From 194f7b25ec96b8be9ee9900e7510856db186c0bc Mon Sep 17 00:00:00 2001 From: niels Date: Mon, 28 Sep 2020 16:18:02 +0200 Subject: [PATCH] release v1.5.0 --- README.md | 292 +++++++++++++++++++++++++++---------- dist/scheduler-card.js | 300 +++++++++++++++++++-------------------- src/config-validation.ts | 107 ++++++++++---- src/const.ts | 2 +- src/scheduler-card.ts | 1 + 5 files changed, 444 insertions(+), 258 deletions(-) diff --git a/README.md b/README.md index c085c512..1282aef2 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,16 @@ - [Choosing the days](#choosing-the-days) - [Choosing the time](#choosing-the-time) - [Configuration](#configuration) - - [General](#general) - - [About the standard configuration](#about-the-standard-configuration) + - [Introduction](#introduction-1) + - [Overview](#overview) + - [Quick start guide: using the standard configuration](#quick-start-guide-using-the-standard-configuration) + - [Adding a domain](#adding-a-domain) + - [Removing a domain](#removing-a-domain) + - [Adding or removing specific entities](#adding-or-removing-specific-entities) + - [Schedule discovery](#schedule-discovery) + - [Using multiple cards](#using-multiple-cards) + - [Step 1: Make sure your configuration has no overlap](#step-1-make-sure-your-configuration-has-no-overlap) + - [Step 2: Disable the schedule discovery](#step-2-disable-the-schedule-discovery) - [Domains](#domains) - [Options](#options) - [Examples](#examples) @@ -20,14 +28,13 @@ - [Examples](#examples-1) - [Actions](#actions) - [Options](#options-2) - - [Action variables](#action-variables) - - [Examples](#examples-2) + - [Numeric action variable](#numeric-action-variable) + - [List action variable](#list-action-variable) - [Groups](#groups) - [Options](#options-3) - - [Examples](#examples-3) + - [Examples](#examples-2) - [Translations](#translations) - [FAQ](#faq) - - [*Can I set the card to Fahrenheit instead of Celsius?*](#can-i-set-the-card-to-fahrenheit-instead-of-celsius) - [*Can I make a schedule that checks a condition before executing the action?*](#can-i-make-a-schedule-that-checks-a-condition-before-executing-the-action) - [*How do i check which version i am using?*](#how-do-i-check-which-version-i-am-using) - [*How do I fix error 'Failed to call service scheduler/add. Service not found.' ?*](#how-do-i-fix-error-failed-to-call-service-scheduleradd-service-not-found-) @@ -160,7 +167,6 @@ choose your own days. A list with all days of the week appears. You can select o #### Choosing the time -:round_pushpin: Updated in v1.3.0. May contain bugs. The time at which you want schedule to be activated can be set using the timepicker. @@ -188,10 +194,25 @@ Also here, buttons can be clicked to toggle. --- ## Configuration -### General -Configuration is not mandatory. -Out of the box, the card should already find most of your HA entities and provide some basic actions for each. -If you want to modify which entities and/or actions can be used, then keep reading. + + +### Introduction +The configuration of the card is in yaml. +Currently there is no UI editor provided (this may change in the future). + +_Configuration is not necessary_, it is only used for customization. + +The card includes a _standard configuration_. +It is intended to make setting up the card easy. +The standard configuration consists of the following: +* Discovery of devices (entities) of various types in your HA config and making them available for creating schedules +* Defining actions per entity based on their capabilities +* Icons for groups, entities and actions + +:warning: **Tip**: If you want to define your own configuration, provide `standard_configuration:false` to disable it completely. + + +### Overview | Name | Type | Default | Available from | Description | | ---------------------- | ----------------- | ------------ | -------------- | ------------------------------------------------------------------------------------------------------------------------------------ | @@ -207,47 +228,59 @@ If you want to modify which entities and/or actions can be used, then keep readi :warning: **Tip**: It is possible to use multiple scheduler-cards in your HA config. In this case it is recommended to set `discover_existing:false` and `standard_configuration:false` in both cards to avoid duplicates. -#### About the standard configuration -The standard configuration is intended to help you started without needing coding (yaml) skills. +### Quick start guide: using the standard configuration -Included in the standard configuration: -| Device type/domain | Supported actions | Remarks | -| ------------------ | ------------------------------------ | ------------------------------------------------ | -| light | *Turn on*
*Turn off* | Brightness is configurable from 0-100%

| -| switch | *Turn on*
*Turn off* | -| cover | *Open*
*Close*
*Set position* |

Position is configurable from 0-100% | -| climate | *Set temperature*
*Turn off* | Temperature is configurable from 10-30C

| -| fan | *Turn on*
*Turn off* | +By default, the card will show your `climate`, `cover`, `fan`, `light`, `switch` entities. +These types are called _domains_ in HA and thus are referred to as _domains_ configuration in the card. -Are you missing something that should be long in the standard configuration? [Let me know](https://github.com/nielsfaber/scheduler-card/issues) +The standard configuration has the same effect as putting the following in your card: +```yaml +domains: + climate: + cover: + fan: + light: + switch: +``` +If you don't like this set of devices, you can make changes to it. -### Domains -With the `domains` configuration you can specify configuration options for multiple HA entities of the same type (domain). +#### Adding a domain -#### Options +You can add `:` to include additional domains to the standard configuration. -:warning: **Tip**: By default, ALL entities that you have in HA under the configured domain will show up in the card. If you don't want this, then use `include` or `exclude` option to filter the entity_ids that you want to add. +Example: *"I would like to be able to run `script`s with the scheduler"* -| Name | Type | Default | Description | -| ------- | ------ | ------------ | -------------------------------------------------------------------------- | -| domain | key | **Required** | Entity domain from home assistant | -| actions | list | none | See [actions](#actions) | -| icon | string | none | Displayed icon for entities in the domain (overwrites HA config) | -| include | list | none | Filter the entities for this domain, only add the entity_ids in this list | -| exclude | list | none | Filter the entities for this domain, leave out the entity_ids in this list | +```yaml +domains: + script: +``` +:warning: **Note**: Not all entity types are currently supported by the standard configuration. If you are missing something, you can make a [feature request](https://github.com/nielsfaber/scheduler-card/issues) for it. +#### Removing a domain +You can use `:false` to exclude it from the standard configuration. +Example: *"I don't want `fan` entities to show up, but the others can stay"* -#### Examples -Scenario: *"I want to be able to turn on/off all the lamps in my house"* ```yaml domains: - light: - actions: - - service: turn_on - - service: turn_off + fan: false ``` +:warning: **Note**: This notation is only applicable for `climate`, `cover`, `fan`, `light`, `switch`, since they are included by default. + + +#### Adding or removing specific entities + +If you don't want to have the complete list of all entities in that domain, there are two options for achieving this: +1. By applying filtering to the domain +2. By providing `entities` configuration + + +If you don't want to customize specific entities (changing the displayed name/icon, showing specific actions), it's best to use the domain filtering. + +Domain filtering is done using the `include` and `exclude` options options. +With `include` you can specify which entities to add and with `exclude` you can specify which entities to hide. +You shouldn't use them together. Scenario: *“I have a lot of lights in my house, but i only want to control some of them with the scheduler.”* @@ -274,6 +307,92 @@ domain: # rest of domain config (actions, icon, ...) ``` + +### Schedule discovery + +The card checks for the created schedules in your HA config and show them in the overview page. + +The schedule discovery is a feature that will ensure that **all** your schedules will be there. + +What is the benefit of this feature? + +It could occur that you make changes in the configuration, resulting in previously created schedules to become hidden. +For example, you made a schedule for controlling a `fan`. +The day after you decide to remove the `fan` domain from the card. But you forgot to delete the previously created schedule. + +Without the discovery, you now have a schedule that is hidden from the card, but will keep running. You cannot remove or change it anymore (unless via the HA configuration panel). + +Discovery makes sure that you will always find it back in the card. +The feature can be turned on/off through the `discover_existing` option. + +For your protection, it is enabled by default. + + + +### Using multiple cards + +It is possible to use multiple scheduler-cards in your Lovelace configuration. + +For doing this, you can follow these steps. + +#### Step 1: Make sure your configuration has no overlap + +The easiest way to split is to split by _domain_. But it is also possible to make different grouping (for example by room): make use of the `entities` configuration (or domain filtering) if so. + +Example: *"I want one card for lights, and one card for thermostats."* + +Apply filtering to the _standard configuration_, to hide the domains that you don't want to see. + +Card one (only has `light` enabled): +```yaml +title: "My lights" +domains: + climate: false + cover: false + fan: false + switch: false +``` +Card two (only has `climate` enabled): +```yaml +title: "My thermostats" +domains: + cover: false + fan: false + light: false + switch: false +``` + +#### Step 2: Disable the schedule discovery +If you have multiple cards defined, you don't want the running schedules to appear twice. + +Provide `discover_existing:false` to both cards, to prevent the unwanted schedules to show up. Only schedules matching your `domain`/`entities` configuration will show up. + +### Domains +With the `domains` configuration you can specify configuration options for multiple HA entities of the same type (domain). + +#### Options + +:warning: **Tip**: By default, ALL entities that you have in HA under the configured domain will show up in the card. If you don't want this, then use `include` or `exclude` option to filter the entity_ids that you want to add. + +| Name | Type | Default | Description | +| ------- | ------ | ------------ | -------------------------------------------------------------------------- | +| domain | key | **Required** | Entity domain from home assistant | +| actions | list | none | See [actions](#actions) | +| icon | string | none | Displayed icon for entities in the domain (overwrites HA config) | +| include | list | none | Filter the entities for this domain, only add the entity_ids in this list | +| exclude | list | none | Filter the entities for this domain, leave out the entity_ids in this list | + + +#### Examples +Scenario: *"I want to be able to turn on/off all the lamps in my house"* +```yaml +domains: + light: + actions: + - service: turn_on + - service: turn_off +``` + ### Entities With the `entities` configuration you can specify configuration for specific HA entities. @@ -327,29 +446,24 @@ Actions are linked to their entities, so the entity ID is sent together with the :warning: **Note**: Templates (jinja code) are not supported at this point. -#### Action variables - -:round_pushpin: Introduced in v1.2.6 +#### Numeric action variable Some devices allow to operate on a variable working point. For example lights can be dimmed with a `brightness`, fans can spin at a `speed` etc. By providing an action variable, the card allows you to choose the setting you want to apply with the action. -| Name | Type | Default | Description | -| --------------- | ------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| field | string | **Required** | field name in the `service_data` that is represented by this variable | -| name | string | same as field | Name under which the variable is visible in the card | -| unit | string | " " | Displayed unit | -| min | number | 0 | Minimum value that can be set | -| max | number | 255 | Maximum value that can be set | -| step | number | 1 | Step size | -| optional | boolean | false | Setting the variable is optional, the action can also be executed without this variable.
If `optional:true` is provided, a checkbox will be shown that needs to be selected to apply the variable | -| show_percentage | boolean | false | Show slider in percentage instead of from min to max. | - +| Name | Type | Default | Description | +| ------------------- | ----------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| field | string | **Required** | field name in the `service_data` that is represented by this variable | +| name | string | same as field | Name under which the variable is visible in the card | +| unit | string | " " | Displayed unit | +| min | number | 0 | Minimum value that can be set. If not provided, it will be read from the entity attributes. | +| max | number | 255 | Maximum value that can be set. If not provided, it will be read from the entity attributes. | +| step | number | 1 | Step size | +| optional | boolean | false | Setting the variable is optional, the action can also be executed without this variable.
If `optional:true` is provided, a checkbox will be shown that needs to be selected to apply the variable | +| ~~show_percentage~~ | ~~boolean~~ | ~~false~~ | This option is removed in v1.5.0. Use '%' as unit instead. | -:warning: **Note**: At this point it is only possible to use a single action variable per action. The variable *is required* to be numeric. - -#### Examples +**Example** The Xiaomi Air Purifier can be controlled using the [xiaomi miio](https://www.home-assistant.io/integrations/xiaomi_miio/#service-xiaomi_miiofan_set_favorite_level-air-purifiers-only) integration. To be able to set the speed of this device in your action, you can use: @@ -366,15 +480,60 @@ You can now select the speed for this action in the schedule editor: ![action variable example](https://github.com/nielsfaber/scheduler-card/blob/master/screenshots/action_variable_example.png?raw=true) +#### List action variable + +With some actions, you can provide an option from a limited list of options. +For example, setting the value of an `input_select`, but also the operation mode of a thermostat. + +By providing the list variable, the card allows you to choose the option when you set up the action. + +| Name | Type | Default | Description | +| -------- | ------ | ------------- | ----------------------------------------------------------------------------- | +| field | string | **Required** | field name in the `service_data` that is represented by this variable | +| name | string | same as field | Name under which the variable is visible in the card | +| options | list | **Required** | List of options to choose from | +| -- value | string | **Required** | Option value (which is passed with together with the field as `service_data`) | +| -- name | string | same as value | Name to show for the option | +| -- icon | string | none | Icon to show with the option | + +**Example** + +Setting the operation mode of a thermostat. + +Note that this configuration will already be set up when using _standard configuration_. + +```yaml + entities: + climate.my_thermostat: + name: My thermostat + icon: thermometer + actions: + - service: set_hvac_mode + name: Set mode + icon: + variable: + field: hvac_mode + name: Operation mode + options: + - value: heat + icon: fire + - value: cool + icon: snowflake + - value: 'off' + icon: power +``` +Now the list of options become visible when you set up the action: + +![action variable example](https://github.com/nielsfaber/scheduler-card/blob/master/screenshots/action_variable_list_example.png?raw=true) + ### Groups The `groups` configuration provides the capability of organizing the entities. +They have nothing to do with the [group](https://www.home-assistant.io/integrations/group/) integration in Home Assistant. #### Options :warning: **Tip**: The card will automatically create groups based on the domains of the entities in your configuration. If you're OK with this, you don't need to configure `groups`. -:warning: **Warning**: Make sure that the `entities` and `domains` in your groups are also included in their specific configurations, else they will not show up. - | Name | Type | Default | Description | | -------- | ------ | ------------------ | ----------------------------------------------- | | group_id | key | **Required** | Identifier for group | @@ -427,23 +586,6 @@ If you are missing a translation, or a translation needs to be improved, please --- ## FAQ -### *Can I set the card to Fahrenheit instead of Celsius?* - -The standard configuration uses Celsius as unit. If you prefer Fahrenheit, then simply overwrite it. -``` -domains: - climate: - icon: thermometer - actions: - - service: set_temperature - variable: - field: temperature - unit: "F" - min: 50 - max: 80 -``` -
- ### *Can I make a schedule that checks a condition before executing the action?* From within the _scheduler-card_, there is unfortunately no such functionality in place. diff --git a/dist/scheduler-card.js b/dist/scheduler-card.js index 5991c019..77408337 100644 --- a/dist/scheduler-card.js +++ b/dist/scheduler-card.js @@ -12,7 +12,7 @@ See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. - ***************************************************************************** */function t(e,t,r,a){var i,s=arguments.length,n=s<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,r):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,r,a);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(n=(s<3?i(n):s>3?i(t,r,n):i(t,r))||n);return s>3&&n&&Object.defineProperty(t,r,n),n + ***************************************************************************** */function t(e,t,r,a){var s,i=arguments.length,o=i<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,r):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,a);else for(var n=e.length-1;n>=0;n--)(s=e[n])&&(o=(i<3?s(o):i>3?s(t,r,o):s(t,r))||o);return i>3&&o&&Object.defineProperty(t,r,o),o /** * @license * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. @@ -25,7 +25,7 @@ * Code distributed by Google as part of the polymer project is also * subject to an additional IP rights grant found at * http://polymer.github.io/PATENTS.txt - */}const r="undefined"!=typeof window&&null!=window.customElements&&void 0!==window.customElements.polyfillWrapFlushCallback,a=(e,t,r=null)=>{for(;t!==r;){const r=t.nextSibling;e.removeChild(t),t=r}},i=`{{lit-${String(Math.random()).slice(2)}}}`,s=`\x3c!--${i}--\x3e`,n=new RegExp(`${i}|${s}`);class o{constructor(e,t){this.parts=[],this.element=t;const r=[],a=[],s=document.createTreeWalker(t.content,133,null,!1);let o=0,c=-1,h=0;const{strings:p,values:{length:f}}=e;for(;h0;){const t=p[h],r=d.exec(t)[2],a=r.toLowerCase()+"$lit$",i=e.getAttribute(a);e.removeAttribute(a);const s=i.split(n);this.parts.push({type:"attribute",index:c,name:r,strings:s}),h+=s.length-1}}"TEMPLATE"===e.tagName&&(a.push(e),s.currentNode=e.content)}else if(3===e.nodeType){const t=e.data;if(t.indexOf(i)>=0){const a=e.parentNode,i=t.split(n),s=i.length-1;for(let t=0;t{const r=e.length-t.length;return r>=0&&e.slice(r)===t},c=e=>-1!==e.index,u=()=>document.createComment(""),d=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function h(e,t){const{element:{content:r},parts:a}=e,i=document.createTreeWalker(r,133,null,!1);let s=f(a),n=a[s],o=-1,l=0;const c=[];let u=null;for(;i.nextNode();){o++;const e=i.currentNode;for(e.previousSibling===u&&(u=null),t.has(e)&&(c.push(e),null===u&&(u=e)),null!==u&&l++;void 0!==n&&n.index===o;)n.index=null!==u?-1:n.index-l,s=f(a,s),n=a[s]}c.forEach(e=>e.parentNode.removeChild(e))}const p=e=>{let t=11===e.nodeType?0:1;const r=document.createTreeWalker(e,133,null,!1);for(;r.nextNode();)t++;return t},f=(e,t=-1)=>{for(let r=t+1;r{for(;t!==r;){const r=t.nextSibling;e.removeChild(t),t=r}},s=`{{lit-${String(Math.random()).slice(2)}}}`,i=`\x3c!--${s}--\x3e`,o=new RegExp(`${s}|${i}`);class n{constructor(e,t){this.parts=[],this.element=t;const r=[],a=[],i=document.createTreeWalker(t.content,133,null,!1);let n=0,c=-1,h=0;const{strings:p,values:{length:m}}=e;for(;h0;){const t=p[h],r=u.exec(t)[2],a=r.toLowerCase()+"$lit$",s=e.getAttribute(a);e.removeAttribute(a);const i=s.split(o);this.parts.push({type:"attribute",index:c,name:r,strings:i}),h+=i.length-1}}"TEMPLATE"===e.tagName&&(a.push(e),i.currentNode=e.content)}else if(3===e.nodeType){const t=e.data;if(t.indexOf(s)>=0){const a=e.parentNode,s=t.split(o),i=s.length-1;for(let t=0;t{const r=e.length-t.length;return r>=0&&e.slice(r)===t},c=e=>-1!==e.index,d=()=>document.createComment(""),u=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function h(e,t){const{element:{content:r},parts:a}=e,s=document.createTreeWalker(r,133,null,!1);let i=m(a),o=a[i],n=-1,l=0;const c=[];let d=null;for(;s.nextNode();){n++;const e=s.currentNode;for(e.previousSibling===d&&(d=null),t.has(e)&&(c.push(e),null===d&&(d=e)),null!==d&&l++;void 0!==o&&o.index===n;)o.index=null!==d?-1:o.index-l,i=m(a,i),o=a[i]}c.forEach(e=>e.parentNode.removeChild(e))}const p=e=>{let t=11===e.nodeType?0:1;const r=document.createTreeWalker(e,133,null,!1);for(;r.nextNode();)t++;return t},m=(e,t=-1)=>{for(let r=t+1;r"function"==typeof e&&m.has(e),y={},g={}; +const f=new WeakMap,v=e=>"function"==typeof e&&f.has(e),y={},g={}; /** * @license * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. @@ -53,7 +53,7 @@ const m=new WeakMap,v=e=>"function"==typeof e&&m.has(e),y={},g={}; * subject to an additional IP rights grant found at * http://polymer.github.io/PATENTS.txt */ -class b{constructor(e,t,r){this.__parts=[],this.template=e,this.processor=t,this.options=r}update(e){let t=0;for(const r of this.__parts)void 0!==r&&r.setValue(e[t]),t++;for(const e of this.__parts)void 0!==e&&e.commit()}_clone(){const e=r?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),t=[],a=this.template.parts,i=document.createTreeWalker(e,133,null,!1);let s,n=0,o=0,l=i.nextNode();for(;ne}),w=` ${i} `;class P{constructor(e,t,r,a){this.strings=e,this.values=t,this.type=r,this.processor=a}getHTML(){const e=this.strings.length-1;let t="",r=!1;for(let a=0;a-1||r)&&-1===e.indexOf("--\x3e",n+1);const o=d.exec(e);t+=null===o?e+(r?w:s):e.substr(0,o.index)+o[1]+o[2]+"$lit$"+o[3]+i}return t+=this.strings[e],t}getTemplateElement(){const e=document.createElement("template");let t=this.getHTML();return void 0!==_&&(t=_.createHTML(t)),e.innerHTML=t,e}} + */const b=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:e=>e}),w=` ${s} `;class P{constructor(e,t,r,a){this.strings=e,this.values=t,this.type=r,this.processor=a}getHTML(){const e=this.strings.length-1;let t="",r=!1;for(let a=0;a-1||r)&&-1===e.indexOf("--\x3e",o+1);const n=u.exec(e);t+=null===n?e+(r?w:i):e.substr(0,n.index)+n[1]+n[2]+"$lit$"+n[3]+s}return t+=this.strings[e],t}getTemplateElement(){const e=document.createElement("template");let t=this.getHTML();return void 0!==b&&(t=b.createHTML(t)),e.innerHTML=t,e}} /** * @license * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. @@ -79,7 +79,7 @@ class b{constructor(e,t,r){this.__parts=[],this.template=e,this.processor=t,this * Code distributed by Google as part of the polymer project is also * subject to an additional IP rights grant found at * http://polymer.github.io/PATENTS.txt - */const E=e=>null===e||!("object"==typeof e||"function"==typeof e),S=e=>Array.isArray(e)||!(!e||!e[Symbol.iterator]);class x{constructor(e,t,r){this.dirty=!0,this.element=e,this.name=t,this.strings=r,this.parts=[];for(let e=0;e{try{const e={get capture(){return C=!0,!1}};window.addEventListener("test",e,e),window.removeEventListener("test",e,e)}catch(e){}})();class F{constructor(e,t,r){this.value=void 0,this.__pendingValue=void 0,this.element=e,this.eventName=t,this.eventContext=r,this.__boundHandleEvent=e=>this.handleEvent(e)}setValue(e){this.__pendingValue=e}commit(){for(;v(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=y,e(this)}if(this.__pendingValue===y)return;const e=this.__pendingValue,t=this.value,r=null==e||null!=t&&(e.capture!==t.capture||e.once!==t.once||e.passive!==t.passive),a=null!=e&&(null==t||r);r&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),a&&(this.__options=D(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=y}handleEvent(e){"function"==typeof this.value?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}}const D=e=>e&&(C?{capture:e.capture,passive:e.passive,once:e.once}:e.capture) + */const S=e=>null===e||!("object"==typeof e||"function"==typeof e),E=e=>Array.isArray(e)||!(!e||!e[Symbol.iterator]);class x{constructor(e,t,r){this.dirty=!0,this.element=e,this.name=t,this.strings=r,this.parts=[];for(let e=0;e{try{const e={get capture(){return A=!0,!1}};window.addEventListener("test",e,e),window.removeEventListener("test",e,e)}catch(e){}})();class F{constructor(e,t,r){this.value=void 0,this.__pendingValue=void 0,this.element=e,this.eventName=t,this.eventContext=r,this.__boundHandleEvent=e=>this.handleEvent(e)}setValue(e){this.__pendingValue=e}commit(){for(;v(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=y,e(this)}if(this.__pendingValue===y)return;const e=this.__pendingValue,t=this.value,r=null==e||null!=t&&(e.capture!==t.capture||e.once!==t.once||e.passive!==t.passive),a=null!=e&&(null==t||r);r&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),a&&(this.__options=D(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=y}handleEvent(e){"function"==typeof this.value?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}}const D=e=>e&&(A?{capture:e.capture,passive:e.passive,once:e.once}:e.capture) /** * @license * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. @@ -92,7 +92,7 @@ class b{constructor(e,t,r){this.__parts=[],this.template=e,this.processor=t,this * Code distributed by Google as part of the polymer project is also * subject to an additional IP rights grant found at * http://polymer.github.io/PATENTS.txt - */;function z(e){let t=R.get(e.type);void 0===t&&(t={stringsArray:new WeakMap,keyString:new Map},R.set(e.type,t));let r=t.stringsArray.get(e.strings);if(void 0!==r)return r;const a=e.strings.join(i);return r=t.keyString.get(a),void 0===r&&(r=new o(e,e.getTemplateElement()),t.keyString.set(a,r)),t.stringsArray.set(e.strings,r),r}const R=new Map,T=new WeakMap; + */;function R(e){let t=z.get(e.type);void 0===t&&(t={stringsArray:new WeakMap,keyString:new Map},z.set(e.type,t));let r=t.stringsArray.get(e.strings);if(void 0!==r)return r;const a=e.strings.join(s);return r=t.keyString.get(a),void 0===r&&(r=new n(e,e.getTemplateElement()),t.keyString.set(a,r)),t.stringsArray.set(e.strings,r),r}const z=new Map,I=new WeakMap; /** * @license * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. @@ -105,7 +105,7 @@ class b{constructor(e,t,r){this.__parts=[],this.template=e,this.processor=t,this * Code distributed by Google as part of the polymer project is also * subject to an additional IP rights grant found at * http://polymer.github.io/PATENTS.txt - */const I=new + */const N=new /** * @license * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. @@ -119,7 +119,7 @@ class b{constructor(e,t,r){this.__parts=[],this.template=e,this.processor=t,this * subject to an additional IP rights grant found at * http://polymer.github.io/PATENTS.txt */ -class{handleAttributeExpressions(e,t,r,a){const i=t[0];if("."===i){return new k(e,t.slice(1),r).parts}if("@"===i)return[new F(e,t.slice(1),a.eventContext)];if("?"===i)return[new O(e,t.slice(1),r)];return new x(e,t,r).parts}handleTextExpression(e){return new $(e)}}; +class{handleAttributeExpressions(e,t,r,a){const s=t[0];if("."===s){return new O(e,t.slice(1),r).parts}if("@"===s)return[new F(e,t.slice(1),a.eventContext)];if("?"===s)return[new k(e,t.slice(1),r)];return new x(e,t,r).parts}handleTextExpression(e){return new j(e)}}; /** * @license * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. @@ -132,7 +132,7 @@ class{handleAttributeExpressions(e,t,r,a){const i=t[0];if("."===i){return new k( * Code distributed by Google as part of the polymer project is also * subject to an additional IP rights grant found at * http://polymer.github.io/PATENTS.txt - */"undefined"!=typeof window&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0");const N=(e,...t)=>new P(e,t,"html",I) + */"undefined"!=typeof window&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0");const T=(e,...t)=>new P(e,t,"html",N) /** * @license * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. @@ -145,7 +145,7 @@ class{handleAttributeExpressions(e,t,r,a){const i=t[0];if("."===i){return new k( * Code distributed by Google as part of the polymer project is also * subject to an additional IP rights grant found at * http://polymer.github.io/PATENTS.txt - */,U=(e,t)=>`${e}--${t}`;let L=!0;void 0===window.ShadyCSS?L=!1:void 0===window.ShadyCSS.prepareTemplateDom&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),L=!1);const q=e=>t=>{const r=U(t.type,e);let a=R.get(r);void 0===a&&(a={stringsArray:new WeakMap,keyString:new Map},R.set(r,a));let s=a.stringsArray.get(t.strings);if(void 0!==s)return s;const n=t.strings.join(i);if(s=a.keyString.get(n),void 0===s){const r=t.getTemplateElement();L&&window.ShadyCSS.prepareTemplateDom(r,e),s=new o(t,r),a.keyString.set(n,s)}return a.stringsArray.set(t.strings,s),s},V=["html","svg"],M=new Set,H=(e,t,r)=>{M.add(e);const a=r?r.element:document.createElement("template"),i=t.querySelectorAll("style"),{length:s}=i;if(0===s)return void window.ShadyCSS.prepareTemplateStyles(a,e);const n=document.createElement("style");for(let e=0;e{V.forEach(t=>{const r=R.get(U(t,e));void 0!==r&&r.keyString.forEach(e=>{const{element:{content:t}}=e,r=new Set;Array.from(t.querySelectorAll("style")).forEach(e=>{r.add(e)}),h(e,r)})})})(e);const o=a.content;r?function(e,t,r=null){const{element:{content:a},parts:i}=e;if(null==r)return void a.appendChild(t);const s=document.createTreeWalker(a,133,null,!1);let n=f(i),o=0,l=-1;for(;s.nextNode();){l++;for(s.currentNode===r&&(o=p(t),r.parentNode.insertBefore(t,r));-1!==n&&i[n].index===l;){if(o>0){for(;-1!==n;)i[n].index+=o,n=f(i,n);return}n=f(i,n)}}}(r,n,o.firstChild):o.insertBefore(n,o.firstChild),window.ShadyCSS.prepareTemplateStyles(a,e);const l=o.querySelector("style");if(window.ShadyCSS.nativeShadow&&null!==l)t.insertBefore(l.cloneNode(!0),t.firstChild);else if(r){o.insertBefore(n,o.firstChild);const e=new Set;e.add(n),h(r,e)}};window.JSCompiler_renameProperty=(e,t)=>e;const Q={toAttribute(e,t){switch(t){case Boolean:return e?"":null;case Object:case Array:return null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){switch(t){case Boolean:return null!==e;case Number:return null===e?null:Number(e);case Object:case Array:return JSON.parse(e)}return e}},B=(e,t)=>t!==e&&(t==t||e==e),G={attribute:!0,type:String,converter:Q,reflect:!1,hasChanged:B};class K extends HTMLElement{constructor(){super(),this.initialize()}static get observedAttributes(){this.finalize();const e=[];return this._classProperties.forEach((t,r)=>{const a=this._attributeNameForProperty(r,t);void 0!==a&&(this._attributeToPropertyMap.set(a,r),e.push(a))}),e}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;const e=Object.getPrototypeOf(this)._classProperties;void 0!==e&&e.forEach((e,t)=>this._classProperties.set(t,e))}}static createProperty(e,t=G){if(this._ensureClassProperties(),this._classProperties.set(e,t),t.noAccessor||this.prototype.hasOwnProperty(e))return;const r="symbol"==typeof e?Symbol():"__"+e,a=this.getPropertyDescriptor(e,r,t);void 0!==a&&Object.defineProperty(this.prototype,e,a)}static getPropertyDescriptor(e,t,r){return{get(){return this[t]},set(a){const i=this[e];this[t]=a,this.requestUpdateInternal(e,i,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this._classProperties&&this._classProperties.get(e)||G}static finalize(){const e=Object.getPrototypeOf(this);if(e.hasOwnProperty("finalized")||e.finalize(),this.finalized=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){const e=this.properties,t=[...Object.getOwnPropertyNames(e),..."function"==typeof Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e):[]];for(const r of t)this.createProperty(r,e[r])}}static _attributeNameForProperty(e,t){const r=t.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof e?e.toLowerCase():void 0}static _valueHasChanged(e,t,r=B){return r(e,t)}static _propertyValueFromAttribute(e,t){const r=t.type,a=t.converter||Q,i="function"==typeof a?a:a.fromAttribute;return i?i(e,r):e}static _propertyValueToAttribute(e,t){if(void 0===t.reflect)return;const r=t.type,a=t.converter;return(a&&a.toAttribute||Q.toAttribute)(e,r)}initialize(){this._updateState=0,this._updatePromise=new Promise(e=>this._enableUpdatingResolver=e),this._changedProperties=new Map,this._saveInstanceProperties(),this.requestUpdateInternal()}_saveInstanceProperties(){this.constructor._classProperties.forEach((e,t)=>{if(this.hasOwnProperty(t)){const e=this[t];delete this[t],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(t,e)}})}_applyInstanceProperties(){this._instanceProperties.forEach((e,t)=>this[t]=e),this._instanceProperties=void 0}connectedCallback(){this.enableUpdating()}enableUpdating(){void 0!==this._enableUpdatingResolver&&(this._enableUpdatingResolver(),this._enableUpdatingResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(e,t,r){t!==r&&this._attributeToProperty(e,r)}_propertyToAttribute(e,t,r=G){const a=this.constructor,i=a._attributeNameForProperty(e,r);if(void 0!==i){const e=a._propertyValueToAttribute(t,r);if(void 0===e)return;this._updateState=8|this._updateState,null==e?this.removeAttribute(i):this.setAttribute(i,e),this._updateState=-9&this._updateState}}_attributeToProperty(e,t){if(8&this._updateState)return;const r=this.constructor,a=r._attributeToPropertyMap.get(e);if(void 0!==a){const e=r.getPropertyOptions(a);this._updateState=16|this._updateState,this[a]=r._propertyValueFromAttribute(t,e),this._updateState=-17&this._updateState}}requestUpdateInternal(e,t,r){let a=!0;if(void 0!==e){const i=this.constructor;r=r||i.getPropertyOptions(e),i._valueHasChanged(this[e],t,r.hasChanged)?(this._changedProperties.has(e)||this._changedProperties.set(e,t),!0!==r.reflect||16&this._updateState||(void 0===this._reflectingProperties&&(this._reflectingProperties=new Map),this._reflectingProperties.set(e,r))):a=!1}!this._hasRequestedUpdate&&a&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(e,t){return this.requestUpdateInternal(e,t),this.updateComplete}async _enqueueUpdate(){this._updateState=4|this._updateState;try{await this._updatePromise}catch(e){}const e=this.performUpdate();return null!=e&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return 4&this._updateState}get hasUpdated(){return 1&this._updateState}performUpdate(){if(!this._hasRequestedUpdate)return;this._instanceProperties&&this._applyInstanceProperties();let e=!1;const t=this._changedProperties;try{e=this.shouldUpdate(t),e?this.update(t):this._markUpdated()}catch(t){throw e=!1,this._markUpdated(),t}e&&(1&this._updateState||(this._updateState=1|this._updateState,this.firstUpdated(t)),this.updated(t))}_markUpdated(){this._changedProperties=new Map,this._updateState=-5&this._updateState}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this._updatePromise}shouldUpdate(e){return!0}update(e){void 0!==this._reflectingProperties&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach((e,t)=>this._propertyToAttribute(t,this[t],e)),this._reflectingProperties=void 0),this._markUpdated()}updated(e){}firstUpdated(e){}}K.finalized=!0; + */,L=(e,t)=>`${e}--${t}`;let V=!0;void 0===window.ShadyCSS?V=!1:void 0===window.ShadyCSS.prepareTemplateDom&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),V=!1);const q=e=>t=>{const r=L(t.type,e);let a=z.get(r);void 0===a&&(a={stringsArray:new WeakMap,keyString:new Map},z.set(r,a));let i=a.stringsArray.get(t.strings);if(void 0!==i)return i;const o=t.strings.join(s);if(i=a.keyString.get(o),void 0===i){const r=t.getTemplateElement();V&&window.ShadyCSS.prepareTemplateDom(r,e),i=new n(t,r),a.keyString.set(o,i)}return a.stringsArray.set(t.strings,i),i},U=["html","svg"],M=new Set,Q=(e,t,r)=>{M.add(e);const a=r?r.element:document.createElement("template"),s=t.querySelectorAll("style"),{length:i}=s;if(0===i)return void window.ShadyCSS.prepareTemplateStyles(a,e);const o=document.createElement("style");for(let e=0;e{U.forEach(t=>{const r=z.get(L(t,e));void 0!==r&&r.keyString.forEach(e=>{const{element:{content:t}}=e,r=new Set;Array.from(t.querySelectorAll("style")).forEach(e=>{r.add(e)}),h(e,r)})})})(e);const n=a.content;r?function(e,t,r=null){const{element:{content:a},parts:s}=e;if(null==r)return void a.appendChild(t);const i=document.createTreeWalker(a,133,null,!1);let o=m(s),n=0,l=-1;for(;i.nextNode();){l++;for(i.currentNode===r&&(n=p(t),r.parentNode.insertBefore(t,r));-1!==o&&s[o].index===l;){if(n>0){for(;-1!==o;)s[o].index+=n,o=m(s,o);return}o=m(s,o)}}}(r,o,n.firstChild):n.insertBefore(o,n.firstChild),window.ShadyCSS.prepareTemplateStyles(a,e);const l=n.querySelector("style");if(window.ShadyCSS.nativeShadow&&null!==l)t.insertBefore(l.cloneNode(!0),t.firstChild);else if(r){n.insertBefore(o,n.firstChild);const e=new Set;e.add(o),h(r,e)}};window.JSCompiler_renameProperty=(e,t)=>e;const H={toAttribute(e,t){switch(t){case Boolean:return e?"":null;case Object:case Array:return null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){switch(t){case Boolean:return null!==e;case Number:return null===e?null:Number(e);case Object:case Array:return JSON.parse(e)}return e}},G=(e,t)=>t!==e&&(t==t||e==e),K={attribute:!0,type:String,converter:H,reflect:!1,hasChanged:G};class B extends HTMLElement{constructor(){super(),this.initialize()}static get observedAttributes(){this.finalize();const e=[];return this._classProperties.forEach((t,r)=>{const a=this._attributeNameForProperty(r,t);void 0!==a&&(this._attributeToPropertyMap.set(a,r),e.push(a))}),e}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;const e=Object.getPrototypeOf(this)._classProperties;void 0!==e&&e.forEach((e,t)=>this._classProperties.set(t,e))}}static createProperty(e,t=K){if(this._ensureClassProperties(),this._classProperties.set(e,t),t.noAccessor||this.prototype.hasOwnProperty(e))return;const r="symbol"==typeof e?Symbol():"__"+e,a=this.getPropertyDescriptor(e,r,t);void 0!==a&&Object.defineProperty(this.prototype,e,a)}static getPropertyDescriptor(e,t,r){return{get(){return this[t]},set(a){const s=this[e];this[t]=a,this.requestUpdateInternal(e,s,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this._classProperties&&this._classProperties.get(e)||K}static finalize(){const e=Object.getPrototypeOf(this);if(e.hasOwnProperty("finalized")||e.finalize(),this.finalized=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){const e=this.properties,t=[...Object.getOwnPropertyNames(e),..."function"==typeof Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e):[]];for(const r of t)this.createProperty(r,e[r])}}static _attributeNameForProperty(e,t){const r=t.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof e?e.toLowerCase():void 0}static _valueHasChanged(e,t,r=G){return r(e,t)}static _propertyValueFromAttribute(e,t){const r=t.type,a=t.converter||H,s="function"==typeof a?a:a.fromAttribute;return s?s(e,r):e}static _propertyValueToAttribute(e,t){if(void 0===t.reflect)return;const r=t.type,a=t.converter;return(a&&a.toAttribute||H.toAttribute)(e,r)}initialize(){this._updateState=0,this._updatePromise=new Promise(e=>this._enableUpdatingResolver=e),this._changedProperties=new Map,this._saveInstanceProperties(),this.requestUpdateInternal()}_saveInstanceProperties(){this.constructor._classProperties.forEach((e,t)=>{if(this.hasOwnProperty(t)){const e=this[t];delete this[t],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(t,e)}})}_applyInstanceProperties(){this._instanceProperties.forEach((e,t)=>this[t]=e),this._instanceProperties=void 0}connectedCallback(){this.enableUpdating()}enableUpdating(){void 0!==this._enableUpdatingResolver&&(this._enableUpdatingResolver(),this._enableUpdatingResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(e,t,r){t!==r&&this._attributeToProperty(e,r)}_propertyToAttribute(e,t,r=K){const a=this.constructor,s=a._attributeNameForProperty(e,r);if(void 0!==s){const e=a._propertyValueToAttribute(t,r);if(void 0===e)return;this._updateState=8|this._updateState,null==e?this.removeAttribute(s):this.setAttribute(s,e),this._updateState=-9&this._updateState}}_attributeToProperty(e,t){if(8&this._updateState)return;const r=this.constructor,a=r._attributeToPropertyMap.get(e);if(void 0!==a){const e=r.getPropertyOptions(a);this._updateState=16|this._updateState,this[a]=r._propertyValueFromAttribute(t,e),this._updateState=-17&this._updateState}}requestUpdateInternal(e,t,r){let a=!0;if(void 0!==e){const s=this.constructor;r=r||s.getPropertyOptions(e),s._valueHasChanged(this[e],t,r.hasChanged)?(this._changedProperties.has(e)||this._changedProperties.set(e,t),!0!==r.reflect||16&this._updateState||(void 0===this._reflectingProperties&&(this._reflectingProperties=new Map),this._reflectingProperties.set(e,r))):a=!1}!this._hasRequestedUpdate&&a&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(e,t){return this.requestUpdateInternal(e,t),this.updateComplete}async _enqueueUpdate(){this._updateState=4|this._updateState;try{await this._updatePromise}catch(e){}const e=this.performUpdate();return null!=e&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return 4&this._updateState}get hasUpdated(){return 1&this._updateState}performUpdate(){if(!this._hasRequestedUpdate)return;this._instanceProperties&&this._applyInstanceProperties();let e=!1;const t=this._changedProperties;try{e=this.shouldUpdate(t),e?this.update(t):this._markUpdated()}catch(t){throw e=!1,this._markUpdated(),t}e&&(1&this._updateState||(this._updateState=1|this._updateState,this.firstUpdated(t)),this.updated(t))}_markUpdated(){this._changedProperties=new Map,this._updateState=-5&this._updateState}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this._updatePromise}shouldUpdate(e){return!0}update(e){void 0!==this._reflectingProperties&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach((e,t)=>this._propertyToAttribute(t,this[t],e)),this._reflectingProperties=void 0),this._markUpdated()}updated(e){}firstUpdated(e){}}B.finalized=!0; /** * @license * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. @@ -183,7 +183,7 @@ const J=e=>t=>"function"==typeof t?((e,t)=>(window.customElements.define(e,t),t) * subject to an additional IP rights grant found at * http://polymer.github.io/PATENTS.txt */ -(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");const re={};class ae extends K{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;const e=this.getStyles();if(Array.isArray(e)){const t=(e,r)=>e.reduceRight((e,r)=>Array.isArray(r)?t(r,e):(e.add(r),e),r),r=t(e,new Set),a=[];r.forEach(e=>a.unshift(e)),this._styles=a}else this._styles=void 0===e?[]:[e];this._styles=this._styles.map(e=>{if(e instanceof CSSStyleSheet&&!Y){const t=Array.prototype.slice.call(e.cssRules).reduce((e,t)=>e+t.cssText,"");return new ee(String(t),X)}return e})}initialize(){super.initialize(),this.constructor._getUniqueStyles(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow({mode:"open"})}adoptStyles(){const e=this.constructor._styles;0!==e.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?Y?this.renderRoot.adoptedStyleSheets=e.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(e.map(e=>e.cssText),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(e){const t=this.render();super.update(e),t!==re&&this.constructor.render(t,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach(e=>{const t=document.createElement("style");t.textContent=e.cssText,this.renderRoot.appendChild(t)}))}render(){return re}}ae.finalized=!0,ae.render=(e,t,r)=>{if(!r||"object"!=typeof r||!r.scopeName)throw new Error("The `scopeName` option is required.");const i=r.scopeName,s=T.has(t),n=L&&11===t.nodeType&&!!t.host,o=n&&!M.has(i),l=o?document.createDocumentFragment():t;if(((e,t,r)=>{let i=T.get(t);void 0===i&&(a(t,t.firstChild),T.set(t,i=new $(Object.assign({templateFactory:z},r))),i.appendInto(t)),i.setValue(e),i.commit()})(e,l,Object.assign({templateFactory:q(i)},r)),o){const e=T.get(l);T.delete(l);const r=e.value instanceof b?e.value.template:void 0;H(i,l,r),a(t,t.firstChild),t.appendChild(l),T.set(t,e)}!s&&n&&window.ShadyCSS.styleElement(t.host)};var ie="object"==typeof global&&global&&global.Object===Object&&global,se="object"==typeof self&&self&&self.Object===Object&&self,ne=ie||se||Function("return this")(),oe=ne.Symbol,le=Object.prototype,ce=le.hasOwnProperty,ue=le.toString,de=oe?oe.toStringTag:void 0;var he=Object.prototype.toString;var pe=oe?oe.toStringTag:void 0;function fe(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":pe&&pe in Object(e)?function(e){var t=ce.call(e,de),r=e[de];try{e[de]=void 0;var a=!0}catch(e){}var i=ue.call(e);return a&&(t?e[de]=r:delete e[de]),i}(e):function(e){return he.call(e)}(e)}function me(e){return null!=e&&"object"==typeof e}function ve(e){return"symbol"==typeof e||me(e)&&"[object Symbol]"==fe(e)}function ye(e,t){for(var r=-1,a=null==e?0:e.length,i=Array(a);++r0){if(++Ze>=800)return arguments[0]}else Ze=0;return We.apply(void 0,arguments)});function tt(e,t){for(var r=-1,a=null==e?0:e.length;++r-1&&e%1==0&&e-1&&e%1==0&&e<=9007199254740991}function vt(e){return null!=e&&mt(e.length)&&!Ae(e)}function yt(e,t,r){if(!Pe(r))return!1;var a=typeof t;return!!("number"==a?vt(r)&&nt(t,r.length):"string"==a&&t in r)&<(r[t],e)}var gt=Object.prototype;function bt(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||gt)}function _t(e){return me(e)&&"[object Arguments]"==fe(e)}var wt=Object.prototype,Pt=wt.hasOwnProperty,Et=wt.propertyIsEnumerable,St=_t(function(){return arguments}())?_t:function(e){return me(e)&&Pt.call(e,"callee")&&!Et.call(e,"callee")};var xt="object"==typeof e&&e&&!e.nodeType&&e,jt=xt&&"object"==typeof module&&module&&!module.nodeType&&module,$t=jt&&jt.exports===xt?ne.Buffer:void 0,Ot=($t?$t.isBuffer:void 0)||function(){return!1},kt={};function At(e){return function(t){return e(t)}}kt["[object Float32Array]"]=kt["[object Float64Array]"]=kt["[object Int8Array]"]=kt["[object Int16Array]"]=kt["[object Int32Array]"]=kt["[object Uint8Array]"]=kt["[object Uint8ClampedArray]"]=kt["[object Uint16Array]"]=kt["[object Uint32Array]"]=!0,kt["[object Arguments]"]=kt["[object Array]"]=kt["[object ArrayBuffer]"]=kt["[object Boolean]"]=kt["[object DataView]"]=kt["[object Date]"]=kt["[object Error]"]=kt["[object Function]"]=kt["[object Map]"]=kt["[object Number]"]=kt["[object Object]"]=kt["[object RegExp]"]=kt["[object Set]"]=kt["[object String]"]=kt["[object WeakMap]"]=!1;var Ct="object"==typeof e&&e&&!e.nodeType&&e,Ft=Ct&&"object"==typeof module&&module&&!module.nodeType&&module,Dt=Ft&&Ft.exports===Ct&&ie.process,zt=function(){try{var e=Ft&&Ft.require&&Ft.require("util").types;return e||Dt&&Dt.binding&&Dt.binding("util")}catch(e){}}(),Rt=zt&&zt.isTypedArray,Tt=Rt?At(Rt):function(e){return me(e)&&mt(e.length)&&!!kt[fe(e)]},It=Object.prototype.hasOwnProperty;function Nt(e,t){var r=ge(e),a=!r&&St(e),i=!r&&!a&&Ot(e),s=!r&&!a&&!i&&Tt(e),n=r||a||i||s,o=n?function(e,t){for(var r=-1,a=Array(e);++r1?t[a-1]:void 0,s=a>2?t[2]:void 0;for(i=Gt.length>3&&"function"==typeof i?(a--,i):void 0,s&&yt(t[0],t[1],s)&&(i=a<3?void 0:i,a=1),e=Object(e);++r-1},ir.prototype.set=function(e,t){var r=this.__data__,a=rr(r,e);return a<0?(++this.size,r.push([e,t])):r[a][1]=t,this};var sr=Me(ne,"Map");function nr(e,t){var r=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?r["string"==typeof t?"string":"hash"]:r.map}function or(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t0&&r(o)?t>1?gr(o,t-1,r,a,i):mr(i,o):a||(i[i.length]=o)}return i}function br(e){return(null==e?0:e.length)?gr(e,1):[]}function _r(e){return et(pt(e,void 0,br),e+"")}var wr=Ut(Object.getPrototypeOf,Object),Pr=Function.prototype,Er=Object.prototype,Sr=Pr.toString,xr=Er.hasOwnProperty,jr=Sr.call(Object);function $r(e){var t=this.__data__=new ir(e);this.size=t.size}$r.prototype.clear=function(){this.__data__=new ir,this.size=0},$r.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},$r.prototype.get=function(e){return this.__data__.get(e)},$r.prototype.has=function(e){return this.__data__.has(e)},$r.prototype.set=function(e,t){var r=this.__data__;if(r instanceof ir){var a=r.__data__;if(!sr||a.length<199)return a.push([e,t]),this.size=++r.size,this;r=this.__data__=new or(a)}return r.set(e,t),this.size=r.size,this};var Or="object"==typeof e&&e&&!e.nodeType&&e,kr=Or&&"object"==typeof module&&module&&!module.nodeType&&module,Ar=kr&&kr.exports===Or?ne.Buffer:void 0,Cr=Ar?Ar.allocUnsafe:void 0;function Fr(e,t){for(var r=-1,a=null==e?0:e.length,i=0,s=[];++ro))return!1;var c=s.get(e);if(c&&s.get(t))return c==t;var u=-1,d=!0,h=2&r?new ua:void 0;for(s.set(e,t),s.set(t,e);++u-1?a[i?e[s]:s]:void 0});function qa(e,t){var r=-1,a=vt(e)?Array(e.length):[];return za(e,(function(e,i,s){a[++r]=t(e,i,s)})),a}var Va=Object.prototype.hasOwnProperty;function Ma(e,t){return null!=e&&Va.call(e,t)}function Ha(e,t){return null!=e&&ja(e,t,Ma)}function Qa(e){return null==e?[]:function(e,t){return ye(t,(function(t){return e[t]}))}(e,Mt(e))}function Ba(e,t){return t.length<2?e:fr(e,function(e,t,r){var a=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(r=r>i?i:r)<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var s=Array(i);++a1),t})),dt(e,Lr(e),r),a&&(r=ca(r,7,Ya));for(var i=t.length;i--;)Za(r,t[i]);return r}));function ei(e,t,r,a){if(!Pe(e))return e;for(var i=-1,s=(t=hr(t,e)).length,n=s-1,o=e;null!=o&&++it||s&&n&&l&&!o&&!c||a&&n&&l||!r&&l||!i)return 1;if(!a&&!s&&!c&&e=o?l:l*("desc"==r[a]?-1:1)}return e.index-t.index}(e,t,r)}))}var si=_r((function(e,t){return null==e?{}:function(e,t){return ti(e,t,(function(t,r){return $a(e,r)}))}(e,t)}));function ni(e,t,r,a){for(var i=r-1,s=e.length;++i-1;)o!==e&&oi.call(o,l,1),oi.call(e,l,1);return e}(e,t):e})),ci=ft((function(e,t){if(null==e)return[];var r=t.length;return r>1&&yt(e,t[0],t[1])?t=[]:r>2&&yt(t[0],t[1],t[2])&&(t=[t[0]]),ii(e,gr(t,1),[])})),ui={add:"hinzufügen",cancel:"abbrechen",next:"weiter",save:"speichern",delete:"löschen"},di={no_group_selected:"Wähle zuerst eine Gruppe aus",no_entity_selected:"Wähle zuerst eine Entity aus",no_groups_defined:"Es gibt keine Gruppe",no_entities_for_group:"Es gibt keine Entities in dieser Gruppe",no_actions_for_entity:"Es gibt keine Aktionen für diese Entity",no_entries_defined:"Es gibt keine Einträge"},hi={group:"Gruppe",entity:"Entity",action:"Aktion",days:"Tage",time:"Zeit",options:"Optionen",day_type_daily:"jeden Tag",day_type_weekdays:"Werktags",day_type_custom:"benutzerdefiniert",shift_with_sun:"Zeit automatisch an Sonnenauf- bzw. Sonnenuntergang anpassen",brightness:"Helligkeit",temperature:"Temperatur",position:"Position"},pi={mon:"Mo",tue:"Di",wed:"Mi",thu:"Do",fri:"Fr",sat:"Sa",sun:"So"},fi={mon:"Montag",tue:"Dienstag",wed:"Mittwoch",thu:"Donnerstag",fri:"Freitag",sat:"Samstag",sun:"Sonntag"},mi={on:"An",every:"jeden",and:"und",at:"um",before:"vor",after:"nach",sunrise:"Sonnenaufgang",sunset:"Sonnenuntergang"},vi={turn_on:"anschalten",turn_off:"ausschalten",close_cover:"schließen",open_cover:"öffnen",set_temperature:"Temperatur einstellen",set_to:"setzen auf",set_position:"Position setzen"},yi={climate:"Heizung",cover:"Beschattung",fan:"Lüfter",light:"Licht",switch:"Schalter",vacuum:"Staubsauger"},gi={scheduler:"Zeitplaner",actions:ui,instructions:di,fields:hi,days_short:pi,days_long:fi,words:mi,services:vi,domains:yi},bi=Object.freeze({__proto__:null,scheduler:"Zeitplaner",actions:ui,instructions:di,fields:hi,days_short:pi,days_long:fi,words:mi,services:vi,domains:yi,default:gi}),_i={add:"add item",cancel:"cancel",next:"next",save:"save",delete:"delete"},wi={no_group_selected:"Select a group first",no_entity_selected:"Select an entity first",no_groups_defined:"There are no groups defined",no_entities_for_group:"There are no entities in this group",no_actions_for_entity:"There are no actions for this entity",no_entries_defined:"There are no items to show"},Pi={group:"Group",entity:"Entity",action:"Action",days:"Days",time:"Time",options:"Options",day_type_daily:"every day",day_type_weekdays:"weekdays",day_type_custom:"custom",shift_with_sun:"automatically adjust time to sunrise/sunset",brightness:"Brightness",temperature:"Temperature",position:"Position"},Ei={mon:"mon",tue:"tue",wed:"wed",thu:"thu",fri:"fri",sat:"sat",sun:"sun"},Si={mon:"monday",tue:"tuesday",wed:"wednesday",thu:"thursday",fri:"friday",sat:"saturday",sun:"sunday"},xi={on:"on",every:"every",and:"and",at:"at",before:"before",after:"after",sunrise:"sunrise",sunset:"sunset"},ji={turn_on:"turn on",turn_off:"turn off",close_cover:"close",open_cover:"open",set_temperature:"set temperature",set_to:"set to",set_position:"set position"},$i={climate:"climate",cover:"covers",fan:"fans",light:"lights",switch:"switches",vacuum:"vacuum"},Oi={scheduler:"Scheduler",actions:_i,instructions:wi,fields:Pi,days_short:Ei,days_long:Si,words:xi,services:ji,domains:$i},ki=Object.freeze({__proto__:null,scheduler:"Scheduler",actions:_i,instructions:wi,fields:Pi,days_short:Ei,days_long:Si,words:xi,services:ji,domains:$i,default:Oi}),Ai={add:"Agregar",cancel:"cancelar",next:"siguiente",save:"guardar",delete:"borrar"},Ci={no_group_selected:"Selecciona un grupo primero",no_entity_selected:"Selecciona una entidad primero",no_groups_defined:"No hay grupos definidos",no_entities_for_group:"No hay entidades en este grupo",no_actions_for_entity:"No hay acciones para esta entidad",no_entries_defined:"No hay dispositivos definidos"},Fi={group:"Grupo",entity:"Entidad",action:"Acción",days:"Días",time:"Hora",options:"Opciones",day_type_daily:"cada día",day_type_weekdays:"dias semanales",day_type_custom:"personalizado",shift_with_sun:"ajusta automaticamente la hora al amanecer/atardecer",brightness:"Brillo",temperature:"Temperatura",position:"Posición"},Di={mon:"lun",tue:"mar",wed:"mie",thu:"jue",fri:"vie",sat:"sab",sun:"dom"},zi={mon:"lunes",tue:"martes",wed:"miércoles",thu:"jueves",fri:"viernes",sat:"sábado",sun:"domingo"},Ri={on:"el",every:"cada",and:"y",at:"a las",before:"antes",after:"después",sunrise:"amanecer",sunset:"atardecer"},Ti={turn_on:"encender",turn_off:"apagar",close_cover:"cerrar",open_cover:"abrir",set_temperature:"establecer temperatura",set_to:"establecer a",set_position:"posición de ajuste"},Ii={climate:"climatización",cover:"persiana",fan:"ventilador",light:"luces",switch:"interruptores",vacuum:"aspirador"},Ni={scheduler:"Programador",actions:Ai,instructions:Ci,fields:Fi,days_short:Di,days_long:zi,words:Ri,services:Ti,domains:Ii},Ui=Object.freeze({__proto__:null,scheduler:"Programador",actions:Ai,instructions:Ci,fields:Fi,days_short:Di,days_long:zi,words:Ri,services:Ti,domains:Ii,default:Ni}),Li={add:"lisa ajastus",cancel:"loobu",next:"järgmine",save:"salvesta",delete:"kustuta"},qi={no_group_selected:"Vali grupp",no_entity_selected:"Vali olem",no_groups_defined:"Gruppe pole määratud",no_entities_for_group:"Antud grupis puuduvad olemid",no_actions_for_entity:"Selles olemis puuduvad tegevused",no_entries_defined:"Pole midagi kuvada"},Vi={group:"Grupp",entity:"Olem",action:"Tegevus",days:"Päev",time:"Aeg",options:"Suvandid",day_type_daily:"iga päev",day_type_weekdays:"nädalapäev",day_type_custom:"seadistatud",shift_with_sun:"määrake automaatselt Päikese tõus/loojang",brightness:"Heledus",temperature:"Temperatuur",position:"Asukoht"},Mi={mon:"E",tue:"T",wed:"K",thu:"N",fri:"R",sat:"L",sun:"P"},Hi={mon:"Esmaspäev",tue:"Teisipäev",wed:"Kolmapäev",thu:"Neljapäev",fri:"Reede",sat:"Laupäev",sun:"Pühapäev"},Qi={on:"sisse",every:"iga",and:"ja",at:"ajal",before:"enne",after:"pärast",sunrise:"päikesetõus",sunset:"loojang"},Bi={turn_on:"lülita sisse",turn_off:"lülita välja",close_cover:"sulge",open_cover:"ava",set_temperature:"määra temperatuur",set_to:"seadista väärtusele",set_position:"seadista asendisse"},Gi={climate:"kliimaseade",cover:"(akna)katted",fan:"ventilaatorid",light:"tuled",switch:"lülitid",vacuum:"tolmuimejad"},Ki={scheduler:"Ajastaja",actions:Li,instructions:qi,fields:Vi,days_short:Mi,days_long:Hi,words:Qi,services:Bi,domains:Gi},Ji=Object.freeze({__proto__:null,scheduler:"Ajastaja",actions:Li,instructions:qi,fields:Vi,days_short:Mi,days_long:Hi,words:Qi,services:Bi,domains:Gi,default:Ki}),Wi={add:"ajouter un item",cancel:"annuler",next:"suivant",save:"sauvegarder",delete:"effacer"},Zi={no_group_selected:"Sélectionner un groupe en premier",no_entity_selected:"Sélectionner une entité en premier",no_groups_defined:"Il n'y a pas de groupe défini",no_entities_for_group:"Il n'y a pas d'entité dans ce groupe",no_actions_for_entity:"Il n'y a pas d'action pour cette entité",no_entries_defined:"Il n'y a pas d'item à afficher"},Yi={group:"Groupe",entity:"Entité",action:"Action",days:"Jours",time:"Temps",options:"Options",day_type_daily:"chaque jour",day_type_weekdays:"en semaine",day_type_custom:"sur mesure",shift_with_sun:"ajuster automatiquement l'heure au lever/coucher du soleil",brightness:"Luminosité",temperature:"Température",position:"Position"},Xi={mon:"lun",tue:"mar",wed:"mer",thu:"jeu",fri:"ven",sat:"sam",sun:"dim"},es={mon:"lundi",tue:"mardi",wed:"mercredi",thu:"jeudi",fri:"vendredi",sat:"samedi",sun:"dimanche"},ts={on:"marche",every:"tout",and:"et",at:"à",before:"avant",after:"après",sunrise:"lever du soleil",sunset:"coucher du soleil"},rs={turn_on:"allumer",turn_off:"éteindre",close_cover:"fermer",open_cover:"ouvrir",set_temperature:"régler la température",set_to:"défini à",set_position:"position définie"},as={climate:"climat",cover:"contrôleur",fan:"ventilateur",light:"lumière",switch:"interrupteurs",vacuum:"aspirateur"},is={scheduler:"Planificateur",actions:Wi,instructions:Zi,fields:Yi,days_short:Xi,days_long:es,words:ts,services:rs,domains:as},ss=Object.freeze({__proto__:null,scheduler:"Planificateur",actions:Wi,instructions:Zi,fields:Yi,days_short:Xi,days_long:es,words:ts,services:rs,domains:as,default:is}),ns={add:"új időzítés",cancel:"mégse",next:"tovább",save:"törlés",delete:"delete"},os={no_group_selected:"Előbb egy csoportot szükséges választani",no_entity_selected:"Előbb egy entitást szükséges választani",no_groups_defined:"Nincsenek deffiniált csoportok",no_entities_for_group:"Ebben a csoportban nem találhatók entitások",no_actions_for_entity:"Ehhez az entitáshoz nem tartoznak műveletek",no_entries_defined:"Nincs megjeleníthető elem"},ls={group:"Csoport",entity:"Entitás",action:"Művelet",days:"Napokon",time:"Időpontban",options:"Opciók",day_type_daily:"minden nap",day_type_weekdays:"munkanapokon",day_type_custom:"egyedi",shift_with_sun:"Az idő automatikus igazítása napkeltéhez/naplementéhez",brightness:"Fényerő",temperature:"Hőmérséklet",position:"Pozíciót"},cs={mon:"hét",tue:"ked",wed:"sze",thu:"csü",fri:"pén",sat:"szo",sun:"vas"},us={mon:"hétfő",tue:"kedd",wed:"szerda",thu:"csütörtök",fri:"péntek",sat:"szombat",sun:"vasárnap"},ds={on:"on",every:"minden",and:"és",at:"at",before:"előtt",after:"után",sunrise:"napkelte",sunset:"naplemente"},hs={turn_on:"bekapcsolás",turn_off:"kikapcsolás",close_cover:"zárás",open_cover:"nyitás",set_temperature:"hőmérséklet",set_to:"beállítva",set_position:"változtass pozíciót"},ps={climate:"termosztát",cover:"redőny",fan:"ventilátor",light:"lámpa",switch:"kapcsoló",vacuum:"pórszívó"},fs={scheduler:"Időzítések",actions:ns,instructions:os,fields:ls,days_short:cs,days_long:us,words:ds,services:hs,domains:ps},ms=Object.freeze({__proto__:null,scheduler:"Időzítések",actions:ns,instructions:os,fields:ls,days_short:cs,days_long:us,words:ds,services:hs,domains:ps,default:fs}),vs={add:"Nieuw item",cancel:"annuleren",next:"verder",save:"opslaan",delete:"verwijder"},ys={no_group_selected:"Selecteer eerst een groep",no_entity_selected:"Selecteer eerst een entiteit",no_groups_defined:"Er zijn geen groepen gedefinieerd",no_entities_for_group:"Deze groep heeft geen entiteiten",no_actions_for_entity:"Deze entiteit heeft geen acties",no_entries_defined:"Er zijn geen items aangemaakt"},gs={group:"Groep",entity:"Entiteit",action:"Actie",days:"Dagen",time:"Tijdstip",options:"Opties",day_type_daily:"Dagelijks",day_type_weekdays:"werkdagen",day_type_custom:"Anders",shift_with_sun:"Automatisch aanpassen aan zonsopgang/zonsondergang",brightness:"Helderheid",temperature:"Temperatuur",position:"Positie"},bs={mon:"ma",tue:"di",wed:"wo",thu:"do",fri:"vr",sat:"za",sun:"zo"},_s={mon:"maandag",tue:"dinsdag",wed:"woensdag",thu:"donderdag",fri:"vrijdag",sat:"zaterdag",sun:"zondag"},ws={on:"op",every:"elke",and:"en",at:"om",before:"voor",after:"na",sunrise:"zonsopgang",sunset:"zonsondergang"},Ps={turn_on:"aanzetten",turn_off:"uitzetten",close_cover:"sluiten",open_cover:"openen",set_temperature:"temperatuur instellen",set_to:"Zet op",set_position:"positie instellen"},Es={climate:"verwarming",cover:"zonwering",fan:"ventilatie",light:"verlichting",switch:"schakelaars",vacuum:"stofzuiger"},Ss={scheduler:"Tijdplanner",actions:vs,instructions:ys,fields:gs,days_short:bs,days_long:_s,words:ws,services:Ps,domains:Es},xs=Object.freeze({__proto__:null,scheduler:"Tijdplanner",actions:vs,instructions:ys,fields:gs,days_short:bs,days_long:_s,words:ws,services:Ps,domains:Es,default:Ss}),js={add:"legg til",cancel:"avbryt",next:"neste",save:"lagre",delete:"slett"},$s={no_group_selected:"Velg en gruppe først",no_entity_selected:"Velg en entitet først",no_groups_defined:"Ingen grupper definert",no_entities_for_group:"Det finnes ingen entiteter i denne gruppen",no_actions_for_entity:"Det finnes ingen handlinger for denne entiteten",no_entries_defined:"Det er ingen definerte tidsplaner å vise"},Os={group:"Gruppe",entity:"Entitet",action:"Handling",days:"Dager",time:"Tid",options:"Valg",day_type_daily:"hver dag",day_type_weekdays:"ukedager",day_type_custom:"egendefinert",shift_with_sun:"automatisk juster tid for soloppgang/solnedgang",brightness:"Lysstyrke",temperature:"Temperatur",position:"Posisjon"},ks={mon:"man",tue:"tir",wed:"ons",thu:"tor",fri:"fre",sat:"lør",sun:"søn"},As={mon:"mandag",tue:"tirsdag",wed:"onsdag",thu:"torsdag",fri:"fredag",sat:"lørdag",sun:"søndag"},Cs={on:"den",every:"hver",and:"og",at:"på",before:"før",after:"etter",sunrise:"soloppgang",sunset:"solnedgang"},Fs={turn_on:"slå på",turn_off:"slå av",close_cover:"lukk",open_cover:"åpne",set_temperature:"sett temperatur",set_to:"sett til",set_position:"sett posisjon"},Ds={climate:"klima",cover:"cover",fan:"vifter",light:"lys",switch:"brytere",vacuum:"støvsugere"},zs={scheduler:"Tidsplan",actions:js,instructions:$s,fields:Os,days_short:ks,days_long:As,words:Cs,services:Fs,domains:Ds},Rs=Object.freeze({__proto__:null,scheduler:"Tidsplan",actions:js,instructions:$s,fields:Os,days_short:ks,days_long:As,words:Cs,services:Fs,domains:Ds,default:zs}),Ts={add:"dodaj",cancel:"anuluj",next:"dalej",save:"zapisz",delete:"usuń"},Is={no_group_selected:"Najpierw wybierz grupę",no_entity_selected:"Najpierw wybierz encję",no_groups_defined:"Nie ma zdefiniowanych grup",no_entities_for_group:"Nie ma encji w tej grupie",no_actions_for_entity:"Nie ma akcji dla tej encji",no_entries_defined:"Nie ma elementów do pokazania"},Ns={group:"Grupa",entity:"Encja",action:"Akcja",days:"Dni",time:"Czas",options:"Opcje",day_type_daily:"codziennie",day_type_weekdays:"dni tygodnia",day_type_custom:"niestandardowy",shift_with_sun:"automatycznie dopasuj czas do wschodów/zachodów",brightness:"Jasność",temperature:"Temperatura",position:"Pozycję"},Us={mon:"pon",tue:"wt",wed:"śr",thu:"czw",fri:"pt",sat:"sob",sun:"niedz"},Ls={mon:"poniedziałek",tue:"wtorek",wed:"środa",thu:"czwartek",fri:"piątek",sat:"sobota",sun:"niedziela"},qs={on:"w",every:"każdy",and:"oraz",at:"o",before:"przed",after:"po",sunrise:"wschód",sunset:"zachodów"},Vs={turn_on:"włącz",turn_off:"wyłącz",close_cover:"zamknij",open_cover:"otwórz",set_temperature:"Ustaw temperaturę",set_to:"ustaw na",set_position:"Ustaw pozycję"},Ms={climate:"termostat",cover:"roleta",fan:"wiatrak",light:"światło",switch:"włącznik",vacuum:"odkurzacz"},Hs={scheduler:"Harmonogram",actions:Ts,instructions:Is,fields:Ns,days_short:Us,days_long:Ls,words:qs,services:Vs,domains:Ms},Qs=Object.freeze({__proto__:null,scheduler:"Harmonogram",actions:Ts,instructions:Is,fields:Ns,days_short:Us,days_long:Ls,words:qs,services:Vs,domains:Ms,default:Hs}),Bs={add:"adicionar item",cancel:"cancelar",next:"próximo",save:"gravar",delete:"apagar"},Gs={no_group_selected:"Selecione um grupo primeiro",no_entity_selected:"Selecione uma entidade primeiro",no_groups_defined:"Não tem grupo definido",no_entities_for_group:"Não tem entidade no grupo",no_actions_for_entity:"Não há ações para esta entidade",no_entries_defined:"Não tem item pra mostar"},Ks={group:"Grupo",entity:"Entidade",action:"Ação",days:"Dias",time:"Hora",options:"Opções",day_type_daily:"todos os dias",day_type_weekdays:"dias da semana",day_type_custom:"personalizado",shift_with_sun:"automaticamente ajusta hora pelo nascer do sol/pôr do sol",brightness:"Brilho",temperature:"Temperatura",position:"Posição"},Js={mon:"seg",tue:"ter",wed:"qua",thu:"qui",fri:"sex",sat:"sab",sun:"dom"},Ws={mon:"segunda",tue:"terça",wed:"quarta",thu:"quinta",fri:"sexta",sat:"sabádo",sun:"domingo"},Zs={on:"on",every:"cada",and:"e",at:"às",before:"antes",after:"depois",sunrise:"nascer do sol",sunset:"pôr do sol"},Ys={turn_on:"ligar",turn_off:"desligar",close_cover:"fechar",open_cover:"abrir",set_temperature:"ajustar temperatura",set_to:"ajustar para",set_position:"ajustar posição"},Xs={climate:"ar condicionado",cover:"persiana",fan:"ventilador",light:"luz",switch:"interruptor",vacuum:"aspirador"},en={scheduler:"Agenda",actions:Bs,instructions:Gs,fields:Ks,days_short:Js,days_long:Ws,words:Zs,services:Ys,domains:Xs},tn=Object.freeze({__proto__:null,scheduler:"Agenda",actions:Bs,instructions:Gs,fields:Ks,days_short:Js,days_long:Ws,words:Zs,services:Ys,domains:Xs,default:en}),rn={add:"добавить",cancel:"отменить",next:"далее",save:"сохранить",delete:"удалить"},an={no_group_selected:"Необходимо выбрать группу",no_entity_selected:"Необходимо выбрать объект",no_groups_defined:"Ни одной группы не создано",no_entities_for_group:"В этой группе нет объектов",no_actions_for_entity:"Для этого объекта нет действий",no_entries_defined:"Объекты отсутствуют"},sn={group:"Группа",entity:"Объект",action:"Действие",days:"Дни",time:"Время",options:"Опции",day_type_daily:"ежедневно",day_type_weekdays:"по будням",day_type_custom:"выбрать дни",shift_with_sun:"автоматически настраивать время на восход / закат",brightness:"Яркость",temperature:"Температура",position:"Позицию"},nn={mon:"пн",tue:"вт",wed:"ср",thu:"чт",fri:"пт",sat:"сб",sun:"вс"},on={mon:"понедельник",tue:"вторник",wed:"среда",thu:"четверг",fri:"пятница",sat:"суббота",sun:"воскресенье"},ln={on:"по",every:"каждый",and:"и",at:"в",before:"до",after:"после",sunrise:"восхода",sunset:"заката"},cn={turn_on:"включить",turn_off:"выключить",close_cover:"закрыть",open_cover:"открыть",set_temperature:"задать температуру",set_to:"установить",set_position:"установить позицию"},un={climate:"Климат",cover:"Жалюзи",fan:"Вентиляторы",light:"Свет",switch:"Выключатели",vacuum:"Пылесосы"},dn={scheduler:"Планирование",actions:rn,instructions:an,fields:sn,days_short:nn,days_long:on,words:ln,services:cn,domains:un},hn={de:bi,en:ki,es:Ui,et:Ji,es_419:Ui,fr:ss,hu:ms,nb:Rs,nl:xs,nn:Rs,no:Rs,pl:Qs,pt:tn,pt_BR:tn,ru:Object.freeze({__proto__:null,scheduler:"Планирование",actions:rn,instructions:an,fields:sn,days_short:nn,days_long:on,words:ln,services:cn,domains:un,default:dn})};function pn(e,t="",r=""){const a=fn();var i;try{i=e.split(".").reduce((e,t)=>e[t],hn[a])}catch(t){i=e.split(".").reduce((e,t)=>e[t],hn.en)}return void 0===i&&(i=e.split(".").reduce((e,t)=>e[t],hn.en)),""!==t&&""!==r&&(i=i.replace(t,r)),i}function fn(){var e;let t=null===(e=localStorage.getItem("selectedLanguage"))||void 0===e?void 0:e.replace(/['"]+/g,"").replace("-","_");if(!t||"null"==t){const e=document.querySelector("home-assistant").hass;t=e.selectedLanguage||e.language||"en"}return String(t)}function mn(e,t){let r=e>=0?Math.floor(e/60):Math.ceil(e/60),a=e-60*r;return a%t!=0&&(a=Math.round(a/t)*t),a>=60&&(r++,a-=60),r>=24&&(r-=24),60*r+a}function vn(e,t={}){let r=!!t.amPm&&t.amPm,a=!!t.absolute&&t.absolute,i=e>=0?Math.floor(e/60):Math.ceil(e/60),s=e-60*i,n="";r&&(n=i>=12?"PM":"AM",(i>12||12==i&&s>0)&&(i-=12));let o=String(Math.abs(i)).padStart(2,"0"),l=String(Math.abs(s)).padStart(2,"0"),c=i<0||s<0;return{hours:o,minutes:l,time:`${c&&!a?"-":""}${o}:${l}${r?" "+n:""}`,signed:c,amPm:n}}function yn(e,t={}){let r=t.stepSize?t.stepSize:1,a=!!t.signed&&t.signed,i=t.max?t.max:1440,s=mn(e,r);return s<0&&!a?e+=1440:s>=1440&&(e-=1440),s<-i?-i:s>i?i:e}function gn(e){let t,r,a;if(null!==(a=/^([0-9]{2}):([0-9]{2})$/.exec(e)))[t,r]=[Number(a[1]),Number(a[2])];else if(null!==(a=/^([0-9]{2})([0-9]{2})$/.exec(e)))[t,r]=[Number(a[1]),Number(a[2])];else{if(null!==(a=/^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}[\+|\-][0-9]{2}:[0-9]{2}$/.exec(e))){let e=new Date(a[0]);return gn(`${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}`)}console.log(`failed to parse timestamp '${e}'`)}return 60*t+r}function bn(e){return"weekdays"==e.daysType?[1,2,3,4,5]:"custom"==e.daysType?e.daysCustom.sort().filter(e=>0!=e):[]}const _n={light:{actions:[{service:"turn_on",icon:"lightbulb-on-outline",variable:{field:"brightness"}},{service:"turn_off",icon:"lightbulb-off-outline"}]},switch:{actions:[{service:"turn_on"},{service:"turn_off"}]},cover:{actions:[{service:"open_cover",name:pn("services.open_cover")},{service:"close_cover",name:pn("services.close_cover")},{service:"set_cover_position",name:pn("services.set_position"),variable:{field:"position"}}]},climate:{actions:[{service:"set_temperature",variable:{field:"temperature"},icon:"thermometer"},{service:"turn_off",icon:"thermometer-off"}]},fan:{actions:[{service:"turn_on",icon:"fan"},{service:"turn_off",icon:"fan-off"}]}};function wn(e){var t={automation:"robot",camera:"camera",climate:"home-thermometer-outline",cover:"window-shutter",fan:"fan",input_number:"sort-numeric-variant",input_select:"form-select",input_text:"form-textbox",input_time:"clock",light:"lightbulb-outline",media_player:"speaker",script:"script-text",switch:"flash",vacuum:"robot-vacuum"};return e in t?t[e]:"folder-outline"}function Pn(e){let t=null;return"climate"==e?t=pn("domains.climate"):"cover"==e?t=pn("domains.cover"):"fan"==e?t=pn("domains.fan"):"light"==e?t=pn("domains.light"):"switch"==e?t=pn("domains.switch"):"vacuum"==e&&(t=pn("domains.vacuum")),t||e}function En(e){const t={brightness:{name:pn("fields.brightness"),unit:"",min:0,max:255,step:1,optional:!0,show_percentage:!0},temperature:{name:pn("fields.temperature"),unit:"°C",min:10,max:30,step:1,optional:!1,show_percentage:!1},position:{name:pn("fields.position"),unit:"%",min:0,max:100,step:1,optional:!1,show_percentage:!1},default:{name:e,unit:"",min:0,max:255,step:1,optional:!1,show_percentage:!1}};return void 0!==t[e]?Object.assign({},t[e]):Object.assign({},t.default)}const Sn={id:"create_routine",service:"create_routine",name:"create routine",icon:"hass:cog-refresh-outline",routine:!1},xn=[{startTime:gn("00:00"),endTime:gn("08:00")},{startTime:gn("08:00"),endTime:gn("16:00")},{startTime:gn("16:00"),endTime:1440}];"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function jn(e,t,r){return e(r={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&r.path)}},r.exports),r.exports}var $n=jn((function(e,t){var r;r=function(){var e=JSON.parse('{"$":"dollar","%":"percent","&":"and","<":"less",">":"greater","|":"or","¢":"cent","£":"pound","¤":"currency","¥":"yen","©":"(c)","ª":"a","®":"(r)","º":"o","À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","Æ":"AE","Ç":"C","È":"E","É":"E","Ê":"E","Ë":"E","Ì":"I","Í":"I","Î":"I","Ï":"I","Ð":"D","Ñ":"N","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","Ù":"U","Ú":"U","Û":"U","Ü":"U","Ý":"Y","Þ":"TH","ß":"ss","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","æ":"ae","ç":"c","è":"e","é":"e","ê":"e","ë":"e","ì":"i","í":"i","î":"i","ï":"i","ð":"d","ñ":"n","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","ù":"u","ú":"u","û":"u","ü":"u","ý":"y","þ":"th","ÿ":"y","Ā":"A","ā":"a","Ă":"A","ă":"a","Ą":"A","ą":"a","Ć":"C","ć":"c","Č":"C","č":"c","Ď":"D","ď":"d","Đ":"DJ","đ":"dj","Ē":"E","ē":"e","Ė":"E","ė":"e","Ę":"e","ę":"e","Ě":"E","ě":"e","Ğ":"G","ğ":"g","Ģ":"G","ģ":"g","Ĩ":"I","ĩ":"i","Ī":"i","ī":"i","Į":"I","į":"i","İ":"I","ı":"i","Ķ":"k","ķ":"k","Ļ":"L","ļ":"l","Ľ":"L","ľ":"l","Ł":"L","ł":"l","Ń":"N","ń":"n","Ņ":"N","ņ":"n","Ň":"N","ň":"n","Ō":"O","ō":"o","Ő":"O","ő":"o","Œ":"OE","œ":"oe","Ŕ":"R","ŕ":"r","Ř":"R","ř":"r","Ś":"S","ś":"s","Ş":"S","ş":"s","Š":"S","š":"s","Ţ":"T","ţ":"t","Ť":"T","ť":"t","Ũ":"U","ũ":"u","Ū":"u","ū":"u","Ů":"U","ů":"u","Ű":"U","ű":"u","Ų":"U","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","ź":"z","Ż":"Z","ż":"z","Ž":"Z","ž":"z","ƒ":"f","Ơ":"O","ơ":"o","Ư":"U","ư":"u","Lj":"LJ","lj":"lj","Nj":"NJ","nj":"nj","Ș":"S","ș":"s","Ț":"T","ț":"t","˚":"o","Ά":"A","Έ":"E","Ή":"H","Ί":"I","Ό":"O","Ύ":"Y","Ώ":"W","ΐ":"i","Α":"A","Β":"B","Γ":"G","Δ":"D","Ε":"E","Ζ":"Z","Η":"H","Θ":"8","Ι":"I","Κ":"K","Λ":"L","Μ":"M","Ν":"N","Ξ":"3","Ο":"O","Π":"P","Ρ":"R","Σ":"S","Τ":"T","Υ":"Y","Φ":"F","Χ":"X","Ψ":"PS","Ω":"W","Ϊ":"I","Ϋ":"Y","ά":"a","έ":"e","ή":"h","ί":"i","ΰ":"y","α":"a","β":"b","γ":"g","δ":"d","ε":"e","ζ":"z","η":"h","θ":"8","ι":"i","κ":"k","λ":"l","μ":"m","ν":"n","ξ":"3","ο":"o","π":"p","ρ":"r","ς":"s","σ":"s","τ":"t","υ":"y","φ":"f","χ":"x","ψ":"ps","ω":"w","ϊ":"i","ϋ":"y","ό":"o","ύ":"y","ώ":"w","Ё":"Yo","Ђ":"DJ","Є":"Ye","І":"I","Ї":"Yi","Ј":"J","Љ":"LJ","Њ":"NJ","Ћ":"C","Џ":"DZ","А":"A","Б":"B","В":"V","Г":"G","Д":"D","Е":"E","Ж":"Zh","З":"Z","И":"I","Й":"J","К":"K","Л":"L","М":"M","Н":"N","О":"O","П":"P","Р":"R","С":"S","Т":"T","У":"U","Ф":"F","Х":"H","Ц":"C","Ч":"Ch","Ш":"Sh","Щ":"Sh","Ъ":"U","Ы":"Y","Ь":"","Э":"E","Ю":"Yu","Я":"Ya","а":"a","б":"b","в":"v","г":"g","д":"d","е":"e","ж":"zh","з":"z","и":"i","й":"j","к":"k","л":"l","м":"m","н":"n","о":"o","п":"p","р":"r","с":"s","т":"t","у":"u","ф":"f","х":"h","ц":"c","ч":"ch","ш":"sh","щ":"sh","ъ":"u","ы":"y","ь":"","э":"e","ю":"yu","я":"ya","ё":"yo","ђ":"dj","є":"ye","і":"i","ї":"yi","ј":"j","љ":"lj","њ":"nj","ћ":"c","ѝ":"u","џ":"dz","Ґ":"G","ґ":"g","Ғ":"GH","ғ":"gh","Қ":"KH","қ":"kh","Ң":"NG","ң":"ng","Ү":"UE","ү":"ue","Ұ":"U","ұ":"u","Һ":"H","һ":"h","Ә":"AE","ә":"ae","Ө":"OE","ө":"oe","฿":"baht","ა":"a","ბ":"b","გ":"g","დ":"d","ე":"e","ვ":"v","ზ":"z","თ":"t","ი":"i","კ":"k","ლ":"l","მ":"m","ნ":"n","ო":"o","პ":"p","ჟ":"zh","რ":"r","ს":"s","ტ":"t","უ":"u","ფ":"f","ქ":"k","ღ":"gh","ყ":"q","შ":"sh","ჩ":"ch","ც":"ts","ძ":"dz","წ":"ts","ჭ":"ch","ხ":"kh","ჯ":"j","ჰ":"h","Ẁ":"W","ẁ":"w","Ẃ":"W","ẃ":"w","Ẅ":"W","ẅ":"w","ẞ":"SS","Ạ":"A","ạ":"a","Ả":"A","ả":"a","Ấ":"A","ấ":"a","Ầ":"A","ầ":"a","Ẩ":"A","ẩ":"a","Ẫ":"A","ẫ":"a","Ậ":"A","ậ":"a","Ắ":"A","ắ":"a","Ằ":"A","ằ":"a","Ẳ":"A","ẳ":"a","Ẵ":"A","ẵ":"a","Ặ":"A","ặ":"a","Ẹ":"E","ẹ":"e","Ẻ":"E","ẻ":"e","Ẽ":"E","ẽ":"e","Ế":"E","ế":"e","Ề":"E","ề":"e","Ể":"E","ể":"e","Ễ":"E","ễ":"e","Ệ":"E","ệ":"e","Ỉ":"I","ỉ":"i","Ị":"I","ị":"i","Ọ":"O","ọ":"o","Ỏ":"O","ỏ":"o","Ố":"O","ố":"o","Ồ":"O","ồ":"o","Ổ":"O","ổ":"o","Ỗ":"O","ỗ":"o","Ộ":"O","ộ":"o","Ớ":"O","ớ":"o","Ờ":"O","ờ":"o","Ở":"O","ở":"o","Ỡ":"O","ỡ":"o","Ợ":"O","ợ":"o","Ụ":"U","ụ":"u","Ủ":"U","ủ":"u","Ứ":"U","ứ":"u","Ừ":"U","ừ":"u","Ử":"U","ử":"u","Ữ":"U","ữ":"u","Ự":"U","ự":"u","Ỳ":"Y","ỳ":"y","Ỵ":"Y","ỵ":"y","Ỷ":"Y","ỷ":"y","Ỹ":"Y","ỹ":"y","‘":"\'","’":"\'","“":"\\"","”":"\\"","†":"+","•":"*","…":"...","₠":"ecu","₢":"cruzeiro","₣":"french franc","₤":"lira","₥":"mill","₦":"naira","₧":"peseta","₨":"rupee","₩":"won","₪":"new shequel","₫":"dong","€":"euro","₭":"kip","₮":"tugrik","₯":"drachma","₰":"penny","₱":"peso","₲":"guarani","₳":"austral","₴":"hryvnia","₵":"cedi","₸":"kazakhstani tenge","₹":"indian rupee","₺":"turkish lira","₽":"russian ruble","₿":"bitcoin","℠":"sm","™":"tm","∂":"d","∆":"delta","∑":"sum","∞":"infinity","♥":"love","元":"yuan","円":"yen","﷼":"rial"}'),t=JSON.parse('{"de":{"Ä":"AE","ä":"ae","Ö":"OE","ö":"oe","Ü":"UE","ü":"ue"},"vi":{"Đ":"D","đ":"d"}}');function r(r,a){if("string"!=typeof r)throw new Error("slugify: string argument expected");var i=t[(a="string"==typeof a?{replacement:a}:a||{}).locale]||{},s=void 0===a.replacement?"-":a.replacement,n=r.split("").reduce((function(t,r){return t+(i[r]||e[r]||r).replace(a.remove||/[^\w\s$*_+~.()'"!\-:@]+/g,"")}),"").trim().replace(new RegExp("[\\s"+s+"]+","g"),s);return a.lower&&(n=n.toLowerCase()),a.strict&&(n=n.replace(new RegExp("[^a-zA-Z0-9"+s+"]","g"),"").replace(new RegExp("[\\s"+s+"]+","g"),s)),n}return r.extend=function(t){for(var r in t)e[r]=t[r]},r},e.exports=r(),e.exports.default=r()}));const On=/^D([0-7]+)T([0-9SR\-\+]+)([A0-9+]+)$/,kn=/^(A([0-9]+))+$/,An=/^([0-9]{4})?(S[SR])([0-9]{4})?$/;function Cn(e){if(-1===e.indexOf("."))return"";return String(e.split(".").shift())}function Fn(e){let t=Mt(e);t=t.sort();let r={};return t.forEach(t=>r[t]=e[t]),$n(JSON.stringify(Qa(r)).replace(/\W/g," "),"_")}function Dn(e){return e.match(/^switch.schedule_[0-9a-f]{6}$/)}function zn(e){return!e||!e.length||1==e.length&&0==e[0]?"daily":5!=e.length||e.includes(6)||e.includes(7)?"custom":"weekdays"}function Rn(e){if("daily"==zn(e))return pn("fields.day_type_daily");if("weekdays"==zn(e))return`${pn("words.on")} ${pn("fields.day_type_weekdays")}`;{let r=Array();e.includes(1)&&r.push(pn("days_long.mon")),e.includes(2)&&r.push(pn("days_long.tue")),e.includes(3)&&r.push(pn("days_long.wed")),e.includes(4)&&r.push(pn("days_long.thu")),e.includes(5)&&r.push(pn("days_long.fri")),e.includes(6)&&r.push(pn("days_long.sat")),e.includes(7)&&r.push(pn("days_long.sun"));let a=r.join(", ");var t=a.lastIndexOf(", ");return t&&(a=a.slice(0,t)+a.slice(t).replace(", ",` ${pn("words.and")} `)),`${pn("words.every")} ${a}`}}function Tn(e,t){let r=!!t.amPm&&t.amPm;if(!e.event)return`${pn("words.at")} ${vn(e.value,{amPm:r}).time}`;let a="unknown";if("sunrise"==e.event&&null!==t.sunrise){a=vn(yn(Number(t.sunrise)+e.value),{amPm:r}).time}else if("sunset"==e.event&&null!==t.sunset){a=vn(yn(Number(t.sunset)+e.value),{amPm:r}).time}return 0==Math.abs(e.value)?`${pn("words.at")} ${pn("words."+e.event)} (${a})`:`${vn(e.value,{absolute:!0}).time} ${vn(e.value).signed?pn("words.before"):pn("words.after")} ${pn("words."+e.event)} (${a})`}function In(e){return"string"!=typeof e&&(e=String(e)),Ln(e.replace(/_/g," "))}function Nn(e){return"string"!=typeof e&&(e=String(e)),e.match(/^[a-z]+:[a-z0-9-]+$/i)?e:"hass:"+e}function Un(e,t){let r=In(t.name);if(e.hasOwnProperty("level")){let a=t.variable,i=Number(e.level),s=a.hasOwnProperty("unit")?a.unit:"";a.show_percentage&&(i=Math.round((i-a.min)/(a.max-a.min)*100),ia.max&&(i=a.max),s="%"),r=`${pn("services.set_to")} ${i}${s}`}return Ln(r)}function Ln(e){return e.charAt(0).toUpperCase()+e.slice(1)}function qn(e){let t=e.map(e=>{let t={startTime:e.time.value,endTime:e.time.value,action:e.action};return e.hasOwnProperty("level")&&Object.assign(t,{level:e.level}),e.hasOwnProperty("levelEnabled")&&Object.assign(t,{levelEnabled:e.levelEnabled}),t});t.find(e=>0==e.startTime)||t.push({startTime:0,endTime:0}),t.sort((e,t)=>e.startTime>t.startTime?1:e.startTime=0;r--)t[r].endTime=a,a=t[r].startTime;return t}class Vn{constructor(){this.entities=[],this.groups=[],this.userConfig={groups:{},domains:{},entities:{},discover_existing:!0,standard_configuration:!0}}setUserConfig(e){Object.assign(this.userConfig,si(e,["entities","groups","discover_existing","standard_configuration"])),this.userConfig.standard_configuration&&Object.assign(this.userConfig,{domains:_n}),e.domains&&Ra(e.domains,(e,t)=>{let r=Object.assign({},this.userConfig.domains);Object.assign(r,{[t]:e}),this.userConfig.domains=r}),this.userConfig.groups&&Ra(e.groups,this.AddGroup.bind(this))}AddGroup(e,t){if(this.FindGroup(t))return;let r=Object.assign({id:t,icon:"folder-outline",domains:[],entities:[],name:Pn(t)},ri(Object.assign({},e),Ja));this.groups.push(r)}FindGroup(e){let t=La(this.groups,{id:e});return t||null}AddEntityToGroup(e){let t=Cn(e),r=La(this.groups,r=>r.domains.includes(t)||r.entities.includes(e));if(!r)if(r=this.FindGroup(t),r){let a=[...r.entities];a.push(e),this.groups.forEach((e,r)=>{e.id==t&&(this.groups[r].entities=a)})}else this.AddGroup({icon:wn(t),entities:[e]},t)}GetGroups(){let e=[...this.groups];return e=ci(e,"name"),e}AddEntity(e,t){if(this.FindEntity(t))return;let r=Object.assign({id:t,name:t.split(".").pop(),icon:wn(Cn(t))},ri(Object.assign({},e),Ja));this.entities.push(r),this.AddEntityToGroup(t)}FindEntity(e){let t=La(this.entities,{id:e});return t||null}GetEntitiesForGroup(e){let t=[...this.entities];if(e){let r=this.FindGroup(e);if(!r)return[];t=t.filter(e=>{let t=Cn(e.id);return(null==r?void 0:r.entities.includes(e.id))||(null==r?void 0:r.domains.includes(t))})}return t=ci(t,"name"),t}AddActionToEntity(e,t){if(!this.FindEntity(e))throw Error(`Entity '${e}' must be created before actions can be assigned`);if(this.FindAction(e,t.id))return;if(this.GetActionsForEntity(e).find(e=>!!e.hasOwnProperty("variable")&&!(!t.hasOwnProperty("service_data")||!t.service_data.hasOwnProperty(e.variable.field))))return;let r=[...this.GetActionsForEntity(e)];r.push(t),this.entities.forEach((t,a)=>{t.id==e&&(this.entities[a].actions=r)})}CreateAction(e){let t={id:Fn(si(e,["service","service_data"])),name:(a=e.service,"turn_on"==a?pn("services.turn_on"):"turn_off"==a?pn("services.turn_off"):"open_cover"==a?pn("services.open_cover"):"close_cover"==a?pn("services.close_cover"):"set_temperature"==a?pn("services.set_temperature"):"set_cover_position"==a?pn("services.set_position"):-1!==a.indexOf(".")?a.split(".").pop():a),icon:(r=e.service,"turn_on"==r?"toggle-switch-outline":"turn_off"==r?"toggle-switch-off-outline":"open_cover"==r?"window-shutter-open":"close_cover"==r?"window-shutter":"set_temperature"==r?"thermometer":"set_cover_position"==r?"window-shutter":"flash"),service:e.service,routine:!1};var r,a;return Ha(e,"service_data")&&!function(e){if(null==e)return!0;if(vt(e)&&(ge(e)||"string"==typeof e||"function"==typeof e.splice||Ot(e)||Tt(e)||St(e)))return!e.length;var t=Wr(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(bt(e))return!Vt(e).length;for(var r in e)if(Ga.call(e,r))return!1;return!0}(e)&&Object.assign(t,si(e,"service_data")),Ha(e,"icon")&&Object.assign(t,si(e,"icon")),Ha(e,"name")&&Object.assign(t,si(e,"name")),Ha(e,"variable")&&Object.assign(t,{variable:Object.assign(En(e.variable.field),e.variable)}),Ha(e,"routine")&&Object.assign(t,si(e,"routine")),t}FindAction(e,t){let r=this.GetActionsForEntity(e),a=La(r,{id:t});return a||null}GetActionsForEntity(e){let t=this.FindEntity(e);if(!t)return[];let r=[...t.actions];return r.filter(e=>e.routine).length&&!La(r,{id:Sn.id})&&r.push(Object.assign({},Sn)),r=ci(r,"name"),r}LoadEntities(e){if(Ra(e,t=>{let r=t.entity_id,a=Cn(r);if(!Dn(r)&&(a in this.userConfig.domains||r in this.userConfig.entities)){let i=[],s={actions:[],name:e[r].attributes.friendly_name,icon:e[r].attributes.icon},n=!1;if(a in this.userConfig.domains&&(Ha(this.userConfig.domains[a],"include")&&!this.userConfig.domains[a].include.includes(r)&&(n=!0),Ha(this.userConfig.domains[a],"exclude")&&this.userConfig.domains[a].exclude.includes(r)&&(n=!0),Object.assign(s,Xa(this.userConfig.domains[a],"actions")),Ha(this.userConfig.domains[a],"actions")&&!n)){let e=Wa(this.userConfig.domains[a].actions,e=>{if(Cn((e=Object.assign({},e)).service)==a&&(e=Object.assign(e,{service:e.service.split(".").pop()})),"light"==a&&t.attributes.hasOwnProperty("supported_features")){!(1&t.attributes.supported_features)&&e.variable&&delete e.variable}else if("cover"==a&&t.attributes.hasOwnProperty("supported_features")){if(!(4&t.attributes.supported_features)&&e.variable)return null}return this.CreateAction(e)});e=Ia(e,e=>e),Ra(e,e=>i.push(e))}if(r in this.userConfig.entities){if(Object.assign(s,Xa(this.userConfig.entities[r],"actions")),Ha(this.userConfig.entities[r],"actions")){let e=Wa(this.userConfig.entities[r].actions,e=>{if(Cn((e=Object.assign({},e)).service)==a&&(e=Object.assign(e,{service:e.service.split(".").pop()})),"light"==a&&t.attributes.hasOwnProperty("supported_features")){!(1&t.attributes.supported_features)&&e.variable&&delete e.variable}else if("cover"==a&&t.attributes.hasOwnProperty("supported_features")){if(!(4&t.attributes.supported_features)&&e.variable)return null}return this.CreateAction(e)});e=Ia(e,e=>e),Ra(e,e=>i.push(e))}n=!1}if(n)return;this.AddEntity(s,r),Ra(i,e=>this.AddActionToEntity(r,e))}}),this.userConfig.discover_existing){let a=Ia(e,e=>Dn(e.entity_id));r=e=>e.attributes.actions,a=(ge(t=a)?ye:qa)(t,Aa(r)),a=br(a),Ra(a,t=>{let r=Object.assign({},t),a=r.entity,i=r.service,s=Xa(r,["entity","service"]);Cn(a)||(a=Cn(i)+"."+a,i=i.split(".").pop());let n=this.CreateAction({service:i,service_data:s});if(!this.FindEntity(a)){if(!e[a])return;let t={actions:[],name:e[a].attributes.friendly_name,icon:e[a].attributes.icon};this.AddEntity(t,a)}this.AddActionToEntity(a,n)})}var t,r}}const Mn=te` +(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");const re={};class ae extends B{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;const e=this.getStyles();if(Array.isArray(e)){const t=(e,r)=>e.reduceRight((e,r)=>Array.isArray(r)?t(r,e):(e.add(r),e),r),r=t(e,new Set),a=[];r.forEach(e=>a.unshift(e)),this._styles=a}else this._styles=void 0===e?[]:[e];this._styles=this._styles.map(e=>{if(e instanceof CSSStyleSheet&&!Y){const t=Array.prototype.slice.call(e.cssRules).reduce((e,t)=>e+t.cssText,"");return new ee(String(t),X)}return e})}initialize(){super.initialize(),this.constructor._getUniqueStyles(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow({mode:"open"})}adoptStyles(){const e=this.constructor._styles;0!==e.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?Y?this.renderRoot.adoptedStyleSheets=e.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(e.map(e=>e.cssText),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(e){const t=this.render();super.update(e),t!==re&&this.constructor.render(t,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach(e=>{const t=document.createElement("style");t.textContent=e.cssText,this.renderRoot.appendChild(t)}))}render(){return re}}var se;ae.finalized=!0,ae.render=(e,t,r)=>{if(!r||"object"!=typeof r||!r.scopeName)throw new Error("The `scopeName` option is required.");const s=r.scopeName,i=I.has(t),o=V&&11===t.nodeType&&!!t.host,n=o&&!M.has(s),l=n?document.createDocumentFragment():t;if(((e,t,r)=>{let s=I.get(t);void 0===s&&(a(t,t.firstChild),I.set(t,s=new j(Object.assign({templateFactory:R},r))),s.appendInto(t)),s.setValue(e),s.commit()})(e,l,Object.assign({templateFactory:q(s)},r)),n){const e=I.get(l);I.delete(l);const r=e.value instanceof _?e.value.template:void 0;Q(s,l,r),a(t,t.firstChild),t.appendChild(l),I.set(t,e)}!i&&o&&window.ShadyCSS.styleElement(t.host)},function(e){e.Level="LEVEL",e.List="LIST"}(se||(se={}));var ie,oe;function ne(e,t){let r=e>=0?Math.floor(e/60):Math.ceil(e/60),a=e-60*r;return a%t!=0&&(a=Math.round(a/t)*t),a>=60&&(r++,a-=60),r>=24&&(r-=24),60*r+a}function le(e,t={}){let r=!!t.amPm&&t.amPm,a=!!t.absolute&&t.absolute,s=e>=0?Math.floor(e/60):Math.ceil(e/60),i=e-60*s,o="";r&&(o=s>=12?"PM":"AM",(s>12||12==s&&i>0)&&(s-=12));let n=String(Math.abs(s)).padStart(2,"0"),l=String(Math.abs(i)).padStart(2,"0"),c=s<0||i<0;return{hours:n,minutes:l,time:`${c&&!a?"-":""}${n}:${l}${r?" "+o:""}`,signed:c,amPm:o}}function ce(e,t={}){let r=t.stepSize?t.stepSize:1,a=!!t.signed&&t.signed,s=t.max?t.max:1440,i=ne(e,r);return i<0&&!a?e+=1440:i>=1440&&(e-=1440),i<-s?-s:i>s?s:e}function de(e){let t,r,a;if(null!==(a=/^([0-9]{2}):([0-9]{2})$/.exec(e)))[t,r]=[Number(a[1]),Number(a[2])];else if(null!==(a=/^([0-9]{2})([0-9]{2})$/.exec(e)))[t,r]=[Number(a[1]),Number(a[2])];else{if(null!==(a=/^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}[\+|\-][0-9]{2}:[0-9]{2}$/.exec(e))){let e=new Date(a[0]);return de(`${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}`)}console.log(`failed to parse timestamp '${e}'`)}return 60*t+r}function ue(e){return e.type==oe.Weekdays?[1,2,3,4,5]:e.type==oe.Custom&&e.custom_days?e.custom_days.sort().filter(e=>0!=e):[]}function he(e){let t=[1,2,3,4,5,6,7],r=[1,2,3,4,5],a=[...e].sort().filter(e=>0!=e);return a.every((e,r)=>e==t[r])?{type:oe.Daily,custom_days:[]}:a.every((e,t)=>e==r[t])?{type:oe.Weekdays,custom_days:[]}:{type:oe.Custom,custom_days:a}}function pe(e){return e==ie.Sunrise?"sunrise":"sunset"}!function(e){e.Sunrise="SUNRISE",e.Sunset="SUNSET"}(ie||(ie={})),function(e){e.Daily="DAILY",e.Weekdays="WEEKDAYS",e.Custom="CUSTOM"}(oe||(oe={}));const me={sunrise:null,sunset:null,title:!0,am_pm:!1,time_step:10,temperature_unit:"",is_admin:!0},fe={climate:{},cover:{},fan:{},light:{},switch:{}},ve={time:{value:de("12:00")},days:{type:oe.Daily},action:"",entity:""},ye="create_routine",ge={type:se.Level,field:"",unit:"",name:"level",min:0,max:255,step:1,optional:!1},_e={type:se.List,field:"",name:"option",options:[]};de("00:00"),de("08:00"),de("08:00"),de("16:00"),de("16:00");var be={add:"hinzufügen",cancel:"abbrechen",next:"weiter",save:"speichern",delete:"löschen"},we={no_group_selected:"Wähle zuerst eine Gruppe aus",no_entity_selected:"Wähle zuerst eine Entity aus",no_groups_defined:"Es gibt keine Gruppe",no_entities_for_group:"Es gibt keine Entities in dieser Gruppe",no_actions_for_entity:"Es gibt keine Aktionen für diese Entity",no_entries_defined:"Es gibt keine Einträge"},Pe={group:"Gruppe",entity:"Entity",action:"Aktion",days:"Tage",time:"Zeit",options:"Optionen",day_type_daily:"jeden Tag",day_type_weekdays:"Werktags",day_type_custom:"benutzerdefiniert",shift_with_sun:"Zeit automatisch an Sonnenauf- bzw. Sonnenuntergang anpassen",brightness:"Helligkeit",temperature:"Temperatur",position:"Position"},Se={mon:"Mo",tue:"Di",wed:"Mi",thu:"Do",fri:"Fr",sat:"Sa",sun:"So"},Ee={mon:"Montag",tue:"Dienstag",wed:"Mittwoch",thu:"Donnerstag",fri:"Freitag",sat:"Samstag",sun:"Sonntag"},xe={on:"An",every:"jeden",and:"und",at:"um",before:"vor",after:"nach",sunrise:"Sonnenaufgang",sunset:"Sonnenuntergang"},$e={turn_on:"anschalten",turn_off:"ausschalten",close_cover:"schließen",open_cover:"öffnen",set_temperature:"Temperatur einstellen",set_to:"setzen auf",set_position:"Position setzen",set_hvac_mode:"set mode",set_preset_mode:"set preset",set_value:"set value",select_option:"select option",select_source:"select source",start:"start"},je={camera:"cameras",climate:"Heizung",cover:"Beschattung",fan:"Lüfter",group:"groups",input_boolean:"input_boolean",input_number:"input_number",input_select:"input_select",light:"Licht",media_player:"media players",scene:"scenes",switch:"Schalter",vacuum:"Staubsauger"},ke={scheduler:"Zeitplaner",actions:be,instructions:we,fields:Pe,days_short:Se,days_long:Ee,words:xe,services:$e,domains:je},Oe=Object.freeze({__proto__:null,scheduler:"Zeitplaner",actions:be,instructions:we,fields:Pe,days_short:Se,days_long:Ee,words:xe,services:$e,domains:je,default:ke}),Ce={add:"add item",cancel:"cancel",next:"next",save:"save",delete:"delete"},Ae={no_group_selected:"Select a group first",no_entity_selected:"Select an entity first",no_groups_defined:"There are no groups defined",no_entities_for_group:"There are no entities in this group",no_actions_for_entity:"There are no actions for this entity",no_entries_defined:"There are no items to show"},Fe={group:"Group",entity:"Entity",action:"Action",days:"Days",time:"Time",options:"Options",day_type_daily:"every day",day_type_weekdays:"weekdays",day_type_custom:"custom",shift_with_sun:"automatically adjust time to sunrise/sunset",brightness:"Brightness",temperature:"Temperature",position:"Position"},De={mon:"mon",tue:"tue",wed:"wed",thu:"thu",fri:"fri",sat:"sat",sun:"sun"},Re={mon:"monday",tue:"tuesday",wed:"wednesday",thu:"thursday",fri:"friday",sat:"saturday",sun:"sunday"},ze={on:"on",every:"every",and:"and",at:"at",before:"before",after:"after",sunrise:"sunrise",sunset:"sunset"},Ie={turn_on:"turn on",turn_off:"turn off",close_cover:"close",open_cover:"open",set_temperature:"set temperature",set_to:"set to",set_position:"set position",set_hvac_mode:"set mode",set_preset_mode:"set preset",set_value:"set value",select_option:"select option",select_source:"select source",start:"start"},Ne={camera:"cameras",climate:"climate",cover:"covers",fan:"fans",group:"groups",input_boolean:"input_boolean",input_number:"input_number",input_select:"input_select",light:"lights",media_player:"media players",scene:"scenes",switch:"switches",vacuum:"vacuum"},Te={scheduler:"Scheduler",actions:Ce,instructions:Ae,fields:Fe,days_short:De,days_long:Re,words:ze,services:Ie,domains:Ne},Le=Object.freeze({__proto__:null,scheduler:"Scheduler",actions:Ce,instructions:Ae,fields:Fe,days_short:De,days_long:Re,words:ze,services:Ie,domains:Ne,default:Te}),Ve={add:"Agregar",cancel:"cancelar",next:"siguiente",save:"guardar",delete:"borrar"},qe={no_group_selected:"Selecciona un grupo primero",no_entity_selected:"Selecciona una entidad primero",no_groups_defined:"No hay grupos definidos",no_entities_for_group:"No hay entidades en este grupo",no_actions_for_entity:"No hay acciones para esta entidad",no_entries_defined:"No hay dispositivos definidos"},Ue={group:"Grupo",entity:"Entidad",action:"Acción",days:"Días",time:"Hora",options:"Opciones",day_type_daily:"cada día",day_type_weekdays:"dias semanales",day_type_custom:"personalizado",shift_with_sun:"ajusta automaticamente la hora al amanecer/atardecer",brightness:"Brillo",temperature:"Temperatura",position:"Posición"},Me={mon:"lun",tue:"mar",wed:"mie",thu:"jue",fri:"vie",sat:"sab",sun:"dom"},Qe={mon:"lunes",tue:"martes",wed:"miércoles",thu:"jueves",fri:"viernes",sat:"sábado",sun:"domingo"},He={on:"el",every:"cada",and:"y",at:"a las",before:"antes",after:"después",sunrise:"amanecer",sunset:"atardecer"},Ge={turn_on:"encender",turn_off:"apagar",close_cover:"cerrar",open_cover:"abrir",set_temperature:"establecer temperatura",set_to:"establecer a",set_position:"posición de ajuste",set_hvac_mode:"set mode",set_preset_mode:"set preset",set_value:"set value",select_option:"select option",select_source:"select source",start:"start"},Ke={camera:"cameras",climate:"climatización",cover:"persiana",fan:"ventilador",group:"groups",input_boolean:"input_boolean",input_number:"input_number",input_select:"input_select",light:"luces",media_player:"media players",scene:"scenes",switch:"interruptores",vacuum:"aspirador"},Be={scheduler:"Programador",actions:Ve,instructions:qe,fields:Ue,days_short:Me,days_long:Qe,words:He,services:Ge,domains:Ke},Je=Object.freeze({__proto__:null,scheduler:"Programador",actions:Ve,instructions:qe,fields:Ue,days_short:Me,days_long:Qe,words:He,services:Ge,domains:Ke,default:Be}),We={add:"lisa",cancel:"loobu",next:"edasi",save:"salvesta",delete:"kustuta"},Ze={no_group_selected:"Vali grupp",no_entity_selected:"Vali olem",no_groups_defined:"Gruppe pole määratud",no_entities_for_group:"Antud grupis puuduvad olemid",no_actions_for_entity:"Selles olemis puuduvad tegevused",no_entries_defined:"Pole midagi kuvada"},Ye={group:"Grupp",entity:"Olem",action:"Tegevus",days:"Päev",time:"Aeg",options:"Suvandid",day_type_daily:"iga päev",day_type_weekdays:"tööpäevadel",day_type_custom:"valikuline",shift_with_sun:"määrake automaatselt Päikese tõus/loojang",brightness:"Heledus",temperature:"Temperatuur",position:"Asukoht"},Xe={mon:"E",tue:"T",wed:"K",thu:"N",fri:"R",sat:"L",sun:"P"},et={mon:"Esmaspäev",tue:"Teisipäev",wed:"Kolmapäev",thu:"Neljapäev",fri:"Reede",sat:"Laupäev",sun:"Pühapäev"},tt={on:" ",every:"iga",and:"ja",at:"kell",before:"enne",after:"pärast",sunrise:"päikesetõus",sunset:"loojang"},rt={turn_on:"lülita sisse",turn_off:"lülita välja",close_cover:"sulge",open_cover:"ava",set_temperature:"määra temperatuur",set_to:"seadista väärtusele",set_position:"seadista asendisse",set_hvac_mode:"set mode",set_preset_mode:"set preset",set_value:"set value",select_option:"select option",select_source:"select source",start:"start"},at={camera:"cameras",climate:"kliimaseade",cover:"(akna)katted",fan:"ventilaatorid",group:"groups",input_boolean:"input_boolean",input_number:"input_number",input_select:"input_select",light:"valgustid",media_player:"media players",scene:"scenes",switch:"lülitid",vacuum:"tolmuimejad"},st={scheduler:"Ajastaja",actions:We,instructions:Ze,fields:Ye,days_short:Xe,days_long:et,words:tt,services:rt,domains:at},it=Object.freeze({__proto__:null,scheduler:"Ajastaja",actions:We,instructions:Ze,fields:Ye,days_short:Xe,days_long:et,words:tt,services:rt,domains:at,default:st}),ot={add:"ajouter un item",cancel:"annuler",next:"suivant",save:"sauvegarder",delete:"effacer"},nt={no_group_selected:"Sélectionner un groupe en premier",no_entity_selected:"Sélectionner une entité en premier",no_groups_defined:"Il n'y a pas de groupe défini",no_entities_for_group:"Il n'y a pas d'entité dans ce groupe",no_actions_for_entity:"Il n'y a pas d'action pour cette entité",no_entries_defined:"Il n'y a pas d'item à afficher"},lt={group:"Groupe",entity:"Entité",action:"Action",days:"Jours",time:"Temps",options:"Options",day_type_daily:"chaque jour",day_type_weekdays:"en semaine",day_type_custom:"sur mesure",shift_with_sun:"ajuster automatiquement l'heure au lever/coucher du soleil",brightness:"Luminosité",temperature:"Température",position:"Position"},ct={mon:"lun",tue:"mar",wed:"mer",thu:"jeu",fri:"ven",sat:"sam",sun:"dim"},dt={mon:"lundi",tue:"mardi",wed:"mercredi",thu:"jeudi",fri:"vendredi",sat:"samedi",sun:"dimanche"},ut={on:"marche",every:"tout",and:"et",at:"à",before:"avant",after:"après",sunrise:"lever du soleil",sunset:"coucher du soleil"},ht={turn_on:"allumer",turn_off:"éteindre",close_cover:"fermer",open_cover:"ouvrir",set_temperature:"régler la température",set_to:"défini à",set_position:"position définie",set_hvac_mode:"set mode",set_preset_mode:"set preset",set_value:"set value",select_option:"select option",select_source:"select source",start:"start"},pt={camera:"cameras",climate:"climat",cover:"contrôleur",fan:"ventilateur",group:"groups",input_boolean:"input_boolean",input_number:"input_number",input_select:"input_select",light:"lumière",media_player:"media players",scene:"scenes",switch:"interrupteurs",vacuum:"aspirateur"},mt={scheduler:"Planificateur",actions:ot,instructions:nt,fields:lt,days_short:ct,days_long:dt,words:ut,services:ht,domains:pt},ft=Object.freeze({__proto__:null,scheduler:"Planificateur",actions:ot,instructions:nt,fields:lt,days_short:ct,days_long:dt,words:ut,services:ht,domains:pt,default:mt}),vt={add:"új időzítés",cancel:"mégse",next:"tovább",save:"törlés",delete:"delete"},yt={no_group_selected:"Előbb egy csoportot szükséges választani",no_entity_selected:"Előbb egy entitást szükséges választani",no_groups_defined:"Nincsenek deffiniált csoportok",no_entities_for_group:"Ebben a csoportban nem találhatók entitások",no_actions_for_entity:"Ehhez az entitáshoz nem tartoznak műveletek",no_entries_defined:"Nincs megjeleníthető elem"},gt={group:"Csoport",entity:"Entitás",action:"Művelet",days:"Napokon",time:"Időpontban",options:"Opciók",day_type_daily:"minden nap",day_type_weekdays:"munkanapokon",day_type_custom:"egyedi",shift_with_sun:"Az idő automatikus igazítása napkeltéhez/naplementéhez",brightness:"Fényerő",temperature:"Hőmérséklet",position:"Pozíciót"},_t={mon:"hét",tue:"ked",wed:"sze",thu:"csü",fri:"pén",sat:"szo",sun:"vas"},bt={mon:"hétfő",tue:"kedd",wed:"szerda",thu:"csütörtök",fri:"péntek",sat:"szombat",sun:"vasárnap"},wt={on:"on",every:"minden",and:"és",at:"at",before:"előtt",after:"után",sunrise:"napkelte",sunset:"naplemente"},Pt={turn_on:"bekapcsolás",turn_off:"kikapcsolás",close_cover:"zárás",open_cover:"nyitás",set_temperature:"hőmérséklet",set_to:"beállítva",set_position:"változtass pozíciót",set_hvac_mode:"set mode",set_preset_mode:"set preset",set_value:"set value",select_option:"select option",select_source:"select source",start:"start"},St={camera:"cameras",climate:"termosztát",cover:"redőny",fan:"ventilátor",group:"groups",input_boolean:"input_boolean",input_number:"input_number",input_select:"input_select",light:"lámpa",media_player:"media players",scene:"scenes",switch:"kapcsoló",vacuum:"pórszívó"},Et={scheduler:"Időzítések",actions:vt,instructions:yt,fields:gt,days_short:_t,days_long:bt,words:wt,services:Pt,domains:St},xt=Object.freeze({__proto__:null,scheduler:"Időzítések",actions:vt,instructions:yt,fields:gt,days_short:_t,days_long:bt,words:wt,services:Pt,domains:St,default:Et}),$t={add:"Nieuw item",cancel:"annuleren",next:"verder",save:"opslaan",delete:"verwijder"},jt={no_group_selected:"Selecteer eerst een groep",no_entity_selected:"Selecteer eerst een entiteit",no_groups_defined:"Er zijn geen groepen gedefinieerd",no_entities_for_group:"Deze groep heeft geen entiteiten",no_actions_for_entity:"Deze entiteit heeft geen acties",no_entries_defined:"Er zijn geen items aangemaakt"},kt={group:"Groep",entity:"Entiteit",action:"Actie",days:"Dagen",time:"Tijdstip",options:"Opties",day_type_daily:"Dagelijks",day_type_weekdays:"werkdagen",day_type_custom:"Anders",shift_with_sun:"Automatisch aanpassen aan zonsopgang/zonsondergang",brightness:"Helderheid",temperature:"Temperatuur",position:"Positie"},Ot={mon:"ma",tue:"di",wed:"wo",thu:"do",fri:"vr",sat:"za",sun:"zo"},Ct={mon:"maandag",tue:"dinsdag",wed:"woensdag",thu:"donderdag",fri:"vrijdag",sat:"zaterdag",sun:"zondag"},At={on:"op",every:"elke",and:"en",at:"om",before:"voor",after:"na",sunrise:"zonsopgang",sunset:"zonsondergang"},Ft={turn_on:"aanzetten",turn_off:"uitzetten",close_cover:"sluiten",open_cover:"openen",set_temperature:"temperatuur instellen",set_to:"Zet op",set_position:"positie instellen",set_hvac_mode:"stand aanpassen",set_preset_mode:"voorinstelling kiezen",set_value:"waarde instellen",select_option:"optie selecteren",select_source:"ingang selecteren",start:"starten"},Dt={camera:"cameras",climate:"verwarming",cover:"zonwering",fan:"ventilatie",group:"groepen",input_boolean:"input_boolean",input_number:"input_number",input_select:"input_select",light:"verlichting",media_player:"mediaspelers",scene:"scènes",switch:"schakelaars",vacuum:"stofzuigers"},Rt={scheduler:"Tijdplanner",actions:$t,instructions:jt,fields:kt,days_short:Ot,days_long:Ct,words:At,services:Ft,domains:Dt},zt=Object.freeze({__proto__:null,scheduler:"Tijdplanner",actions:$t,instructions:jt,fields:kt,days_short:Ot,days_long:Ct,words:At,services:Ft,domains:Dt,default:Rt}),It={add:"legg til",cancel:"avbryt",next:"neste",save:"lagre",delete:"slett"},Nt={no_group_selected:"Velg en gruppe først",no_entity_selected:"Velg en entitet først",no_groups_defined:"Ingen grupper definert",no_entities_for_group:"Det finnes ingen entiteter i denne gruppen",no_actions_for_entity:"Det finnes ingen handlinger for denne entiteten",no_entries_defined:"Det er ingen definerte tidsplaner å vise"},Tt={group:"Gruppe",entity:"Entitet",action:"Handling",days:"Dager",time:"Tid",options:"Valg",day_type_daily:"hver dag",day_type_weekdays:"ukedager",day_type_custom:"egendefinert",shift_with_sun:"automatisk juster tid for soloppgang/solnedgang",brightness:"Lysstyrke",temperature:"Temperatur",position:"Posisjon"},Lt={mon:"man",tue:"tir",wed:"ons",thu:"tor",fri:"fre",sat:"lør",sun:"søn"},Vt={mon:"mandag",tue:"tirsdag",wed:"onsdag",thu:"torsdag",fri:"fredag",sat:"lørdag",sun:"søndag"},qt={on:"den",every:"hver",and:"og",at:"på",before:"før",after:"etter",sunrise:"soloppgang",sunset:"solnedgang"},Ut={turn_on:"slå på",turn_off:"slå av",close_cover:"lukk",open_cover:"åpne",set_temperature:"sett temperatur",set_to:"sett til",set_position:"sett posisjon",set_hvac_mode:"set mode",set_preset_mode:"set preset",set_value:"set value",select_option:"select option",select_source:"select source",start:"start"},Mt={camera:"cameras",climate:"klima",cover:"cover",fan:"vifter",group:"groups",input_boolean:"input_boolean",input_number:"input_number",input_select:"input_select",media_player:"media players",scene:"scenes",light:"lys",switch:"brytere",vacuum:"støvsugere"},Qt={scheduler:"Tidsplan",actions:It,instructions:Nt,fields:Tt,days_short:Lt,days_long:Vt,words:qt,services:Ut,domains:Mt},Ht=Object.freeze({__proto__:null,scheduler:"Tidsplan",actions:It,instructions:Nt,fields:Tt,days_short:Lt,days_long:Vt,words:qt,services:Ut,domains:Mt,default:Qt}),Gt={add:"dodaj",cancel:"anuluj",next:"dalej",save:"zapisz",delete:"usuń"},Kt={no_group_selected:"Najpierw wybierz grupę",no_entity_selected:"Najpierw wybierz encję",no_groups_defined:"Nie ma zdefiniowanych grup",no_entities_for_group:"Nie ma encji w tej grupie",no_actions_for_entity:"Nie ma akcji dla tej encji",no_entries_defined:"Nie ma elementów do pokazania"},Bt={group:"Grupa",entity:"Encja",action:"Akcja",days:"Dni",time:"Czas",options:"Opcje",day_type_daily:"codziennie",day_type_weekdays:"dni tygodnia",day_type_custom:"niestandardowy",shift_with_sun:"automatycznie dopasuj czas do wschodów/zachodów",brightness:"Jasność",temperature:"Temperatura",position:"Pozycję"},Jt={mon:"pon",tue:"wt",wed:"śr",thu:"czw",fri:"pt",sat:"sob",sun:"niedz"},Wt={mon:"poniedziałek",tue:"wtorek",wed:"środa",thu:"czwartek",fri:"piątek",sat:"sobota",sun:"niedziela"},Zt={on:"w",every:"każdy",and:"oraz",at:"o",before:"przed",after:"po",sunrise:"wschód",sunset:"zachodów"},Yt={turn_on:"włącz",turn_off:"wyłącz",close_cover:"zamknij",open_cover:"otwórz",set_temperature:"Ustaw temperaturę",set_to:"ustaw na",set_position:"Ustaw pozycję",set_hvac_mode:"set mode",set_preset_mode:"set preset",set_value:"set value",select_option:"select option",select_source:"select source",start:"start"},Xt={camera:"cameras",climate:"termostat",cover:"roleta",fan:"wiatrak",group:"groups",input_boolean:"input_boolean",input_number:"input_number",input_select:"input_select",media_player:"media players",scene:"scenes",light:"światło",switch:"włącznik",vacuum:"odkurzacz"},er={scheduler:"Harmonogram",actions:Gt,instructions:Kt,fields:Bt,days_short:Jt,days_long:Wt,words:Zt,services:Yt,domains:Xt},tr=Object.freeze({__proto__:null,scheduler:"Harmonogram",actions:Gt,instructions:Kt,fields:Bt,days_short:Jt,days_long:Wt,words:Zt,services:Yt,domains:Xt,default:er}),rr={add:"adicionar item",cancel:"cancelar",next:"próximo",save:"gravar",delete:"apagar"},ar={no_group_selected:"Selecione um grupo primeiro",no_entity_selected:"Selecione uma entidade primeiro",no_groups_defined:"Não tem grupo definido",no_entities_for_group:"Não tem entidade no grupo",no_actions_for_entity:"Não há ações para esta entidade",no_entries_defined:"Não tem item pra mostar"},sr={group:"Grupo",entity:"Entidade",action:"Ação",days:"Dias",time:"Hora",options:"Opções",day_type_daily:"todos os dias",day_type_weekdays:"dias da semana",day_type_custom:"personalizado",shift_with_sun:"automaticamente ajusta hora pelo nascer do sol/pôr do sol",brightness:"Brilho",temperature:"Temperatura",position:"Posição"},ir={mon:"seg",tue:"ter",wed:"qua",thu:"qui",fri:"sex",sat:"sab",sun:"dom"},or={mon:"segunda",tue:"terça",wed:"quarta",thu:"quinta",fri:"sexta",sat:"sabádo",sun:"domingo"},nr={on:"on",every:"cada",and:"e",at:"às",before:"antes",after:"depois",sunrise:"nascer do sol",sunset:"pôr do sol"},lr={turn_on:"ligar",turn_off:"desligar",close_cover:"fechar",open_cover:"abrir",set_temperature:"ajustar temperatura",set_to:"ajustar para",set_position:"ajustar posição",set_hvac_mode:"set mode",set_preset_mode:"set preset",set_value:"set value",select_option:"select option",select_source:"select source",start:"start"},cr={camera:"cameras",climate:"ar condicionado",cover:"persiana",fan:"ventilador",group:"groups",input_boolean:"input_boolean",input_number:"input_number",input_select:"input_select",media_player:"media players",scene:"scenes",light:"luz",switch:"interruptor",vacuum:"aspirador"},dr={scheduler:"Agenda",actions:rr,instructions:ar,fields:sr,days_short:ir,days_long:or,words:nr,services:lr,domains:cr},ur=Object.freeze({__proto__:null,scheduler:"Agenda",actions:rr,instructions:ar,fields:sr,days_short:ir,days_long:or,words:nr,services:lr,domains:cr,default:dr}),hr={add:"добавить",cancel:"отменить",next:"далее",save:"сохранить",delete:"удалить"},pr={no_group_selected:"Необходимо выбрать группу",no_entity_selected:"Необходимо выбрать объект",no_groups_defined:"Ни одной группы не создано",no_entities_for_group:"В этой группе нет объектов",no_actions_for_entity:"Для этого объекта нет действий",no_entries_defined:"Объекты отсутствуют"},mr={group:"Группа",entity:"Объект",action:"Действие",days:"Дни",time:"Время",options:"Опции",day_type_daily:"ежедневно",day_type_weekdays:"по будням",day_type_custom:"выбрать дни",shift_with_sun:"автоматически настраивать время на восход / закат",brightness:"Яркость",temperature:"Температура",position:"Позицию"},fr={mon:"пн",tue:"вт",wed:"ср",thu:"чт",fri:"пт",sat:"сб",sun:"вс"},vr={mon:"понедельник",tue:"вторник",wed:"среда",thu:"четверг",fri:"пятница",sat:"суббота",sun:"воскресенье"},yr={on:"по",every:"каждый",and:"и",at:"в",before:"до",after:"после",sunrise:"восхода",sunset:"заката"},gr={turn_on:"включить",turn_off:"выключить",close_cover:"закрыть",open_cover:"открыть",set_temperature:"задать температуру",set_to:"установить",set_position:"установить позицию",set_hvac_mode:"set mode",set_preset_mode:"set preset",set_value:"set value",select_option:"select option",select_source:"select source",start:"start"},_r={camera:"cameras",climate:"Климат",cover:"Жалюзи",fan:"Вентиляторы",group:"groups",input_boolean:"input_boolean",input_number:"input_number",input_select:"input_select",media_player:"media players",scene:"scenes",light:"Свет",switch:"Выключатели",vacuum:"Пылесосы"},br={scheduler:"Планирование",actions:hr,instructions:pr,fields:mr,days_short:fr,days_long:vr,words:yr,services:gr,domains:_r},wr={de:Oe,en:Le,es:Je,et:it,es_419:Je,fr:ft,hu:xt,nb:Ht,nl:zt,nn:Ht,no:Ht,pl:tr,pt:ur,pt_BR:ur,ru:Object.freeze({__proto__:null,scheduler:"Планирование",actions:hr,instructions:pr,fields:mr,days_short:fr,days_long:vr,words:yr,services:gr,domains:_r,default:br})};function Pr(e,t="",r=""){const a=Sr();var s;try{if("test"==a)return"TRANSLATED";s=e.split(".").reduce((e,t)=>e[t],wr[a])}catch(t){s=e.split(".").reduce((e,t)=>e[t],wr.en)}return void 0===s&&(s=e.split(".").reduce((e,t)=>e[t],wr.en)),""!==t&&""!==r&&(s=s.replace(t,r)),s}function Sr(){var e;let t=null===(e=localStorage.getItem("selectedLanguage"))||void 0===e?void 0:e.replace(/['"]+/g,"").replace("-","_");if(!t||"null"==t){const e=document.querySelector("home-assistant").hass;t=e.selectedLanguage||e.language||"en"}return String(t)}const Er={turn_on:"services.turn_on",turn_off:"services.turn_off",open_cover:"services.open_cover",close_cover:"services.close_cover",set_temperature:"services.set_temperature",set_cover_position:"services.set_cover_position",set_hvac_mode:"services.set_hvac_mode",set_preset_mode:"services.set_preset_mode",set_value:"services.set_value",select_option:"services.select_option",select_source:"services.select_source",start:"services.start"},xr={camera:"domains.camera",climate:"domains.climate",cover:"domains.cover",fan:"domains.fan",group:"domains.group",input_boolean:"domains.input_boolean",input_number:"domains.input_number",input_select:"domains.input_select",light:"domains.light",media_player:"domains.media_player",scene:"domains.scene",switch:"domains.switch",vacuum:"domains.vacuum"};function $r(e,t,r={}){let a=Array.isArray(e)?[...e]:Object.assign({},e);return null===e&&(a=Array.isArray(t)?[]:{}),null==t?e:(Object.keys(t).forEach(e=>{let s=t[e];if(void 0!==s)if(null===s&&r.compact)void 0!==a[e]&&delete a[e];else if(Array.isArray(s)&&Array.isArray(a[e])&&!r.overwrite?s=$r(a[e],s,r):"object"!=typeof s||null===s||"object"!=typeof a[e]||r.overwrite||(s=$r(a[e],s,r)),Array.isArray(t))null!==s&&(r.overwrite?a=s:a.push(s));else{if((Array.isArray(s)||"object"==typeof s)&&null!==s&&!Object.keys(s).length&&r.compact)return void delete a[e];Object.assign(a,{[e]:s})}}),a)}function jr(e,t){return e?Object.entries(e).filter(([e])=>t.includes(e)).reduce((e,[t,r])=>Object.assign(e,{[t]:r}),{}):{}}function kr(e,t){return e?Object.entries(e).filter(([e])=>!t.includes(e)).reduce((e,[t,r])=>Object.assign(e,{[t]:r}),{}):{}}function Or(e,t){return Object.entries(e).map(([e,r])=>[e,t(r,e)]).filter(([,e])=>null!=e).reduce((e,[t,r])=>Object.assign(e,{[t]:r}),{})}function Cr(e,t){return Object.entries(e).filter(([e,r])=>t(r,e)).reduce((e,[t,r])=>Object.assign(e,{[t]:r}),{})}function Ar(e,t){return e.reduce((e,r)=>Object.assign(e,{[t(r)]:r}),{})}function Fr(e){if(-1===e.indexOf("."))return"";return String(e.split(".").shift())}function Dr(e){if(-1===e.indexOf("."))return e;return String(e.split(".").pop())}function Rr(e){if(e.type==oe.Daily)return Pr("fields.day_type_daily");if(e.type==oe.Weekdays)return`${Pr("words.on")} ${Pr("fields.day_type_weekdays")}`;{let r=e.custom_days||[],a=Array();r.includes(1)&&a.push(Pr("days_long.mon")),r.includes(2)&&a.push(Pr("days_long.tue")),r.includes(3)&&a.push(Pr("days_long.wed")),r.includes(4)&&a.push(Pr("days_long.thu")),r.includes(5)&&a.push(Pr("days_long.fri")),r.includes(6)&&a.push(Pr("days_long.sat")),r.includes(7)&&a.push(Pr("days_long.sun"));let s=a.join(", ");var t=s.lastIndexOf(", ");return t&&(s=s.slice(0,t)+s.slice(t).replace(", ",` ${Pr("words.and")} `)),`${Pr("words.every")} ${s}`}}function zr(e,t){let r=!!t.amPm&&t.amPm;if(!e.event)return`${Pr("words.at")} ${le(e.value,{amPm:r}).time}`;let a="unknown",s="";if(e.event===ie.Sunrise&&null!==t.sunrise){a=le(ce(Number(t.sunrise)+e.value),{amPm:r}).time,s="sunrise"}else if(e.event==ie.Sunrise&&null!==t.sunset){a=le(ce(Number(t.sunset)+e.value),{amPm:r}).time,s="sunset"}return 0==Math.abs(e.value)?`${Pr("words.at")} ${Pr("words."+e.event)} (${a})`:`${le(e.value,{absolute:!0}).time} ${le(e.value).signed?Pr("words.before"):Pr("words.after")} ${Pr("words."+s)} (${a})`}function Ir(e){return"string"!=typeof e&&(e=String(e)),Vr(e.replace(/_/g," "))}function Nr(e){return"string"!=typeof e&&(e=String(e)),e.match(/^[a-z]+:[a-z0-9-]+$/i)?e:"hass:"+e}function Tr(e,t,r){let a=Ir(t.name);if(e.hasOwnProperty("variable")&&e.variable&&t.variable){let s=Lr(e.variable,t.variable,r);a=`${Pr("services.set_to")} ${s}`}return Vr(a)}function Lr(e,t,r){if(e.type==se.Level){let a="unit"in(t=t)?t.unit:"";a.length||"temperature"!=t.field||(a=r.temperature_unit);let s=Number(e.value);return"%"==t.unit&&(s=Math.round((s-t.min)/(t.max-t.min)*100),st.max&&(s=t.max)),`${s}${a}`}return String(e.value)}function Vr(e){return e.charAt(0).toUpperCase()+e.slice(1)}function qr(e,t){if(Array.isArray(e)&&Array.isArray(t)){let a=[...e].sort(),s=[...t].sort();if(a.length!=a.length)return!1;for(var r=0;rHr(e,t)),r=function(e,t){var r;if(e.supported_feature&&0==(t&e.supported_feature))return null;(null===(r=e.variable)||void 0===r?void 0:r.supported_feature)&&0==(t&e.variable.supported_feature)&&(e=$r(e,{variable:null},{compact:!0}));return e}(r,t.attributes.supported_features),(null==r?void 0:r.variable)&&(r=function(e,t){let r=Object.assign({},e),a=e.variable;a.name||(a=$r(a,{name:a.field}));if(a=Or(a,e=>Hr(e,t)),"options"in a){let e=[...a.options];e=e.map(e=>"object"!=typeof e?{value:e}:$r(e,{value:Hr(e.value,t)})).filter(e=>e.value),a=$r(a,{options:e},{overwrite:!0});let s=$r(_e,a);r=$r(r,{variable:s},{overwrite:!0})}else{let e=$r(ge,a);r=$r(r,{variable:e})}return r}(r,t)),r}function Hr(e,t){if("string"!=typeof e)return e;let r=String(e).match(/^attribute:(\w+):?(\w+)?$/);return null===r?e:"entity_id"==r[1]?t.entity_id:r[1]in t.attributes?void 0!==r[2]?Array.isArray(t.attributes[r[1]])&&t.attributes[r[1]].includes(r[2])?r[2]:null:t.attributes[r[1]]:null}function Gr(e){let t=e.entity,r=e.service;Fr(t)&&Fr(r)?r=Dr(r):!Fr(t)&&Fr(r)&&(t=Fr(r)+"."+t,r=Dr(r));let a=kr(e,["service","entity","service_data"]),s=$r({},{entity:t,service:r,service_data:Object.keys(a).length?a:null},{compact:!0});return s=$r(s,jr(e,["service_data"])),s}function Kr(e,t){let r=Gr(e),a=t.find(e=>{let t=Br(e);return e.service==r.service&&(t==Br(r)||!!(e.variable&&r.service_data&&Object.keys(r.service_data).includes(e.variable.field))&&t==Br($r(r,{service_data:{[e.variable.field]:null}},{compact:!0})))});return a||null}function Br(e){let t=e=>Object.entries(e).sort((e,t)=>e[0]>t[0]?1:-1).map(([e,r])=>[e,"object"==typeof r&&null!==r?t(r):r]).reduce((e,[t,r])=>Object.assign(e,{[t]:r}),{}),r=jr(e,["service","service_data"]);return r=t(r),Object.values(r).map(e=>JSON.stringify(e).replace(/[\W]/g," ").split(" ").filter(e=>" "!=e&&""!=e).join("_")).join("_")}function Jr(e){return e.match(/^switch.schedule_[0-9a-f]{6}$/)}class Wr{constructor(){this.domainConfig={},this.entityConfig={},this.entities=[],this.standard_configuration=!0}SetConfig(e){this.domainConfig=e.domains,this.entityConfig=e.entities,this.standard_configuration=e.standard_configuration}InDomainCfg(e){let t=Fr(e);if(!(t in this.domainConfig))return!1;let r=this.domainConfig[t];return!("boolean"==typeof r&&!r)&&(!((null==r?void 0:r.include)&&!r.include.includes(e))&&(!(null==r?void 0:r.exclude)||!r.exclude.includes(e)))}InEntityCfg(e){return e in this.entityConfig}InConfig(e){return!Jr(e)&&(this.InDomainCfg(e)||this.InEntityCfg(e))}Find(e){return this.entities.find(t=>t.id==e)}Get(e=[]){let t=[];if(e&&e.length){(Array.isArray(e)?e:[e]).filter(e=>void 0!==this.Find(e)).forEach(e=>t.push(Object.assign({},this.entities[e])))}else t=[...this.entities];return t.sort((e,t)=>e.name>t.name?1:-1),t}Add(e,t){if(this.Find(e))return;let r={id:e,name:Dr(e),icon:"folder-outline",actions:[]};r=$r(r,kr(t,["actions"])),this.entities.push(r)}Set(e,t){if(!this.Find(e))throw`Entity '${e}' does not exist`;for(var r=0;ro.includes(t))),s=$r(s,{actions:Object.values(i)}),s}AddAction(e,t){let r=this.Find(e);if(!r)throw Error(`Entity '${e}' must be created before actions can be assigned`);if(r.actions.find(e=>e.id==t.id))return;let a=[...r.actions];a.push(t),this.Set(e,{actions:a})}}class Zr{constructor(){this.groupConfig={},this.groups=[],this.standard_configuration=!0}SetConfig(e){this.groupConfig=e.groups,this.standard_configuration=e.standard_configuration}Find(e){return this.groups.find(t=>t.id==e)}Get(){let e=[...this.groups].filter(e=>"discovered"!=e.id);return e.sort((e,t)=>e.name>t.name?1:-1),this.Find("discovered")&&e.push(Object.assign({},this.Find("discovered"))),e}Add(e,t){if(this.Find(e))return;let r={id:e,name:e in xr?Pr(xr[e]):e,icon:"folder-outline",domains:[],entities:[]};r=$r(r,t),this.groups.push(r)}Set(e,t){if(!this.Find(e))throw`Group '${e}' does not exist`;for(var r=0;rthis.InGroup(t.id,e))}CreateGroups(e){Object.entries(this.groupConfig).forEach(([e,t])=>this.Add(e,t)),e.forEach(e=>{var t;if(this.InConfig(e))return;let r=Fr(e),a=this.Find(r);if(a){let t=[...a.entities];t.push(e),this.Set(r,{entities:t})}else{let a={entities:[e]};(null===(t=Ur[r])||void 0===t?void 0:t.icon)&&this.standard_configuration&&Object.assign(a,{icon:Ur[r].icon}),this.Add(r,a)}})}}class Yr{constructor(){this.discover_existing=!0,this.standard_configuration=!0,this.entities=new Wr,this.groups=new Zr}setUserConfig(e){void 0!==e.discover_existing&&(this.discover_existing=e.discover_existing),void 0!==e.standard_configuration&&(this.standard_configuration=e.standard_configuration);let t=e.entities||{},r=this.standard_configuration?fe:{},a=e.groups||{};Object.assign(r,e.domains),this.entities.SetConfig({entities:t,domains:r,standard_configuration:this.standard_configuration}),this.groups.SetConfig({groups:a,standard_configuration:this.standard_configuration})}GetGroups(){return this.groups.Get()}GetEntitiesForGroup(e){return this.groups.Find(e)?this.entities.Get().filter(t=>this.groups.InGroup(e,t.id)):[]}FindEntity(e){if(!e)return null;let t=this.entities.Find(e);return t||null}FindAction(e,t){if(!e||!t)return null;let r=this.entities.Find(e);return r?r.actions.find(e=>e.id==t):null}GetActionsForEntity(e){if(!e)return[];let t=this.entities.Find(e);if(!t)return[];let r=[...t.actions];return r.sort((e,t)=>e.name>t.name?1:-1),r}GetEntityConfig(e){return this.entities.GetConfig(e)}LoadEntities(e){if(Object.entries(e).forEach(([e,t])=>{if(!this.entities.InConfig(e))return;let r=this.GetEntityConfig(t);if(this.entities.Add(e,r),r.actions){r.actions.map(e=>Qr(e,t)).filter(e=>e).map(Mr).forEach(t=>this.entities.AddAction(e,t))}}),this.groups.CreateGroups(this.entities.Get().map(e=>e.id)),!this.discover_existing)return;let t=[];if(Object.entries(e).filter(([e])=>Jr(e)).forEach(([r,a])=>{let s=a.attributes.actions;s&&s.forEach(r=>{let a=(Fr(r.entity)||Fr(r.service))+"."+r.entity.split(".").pop();if(!(a in e))return;let s=e[a],i=this.GetEntityConfig(s);this.entities.Find(a)||(this.entities.Add(a,i),t.push(a));let o=i.actions?Kr(r,i.actions):null;o||(o=jr(Gr(r),["service","service_data"]));let n=Mr(o);this.entities.AddAction(a,n)})}),t.length){let e={entities:t,icon:"reload-alert"};this.groups.Add("discovered",e)}}}const Xr=te` /* list view */ div.list-item { @@ -377,9 +377,9 @@ const J=e=>t=>"function"==typeof t?((e,t)=>(window.customElements.define(e,t),t) .padded-right { margin-right: 11px; } -`;var Hn=jn((function(e,t){ +`;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function ea(e,t,r){return e(r={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&r.path)}},r.exports),r.exports}var ta=ea((function(e,t){ /** @license URI.js v4.4.0 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */ -!function(e){function t(){for(var e=arguments.length,t=Array(e),r=0;r1){t[0]=t[0].slice(0,-1);for(var a=t.length-1,i=1;i= 0x80 (not a basic code point)","invalid-input":"Invalid input"},f=Math.floor,m=String.fromCharCode;function v(e){throw new RangeError(p[e])}function y(e,t){var r=e.split("@"),a="";r.length>1&&(a=r[0]+"@",e=r[1]);var i=function(e,t){for(var r=[],a=e.length;a--;)r[a]=t(e[a]);return r}((e=e.replace(h,".")).split("."),t).join(".");return a+i}function g(e){for(var t=[],r=0,a=e.length;r=55296&&i<=56319&&r>1,e+=f(e/t);e>455;a+=36)e=f(e/35);return f(a+36*e/(e+38))},w=function(e){var t,r=[],a=e.length,i=0,s=128,n=72,o=e.lastIndexOf("-");o<0&&(o=0);for(var l=0;l=128&&v("not-basic"),r.push(e.charCodeAt(l));for(var u=o>0?o+1:0;u=a&&v("invalid-input");var m=(t=e.charCodeAt(u++))-48<10?t-22:t-65<26?t-65:t-97<26?t-97:36;(m>=36||m>f((c-i)/h))&&v("overflow"),i+=m*h;var y=p<=n?1:p>=n+26?26:p-n;if(mf(c/g)&&v("overflow"),h*=g}var b=r.length+1;n=_(i-d,b,0==d),f(i/b)>c-s&&v("overflow"),s+=f(i/b),i%=b,r.splice(i++,0,s)}return String.fromCodePoint.apply(String,r)},P=function(e){var t=[],r=(e=g(e)).length,a=128,i=0,s=72,n=!0,o=!1,l=void 0;try{for(var u,d=e[Symbol.iterator]();!(n=(u=d.next()).done);n=!0){var h=u.value;h<128&&t.push(m(h))}}catch(e){o=!0,l=e}finally{try{!n&&d.return&&d.return()}finally{if(o)throw l}}var p=t.length,y=p;for(p&&t.push("-");y=a&&$f((c-i)/O)&&v("overflow"),i+=(w-a)*O,a=w;var k=!0,A=!1,C=void 0;try{for(var F,D=e[Symbol.iterator]();!(k=(F=D.next()).done);k=!0){var z=F.value;if(zc&&v("overflow"),z==a){for(var R=i,T=36;;T+=36){var I=T<=s?1:T>=s+26?26:T-s;if(R>6|192).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase():"%"+(t>>12|224).toString(16).toUpperCase()+"%"+(t>>6&63|128).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase()}function $(e){for(var t="",r=0,a=e.length;r=194&&i<224){if(a-r>=6){var s=parseInt(e.substr(r+4,2),16);t+=String.fromCharCode((31&i)<<6|63&s)}else t+=e.substr(r,6);r+=6}else if(i>=224){if(a-r>=9){var n=parseInt(e.substr(r+4,2),16),o=parseInt(e.substr(r+7,2),16);t+=String.fromCharCode((15&i)<<12|(63&n)<<6|63&o)}else t+=e.substr(r,9);r+=9}else t+=e.substr(r,3),r+=3}return t}function O(e,t){function r(e){var r=$(e);return r.match(t.UNRESERVED)?r:e}return e.scheme&&(e.scheme=String(e.scheme).replace(t.PCT_ENCODED,r).toLowerCase().replace(t.NOT_SCHEME,"")),void 0!==e.userinfo&&(e.userinfo=String(e.userinfo).replace(t.PCT_ENCODED,r).replace(t.NOT_USERINFO,j).replace(t.PCT_ENCODED,i)),void 0!==e.host&&(e.host=String(e.host).replace(t.PCT_ENCODED,r).toLowerCase().replace(t.NOT_HOST,j).replace(t.PCT_ENCODED,i)),void 0!==e.path&&(e.path=String(e.path).replace(t.PCT_ENCODED,r).replace(e.scheme?t.NOT_PATH:t.NOT_PATH_NOSCHEME,j).replace(t.PCT_ENCODED,i)),void 0!==e.query&&(e.query=String(e.query).replace(t.PCT_ENCODED,r).replace(t.NOT_QUERY,j).replace(t.PCT_ENCODED,i)),void 0!==e.fragment&&(e.fragment=String(e.fragment).replace(t.PCT_ENCODED,r).replace(t.NOT_FRAGMENT,j).replace(t.PCT_ENCODED,i)),e}function k(e){return e.replace(/^0*(.*)/,"$1")||"0"}function A(e,t){var r=e.match(t.IPV4ADDRESS)||[],a=l(r,2)[1];return a?a.split(".").map(k).join("."):e}function C(e,t){var r=e.match(t.IPV6ADDRESS)||[],a=l(r,3),i=a[1],s=a[2];if(i){for(var n=i.toLowerCase().split("::").reverse(),o=l(n,2),c=o[0],u=o[1],d=u?u.split(":").map(k):[],h=c.split(":").map(k),p=t.IPV4ADDRESS.test(h[h.length-1]),f=p?7:8,m=h.length-f,v=Array(f),y=0;y1){var _=v.slice(0,g.index),w=v.slice(g.index+g.length);b=_.join(":")+"::"+w.join(":")}else b=v.join(":");return s&&(b+="%"+s),b}return e}var F=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,D=void 0==="".match(/(){0}/)[1];function z(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={},a=!1!==t.iri?o:n;"suffix"===t.reference&&(e=(t.scheme?t.scheme+":":"")+"//"+e);var i=e.match(F);if(i){D?(r.scheme=i[1],r.userinfo=i[3],r.host=i[4],r.port=parseInt(i[5],10),r.path=i[6]||"",r.query=i[7],r.fragment=i[8],isNaN(r.port)&&(r.port=i[5])):(r.scheme=i[1]||void 0,r.userinfo=-1!==e.indexOf("@")?i[3]:void 0,r.host=-1!==e.indexOf("//")?i[4]:void 0,r.port=parseInt(i[5],10),r.path=i[6]||"",r.query=-1!==e.indexOf("?")?i[7]:void 0,r.fragment=-1!==e.indexOf("#")?i[8]:void 0,isNaN(r.port)&&(r.port=e.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?i[4]:void 0)),r.host&&(r.host=C(A(r.host,a),a)),void 0!==r.scheme||void 0!==r.userinfo||void 0!==r.host||void 0!==r.port||r.path||void 0!==r.query?void 0===r.scheme?r.reference="relative":void 0===r.fragment?r.reference="absolute":r.reference="uri":r.reference="same-document",t.reference&&"suffix"!==t.reference&&t.reference!==r.reference&&(r.error=r.error||"URI is not a "+t.reference+" reference.");var s=x[(t.scheme||r.scheme||"").toLowerCase()];if(t.unicodeSupport||s&&s.unicodeSupport)O(r,a);else{if(r.host&&(t.domainHost||s&&s.domainHost))try{r.host=E(r.host.replace(a.PCT_ENCODED,$).toLowerCase())}catch(e){r.error=r.error||"Host's domain name can not be converted to ASCII via punycode: "+e}O(r,n)}s&&s.parse&&s.parse(r,t)}else r.error=r.error||"URI can not be parsed.";return r}function R(e,t){var r=!1!==t.iri?o:n,a=[];return void 0!==e.userinfo&&(a.push(e.userinfo),a.push("@")),void 0!==e.host&&a.push(C(A(String(e.host),r),r).replace(r.IPV6ADDRESS,(function(e,t,r){return"["+t+(r?"%25"+r:"")+"]"}))),"number"!=typeof e.port&&"string"!=typeof e.port||(a.push(":"),a.push(String(e.port))),a.length?a.join(""):void 0}var T=/^\.\.?\//,I=/^\/\.(\/|$)/,N=/^\/\.\.(\/|$)/,U=/^\/?(?:.|\n)*?(?=\/|$)/;function L(e){for(var t=[];e.length;)if(e.match(T))e=e.replace(T,"");else if(e.match(I))e=e.replace(I,"/");else if(e.match(N))e=e.replace(N,"/"),t.pop();else if("."===e||".."===e)e="";else{var r=e.match(U);if(!r)throw new Error("Unexpected dot segment condition");var a=r[0];e=e.slice(a.length),t.push(a)}return t.join("")}function q(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.iri?o:n,a=[],i=x[(t.scheme||e.scheme||"").toLowerCase()];if(i&&i.serialize&&i.serialize(e,t),e.host)if(r.IPV6ADDRESS.test(e.host));else if(t.domainHost||i&&i.domainHost)try{e.host=t.iri?S(e.host):E(e.host.replace(r.PCT_ENCODED,$).toLowerCase())}catch(r){e.error=e.error||"Host's domain name can not be converted to "+(t.iri?"Unicode":"ASCII")+" via punycode: "+r}O(e,r),"suffix"!==t.reference&&e.scheme&&(a.push(e.scheme),a.push(":"));var s=R(e,t);if(void 0!==s&&("suffix"!==t.reference&&a.push("//"),a.push(s),e.path&&"/"!==e.path.charAt(0)&&a.push("/")),void 0!==e.path){var l=e.path;t.absolutePath||i&&i.absolutePath||(l=L(l)),void 0===s&&(l=l.replace(/^\/\//,"/%2F")),a.push(l)}return void 0!==e.query&&(a.push("?"),a.push(e.query)),void 0!==e.fragment&&(a.push("#"),a.push(e.fragment)),a.join("")}function V(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=arguments[3],i={};return a||(e=z(q(e,r),r),t=z(q(t,r),r)),!(r=r||{}).tolerant&&t.scheme?(i.scheme=t.scheme,i.userinfo=t.userinfo,i.host=t.host,i.port=t.port,i.path=L(t.path||""),i.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(i.userinfo=t.userinfo,i.host=t.host,i.port=t.port,i.path=L(t.path||""),i.query=t.query):(t.path?("/"===t.path.charAt(0)?i.path=L(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?i.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:i.path=t.path:i.path="/"+t.path,i.path=L(i.path)),i.query=t.query):(i.path=e.path,void 0!==t.query?i.query=t.query:i.query=e.query),i.userinfo=e.userinfo,i.host=e.host,i.port=e.port),i.scheme=e.scheme),i.fragment=t.fragment,i}function M(e,t){return e&&e.toString().replace(t&&t.iri?o.PCT_ENCODED:n.PCT_ENCODED,$)}var H={scheme:"http",domainHost:!0,parse:function(e,t){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e},serialize:function(e,t){var r="https"===String(e.scheme).toLowerCase();return e.port!==(r?443:80)&&""!==e.port||(e.port=void 0),e.path||(e.path="/"),e}},Q={scheme:"https",domainHost:H.domainHost,parse:H.parse,serialize:H.serialize};function B(e){return"boolean"==typeof e.secure?e.secure:"wss"===String(e.scheme).toLowerCase()}var G={scheme:"ws",domainHost:!0,parse:function(e,t){var r=e;return r.secure=B(r),r.resourceName=(r.path||"/")+(r.query?"?"+r.query:""),r.path=void 0,r.query=void 0,r},serialize:function(e,t){if(e.port!==(B(e)?443:80)&&""!==e.port||(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){var r=e.resourceName.split("?"),a=l(r,2),i=a[0],s=a[1];e.path=i&&"/"!==i?i:void 0,e.query=s,e.resourceName=void 0}return e.fragment=void 0,e}},K={scheme:"wss",domainHost:G.domainHost,parse:G.parse,serialize:G.serialize},J={},W="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",Z="[0-9A-Fa-f]",Y=r(r("%[EFef]"+Z+"%"+Z+Z+"%"+Z+Z)+"|"+r("%[89A-Fa-f]"+Z+"%"+Z+Z)+"|"+r("%"+Z+Z)),X=t("[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",'[\\"\\\\]'),ee=new RegExp(W,"g"),te=new RegExp(Y,"g"),re=new RegExp(t("[^]","[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]","[\\.]",'[\\"]',X),"g"),ae=new RegExp(t("[^]",W,"[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]"),"g"),ie=ae;function se(e){var t=$(e);return t.match(ee)?t:e}var ne={scheme:"mailto",parse:function(e,t){var r=e,a=r.to=r.path?r.path.split(","):[];if(r.path=void 0,r.query){for(var i=!1,s={},n=r.query.split("&"),o=0,l=n.length;o=55296&&t<=56319&&i=t)throw new Error("Cannot access property/index "+a+" levels up, current level is "+t);return r[t-a]}if(a>t)throw new Error("Cannot access data "+a+" levels up, current level is "+t);if(s="data"+(t-a||""),!i)return s}for(var o=s,l=i.split("/"),c=0;c=0?{index:a,compiling:!0}:(a=this._compilations.length,this._compilations[a]={schema:e,root:t,baseId:r},{index:a,compiling:!1})}function Co(e,t,r){var a=Fo.call(this,e,t,r);a>=0&&this._compilations.splice(a,1)}function Fo(e,t,r){for(var a=0;a%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,Qo=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-?)*(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-?)*(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,Bo=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Go=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Ko=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Jo=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,Wo=Zo;function Zo(e){return e="full"==e?"full":"fast",Bn.copy(Zo[e])}function Yo(e){var t=e.match(Uo);if(!t)return!1;var r=+t[1],a=+t[2],i=+t[3];return a>=1&&a<=12&&i>=1&&i<=(2==a&&function(e){return e%4==0&&(e%100!=0||e%400==0)}(r)?29:Lo[a])}function Xo(e,t){var r=e.match(qo);if(!r)return!1;var a=r[1],i=r[2],s=r[3],n=r[5];return(a<=23&&i<=59&&s<=59||23==a&&59==i&&60==s)&&(!t||n)}Zo.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":Ho,url:Qo,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:Vo,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:al,uuid:Bo,"json-pointer":Go,"json-pointer-uri-fragment":Ko,"relative-json-pointer":Jo},Zo.full={date:Yo,time:Xo,"date-time":function(e){var t=e.split(el);return 2==t.length&&Yo(t[0])&&Xo(t[1],!0)},uri:function(e){return tl.test(e)&&Mo.test(e)},"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":Ho,url:Qo,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:Vo,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:al,uuid:Bo,"json-pointer":Go,"json-pointer-uri-fragment":Ko,"relative-json-pointer":Jo};var el=/t|\s/i;var tl=/\/|:/;var rl=/[^\\]\\Z/;function al(e){if(rl.test(e))return!1;try{return new RegExp(e),!0}catch(e){return!1}}var il=function(e,t,r){var a,i=" ",s=e.level,n=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,d="data"+(n||""),h=e.opts.$data&&o&&o.$data;h?(i+=" var schema"+s+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",a="schema"+s):a=o;var p="maximum"==t,f=p?"exclusiveMaximum":"exclusiveMinimum",m=e.schema[f],v=e.opts.$data&&m&&m.$data,y=p?"<":">",g=p?">":"<",b=void 0;if(!h&&"number"!=typeof o&&void 0!==o)throw new Error(t+" must be number");if(!v&&void 0!==m&&"number"!=typeof m&&"boolean"!=typeof m)throw new Error(f+" must be number or boolean");if(v){var _=e.util.getData(m.$data,n,e.dataPathArr),w="exclusive"+s,P="exclType"+s,E="exclIsNumber"+s,S="' + "+($="op"+s)+" + '";i+=" var schemaExcl"+s+" = "+_+"; ",i+=" var "+w+"; var "+P+" = typeof "+(_="schemaExcl"+s)+"; if ("+P+" != 'boolean' && "+P+" != 'undefined' && "+P+" != 'number') { ";var x;b=f;(x=x||[]).push(i),i="",!1!==e.createErrors?(i+=" { keyword: '"+(b||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",!1!==e.opts.messages&&(i+=" , message: '"+f+" should be boolean' "),e.opts.verbose&&(i+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var j=i;i=x.pop(),!e.compositeRule&&u?e.async?i+=" throw new ValidationError(["+j+"]); ":i+=" validate.errors = ["+j+"]; return false; ":i+=" var err = "+j+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } else if ( ",h&&(i+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),i+=" "+P+" == 'number' ? ( ("+w+" = "+a+" === undefined || "+_+" "+y+"= "+a+") ? "+d+" "+g+"= "+_+" : "+d+" "+g+" "+a+" ) : ( ("+w+" = "+_+" === true) ? "+d+" "+g+"= "+a+" : "+d+" "+g+" "+a+" ) || "+d+" !== "+d+") { var op"+s+" = "+w+" ? '"+y+"' : '"+y+"='; ",void 0===o&&(b=f,c=e.errSchemaPath+"/"+f,a=_,h=v)}else{S=y;if((E="number"==typeof m)&&h){var $="'"+S+"'";i+=" if ( ",h&&(i+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),i+=" ( "+a+" === undefined || "+m+" "+y+"= "+a+" ? "+d+" "+g+"= "+m+" : "+d+" "+g+" "+a+" ) || "+d+" !== "+d+") { "}else{E&&void 0===o?(w=!0,b=f,c=e.errSchemaPath+"/"+f,a=m,g+="="):(E&&(a=Math[p?"min":"max"](m,o)),m===(!E||a)?(w=!0,b=f,c=e.errSchemaPath+"/"+f,g+="="):(w=!1,S+="="));$="'"+S+"'";i+=" if ( ",h&&(i+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),i+=" "+d+" "+g+" "+a+" || "+d+" !== "+d+") { "}}b=b||t,(x=x||[]).push(i),i="",!1!==e.createErrors?(i+=" { keyword: '"+(b||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { comparison: "+$+", limit: "+a+", exclusive: "+w+" } ",!1!==e.opts.messages&&(i+=" , message: 'should be "+S+" ",i+=h?"' + "+a:a+"'"),e.opts.verbose&&(i+=" , schema: ",i+=h?"validate.schema"+l:""+o,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";j=i;return i=x.pop(),!e.compositeRule&&u?e.async?i+=" throw new ValidationError(["+j+"]); ":i+=" validate.errors = ["+j+"]; return false; ":i+=" var err = "+j+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",u&&(i+=" else { "),i},sl=function(e,t,r){var a,i=" ",s=e.level,n=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,d="data"+(n||""),h=e.opts.$data&&o&&o.$data;if(h?(i+=" var schema"+s+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",a="schema"+s):a=o,!h&&"number"!=typeof o)throw new Error(t+" must be number");i+="if ( ",h&&(i+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),i+=" "+d+".length "+("maxItems"==t?">":"<")+" "+a+") { ";var p=t,f=f||[];f.push(i),i="",!1!==e.createErrors?(i+=" { keyword: '"+(p||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+a+" } ",!1!==e.opts.messages&&(i+=" , message: 'should NOT have ",i+="maxItems"==t?"more":"fewer",i+=" than ",i+=h?"' + "+a+" + '":""+o,i+=" items' "),e.opts.verbose&&(i+=" , schema: ",i+=h?"validate.schema"+l:""+o,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var m=i;return i=f.pop(),!e.compositeRule&&u?e.async?i+=" throw new ValidationError(["+m+"]); ":i+=" validate.errors = ["+m+"]; return false; ":i+=" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",u&&(i+=" else { "),i},nl=function(e,t,r){var a,i=" ",s=e.level,n=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,d="data"+(n||""),h=e.opts.$data&&o&&o.$data;if(h?(i+=" var schema"+s+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",a="schema"+s):a=o,!h&&"number"!=typeof o)throw new Error(t+" must be number");var p="maxLength"==t?">":"<";i+="if ( ",h&&(i+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),!1===e.opts.unicode?i+=" "+d+".length ":i+=" ucs2length("+d+") ",i+=" "+p+" "+a+") { ";var f=t,m=m||[];m.push(i),i="",!1!==e.createErrors?(i+=" { keyword: '"+(f||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+a+" } ",!1!==e.opts.messages&&(i+=" , message: 'should NOT be ",i+="maxLength"==t?"longer":"shorter",i+=" than ",i+=h?"' + "+a+" + '":""+o,i+=" characters' "),e.opts.verbose&&(i+=" , schema: ",i+=h?"validate.schema"+l:""+o,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var v=i;return i=m.pop(),!e.compositeRule&&u?e.async?i+=" throw new ValidationError(["+v+"]); ":i+=" validate.errors = ["+v+"]; return false; ":i+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",u&&(i+=" else { "),i},ol=function(e,t,r){var a,i=" ",s=e.level,n=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,d="data"+(n||""),h=e.opts.$data&&o&&o.$data;if(h?(i+=" var schema"+s+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",a="schema"+s):a=o,!h&&"number"!=typeof o)throw new Error(t+" must be number");i+="if ( ",h&&(i+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),i+=" Object.keys("+d+").length "+("maxProperties"==t?">":"<")+" "+a+") { ";var p=t,f=f||[];f.push(i),i="",!1!==e.createErrors?(i+=" { keyword: '"+(p||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+a+" } ",!1!==e.opts.messages&&(i+=" , message: 'should NOT have ",i+="maxProperties"==t?"more":"fewer",i+=" than ",i+=h?"' + "+a+" + '":""+o,i+=" properties' "),e.opts.verbose&&(i+=" , schema: ",i+=h?"validate.schema"+l:""+o,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var m=i;return i=f.pop(),!e.compositeRule&&u?e.async?i+=" throw new ValidationError(["+m+"]); ":i+=" validate.errors = ["+m+"]; return false; ":i+=" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",u&&(i+=" else { "),i},ll={$ref:function(e,t,r){var a,i,s=" ",n=e.level,o=e.dataLevel,l=e.schema[t],c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,d="data"+(o||""),h="valid"+n;if("#"==l||"#/"==l)e.isRoot?(a=e.async,i="validate"):(a=!0===e.root.schema.$async,i="root.refVal[0]");else{var p=e.resolveRef(e.baseId,l,e.isRoot);if(void 0===p){var f=e.MissingRefError.message(e.baseId,l);if("fail"==e.opts.missingRefs){e.logger.error(f),(g=g||[]).push(s),s="",!1!==e.createErrors?(s+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { ref: '"+e.util.escapeQuotes(l)+"' } ",!1!==e.opts.messages&&(s+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(l)+"' "),e.opts.verbose&&(s+=" , schema: "+e.util.toQuotedString(l)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),s+=" } "):s+=" {} ";var m=s;s=g.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+m+"]); ":s+=" validate.errors = ["+m+"]; return false; ":s+=" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u&&(s+=" if (false) { ")}else{if("ignore"!=e.opts.missingRefs)throw new e.MissingRefError(e.baseId,l,f);e.logger.warn(f),u&&(s+=" if (true) { ")}}else if(p.inline){var v=e.util.copy(e);v.level++;var y="valid"+v.level;v.schema=p.schema,v.schemaPath="",v.errSchemaPath=l,s+=" "+e.validate(v).replace(/validate\.schema/g,p.code)+" ",u&&(s+=" if ("+y+") { ")}else a=!0===p.$async||e.async&&!1!==p.$async,i=p.code}if(i){var g;(g=g||[]).push(s),s="",e.opts.passContext?s+=" "+i+".call(this, ":s+=" "+i+"( ",s+=" "+d+", (dataPath || '')",'""'!=e.errorPath&&(s+=" + "+e.errorPath);var b=s+=" , "+(o?"data"+(o-1||""):"parentData")+" , "+(o?e.dataPathArr[o]:"parentDataProperty")+", rootData) ";if(s=g.pop(),a){if(!e.async)throw new Error("async schema referenced by sync schema");u&&(s+=" var "+h+"; "),s+=" try { await "+b+"; ",u&&(s+=" "+h+" = true; "),s+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",u&&(s+=" "+h+" = false; "),s+=" } ",u&&(s+=" if ("+h+") { ")}else s+=" if (!"+b+") { if (vErrors === null) vErrors = "+i+".errors; else vErrors = vErrors.concat("+i+".errors); errors = vErrors.length; } ",u&&(s+=" else { ")}return s},allOf:function(e,t,r){var a=" ",i=e.schema[t],s=e.schemaPath+e.util.getProperty(t),n=e.errSchemaPath+"/"+t,o=!e.opts.allErrors,l=e.util.copy(e),c="";l.level++;var u="valid"+l.level,d=l.baseId,h=!0,p=i;if(p)for(var f,m=-1,v=p.length-1;m0:e.util.schemaHasRules(f,e.RULES.all))&&(h=!1,l.schema=f,l.schemaPath=s+"["+m+"]",l.errSchemaPath=n+"/"+m,a+=" "+e.validate(l)+" ",l.baseId=d,o&&(a+=" if ("+u+") { ",c+="}"));return o&&(a+=h?" if (true) { ":" "+c.slice(0,-1)+" "),a},anyOf:function(e,t,r){var a=" ",i=e.level,s=e.dataLevel,n=e.schema[t],o=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u="data"+(s||""),d="valid"+i,h="errs__"+i,p=e.util.copy(e),f="";p.level++;var m="valid"+p.level;if(n.every((function(t){return e.opts.strictKeywords?"object"==typeof t&&Object.keys(t).length>0:e.util.schemaHasRules(t,e.RULES.all)}))){var v=p.baseId;a+=" var "+h+" = errors; var "+d+" = false; ";var y=e.compositeRule;e.compositeRule=p.compositeRule=!0;var g=n;if(g)for(var b,_=-1,w=g.length-1;_0:e.util.schemaHasRules(n,e.RULES.all);if(a+="var "+h+" = errors;var "+d+";",b){var _=e.compositeRule;e.compositeRule=p.compositeRule=!0,p.schema=n,p.schemaPath=o,p.errSchemaPath=l,a+=" var "+f+" = false; for (var "+m+" = 0; "+m+" < "+u+".length; "+m+"++) { ",p.errorPath=e.util.getPathExpr(e.errorPath,m,e.opts.jsonPointers,!0);var w=u+"["+m+"]";p.dataPathArr[v]=m;var P=e.validate(p);p.baseId=g,e.util.varOccurences(P,y)<2?a+=" "+e.util.varReplace(P,y,w)+" ":a+=" var "+y+" = "+w+"; "+P+" ",a+=" if ("+f+") break; } ",e.compositeRule=p.compositeRule=_,a+=" if (!"+f+") {"}else a+=" if ("+u+".length == 0) {";var E=E||[];E.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",!1!==e.opts.messages&&(a+=" , message: 'should contain a valid item' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var S=a;return a=E.pop(),!e.compositeRule&&c?e.async?a+=" throw new ValidationError(["+S+"]); ":a+=" validate.errors = ["+S+"]; return false; ":a+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { ",b&&(a+=" errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } "),e.opts.allErrors&&(a+=" } "),a},dependencies:function(e,t,r){var a=" ",i=e.level,s=e.dataLevel,n=e.schema[t],o=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u="data"+(s||""),d="errs__"+i,h=e.util.copy(e),p="";h.level++;var f="valid"+h.level,m={},v={},y=e.opts.ownProperties;for(w in n)if("__proto__"!=w){var g=n[w],b=Array.isArray(g)?v:m;b[w]=g}a+="var "+d+" = errors;";var _=e.errorPath;for(var w in a+="var missing"+i+";",v)if((b=v[w]).length){if(a+=" if ( "+u+e.util.getProperty(w)+" !== undefined ",y&&(a+=" && Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(w)+"') "),c){a+=" && ( ";var P=b;if(P)for(var E=-1,S=P.length-1;E0:e.util.schemaHasRules(g,e.RULES.all))&&(a+=" "+f+" = true; if ( "+u+e.util.getProperty(w)+" !== undefined ",y&&(a+=" && Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(w)+"') "),a+=") { ",h.schema=g,h.schemaPath=o+e.util.getProperty(w),h.errSchemaPath=l+"/"+e.util.escapeFragment(w),a+=" "+e.validate(h)+" ",h.baseId=R,a+=" } ",c&&(a+=" if ("+f+") { ",p+="}"))}return c&&(a+=" "+p+" if ("+d+" == errors) {"),a},enum:function(e,t,r){var a=" ",i=e.level,s=e.dataLevel,n=e.schema[t],o=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u="data"+(s||""),d="valid"+i,h=e.opts.$data&&n&&n.$data;h&&(a+=" var schema"+i+" = "+e.util.getData(n.$data,s,e.dataPathArr)+"; ");var p="i"+i,f="schema"+i;h||(a+=" var "+f+" = validate.schema"+o+";"),a+="var "+d+";",h&&(a+=" if (schema"+i+" === undefined) "+d+" = true; else if (!Array.isArray(schema"+i+")) "+d+" = false; else {"),a+=d+" = false;for (var "+p+"=0; "+p+"<"+f+".length; "+p+"++) if (equal("+u+", "+f+"["+p+"])) { "+d+" = true; break; }",h&&(a+=" } "),a+=" if (!"+d+") { ";var m=m||[];m.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { allowedValues: schema"+i+" } ",!1!==e.opts.messages&&(a+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var v=a;return a=m.pop(),!e.compositeRule&&c?e.async?a+=" throw new ValidationError(["+v+"]); ":a+=" validate.errors = ["+v+"]; return false; ":a+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" }",c&&(a+=" else { "),a},format:function(e,t,r){var a=" ",i=e.level,s=e.dataLevel,n=e.schema[t],o=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u="data"+(s||"");if(!1===e.opts.format)return c&&(a+=" if (true) { "),a;var d,h=e.opts.$data&&n&&n.$data;h?(a+=" var schema"+i+" = "+e.util.getData(n.$data,s,e.dataPathArr)+"; ",d="schema"+i):d=n;var p=e.opts.unknownFormats,f=Array.isArray(p);if(h){a+=" var "+(m="format"+i)+" = formats["+d+"]; var "+(v="isObject"+i)+" = typeof "+m+" == 'object' && !("+m+" instanceof RegExp) && "+m+".validate; var "+(y="formatType"+i)+" = "+v+" && "+m+".type || 'string'; if ("+v+") { ",e.async&&(a+=" var async"+i+" = "+m+".async; "),a+=" "+m+" = "+m+".validate; } if ( ",h&&(a+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),a+=" (","ignore"!=p&&(a+=" ("+d+" && !"+m+" ",f&&(a+=" && self._opts.unknownFormats.indexOf("+d+") == -1 "),a+=") || "),a+=" ("+m+" && "+y+" == '"+r+"' && !(typeof "+m+" == 'function' ? ",e.async?a+=" (async"+i+" ? await "+m+"("+u+") : "+m+"("+u+")) ":a+=" "+m+"("+u+") ",a+=" : "+m+".test("+u+"))))) {"}else{var m;if(!(m=e.formats[n])){if("ignore"==p)return e.logger.warn('unknown format "'+n+'" ignored in schema at path "'+e.errSchemaPath+'"'),c&&(a+=" if (true) { "),a;if(f&&p.indexOf(n)>=0)return c&&(a+=" if (true) { "),a;throw new Error('unknown format "'+n+'" is used in schema at path "'+e.errSchemaPath+'"')}var v,y=(v="object"==typeof m&&!(m instanceof RegExp)&&m.validate)&&m.type||"string";if(v){var g=!0===m.async;m=m.validate}if(y!=r)return c&&(a+=" if (true) { "),a;if(g){if(!e.async)throw new Error("async format in sync schema");a+=" if (!(await "+(b="formats"+e.util.getProperty(n)+".validate")+"("+u+"))) { "}else{a+=" if (! ";var b="formats"+e.util.getProperty(n);v&&(b+=".validate"),a+="function"==typeof m?" "+b+"("+u+") ":" "+b+".test("+u+") ",a+=") { "}}var _=_||[];_.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { format: ",a+=h?""+d:""+e.util.toQuotedString(n),a+=" } ",!1!==e.opts.messages&&(a+=" , message: 'should match format \"",a+=h?"' + "+d+" + '":""+e.util.escapeQuotes(n),a+="\"' "),e.opts.verbose&&(a+=" , schema: ",a+=h?"validate.schema"+o:""+e.util.toQuotedString(n),a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var w=a;return a=_.pop(),!e.compositeRule&&c?e.async?a+=" throw new ValidationError(["+w+"]); ":a+=" validate.errors = ["+w+"]; return false; ":a+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",c&&(a+=" else { "),a},if:function(e,t,r){var a=" ",i=e.level,s=e.dataLevel,n=e.schema[t],o=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u="data"+(s||""),d="valid"+i,h="errs__"+i,p=e.util.copy(e);p.level++;var f="valid"+p.level,m=e.schema.then,v=e.schema.else,y=void 0!==m&&(e.opts.strictKeywords?"object"==typeof m&&Object.keys(m).length>0:e.util.schemaHasRules(m,e.RULES.all)),g=void 0!==v&&(e.opts.strictKeywords?"object"==typeof v&&Object.keys(v).length>0:e.util.schemaHasRules(v,e.RULES.all)),b=p.baseId;if(y||g){var _;p.createErrors=!1,p.schema=n,p.schemaPath=o,p.errSchemaPath=l,a+=" var "+h+" = errors; var "+d+" = true; ";var w=e.compositeRule;e.compositeRule=p.compositeRule=!0,a+=" "+e.validate(p)+" ",p.baseId=b,p.createErrors=!0,a+=" errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } ",e.compositeRule=p.compositeRule=w,y?(a+=" if ("+f+") { ",p.schema=e.schema.then,p.schemaPath=e.schemaPath+".then",p.errSchemaPath=e.errSchemaPath+"/then",a+=" "+e.validate(p)+" ",p.baseId=b,a+=" "+d+" = "+f+"; ",y&&g?a+=" var "+(_="ifClause"+i)+" = 'then'; ":_="'then'",a+=" } ",g&&(a+=" else { ")):a+=" if (!"+f+") { ",g&&(p.schema=e.schema.else,p.schemaPath=e.schemaPath+".else",p.errSchemaPath=e.errSchemaPath+"/else",a+=" "+e.validate(p)+" ",p.baseId=b,a+=" "+d+" = "+f+"; ",y&&g?a+=" var "+(_="ifClause"+i)+" = 'else'; ":_="'else'",a+=" } "),a+=" if (!"+d+") { var err = ",!1!==e.createErrors?(a+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { failingKeyword: "+_+" } ",!1!==e.opts.messages&&(a+=" , message: 'should match \"' + "+_+" + '\" schema' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&c&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; "),a+=" } ",c&&(a+=" else { ")}else c&&(a+=" if (true) { ");return a},items:function(e,t,r){var a=" ",i=e.level,s=e.dataLevel,n=e.schema[t],o=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u="data"+(s||""),d="valid"+i,h="errs__"+i,p=e.util.copy(e),f="";p.level++;var m="valid"+p.level,v="i"+i,y=p.dataLevel=e.dataLevel+1,g="data"+y,b=e.baseId;if(a+="var "+h+" = errors;var "+d+";",Array.isArray(n)){var _=e.schema.additionalItems;if(!1===_){a+=" "+d+" = "+u+".length <= "+n.length+"; ";var w=l;l=e.errSchemaPath+"/additionalItems",a+=" if (!"+d+") { ";var P=P||[];P.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { limit: "+n.length+" } ",!1!==e.opts.messages&&(a+=" , message: 'should NOT have more than "+n.length+" items' "),e.opts.verbose&&(a+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var E=a;a=P.pop(),!e.compositeRule&&c?e.async?a+=" throw new ValidationError(["+E+"]); ":a+=" validate.errors = ["+E+"]; return false; ":a+=" var err = "+E+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",l=w,c&&(f+="}",a+=" else { ")}var S=n;if(S)for(var x,j=-1,$=S.length-1;j<$;)if(x=S[j+=1],e.opts.strictKeywords?"object"==typeof x&&Object.keys(x).length>0:e.util.schemaHasRules(x,e.RULES.all)){a+=" "+m+" = true; if ("+u+".length > "+j+") { ";var O=u+"["+j+"]";p.schema=x,p.schemaPath=o+"["+j+"]",p.errSchemaPath=l+"/"+j,p.errorPath=e.util.getPathExpr(e.errorPath,j,e.opts.jsonPointers,!0),p.dataPathArr[y]=j;var k=e.validate(p);p.baseId=b,e.util.varOccurences(k,g)<2?a+=" "+e.util.varReplace(k,g,O)+" ":a+=" var "+g+" = "+O+"; "+k+" ",a+=" } ",c&&(a+=" if ("+m+") { ",f+="}")}if("object"==typeof _&&(e.opts.strictKeywords?"object"==typeof _&&Object.keys(_).length>0:e.util.schemaHasRules(_,e.RULES.all))){p.schema=_,p.schemaPath=e.schemaPath+".additionalItems",p.errSchemaPath=e.errSchemaPath+"/additionalItems",a+=" "+m+" = true; if ("+u+".length > "+n.length+") { for (var "+v+" = "+n.length+"; "+v+" < "+u+".length; "+v+"++) { ",p.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);O=u+"["+v+"]";p.dataPathArr[y]=v;k=e.validate(p);p.baseId=b,e.util.varOccurences(k,g)<2?a+=" "+e.util.varReplace(k,g,O)+" ":a+=" var "+g+" = "+O+"; "+k+" ",c&&(a+=" if (!"+m+") break; "),a+=" } } ",c&&(a+=" if ("+m+") { ",f+="}")}}else if(e.opts.strictKeywords?"object"==typeof n&&Object.keys(n).length>0:e.util.schemaHasRules(n,e.RULES.all)){p.schema=n,p.schemaPath=o,p.errSchemaPath=l,a+=" for (var "+v+" = 0; "+v+" < "+u+".length; "+v+"++) { ",p.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);O=u+"["+v+"]";p.dataPathArr[y]=v;k=e.validate(p);p.baseId=b,e.util.varOccurences(k,g)<2?a+=" "+e.util.varReplace(k,g,O)+" ":a+=" var "+g+" = "+O+"; "+k+" ",c&&(a+=" if (!"+m+") break; "),a+=" }"}return c&&(a+=" "+f+" if ("+h+" == errors) {"),a},maximum:il,minimum:il,maxItems:sl,minItems:sl,maxLength:nl,minLength:nl,maxProperties:ol,minProperties:ol,multipleOf:function(e,t,r){var a,i=" ",s=e.level,n=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,d="data"+(n||""),h=e.opts.$data&&o&&o.$data;if(h?(i+=" var schema"+s+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",a="schema"+s):a=o,!h&&"number"!=typeof o)throw new Error(t+" must be number");i+="var division"+s+";if (",h&&(i+=" "+a+" !== undefined && ( typeof "+a+" != 'number' || "),i+=" (division"+s+" = "+d+" / "+a+", ",e.opts.multipleOfPrecision?i+=" Math.abs(Math.round(division"+s+") - division"+s+") > 1e-"+e.opts.multipleOfPrecision+" ":i+=" division"+s+" !== parseInt(division"+s+") ",i+=" ) ",h&&(i+=" ) "),i+=" ) { ";var p=p||[];p.push(i),i="",!1!==e.createErrors?(i+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { multipleOf: "+a+" } ",!1!==e.opts.messages&&(i+=" , message: 'should be multiple of ",i+=h?"' + "+a:a+"'"),e.opts.verbose&&(i+=" , schema: ",i+=h?"validate.schema"+l:""+o,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var f=i;return i=p.pop(),!e.compositeRule&&u?e.async?i+=" throw new ValidationError(["+f+"]); ":i+=" validate.errors = ["+f+"]; return false; ":i+=" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",u&&(i+=" else { "),i},not:function(e,t,r){var a=" ",i=e.level,s=e.dataLevel,n=e.schema[t],o=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u="data"+(s||""),d="errs__"+i,h=e.util.copy(e);h.level++;var p="valid"+h.level;if(e.opts.strictKeywords?"object"==typeof n&&Object.keys(n).length>0:e.util.schemaHasRules(n,e.RULES.all)){h.schema=n,h.schemaPath=o,h.errSchemaPath=l,a+=" var "+d+" = errors; ";var f,m=e.compositeRule;e.compositeRule=h.compositeRule=!0,h.createErrors=!1,h.opts.allErrors&&(f=h.opts.allErrors,h.opts.allErrors=!1),a+=" "+e.validate(h)+" ",h.createErrors=!0,f&&(h.opts.allErrors=f),e.compositeRule=h.compositeRule=m,a+=" if ("+p+") { ";var v=v||[];v.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",!1!==e.opts.messages&&(a+=" , message: 'should NOT be valid' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var y=a;a=v.pop(),!e.compositeRule&&c?e.async?a+=" throw new ValidationError(["+y+"]); ":a+=" validate.errors = ["+y+"]; return false; ":a+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } ",e.opts.allErrors&&(a+=" } ")}else a+=" var err = ",!1!==e.createErrors?(a+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",!1!==e.opts.messages&&(a+=" , message: 'should NOT be valid' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c&&(a+=" if (false) { ");return a},oneOf:function(e,t,r){var a=" ",i=e.level,s=e.dataLevel,n=e.schema[t],o=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u="data"+(s||""),d="valid"+i,h="errs__"+i,p=e.util.copy(e),f="";p.level++;var m="valid"+p.level,v=p.baseId,y="prevValid"+i,g="passingSchemas"+i;a+="var "+h+" = errors , "+y+" = false , "+d+" = false , "+g+" = null; ";var b=e.compositeRule;e.compositeRule=p.compositeRule=!0;var _=n;if(_)for(var w,P=-1,E=_.length-1;P0:e.util.schemaHasRules(w,e.RULES.all))?(p.schema=w,p.schemaPath=o+"["+P+"]",p.errSchemaPath=l+"/"+P,a+=" "+e.validate(p)+" ",p.baseId=v):a+=" var "+m+" = true; ",P&&(a+=" if ("+m+" && "+y+") { "+d+" = false; "+g+" = ["+g+", "+P+"]; } else { ",f+="}"),a+=" if ("+m+") { "+d+" = "+y+" = true; "+g+" = "+P+"; }";return e.compositeRule=p.compositeRule=b,a+=f+"if (!"+d+") { var err = ",!1!==e.createErrors?(a+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { passingSchemas: "+g+" } ",!1!==e.opts.messages&&(a+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&c&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; "),a+="} else { errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; }",e.opts.allErrors&&(a+=" } "),a},pattern:function(e,t,r){var a,i=" ",s=e.level,n=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,d="data"+(n||""),h=e.opts.$data&&o&&o.$data;h?(i+=" var schema"+s+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",a="schema"+s):a=o,i+="if ( ",h&&(i+=" ("+a+" !== undefined && typeof "+a+" != 'string') || "),i+=" !"+(h?"(new RegExp("+a+"))":e.usePattern(o))+".test("+d+") ) { ";var p=p||[];p.push(i),i="",!1!==e.createErrors?(i+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { pattern: ",i+=h?""+a:""+e.util.toQuotedString(o),i+=" } ",!1!==e.opts.messages&&(i+=" , message: 'should match pattern \"",i+=h?"' + "+a+" + '":""+e.util.escapeQuotes(o),i+="\"' "),e.opts.verbose&&(i+=" , schema: ",i+=h?"validate.schema"+l:""+e.util.toQuotedString(o),i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var f=i;return i=p.pop(),!e.compositeRule&&u?e.async?i+=" throw new ValidationError(["+f+"]); ":i+=" validate.errors = ["+f+"]; return false; ":i+=" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+="} ",u&&(i+=" else { "),i},properties:function(e,t,r){var a=" ",i=e.level,s=e.dataLevel,n=e.schema[t],o=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u="data"+(s||""),d="errs__"+i,h=e.util.copy(e),p="";h.level++;var f="valid"+h.level,m="key"+i,v="idx"+i,y=h.dataLevel=e.dataLevel+1,g="data"+y,b="dataProperties"+i,_=Object.keys(n||{}).filter(D),w=e.schema.patternProperties||{},P=Object.keys(w).filter(D),E=e.schema.additionalProperties,S=_.length||P.length,x=!1===E,j="object"==typeof E&&Object.keys(E).length,$=e.opts.removeAdditional,O=x||j||$,k=e.opts.ownProperties,A=e.baseId,C=e.schema.required;if(C&&(!e.opts.$data||!C.$data)&&C.length8)a+=" || validate.schema"+o+".hasOwnProperty("+m+") ";else{var z=_;if(z)for(var R=-1,T=z.length-1;R0:e.util.schemaHasRules(Y,e.RULES.all)){var X=e.util.getProperty(J),ee=(Q=u+X,G&&void 0!==Y.default);h.schema=Y,h.schemaPath=o+X,h.errSchemaPath=l+"/"+e.util.escapeFragment(J),h.errorPath=e.util.getPath(e.errorPath,J,e.opts.jsonPointers),h.dataPathArr[y]=e.util.toQuotedString(J);B=e.validate(h);if(h.baseId=A,e.util.varOccurences(B,g)<2){B=e.util.varReplace(B,g,Q);var te=Q}else{te=g;a+=" var "+g+" = "+Q+"; "}if(ee)a+=" "+B+" ";else{if(F&&F[J]){a+=" if ( "+te+" === undefined ",k&&(a+=" || ! Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(J)+"') "),a+=") { "+f+" = false; ";L=e.errorPath,V=l;var re,ae=e.util.escapeQuotes(J);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(L,J,e.opts.jsonPointers)),l=e.errSchemaPath+"/required",(re=re||[]).push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+ae+"' } ",!1!==e.opts.messages&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+ae+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";M=a;a=re.pop(),!e.compositeRule&&c?e.async?a+=" throw new ValidationError(["+M+"]); ":a+=" validate.errors = ["+M+"]; return false; ":a+=" var err = "+M+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",l=V,e.errorPath=L,a+=" } else { "}else c?(a+=" if ( "+te+" === undefined ",k&&(a+=" || ! Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(J)+"') "),a+=") { "+f+" = true; } else { "):(a+=" if ("+te+" !== undefined ",k&&(a+=" && Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(J)+"') "),a+=" ) { ");a+=" "+B+" } "}}c&&(a+=" if ("+f+") { ",p+="}")}}if(P.length){var ie=P;if(ie)for(var se,ne=-1,oe=ie.length-1;ne0:e.util.schemaHasRules(Y,e.RULES.all)){h.schema=Y,h.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(se),h.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(se),a+=k?" "+b+" = "+b+" || Object.keys("+u+"); for (var "+v+"=0; "+v+"<"+b+".length; "+v+"++) { var "+m+" = "+b+"["+v+"]; ":" for (var "+m+" in "+u+") { ",a+=" if ("+e.usePattern(se)+".test("+m+")) { ",h.errorPath=e.util.getPathExpr(e.errorPath,m,e.opts.jsonPointers);Q=u+"["+m+"]";h.dataPathArr[y]=m;B=e.validate(h);h.baseId=A,e.util.varOccurences(B,g)<2?a+=" "+e.util.varReplace(B,g,Q)+" ":a+=" var "+g+" = "+Q+"; "+B+" ",c&&(a+=" if (!"+f+") break; "),a+=" } ",c&&(a+=" else "+f+" = true; "),a+=" } ",c&&(a+=" if ("+f+") { ",p+="}")}}}return c&&(a+=" "+p+" if ("+d+" == errors) {"),a},propertyNames:function(e,t,r){var a=" ",i=e.level,s=e.dataLevel,n=e.schema[t],o=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u="data"+(s||""),d="errs__"+i,h=e.util.copy(e);h.level++;var p="valid"+h.level;if(a+="var "+d+" = errors;",e.opts.strictKeywords?"object"==typeof n&&Object.keys(n).length>0:e.util.schemaHasRules(n,e.RULES.all)){h.schema=n,h.schemaPath=o,h.errSchemaPath=l;var f="key"+i,m="idx"+i,v="i"+i,y="' + "+f+" + '",g="data"+(h.dataLevel=e.dataLevel+1),b="dataProperties"+i,_=e.opts.ownProperties,w=e.baseId;_&&(a+=" var "+b+" = undefined; "),a+=_?" "+b+" = "+b+" || Object.keys("+u+"); for (var "+m+"=0; "+m+"<"+b+".length; "+m+"++) { var "+f+" = "+b+"["+m+"]; ":" for (var "+f+" in "+u+") { ",a+=" var startErrs"+i+" = errors; ";var P=f,E=e.compositeRule;e.compositeRule=h.compositeRule=!0;var S=e.validate(h);h.baseId=w,e.util.varOccurences(S,g)<2?a+=" "+e.util.varReplace(S,g,P)+" ":a+=" var "+g+" = "+P+"; "+S+" ",e.compositeRule=h.compositeRule=E,a+=" if (!"+p+") { for (var "+v+"=startErrs"+i+"; "+v+"0:e.util.schemaHasRules(b,e.RULES.all))||(f[f.length]=v)}}else f=n;if(h||f.length){var _=e.errorPath,w=h||f.length>=e.opts.loopRequired,P=e.opts.ownProperties;if(c)if(a+=" var missing"+i+"; ",w){h||(a+=" var "+p+" = validate.schema"+o+"; ");var E="' + "+(k="schema"+i+"["+(j="i"+i)+"]")+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(_,k,e.opts.jsonPointers)),a+=" var "+d+" = true; ",h&&(a+=" if (schema"+i+" === undefined) "+d+" = true; else if (!Array.isArray(schema"+i+")) "+d+" = false; else {"),a+=" for (var "+j+" = 0; "+j+" < "+p+".length; "+j+"++) { "+d+" = "+u+"["+p+"["+j+"]] !== undefined ",P&&(a+=" && Object.prototype.hasOwnProperty.call("+u+", "+p+"["+j+"]) "),a+="; if (!"+d+") break; } ",h&&(a+=" } "),a+=" if (!"+d+") { ",(O=O||[]).push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+E+"' } ",!1!==e.opts.messages&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+E+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var S=a;a=O.pop(),!e.compositeRule&&c?e.async?a+=" throw new ValidationError(["+S+"]); ":a+=" validate.errors = ["+S+"]; return false; ":a+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { "}else{a+=" if ( ";var x=f;if(x)for(var j=-1,$=x.length-1;j<$;){C=x[j+=1],j&&(a+=" || "),a+=" ( ( "+(R=u+(z=e.util.getProperty(C)))+" === undefined ",P&&(a+=" || ! Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(C)+"') "),a+=") && (missing"+i+" = "+e.util.toQuotedString(e.opts.jsonPointers?C:z)+") ) "}a+=") { ";var O;E="' + "+(k="missing"+i)+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(_,k,!0):_+" + "+k),(O=O||[]).push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+E+"' } ",!1!==e.opts.messages&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+E+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";S=a;a=O.pop(),!e.compositeRule&&c?e.async?a+=" throw new ValidationError(["+S+"]); ":a+=" validate.errors = ["+S+"]; return false; ":a+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { "}else if(w){h||(a+=" var "+p+" = validate.schema"+o+"; ");var k;E="' + "+(k="schema"+i+"["+(j="i"+i)+"]")+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(_,k,e.opts.jsonPointers)),h&&(a+=" if ("+p+" && !Array.isArray("+p+")) { var err = ",!1!==e.createErrors?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+E+"' } ",!1!==e.opts.messages&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+E+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+p+" !== undefined) { "),a+=" for (var "+j+" = 0; "+j+" < "+p+".length; "+j+"++) { if ("+u+"["+p+"["+j+"]] === undefined ",P&&(a+=" || ! Object.prototype.hasOwnProperty.call("+u+", "+p+"["+j+"]) "),a+=") { var err = ",!1!==e.createErrors?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+E+"' } ",!1!==e.opts.messages&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+E+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",h&&(a+=" } ")}else{var A=f;if(A)for(var C,F=-1,D=A.length-1;F 1) { ";var f=e.schema.items&&e.schema.items.type,m=Array.isArray(f);if(!f||"object"==f||"array"==f||m&&(f.indexOf("object")>=0||f.indexOf("array")>=0))i+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+d+"[i], "+d+"[j])) { "+h+" = false; break outer; } } } ";else{i+=" var itemIndices = {}, item; for (;i--;) { var item = "+d+"[i]; ";var v="checkDataType"+(m?"s":"");i+=" if ("+e.util[v](f,"item",e.opts.strictNumbers,!0)+") continue; ",m&&(i+=" if (typeof item == 'string') item = '\"' + item; "),i+=" if (typeof itemIndices[item] == 'number') { "+h+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}i+=" } ",p&&(i+=" } "),i+=" if (!"+h+") { ";var y=y||[];y.push(i),i="",!1!==e.createErrors?(i+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { i: i, j: j } ",!1!==e.opts.messages&&(i+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(i+=" , schema: ",i+=p?"validate.schema"+l:""+o,i+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),i+=" } "):i+=" {} ";var g=i;i=y.pop(),!e.compositeRule&&u?e.async?i+=" throw new ValidationError(["+g+"]); ":i+=" validate.errors = ["+g+"]; return false; ":i+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",i+=" } ",u&&(i+=" else { ")}else u&&(i+=" if (true) { ");return i},validate:jo},cl=Bn.toHash,ul=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"],dl=function(e,t){for(var r=0;r1){t[0]=t[0].slice(0,-1);for(var a=t.length-1,s=1;s= 0x80 (not a basic code point)","invalid-input":"Invalid input"},m=Math.floor,f=String.fromCharCode;function v(e){throw new RangeError(p[e])}function y(e,t){var r=e.split("@"),a="";r.length>1&&(a=r[0]+"@",e=r[1]);var s=function(e,t){for(var r=[],a=e.length;a--;)r[a]=t(e[a]);return r}((e=e.replace(h,".")).split("."),t).join(".");return a+s}function g(e){for(var t=[],r=0,a=e.length;r=55296&&s<=56319&&r>1,e+=m(e/t);e>455;a+=36)e=m(e/35);return m(a+36*e/(e+38))},w=function(e){var t,r=[],a=e.length,s=0,i=128,o=72,n=e.lastIndexOf("-");n<0&&(n=0);for(var l=0;l=128&&v("not-basic"),r.push(e.charCodeAt(l));for(var d=n>0?n+1:0;d=a&&v("invalid-input");var f=(t=e.charCodeAt(d++))-48<10?t-22:t-65<26?t-65:t-97<26?t-97:36;(f>=36||f>m((c-s)/h))&&v("overflow"),s+=f*h;var y=p<=o?1:p>=o+26?26:p-o;if(fm(c/g)&&v("overflow"),h*=g}var _=r.length+1;o=b(s-u,_,0==u),m(s/_)>c-i&&v("overflow"),i+=m(s/_),s%=_,r.splice(s++,0,i)}return String.fromCodePoint.apply(String,r)},P=function(e){var t=[],r=(e=g(e)).length,a=128,s=0,i=72,o=!0,n=!1,l=void 0;try{for(var d,u=e[Symbol.iterator]();!(o=(d=u.next()).done);o=!0){var h=d.value;h<128&&t.push(f(h))}}catch(e){n=!0,l=e}finally{try{!o&&u.return&&u.return()}finally{if(n)throw l}}var p=t.length,y=p;for(p&&t.push("-");y=a&&jm((c-s)/k)&&v("overflow"),s+=(w-a)*k,a=w;var O=!0,C=!1,A=void 0;try{for(var F,D=e[Symbol.iterator]();!(O=(F=D.next()).done);O=!0){var R=F.value;if(Rc&&v("overflow"),R==a){for(var z=s,I=36;;I+=36){var N=I<=i?1:I>=i+26?26:I-i;if(z>6|192).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase():"%"+(t>>12|224).toString(16).toUpperCase()+"%"+(t>>6&63|128).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase()}function j(e){for(var t="",r=0,a=e.length;r=194&&s<224){if(a-r>=6){var i=parseInt(e.substr(r+4,2),16);t+=String.fromCharCode((31&s)<<6|63&i)}else t+=e.substr(r,6);r+=6}else if(s>=224){if(a-r>=9){var o=parseInt(e.substr(r+4,2),16),n=parseInt(e.substr(r+7,2),16);t+=String.fromCharCode((15&s)<<12|(63&o)<<6|63&n)}else t+=e.substr(r,9);r+=9}else t+=e.substr(r,3),r+=3}return t}function k(e,t){function r(e){var r=j(e);return r.match(t.UNRESERVED)?r:e}return e.scheme&&(e.scheme=String(e.scheme).replace(t.PCT_ENCODED,r).toLowerCase().replace(t.NOT_SCHEME,"")),void 0!==e.userinfo&&(e.userinfo=String(e.userinfo).replace(t.PCT_ENCODED,r).replace(t.NOT_USERINFO,$).replace(t.PCT_ENCODED,s)),void 0!==e.host&&(e.host=String(e.host).replace(t.PCT_ENCODED,r).toLowerCase().replace(t.NOT_HOST,$).replace(t.PCT_ENCODED,s)),void 0!==e.path&&(e.path=String(e.path).replace(t.PCT_ENCODED,r).replace(e.scheme?t.NOT_PATH:t.NOT_PATH_NOSCHEME,$).replace(t.PCT_ENCODED,s)),void 0!==e.query&&(e.query=String(e.query).replace(t.PCT_ENCODED,r).replace(t.NOT_QUERY,$).replace(t.PCT_ENCODED,s)),void 0!==e.fragment&&(e.fragment=String(e.fragment).replace(t.PCT_ENCODED,r).replace(t.NOT_FRAGMENT,$).replace(t.PCT_ENCODED,s)),e}function O(e){return e.replace(/^0*(.*)/,"$1")||"0"}function C(e,t){var r=e.match(t.IPV4ADDRESS)||[],a=l(r,2)[1];return a?a.split(".").map(O).join("."):e}function A(e,t){var r=e.match(t.IPV6ADDRESS)||[],a=l(r,3),s=a[1],i=a[2];if(s){for(var o=s.toLowerCase().split("::").reverse(),n=l(o,2),c=n[0],d=n[1],u=d?d.split(":").map(O):[],h=c.split(":").map(O),p=t.IPV4ADDRESS.test(h[h.length-1]),m=p?7:8,f=h.length-m,v=Array(m),y=0;y1){var b=v.slice(0,g.index),w=v.slice(g.index+g.length);_=b.join(":")+"::"+w.join(":")}else _=v.join(":");return i&&(_+="%"+i),_}return e}var F=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,D=void 0==="".match(/(){0}/)[1];function R(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={},a=!1!==t.iri?n:o;"suffix"===t.reference&&(e=(t.scheme?t.scheme+":":"")+"//"+e);var s=e.match(F);if(s){D?(r.scheme=s[1],r.userinfo=s[3],r.host=s[4],r.port=parseInt(s[5],10),r.path=s[6]||"",r.query=s[7],r.fragment=s[8],isNaN(r.port)&&(r.port=s[5])):(r.scheme=s[1]||void 0,r.userinfo=-1!==e.indexOf("@")?s[3]:void 0,r.host=-1!==e.indexOf("//")?s[4]:void 0,r.port=parseInt(s[5],10),r.path=s[6]||"",r.query=-1!==e.indexOf("?")?s[7]:void 0,r.fragment=-1!==e.indexOf("#")?s[8]:void 0,isNaN(r.port)&&(r.port=e.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?s[4]:void 0)),r.host&&(r.host=A(C(r.host,a),a)),void 0!==r.scheme||void 0!==r.userinfo||void 0!==r.host||void 0!==r.port||r.path||void 0!==r.query?void 0===r.scheme?r.reference="relative":void 0===r.fragment?r.reference="absolute":r.reference="uri":r.reference="same-document",t.reference&&"suffix"!==t.reference&&t.reference!==r.reference&&(r.error=r.error||"URI is not a "+t.reference+" reference.");var i=x[(t.scheme||r.scheme||"").toLowerCase()];if(t.unicodeSupport||i&&i.unicodeSupport)k(r,a);else{if(r.host&&(t.domainHost||i&&i.domainHost))try{r.host=S(r.host.replace(a.PCT_ENCODED,j).toLowerCase())}catch(e){r.error=r.error||"Host's domain name can not be converted to ASCII via punycode: "+e}k(r,o)}i&&i.parse&&i.parse(r,t)}else r.error=r.error||"URI can not be parsed.";return r}function z(e,t){var r=!1!==t.iri?n:o,a=[];return void 0!==e.userinfo&&(a.push(e.userinfo),a.push("@")),void 0!==e.host&&a.push(A(C(String(e.host),r),r).replace(r.IPV6ADDRESS,(function(e,t,r){return"["+t+(r?"%25"+r:"")+"]"}))),"number"!=typeof e.port&&"string"!=typeof e.port||(a.push(":"),a.push(String(e.port))),a.length?a.join(""):void 0}var I=/^\.\.?\//,N=/^\/\.(\/|$)/,T=/^\/\.\.(\/|$)/,L=/^\/?(?:.|\n)*?(?=\/|$)/;function V(e){for(var t=[];e.length;)if(e.match(I))e=e.replace(I,"");else if(e.match(N))e=e.replace(N,"/");else if(e.match(T))e=e.replace(T,"/"),t.pop();else if("."===e||".."===e)e="";else{var r=e.match(L);if(!r)throw new Error("Unexpected dot segment condition");var a=r[0];e=e.slice(a.length),t.push(a)}return t.join("")}function q(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.iri?n:o,a=[],s=x[(t.scheme||e.scheme||"").toLowerCase()];if(s&&s.serialize&&s.serialize(e,t),e.host)if(r.IPV6ADDRESS.test(e.host));else if(t.domainHost||s&&s.domainHost)try{e.host=t.iri?E(e.host):S(e.host.replace(r.PCT_ENCODED,j).toLowerCase())}catch(r){e.error=e.error||"Host's domain name can not be converted to "+(t.iri?"Unicode":"ASCII")+" via punycode: "+r}k(e,r),"suffix"!==t.reference&&e.scheme&&(a.push(e.scheme),a.push(":"));var i=z(e,t);if(void 0!==i&&("suffix"!==t.reference&&a.push("//"),a.push(i),e.path&&"/"!==e.path.charAt(0)&&a.push("/")),void 0!==e.path){var l=e.path;t.absolutePath||s&&s.absolutePath||(l=V(l)),void 0===i&&(l=l.replace(/^\/\//,"/%2F")),a.push(l)}return void 0!==e.query&&(a.push("?"),a.push(e.query)),void 0!==e.fragment&&(a.push("#"),a.push(e.fragment)),a.join("")}function U(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=arguments[3],s={};return a||(e=R(q(e,r),r),t=R(q(t,r),r)),!(r=r||{}).tolerant&&t.scheme?(s.scheme=t.scheme,s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=V(t.path||""),s.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=V(t.path||""),s.query=t.query):(t.path?("/"===t.path.charAt(0)?s.path=V(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?s.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:s.path=t.path:s.path="/"+t.path,s.path=V(s.path)),s.query=t.query):(s.path=e.path,void 0!==t.query?s.query=t.query:s.query=e.query),s.userinfo=e.userinfo,s.host=e.host,s.port=e.port),s.scheme=e.scheme),s.fragment=t.fragment,s}function M(e,t){return e&&e.toString().replace(t&&t.iri?n.PCT_ENCODED:o.PCT_ENCODED,j)}var Q={scheme:"http",domainHost:!0,parse:function(e,t){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e},serialize:function(e,t){var r="https"===String(e.scheme).toLowerCase();return e.port!==(r?443:80)&&""!==e.port||(e.port=void 0),e.path||(e.path="/"),e}},H={scheme:"https",domainHost:Q.domainHost,parse:Q.parse,serialize:Q.serialize};function G(e){return"boolean"==typeof e.secure?e.secure:"wss"===String(e.scheme).toLowerCase()}var K={scheme:"ws",domainHost:!0,parse:function(e,t){var r=e;return r.secure=G(r),r.resourceName=(r.path||"/")+(r.query?"?"+r.query:""),r.path=void 0,r.query=void 0,r},serialize:function(e,t){if(e.port!==(G(e)?443:80)&&""!==e.port||(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){var r=e.resourceName.split("?"),a=l(r,2),s=a[0],i=a[1];e.path=s&&"/"!==s?s:void 0,e.query=i,e.resourceName=void 0}return e.fragment=void 0,e}},B={scheme:"wss",domainHost:K.domainHost,parse:K.parse,serialize:K.serialize},J={},W="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",Z="[0-9A-Fa-f]",Y=r(r("%[EFef]"+Z+"%"+Z+Z+"%"+Z+Z)+"|"+r("%[89A-Fa-f]"+Z+"%"+Z+Z)+"|"+r("%"+Z+Z)),X=t("[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",'[\\"\\\\]'),ee=new RegExp(W,"g"),te=new RegExp(Y,"g"),re=new RegExp(t("[^]","[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]","[\\.]",'[\\"]',X),"g"),ae=new RegExp(t("[^]",W,"[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]"),"g"),se=ae;function ie(e){var t=j(e);return t.match(ee)?t:e}var oe={scheme:"mailto",parse:function(e,t){var r=e,a=r.to=r.path?r.path.split(","):[];if(r.path=void 0,r.query){for(var s=!1,i={},o=r.query.split("&"),n=0,l=o.length;n=55296&&t<=56319&&s=t)throw new Error("Cannot access property/index "+a+" levels up, current level is "+t);return r[t-a]}if(a>t)throw new Error("Cannot access data "+a+" levels up, current level is "+t);if(i="data"+(t-a||""),!s)return i}for(var n=i,l=s.split("/"),c=0;c=0?{index:a,compiling:!0}:(a=this._compilations.length,this._compilations[a]={schema:e,root:t,baseId:r},{index:a,compiling:!1})}function qa(e,t,r){var a=Ua.call(this,e,t,r);a>=0&&this._compilations.splice(a,1)}function Ua(e,t,r){for(var a=0;a%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,ts=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-?)*(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-?)*(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,rs=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,as=/^(?:\/(?:[^~/]|~0|~1)*)*$/,ss=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,is=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,os=ns;function ns(e){return e="full"==e?"full":"fast",aa.copy(ns[e])}function ls(e){var t=e.match(Ja);if(!t)return!1;var r=+t[1],a=+t[2],s=+t[3];return a>=1&&a<=12&&s>=1&&s<=(2==a&&function(e){return e%4==0&&(e%100!=0||e%400==0)}(r)?29:Wa[a])}function cs(e,t){var r=e.match(Za);if(!r)return!1;var a=r[1],s=r[2],i=r[3],o=r[5];return(a<=23&&s<=59&&i<=59||23==a&&59==s&&60==i)&&(!t||o)}ns.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":es,url:ts,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:Ya,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:ps,uuid:rs,"json-pointer":as,"json-pointer-uri-fragment":ss,"relative-json-pointer":is},ns.full={date:ls,time:cs,"date-time":function(e){var t=e.split(ds);return 2==t.length&&ls(t[0])&&cs(t[1],!0)},uri:function(e){return us.test(e)&&Xa.test(e)},"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":es,url:ts,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:Ya,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:ps,uuid:rs,"json-pointer":as,"json-pointer-uri-fragment":ss,"relative-json-pointer":is};var ds=/t|\s/i;var us=/\/|:/;var hs=/[^\\]\\Z/;function ps(e){if(hs.test(e))return!1;try{return new RegExp(e),!0}catch(e){return!1}}var ms=function(e,t,r){var a,s=" ",i=e.level,o=e.dataLevel,n=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,u="data"+(o||""),h=e.opts.$data&&n&&n.$data;h?(s+=" var schema"+i+" = "+e.util.getData(n.$data,o,e.dataPathArr)+"; ",a="schema"+i):a=n;var p="maximum"==t,m=p?"exclusiveMaximum":"exclusiveMinimum",f=e.schema[m],v=e.opts.$data&&f&&f.$data,y=p?"<":">",g=p?">":"<",_=void 0;if(!h&&"number"!=typeof n&&void 0!==n)throw new Error(t+" must be number");if(!v&&void 0!==f&&"number"!=typeof f&&"boolean"!=typeof f)throw new Error(m+" must be number or boolean");if(v){var b=e.util.getData(f.$data,o,e.dataPathArr),w="exclusive"+i,P="exclType"+i,S="exclIsNumber"+i,E="' + "+(j="op"+i)+" + '";s+=" var schemaExcl"+i+" = "+b+"; ",s+=" var "+w+"; var "+P+" = typeof "+(b="schemaExcl"+i)+"; if ("+P+" != 'boolean' && "+P+" != 'undefined' && "+P+" != 'number') { ";var x;_=m;(x=x||[]).push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(_||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",!1!==e.opts.messages&&(s+=" , message: '"+m+" should be boolean' "),e.opts.verbose&&(s+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),s+=" } "):s+=" {} ";var $=s;s=x.pop(),!e.compositeRule&&d?e.async?s+=" throw new ValidationError(["+$+"]); ":s+=" validate.errors = ["+$+"]; return false; ":s+=" var err = "+$+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } else if ( ",h&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" "+P+" == 'number' ? ( ("+w+" = "+a+" === undefined || "+b+" "+y+"= "+a+") ? "+u+" "+g+"= "+b+" : "+u+" "+g+" "+a+" ) : ( ("+w+" = "+b+" === true) ? "+u+" "+g+"= "+a+" : "+u+" "+g+" "+a+" ) || "+u+" !== "+u+") { var op"+i+" = "+w+" ? '"+y+"' : '"+y+"='; ",void 0===n&&(_=m,c=e.errSchemaPath+"/"+m,a=b,h=v)}else{E=y;if((S="number"==typeof f)&&h){var j="'"+E+"'";s+=" if ( ",h&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" ( "+a+" === undefined || "+f+" "+y+"= "+a+" ? "+u+" "+g+"= "+f+" : "+u+" "+g+" "+a+" ) || "+u+" !== "+u+") { "}else{S&&void 0===n?(w=!0,_=m,c=e.errSchemaPath+"/"+m,a=f,g+="="):(S&&(a=Math[p?"min":"max"](f,n)),f===(!S||a)?(w=!0,_=m,c=e.errSchemaPath+"/"+m,g+="="):(w=!1,E+="="));j="'"+E+"'";s+=" if ( ",h&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" "+u+" "+g+" "+a+" || "+u+" !== "+u+") { "}}_=_||t,(x=x||[]).push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(_||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { comparison: "+j+", limit: "+a+", exclusive: "+w+" } ",!1!==e.opts.messages&&(s+=" , message: 'should be "+E+" ",s+=h?"' + "+a:a+"'"),e.opts.verbose&&(s+=" , schema: ",s+=h?"validate.schema"+l:""+n,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),s+=" } "):s+=" {} ";$=s;return s=x.pop(),!e.compositeRule&&d?e.async?s+=" throw new ValidationError(["+$+"]); ":s+=" validate.errors = ["+$+"]; return false; ":s+=" var err = "+$+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } ",d&&(s+=" else { "),s},fs=function(e,t,r){var a,s=" ",i=e.level,o=e.dataLevel,n=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,u="data"+(o||""),h=e.opts.$data&&n&&n.$data;if(h?(s+=" var schema"+i+" = "+e.util.getData(n.$data,o,e.dataPathArr)+"; ",a="schema"+i):a=n,!h&&"number"!=typeof n)throw new Error(t+" must be number");s+="if ( ",h&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" "+u+".length "+("maxItems"==t?">":"<")+" "+a+") { ";var p=t,m=m||[];m.push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(p||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+a+" } ",!1!==e.opts.messages&&(s+=" , message: 'should NOT have ",s+="maxItems"==t?"more":"fewer",s+=" than ",s+=h?"' + "+a+" + '":""+n,s+=" items' "),e.opts.verbose&&(s+=" , schema: ",s+=h?"validate.schema"+l:""+n,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),s+=" } "):s+=" {} ";var f=s;return s=m.pop(),!e.compositeRule&&d?e.async?s+=" throw new ValidationError(["+f+"]); ":s+=" validate.errors = ["+f+"]; return false; ":s+=" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",d&&(s+=" else { "),s},vs=function(e,t,r){var a,s=" ",i=e.level,o=e.dataLevel,n=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,u="data"+(o||""),h=e.opts.$data&&n&&n.$data;if(h?(s+=" var schema"+i+" = "+e.util.getData(n.$data,o,e.dataPathArr)+"; ",a="schema"+i):a=n,!h&&"number"!=typeof n)throw new Error(t+" must be number");var p="maxLength"==t?">":"<";s+="if ( ",h&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),!1===e.opts.unicode?s+=" "+u+".length ":s+=" ucs2length("+u+") ",s+=" "+p+" "+a+") { ";var m=t,f=f||[];f.push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(m||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+a+" } ",!1!==e.opts.messages&&(s+=" , message: 'should NOT be ",s+="maxLength"==t?"longer":"shorter",s+=" than ",s+=h?"' + "+a+" + '":""+n,s+=" characters' "),e.opts.verbose&&(s+=" , schema: ",s+=h?"validate.schema"+l:""+n,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),s+=" } "):s+=" {} ";var v=s;return s=f.pop(),!e.compositeRule&&d?e.async?s+=" throw new ValidationError(["+v+"]); ":s+=" validate.errors = ["+v+"]; return false; ":s+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",d&&(s+=" else { "),s},ys=function(e,t,r){var a,s=" ",i=e.level,o=e.dataLevel,n=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,u="data"+(o||""),h=e.opts.$data&&n&&n.$data;if(h?(s+=" var schema"+i+" = "+e.util.getData(n.$data,o,e.dataPathArr)+"; ",a="schema"+i):a=n,!h&&"number"!=typeof n)throw new Error(t+" must be number");s+="if ( ",h&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" Object.keys("+u+").length "+("maxProperties"==t?">":"<")+" "+a+") { ";var p=t,m=m||[];m.push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(p||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+a+" } ",!1!==e.opts.messages&&(s+=" , message: 'should NOT have ",s+="maxProperties"==t?"more":"fewer",s+=" than ",s+=h?"' + "+a+" + '":""+n,s+=" properties' "),e.opts.verbose&&(s+=" , schema: ",s+=h?"validate.schema"+l:""+n,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),s+=" } "):s+=" {} ";var f=s;return s=m.pop(),!e.compositeRule&&d?e.async?s+=" throw new ValidationError(["+f+"]); ":s+=" validate.errors = ["+f+"]; return false; ":s+=" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",d&&(s+=" else { "),s},gs={$ref:function(e,t,r){var a,s,i=" ",o=e.level,n=e.dataLevel,l=e.schema[t],c=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,u="data"+(n||""),h="valid"+o;if("#"==l||"#/"==l)e.isRoot?(a=e.async,s="validate"):(a=!0===e.root.schema.$async,s="root.refVal[0]");else{var p=e.resolveRef(e.baseId,l,e.isRoot);if(void 0===p){var m=e.MissingRefError.message(e.baseId,l);if("fail"==e.opts.missingRefs){e.logger.error(m),(g=g||[]).push(i),i="",!1!==e.createErrors?(i+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { ref: '"+e.util.escapeQuotes(l)+"' } ",!1!==e.opts.messages&&(i+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(l)+"' "),e.opts.verbose&&(i+=" , schema: "+e.util.toQuotedString(l)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),i+=" } "):i+=" {} ";var f=i;i=g.pop(),!e.compositeRule&&d?e.async?i+=" throw new ValidationError(["+f+"]); ":i+=" validate.errors = ["+f+"]; return false; ":i+=" var err = "+f+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",d&&(i+=" if (false) { ")}else{if("ignore"!=e.opts.missingRefs)throw new e.MissingRefError(e.baseId,l,m);e.logger.warn(m),d&&(i+=" if (true) { ")}}else if(p.inline){var v=e.util.copy(e);v.level++;var y="valid"+v.level;v.schema=p.schema,v.schemaPath="",v.errSchemaPath=l,i+=" "+e.validate(v).replace(/validate\.schema/g,p.code)+" ",d&&(i+=" if ("+y+") { ")}else a=!0===p.$async||e.async&&!1!==p.$async,s=p.code}if(s){var g;(g=g||[]).push(i),i="",e.opts.passContext?i+=" "+s+".call(this, ":i+=" "+s+"( ",i+=" "+u+", (dataPath || '')",'""'!=e.errorPath&&(i+=" + "+e.errorPath);var _=i+=" , "+(n?"data"+(n-1||""):"parentData")+" , "+(n?e.dataPathArr[n]:"parentDataProperty")+", rootData) ";if(i=g.pop(),a){if(!e.async)throw new Error("async schema referenced by sync schema");d&&(i+=" var "+h+"; "),i+=" try { await "+_+"; ",d&&(i+=" "+h+" = true; "),i+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",d&&(i+=" "+h+" = false; "),i+=" } ",d&&(i+=" if ("+h+") { ")}else i+=" if (!"+_+") { if (vErrors === null) vErrors = "+s+".errors; else vErrors = vErrors.concat("+s+".errors); errors = vErrors.length; } ",d&&(i+=" else { ")}return i},allOf:function(e,t,r){var a=" ",s=e.schema[t],i=e.schemaPath+e.util.getProperty(t),o=e.errSchemaPath+"/"+t,n=!e.opts.allErrors,l=e.util.copy(e),c="";l.level++;var d="valid"+l.level,u=l.baseId,h=!0,p=s;if(p)for(var m,f=-1,v=p.length-1;f0:e.util.schemaHasRules(m,e.RULES.all))&&(h=!1,l.schema=m,l.schemaPath=i+"["+f+"]",l.errSchemaPath=o+"/"+f,a+=" "+e.validate(l)+" ",l.baseId=u,n&&(a+=" if ("+d+") { ",c+="}"));return n&&(a+=h?" if (true) { ":" "+c.slice(0,-1)+" "),a},anyOf:function(e,t,r){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[t],n=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,d="data"+(i||""),u="valid"+s,h="errs__"+s,p=e.util.copy(e),m="";p.level++;var f="valid"+p.level;if(o.every((function(t){return e.opts.strictKeywords?"object"==typeof t&&Object.keys(t).length>0:e.util.schemaHasRules(t,e.RULES.all)}))){var v=p.baseId;a+=" var "+h+" = errors; var "+u+" = false; ";var y=e.compositeRule;e.compositeRule=p.compositeRule=!0;var g=o;if(g)for(var _,b=-1,w=g.length-1;b0:e.util.schemaHasRules(o,e.RULES.all);if(a+="var "+h+" = errors;var "+u+";",_){var b=e.compositeRule;e.compositeRule=p.compositeRule=!0,p.schema=o,p.schemaPath=n,p.errSchemaPath=l,a+=" var "+m+" = false; for (var "+f+" = 0; "+f+" < "+d+".length; "+f+"++) { ",p.errorPath=e.util.getPathExpr(e.errorPath,f,e.opts.jsonPointers,!0);var w=d+"["+f+"]";p.dataPathArr[v]=f;var P=e.validate(p);p.baseId=g,e.util.varOccurences(P,y)<2?a+=" "+e.util.varReplace(P,y,w)+" ":a+=" var "+y+" = "+w+"; "+P+" ",a+=" if ("+m+") break; } ",e.compositeRule=p.compositeRule=b,a+=" if (!"+m+") {"}else a+=" if ("+d+".length == 0) {";var S=S||[];S.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",!1!==e.opts.messages&&(a+=" , message: 'should contain a valid item' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var E=a;return a=S.pop(),!e.compositeRule&&c?e.async?a+=" throw new ValidationError(["+E+"]); ":a+=" validate.errors = ["+E+"]; return false; ":a+=" var err = "+E+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { ",_&&(a+=" errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } "),e.opts.allErrors&&(a+=" } "),a},dependencies:function(e,t,r){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[t],n=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,d="data"+(i||""),u="errs__"+s,h=e.util.copy(e),p="";h.level++;var m="valid"+h.level,f={},v={},y=e.opts.ownProperties;for(w in o)if("__proto__"!=w){var g=o[w],_=Array.isArray(g)?v:f;_[w]=g}a+="var "+u+" = errors;";var b=e.errorPath;for(var w in a+="var missing"+s+";",v)if((_=v[w]).length){if(a+=" if ( "+d+e.util.getProperty(w)+" !== undefined ",y&&(a+=" && Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(w)+"') "),c){a+=" && ( ";var P=_;if(P)for(var S=-1,E=P.length-1;S0:e.util.schemaHasRules(g,e.RULES.all))&&(a+=" "+m+" = true; if ( "+d+e.util.getProperty(w)+" !== undefined ",y&&(a+=" && Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(w)+"') "),a+=") { ",h.schema=g,h.schemaPath=n+e.util.getProperty(w),h.errSchemaPath=l+"/"+e.util.escapeFragment(w),a+=" "+e.validate(h)+" ",h.baseId=z,a+=" } ",c&&(a+=" if ("+m+") { ",p+="}"))}return c&&(a+=" "+p+" if ("+u+" == errors) {"),a},enum:function(e,t,r){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[t],n=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,d="data"+(i||""),u="valid"+s,h=e.opts.$data&&o&&o.$data;h&&(a+=" var schema"+s+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ");var p="i"+s,m="schema"+s;h||(a+=" var "+m+" = validate.schema"+n+";"),a+="var "+u+";",h&&(a+=" if (schema"+s+" === undefined) "+u+" = true; else if (!Array.isArray(schema"+s+")) "+u+" = false; else {"),a+=u+" = false;for (var "+p+"=0; "+p+"<"+m+".length; "+p+"++) if (equal("+d+", "+m+"["+p+"])) { "+u+" = true; break; }",h&&(a+=" } "),a+=" if (!"+u+") { ";var f=f||[];f.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { allowedValues: schema"+s+" } ",!1!==e.opts.messages&&(a+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var v=a;return a=f.pop(),!e.compositeRule&&c?e.async?a+=" throw new ValidationError(["+v+"]); ":a+=" validate.errors = ["+v+"]; return false; ":a+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" }",c&&(a+=" else { "),a},format:function(e,t,r){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[t],n=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,d="data"+(i||"");if(!1===e.opts.format)return c&&(a+=" if (true) { "),a;var u,h=e.opts.$data&&o&&o.$data;h?(a+=" var schema"+s+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",u="schema"+s):u=o;var p=e.opts.unknownFormats,m=Array.isArray(p);if(h){a+=" var "+(f="format"+s)+" = formats["+u+"]; var "+(v="isObject"+s)+" = typeof "+f+" == 'object' && !("+f+" instanceof RegExp) && "+f+".validate; var "+(y="formatType"+s)+" = "+v+" && "+f+".type || 'string'; if ("+v+") { ",e.async&&(a+=" var async"+s+" = "+f+".async; "),a+=" "+f+" = "+f+".validate; } if ( ",h&&(a+=" ("+u+" !== undefined && typeof "+u+" != 'string') || "),a+=" (","ignore"!=p&&(a+=" ("+u+" && !"+f+" ",m&&(a+=" && self._opts.unknownFormats.indexOf("+u+") == -1 "),a+=") || "),a+=" ("+f+" && "+y+" == '"+r+"' && !(typeof "+f+" == 'function' ? ",e.async?a+=" (async"+s+" ? await "+f+"("+d+") : "+f+"("+d+")) ":a+=" "+f+"("+d+") ",a+=" : "+f+".test("+d+"))))) {"}else{var f;if(!(f=e.formats[o])){if("ignore"==p)return e.logger.warn('unknown format "'+o+'" ignored in schema at path "'+e.errSchemaPath+'"'),c&&(a+=" if (true) { "),a;if(m&&p.indexOf(o)>=0)return c&&(a+=" if (true) { "),a;throw new Error('unknown format "'+o+'" is used in schema at path "'+e.errSchemaPath+'"')}var v,y=(v="object"==typeof f&&!(f instanceof RegExp)&&f.validate)&&f.type||"string";if(v){var g=!0===f.async;f=f.validate}if(y!=r)return c&&(a+=" if (true) { "),a;if(g){if(!e.async)throw new Error("async format in sync schema");a+=" if (!(await "+(_="formats"+e.util.getProperty(o)+".validate")+"("+d+"))) { "}else{a+=" if (! ";var _="formats"+e.util.getProperty(o);v&&(_+=".validate"),a+="function"==typeof f?" "+_+"("+d+") ":" "+_+".test("+d+") ",a+=") { "}}var b=b||[];b.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { format: ",a+=h?""+u:""+e.util.toQuotedString(o),a+=" } ",!1!==e.opts.messages&&(a+=" , message: 'should match format \"",a+=h?"' + "+u+" + '":""+e.util.escapeQuotes(o),a+="\"' "),e.opts.verbose&&(a+=" , schema: ",a+=h?"validate.schema"+n:""+e.util.toQuotedString(o),a+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var w=a;return a=b.pop(),!e.compositeRule&&c?e.async?a+=" throw new ValidationError(["+w+"]); ":a+=" validate.errors = ["+w+"]; return false; ":a+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",c&&(a+=" else { "),a},if:function(e,t,r){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[t],n=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,d="data"+(i||""),u="valid"+s,h="errs__"+s,p=e.util.copy(e);p.level++;var m="valid"+p.level,f=e.schema.then,v=e.schema.else,y=void 0!==f&&(e.opts.strictKeywords?"object"==typeof f&&Object.keys(f).length>0:e.util.schemaHasRules(f,e.RULES.all)),g=void 0!==v&&(e.opts.strictKeywords?"object"==typeof v&&Object.keys(v).length>0:e.util.schemaHasRules(v,e.RULES.all)),_=p.baseId;if(y||g){var b;p.createErrors=!1,p.schema=o,p.schemaPath=n,p.errSchemaPath=l,a+=" var "+h+" = errors; var "+u+" = true; ";var w=e.compositeRule;e.compositeRule=p.compositeRule=!0,a+=" "+e.validate(p)+" ",p.baseId=_,p.createErrors=!0,a+=" errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } ",e.compositeRule=p.compositeRule=w,y?(a+=" if ("+m+") { ",p.schema=e.schema.then,p.schemaPath=e.schemaPath+".then",p.errSchemaPath=e.errSchemaPath+"/then",a+=" "+e.validate(p)+" ",p.baseId=_,a+=" "+u+" = "+m+"; ",y&&g?a+=" var "+(b="ifClause"+s)+" = 'then'; ":b="'then'",a+=" } ",g&&(a+=" else { ")):a+=" if (!"+m+") { ",g&&(p.schema=e.schema.else,p.schemaPath=e.schemaPath+".else",p.errSchemaPath=e.errSchemaPath+"/else",a+=" "+e.validate(p)+" ",p.baseId=_,a+=" "+u+" = "+m+"; ",y&&g?a+=" var "+(b="ifClause"+s)+" = 'else'; ":b="'else'",a+=" } "),a+=" if (!"+u+") { var err = ",!1!==e.createErrors?(a+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { failingKeyword: "+b+" } ",!1!==e.opts.messages&&(a+=" , message: 'should match \"' + "+b+" + '\" schema' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&c&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; "),a+=" } ",c&&(a+=" else { ")}else c&&(a+=" if (true) { ");return a},items:function(e,t,r){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[t],n=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,d="data"+(i||""),u="valid"+s,h="errs__"+s,p=e.util.copy(e),m="";p.level++;var f="valid"+p.level,v="i"+s,y=p.dataLevel=e.dataLevel+1,g="data"+y,_=e.baseId;if(a+="var "+h+" = errors;var "+u+";",Array.isArray(o)){var b=e.schema.additionalItems;if(!1===b){a+=" "+u+" = "+d+".length <= "+o.length+"; ";var w=l;l=e.errSchemaPath+"/additionalItems",a+=" if (!"+u+") { ";var P=P||[];P.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { limit: "+o.length+" } ",!1!==e.opts.messages&&(a+=" , message: 'should NOT have more than "+o.length+" items' "),e.opts.verbose&&(a+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var S=a;a=P.pop(),!e.compositeRule&&c?e.async?a+=" throw new ValidationError(["+S+"]); ":a+=" validate.errors = ["+S+"]; return false; ":a+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",l=w,c&&(m+="}",a+=" else { ")}var E=o;if(E)for(var x,$=-1,j=E.length-1;$0:e.util.schemaHasRules(x,e.RULES.all)){a+=" "+f+" = true; if ("+d+".length > "+$+") { ";var k=d+"["+$+"]";p.schema=x,p.schemaPath=n+"["+$+"]",p.errSchemaPath=l+"/"+$,p.errorPath=e.util.getPathExpr(e.errorPath,$,e.opts.jsonPointers,!0),p.dataPathArr[y]=$;var O=e.validate(p);p.baseId=_,e.util.varOccurences(O,g)<2?a+=" "+e.util.varReplace(O,g,k)+" ":a+=" var "+g+" = "+k+"; "+O+" ",a+=" } ",c&&(a+=" if ("+f+") { ",m+="}")}if("object"==typeof b&&(e.opts.strictKeywords?"object"==typeof b&&Object.keys(b).length>0:e.util.schemaHasRules(b,e.RULES.all))){p.schema=b,p.schemaPath=e.schemaPath+".additionalItems",p.errSchemaPath=e.errSchemaPath+"/additionalItems",a+=" "+f+" = true; if ("+d+".length > "+o.length+") { for (var "+v+" = "+o.length+"; "+v+" < "+d+".length; "+v+"++) { ",p.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);k=d+"["+v+"]";p.dataPathArr[y]=v;O=e.validate(p);p.baseId=_,e.util.varOccurences(O,g)<2?a+=" "+e.util.varReplace(O,g,k)+" ":a+=" var "+g+" = "+k+"; "+O+" ",c&&(a+=" if (!"+f+") break; "),a+=" } } ",c&&(a+=" if ("+f+") { ",m+="}")}}else if(e.opts.strictKeywords?"object"==typeof o&&Object.keys(o).length>0:e.util.schemaHasRules(o,e.RULES.all)){p.schema=o,p.schemaPath=n,p.errSchemaPath=l,a+=" for (var "+v+" = 0; "+v+" < "+d+".length; "+v+"++) { ",p.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);k=d+"["+v+"]";p.dataPathArr[y]=v;O=e.validate(p);p.baseId=_,e.util.varOccurences(O,g)<2?a+=" "+e.util.varReplace(O,g,k)+" ":a+=" var "+g+" = "+k+"; "+O+" ",c&&(a+=" if (!"+f+") break; "),a+=" }"}return c&&(a+=" "+m+" if ("+h+" == errors) {"),a},maximum:ms,minimum:ms,maxItems:fs,minItems:fs,maxLength:vs,minLength:vs,maxProperties:ys,minProperties:ys,multipleOf:function(e,t,r){var a,s=" ",i=e.level,o=e.dataLevel,n=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,u="data"+(o||""),h=e.opts.$data&&n&&n.$data;if(h?(s+=" var schema"+i+" = "+e.util.getData(n.$data,o,e.dataPathArr)+"; ",a="schema"+i):a=n,!h&&"number"!=typeof n)throw new Error(t+" must be number");s+="var division"+i+";if (",h&&(s+=" "+a+" !== undefined && ( typeof "+a+" != 'number' || "),s+=" (division"+i+" = "+u+" / "+a+", ",e.opts.multipleOfPrecision?s+=" Math.abs(Math.round(division"+i+") - division"+i+") > 1e-"+e.opts.multipleOfPrecision+" ":s+=" division"+i+" !== parseInt(division"+i+") ",s+=" ) ",h&&(s+=" ) "),s+=" ) { ";var p=p||[];p.push(s),s="",!1!==e.createErrors?(s+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { multipleOf: "+a+" } ",!1!==e.opts.messages&&(s+=" , message: 'should be multiple of ",s+=h?"' + "+a:a+"'"),e.opts.verbose&&(s+=" , schema: ",s+=h?"validate.schema"+l:""+n,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),s+=" } "):s+=" {} ";var m=s;return s=p.pop(),!e.compositeRule&&d?e.async?s+=" throw new ValidationError(["+m+"]); ":s+=" validate.errors = ["+m+"]; return false; ":s+=" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",d&&(s+=" else { "),s},not:function(e,t,r){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[t],n=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,d="data"+(i||""),u="errs__"+s,h=e.util.copy(e);h.level++;var p="valid"+h.level;if(e.opts.strictKeywords?"object"==typeof o&&Object.keys(o).length>0:e.util.schemaHasRules(o,e.RULES.all)){h.schema=o,h.schemaPath=n,h.errSchemaPath=l,a+=" var "+u+" = errors; ";var m,f=e.compositeRule;e.compositeRule=h.compositeRule=!0,h.createErrors=!1,h.opts.allErrors&&(m=h.opts.allErrors,h.opts.allErrors=!1),a+=" "+e.validate(h)+" ",h.createErrors=!0,m&&(h.opts.allErrors=m),e.compositeRule=h.compositeRule=f,a+=" if ("+p+") { ";var v=v||[];v.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",!1!==e.opts.messages&&(a+=" , message: 'should NOT be valid' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var y=a;a=v.pop(),!e.compositeRule&&c?e.async?a+=" throw new ValidationError(["+y+"]); ":a+=" validate.errors = ["+y+"]; return false; ":a+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { errors = "+u+"; if (vErrors !== null) { if ("+u+") vErrors.length = "+u+"; else vErrors = null; } ",e.opts.allErrors&&(a+=" } ")}else a+=" var err = ",!1!==e.createErrors?(a+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: {} ",!1!==e.opts.messages&&(a+=" , message: 'should NOT be valid' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c&&(a+=" if (false) { ");return a},oneOf:function(e,t,r){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[t],n=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,d="data"+(i||""),u="valid"+s,h="errs__"+s,p=e.util.copy(e),m="";p.level++;var f="valid"+p.level,v=p.baseId,y="prevValid"+s,g="passingSchemas"+s;a+="var "+h+" = errors , "+y+" = false , "+u+" = false , "+g+" = null; ";var _=e.compositeRule;e.compositeRule=p.compositeRule=!0;var b=o;if(b)for(var w,P=-1,S=b.length-1;P0:e.util.schemaHasRules(w,e.RULES.all))?(p.schema=w,p.schemaPath=n+"["+P+"]",p.errSchemaPath=l+"/"+P,a+=" "+e.validate(p)+" ",p.baseId=v):a+=" var "+f+" = true; ",P&&(a+=" if ("+f+" && "+y+") { "+u+" = false; "+g+" = ["+g+", "+P+"]; } else { ",m+="}"),a+=" if ("+f+") { "+u+" = "+y+" = true; "+g+" = "+P+"; }";return e.compositeRule=p.compositeRule=_,a+=m+"if (!"+u+") { var err = ",!1!==e.createErrors?(a+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { passingSchemas: "+g+" } ",!1!==e.opts.messages&&(a+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ",a+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&c&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; "),a+="} else { errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; }",e.opts.allErrors&&(a+=" } "),a},pattern:function(e,t,r){var a,s=" ",i=e.level,o=e.dataLevel,n=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,u="data"+(o||""),h=e.opts.$data&&n&&n.$data;h?(s+=" var schema"+i+" = "+e.util.getData(n.$data,o,e.dataPathArr)+"; ",a="schema"+i):a=n,s+="if ( ",h&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'string') || "),s+=" !"+(h?"(new RegExp("+a+"))":e.usePattern(n))+".test("+u+") ) { ";var p=p||[];p.push(s),s="",!1!==e.createErrors?(s+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { pattern: ",s+=h?""+a:""+e.util.toQuotedString(n),s+=" } ",!1!==e.opts.messages&&(s+=" , message: 'should match pattern \"",s+=h?"' + "+a+" + '":""+e.util.escapeQuotes(n),s+="\"' "),e.opts.verbose&&(s+=" , schema: ",s+=h?"validate.schema"+l:""+e.util.toQuotedString(n),s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),s+=" } "):s+=" {} ";var m=s;return s=p.pop(),!e.compositeRule&&d?e.async?s+=" throw new ValidationError(["+m+"]); ":s+=" validate.errors = ["+m+"]; return false; ":s+=" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",d&&(s+=" else { "),s},properties:function(e,t,r){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[t],n=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,d="data"+(i||""),u="errs__"+s,h=e.util.copy(e),p="";h.level++;var m="valid"+h.level,f="key"+s,v="idx"+s,y=h.dataLevel=e.dataLevel+1,g="data"+y,_="dataProperties"+s,b=Object.keys(o||{}).filter(D),w=e.schema.patternProperties||{},P=Object.keys(w).filter(D),S=e.schema.additionalProperties,E=b.length||P.length,x=!1===S,$="object"==typeof S&&Object.keys(S).length,j=e.opts.removeAdditional,k=x||$||j,O=e.opts.ownProperties,C=e.baseId,A=e.schema.required;if(A&&(!e.opts.$data||!A.$data)&&A.length8)a+=" || validate.schema"+n+".hasOwnProperty("+f+") ";else{var R=b;if(R)for(var z=-1,I=R.length-1;z0:e.util.schemaHasRules(Y,e.RULES.all)){var X=e.util.getProperty(J),ee=(H=d+X,K&&void 0!==Y.default);h.schema=Y,h.schemaPath=n+X,h.errSchemaPath=l+"/"+e.util.escapeFragment(J),h.errorPath=e.util.getPath(e.errorPath,J,e.opts.jsonPointers),h.dataPathArr[y]=e.util.toQuotedString(J);G=e.validate(h);if(h.baseId=C,e.util.varOccurences(G,g)<2){G=e.util.varReplace(G,g,H);var te=H}else{te=g;a+=" var "+g+" = "+H+"; "}if(ee)a+=" "+G+" ";else{if(F&&F[J]){a+=" if ( "+te+" === undefined ",O&&(a+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(J)+"') "),a+=") { "+m+" = false; ";V=e.errorPath,U=l;var re,ae=e.util.escapeQuotes(J);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(V,J,e.opts.jsonPointers)),l=e.errSchemaPath+"/required",(re=re||[]).push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+ae+"' } ",!1!==e.opts.messages&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+ae+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";M=a;a=re.pop(),!e.compositeRule&&c?e.async?a+=" throw new ValidationError(["+M+"]); ":a+=" validate.errors = ["+M+"]; return false; ":a+=" var err = "+M+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",l=U,e.errorPath=V,a+=" } else { "}else c?(a+=" if ( "+te+" === undefined ",O&&(a+=" || ! Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(J)+"') "),a+=") { "+m+" = true; } else { "):(a+=" if ("+te+" !== undefined ",O&&(a+=" && Object.prototype.hasOwnProperty.call("+d+", '"+e.util.escapeQuotes(J)+"') "),a+=" ) { ");a+=" "+G+" } "}}c&&(a+=" if ("+m+") { ",p+="}")}}if(P.length){var se=P;if(se)for(var ie,oe=-1,ne=se.length-1;oe0:e.util.schemaHasRules(Y,e.RULES.all)){h.schema=Y,h.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(ie),h.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(ie),a+=O?" "+_+" = "+_+" || Object.keys("+d+"); for (var "+v+"=0; "+v+"<"+_+".length; "+v+"++) { var "+f+" = "+_+"["+v+"]; ":" for (var "+f+" in "+d+") { ",a+=" if ("+e.usePattern(ie)+".test("+f+")) { ",h.errorPath=e.util.getPathExpr(e.errorPath,f,e.opts.jsonPointers);H=d+"["+f+"]";h.dataPathArr[y]=f;G=e.validate(h);h.baseId=C,e.util.varOccurences(G,g)<2?a+=" "+e.util.varReplace(G,g,H)+" ":a+=" var "+g+" = "+H+"; "+G+" ",c&&(a+=" if (!"+m+") break; "),a+=" } ",c&&(a+=" else "+m+" = true; "),a+=" } ",c&&(a+=" if ("+m+") { ",p+="}")}}}return c&&(a+=" "+p+" if ("+u+" == errors) {"),a},propertyNames:function(e,t,r){var a=" ",s=e.level,i=e.dataLevel,o=e.schema[t],n=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,d="data"+(i||""),u="errs__"+s,h=e.util.copy(e);h.level++;var p="valid"+h.level;if(a+="var "+u+" = errors;",e.opts.strictKeywords?"object"==typeof o&&Object.keys(o).length>0:e.util.schemaHasRules(o,e.RULES.all)){h.schema=o,h.schemaPath=n,h.errSchemaPath=l;var m="key"+s,f="idx"+s,v="i"+s,y="' + "+m+" + '",g="data"+(h.dataLevel=e.dataLevel+1),_="dataProperties"+s,b=e.opts.ownProperties,w=e.baseId;b&&(a+=" var "+_+" = undefined; "),a+=b?" "+_+" = "+_+" || Object.keys("+d+"); for (var "+f+"=0; "+f+"<"+_+".length; "+f+"++) { var "+m+" = "+_+"["+f+"]; ":" for (var "+m+" in "+d+") { ",a+=" var startErrs"+s+" = errors; ";var P=m,S=e.compositeRule;e.compositeRule=h.compositeRule=!0;var E=e.validate(h);h.baseId=w,e.util.varOccurences(E,g)<2?a+=" "+e.util.varReplace(E,g,P)+" ":a+=" var "+g+" = "+P+"; "+E+" ",e.compositeRule=h.compositeRule=S,a+=" if (!"+p+") { for (var "+v+"=startErrs"+s+"; "+v+"0:e.util.schemaHasRules(_,e.RULES.all))||(m[m.length]=v)}}else m=o;if(h||m.length){var b=e.errorPath,w=h||m.length>=e.opts.loopRequired,P=e.opts.ownProperties;if(c)if(a+=" var missing"+s+"; ",w){h||(a+=" var "+p+" = validate.schema"+n+"; ");var S="' + "+(O="schema"+s+"["+($="i"+s)+"]")+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(b,O,e.opts.jsonPointers)),a+=" var "+u+" = true; ",h&&(a+=" if (schema"+s+" === undefined) "+u+" = true; else if (!Array.isArray(schema"+s+")) "+u+" = false; else {"),a+=" for (var "+$+" = 0; "+$+" < "+p+".length; "+$+"++) { "+u+" = "+d+"["+p+"["+$+"]] !== undefined ",P&&(a+=" && Object.prototype.hasOwnProperty.call("+d+", "+p+"["+$+"]) "),a+="; if (!"+u+") break; } ",h&&(a+=" } "),a+=" if (!"+u+") { ",(k=k||[]).push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { missingProperty: '"+S+"' } ",!1!==e.opts.messages&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+S+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+n+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+d+" "),a+=" } "):a+=" {} ";var E=a;a=k.pop(),!e.compositeRule&&c?e.async?a+=" throw new ValidationError(["+E+"]); ":a+=" validate.errors = ["+E+"]; return false; ":a+=" var err = "+E+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { "}else{a+=" if ( ";var x=m;if(x)for(var $=-1,j=x.length-1;$ 1) { ";var m=e.schema.items&&e.schema.items.type,f=Array.isArray(m);if(!m||"object"==m||"array"==m||f&&(m.indexOf("object")>=0||m.indexOf("array")>=0))s+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+u+"[i], "+u+"[j])) { "+h+" = false; break outer; } } } ";else{s+=" var itemIndices = {}, item; for (;i--;) { var item = "+u+"[i]; ";var v="checkDataType"+(f?"s":"");s+=" if ("+e.util[v](m,"item",e.opts.strictNumbers,!0)+") continue; ",f&&(s+=" if (typeof item == 'string') item = '\"' + item; "),s+=" if (typeof itemIndices[item] == 'number') { "+h+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}s+=" } ",p&&(s+=" } "),s+=" if (!"+h+") { ";var y=y||[];y.push(s),s="",!1!==e.createErrors?(s+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { i: i, j: j } ",!1!==e.opts.messages&&(s+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(s+=" , schema: ",s+=p?"validate.schema"+l:""+n,s+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),s+=" } "):s+=" {} ";var g=s;s=y.pop(),!e.compositeRule&&d?e.async?s+=" throw new ValidationError(["+g+"]); ":s+=" validate.errors = ["+g+"]; return false; ":s+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } ",d&&(s+=" else { ")}else d&&(s+=" if (true) { ");return s},validate:Ia},_s=aa.toHash,bs=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"],ws=function(e,t){for(var r=0;r
@@ -409,15 +409,15 @@ const J=e=>t=>"function"==typeof t?((e,t)=>(window.customElements.define(e,t),t) ${this.getSunModeToggle()}
- `}getHours(){return vn(this.value,{amPm:"true"==this.formatAmPm}).hours}getMinutes(){return vn(this.value,{amPm:"true"==this.formatAmPm}).minutes}hoursUp(){let e=this.event?{stepSize:this.stepSize,signed:!0,max:60*this.maxOffset}:{stepSize:this.stepSize};this.value=yn(this._val+60,e)}hoursDown(){let e=this.event?{stepSize:this.stepSize,signed:!0,max:60*this.maxOffset}:{stepSize:this.stepSize};this.value=yn(this._val-60,e)}minutesUp(){let e=this.event?{stepSize:this.stepSize,signed:!0,max:60*this.maxOffset}:{stepSize:this.stepSize};this.value=yn(this._val+this.stepSize,e)}minutesDown(){let e=this.event?{stepSize:this.stepSize,signed:!0,max:60*this.maxOffset}:{stepSize:this.stepSize};this.value=yn(this._val-this.stepSize,e)}getSunModeToggle(){if(isNaN(this.sunrise)||isNaN(this.sunset))return N``;let e=Math.abs(yn(this._val-this.sunrise,{stepSize:this.stepSize,signed:!0})),t=Math.abs(yn(this._val-this.sunset,{stepSize:this.stepSize,signed:!0}));return this.event||e<=60*this.maxOffset||t<=60*this.maxOffset?N` + `}getHours(){return le(this.value,{amPm:"true"==this.formatAmPm}).hours}getMinutes(){return le(this.value,{amPm:"true"==this.formatAmPm}).minutes}hoursUp(){let e=this.event?{stepSize:this.stepSize,signed:!0,max:60*this.maxOffset}:{stepSize:this.stepSize};this.value=ce(this._val+60,e)}hoursDown(){let e=this.event?{stepSize:this.stepSize,signed:!0,max:60*this.maxOffset}:{stepSize:this.stepSize};this.value=ce(this._val-60,e)}minutesUp(){let e=this.event?{stepSize:this.stepSize,signed:!0,max:60*this.maxOffset}:{stepSize:this.stepSize};this.value=ce(this._val+this.stepSize,e)}minutesDown(){let e=this.event?{stepSize:this.stepSize,signed:!0,max:60*this.maxOffset}:{stepSize:this.stepSize};this.value=ce(this._val-this.stepSize,e)}getSunModeToggle(){if(isNaN(this.sunrise)||isNaN(this.sunset))return T``;let e=Math.abs(ce(this._val-this.sunrise,{stepSize:this.stepSize,signed:!0})),t=Math.abs(ce(this._val-this.sunset,{stepSize:this.stepSize,signed:!0}));return this.event||e<=60*this.maxOffset||t<=60*this.maxOffset?T` - `:N` + `:T` - `}getAmPm(){return vn(this._val,{amPm:"true"==this.formatAmPm}).amPm}getBeforeAfter(){return this.value<0?pn("words.before"):pn("words.after")}getSuffix(){return this.event?N` + `}getAmPm(){return le(this._val,{amPm:"true"==this.formatAmPm}).amPm}getBeforeAfter(){return this.value<0?Pr("words.before"):Pr("words.after")}getSuffix(){return this.event?T`
${this.getBeforeAfter()} @@ -426,13 +426,13 @@ const J=e=>t=>"function"==typeof t?((e,t)=>(window.customElements.define(e,t),t)
- `:"true"==this.formatAmPm?N` + `:"true"==this.formatAmPm?T`
${this.getAmPm()}
- `:N``}toggleAmPm(){this._val<720?this.value=yn(this._val+720):this.value=yn(this._val-720)}toggleBeforeAfter(){this.value=-this._val}toggleSunriseSunset(){this.event="sunrise"==this.event?"sunset":"sunrise",this.value=this._val}toggleMode(){let e=this.value;if(this.event){let t="sunrise"==this.event?this.sunrise:this.sunset;this.event=null,this.value=e+t}else{let t;Math.abs(e-this.sunrise)t=>"function"==typeof t?((e,t)=>(window.customElements.define(e,t),t) --mdc-theme-primary: var(--text-primary-color); border-radius: 4px; } - `,t([Z({type:Number})],Ul.prototype,"value",null),t([Z({type:String})],Ul.prototype,"event",void 0),t([Z({type:String})],Ul.prototype,"formatAmPm",void 0),t([Z({type:Number})],Ul.prototype,"stepSize",void 0),t([Z({type:Number})],Ul.prototype,"sunrise",void 0),t([Z({type:Number})],Ul.prototype,"sunset",void 0),Ul=t([J("time-picker")],Ul);function Ll(e){return"true"==e||"false"!=e&&!!e.length}let ql=class extends ae{constructor(){super(...arguments),this.min=0,this.max=100,this.step=1,this.value=0,this.show_percentage="false",this.unit="",this.optional="false",this.disabled="false",this.scaleGain=1,this.scaleOffset=0}updated(){}firstUpdated(){(async()=>{await(async()=>{if(customElements.get("ha-checkbox")&&customElements.get("ha-paper-slider"))return;await customElements.whenDefined("partial-panel-resolver");const e=document.createElement("partial-panel-resolver");e.hass={panels:[{url_path:"tmp",component_name:"config"}]},e._updateRoutes(),await e.routerOptions.routes.tmp.load(),await customElements.whenDefined("ha-panel-config");const t=document.createElement("ha-panel-config");await t.routerOptions.routes.automation.load()})()})(),Ll(this.show_percentage)&&(this.unit="%",this.scaleOffset=this.min,this.scaleGain=(this.max-this.min)/100,this.min=0,this.max=100),Ll(this.disabled)&&!Ll(this.optional)&&(this.disabled="false"),isNaN(this.value)&&(this.value=this.min),this.requestUpdate()}render(){return N` + `,t([Z({type:Number})],Ws.prototype,"value",null),t([Z({type:String})],Ws.prototype,"event",void 0),t([Z({type:String})],Ws.prototype,"formatAmPm",void 0),t([Z({type:Number})],Ws.prototype,"stepSize",void 0),t([Z({type:Number})],Ws.prototype,"sunrise",void 0),t([Z({type:Number})],Ws.prototype,"sunset",void 0),Ws=t([J("time-picker")],Ws);function Zs(e){return"true"==e||"false"!=e&&!!e.length}let Ys=class extends ae{constructor(){super(...arguments),this.min=0,this.max=100,this.step=1,this.value=0,this.unit="",this.optional="false",this.disabled="false",this.scaleGain=1,this.scaleOffset=0}updated(){}firstUpdated(){(async()=>{await(async()=>{if(customElements.get("ha-checkbox")&&customElements.get("ha-paper-slider"))return;await customElements.whenDefined("partial-panel-resolver");const e=document.createElement("partial-panel-resolver");e.hass={panels:[{url_path:"tmp",component_name:"config"}]},e._updateRoutes(),await e.routerOptions.routes.tmp.load(),await customElements.whenDefined("ha-panel-config");const t=document.createElement("ha-panel-config");await t.routerOptions.routes.automation.load()})()})(),"%"==this.unit&&(this.scaleOffset=this.min,this.scaleGain=(this.max-this.min)/100,this.min=0,this.max=100),Zs(this.disabled)&&!Zs(this.optional)&&(this.disabled="false"),isNaN(this.value)&&(this.value=this.min),this.requestUpdate()}render(){return T`
${this.getCheckbox()} @@ -485,10 +485,10 @@ const J=e=>t=>"function"==typeof t?((e,t)=>(window.customElements.define(e,t),t)
${this.getSlider()}
-
+
${this.getScaledValue()}${this.unit}
- `}getScaledValue(){let e=this.value,t=Math.round((e-this.scaleOffset)/this.scaleGain);return tthis.max&&(t=this.max),Math.round(t*this.step/this.step)}getSlider(){return Ll(this.disabled)?N` + `}getScaledValue(){let e=this.value,t=Math.round((e-this.scaleOffset)/this.scaleGain);return tthis.max&&(t=this.max),Math.round(t*this.step/this.step)}getSlider(){return Zs(this.disabled)?T` t=>"function"==typeof t?((e,t)=>(window.customElements.define(e,t),t) step=${this.step} value=${this.getScaledValue()} disabled - >`:N` + >`:T` t=>"function"==typeof t?((e,t)=>(window.customElements.define(e,t),t) step=${this.step} value=${this.getScaledValue()} @change=${this.updateValue} - >`}getCheckbox(){return Ll(this.optional)?Ll(this.disabled)?N``:N``:N``}toggleChecked(e){let t=e.target.checked;this.disabled=t?"false":"true"}updateValue(e){let t=Number(e.target.value)*this.scaleGain+this.scaleOffset;t=Math.round(t*this.step)/this.step,this.value=t}};ql.styles=te` + >`}getCheckbox(){return Zs(this.optional)?Zs(this.disabled)?T``:T``:T``}toggleChecked(e){let t=e.target.checked;this.disabled=t?"false":"true"}updateValue(e){let t=Number(e.target.value)*this.scaleGain+this.scaleOffset;t=Math.round(t*this.step)/this.step,this.value=t}};function Xs(e){return e.endTime-e.startTime}Ys.styles=te` :host { width: 100%; @@ -544,7 +544,7 @@ const J=e=>t=>"function"==typeof t?((e,t)=>(window.customElements.define(e,t),t) .disabled { color: var(--disabled-text-color); } - `,t([Z({type:Number})],ql.prototype,"min",void 0),t([Z({type:Number})],ql.prototype,"max",void 0),t([Z({type:Number})],ql.prototype,"step",void 0),t([Z({type:Number})],ql.prototype,"value",void 0),t([Z({type:String})],ql.prototype,"show_percentage",void 0),t([Z({type:String})],ql.prototype,"unit",void 0),t([Z({type:String})],ql.prototype,"optional",void 0),t([Z({type:String})],ql.prototype,"disabled",void 0),ql=t([J("variable-slider")],ql);function Vl(e){return e.endTime-e.startTime}let Ml=class extends ae{constructor(){super(...arguments),this.slots=[],this.actions=[],this.stepSize=15,this._activeSlot=null,this._activeThumb=null}updated(){}firstUpdated(){}render(){return N` + `,t([Z({type:Number})],Ys.prototype,"min",void 0),t([Z({type:Number})],Ys.prototype,"max",void 0),t([Z({type:Number})],Ys.prototype,"step",void 0),t([Z({type:Number})],Ys.prototype,"value",void 0),t([Z({type:String})],Ys.prototype,"unit",void 0),t([Z({type:String})],Ys.prototype,"optional",void 0),t([Z({type:String})],Ys.prototype,"disabled",void 0),Ys=t([J("variable-slider")],Ys);let ei=class extends ae{constructor(){super(...arguments),this.slots=[],this.actions=[],this.stepSize=15,this._activeSlot=null,this._activeThumb=null,this.temperatureUnit=""}updated(){}firstUpdated(){}render(){return T`
@@ -564,40 +564,40 @@ const J=e=>t=>"function"==typeof t?((e,t)=>(window.customElements.define(e,t),t)
- ${null!==this._activeSlot&&this.slots.length<10?N` + ${null!==this._activeSlot&&this.slots.length<10?T` Add - `:N` + `:T` Add `} - ${null!==this._activeSlot&&this.slots.length>3?N` + ${null!==this._activeSlot&&this.slots.length>3?T` Remove - `:N` + `:T` Remove `}
- `}getSlots(){let e=[];return this.slots.forEach((t,r)=>{e.push(N` -
+ `}getSlots(){let e=[];return this.slots.forEach((t,r)=>{e.push(T` +
${this.getSlotAction(t)}
- `),r
- ${vn(this.slots[r].endTime).time} + ${le(this.slots[r].endTime).time}
-
`)}),e}getSlotAction(e){if(!e.action)return"";let t=this.actions.find(t=>t.id==e.action);if(e.levelEnabled&&void 0!==e.level&&t.variable){let r=t.variable,a=e.level,i=r.unit;if(r.show_percentage){let e=r.min,t=(r.max-r.min)/100;a=Math.round((a-e)/t),i="%"}return`${a}${i}`}return"turn_on"==e.action?"on":"turn_off"==e.action?"off":""+e.action}_handleSegmentClick(e){let t=e.target,r=Number(t.getAttribute("index"));this._activeSlot=this._activeSlot==r?null:r;let a=new CustomEvent("update",{detail:{slot:this._activeSlot}});this.dispatchEvent(a)}_handleTouchStart(e){let t;if(t=e.target,!t)return;let r=t.parentNode,a=Number(r.getAttribute("index"));this._activeThumb=a;let i=r.parentElement,s=i.getBoundingClientRect(),n=r.previousElementSibling,o=r.nextElementSibling,l=r.querySelector(".slider-thumb-tooltip");const c=n.offsetWidth+o.offsetWidth,u=s.width;let d=Array.from(i.querySelectorAll(".slider-slot")),h=d.map(e=>e.offsetWidth),p=0,f=-1;d.forEach((e,t)=>{e==n?f=t:-1==f&&(p+=h[t])});let m=e=>{let t;t=e instanceof TouchEvent?e.changedTouches[0].pageX:e.pageX;let r=t-s.left;r<0?r=0:r>s.width&&(r=s.width),r>c+p&&(r=c+p),r=1440?a=1440:mn(a,this.stepSize),l.dispatchEvent(new CustomEvent("update",{detail:{time:a}}))};var v=()=>{window.removeEventListener("mousemove",m),window.removeEventListener("touchmove",m),window.removeEventListener("mouseup",v),window.addEventListener("touchend",v);let e=gn(l.innerText),t=Vl(this.slots[f])+Vl(this.slots[f+1]),r=this.slots[f].startTime,a=[...this.slots];Object.assign(a[f],{endTime:e}),Object.assign(a[f+1],{startTime:e,endTime:r+t});let i=new CustomEvent("update",{detail:{slots:a}});this.dispatchEvent(i),m=()=>{},this._activeThumb=null};window.addEventListener("mouseup",v),window.addEventListener("touchend",v),window.addEventListener("mousemove",m),window.addEventListener("touchmove",m)}_updateMarker(e){let t=e.detail,r=0;if(t.hasOwnProperty("time"))r=Number(t.time);else if(t.hasOwnProperty("index")){let e=t.index;r=this.slots[e].endTime}1440==r&&(r-=1),e.target.innerText=vn(r).time}_addSlot(){let e=this.slots[this._activeSlot],t=e.startTime,r=e.endTime,a=mn(t+Vl(e)/2,this.stepSize),i=[...this.slots];Object.assign(i[this._activeSlot],{endTime:a}),i.splice(this._activeSlot+1,0,{startTime:a,endTime:r});let s=new CustomEvent("update",{detail:{slots:i}});this.dispatchEvent(s)}_removeSlot(){let e=this._activeSlot==this.slots.length-1?this._activeSlot-1:this._activeSlot,t=Object.assign({},this.slots[e]);Object.assign(t,{endTime:this.slots[e+1].endTime});let r=[...this.slots];r.splice(e,2,t);let a=new CustomEvent("update",{detail:{slots:r}});this.dispatchEvent(a)}};Ml.styles=te` +
`)}),e}getSlotAction(e){if(!e.action)return"";let t=this.actions.find(t=>t.id==e.action);if(e.variable&&e.variable.type==se.Level){let r=e.variable,a=t.variable;if(r.enabled)return Lr(r,a,{temperature_unit:this.temperatureUnit})}else if(e.variable&&e.variable.type==se.List){return Lr(e.variable,t.variable,{temperature_unit:this.temperatureUnit})}return"turn_on"==e.action?"on":"turn_off"==e.action?"off":""+e.action}_handleSegmentClick(e){let t=e.target,r=Number(t.getAttribute("index"));this._activeSlot=this._activeSlot==r?null:r;let a=new CustomEvent("update",{detail:{slot:this._activeSlot}});this.dispatchEvent(a)}_handleTouchStart(e){let t;if(t=e.target,!t)return;let r=t.parentNode,a=Number(r.getAttribute("index"));this._activeThumb=a;let s=r.parentElement,i=s.getBoundingClientRect(),o=r.previousElementSibling,n=r.nextElementSibling,l=r.querySelector(".slider-thumb-tooltip");const c=o.offsetWidth+n.offsetWidth,d=i.width;let u=Array.from(s.querySelectorAll(".slider-slot")),h=u.map(e=>e.offsetWidth),p=0,m=-1;u.forEach((e,t)=>{e==o?m=t:-1==m&&(p+=h[t])});let f=e=>{let t;t=e instanceof TouchEvent?e.changedTouches[0].pageX:e.pageX;let r=t-i.left;r<0?r=0:r>i.width&&(r=i.width),r>c+p&&(r=c+p),r=1440?a=1440:ne(a,this.stepSize),l.dispatchEvent(new CustomEvent("update",{detail:{time:a}}))};var v=()=>{window.removeEventListener("mousemove",f),window.removeEventListener("touchmove",f),window.removeEventListener("mouseup",v),window.addEventListener("touchend",v);let e=de(l.innerText),t=Xs(this.slots[m])+Xs(this.slots[m+1]),r=this.slots[m].startTime,a=[...this.slots];Object.assign(a[m],{endTime:e}),Object.assign(a[m+1],{startTime:e,endTime:r+t});let s=new CustomEvent("update",{detail:{slots:a}});this.dispatchEvent(s),f=()=>{},this._activeThumb=null};window.addEventListener("mouseup",v),window.addEventListener("touchend",v),window.addEventListener("mousemove",f),window.addEventListener("touchmove",f)}_updateMarker(e){let t=e.detail,r=0;if(t.hasOwnProperty("time"))r=Number(t.time);else if(t.hasOwnProperty("index")){let e=t.index;r=this.slots[e].endTime}1440==r&&(r-=1),e.target.innerText=le(r).time}_addSlot(){let e=this.slots[this._activeSlot],t=e.startTime,r=e.endTime,a=ne(t+Xs(e)/2,this.stepSize),s=[...this.slots];Object.assign(s[this._activeSlot],{endTime:a}),s.splice(this._activeSlot+1,0,{startTime:a,endTime:r});let i=new CustomEvent("update",{detail:{slots:s}});this.dispatchEvent(i)}_removeSlot(){let e=this._activeSlot==this.slots.length-1?this._activeSlot-1:this._activeSlot,t=Object.assign({},this.slots[e]);Object.assign(t,{endTime:this.slots[e+1].endTime});let r=[...this.slots];r.splice(e,2,t);let a=new CustomEvent("update",{detail:{slots:r}});this.dispatchEvent(a)}};ei.styles=te` div.slider-track { height: 45px; @@ -692,149 +692,150 @@ const J=e=>t=>"function"==typeof t?((e,t)=>(window.customElements.define(e,t),t) --mdc-theme-primary: var(--text-primary-color); border-radius: 4px; } - `,t([Z({type:Array})],Ml.prototype,"slots",void 0),t([Z({type:Array})],Ml.prototype,"actions",void 0),t([Z({type:Number})],Ml.prototype,"stepSize",void 0),t([Z({type:Number})],Ml.prototype,"_activeSlot",void 0),t([Z({type:Number})],Ml.prototype,"_activeThumb",void 0),Ml=t([J("timeslot-editor")],Ml),window.customCards=window.customCards||[],window.customCards.push({type:"scheduler-card",name:"Scheduler Card",description:"Card to manage schedule entities made with scheduler-component."}),console.info(`%c SCHEDULER-CARD \n%c Version: ${"1.4.2".padEnd(8," ")}\n%c Language: ${fn().padEnd(7," ")}`,"color: orange; font-weight: bold; background: black","color: white; font-weight: bold; background: dimgray","color: white; font-weight: bold; background: dimgray"),e.SchedulerCard=class extends ae{constructor(){super(...arguments),this._config=Nl,this.Config=new Vn,this.scheduleItems=[],this.selection=Object.assign({},Il)}static get styles(){return Mn}set hass(e){this._hass||this.init(e),this.updateScheduleList(e),this._hass=e}init(e){void 0!==e.states["sun.sun"]&&Object.assign(this._config,{sunrise:gn(e.states["sun.sun"].attributes.next_rising),sunset:gn(e.states["sun.sun"].attributes.next_setting)}),this.Config.LoadEntities(e.states)}updateScheduleList(e){let t=Ia(e.states,e=>Dn(e.entity_id)).map(e=>function(e,t){let r=e.attributes.actions.map(e=>{let r=String(e.entity),a=String(e.service),i=Object.entries(e).filter(([e])=>!["entity","service"].includes(e)).reduce((e,[t,r])=>Object.assign(e,{[t]:r}),{});if(Cn(r)||(r=`${Cn(a)}.${r}`),Cn(a)==Cn(r)&&(a=String(a.split(".").pop())),!t.FindEntity(r))return{};let s=Object.keys(i).length?Fn({service:a,service_data:i}):Fn({service:a}),n={entity:r,action:s};if(!t.FindAction(r,s)){let e=t.GetActionsForEntity(r).find(e=>e.hasOwnProperty("variable")&&i.hasOwnProperty(e.variable.field));if(!e)return n;{let t=e.variable.field;Object.assign(n,{level:Number(i[t]),levelEnabled:!0}),delete i[t],s=Object.keys(i).length?Fn({service:a,service_data:i}):Fn({service:a})}}return Object.assign(n,{action:s}),n}),a=[];return e.attributes.entries.forEach(e=>{let t,i=On.exec(e),s=kn.exec(i[3]),n=An.exec(i[2]);t=n?{event:"SR"==n[2]?"sunrise":"sunset",value:n[1]?-gn(n[1]):gn(n[3])}:{value:gn(i[2])},s.map(Number).filter(e=>!isNaN(e)).forEach(e=>{e>=r.length||a.push(Object.assign(Object.assign({},r[e]),{time:t,days:i[1].split("").map(Number)}))})}),{id:e.entity_id,enabled:"off"!=e.state,entries:a}}(e,this.Config));Ka(t,this.scheduleItems)||(this.scheduleItems=t,this.requestUpdate())}getCardSize(){return this._hass&&this.scheduleItems.length?6+2*this.scheduleItems.length:6}render(){return this.selection.newItem||this.selection.editItem?this.selection.newItem&&!this.selection.actionConfirmed?N` + `,t([Z({type:Array})],ei.prototype,"slots",void 0),t([Z({type:Array})],ei.prototype,"actions",void 0),t([Z({type:Number})],ei.prototype,"stepSize",void 0),t([Z({type:Number})],ei.prototype,"_activeSlot",void 0),t([Z({type:Number})],ei.prototype,"_activeThumb",void 0),t([Z({type:String})],ei.prototype,"temperatureUnit",void 0),ei=t([J("timeslot-editor")],ei),window.customCards=window.customCards||[],window.customCards.push({type:"scheduler-card",name:"Scheduler Card",description:"Card to manage schedule entities made with scheduler-component."}),console.info(`%c SCHEDULER-CARD \n%c Version: ${"1.5.0".padEnd(8," ")}\n%c Language: ${Sr().padEnd(7," ")}`,"color: orange; font-weight: bold; background: black","color: white; font-weight: bold; background: dimgray","color: white; font-weight: bold; background: dimgray"),e.SchedulerCard=class extends ae{constructor(){super(...arguments),this._config=me,this.Config=new Yr,this._entities={},this.scheduleItems=[],this.newItem=!1,this.editItem=!1,this.newItemConfirmed=!1,this._entry=Object.assign({},ve),this._slots=[],this._slotNum=null,this._selectedGroup=""}static get styles(){return Xr}set hass(e){this._hass||this.init(e),this.updateScheduleList(e),this._hass=e}init(e){void 0!==e.states["sun.sun"]&&(this._config=Object.assign(Object.assign({},this._config),{sunrise:de(e.states["sun.sun"].attributes.next_rising),sunset:de(e.states["sun.sun"].attributes.next_setting)})),e.config.unit_system&&e.config.unit_system.temperature&&(this._config=Object.assign(Object.assign({},this._config),{temperature_unit:e.config.unit_system.temperature})),e.user.is_admin||(this._config=Object.assign(Object.assign({},this._config),{is_admin:!1})),this.Config.LoadEntities(e.states)}updateScheduleList(e){let t=Cr(e.states,(e,t)=>Jr(t));qr(t,this._entities)||(this._entities=t,this.scheduleItems=Object.values(t).map(e=>function(e,t){if(!e.attributes.actions||!e.attributes.entries)return null;let r=e.attributes.actions.map(e=>{let r=Gr(e);if(!t.FindEntity(r.entity))return null;let a=Kr(r,t.GetActionsForEntity(r.entity));if(!a)return null;let s={entity:r.entity,action:a.id};if(a.variable&&a.variable.type==se.Level){if(a.variable.type==se.Level){let e;e=r.service_data&&a.variable.field in r.service_data?{type:se.Level,value:Number(r.service_data[a.variable.field]),enabled:!0}:{type:se.Level,value:null,enabled:!1},s=$r(s,{variable:e})}}else if(a.variable&&a.variable.type==se.List){let e;e=r.service_data&&a.variable.field in r.service_data?{type:se.List,value:String(r.service_data[a.variable.field])}:{type:se.List,value:null},s=$r(s,{variable:e})}return s}),a=[];return e.attributes.entries.forEach(e=>{let t,s=Ks.exec(e),i=Bs.exec(s[3]).map(Number),o=Js.exec(s[2]);return t=o?{event:"SR"==o[2]?ie.Sunrise:ie.Sunset,value:o[1]?-de(o[1]):de(o[3])}:{value:de(s[2])},i.filter(e=>r[e]).forEach(e=>{a.push($r(r[e],{time:t,days:he(s[1].split("").map(Number))}))})}),a.length?{entries:a,id:e.entity_id,enabled:"off"!=e.state}:null}(e,this.Config)).filter(e=>e))}setConfig(e){!function(e){if(!Hs.validate(Gs,e)){let e=Hs.errors.map(e=>{let t="",r=e.dataPath.substr(1).split("/"),a=r.pop();return r.length&&(t+=`in ${r.join("/")} `),"type"==e.keyword&&(t+="type of "),a?a&&(t+=(isNaN(+a)?`'${a}'`:`[item ${a}]`)+" "):t+="card ",t+=e.message,e.params.hasOwnProperty("additionalProperty")&&(t+=` '${e.params.additionalProperty}'`),t.charAt(0).toUpperCase()+t.slice(1)+"."});throw new Error("Invalid configuration provided. "+e.join(" //////////////////////////////////// "))}}(e);this._config=Object.assign(Object.assign({},this._config),jr(e,Object.keys(this._config))),this.Config.setUserConfig(jr(e,["groups","domains","entities","discover_existing","standard_configuration"]))}getCardSize(){return this._hass&&this.scheduleItems.length?6+2*this.scheduleItems.length:6}render(){return this.newItem||this.editItem?this.newItem&&!this.newItemConfirmed?T` ${this.getTitle()}
-
${pn("fields.group")}
+
${Pr("fields.group")}
${this.getGroups()}
-
${pn("fields.entity")}
+
${Pr("fields.entity")}
${this.getEntities()}
${this.getActions()}
- ${pn("actions.cancel")} - ${this.selection.action?N`${pn("actions.next")}`:N`${pn("actions.next")}`} + ${Pr("actions.cancel")} + ${this._entry.action?T`${Pr("actions.next")}`:T`${Pr("actions.next")}`}
- `:this.selection.action==Sn.id?N` + `:this._entry.action==ye?T` ${this.getTitle()} ${this.showRoutineEditor()} - `:N` + `:T` ${this.getTitle()} ${this.showEditor()} - `:N` + `:T` ${this.getTitle()}
${this.getEntries()}
+ ${this._config.is_admin?T`
- ${pn("actions.add")} -
+ ${Pr("actions.add")} +
`:""} - `}getTitle(){return"string"==typeof this._config.title?N`
${this._config.title}
`:this._config.title?N`
${pn("scheduler")}
`:N``}newItem(){this.selection=Kt(Object.assign({},Il),{newItem:!0}),this.requestUpdate()}editItemCancel(){this.selection=Object.assign({},Il),this.requestUpdate()}newItemConfirm(){this.selection=Kt(Object.assign({},Il),{newItem:!0,actionConfirmed:!0,entity:this.selection.entity,action:this.selection.action}),this.requestUpdate()}getEntries(){return this.scheduleItems&&this.scheduleItems.length?this.scheduleItems.map(e=>{let t=this.Config.FindEntity(e.entries[0].entity),r=this.Config.FindAction(e.entries[0].entity,e.entries[0].action);if(!t||!r)return N``;if(1==e.entries.length)return N` -
+ `}getTitle(){return"string"==typeof this._config.title?T`
${this._config.title}
`:this._config.title?T`
${Pr("scheduler")}
`:T``}getEntries(){return this.scheduleItems&&this.scheduleItems.length?this.scheduleItems.map(e=>{let t=this.Config.FindEntity(e.entries[0].entity),r=this.Config.FindAction(e.entries[0].entity,e.entries[0].action);if(!t||!r)return T``;if(1==e.entries.length)return T` +
- ${t.icon?N``:""} + ${t.icon?T``:""}
- ${In(t.name)} + ${Ir(t.name)}
- ${Un(e.entries[0],r)} + ${Tr(e.entries[0],r,{temperature_unit:this._config.temperature_unit})}
- ${Ln(Rn(e.entries[0].days))} + ${Vr(Rr(e.entries[0].days))}
- ${Ln(Tn(e.entries[0].time,{amPm:this._config.am_pm,sunrise:this._config.sunrise,sunset:this._config.sunset}))} + ${Vr(zr(e.entries[0].time,{amPm:this._config.am_pm,sunrise:this._config.sunrise,sunset:this._config.sunset}))}
- ${e.enabled?N``:N``} + ${e.enabled?T``:T``}
- `;{let r=e.entries.map(e=>{let t=Un(e,this.Config.FindAction(e.entity,e.action)),r=Tn(e.time,{amPm:this._config.am_pm,sunrise:this._config.sunrise,sunset:this._config.sunset});return N`${t} ${r}
`});return N` -
+ `;{let r=e.entries.map(e=>{let t=Tr(e,this.Config.FindAction(e.entity,e.action),{temperature_unit:this._config.temperature_unit}),r=zr(e.time,{amPm:this._config.am_pm,sunrise:this._config.sunrise,sunset:this._config.sunset});return T`${t} ${r}
`});return T` +
- ${t.icon?N``:""} + ${t.icon?T``:""}
- ${In(t.name)} + ${Ir(t.name)}
${r}
- ${Ln(Rn(e.entries[0].days))} + ${Vr(Rr(e.entries[0].days))}
- ${e.enabled?N``:N``} + ${e.enabled?T``:T``}
- `}}):[N` + `}}):[T`
- ${pn("instructions.no_entries_defined")} + ${Pr("instructions.no_entries_defined")}
- `]}toggleDisable(e,t){t.stopPropagation(),!t.target.checked?this._hass.callService("switch","turn_on",{entity_id:e}):this._hass.callService("switch","turn_off",{entity_id:e})}editItem(e){let t=La(this.scheduleItems,{id:e});1==t.entries.length?(this.selection=Kt(Object.assign({},Il),{editItem:e,entity:t.entries[0].entity,action:t.entries[0].action,time:t.entries[0].time,days:t.entries[0].days,daysType:zn(t.entries[0].days)}),void 0!==t.entries[0].level&&Object.assign(this.selection,{levelEnabled:!0,level:t.entries[0].level})):this.selection=Kt(Object.assign({},Il),{editItem:e,entity:t.entries[0].entity,action:Sn.id,days:t.entries[0].days,daysType:zn(t.entries[0].days),plannerSlots:qn(t.entries)}),this.requestUpdate()}getGroups(){let e=this.Config.GetGroups();return e.length?e.map(e=>N` - - ${e.icon?N``:""} - ${In(e.name)} + `]}toggleDisable(e,t){t.stopPropagation(),!t.target.checked?this._hass.callService("switch","turn_on",{entity_id:e}):this._hass.callService("switch","turn_off",{entity_id:e})}getGroups(){let e=this.Config.GetGroups();return e.length?e.map(e=>T` + + ${e.icon?T``:""} + ${Ir(e.name)} - `):[N`
${pn("instructions.no_groups_defined")}
`]}selectGroup(e){Object.assign(this.selection,{group:e,entity:null,action:null}),this.requestUpdate()}getEntities(){if(!this.selection.group)return[N`
${pn("instructions.no_group_selected")}
`];let e=this.Config.GetEntitiesForGroup(this.selection.group);return e.length?e.map(e=>N` - - ${e.icon?N``:""} - ${In(e.name)} + `):[T`
${Pr("instructions.no_groups_defined")}
`]}selectGroup(e){this._selectedGroup=e,1==this.Config.GetEntitiesForGroup(e).length?this.selectEntity(this.Config.GetEntitiesForGroup(e)[0].id):this._entry=Object.assign({},ve)}getEntities(){if(!this._selectedGroup)return[T`
${Pr("instructions.no_group_selected")}
`];let e=this.Config.GetEntitiesForGroup(this._selectedGroup);return e.length?e.map(e=>T` + + ${e.icon?T``:""} + ${Ir(e.name)} - `):[N`
${pn("instructions.no_entities_for_group")}
`]}selectEntity(e){Object.assign(this.selection,{entity:e,action:null}),this.requestUpdate()}getActions(){if(!this.selection.entity)return N` + `):[T`
${Pr("instructions.no_entities_for_group")}
`]}selectEntity(e){this._entry=Object.assign(Object.assign({},this._entry),{entity:e}),1==this.Config.GetActionsForEntity(e).length&&this.selectAction(this.Config.GetActionsForEntity(e)[0].id)}getActions(){if(!this._entry.entity)return T`
-
${pn("fields.action")}
+
${Pr("fields.action")}
-
${pn("instructions.no_entity_selected")}
+
${Pr("instructions.no_entity_selected")}
- `;let e=this.Config.GetActionsForEntity(this.selection.entity);if(!e.length)return N` + `;let e=this.Config.GetActionsForEntity(this._entry.entity);if(!e.length)return T`
-
${pn("fields.action")}
+
${Pr("fields.action")}
-
${pn("instructions.no_actions_for_entity")}
+
${Pr("instructions.no_actions_for_entity")}
- `;let t=e.filter(e=>e.id!=Sn.id).map(e=>N` - - ${e.icon?N``:""} - ${In(e.name)} + `;1==e.length&&this.selectAction(e[0].id);let t=e.filter(e=>e.id!=ye).map(e=>T` + + ${e.icon?T``:""} + ${Ir(e.name)} - `),r=[N``];return r=e.filter(e=>e.id==Sn.id).map(e=>N` + `),r=[T``];return r=e.filter(e=>e.id==ye).map(e=>T`
or
- - ${e.icon?N``:""} - ${In(e.name)} + + ${e.icon?T``:""} + ${Ir(e.name)}
- `),N` + `),T`
-
${pn("fields.action")}
+
${Pr("fields.action")}
${t}
${r} - `}selectAction(e){Object.assign(this.selection,{action:e}),this.requestUpdate()}setConfig(e){let t={},r={};!function(e){if(!Rl.validate(Tl,e)){let e=Rl.errors.map(e=>{let t="",r=e.dataPath.substr(1).split("/"),a=r.pop();return r.length&&(t+=`in '${r.join("->")}' `),"type"==e.keyword&&(t+="type of "),a?a&&(t+=(isNaN(+a)?`'${a}'`:`[item ${a}]`)+" "):t+="card ",t+=e.message,e.params.hasOwnProperty("additionalProperty")&&(t+=` '${e.params.additionalProperty}'`),t.charAt(0).toUpperCase()+t.slice(1)+"."});throw new Error("Invalid configuration provided. "+e.map((e,t)=>`(${t+1}) ${e}`).join(" "))}}(e);const a=["groups","domains","entities","discover_existing","standard_configuration"];t=Object.entries(e).filter(([e])=>a.includes(e)).reduce((e,[t,r])=>Object.assign(e,{[t]:r}),{}),r=Object.entries(e).filter(([e])=>Object.keys(this._config).includes(e)).reduce((e,[t,r])=>Object.assign(e,{[t]:r}),{}),Object.assign(this._config,r),this.Config.setUserConfig(t)}showEditor(){let e=this.Config.FindEntity(this.selection.entity),t=this.Config.FindAction(this.selection.entity,this.selection.action);return e&&t?N` + `}selectAction(e){this._entry=Object.assign(Object.assign({},this._entry),{action:e})}showEditor(){let e=this.Config.FindEntity(this._entry.entity),t=this.Config.FindAction(this._entry.entity,this._entry.action);return e&&t?T`
-
${pn("fields.action")}
+
${Pr("fields.action")}
- ${e.icon?N``:""} + ${e.icon?T``:""}
- ${In(e.name)} + ${Ir(e.name)}
@@ -842,53 +843,56 @@ const J=e=>t=>"function"==typeof t?((e,t)=>(window.customElements.define(e,t),t)
- ${t.icon?N``:""} + ${t.icon?T``:""}
- ${In(t.name)} + ${Ir(t.name)}
- ${t.hasOwnProperty("variable")?this.getLevelPanel(t.variable):""} -
-
${pn("fields.days")}
-
- ${pn("fields.day_type_daily")} - ${pn("fields.day_type_weekdays")} - ${pn("fields.day_type_custom")} -
-
- ${pn("days_short.mon")} - ${pn("days_short.tue")} - ${pn("days_short.wed")} - ${pn("days_short.thu")} - ${pn("days_short.fri")} - ${pn("days_short.sat")} - ${pn("days_short.sun")} -
-
+ ${t.variable&&t.variable.type==se.Level?this.getLevelPanel(t.variable):""} + ${t.variable&&t.variable.type==se.List?this.getListPanel(t.variable):""} + ${this.getDayPicker()}
-
${pn("fields.time")}
- +
${Pr("fields.time")}
+
- ${pn("actions.cancel")} - ${void 0===this.selection.editItem?"":N`${pn("actions.delete")}`} - ${pn("actions.save")} + ${Pr("actions.cancel")} + ${this.newItem||!this._config.is_admin?"":T`${Pr("actions.delete")}`} + ${Pr("actions.save")}
- `:N``}showRoutineEditor(){let e=this.Config.FindEntity(this.selection.entity),t=this.Config.FindAction(this.selection.entity,this.selection.action),r=this.Config.GetActionsForEntity(this.selection.entity).filter(e=>e.routine),a=isNaN(this.selection.activePlannerSlot)?null:this.selection.plannerSlots[this.selection.activePlannerSlot],i=a?r.find(e=>e.id==a.action):null;if(this.selection.plannerSlots||Object.assign(this.selection,{plannerSlots:xn}),i&&i.variable){let e=this.selection.activePlannerSlot,t=[...this.selection.plannerSlots],r=Object.assign({},t[e]);Object.assign(r,{level:this.selection.level,levelEnabled:this.selection.levelEnabled}),t[e]=r,this.selection.plannerSlots=t}return e&&t?N` + `:T``}getDayPicker(){var e,t,r,a,s,i;let o=(null===(e=this._entry.days)||void 0===e?void 0:e.custom_days)?null===(t=this._entry.days)||void 0===t?void 0:t.custom_days:[],n=(null===(r=this._entry.days)||void 0===r?void 0:r.type)==oe.Custom?T` +
+ ${Pr("days_short.mon")} + ${Pr("days_short.tue")} + ${Pr("days_short.wed")} + ${Pr("days_short.thu")} + ${Pr("days_short.fri")} + ${Pr("days_short.sat")} + ${Pr("days_short.sun")} +
`:"";return T` +
+
${Pr("fields.days")}
+
+ ${Pr("fields.day_type_daily")} + ${Pr("fields.day_type_weekdays")} + ${Pr("fields.day_type_custom")} +
+ ${n} +
`}updateTime(e){let t=e.target,r=Number(t.value),a="sunrise"==e.detail.event?ie.Sunrise:ie.Sunset;Object.assign(this._entry,{time:e.detail.event?{event:a,value:r}:{value:r}})}selectDays(e){var t;let r=Object.assign({},this._entry.days);if("string"==typeof e){let t=oe.Custom;"daily"==e?t=oe.Daily:"weekdays"==e&&(t=oe.Weekdays),Object.assign(r,{type:t}),t!=oe.Custom||r.custom_days||Object.assign(r,{custom_days:ue(this._entry.days)})}else{let a=(null===(t=this._entry.days)||void 0===t?void 0:t.custom_days)?[...this._entry.days.custom_days]:[];a.includes(e)?a.length>1&&(a=a.filter(t=>t!=e)):a.push(e),Object.assign(r,{custom_days:a})}this._entry=Object.assign(Object.assign({},this._entry),{days:r})}showRoutineEditor(){var e,t;let r=this.Config.FindEntity(this._entry.entity),a=this.Config.FindAction(this._entry.entity,this._entry.action);if(!r||!a)return T``;let s=this.Config.GetActionsForEntity(this._entry.entity).filter(e=>e.routine),i=null!==this._slotNum?this._slots[this._slotNum]:null,o=i?s.find(e=>e.id==i.action):null;if(null!==this._slotNum&&o&&o.variable){let r=[...this._slots],a=Object.assign({},r[this._slotNum]);if((null===(e=this._entry.variable)||void 0===e?void 0:e.type)==se.Level){let e=this._entry.variable;Object.assign(a,{variable:{value:e.value,enabled:e.enabled}})}else if((null===(t=this._entry.variable)||void 0===t?void 0:t.type)==se.List){let e=this._entry.variable;Object.assign(a,{variable:{value:e.value}})}r[this._slotNum]=a,this._slots=r}return r&&a?T`
-
${pn("fields.action")}
+
${Pr("fields.action")}
- ${e.icon?N``:""} + ${r.icon?T``:""}
- ${In(e.name)} + ${Ir(r.name)}
@@ -896,60 +900,44 @@ const J=e=>t=>"function"==typeof t?((e,t)=>(window.customElements.define(e,t),t)
- ${t.icon?N``:""} + ${a.icon?T``:""}
- ${In(t.name)} + ${Ir(a.name)}
-
-
${pn("fields.days")}
-
- ${pn("fields.day_type_daily")} - ${pn("fields.day_type_weekdays")} - ${pn("fields.day_type_custom")} -
-
- ${pn("days_short.mon")} - ${pn("days_short.tue")} - ${pn("days_short.wed")} - ${pn("days_short.thu")} - ${pn("days_short.fri")} - ${pn("days_short.sat")} - ${pn("days_short.sun")} -
-
+ ${this.getDayPicker()}
-
${pn("fields.time")}
+
${Pr("fields.time")}
-
${pn("fields.action")}
+
${Pr("fields.action")}
${this.getPlannerActions()}
- ${i&&i.hasOwnProperty("variable")?this.getLevelPanel(i.variable,!0):""} + ${o&&o.variable?this.getLevelPanel(o.variable,!0):""}
- ${pn("actions.cancel")} - ${void 0===this.selection.editItem?"":N`${pn("actions.delete")}`} - ${pn("actions.save")} + ${Pr("actions.cancel")} + ${this.newItem||!this._config.is_admin?"":T`${Pr("actions.delete")}`} + ${Pr("actions.save")}
- `:N``}handlePlannerUpdate(e){e.target;if(e.detail.hasOwnProperty("slot")){let t=Number(e.detail.slot);this.selection.activePlannerSlot=t;let r=this.selection.plannerSlots[t];void 0!==r.level?Object.assign(this.selection,{level:r.level,levelEnabled:r.levelEnabled}):Object.assign(this.selection,{level:null,levelEnabled:null})}else if(e.detail.hasOwnProperty("slots")){let t=e.detail.slots;this.selection.plannerSlots=[...t]}this.requestUpdate()}getPlannerActions(){if(null===this.selection.activePlannerSlot||void 0===this.selection.activePlannerSlot)return N`
select a timeslot first
`;let e=this.Config.GetActionsForEntity(this.selection.entity),t=this.selection.plannerSlots[this.selection.activePlannerSlot];return e.filter(e=>e.id!=Sn.id).map(e=>N` + `:T``}handlePlannerUpdate(e){e.target;if(e.detail.hasOwnProperty("slot")){let t=Number(e.detail.slot);this._slotNum=t;let r=this._slots[t];if(r.variable){let e=r.variable;Object.assign(this._entry,{variable:{level:Number(e.value),levelEnabled:e.enabled}})}else Object.assign(this._entry,{variable:void 0})}else if(e.detail.hasOwnProperty("slots")){let t=e.detail.slots;this._slots=[...t]}this.requestUpdate()}getPlannerActions(){if(null===this._slotNum)return T`
select a timeslot first
`;let e=this.Config.GetActionsForEntity(this._entry.entity),t=this._slots[this._slotNum];return e.filter(e=>e.id!=ye).map(e=>T` - ${e.icon?N``:""} - ${In(e.name)} + ${e.icon?T``:""} + ${Ir(e.name)} - `)}selectPlannerAction(e){let t=this.selection.activePlannerSlot,r=[...this.selection.plannerSlots],a=Object.assign({},r[t]);Object.assign(a,{action:a.action==e.id?null:e.id}),a.action&&e.variable&&Object.assign(this.selection,{level:void 0!==a.level?a.level:e.variable.min,levelEnabled:void 0!==a.levelEnabled?a.levelEnabled:!e.variable.optional}),r[t]=a,this.selection.plannerSlots=r,this.requestUpdate()}getLevelPanel(e,t=!1){return N` + `)}selectPlannerAction(e){let t=[...this._slots],r=Object.assign({},t[this._slotNum]);if(Object.assign(r,{action:r.action==e.id?null:e.id}),r.action&&e.variable&&e.variable.type==se.Level){let t=r.variable,a=e.variable;Object.assign(this._entry,{variable:{level:void 0!==t.value?t.value:a.min,levelEnabled:void 0!==t.enabled?t.enabled:!a.optional}})}t[this._slotNum]=r,this._slots=t,this.requestUpdate()}getLevelPanel(e,t=!1){e.unit.length||"temperature"!=e.field||Object.assign(e,{unit:this._config.temperature_unit});let r=this._entry.variable;return T`
${e.name}
@@ -957,13 +945,21 @@ const J=e=>t=>"function"==typeof t?((e,t)=>(window.customElements.define(e,t),t) min=${e.min} max=${e.max} step=${e.step} - value=${this.selection.level} + value=${r.value} unit=${e.unit} optional=${e.optional} - disabled=${!this.selection.levelEnabled} - show_percentage=${e.show_percentage} + disabled=${!r.enabled} @change="${e=>{this.updateLevel(e,t)}}" >
-
`}updateLevel(e,t){let r=e.target;this.selection.level=Number(r.value),this.selection.levelEnabled="false"==String(r.disabled),t&&this.requestUpdate()}updateDays(e){var t=Array("daily","weekdays","custom");t.includes(e)?this.selection.daysType=e:(this.selection.daysCustom.includes(Number(e))?li(this.selection.daysCustom,Number(e)):this.selection.daysCustom.push(Number(e)),this.selection.daysType="custom"),this.shadowRoot.querySelectorAll(".day-item").forEach(e=>{let r=String(e.getAttribute("index"));t.includes(r)?this.selection.daysType==r?e.classList.add("active"):e.classList.remove("active"):this.selection.daysCustom.includes(Number(r))?e.classList.add("active"):e.classList.remove("active")}),"custom"==this.selection.daysType?this.shadowRoot.querySelector("#day-list-custom").classList.remove("closed"):this.shadowRoot.querySelector("#day-list-custom").classList.add("closed")}updateTime(e){let t=e.target,r=Number(t.value),a=e.detail.event;this.selection.time=a?{event:a,value:r}:{value:r}}editItemSave(){let e,t;if(void 0!==this.selection.plannerSlots){let e=this.selection.plannerSlots;e=e.filter(e=>e.action),t=e.map(e=>Object.assign(Object.assign({},e),{time:{value:e.startTime},days:bn(this.selection),action:e.action,entity:this.selection.entity}))}else t=[Object.assign(Object.assign({},this.selection),{days:bn(this.selection)})];e=function(e,t){let r=[],a=[];return e.forEach(e=>{var i;let s=t.FindAction(e.entity,e.action),n={entity:e.entity,service:Cn(s.service)?s.service:`${Cn(e.entity)}.${s.service}`};if(s.hasOwnProperty("service_data")&&Object.assign(n,{service_data:s.service_data}),e.levelEnabled){let t=String(null===(i=s.variable)||void 0===i?void 0:i.field),r=Number(e.level),a=n.hasOwnProperty("service_data")?n.service_data:{};Object.assign(a,{[t]:r}),Object.assign(n,{service_data:a})}let o=a.findIndex(e=>Ka(e,n));o<0&&(o=a.push(n)-1);let l={actions:[o]};e.time.event?Object.assign(l,{event:e.time.event,offset:vn(e.time.value).time}):Object.assign(l,{time:vn(e.time.value).time}),e.days.length&&Object.assign(l,{days:e.days}),r.push(l)}),{actions:a,entries:r}}(t,this.Config),this.selection.newItem?this._hass.callService("scheduler","add",e):this.selection.editItem&&this._hass.callService("scheduler","edit",Object.assign(e,{entity_id:this.selection.editItem})),this.selection=Object.assign({},Il),this.requestUpdate()}editItemDelete(){let e=this.selection.editItem;this._hass.callService("scheduler","remove",{entity_id:e}),this.selection=Object.assign({},Il),this.requestUpdate()}},t([Z()],e.SchedulerCard.prototype,"_hass",void 0),e.SchedulerCard=t([J("scheduler-card")],e.SchedulerCard)}({}); +
`}updateLevel(e,t){let r=e.target;if(!this._entry.variable)return;let a={type:se.Level,value:Number(r.value),enabled:"false"==String(r.disabled)};Object.assign(this._entry,{variable:a}),t&&this.requestUpdate()}getListPanel(e){let t,r=e.options;return t=r.length?r.map(e=>{var t;return T` + + ${e.icon?T``:""} + ${Ir(e.value)} + + `}):T`
${Pr("instructions.no_entries_defined")}
`,T` +
+
${e.name}
+ ${t} +
`}selectListItem(e){let t={type:se.List,value:String(e)};this._entry=Object.assign(Object.assign({},this._entry),{variable:t})}_addItemClick(){this.newItem=!0,this.newItemConfirmed=!1,this._entry=Object.assign({},ve);let e=this.Config.GetGroups();1==e.length&&(this.selectGroup(e[0].id),this._entry.action&&this._confirmItemClick())}_cancelEditClick(){this.newItem=!1,this.editItem=!1}_confirmItemClick(){this.newItemConfirmed=!0;let e=this.Config.FindAction(this._entry.entity,this._entry.action);if(e&&e.variable){let t;if((null==e?void 0:e.variable.type)==se.Level){let r=e.variable;t={type:se.Level,value:null,enabled:!r.optional}}else if((null==e?void 0:e.variable.type)==se.List){let r=e.variable;t={type:se.List,value:r.options[0].value}}this._entry=Object.assign(this._entry,{variable:t})}}_saveItemClick(){let e,t;if(this._entry.action==ye){t=this._slots.filter(e=>e.action).map(e=>Object.assign(Object.assign({},e),{time:{value:e.startTime},days:this._entry.days,action:e.action,entity:this._entry.entity}))}else t=[this._entry];e=function(e,t){let r=[],a=[];return e.forEach(e=>{let s=t.FindAction(e.entity,e.action),i={entity:e.entity,service:Fr(s.service)?s.service:`${Fr(e.entity)}.${s.service}`,service_data:{}};var o,n;s.hasOwnProperty("service_data")&&Object.assign(i,{service_data:s.service_data}),"variable"in e&&"variable"in s&&Object.assign(i,{service_data:(o=e.variable,n=s.variable,o.type==se.Level?o.enabled?{[n.field]:String(o.value)}:{}:o.type==se.List?{[n.field]:String(o.value)}:{})});let l=a.findIndex(e=>qr(e,i));l<0&&(l=a.push(i)-1);let c={actions:[l]};e.time.event?Object.assign(c,{event:pe(e.time.event),offset:le(e.time.value).time}):Object.assign(c,{time:le(e.time.value).time}),e.days.type!=oe.Daily&&Object.assign(c,{days:ue(e.days)}),r.push(c)}),{actions:a,entries:r}}(t,this.Config),this.newItem?this._hass.callService("scheduler","add",e):this.editItem&&this._hass.callService("scheduler","edit",Object.assign(e,{entity_id:this.editItem})),this.newItem=!1,this.editItem=!1}_deleteItemClick(){let e=this.editItem;this._hass.callService("scheduler","remove",{entity_id:e}),this.newItem=!1,this.editItem=!1}_editItemClick(e){let t=this.scheduleItems.find(t=>t.id==e);t&&(1==t.entries.length?this._entry=Object.assign({},t.entries[0]):(this._entry=Object.assign({},t.entries[0]),this._slots=function(e){let t=e.map(e=>{let t={startTime:e.time.value,endTime:e.time.value,action:e.action};return e.hasOwnProperty("level")&&Object.assign(t,{variable:e.variable}),t});t.find(e=>0==e.startTime)||t.push({startTime:0,endTime:0}),t.sort((e,t)=>e.startTime>t.startTime?1:-1);let r,a=1440;for(r=t.length-1;r>=0;r--)t[r].endTime=a,a=t[r].startTime;return t}(t.entries),this._slotNum=null),this.editItem=e)}},t([Z({type:Array})],e.SchedulerCard.prototype,"scheduleItems",void 0),t([Z({type:Object})],e.SchedulerCard.prototype,"_hass",void 0),t([Z({type:Boolean})],e.SchedulerCard.prototype,"newItem",void 0),t([Z({type:Boolean})],e.SchedulerCard.prototype,"editItem",void 0),t([Z({type:Boolean})],e.SchedulerCard.prototype,"newItemConfirmed",void 0),t([Z({type:Object})],e.SchedulerCard.prototype,"_entry",void 0),t([Z({type:Array})],e.SchedulerCard.prototype,"_slots",void 0),t([Z({type:Number})],e.SchedulerCard.prototype,"_slotNum",void 0),t([Z({type:String})],e.SchedulerCard.prototype,"_selectedGroup",void 0),e.SchedulerCard=t([J("scheduler-card")],e.SchedulerCard)}({}); diff --git a/src/config-validation.ts b/src/config-validation.ts index b59fe9f7..ba1abfad 100755 --- a/src/config-validation.ts +++ b/src/config-validation.ts @@ -15,7 +15,7 @@ const ConfigSchema = { domains: { type: "object", additionalProperties: { - type: ["object", "null"], + type: ["object", "null", "boolean"], properties: { icon: { type: "string" }, actions: { @@ -29,21 +29,45 @@ const ConfigSchema = { service_data: { type: "object" }, variable: { type: "object", - properties: { - field: { type: "string" }, - name: { type: "string" }, - unit: { type: "string" }, - min: { type: "number", minimum: 0 }, - max: { type: "number", minimum: 1 }, - step: { type: "number", minimum: 0.1 }, - optional: { type: "boolean" }, - show_percentage: { type: "boolean" } - }, - required: ['field'], - additionalProperties: false + oneOf: [ + { + properties: { + field: { type: "string" }, + name: { type: "string" }, + unit: { type: "string" }, + min: { type: "number", minimum: 0 }, + max: { type: "number", minimum: 1 }, + step: { type: "number", minimum: 0.1 }, + optional: { type: "boolean" }, + }, + required: ['field'], + additionalProperties: false + }, + { + properties: { + field: { type: "string" }, + name: { type: "string" }, + options: { + type: "array", + items: { + type: "object", + properties: { + value: { type: "string" }, + name: { type: "string" }, + icon: { type: "string" }, + }, + required: ["value"], + additionalProperties: false + }, + }, + }, + required: ["field"], + additionalProperties: false + } + ], } }, - required: ['service'], + required: ["service"], additionalProperties: false }, }, @@ -62,7 +86,7 @@ const ConfigSchema = { entities: { type: "object", additionalProperties: { - type: ["object", "null"], + type: ["object", "null", "boolean"], properties: { name: { type: "string" }, icon: { type: "string" }, @@ -77,18 +101,42 @@ const ConfigSchema = { service_data: { type: "object" }, variable: { type: "object", - properties: { - field: { type: "string" }, - name: { type: "string" }, - unit: { type: "string" }, - min: { type: "number", minimum: 0 }, - max: { type: "number", minimum: 1 }, - step: { type: "number", minimum: 0.1 }, - optional: { type: "boolean" }, - show_percentage: { type: "boolean" } - }, - required: ['field'], - additionalProperties: false + oneOf: [ + { + properties: { + field: { type: "string" }, + name: { type: "string" }, + unit: { type: "string" }, + min: { type: "number", minimum: 0 }, + max: { type: "number", minimum: 1 }, + step: { type: "number", minimum: 0.1 }, + optional: { type: "boolean" }, + }, + required: ['field'], + additionalProperties: false + }, + { + properties: { + field: { type: "string" }, + name: { type: "string" }, + options: { + type: "array", + items: { + type: "object", + properties: { + value: { type: "string" }, + name: { type: "string" }, + icon: { type: "string" }, + }, + required: ["value"], + additionalProperties: false + }, + }, + }, + required: ["field"], + additionalProperties: false + } + ], } }, required: ["service"], @@ -133,8 +181,7 @@ export function ValidateConfig(config: any) { let path = e.dataPath.substr(1).split('/'); let item = path.pop(); - - if (path.length) output += `in '${path.join('->')}' `; + if (path.length) output += `in ${path.join('/')} `; if (e.keyword == 'type') output += 'type of '; if (!item) output += 'card '; else if (item) output += `${isNaN(+item) ? `'${item}'` : `[item ${item}]`} `; @@ -144,6 +191,6 @@ export function ValidateConfig(config: any) { return `${output.charAt(0).toUpperCase() + output.slice(1)}.`; }); - throw new Error(`Invalid configuration provided. ${errors.map((e, i) => { return `(${i + 1}) ${e}` }).join(` `)}`); + throw new Error(`Invalid configuration provided. ${errors.join(` //////////////////////////////////// `)}`); } } \ No newline at end of file diff --git a/src/const.ts b/src/const.ts index 77bc5aa7..117749e6 100755 --- a/src/const.ts +++ b/src/const.ts @@ -2,7 +2,7 @@ import { IDictionary, IDomainConfig, IActionElement, IUserConfig, ILevelVariableConfig, IListVariableConfig, ITimeSlot, IEntry, EVariableType } from './types' import { parseTimestamp, HoursPerDay, MinutesPerHour, EDayType } from './date-time' -export const CARD_VERSION = "1.4.2" +export const CARD_VERSION = "1.5.0" export const DefaultUserConfig: IUserConfig = { sunrise: null, diff --git a/src/scheduler-card.ts b/src/scheduler-card.ts index 174a1827..f49c5179 100755 --- a/src/scheduler-card.ts +++ b/src/scheduler-card.ts @@ -108,6 +108,7 @@ export class SchedulerCard extends LitElement { } setConfig(config) { + ValidateConfig(config); const userCfgKeys = ['groups', 'domains', 'entities', 'discover_existing', 'standard_configuration']; this._config = Object.assign({ ...this._config }, pick(config, Object.keys(this._config))); this.Config.setUserConfig(pick(config, userCfgKeys));