From 6d4d901dba6446773d90c2ce78e4d5fbe16b9891 Mon Sep 17 00:00:00 2001 From: Gunnar Skjold Date: Thu, 16 Nov 2023 17:59:33 +0100 Subject: [PATCH 01/16] Migrating to new license --- LICENSE | 643 +++------------------------------------- README.md | 11 +- src/AmsToMqttBridge.cpp | 18 +- 3 files changed, 47 insertions(+), 625 deletions(-) diff --git a/LICENSE b/LICENSE index e10ded37..f907c7b6 100644 --- a/LICENSE +++ b/LICENSE @@ -1,617 +1,44 @@ - GNU AFFERO GENERAL PUBLIC LICENSE - Version 3, 19 November 2007 +Fair Source License, version 0.9 - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. +Copyright (C) 2023 Utilitech AS - Preamble +Licensor: Utilitech AS - The GNU Affero General Public License is a free, copyleft license for -software and other kinds of works, specifically designed to ensure -cooperation with the community in the case of network server software. +Software: AMS reader - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -our General Public Licenses are intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. +Use Limitation: 5 users - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. +License Grant. Licensor hereby grants to each recipient of the +Software ("you") a non-exclusive, non-transferable, royalty-free and +fully-paid-up license, under all of the Licensor’s copyright and +patent rights, to use, copy, distribute, prepare derivative works of, +publicly perform and display the Software, subject to the Use +Limitation and the conditions set forth below. - Developers that use our General Public Licenses protect your rights -with two steps: (1) assert copyright on the software, and (2) offer -you this License which gives you legal permission to copy, distribute -and/or modify the software. +Use Limitation. The license granted above allows use by up to the +number of users per entity set forth above (the "Use Limitation"). For +determining the number of users, "you" includes all affiliates, +meaning legal entities controlling, controlled by, or under common +control with you. If you exceed the Use Limitation, your use is +subject to payment of Licensor’s then-current list price for licenses. - A secondary benefit of defending all users' freedom is that -improvements made in alternate versions of the program, if they -receive widespread use, become available for other developers to -incorporate. Many developers of free software are heartened and -encouraged by the resulting cooperation. However, in the case of -software used on network servers, this result may fail to come about. -The GNU General Public License permits making a modified version and -letting the public access it on a server without ever releasing its -source code to the public. - - The GNU Affero General Public License is designed specifically to -ensure that, in such cases, the modified source code becomes available -to the community. It requires the operator of a network server to -provide the source code of the modified version running there to the -users of that server. Therefore, public use of a modified version, on -a publicly accessible server, gives the public access to the source -code of the modified version. - - An older license, called the Affero General Public License and -published by Affero, was designed to accomplish similar goals. This is -a different license, not a version of the Affero GPL, but Affero has -released a new version of the Affero GPL which permits relicensing under +Conditions. Redistribution in source code or other forms must include +a copy of this license document to be provided in a reasonable +manner. Any redistribution of the Software is only allowed subject to this license. - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU Affero General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Remote Network Interaction; Use with the GNU General Public License. - - Notwithstanding any other provision of this License, if you modify the -Program, your modified version must prominently offer all users -interacting with it remotely through a computer network (if your version -supports such interaction) an opportunity to receive the Corresponding -Source of your version by providing access to the Corresponding Source -from a network server at no charge, through some standard or customary -means of facilitating copying of software. This Corresponding Source -shall include the Corresponding Source for any work covered by version 3 -of the GNU General Public License that is incorporated pursuant to the -following paragraph. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the work with which it is combined will remain governed by version -3 of the GNU General Public License. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU Affero General Public License from time to time. Such new versions -will be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU Affero General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU Affero General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU Affero General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. \ No newline at end of file +Trademarks. This license does not grant you any right in the +trademarks, service marks, brand names or logos of Licensor. + +DISCLAIMER. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OR +CONDITION, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. LICENSORS HEREBY DISCLAIM ALL LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE. + +Termination. If you violate the terms of this license, your rights +will terminate automatically and will not be reinstated without the +prior written consent of Licensor. Any such termination will not +affect the right of others who may have received copies of the +Software from you. diff --git a/README.md b/README.md index 61ab2af8..edb30159 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # AMS Reader This code is designed to decode data from electric smart meters installed in many countries in Europe these days. The data is presented in a graphical web interface and can also send the data to a MQTT broker which makes it suitable for home automation project. Originally it was only designed to work with Norwegian meters, but has since been adapter to read any IEC-62056-7-5 or IEC-62056-21 compliant meters. -Later development have added Energy usage graph for both day and month, as well as future energy price. The code can run on any ESP8266 or ESP32 hardware which you can read more about in the [WiKi](https://github.com/UtilitechAS/amsreader-firmware/wiki). If you don't have the knowledge to set up a ESP device yourself, have a look at the shop at [amsleser.no](https://amsleser.no/). +Later development have added Energy usage graph for both day and month, as well as future energy price. The code can run on any ESP8266 or ESP32 hardware which you can read more about in the [WiKi](https://github.com/UtilitechAS/amsreader-firmware/wiki). If you don't have the knowledge to set up a ESP device yourself, or you would like to support our work, please have a look at our shop at [amsleser.no](https://amsleser.no/). @@ -18,3 +18,12 @@ It is recommended to use Visual Studio Code with the PlatformIO plugin for devel [PlatformIO vscode plugin](https://platformio.org/install/ide?install=vscode) For development purposes, copy the ```platformio-user.ini-example``` to ```platformio-user.ini``` and customize to your preference. The code will adapt to the platform and board set in your profile. + +## Licensing +Initially, this project began as a hobby, consuming countless hours of our spare time. However, the time required to support this project has expanded beyond the scope of a hobby. As a result, we established ‘Utilitech’, a company dedicated to maintaining the software and hardware for this project as part of our regular work. + +To ensure the sustainability of our venture, we have opted to license our software under the [Fair Source License] (https://fair.io). This approach allows the software to remain free for personal use, while also ensuring full transparency of our code’s inner workings. It also prevents competitors from exploiting our work without contributing to the maintenance of the code or providing technical support to end users. + +For more information, please refer to our [LICENSE](/LICENSE) file. + +If your usage falls outside the scope of this license and you require a separate license, please contact us at [post@utilitech.no](mailto:post@utilitech.no) for further details. diff --git a/src/AmsToMqttBridge.cpp b/src/AmsToMqttBridge.cpp index 4ede33b8..5a075260 100644 --- a/src/AmsToMqttBridge.cpp +++ b/src/AmsToMqttBridge.cpp @@ -1,20 +1,6 @@ /** - * Copyright (C) 2022 Gunnar Skjold - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * - * @author Gunnar Skjold (@gskjold) gunnar.skjold@gmail.com + * @copyright Utilitech AS 2023 + * License: Fair Source 5 * * @brief Program for ESP32 and ESP8266 to receive data from AMS electric meters and send to MQTT * From 7239f295e8171beedbe2927829b589c16d692ff2 Mon Sep 17 00:00:00 2001 From: Gunnar Skjold Date: Sun, 3 Dec 2023 20:59:31 +0100 Subject: [PATCH 02/16] Fixed volt and amp for some browsers --- lib/SvelteUi/app/src/lib/AmpPlot.svelte | 1 + lib/SvelteUi/app/src/lib/VoltPlot.svelte | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/SvelteUi/app/src/lib/AmpPlot.svelte b/lib/SvelteUi/app/src/lib/AmpPlot.svelte index 0dc40547..db00d355 100644 --- a/lib/SvelteUi/app/src/lib/AmpPlot.svelte +++ b/lib/SvelteUi/app/src/lib/AmpPlot.svelte @@ -37,6 +37,7 @@ points.push(point(i3)); } config = { + title: 'Amperage', padding: { top: 20, right: 15, bottom: 20, left: 35 }, y: { min: 0, diff --git a/lib/SvelteUi/app/src/lib/VoltPlot.svelte b/lib/SvelteUi/app/src/lib/VoltPlot.svelte index 9a8deb98..92de9d9f 100644 --- a/lib/SvelteUi/app/src/lib/VoltPlot.svelte +++ b/lib/SvelteUi/app/src/lib/VoltPlot.svelte @@ -34,6 +34,7 @@ points.push(point(u3)); } config = { + title: 'Voltage', padding: { top: 20, right: 15, bottom: 20, left: 35 }, y: { min: 200, From 09d255d656ecdd911f53399a3c1476d846e407ce Mon Sep 17 00:00:00 2001 From: Gunnar Skjold Date: Sun, 3 Dec 2023 21:14:26 +0100 Subject: [PATCH 03/16] Fix --- lib/SvelteUi/app/dist/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/SvelteUi/app/dist/index.js b/lib/SvelteUi/app/dist/index.js index abfc40b6..91bfb713 100644 --- a/lib/SvelteUi/app/dist/index.js +++ b/lib/SvelteUi/app/dist/index.js @@ -1,7 +1,7 @@ (function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const u of o.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&n(u)}).observe(document,{childList:!0,subtree:!0});function l(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerpolicy&&(o.referrerPolicy=i.referrerpolicy),i.crossorigin==="use-credentials"?o.credentials="include":i.crossorigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(i){if(i.ep)return;i.ep=!0;const o=l(i);fetch(i.href,o)}})();function fe(){}function xt(t,e){for(const l in e)t[l]=e[l];return t}function tc(t){return t()}function La(){return Object.create(null)}function ze(t){t.forEach(tc)}function co(t){return typeof t=="function"}function Ne(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let _s;function Js(t,e){return _s||(_s=document.createElement("a")),_s.href=e,t===_s.href}function xc(t){return Object.keys(t).length===0}function mo(t,...e){if(t==null)return fe;const l=t.subscribe(...e);return l.unsubscribe?()=>l.unsubscribe():l}function ai(t){let e;return mo(t,l=>e=l)(),e}function ul(t,e,l){t.$$.on_destroy.push(mo(e,l))}function po(t,e,l,n){if(t){const i=lc(t,e,l,n);return t[0](i)}}function lc(t,e,l,n){return t[1]&&n?xt(l.ctx.slice(),t[1](n(e))):l.ctx}function _o(t,e,l,n){if(t[2]&&n){const i=t[2](n(l));if(e.dirty===void 0)return i;if(typeof i=="object"){const o=[],u=Math.max(e.dirty.length,i.length);for(let a=0;a32){const e=[],l=t.ctx.length/32;for(let n=0;nt.removeEventListener(e,l,n)}function Ms(t){return function(e){return e.preventDefault(),t.call(this,e)}}function r(t,e,l){l==null?t.removeAttribute(e):t.getAttribute(e)!==l&&t.setAttribute(e,l)}const t0=["width","height"];function ui(t,e){const l=Object.getOwnPropertyDescriptors(t.__proto__);for(const n in e)e[n]==null?t.removeAttribute(n):n==="style"?t.style.cssText=e[n]:n==="__value"?t.value=t[n]=e[n]:l[n]&&l[n].set&&t0.indexOf(n)===-1?t[n]=e[n]:r(t,n,e[n])}function he(t){return t===""?null:+t}function l0(t){return Array.from(t.childNodes)}function X(t,e){e=""+e,t.data!==e&&(t.data=e)}function n0(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function i0(t,e,l){~e0.indexOf(l)?n0(t,e):X(t,e)}function te(t,e){t.value=e==null?"":e}function nc(t,e,l,n){l==null?t.style.removeProperty(e):t.style.setProperty(e,l,n?"important":"")}function qe(t,e,l){for(let n=0;n{u.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{o=ee(n.contentWindow,"resize",e),e()}),s(t,n),()=>{(i||o&&n.contentWindow)&&o(),C(n)}}function r0(t,e,{bubbles:l=!1,cancelable:n=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(t,l,n,e),i}function Oa(t,e){return new t(e)}let Si;function $i(t){Si=t}function Ti(){if(!Si)throw new Error("Function called outside component initialization");return Si}function ic(t){Ti().$$.on_mount.push(t)}function a0(t){Ti().$$.on_destroy.push(t)}function u0(){const t=Ti();return(e,l,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const o=r0(e,l,{cancelable:n});return i.slice().forEach(u=>{u.call(t,o)}),!o.defaultPrevented}return!0}}function Mi(t,e){return Ti().$$.context.set(t,e),e}function Bl(t){return Ti().$$.context.get(t)}const ii=[],ws=[];let si=[];const Fa=[],sc=Promise.resolve();let xs=!1;function oc(){xs||(xs=!0,sc.then(rc))}function f0(){return oc(),sc}function tt(t){si.push(t)}const Vs=new Set;let li=0;function rc(){if(li!==0)return;const t=Si;do{try{for(;lit.indexOf(n)===-1?e.push(n):l.push(n)),l.forEach(n=>n()),si=e}const bs=new Set;let rn;function De(){rn={r:0,c:[],p:rn}}function Ie(){rn.r||ze(rn.c),rn=rn.p}function D(t,e){t&&t.i&&(bs.delete(t),t.i(e))}function q(t,e,l,n){if(t&&t.o){if(bs.has(t))return;bs.add(t),rn.c.push(()=>{bs.delete(t),n&&(l&&t.d(1),n())}),t.o(e)}else n&&n()}function ac(t,e){const l={},n={},i={$$scope:1};let o=t.length;for(;o--;){const u=t[o],a=e[o];if(a){for(const c in u)c in a||(n[c]=1);for(const c in a)i[c]||(l[c]=a[c],i[c]=1);t[o]=a}else for(const c in u)i[c]=1}for(const u in n)u in l||(l[u]=void 0);return l}function qa(t){return typeof t=="object"&&t!==null?t:{}}function ie(t){t&&t.c()}function le(t,e,l,n){const{fragment:i,after_update:o}=t.$$;i&&i.m(e,l),n||tt(()=>{const u=t.$$.on_mount.map(tc).filter(co);t.$$.on_destroy?t.$$.on_destroy.push(...u):ze(u),t.$$.on_mount=[]}),o.forEach(tt)}function ne(t,e){const l=t.$$;l.fragment!==null&&(m0(l.after_update),ze(l.on_destroy),l.fragment&&l.fragment.d(e),l.on_destroy=l.fragment=null,l.ctx=[])}function p0(t,e){t.$$.dirty[0]===-1&&(ii.push(t),oc(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const d=v.length?v[0]:b;return f.ctx&&i(f.ctx[p],f.ctx[p]=d)&&(!f.skip_bound&&f.bound[p]&&f.bound[p](d),_&&p0(t,p)),b}):[],f.update(),_=!0,ze(f.before_update),f.fragment=n?n(f.ctx):!1,e.target){if(e.hydrate){const p=l0(e.target);f.fragment&&f.fragment.l(p),p.forEach(C)}else f.fragment&&f.fragment.c();e.intro&&D(t.$$.fragment),le(t,e.target,e.anchor,e.customElement),rc()}$i(c)}class Ee{$destroy(){ne(this,1),this.$destroy=fe}$on(e,l){if(!co(l))return fe;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(l),()=>{const i=n.indexOf(l);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!xc(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Ba=t=>typeof t>"u",uc=t=>typeof t=="function",fc=t=>typeof t=="number";function _0(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function cc(){let t=0;return()=>t++}function d0(){return Math.random().toString(36).substring(2)}const Ul=typeof window>"u";function mc(t,e,l){return t.addEventListener(e,l),()=>t.removeEventListener(e,l)}const pc=(t,e)=>t?{}:{style:e},eo=t=>({"aria-hidden":"true",...pc(t,"display:none;")}),ni=[];function _c(t,e){return{subscribe:at(t,e).subscribe}}function at(t,e=fe){let l;const n=new Set;function i(a){if(Ne(t,a)&&(t=a,l)){const c=!ni.length;for(const f of n)f[1](),ni.push(f,t);if(c){for(let f=0;f{n.delete(f),n.size===0&&l&&(l(),l=null)}}return{set:i,update:o,subscribe:u}}function v0(t,e,l){const n=!Array.isArray(t),i=n?[t]:t,o=e.length<2;return _c(l,u=>{let a=!1;const c=[];let f=0,_=fe;const p=()=>{if(f)return;_();const v=e(n?c[0]:c,u);o?u(v):_=co(v)?v:fe},b=i.map((v,d)=>mo(v,M=>{c[d]=M,f&=~(1<{f|=1<`@@svnav-ctx__${t}`,to=Ni("LOCATION"),fi=Ni("ROUTER"),dc=Ni("ROUTE"),h0=Ni("ROUTE_PARAMS"),b0=Ni("FOCUS_ELEM"),vc=/^:(.+)/,wi=(t,e,l)=>t.substr(e,l),lo=(t,e)=>wi(t,0,e.length)===e,g0=t=>t==="",k0=t=>vc.test(t),hc=t=>t[0]==="*",w0=t=>t.replace(/\*.*$/,""),bc=t=>t.replace(/(^\/+|\/+$)/g,"");function ml(t,e=!1){const l=bc(t).split("/");return e?l.filter(Boolean):l}const Ks=(t,e)=>t+(e?`?${e}`:""),bo=t=>`/${bc(t)}`;function Ai(...t){const e=n=>ml(n,!0).join("/"),l=t.map(e).join("/");return bo(l)}const go=1,Ss=2,mn=3,y0=4,gc=5,C0=6,kc=7,$0=8,M0=9,wc=10,yc=11,S0={[go]:"Link",[Ss]:"Route",[mn]:"Router",[y0]:"useFocus",[gc]:"useLocation",[C0]:"useMatch",[kc]:"useNavigate",[$0]:"useParams",[M0]:"useResolvable",[wc]:"useResolve",[yc]:"navigate"},ko=t=>S0[t];function T0(t,e){let l;return t===Ss?l=e.path?`path="${e.path}"`:"default":t===go?l=`to="${e.to}"`:t===mn&&(l=`basepath="${e.basepath||""}"`),`<${ko(t)} ${l||""} />`}function N0(t,e,l,n){const i=l&&T0(n||t,l),o=i?` Occurred in: ${i}`:"",u=ko(t),a=uc(e)?e(u):e;return`<${u}> ${a}${o}`}const Cc=t=>(...e)=>t(N0(...e)),$c=Cc(t=>{throw new Error(t)}),ys=Cc(console.warn),Ua=4,A0=3,P0=2,E0=1,D0=1;function I0(t,e){const l=t.default?0:ml(t.fullPath).reduce((n,i)=>{let o=n;return o+=Ua,g0(i)?o+=D0:k0(i)?o+=P0:hc(i)?o-=Ua+E0:o+=A0,o},0);return{route:t,score:l,index:e}}function R0(t){return t.map(I0).sort((e,l)=>e.scorel.score?-1:e.index-l.index)}function Mc(t,e){let l,n;const[i]=e.split("?"),o=ml(i),u=o[0]==="",a=R0(t);for(let c=0,f=a.length;c({..._,params:b,uri:T});if(_.default){n=v(e);continue}const d=ml(_.fullPath),M=Math.max(o.length,d.length);let y=0;for(;y{f===".."?c.pop():f!=="."&&c.push(f)}),Ks(`/${c.join("/")}`,n)}function ja(t,e){const{pathname:l,hash:n="",search:i="",state:o}=t,u=ml(e,!0),a=ml(l,!0);for(;u.length;)u[0]!==a[0]&&$c(mn,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),u.shift(),a.shift();return{pathname:Ai(...a),hash:n,search:i,state:o}}const Ha=t=>t.length===1?"":t,wo=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,o=i?Ha(wi(t,l)):"",u=i?wi(t,0,l):t,a=n?Ha(wi(u,e)):"";return{pathname:(n?wi(u,0,e):u)||"/",search:a,hash:o}},O0=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function F0(t,e,l){return Ai(l,L0(t,e))}function q0(t,e){const l=bo(w0(t)),n=ml(l,!0),i=ml(e,!0).slice(0,n.length),o=Sc({fullPath:l},Ai(...i));return o&&o.uri}const Ys="POP",B0="PUSH",U0="REPLACE";function Qs(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function j0(t){let e=[],l=Qs(t),n=Ys;const i=(o=e)=>o.forEach(u=>u({location:l,action:n}));return{get location(){return l},listen(o){e.push(o);const u=()=>{l=Qs(t),n=Ys,i([o])};i([o]);const a=mc(t,"popstate",u);return()=>{a(),e=e.filter(c=>c!==o)}},navigate(o,u){const{state:a={},replace:c=!1}=u||{};if(n=c?U0:B0,fc(o))u&&ys(yc,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=Ys,t.history.go(o);else{const f={...a,_key:d0()};try{t.history[c?"replaceState":"pushState"](f,"",o)}catch{t.location[c?"replace":"assign"](o)}}l=Qs(t),i()}}}function Xs(t,e){return{...wo(e),state:t}}function H0(t="/"){let e=0,l=[Xs(null,t)];return{get entries(){return l},get location(){return l[e]},addEventListener(){},removeEventListener(){},history:{get state(){return l[e].state},pushState(n,i,o){e++,l=l.slice(0,e),l.push(Xs(n,o))},replaceState(n,i,o){l[e]=Xs(n,o)},go(n){const i=e+n;i<0||i>l.length-1||(e=i)}}}}const W0=!!(!Ul&&window.document&&window.document.createElement),z0=!Ul&&window.location.origin==="null",Tc=j0(W0&&!z0?window:H0()),{navigate:oi}=Tc;let Sl=null,Nc=!0;function G0(t,e){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;nSl.level||t.level===Sl.level&&G0(t.routerId,Sl.routerId))&&(Sl=t)}function K0(){Sl=null}function Y0(){Nc=!1}function Wa(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=mc(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function Q0(t,e){return Number(t.dataset.svnavRouteEnd)===e}function X0(t){return/^H[1-6]$/i.test(t.tagName)}function za(t,e=document){return e.querySelector(t)}function Z0(t){let l=za(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!Q0(l,t);){if(X0(l))return l;const n=za("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function J0(t){Promise.resolve(ai(t.focusElement)).then(e=>{const l=e||Z0(t.id);l||ys(mn,`Could not find an element to focus. You should always render a header for accessibility reasons, or set a custom focus element via the "useFocus" hook. If you don't want this Route or Router to manage focus, pass "primary={false}" to it.`,t,Ss),!Wa(l)&&Wa(document.documentElement)})}const x0=(t,e,l)=>(n,i)=>f0().then(()=>{if(!Sl||Nc){Y0();return}if(n&&J0(Sl.route),t.announcements&&i){const{path:o,fullPath:u,meta:a,params:c,uri:f}=Sl.route,_=t.createAnnouncement({path:o,fullPath:u,meta:a,params:c,uri:f},ai(l));Promise.resolve(_).then(p=>{e.set(p)})}K0()}),e1="position:fixed;top:-1px;left:0;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;";function t1(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},pc(t[6],e1)],i={};for(let o=0;o`Navigated to ${ue.uri}`,announcements:!0,...d},T=_,N=bo(_),E=Bl(to),B=Bl(fi),P=!E,L=n1(),O=v&&!(B&&!B.manageFocus),F=at("");ul(t,F,ue=>l(0,a=ue));const x=B?B.disableInlineStyles:M,j=at([]);ul(t,j,ue=>l(20,u=ue));const z=at(null);ul(t,z,ue=>l(18,i=ue));let G=!1;const V=P?0:B.level+1,U=P?at((()=>ja(Ul?wo(p):b.location,N))()):E;ul(t,U,ue=>l(17,n=ue));const K=at(n);ul(t,K,ue=>l(19,o=ue));const H=x0(y,F,U),Y=ue=>ke=>ke.filter(me=>me.id!==ue);function Z(ue){if(Ul){if(G)return;const ke=Sc(ue,n.pathname);if(ke)return G=!0,ke}else j.update(ke=>{const me=Y(ue.id)(ke);return me.push(ue),me})}function re(ue){j.update(Y(ue))}return!P&&_!==Ga&&ys(mn,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:_}),P&&(ic(()=>b.listen(ke=>{const me=ja(ke.location,N);K.set(n),U.set(me)})),Mi(to,U)),Mi(fi,{activeRoute:z,registerRoute:Z,unregisterRoute:re,manageFocus:O,level:V,id:L,history:P?b:B.history,basepath:P?N:B.basepath,disableInlineStyles:x}),t.$$set=ue=>{"basepath"in ue&&l(11,_=ue.basepath),"url"in ue&&l(12,p=ue.url),"history"in ue&&l(13,b=ue.history),"primary"in ue&&l(14,v=ue.primary),"a11y"in ue&&l(15,d=ue.a11y),"disableInlineStyles"in ue&&l(16,M=ue.disableInlineStyles),"$$scope"in ue&&l(21,f=ue.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&_!==T&&ys(mn,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const ue=Mc(u,n.pathname);z.set(ue)}if(t.$$.dirty[0]&655360&&P){const ue=!!n.hash,ke=!ue&&O,me=!ue||n.pathname!==o.pathname;H(ke,me)}t.$$.dirty[0]&262144&&O&&i&&i.primary&&V0({level:V,routerId:L,route:i})},[a,y,P,L,O,F,x,j,z,U,K,_,p,b,v,d,M,n,i,o,u,f,c]}class s1 extends Ee{constructor(e){super(),Pe(this,e,i1,l1,Ne,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}const Ac=s1;function Pi(t,e,l=fi,n=mn){Bl(l)||$c(t,o=>`You cannot use ${o} outside of a ${ko(n)}.`,e)}const o1=t=>{const{subscribe:e}=Bl(t);return{subscribe:e}};function Pc(){return Pi(gc),o1(to)}function Ec(){const{history:t}=Bl(fi);return t}function Dc(){const t=Bl(dc);return t?v0(t,e=>e.base):at("/")}function Ic(){Pi(wc);const t=Dc(),{basepath:e}=Bl(fi);return n=>F0(n,ai(t),e)}function r1(){Pi(kc);const t=Ic(),{navigate:e}=Ec();return(n,i)=>{const o=fc(n)?n:t(n);return e(o,i)}}const a1=t=>({params:t&16,location:t&8}),Va=t=>({params:Ul?ai(t[10]):t[4],location:t[3],navigate:t[11]});function Ka(t){let e,l;return e=new Ac({props:{primary:t[1],$$slots:{default:[c1]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.primary=n[1]),i&528409&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function u1(t){let e;const l=t[18].default,n=po(l,t,t[19],Va);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&524312)&&vo(n,l,i,i[19],e?_o(l,i[19],o,a1):ho(i[19]),Va)},i(i){e||(D(n,i),e=!0)},o(i){q(n,i),e=!1},d(i){n&&n.d(i)}}}function f1(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},Ul?ai(t[10]):t[4],t[12]];var o=t[0];function u(a){let c={};for(let f=0;f{ne(_,1)}),Ie()}o?(e=Oa(o,u()),ie(e.$$.fragment),D(e.$$.fragment,1),le(e,l.parentNode,l)):e=null}else o&&e.$set(f)},i(a){n||(e&&D(e.$$.fragment,a),n=!0)},o(a){e&&q(e.$$.fragment,a),n=!1},d(a){a&&C(l),e&&ne(e,a)}}}function c1(t){let e,l,n,i;const o=[f1,u1],u=[];function a(c,f){return c[0]!==null?0:1}return e=a(t),l=u[e]=o[e](t),{c(){l.c(),n=Ve()},m(c,f){u[e].m(c,f),$(c,n,f),i=!0},p(c,f){let _=e;e=a(c),e===_?u[e].p(c,f):(De(),q(u[_],1,1,()=>{u[_]=null}),Ie(),l=u[e],l?l.p(c,f):(l=u[e]=o[e](c),l.c()),D(l,1),l.m(n.parentNode,n))},i(c){i||(D(l),i=!0)},o(c){q(l),i=!1},d(c){u[e].d(c),c&&C(n)}}}function m1(t){let e,l,n,i,o,u=[eo(t[7]),{"data-svnav-route-start":t[5]}],a={};for(let p=0;p{c=null}),Ie())},i(p){o||(D(c),o=!0)},o(p){q(c),o=!1},d(p){p&&C(e),p&&C(l),c&&c.d(p),p&&C(n),p&&C(i)}}}const p1=cc();function _1(t,e,l){let n;const i=["path","component","meta","primary"];let o=ks(e,i),u,a,c,f,{$$slots:_={},$$scope:p}=e,{path:b=""}=e,{component:v=null}=e,{meta:d={}}=e,{primary:M=!0}=e;Pi(Ss,e);const y=p1(),{registerRoute:T,unregisterRoute:N,activeRoute:E,disableInlineStyles:B}=Bl(fi);ul(t,E,G=>l(16,u=G));const P=Dc();ul(t,P,G=>l(17,c=G));const L=Pc();ul(t,L,G=>l(3,a=G));const O=at(null);let F;const x=at(),j=at({});ul(t,j,G=>l(4,f=G)),Mi(dc,x),Mi(h0,j),Mi(b0,O);const z=r1();return Ul||a0(()=>N(y)),t.$$set=G=>{l(24,e=xt(xt({},e),gs(G))),l(12,o=ks(e,i)),"path"in G&&l(13,b=G.path),"component"in G&&l(0,v=G.component),"meta"in G&&l(14,d=G.meta),"primary"in G&&l(1,M=G.primary),"$$scope"in G&&l(19,p=G.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const G=b==="",V=Ai(c,b),W={id:y,path:b,meta:d,default:G,fullPath:G?"":V,base:G?c:q0(V,a.pathname),primary:M,focusElement:O};x.set(W),l(15,F=T(W))}if(t.$$.dirty&98304&&l(2,n=!!(F||u&&u.id===y)),t.$$.dirty&98308&&n){const{params:G}=F||u;j.set(G)}},e=gs(e),[v,M,n,a,f,y,E,B,P,L,j,z,o,b,d,F,u,c,_,p]}class d1 extends Ee{constructor(e){super(),Pe(this,e,_1,m1,Ne,{path:13,component:0,meta:14,primary:1})}}const Ml=d1;function v1(t){let e,l,n,i;const o=t[13].default,u=po(o,t,t[12],null);let a=[{href:t[0]},t[2],t[1]],c={};for(let f=0;fl(11,p=O));const E=u0(),B=Ic(),{navigate:P}=Ec();function L(O){E("click",O),_0(O)&&(O.preventDefault(),P(n,{state:y,replace:u||M}))}return t.$$set=O=>{l(19,e=xt(xt({},e),gs(O))),l(18,_=ks(e,f)),"to"in O&&l(5,d=O.to),"replace"in O&&l(6,M=O.replace),"state"in O&&l(7,y=O.state),"getProps"in O&&l(8,T=O.getProps),"$$scope"in O&&l(12,v=O.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=B(d,p)),t.$$.dirty&2049&&l(10,i=lo(p.pathname,n)),t.$$.dirty&2049&&l(9,o=n===p.pathname),t.$$.dirty&2049&&(u=wo(n)===O0(p)),t.$$.dirty&512&&l(2,a=o?{"aria-current":"page"}:{}),l(1,c=(()=>{if(uc(T)){const O=T({location:p,href:n,isPartiallyCurrent:i,isCurrent:o});return{..._,...O}}return _})())},e=gs(e),[n,c,a,N,L,d,M,y,T,o,i,p,v,b]}class b1 extends Ee{constructor(e){super(),Pe(this,e,h1,v1,Ne,{to:5,replace:6,state:7,getProps:8})}}const el=b1;let no=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function ql(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function g1(t){return t>218&&t<242?"#32d900":t>212&&t<248?"#b1d900":t>208&&t<252?"#ffb800":"#d90000"}function Rc(t){return t>90?"#d90000":t>85?"#e32100":t>80?"#ffb800":t>75?"#dcd800":"#32d900"}function k1(t){return t>75?"#32d900":t>50?"#77d900":t>25?"#94d900":"#dcd800"}function Cs(t){switch(t){case 1:return"Aidon";case 2:return"Kaifa";case 3:return"Kamstrup";case 8:return"Iskra";case 9:return"Landis+Gyr";case 10:return"Sagemcom";default:return"Unknown"}}function Oe(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function be(t,e){switch(e){case 5:switch(t){case"esp8266":return"Pow-K (GPIO12)";case"esp32s2":return"Pow-K+"}case 7:switch(t){case"esp8266":return"Pow-U (GPIO12)";case"esp32s2":return"Pow-U+"}case 6:return"Pow-P1";case 51:return"Wemos S2 mini";case 50:return"Generic ESP32-S2";case 201:return"Wemos LOLIN D32";case 202:return"Adafruit HUZZAH32";case 203:return"DevKitC";case 200:return"Generic ESP32";case 2:return"HAN Reader 2.0 by Max Spencer";case 0:return"Custom hardware by Roar Fredriksen";case 1:return"Kamstrup module by Egil Opsahl";case 8:return"\xB5HAN mosquito by dbeinder";case 3:return"Pow-K (UART0)";case 4:return"Pow-U (UART0)";case 101:return"Wemos D1 mini";case 100:return"Generic ESP8266";case 70:return"Generic ESP32-C3";case 71:return"ESP32-C3-DevKitM-1"}}function Ya(t){switch(t){case-1:return"Parse error";case-2:return"Incomplete data received";case-3:return"Payload boundry flag missing";case-4:return"Header checksum error";case-5:return"Footer checksum error";case-9:return"Unknown data received, check meter config";case-41:return"Frame length not equal";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid";case 90:return"No HAN data received for at least 30s";case 91:return"Serial break";case 92:return"Serial buffer full";case 93:return"Serial FIFO overflow";case 94:return"Serial frame error";case 95:return"Serial parity error";case 96:return"RX error";case 98:return"Exception in code, debugging necessary";case 99:return"Autodetection failed"}return t<0?"Unspecified error "+t:""}function Qa(t){switch(t){case-3:return"Connection failed";case-4:return"Network timeout";case-10:return"Connection denied";case-11:return"Failed to subscribe";case-13:return"Connection lost"}return t<0?"Unspecified error "+t:""}function Xa(t){switch(t){case 400:return"Unrecognized data in request";case 401:case 403:return"Unauthorized, check API key";case 404:return"Price unavailable, not found";case 425:return"Server says its too early";case 429:return"Exceeded API rate limit";case 500:return"Internal server error";case-1:return"Connection error";case-2:return"Incomplete data received";case-3:return"Invalid data, tag missing";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid"}return t<0?"Unspecified error "+t:""}function ri(t){switch(t){case 2:case 4:case 7:return!0}return!1}function Ke(t,e){return t==1||t==2&&e}function Ut(t){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+t}function ge(t,e){return isNaN(t)?"-":(isNaN(e)&&(e=t<10?1:0),t.toFixed(e))}function fl(t,e){return t.setTime(t.getTime()+e*36e5),t}function Za(t){if(t.chip=="esp8266")switch(t.boot_reason){case 0:return"Normal";case 1:return"WDT reset";case 2:return"Exception reset";case 3:return"Soft WDT reset";case 4:return"Software restart";case 5:return"Deep sleep";case 6:return"External reset";default:return"Unknown (8266)"}else switch(t.boot_reason){case 1:return"Vbat power on reset";case 3:return"Software reset";case 4:return"WDT reset";case 5:return"Deep sleep";case 6:return"SLC reset";case 7:return"Timer Group0 WDT reset";case 8:return"Timer Group1 WDT reset";case 9:return"RTC WDT reset";case 10:return"Instrusion test reset CPU";case 11:return"Time Group reset CPU";case 12:return"Software reset CPU";case 13:return"RTC WTD reset CPU";case 14:return"PRO CPU";case 15:return"Brownout";case 16:return"RTC reset";default:return"Unknown"}}function Ja(t){return t=="EOE"?"ENTSO-E":t=="HKS"?"hvakosterstrommen.no":t=="EDS"?"Energy Data Service":t=="MIX"?"Mixed sources":"Unknown ("+t+")"}async function jl(t,e={}){const{timeout:l=8e3}=e,n=new AbortController,i=setTimeout(()=>n.abort(),l),o=await fetch(t,{...e,signal:n.signal});return clearTimeout(i),o}let al={version:"",chip:"",mac:null,apmac:null,vndcfg:null,usrcfg:null,fwconsent:null,booting:!1,upgrading:!1,ui:{},security:0,boot_reason:0,upgrade:{x:-1,e:0,f:null,t:null},trying:null};const jt=at(al);async function yo(){al=await(await jl("/sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),jt.set(al)}let vs=0,xa=-127,eu=null,w1={};const y1=_c(w1,t=>{let e;async function l(){jl("/data.json").then(n=>n.json()).then(n=>{t(n),xa!=n.t&&(xa=n.t,setTimeout(Bc,2e3)),eu==null&&n.pe&&n.p!=null&&(eu=n.p,Oc()),al.upgrading?window.location.reload():(!al||!al.chip||al.booting||vs>1&&!ri(al.board))&&(yo(),an&&clearTimeout(an),an=setTimeout($o,2e3),un&&clearTimeout(un),un=setTimeout(Mo,3e3));let i=5e3;if(ri(al.board)&&n.v>2.5){let o=3.3-Math.min(3.3,n.v);o>0&&(i=Math.max(o,.1)*10*5e3)}i>5e3&&console.log("Scheduling next data fetch in "+i+"ms"),e&&clearTimeout(e),e=setTimeout(l,i),vs=0}).catch(n=>{vs++,vs>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(l,15e3)):e=setTimeout(l,ri(al.board)?1e4:5e3)})}return l(),function(){clearTimeout(e)}});let io={},yi;const Co=at(io);async function Lc(){let t=!1;if(Co.update(e=>{for(var l=0;l<36;l++){if(e[Oe(l)]==null){t=l<12;break}e[Oe(l)]=e[Oe(l+1)]}return e}),t)Oc();else{let e=new Date;yi=setTimeout(Lc,(60-e.getMinutes())*6e4)}}async function Oc(){yi&&(clearTimeout(yi),yi=0),io=await(await jl("/energyprice.json")).json(),Co.set(io);let e=new Date;yi=setTimeout(Lc,(60-e.getMinutes())*6e4)}let so={},an;async function $o(){an&&(clearTimeout(an),an=0),so=await(await jl("/dayplot.json")).json(),Fc.set(so);let e=new Date;an=setTimeout($o,(60-e.getMinutes())*6e4+20)}const Fc=at(so,t=>($o(),function(){}));let oo={},un;async function Mo(){un&&(clearTimeout(un),un=0),oo=await(await jl("/monthplot.json")).json(),qc.set(oo);let e=new Date;un=setTimeout(Mo,(24-e.getHours())*36e5+40)}const qc=at(oo,t=>(Mo(),function(){}));let ro={};async function Bc(){ro=await(await jl("/temperature.json")).json(),Uc.set(ro)}const Uc=at(ro,t=>(Bc(),function(){}));let ao={},hs;async function jc(){hs&&(clearTimeout(hs),hs=0),ao=await(await jl("/tariff.json")).json(),Hc.set(ao);let e=new Date;hs=setTimeout(jc,(60-e.getMinutes())*6e4+30)}const Hc=at(ao,t=>function(){});let uo=[];const So=at(uo);async function C1(){uo=await(await jl("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),So.set(uo)}function $s(t){return"WARNING: "+t+" must be connected to an external power supply during firmware upgrade. Failure to do so may cause power-down during upload resulting in non-functioning unit."}async function Wc(t){await(await fetch("/upgrade?expected_version="+t,{method:"POST"})).json()}function zc(t,e){if(/^v\d{1,2}\.\d{1,2}\.\d{1,2}$/.test(t)){let l=t.substring(1).split("."),n=parseInt(l[0]),i=parseInt(l[1]),o=parseInt(l[2]),u=[...e];u.reverse();let a,c,f;for(let _=0;_o&&(a=p):M==i+1&&(c=p);else if(d==n+1)if(f){let T=f.tag_name.substring(1).split(".");parseInt(T[0]);let N=parseInt(T[1]);parseInt(T[2]),M==N&&(f=p)}else f=p}return c||f||a||!1}else return e[0]}const $1="/github.svg";function tu(t){let e,l;function n(u,a){return u[1]>1?E1:u[1]>0?P1:u[2]>1?A1:u[2]>0?N1:u[3]>1?T1:u[3]>0?S1:M1}let i=n(t),o=i(t);return{c(){e=S(`Up - `),o.c(),l=Ve()},m(u,a){$(u,e,a),o.m(u,a),$(u,l,a)},p(u,a){i===(i=n(u))&&o?o.p(u,a):(o.d(1),o=i(u),o&&(o.c(),o.m(l.parentNode,l)))},d(u){u&&C(e),o.d(u),u&&C(l)}}}function M1(t){let e,l;return{c(){e=S(t[0]),l=S(" seconds")},m(n,i){$(n,e,i),$(n,l,i)},p(n,i){i&1&&X(e,n[0])},d(n){n&&C(e),n&&C(l)}}}function S1(t){let e,l;return{c(){e=S(t[3]),l=S(" minute")},m(n,i){$(n,e,i),$(n,l,i)},p(n,i){i&8&&X(e,n[3])},d(n){n&&C(e),n&&C(l)}}}function T1(t){let e,l;return{c(){e=S(t[3]),l=S(" minutes")},m(n,i){$(n,e,i),$(n,l,i)},p(n,i){i&8&&X(e,n[3])},d(n){n&&C(e),n&&C(l)}}}function N1(t){let e,l;return{c(){e=S(t[2]),l=S(" hour")},m(n,i){$(n,e,i),$(n,l,i)},p(n,i){i&4&&X(e,n[2])},d(n){n&&C(e),n&&C(l)}}}function A1(t){let e,l;return{c(){e=S(t[2]),l=S(" hours")},m(n,i){$(n,e,i),$(n,l,i)},p(n,i){i&4&&X(e,n[2])},d(n){n&&C(e),n&&C(l)}}}function P1(t){let e,l;return{c(){e=S(t[1]),l=S(" day")},m(n,i){$(n,e,i),$(n,l,i)},p(n,i){i&2&&X(e,n[1])},d(n){n&&C(e),n&&C(l)}}}function E1(t){let e,l;return{c(){e=S(t[1]),l=S(" days")},m(n,i){$(n,e,i),$(n,l,i)},p(n,i){i&2&&X(e,n[1])},d(n){n&&C(e),n&&C(l)}}}function D1(t){let e,l=t[0]&&tu(t);return{c(){l&&l.c(),e=Ve()},m(n,i){l&&l.m(n,i),$(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=tu(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:fe,o:fe,d(n){l&&l.d(n),n&&C(e)}}}function I1(t,e,l){let{epoch:n}=e,i=0,o=0,u=0;return t.$$set=a=>{"epoch"in a&&l(0,n=a.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(l(1,i=Math.floor(n/86400)),l(2,o=Math.floor(n/3600)),l(3,u=Math.floor(n/60)))},[n,i,o,u]}class R1 extends Ee{constructor(e){super(),Pe(this,e,I1,D1,Ne,{epoch:0})}}function L1(t){let e,l,n;return{c(){e=m("span"),l=S(t[2]),r(e,"title",t[1]),r(e,"class",n="bd-"+t[0])},m(i,o){$(i,e,o),s(e,l)},p(i,[o]){o&4&&X(l,i[2]),o&2&&r(e,"title",i[1]),o&1&&n!==(n="bd-"+i[0])&&r(e,"class",n)},i:fe,o:fe,d(i){i&&C(e)}}}function O1(t,e,l){let{color:n}=e,{title:i}=e,{text:o}=e;return t.$$set=u=>{"color"in u&&l(0,n=u.color),"title"in u&&l(1,i=u.title),"text"in u&&l(2,o=u.text)},[n,i,o]}class fn extends Ee{constructor(e){super(),Pe(this,e,O1,L1,Ne,{color:0,title:1,text:2})}}function F1(t){let e,l=`${Oe(t[0].getDate())}.${Oe(t[0].getMonth()+1)}.${t[0].getFullYear()} ${Oe(t[0].getHours())}:${Oe(t[0].getMinutes())}`,n;return{c(){e=m("span"),n=S(l),r(e,"class",t[1])},m(i,o){$(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=`${Oe(i[0].getDate())}.${Oe(i[0].getMonth()+1)}.${i[0].getFullYear()} ${Oe(i[0].getHours())}:${Oe(i[0].getMinutes())}`)&&X(n,l),o&2&&r(e,"class",i[1])},d(i){i&&C(e)}}}function q1(t){let e=`${Oe(t[0].getDate())}. ${no[t[0].getMonth()]} ${Oe(t[0].getHours())}:${Oe(t[0].getMinutes())}`,l;return{c(){l=S(e)},m(n,i){$(n,l,i)},p(n,i){i&1&&e!==(e=`${Oe(n[0].getDate())}. ${no[n[0].getMonth()]} ${Oe(n[0].getHours())}:${Oe(n[0].getMinutes())}`)&&X(l,e)},d(n){n&&C(l)}}}function B1(t){let e;function l(o,u){return o[2]?q1:F1}let n=l(t),i=n(t);return{c(){i.c(),e=Ve()},m(o,u){i.m(o,u),$(o,e,u)},p(o,[u]){n===(n=l(o))&&i?i.p(o,u):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},i:fe,o:fe,d(o){i.d(o),o&&C(e)}}}function U1(t,e,l){let{timestamp:n}=e,{fullTimeColor:i}=e,{offset:o}=e,u;return t.$$set=a=>{"timestamp"in a&&l(0,n=a.timestamp),"fullTimeColor"in a&&l(1,i=a.fullTimeColor),"offset"in a&&l(3,o=a.offset)},t.$$.update=()=>{t.$$.dirty&9&&(l(2,u=Math.abs(new Date().getTime()-n.getTime())<3e5),isNaN(o)||fl(n,o-(24+n.getHours()-n.getUTCHours())%24))},[n,i,u,o]}class Gc extends Ee{constructor(e){super(),Pe(this,e,U1,B1,Ne,{timestamp:0,fullTimeColor:1,offset:3})}}function j1(t){let e,l,n;return{c(){e=Fe("svg"),l=Fe("path"),n=Fe("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 011.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 01-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.397.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 01-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.505-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.107-1.204l-.527-.738a1.125 1.125 0 01.12-1.45l.773-.773a1.125 1.125 0 011.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894z"),r(n,"stroke-linecap","round"),r(n,"stroke-linejoin","round"),r(n,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(i,o){$(i,e,o),s(e,l),s(e,n)},p:fe,i:fe,o:fe,d(i){i&&C(e)}}}class H1 extends Ee{constructor(e){super(),Pe(this,e,null,j1,Ne,{})}}function W1(t){let e,l;return{c(){e=Fe("svg"),l=Fe("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(n,i){$(n,e,i),s(e,l)},p:fe,i:fe,o:fe,d(n){n&&C(e)}}}class z1 extends Ee{constructor(e){super(),Pe(this,e,null,W1,Ne,{})}}function G1(t){let e,l;return{c(){e=Fe("svg"),l=Fe("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(n,i){$(n,e,i),s(e,l)},p:fe,i:fe,o:fe,d(n){n&&C(e)}}}class Bt extends Ee{constructor(e){super(),Pe(this,e,null,G1,Ne,{})}}function V1(t){let e,l;return{c(){e=Fe("svg"),l=Fe("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M9 8.25H7.5a2.25 2.25 0 00-2.25 2.25v9a2.25 2.25 0 002.25 2.25h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25H15M9 12l3 3m0 0l3-3m-3 3V2.25"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(n,i){$(n,e,i),s(e,l)},p:fe,i:fe,o:fe,d(n){n&&C(e)}}}class Vc extends Ee{constructor(e){super(),Pe(this,e,null,V1,Ne,{})}}function K1(t){let e,l,n=t[1].version+"",i;return{c(){e=S("AMS reader "),l=m("span"),i=S(n)},m(o,u){$(o,e,u),$(o,l,u),s(l,i)},p(o,u){u&2&&n!==(n=o[1].version+"")&&X(i,n)},d(o){o&&C(e),o&&C(l)}}}function lu(t){let e,l=(t[0].t>-50?t[0].t.toFixed(1):"-")+"",n,i;return{c(){e=m("div"),n=S(l),i=S("\xB0C"),r(e,"class","flex-none my-auto")},m(o,u){$(o,e,u),s(e,n),s(e,i)},p(o,u){u&1&&l!==(l=(o[0].t>-50?o[0].t.toFixed(1):"-")+"")&&X(n,l)},d(o){o&&C(e)}}}function nu(t){let e,l="HAN: "+Ya(t[0].he),n;return{c(){e=m("div"),n=S(l),r(e,"class","bd-red")},m(i,o){$(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="HAN: "+Ya(i[0].he))&&X(n,l)},d(i){i&&C(e)}}}function iu(t){let e,l="MQTT: "+Qa(t[0].me),n;return{c(){e=m("div"),n=S(l),r(e,"class","bd-red")},m(i,o){$(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="MQTT: "+Qa(i[0].me))&&X(n,l)},d(i){i&&C(e)}}}function su(t){let e,l="PriceAPI: "+Xa(t[0].ee),n;return{c(){e=m("div"),n=S(l),r(e,"class","bd-red")},m(i,o){$(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="PriceAPI: "+Xa(i[0].ee))&&X(n,l)},d(i){i&&C(e)}}}function ou(t){let e,l,n,i,o,u;return l=new el({props:{to:"/configuration",$$slots:{default:[Y1]},$$scope:{ctx:t}}}),o=new el({props:{to:"/status",$$slots:{default:[Q1]},$$scope:{ctx:t}}}),{c(){e=m("div"),ie(l.$$.fragment),n=h(),i=m("div"),ie(o.$$.fragment),r(e,"class","flex-none px-1 mt-1"),r(e,"title","Configuration"),r(i,"class","flex-none px-1 mt-1"),r(i,"title","Device information")},m(a,c){$(a,e,c),le(l,e,null),$(a,n,c),$(a,i,c),le(o,i,null),u=!0},i(a){u||(D(l.$$.fragment,a),D(o.$$.fragment,a),u=!0)},o(a){q(l.$$.fragment,a),q(o.$$.fragment,a),u=!1},d(a){a&&C(e),ne(l),a&&C(n),a&&C(i),ne(o)}}}function Y1(t){let e,l;return e=new H1({}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function Q1(t){let e,l;return e=new z1({}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function ru(t){let e,l,n,i,o;const u=[Z1,X1],a=[];function c(f,_){return f[1].security==0||f[0].a?0:1}return l=c(t),n=a[l]=u[l](t),{c(){e=m("div"),n.c(),r(e,"class","flex-none mr-3 text-yellow-500"),r(e,"title",i="New version: "+t[2].tag_name)},m(f,_){$(f,e,_),a[l].m(e,null),o=!0},p(f,_){let p=l;l=c(f),l===p?a[l].p(f,_):(De(),q(a[p],1,1,()=>{a[p]=null}),Ie(),n=a[l],n?n.p(f,_):(n=a[l]=u[l](f),n.c()),D(n,1),n.m(e,null)),(!o||_&4&&i!==(i="New version: "+f[2].tag_name))&&r(e,"title",i)},i(f){o||(D(n),o=!0)},o(f){q(n),o=!1},d(f){f&&C(e),a[l].d()}}}function X1(t){let e,l,n=t[2].tag_name+"",i;return{c(){e=m("span"),l=S("New version: "),i=S(n)},m(o,u){$(o,e,u),s(e,l),s(e,i)},p(o,u){u&4&&n!==(n=o[2].tag_name+"")&&X(i,n)},i:fe,o:fe,d(o){o&&C(e)}}}function Z1(t){let e,l,n,i=t[2].tag_name+"",o,u,a,c,f,_;return a=new Vc({}),{c(){e=m("button"),l=m("span"),n=S("New version: "),o=S(i),u=h(),ie(a.$$.fragment),r(l,"class","mt-1"),r(e,"class","flex")},m(p,b){$(p,e,b),s(e,l),s(l,n),s(l,o),s(e,u),le(a,e,null),c=!0,f||(_=ee(e,"click",t[3]),f=!0)},p(p,b){(!c||b&4)&&i!==(i=p[2].tag_name+"")&&X(o,i)},i(p){c||(D(a.$$.fragment,p),c=!0)},o(p){q(a.$$.fragment,p),c=!1},d(p){p&&C(e),ne(a),f=!1,_()}}}function J1(t){let e,l,n,i,o,u,a,c,f,_,p,b,v=(t[0].m?(t[0].m/1e3).toFixed(1):"-")+"",d,M,y,T,N,E,B,P,L,O,F,x,j,z,G,V,W,U,K,H,Y,Z,re,ue,ke,me,Se,je,Re,He;i=new el({props:{to:"/",$$slots:{default:[K1]},$$scope:{ctx:t}}}),c=new R1({props:{epoch:t[0].u}});let we=t[0].t>-50&&lu(t);N=new fn({props:{title:"ESP",text:t[1].booting?"Booting":t[0].v>2?t[0].v.toFixed(2)+"V":"ESP",color:ql(t[1].booting?2:t[0].em)}}),B=new fn({props:{title:"HAN",text:"HAN",color:ql(t[1].booting?9:t[0].hm)}}),L=new fn({props:{title:"WiFi",text:t[0].r?t[0].r.toFixed(0)+"dBm":"WiFi",color:ql(t[1].booting?9:t[0].wm)}}),F=new fn({props:{title:"MQTT",text:"MQTT",color:ql(t[1].booting?9:t[0].mm)}});let Te=(t[0].he<0||t[0].he>0)&&nu(t),Le=t[0].me<0&&iu(t),$e=(t[0].ee>0||t[0].ee<0)&&su(t);re=new Gc({props:{timestamp:t[0].c?new Date(t[0].c*1e3):new Date(0),offset:t[1].clock_offset,fullTimeColor:"text-red-500"}});let w=t[1].vndcfg&&t[1].usrcfg&&ou(t);je=new Bt({});let g=t[1].fwconsent===1&&t[2]&&ru(t);return{c(){e=m("nav"),l=m("div"),n=m("div"),ie(i.$$.fragment),o=h(),u=m("div"),a=m("div"),ie(c.$$.fragment),f=h(),we&&we.c(),_=h(),p=m("div"),b=S("Free mem: "),d=S(v),M=S("kb"),y=h(),T=m("div"),ie(N.$$.fragment),E=h(),ie(B.$$.fragment),P=h(),ie(L.$$.fragment),O=h(),ie(F.$$.fragment),x=h(),Te&&Te.c(),j=h(),Le&&Le.c(),z=h(),$e&&$e.c(),G=h(),V=m("div"),W=m("div"),U=m("a"),K=m("img"),Y=h(),Z=m("div"),ie(re.$$.fragment),ue=h(),w&&w.c(),ke=h(),me=m("div"),Se=m("a"),ie(je.$$.fragment),Re=h(),g&&g.c(),r(n,"class","flex text-lg text-gray-100 p-2"),r(a,"class","flex-none my-auto"),r(p,"class","flex-none my-auto"),r(u,"class","flex-none my-auto p-2 flex space-x-4"),r(T,"class","flex-auto flex-wrap my-auto justify-center p-2"),r(K,"class","gh-logo"),Js(K.src,H=$1)||r(K,"src",H),r(K,"alt","GitHub repo"),r(U,"class","float-right"),r(U,"href","https://github.com/UtilitechAS/amsreader-firmware"),r(U,"target","_blank"),r(U,"rel","noreferrer"),r(U,"aria-label","GitHub"),r(W,"class","flex-none"),r(Z,"class","flex-none my-auto px-2"),r(Se,"href",Ut("")),r(Se,"target","_blank"),r(Se,"rel","noreferrer"),r(me,"class","flex-none px-1 mt-1"),r(me,"title","Documentation"),r(V,"class","flex-auto p-2 flex flex-row-reverse flex-wrap"),r(l,"class","flex flex-wrap space-x-4 text-sm text-gray-300"),r(e,"class","bg-violet-600 p-1 rounded-md mx-2")},m(k,A){$(k,e,A),s(e,l),s(l,n),le(i,n,null),s(l,o),s(l,u),s(u,a),le(c,a,null),s(u,f),we&&we.m(u,null),s(u,_),s(u,p),s(p,b),s(p,d),s(p,M),s(l,y),s(l,T),le(N,T,null),s(T,E),le(B,T,null),s(T,P),le(L,T,null),s(T,O),le(F,T,null),s(l,x),Te&&Te.m(l,null),s(l,j),Le&&Le.m(l,null),s(l,z),$e&&$e.m(l,null),s(l,G),s(l,V),s(V,W),s(W,U),s(U,K),s(V,Y),s(V,Z),le(re,Z,null),s(V,ue),w&&w.m(V,null),s(V,ke),s(V,me),s(me,Se),le(je,Se,null),s(V,Re),g&&g.m(V,null),He=!0},p(k,[A]){const I={};A&18&&(I.$$scope={dirty:A,ctx:k}),i.$set(I);const Q={};A&1&&(Q.epoch=k[0].u),c.$set(Q),k[0].t>-50?we?we.p(k,A):(we=lu(k),we.c(),we.m(u,_)):we&&(we.d(1),we=null),(!He||A&1)&&v!==(v=(k[0].m?(k[0].m/1e3).toFixed(1):"-")+"")&&X(d,v);const J={};A&3&&(J.text=k[1].booting?"Booting":k[0].v>2?k[0].v.toFixed(2)+"V":"ESP"),A&3&&(J.color=ql(k[1].booting?2:k[0].em)),N.$set(J);const se={};A&3&&(se.color=ql(k[1].booting?9:k[0].hm)),B.$set(se);const ce={};A&1&&(ce.text=k[0].r?k[0].r.toFixed(0)+"dBm":"WiFi"),A&3&&(ce.color=ql(k[1].booting?9:k[0].wm)),L.$set(ce);const ve={};A&3&&(ve.color=ql(k[1].booting?9:k[0].mm)),F.$set(ve),k[0].he<0||k[0].he>0?Te?Te.p(k,A):(Te=nu(k),Te.c(),Te.m(l,j)):Te&&(Te.d(1),Te=null),k[0].me<0?Le?Le.p(k,A):(Le=iu(k),Le.c(),Le.m(l,z)):Le&&(Le.d(1),Le=null),k[0].ee>0||k[0].ee<0?$e?$e.p(k,A):($e=su(k),$e.c(),$e.m(l,G)):$e&&($e.d(1),$e=null);const Me={};A&1&&(Me.timestamp=k[0].c?new Date(k[0].c*1e3):new Date(0)),A&2&&(Me.offset=k[1].clock_offset),re.$set(Me),k[1].vndcfg&&k[1].usrcfg?w?A&2&&D(w,1):(w=ou(k),w.c(),D(w,1),w.m(V,ke)):w&&(De(),q(w,1,1,()=>{w=null}),Ie()),k[1].fwconsent===1&&k[2]?g?(g.p(k,A),A&6&&D(g,1)):(g=ru(k),g.c(),D(g,1),g.m(V,null)):g&&(De(),q(g,1,1,()=>{g=null}),Ie())},i(k){He||(D(i.$$.fragment,k),D(c.$$.fragment,k),D(N.$$.fragment,k),D(B.$$.fragment,k),D(L.$$.fragment,k),D(F.$$.fragment,k),D(re.$$.fragment,k),D(w),D(je.$$.fragment,k),D(g),He=!0)},o(k){q(i.$$.fragment,k),q(c.$$.fragment,k),q(N.$$.fragment,k),q(B.$$.fragment,k),q(L.$$.fragment,k),q(F.$$.fragment,k),q(re.$$.fragment,k),q(w),q(je.$$.fragment,k),q(g),He=!1},d(k){k&&C(e),ne(i),ne(c),we&&we.d(),ne(N),ne(B),ne(L),ne(F),Te&&Te.d(),Le&&Le.d(),$e&&$e.d(),ne(re),w&&w.d(),ne(je),g&&g.d()}}}function x1(t,e,l){let{data:n={}}=e,i={},o={};function u(){confirm("Do you want to upgrade this device to "+o.tag_name+"?")&&(!ri(i.board)||confirm($s(be(i.chip,i.board))))&&(jt.update(a=>(a.upgrading=!0,a)),Wc(o.tag_name))}return jt.subscribe(a=>{l(1,i=a),a.fwconsent===1&&C1()}),So.subscribe(a=>{l(2,o=zc(i.version,a))}),t.$$set=a=>{"data"in a&&l(0,n=a.data)},[n,i,o,u]}class em extends Ee{constructor(e){super(),Pe(this,e,x1,J1,Ne,{data:0})}}function tm(t){let e,l,n,i;return{c(){e=Fe("svg"),l=Fe("path"),n=Fe("path"),r(l,"d",Zs(150,150,115,210,510)),r(l,"stroke","#eee"),r(l,"fill","none"),r(l,"stroke-width","55"),r(n,"d",i=Zs(150,150,115,210,210+300*t[0]/100)),r(n,"stroke",t[1]),r(n,"fill","none"),r(n,"stroke-width","55"),r(e,"viewBox","0 0 300 300"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"height","100%")},m(o,u){$(o,e,u),s(e,l),s(e,n)},p(o,[u]){u&1&&i!==(i=Zs(150,150,115,210,210+300*o[0]/100))&&r(n,"d",i),u&2&&r(n,"stroke",o[1])},i:fe,o:fe,d(o){o&&C(e)}}}function au(t,e,l,n){var i=(n-90)*Math.PI/180;return{x:t+l*Math.cos(i),y:e+l*Math.sin(i)}}function Zs(t,e,l,n,i){var o=au(t,e,l,i),u=au(t,e,l,n),a=i-n<=180?"0":"1",c=["M",o.x,o.y,"A",l,l,0,a,0,u.x,u.y].join(" ");return c}function lm(t,e,l){let{pct:n=0}=e,{color:i="red"}=e;return t.$$set=o=>{"pct"in o&&l(0,n=o.pct),"color"in o&&l(1,i=o.color)},[n,i]}class nm extends Ee{constructor(e){super(),Pe(this,e,lm,tm,Ne,{pct:0,color:1})}}function uu(t){let e,l,n,i,o,u,a,c;return{c(){e=m("br"),l=h(),n=m("span"),i=S(t[3]),o=h(),u=m("span"),a=S(t[4]),c=S("/kWh"),r(n,"class","pl-sub"),r(u,"class","pl-snt")},m(f,_){$(f,e,_),$(f,l,_),$(f,n,_),s(n,i),$(f,o,_),$(f,u,_),s(u,a),s(u,c)},p(f,_){_&8&&X(i,f[3]),_&16&&X(a,f[4])},d(f){f&&C(e),f&&C(l),f&&C(n),f&&C(o),f&&C(u)}}}function im(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,M,y;l=new nm({props:{pct:t[6],color:t[5](t[6])}});let T=t[3]&&uu(t);return{c(){e=m("div"),ie(l.$$.fragment),n=h(),i=m("span"),o=m("span"),u=S(t[2]),a=h(),c=m("br"),f=h(),_=m("span"),p=S(t[0]),b=h(),v=m("span"),d=S(t[1]),M=h(),T&&T.c(),r(o,"class","pl-lab"),r(_,"class","pl-val"),r(v,"class","pl-unt"),r(i,"class","pl-ov"),r(e,"class","pl-root")},m(N,E){$(N,e,E),le(l,e,null),s(e,n),s(e,i),s(i,o),s(o,u),s(i,a),s(i,c),s(i,f),s(i,_),s(_,p),s(i,b),s(i,v),s(v,d),s(i,M),T&&T.m(i,null),y=!0},p(N,[E]){const B={};E&64&&(B.pct=N[6]),E&96&&(B.color=N[5](N[6])),l.$set(B),(!y||E&4)&&X(u,N[2]),(!y||E&1)&&X(p,N[0]),(!y||E&2)&&X(d,N[1]),N[3]?T?T.p(N,E):(T=uu(N),T.c(),T.m(i,null)):T&&(T.d(1),T=null)},i(N){y||(D(l.$$.fragment,N),y=!0)},o(N){q(l.$$.fragment,N),y=!1},d(N){N&&C(e),ne(l),T&&T.d()}}}function sm(t,e,l){let{val:n}=e,{max:i}=e,{unit:o}=e,{label:u}=e,{sub:a=""}=e,{subunit:c=""}=e,{colorFn:f}=e,_=0;return t.$$set=p=>{"val"in p&&l(0,n=p.val),"max"in p&&l(7,i=p.max),"unit"in p&&l(1,o=p.unit),"label"in p&&l(2,u=p.label),"sub"in p&&l(3,a=p.sub),"subunit"in p&&l(4,c=p.subunit),"colorFn"in p&&l(5,f=p.colorFn)},t.$$.update=()=>{t.$$.dirty&129&&l(6,_=Math.min(n,i)/i*100)},[n,o,u,a,c,f,_,i]}class Kc extends Ee{constructor(e){super(),Pe(this,e,sm,im,Ne,{val:0,max:7,unit:1,label:2,sub:3,subunit:4,colorFn:5})}}function fu(t,e,l){const n=t.slice();return n[9]=e[l],n[11]=l,n}function cu(t,e,l){const n=t.slice();return n[9]=e[l],n[11]=l,n}function mu(t,e,l){const n=t.slice();return n[13]=e[l],n}function pu(t){let e,l,n,i,o,u,a=t[0].title&&_u(t),c=t[0].y.ticks,f=[];for(let d=0;d20||t[11]%2==0)&&bu(t);return{c(){e=Fe("g"),n&&n.c(),r(e,"class","tick"),r(e,"transform",l="translate("+t[5](t[11])+","+t[4]+")")},m(i,o){$(i,e,o),n&&n.m(e,null)},p(i,o){i[3]>20||i[11]%2==0?n?n.p(i,o):(n=bu(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o&48&&l!==(l="translate("+i[5](i[11])+","+i[4]+")")&&r(e,"transform",l)},d(i){i&&C(e),n&&n.d()}}}function bu(t){let e,l=t[9].label+"",n,i;return{c(){e=Fe("text"),n=S(l),r(e,"x",i=t[3]/2),r(e,"y","-4")},m(o,u){$(o,e,u),s(e,n)},p(o,u){u&1&&l!==(l=o[9].label+"")&&X(n,l),u&8&&i!==(i=o[3]/2)&&r(e,"x",i)},d(o){o&&C(e)}}}function gu(t){let e=!isNaN(t[5](t[11])),l,n=e&&hu(t);return{c(){n&&n.c(),l=Ve()},m(i,o){n&&n.m(i,o),$(i,l,o)},p(i,o){o&32&&(e=!isNaN(i[5](i[11]))),e?n?n.p(i,o):(n=hu(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&C(l)}}}function ku(t){let e,l,n=t[9].value!==void 0&&wu(t),i=t[9].value2>1e-4&&$u(t);return{c(){e=Fe("g"),n&&n.c(),l=Fe("g"),i&&i.c()},m(o,u){$(o,e,u),n&&n.m(e,null),$(o,l,u),i&&i.m(l,null)},p(o,u){o[9].value!==void 0?n?n.p(o,u):(n=wu(o),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o[9].value2>1e-4?i?i.p(o,u):(i=$u(o),i.c(),i.m(l,null)):i&&(i.d(1),i=null)},d(o){o&&C(e),n&&n.d(),o&&C(l),i&&i.d()}}}function wu(t){let e,l,n,i,o,u,a,c=t[3]>15&&yu(t);return{c(){e=Fe("rect"),c&&c.c(),a=Ve(),r(e,"x",l=t[5](t[11])+2),r(e,"y",n=t[6](t[9].value)),r(e,"width",i=t[3]-4),r(e,"height",o=t[6](t[0].y.min)-t[6](Math.min(t[0].y.min,0)+t[9].value)),r(e,"fill",u=t[9].color)},m(f,_){$(f,e,_),c&&c.m(f,_),$(f,a,_)},p(f,_){_&32&&l!==(l=f[5](f[11])+2)&&r(e,"x",l),_&65&&n!==(n=f[6](f[9].value))&&r(e,"y",n),_&8&&i!==(i=f[3]-4)&&r(e,"width",i),_&65&&o!==(o=f[6](f[0].y.min)-f[6](Math.min(f[0].y.min,0)+f[9].value))&&r(e,"height",o),_&1&&u!==(u=f[9].color)&&r(e,"fill",u),f[3]>15?c?c.p(f,_):(c=yu(f),c.c(),c.m(a.parentNode,a)):c&&(c.d(1),c=null)},d(f){f&&C(e),c&&c.d(f),f&&C(a)}}}function yu(t){let e,l=t[9].label+"",n,i,o,u,a,c,f=t[9].title&&Cu(t);return{c(){e=Fe("text"),n=S(l),f&&f.c(),c=Ve(),r(e,"width",i=t[3]-4),r(e,"dominant-baseline","middle"),r(e,"text-anchor",o=t[3]t[6](0)-t[7]?t[9].color:"white"),r(e,"transform",a="translate("+(t[5](t[11])+t[3]/2)+" "+(t[6](t[9].value)>t[6](0)-t[7]?t[6](t[9].value)-t[7]:t[6](t[9].value)+10)+") rotate("+(t[3]_[6](0)-_[7]?_[9].color:"white")&&r(e,"fill",u),p&233&&a!==(a="translate("+(_[5](_[11])+_[3]/2)+" "+(_[6](_[9].value)>_[6](0)-_[7]?_[6](_[9].value)-_[7]:_[6](_[9].value)+10)+") rotate("+(_[3]15&&Mu(t);return{c(){e=Fe("rect"),c&&c.c(),a=Ve(),r(e,"x",l=t[5](t[11])+2),r(e,"y",n=t[6](0)),r(e,"width",i=t[3]-4),r(e,"height",o=t[6](t[0].y.min)-t[6](t[0].y.min+t[9].value2)),r(e,"fill",u=t[9].color2?t[9].color2:t[9].color)},m(f,_){$(f,e,_),c&&c.m(f,_),$(f,a,_)},p(f,_){_&32&&l!==(l=f[5](f[11])+2)&&r(e,"x",l),_&64&&n!==(n=f[6](0))&&r(e,"y",n),_&8&&i!==(i=f[3]-4)&&r(e,"width",i),_&65&&o!==(o=f[6](f[0].y.min)-f[6](f[0].y.min+f[9].value2))&&r(e,"height",o),_&1&&u!==(u=f[9].color2?f[9].color2:f[9].color)&&r(e,"fill",u),f[3]>15?c?c.p(f,_):(c=Mu(f),c.c(),c.m(a.parentNode,a)):c&&(c.d(1),c=null)},d(f){f&&C(e),c&&c.d(f),f&&C(a)}}}function Mu(t){let e,l=t[9].label2+"",n,i,o,u,a,c=t[9].title2&&Su(t);return{c(){e=Fe("text"),n=S(l),c&&c.c(),a=Ve(),r(e,"width",i=t[3]-4),r(e,"dominant-baseline","middle"),r(e,"text-anchor","middle"),r(e,"fill",o=t[6](-t[9].value2)t[8].call(e))},m(i,o){$(i,e,o),n&&n.m(e,null),l=o0(e,t[8].bind(e))},p(i,[o]){i[0].x.ticks&&i[0].points&&i[4]?n?n.p(i,o):(n=pu(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},i:fe,o:fe,d(i){i&&C(e),n&&n.d(),l()}}}let cn=30;function rm(t,e,l){let{config:n}=e,i,o,u,a,c,f,_;function p(){i=this.clientWidth,o=this.clientHeight,l(1,i),l(2,o)}return t.$$set=b=>{"config"in b&&l(0,n=b.config)},t.$$.update=()=>{if(t.$$.dirty&31){l(4,f=o-(n.title?20:0));let b=i-(n.padding.left+n.padding.right);l(3,u=b/n.points.length),l(7,_=un.y.max?M=n.padding.bottom:df||M<0?0:M})}},[n,i,o,u,f,a,c,_,p]}class pn extends Ee{constructor(e){super(),Pe(this,e,rm,om,Ne,{config:0})}}function am(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function um(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{ds:u}=e,a={};function c(f){return{label:ge(f)+"V",title:f.toFixed(1)+" V",value:isNaN(f)?0:f,color:g1(f||0)}}return t.$$set=f=>{"u1"in f&&l(1,n=f.u1),"u2"in f&&l(2,i=f.u2),"u3"in f&&l(3,o=f.u3),"ds"in f&&l(4,u=f.ds)},t.$$.update=()=>{if(t.$$.dirty&30){let f=[],_=[];n>0&&(f.push({label:u===1?"L1-L2":"L1"}),_.push(c(n))),i>0&&(f.push({label:u===1?"L1-L3":"L2"}),_.push(c(i))),o>0&&(f.push({label:u===1?"L2-L3":"L3"}),_.push(c(o))),l(0,a={padding:{top:20,right:15,bottom:20,left:35},y:{min:200,max:260,ticks:[{value:207,label:"-10%"},{value:230,label:"230v"},{value:253,label:"+10%"}]},x:{ticks:f},points:_})}},[a,n,i,o,u]}class fm extends Ee{constructor(e){super(),Pe(this,e,um,am,Ne,{u1:1,u2:2,u3:3,ds:4})}}function cm(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function mm(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{i1:u}=e,{i2:a}=e,{i3:c}=e,{max:f}=e,_={};function p(b){return{label:ge(b)+"A",title:b.toFixed(1)+" A",value:isNaN(b)?0:b,color:Rc(b?b/f*100:0)}}return t.$$set=b=>{"u1"in b&&l(1,n=b.u1),"u2"in b&&l(2,i=b.u2),"u3"in b&&l(3,o=b.u3),"i1"in b&&l(4,u=b.i1),"i2"in b&&l(5,a=b.i2),"i3"in b&&l(6,c=b.i3),"max"in b&&l(7,f=b.max)},t.$$.update=()=>{if(t.$$.dirty&254){let b=[],v=[];n>0&&(b.push({label:"L1"}),v.push(p(u))),i>0&&(b.push({label:"L2"}),v.push(p(a))),o>0&&(b.push({label:"L3"}),v.push(p(c))),l(0,_={padding:{top:20,right:15,bottom:20,left:35},y:{min:0,max:f,ticks:[{value:0,label:"0%"},{value:f/4,label:"25%"},{value:f/2,label:"50%"},{value:f/4*3,label:"75%"},{value:f,label:"100%"}]},x:{ticks:b},points:v})}},[_,n,i,o,u,a,c,f]}class pm extends Ee{constructor(e){super(),Pe(this,e,mm,cm,Ne,{u1:1,u2:2,u3:3,i1:4,i2:5,i3:6,max:7})}}function _m(t){let e,l,n,i,o,u,a,c=(typeof t[0]<"u"?t[0].toFixed(0):"-")+"",f,_,p,b,v,d,M=(typeof t[1]<"u"?t[1].toFixed(0):"-")+"",y,T,N,E,B,P,L,O=(typeof t[2]<"u"?t[2].toFixed(1):"-")+"",F,x,j,z,G,V,W=(typeof t[3]<"u"?t[3].toFixed(1):"-")+"",U,K;return{c(){e=m("div"),l=m("strong"),l.textContent="Reactive",n=h(),i=m("div"),o=m("div"),o.textContent="Instant in",u=h(),a=m("div"),f=S(c),_=S(" VAr"),p=h(),b=m("div"),b.textContent="Instant out",v=h(),d=m("div"),y=S(M),T=S(" VAr"),N=h(),E=m("div"),B=m("div"),B.textContent="Total in",P=h(),L=m("div"),F=S(O),x=S(" kVArh"),j=h(),z=m("div"),z.textContent="Total out",G=h(),V=m("div"),U=S(W),K=S(" kVArh"),r(a,"class","text-right"),r(d,"class","text-right"),r(i,"class","grid grid-cols-2 mt-4"),r(L,"class","text-right"),r(V,"class","text-right"),r(E,"class","grid grid-cols-2 mt-4"),r(e,"class","mx-2 text-sm")},m(H,Y){$(H,e,Y),s(e,l),s(e,n),s(e,i),s(i,o),s(i,u),s(i,a),s(a,f),s(a,_),s(i,p),s(i,b),s(i,v),s(i,d),s(d,y),s(d,T),s(e,N),s(e,E),s(E,B),s(E,P),s(E,L),s(L,F),s(L,x),s(E,j),s(E,z),s(E,G),s(E,V),s(V,U),s(V,K)},p(H,[Y]){Y&1&&c!==(c=(typeof H[0]<"u"?H[0].toFixed(0):"-")+"")&&X(f,c),Y&2&&M!==(M=(typeof H[1]<"u"?H[1].toFixed(0):"-")+"")&&X(y,M),Y&4&&O!==(O=(typeof H[2]<"u"?H[2].toFixed(1):"-")+"")&&X(F,O),Y&8&&W!==(W=(typeof H[3]<"u"?H[3].toFixed(1):"-")+"")&&X(U,W)},i:fe,o:fe,d(H){H&&C(e)}}}function dm(t,e,l){let{importInstant:n}=e,{exportInstant:i}=e,{importTotal:o}=e,{exportTotal:u}=e;return t.$$set=a=>{"importInstant"in a&&l(0,n=a.importInstant),"exportInstant"in a&&l(1,i=a.exportInstant),"importTotal"in a&&l(2,o=a.importTotal),"exportTotal"in a&&l(3,u=a.exportTotal)},[n,i,o,u]}class vm extends Ee{constructor(e){super(),Pe(this,e,dm,_m,Ne,{importInstant:0,exportInstant:1,importTotal:2,exportTotal:3})}}function Nu(t){let e;function l(o,u){return o[3]?bm:hm}let n=l(t),i=n(t);return{c(){i.c(),e=Ve()},m(o,u){i.m(o,u),$(o,e,u)},p(o,u){n===(n=l(o))&&i?i.p(o,u):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){i.d(o),o&&C(e)}}}function hm(t){let e,l,n,i,o,u,a=ge(t[1].h.u,2)+"",c,f,_,p,b,v,d=ge(t[1].d.u,1)+"",M,y,T,N,E,B,P=ge(t[1].m.u)+"",L,O,F,x,j,z,G=ge(t[0].last_month.u)+"",V,W,U,K,H=t[4]&&Au(t);return{c(){e=m("strong"),e.textContent="Consumption",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",o=h(),u=m("div"),c=S(a),f=S(" kWh"),_=h(),p=m("div"),p.textContent="Day",b=h(),v=m("div"),M=S(d),y=S(" kWh"),T=h(),N=m("div"),N.textContent="Month",E=h(),B=m("div"),L=S(P),O=S(" kWh"),F=h(),x=m("div"),x.textContent="Last month",j=h(),z=m("div"),V=S(G),W=S(" kWh"),U=h(),H&&H.c(),K=Ve(),r(u,"class","text-right"),r(v,"class","text-right"),r(B,"class","text-right"),r(z,"class","text-right"),r(n,"class","grid grid-cols-2 mb-3")},m(Y,Z){$(Y,e,Z),$(Y,l,Z),$(Y,n,Z),s(n,i),s(n,o),s(n,u),s(u,c),s(u,f),s(n,_),s(n,p),s(n,b),s(n,v),s(v,M),s(v,y),s(n,T),s(n,N),s(n,E),s(n,B),s(B,L),s(B,O),s(n,F),s(n,x),s(n,j),s(n,z),s(z,V),s(z,W),$(Y,U,Z),H&&H.m(Y,Z),$(Y,K,Z)},p(Y,Z){Z&2&&a!==(a=ge(Y[1].h.u,2)+"")&&X(c,a),Z&2&&d!==(d=ge(Y[1].d.u,1)+"")&&X(M,d),Z&2&&P!==(P=ge(Y[1].m.u)+"")&&X(L,P),Z&1&&G!==(G=ge(Y[0].last_month.u)+"")&&X(V,G),Y[4]?H?H.p(Y,Z):(H=Au(Y),H.c(),H.m(K.parentNode,K)):H&&(H.d(1),H=null)},d(Y){Y&&C(e),Y&&C(l),Y&&C(n),Y&&C(U),H&&H.d(Y),Y&&C(K)}}}function bm(t){let e,l,n,i,o,u,a=ge(t[1].h.u,2)+"",c,f,_,p,b,v,d,M=ge(t[1].d.u,1)+"",y,T,N,E,B,P,L,O=ge(t[1].m.u)+"",F,x,j,z,G,V,W,U=ge(t[0].last_month.u)+"",K,H,Y,Z,re,ue,ke,me,Se,je,Re,He=ge(t[1].h.p,2)+"",we,Te,Le,$e,w,g,k,A=ge(t[1].d.p,1)+"",I,Q,J,se,ce,ve,Me,oe=ge(t[1].m.p)+"",pe,Be,_e,ye,vt,Hl,tl,ct=ge(t[0].last_month.p)+"",Tl,pl,Ht,ht,Qe=t[4]&&Pu(t),Xe=t[4]&&Eu(t),Ze=t[4]&&Du(t),Ue=t[4]&&Iu(t),Je=t[4]&&Ru(t),We=t[4]&&Lu(t),xe=t[4]&&Ou(t),et=t[4]&&Fu(t);return{c(){e=m("strong"),e.textContent="Import",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",o=h(),u=m("div"),c=S(a),f=S(" kWh"),_=h(),Qe&&Qe.c(),p=h(),b=m("div"),b.textContent="Day",v=h(),d=m("div"),y=S(M),T=S(" kWh"),N=h(),Xe&&Xe.c(),E=h(),B=m("div"),B.textContent="Month",P=h(),L=m("div"),F=S(O),x=S(" kWh"),j=h(),Ze&&Ze.c(),z=h(),G=m("div"),G.textContent="Last mo.",V=h(),W=m("div"),K=S(U),H=S(" kWh"),Y=h(),Ue&&Ue.c(),re=h(),ue=m("strong"),ue.textContent="Export",ke=h(),me=m("div"),Se=m("div"),Se.textContent="Hour",je=h(),Re=m("div"),we=S(He),Te=S(" kWh"),Le=h(),Je&&Je.c(),$e=h(),w=m("div"),w.textContent="Day",g=h(),k=m("div"),I=S(A),Q=S(" kWh"),J=h(),We&&We.c(),se=h(),ce=m("div"),ce.textContent="Month",ve=h(),Me=m("div"),pe=S(oe),Be=S(" kWh"),_e=h(),xe&&xe.c(),ye=h(),vt=m("div"),vt.textContent="Last mo.",Hl=h(),tl=m("div"),Tl=S(ct),pl=S(" kWh"),Ht=h(),et&&et.c(),r(u,"class","text-right"),r(d,"class","text-right"),r(L,"class","text-right"),r(W,"class","text-right"),r(n,"class",Z="grid grid-cols-"+t[5]+" mb-3"),r(Re,"class","text-right"),r(k,"class","text-right"),r(Me,"class","text-right"),r(tl,"class","text-right"),r(me,"class",ht="grid grid-cols-"+t[5])},m(de,Ce){$(de,e,Ce),$(de,l,Ce),$(de,n,Ce),s(n,i),s(n,o),s(n,u),s(u,c),s(u,f),s(n,_),Qe&&Qe.m(n,null),s(n,p),s(n,b),s(n,v),s(n,d),s(d,y),s(d,T),s(n,N),Xe&&Xe.m(n,null),s(n,E),s(n,B),s(n,P),s(n,L),s(L,F),s(L,x),s(n,j),Ze&&Ze.m(n,null),s(n,z),s(n,G),s(n,V),s(n,W),s(W,K),s(W,H),s(n,Y),Ue&&Ue.m(n,null),$(de,re,Ce),$(de,ue,Ce),$(de,ke,Ce),$(de,me,Ce),s(me,Se),s(me,je),s(me,Re),s(Re,we),s(Re,Te),s(me,Le),Je&&Je.m(me,null),s(me,$e),s(me,w),s(me,g),s(me,k),s(k,I),s(k,Q),s(me,J),We&&We.m(me,null),s(me,se),s(me,ce),s(me,ve),s(me,Me),s(Me,pe),s(Me,Be),s(me,_e),xe&&xe.m(me,null),s(me,ye),s(me,vt),s(me,Hl),s(me,tl),s(tl,Tl),s(tl,pl),s(me,Ht),et&&et.m(me,null)},p(de,Ce){Ce&2&&a!==(a=ge(de[1].h.u,2)+"")&&X(c,a),de[4]?Qe?Qe.p(de,Ce):(Qe=Pu(de),Qe.c(),Qe.m(n,p)):Qe&&(Qe.d(1),Qe=null),Ce&2&&M!==(M=ge(de[1].d.u,1)+"")&&X(y,M),de[4]?Xe?Xe.p(de,Ce):(Xe=Eu(de),Xe.c(),Xe.m(n,E)):Xe&&(Xe.d(1),Xe=null),Ce&2&&O!==(O=ge(de[1].m.u)+"")&&X(F,O),de[4]?Ze?Ze.p(de,Ce):(Ze=Du(de),Ze.c(),Ze.m(n,z)):Ze&&(Ze.d(1),Ze=null),Ce&1&&U!==(U=ge(de[0].last_month.u)+"")&&X(K,U),de[4]?Ue?Ue.p(de,Ce):(Ue=Iu(de),Ue.c(),Ue.m(n,null)):Ue&&(Ue.d(1),Ue=null),Ce&32&&Z!==(Z="grid grid-cols-"+de[5]+" mb-3")&&r(n,"class",Z),Ce&2&&He!==(He=ge(de[1].h.p,2)+"")&&X(we,He),de[4]?Je?Je.p(de,Ce):(Je=Ru(de),Je.c(),Je.m(me,$e)):Je&&(Je.d(1),Je=null),Ce&2&&A!==(A=ge(de[1].d.p,1)+"")&&X(I,A),de[4]?We?We.p(de,Ce):(We=Lu(de),We.c(),We.m(me,se)):We&&(We.d(1),We=null),Ce&2&&oe!==(oe=ge(de[1].m.p)+"")&&X(pe,oe),de[4]?xe?xe.p(de,Ce):(xe=Ou(de),xe.c(),xe.m(me,ye)):xe&&(xe.d(1),xe=null),Ce&1&&ct!==(ct=ge(de[0].last_month.p)+"")&&X(Tl,ct),de[4]?et?et.p(de,Ce):(et=Fu(de),et.c(),et.m(me,null)):et&&(et.d(1),et=null),Ce&32&&ht!==(ht="grid grid-cols-"+de[5])&&r(me,"class",ht)},d(de){de&&C(e),de&&C(l),de&&C(n),Qe&&Qe.d(),Xe&&Xe.d(),Ze&&Ze.d(),Ue&&Ue.d(),de&&C(re),de&&C(ue),de&&C(ke),de&&C(me),Je&&Je.d(),We&&We.d(),xe&&xe.d(),et&&et.d()}}}function Au(t){let e,l,n,i,o,u,a=ge(t[1].h.c,2)+"",c,f,_,p,b,v,d,M=ge(t[1].d.c,1)+"",y,T,N,E,B,P,L,O=ge(t[1].m.c)+"",F,x,j,z,G,V,W,U=ge(t[0].last_month.c)+"",K,H,Y;return{c(){e=m("strong"),e.textContent="Cost",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",o=h(),u=m("div"),c=S(a),f=h(),_=S(t[2]),p=h(),b=m("div"),b.textContent="Day",v=h(),d=m("div"),y=S(M),T=h(),N=S(t[2]),E=h(),B=m("div"),B.textContent="Month",P=h(),L=m("div"),F=S(O),x=h(),j=S(t[2]),z=h(),G=m("div"),G.textContent="Last month",V=h(),W=m("div"),K=S(U),H=h(),Y=S(t[2]),r(u,"class","text-right"),r(d,"class","text-right"),r(L,"class","text-right"),r(W,"class","text-right"),r(n,"class","grid grid-cols-2")},m(Z,re){$(Z,e,re),$(Z,l,re),$(Z,n,re),s(n,i),s(n,o),s(n,u),s(u,c),s(u,f),s(u,_),s(n,p),s(n,b),s(n,v),s(n,d),s(d,y),s(d,T),s(d,N),s(n,E),s(n,B),s(n,P),s(n,L),s(L,F),s(L,x),s(L,j),s(n,z),s(n,G),s(n,V),s(n,W),s(W,K),s(W,H),s(W,Y)},p(Z,re){re&2&&a!==(a=ge(Z[1].h.c,2)+"")&&X(c,a),re&4&&X(_,Z[2]),re&2&&M!==(M=ge(Z[1].d.c,1)+"")&&X(y,M),re&4&&X(N,Z[2]),re&2&&O!==(O=ge(Z[1].m.c)+"")&&X(F,O),re&4&&X(j,Z[2]),re&1&&U!==(U=ge(Z[0].last_month.c)+"")&&X(K,U),re&4&&X(Y,Z[2])},d(Z){Z&&C(e),Z&&C(l),Z&&C(n)}}}function Pu(t){let e,l=ge(t[1].h.c,2)+"",n,i,o;return{c(){e=m("div"),n=S(l),i=h(),o=S(t[2]),r(e,"class","text-right")},m(u,a){$(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&2&&l!==(l=ge(u[1].h.c,2)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&C(e)}}}function Eu(t){let e,l=ge(t[1].d.c,1)+"",n,i,o;return{c(){e=m("div"),n=S(l),i=h(),o=S(t[2]),r(e,"class","text-right")},m(u,a){$(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&2&&l!==(l=ge(u[1].d.c,1)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&C(e)}}}function Du(t){let e,l=ge(t[1].m.c)+"",n,i,o;return{c(){e=m("div"),n=S(l),i=h(),o=S(t[2]),r(e,"class","text-right")},m(u,a){$(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&2&&l!==(l=ge(u[1].m.c)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&C(e)}}}function Iu(t){let e,l=ge(t[0].last_month.c)+"",n,i,o;return{c(){e=m("div"),n=S(l),i=h(),o=S(t[2]),r(e,"class","text-right")},m(u,a){$(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&1&&l!==(l=ge(u[0].last_month.c)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&C(e)}}}function Ru(t){let e,l=ge(t[1].h.i,2)+"",n,i,o;return{c(){e=m("div"),n=S(l),i=h(),o=S(t[2]),r(e,"class","text-right")},m(u,a){$(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&2&&l!==(l=ge(u[1].h.i,2)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&C(e)}}}function Lu(t){let e,l=ge(t[1].d.i,1)+"",n,i,o;return{c(){e=m("div"),n=S(l),i=h(),o=S(t[2]),r(e,"class","text-right")},m(u,a){$(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&2&&l!==(l=ge(u[1].d.i,1)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&C(e)}}}function Ou(t){let e,l=ge(t[1].m.i)+"",n,i,o;return{c(){e=m("div"),n=S(l),i=h(),o=S(t[2]),r(e,"class","text-right")},m(u,a){$(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&2&&l!==(l=ge(u[1].m.i)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&C(e)}}}function Fu(t){let e,l=ge(t[0].last_month.i)+"",n,i,o;return{c(){e=m("div"),n=S(l),i=h(),o=S(t[2]),r(e,"class","text-right")},m(u,a){$(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&1&&l!==(l=ge(u[0].last_month.i)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&C(e)}}}function gm(t){let e,l,n,i,o,u,a=t[1]&&Nu(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Real time calculation",n=h(),i=m("br"),o=m("br"),u=h(),a&&a.c(),r(e,"class","mx-2 text-sm")},m(c,f){$(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),s(e,u),a&&a.m(e,null)},p(c,[f]){c[1]?a?a.p(c,f):(a=Nu(c),a.c(),a.m(e,null)):a&&(a.d(1),a=null)},i:fe,o:fe,d(c){c&&C(e),a&&a.d()}}}function km(t,e,l){let{sysinfo:n}=e,{data:i}=e,{currency:o}=e,{hasExport:u}=e,a=!1,c=3;return t.$$set=f=>{"sysinfo"in f&&l(0,n=f.sysinfo),"data"in f&&l(1,i=f.data),"currency"in f&&l(2,o=f.currency),"hasExport"in f&&l(3,u=f.hasExport)},t.$$.update=()=>{t.$$.dirty&18&&(l(4,a=i&&i.h&&(Math.abs(i.h.c)>.01||Math.abs(i.d.c)>.01||Math.abs(i.m.c)>.01||Math.abs(i.h.i)>.01||Math.abs(i.d.i)>.01||Math.abs(i.m.i)>.01)),l(5,c=a?3:2))},[n,i,o,u,a,c]}class wm extends Ee{constructor(e){super(),Pe(this,e,km,gm,Ne,{sysinfo:0,data:1,currency:2,hasExport:3})}}function ym(t){let e,l,n=Ja(t[0].source)+"",i,o,u,a;return u=new pn({props:{config:t[1]}}),{c(){e=m("a"),l=S("Provided by: "),i=S(n),o=h(),ie(u.$$.fragment),r(e,"href","https://transparency.entsoe.eu/"),r(e,"target","_blank"),r(e,"class","text-xs float-right z-40")},m(c,f){$(c,e,f),s(e,l),s(e,i),$(c,o,f),le(u,c,f),a=!0},p(c,[f]){(!a||f&1)&&n!==(n=Ja(c[0].source)+"")&&X(i,n);const _={};f&2&&(_.config=c[1]),u.$set(_)},i(c){a||(D(u.$$.fragment,c),a=!0)},o(c){q(u.$$.fragment,c),a=!1},d(c){c&&C(e),c&&C(o),ne(u,c)}}}function Cm(t,e,l){let{json:n}=e,{sysinfo:i}=e,o={},u,a;return t.$$set=c=>{"json"in c&&l(0,n=c.json),"sysinfo"in c&&l(2,i=c.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&29){let c=n.currency,f=new Date().getUTCHours(),_=0,p=0,b=0,v=[],d=[],M=[];l(4,a=l(3,u=0));let y=new Date;for(fl(y,i.clock_offset-(24+y.getHours()-y.getUTCHours())%24),_=f;_<24&&(p=n[Oe(b++)],p!=null);_++)d.push({label:Oe(y.getHours())}),M.push(p*100),l(4,a=Math.min(a,p*100)),l(3,u=Math.max(u,p*100)),fl(y,1);for(_=0;_<24&&(p=n[Oe(b++)],p!=null);_++)d.push({label:Oe(y.getHours())}),M.push(p*100),l(4,a=Math.min(a,p*100)),l(3,u=Math.max(u,p*100)),fl(y,1);if(a>-100&&u<100){switch(c){case"NOK":case"SEK":case"DKK":c="\xF8re";break;case"EUR":c="cent";break;default:c=c+"/100"}for(l(4,a*=100),l(3,u*=100),_=0;_=0?P.toFixed(L):"",title:P>=0?P.toFixed(2)+" "+c:"",value:p>=0?Math.abs(p):0,label2:P<0?P.toFixed(L):"",title2:P<0?P.toFixed(2)+" "+c:"",value2:p<0?Math.abs(p):0,color:"#7c3aed"})}let N=Math.max(u,Math.abs(a));if(a<0){l(4,a=Math.min(N/4*-1,a));let P=Math.ceil(Math.abs(a)/N*4),L=a/P;for(_=1;_{"json"in c&&l(1,n=c.json),"sysinfo"in c&&l(2,i=c.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let c=0,f=[],_=[],p=[];l(4,a=l(3,u=0));let b=fl(new Date,-24),v=new Date().getUTCHours();for(fl(b,i.clock_offset-(24+b.getHours()-b.getUTCHours())%24),c=v;c<24;c++){let T=n["i"+Oe(c)],N=n["e"+Oe(c)];T===void 0&&(T=0),N===void 0&&(N=0),_.push({label:Oe(b.getHours())}),p.push({label:T.toFixed(1),title:T.toFixed(2)+" kWh",value:T*10,label2:N.toFixed(1),title2:N.toFixed(2)+" kWh",value2:N*10,color:"#7c3aed",color2:"#37829E"}),l(4,a=Math.max(a,N*10)),l(3,u=Math.max(u,T*10)),fl(b,1)}for(c=0;c{"json"in c&&l(1,n=c.json),"sysinfo"in c&&l(2,i=c.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let c=0,f=[],_=[],p=[];l(4,a=l(3,u=0));let b=new Date,v=new Date;for(fl(b,i.clock_offset-(24+b.getHours()-b.getUTCHours())%24),fl(v,i.clock_offset-(24+v.getHours()-v.getUTCHours())%24),v.setDate(0),c=b.getDate();c<=v.getDate();c++){let T=n["i"+Oe(c)],N=n["e"+Oe(c)];T===void 0&&(T=0),N===void 0&&(N=0),_.push({label:Oe(c)}),p.push({label:T.toFixed(T<10?1:0),title:T.toFixed(2)+" kWh",value:T,label2:N.toFixed(N<10?1:0),title2:N.toFixed(2)+" kWh",value2:N,color:"#7c3aed",color2:"#37829E"}),l(4,a=Math.max(a,N)),l(3,u=Math.max(u,T))}for(c=1;c{"json"in a&&l(1,n=a.json)},t.$$.update=()=>{if(t.$$.dirty&14){let a=0,c=0,f=[],_=[],p=[];n.s&&n.s.forEach((d,M)=>{var y=d.n?d.n:d.a;c=d.v,c==-127&&(c=0),_.push({label:y.slice(-4)}),p.push({label:c.toFixed(1),value:c,color:"#7c3aed"}),l(3,u=Math.min(u,c)),l(2,o=Math.max(o,c))}),l(2,o=Math.ceil(o)),l(3,u=Math.floor(u));let b=o;u<0&&(b+=Math.abs(u));let v=b/4;for(a=0;a<5;a++)c=u+v*a,f.push({value:c,label:c.toFixed(1)});l(0,i={title:"Temperature sensors (\xB0C)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:u,max:o,ticks:f},x:{ticks:_},points:p})}},[i,n,o,u]}class Im extends Ee{constructor(e){super(),Pe(this,e,Dm,Em,Ne,{json:1})}}function Rm(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}let Lm=0;function Om(t,e,l){let n={},i=0,o;return Hc.subscribe(u=>{l(2,o=u)}),jc(),t.$$.update=()=>{if(t.$$.dirty&6){let u=0,a=[],c=[],f=[];if(a.push({value:0,label:0}),o&&o.p)for(u=0;u0?Oe(_.d)+"."+no[new Date().getMonth()]:"-"}),l(1,i=Math.max(i,_.v))}if(o&&o.t){for(u=0;u=i)break;a.push({value:_,label:_})}a.push({label:o.m.toFixed(1),align:"right",color:"green",value:o.m})}o&&o.c&&(a.push({label:o.c.toFixed(0),color:"orange",value:o.c}),l(1,i=Math.max(i,o.c))),l(1,i=Math.ceil(i)),l(0,n={title:"Tariff peaks",padding:{top:20,right:35,bottom:20,left:35},y:{min:Lm,max:i,ticks:a},x:{ticks:c},points:f})}},[n,i,o]}class Fm extends Ee{constructor(e){super(),Pe(this,e,Om,Rm,Ne,{})}}function qu(t){let e,l,n,i,o,u,a=(t[0].mt?Cs(t[0].mt):"-")+"",c,f,_,p=(t[0].ic?t[0].ic.toFixed(1):"-")+"",b,v,d;return i=new Kc({props:{val:t[0].i?t[0].i:0,max:t[0].im?t[0].im:15e3,unit:"W",label:"Import",sub:t[0].p,subunit:t[0].pc,colorFn:Rc}}),{c(){e=m("div"),l=m("div"),n=m("div"),ie(i.$$.fragment),o=h(),u=m("div"),c=S(a),f=h(),_=m("div"),b=S(p),v=S(" kWh"),r(n,"class","col-span-2"),r(_,"class","text-right"),r(l,"class","grid grid-cols-2"),r(e,"class","cnt")},m(M,y){$(M,e,y),s(e,l),s(l,n),le(i,n,null),s(l,o),s(l,u),s(u,c),s(l,f),s(l,_),s(_,b),s(_,v),d=!0},p(M,y){const T={};y&1&&(T.val=M[0].i?M[0].i:0),y&1&&(T.max=M[0].im?M[0].im:15e3),y&1&&(T.sub=M[0].p),y&1&&(T.subunit=M[0].pc),i.$set(T),(!d||y&1)&&a!==(a=(M[0].mt?Cs(M[0].mt):"-")+"")&&X(c,a),(!d||y&1)&&p!==(p=(M[0].ic?M[0].ic.toFixed(1):"-")+"")&&X(b,p)},i(M){d||(D(i.$$.fragment,M),d=!0)},o(M){q(i.$$.fragment,M),d=!1},d(M){M&&C(e),ne(i)}}}function Bu(t){let e,l,n,i,o,u,a,c,f=(t[0].ec?t[0].ec.toFixed(1):"-")+"",_,p,b;return i=new Kc({props:{val:t[0].e?t[0].e:0,max:t[0].om?t[0].om*1e3:1e4,unit:"W",label:"Export",colorFn:k1}}),{c(){e=m("div"),l=m("div"),n=m("div"),ie(i.$$.fragment),o=h(),u=m("div"),a=h(),c=m("div"),_=S(f),p=S(" kWh"),r(n,"class","col-span-2"),r(c,"class","text-right"),r(l,"class","grid grid-cols-2"),r(e,"class","cnt")},m(v,d){$(v,e,d),s(e,l),s(l,n),le(i,n,null),s(l,o),s(l,u),s(l,a),s(l,c),s(c,_),s(c,p),b=!0},p(v,d){const M={};d&1&&(M.val=v[0].e?v[0].e:0),d&1&&(M.max=v[0].om?v[0].om*1e3:1e4),i.$set(M),(!b||d&1)&&f!==(f=(v[0].ec?v[0].ec.toFixed(1):"-")+"")&&X(_,f)},i(v){b||(D(i.$$.fragment,v),b=!0)},o(v){q(i.$$.fragment,v),b=!1},d(v){v&&C(e),ne(i)}}}function Uu(t){let e,l,n;return l=new fm({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,ds:t[0].ds}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt")},m(i,o){$(i,e,o),le(l,e,null),n=!0},p(i,o){const u={};o&1&&(u.u1=i[0].u1),o&1&&(u.u2=i[0].u2),o&1&&(u.u3=i[0].u3),o&1&&(u.ds=i[0].ds),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function ju(t){let e,l,n;return l=new pm({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,i1:t[0].i1,i2:t[0].i2,i3:t[0].i3,max:t[0].mf?t[0].mf:32}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt")},m(i,o){$(i,e,o),le(l,e,null),n=!0},p(i,o){const u={};o&1&&(u.u1=i[0].u1),o&1&&(u.u2=i[0].u2),o&1&&(u.u3=i[0].u3),o&1&&(u.i1=i[0].i1),o&1&&(u.i2=i[0].i2),o&1&&(u.i3=i[0].i3),o&1&&(u.max=i[0].mf?i[0].mf:32),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Hu(t){let e,l,n;return l=new vm({props:{importInstant:t[0].ri,exportInstant:t[0].re,importTotal:t[0].ric,exportTotal:t[0].rec}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt")},m(i,o){$(i,e,o),le(l,e,null),n=!0},p(i,o){const u={};o&1&&(u.importInstant=i[0].ri),o&1&&(u.exportInstant=i[0].re),o&1&&(u.importTotal=i[0].ric),o&1&&(u.exportTotal=i[0].rec),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Wu(t){let e,l,n;return l=new wm({props:{sysinfo:t[1],data:t[0].ea,currency:t[0].pc,hasExport:t[0].om>0||t[0].e>0}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt")},m(i,o){$(i,e,o),le(l,e,null),n=!0},p(i,o){const u={};o&2&&(u.sysinfo=i[1]),o&1&&(u.data=i[0].ea),o&1&&(u.currency=i[0].pc),o&1&&(u.hasExport=i[0].om>0||i[0].e>0),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function zu(t){let e,l,n;return l=new Fm({}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt h-64")},m(i,o){$(i,e,o),le(l,e,null),n=!0},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Gu(t){let e,l,n;return l=new $m({props:{json:t[2],sysinfo:t[1]}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){$(i,e,o),le(l,e,null),n=!0},p(i,o){const u={};o&4&&(u.json=i[2]),o&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Vu(t){let e,l,n;return l=new Tm({props:{json:t[3],sysinfo:t[1]}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){$(i,e,o),le(l,e,null),n=!0},p(i,o){const u={};o&8&&(u.json=i[3]),o&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Ku(t){let e,l,n;return l=new Pm({props:{json:t[4],sysinfo:t[1]}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){$(i,e,o),le(l,e,null),n=!0},p(i,o){const u={};o&16&&(u.json=i[4]),o&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Yu(t){let e,l,n;return l=new Im({props:{json:t[5]}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){$(i,e,o),le(l,e,null),n=!0},p(i,o){const u={};o&32&&(u.json=i[5]),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function qm(t){let e,l=Ke(t[1].ui.i,t[0].i),n,i=Ke(t[1].ui.e,t[0].om||t[0].e>0),o,u=Ke(t[1].ui.v,t[0].u1>100||t[0].u2>100||t[0].u3>100),a,c=Ke(t[1].ui.a,t[0].i1>.01||t[0].i2>.01||t[0].i3>.01),f,_=Ke(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),p,b=Ke(t[1].ui.c,t[0].ea),v,d=Ke(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("10YNO")||t[0].pr.startsWith("10Y1001A1001A4"))),M,y=Ke(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].p)),T,N=Ke(t[1].ui.d,t[3]),E,B=Ke(t[1].ui.m,t[4]),P,L=Ke(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[5].c>1),O,F=l&&qu(t),x=i&&Bu(t),j=u&&Uu(t),z=c&&ju(t),G=_&&Hu(t),V=b&&Wu(t),W=d&&zu(),U=y&&Gu(t),K=N&&Vu(t),H=B&&Ku(t),Y=L&&Yu(t);return{c(){e=m("div"),F&&F.c(),n=h(),x&&x.c(),o=h(),j&&j.c(),a=h(),z&&z.c(),f=h(),G&&G.c(),p=h(),V&&V.c(),v=h(),W&&W.c(),M=h(),U&&U.c(),T=h(),K&&K.c(),E=h(),H&&H.c(),P=h(),Y&&Y.c(),r(e,"class","grid 2xl:grid-cols-6 xl:grid-cols-5 lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2")},m(Z,re){$(Z,e,re),F&&F.m(e,null),s(e,n),x&&x.m(e,null),s(e,o),j&&j.m(e,null),s(e,a),z&&z.m(e,null),s(e,f),G&&G.m(e,null),s(e,p),V&&V.m(e,null),s(e,v),W&&W.m(e,null),s(e,M),U&&U.m(e,null),s(e,T),K&&K.m(e,null),s(e,E),H&&H.m(e,null),s(e,P),Y&&Y.m(e,null),O=!0},p(Z,[re]){re&3&&(l=Ke(Z[1].ui.i,Z[0].i)),l?F?(F.p(Z,re),re&3&&D(F,1)):(F=qu(Z),F.c(),D(F,1),F.m(e,n)):F&&(De(),q(F,1,1,()=>{F=null}),Ie()),re&3&&(i=Ke(Z[1].ui.e,Z[0].om||Z[0].e>0)),i?x?(x.p(Z,re),re&3&&D(x,1)):(x=Bu(Z),x.c(),D(x,1),x.m(e,o)):x&&(De(),q(x,1,1,()=>{x=null}),Ie()),re&3&&(u=Ke(Z[1].ui.v,Z[0].u1>100||Z[0].u2>100||Z[0].u3>100)),u?j?(j.p(Z,re),re&3&&D(j,1)):(j=Uu(Z),j.c(),D(j,1),j.m(e,a)):j&&(De(),q(j,1,1,()=>{j=null}),Ie()),re&3&&(c=Ke(Z[1].ui.a,Z[0].i1>.01||Z[0].i2>.01||Z[0].i3>.01)),c?z?(z.p(Z,re),re&3&&D(z,1)):(z=ju(Z),z.c(),D(z,1),z.m(e,f)):z&&(De(),q(z,1,1,()=>{z=null}),Ie()),re&3&&(_=Ke(Z[1].ui.r,Z[0].ri>0||Z[0].re>0||Z[0].ric>0||Z[0].rec>0)),_?G?(G.p(Z,re),re&3&&D(G,1)):(G=Hu(Z),G.c(),D(G,1),G.m(e,p)):G&&(De(),q(G,1,1,()=>{G=null}),Ie()),re&3&&(b=Ke(Z[1].ui.c,Z[0].ea)),b?V?(V.p(Z,re),re&3&&D(V,1)):(V=Wu(Z),V.c(),D(V,1),V.m(e,v)):V&&(De(),q(V,1,1,()=>{V=null}),Ie()),re&3&&(d=Ke(Z[1].ui.t,Z[0].pr&&(Z[0].pr.startsWith("10YNO")||Z[0].pr.startsWith("10Y1001A1001A4")))),d?W?re&3&&D(W,1):(W=zu(),W.c(),D(W,1),W.m(e,M)):W&&(De(),q(W,1,1,()=>{W=null}),Ie()),re&3&&(y=Ke(Z[1].ui.p,Z[0].pe&&!Number.isNaN(Z[0].p))),y?U?(U.p(Z,re),re&3&&D(U,1)):(U=Gu(Z),U.c(),D(U,1),U.m(e,T)):U&&(De(),q(U,1,1,()=>{U=null}),Ie()),re&10&&(N=Ke(Z[1].ui.d,Z[3])),N?K?(K.p(Z,re),re&10&&D(K,1)):(K=Vu(Z),K.c(),D(K,1),K.m(e,E)):K&&(De(),q(K,1,1,()=>{K=null}),Ie()),re&18&&(B=Ke(Z[1].ui.m,Z[4])),B?H?(H.p(Z,re),re&18&&D(H,1)):(H=Ku(Z),H.c(),D(H,1),H.m(e,P)):H&&(De(),q(H,1,1,()=>{H=null}),Ie()),re&35&&(L=Ke(Z[1].ui.s,Z[0].t&&Z[0].t!=-127&&Z[5].c>1)),L?Y?(Y.p(Z,re),re&35&&D(Y,1)):(Y=Yu(Z),Y.c(),D(Y,1),Y.m(e,null)):Y&&(De(),q(Y,1,1,()=>{Y=null}),Ie())},i(Z){O||(D(F),D(x),D(j),D(z),D(G),D(V),D(W),D(U),D(K),D(H),D(Y),O=!0)},o(Z){q(F),q(x),q(j),q(z),q(G),q(V),q(W),q(U),q(K),q(H),q(Y),O=!1},d(Z){Z&&C(e),F&&F.d(),x&&x.d(),j&&j.d(),z&&z.d(),G&&G.d(),V&&V.d(),W&&W.d(),U&&U.d(),K&&K.d(),H&&H.d(),Y&&Y.d()}}}function Bm(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,o={},u={},a={},c={};return Co.subscribe(f=>{l(2,o=f)}),Fc.subscribe(f=>{l(3,u=f)}),qc.subscribe(f=>{l(4,a=f)}),Uc.subscribe(f=>{l(5,c=f)}),t.$$set=f=>{"data"in f&&l(0,n=f.data),"sysinfo"in f&&l(1,i=f.sysinfo)},[n,i,o,u,a,c]}class Um extends Ee{constructor(e){super(),Pe(this,e,Bm,qm,Ne,{data:0,sysinfo:1})}}let fo={};const Ci=at(fo);async function jm(){fo=await(await fetch("/configuration.json")).json(),Ci.set(fo)}function Qu(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function Hm(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=3,e.value=e.__value},m(l,n){$(l,e,n)},d(l){l&&C(e)}}}function Wm(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=20,e.value=e.__value},m(l,n){$(l,e,n)},d(l){l&&C(e)}}}function Xu(t){let e;return{c(){e=m("option"),e.textContent="UART2",e.__value=113,e.value=e.__value},m(l,n){$(l,e,n)},d(l){l&&C(e)}}}function Zu(t){let e,l,n;return{c(){e=m("option"),e.textContent="UART1",l=h(),n=m("option"),n.textContent="UART2",e.__value=9,e.value=e.__value,n.__value=16,n.value=n.__value},m(i,o){$(i,e,o),$(i,l,o),$(i,n,o)},d(i){i&&C(e),i&&C(l),i&&C(n)}}}function Ju(t){let e;return{c(){e=m("option"),e.textContent="UART1",e.__value=18,e.value=e.__value},m(l,n){$(l,e,n)},d(l){l&&C(e)}}}function xu(t){let e,l,n;return{c(){e=m("option"),l=S("GPIO"),n=S(t[4]),e.__value=t[4],e.value=e.__value},m(i,o){$(i,e,o),s(e,l),s(e,n)},d(i){i&&C(e)}}}function ef(t){let e,l=t[4]>3&&!(t[0]=="esp32"&&(t[4]==9||t[4]==16))&&!(t[0]=="esp32s2"&&t[4]==18)&&!(t[0]=="esp8266"&&(t[4]==3||t[4]==113))&&xu(t);return{c(){l&&l.c(),e=Ve()},m(n,i){l&&l.m(n,i),$(n,e,i)},p(n,i){n[4]>3&&!(n[0]=="esp32"&&(n[4]==9||n[4]==16))&&!(n[0]=="esp32s2"&&n[4]==18)&&!(n[0]=="esp8266"&&(n[4]==3||n[4]==113))?l||(l=xu(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){l&&l.d(n),n&&C(e)}}}function zm(t){let e,l,n,i,o;function u(d,M){return d[0]=="esp32c3"?Wm:Hm}let a=u(t),c=a(t),f=t[0]=="esp8266"&&Xu(),_=(t[0]=="esp32"||t[0]=="esp32solo")&&Zu(),p=t[0]=="esp32s2"&&Ju(),b={length:t[1]+1},v=[];for(let d=0;d{"chip"in o&&l(0,n=o.chip)},t.$$.update=()=>{if(t.$$.dirty&1)switch(n){case"esp8266":l(1,i=16);break;case"esp32s2":l(1,i=44);break;case"esp32c3":l(1,i=19);break}},[n,i]}class Yc extends Ee{constructor(e){super(),Pe(this,e,Gm,zm,Ne,{chip:0})}}function tf(t){let e,l,n=t[1]&&lf(t);return{c(){e=m("div"),l=m("div"),n&&n.c(),r(l,"class","fixed inset-0 bg-gray-500 bg-opacity-50 flex items-center justify-center"),r(e,"class","z-50"),r(e,"aria-modal","true")},m(i,o){$(i,e,o),s(e,l),n&&n.m(l,null)},p(i,o){i[1]?n?n.p(i,o):(n=lf(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&C(e),n&&n.d()}}}function lf(t){let e,l;return{c(){e=m("div"),l=S(t[1]),r(e,"class","bg-white m-2 p-3 rounded-md shadow-lg pb-4 text-gray-700 w-96")},m(n,i){$(n,e,i),s(e,l)},p(n,i){i&2&&X(l,n[1])},d(n){n&&C(e)}}}function Vm(t){let e,l=t[0]&&tf(t);return{c(){l&&l.c(),e=Ve()},m(n,i){l&&l.m(n,i),$(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=tf(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:fe,o:fe,d(n){l&&l.d(n),n&&C(e)}}}function Km(t,e,l){let{active:n}=e,{message:i}=e;return t.$$set=o=>{"active"in o&&l(0,n=o.active),"message"in o&&l(1,i=o.message)},[n,i]}class It extends Ee{constructor(e){super(),Pe(this,e,Km,Vm,Ne,{active:0,message:1})}}function nf(t,e,l){const n=t.slice();return n[1]=e[l],n}function sf(t){let e,l,n=t[1]+"",i;return{c(){e=m("option"),l=S("Europe/"),i=S(n),e.__value="Europe/"+t[1],e.value=e.__value},m(o,u){$(o,e,u),s(e,l),s(e,i)},p:fe,d(o){o&&C(e)}}}function Ym(t){let e,l,n,i=t[0],o=[];for(let u=0;u>1&1,A=0;A0;g--)A[g]=A[g]?A[g-1]^P.EXPONENT[F._modN(P.LOG[A[g]]+w)]:A[g-1];A[0]=P.EXPONENT[F._modN(P.LOG[A[0]]+w)]}for(w=0;w<=k;w++)A[w]=P.LOG[A[w]]},_checkBadness:function(){var w,g,k,A,I,Q=0,J=this._badness,se=this.buffer,ce=this.width;for(I=0;Ice*ce;)oe-=ce*ce,Me++;for(Q+=Me*F.N4,A=0;A=J-2&&(w=J-2,I>9&&w--);var se=w;if(I>9){for(Q[se+2]=0,Q[se+3]=0;se--;)g=Q[se],Q[se+3]|=255&g<<4,Q[se+2]=g>>4;Q[2]|=255&w<<4,Q[1]=w>>4,Q[0]=64|w>>12}else{for(Q[se+1]=0,Q[se+2]=0;se--;)g=Q[se],Q[se+2]|=255&g<<4,Q[se+1]=g>>4;Q[1]|=255&w<<4,Q[0]=64|w>>4}for(se=w+3-(I<10);se=5&&(k+=F.N1+A[g]-5);for(g=3;gw||A[g-3]*3>=A[g]*4||A[g+3]*3>=A[g]*4)&&(k+=F.N3);return k},_finish:function(){this._stringBuffer=this.buffer.slice();var w,g,k=0,A=3e4;for(g=0;g<8&&(this._applyMask(g),w=this._checkBadness(),w>=1)A&1&&(I[Q-1-g+Q*8]=1,g<6?I[8+Q*g]=1:I[8+Q*(g+1)]=1);for(g=0;g<7;g++,A>>=1)A&1&&(I[8+Q*(Q-7+g)]=1,g?I[6-g+Q*8]=1:I[7+Q*8]=1)},_interleaveBlocks:function(){var w,g,k=this._dataBlock,A=this._ecc,I=this._eccBlock,Q=0,J=this._calculateMaxLength(),se=this._neccBlock1,ce=this._neccBlock2,ve=this._stringBuffer;for(w=0;w1)for(w=T.BLOCK[A],k=I-7;;){for(g=I-7;g>w-3&&(this._addAlignment(g,k),!(g6)for(w=O.BLOCK[Q-7],g=17,k=0;k<6;k++)for(A=0;A<3;A++,g--)1&(g>11?Q>>g-12:w>>g)?(I[5-k+J*(2-A+J-11)]=1,I[2-A+J-11+J*(5-k)]=1):(this._setMask(5-k,2-A+J-11),this._setMask(2-A+J-11,5-k))},_isMasked:function(w,g){var k=F._getMaskBit(w,g);return this._mask[k]===1},_pack:function(){var w,g,k,A=1,I=1,Q=this.width,J=Q-1,se=Q-1,ce=(this._dataBlock+this._eccBlock)*(this._neccBlock1+this._neccBlock2)+this._neccBlock2;for(g=0;gg&&(k=w,w=g,g=k),k=g,k+=g*g,k>>=1,k+=w,k},_modN:function(w){for(;w>=255;)w-=255,w=(w>>8)+(w&255);return w},N1:3,N2:3,N3:40,N4:10}),x=F,j=v.extend({draw:function(){this.element.src=this.qrious.toDataURL()},reset:function(){this.element.src=""},resize:function(){var w=this.element;w.width=w.height=this.qrious.size}}),z=j,G=p.extend(function(w,g,k,A){this.name=w,this.modifiable=Boolean(g),this.defaultValue=k,this._valueTransformer=A},{transform:function(w){var g=this._valueTransformer;return typeof g=="function"?g(w,this):w}}),V=G,W=p.extend(null,{abs:function(w){return w!=null?Math.abs(w):null},hasOwn:function(w,g){return Object.prototype.hasOwnProperty.call(w,g)},noop:function(){},toUpperCase:function(w){return w!=null?w.toUpperCase():null}}),U=W,K=p.extend(function(w){this.options={},w.forEach(function(g){this.options[g.name]=g},this)},{exists:function(w){return this.options[w]!=null},get:function(w,g){return K._get(this.options[w],g)},getAll:function(w){var g,k=this.options,A={};for(g in k)U.hasOwn(k,g)&&(A[g]=K._get(k[g],w));return A},init:function(w,g,k){typeof k!="function"&&(k=U.noop);var A,I;for(A in this.options)U.hasOwn(this.options,A)&&(I=this.options[A],K._set(I,I.defaultValue,g),K._createAccessor(I,g,k));this._setAll(w,g,!0)},set:function(w,g,k){return this._set(w,g,k)},setAll:function(w,g){return this._setAll(w,g)},_set:function(w,g,k,A){var I=this.options[w];if(!I)throw new Error("Invalid option: "+w);if(!I.modifiable&&!A)throw new Error("Option cannot be modified: "+w);return K._set(I,g,k)},_setAll:function(w,g,k){if(!w)return!1;var A,I=!1;for(A in w)U.hasOwn(w,A)&&this._set(A,w[A],g,k)&&(I=!0);return I}},{_createAccessor:function(w,g,k){var A={get:function(){return K._get(w,g)}};w.modifiable&&(A.set=function(I){K._set(w,I,g)&&k(I,w)}),Object.defineProperty(g,w.name,A)},_get:function(w,g){return g["_"+w.name]},_set:function(w,g,k){var A="_"+w.name,I=k[A],Q=w.transform(g!=null?g:w.defaultValue);return k[A]=Q,Q!==I}}),H=K,Y=p.extend(function(){this._services={}},{getService:function(w){var g=this._services[w];if(!g)throw new Error("Service is not being managed with name: "+w);return g},setService:function(w,g){if(this._services[w])throw new Error("Service is already managed with name: "+w);g&&(this._services[w]=g)}}),Z=Y,re=new H([new V("background",!0,"white"),new V("backgroundAlpha",!0,1,U.abs),new V("element"),new V("foreground",!0,"black"),new V("foregroundAlpha",!0,1,U.abs),new V("level",!0,"L",U.toUpperCase),new V("mime",!0,"image/png"),new V("padding",!0,null,U.abs),new V("size",!0,100,U.abs),new V("value",!0,"")]),ue=new Z,ke=p.extend(function(w){re.init(w,this,this.update.bind(this));var g=re.get("element",this),k=ue.getService("element"),A=g&&k.isCanvas(g)?g:k.createCanvas(),I=g&&k.isImage(g)?g:k.createImage();this._canvasRenderer=new M(this,A,!0),this._imageRenderer=new z(this,I,I===g),this.update()},{get:function(){return re.getAll(this)},set:function(w){re.setAll(w,this)&&this.update()},toDataURL:function(w){return this.canvas.toDataURL(w||this.mime)},update:function(){var w=new x({level:this.level,value:this.value});this._canvasRenderer.render(w),this._imageRenderer.render(w)}},{use:function(w){ue.setService(w.getName(),w)}});Object.defineProperties(ke.prototype,{canvas:{get:function(){return this._canvasRenderer.getElement()}},image:{get:function(){return this._imageRenderer.getElement()}}});var me=ke,Se=me,je=p.extend({getName:function(){}}),Re=je,He=Re.extend({createCanvas:function(){},createImage:function(){},getName:function(){return"element"},isCanvas:function(w){},isImage:function(w){}}),we=He,Te=we.extend({createCanvas:function(){return document.createElement("canvas")},createImage:function(){return document.createElement("img")},isCanvas:function(w){return w instanceof HTMLCanvasElement},isImage:function(w){return w instanceof HTMLImageElement}}),Le=Te;Se.use(new Le);var $e=Se;return $e})})(Xc);const ep=Xc.exports;function tp(t){let e,l;return{c(){e=m("img"),Js(e.src,l=t[2])||r(e,"src",l),r(e,"alt",t[0]),r(e,"class",t[1])},m(n,i){$(n,e,i)},p(n,[i]){i&4&&!Js(e.src,l=n[2])&&r(e,"src",l),i&1&&r(e,"alt",n[0]),i&2&&r(e,"class",n[1])},i:fe,o:fe,d(n){n&&C(e)}}}function lp(t,e,l){const n=new ep;let{errorCorrection:i="L"}=e,{background:o="#fff"}=e,{color:u="#000"}=e,{size:a="200"}=e,{value:c=""}=e,{padding:f=0}=e,{className:_="qrcode"}=e,p="";function b(){n.set({background:o,foreground:u,level:i,padding:f,size:a,value:c}),l(2,p=n.toDataURL("image/jpeg"))}return ic(()=>{b()}),t.$$set=v=>{"errorCorrection"in v&&l(3,i=v.errorCorrection),"background"in v&&l(4,o=v.background),"color"in v&&l(5,u=v.color),"size"in v&&l(6,a=v.size),"value"in v&&l(0,c=v.value),"padding"in v&&l(7,f=v.padding),"className"in v&&l(1,_=v.className)},t.$$.update=()=>{t.$$.dirty&1&&c&&b()},[c,_,p,i,o,u,a,f]}class np extends Ee{constructor(e){super(),Pe(this,e,lp,tp,Ne,{errorCorrection:3,background:4,color:5,size:6,value:0,padding:7,className:1})}}function of(t,e,l){const n=t.slice();return n[95]=e[l],n[96]=e,n[97]=l,n}function rf(t,e,l){const n=t.slice();return n[98]=e[l],n[99]=e,n[100]=l,n}function ip(t,e,l){const n=t.slice();return n[101]=e[l],n}function sp(t,e,l){const n=t.slice();return n[104]=e[l],n}function op(t){let e,l;return{c(){e=m("option"),l=S(t[104]),e.__value=t[104],e.value=e.__value},m(n,i){$(n,e,i),s(e,l)},p:fe,d(n){n&&C(e)}}}function af(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),r(l,"name","pt"),r(l,"type","text"),r(l,"class","in-s"),r(l,"placeholder","ENTSO-E API key, optional, read docs")},m(o,u){$(o,e,u),$(o,l,u),te(l,t[3].p.t),n||(i=ee(l,"input",t[22]),n=!0)},p(o,u){u[0]&8&&l.value!==o[3].p.t&&te(l,o[3].p.t)},d(o){o&&C(e),o&&C(l),n=!1,i()}}}function uf(t){let e,l,n,i,o,u,a,c,f,_,p,b,v;return{c(){e=m("div"),l=S("Username"),n=m("br"),i=h(),o=m("input"),u=h(),a=m("div"),c=S("Password"),f=m("br"),_=h(),p=m("input"),r(o,"name","gu"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1"),r(p,"name","gp"),r(p,"type","password"),r(p,"class","in-s"),r(a,"class","my-1")},m(d,M){$(d,e,M),s(e,l),s(e,n),s(e,i),s(e,o),te(o,t[3].g.u),$(d,u,M),$(d,a,M),s(a,c),s(a,f),s(a,_),s(a,p),te(p,t[3].g.p),b||(v=[ee(o,"input",t[24]),ee(p,"input",t[25])],b=!0)},p(d,M){M[0]&8&&o.value!==d[3].g.u&&te(o,d[3].g.u),M[0]&8&&p.value!==d[3].g.p&&te(p,d[3].g.p)},d(d){d&&C(e),d&&C(u),d&&C(a),b=!1,ze(v)}}}function rp(t){let e,l=t[101]*100+"",n;return{c(){e=m("option"),n=S(l),e.__value=t[101]*100,e.value=e.__value},m(i,o){$(i,e,o),s(e,n)},p:fe,d(i){i&&C(e)}}}function ff(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),r(l,"name","mek"),r(l,"type","text"),r(l,"class","in-s")},m(o,u){$(o,e,u),$(o,l,u),te(l,t[3].m.e.k),n||(i=ee(l,"input",t[34]),n=!0)},p(o,u){u[0]&8&&l.value!==o[3].m.e.k&&te(l,o[3].m.e.k)},d(o){o&&C(e),o&&C(l),n=!1,i()}}}function cf(t){let e,l,n,i,o,u,a;return{c(){e=m("div"),l=S("Authentication key"),n=m("br"),i=h(),o=m("input"),r(o,"name","mea"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1")},m(c,f){$(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),te(o,t[3].m.e.a),u||(a=ee(o,"input",t[35]),u=!0)},p(c,f){f[0]&8&&o.value!==c[3].m.e.a&&te(o,c[3].m.e.a)},d(c){c&&C(e),u=!1,a()}}}function mf(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,M,y,T,N,E,B,P,L,O,F,x,j;return{c(){e=m("div"),l=m("div"),n=S("Watt"),i=m("br"),o=h(),u=m("input"),a=h(),c=m("div"),f=S("Volt"),_=m("br"),p=h(),b=m("input"),v=h(),d=m("div"),M=S("Amp"),y=m("br"),T=h(),N=m("input"),E=h(),B=m("div"),P=S("kWh"),L=m("br"),O=h(),F=m("input"),r(u,"name","mmw"),r(u,"type","number"),r(u,"min","0.00"),r(u,"max","1000"),r(u,"step","0.001"),r(u,"class","in-f tr w-full"),r(l,"class","w-1/4"),r(b,"name","mmv"),r(b,"type","number"),r(b,"min","0.00"),r(b,"max","1000"),r(b,"step","0.001"),r(b,"class","in-m tr w-full"),r(c,"class","w-1/4"),r(N,"name","mma"),r(N,"type","number"),r(N,"min","0.00"),r(N,"max","1000"),r(N,"step","0.001"),r(N,"class","in-m tr w-full"),r(d,"class","w-1/4"),r(F,"name","mmc"),r(F,"type","number"),r(F,"min","0.00"),r(F,"max","1000"),r(F,"step","0.001"),r(F,"class","in-l tr w-full"),r(B,"class","w-1/4"),r(e,"class","flex my-1")},m(z,G){$(z,e,G),s(e,l),s(l,n),s(l,i),s(l,o),s(l,u),te(u,t[3].m.m.w),s(e,a),s(e,c),s(c,f),s(c,_),s(c,p),s(c,b),te(b,t[3].m.m.v),s(e,v),s(e,d),s(d,M),s(d,y),s(d,T),s(d,N),te(N,t[3].m.m.a),s(e,E),s(e,B),s(B,P),s(B,L),s(B,O),s(B,F),te(F,t[3].m.m.c),x||(j=[ee(u,"input",t[37]),ee(b,"input",t[38]),ee(N,"input",t[39]),ee(F,"input",t[40])],x=!0)},p(z,G){G[0]&8&&he(u.value)!==z[3].m.m.w&&te(u,z[3].m.m.w),G[0]&8&&he(b.value)!==z[3].m.m.v&&te(b,z[3].m.m.v),G[0]&8&&he(N.value)!==z[3].m.m.a&&te(N,z[3].m.m.a),G[0]&8&&he(F.value)!==z[3].m.m.c&&te(F,z[3].m.m.c)},d(z){z&&C(e),x=!1,ze(j)}}}function pf(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,M,y;return{c(){e=m("div"),l=S("Gateway"),n=m("br"),i=h(),o=m("input"),u=h(),a=m("div"),c=S("DNS"),f=m("br"),_=h(),p=m("div"),b=m("input"),v=h(),d=m("input"),r(o,"name","ng"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1"),r(b,"name","nd1"),r(b,"type","text"),r(b,"class","in-f w-full"),r(d,"name","nd2"),r(d,"type","text"),r(d,"class","in-l w-full"),r(p,"class","flex"),r(a,"class","my-1")},m(T,N){$(T,e,N),s(e,l),s(e,n),s(e,i),s(e,o),te(o,t[3].n.g),$(T,u,N),$(T,a,N),s(a,c),s(a,f),s(a,_),s(a,p),s(p,b),te(b,t[3].n.d1),s(p,v),s(p,d),te(d,t[3].n.d2),M||(y=[ee(o,"input",t[49]),ee(b,"input",t[50]),ee(d,"input",t[51])],M=!0)},p(T,N){N[0]&8&&o.value!==T[3].n.g&&te(o,T[3].n.g),N[0]&8&&b.value!==T[3].n.d1&&te(b,T[3].n.d1),N[0]&8&&d.value!==T[3].n.d2&&te(d,T[3].n.d2)},d(T){T&&C(e),T&&C(u),T&&C(a),M=!1,ze(y)}}}function _f(t){let e,l,n,i,o;return{c(){e=m("label"),l=m("input"),n=S(" SSL"),r(l,"type","checkbox"),r(l,"name","qs"),l.__value="true",l.value=l.__value,r(l,"class","rounded mb-1"),r(e,"class","float-right mr-3")},m(u,a){$(u,e,a),s(e,l),l.checked=t[3].q.s.e,s(e,n),i||(o=[ee(l,"change",t[55]),ee(l,"change",t[14])],i=!0)},p(u,a){a[0]&8&&(l.checked=u[3].q.s.e)},d(u){u&&C(e),i=!1,ze(o)}}}function df(t){let e,l,n,i,o,u,a,c,f,_,p,b,v;const d=[up,ap],M=[];function y(O,F){return O[3].q.s.c?0:1}n=y(t),i=M[n]=d[n](t);const T=[pp,mp],N=[];function E(O,F){return O[3].q.s.r?0:1}a=E(t),c=N[a]=T[a](t);const B=[hp,vp],P=[];function L(O,F){return O[3].q.s.k?0:1}return p=L(t),b=P[p]=B[p](t),{c(){e=m("div"),l=m("span"),i.c(),o=h(),u=m("span"),c.c(),f=h(),_=m("span"),b.c(),r(l,"class","flex pr-2"),r(u,"class","flex pr-2"),r(_,"class","flex pr-2"),r(e,"class","my-1 flex")},m(O,F){$(O,e,F),s(e,l),M[n].m(l,null),s(e,o),s(e,u),N[a].m(u,null),s(e,f),s(e,_),P[p].m(_,null),v=!0},p(O,F){let x=n;n=y(O),n===x?M[n].p(O,F):(De(),q(M[x],1,1,()=>{M[x]=null}),Ie(),i=M[n],i?i.p(O,F):(i=M[n]=d[n](O),i.c()),D(i,1),i.m(l,null));let j=a;a=E(O),a===j?N[a].p(O,F):(De(),q(N[j],1,1,()=>{N[j]=null}),Ie(),c=N[a],c?c.p(O,F):(c=N[a]=T[a](O),c.c()),D(c,1),c.m(u,null));let z=p;p=L(O),p===z?P[p].p(O,F):(De(),q(P[z],1,1,()=>{P[z]=null}),Ie(),b=P[p],b?b.p(O,F):(b=P[p]=B[p](O),b.c()),D(b,1),b.m(_,null))},i(O){v||(D(i),D(c),D(b),v=!0)},o(O){q(i),q(c),q(b),v=!1},d(O){O&&C(e),M[n].d(),N[a].d(),P[p].d()}}}function ap(t){let e,l;return e=new el({props:{to:"/mqtt-ca",$$slots:{default:[fp]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i[3]&16384&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function up(t){let e,l,n,i,o,u,a,c;return l=new el({props:{to:"/mqtt-ca",$$slots:{default:[cp]},$$scope:{ctx:t}}}),o=new To({}),{c(){e=m("span"),ie(l.$$.fragment),n=h(),i=m("span"),ie(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,_){$(f,e,_),le(l,e,null),$(f,n,_),$(f,i,_),le(o,i,null),u=!0,a||(c=[ee(i,"click",t[11]),ee(i,"keypress",t[11])],a=!0)},p(f,_){const p={};_[3]&16384&&(p.$$scope={dirty:_,ctx:f}),l.$set(p)},i(f){u||(D(l.$$.fragment,f),D(o.$$.fragment,f),u=!0)},o(f){q(l.$$.fragment,f),q(o.$$.fragment,f),u=!1},d(f){f&&C(e),ne(l),f&&C(n),f&&C(i),ne(o),a=!1,ze(c)}}}function fp(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload CA",title:"Click here to upload CA"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function cp(t){let e;return{c(){e=S("CA OK")},m(l,n){$(l,e,n)},d(l){l&&C(e)}}}function mp(t){let e,l;return e=new el({props:{to:"/mqtt-cert",$$slots:{default:[_p]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i[3]&16384&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function pp(t){let e,l,n,i,o,u,a,c;return l=new el({props:{to:"/mqtt-cert",$$slots:{default:[dp]},$$scope:{ctx:t}}}),o=new To({}),{c(){e=m("span"),ie(l.$$.fragment),n=h(),i=m("span"),ie(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,_){$(f,e,_),le(l,e,null),$(f,n,_),$(f,i,_),le(o,i,null),u=!0,a||(c=[ee(i,"click",t[12]),ee(i,"keypress",t[12])],a=!0)},p(f,_){const p={};_[3]&16384&&(p.$$scope={dirty:_,ctx:f}),l.$set(p)},i(f){u||(D(l.$$.fragment,f),D(o.$$.fragment,f),u=!0)},o(f){q(l.$$.fragment,f),q(o.$$.fragment,f),u=!1},d(f){f&&C(e),ne(l),f&&C(n),f&&C(i),ne(o),a=!1,ze(c)}}}function _p(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload cert",title:"Click here to upload certificate"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function dp(t){let e;return{c(){e=S("Cert OK")},m(l,n){$(l,e,n)},d(l){l&&C(e)}}}function vp(t){let e,l;return e=new el({props:{to:"/mqtt-key",$$slots:{default:[bp]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i[3]&16384&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function hp(t){let e,l,n,i,o,u,a,c;return l=new el({props:{to:"/mqtt-key",$$slots:{default:[gp]},$$scope:{ctx:t}}}),o=new To({}),{c(){e=m("span"),ie(l.$$.fragment),n=h(),i=m("span"),ie(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,_){$(f,e,_),le(l,e,null),$(f,n,_),$(f,i,_),le(o,i,null),u=!0,a||(c=[ee(i,"click",t[13]),ee(i,"keypress",t[13])],a=!0)},p(f,_){const p={};_[3]&16384&&(p.$$scope={dirty:_,ctx:f}),l.$set(p)},i(f){u||(D(l.$$.fragment,f),D(o.$$.fragment,f),u=!0)},o(f){q(l.$$.fragment,f),q(o.$$.fragment,f),u=!1},d(f){f&&C(e),ne(l),f&&C(n),f&&C(i),ne(o),a=!1,ze(c)}}}function bp(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload key",title:"Click here to upload key"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function gp(t){let e;return{c(){e=S("Key OK")},m(l,n){$(l,e,n)},d(l){l&&C(e)}}}function vf(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,M,y,T,N,E,B,P,L,O,F,x,j,z,G,V,W,U,K;return o=new Bt({}),{c(){e=m("div"),l=m("strong"),l.textContent="Domoticz",n=h(),i=m("a"),ie(o.$$.fragment),u=h(),a=m("input"),c=h(),f=m("div"),_=m("div"),p=S("Electricity IDX"),b=m("br"),v=h(),d=m("input"),M=h(),y=m("div"),T=S("Current IDX"),N=m("br"),E=h(),B=m("input"),P=h(),L=m("div"),O=S(`Voltage IDX: L1, L2 & L3 + `),o.c(),l=Ve()},m(u,a){$(u,e,a),o.m(u,a),$(u,l,a)},p(u,a){i===(i=n(u))&&o?o.p(u,a):(o.d(1),o=i(u),o&&(o.c(),o.m(l.parentNode,l)))},d(u){u&&C(e),o.d(u),u&&C(l)}}}function M1(t){let e,l;return{c(){e=S(t[0]),l=S(" seconds")},m(n,i){$(n,e,i),$(n,l,i)},p(n,i){i&1&&X(e,n[0])},d(n){n&&C(e),n&&C(l)}}}function S1(t){let e,l;return{c(){e=S(t[3]),l=S(" minute")},m(n,i){$(n,e,i),$(n,l,i)},p(n,i){i&8&&X(e,n[3])},d(n){n&&C(e),n&&C(l)}}}function T1(t){let e,l;return{c(){e=S(t[3]),l=S(" minutes")},m(n,i){$(n,e,i),$(n,l,i)},p(n,i){i&8&&X(e,n[3])},d(n){n&&C(e),n&&C(l)}}}function N1(t){let e,l;return{c(){e=S(t[2]),l=S(" hour")},m(n,i){$(n,e,i),$(n,l,i)},p(n,i){i&4&&X(e,n[2])},d(n){n&&C(e),n&&C(l)}}}function A1(t){let e,l;return{c(){e=S(t[2]),l=S(" hours")},m(n,i){$(n,e,i),$(n,l,i)},p(n,i){i&4&&X(e,n[2])},d(n){n&&C(e),n&&C(l)}}}function P1(t){let e,l;return{c(){e=S(t[1]),l=S(" day")},m(n,i){$(n,e,i),$(n,l,i)},p(n,i){i&2&&X(e,n[1])},d(n){n&&C(e),n&&C(l)}}}function E1(t){let e,l;return{c(){e=S(t[1]),l=S(" days")},m(n,i){$(n,e,i),$(n,l,i)},p(n,i){i&2&&X(e,n[1])},d(n){n&&C(e),n&&C(l)}}}function D1(t){let e,l=t[0]&&tu(t);return{c(){l&&l.c(),e=Ve()},m(n,i){l&&l.m(n,i),$(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=tu(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:fe,o:fe,d(n){l&&l.d(n),n&&C(e)}}}function I1(t,e,l){let{epoch:n}=e,i=0,o=0,u=0;return t.$$set=a=>{"epoch"in a&&l(0,n=a.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(l(1,i=Math.floor(n/86400)),l(2,o=Math.floor(n/3600)),l(3,u=Math.floor(n/60)))},[n,i,o,u]}class R1 extends Ee{constructor(e){super(),Pe(this,e,I1,D1,Ne,{epoch:0})}}function L1(t){let e,l,n;return{c(){e=m("span"),l=S(t[2]),r(e,"title",t[1]),r(e,"class",n="bd-"+t[0])},m(i,o){$(i,e,o),s(e,l)},p(i,[o]){o&4&&X(l,i[2]),o&2&&r(e,"title",i[1]),o&1&&n!==(n="bd-"+i[0])&&r(e,"class",n)},i:fe,o:fe,d(i){i&&C(e)}}}function O1(t,e,l){let{color:n}=e,{title:i}=e,{text:o}=e;return t.$$set=u=>{"color"in u&&l(0,n=u.color),"title"in u&&l(1,i=u.title),"text"in u&&l(2,o=u.text)},[n,i,o]}class fn extends Ee{constructor(e){super(),Pe(this,e,O1,L1,Ne,{color:0,title:1,text:2})}}function F1(t){let e,l=`${Oe(t[0].getDate())}.${Oe(t[0].getMonth()+1)}.${t[0].getFullYear()} ${Oe(t[0].getHours())}:${Oe(t[0].getMinutes())}`,n;return{c(){e=m("span"),n=S(l),r(e,"class",t[1])},m(i,o){$(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=`${Oe(i[0].getDate())}.${Oe(i[0].getMonth()+1)}.${i[0].getFullYear()} ${Oe(i[0].getHours())}:${Oe(i[0].getMinutes())}`)&&X(n,l),o&2&&r(e,"class",i[1])},d(i){i&&C(e)}}}function q1(t){let e=`${Oe(t[0].getDate())}. ${no[t[0].getMonth()]} ${Oe(t[0].getHours())}:${Oe(t[0].getMinutes())}`,l;return{c(){l=S(e)},m(n,i){$(n,l,i)},p(n,i){i&1&&e!==(e=`${Oe(n[0].getDate())}. ${no[n[0].getMonth()]} ${Oe(n[0].getHours())}:${Oe(n[0].getMinutes())}`)&&X(l,e)},d(n){n&&C(l)}}}function B1(t){let e;function l(o,u){return o[2]?q1:F1}let n=l(t),i=n(t);return{c(){i.c(),e=Ve()},m(o,u){i.m(o,u),$(o,e,u)},p(o,[u]){n===(n=l(o))&&i?i.p(o,u):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},i:fe,o:fe,d(o){i.d(o),o&&C(e)}}}function U1(t,e,l){let{timestamp:n}=e,{fullTimeColor:i}=e,{offset:o}=e,u;return t.$$set=a=>{"timestamp"in a&&l(0,n=a.timestamp),"fullTimeColor"in a&&l(1,i=a.fullTimeColor),"offset"in a&&l(3,o=a.offset)},t.$$.update=()=>{t.$$.dirty&9&&(l(2,u=Math.abs(new Date().getTime()-n.getTime())<3e5),isNaN(o)||fl(n,o-(24+n.getHours()-n.getUTCHours())%24))},[n,i,u,o]}class Gc extends Ee{constructor(e){super(),Pe(this,e,U1,B1,Ne,{timestamp:0,fullTimeColor:1,offset:3})}}function j1(t){let e,l,n;return{c(){e=Fe("svg"),l=Fe("path"),n=Fe("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 011.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 01-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.397.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 01-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.505-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.107-1.204l-.527-.738a1.125 1.125 0 01.12-1.45l.773-.773a1.125 1.125 0 011.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894z"),r(n,"stroke-linecap","round"),r(n,"stroke-linejoin","round"),r(n,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(i,o){$(i,e,o),s(e,l),s(e,n)},p:fe,i:fe,o:fe,d(i){i&&C(e)}}}class H1 extends Ee{constructor(e){super(),Pe(this,e,null,j1,Ne,{})}}function W1(t){let e,l;return{c(){e=Fe("svg"),l=Fe("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(n,i){$(n,e,i),s(e,l)},p:fe,i:fe,o:fe,d(n){n&&C(e)}}}class z1 extends Ee{constructor(e){super(),Pe(this,e,null,W1,Ne,{})}}function G1(t){let e,l;return{c(){e=Fe("svg"),l=Fe("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(n,i){$(n,e,i),s(e,l)},p:fe,i:fe,o:fe,d(n){n&&C(e)}}}class Bt extends Ee{constructor(e){super(),Pe(this,e,null,G1,Ne,{})}}function V1(t){let e,l;return{c(){e=Fe("svg"),l=Fe("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M9 8.25H7.5a2.25 2.25 0 00-2.25 2.25v9a2.25 2.25 0 002.25 2.25h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25H15M9 12l3 3m0 0l3-3m-3 3V2.25"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(n,i){$(n,e,i),s(e,l)},p:fe,i:fe,o:fe,d(n){n&&C(e)}}}class Vc extends Ee{constructor(e){super(),Pe(this,e,null,V1,Ne,{})}}function K1(t){let e,l,n=t[1].version+"",i;return{c(){e=S("AMS reader "),l=m("span"),i=S(n)},m(o,u){$(o,e,u),$(o,l,u),s(l,i)},p(o,u){u&2&&n!==(n=o[1].version+"")&&X(i,n)},d(o){o&&C(e),o&&C(l)}}}function lu(t){let e,l=(t[0].t>-50?t[0].t.toFixed(1):"-")+"",n,i;return{c(){e=m("div"),n=S(l),i=S("\xB0C"),r(e,"class","flex-none my-auto")},m(o,u){$(o,e,u),s(e,n),s(e,i)},p(o,u){u&1&&l!==(l=(o[0].t>-50?o[0].t.toFixed(1):"-")+"")&&X(n,l)},d(o){o&&C(e)}}}function nu(t){let e,l="HAN: "+Ya(t[0].he),n;return{c(){e=m("div"),n=S(l),r(e,"class","bd-red")},m(i,o){$(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="HAN: "+Ya(i[0].he))&&X(n,l)},d(i){i&&C(e)}}}function iu(t){let e,l="MQTT: "+Qa(t[0].me),n;return{c(){e=m("div"),n=S(l),r(e,"class","bd-red")},m(i,o){$(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="MQTT: "+Qa(i[0].me))&&X(n,l)},d(i){i&&C(e)}}}function su(t){let e,l="PriceAPI: "+Xa(t[0].ee),n;return{c(){e=m("div"),n=S(l),r(e,"class","bd-red")},m(i,o){$(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="PriceAPI: "+Xa(i[0].ee))&&X(n,l)},d(i){i&&C(e)}}}function ou(t){let e,l,n,i,o,u;return l=new el({props:{to:"/configuration",$$slots:{default:[Y1]},$$scope:{ctx:t}}}),o=new el({props:{to:"/status",$$slots:{default:[Q1]},$$scope:{ctx:t}}}),{c(){e=m("div"),ie(l.$$.fragment),n=h(),i=m("div"),ie(o.$$.fragment),r(e,"class","flex-none px-1 mt-1"),r(e,"title","Configuration"),r(i,"class","flex-none px-1 mt-1"),r(i,"title","Device information")},m(a,c){$(a,e,c),le(l,e,null),$(a,n,c),$(a,i,c),le(o,i,null),u=!0},i(a){u||(D(l.$$.fragment,a),D(o.$$.fragment,a),u=!0)},o(a){q(l.$$.fragment,a),q(o.$$.fragment,a),u=!1},d(a){a&&C(e),ne(l),a&&C(n),a&&C(i),ne(o)}}}function Y1(t){let e,l;return e=new H1({}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function Q1(t){let e,l;return e=new z1({}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function ru(t){let e,l,n,i,o;const u=[Z1,X1],a=[];function c(f,_){return f[1].security==0||f[0].a?0:1}return l=c(t),n=a[l]=u[l](t),{c(){e=m("div"),n.c(),r(e,"class","flex-none mr-3 text-yellow-500"),r(e,"title",i="New version: "+t[2].tag_name)},m(f,_){$(f,e,_),a[l].m(e,null),o=!0},p(f,_){let p=l;l=c(f),l===p?a[l].p(f,_):(De(),q(a[p],1,1,()=>{a[p]=null}),Ie(),n=a[l],n?n.p(f,_):(n=a[l]=u[l](f),n.c()),D(n,1),n.m(e,null)),(!o||_&4&&i!==(i="New version: "+f[2].tag_name))&&r(e,"title",i)},i(f){o||(D(n),o=!0)},o(f){q(n),o=!1},d(f){f&&C(e),a[l].d()}}}function X1(t){let e,l,n=t[2].tag_name+"",i;return{c(){e=m("span"),l=S("New version: "),i=S(n)},m(o,u){$(o,e,u),s(e,l),s(e,i)},p(o,u){u&4&&n!==(n=o[2].tag_name+"")&&X(i,n)},i:fe,o:fe,d(o){o&&C(e)}}}function Z1(t){let e,l,n,i=t[2].tag_name+"",o,u,a,c,f,_;return a=new Vc({}),{c(){e=m("button"),l=m("span"),n=S("New version: "),o=S(i),u=h(),ie(a.$$.fragment),r(l,"class","mt-1"),r(e,"class","flex")},m(p,b){$(p,e,b),s(e,l),s(l,n),s(l,o),s(e,u),le(a,e,null),c=!0,f||(_=ee(e,"click",t[3]),f=!0)},p(p,b){(!c||b&4)&&i!==(i=p[2].tag_name+"")&&X(o,i)},i(p){c||(D(a.$$.fragment,p),c=!0)},o(p){q(a.$$.fragment,p),c=!1},d(p){p&&C(e),ne(a),f=!1,_()}}}function J1(t){let e,l,n,i,o,u,a,c,f,_,p,b,v=(t[0].m?(t[0].m/1e3).toFixed(1):"-")+"",d,M,y,T,N,E,B,P,L,O,F,x,j,z,G,V,W,U,K,H,Y,Z,re,ue,ke,me,Se,je,Re,He;i=new el({props:{to:"/",$$slots:{default:[K1]},$$scope:{ctx:t}}}),c=new R1({props:{epoch:t[0].u}});let we=t[0].t>-50&&lu(t);N=new fn({props:{title:"ESP",text:t[1].booting?"Booting":t[0].v>2?t[0].v.toFixed(2)+"V":"ESP",color:ql(t[1].booting?2:t[0].em)}}),B=new fn({props:{title:"HAN",text:"HAN",color:ql(t[1].booting?9:t[0].hm)}}),L=new fn({props:{title:"WiFi",text:t[0].r?t[0].r.toFixed(0)+"dBm":"WiFi",color:ql(t[1].booting?9:t[0].wm)}}),F=new fn({props:{title:"MQTT",text:"MQTT",color:ql(t[1].booting?9:t[0].mm)}});let Te=(t[0].he<0||t[0].he>0)&&nu(t),Le=t[0].me<0&&iu(t),$e=(t[0].ee>0||t[0].ee<0)&&su(t);re=new Gc({props:{timestamp:t[0].c?new Date(t[0].c*1e3):new Date(0),offset:t[1].clock_offset,fullTimeColor:"text-red-500"}});let w=t[1].vndcfg&&t[1].usrcfg&&ou(t);je=new Bt({});let g=t[1].fwconsent===1&&t[2]&&ru(t);return{c(){e=m("nav"),l=m("div"),n=m("div"),ie(i.$$.fragment),o=h(),u=m("div"),a=m("div"),ie(c.$$.fragment),f=h(),we&&we.c(),_=h(),p=m("div"),b=S("Free mem: "),d=S(v),M=S("kb"),y=h(),T=m("div"),ie(N.$$.fragment),E=h(),ie(B.$$.fragment),P=h(),ie(L.$$.fragment),O=h(),ie(F.$$.fragment),x=h(),Te&&Te.c(),j=h(),Le&&Le.c(),z=h(),$e&&$e.c(),G=h(),V=m("div"),W=m("div"),U=m("a"),K=m("img"),Y=h(),Z=m("div"),ie(re.$$.fragment),ue=h(),w&&w.c(),ke=h(),me=m("div"),Se=m("a"),ie(je.$$.fragment),Re=h(),g&&g.c(),r(n,"class","flex text-lg text-gray-100 p-2"),r(a,"class","flex-none my-auto"),r(p,"class","flex-none my-auto"),r(u,"class","flex-none my-auto p-2 flex space-x-4"),r(T,"class","flex-auto flex-wrap my-auto justify-center p-2"),r(K,"class","gh-logo"),Js(K.src,H=$1)||r(K,"src",H),r(K,"alt","GitHub repo"),r(U,"class","float-right"),r(U,"href","https://github.com/UtilitechAS/amsreader-firmware"),r(U,"target","_blank"),r(U,"rel","noreferrer"),r(U,"aria-label","GitHub"),r(W,"class","flex-none"),r(Z,"class","flex-none my-auto px-2"),r(Se,"href",Ut("")),r(Se,"target","_blank"),r(Se,"rel","noreferrer"),r(me,"class","flex-none px-1 mt-1"),r(me,"title","Documentation"),r(V,"class","flex-auto p-2 flex flex-row-reverse flex-wrap"),r(l,"class","flex flex-wrap space-x-4 text-sm text-gray-300"),r(e,"class","bg-violet-600 p-1 rounded-md mx-2")},m(k,A){$(k,e,A),s(e,l),s(l,n),le(i,n,null),s(l,o),s(l,u),s(u,a),le(c,a,null),s(u,f),we&&we.m(u,null),s(u,_),s(u,p),s(p,b),s(p,d),s(p,M),s(l,y),s(l,T),le(N,T,null),s(T,E),le(B,T,null),s(T,P),le(L,T,null),s(T,O),le(F,T,null),s(l,x),Te&&Te.m(l,null),s(l,j),Le&&Le.m(l,null),s(l,z),$e&&$e.m(l,null),s(l,G),s(l,V),s(V,W),s(W,U),s(U,K),s(V,Y),s(V,Z),le(re,Z,null),s(V,ue),w&&w.m(V,null),s(V,ke),s(V,me),s(me,Se),le(je,Se,null),s(V,Re),g&&g.m(V,null),He=!0},p(k,[A]){const I={};A&18&&(I.$$scope={dirty:A,ctx:k}),i.$set(I);const Q={};A&1&&(Q.epoch=k[0].u),c.$set(Q),k[0].t>-50?we?we.p(k,A):(we=lu(k),we.c(),we.m(u,_)):we&&(we.d(1),we=null),(!He||A&1)&&v!==(v=(k[0].m?(k[0].m/1e3).toFixed(1):"-")+"")&&X(d,v);const J={};A&3&&(J.text=k[1].booting?"Booting":k[0].v>2?k[0].v.toFixed(2)+"V":"ESP"),A&3&&(J.color=ql(k[1].booting?2:k[0].em)),N.$set(J);const se={};A&3&&(se.color=ql(k[1].booting?9:k[0].hm)),B.$set(se);const ce={};A&1&&(ce.text=k[0].r?k[0].r.toFixed(0)+"dBm":"WiFi"),A&3&&(ce.color=ql(k[1].booting?9:k[0].wm)),L.$set(ce);const ve={};A&3&&(ve.color=ql(k[1].booting?9:k[0].mm)),F.$set(ve),k[0].he<0||k[0].he>0?Te?Te.p(k,A):(Te=nu(k),Te.c(),Te.m(l,j)):Te&&(Te.d(1),Te=null),k[0].me<0?Le?Le.p(k,A):(Le=iu(k),Le.c(),Le.m(l,z)):Le&&(Le.d(1),Le=null),k[0].ee>0||k[0].ee<0?$e?$e.p(k,A):($e=su(k),$e.c(),$e.m(l,G)):$e&&($e.d(1),$e=null);const Me={};A&1&&(Me.timestamp=k[0].c?new Date(k[0].c*1e3):new Date(0)),A&2&&(Me.offset=k[1].clock_offset),re.$set(Me),k[1].vndcfg&&k[1].usrcfg?w?A&2&&D(w,1):(w=ou(k),w.c(),D(w,1),w.m(V,ke)):w&&(De(),q(w,1,1,()=>{w=null}),Ie()),k[1].fwconsent===1&&k[2]?g?(g.p(k,A),A&6&&D(g,1)):(g=ru(k),g.c(),D(g,1),g.m(V,null)):g&&(De(),q(g,1,1,()=>{g=null}),Ie())},i(k){He||(D(i.$$.fragment,k),D(c.$$.fragment,k),D(N.$$.fragment,k),D(B.$$.fragment,k),D(L.$$.fragment,k),D(F.$$.fragment,k),D(re.$$.fragment,k),D(w),D(je.$$.fragment,k),D(g),He=!0)},o(k){q(i.$$.fragment,k),q(c.$$.fragment,k),q(N.$$.fragment,k),q(B.$$.fragment,k),q(L.$$.fragment,k),q(F.$$.fragment,k),q(re.$$.fragment,k),q(w),q(je.$$.fragment,k),q(g),He=!1},d(k){k&&C(e),ne(i),ne(c),we&&we.d(),ne(N),ne(B),ne(L),ne(F),Te&&Te.d(),Le&&Le.d(),$e&&$e.d(),ne(re),w&&w.d(),ne(je),g&&g.d()}}}function x1(t,e,l){let{data:n={}}=e,i={},o={};function u(){confirm("Do you want to upgrade this device to "+o.tag_name+"?")&&(!ri(i.board)||confirm($s(be(i.chip,i.board))))&&(jt.update(a=>(a.upgrading=!0,a)),Wc(o.tag_name))}return jt.subscribe(a=>{l(1,i=a),a.fwconsent===1&&C1()}),So.subscribe(a=>{l(2,o=zc(i.version,a))}),t.$$set=a=>{"data"in a&&l(0,n=a.data)},[n,i,o,u]}class em extends Ee{constructor(e){super(),Pe(this,e,x1,J1,Ne,{data:0})}}function tm(t){let e,l,n,i;return{c(){e=Fe("svg"),l=Fe("path"),n=Fe("path"),r(l,"d",Zs(150,150,115,210,510)),r(l,"stroke","#eee"),r(l,"fill","none"),r(l,"stroke-width","55"),r(n,"d",i=Zs(150,150,115,210,210+300*t[0]/100)),r(n,"stroke",t[1]),r(n,"fill","none"),r(n,"stroke-width","55"),r(e,"viewBox","0 0 300 300"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"height","100%")},m(o,u){$(o,e,u),s(e,l),s(e,n)},p(o,[u]){u&1&&i!==(i=Zs(150,150,115,210,210+300*o[0]/100))&&r(n,"d",i),u&2&&r(n,"stroke",o[1])},i:fe,o:fe,d(o){o&&C(e)}}}function au(t,e,l,n){var i=(n-90)*Math.PI/180;return{x:t+l*Math.cos(i),y:e+l*Math.sin(i)}}function Zs(t,e,l,n,i){var o=au(t,e,l,i),u=au(t,e,l,n),a=i-n<=180?"0":"1",c=["M",o.x,o.y,"A",l,l,0,a,0,u.x,u.y].join(" ");return c}function lm(t,e,l){let{pct:n=0}=e,{color:i="red"}=e;return t.$$set=o=>{"pct"in o&&l(0,n=o.pct),"color"in o&&l(1,i=o.color)},[n,i]}class nm extends Ee{constructor(e){super(),Pe(this,e,lm,tm,Ne,{pct:0,color:1})}}function uu(t){let e,l,n,i,o,u,a,c;return{c(){e=m("br"),l=h(),n=m("span"),i=S(t[3]),o=h(),u=m("span"),a=S(t[4]),c=S("/kWh"),r(n,"class","pl-sub"),r(u,"class","pl-snt")},m(f,_){$(f,e,_),$(f,l,_),$(f,n,_),s(n,i),$(f,o,_),$(f,u,_),s(u,a),s(u,c)},p(f,_){_&8&&X(i,f[3]),_&16&&X(a,f[4])},d(f){f&&C(e),f&&C(l),f&&C(n),f&&C(o),f&&C(u)}}}function im(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,M,y;l=new nm({props:{pct:t[6],color:t[5](t[6])}});let T=t[3]&&uu(t);return{c(){e=m("div"),ie(l.$$.fragment),n=h(),i=m("span"),o=m("span"),u=S(t[2]),a=h(),c=m("br"),f=h(),_=m("span"),p=S(t[0]),b=h(),v=m("span"),d=S(t[1]),M=h(),T&&T.c(),r(o,"class","pl-lab"),r(_,"class","pl-val"),r(v,"class","pl-unt"),r(i,"class","pl-ov"),r(e,"class","pl-root")},m(N,E){$(N,e,E),le(l,e,null),s(e,n),s(e,i),s(i,o),s(o,u),s(i,a),s(i,c),s(i,f),s(i,_),s(_,p),s(i,b),s(i,v),s(v,d),s(i,M),T&&T.m(i,null),y=!0},p(N,[E]){const B={};E&64&&(B.pct=N[6]),E&96&&(B.color=N[5](N[6])),l.$set(B),(!y||E&4)&&X(u,N[2]),(!y||E&1)&&X(p,N[0]),(!y||E&2)&&X(d,N[1]),N[3]?T?T.p(N,E):(T=uu(N),T.c(),T.m(i,null)):T&&(T.d(1),T=null)},i(N){y||(D(l.$$.fragment,N),y=!0)},o(N){q(l.$$.fragment,N),y=!1},d(N){N&&C(e),ne(l),T&&T.d()}}}function sm(t,e,l){let{val:n}=e,{max:i}=e,{unit:o}=e,{label:u}=e,{sub:a=""}=e,{subunit:c=""}=e,{colorFn:f}=e,_=0;return t.$$set=p=>{"val"in p&&l(0,n=p.val),"max"in p&&l(7,i=p.max),"unit"in p&&l(1,o=p.unit),"label"in p&&l(2,u=p.label),"sub"in p&&l(3,a=p.sub),"subunit"in p&&l(4,c=p.subunit),"colorFn"in p&&l(5,f=p.colorFn)},t.$$.update=()=>{t.$$.dirty&129&&l(6,_=Math.min(n,i)/i*100)},[n,o,u,a,c,f,_,i]}class Kc extends Ee{constructor(e){super(),Pe(this,e,sm,im,Ne,{val:0,max:7,unit:1,label:2,sub:3,subunit:4,colorFn:5})}}function fu(t,e,l){const n=t.slice();return n[9]=e[l],n[11]=l,n}function cu(t,e,l){const n=t.slice();return n[9]=e[l],n[11]=l,n}function mu(t,e,l){const n=t.slice();return n[13]=e[l],n}function pu(t){let e,l,n,i,o,u,a=t[0].title&&_u(t),c=t[0].y.ticks,f=[];for(let d=0;d20||t[11]%2==0)&&bu(t);return{c(){e=Fe("g"),n&&n.c(),r(e,"class","tick"),r(e,"transform",l="translate("+t[5](t[11])+","+t[4]+")")},m(i,o){$(i,e,o),n&&n.m(e,null)},p(i,o){i[3]>20||i[11]%2==0?n?n.p(i,o):(n=bu(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o&48&&l!==(l="translate("+i[5](i[11])+","+i[4]+")")&&r(e,"transform",l)},d(i){i&&C(e),n&&n.d()}}}function bu(t){let e,l=t[9].label+"",n,i;return{c(){e=Fe("text"),n=S(l),r(e,"x",i=t[3]/2),r(e,"y","-4")},m(o,u){$(o,e,u),s(e,n)},p(o,u){u&1&&l!==(l=o[9].label+"")&&X(n,l),u&8&&i!==(i=o[3]/2)&&r(e,"x",i)},d(o){o&&C(e)}}}function gu(t){let e=!isNaN(t[5](t[11])),l,n=e&&hu(t);return{c(){n&&n.c(),l=Ve()},m(i,o){n&&n.m(i,o),$(i,l,o)},p(i,o){o&32&&(e=!isNaN(i[5](i[11]))),e?n?n.p(i,o):(n=hu(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&C(l)}}}function ku(t){let e,l,n=t[9].value!==void 0&&wu(t),i=t[9].value2>1e-4&&$u(t);return{c(){e=Fe("g"),n&&n.c(),l=Fe("g"),i&&i.c()},m(o,u){$(o,e,u),n&&n.m(e,null),$(o,l,u),i&&i.m(l,null)},p(o,u){o[9].value!==void 0?n?n.p(o,u):(n=wu(o),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o[9].value2>1e-4?i?i.p(o,u):(i=$u(o),i.c(),i.m(l,null)):i&&(i.d(1),i=null)},d(o){o&&C(e),n&&n.d(),o&&C(l),i&&i.d()}}}function wu(t){let e,l,n,i,o,u,a,c=t[3]>15&&yu(t);return{c(){e=Fe("rect"),c&&c.c(),a=Ve(),r(e,"x",l=t[5](t[11])+2),r(e,"y",n=t[6](t[9].value)),r(e,"width",i=t[3]-4),r(e,"height",o=t[6](t[0].y.min)-t[6](Math.min(t[0].y.min,0)+t[9].value)),r(e,"fill",u=t[9].color)},m(f,_){$(f,e,_),c&&c.m(f,_),$(f,a,_)},p(f,_){_&32&&l!==(l=f[5](f[11])+2)&&r(e,"x",l),_&65&&n!==(n=f[6](f[9].value))&&r(e,"y",n),_&8&&i!==(i=f[3]-4)&&r(e,"width",i),_&65&&o!==(o=f[6](f[0].y.min)-f[6](Math.min(f[0].y.min,0)+f[9].value))&&r(e,"height",o),_&1&&u!==(u=f[9].color)&&r(e,"fill",u),f[3]>15?c?c.p(f,_):(c=yu(f),c.c(),c.m(a.parentNode,a)):c&&(c.d(1),c=null)},d(f){f&&C(e),c&&c.d(f),f&&C(a)}}}function yu(t){let e,l=t[9].label+"",n,i,o,u,a,c,f=t[9].title&&Cu(t);return{c(){e=Fe("text"),n=S(l),f&&f.c(),c=Ve(),r(e,"width",i=t[3]-4),r(e,"dominant-baseline","middle"),r(e,"text-anchor",o=t[3]t[6](0)-t[7]?t[9].color:"white"),r(e,"transform",a="translate("+(t[5](t[11])+t[3]/2)+" "+(t[6](t[9].value)>t[6](0)-t[7]?t[6](t[9].value)-t[7]:t[6](t[9].value)+10)+") rotate("+(t[3]_[6](0)-_[7]?_[9].color:"white")&&r(e,"fill",u),p&233&&a!==(a="translate("+(_[5](_[11])+_[3]/2)+" "+(_[6](_[9].value)>_[6](0)-_[7]?_[6](_[9].value)-_[7]:_[6](_[9].value)+10)+") rotate("+(_[3]15&&Mu(t);return{c(){e=Fe("rect"),c&&c.c(),a=Ve(),r(e,"x",l=t[5](t[11])+2),r(e,"y",n=t[6](0)),r(e,"width",i=t[3]-4),r(e,"height",o=t[6](t[0].y.min)-t[6](t[0].y.min+t[9].value2)),r(e,"fill",u=t[9].color2?t[9].color2:t[9].color)},m(f,_){$(f,e,_),c&&c.m(f,_),$(f,a,_)},p(f,_){_&32&&l!==(l=f[5](f[11])+2)&&r(e,"x",l),_&64&&n!==(n=f[6](0))&&r(e,"y",n),_&8&&i!==(i=f[3]-4)&&r(e,"width",i),_&65&&o!==(o=f[6](f[0].y.min)-f[6](f[0].y.min+f[9].value2))&&r(e,"height",o),_&1&&u!==(u=f[9].color2?f[9].color2:f[9].color)&&r(e,"fill",u),f[3]>15?c?c.p(f,_):(c=Mu(f),c.c(),c.m(a.parentNode,a)):c&&(c.d(1),c=null)},d(f){f&&C(e),c&&c.d(f),f&&C(a)}}}function Mu(t){let e,l=t[9].label2+"",n,i,o,u,a,c=t[9].title2&&Su(t);return{c(){e=Fe("text"),n=S(l),c&&c.c(),a=Ve(),r(e,"width",i=t[3]-4),r(e,"dominant-baseline","middle"),r(e,"text-anchor","middle"),r(e,"fill",o=t[6](-t[9].value2)t[8].call(e))},m(i,o){$(i,e,o),n&&n.m(e,null),l=o0(e,t[8].bind(e))},p(i,[o]){i[0].x.ticks&&i[0].points&&i[4]?n?n.p(i,o):(n=pu(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},i:fe,o:fe,d(i){i&&C(e),n&&n.d(),l()}}}let cn=30;function rm(t,e,l){let{config:n}=e,i,o,u,a,c,f,_;function p(){i=this.clientWidth,o=this.clientHeight,l(1,i),l(2,o)}return t.$$set=b=>{"config"in b&&l(0,n=b.config)},t.$$.update=()=>{if(t.$$.dirty&31){l(4,f=o-(n.title?20:0));let b=i-(n.padding.left+n.padding.right);l(3,u=b/n.points.length),l(7,_=un.y.max?M=n.padding.bottom:df||M<0?0:M})}},[n,i,o,u,f,a,c,_,p]}class pn extends Ee{constructor(e){super(),Pe(this,e,rm,om,Ne,{config:0})}}function am(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function um(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{ds:u}=e,a={};function c(f){return{label:ge(f)+"V",title:f.toFixed(1)+" V",value:isNaN(f)?0:f,color:g1(f||0)}}return t.$$set=f=>{"u1"in f&&l(1,n=f.u1),"u2"in f&&l(2,i=f.u2),"u3"in f&&l(3,o=f.u3),"ds"in f&&l(4,u=f.ds)},t.$$.update=()=>{if(t.$$.dirty&30){let f=[],_=[];n>0&&(f.push({label:u===1?"L1-L2":"L1"}),_.push(c(n))),i>0&&(f.push({label:u===1?"L1-L3":"L2"}),_.push(c(i))),o>0&&(f.push({label:u===1?"L2-L3":"L3"}),_.push(c(o))),l(0,a={title:"Voltage",padding:{top:20,right:15,bottom:20,left:35},y:{min:200,max:260,ticks:[{value:207,label:"-10%"},{value:230,label:"230v"},{value:253,label:"+10%"}]},x:{ticks:f},points:_})}},[a,n,i,o,u]}class fm extends Ee{constructor(e){super(),Pe(this,e,um,am,Ne,{u1:1,u2:2,u3:3,ds:4})}}function cm(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function mm(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{i1:u}=e,{i2:a}=e,{i3:c}=e,{max:f}=e,_={};function p(b){return{label:ge(b)+"A",title:b.toFixed(1)+" A",value:isNaN(b)?0:b,color:Rc(b?b/f*100:0)}}return t.$$set=b=>{"u1"in b&&l(1,n=b.u1),"u2"in b&&l(2,i=b.u2),"u3"in b&&l(3,o=b.u3),"i1"in b&&l(4,u=b.i1),"i2"in b&&l(5,a=b.i2),"i3"in b&&l(6,c=b.i3),"max"in b&&l(7,f=b.max)},t.$$.update=()=>{if(t.$$.dirty&254){let b=[],v=[];n>0&&(b.push({label:"L1"}),v.push(p(u))),i>0&&(b.push({label:"L2"}),v.push(p(a))),o>0&&(b.push({label:"L3"}),v.push(p(c))),l(0,_={title:"Amperage",padding:{top:20,right:15,bottom:20,left:35},y:{min:0,max:f,ticks:[{value:0,label:"0%"},{value:f/4,label:"25%"},{value:f/2,label:"50%"},{value:f/4*3,label:"75%"},{value:f,label:"100%"}]},x:{ticks:b},points:v})}},[_,n,i,o,u,a,c,f]}class pm extends Ee{constructor(e){super(),Pe(this,e,mm,cm,Ne,{u1:1,u2:2,u3:3,i1:4,i2:5,i3:6,max:7})}}function _m(t){let e,l,n,i,o,u,a,c=(typeof t[0]<"u"?t[0].toFixed(0):"-")+"",f,_,p,b,v,d,M=(typeof t[1]<"u"?t[1].toFixed(0):"-")+"",y,T,N,E,B,P,L,O=(typeof t[2]<"u"?t[2].toFixed(1):"-")+"",F,x,j,z,G,V,W=(typeof t[3]<"u"?t[3].toFixed(1):"-")+"",U,K;return{c(){e=m("div"),l=m("strong"),l.textContent="Reactive",n=h(),i=m("div"),o=m("div"),o.textContent="Instant in",u=h(),a=m("div"),f=S(c),_=S(" VAr"),p=h(),b=m("div"),b.textContent="Instant out",v=h(),d=m("div"),y=S(M),T=S(" VAr"),N=h(),E=m("div"),B=m("div"),B.textContent="Total in",P=h(),L=m("div"),F=S(O),x=S(" kVArh"),j=h(),z=m("div"),z.textContent="Total out",G=h(),V=m("div"),U=S(W),K=S(" kVArh"),r(a,"class","text-right"),r(d,"class","text-right"),r(i,"class","grid grid-cols-2 mt-4"),r(L,"class","text-right"),r(V,"class","text-right"),r(E,"class","grid grid-cols-2 mt-4"),r(e,"class","mx-2 text-sm")},m(H,Y){$(H,e,Y),s(e,l),s(e,n),s(e,i),s(i,o),s(i,u),s(i,a),s(a,f),s(a,_),s(i,p),s(i,b),s(i,v),s(i,d),s(d,y),s(d,T),s(e,N),s(e,E),s(E,B),s(E,P),s(E,L),s(L,F),s(L,x),s(E,j),s(E,z),s(E,G),s(E,V),s(V,U),s(V,K)},p(H,[Y]){Y&1&&c!==(c=(typeof H[0]<"u"?H[0].toFixed(0):"-")+"")&&X(f,c),Y&2&&M!==(M=(typeof H[1]<"u"?H[1].toFixed(0):"-")+"")&&X(y,M),Y&4&&O!==(O=(typeof H[2]<"u"?H[2].toFixed(1):"-")+"")&&X(F,O),Y&8&&W!==(W=(typeof H[3]<"u"?H[3].toFixed(1):"-")+"")&&X(U,W)},i:fe,o:fe,d(H){H&&C(e)}}}function dm(t,e,l){let{importInstant:n}=e,{exportInstant:i}=e,{importTotal:o}=e,{exportTotal:u}=e;return t.$$set=a=>{"importInstant"in a&&l(0,n=a.importInstant),"exportInstant"in a&&l(1,i=a.exportInstant),"importTotal"in a&&l(2,o=a.importTotal),"exportTotal"in a&&l(3,u=a.exportTotal)},[n,i,o,u]}class vm extends Ee{constructor(e){super(),Pe(this,e,dm,_m,Ne,{importInstant:0,exportInstant:1,importTotal:2,exportTotal:3})}}function Nu(t){let e;function l(o,u){return o[3]?bm:hm}let n=l(t),i=n(t);return{c(){i.c(),e=Ve()},m(o,u){i.m(o,u),$(o,e,u)},p(o,u){n===(n=l(o))&&i?i.p(o,u):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){i.d(o),o&&C(e)}}}function hm(t){let e,l,n,i,o,u,a=ge(t[1].h.u,2)+"",c,f,_,p,b,v,d=ge(t[1].d.u,1)+"",M,y,T,N,E,B,P=ge(t[1].m.u)+"",L,O,F,x,j,z,G=ge(t[0].last_month.u)+"",V,W,U,K,H=t[4]&&Au(t);return{c(){e=m("strong"),e.textContent="Consumption",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",o=h(),u=m("div"),c=S(a),f=S(" kWh"),_=h(),p=m("div"),p.textContent="Day",b=h(),v=m("div"),M=S(d),y=S(" kWh"),T=h(),N=m("div"),N.textContent="Month",E=h(),B=m("div"),L=S(P),O=S(" kWh"),F=h(),x=m("div"),x.textContent="Last month",j=h(),z=m("div"),V=S(G),W=S(" kWh"),U=h(),H&&H.c(),K=Ve(),r(u,"class","text-right"),r(v,"class","text-right"),r(B,"class","text-right"),r(z,"class","text-right"),r(n,"class","grid grid-cols-2 mb-3")},m(Y,Z){$(Y,e,Z),$(Y,l,Z),$(Y,n,Z),s(n,i),s(n,o),s(n,u),s(u,c),s(u,f),s(n,_),s(n,p),s(n,b),s(n,v),s(v,M),s(v,y),s(n,T),s(n,N),s(n,E),s(n,B),s(B,L),s(B,O),s(n,F),s(n,x),s(n,j),s(n,z),s(z,V),s(z,W),$(Y,U,Z),H&&H.m(Y,Z),$(Y,K,Z)},p(Y,Z){Z&2&&a!==(a=ge(Y[1].h.u,2)+"")&&X(c,a),Z&2&&d!==(d=ge(Y[1].d.u,1)+"")&&X(M,d),Z&2&&P!==(P=ge(Y[1].m.u)+"")&&X(L,P),Z&1&&G!==(G=ge(Y[0].last_month.u)+"")&&X(V,G),Y[4]?H?H.p(Y,Z):(H=Au(Y),H.c(),H.m(K.parentNode,K)):H&&(H.d(1),H=null)},d(Y){Y&&C(e),Y&&C(l),Y&&C(n),Y&&C(U),H&&H.d(Y),Y&&C(K)}}}function bm(t){let e,l,n,i,o,u,a=ge(t[1].h.u,2)+"",c,f,_,p,b,v,d,M=ge(t[1].d.u,1)+"",y,T,N,E,B,P,L,O=ge(t[1].m.u)+"",F,x,j,z,G,V,W,U=ge(t[0].last_month.u)+"",K,H,Y,Z,re,ue,ke,me,Se,je,Re,He=ge(t[1].h.p,2)+"",we,Te,Le,$e,w,g,k,A=ge(t[1].d.p,1)+"",I,Q,J,se,ce,ve,Me,oe=ge(t[1].m.p)+"",pe,Be,_e,ye,vt,Hl,tl,ct=ge(t[0].last_month.p)+"",Tl,pl,Ht,ht,Qe=t[4]&&Pu(t),Xe=t[4]&&Eu(t),Ze=t[4]&&Du(t),Ue=t[4]&&Iu(t),Je=t[4]&&Ru(t),We=t[4]&&Lu(t),xe=t[4]&&Ou(t),et=t[4]&&Fu(t);return{c(){e=m("strong"),e.textContent="Import",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",o=h(),u=m("div"),c=S(a),f=S(" kWh"),_=h(),Qe&&Qe.c(),p=h(),b=m("div"),b.textContent="Day",v=h(),d=m("div"),y=S(M),T=S(" kWh"),N=h(),Xe&&Xe.c(),E=h(),B=m("div"),B.textContent="Month",P=h(),L=m("div"),F=S(O),x=S(" kWh"),j=h(),Ze&&Ze.c(),z=h(),G=m("div"),G.textContent="Last mo.",V=h(),W=m("div"),K=S(U),H=S(" kWh"),Y=h(),Ue&&Ue.c(),re=h(),ue=m("strong"),ue.textContent="Export",ke=h(),me=m("div"),Se=m("div"),Se.textContent="Hour",je=h(),Re=m("div"),we=S(He),Te=S(" kWh"),Le=h(),Je&&Je.c(),$e=h(),w=m("div"),w.textContent="Day",g=h(),k=m("div"),I=S(A),Q=S(" kWh"),J=h(),We&&We.c(),se=h(),ce=m("div"),ce.textContent="Month",ve=h(),Me=m("div"),pe=S(oe),Be=S(" kWh"),_e=h(),xe&&xe.c(),ye=h(),vt=m("div"),vt.textContent="Last mo.",Hl=h(),tl=m("div"),Tl=S(ct),pl=S(" kWh"),Ht=h(),et&&et.c(),r(u,"class","text-right"),r(d,"class","text-right"),r(L,"class","text-right"),r(W,"class","text-right"),r(n,"class",Z="grid grid-cols-"+t[5]+" mb-3"),r(Re,"class","text-right"),r(k,"class","text-right"),r(Me,"class","text-right"),r(tl,"class","text-right"),r(me,"class",ht="grid grid-cols-"+t[5])},m(de,Ce){$(de,e,Ce),$(de,l,Ce),$(de,n,Ce),s(n,i),s(n,o),s(n,u),s(u,c),s(u,f),s(n,_),Qe&&Qe.m(n,null),s(n,p),s(n,b),s(n,v),s(n,d),s(d,y),s(d,T),s(n,N),Xe&&Xe.m(n,null),s(n,E),s(n,B),s(n,P),s(n,L),s(L,F),s(L,x),s(n,j),Ze&&Ze.m(n,null),s(n,z),s(n,G),s(n,V),s(n,W),s(W,K),s(W,H),s(n,Y),Ue&&Ue.m(n,null),$(de,re,Ce),$(de,ue,Ce),$(de,ke,Ce),$(de,me,Ce),s(me,Se),s(me,je),s(me,Re),s(Re,we),s(Re,Te),s(me,Le),Je&&Je.m(me,null),s(me,$e),s(me,w),s(me,g),s(me,k),s(k,I),s(k,Q),s(me,J),We&&We.m(me,null),s(me,se),s(me,ce),s(me,ve),s(me,Me),s(Me,pe),s(Me,Be),s(me,_e),xe&&xe.m(me,null),s(me,ye),s(me,vt),s(me,Hl),s(me,tl),s(tl,Tl),s(tl,pl),s(me,Ht),et&&et.m(me,null)},p(de,Ce){Ce&2&&a!==(a=ge(de[1].h.u,2)+"")&&X(c,a),de[4]?Qe?Qe.p(de,Ce):(Qe=Pu(de),Qe.c(),Qe.m(n,p)):Qe&&(Qe.d(1),Qe=null),Ce&2&&M!==(M=ge(de[1].d.u,1)+"")&&X(y,M),de[4]?Xe?Xe.p(de,Ce):(Xe=Eu(de),Xe.c(),Xe.m(n,E)):Xe&&(Xe.d(1),Xe=null),Ce&2&&O!==(O=ge(de[1].m.u)+"")&&X(F,O),de[4]?Ze?Ze.p(de,Ce):(Ze=Du(de),Ze.c(),Ze.m(n,z)):Ze&&(Ze.d(1),Ze=null),Ce&1&&U!==(U=ge(de[0].last_month.u)+"")&&X(K,U),de[4]?Ue?Ue.p(de,Ce):(Ue=Iu(de),Ue.c(),Ue.m(n,null)):Ue&&(Ue.d(1),Ue=null),Ce&32&&Z!==(Z="grid grid-cols-"+de[5]+" mb-3")&&r(n,"class",Z),Ce&2&&He!==(He=ge(de[1].h.p,2)+"")&&X(we,He),de[4]?Je?Je.p(de,Ce):(Je=Ru(de),Je.c(),Je.m(me,$e)):Je&&(Je.d(1),Je=null),Ce&2&&A!==(A=ge(de[1].d.p,1)+"")&&X(I,A),de[4]?We?We.p(de,Ce):(We=Lu(de),We.c(),We.m(me,se)):We&&(We.d(1),We=null),Ce&2&&oe!==(oe=ge(de[1].m.p)+"")&&X(pe,oe),de[4]?xe?xe.p(de,Ce):(xe=Ou(de),xe.c(),xe.m(me,ye)):xe&&(xe.d(1),xe=null),Ce&1&&ct!==(ct=ge(de[0].last_month.p)+"")&&X(Tl,ct),de[4]?et?et.p(de,Ce):(et=Fu(de),et.c(),et.m(me,null)):et&&(et.d(1),et=null),Ce&32&&ht!==(ht="grid grid-cols-"+de[5])&&r(me,"class",ht)},d(de){de&&C(e),de&&C(l),de&&C(n),Qe&&Qe.d(),Xe&&Xe.d(),Ze&&Ze.d(),Ue&&Ue.d(),de&&C(re),de&&C(ue),de&&C(ke),de&&C(me),Je&&Je.d(),We&&We.d(),xe&&xe.d(),et&&et.d()}}}function Au(t){let e,l,n,i,o,u,a=ge(t[1].h.c,2)+"",c,f,_,p,b,v,d,M=ge(t[1].d.c,1)+"",y,T,N,E,B,P,L,O=ge(t[1].m.c)+"",F,x,j,z,G,V,W,U=ge(t[0].last_month.c)+"",K,H,Y;return{c(){e=m("strong"),e.textContent="Cost",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",o=h(),u=m("div"),c=S(a),f=h(),_=S(t[2]),p=h(),b=m("div"),b.textContent="Day",v=h(),d=m("div"),y=S(M),T=h(),N=S(t[2]),E=h(),B=m("div"),B.textContent="Month",P=h(),L=m("div"),F=S(O),x=h(),j=S(t[2]),z=h(),G=m("div"),G.textContent="Last month",V=h(),W=m("div"),K=S(U),H=h(),Y=S(t[2]),r(u,"class","text-right"),r(d,"class","text-right"),r(L,"class","text-right"),r(W,"class","text-right"),r(n,"class","grid grid-cols-2")},m(Z,re){$(Z,e,re),$(Z,l,re),$(Z,n,re),s(n,i),s(n,o),s(n,u),s(u,c),s(u,f),s(u,_),s(n,p),s(n,b),s(n,v),s(n,d),s(d,y),s(d,T),s(d,N),s(n,E),s(n,B),s(n,P),s(n,L),s(L,F),s(L,x),s(L,j),s(n,z),s(n,G),s(n,V),s(n,W),s(W,K),s(W,H),s(W,Y)},p(Z,re){re&2&&a!==(a=ge(Z[1].h.c,2)+"")&&X(c,a),re&4&&X(_,Z[2]),re&2&&M!==(M=ge(Z[1].d.c,1)+"")&&X(y,M),re&4&&X(N,Z[2]),re&2&&O!==(O=ge(Z[1].m.c)+"")&&X(F,O),re&4&&X(j,Z[2]),re&1&&U!==(U=ge(Z[0].last_month.c)+"")&&X(K,U),re&4&&X(Y,Z[2])},d(Z){Z&&C(e),Z&&C(l),Z&&C(n)}}}function Pu(t){let e,l=ge(t[1].h.c,2)+"",n,i,o;return{c(){e=m("div"),n=S(l),i=h(),o=S(t[2]),r(e,"class","text-right")},m(u,a){$(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&2&&l!==(l=ge(u[1].h.c,2)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&C(e)}}}function Eu(t){let e,l=ge(t[1].d.c,1)+"",n,i,o;return{c(){e=m("div"),n=S(l),i=h(),o=S(t[2]),r(e,"class","text-right")},m(u,a){$(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&2&&l!==(l=ge(u[1].d.c,1)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&C(e)}}}function Du(t){let e,l=ge(t[1].m.c)+"",n,i,o;return{c(){e=m("div"),n=S(l),i=h(),o=S(t[2]),r(e,"class","text-right")},m(u,a){$(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&2&&l!==(l=ge(u[1].m.c)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&C(e)}}}function Iu(t){let e,l=ge(t[0].last_month.c)+"",n,i,o;return{c(){e=m("div"),n=S(l),i=h(),o=S(t[2]),r(e,"class","text-right")},m(u,a){$(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&1&&l!==(l=ge(u[0].last_month.c)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&C(e)}}}function Ru(t){let e,l=ge(t[1].h.i,2)+"",n,i,o;return{c(){e=m("div"),n=S(l),i=h(),o=S(t[2]),r(e,"class","text-right")},m(u,a){$(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&2&&l!==(l=ge(u[1].h.i,2)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&C(e)}}}function Lu(t){let e,l=ge(t[1].d.i,1)+"",n,i,o;return{c(){e=m("div"),n=S(l),i=h(),o=S(t[2]),r(e,"class","text-right")},m(u,a){$(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&2&&l!==(l=ge(u[1].d.i,1)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&C(e)}}}function Ou(t){let e,l=ge(t[1].m.i)+"",n,i,o;return{c(){e=m("div"),n=S(l),i=h(),o=S(t[2]),r(e,"class","text-right")},m(u,a){$(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&2&&l!==(l=ge(u[1].m.i)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&C(e)}}}function Fu(t){let e,l=ge(t[0].last_month.i)+"",n,i,o;return{c(){e=m("div"),n=S(l),i=h(),o=S(t[2]),r(e,"class","text-right")},m(u,a){$(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&1&&l!==(l=ge(u[0].last_month.i)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&C(e)}}}function gm(t){let e,l,n,i,o,u,a=t[1]&&Nu(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Real time calculation",n=h(),i=m("br"),o=m("br"),u=h(),a&&a.c(),r(e,"class","mx-2 text-sm")},m(c,f){$(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),s(e,u),a&&a.m(e,null)},p(c,[f]){c[1]?a?a.p(c,f):(a=Nu(c),a.c(),a.m(e,null)):a&&(a.d(1),a=null)},i:fe,o:fe,d(c){c&&C(e),a&&a.d()}}}function km(t,e,l){let{sysinfo:n}=e,{data:i}=e,{currency:o}=e,{hasExport:u}=e,a=!1,c=3;return t.$$set=f=>{"sysinfo"in f&&l(0,n=f.sysinfo),"data"in f&&l(1,i=f.data),"currency"in f&&l(2,o=f.currency),"hasExport"in f&&l(3,u=f.hasExport)},t.$$.update=()=>{t.$$.dirty&18&&(l(4,a=i&&i.h&&(Math.abs(i.h.c)>.01||Math.abs(i.d.c)>.01||Math.abs(i.m.c)>.01||Math.abs(i.h.i)>.01||Math.abs(i.d.i)>.01||Math.abs(i.m.i)>.01)),l(5,c=a?3:2))},[n,i,o,u,a,c]}class wm extends Ee{constructor(e){super(),Pe(this,e,km,gm,Ne,{sysinfo:0,data:1,currency:2,hasExport:3})}}function ym(t){let e,l,n=Ja(t[0].source)+"",i,o,u,a;return u=new pn({props:{config:t[1]}}),{c(){e=m("a"),l=S("Provided by: "),i=S(n),o=h(),ie(u.$$.fragment),r(e,"href","https://transparency.entsoe.eu/"),r(e,"target","_blank"),r(e,"class","text-xs float-right z-40")},m(c,f){$(c,e,f),s(e,l),s(e,i),$(c,o,f),le(u,c,f),a=!0},p(c,[f]){(!a||f&1)&&n!==(n=Ja(c[0].source)+"")&&X(i,n);const _={};f&2&&(_.config=c[1]),u.$set(_)},i(c){a||(D(u.$$.fragment,c),a=!0)},o(c){q(u.$$.fragment,c),a=!1},d(c){c&&C(e),c&&C(o),ne(u,c)}}}function Cm(t,e,l){let{json:n}=e,{sysinfo:i}=e,o={},u,a;return t.$$set=c=>{"json"in c&&l(0,n=c.json),"sysinfo"in c&&l(2,i=c.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&29){let c=n.currency,f=new Date().getUTCHours(),_=0,p=0,b=0,v=[],d=[],M=[];l(4,a=l(3,u=0));let y=new Date;for(fl(y,i.clock_offset-(24+y.getHours()-y.getUTCHours())%24),_=f;_<24&&(p=n[Oe(b++)],p!=null);_++)d.push({label:Oe(y.getHours())}),M.push(p*100),l(4,a=Math.min(a,p*100)),l(3,u=Math.max(u,p*100)),fl(y,1);for(_=0;_<24&&(p=n[Oe(b++)],p!=null);_++)d.push({label:Oe(y.getHours())}),M.push(p*100),l(4,a=Math.min(a,p*100)),l(3,u=Math.max(u,p*100)),fl(y,1);if(a>-100&&u<100){switch(c){case"NOK":case"SEK":case"DKK":c="\xF8re";break;case"EUR":c="cent";break;default:c=c+"/100"}for(l(4,a*=100),l(3,u*=100),_=0;_=0?P.toFixed(L):"",title:P>=0?P.toFixed(2)+" "+c:"",value:p>=0?Math.abs(p):0,label2:P<0?P.toFixed(L):"",title2:P<0?P.toFixed(2)+" "+c:"",value2:p<0?Math.abs(p):0,color:"#7c3aed"})}let N=Math.max(u,Math.abs(a));if(a<0){l(4,a=Math.min(N/4*-1,a));let P=Math.ceil(Math.abs(a)/N*4),L=a/P;for(_=1;_{"json"in c&&l(1,n=c.json),"sysinfo"in c&&l(2,i=c.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let c=0,f=[],_=[],p=[];l(4,a=l(3,u=0));let b=fl(new Date,-24),v=new Date().getUTCHours();for(fl(b,i.clock_offset-(24+b.getHours()-b.getUTCHours())%24),c=v;c<24;c++){let T=n["i"+Oe(c)],N=n["e"+Oe(c)];T===void 0&&(T=0),N===void 0&&(N=0),_.push({label:Oe(b.getHours())}),p.push({label:T.toFixed(1),title:T.toFixed(2)+" kWh",value:T*10,label2:N.toFixed(1),title2:N.toFixed(2)+" kWh",value2:N*10,color:"#7c3aed",color2:"#37829E"}),l(4,a=Math.max(a,N*10)),l(3,u=Math.max(u,T*10)),fl(b,1)}for(c=0;c{"json"in c&&l(1,n=c.json),"sysinfo"in c&&l(2,i=c.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let c=0,f=[],_=[],p=[];l(4,a=l(3,u=0));let b=new Date,v=new Date;for(fl(b,i.clock_offset-(24+b.getHours()-b.getUTCHours())%24),fl(v,i.clock_offset-(24+v.getHours()-v.getUTCHours())%24),v.setDate(0),c=b.getDate();c<=v.getDate();c++){let T=n["i"+Oe(c)],N=n["e"+Oe(c)];T===void 0&&(T=0),N===void 0&&(N=0),_.push({label:Oe(c)}),p.push({label:T.toFixed(T<10?1:0),title:T.toFixed(2)+" kWh",value:T,label2:N.toFixed(N<10?1:0),title2:N.toFixed(2)+" kWh",value2:N,color:"#7c3aed",color2:"#37829E"}),l(4,a=Math.max(a,N)),l(3,u=Math.max(u,T))}for(c=1;c{"json"in a&&l(1,n=a.json)},t.$$.update=()=>{if(t.$$.dirty&14){let a=0,c=0,f=[],_=[],p=[];n.s&&n.s.forEach((d,M)=>{var y=d.n?d.n:d.a;c=d.v,c==-127&&(c=0),_.push({label:y.slice(-4)}),p.push({label:c.toFixed(1),value:c,color:"#7c3aed"}),l(3,u=Math.min(u,c)),l(2,o=Math.max(o,c))}),l(2,o=Math.ceil(o)),l(3,u=Math.floor(u));let b=o;u<0&&(b+=Math.abs(u));let v=b/4;for(a=0;a<5;a++)c=u+v*a,f.push({value:c,label:c.toFixed(1)});l(0,i={title:"Temperature sensors (\xB0C)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:u,max:o,ticks:f},x:{ticks:_},points:p})}},[i,n,o,u]}class Im extends Ee{constructor(e){super(),Pe(this,e,Dm,Em,Ne,{json:1})}}function Rm(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}let Lm=0;function Om(t,e,l){let n={},i=0,o;return Hc.subscribe(u=>{l(2,o=u)}),jc(),t.$$.update=()=>{if(t.$$.dirty&6){let u=0,a=[],c=[],f=[];if(a.push({value:0,label:0}),o&&o.p)for(u=0;u0?Oe(_.d)+"."+no[new Date().getMonth()]:"-"}),l(1,i=Math.max(i,_.v))}if(o&&o.t){for(u=0;u=i)break;a.push({value:_,label:_})}a.push({label:o.m.toFixed(1),align:"right",color:"green",value:o.m})}o&&o.c&&(a.push({label:o.c.toFixed(0),color:"orange",value:o.c}),l(1,i=Math.max(i,o.c))),l(1,i=Math.ceil(i)),l(0,n={title:"Tariff peaks",padding:{top:20,right:35,bottom:20,left:35},y:{min:Lm,max:i,ticks:a},x:{ticks:c},points:f})}},[n,i,o]}class Fm extends Ee{constructor(e){super(),Pe(this,e,Om,Rm,Ne,{})}}function qu(t){let e,l,n,i,o,u,a=(t[0].mt?Cs(t[0].mt):"-")+"",c,f,_,p=(t[0].ic?t[0].ic.toFixed(1):"-")+"",b,v,d;return i=new Kc({props:{val:t[0].i?t[0].i:0,max:t[0].im?t[0].im:15e3,unit:"W",label:"Import",sub:t[0].p,subunit:t[0].pc,colorFn:Rc}}),{c(){e=m("div"),l=m("div"),n=m("div"),ie(i.$$.fragment),o=h(),u=m("div"),c=S(a),f=h(),_=m("div"),b=S(p),v=S(" kWh"),r(n,"class","col-span-2"),r(_,"class","text-right"),r(l,"class","grid grid-cols-2"),r(e,"class","cnt")},m(M,y){$(M,e,y),s(e,l),s(l,n),le(i,n,null),s(l,o),s(l,u),s(u,c),s(l,f),s(l,_),s(_,b),s(_,v),d=!0},p(M,y){const T={};y&1&&(T.val=M[0].i?M[0].i:0),y&1&&(T.max=M[0].im?M[0].im:15e3),y&1&&(T.sub=M[0].p),y&1&&(T.subunit=M[0].pc),i.$set(T),(!d||y&1)&&a!==(a=(M[0].mt?Cs(M[0].mt):"-")+"")&&X(c,a),(!d||y&1)&&p!==(p=(M[0].ic?M[0].ic.toFixed(1):"-")+"")&&X(b,p)},i(M){d||(D(i.$$.fragment,M),d=!0)},o(M){q(i.$$.fragment,M),d=!1},d(M){M&&C(e),ne(i)}}}function Bu(t){let e,l,n,i,o,u,a,c,f=(t[0].ec?t[0].ec.toFixed(1):"-")+"",_,p,b;return i=new Kc({props:{val:t[0].e?t[0].e:0,max:t[0].om?t[0].om*1e3:1e4,unit:"W",label:"Export",colorFn:k1}}),{c(){e=m("div"),l=m("div"),n=m("div"),ie(i.$$.fragment),o=h(),u=m("div"),a=h(),c=m("div"),_=S(f),p=S(" kWh"),r(n,"class","col-span-2"),r(c,"class","text-right"),r(l,"class","grid grid-cols-2"),r(e,"class","cnt")},m(v,d){$(v,e,d),s(e,l),s(l,n),le(i,n,null),s(l,o),s(l,u),s(l,a),s(l,c),s(c,_),s(c,p),b=!0},p(v,d){const M={};d&1&&(M.val=v[0].e?v[0].e:0),d&1&&(M.max=v[0].om?v[0].om*1e3:1e4),i.$set(M),(!b||d&1)&&f!==(f=(v[0].ec?v[0].ec.toFixed(1):"-")+"")&&X(_,f)},i(v){b||(D(i.$$.fragment,v),b=!0)},o(v){q(i.$$.fragment,v),b=!1},d(v){v&&C(e),ne(i)}}}function Uu(t){let e,l,n;return l=new fm({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,ds:t[0].ds}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt")},m(i,o){$(i,e,o),le(l,e,null),n=!0},p(i,o){const u={};o&1&&(u.u1=i[0].u1),o&1&&(u.u2=i[0].u2),o&1&&(u.u3=i[0].u3),o&1&&(u.ds=i[0].ds),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function ju(t){let e,l,n;return l=new pm({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,i1:t[0].i1,i2:t[0].i2,i3:t[0].i3,max:t[0].mf?t[0].mf:32}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt")},m(i,o){$(i,e,o),le(l,e,null),n=!0},p(i,o){const u={};o&1&&(u.u1=i[0].u1),o&1&&(u.u2=i[0].u2),o&1&&(u.u3=i[0].u3),o&1&&(u.i1=i[0].i1),o&1&&(u.i2=i[0].i2),o&1&&(u.i3=i[0].i3),o&1&&(u.max=i[0].mf?i[0].mf:32),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Hu(t){let e,l,n;return l=new vm({props:{importInstant:t[0].ri,exportInstant:t[0].re,importTotal:t[0].ric,exportTotal:t[0].rec}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt")},m(i,o){$(i,e,o),le(l,e,null),n=!0},p(i,o){const u={};o&1&&(u.importInstant=i[0].ri),o&1&&(u.exportInstant=i[0].re),o&1&&(u.importTotal=i[0].ric),o&1&&(u.exportTotal=i[0].rec),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Wu(t){let e,l,n;return l=new wm({props:{sysinfo:t[1],data:t[0].ea,currency:t[0].pc,hasExport:t[0].om>0||t[0].e>0}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt")},m(i,o){$(i,e,o),le(l,e,null),n=!0},p(i,o){const u={};o&2&&(u.sysinfo=i[1]),o&1&&(u.data=i[0].ea),o&1&&(u.currency=i[0].pc),o&1&&(u.hasExport=i[0].om>0||i[0].e>0),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function zu(t){let e,l,n;return l=new Fm({}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt h-64")},m(i,o){$(i,e,o),le(l,e,null),n=!0},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Gu(t){let e,l,n;return l=new $m({props:{json:t[2],sysinfo:t[1]}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){$(i,e,o),le(l,e,null),n=!0},p(i,o){const u={};o&4&&(u.json=i[2]),o&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Vu(t){let e,l,n;return l=new Tm({props:{json:t[3],sysinfo:t[1]}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){$(i,e,o),le(l,e,null),n=!0},p(i,o){const u={};o&8&&(u.json=i[3]),o&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Ku(t){let e,l,n;return l=new Pm({props:{json:t[4],sysinfo:t[1]}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){$(i,e,o),le(l,e,null),n=!0},p(i,o){const u={};o&16&&(u.json=i[4]),o&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Yu(t){let e,l,n;return l=new Im({props:{json:t[5]}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){$(i,e,o),le(l,e,null),n=!0},p(i,o){const u={};o&32&&(u.json=i[5]),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function qm(t){let e,l=Ke(t[1].ui.i,t[0].i),n,i=Ke(t[1].ui.e,t[0].om||t[0].e>0),o,u=Ke(t[1].ui.v,t[0].u1>100||t[0].u2>100||t[0].u3>100),a,c=Ke(t[1].ui.a,t[0].i1>.01||t[0].i2>.01||t[0].i3>.01),f,_=Ke(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),p,b=Ke(t[1].ui.c,t[0].ea),v,d=Ke(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("10YNO")||t[0].pr.startsWith("10Y1001A1001A4"))),M,y=Ke(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].p)),T,N=Ke(t[1].ui.d,t[3]),E,B=Ke(t[1].ui.m,t[4]),P,L=Ke(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[5].c>1),O,F=l&&qu(t),x=i&&Bu(t),j=u&&Uu(t),z=c&&ju(t),G=_&&Hu(t),V=b&&Wu(t),W=d&&zu(),U=y&&Gu(t),K=N&&Vu(t),H=B&&Ku(t),Y=L&&Yu(t);return{c(){e=m("div"),F&&F.c(),n=h(),x&&x.c(),o=h(),j&&j.c(),a=h(),z&&z.c(),f=h(),G&&G.c(),p=h(),V&&V.c(),v=h(),W&&W.c(),M=h(),U&&U.c(),T=h(),K&&K.c(),E=h(),H&&H.c(),P=h(),Y&&Y.c(),r(e,"class","grid 2xl:grid-cols-6 xl:grid-cols-5 lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2")},m(Z,re){$(Z,e,re),F&&F.m(e,null),s(e,n),x&&x.m(e,null),s(e,o),j&&j.m(e,null),s(e,a),z&&z.m(e,null),s(e,f),G&&G.m(e,null),s(e,p),V&&V.m(e,null),s(e,v),W&&W.m(e,null),s(e,M),U&&U.m(e,null),s(e,T),K&&K.m(e,null),s(e,E),H&&H.m(e,null),s(e,P),Y&&Y.m(e,null),O=!0},p(Z,[re]){re&3&&(l=Ke(Z[1].ui.i,Z[0].i)),l?F?(F.p(Z,re),re&3&&D(F,1)):(F=qu(Z),F.c(),D(F,1),F.m(e,n)):F&&(De(),q(F,1,1,()=>{F=null}),Ie()),re&3&&(i=Ke(Z[1].ui.e,Z[0].om||Z[0].e>0)),i?x?(x.p(Z,re),re&3&&D(x,1)):(x=Bu(Z),x.c(),D(x,1),x.m(e,o)):x&&(De(),q(x,1,1,()=>{x=null}),Ie()),re&3&&(u=Ke(Z[1].ui.v,Z[0].u1>100||Z[0].u2>100||Z[0].u3>100)),u?j?(j.p(Z,re),re&3&&D(j,1)):(j=Uu(Z),j.c(),D(j,1),j.m(e,a)):j&&(De(),q(j,1,1,()=>{j=null}),Ie()),re&3&&(c=Ke(Z[1].ui.a,Z[0].i1>.01||Z[0].i2>.01||Z[0].i3>.01)),c?z?(z.p(Z,re),re&3&&D(z,1)):(z=ju(Z),z.c(),D(z,1),z.m(e,f)):z&&(De(),q(z,1,1,()=>{z=null}),Ie()),re&3&&(_=Ke(Z[1].ui.r,Z[0].ri>0||Z[0].re>0||Z[0].ric>0||Z[0].rec>0)),_?G?(G.p(Z,re),re&3&&D(G,1)):(G=Hu(Z),G.c(),D(G,1),G.m(e,p)):G&&(De(),q(G,1,1,()=>{G=null}),Ie()),re&3&&(b=Ke(Z[1].ui.c,Z[0].ea)),b?V?(V.p(Z,re),re&3&&D(V,1)):(V=Wu(Z),V.c(),D(V,1),V.m(e,v)):V&&(De(),q(V,1,1,()=>{V=null}),Ie()),re&3&&(d=Ke(Z[1].ui.t,Z[0].pr&&(Z[0].pr.startsWith("10YNO")||Z[0].pr.startsWith("10Y1001A1001A4")))),d?W?re&3&&D(W,1):(W=zu(),W.c(),D(W,1),W.m(e,M)):W&&(De(),q(W,1,1,()=>{W=null}),Ie()),re&3&&(y=Ke(Z[1].ui.p,Z[0].pe&&!Number.isNaN(Z[0].p))),y?U?(U.p(Z,re),re&3&&D(U,1)):(U=Gu(Z),U.c(),D(U,1),U.m(e,T)):U&&(De(),q(U,1,1,()=>{U=null}),Ie()),re&10&&(N=Ke(Z[1].ui.d,Z[3])),N?K?(K.p(Z,re),re&10&&D(K,1)):(K=Vu(Z),K.c(),D(K,1),K.m(e,E)):K&&(De(),q(K,1,1,()=>{K=null}),Ie()),re&18&&(B=Ke(Z[1].ui.m,Z[4])),B?H?(H.p(Z,re),re&18&&D(H,1)):(H=Ku(Z),H.c(),D(H,1),H.m(e,P)):H&&(De(),q(H,1,1,()=>{H=null}),Ie()),re&35&&(L=Ke(Z[1].ui.s,Z[0].t&&Z[0].t!=-127&&Z[5].c>1)),L?Y?(Y.p(Z,re),re&35&&D(Y,1)):(Y=Yu(Z),Y.c(),D(Y,1),Y.m(e,null)):Y&&(De(),q(Y,1,1,()=>{Y=null}),Ie())},i(Z){O||(D(F),D(x),D(j),D(z),D(G),D(V),D(W),D(U),D(K),D(H),D(Y),O=!0)},o(Z){q(F),q(x),q(j),q(z),q(G),q(V),q(W),q(U),q(K),q(H),q(Y),O=!1},d(Z){Z&&C(e),F&&F.d(),x&&x.d(),j&&j.d(),z&&z.d(),G&&G.d(),V&&V.d(),W&&W.d(),U&&U.d(),K&&K.d(),H&&H.d(),Y&&Y.d()}}}function Bm(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,o={},u={},a={},c={};return Co.subscribe(f=>{l(2,o=f)}),Fc.subscribe(f=>{l(3,u=f)}),qc.subscribe(f=>{l(4,a=f)}),Uc.subscribe(f=>{l(5,c=f)}),t.$$set=f=>{"data"in f&&l(0,n=f.data),"sysinfo"in f&&l(1,i=f.sysinfo)},[n,i,o,u,a,c]}class Um extends Ee{constructor(e){super(),Pe(this,e,Bm,qm,Ne,{data:0,sysinfo:1})}}let fo={};const Ci=at(fo);async function jm(){fo=await(await fetch("/configuration.json")).json(),Ci.set(fo)}function Qu(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function Hm(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=3,e.value=e.__value},m(l,n){$(l,e,n)},d(l){l&&C(e)}}}function Wm(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=20,e.value=e.__value},m(l,n){$(l,e,n)},d(l){l&&C(e)}}}function Xu(t){let e;return{c(){e=m("option"),e.textContent="UART2",e.__value=113,e.value=e.__value},m(l,n){$(l,e,n)},d(l){l&&C(e)}}}function Zu(t){let e,l,n;return{c(){e=m("option"),e.textContent="UART1",l=h(),n=m("option"),n.textContent="UART2",e.__value=9,e.value=e.__value,n.__value=16,n.value=n.__value},m(i,o){$(i,e,o),$(i,l,o),$(i,n,o)},d(i){i&&C(e),i&&C(l),i&&C(n)}}}function Ju(t){let e;return{c(){e=m("option"),e.textContent="UART1",e.__value=18,e.value=e.__value},m(l,n){$(l,e,n)},d(l){l&&C(e)}}}function xu(t){let e,l,n;return{c(){e=m("option"),l=S("GPIO"),n=S(t[4]),e.__value=t[4],e.value=e.__value},m(i,o){$(i,e,o),s(e,l),s(e,n)},d(i){i&&C(e)}}}function ef(t){let e,l=t[4]>3&&!(t[0]=="esp32"&&(t[4]==9||t[4]==16))&&!(t[0]=="esp32s2"&&t[4]==18)&&!(t[0]=="esp8266"&&(t[4]==3||t[4]==113))&&xu(t);return{c(){l&&l.c(),e=Ve()},m(n,i){l&&l.m(n,i),$(n,e,i)},p(n,i){n[4]>3&&!(n[0]=="esp32"&&(n[4]==9||n[4]==16))&&!(n[0]=="esp32s2"&&n[4]==18)&&!(n[0]=="esp8266"&&(n[4]==3||n[4]==113))?l||(l=xu(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){l&&l.d(n),n&&C(e)}}}function zm(t){let e,l,n,i,o;function u(d,M){return d[0]=="esp32c3"?Wm:Hm}let a=u(t),c=a(t),f=t[0]=="esp8266"&&Xu(),_=(t[0]=="esp32"||t[0]=="esp32solo")&&Zu(),p=t[0]=="esp32s2"&&Ju(),b={length:t[1]+1},v=[];for(let d=0;d{"chip"in o&&l(0,n=o.chip)},t.$$.update=()=>{if(t.$$.dirty&1)switch(n){case"esp8266":l(1,i=16);break;case"esp32s2":l(1,i=44);break;case"esp32c3":l(1,i=19);break}},[n,i]}class Yc extends Ee{constructor(e){super(),Pe(this,e,Gm,zm,Ne,{chip:0})}}function tf(t){let e,l,n=t[1]&&lf(t);return{c(){e=m("div"),l=m("div"),n&&n.c(),r(l,"class","fixed inset-0 bg-gray-500 bg-opacity-50 flex items-center justify-center"),r(e,"class","z-50"),r(e,"aria-modal","true")},m(i,o){$(i,e,o),s(e,l),n&&n.m(l,null)},p(i,o){i[1]?n?n.p(i,o):(n=lf(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&C(e),n&&n.d()}}}function lf(t){let e,l;return{c(){e=m("div"),l=S(t[1]),r(e,"class","bg-white m-2 p-3 rounded-md shadow-lg pb-4 text-gray-700 w-96")},m(n,i){$(n,e,i),s(e,l)},p(n,i){i&2&&X(l,n[1])},d(n){n&&C(e)}}}function Vm(t){let e,l=t[0]&&tf(t);return{c(){l&&l.c(),e=Ve()},m(n,i){l&&l.m(n,i),$(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=tf(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:fe,o:fe,d(n){l&&l.d(n),n&&C(e)}}}function Km(t,e,l){let{active:n}=e,{message:i}=e;return t.$$set=o=>{"active"in o&&l(0,n=o.active),"message"in o&&l(1,i=o.message)},[n,i]}class It extends Ee{constructor(e){super(),Pe(this,e,Km,Vm,Ne,{active:0,message:1})}}function nf(t,e,l){const n=t.slice();return n[1]=e[l],n}function sf(t){let e,l,n=t[1]+"",i;return{c(){e=m("option"),l=S("Europe/"),i=S(n),e.__value="Europe/"+t[1],e.value=e.__value},m(o,u){$(o,e,u),s(e,l),s(e,i)},p:fe,d(o){o&&C(e)}}}function Ym(t){let e,l,n,i=t[0],o=[];for(let u=0;u>1&1,A=0;A0;g--)A[g]=A[g]?A[g-1]^P.EXPONENT[F._modN(P.LOG[A[g]]+w)]:A[g-1];A[0]=P.EXPONENT[F._modN(P.LOG[A[0]]+w)]}for(w=0;w<=k;w++)A[w]=P.LOG[A[w]]},_checkBadness:function(){var w,g,k,A,I,Q=0,J=this._badness,se=this.buffer,ce=this.width;for(I=0;Ice*ce;)oe-=ce*ce,Me++;for(Q+=Me*F.N4,A=0;A=J-2&&(w=J-2,I>9&&w--);var se=w;if(I>9){for(Q[se+2]=0,Q[se+3]=0;se--;)g=Q[se],Q[se+3]|=255&g<<4,Q[se+2]=g>>4;Q[2]|=255&w<<4,Q[1]=w>>4,Q[0]=64|w>>12}else{for(Q[se+1]=0,Q[se+2]=0;se--;)g=Q[se],Q[se+2]|=255&g<<4,Q[se+1]=g>>4;Q[1]|=255&w<<4,Q[0]=64|w>>4}for(se=w+3-(I<10);se=5&&(k+=F.N1+A[g]-5);for(g=3;gw||A[g-3]*3>=A[g]*4||A[g+3]*3>=A[g]*4)&&(k+=F.N3);return k},_finish:function(){this._stringBuffer=this.buffer.slice();var w,g,k=0,A=3e4;for(g=0;g<8&&(this._applyMask(g),w=this._checkBadness(),w>=1)A&1&&(I[Q-1-g+Q*8]=1,g<6?I[8+Q*g]=1:I[8+Q*(g+1)]=1);for(g=0;g<7;g++,A>>=1)A&1&&(I[8+Q*(Q-7+g)]=1,g?I[6-g+Q*8]=1:I[7+Q*8]=1)},_interleaveBlocks:function(){var w,g,k=this._dataBlock,A=this._ecc,I=this._eccBlock,Q=0,J=this._calculateMaxLength(),se=this._neccBlock1,ce=this._neccBlock2,ve=this._stringBuffer;for(w=0;w1)for(w=T.BLOCK[A],k=I-7;;){for(g=I-7;g>w-3&&(this._addAlignment(g,k),!(g6)for(w=O.BLOCK[Q-7],g=17,k=0;k<6;k++)for(A=0;A<3;A++,g--)1&(g>11?Q>>g-12:w>>g)?(I[5-k+J*(2-A+J-11)]=1,I[2-A+J-11+J*(5-k)]=1):(this._setMask(5-k,2-A+J-11),this._setMask(2-A+J-11,5-k))},_isMasked:function(w,g){var k=F._getMaskBit(w,g);return this._mask[k]===1},_pack:function(){var w,g,k,A=1,I=1,Q=this.width,J=Q-1,se=Q-1,ce=(this._dataBlock+this._eccBlock)*(this._neccBlock1+this._neccBlock2)+this._neccBlock2;for(g=0;gg&&(k=w,w=g,g=k),k=g,k+=g*g,k>>=1,k+=w,k},_modN:function(w){for(;w>=255;)w-=255,w=(w>>8)+(w&255);return w},N1:3,N2:3,N3:40,N4:10}),x=F,j=v.extend({draw:function(){this.element.src=this.qrious.toDataURL()},reset:function(){this.element.src=""},resize:function(){var w=this.element;w.width=w.height=this.qrious.size}}),z=j,G=p.extend(function(w,g,k,A){this.name=w,this.modifiable=Boolean(g),this.defaultValue=k,this._valueTransformer=A},{transform:function(w){var g=this._valueTransformer;return typeof g=="function"?g(w,this):w}}),V=G,W=p.extend(null,{abs:function(w){return w!=null?Math.abs(w):null},hasOwn:function(w,g){return Object.prototype.hasOwnProperty.call(w,g)},noop:function(){},toUpperCase:function(w){return w!=null?w.toUpperCase():null}}),U=W,K=p.extend(function(w){this.options={},w.forEach(function(g){this.options[g.name]=g},this)},{exists:function(w){return this.options[w]!=null},get:function(w,g){return K._get(this.options[w],g)},getAll:function(w){var g,k=this.options,A={};for(g in k)U.hasOwn(k,g)&&(A[g]=K._get(k[g],w));return A},init:function(w,g,k){typeof k!="function"&&(k=U.noop);var A,I;for(A in this.options)U.hasOwn(this.options,A)&&(I=this.options[A],K._set(I,I.defaultValue,g),K._createAccessor(I,g,k));this._setAll(w,g,!0)},set:function(w,g,k){return this._set(w,g,k)},setAll:function(w,g){return this._setAll(w,g)},_set:function(w,g,k,A){var I=this.options[w];if(!I)throw new Error("Invalid option: "+w);if(!I.modifiable&&!A)throw new Error("Option cannot be modified: "+w);return K._set(I,g,k)},_setAll:function(w,g,k){if(!w)return!1;var A,I=!1;for(A in w)U.hasOwn(w,A)&&this._set(A,w[A],g,k)&&(I=!0);return I}},{_createAccessor:function(w,g,k){var A={get:function(){return K._get(w,g)}};w.modifiable&&(A.set=function(I){K._set(w,I,g)&&k(I,w)}),Object.defineProperty(g,w.name,A)},_get:function(w,g){return g["_"+w.name]},_set:function(w,g,k){var A="_"+w.name,I=k[A],Q=w.transform(g!=null?g:w.defaultValue);return k[A]=Q,Q!==I}}),H=K,Y=p.extend(function(){this._services={}},{getService:function(w){var g=this._services[w];if(!g)throw new Error("Service is not being managed with name: "+w);return g},setService:function(w,g){if(this._services[w])throw new Error("Service is already managed with name: "+w);g&&(this._services[w]=g)}}),Z=Y,re=new H([new V("background",!0,"white"),new V("backgroundAlpha",!0,1,U.abs),new V("element"),new V("foreground",!0,"black"),new V("foregroundAlpha",!0,1,U.abs),new V("level",!0,"L",U.toUpperCase),new V("mime",!0,"image/png"),new V("padding",!0,null,U.abs),new V("size",!0,100,U.abs),new V("value",!0,"")]),ue=new Z,ke=p.extend(function(w){re.init(w,this,this.update.bind(this));var g=re.get("element",this),k=ue.getService("element"),A=g&&k.isCanvas(g)?g:k.createCanvas(),I=g&&k.isImage(g)?g:k.createImage();this._canvasRenderer=new M(this,A,!0),this._imageRenderer=new z(this,I,I===g),this.update()},{get:function(){return re.getAll(this)},set:function(w){re.setAll(w,this)&&this.update()},toDataURL:function(w){return this.canvas.toDataURL(w||this.mime)},update:function(){var w=new x({level:this.level,value:this.value});this._canvasRenderer.render(w),this._imageRenderer.render(w)}},{use:function(w){ue.setService(w.getName(),w)}});Object.defineProperties(ke.prototype,{canvas:{get:function(){return this._canvasRenderer.getElement()}},image:{get:function(){return this._imageRenderer.getElement()}}});var me=ke,Se=me,je=p.extend({getName:function(){}}),Re=je,He=Re.extend({createCanvas:function(){},createImage:function(){},getName:function(){return"element"},isCanvas:function(w){},isImage:function(w){}}),we=He,Te=we.extend({createCanvas:function(){return document.createElement("canvas")},createImage:function(){return document.createElement("img")},isCanvas:function(w){return w instanceof HTMLCanvasElement},isImage:function(w){return w instanceof HTMLImageElement}}),Le=Te;Se.use(new Le);var $e=Se;return $e})})(Xc);const ep=Xc.exports;function tp(t){let e,l;return{c(){e=m("img"),Js(e.src,l=t[2])||r(e,"src",l),r(e,"alt",t[0]),r(e,"class",t[1])},m(n,i){$(n,e,i)},p(n,[i]){i&4&&!Js(e.src,l=n[2])&&r(e,"src",l),i&1&&r(e,"alt",n[0]),i&2&&r(e,"class",n[1])},i:fe,o:fe,d(n){n&&C(e)}}}function lp(t,e,l){const n=new ep;let{errorCorrection:i="L"}=e,{background:o="#fff"}=e,{color:u="#000"}=e,{size:a="200"}=e,{value:c=""}=e,{padding:f=0}=e,{className:_="qrcode"}=e,p="";function b(){n.set({background:o,foreground:u,level:i,padding:f,size:a,value:c}),l(2,p=n.toDataURL("image/jpeg"))}return ic(()=>{b()}),t.$$set=v=>{"errorCorrection"in v&&l(3,i=v.errorCorrection),"background"in v&&l(4,o=v.background),"color"in v&&l(5,u=v.color),"size"in v&&l(6,a=v.size),"value"in v&&l(0,c=v.value),"padding"in v&&l(7,f=v.padding),"className"in v&&l(1,_=v.className)},t.$$.update=()=>{t.$$.dirty&1&&c&&b()},[c,_,p,i,o,u,a,f]}class np extends Ee{constructor(e){super(),Pe(this,e,lp,tp,Ne,{errorCorrection:3,background:4,color:5,size:6,value:0,padding:7,className:1})}}function of(t,e,l){const n=t.slice();return n[95]=e[l],n[96]=e,n[97]=l,n}function rf(t,e,l){const n=t.slice();return n[98]=e[l],n[99]=e,n[100]=l,n}function ip(t,e,l){const n=t.slice();return n[101]=e[l],n}function sp(t,e,l){const n=t.slice();return n[104]=e[l],n}function op(t){let e,l;return{c(){e=m("option"),l=S(t[104]),e.__value=t[104],e.value=e.__value},m(n,i){$(n,e,i),s(e,l)},p:fe,d(n){n&&C(e)}}}function af(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),r(l,"name","pt"),r(l,"type","text"),r(l,"class","in-s"),r(l,"placeholder","ENTSO-E API key, optional, read docs")},m(o,u){$(o,e,u),$(o,l,u),te(l,t[3].p.t),n||(i=ee(l,"input",t[22]),n=!0)},p(o,u){u[0]&8&&l.value!==o[3].p.t&&te(l,o[3].p.t)},d(o){o&&C(e),o&&C(l),n=!1,i()}}}function uf(t){let e,l,n,i,o,u,a,c,f,_,p,b,v;return{c(){e=m("div"),l=S("Username"),n=m("br"),i=h(),o=m("input"),u=h(),a=m("div"),c=S("Password"),f=m("br"),_=h(),p=m("input"),r(o,"name","gu"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1"),r(p,"name","gp"),r(p,"type","password"),r(p,"class","in-s"),r(a,"class","my-1")},m(d,M){$(d,e,M),s(e,l),s(e,n),s(e,i),s(e,o),te(o,t[3].g.u),$(d,u,M),$(d,a,M),s(a,c),s(a,f),s(a,_),s(a,p),te(p,t[3].g.p),b||(v=[ee(o,"input",t[24]),ee(p,"input",t[25])],b=!0)},p(d,M){M[0]&8&&o.value!==d[3].g.u&&te(o,d[3].g.u),M[0]&8&&p.value!==d[3].g.p&&te(p,d[3].g.p)},d(d){d&&C(e),d&&C(u),d&&C(a),b=!1,ze(v)}}}function rp(t){let e,l=t[101]*100+"",n;return{c(){e=m("option"),n=S(l),e.__value=t[101]*100,e.value=e.__value},m(i,o){$(i,e,o),s(e,n)},p:fe,d(i){i&&C(e)}}}function ff(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),r(l,"name","mek"),r(l,"type","text"),r(l,"class","in-s")},m(o,u){$(o,e,u),$(o,l,u),te(l,t[3].m.e.k),n||(i=ee(l,"input",t[34]),n=!0)},p(o,u){u[0]&8&&l.value!==o[3].m.e.k&&te(l,o[3].m.e.k)},d(o){o&&C(e),o&&C(l),n=!1,i()}}}function cf(t){let e,l,n,i,o,u,a;return{c(){e=m("div"),l=S("Authentication key"),n=m("br"),i=h(),o=m("input"),r(o,"name","mea"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1")},m(c,f){$(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),te(o,t[3].m.e.a),u||(a=ee(o,"input",t[35]),u=!0)},p(c,f){f[0]&8&&o.value!==c[3].m.e.a&&te(o,c[3].m.e.a)},d(c){c&&C(e),u=!1,a()}}}function mf(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,M,y,T,N,E,B,P,L,O,F,x,j;return{c(){e=m("div"),l=m("div"),n=S("Watt"),i=m("br"),o=h(),u=m("input"),a=h(),c=m("div"),f=S("Volt"),_=m("br"),p=h(),b=m("input"),v=h(),d=m("div"),M=S("Amp"),y=m("br"),T=h(),N=m("input"),E=h(),B=m("div"),P=S("kWh"),L=m("br"),O=h(),F=m("input"),r(u,"name","mmw"),r(u,"type","number"),r(u,"min","0.00"),r(u,"max","1000"),r(u,"step","0.001"),r(u,"class","in-f tr w-full"),r(l,"class","w-1/4"),r(b,"name","mmv"),r(b,"type","number"),r(b,"min","0.00"),r(b,"max","1000"),r(b,"step","0.001"),r(b,"class","in-m tr w-full"),r(c,"class","w-1/4"),r(N,"name","mma"),r(N,"type","number"),r(N,"min","0.00"),r(N,"max","1000"),r(N,"step","0.001"),r(N,"class","in-m tr w-full"),r(d,"class","w-1/4"),r(F,"name","mmc"),r(F,"type","number"),r(F,"min","0.00"),r(F,"max","1000"),r(F,"step","0.001"),r(F,"class","in-l tr w-full"),r(B,"class","w-1/4"),r(e,"class","flex my-1")},m(z,G){$(z,e,G),s(e,l),s(l,n),s(l,i),s(l,o),s(l,u),te(u,t[3].m.m.w),s(e,a),s(e,c),s(c,f),s(c,_),s(c,p),s(c,b),te(b,t[3].m.m.v),s(e,v),s(e,d),s(d,M),s(d,y),s(d,T),s(d,N),te(N,t[3].m.m.a),s(e,E),s(e,B),s(B,P),s(B,L),s(B,O),s(B,F),te(F,t[3].m.m.c),x||(j=[ee(u,"input",t[37]),ee(b,"input",t[38]),ee(N,"input",t[39]),ee(F,"input",t[40])],x=!0)},p(z,G){G[0]&8&&he(u.value)!==z[3].m.m.w&&te(u,z[3].m.m.w),G[0]&8&&he(b.value)!==z[3].m.m.v&&te(b,z[3].m.m.v),G[0]&8&&he(N.value)!==z[3].m.m.a&&te(N,z[3].m.m.a),G[0]&8&&he(F.value)!==z[3].m.m.c&&te(F,z[3].m.m.c)},d(z){z&&C(e),x=!1,ze(j)}}}function pf(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,M,y;return{c(){e=m("div"),l=S("Gateway"),n=m("br"),i=h(),o=m("input"),u=h(),a=m("div"),c=S("DNS"),f=m("br"),_=h(),p=m("div"),b=m("input"),v=h(),d=m("input"),r(o,"name","ng"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1"),r(b,"name","nd1"),r(b,"type","text"),r(b,"class","in-f w-full"),r(d,"name","nd2"),r(d,"type","text"),r(d,"class","in-l w-full"),r(p,"class","flex"),r(a,"class","my-1")},m(T,N){$(T,e,N),s(e,l),s(e,n),s(e,i),s(e,o),te(o,t[3].n.g),$(T,u,N),$(T,a,N),s(a,c),s(a,f),s(a,_),s(a,p),s(p,b),te(b,t[3].n.d1),s(p,v),s(p,d),te(d,t[3].n.d2),M||(y=[ee(o,"input",t[49]),ee(b,"input",t[50]),ee(d,"input",t[51])],M=!0)},p(T,N){N[0]&8&&o.value!==T[3].n.g&&te(o,T[3].n.g),N[0]&8&&b.value!==T[3].n.d1&&te(b,T[3].n.d1),N[0]&8&&d.value!==T[3].n.d2&&te(d,T[3].n.d2)},d(T){T&&C(e),T&&C(u),T&&C(a),M=!1,ze(y)}}}function _f(t){let e,l,n,i,o;return{c(){e=m("label"),l=m("input"),n=S(" SSL"),r(l,"type","checkbox"),r(l,"name","qs"),l.__value="true",l.value=l.__value,r(l,"class","rounded mb-1"),r(e,"class","float-right mr-3")},m(u,a){$(u,e,a),s(e,l),l.checked=t[3].q.s.e,s(e,n),i||(o=[ee(l,"change",t[55]),ee(l,"change",t[14])],i=!0)},p(u,a){a[0]&8&&(l.checked=u[3].q.s.e)},d(u){u&&C(e),i=!1,ze(o)}}}function df(t){let e,l,n,i,o,u,a,c,f,_,p,b,v;const d=[up,ap],M=[];function y(O,F){return O[3].q.s.c?0:1}n=y(t),i=M[n]=d[n](t);const T=[pp,mp],N=[];function E(O,F){return O[3].q.s.r?0:1}a=E(t),c=N[a]=T[a](t);const B=[hp,vp],P=[];function L(O,F){return O[3].q.s.k?0:1}return p=L(t),b=P[p]=B[p](t),{c(){e=m("div"),l=m("span"),i.c(),o=h(),u=m("span"),c.c(),f=h(),_=m("span"),b.c(),r(l,"class","flex pr-2"),r(u,"class","flex pr-2"),r(_,"class","flex pr-2"),r(e,"class","my-1 flex")},m(O,F){$(O,e,F),s(e,l),M[n].m(l,null),s(e,o),s(e,u),N[a].m(u,null),s(e,f),s(e,_),P[p].m(_,null),v=!0},p(O,F){let x=n;n=y(O),n===x?M[n].p(O,F):(De(),q(M[x],1,1,()=>{M[x]=null}),Ie(),i=M[n],i?i.p(O,F):(i=M[n]=d[n](O),i.c()),D(i,1),i.m(l,null));let j=a;a=E(O),a===j?N[a].p(O,F):(De(),q(N[j],1,1,()=>{N[j]=null}),Ie(),c=N[a],c?c.p(O,F):(c=N[a]=T[a](O),c.c()),D(c,1),c.m(u,null));let z=p;p=L(O),p===z?P[p].p(O,F):(De(),q(P[z],1,1,()=>{P[z]=null}),Ie(),b=P[p],b?b.p(O,F):(b=P[p]=B[p](O),b.c()),D(b,1),b.m(_,null))},i(O){v||(D(i),D(c),D(b),v=!0)},o(O){q(i),q(c),q(b),v=!1},d(O){O&&C(e),M[n].d(),N[a].d(),P[p].d()}}}function ap(t){let e,l;return e=new el({props:{to:"/mqtt-ca",$$slots:{default:[fp]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i[3]&16384&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function up(t){let e,l,n,i,o,u,a,c;return l=new el({props:{to:"/mqtt-ca",$$slots:{default:[cp]},$$scope:{ctx:t}}}),o=new To({}),{c(){e=m("span"),ie(l.$$.fragment),n=h(),i=m("span"),ie(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,_){$(f,e,_),le(l,e,null),$(f,n,_),$(f,i,_),le(o,i,null),u=!0,a||(c=[ee(i,"click",t[11]),ee(i,"keypress",t[11])],a=!0)},p(f,_){const p={};_[3]&16384&&(p.$$scope={dirty:_,ctx:f}),l.$set(p)},i(f){u||(D(l.$$.fragment,f),D(o.$$.fragment,f),u=!0)},o(f){q(l.$$.fragment,f),q(o.$$.fragment,f),u=!1},d(f){f&&C(e),ne(l),f&&C(n),f&&C(i),ne(o),a=!1,ze(c)}}}function fp(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload CA",title:"Click here to upload CA"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function cp(t){let e;return{c(){e=S("CA OK")},m(l,n){$(l,e,n)},d(l){l&&C(e)}}}function mp(t){let e,l;return e=new el({props:{to:"/mqtt-cert",$$slots:{default:[_p]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i[3]&16384&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function pp(t){let e,l,n,i,o,u,a,c;return l=new el({props:{to:"/mqtt-cert",$$slots:{default:[dp]},$$scope:{ctx:t}}}),o=new To({}),{c(){e=m("span"),ie(l.$$.fragment),n=h(),i=m("span"),ie(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,_){$(f,e,_),le(l,e,null),$(f,n,_),$(f,i,_),le(o,i,null),u=!0,a||(c=[ee(i,"click",t[12]),ee(i,"keypress",t[12])],a=!0)},p(f,_){const p={};_[3]&16384&&(p.$$scope={dirty:_,ctx:f}),l.$set(p)},i(f){u||(D(l.$$.fragment,f),D(o.$$.fragment,f),u=!0)},o(f){q(l.$$.fragment,f),q(o.$$.fragment,f),u=!1},d(f){f&&C(e),ne(l),f&&C(n),f&&C(i),ne(o),a=!1,ze(c)}}}function _p(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload cert",title:"Click here to upload certificate"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function dp(t){let e;return{c(){e=S("Cert OK")},m(l,n){$(l,e,n)},d(l){l&&C(e)}}}function vp(t){let e,l;return e=new el({props:{to:"/mqtt-key",$$slots:{default:[bp]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i[3]&16384&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function hp(t){let e,l,n,i,o,u,a,c;return l=new el({props:{to:"/mqtt-key",$$slots:{default:[gp]},$$scope:{ctx:t}}}),o=new To({}),{c(){e=m("span"),ie(l.$$.fragment),n=h(),i=m("span"),ie(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,_){$(f,e,_),le(l,e,null),$(f,n,_),$(f,i,_),le(o,i,null),u=!0,a||(c=[ee(i,"click",t[13]),ee(i,"keypress",t[13])],a=!0)},p(f,_){const p={};_[3]&16384&&(p.$$scope={dirty:_,ctx:f}),l.$set(p)},i(f){u||(D(l.$$.fragment,f),D(o.$$.fragment,f),u=!0)},o(f){q(l.$$.fragment,f),q(o.$$.fragment,f),u=!1},d(f){f&&C(e),ne(l),f&&C(n),f&&C(i),ne(o),a=!1,ze(c)}}}function bp(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload key",title:"Click here to upload key"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function gp(t){let e;return{c(){e=S("Key OK")},m(l,n){$(l,e,n)},d(l){l&&C(e)}}}function vf(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,M,y,T,N,E,B,P,L,O,F,x,j,z,G,V,W,U,K;return o=new Bt({}),{c(){e=m("div"),l=m("strong"),l.textContent="Domoticz",n=h(),i=m("a"),ie(o.$$.fragment),u=h(),a=m("input"),c=h(),f=m("div"),_=m("div"),p=S("Electricity IDX"),b=m("br"),v=h(),d=m("input"),M=h(),y=m("div"),T=S("Current IDX"),N=m("br"),E=h(),B=m("input"),P=h(),L=m("div"),O=S(`Voltage IDX: L1, L2 & L3 `),F=m("div"),x=m("input"),j=h(),z=m("input"),G=h(),V=m("input"),r(l,"class","text-sm"),r(i,"href",Ut("MQTT-configuration#domoticz")),r(i,"target","_blank"),r(i,"class","float-right"),r(a,"type","hidden"),r(a,"name","o"),a.value="true",r(d,"name","oe"),r(d,"type","text"),r(d,"class","in-f tr w-full"),r(_,"class","w-1/2"),r(B,"name","oc"),r(B,"type","text"),r(B,"class","in-l tr w-full"),r(y,"class","w-1/2"),r(f,"class","my-1 flex"),r(x,"name","ou1"),r(x,"type","text"),r(x,"class","in-f tr w-1/3"),r(z,"name","ou2"),r(z,"type","text"),r(z,"class","in-m tr w-1/3"),r(V,"name","ou3"),r(V,"type","text"),r(V,"class","in-l tr w-1/3"),r(F,"class","flex"),r(L,"class","my-1"),r(e,"class","cnt")},m(H,Y){$(H,e,Y),s(e,l),s(e,n),s(e,i),le(o,i,null),s(e,u),s(e,a),s(e,c),s(e,f),s(f,_),s(_,p),s(_,b),s(_,v),s(_,d),te(d,t[3].o.e),s(f,M),s(f,y),s(y,T),s(y,N),s(y,E),s(y,B),te(B,t[3].o.c),s(e,P),s(e,L),s(L,O),s(L,F),s(F,x),te(x,t[3].o.u1),s(F,j),s(F,z),te(z,t[3].o.u2),s(F,G),s(F,V),te(V,t[3].o.u3),W=!0,U||(K=[ee(d,"input",t[63]),ee(B,"input",t[64]),ee(x,"input",t[65]),ee(z,"input",t[66]),ee(V,"input",t[67])],U=!0)},p(H,Y){Y[0]&8&&d.value!==H[3].o.e&&te(d,H[3].o.e),Y[0]&8&&B.value!==H[3].o.c&&te(B,H[3].o.c),Y[0]&8&&x.value!==H[3].o.u1&&te(x,H[3].o.u1),Y[0]&8&&z.value!==H[3].o.u2&&te(z,H[3].o.u2),Y[0]&8&&V.value!==H[3].o.u3&&te(V,H[3].o.u3)},i(H){W||(D(o.$$.fragment,H),W=!0)},o(H){q(o.$$.fragment,H),W=!1},d(H){H&&C(e),ne(o),U=!1,ze(K)}}}function hf(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,M,y,T,N,E,B,P,L,O,F,x,j,z,G,V;return o=new Bt({}),{c(){e=m("div"),l=m("strong"),l.textContent="Home-Assistant",n=h(),i=m("a"),ie(o.$$.fragment),u=h(),a=m("input"),c=h(),f=m("div"),_=S("Discovery topic prefix"),p=m("br"),b=h(),v=m("input"),d=h(),M=m("div"),y=S("Hostname for URL"),T=m("br"),N=h(),E=m("input"),P=h(),L=m("div"),O=S("Name tag"),F=m("br"),x=h(),j=m("input"),r(l,"class","text-sm"),r(i,"href",Ut("MQTT-configuration#home-assistant")),r(i,"target","_blank"),r(i,"class","float-right"),r(a,"type","hidden"),r(a,"name","h"),a.value="true",r(v,"name","ht"),r(v,"type","text"),r(v,"class","in-s"),r(v,"placeholder","homeassistant"),r(f,"class","my-1"),r(E,"name","hh"),r(E,"type","text"),r(E,"class","in-s"),r(E,"placeholder",B=t[3].g.h+".local"),r(M,"class","my-1"),r(j,"name","hn"),r(j,"type","text"),r(j,"class","in-s"),r(L,"class","my-1"),r(e,"class","cnt")},m(W,U){$(W,e,U),s(e,l),s(e,n),s(e,i),le(o,i,null),s(e,u),s(e,a),s(e,c),s(e,f),s(f,_),s(f,p),s(f,b),s(f,v),te(v,t[3].h.t),s(e,d),s(e,M),s(M,y),s(M,T),s(M,N),s(M,E),te(E,t[3].h.h),s(e,P),s(e,L),s(L,O),s(L,F),s(L,x),s(L,j),te(j,t[3].h.n),z=!0,G||(V=[ee(v,"input",t[68]),ee(E,"input",t[69]),ee(j,"input",t[70])],G=!0)},p(W,U){U[0]&8&&v.value!==W[3].h.t&&te(v,W[3].h.t),(!z||U[0]&8&&B!==(B=W[3].g.h+".local"))&&r(E,"placeholder",B),U[0]&8&&E.value!==W[3].h.h&&te(E,W[3].h.h),U[0]&8&&j.value!==W[3].h.n&&te(j,W[3].h.n)},i(W){z||(D(o.$$.fragment,W),z=!0)},o(W){q(o.$$.fragment,W),z=!1},d(W){W&&C(e),ne(o),G=!1,ze(V)}}}function bf(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d=t[3].c.es&&gf(t);return{c(){e=m("div"),l=m("input"),n=h(),i=m("strong"),i.textContent="Cloud connections",o=h(),u=m("div"),a=m("label"),c=m("input"),f=S(" Energy Speedometer"),_=h(),d&&d.c(),r(l,"type","hidden"),r(l,"name","c"),l.value="true",r(i,"class","text-sm"),r(c,"type","checkbox"),r(c,"class","rounded mb-1"),r(c,"name","ces"),c.__value="true",c.value=c.__value,r(u,"class","my-1"),r(e,"class","cnt")},m(M,y){$(M,e,y),s(e,l),s(e,n),s(e,i),s(e,o),s(e,u),s(u,a),s(a,c),c.checked=t[3].c.es,s(a,f),s(u,_),d&&d.m(u,null),p=!0,b||(v=ee(c,"change",t[71]),b=!0)},p(M,y){y[0]&8&&(c.checked=M[3].c.es),M[3].c.es?d?(d.p(M,y),y[0]&8&&D(d,1)):(d=gf(M),d.c(),D(d,1),d.m(u,null)):d&&(De(),q(d,1,1,()=>{d=null}),Ie())},i(M){p||(D(d),p=!0)},o(M){q(d),p=!1},d(M){M&&C(e),d&&d.d(),b=!1,v()}}}function gf(t){let e,l,n=t[0].mac+"",i,o,u,a,c=(t[0].meter.id?t[0].meter.id:"missing, required")+"",f,_,p,b,v=t[0].mac&&t[0].meter.id&&kf(t);return{c(){e=m("div"),l=S("MAC: "),i=S(n),o=h(),u=m("div"),a=S("Meter ID: "),f=S(c),_=h(),v&&v.c(),p=Ve(),r(e,"class","pl-5"),r(u,"class","pl-5")},m(d,M){$(d,e,M),s(e,l),s(e,i),$(d,o,M),$(d,u,M),s(u,a),s(u,f),$(d,_,M),v&&v.m(d,M),$(d,p,M),b=!0},p(d,M){(!b||M[0]&1)&&n!==(n=d[0].mac+"")&&X(i,n),(!b||M[0]&1)&&c!==(c=(d[0].meter.id?d[0].meter.id:"missing, required")+"")&&X(f,c),d[0].mac&&d[0].meter.id?v?(v.p(d,M),M[0]&1&&D(v,1)):(v=kf(d),v.c(),D(v,1),v.m(p.parentNode,p)):v&&(De(),q(v,1,1,()=>{v=null}),Ie())},i(d){b||(D(v),b=!0)},o(d){q(v),b=!1},d(d){d&&C(e),d&&C(o),d&&C(u),d&&C(_),v&&v.d(d),d&&C(p)}}}function kf(t){let e,l,n;return l=new np({props:{value:'{"mac":"'+t[0].mac+'","meter":"'+t[0].meter.id+'"}'}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","pl-2")},m(i,o){$(i,e,o),le(l,e,null),n=!0},p(i,o){const u={};o[0]&1&&(u.value='{"mac":"'+i[0].mac+'","meter":"'+i[0].meter.id+'"}'),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function wf(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,M,y,T,N,E;o=new Bt({});let B={length:9},P=[];for(let L=0;L20&&Mf(t),_=t[0].chip=="esp8266"&&Nf(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Hardware",n=h(),i=m("a"),ie(o.$$.fragment),u=h(),f&&f.c(),a=h(),_&&_.c(),r(l,"class","text-sm"),r(i,"href",Ut("GPIO-configuration")),r(i,"target","_blank"),r(i,"class","float-right"),r(e,"class","cnt")},m(p,b){$(p,e,b),s(e,l),s(e,n),s(e,i),le(o,i,null),s(e,u),f&&f.m(e,null),s(e,a),_&&_.m(e,null),c=!0},p(p,b){p[0].board>20?f?(f.p(p,b),b[0]&1&&D(f,1)):(f=Mf(p),f.c(),D(f,1),f.m(e,a)):f&&(De(),q(f,1,1,()=>{f=null}),Ie()),p[0].chip=="esp8266"?_?_.p(p,b):(_=Nf(p),_.c(),_.m(e,null)):_&&(_.d(1),_=null)},i(p){c||(D(o.$$.fragment,p),D(f),c=!0)},o(p){q(o.$$.fragment,p),q(f),c=!1},d(p){p&&C(e),ne(o),f&&f.d(),_&&_.d()}}}function Mf(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,M,y,T,N,E,B,P,L,O,F,x,j,z,G,V,W,U,K,H,Y,Z,re,ue,ke,me,Se,je,Re,He,we,Te,Le,$e,w,g,k,A,I,Q,J,se,ce,ve,Me,oe;b=new Yc({props:{chip:t[0].chip}});let pe=t[0].chip!="esp8266"&&Sf(t),Be=t[3].i.v.p>0&&Tf(t);return{c(){e=m("input"),l=h(),n=m("div"),i=m("div"),o=S("HAN"),u=m("label"),a=m("input"),c=S(" pullup"),f=m("br"),_=h(),p=m("select"),ie(b.$$.fragment),v=h(),d=m("div"),M=S("AP button"),y=m("br"),T=h(),N=m("input"),E=h(),B=m("div"),P=S("LED"),L=m("label"),O=m("input"),F=S(" inv"),x=m("br"),j=h(),z=m("div"),G=m("input"),V=h(),W=m("div"),U=S("RGB"),K=m("label"),H=m("input"),Y=S(" inverted"),Z=m("br"),re=h(),ue=m("div"),ke=m("input"),me=h(),Se=m("input"),je=h(),Re=m("input"),He=h(),we=m("div"),Te=S("Temperature"),Le=m("br"),$e=h(),w=m("input"),g=h(),k=m("div"),A=S("Analog temp"),I=m("br"),Q=h(),J=m("input"),se=h(),pe&&pe.c(),ce=h(),Be&&Be.c(),r(e,"type","hidden"),r(e,"name","i"),e.value="true",r(a,"name","ihu"),a.__value="true",a.value=a.__value,r(a,"type","checkbox"),r(a,"class","rounded mb-1"),r(u,"class","ml-2"),r(p,"name","ihp"),r(p,"class","in-f w-full"),t[3].i.h.p===void 0&&tt(()=>t[76].call(p)),r(i,"class","w-1/3"),r(N,"name","ia"),r(N,"type","number"),r(N,"min","0"),r(N,"max",t[6]),r(N,"class","in-m tr w-full"),r(d,"class","w-1/3"),r(O,"name","ili"),O.__value="true",O.value=O.__value,r(O,"type","checkbox"),r(O,"class","rounded mb-1"),r(L,"class","ml-4"),r(G,"name","ilp"),r(G,"type","number"),r(G,"min","0"),r(G,"max",t[6]),r(G,"class","in-l tr w-full"),r(z,"class","flex"),r(B,"class","w-1/3"),r(H,"name","iri"),H.__value="true",H.value=H.__value,r(H,"type","checkbox"),r(H,"class","rounded mb-1"),r(K,"class","ml-4"),r(ke,"name","irr"),r(ke,"type","number"),r(ke,"min","0"),r(ke,"max",t[6]),r(ke,"class","in-f tr w-1/3"),r(Se,"name","irg"),r(Se,"type","number"),r(Se,"min","0"),r(Se,"max",t[6]),r(Se,"class","in-m tr w-1/3"),r(Re,"name","irb"),r(Re,"type","number"),r(Re,"min","0"),r(Re,"max",t[6]),r(Re,"class","in-l tr w-1/3"),r(ue,"class","flex"),r(W,"class","w-full"),r(w,"name","itd"),r(w,"type","number"),r(w,"min","0"),r(w,"max",t[6]),r(w,"class","in-f tr w-full"),r(we,"class","my-1 w-1/3"),r(J,"name","ita"),r(J,"type","number"),r(J,"min","0"),r(J,"max",t[6]),r(J,"class","in-l tr w-full"),r(k,"class","my-1 pr-1 w-1/3"),r(n,"class","flex flex-wrap")},m(_e,ye){$(_e,e,ye),$(_e,l,ye),$(_e,n,ye),s(n,i),s(i,o),s(i,u),s(u,a),a.checked=t[3].i.h.u,s(u,c),s(i,f),s(i,_),s(i,p),le(b,p,null),qe(p,t[3].i.h.p,!0),s(n,v),s(n,d),s(d,M),s(d,y),s(d,T),s(d,N),te(N,t[3].i.a),s(n,E),s(n,B),s(B,P),s(B,L),s(L,O),O.checked=t[3].i.l.i,s(L,F),s(B,x),s(B,j),s(B,z),s(z,G),te(G,t[3].i.l.p),s(n,V),s(n,W),s(W,U),s(W,K),s(K,H),H.checked=t[3].i.r.i,s(K,Y),s(W,Z),s(W,re),s(W,ue),s(ue,ke),te(ke,t[3].i.r.r),s(ue,me),s(ue,Se),te(Se,t[3].i.r.g),s(ue,je),s(ue,Re),te(Re,t[3].i.r.b),s(n,He),s(n,we),s(we,Te),s(we,Le),s(we,$e),s(we,w),te(w,t[3].i.t.d),s(n,g),s(n,k),s(k,A),s(k,I),s(k,Q),s(k,J),te(J,t[3].i.t.a),s(n,se),pe&&pe.m(n,null),s(n,ce),Be&&Be.m(n,null),ve=!0,Me||(oe=[ee(a,"change",t[75]),ee(p,"change",t[76]),ee(N,"input",t[77]),ee(O,"change",t[78]),ee(G,"input",t[79]),ee(H,"change",t[80]),ee(ke,"input",t[81]),ee(Se,"input",t[82]),ee(Re,"input",t[83]),ee(w,"input",t[84]),ee(J,"input",t[85])],Me=!0)},p(_e,ye){ye[0]&8&&(a.checked=_e[3].i.h.u);const vt={};ye[0]&1&&(vt.chip=_e[0].chip),b.$set(vt),ye[0]&8&&qe(p,_e[3].i.h.p),(!ve||ye[0]&64)&&r(N,"max",_e[6]),ye[0]&8&&he(N.value)!==_e[3].i.a&&te(N,_e[3].i.a),ye[0]&8&&(O.checked=_e[3].i.l.i),(!ve||ye[0]&64)&&r(G,"max",_e[6]),ye[0]&8&&he(G.value)!==_e[3].i.l.p&&te(G,_e[3].i.l.p),ye[0]&8&&(H.checked=_e[3].i.r.i),(!ve||ye[0]&64)&&r(ke,"max",_e[6]),ye[0]&8&&he(ke.value)!==_e[3].i.r.r&&te(ke,_e[3].i.r.r),(!ve||ye[0]&64)&&r(Se,"max",_e[6]),ye[0]&8&&he(Se.value)!==_e[3].i.r.g&&te(Se,_e[3].i.r.g),(!ve||ye[0]&64)&&r(Re,"max",_e[6]),ye[0]&8&&he(Re.value)!==_e[3].i.r.b&&te(Re,_e[3].i.r.b),(!ve||ye[0]&64)&&r(w,"max",_e[6]),ye[0]&8&&he(w.value)!==_e[3].i.t.d&&te(w,_e[3].i.t.d),(!ve||ye[0]&64)&&r(J,"max",_e[6]),ye[0]&8&&he(J.value)!==_e[3].i.t.a&&te(J,_e[3].i.t.a),_e[0].chip!="esp8266"?pe?pe.p(_e,ye):(pe=Sf(_e),pe.c(),pe.m(n,ce)):pe&&(pe.d(1),pe=null),_e[3].i.v.p>0?Be?Be.p(_e,ye):(Be=Tf(_e),Be.c(),Be.m(n,null)):Be&&(Be.d(1),Be=null)},i(_e){ve||(D(b.$$.fragment,_e),ve=!0)},o(_e){q(b.$$.fragment,_e),ve=!1},d(_e){_e&&C(e),_e&&C(l),_e&&C(n),ne(b),pe&&pe.d(),Be&&Be.d(),Me=!1,ze(oe)}}}function Sf(t){let e,l,n,i,o,u,a;return{c(){e=m("div"),l=S("Vcc"),n=m("br"),i=h(),o=m("input"),r(o,"name","ivp"),r(o,"type","number"),r(o,"min","0"),r(o,"max",t[6]),r(o,"class","in-s tr w-full"),r(e,"class","my-1 pl-1 w-1/3")},m(c,f){$(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),te(o,t[3].i.v.p),u||(a=ee(o,"input",t[86]),u=!0)},p(c,f){f[0]&64&&r(o,"max",c[6]),f[0]&8&&he(o.value)!==c[3].i.v.p&&te(o,c[3].i.v.p)},d(c){c&&C(e),u=!1,a()}}}function Tf(t){let e,l,n,i,o,u,a,c,f,_;return{c(){e=m("div"),l=S("Voltage divider"),n=m("br"),i=h(),o=m("div"),u=m("input"),a=h(),c=m("input"),r(u,"name","ivdv"),r(u,"type","number"),r(u,"min","0"),r(u,"max","65535"),r(u,"class","in-f tr w-full"),r(u,"placeholder","VCC"),r(c,"name","ivdg"),r(c,"type","number"),r(c,"min","0"),r(c,"max","65535"),r(c,"class","in-l tr w-full"),r(c,"placeholder","GND"),r(o,"class","flex"),r(e,"class","my-1")},m(p,b){$(p,e,b),s(e,l),s(e,n),s(e,i),s(e,o),s(o,u),te(u,t[3].i.v.d.v),s(o,a),s(o,c),te(c,t[3].i.v.d.g),f||(_=[ee(u,"input",t[87]),ee(c,"input",t[88])],f=!0)},p(p,b){b[0]&8&&he(u.value)!==p[3].i.v.d.v&&te(u,p[3].i.v.d.v),b[0]&8&&he(c.value)!==p[3].i.v.d.g&&te(c,p[3].i.v.d.g)},d(p){p&&C(e),f=!1,ze(_)}}}function Nf(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,M,y,T,N=(t[0].board==2||t[0].board==100)&&Af(t);return{c(){e=m("input"),l=h(),n=m("div"),i=m("div"),o=S("Vcc offset"),u=m("br"),a=h(),c=m("input"),f=h(),_=m("div"),p=S("Multiplier"),b=m("br"),v=h(),d=m("input"),M=h(),N&&N.c(),r(e,"type","hidden"),r(e,"name","iv"),e.value="true",r(c,"name","ivo"),r(c,"type","number"),r(c,"min","0.0"),r(c,"max","3.5"),r(c,"step","0.01"),r(c,"class","in-f tr w-full"),r(i,"class","w-1/3"),r(d,"name","ivm"),r(d,"type","number"),r(d,"min","0.1"),r(d,"max","10"),r(d,"step","0.01"),r(d,"class","in-l tr w-full"),r(_,"class","w-1/3 pr-1"),r(n,"class","my-1 flex flex-wrap")},m(E,B){$(E,e,B),$(E,l,B),$(E,n,B),s(n,i),s(i,o),s(i,u),s(i,a),s(i,c),te(c,t[3].i.v.o),s(n,f),s(n,_),s(_,p),s(_,b),s(_,v),s(_,d),te(d,t[3].i.v.m),s(n,M),N&&N.m(n,null),y||(T=[ee(c,"input",t[89]),ee(d,"input",t[90])],y=!0)},p(E,B){B[0]&8&&he(c.value)!==E[3].i.v.o&&te(c,E[3].i.v.o),B[0]&8&&he(d.value)!==E[3].i.v.m&&te(d,E[3].i.v.m),E[0].board==2||E[0].board==100?N?N.p(E,B):(N=Af(E),N.c(),N.m(n,null)):N&&(N.d(1),N=null)},d(E){E&&C(e),E&&C(l),E&&C(n),N&&N.d(),y=!1,ze(T)}}}function Af(t){let e,l,n,i,o,u,a;return{c(){e=m("div"),l=S("Boot limit"),n=m("br"),i=h(),o=m("input"),r(o,"name","ivb"),r(o,"type","number"),r(o,"min","2.5"),r(o,"max","3.5"),r(o,"step","0.1"),r(o,"class","in-s tr w-full"),r(e,"class","w-1/3 pl-1")},m(c,f){$(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),te(o,t[3].i.v.b),u||(a=ee(o,"input",t[91]),u=!0)},p(c,f){f[0]&8&&he(o.value)!==c[3].i.v.b&&te(o,c[3].i.v.b)},d(c){c&&C(e),u=!1,a()}}}function Pf(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,M,y,T=t[3].d.t&&Ef();return{c(){e=m("div"),e.textContent="Debug can cause sudden reboots. Do not leave on!",l=h(),n=m("div"),i=m("label"),o=m("input"),u=S(" Enable telnet"),a=h(),T&&T.c(),c=h(),f=m("div"),_=m("select"),p=m("option"),p.textContent="Verbose",b=m("option"),b.textContent="Debug",v=m("option"),v.textContent="Info",d=m("option"),d.textContent="Warning",r(e,"class","bd-red"),r(o,"type","checkbox"),r(o,"name","dt"),o.__value="true",o.value=o.__value,r(o,"class","rounded mb-1"),r(n,"class","my-1"),p.__value=1,p.value=p.__value,b.__value=2,b.value=b.__value,v.__value=3,v.value=v.__value,d.__value=4,d.value=d.__value,r(_,"name","dl"),r(_,"class","in-s"),t[3].d.l===void 0&&tt(()=>t[94].call(_)),r(f,"class","my-1")},m(N,E){$(N,e,E),$(N,l,E),$(N,n,E),s(n,i),s(i,o),o.checked=t[3].d.t,s(i,u),$(N,a,E),T&&T.m(N,E),$(N,c,E),$(N,f,E),s(f,_),s(_,p),s(_,b),s(_,v),s(_,d),qe(_,t[3].d.l,!0),M||(y=[ee(o,"change",t[93]),ee(_,"change",t[94])],M=!0)},p(N,E){E[0]&8&&(o.checked=N[3].d.t),N[3].d.t?T||(T=Ef(),T.c(),T.m(c.parentNode,c)):T&&(T.d(1),T=null),E[0]&8&&qe(_,N[3].d.l)},d(N){N&&C(e),N&&C(l),N&&C(n),N&&C(a),T&&T.d(N),N&&C(c),N&&C(f),M=!1,ze(y)}}}function Ef(t){let e;return{c(){e=m("div"),e.textContent="Telnet is unsafe and should be off when not in use",r(e,"class","bd-red")},m(l,n){$(l,e,n)},d(l){l&&C(e)}}}function kp(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,M,y,T,N,E,B,P,L,O,F,x,j,z,G,V,W,U,K,H,Y,Z,re,ue,ke,me,Se,je,Re,He,we,Te,Le,$e,w,g,k,A,I,Q,J,se,ce,ve,Me,oe,pe,Be,_e,ye,vt,Hl,tl,ct,Tl,pl,Ht,ht,Qe,Xe,Ze,Ue,Je,We,xe,et,de,Ce,Ei,_l,_n,Tt,Di,Ii,Ri,dl,Li,Oi,Fi,Nt,Nl,Al,Pl,qi,Ge,Ae,vl,Ts,El,Rt,Bi,Wl,Ao,ll,Ui,Po,Ns,Eo,ci,Wt,Do,Io,Dl,nl,Il,Ro,ji,Lo,pt,Rl,Oo,Hi,dn,vn,hn,bn,Wi,Fo,At,zi,qo,zl,Bo,Uo,jo,il,gn,kn,Ho,wn,Gl,Wo,zo,Go,yn,zt,Vo,Gi,Ko,Vl,Yo,Qo,Xo,Cn,Gt,Zo,Vi,Jo,As,xo,Kl,Ki,Vt,er,tr,lr,Ps,Yi,Kt,nr,ir,sr,mt,Qi,or,$n,Mn,rr,mi,ar,Yl,ur,fr,cr,hl,mr,Ql,pr,_r,dr,bl,vr,Sn,Xl,hr,br,gr,Lt,Tn,Nn,An,Pn,kr,Zl,wr,yr,Cr,En,Ot,$r,Xi,Mr,Zi,Ji,Yt,Sr,Tr,ut,xi,Nr,Dn,In,Ar,Jl,Pr,Er,Dr,Ll,sl,Rn,Ln,Ir,Pt,es,ts,Rr,Et,On,ls,ns,Lr,Es,is,ss,Qt,Or,Fr,pi,qr,Ol,Br,_i,Xt,Ur,jr,Hr,os,gl,Wr,Ye,rs,zr,Fn,qn,Gr,di,Vr,ol,Kr,Ds,Yr,Qr,Bn,kl,Xr,Zt,Zr,Is,xl,Jr,xr,ea,wl,ta,en,la,na,ia,yl,sa,Un,jn,oa,ra,aa,Cl,ua,Hn,fa,ca,ma,bt,Wn,zn,Gn,Vn,Kn,Yn,pa,tn,_a,da,va,$l,ha,Rs,Ls,Os,Fs=t[3].p.r.startsWith("10YNO")||t[3].p.r.startsWith("10Y1001A1001A4"),qs,rl,as,ba,Qn,Xn,ga,vi,ka,hi,wa,Bs,Dt,us,ya,Zn,Jn,Ca,bi,$a,fs,cs,Jt,Ma,Sa,Ta,Fl,Us,xn,Na,ms,ei,Aa,ps,js,ln,Hs,nn,Ws,sn,zs,on,Ft,Gs,Pa;a=new Bt({}),F=new Xm({});let Zc=["NOK","SEK","DKK","EUR"],gi=[];for(let R=0;R<4;R+=1)gi[R]=op(sp(t,Zc,R));let gt=t[3].p.e&&t[0].chip!="esp8266"&&af(t),kt=t[3].g.s>0&&uf(t);Rt=new Bt({});let Jc=[24,48,96,192,384,576,1152],ki=[];for(let R=0;R<7;R+=1)ki[R]=rp(ip(t,Jc,R));let wt=t[3].m.e.e&&ff(t),yt=t[3].m.e.e&&cf(t),Ct=t[3].m.m.e&&mf(t);Mn=new Bt({}),In=new Bt({}),On=new Qc({});let $t=t[3].n.m=="static"&&pf(t);qn=new Bt({});let Mt=t[0].chip!="esp8266"&&_f(t),lt=t[3].q.s.e&&df(t),nt=t[3].q.m==3&&vf(t),it=t[3].q.m==4&&hf(t),st=t[3].c.es!=null&&bf(t),ot=Fs&&wf(t);Xn=new Bt({});let ti=t[7],_t=[];for(let R=0;R20||t[0].chip=="esp8266")&&$f(t);Jn=new Bt({});let St=t[3].d.s&&Pf(t);return ln=new It({props:{active:t[1],message:"Loading configuration"}}),nn=new It({props:{active:t[2],message:"Saving configuration"}}),sn=new It({props:{active:t[4],message:"Performing factory reset"}}),on=new It({props:{active:t[5],message:"Device have been factory reset and switched to AP mode"}}),{c(){e=m("form"),l=m("div"),n=m("div"),i=m("strong"),i.textContent="General",o=h(),u=m("a"),ie(a.$$.fragment),c=h(),f=m("input"),_=h(),p=m("div"),b=m("div"),v=m("div"),d=S("Hostname"),M=m("br"),y=h(),T=m("input"),N=h(),E=m("div"),B=S("Time zone"),P=m("br"),L=h(),O=m("select"),ie(F.$$.fragment),x=h(),j=m("input"),z=h(),G=m("div"),V=m("div"),W=m("div"),U=S("Price region"),K=m("br"),H=h(),Y=m("select"),Z=m("optgroup"),re=m("option"),re.textContent="NO1",ue=m("option"),ue.textContent="NO2",ke=m("option"),ke.textContent="NO3",me=m("option"),me.textContent="NO4",Se=m("option"),Se.textContent="NO5",je=m("optgroup"),Re=m("option"),Re.textContent="SE1",He=m("option"),He.textContent="SE2",we=m("option"),we.textContent="SE3",Te=m("option"),Te.textContent="SE4",Le=m("optgroup"),$e=m("option"),$e.textContent="DK1",w=m("option"),w.textContent="DK2",g=m("option"),g.textContent="Austria",k=m("option"),k.textContent="Belgium",A=m("option"),A.textContent="Czech Republic",I=m("option"),I.textContent="Estonia",Q=m("option"),Q.textContent="Finland",J=m("option"),J.textContent="France",se=m("option"),se.textContent="Germany",ce=m("option"),ce.textContent="Great Britain",ve=m("option"),ve.textContent="Latvia",Me=m("option"),Me.textContent="Lithuania",oe=m("option"),oe.textContent="Netherland",pe=m("option"),pe.textContent="Poland",Be=m("option"),Be.textContent="Switzerland",_e=h(),ye=m("div"),vt=S("Currency"),Hl=m("br"),tl=h(),ct=m("select");for(let R=0;R<4;R+=1)gi[R].c();Tl=h(),pl=m("div"),Ht=m("div"),ht=m("div"),Qe=S("Fixed price"),Xe=m("br"),Ze=h(),Ue=m("input"),Je=h(),We=m("div"),xe=S("Multiplier"),et=m("br"),de=h(),Ce=m("input"),Ei=h(),_l=m("div"),_n=m("label"),Tt=m("input"),Di=S(" Enable price fetch from remote server"),Ii=h(),gt&>.c(),Ri=h(),dl=m("div"),Li=S("Security"),Oi=m("br"),Fi=h(),Nt=m("select"),Nl=m("option"),Nl.textContent="None",Al=m("option"),Al.textContent="Only configuration",Pl=m("option"),Pl.textContent="Everything",qi=h(),kt&&kt.c(),Ge=h(),Ae=m("div"),vl=m("strong"),vl.textContent="Meter",Ts=h(),El=m("a"),ie(Rt.$$.fragment),Bi=h(),Wl=m("input"),Ao=h(),ll=m("div"),Ui=m("span"),Ui.textContent="Buffer size",Po=h(),Ns=m("span"),Ns.textContent="Serial conf.",Eo=h(),ci=m("label"),Wt=m("input"),Do=S(" inverted"),Io=h(),Dl=m("div"),nl=m("select"),Il=m("option"),Ro=S("Autodetect");for(let R=0;R<7;R+=1)ki[R].c();Lo=h(),pt=m("select"),Rl=m("option"),Oo=S("-"),dn=m("option"),dn.textContent="7N1",vn=m("option"),vn.textContent="8N1",hn=m("option"),hn.textContent="7E1",bn=m("option"),bn.textContent="8E1",Fo=h(),At=m("input"),qo=h(),zl=m("div"),Bo=S("Voltage"),Uo=m("br"),jo=h(),il=m("select"),gn=m("option"),gn.textContent="400V (TN)",kn=m("option"),kn.textContent="230V (IT/TT)",Ho=h(),wn=m("div"),Gl=m("div"),Wo=S("Main fuse"),zo=m("br"),Go=h(),yn=m("label"),zt=m("input"),Vo=h(),Gi=m("span"),Gi.textContent="A",Ko=h(),Vl=m("div"),Yo=S("Production"),Qo=m("br"),Xo=h(),Cn=m("label"),Gt=m("input"),Zo=h(),Vi=m("span"),Vi.textContent="kWp",Jo=h(),As=m("div"),xo=h(),Kl=m("div"),Ki=m("label"),Vt=m("input"),er=S(" Meter is encrypted"),tr=h(),wt&&wt.c(),lr=h(),yt&&yt.c(),Ps=h(),Yi=m("label"),Kt=m("input"),nr=S(" Multipliers"),ir=h(),Ct&&Ct.c(),sr=h(),mt=m("div"),Qi=m("strong"),Qi.textContent="WiFi",or=h(),$n=m("a"),ie(Mn.$$.fragment),rr=h(),mi=m("input"),ar=h(),Yl=m("div"),ur=S("SSID"),fr=m("br"),cr=h(),hl=m("input"),mr=h(),Ql=m("div"),pr=S("Password"),_r=m("br"),dr=h(),bl=m("input"),vr=h(),Sn=m("div"),Xl=m("div"),hr=S("Power saving"),br=m("br"),gr=h(),Lt=m("select"),Tn=m("option"),Tn.textContent="Default",Nn=m("option"),Nn.textContent="Off",An=m("option"),An.textContent="Minimum",Pn=m("option"),Pn.textContent="Maximum",kr=h(),Zl=m("div"),wr=S("Power"),yr=m("br"),Cr=h(),En=m("div"),Ot=m("input"),$r=h(),Xi=m("span"),Xi.textContent="dBm",Mr=h(),Zi=m("div"),Ji=m("label"),Yt=m("input"),Sr=S(" Allow 802.11b legacy rates"),Tr=h(),ut=m("div"),xi=m("strong"),xi.textContent="Network",Nr=h(),Dn=m("a"),ie(In.$$.fragment),Ar=h(),Jl=m("div"),Pr=S("IP"),Er=m("br"),Dr=h(),Ll=m("div"),sl=m("select"),Rn=m("option"),Rn.textContent="DHCP",Ln=m("option"),Ln.textContent="Static",Ir=h(),Pt=m("input"),Rr=h(),Et=m("select"),ie(On.$$.fragment),Lr=h(),$t&&$t.c(),Es=h(),is=m("div"),ss=m("label"),Qt=m("input"),Or=S(" enable mDNS"),Fr=h(),pi=m("input"),qr=h(),Ol=m("div"),Br=S("NTP "),_i=m("label"),Xt=m("input"),Ur=S(" obtain from DHCP"),jr=m("br"),Hr=h(),os=m("div"),gl=m("input"),Wr=h(),Ye=m("div"),rs=m("strong"),rs.textContent="MQTT",zr=h(),Fn=m("a"),ie(qn.$$.fragment),Gr=h(),di=m("input"),Vr=h(),ol=m("div"),Kr=S(`Server `),Mt&&Mt.c(),Ds=h(),Yr=m("br"),Qr=h(),Bn=m("div"),kl=m("input"),Xr=h(),Zt=m("input"),Zr=h(),lt&<.c(),Is=h(),xl=m("div"),Jr=S("Username"),xr=m("br"),ea=h(),wl=m("input"),ta=h(),en=m("div"),la=S("Password"),na=m("br"),ia=h(),yl=m("input"),sa=h(),Un=m("div"),jn=m("div"),oa=S("Client ID"),ra=m("br"),aa=h(),Cl=m("input"),ua=h(),Hn=m("div"),fa=S("Payload"),ca=m("br"),ma=h(),bt=m("select"),Wn=m("option"),Wn.textContent="JSON",zn=m("option"),zn.textContent="Raw (minimal)",Gn=m("option"),Gn.textContent="Raw (full)",Vn=m("option"),Vn.textContent="Domoticz",Kn=m("option"),Kn.textContent="HomeAssistant",Yn=m("option"),Yn.textContent="HEX dump",pa=h(),tn=m("div"),_a=S("Publish topic"),da=m("br"),va=h(),$l=m("input"),ha=h(),nt&&nt.c(),Rs=h(),it&&it.c(),Ls=h(),st&&st.c(),Os=h(),ot&&ot.c(),qs=h(),rl=m("div"),as=m("strong"),as.textContent="User interface",ba=h(),Qn=m("a"),ie(Xn.$$.fragment),ga=h(),vi=m("input"),ka=h(),hi=m("div");for(let R=0;R<_t.length;R+=1)_t[R].c();wa=h(),rt&&rt.c(),Bs=h(),Dt=m("div"),us=m("strong"),us.textContent="Debugging",ya=h(),Zn=m("a"),ie(Jn.$$.fragment),Ca=h(),bi=m("input"),$a=h(),fs=m("div"),cs=m("label"),Jt=m("input"),Ma=S(" Enable debugging"),Sa=h(),St&&St.c(),Ta=h(),Fl=m("div"),Us=m("div"),xn=m("button"),xn.textContent="Factory reset",Na=h(),ms=m("div"),ei=m("button"),ei.textContent="Reboot",Aa=h(),ps=m("div"),ps.innerHTML='',js=h(),ie(ln.$$.fragment),Hs=h(),ie(nn.$$.fragment),Ws=h(),ie(sn.$$.fragment),zs=h(),ie(on.$$.fragment),r(i,"class","text-sm"),r(u,"href",Ut("General-configuration")),r(u,"target","_blank"),r(u,"class","float-right"),r(f,"type","hidden"),r(f,"name","g"),f.value="true",r(T,"name","gh"),r(T,"type","text"),r(T,"class","in-f w-full"),r(T,"pattern","[A-Za-z0-9-]+"),r(O,"name","gt"),r(O,"class","in-l w-full"),t[3].g.t===void 0&&tt(()=>t[16].call(O)),r(b,"class","flex"),r(p,"class","my-1"),r(j,"type","hidden"),r(j,"name","p"),j.value="true",re.__value="10YNO-1--------2",re.value=re.__value,ue.__value="10YNO-2--------T",ue.value=ue.__value,ke.__value="10YNO-3--------J",ke.value=ke.__value,me.__value="10YNO-4--------9",me.value=me.__value,Se.__value="10Y1001A1001A48H",Se.value=Se.__value,r(Z,"label","Norway"),Re.__value="10Y1001A1001A44P",Re.value=Re.__value,He.__value="10Y1001A1001A45N",He.value=He.__value,we.__value="10Y1001A1001A46L",we.value=we.__value,Te.__value="10Y1001A1001A47J",Te.value=Te.__value,r(je,"label","Sweden"),$e.__value="10YDK-1--------W",$e.value=$e.__value,w.__value="10YDK-2--------M",w.value=w.__value,r(Le,"label","Denmark"),g.__value="10YAT-APG------L",g.value=g.__value,k.__value="10YBE----------2",k.value=k.__value,A.__value="10YCZ-CEPS-----N",A.value=A.__value,I.__value="10Y1001A1001A39I",I.value=I.__value,Q.__value="10YFI-1--------U",Q.value=Q.__value,J.__value="10YFR-RTE------C",J.value=J.__value,se.__value="10Y1001A1001A83F",se.value=se.__value,ce.__value="10YGB----------A",ce.value=ce.__value,ve.__value="10YLV-1001A00074",ve.value=ve.__value,Me.__value="10YLT-1001A0008Q",Me.value=Me.__value,oe.__value="10YNL----------L",oe.value=oe.__value,pe.__value="10YPL-AREA-----S",pe.value=pe.__value,Be.__value="10YCH-SWISSGRIDZ",Be.value=Be.__value,r(Y,"name","pr"),r(Y,"class","in-f w-full"),t[3].p.r===void 0&&tt(()=>t[17].call(Y)),r(W,"class","w-full"),r(ct,"name","pc"),r(ct,"class","in-l"),t[3].p.c===void 0&&tt(()=>t[18].call(ct)),r(V,"class","flex"),r(G,"class","my-1"),r(Ue,"name","pf"),r(Ue,"type","number"),r(Ue,"min","0.001"),r(Ue,"max","65"),r(Ue,"step","0.001"),r(Ue,"class","in-f tr w-full"),r(ht,"class","w-1/2"),r(Ce,"name","pm"),r(Ce,"type","number"),r(Ce,"min","0.001"),r(Ce,"max","1000"),r(Ce,"step","0.001"),r(Ce,"class","in-l tr w-full"),r(We,"class","w-1/2"),r(Ht,"class","flex"),r(pl,"class","my-1"),r(Tt,"type","checkbox"),r(Tt,"name","pe"),Tt.__value="true",Tt.value=Tt.__value,r(Tt,"class","rounded mb-1"),r(_l,"class","my-1"),Nl.__value=0,Nl.value=Nl.__value,Al.__value=1,Al.value=Al.__value,Pl.__value=2,Pl.value=Pl.__value,r(Nt,"name","gs"),r(Nt,"class","in-s"),t[3].g.s===void 0&&tt(()=>t[23].call(Nt)),r(dl,"class","my-1"),r(n,"class","cnt"),r(vl,"class","text-sm"),r(El,"href",Ut("Meter-configuration")),r(El,"target","_blank"),r(El,"class","float-right"),r(Wl,"type","hidden"),r(Wl,"name","m"),Wl.value="true",r(Ui,"class","float-right"),r(Wt,"name","mi"),Wt.__value="true",Wt.value=Wt.__value,r(Wt,"type","checkbox"),r(Wt,"class","rounded mb-1"),r(ci,"class","mt-2 ml-3 whitespace-nowrap"),Il.__value=0,Il.value=Il.__value,Il.disabled=ji=t[3].m.b!=0,r(nl,"name","mb"),r(nl,"class","in-f tr w-1/2"),t[3].m.b===void 0&&tt(()=>t[27].call(nl)),Rl.__value=0,Rl.value=Rl.__value,Rl.disabled=Hi=t[3].m.b!=0,dn.__value=2,dn.value=dn.__value,vn.__value=3,vn.value=vn.__value,hn.__value=10,hn.value=hn.__value,bn.__value=11,bn.value=bn.__value,r(pt,"name","mp"),r(pt,"class","in-m"),pt.disabled=Wi=t[3].m.b==0,t[3].m.p===void 0&&tt(()=>t[28].call(pt)),r(At,"name","ms"),r(At,"type","number"),r(At,"min",64),r(At,"max",zi=t[0].chip=="esp8266"?t[3].i.h.p==3||t[3].i.h.p==113?512:128:4096),r(At,"step",64),r(At,"class","in-l tr w-1/2"),r(Dl,"class","flex w-full"),r(ll,"class","my-1"),gn.__value=2,gn.value=gn.__value,kn.__value=1,kn.value=kn.__value,r(il,"name","md"),r(il,"class","in-s"),t[3].m.d===void 0&&tt(()=>t[30].call(il)),r(zl,"class","my-1"),r(zt,"name","mf"),r(zt,"type","number"),r(zt,"min","5"),r(zt,"max","65535"),r(zt,"class","in-f tr w-full"),r(Gi,"class","in-post"),r(yn,"class","flex"),r(Gl,"class","mx-1"),r(Gt,"name","mr"),r(Gt,"type","number"),r(Gt,"min","0"),r(Gt,"max","65535"),r(Gt,"class","in-f tr w-full"),r(Vi,"class","in-post"),r(Cn,"class","flex"),r(Vl,"class","mx-1"),r(wn,"class","my-1 flex"),r(As,"class","my-1"),r(Vt,"type","checkbox"),r(Vt,"name","me"),Vt.__value="true",Vt.value=Vt.__value,r(Vt,"class","rounded mb-1"),r(Kl,"class","my-1"),r(Kt,"type","checkbox"),r(Kt,"name","mm"),Kt.__value="true",Kt.value=Kt.__value,r(Kt,"class","rounded mb-1"),r(Ae,"class","cnt"),r(Qi,"class","text-sm"),r($n,"href",Ut("WiFi-configuration")),r($n,"target","_blank"),r($n,"class","float-right"),r(mi,"type","hidden"),r(mi,"name","w"),mi.value="true",r(hl,"name","ws"),r(hl,"type","text"),r(hl,"class","in-s"),r(Yl,"class","my-1"),r(bl,"name","wp"),r(bl,"type","password"),r(bl,"class","in-s"),r(Ql,"class","my-1"),Tn.__value=255,Tn.value=Tn.__value,Nn.__value=0,Nn.value=Nn.__value,An.__value=1,An.value=An.__value,Pn.__value=2,Pn.value=Pn.__value,r(Lt,"name","wz"),r(Lt,"class","in-s"),t[3].w.z===void 0&&tt(()=>t[43].call(Lt)),r(Xl,"class","w-1/2"),r(Ot,"name","ww"),r(Ot,"type","number"),r(Ot,"min","0"),r(Ot,"max","20.5"),r(Ot,"step","0.5"),r(Ot,"class","in-f tr w-full"),r(Xi,"class","in-post"),r(En,"class","flex"),r(Zl,"class","ml-2 w-1/2"),r(Sn,"class","my-1 flex"),r(Yt,"type","checkbox"),r(Yt,"name","wb"),Yt.__value="true",Yt.value=Yt.__value,r(Yt,"class","rounded mb-1"),r(Zi,"class","my-3"),r(mt,"class","cnt"),r(xi,"class","text-sm"),r(Dn,"href",Ut("Network-configuration")),r(Dn,"target","_blank"),r(Dn,"class","float-right"),Rn.__value="dhcp",Rn.value=Rn.__value,Ln.__value="static",Ln.value=Ln.__value,r(sl,"name","nm"),r(sl,"class","in-f"),t[3].n.m===void 0&&tt(()=>t[46].call(sl)),r(Pt,"name","ni"),r(Pt,"type","text"),r(Pt,"class","in-m w-full"),Pt.disabled=es=t[3].n.m=="dhcp",Pt.required=ts=t[3].n.m=="static",r(Et,"name","ns"),r(Et,"class","in-l"),Et.disabled=ls=t[3].n.m=="dhcp",Et.required=ns=t[3].n.m=="static",t[3].n.s===void 0&&tt(()=>t[48].call(Et)),r(Ll,"class","flex"),r(Jl,"class","my-1"),r(Qt,"name","nd"),Qt.__value="true",Qt.value=Qt.__value,r(Qt,"type","checkbox"),r(Qt,"class","rounded mb-1"),r(is,"class","my-1"),r(pi,"type","hidden"),r(pi,"name","ntp"),pi.value="true",r(Xt,"name","ntpd"),Xt.__value="true",Xt.value=Xt.__value,r(Xt,"type","checkbox"),r(Xt,"class","rounded mb-1"),r(_i,"class","ml-4"),r(gl,"name","ntph"),r(gl,"type","text"),r(gl,"class","in-s"),r(os,"class","flex"),r(Ol,"class","my-1"),r(ut,"class","cnt"),r(rs,"class","text-sm"),r(Fn,"href",Ut("MQTT-configuration")),r(Fn,"target","_blank"),r(Fn,"class","float-right"),r(di,"type","hidden"),r(di,"name","q"),di.value="true",r(kl,"name","qh"),r(kl,"type","text"),r(kl,"class","in-f w-3/4"),r(Zt,"name","qp"),r(Zt,"type","number"),r(Zt,"min","1024"),r(Zt,"max","65535"),r(Zt,"class","in-l tr w-1/4"),r(Bn,"class","flex"),r(ol,"class","my-1"),r(wl,"name","qu"),r(wl,"type","text"),r(wl,"class","in-s"),r(xl,"class","my-1"),r(yl,"name","qa"),r(yl,"type","password"),r(yl,"class","in-s"),r(en,"class","my-1"),r(Cl,"name","qc"),r(Cl,"type","text"),r(Cl,"class","in-f w-full"),Wn.__value=0,Wn.value=Wn.__value,zn.__value=1,zn.value=zn.__value,Gn.__value=2,Gn.value=Gn.__value,Vn.__value=3,Vn.value=Vn.__value,Kn.__value=4,Kn.value=Kn.__value,Yn.__value=255,Yn.value=Yn.__value,r(bt,"name","qm"),r(bt,"class","in-l"),t[3].q.m===void 0&&tt(()=>t[61].call(bt)),r(Un,"class","my-1 flex"),r($l,"name","qb"),r($l,"type","text"),r($l,"class","in-s"),r(tn,"class","my-1"),r(Ye,"class","cnt"),r(as,"class","text-sm"),r(Qn,"href",Ut("User-interface")),r(Qn,"target","_blank"),r(Qn,"class","float-right"),r(vi,"type","hidden"),r(vi,"name","u"),vi.value="true",r(hi,"class","flex flex-wrap"),r(rl,"class","cnt"),r(us,"class","text-sm"),r(Zn,"href","https://amsleser.no/blog/post/24-telnet-debug"),r(Zn,"target","_blank"),r(Zn,"class","float-right"),r(bi,"type","hidden"),r(bi,"name","d"),bi.value="true",r(Jt,"type","checkbox"),r(Jt,"name","ds"),Jt.__value="true",Jt.value=Jt.__value,r(Jt,"class","rounded mb-1"),r(fs,"class","mt-3"),r(Dt,"class","cnt"),r(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),r(xn,"type","button"),r(xn,"class","py-2 px-4 rounded bg-red-500 text-white ml-2"),r(ei,"type","button"),r(ei,"class","py-2 px-4 rounded bg-yellow-500 text-white"),r(ms,"class","text-center"),r(ps,"class","text-right"),r(Fl,"class","grid grid-cols-3"),r(e,"autocomplete","off")},m(R,ae){$(R,e,ae),s(e,l),s(l,n),s(n,i),s(n,o),s(n,u),le(a,u,null),s(n,c),s(n,f),s(n,_),s(n,p),s(p,b),s(b,v),s(v,d),s(v,M),s(v,y),s(v,T),te(T,t[3].g.h),s(b,N),s(b,E),s(E,B),s(E,P),s(E,L),s(E,O),le(F,O,null),qe(O,t[3].g.t,!0),s(n,x),s(n,j),s(n,z),s(n,G),s(G,V),s(V,W),s(W,U),s(W,K),s(W,H),s(W,Y),s(Y,Z),s(Z,re),s(Z,ue),s(Z,ke),s(Z,me),s(Z,Se),s(Y,je),s(je,Re),s(je,He),s(je,we),s(je,Te),s(Y,Le),s(Le,$e),s(Le,w),s(Y,g),s(Y,k),s(Y,A),s(Y,I),s(Y,Q),s(Y,J),s(Y,se),s(Y,ce),s(Y,ve),s(Y,Me),s(Y,oe),s(Y,pe),s(Y,Be),qe(Y,t[3].p.r,!0),s(V,_e),s(V,ye),s(ye,vt),s(ye,Hl),s(ye,tl),s(ye,ct);for(let ft=0;ft<4;ft+=1)gi[ft]&&gi[ft].m(ct,null);qe(ct,t[3].p.c,!0),s(n,Tl),s(n,pl),s(pl,Ht),s(Ht,ht),s(ht,Qe),s(ht,Xe),s(ht,Ze),s(ht,Ue),te(Ue,t[3].p.f),s(Ht,Je),s(Ht,We),s(We,xe),s(We,et),s(We,de),s(We,Ce),te(Ce,t[3].p.m),s(n,Ei),s(n,_l),s(_l,_n),s(_n,Tt),Tt.checked=t[3].p.e,s(_n,Di),s(_l,Ii),gt&>.m(_l,null),s(n,Ri),s(n,dl),s(dl,Li),s(dl,Oi),s(dl,Fi),s(dl,Nt),s(Nt,Nl),s(Nt,Al),s(Nt,Pl),qe(Nt,t[3].g.s,!0),s(n,qi),kt&&kt.m(n,null),s(l,Ge),s(l,Ae),s(Ae,vl),s(Ae,Ts),s(Ae,El),le(Rt,El,null),s(Ae,Bi),s(Ae,Wl),s(Ae,Ao),s(Ae,ll),s(ll,Ui),s(ll,Po),s(ll,Ns),s(ll,Eo),s(ll,ci),s(ci,Wt),Wt.checked=t[3].m.i,s(ci,Do),s(ll,Io),s(ll,Dl),s(Dl,nl),s(nl,Il),s(Il,Ro);for(let ft=0;ft<7;ft+=1)ki[ft]&&ki[ft].m(nl,null);qe(nl,t[3].m.b,!0),s(Dl,Lo),s(Dl,pt),s(pt,Rl),s(Rl,Oo),s(pt,dn),s(pt,vn),s(pt,hn),s(pt,bn),qe(pt,t[3].m.p,!0),s(Dl,Fo),s(Dl,At),te(At,t[3].m.s),s(Ae,qo),s(Ae,zl),s(zl,Bo),s(zl,Uo),s(zl,jo),s(zl,il),s(il,gn),s(il,kn),qe(il,t[3].m.d,!0),s(Ae,Ho),s(Ae,wn),s(wn,Gl),s(Gl,Wo),s(Gl,zo),s(Gl,Go),s(Gl,yn),s(yn,zt),te(zt,t[3].m.f),s(yn,Vo),s(yn,Gi),s(wn,Ko),s(wn,Vl),s(Vl,Yo),s(Vl,Qo),s(Vl,Xo),s(Vl,Cn),s(Cn,Gt),te(Gt,t[3].m.r),s(Cn,Zo),s(Cn,Vi),s(Ae,Jo),s(Ae,As),s(Ae,xo),s(Ae,Kl),s(Kl,Ki),s(Ki,Vt),Vt.checked=t[3].m.e.e,s(Ki,er),s(Kl,tr),wt&&wt.m(Kl,null),s(Ae,lr),yt&&yt.m(Ae,null),s(Ae,Ps),s(Ae,Yi),s(Yi,Kt),Kt.checked=t[3].m.m.e,s(Yi,nr),s(Ae,ir),Ct&&Ct.m(Ae,null),s(l,sr),s(l,mt),s(mt,Qi),s(mt,or),s(mt,$n),le(Mn,$n,null),s(mt,rr),s(mt,mi),s(mt,ar),s(mt,Yl),s(Yl,ur),s(Yl,fr),s(Yl,cr),s(Yl,hl),te(hl,t[3].w.s),s(mt,mr),s(mt,Ql),s(Ql,pr),s(Ql,_r),s(Ql,dr),s(Ql,bl),te(bl,t[3].w.p),s(mt,vr),s(mt,Sn),s(Sn,Xl),s(Xl,hr),s(Xl,br),s(Xl,gr),s(Xl,Lt),s(Lt,Tn),s(Lt,Nn),s(Lt,An),s(Lt,Pn),qe(Lt,t[3].w.z,!0),s(Sn,kr),s(Sn,Zl),s(Zl,wr),s(Zl,yr),s(Zl,Cr),s(Zl,En),s(En,Ot),te(Ot,t[3].w.w),s(En,$r),s(En,Xi),s(mt,Mr),s(mt,Zi),s(Zi,Ji),s(Ji,Yt),Yt.checked=t[3].w.b,s(Ji,Sr),s(l,Tr),s(l,ut),s(ut,xi),s(ut,Nr),s(ut,Dn),le(In,Dn,null),s(ut,Ar),s(ut,Jl),s(Jl,Pr),s(Jl,Er),s(Jl,Dr),s(Jl,Ll),s(Ll,sl),s(sl,Rn),s(sl,Ln),qe(sl,t[3].n.m,!0),s(Ll,Ir),s(Ll,Pt),te(Pt,t[3].n.i),s(Ll,Rr),s(Ll,Et),le(On,Et,null),qe(Et,t[3].n.s,!0),s(ut,Lr),$t&&$t.m(ut,null),s(ut,Es),s(ut,is),s(is,ss),s(ss,Qt),Qt.checked=t[3].n.d,s(ss,Or),s(ut,Fr),s(ut,pi),s(ut,qr),s(ut,Ol),s(Ol,Br),s(Ol,_i),s(_i,Xt),Xt.checked=t[3].n.h,s(_i,Ur),s(Ol,jr),s(Ol,Hr),s(Ol,os),s(os,gl),te(gl,t[3].n.n1),s(l,Wr),s(l,Ye),s(Ye,rs),s(Ye,zr),s(Ye,Fn),le(qn,Fn,null),s(Ye,Gr),s(Ye,di),s(Ye,Vr),s(Ye,ol),s(ol,Kr),Mt&&Mt.m(ol,null),s(ol,Ds),s(ol,Yr),s(ol,Qr),s(ol,Bn),s(Bn,kl),te(kl,t[3].q.h),s(Bn,Xr),s(Bn,Zt),te(Zt,t[3].q.p),s(Ye,Zr),lt&<.m(Ye,null),s(Ye,Is),s(Ye,xl),s(xl,Jr),s(xl,xr),s(xl,ea),s(xl,wl),te(wl,t[3].q.u),s(Ye,ta),s(Ye,en),s(en,la),s(en,na),s(en,ia),s(en,yl),te(yl,t[3].q.a),s(Ye,sa),s(Ye,Un),s(Un,jn),s(jn,oa),s(jn,ra),s(jn,aa),s(jn,Cl),te(Cl,t[3].q.c),s(Un,ua),s(Un,Hn),s(Hn,fa),s(Hn,ca),s(Hn,ma),s(Hn,bt),s(bt,Wn),s(bt,zn),s(bt,Gn),s(bt,Vn),s(bt,Kn),s(bt,Yn),qe(bt,t[3].q.m,!0),s(Ye,pa),s(Ye,tn),s(tn,_a),s(tn,da),s(tn,va),s(tn,$l),te($l,t[3].q.b),s(l,ha),nt&&nt.m(l,null),s(l,Rs),it&&it.m(l,null),s(l,Ls),st&&st.m(l,null),s(l,Os),ot&&ot.m(l,null),s(l,qs),s(l,rl),s(rl,as),s(rl,ba),s(rl,Qn),le(Xn,Qn,null),s(rl,ga),s(rl,vi),s(rl,ka),s(rl,hi);for(let ft=0;ft<_t.length;ft+=1)_t[ft]&&_t[ft].m(hi,null);s(l,wa),rt&&rt.m(l,null),s(l,Bs),s(l,Dt),s(Dt,us),s(Dt,ya),s(Dt,Zn),le(Jn,Zn,null),s(Dt,Ca),s(Dt,bi),s(Dt,$a),s(Dt,fs),s(fs,cs),s(cs,Jt),Jt.checked=t[3].d.s,s(cs,Ma),s(Dt,Sa),St&&St.m(Dt,null),s(e,Ta),s(e,Fl),s(Fl,Us),s(Us,xn),s(Fl,Na),s(Fl,ms),s(ms,ei),s(Fl,Aa),s(Fl,ps),$(R,js,ae),le(ln,R,ae),$(R,Hs,ae),le(nn,R,ae),$(R,Ws,ae),le(sn,R,ae),$(R,zs,ae),le(on,R,ae),Ft=!0,Gs||(Pa=[ee(T,"input",t[15]),ee(O,"change",t[16]),ee(Y,"change",t[17]),ee(ct,"change",t[18]),ee(Ue,"input",t[19]),ee(Ce,"input",t[20]),ee(Tt,"change",t[21]),ee(Nt,"change",t[23]),ee(Wt,"change",t[26]),ee(nl,"change",t[27]),ee(pt,"change",t[28]),ee(At,"input",t[29]),ee(il,"change",t[30]),ee(zt,"input",t[31]),ee(Gt,"input",t[32]),ee(Vt,"change",t[33]),ee(Kt,"change",t[36]),ee(hl,"input",t[41]),ee(bl,"input",t[42]),ee(Lt,"change",t[43]),ee(Ot,"input",t[44]),ee(Yt,"change",t[45]),ee(sl,"change",t[46]),ee(Pt,"input",t[47]),ee(Et,"change",t[48]),ee(Qt,"change",t[52]),ee(Xt,"change",t[53]),ee(gl,"input",t[54]),ee(kl,"input",t[56]),ee(Zt,"input",t[57]),ee(wl,"input",t[58]),ee(yl,"input",t[59]),ee(Cl,"input",t[60]),ee(bt,"change",t[61]),ee($l,"input",t[62]),ee(Jt,"change",t[92]),ee(xn,"click",t[8]),ee(ei,"click",t[10]),ee(e,"submit",Ms(t[9]))],Gs=!0)},p(R,ae){if(ae[0]&8&&T.value!==R[3].g.h&&te(T,R[3].g.h),ae[0]&8&&qe(O,R[3].g.t),ae[0]&8&&qe(Y,R[3].p.r),ae[0]&8&&qe(ct,R[3].p.c),ae[0]&8&&he(Ue.value)!==R[3].p.f&&te(Ue,R[3].p.f),ae[0]&8&&he(Ce.value)!==R[3].p.m&&te(Ce,R[3].p.m),ae[0]&8&&(Tt.checked=R[3].p.e),R[3].p.e&&R[0].chip!="esp8266"?gt?gt.p(R,ae):(gt=af(R),gt.c(),gt.m(_l,null)):gt&&(gt.d(1),gt=null),ae[0]&8&&qe(Nt,R[3].g.s),R[3].g.s>0?kt?kt.p(R,ae):(kt=uf(R),kt.c(),kt.m(n,null)):kt&&(kt.d(1),kt=null),ae[0]&8&&(Wt.checked=R[3].m.i),(!Ft||ae[0]&8&&ji!==(ji=R[3].m.b!=0))&&(Il.disabled=ji),ae[0]&8&&qe(nl,R[3].m.b),(!Ft||ae[0]&8&&Hi!==(Hi=R[3].m.b!=0))&&(Rl.disabled=Hi),(!Ft||ae[0]&8&&Wi!==(Wi=R[3].m.b==0))&&(pt.disabled=Wi),ae[0]&8&&qe(pt,R[3].m.p),(!Ft||ae[0]&9&&zi!==(zi=R[0].chip=="esp8266"?R[3].i.h.p==3||R[3].i.h.p==113?512:128:4096))&&r(At,"max",zi),ae[0]&8&&he(At.value)!==R[3].m.s&&te(At,R[3].m.s),ae[0]&8&&qe(il,R[3].m.d),ae[0]&8&&he(zt.value)!==R[3].m.f&&te(zt,R[3].m.f),ae[0]&8&&he(Gt.value)!==R[3].m.r&&te(Gt,R[3].m.r),ae[0]&8&&(Vt.checked=R[3].m.e.e),R[3].m.e.e?wt?wt.p(R,ae):(wt=ff(R),wt.c(),wt.m(Kl,null)):wt&&(wt.d(1),wt=null),R[3].m.e.e?yt?yt.p(R,ae):(yt=cf(R),yt.c(),yt.m(Ae,Ps)):yt&&(yt.d(1),yt=null),ae[0]&8&&(Kt.checked=R[3].m.m.e),R[3].m.m.e?Ct?Ct.p(R,ae):(Ct=mf(R),Ct.c(),Ct.m(Ae,null)):Ct&&(Ct.d(1),Ct=null),ae[0]&8&&hl.value!==R[3].w.s&&te(hl,R[3].w.s),ae[0]&8&&bl.value!==R[3].w.p&&te(bl,R[3].w.p),ae[0]&8&&qe(Lt,R[3].w.z),ae[0]&8&&he(Ot.value)!==R[3].w.w&&te(Ot,R[3].w.w),ae[0]&8&&(Yt.checked=R[3].w.b),ae[0]&8&&qe(sl,R[3].n.m),(!Ft||ae[0]&8&&es!==(es=R[3].n.m=="dhcp"))&&(Pt.disabled=es),(!Ft||ae[0]&8&&ts!==(ts=R[3].n.m=="static"))&&(Pt.required=ts),ae[0]&8&&Pt.value!==R[3].n.i&&te(Pt,R[3].n.i),(!Ft||ae[0]&8&&ls!==(ls=R[3].n.m=="dhcp"))&&(Et.disabled=ls),(!Ft||ae[0]&8&&ns!==(ns=R[3].n.m=="static"))&&(Et.required=ns),ae[0]&8&&qe(Et,R[3].n.s),R[3].n.m=="static"?$t?$t.p(R,ae):($t=pf(R),$t.c(),$t.m(ut,Es)):$t&&($t.d(1),$t=null),ae[0]&8&&(Qt.checked=R[3].n.d),ae[0]&8&&(Xt.checked=R[3].n.h),ae[0]&8&&gl.value!==R[3].n.n1&&te(gl,R[3].n.n1),R[0].chip!="esp8266"?Mt?Mt.p(R,ae):(Mt=_f(R),Mt.c(),Mt.m(ol,Ds)):Mt&&(Mt.d(1),Mt=null),ae[0]&8&&kl.value!==R[3].q.h&&te(kl,R[3].q.h),ae[0]&8&&he(Zt.value)!==R[3].q.p&&te(Zt,R[3].q.p),R[3].q.s.e?lt?(lt.p(R,ae),ae[0]&8&&D(lt,1)):(lt=df(R),lt.c(),D(lt,1),lt.m(Ye,Is)):lt&&(De(),q(lt,1,1,()=>{lt=null}),Ie()),ae[0]&8&&wl.value!==R[3].q.u&&te(wl,R[3].q.u),ae[0]&8&&yl.value!==R[3].q.a&&te(yl,R[3].q.a),ae[0]&8&&Cl.value!==R[3].q.c&&te(Cl,R[3].q.c),ae[0]&8&&qe(bt,R[3].q.m),ae[0]&8&&$l.value!==R[3].q.b&&te($l,R[3].q.b),R[3].q.m==3?nt?(nt.p(R,ae),ae[0]&8&&D(nt,1)):(nt=vf(R),nt.c(),D(nt,1),nt.m(l,Rs)):nt&&(De(),q(nt,1,1,()=>{nt=null}),Ie()),R[3].q.m==4?it?(it.p(R,ae),ae[0]&8&&D(it,1)):(it=hf(R),it.c(),D(it,1),it.m(l,Ls)):it&&(De(),q(it,1,1,()=>{it=null}),Ie()),R[3].c.es!=null?st?(st.p(R,ae),ae[0]&8&&D(st,1)):(st=bf(R),st.c(),D(st,1),st.m(l,Os)):st&&(De(),q(st,1,1,()=>{st=null}),Ie()),ae[0]&8&&(Fs=R[3].p.r.startsWith("10YNO")||R[3].p.r.startsWith("10Y1001A1001A4")),Fs?ot?(ot.p(R,ae),ae[0]&8&&D(ot,1)):(ot=wf(R),ot.c(),D(ot,1),ot.m(l,qs)):ot&&(De(),q(ot,1,1,()=>{ot=null}),Ie()),ae[0]&136){ti=R[7];let qt;for(qt=0;qt20||R[0].chip=="esp8266"?rt?(rt.p(R,ae),ae[0]&1&&D(rt,1)):(rt=$f(R),rt.c(),D(rt,1),rt.m(l,Bs)):rt&&(De(),q(rt,1,1,()=>{rt=null}),Ie()),ae[0]&8&&(Jt.checked=R[3].d.s),R[3].d.s?St?St.p(R,ae):(St=Pf(R),St.c(),St.m(Dt,null)):St&&(St.d(1),St=null);const ft={};ae[0]&2&&(ft.active=R[1]),ln.$set(ft);const Ea={};ae[0]&4&&(Ea.active=R[2]),nn.$set(Ea);const Da={};ae[0]&16&&(Da.active=R[4]),sn.$set(Da);const Ia={};ae[0]&32&&(Ia.active=R[5]),on.$set(Ia)},i(R){Ft||(D(a.$$.fragment,R),D(F.$$.fragment,R),D(Rt.$$.fragment,R),D(Mn.$$.fragment,R),D(In.$$.fragment,R),D(On.$$.fragment,R),D(qn.$$.fragment,R),D(lt),D(nt),D(it),D(st),D(ot),D(Xn.$$.fragment,R),D(rt),D(Jn.$$.fragment,R),D(ln.$$.fragment,R),D(nn.$$.fragment,R),D(sn.$$.fragment,R),D(on.$$.fragment,R),Ft=!0)},o(R){q(a.$$.fragment,R),q(F.$$.fragment,R),q(Rt.$$.fragment,R),q(Mn.$$.fragment,R),q(In.$$.fragment,R),q(On.$$.fragment,R),q(qn.$$.fragment,R),q(lt),q(nt),q(it),q(st),q(ot),q(Xn.$$.fragment,R),q(rt),q(Jn.$$.fragment,R),q(ln.$$.fragment,R),q(nn.$$.fragment,R),q(sn.$$.fragment,R),q(on.$$.fragment,R),Ft=!1},d(R){R&&C(e),ne(a),ne(F),cl(gi,R),gt&>.d(),kt&&kt.d(),ne(Rt),cl(ki,R),wt&&wt.d(),yt&&yt.d(),Ct&&Ct.d(),ne(Mn),ne(In),ne(On),$t&&$t.d(),ne(qn),Mt&&Mt.d(),lt&<.d(),nt&&nt.d(),it&&it.d(),st&&st.d(),ot&&ot.d(),ne(Xn),cl(_t,R),rt&&rt.d(),ne(Jn),St&&St.d(),R&&C(js),ne(ln,R),R&&C(Hs),ne(nn,R),R&&C(Ws),ne(sn,R),R&&C(zs),ne(on,R),Gs=!1,ze(Pa)}}}async function wp(){await(await fetch("/reboot",{method:"POST"})).json()}function yp(t,e,l){let{sysinfo:n={}}=e,i=[{name:"Import gauge",key:"i"},{name:"Export gauge",key:"e"},{name:"Voltage",key:"v"},{name:"Amperage",key:"a"},{name:"Reactive",key:"r"},{name:"Realtime",key:"c"},{name:"Peaks",key:"t"},{name:"Price",key:"p"},{name:"Day plot",key:"d"},{name:"Month plot",key:"m"},{name:"Temperature plot",key:"s"}],o=!0,u=!1,a={g:{t:"",h:"",s:0,u:"",p:""},m:{b:2400,p:11,i:!1,d:0,f:0,r:0,e:{e:!1,k:"",a:""},m:{e:!1,w:!1,v:!1,a:!1,c:!1}},w:{s:"",p:"",w:0,z:255,a:!0,b:!0},n:{m:"",i:"",s:"",g:"",d1:"",d2:"",d:!1,n1:"",n2:"",h:!1},q:{h:"",p:1883,u:"",a:"",b:"",s:{e:!1,c:!1,r:!0,k:!1}},o:{e:"",c:"",u1:"",u2:"",u3:""},t:{t:[0,0,0,0,0,0,0,0,0,0],h:1},p:{e:!1,t:"",r:"",c:"",m:1,f:null},d:{s:!1,t:!1,l:5},u:{i:0,e:0,v:0,a:0,r:0,c:0,t:0,p:0,d:0,m:0,s:0},i:{h:{p:null,u:!0},a:null,l:{p:null,i:!1},r:{r:null,g:null,b:null,i:!1},t:{d:null,a:null},v:{p:null,d:{v:null,g:null},o:null,m:null,b:null}},h:{t:"",h:"",n:""},c:{es:null}};Ci.subscribe(Ge=>{Ge.version&&(l(3,a=Ge),l(1,o=!1))}),jm();let c=!1,f=!1;async function _(){if(confirm("Are you sure you want to factory reset the device?")){l(4,c=!0);const Ge=new URLSearchParams;Ge.append("perform","true");let vl=await(await fetch("/reset",{method:"POST",body:Ge})).json();l(4,c=!1),l(5,f=vl.success)}}async function p(Ge){l(2,u=!0);const Ae=new FormData(Ge.target),vl=new URLSearchParams;for(let Rt of Ae){const[Bi,Wl]=Rt;vl.append(Bi,Wl)}let El=await(await fetch("/save",{method:"POST",body:vl})).json();jt.update(Rt=>(Rt.booting=El.reboot,Rt.ui=a.u,Rt)),l(2,u=!1),oi("/")}const b=function(){confirm("Are you sure you want to reboot the device?")&&(jt.update(Ge=>(Ge.booting=!0,Ge)),wp())};async function v(){confirm("Are you sure you want to delete CA?")&&(await(await fetch("/mqtt-ca",{method:"POST"})).text(),Ci.update(Ae=>(Ae.q.s.c=!1,Ae)))}async function d(){confirm("Are you sure you want to delete cert?")&&(await(await fetch("/mqtt-cert",{method:"POST"})).text(),Ci.update(Ae=>(Ae.q.s.r=!1,Ae)))}async function M(){confirm("Are you sure you want to delete key?")&&(await(await fetch("/mqtt-key",{method:"POST"})).text(),Ci.update(Ae=>(Ae.q.s.k=!1,Ae)))}const y=function(){a.q.s.e?a.q.p==1883&&l(3,a.q.p=8883,a):a.q.p==8883&&l(3,a.q.p=1883,a)};let T=44;function N(){a.g.h=this.value,l(3,a)}function E(){a.g.t=dt(this),l(3,a)}function B(){a.p.r=dt(this),l(3,a)}function P(){a.p.c=dt(this),l(3,a)}function L(){a.p.f=he(this.value),l(3,a)}function O(){a.p.m=he(this.value),l(3,a)}function F(){a.p.e=this.checked,l(3,a)}function x(){a.p.t=this.value,l(3,a)}function j(){a.g.s=dt(this),l(3,a)}function z(){a.g.u=this.value,l(3,a)}function G(){a.g.p=this.value,l(3,a)}function V(){a.m.i=this.checked,l(3,a)}function W(){a.m.b=dt(this),l(3,a)}function U(){a.m.p=dt(this),l(3,a)}function K(){a.m.s=he(this.value),l(3,a)}function H(){a.m.d=dt(this),l(3,a)}function Y(){a.m.f=he(this.value),l(3,a)}function Z(){a.m.r=he(this.value),l(3,a)}function re(){a.m.e.e=this.checked,l(3,a)}function ue(){a.m.e.k=this.value,l(3,a)}function ke(){a.m.e.a=this.value,l(3,a)}function me(){a.m.m.e=this.checked,l(3,a)}function Se(){a.m.m.w=he(this.value),l(3,a)}function je(){a.m.m.v=he(this.value),l(3,a)}function Re(){a.m.m.a=he(this.value),l(3,a)}function He(){a.m.m.c=he(this.value),l(3,a)}function we(){a.w.s=this.value,l(3,a)}function Te(){a.w.p=this.value,l(3,a)}function Le(){a.w.z=dt(this),l(3,a)}function $e(){a.w.w=he(this.value),l(3,a)}function w(){a.w.b=this.checked,l(3,a)}function g(){a.n.m=dt(this),l(3,a)}function k(){a.n.i=this.value,l(3,a)}function A(){a.n.s=dt(this),l(3,a)}function I(){a.n.g=this.value,l(3,a)}function Q(){a.n.d1=this.value,l(3,a)}function J(){a.n.d2=this.value,l(3,a)}function se(){a.n.d=this.checked,l(3,a)}function ce(){a.n.h=this.checked,l(3,a)}function ve(){a.n.n1=this.value,l(3,a)}function Me(){a.q.s.e=this.checked,l(3,a)}function oe(){a.q.h=this.value,l(3,a)}function pe(){a.q.p=he(this.value),l(3,a)}function Be(){a.q.u=this.value,l(3,a)}function _e(){a.q.a=this.value,l(3,a)}function ye(){a.q.c=this.value,l(3,a)}function vt(){a.q.m=dt(this),l(3,a)}function Hl(){a.q.b=this.value,l(3,a)}function tl(){a.o.e=this.value,l(3,a)}function ct(){a.o.c=this.value,l(3,a)}function Tl(){a.o.u1=this.value,l(3,a)}function pl(){a.o.u2=this.value,l(3,a)}function Ht(){a.o.u3=this.value,l(3,a)}function ht(){a.h.t=this.value,l(3,a)}function Qe(){a.h.h=this.value,l(3,a)}function Xe(){a.h.n=this.value,l(3,a)}function Ze(){a.c.es=this.checked,l(3,a)}function Ue(Ge){a.t.t[Ge]=he(this.value),l(3,a)}function Je(){a.t.h=he(this.value),l(3,a)}function We(Ge){a.u[Ge.key]=dt(this),l(3,a)}function xe(){a.i.h.u=this.checked,l(3,a)}function et(){a.i.h.p=dt(this),l(3,a)}function de(){a.i.a=he(this.value),l(3,a)}function Ce(){a.i.l.i=this.checked,l(3,a)}function Ei(){a.i.l.p=he(this.value),l(3,a)}function _l(){a.i.r.i=this.checked,l(3,a)}function _n(){a.i.r.r=he(this.value),l(3,a)}function Tt(){a.i.r.g=he(this.value),l(3,a)}function Di(){a.i.r.b=he(this.value),l(3,a)}function Ii(){a.i.t.d=he(this.value),l(3,a)}function Ri(){a.i.t.a=he(this.value),l(3,a)}function dl(){a.i.v.p=he(this.value),l(3,a)}function Li(){a.i.v.d.v=he(this.value),l(3,a)}function Oi(){a.i.v.d.g=he(this.value),l(3,a)}function Fi(){a.i.v.o=he(this.value),l(3,a)}function Nt(){a.i.v.m=he(this.value),l(3,a)}function Nl(){a.i.v.b=he(this.value),l(3,a)}function Al(){a.d.s=this.checked,l(3,a)}function Pl(){a.d.t=this.checked,l(3,a)}function qi(){a.d.l=dt(this),l(3,a)}return t.$$set=Ge=>{"sysinfo"in Ge&&l(0,n=Ge.sysinfo)},t.$$.update=()=>{t.$$.dirty[0]&1&&l(6,T=n.chip=="esp8266"?16:n.chip=="esp32s2"?44:39)},[n,o,u,a,c,f,T,i,_,p,b,v,d,M,y,N,E,B,P,L,O,F,x,j,z,G,V,W,U,K,H,Y,Z,re,ue,ke,me,Se,je,Re,He,we,Te,Le,$e,w,g,k,A,I,Q,J,se,ce,ve,Me,oe,pe,Be,_e,ye,vt,Hl,tl,ct,Tl,pl,Ht,ht,Qe,Xe,Ze,Ue,Je,We,xe,et,de,Ce,Ei,_l,_n,Tt,Di,Ii,Ri,dl,Li,Oi,Fi,Nt,Nl,Al,Pl,qi]}class Cp extends Ee{constructor(e){super(),Pe(this,e,yp,kp,Ne,{sysinfo:0},null,[-1,-1,-1,-1])}}function Df(t,e,l){const n=t.slice();return n[20]=e[l],n}function $p(t){let e=be(t[1].chip,t[1].board)+"",l;return{c(){l=S(e)},m(n,i){$(n,l,i)},p(n,i){i&2&&e!==(e=be(n[1].chip,n[1].board)+"")&&X(l,e)},d(n){n&&C(l)}}}function If(t){let e,l,n=t[1].apmac+"",i,o,u,a,c,f,_,p,b,v=Za(t[1])+"",d,M,y=t[1].boot_reason+"",T,N,E=t[1].ex_cause+"",B,P,L;const O=[Sp,Mp],F=[];function x(j,z){return j[0].u>0?0:1}return c=x(t),f=F[c]=O[c](t),{c(){e=m("div"),l=S("AP MAC: "),i=S(n),o=h(),u=m("div"),a=S(`Last boot: `),f.c(),_=h(),p=m("div"),b=S("Reason: "),d=S(v),M=S(" ("),T=S(y),N=S("/"),B=S(E),P=S(")"),r(e,"class","my-2"),r(u,"class","my-2"),r(p,"class","my-2")},m(j,z){$(j,e,z),s(e,l),s(e,i),$(j,o,z),$(j,u,z),s(u,a),F[c].m(u,null),$(j,_,z),$(j,p,z),s(p,b),s(p,d),s(p,M),s(p,T),s(p,N),s(p,B),s(p,P),L=!0},p(j,z){(!L||z&2)&&n!==(n=j[1].apmac+"")&&X(i,n);let G=c;c=x(j),c===G?F[c].p(j,z):(De(),q(F[G],1,1,()=>{F[G]=null}),Ie(),f=F[c],f?f.p(j,z):(f=F[c]=O[c](j),f.c()),D(f,1),f.m(u,null)),(!L||z&2)&&v!==(v=Za(j[1])+"")&&X(d,v),(!L||z&2)&&y!==(y=j[1].boot_reason+"")&&X(T,y),(!L||z&2)&&E!==(E=j[1].ex_cause+"")&&X(B,E)},i(j){L||(D(f),L=!0)},o(j){q(f),L=!1},d(j){j&&C(e),j&&C(o),j&&C(u),F[c].d(),j&&C(_),j&&C(p)}}}function Mp(t){let e;return{c(){e=S("-")},m(l,n){$(l,e,n)},p:fe,i:fe,o:fe,d(l){l&&C(e)}}}function Sp(t){let e,l;return e=new Gc({props:{timestamp:new Date(new Date().getTime()-t[0].u*1e3),fullTimeColor:""}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.timestamp=new Date(new Date().getTime()-n[0].u*1e3)),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function Tp(t){let e;return{c(){e=m("span"),e.textContent="Update consents",r(e,"class","btn-pri-sm")},m(l,n){$(l,e,n)},p:fe,d(l){l&&C(e)}}}function Rf(t){let e,l,n,i,o,u=Cs(t[1].meter.mfg)+"",a,c,f,_,p=(t[1].meter.model?t[1].meter.model:"unknown")+"",b,v,d,M,y=(t[1].meter.id?t[1].meter.id:"unknown")+"",T;return{c(){e=m("div"),l=m("strong"),l.textContent="Meter",n=h(),i=m("div"),o=S("Manufacturer: "),a=S(u),c=h(),f=m("div"),_=S("Model: "),b=S(p),v=h(),d=m("div"),M=S("ID: "),T=S(y),r(l,"class","text-sm"),r(i,"class","my-2"),r(f,"class","my-2"),r(d,"class","my-2"),r(e,"class","cnt")},m(N,E){$(N,e,E),s(e,l),s(e,n),s(e,i),s(i,o),s(i,a),s(e,c),s(e,f),s(f,_),s(f,b),s(e,v),s(e,d),s(d,M),s(d,T)},p(N,E){E&2&&u!==(u=Cs(N[1].meter.mfg)+"")&&X(a,u),E&2&&p!==(p=(N[1].meter.model?N[1].meter.model:"unknown")+"")&&X(b,p),E&2&&y!==(y=(N[1].meter.id?N[1].meter.id:"unknown")+"")&&X(T,y)},d(N){N&&C(e)}}}function Lf(t){let e,l,n,i,o,u=t[1].net.ip+"",a,c,f,_,p=t[1].net.mask+"",b,v,d,M,y=t[1].net.gw+"",T,N,E,B,P=t[1].net.dns1+"",L,O,F=t[1].net.dns2&&Of(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Network",n=h(),i=m("div"),o=S("IP: "),a=S(u),c=h(),f=m("div"),_=S("Mask: "),b=S(p),v=h(),d=m("div"),M=S("Gateway: "),T=S(y),N=h(),E=m("div"),B=S("DNS: "),L=S(P),O=h(),F&&F.c(),r(l,"class","text-sm"),r(i,"class","my-2"),r(f,"class","my-2"),r(d,"class","my-2"),r(E,"class","my-2"),r(e,"class","cnt")},m(x,j){$(x,e,j),s(e,l),s(e,n),s(e,i),s(i,o),s(i,a),s(e,c),s(e,f),s(f,_),s(f,b),s(e,v),s(e,d),s(d,M),s(d,T),s(e,N),s(e,E),s(E,B),s(E,L),s(E,O),F&&F.m(E,null)},p(x,j){j&2&&u!==(u=x[1].net.ip+"")&&X(a,u),j&2&&p!==(p=x[1].net.mask+"")&&X(b,p),j&2&&y!==(y=x[1].net.gw+"")&&X(T,y),j&2&&P!==(P=x[1].net.dns1+"")&&X(L,P),x[1].net.dns2?F?F.p(x,j):(F=Of(x),F.c(),F.m(E,null)):F&&(F.d(1),F=null)},d(x){x&&C(e),F&&F.d()}}}function Of(t){let e,l=t[1].net.dns2+"",n;return{c(){e=S("/ "),n=S(l)},m(i,o){$(i,e,o),$(i,n,o)},p(i,o){o&2&&l!==(l=i[1].net.dns2+"")&&X(n,l)},d(i){i&&C(e),i&&C(n)}}}function Ff(t){let e,l,n,i=t[1].upgrade.t+"",o,u,a=t[1].version+"",c,f,_=t[1].upgrade.x+"",p,b,v=t[1].upgrade.e+"",d,M;return{c(){e=m("div"),l=m("div"),n=S("Previous upgrade attempt ("),o=S(i),u=S(") does not match current version ("),c=S(a),f=S(") ["),p=S(_),b=S("/"),d=S(v),M=S("]"),r(l,"class","bd-yellow"),r(e,"class","my-2")},m(y,T){$(y,e,T),s(e,l),s(l,n),s(l,o),s(l,u),s(l,c),s(l,f),s(l,p),s(l,b),s(l,d),s(l,M)},p(y,T){T&2&&i!==(i=y[1].upgrade.t+"")&&X(o,i),T&2&&a!==(a=y[1].version+"")&&X(c,a),T&2&&_!==(_=y[1].upgrade.x+"")&&X(p,_),T&2&&v!==(v=y[1].upgrade.e+"")&&X(d,v)},d(y){y&&C(e)}}}function qf(t){let e,l,n,i=t[2].tag_name+"",o,u,a,c,f,_,p=(t[1].security==0||t[0].a)&&t[1].fwconsent===1&&t[2]&&t[2].tag_name!=t[1].version&&Bf(t),b=t[1].fwconsent===2&&Uf();return{c(){e=m("div"),l=S(`Latest version: From ddd08e25df1252401b99c48af5858f3515e36539 Mon Sep 17 00:00:00 2001 From: Gunnar Skjold Date: Sun, 3 Dec 2023 21:38:20 +0100 Subject: [PATCH 04/16] Keep last reason for reboot --- lib/SvelteUi/include/AmsWebServer.h | 9 ++++++++- lib/SvelteUi/src/AmsWebServer.cpp | 25 ++++++++++++++++++++----- src/AmsToMqttBridge.cpp | 7 ++++++- 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/lib/SvelteUi/include/AmsWebServer.h b/lib/SvelteUi/include/AmsWebServer.h index 8a0744ab..2a6782dc 100644 --- a/lib/SvelteUi/include/AmsWebServer.h +++ b/lib/SvelteUi/include/AmsWebServer.h @@ -31,9 +31,15 @@ #include "LittleFS.h" +struct ResetDataContainer { + uint8_t cause; + uint8_t last_cause; + uint8_t magic; +}; + class AmsWebServer { public: - AmsWebServer(uint8_t* buf, RemoteDebug* Debug, HwTools* hw); + AmsWebServer(uint8_t* buf, RemoteDebug* Debug, HwTools* hw, ResetDataContainer* rdc); void setup(AmsConfiguration*, GpioConfig*, MeterConfig*, AmsData*, AmsDataStorage*, EnergyAccounting*); void loop(); void setMqtt(MQTTClient* mqtt); @@ -45,6 +51,7 @@ public: private: RemoteDebug* debugger; + ResetDataContainer* rdc; bool mqttEnabled = false; int maxPwr = 0; HwTools* hw; diff --git a/lib/SvelteUi/src/AmsWebServer.cpp b/lib/SvelteUi/src/AmsWebServer.cpp index c4ec727b..51d94331 100644 --- a/lib/SvelteUi/src/AmsWebServer.cpp +++ b/lib/SvelteUi/src/AmsWebServer.cpp @@ -50,10 +50,19 @@ #include "esp32s3/rom/rtc.h" #endif -AmsWebServer::AmsWebServer(uint8_t* buf, RemoteDebug* Debug, HwTools* hw) { +AmsWebServer::AmsWebServer(uint8_t* buf, RemoteDebug* Debug, HwTools* hw, ResetDataContainer* rdc) { this->debugger = Debug; this->hw = hw; this->buf = (char*) buf; + this->rdc = rdc; + if(rdc->magic != 0x4a) { + rdc->last_cause = 0; + rdc->cause = 0; + rdc->magic = 0x4a; + } else { + rdc->last_cause = rdc->cause; + rdc->cause = 0; + } } void AmsWebServer::setup(AmsConfiguration* config, GpioConfig* gpioConfig, MeterConfig* meterConfig, AmsData* meterState, AmsDataStorage* ds, EnergyAccounting* ea) { @@ -321,7 +330,7 @@ void AmsWebServer::sysinfoJson() { webConfig.security, #if defined(ESP32) rtc_get_reset_reason(0), - 0, + rdc->last_cause, #else ESP.getResetInfoPtr()->reason, ESP.getResetInfoPtr()->exccause, @@ -356,6 +365,7 @@ void AmsWebServer::sysinfoJson() { if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("Rebooting\n")); debugger->flush(); delay(1000); + rdc->cause = 1; ESP.restart(); performRestart = false; } @@ -1520,8 +1530,9 @@ void AmsWebServer::handleSave() { if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("Rebooting\n")); debugger->flush(); delay(1000); - ESP.restart(); + rdc->cause = 2; performRestart = false; + ESP.restart(); } } @@ -1538,9 +1549,11 @@ void AmsWebServer::reboot() { if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("Rebooting\n")); debugger->flush(); - delay(1000); - ESP.restart(); + delay(1000); rdc->cause = 3; + + rdc->cause = 3; performRestart = false; + ESP.restart(); } void AmsWebServer::upgrade() { @@ -1619,6 +1632,7 @@ void AmsWebServer::upgradeFromUrl(String url, String nextVersion) { case HTTP_UPDATE_OK: debugger->printf_P(PSTR("Update OK\n")); debugger->flush(); + rdc->cause = 4; ESP.restart(); break; } @@ -1802,6 +1816,7 @@ void AmsWebServer::factoryResetPost() { if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("Rebooting\n")); debugger->flush(); delay(1000); + rdc->cause = 5; ESP.restart(); } diff --git a/src/AmsToMqttBridge.cpp b/src/AmsToMqttBridge.cpp index 68d61ed7..eb8a7d9b 100644 --- a/src/AmsToMqttBridge.cpp +++ b/src/AmsToMqttBridge.cpp @@ -102,7 +102,12 @@ EntsoeApi* eapi = NULL; Timezone* tz = NULL; -AmsWebServer ws(commonBuffer, &Debug, &hw); +#if defined(ESP32) +__NOINIT_ATTR ResetDataContainer rdc; +#else +ResetDataContainer rdc; +#endif +AmsWebServer ws(commonBuffer, &Debug, &hw, &rdc); bool mqttEnabled = false; AmsMqttHandler* mqttHandler = NULL; From a30cd763542867f0fc94aa84709b4d035c4a48b7 Mon Sep 17 00:00:00 2001 From: Gunnar Skjold Date: Mon, 4 Dec 2023 11:59:18 +0100 Subject: [PATCH 05/16] Indicator for estimated I2. Also fix on charts --- lib/AmsData/include/AmsData.h | 3 ++- lib/AmsData/src/AmsData.cpp | 5 +++++ lib/SvelteUi/app/dist/index.css | 2 +- lib/SvelteUi/app/dist/index.js | 20 ++++++++++---------- lib/SvelteUi/app/src/lib/AmpPlot.svelte | 9 +++++---- lib/SvelteUi/app/src/lib/BarChart.svelte | 5 +++-- lib/SvelteUi/app/src/lib/Dashboard.svelte | 2 +- lib/SvelteUi/app/src/lib/Helpers.js | 15 +++++++++------ lib/SvelteUi/json/data.json | 1 + lib/SvelteUi/src/AmsWebServer.cpp | 1 + src/IEC6205675.cpp | 2 ++ 11 files changed, 40 insertions(+), 25 deletions(-) diff --git a/lib/AmsData/include/AmsData.h b/lib/AmsData/include/AmsData.h index b864a2bc..48dec5cd 100644 --- a/lib/AmsData/include/AmsData.h +++ b/lib/AmsData/include/AmsData.h @@ -68,6 +68,7 @@ public: bool isThreePhase(); bool isTwoPhase(); + bool isL2currentEstimated(); int8_t getLastError(); void setLastError(int8_t); @@ -85,7 +86,7 @@ protected: float l1activeExportPower = 0, l2activeExportPower = 0, l3activeExportPower = 0; float powerFactor = 0, l1PowerFactor = 0, l2PowerFactor = 0, l3PowerFactor = 0; double activeImportCounter = 0, reactiveImportCounter = 0, activeExportCounter = 0, reactiveExportCounter = 0; - bool threePhase = false, twoPhase = false, counterEstimated = false; + bool threePhase = false, twoPhase = false, counterEstimated = false, l2currentEstimated = false; int8_t lastError = 0x00; uint8_t lastErrorCount = 0; diff --git a/lib/AmsData/src/AmsData.cpp b/lib/AmsData/src/AmsData.cpp index 66e5fea5..c115038c 100644 --- a/lib/AmsData/src/AmsData.cpp +++ b/lib/AmsData/src/AmsData.cpp @@ -67,6 +67,7 @@ void AmsData::apply(AmsData& other) { this->reactiveExportPower = other.getReactiveExportPower(); this->l1current = other.getL1Current(); this->l2current = other.getL2Current(); + this->l2currentEstimated = other.isL2currentEstimated(); this->l3current = other.getL3Current(); this->l1voltage = other.getL1Voltage(); this->l2voltage = other.getL2Voltage(); @@ -218,6 +219,10 @@ bool AmsData::isTwoPhase() { return this->twoPhase; } +bool AmsData::isL2currentEstimated() { + return this->l2currentEstimated; +} + int8_t AmsData::getLastError() { return lastErrorCount > 2 ? lastError : 0; } diff --git a/lib/SvelteUi/app/dist/index.css b/lib/SvelteUi/app/dist/index.css index f1d30ab2..d2d1001f 100644 --- a/lib/SvelteUi/app/dist/index.css +++ b/lib/SvelteUi/app/dist/index.css @@ -1 +1 @@ -/*! tailwindcss v3.3.2 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}html{-webkit-text-size-adjust:100%;font-feature-settings:normal;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{color:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}[multiple],[type=date],[type=datetime-local],[type=email],[type=month],[type=number],[type=password],[type=search],[type=tel],[type=text],[type=time],[type=url],[type=week],select,textarea{--tw-shadow:0 0 #0000;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#fff;border-color:#6b7280;border-radius:0;border-width:1px;font-size:1rem;line-height:1.5rem;padding:.5rem .75rem}[multiple]:focus,[type=date]:focus,[type=datetime-local]:focus,[type=email]:focus,[type=month]:focus,[type=number]:focus,[type=password]:focus,[type=search]:focus,[type=tel]:focus,[type=text]:focus,[type=time]:focus,[type=url]:focus,[type=week]:focus,select:focus,textarea:focus{--tw-ring-inset:var(--tw-empty, );--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#2563eb;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);border-color:#2563eb;box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);outline:2px solid transparent;outline-offset:2px}input::-moz-placeholder,textarea::-moz-placeholder{color:#6b7280;opacity:1}input::placeholder,textarea::placeholder{color:#6b7280;opacity:1}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-date-and-time-value{min-height:1.5em}::-webkit-datetime-edit,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-meridiem-field,::-webkit-datetime-edit-millisecond-field,::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-second-field,::-webkit-datetime-edit-year-field{padding-bottom:0;padding-top:0}select{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");background-position:right .5rem center;background-repeat:no-repeat;background-size:1.5em 1.5em;padding-right:2.5rem;-webkit-print-color-adjust:exact;print-color-adjust:exact}[multiple]{background-image:none;background-position:0 0;background-repeat:unset;background-size:initial;padding-right:.75rem;-webkit-print-color-adjust:unset;print-color-adjust:unset}[type=checkbox],[type=radio]{--tw-shadow:0 0 #0000;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#fff;background-origin:border-box;border-color:#6b7280;border-width:1px;color:#2563eb;display:inline-block;flex-shrink:0;height:1rem;padding:0;-webkit-print-color-adjust:exact;print-color-adjust:exact;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:middle;width:1rem}[type=checkbox]{border-radius:0}[type=radio]{border-radius:100%}[type=checkbox]:focus,[type=radio]:focus{--tw-ring-inset:var(--tw-empty, );--tw-ring-offset-width:2px;--tw-ring-offset-color:#fff;--tw-ring-color:#2563eb;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);outline:2px solid transparent;outline-offset:2px}[type=checkbox]:checked,[type=radio]:checked{background-color:currentColor;background-position:50%;background-repeat:no-repeat;background-size:100% 100%;border-color:transparent}[type=checkbox]:checked{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 16 16' fill='%23fff' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12.207 4.793a1 1 0 0 1 0 1.414l-5 5a1 1 0 0 1-1.414 0l-2-2a1 1 0 0 1 1.414-1.414L6.5 9.086l4.293-4.293a1 1 0 0 1 1.414 0z'/%3E%3C/svg%3E")}[type=radio]:checked{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 16 16' fill='%23fff' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='8' cy='8' r='3'/%3E%3C/svg%3E")}[type=checkbox]:checked:focus,[type=checkbox]:checked:hover,[type=radio]:checked:focus,[type=radio]:checked:hover{background-color:currentColor;border-color:transparent}[type=checkbox]:indeterminate{background-color:currentColor;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 16 16'%3E%3Cpath stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 8h8'/%3E%3C/svg%3E");background-position:50%;background-repeat:no-repeat;background-size:100% 100%;border-color:transparent}[type=checkbox]:indeterminate:focus,[type=checkbox]:indeterminate:hover{background-color:currentColor;border-color:transparent}[type=file]{background:unset;border-color:inherit;border-radius:0;border-width:0;font-size:unset;line-height:inherit;padding:0}[type=file]:focus{outline:1px solid ButtonText;outline:1px auto -webkit-focus-ring-color}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.static{position:static}.fixed{position:fixed}.inset-0{inset:0}.z-40{z-index:40}.z-50{z-index:50}.col-span-2{grid-column:span 2/span 2}.float-right{float:right}.clear-both{clear:both}.m-1{margin:.25rem}.m-2{margin:.5rem}.m-3{margin:.75rem}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-3{margin-left:.75rem;margin-right:.75rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-bottom:.25rem;margin-top:.25rem}.my-2{margin-bottom:.5rem;margin-top:.5rem}.my-3{margin-bottom:.75rem;margin-top:.75rem}.my-auto{margin-bottom:auto;margin-top:auto}.mb-1{margin-bottom:.25rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-4{margin-left:1rem}.mr-3{margin-right:.75rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.flex{display:flex}.grid{display:grid}.hidden{display:none}.h-4{height:1rem}.h-6{height:1.5rem}.h-64{height:16rem}.w-1\/2{width:50%}.w-1\/3{width:33.333333%}.w-1\/4{width:25%}.w-3\/4{width:75%}.w-4{width:1rem}.w-40{width:10rem}.w-6{width:1.5rem}.w-96{width:24rem}.w-full{width:100%}.flex-auto{flex:1 1 auto}.flex-none{flex:none}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-row-reverse{flex-direction:row-reverse}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-center{justify-content:center}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(1rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(1rem*var(--tw-space-x-reverse))}.whitespace-nowrap{white-space:nowrap}.rounded{border-radius:.25rem}.rounded-md{border-radius:.375rem}.rounded-l-md{border-bottom-left-radius:.375rem;border-top-left-radius:.375rem}.rounded-r-md{border-bottom-right-radius:.375rem;border-top-right-radius:.375rem}.bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}.bg-gray-500{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity))}.bg-green-500{--tw-bg-opacity:1;background-color:rgb(34 197 94/var(--tw-bg-opacity))}.bg-red-500{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity))}.bg-violet-600{--tw-bg-opacity:1;background-color:rgb(124 58 237/var(--tw-bg-opacity))}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.bg-yellow-500{--tw-bg-opacity:1;background-color:rgb(234 179 8/var(--tw-bg-opacity))}.bg-opacity-50{--tw-bg-opacity:.5}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-4{padding-left:1rem;padding-right:1rem}.py-1{padding-bottom:.25rem;padding-top:.25rem}.py-2{padding-bottom:.5rem;padding-top:.5rem}.pb-4{padding-bottom:1rem}.pl-1{padding-left:.25rem}.pl-2{padding-left:.5rem}.pl-5{padding-left:1.25rem}.pr-1{padding-right:.25rem}.pr-2{padding-right:.5rem}.text-center{text-align:center}.text-right{text-align:right}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-semibold{font-weight:600}.text-blue-600{--tw-text-opacity:1;color:rgb(37 99 235/var(--tw-text-opacity))}.text-gray-100{--tw-text-opacity:1;color:rgb(243 244 246/var(--tw-text-opacity))}.text-gray-300{--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity))}.text-green-100{--tw-text-opacity:1;color:rgb(220 252 231/var(--tw-text-opacity))}.text-green-500{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity))}.text-red-100{--tw-text-opacity:1;color:rgb(254 226 226/var(--tw-text-opacity))}.text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.text-yellow-500{--tw-text-opacity:1;color:rgb(234 179 8/var(--tw-text-opacity))}.shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.gh-logo{height:2rem;width:2rem}.cnt{--tw-bg-opacity:1;--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color);background-color:rgb(255 255 255/var(--tw-bg-opacity));border-radius:.25rem;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);margin:.5rem;min-height:268px;padding:.5rem}.gwf{height:16rem}@media (min-width:640px){.gwf{grid-column:span 2/span 2}}@media (min-width:768px){.gwf{grid-column:span 3/span 3}}@media (min-width:1024px){.gwf{grid-column:span 4/span 4}}@media (min-width:1280px){.gwf{grid-column:span 5/span 5}}@media (min-width:1536px){.gwf{grid-column:span 6/span 6}}.in-pre{border-bottom-left-radius:.375rem;border-color:rgb(209 213 219/var(--tw-border-opacity));border-top-left-radius:.375rem;border-width:1px 0 1px 1px}.in-post,.in-pre{--tw-border-opacity:1;--tw-bg-opacity:1;align-items:center;background-color:rgb(243 244 246/var(--tw-bg-opacity));display:flex;font-size:.875rem;line-height:1.25rem;padding-left:.75rem;padding-right:.75rem;white-space:nowrap}.in-post{border-bottom-right-radius:.375rem;border-top-right-radius:.375rem;border-width:1px 1px 1px 0}.in-post,.in-txt{border-color:rgb(209 213 219/var(--tw-border-opacity))}.in-txt{--tw-border-opacity:1;--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);height:2.5rem}.in-txt:disabled{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.in-f{--tw-border-opacity:1;--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);border-bottom-left-radius:.375rem;border-color:rgb(209 213 219/var(--tw-border-opacity));border-top-left-radius:.375rem;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);height:2.5rem}.in-f:disabled{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.in-m{--tw-border-opacity:1;--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);border-color:rgb(209 213 219/var(--tw-border-opacity));border-left-width:0;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);height:2.5rem}.in-m:disabled{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.in-l{--tw-border-opacity:1;--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);border-bottom-right-radius:.375rem;border-color:rgb(209 213 219/var(--tw-border-opacity));border-left-width:0;border-top-right-radius:.375rem;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);height:2.5rem}.in-l:disabled{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.in-s{--tw-border-opacity:1;--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);border-color:rgb(209 213 219/var(--tw-border-opacity));border-radius:.375rem;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);height:2.5rem;width:100%}.in-s:disabled{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.tr{text-align:right}.bd-green{background-color:rgb(34 197 94/var(--tw-bg-opacity));color:rgb(220 252 231/var(--tw-text-opacity))}.bd-green,.bd-yellow{--tw-bg-opacity:1;--tw-text-opacity:1;border-radius:.25rem;font-size:.75rem;font-weight:600;line-height:1rem;margin-bottom:auto;margin-right:.5rem;margin-top:auto;padding:.125rem .625rem}.bd-yellow{background-color:rgb(234 179 8/var(--tw-bg-opacity));color:rgb(254 249 195/var(--tw-text-opacity))}.bd-red{background-color:rgb(239 68 68/var(--tw-bg-opacity));color:rgb(254 226 226/var(--tw-text-opacity))}.bd-blue,.bd-red{--tw-bg-opacity:1;--tw-text-opacity:1;border-radius:.25rem;font-size:.75rem;font-weight:600;line-height:1rem;margin-bottom:auto;margin-right:.5rem;margin-top:auto;padding:.125rem .625rem}.bd-blue{background-color:rgb(59 130 246/var(--tw-bg-opacity));color:rgb(219 234 254/var(--tw-text-opacity))}.bd-gray{--tw-bg-opacity:1;--tw-text-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity));border-radius:.25rem;color:rgb(243 244 246/var(--tw-text-opacity));font-size:.75rem;font-weight:600;line-height:1rem;margin-bottom:auto;margin-right:.5rem;margin-top:auto;padding:.125rem .625rem}.btn-pri{padding:.5rem 1rem}.btn-pri,.btn-pri-sm{--tw-bg-opacity:1;--tw-text-opacity:1;background-color:rgb(59 130 246/var(--tw-bg-opacity));border-radius:.25rem;color:rgb(255 255 255/var(--tw-text-opacity));margin-right:.75rem}.btn-pri-sm{font-size:.75rem;line-height:1rem;padding:.25rem .5rem}.pl-root{position:relative}.pl-ov{left:25%;position:absolute;text-align:center;top:27%;width:50%}.pl-val{font-size:1.7rem}.pl-unt{color:gray;font-size:1rem}.pl-sub{font-size:1rem;padding-top:10px}.pl-snt{color:gray;font-size:.7rem}.pl-lab{font-size:1rem}.chart{height:100%;margin:0 auto;width:100%}svg{position:relative;width:100%}.tick{font-family:Helvetica,Arial;font-size:.85em;font-weight:200}.tick line{stroke:#e2e2e2;stroke-dasharray:2}.tick text{fill:#999;text-anchor:start}.tick.tick-0 line{stroke-dasharray:0}.tick.tick-green line{stroke:#32d900!important}.tick.tick-green text{fill:#32d900!important}.tick.tick-orange line{stroke:#d95600!important}.tick.tick-orange text{fill:#d95600!important}.x-axis .tick text{text-anchor:middle}.bars rect{stroke:#000;stroke-opacity:.25;opacity:.9}.bars text{display:block;font-family:Helvetica,Arial;font-size:.85em;text-align:center}.hover\:text-blue-800:hover{--tw-text-opacity:1;color:rgb(30 64 175/var(--tw-text-opacity))}@media (min-width:640px){.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (min-width:768px){.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (min-width:1024px){.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}@media (min-width:1280px){.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}}@media (min-width:1536px){.\32xl\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}} +/*! tailwindcss v3.3.2 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}html{-webkit-text-size-adjust:100%;font-feature-settings:normal;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{color:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}[multiple],[type=date],[type=datetime-local],[type=email],[type=month],[type=number],[type=password],[type=search],[type=tel],[type=text],[type=time],[type=url],[type=week],select,textarea{--tw-shadow:0 0 #0000;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#fff;border-color:#6b7280;border-radius:0;border-width:1px;font-size:1rem;line-height:1.5rem;padding:.5rem .75rem}[multiple]:focus,[type=date]:focus,[type=datetime-local]:focus,[type=email]:focus,[type=month]:focus,[type=number]:focus,[type=password]:focus,[type=search]:focus,[type=tel]:focus,[type=text]:focus,[type=time]:focus,[type=url]:focus,[type=week]:focus,select:focus,textarea:focus{--tw-ring-inset:var(--tw-empty, );--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#2563eb;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);border-color:#2563eb;box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);outline:2px solid transparent;outline-offset:2px}input::-moz-placeholder,textarea::-moz-placeholder{color:#6b7280;opacity:1}input::placeholder,textarea::placeholder{color:#6b7280;opacity:1}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-date-and-time-value{min-height:1.5em}::-webkit-datetime-edit,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-meridiem-field,::-webkit-datetime-edit-millisecond-field,::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-second-field,::-webkit-datetime-edit-year-field{padding-bottom:0;padding-top:0}select{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");background-position:right .5rem center;background-repeat:no-repeat;background-size:1.5em 1.5em;padding-right:2.5rem;-webkit-print-color-adjust:exact;print-color-adjust:exact}[multiple]{background-image:none;background-position:0 0;background-repeat:unset;background-size:initial;padding-right:.75rem;-webkit-print-color-adjust:unset;print-color-adjust:unset}[type=checkbox],[type=radio]{--tw-shadow:0 0 #0000;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#fff;background-origin:border-box;border-color:#6b7280;border-width:1px;color:#2563eb;display:inline-block;flex-shrink:0;height:1rem;padding:0;-webkit-print-color-adjust:exact;print-color-adjust:exact;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:middle;width:1rem}[type=checkbox]{border-radius:0}[type=radio]{border-radius:100%}[type=checkbox]:focus,[type=radio]:focus{--tw-ring-inset:var(--tw-empty, );--tw-ring-offset-width:2px;--tw-ring-offset-color:#fff;--tw-ring-color:#2563eb;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);outline:2px solid transparent;outline-offset:2px}[type=checkbox]:checked,[type=radio]:checked{background-color:currentColor;background-position:50%;background-repeat:no-repeat;background-size:100% 100%;border-color:transparent}[type=checkbox]:checked{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 16 16' fill='%23fff' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12.207 4.793a1 1 0 0 1 0 1.414l-5 5a1 1 0 0 1-1.414 0l-2-2a1 1 0 0 1 1.414-1.414L6.5 9.086l4.293-4.293a1 1 0 0 1 1.414 0z'/%3E%3C/svg%3E")}[type=radio]:checked{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 16 16' fill='%23fff' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='8' cy='8' r='3'/%3E%3C/svg%3E")}[type=checkbox]:checked:focus,[type=checkbox]:checked:hover,[type=radio]:checked:focus,[type=radio]:checked:hover{background-color:currentColor;border-color:transparent}[type=checkbox]:indeterminate{background-color:currentColor;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 16 16'%3E%3Cpath stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 8h8'/%3E%3C/svg%3E");background-position:50%;background-repeat:no-repeat;background-size:100% 100%;border-color:transparent}[type=checkbox]:indeterminate:focus,[type=checkbox]:indeterminate:hover{background-color:currentColor;border-color:transparent}[type=file]{background:unset;border-color:inherit;border-radius:0;border-width:0;font-size:unset;line-height:inherit;padding:0}[type=file]:focus{outline:1px solid ButtonText;outline:1px auto -webkit-focus-ring-color}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.static{position:static}.fixed{position:fixed}.inset-0{inset:0}.z-40{z-index:40}.z-50{z-index:50}.col-span-2{grid-column:span 2/span 2}.float-right{float:right}.clear-both{clear:both}.m-1{margin:.25rem}.m-2{margin:.5rem}.m-3{margin:.75rem}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-3{margin-left:.75rem;margin-right:.75rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-bottom:.25rem;margin-top:.25rem}.my-2{margin-bottom:.5rem;margin-top:.5rem}.my-3{margin-bottom:.75rem;margin-top:.75rem}.my-auto{margin-bottom:auto;margin-top:auto}.mb-1{margin-bottom:.25rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-4{margin-left:1rem}.mr-3{margin-right:.75rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.flex{display:flex}.grid{display:grid}.hidden{display:none}.h-4{height:1rem}.h-6{height:1.5rem}.h-64{height:16rem}.w-1\/2{width:50%}.w-1\/3{width:33.333333%}.w-1\/4{width:25%}.w-3\/4{width:75%}.w-4{width:1rem}.w-40{width:10rem}.w-6{width:1.5rem}.w-96{width:24rem}.w-full{width:100%}.flex-auto{flex:1 1 auto}.flex-none{flex:none}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-row-reverse{flex-direction:row-reverse}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-center{justify-content:center}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(1rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(1rem*var(--tw-space-x-reverse))}.whitespace-nowrap{white-space:nowrap}.rounded{border-radius:.25rem}.rounded-md{border-radius:.375rem}.rounded-l-md{border-bottom-left-radius:.375rem;border-top-left-radius:.375rem}.rounded-r-md{border-bottom-right-radius:.375rem;border-top-right-radius:.375rem}.bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}.bg-gray-500{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity))}.bg-green-500{--tw-bg-opacity:1;background-color:rgb(34 197 94/var(--tw-bg-opacity))}.bg-red-500{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity))}.bg-violet-600{--tw-bg-opacity:1;background-color:rgb(124 58 237/var(--tw-bg-opacity))}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.bg-yellow-500{--tw-bg-opacity:1;background-color:rgb(234 179 8/var(--tw-bg-opacity))}.bg-opacity-50{--tw-bg-opacity:.5}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-4{padding-left:1rem;padding-right:1rem}.py-1{padding-bottom:.25rem;padding-top:.25rem}.py-2{padding-bottom:.5rem;padding-top:.5rem}.pb-4{padding-bottom:1rem}.pl-1{padding-left:.25rem}.pl-2{padding-left:.5rem}.pl-5{padding-left:1.25rem}.pr-1{padding-right:.25rem}.pr-2{padding-right:.5rem}.text-center{text-align:center}.text-right{text-align:right}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-semibold{font-weight:600}.text-blue-600{--tw-text-opacity:1;color:rgb(37 99 235/var(--tw-text-opacity))}.text-gray-100{--tw-text-opacity:1;color:rgb(243 244 246/var(--tw-text-opacity))}.text-gray-300{--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity))}.text-green-100{--tw-text-opacity:1;color:rgb(220 252 231/var(--tw-text-opacity))}.text-green-500{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity))}.text-red-100{--tw-text-opacity:1;color:rgb(254 226 226/var(--tw-text-opacity))}.text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.text-yellow-500{--tw-text-opacity:1;color:rgb(234 179 8/var(--tw-text-opacity))}.shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.gh-logo{height:2rem;width:2rem}.cnt{--tw-bg-opacity:1;--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color);background-color:rgb(255 255 255/var(--tw-bg-opacity));border-radius:.25rem;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);margin:.5rem;min-height:268px;padding:.5rem}.gwf{height:16rem}@media (min-width:640px){.gwf{grid-column:span 2/span 2}}@media (min-width:768px){.gwf{grid-column:span 3/span 3}}@media (min-width:1024px){.gwf{grid-column:span 4/span 4}}@media (min-width:1280px){.gwf{grid-column:span 5/span 5}}@media (min-width:1536px){.gwf{grid-column:span 6/span 6}}.in-pre{border-bottom-left-radius:.375rem;border-color:rgb(209 213 219/var(--tw-border-opacity));border-top-left-radius:.375rem;border-width:1px 0 1px 1px}.in-post,.in-pre{--tw-border-opacity:1;--tw-bg-opacity:1;align-items:center;background-color:rgb(243 244 246/var(--tw-bg-opacity));display:flex;font-size:.875rem;line-height:1.25rem;padding-left:.75rem;padding-right:.75rem;white-space:nowrap}.in-post{border-bottom-right-radius:.375rem;border-top-right-radius:.375rem;border-width:1px 1px 1px 0}.in-post,.in-txt{border-color:rgb(209 213 219/var(--tw-border-opacity))}.in-txt{--tw-border-opacity:1;--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);height:2.5rem}.in-txt:disabled{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.in-f{--tw-border-opacity:1;--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);border-bottom-left-radius:.375rem;border-color:rgb(209 213 219/var(--tw-border-opacity));border-top-left-radius:.375rem;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);height:2.5rem}.in-f:disabled{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.in-m{--tw-border-opacity:1;--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);border-color:rgb(209 213 219/var(--tw-border-opacity));border-left-width:0;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);height:2.5rem}.in-m:disabled{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.in-l{--tw-border-opacity:1;--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);border-bottom-right-radius:.375rem;border-color:rgb(209 213 219/var(--tw-border-opacity));border-left-width:0;border-top-right-radius:.375rem;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);height:2.5rem}.in-l:disabled{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.in-s{--tw-border-opacity:1;--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);border-color:rgb(209 213 219/var(--tw-border-opacity));border-radius:.375rem;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);height:2.5rem;width:100%}.in-s:disabled{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.tr{text-align:right}.bd-green{background-color:rgb(34 197 94/var(--tw-bg-opacity));color:rgb(220 252 231/var(--tw-text-opacity))}.bd-green,.bd-yellow{--tw-bg-opacity:1;--tw-text-opacity:1;border-radius:.25rem;font-size:.75rem;font-weight:600;line-height:1rem;margin-bottom:auto;margin-right:.5rem;margin-top:auto;padding:.125rem .625rem}.bd-yellow{background-color:rgb(234 179 8/var(--tw-bg-opacity));color:rgb(254 249 195/var(--tw-text-opacity))}.bd-red{background-color:rgb(239 68 68/var(--tw-bg-opacity));color:rgb(254 226 226/var(--tw-text-opacity))}.bd-blue,.bd-red{--tw-bg-opacity:1;--tw-text-opacity:1;border-radius:.25rem;font-size:.75rem;font-weight:600;line-height:1rem;margin-bottom:auto;margin-right:.5rem;margin-top:auto;padding:.125rem .625rem}.bd-blue{background-color:rgb(59 130 246/var(--tw-bg-opacity));color:rgb(219 234 254/var(--tw-text-opacity))}.bd-gray{--tw-bg-opacity:1;--tw-text-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity));border-radius:.25rem;color:rgb(243 244 246/var(--tw-text-opacity));font-size:.75rem;font-weight:600;line-height:1rem;margin-bottom:auto;margin-right:.5rem;margin-top:auto;padding:.125rem .625rem}.btn-pri{padding:.5rem 1rem}.btn-pri,.btn-pri-sm{--tw-bg-opacity:1;--tw-text-opacity:1;background-color:rgb(59 130 246/var(--tw-bg-opacity));border-radius:.25rem;color:rgb(255 255 255/var(--tw-text-opacity));margin-right:.75rem}.btn-pri-sm{font-size:.75rem;line-height:1rem;padding:.25rem .5rem}.pl-root{position:relative}.pl-ov{left:25%;position:absolute;text-align:center;top:27%;width:50%}.pl-val{font-size:1.7rem}.pl-unt{color:gray;font-size:1rem}.pl-sub{font-size:1rem;padding-top:10px}.pl-snt{color:gray;font-size:.7rem}.pl-lab{font-size:1rem}.chart{height:100%;margin:0 auto;width:100%}svg{position:relative;width:100%}.tick{font-family:Helvetica,Arial;font-size:.85em;font-weight:200}.tick line{stroke:#e2e2e2;stroke-dasharray:2}.tick text{fill:#999;text-anchor:start}.tick.tick-0 line{stroke-dasharray:0}.tick.tick-green line{stroke:#32d900!important}.tick.tick-green text{fill:#32d900!important}.tick.tick-orange line{stroke:#d95600!important}.tick.tick-orange text{fill:#d95600!important}.x-axis .tick text{text-anchor:middle}.bars rect{stroke:#000;stroke-opacity:.25;opacity:.9}.bars text{display:block;font-family:Helvetica,Arial;font-size:.85em;text-align:center}.hover\:text-blue-800:hover{--tw-text-opacity:1;color:rgb(30 64 175/var(--tw-text-opacity))}@media (min-width:640px){.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (min-width:768px){.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (min-width:1024px){.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}@media (min-width:1280px){.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}}@media (min-width:1536px){.\32xl\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}} diff --git a/lib/SvelteUi/app/dist/index.js b/lib/SvelteUi/app/dist/index.js index 91bfb713..f49f1eb2 100644 --- a/lib/SvelteUi/app/dist/index.js +++ b/lib/SvelteUi/app/dist/index.js @@ -1,14 +1,14 @@ -(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const u of o.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&n(u)}).observe(document,{childList:!0,subtree:!0});function l(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerpolicy&&(o.referrerPolicy=i.referrerpolicy),i.crossorigin==="use-credentials"?o.credentials="include":i.crossorigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(i){if(i.ep)return;i.ep=!0;const o=l(i);fetch(i.href,o)}})();function fe(){}function xt(t,e){for(const l in e)t[l]=e[l];return t}function tc(t){return t()}function La(){return Object.create(null)}function ze(t){t.forEach(tc)}function co(t){return typeof t=="function"}function Ne(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let _s;function Js(t,e){return _s||(_s=document.createElement("a")),_s.href=e,t===_s.href}function xc(t){return Object.keys(t).length===0}function mo(t,...e){if(t==null)return fe;const l=t.subscribe(...e);return l.unsubscribe?()=>l.unsubscribe():l}function ai(t){let e;return mo(t,l=>e=l)(),e}function ul(t,e,l){t.$$.on_destroy.push(mo(e,l))}function po(t,e,l,n){if(t){const i=lc(t,e,l,n);return t[0](i)}}function lc(t,e,l,n){return t[1]&&n?xt(l.ctx.slice(),t[1](n(e))):l.ctx}function _o(t,e,l,n){if(t[2]&&n){const i=t[2](n(l));if(e.dirty===void 0)return i;if(typeof i=="object"){const o=[],u=Math.max(e.dirty.length,i.length);for(let a=0;a32){const e=[],l=t.ctx.length/32;for(let n=0;nt.removeEventListener(e,l,n)}function Ms(t){return function(e){return e.preventDefault(),t.call(this,e)}}function r(t,e,l){l==null?t.removeAttribute(e):t.getAttribute(e)!==l&&t.setAttribute(e,l)}const t0=["width","height"];function ui(t,e){const l=Object.getOwnPropertyDescriptors(t.__proto__);for(const n in e)e[n]==null?t.removeAttribute(n):n==="style"?t.style.cssText=e[n]:n==="__value"?t.value=t[n]=e[n]:l[n]&&l[n].set&&t0.indexOf(n)===-1?t[n]=e[n]:r(t,n,e[n])}function he(t){return t===""?null:+t}function l0(t){return Array.from(t.childNodes)}function X(t,e){e=""+e,t.data!==e&&(t.data=e)}function n0(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function i0(t,e,l){~e0.indexOf(l)?n0(t,e):X(t,e)}function te(t,e){t.value=e==null?"":e}function nc(t,e,l,n){l==null?t.style.removeProperty(e):t.style.setProperty(e,l,n?"important":"")}function qe(t,e,l){for(let n=0;n{u.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{o=ee(n.contentWindow,"resize",e),e()}),s(t,n),()=>{(i||o&&n.contentWindow)&&o(),C(n)}}function r0(t,e,{bubbles:l=!1,cancelable:n=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(t,l,n,e),i}function Oa(t,e){return new t(e)}let Si;function $i(t){Si=t}function Ti(){if(!Si)throw new Error("Function called outside component initialization");return Si}function ic(t){Ti().$$.on_mount.push(t)}function a0(t){Ti().$$.on_destroy.push(t)}function u0(){const t=Ti();return(e,l,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const o=r0(e,l,{cancelable:n});return i.slice().forEach(u=>{u.call(t,o)}),!o.defaultPrevented}return!0}}function Mi(t,e){return Ti().$$.context.set(t,e),e}function Bl(t){return Ti().$$.context.get(t)}const ii=[],ws=[];let si=[];const Fa=[],sc=Promise.resolve();let xs=!1;function oc(){xs||(xs=!0,sc.then(rc))}function f0(){return oc(),sc}function tt(t){si.push(t)}const Vs=new Set;let li=0;function rc(){if(li!==0)return;const t=Si;do{try{for(;lit.indexOf(n)===-1?e.push(n):l.push(n)),l.forEach(n=>n()),si=e}const bs=new Set;let rn;function De(){rn={r:0,c:[],p:rn}}function Ie(){rn.r||ze(rn.c),rn=rn.p}function D(t,e){t&&t.i&&(bs.delete(t),t.i(e))}function q(t,e,l,n){if(t&&t.o){if(bs.has(t))return;bs.add(t),rn.c.push(()=>{bs.delete(t),n&&(l&&t.d(1),n())}),t.o(e)}else n&&n()}function ac(t,e){const l={},n={},i={$$scope:1};let o=t.length;for(;o--;){const u=t[o],a=e[o];if(a){for(const c in u)c in a||(n[c]=1);for(const c in a)i[c]||(l[c]=a[c],i[c]=1);t[o]=a}else for(const c in u)i[c]=1}for(const u in n)u in l||(l[u]=void 0);return l}function qa(t){return typeof t=="object"&&t!==null?t:{}}function ie(t){t&&t.c()}function le(t,e,l,n){const{fragment:i,after_update:o}=t.$$;i&&i.m(e,l),n||tt(()=>{const u=t.$$.on_mount.map(tc).filter(co);t.$$.on_destroy?t.$$.on_destroy.push(...u):ze(u),t.$$.on_mount=[]}),o.forEach(tt)}function ne(t,e){const l=t.$$;l.fragment!==null&&(m0(l.after_update),ze(l.on_destroy),l.fragment&&l.fragment.d(e),l.on_destroy=l.fragment=null,l.ctx=[])}function p0(t,e){t.$$.dirty[0]===-1&&(ii.push(t),oc(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const d=v.length?v[0]:b;return f.ctx&&i(f.ctx[p],f.ctx[p]=d)&&(!f.skip_bound&&f.bound[p]&&f.bound[p](d),_&&p0(t,p)),b}):[],f.update(),_=!0,ze(f.before_update),f.fragment=n?n(f.ctx):!1,e.target){if(e.hydrate){const p=l0(e.target);f.fragment&&f.fragment.l(p),p.forEach(C)}else f.fragment&&f.fragment.c();e.intro&&D(t.$$.fragment),le(t,e.target,e.anchor,e.customElement),rc()}$i(c)}class Ee{$destroy(){ne(this,1),this.$destroy=fe}$on(e,l){if(!co(l))return fe;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(l),()=>{const i=n.indexOf(l);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!xc(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Ba=t=>typeof t>"u",uc=t=>typeof t=="function",fc=t=>typeof t=="number";function _0(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function cc(){let t=0;return()=>t++}function d0(){return Math.random().toString(36).substring(2)}const Ul=typeof window>"u";function mc(t,e,l){return t.addEventListener(e,l),()=>t.removeEventListener(e,l)}const pc=(t,e)=>t?{}:{style:e},eo=t=>({"aria-hidden":"true",...pc(t,"display:none;")}),ni=[];function _c(t,e){return{subscribe:at(t,e).subscribe}}function at(t,e=fe){let l;const n=new Set;function i(a){if(Ne(t,a)&&(t=a,l)){const c=!ni.length;for(const f of n)f[1](),ni.push(f,t);if(c){for(let f=0;f{n.delete(f),n.size===0&&l&&(l(),l=null)}}return{set:i,update:o,subscribe:u}}function v0(t,e,l){const n=!Array.isArray(t),i=n?[t]:t,o=e.length<2;return _c(l,u=>{let a=!1;const c=[];let f=0,_=fe;const p=()=>{if(f)return;_();const v=e(n?c[0]:c,u);o?u(v):_=co(v)?v:fe},b=i.map((v,d)=>mo(v,M=>{c[d]=M,f&=~(1<{f|=1<`@@svnav-ctx__${t}`,to=Ni("LOCATION"),fi=Ni("ROUTER"),dc=Ni("ROUTE"),h0=Ni("ROUTE_PARAMS"),b0=Ni("FOCUS_ELEM"),vc=/^:(.+)/,wi=(t,e,l)=>t.substr(e,l),lo=(t,e)=>wi(t,0,e.length)===e,g0=t=>t==="",k0=t=>vc.test(t),hc=t=>t[0]==="*",w0=t=>t.replace(/\*.*$/,""),bc=t=>t.replace(/(^\/+|\/+$)/g,"");function ml(t,e=!1){const l=bc(t).split("/");return e?l.filter(Boolean):l}const Ks=(t,e)=>t+(e?`?${e}`:""),bo=t=>`/${bc(t)}`;function Ai(...t){const e=n=>ml(n,!0).join("/"),l=t.map(e).join("/");return bo(l)}const go=1,Ss=2,mn=3,y0=4,gc=5,C0=6,kc=7,$0=8,M0=9,wc=10,yc=11,S0={[go]:"Link",[Ss]:"Route",[mn]:"Router",[y0]:"useFocus",[gc]:"useLocation",[C0]:"useMatch",[kc]:"useNavigate",[$0]:"useParams",[M0]:"useResolvable",[wc]:"useResolve",[yc]:"navigate"},ko=t=>S0[t];function T0(t,e){let l;return t===Ss?l=e.path?`path="${e.path}"`:"default":t===go?l=`to="${e.to}"`:t===mn&&(l=`basepath="${e.basepath||""}"`),`<${ko(t)} ${l||""} />`}function N0(t,e,l,n){const i=l&&T0(n||t,l),o=i?` +(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function l(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerpolicy&&(o.referrerPolicy=i.referrerpolicy),i.crossorigin==="use-credentials"?o.credentials="include":i.crossorigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(i){if(i.ep)return;i.ep=!0;const o=l(i);fetch(i.href,o)}})();function fe(){}function xt(t,e){for(const l in e)t[l]=e[l];return t}function tc(t){return t()}function La(){return Object.create(null)}function ze(t){t.forEach(tc)}function co(t){return typeof t=="function"}function Ne(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let _s;function Js(t,e){return _s||(_s=document.createElement("a")),_s.href=e,t===_s.href}function e0(t){return Object.keys(t).length===0}function mo(t,...e){if(t==null)return fe;const l=t.subscribe(...e);return l.unsubscribe?()=>l.unsubscribe():l}function ai(t){let e;return mo(t,l=>e=l)(),e}function ul(t,e,l){t.$$.on_destroy.push(mo(e,l))}function po(t,e,l,n){if(t){const i=lc(t,e,l,n);return t[0](i)}}function lc(t,e,l,n){return t[1]&&n?xt(l.ctx.slice(),t[1](n(e))):l.ctx}function _o(t,e,l,n){if(t[2]&&n){const i=t[2](n(l));if(e.dirty===void 0)return i;if(typeof i=="object"){const o=[],a=Math.max(e.dirty.length,i.length);for(let u=0;u32){const e=[],l=t.ctx.length/32;for(let n=0;nt.removeEventListener(e,l,n)}function $s(t){return function(e){return e.preventDefault(),t.call(this,e)}}function r(t,e,l){l==null?t.removeAttribute(e):t.getAttribute(e)!==l&&t.setAttribute(e,l)}const l0=["width","height"];function ui(t,e){const l=Object.getOwnPropertyDescriptors(t.__proto__);for(const n in e)e[n]==null?t.removeAttribute(n):n==="style"?t.style.cssText=e[n]:n==="__value"?t.value=t[n]=e[n]:l[n]&&l[n].set&&l0.indexOf(n)===-1?t[n]=e[n]:r(t,n,e[n])}function he(t){return t===""?null:+t}function n0(t){return Array.from(t.childNodes)}function X(t,e){e=""+e,t.data!==e&&(t.data=e)}function i0(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function s0(t,e,l){~t0.indexOf(l)?i0(t,e):X(t,e)}function te(t,e){t.value=e==null?"":e}function nc(t,e,l,n){l==null?t.style.removeProperty(e):t.style.setProperty(e,l,n?"important":"")}function qe(t,e,l){for(let n=0;n{a.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{o=ee(n.contentWindow,"resize",e),e()}),s(t,n),()=>{(i||o&&n.contentWindow)&&o(),C(n)}}function r0(t,e,{bubbles:l=!1,cancelable:n=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(t,l,n,e),i}function Oa(t,e){return new t(e)}let Si;function Mi(t){Si=t}function Ti(){if(!Si)throw new Error("Function called outside component initialization");return Si}function sc(t){Ti().$$.on_mount.push(t)}function a0(t){Ti().$$.on_destroy.push(t)}function u0(){const t=Ti();return(e,l,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const o=r0(e,l,{cancelable:n});return i.slice().forEach(a=>{a.call(t,o)}),!o.defaultPrevented}return!0}}function $i(t,e){return Ti().$$.context.set(t,e),e}function Bl(t){return Ti().$$.context.get(t)}const ii=[],ws=[];let si=[];const Fa=[],oc=Promise.resolve();let xs=!1;function rc(){xs||(xs=!0,oc.then(ac))}function f0(){return rc(),oc}function Qe(t){si.push(t)}const Vs=new Set;let li=0;function ac(){if(li!==0)return;const t=Si;do{try{for(;lit.indexOf(n)===-1?e.push(n):l.push(n)),l.forEach(n=>n()),si=e}const bs=new Set;let rn;function De(){rn={r:0,c:[],p:rn}}function Ie(){rn.r||ze(rn.c),rn=rn.p}function D(t,e){t&&t.i&&(bs.delete(t),t.i(e))}function q(t,e,l,n){if(t&&t.o){if(bs.has(t))return;bs.add(t),rn.c.push(()=>{bs.delete(t),n&&(l&&t.d(1),n())}),t.o(e)}else n&&n()}function uc(t,e){const l={},n={},i={$$scope:1};let o=t.length;for(;o--;){const a=t[o],u=e[o];if(u){for(const c in a)c in u||(n[c]=1);for(const c in u)i[c]||(l[c]=u[c],i[c]=1);t[o]=u}else for(const c in a)i[c]=1}for(const a in n)a in l||(l[a]=void 0);return l}function qa(t){return typeof t=="object"&&t!==null?t:{}}function ie(t){t&&t.c()}function le(t,e,l,n){const{fragment:i,after_update:o}=t.$$;i&&i.m(e,l),n||Qe(()=>{const a=t.$$.on_mount.map(tc).filter(co);t.$$.on_destroy?t.$$.on_destroy.push(...a):ze(a),t.$$.on_mount=[]}),o.forEach(Qe)}function ne(t,e){const l=t.$$;l.fragment!==null&&(m0(l.after_update),ze(l.on_destroy),l.fragment&&l.fragment.d(e),l.on_destroy=l.fragment=null,l.ctx=[])}function p0(t,e){t.$$.dirty[0]===-1&&(ii.push(t),rc(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const d=v.length?v[0]:b;return f.ctx&&i(f.ctx[p],f.ctx[p]=d)&&(!f.skip_bound&&f.bound[p]&&f.bound[p](d),_&&p0(t,p)),b}):[],f.update(),_=!0,ze(f.before_update),f.fragment=n?n(f.ctx):!1,e.target){if(e.hydrate){const p=n0(e.target);f.fragment&&f.fragment.l(p),p.forEach(C)}else f.fragment&&f.fragment.c();e.intro&&D(t.$$.fragment),le(t,e.target,e.anchor,e.customElement),ac()}Mi(c)}class Ee{$destroy(){ne(this,1),this.$destroy=fe}$on(e,l){if(!co(l))return fe;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(l),()=>{const i=n.indexOf(l);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!e0(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Ba=t=>typeof t>"u",fc=t=>typeof t=="function",cc=t=>typeof t=="number";function _0(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function mc(){let t=0;return()=>t++}function d0(){return Math.random().toString(36).substring(2)}const Ul=typeof window>"u";function pc(t,e,l){return t.addEventListener(e,l),()=>t.removeEventListener(e,l)}const _c=(t,e)=>t?{}:{style:e},eo=t=>({"aria-hidden":"true",..._c(t,"display:none;")}),ni=[];function dc(t,e){return{subscribe:at(t,e).subscribe}}function at(t,e=fe){let l;const n=new Set;function i(u){if(Ne(t,u)&&(t=u,l)){const c=!ni.length;for(const f of n)f[1](),ni.push(f,t);if(c){for(let f=0;f{n.delete(f),n.size===0&&l&&(l(),l=null)}}return{set:i,update:o,subscribe:a}}function v0(t,e,l){const n=!Array.isArray(t),i=n?[t]:t,o=e.length<2;return dc(l,a=>{let u=!1;const c=[];let f=0,_=fe;const p=()=>{if(f)return;_();const v=e(n?c[0]:c,a);o?a(v):_=co(v)?v:fe},b=i.map((v,d)=>mo(v,S=>{c[d]=S,f&=~(1<{f|=1<`@@svnav-ctx__${t}`,to=Ni("LOCATION"),fi=Ni("ROUTER"),vc=Ni("ROUTE"),h0=Ni("ROUTE_PARAMS"),b0=Ni("FOCUS_ELEM"),hc=/^:(.+)/,wi=(t,e,l)=>t.substr(e,l),lo=(t,e)=>wi(t,0,e.length)===e,g0=t=>t==="",k0=t=>hc.test(t),bc=t=>t[0]==="*",w0=t=>t.replace(/\*.*$/,""),gc=t=>t.replace(/(^\/+|\/+$)/g,"");function ml(t,e=!1){const l=gc(t).split("/");return e?l.filter(Boolean):l}const Ks=(t,e)=>t+(e?`?${e}`:""),bo=t=>`/${gc(t)}`;function Ai(...t){const e=n=>ml(n,!0).join("/"),l=t.map(e).join("/");return bo(l)}const go=1,Ss=2,mn=3,y0=4,kc=5,C0=6,wc=7,M0=8,$0=9,yc=10,Cc=11,S0={[go]:"Link",[Ss]:"Route",[mn]:"Router",[y0]:"useFocus",[kc]:"useLocation",[C0]:"useMatch",[wc]:"useNavigate",[M0]:"useParams",[$0]:"useResolvable",[yc]:"useResolve",[Cc]:"navigate"},ko=t=>S0[t];function T0(t,e){let l;return t===Ss?l=e.path?`path="${e.path}"`:"default":t===go?l=`to="${e.to}"`:t===mn&&(l=`basepath="${e.basepath||""}"`),`<${ko(t)} ${l||""} />`}function N0(t,e,l,n){const i=l&&T0(n||t,l),o=i?` -Occurred in: ${i}`:"",u=ko(t),a=uc(e)?e(u):e;return`<${u}> ${a}${o}`}const Cc=t=>(...e)=>t(N0(...e)),$c=Cc(t=>{throw new Error(t)}),ys=Cc(console.warn),Ua=4,A0=3,P0=2,E0=1,D0=1;function I0(t,e){const l=t.default?0:ml(t.fullPath).reduce((n,i)=>{let o=n;return o+=Ua,g0(i)?o+=D0:k0(i)?o+=P0:hc(i)?o-=Ua+E0:o+=A0,o},0);return{route:t,score:l,index:e}}function R0(t){return t.map(I0).sort((e,l)=>e.scorel.score?-1:e.index-l.index)}function Mc(t,e){let l,n;const[i]=e.split("?"),o=ml(i),u=o[0]==="",a=R0(t);for(let c=0,f=a.length;c({..._,params:b,uri:T});if(_.default){n=v(e);continue}const d=ml(_.fullPath),M=Math.max(o.length,d.length);let y=0;for(;y{f===".."?c.pop():f!=="."&&c.push(f)}),Ks(`/${c.join("/")}`,n)}function ja(t,e){const{pathname:l,hash:n="",search:i="",state:o}=t,u=ml(e,!0),a=ml(l,!0);for(;u.length;)u[0]!==a[0]&&$c(mn,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),u.shift(),a.shift();return{pathname:Ai(...a),hash:n,search:i,state:o}}const Ha=t=>t.length===1?"":t,wo=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,o=i?Ha(wi(t,l)):"",u=i?wi(t,0,l):t,a=n?Ha(wi(u,e)):"";return{pathname:(n?wi(u,0,e):u)||"/",search:a,hash:o}},O0=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function F0(t,e,l){return Ai(l,L0(t,e))}function q0(t,e){const l=bo(w0(t)),n=ml(l,!0),i=ml(e,!0).slice(0,n.length),o=Sc({fullPath:l},Ai(...i));return o&&o.uri}const Ys="POP",B0="PUSH",U0="REPLACE";function Qs(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function j0(t){let e=[],l=Qs(t),n=Ys;const i=(o=e)=>o.forEach(u=>u({location:l,action:n}));return{get location(){return l},listen(o){e.push(o);const u=()=>{l=Qs(t),n=Ys,i([o])};i([o]);const a=mc(t,"popstate",u);return()=>{a(),e=e.filter(c=>c!==o)}},navigate(o,u){const{state:a={},replace:c=!1}=u||{};if(n=c?U0:B0,fc(o))u&&ys(yc,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=Ys,t.history.go(o);else{const f={...a,_key:d0()};try{t.history[c?"replaceState":"pushState"](f,"",o)}catch{t.location[c?"replace":"assign"](o)}}l=Qs(t),i()}}}function Xs(t,e){return{...wo(e),state:t}}function H0(t="/"){let e=0,l=[Xs(null,t)];return{get entries(){return l},get location(){return l[e]},addEventListener(){},removeEventListener(){},history:{get state(){return l[e].state},pushState(n,i,o){e++,l=l.slice(0,e),l.push(Xs(n,o))},replaceState(n,i,o){l[e]=Xs(n,o)},go(n){const i=e+n;i<0||i>l.length-1||(e=i)}}}}const W0=!!(!Ul&&window.document&&window.document.createElement),z0=!Ul&&window.location.origin==="null",Tc=j0(W0&&!z0?window:H0()),{navigate:oi}=Tc;let Sl=null,Nc=!0;function G0(t,e){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;nSl.level||t.level===Sl.level&&G0(t.routerId,Sl.routerId))&&(Sl=t)}function K0(){Sl=null}function Y0(){Nc=!1}function Wa(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=mc(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function Q0(t,e){return Number(t.dataset.svnavRouteEnd)===e}function X0(t){return/^H[1-6]$/i.test(t.tagName)}function za(t,e=document){return e.querySelector(t)}function Z0(t){let l=za(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!Q0(l,t);){if(X0(l))return l;const n=za("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function J0(t){Promise.resolve(ai(t.focusElement)).then(e=>{const l=e||Z0(t.id);l||ys(mn,`Could not find an element to focus. You should always render a header for accessibility reasons, or set a custom focus element via the "useFocus" hook. If you don't want this Route or Router to manage focus, pass "primary={false}" to it.`,t,Ss),!Wa(l)&&Wa(document.documentElement)})}const x0=(t,e,l)=>(n,i)=>f0().then(()=>{if(!Sl||Nc){Y0();return}if(n&&J0(Sl.route),t.announcements&&i){const{path:o,fullPath:u,meta:a,params:c,uri:f}=Sl.route,_=t.createAnnouncement({path:o,fullPath:u,meta:a,params:c,uri:f},ai(l));Promise.resolve(_).then(p=>{e.set(p)})}K0()}),e1="position:fixed;top:-1px;left:0;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;";function t1(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},pc(t[6],e1)],i={};for(let o=0;o`Navigated to ${ue.uri}`,announcements:!0,...d},T=_,N=bo(_),E=Bl(to),B=Bl(fi),P=!E,L=n1(),O=v&&!(B&&!B.manageFocus),F=at("");ul(t,F,ue=>l(0,a=ue));const x=B?B.disableInlineStyles:M,j=at([]);ul(t,j,ue=>l(20,u=ue));const z=at(null);ul(t,z,ue=>l(18,i=ue));let G=!1;const V=P?0:B.level+1,U=P?at((()=>ja(Ul?wo(p):b.location,N))()):E;ul(t,U,ue=>l(17,n=ue));const K=at(n);ul(t,K,ue=>l(19,o=ue));const H=x0(y,F,U),Y=ue=>ke=>ke.filter(me=>me.id!==ue);function Z(ue){if(Ul){if(G)return;const ke=Sc(ue,n.pathname);if(ke)return G=!0,ke}else j.update(ke=>{const me=Y(ue.id)(ke);return me.push(ue),me})}function re(ue){j.update(Y(ue))}return!P&&_!==Ga&&ys(mn,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:_}),P&&(ic(()=>b.listen(ke=>{const me=ja(ke.location,N);K.set(n),U.set(me)})),Mi(to,U)),Mi(fi,{activeRoute:z,registerRoute:Z,unregisterRoute:re,manageFocus:O,level:V,id:L,history:P?b:B.history,basepath:P?N:B.basepath,disableInlineStyles:x}),t.$$set=ue=>{"basepath"in ue&&l(11,_=ue.basepath),"url"in ue&&l(12,p=ue.url),"history"in ue&&l(13,b=ue.history),"primary"in ue&&l(14,v=ue.primary),"a11y"in ue&&l(15,d=ue.a11y),"disableInlineStyles"in ue&&l(16,M=ue.disableInlineStyles),"$$scope"in ue&&l(21,f=ue.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&_!==T&&ys(mn,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const ue=Mc(u,n.pathname);z.set(ue)}if(t.$$.dirty[0]&655360&&P){const ue=!!n.hash,ke=!ue&&O,me=!ue||n.pathname!==o.pathname;H(ke,me)}t.$$.dirty[0]&262144&&O&&i&&i.primary&&V0({level:V,routerId:L,route:i})},[a,y,P,L,O,F,x,j,z,U,K,_,p,b,v,d,M,n,i,o,u,f,c]}class s1 extends Ee{constructor(e){super(),Pe(this,e,i1,l1,Ne,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}const Ac=s1;function Pi(t,e,l=fi,n=mn){Bl(l)||$c(t,o=>`You cannot use ${o} outside of a ${ko(n)}.`,e)}const o1=t=>{const{subscribe:e}=Bl(t);return{subscribe:e}};function Pc(){return Pi(gc),o1(to)}function Ec(){const{history:t}=Bl(fi);return t}function Dc(){const t=Bl(dc);return t?v0(t,e=>e.base):at("/")}function Ic(){Pi(wc);const t=Dc(),{basepath:e}=Bl(fi);return n=>F0(n,ai(t),e)}function r1(){Pi(kc);const t=Ic(),{navigate:e}=Ec();return(n,i)=>{const o=fc(n)?n:t(n);return e(o,i)}}const a1=t=>({params:t&16,location:t&8}),Va=t=>({params:Ul?ai(t[10]):t[4],location:t[3],navigate:t[11]});function Ka(t){let e,l;return e=new Ac({props:{primary:t[1],$$slots:{default:[c1]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.primary=n[1]),i&528409&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function u1(t){let e;const l=t[18].default,n=po(l,t,t[19],Va);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&524312)&&vo(n,l,i,i[19],e?_o(l,i[19],o,a1):ho(i[19]),Va)},i(i){e||(D(n,i),e=!0)},o(i){q(n,i),e=!1},d(i){n&&n.d(i)}}}function f1(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},Ul?ai(t[10]):t[4],t[12]];var o=t[0];function u(a){let c={};for(let f=0;f{ne(_,1)}),Ie()}o?(e=Oa(o,u()),ie(e.$$.fragment),D(e.$$.fragment,1),le(e,l.parentNode,l)):e=null}else o&&e.$set(f)},i(a){n||(e&&D(e.$$.fragment,a),n=!0)},o(a){e&&q(e.$$.fragment,a),n=!1},d(a){a&&C(l),e&&ne(e,a)}}}function c1(t){let e,l,n,i;const o=[f1,u1],u=[];function a(c,f){return c[0]!==null?0:1}return e=a(t),l=u[e]=o[e](t),{c(){l.c(),n=Ve()},m(c,f){u[e].m(c,f),$(c,n,f),i=!0},p(c,f){let _=e;e=a(c),e===_?u[e].p(c,f):(De(),q(u[_],1,1,()=>{u[_]=null}),Ie(),l=u[e],l?l.p(c,f):(l=u[e]=o[e](c),l.c()),D(l,1),l.m(n.parentNode,n))},i(c){i||(D(l),i=!0)},o(c){q(l),i=!1},d(c){u[e].d(c),c&&C(n)}}}function m1(t){let e,l,n,i,o,u=[eo(t[7]),{"data-svnav-route-start":t[5]}],a={};for(let p=0;p{c=null}),Ie())},i(p){o||(D(c),o=!0)},o(p){q(c),o=!1},d(p){p&&C(e),p&&C(l),c&&c.d(p),p&&C(n),p&&C(i)}}}const p1=cc();function _1(t,e,l){let n;const i=["path","component","meta","primary"];let o=ks(e,i),u,a,c,f,{$$slots:_={},$$scope:p}=e,{path:b=""}=e,{component:v=null}=e,{meta:d={}}=e,{primary:M=!0}=e;Pi(Ss,e);const y=p1(),{registerRoute:T,unregisterRoute:N,activeRoute:E,disableInlineStyles:B}=Bl(fi);ul(t,E,G=>l(16,u=G));const P=Dc();ul(t,P,G=>l(17,c=G));const L=Pc();ul(t,L,G=>l(3,a=G));const O=at(null);let F;const x=at(),j=at({});ul(t,j,G=>l(4,f=G)),Mi(dc,x),Mi(h0,j),Mi(b0,O);const z=r1();return Ul||a0(()=>N(y)),t.$$set=G=>{l(24,e=xt(xt({},e),gs(G))),l(12,o=ks(e,i)),"path"in G&&l(13,b=G.path),"component"in G&&l(0,v=G.component),"meta"in G&&l(14,d=G.meta),"primary"in G&&l(1,M=G.primary),"$$scope"in G&&l(19,p=G.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const G=b==="",V=Ai(c,b),W={id:y,path:b,meta:d,default:G,fullPath:G?"":V,base:G?c:q0(V,a.pathname),primary:M,focusElement:O};x.set(W),l(15,F=T(W))}if(t.$$.dirty&98304&&l(2,n=!!(F||u&&u.id===y)),t.$$.dirty&98308&&n){const{params:G}=F||u;j.set(G)}},e=gs(e),[v,M,n,a,f,y,E,B,P,L,j,z,o,b,d,F,u,c,_,p]}class d1 extends Ee{constructor(e){super(),Pe(this,e,_1,m1,Ne,{path:13,component:0,meta:14,primary:1})}}const Ml=d1;function v1(t){let e,l,n,i;const o=t[13].default,u=po(o,t,t[12],null);let a=[{href:t[0]},t[2],t[1]],c={};for(let f=0;fl(11,p=O));const E=u0(),B=Ic(),{navigate:P}=Ec();function L(O){E("click",O),_0(O)&&(O.preventDefault(),P(n,{state:y,replace:u||M}))}return t.$$set=O=>{l(19,e=xt(xt({},e),gs(O))),l(18,_=ks(e,f)),"to"in O&&l(5,d=O.to),"replace"in O&&l(6,M=O.replace),"state"in O&&l(7,y=O.state),"getProps"in O&&l(8,T=O.getProps),"$$scope"in O&&l(12,v=O.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=B(d,p)),t.$$.dirty&2049&&l(10,i=lo(p.pathname,n)),t.$$.dirty&2049&&l(9,o=n===p.pathname),t.$$.dirty&2049&&(u=wo(n)===O0(p)),t.$$.dirty&512&&l(2,a=o?{"aria-current":"page"}:{}),l(1,c=(()=>{if(uc(T)){const O=T({location:p,href:n,isPartiallyCurrent:i,isCurrent:o});return{..._,...O}}return _})())},e=gs(e),[n,c,a,N,L,d,M,y,T,o,i,p,v,b]}class b1 extends Ee{constructor(e){super(),Pe(this,e,h1,v1,Ne,{to:5,replace:6,state:7,getProps:8})}}const el=b1;let no=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function ql(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function g1(t){return t>218&&t<242?"#32d900":t>212&&t<248?"#b1d900":t>208&&t<252?"#ffb800":"#d90000"}function Rc(t){return t>90?"#d90000":t>85?"#e32100":t>80?"#ffb800":t>75?"#dcd800":"#32d900"}function k1(t){return t>75?"#32d900":t>50?"#77d900":t>25?"#94d900":"#dcd800"}function Cs(t){switch(t){case 1:return"Aidon";case 2:return"Kaifa";case 3:return"Kamstrup";case 8:return"Iskra";case 9:return"Landis+Gyr";case 10:return"Sagemcom";default:return"Unknown"}}function Oe(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function be(t,e){switch(e){case 5:switch(t){case"esp8266":return"Pow-K (GPIO12)";case"esp32s2":return"Pow-K+"}case 7:switch(t){case"esp8266":return"Pow-U (GPIO12)";case"esp32s2":return"Pow-U+"}case 6:return"Pow-P1";case 51:return"Wemos S2 mini";case 50:return"Generic ESP32-S2";case 201:return"Wemos LOLIN D32";case 202:return"Adafruit HUZZAH32";case 203:return"DevKitC";case 200:return"Generic ESP32";case 2:return"HAN Reader 2.0 by Max Spencer";case 0:return"Custom hardware by Roar Fredriksen";case 1:return"Kamstrup module by Egil Opsahl";case 8:return"\xB5HAN mosquito by dbeinder";case 3:return"Pow-K (UART0)";case 4:return"Pow-U (UART0)";case 101:return"Wemos D1 mini";case 100:return"Generic ESP8266";case 70:return"Generic ESP32-C3";case 71:return"ESP32-C3-DevKitM-1"}}function Ya(t){switch(t){case-1:return"Parse error";case-2:return"Incomplete data received";case-3:return"Payload boundry flag missing";case-4:return"Header checksum error";case-5:return"Footer checksum error";case-9:return"Unknown data received, check meter config";case-41:return"Frame length not equal";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid";case 90:return"No HAN data received for at least 30s";case 91:return"Serial break";case 92:return"Serial buffer full";case 93:return"Serial FIFO overflow";case 94:return"Serial frame error";case 95:return"Serial parity error";case 96:return"RX error";case 98:return"Exception in code, debugging necessary";case 99:return"Autodetection failed"}return t<0?"Unspecified error "+t:""}function Qa(t){switch(t){case-3:return"Connection failed";case-4:return"Network timeout";case-10:return"Connection denied";case-11:return"Failed to subscribe";case-13:return"Connection lost"}return t<0?"Unspecified error "+t:""}function Xa(t){switch(t){case 400:return"Unrecognized data in request";case 401:case 403:return"Unauthorized, check API key";case 404:return"Price unavailable, not found";case 425:return"Server says its too early";case 429:return"Exceeded API rate limit";case 500:return"Internal server error";case-1:return"Connection error";case-2:return"Incomplete data received";case-3:return"Invalid data, tag missing";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid"}return t<0?"Unspecified error "+t:""}function ri(t){switch(t){case 2:case 4:case 7:return!0}return!1}function Ke(t,e){return t==1||t==2&&e}function Ut(t){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+t}function ge(t,e){return isNaN(t)?"-":(isNaN(e)&&(e=t<10?1:0),t.toFixed(e))}function fl(t,e){return t.setTime(t.getTime()+e*36e5),t}function Za(t){if(t.chip=="esp8266")switch(t.boot_reason){case 0:return"Normal";case 1:return"WDT reset";case 2:return"Exception reset";case 3:return"Soft WDT reset";case 4:return"Software restart";case 5:return"Deep sleep";case 6:return"External reset";default:return"Unknown (8266)"}else switch(t.boot_reason){case 1:return"Vbat power on reset";case 3:return"Software reset";case 4:return"WDT reset";case 5:return"Deep sleep";case 6:return"SLC reset";case 7:return"Timer Group0 WDT reset";case 8:return"Timer Group1 WDT reset";case 9:return"RTC WDT reset";case 10:return"Instrusion test reset CPU";case 11:return"Time Group reset CPU";case 12:return"Software reset CPU";case 13:return"RTC WTD reset CPU";case 14:return"PRO CPU";case 15:return"Brownout";case 16:return"RTC reset";default:return"Unknown"}}function Ja(t){return t=="EOE"?"ENTSO-E":t=="HKS"?"hvakosterstrommen.no":t=="EDS"?"Energy Data Service":t=="MIX"?"Mixed sources":"Unknown ("+t+")"}async function jl(t,e={}){const{timeout:l=8e3}=e,n=new AbortController,i=setTimeout(()=>n.abort(),l),o=await fetch(t,{...e,signal:n.signal});return clearTimeout(i),o}let al={version:"",chip:"",mac:null,apmac:null,vndcfg:null,usrcfg:null,fwconsent:null,booting:!1,upgrading:!1,ui:{},security:0,boot_reason:0,upgrade:{x:-1,e:0,f:null,t:null},trying:null};const jt=at(al);async function yo(){al=await(await jl("/sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),jt.set(al)}let vs=0,xa=-127,eu=null,w1={};const y1=_c(w1,t=>{let e;async function l(){jl("/data.json").then(n=>n.json()).then(n=>{t(n),xa!=n.t&&(xa=n.t,setTimeout(Bc,2e3)),eu==null&&n.pe&&n.p!=null&&(eu=n.p,Oc()),al.upgrading?window.location.reload():(!al||!al.chip||al.booting||vs>1&&!ri(al.board))&&(yo(),an&&clearTimeout(an),an=setTimeout($o,2e3),un&&clearTimeout(un),un=setTimeout(Mo,3e3));let i=5e3;if(ri(al.board)&&n.v>2.5){let o=3.3-Math.min(3.3,n.v);o>0&&(i=Math.max(o,.1)*10*5e3)}i>5e3&&console.log("Scheduling next data fetch in "+i+"ms"),e&&clearTimeout(e),e=setTimeout(l,i),vs=0}).catch(n=>{vs++,vs>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(l,15e3)):e=setTimeout(l,ri(al.board)?1e4:5e3)})}return l(),function(){clearTimeout(e)}});let io={},yi;const Co=at(io);async function Lc(){let t=!1;if(Co.update(e=>{for(var l=0;l<36;l++){if(e[Oe(l)]==null){t=l<12;break}e[Oe(l)]=e[Oe(l+1)]}return e}),t)Oc();else{let e=new Date;yi=setTimeout(Lc,(60-e.getMinutes())*6e4)}}async function Oc(){yi&&(clearTimeout(yi),yi=0),io=await(await jl("/energyprice.json")).json(),Co.set(io);let e=new Date;yi=setTimeout(Lc,(60-e.getMinutes())*6e4)}let so={},an;async function $o(){an&&(clearTimeout(an),an=0),so=await(await jl("/dayplot.json")).json(),Fc.set(so);let e=new Date;an=setTimeout($o,(60-e.getMinutes())*6e4+20)}const Fc=at(so,t=>($o(),function(){}));let oo={},un;async function Mo(){un&&(clearTimeout(un),un=0),oo=await(await jl("/monthplot.json")).json(),qc.set(oo);let e=new Date;un=setTimeout(Mo,(24-e.getHours())*36e5+40)}const qc=at(oo,t=>(Mo(),function(){}));let ro={};async function Bc(){ro=await(await jl("/temperature.json")).json(),Uc.set(ro)}const Uc=at(ro,t=>(Bc(),function(){}));let ao={},hs;async function jc(){hs&&(clearTimeout(hs),hs=0),ao=await(await jl("/tariff.json")).json(),Hc.set(ao);let e=new Date;hs=setTimeout(jc,(60-e.getMinutes())*6e4+30)}const Hc=at(ao,t=>function(){});let uo=[];const So=at(uo);async function C1(){uo=await(await jl("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),So.set(uo)}function $s(t){return"WARNING: "+t+" must be connected to an external power supply during firmware upgrade. Failure to do so may cause power-down during upload resulting in non-functioning unit."}async function Wc(t){await(await fetch("/upgrade?expected_version="+t,{method:"POST"})).json()}function zc(t,e){if(/^v\d{1,2}\.\d{1,2}\.\d{1,2}$/.test(t)){let l=t.substring(1).split("."),n=parseInt(l[0]),i=parseInt(l[1]),o=parseInt(l[2]),u=[...e];u.reverse();let a,c,f;for(let _=0;_o&&(a=p):M==i+1&&(c=p);else if(d==n+1)if(f){let T=f.tag_name.substring(1).split(".");parseInt(T[0]);let N=parseInt(T[1]);parseInt(T[2]),M==N&&(f=p)}else f=p}return c||f||a||!1}else return e[0]}const $1="/github.svg";function tu(t){let e,l;function n(u,a){return u[1]>1?E1:u[1]>0?P1:u[2]>1?A1:u[2]>0?N1:u[3]>1?T1:u[3]>0?S1:M1}let i=n(t),o=i(t);return{c(){e=S(`Up - `),o.c(),l=Ve()},m(u,a){$(u,e,a),o.m(u,a),$(u,l,a)},p(u,a){i===(i=n(u))&&o?o.p(u,a):(o.d(1),o=i(u),o&&(o.c(),o.m(l.parentNode,l)))},d(u){u&&C(e),o.d(u),u&&C(l)}}}function M1(t){let e,l;return{c(){e=S(t[0]),l=S(" seconds")},m(n,i){$(n,e,i),$(n,l,i)},p(n,i){i&1&&X(e,n[0])},d(n){n&&C(e),n&&C(l)}}}function S1(t){let e,l;return{c(){e=S(t[3]),l=S(" minute")},m(n,i){$(n,e,i),$(n,l,i)},p(n,i){i&8&&X(e,n[3])},d(n){n&&C(e),n&&C(l)}}}function T1(t){let e,l;return{c(){e=S(t[3]),l=S(" minutes")},m(n,i){$(n,e,i),$(n,l,i)},p(n,i){i&8&&X(e,n[3])},d(n){n&&C(e),n&&C(l)}}}function N1(t){let e,l;return{c(){e=S(t[2]),l=S(" hour")},m(n,i){$(n,e,i),$(n,l,i)},p(n,i){i&4&&X(e,n[2])},d(n){n&&C(e),n&&C(l)}}}function A1(t){let e,l;return{c(){e=S(t[2]),l=S(" hours")},m(n,i){$(n,e,i),$(n,l,i)},p(n,i){i&4&&X(e,n[2])},d(n){n&&C(e),n&&C(l)}}}function P1(t){let e,l;return{c(){e=S(t[1]),l=S(" day")},m(n,i){$(n,e,i),$(n,l,i)},p(n,i){i&2&&X(e,n[1])},d(n){n&&C(e),n&&C(l)}}}function E1(t){let e,l;return{c(){e=S(t[1]),l=S(" days")},m(n,i){$(n,e,i),$(n,l,i)},p(n,i){i&2&&X(e,n[1])},d(n){n&&C(e),n&&C(l)}}}function D1(t){let e,l=t[0]&&tu(t);return{c(){l&&l.c(),e=Ve()},m(n,i){l&&l.m(n,i),$(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=tu(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:fe,o:fe,d(n){l&&l.d(n),n&&C(e)}}}function I1(t,e,l){let{epoch:n}=e,i=0,o=0,u=0;return t.$$set=a=>{"epoch"in a&&l(0,n=a.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(l(1,i=Math.floor(n/86400)),l(2,o=Math.floor(n/3600)),l(3,u=Math.floor(n/60)))},[n,i,o,u]}class R1 extends Ee{constructor(e){super(),Pe(this,e,I1,D1,Ne,{epoch:0})}}function L1(t){let e,l,n;return{c(){e=m("span"),l=S(t[2]),r(e,"title",t[1]),r(e,"class",n="bd-"+t[0])},m(i,o){$(i,e,o),s(e,l)},p(i,[o]){o&4&&X(l,i[2]),o&2&&r(e,"title",i[1]),o&1&&n!==(n="bd-"+i[0])&&r(e,"class",n)},i:fe,o:fe,d(i){i&&C(e)}}}function O1(t,e,l){let{color:n}=e,{title:i}=e,{text:o}=e;return t.$$set=u=>{"color"in u&&l(0,n=u.color),"title"in u&&l(1,i=u.title),"text"in u&&l(2,o=u.text)},[n,i,o]}class fn extends Ee{constructor(e){super(),Pe(this,e,O1,L1,Ne,{color:0,title:1,text:2})}}function F1(t){let e,l=`${Oe(t[0].getDate())}.${Oe(t[0].getMonth()+1)}.${t[0].getFullYear()} ${Oe(t[0].getHours())}:${Oe(t[0].getMinutes())}`,n;return{c(){e=m("span"),n=S(l),r(e,"class",t[1])},m(i,o){$(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=`${Oe(i[0].getDate())}.${Oe(i[0].getMonth()+1)}.${i[0].getFullYear()} ${Oe(i[0].getHours())}:${Oe(i[0].getMinutes())}`)&&X(n,l),o&2&&r(e,"class",i[1])},d(i){i&&C(e)}}}function q1(t){let e=`${Oe(t[0].getDate())}. ${no[t[0].getMonth()]} ${Oe(t[0].getHours())}:${Oe(t[0].getMinutes())}`,l;return{c(){l=S(e)},m(n,i){$(n,l,i)},p(n,i){i&1&&e!==(e=`${Oe(n[0].getDate())}. ${no[n[0].getMonth()]} ${Oe(n[0].getHours())}:${Oe(n[0].getMinutes())}`)&&X(l,e)},d(n){n&&C(l)}}}function B1(t){let e;function l(o,u){return o[2]?q1:F1}let n=l(t),i=n(t);return{c(){i.c(),e=Ve()},m(o,u){i.m(o,u),$(o,e,u)},p(o,[u]){n===(n=l(o))&&i?i.p(o,u):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},i:fe,o:fe,d(o){i.d(o),o&&C(e)}}}function U1(t,e,l){let{timestamp:n}=e,{fullTimeColor:i}=e,{offset:o}=e,u;return t.$$set=a=>{"timestamp"in a&&l(0,n=a.timestamp),"fullTimeColor"in a&&l(1,i=a.fullTimeColor),"offset"in a&&l(3,o=a.offset)},t.$$.update=()=>{t.$$.dirty&9&&(l(2,u=Math.abs(new Date().getTime()-n.getTime())<3e5),isNaN(o)||fl(n,o-(24+n.getHours()-n.getUTCHours())%24))},[n,i,u,o]}class Gc extends Ee{constructor(e){super(),Pe(this,e,U1,B1,Ne,{timestamp:0,fullTimeColor:1,offset:3})}}function j1(t){let e,l,n;return{c(){e=Fe("svg"),l=Fe("path"),n=Fe("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 011.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 01-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.397.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 01-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.505-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.107-1.204l-.527-.738a1.125 1.125 0 01.12-1.45l.773-.773a1.125 1.125 0 011.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894z"),r(n,"stroke-linecap","round"),r(n,"stroke-linejoin","round"),r(n,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(i,o){$(i,e,o),s(e,l),s(e,n)},p:fe,i:fe,o:fe,d(i){i&&C(e)}}}class H1 extends Ee{constructor(e){super(),Pe(this,e,null,j1,Ne,{})}}function W1(t){let e,l;return{c(){e=Fe("svg"),l=Fe("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(n,i){$(n,e,i),s(e,l)},p:fe,i:fe,o:fe,d(n){n&&C(e)}}}class z1 extends Ee{constructor(e){super(),Pe(this,e,null,W1,Ne,{})}}function G1(t){let e,l;return{c(){e=Fe("svg"),l=Fe("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(n,i){$(n,e,i),s(e,l)},p:fe,i:fe,o:fe,d(n){n&&C(e)}}}class Bt extends Ee{constructor(e){super(),Pe(this,e,null,G1,Ne,{})}}function V1(t){let e,l;return{c(){e=Fe("svg"),l=Fe("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M9 8.25H7.5a2.25 2.25 0 00-2.25 2.25v9a2.25 2.25 0 002.25 2.25h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25H15M9 12l3 3m0 0l3-3m-3 3V2.25"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(n,i){$(n,e,i),s(e,l)},p:fe,i:fe,o:fe,d(n){n&&C(e)}}}class Vc extends Ee{constructor(e){super(),Pe(this,e,null,V1,Ne,{})}}function K1(t){let e,l,n=t[1].version+"",i;return{c(){e=S("AMS reader "),l=m("span"),i=S(n)},m(o,u){$(o,e,u),$(o,l,u),s(l,i)},p(o,u){u&2&&n!==(n=o[1].version+"")&&X(i,n)},d(o){o&&C(e),o&&C(l)}}}function lu(t){let e,l=(t[0].t>-50?t[0].t.toFixed(1):"-")+"",n,i;return{c(){e=m("div"),n=S(l),i=S("\xB0C"),r(e,"class","flex-none my-auto")},m(o,u){$(o,e,u),s(e,n),s(e,i)},p(o,u){u&1&&l!==(l=(o[0].t>-50?o[0].t.toFixed(1):"-")+"")&&X(n,l)},d(o){o&&C(e)}}}function nu(t){let e,l="HAN: "+Ya(t[0].he),n;return{c(){e=m("div"),n=S(l),r(e,"class","bd-red")},m(i,o){$(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="HAN: "+Ya(i[0].he))&&X(n,l)},d(i){i&&C(e)}}}function iu(t){let e,l="MQTT: "+Qa(t[0].me),n;return{c(){e=m("div"),n=S(l),r(e,"class","bd-red")},m(i,o){$(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="MQTT: "+Qa(i[0].me))&&X(n,l)},d(i){i&&C(e)}}}function su(t){let e,l="PriceAPI: "+Xa(t[0].ee),n;return{c(){e=m("div"),n=S(l),r(e,"class","bd-red")},m(i,o){$(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="PriceAPI: "+Xa(i[0].ee))&&X(n,l)},d(i){i&&C(e)}}}function ou(t){let e,l,n,i,o,u;return l=new el({props:{to:"/configuration",$$slots:{default:[Y1]},$$scope:{ctx:t}}}),o=new el({props:{to:"/status",$$slots:{default:[Q1]},$$scope:{ctx:t}}}),{c(){e=m("div"),ie(l.$$.fragment),n=h(),i=m("div"),ie(o.$$.fragment),r(e,"class","flex-none px-1 mt-1"),r(e,"title","Configuration"),r(i,"class","flex-none px-1 mt-1"),r(i,"title","Device information")},m(a,c){$(a,e,c),le(l,e,null),$(a,n,c),$(a,i,c),le(o,i,null),u=!0},i(a){u||(D(l.$$.fragment,a),D(o.$$.fragment,a),u=!0)},o(a){q(l.$$.fragment,a),q(o.$$.fragment,a),u=!1},d(a){a&&C(e),ne(l),a&&C(n),a&&C(i),ne(o)}}}function Y1(t){let e,l;return e=new H1({}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function Q1(t){let e,l;return e=new z1({}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function ru(t){let e,l,n,i,o;const u=[Z1,X1],a=[];function c(f,_){return f[1].security==0||f[0].a?0:1}return l=c(t),n=a[l]=u[l](t),{c(){e=m("div"),n.c(),r(e,"class","flex-none mr-3 text-yellow-500"),r(e,"title",i="New version: "+t[2].tag_name)},m(f,_){$(f,e,_),a[l].m(e,null),o=!0},p(f,_){let p=l;l=c(f),l===p?a[l].p(f,_):(De(),q(a[p],1,1,()=>{a[p]=null}),Ie(),n=a[l],n?n.p(f,_):(n=a[l]=u[l](f),n.c()),D(n,1),n.m(e,null)),(!o||_&4&&i!==(i="New version: "+f[2].tag_name))&&r(e,"title",i)},i(f){o||(D(n),o=!0)},o(f){q(n),o=!1},d(f){f&&C(e),a[l].d()}}}function X1(t){let e,l,n=t[2].tag_name+"",i;return{c(){e=m("span"),l=S("New version: "),i=S(n)},m(o,u){$(o,e,u),s(e,l),s(e,i)},p(o,u){u&4&&n!==(n=o[2].tag_name+"")&&X(i,n)},i:fe,o:fe,d(o){o&&C(e)}}}function Z1(t){let e,l,n,i=t[2].tag_name+"",o,u,a,c,f,_;return a=new Vc({}),{c(){e=m("button"),l=m("span"),n=S("New version: "),o=S(i),u=h(),ie(a.$$.fragment),r(l,"class","mt-1"),r(e,"class","flex")},m(p,b){$(p,e,b),s(e,l),s(l,n),s(l,o),s(e,u),le(a,e,null),c=!0,f||(_=ee(e,"click",t[3]),f=!0)},p(p,b){(!c||b&4)&&i!==(i=p[2].tag_name+"")&&X(o,i)},i(p){c||(D(a.$$.fragment,p),c=!0)},o(p){q(a.$$.fragment,p),c=!1},d(p){p&&C(e),ne(a),f=!1,_()}}}function J1(t){let e,l,n,i,o,u,a,c,f,_,p,b,v=(t[0].m?(t[0].m/1e3).toFixed(1):"-")+"",d,M,y,T,N,E,B,P,L,O,F,x,j,z,G,V,W,U,K,H,Y,Z,re,ue,ke,me,Se,je,Re,He;i=new el({props:{to:"/",$$slots:{default:[K1]},$$scope:{ctx:t}}}),c=new R1({props:{epoch:t[0].u}});let we=t[0].t>-50&&lu(t);N=new fn({props:{title:"ESP",text:t[1].booting?"Booting":t[0].v>2?t[0].v.toFixed(2)+"V":"ESP",color:ql(t[1].booting?2:t[0].em)}}),B=new fn({props:{title:"HAN",text:"HAN",color:ql(t[1].booting?9:t[0].hm)}}),L=new fn({props:{title:"WiFi",text:t[0].r?t[0].r.toFixed(0)+"dBm":"WiFi",color:ql(t[1].booting?9:t[0].wm)}}),F=new fn({props:{title:"MQTT",text:"MQTT",color:ql(t[1].booting?9:t[0].mm)}});let Te=(t[0].he<0||t[0].he>0)&&nu(t),Le=t[0].me<0&&iu(t),$e=(t[0].ee>0||t[0].ee<0)&&su(t);re=new Gc({props:{timestamp:t[0].c?new Date(t[0].c*1e3):new Date(0),offset:t[1].clock_offset,fullTimeColor:"text-red-500"}});let w=t[1].vndcfg&&t[1].usrcfg&&ou(t);je=new Bt({});let g=t[1].fwconsent===1&&t[2]&&ru(t);return{c(){e=m("nav"),l=m("div"),n=m("div"),ie(i.$$.fragment),o=h(),u=m("div"),a=m("div"),ie(c.$$.fragment),f=h(),we&&we.c(),_=h(),p=m("div"),b=S("Free mem: "),d=S(v),M=S("kb"),y=h(),T=m("div"),ie(N.$$.fragment),E=h(),ie(B.$$.fragment),P=h(),ie(L.$$.fragment),O=h(),ie(F.$$.fragment),x=h(),Te&&Te.c(),j=h(),Le&&Le.c(),z=h(),$e&&$e.c(),G=h(),V=m("div"),W=m("div"),U=m("a"),K=m("img"),Y=h(),Z=m("div"),ie(re.$$.fragment),ue=h(),w&&w.c(),ke=h(),me=m("div"),Se=m("a"),ie(je.$$.fragment),Re=h(),g&&g.c(),r(n,"class","flex text-lg text-gray-100 p-2"),r(a,"class","flex-none my-auto"),r(p,"class","flex-none my-auto"),r(u,"class","flex-none my-auto p-2 flex space-x-4"),r(T,"class","flex-auto flex-wrap my-auto justify-center p-2"),r(K,"class","gh-logo"),Js(K.src,H=$1)||r(K,"src",H),r(K,"alt","GitHub repo"),r(U,"class","float-right"),r(U,"href","https://github.com/UtilitechAS/amsreader-firmware"),r(U,"target","_blank"),r(U,"rel","noreferrer"),r(U,"aria-label","GitHub"),r(W,"class","flex-none"),r(Z,"class","flex-none my-auto px-2"),r(Se,"href",Ut("")),r(Se,"target","_blank"),r(Se,"rel","noreferrer"),r(me,"class","flex-none px-1 mt-1"),r(me,"title","Documentation"),r(V,"class","flex-auto p-2 flex flex-row-reverse flex-wrap"),r(l,"class","flex flex-wrap space-x-4 text-sm text-gray-300"),r(e,"class","bg-violet-600 p-1 rounded-md mx-2")},m(k,A){$(k,e,A),s(e,l),s(l,n),le(i,n,null),s(l,o),s(l,u),s(u,a),le(c,a,null),s(u,f),we&&we.m(u,null),s(u,_),s(u,p),s(p,b),s(p,d),s(p,M),s(l,y),s(l,T),le(N,T,null),s(T,E),le(B,T,null),s(T,P),le(L,T,null),s(T,O),le(F,T,null),s(l,x),Te&&Te.m(l,null),s(l,j),Le&&Le.m(l,null),s(l,z),$e&&$e.m(l,null),s(l,G),s(l,V),s(V,W),s(W,U),s(U,K),s(V,Y),s(V,Z),le(re,Z,null),s(V,ue),w&&w.m(V,null),s(V,ke),s(V,me),s(me,Se),le(je,Se,null),s(V,Re),g&&g.m(V,null),He=!0},p(k,[A]){const I={};A&18&&(I.$$scope={dirty:A,ctx:k}),i.$set(I);const Q={};A&1&&(Q.epoch=k[0].u),c.$set(Q),k[0].t>-50?we?we.p(k,A):(we=lu(k),we.c(),we.m(u,_)):we&&(we.d(1),we=null),(!He||A&1)&&v!==(v=(k[0].m?(k[0].m/1e3).toFixed(1):"-")+"")&&X(d,v);const J={};A&3&&(J.text=k[1].booting?"Booting":k[0].v>2?k[0].v.toFixed(2)+"V":"ESP"),A&3&&(J.color=ql(k[1].booting?2:k[0].em)),N.$set(J);const se={};A&3&&(se.color=ql(k[1].booting?9:k[0].hm)),B.$set(se);const ce={};A&1&&(ce.text=k[0].r?k[0].r.toFixed(0)+"dBm":"WiFi"),A&3&&(ce.color=ql(k[1].booting?9:k[0].wm)),L.$set(ce);const ve={};A&3&&(ve.color=ql(k[1].booting?9:k[0].mm)),F.$set(ve),k[0].he<0||k[0].he>0?Te?Te.p(k,A):(Te=nu(k),Te.c(),Te.m(l,j)):Te&&(Te.d(1),Te=null),k[0].me<0?Le?Le.p(k,A):(Le=iu(k),Le.c(),Le.m(l,z)):Le&&(Le.d(1),Le=null),k[0].ee>0||k[0].ee<0?$e?$e.p(k,A):($e=su(k),$e.c(),$e.m(l,G)):$e&&($e.d(1),$e=null);const Me={};A&1&&(Me.timestamp=k[0].c?new Date(k[0].c*1e3):new Date(0)),A&2&&(Me.offset=k[1].clock_offset),re.$set(Me),k[1].vndcfg&&k[1].usrcfg?w?A&2&&D(w,1):(w=ou(k),w.c(),D(w,1),w.m(V,ke)):w&&(De(),q(w,1,1,()=>{w=null}),Ie()),k[1].fwconsent===1&&k[2]?g?(g.p(k,A),A&6&&D(g,1)):(g=ru(k),g.c(),D(g,1),g.m(V,null)):g&&(De(),q(g,1,1,()=>{g=null}),Ie())},i(k){He||(D(i.$$.fragment,k),D(c.$$.fragment,k),D(N.$$.fragment,k),D(B.$$.fragment,k),D(L.$$.fragment,k),D(F.$$.fragment,k),D(re.$$.fragment,k),D(w),D(je.$$.fragment,k),D(g),He=!0)},o(k){q(i.$$.fragment,k),q(c.$$.fragment,k),q(N.$$.fragment,k),q(B.$$.fragment,k),q(L.$$.fragment,k),q(F.$$.fragment,k),q(re.$$.fragment,k),q(w),q(je.$$.fragment,k),q(g),He=!1},d(k){k&&C(e),ne(i),ne(c),we&&we.d(),ne(N),ne(B),ne(L),ne(F),Te&&Te.d(),Le&&Le.d(),$e&&$e.d(),ne(re),w&&w.d(),ne(je),g&&g.d()}}}function x1(t,e,l){let{data:n={}}=e,i={},o={};function u(){confirm("Do you want to upgrade this device to "+o.tag_name+"?")&&(!ri(i.board)||confirm($s(be(i.chip,i.board))))&&(jt.update(a=>(a.upgrading=!0,a)),Wc(o.tag_name))}return jt.subscribe(a=>{l(1,i=a),a.fwconsent===1&&C1()}),So.subscribe(a=>{l(2,o=zc(i.version,a))}),t.$$set=a=>{"data"in a&&l(0,n=a.data)},[n,i,o,u]}class em extends Ee{constructor(e){super(),Pe(this,e,x1,J1,Ne,{data:0})}}function tm(t){let e,l,n,i;return{c(){e=Fe("svg"),l=Fe("path"),n=Fe("path"),r(l,"d",Zs(150,150,115,210,510)),r(l,"stroke","#eee"),r(l,"fill","none"),r(l,"stroke-width","55"),r(n,"d",i=Zs(150,150,115,210,210+300*t[0]/100)),r(n,"stroke",t[1]),r(n,"fill","none"),r(n,"stroke-width","55"),r(e,"viewBox","0 0 300 300"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"height","100%")},m(o,u){$(o,e,u),s(e,l),s(e,n)},p(o,[u]){u&1&&i!==(i=Zs(150,150,115,210,210+300*o[0]/100))&&r(n,"d",i),u&2&&r(n,"stroke",o[1])},i:fe,o:fe,d(o){o&&C(e)}}}function au(t,e,l,n){var i=(n-90)*Math.PI/180;return{x:t+l*Math.cos(i),y:e+l*Math.sin(i)}}function Zs(t,e,l,n,i){var o=au(t,e,l,i),u=au(t,e,l,n),a=i-n<=180?"0":"1",c=["M",o.x,o.y,"A",l,l,0,a,0,u.x,u.y].join(" ");return c}function lm(t,e,l){let{pct:n=0}=e,{color:i="red"}=e;return t.$$set=o=>{"pct"in o&&l(0,n=o.pct),"color"in o&&l(1,i=o.color)},[n,i]}class nm extends Ee{constructor(e){super(),Pe(this,e,lm,tm,Ne,{pct:0,color:1})}}function uu(t){let e,l,n,i,o,u,a,c;return{c(){e=m("br"),l=h(),n=m("span"),i=S(t[3]),o=h(),u=m("span"),a=S(t[4]),c=S("/kWh"),r(n,"class","pl-sub"),r(u,"class","pl-snt")},m(f,_){$(f,e,_),$(f,l,_),$(f,n,_),s(n,i),$(f,o,_),$(f,u,_),s(u,a),s(u,c)},p(f,_){_&8&&X(i,f[3]),_&16&&X(a,f[4])},d(f){f&&C(e),f&&C(l),f&&C(n),f&&C(o),f&&C(u)}}}function im(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,M,y;l=new nm({props:{pct:t[6],color:t[5](t[6])}});let T=t[3]&&uu(t);return{c(){e=m("div"),ie(l.$$.fragment),n=h(),i=m("span"),o=m("span"),u=S(t[2]),a=h(),c=m("br"),f=h(),_=m("span"),p=S(t[0]),b=h(),v=m("span"),d=S(t[1]),M=h(),T&&T.c(),r(o,"class","pl-lab"),r(_,"class","pl-val"),r(v,"class","pl-unt"),r(i,"class","pl-ov"),r(e,"class","pl-root")},m(N,E){$(N,e,E),le(l,e,null),s(e,n),s(e,i),s(i,o),s(o,u),s(i,a),s(i,c),s(i,f),s(i,_),s(_,p),s(i,b),s(i,v),s(v,d),s(i,M),T&&T.m(i,null),y=!0},p(N,[E]){const B={};E&64&&(B.pct=N[6]),E&96&&(B.color=N[5](N[6])),l.$set(B),(!y||E&4)&&X(u,N[2]),(!y||E&1)&&X(p,N[0]),(!y||E&2)&&X(d,N[1]),N[3]?T?T.p(N,E):(T=uu(N),T.c(),T.m(i,null)):T&&(T.d(1),T=null)},i(N){y||(D(l.$$.fragment,N),y=!0)},o(N){q(l.$$.fragment,N),y=!1},d(N){N&&C(e),ne(l),T&&T.d()}}}function sm(t,e,l){let{val:n}=e,{max:i}=e,{unit:o}=e,{label:u}=e,{sub:a=""}=e,{subunit:c=""}=e,{colorFn:f}=e,_=0;return t.$$set=p=>{"val"in p&&l(0,n=p.val),"max"in p&&l(7,i=p.max),"unit"in p&&l(1,o=p.unit),"label"in p&&l(2,u=p.label),"sub"in p&&l(3,a=p.sub),"subunit"in p&&l(4,c=p.subunit),"colorFn"in p&&l(5,f=p.colorFn)},t.$$.update=()=>{t.$$.dirty&129&&l(6,_=Math.min(n,i)/i*100)},[n,o,u,a,c,f,_,i]}class Kc extends Ee{constructor(e){super(),Pe(this,e,sm,im,Ne,{val:0,max:7,unit:1,label:2,sub:3,subunit:4,colorFn:5})}}function fu(t,e,l){const n=t.slice();return n[9]=e[l],n[11]=l,n}function cu(t,e,l){const n=t.slice();return n[9]=e[l],n[11]=l,n}function mu(t,e,l){const n=t.slice();return n[13]=e[l],n}function pu(t){let e,l,n,i,o,u,a=t[0].title&&_u(t),c=t[0].y.ticks,f=[];for(let d=0;d20||t[11]%2==0)&&bu(t);return{c(){e=Fe("g"),n&&n.c(),r(e,"class","tick"),r(e,"transform",l="translate("+t[5](t[11])+","+t[4]+")")},m(i,o){$(i,e,o),n&&n.m(e,null)},p(i,o){i[3]>20||i[11]%2==0?n?n.p(i,o):(n=bu(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o&48&&l!==(l="translate("+i[5](i[11])+","+i[4]+")")&&r(e,"transform",l)},d(i){i&&C(e),n&&n.d()}}}function bu(t){let e,l=t[9].label+"",n,i;return{c(){e=Fe("text"),n=S(l),r(e,"x",i=t[3]/2),r(e,"y","-4")},m(o,u){$(o,e,u),s(e,n)},p(o,u){u&1&&l!==(l=o[9].label+"")&&X(n,l),u&8&&i!==(i=o[3]/2)&&r(e,"x",i)},d(o){o&&C(e)}}}function gu(t){let e=!isNaN(t[5](t[11])),l,n=e&&hu(t);return{c(){n&&n.c(),l=Ve()},m(i,o){n&&n.m(i,o),$(i,l,o)},p(i,o){o&32&&(e=!isNaN(i[5](i[11]))),e?n?n.p(i,o):(n=hu(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&C(l)}}}function ku(t){let e,l,n=t[9].value!==void 0&&wu(t),i=t[9].value2>1e-4&&$u(t);return{c(){e=Fe("g"),n&&n.c(),l=Fe("g"),i&&i.c()},m(o,u){$(o,e,u),n&&n.m(e,null),$(o,l,u),i&&i.m(l,null)},p(o,u){o[9].value!==void 0?n?n.p(o,u):(n=wu(o),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o[9].value2>1e-4?i?i.p(o,u):(i=$u(o),i.c(),i.m(l,null)):i&&(i.d(1),i=null)},d(o){o&&C(e),n&&n.d(),o&&C(l),i&&i.d()}}}function wu(t){let e,l,n,i,o,u,a,c=t[3]>15&&yu(t);return{c(){e=Fe("rect"),c&&c.c(),a=Ve(),r(e,"x",l=t[5](t[11])+2),r(e,"y",n=t[6](t[9].value)),r(e,"width",i=t[3]-4),r(e,"height",o=t[6](t[0].y.min)-t[6](Math.min(t[0].y.min,0)+t[9].value)),r(e,"fill",u=t[9].color)},m(f,_){$(f,e,_),c&&c.m(f,_),$(f,a,_)},p(f,_){_&32&&l!==(l=f[5](f[11])+2)&&r(e,"x",l),_&65&&n!==(n=f[6](f[9].value))&&r(e,"y",n),_&8&&i!==(i=f[3]-4)&&r(e,"width",i),_&65&&o!==(o=f[6](f[0].y.min)-f[6](Math.min(f[0].y.min,0)+f[9].value))&&r(e,"height",o),_&1&&u!==(u=f[9].color)&&r(e,"fill",u),f[3]>15?c?c.p(f,_):(c=yu(f),c.c(),c.m(a.parentNode,a)):c&&(c.d(1),c=null)},d(f){f&&C(e),c&&c.d(f),f&&C(a)}}}function yu(t){let e,l=t[9].label+"",n,i,o,u,a,c,f=t[9].title&&Cu(t);return{c(){e=Fe("text"),n=S(l),f&&f.c(),c=Ve(),r(e,"width",i=t[3]-4),r(e,"dominant-baseline","middle"),r(e,"text-anchor",o=t[3]t[6](0)-t[7]?t[9].color:"white"),r(e,"transform",a="translate("+(t[5](t[11])+t[3]/2)+" "+(t[6](t[9].value)>t[6](0)-t[7]?t[6](t[9].value)-t[7]:t[6](t[9].value)+10)+") rotate("+(t[3]_[6](0)-_[7]?_[9].color:"white")&&r(e,"fill",u),p&233&&a!==(a="translate("+(_[5](_[11])+_[3]/2)+" "+(_[6](_[9].value)>_[6](0)-_[7]?_[6](_[9].value)-_[7]:_[6](_[9].value)+10)+") rotate("+(_[3]15&&Mu(t);return{c(){e=Fe("rect"),c&&c.c(),a=Ve(),r(e,"x",l=t[5](t[11])+2),r(e,"y",n=t[6](0)),r(e,"width",i=t[3]-4),r(e,"height",o=t[6](t[0].y.min)-t[6](t[0].y.min+t[9].value2)),r(e,"fill",u=t[9].color2?t[9].color2:t[9].color)},m(f,_){$(f,e,_),c&&c.m(f,_),$(f,a,_)},p(f,_){_&32&&l!==(l=f[5](f[11])+2)&&r(e,"x",l),_&64&&n!==(n=f[6](0))&&r(e,"y",n),_&8&&i!==(i=f[3]-4)&&r(e,"width",i),_&65&&o!==(o=f[6](f[0].y.min)-f[6](f[0].y.min+f[9].value2))&&r(e,"height",o),_&1&&u!==(u=f[9].color2?f[9].color2:f[9].color)&&r(e,"fill",u),f[3]>15?c?c.p(f,_):(c=Mu(f),c.c(),c.m(a.parentNode,a)):c&&(c.d(1),c=null)},d(f){f&&C(e),c&&c.d(f),f&&C(a)}}}function Mu(t){let e,l=t[9].label2+"",n,i,o,u,a,c=t[9].title2&&Su(t);return{c(){e=Fe("text"),n=S(l),c&&c.c(),a=Ve(),r(e,"width",i=t[3]-4),r(e,"dominant-baseline","middle"),r(e,"text-anchor","middle"),r(e,"fill",o=t[6](-t[9].value2)t[8].call(e))},m(i,o){$(i,e,o),n&&n.m(e,null),l=o0(e,t[8].bind(e))},p(i,[o]){i[0].x.ticks&&i[0].points&&i[4]?n?n.p(i,o):(n=pu(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},i:fe,o:fe,d(i){i&&C(e),n&&n.d(),l()}}}let cn=30;function rm(t,e,l){let{config:n}=e,i,o,u,a,c,f,_;function p(){i=this.clientWidth,o=this.clientHeight,l(1,i),l(2,o)}return t.$$set=b=>{"config"in b&&l(0,n=b.config)},t.$$.update=()=>{if(t.$$.dirty&31){l(4,f=o-(n.title?20:0));let b=i-(n.padding.left+n.padding.right);l(3,u=b/n.points.length),l(7,_=un.y.max?M=n.padding.bottom:df||M<0?0:M})}},[n,i,o,u,f,a,c,_,p]}class pn extends Ee{constructor(e){super(),Pe(this,e,rm,om,Ne,{config:0})}}function am(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function um(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{ds:u}=e,a={};function c(f){return{label:ge(f)+"V",title:f.toFixed(1)+" V",value:isNaN(f)?0:f,color:g1(f||0)}}return t.$$set=f=>{"u1"in f&&l(1,n=f.u1),"u2"in f&&l(2,i=f.u2),"u3"in f&&l(3,o=f.u3),"ds"in f&&l(4,u=f.ds)},t.$$.update=()=>{if(t.$$.dirty&30){let f=[],_=[];n>0&&(f.push({label:u===1?"L1-L2":"L1"}),_.push(c(n))),i>0&&(f.push({label:u===1?"L1-L3":"L2"}),_.push(c(i))),o>0&&(f.push({label:u===1?"L2-L3":"L3"}),_.push(c(o))),l(0,a={title:"Voltage",padding:{top:20,right:15,bottom:20,left:35},y:{min:200,max:260,ticks:[{value:207,label:"-10%"},{value:230,label:"230v"},{value:253,label:"+10%"}]},x:{ticks:f},points:_})}},[a,n,i,o,u]}class fm extends Ee{constructor(e){super(),Pe(this,e,um,am,Ne,{u1:1,u2:2,u3:3,ds:4})}}function cm(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function mm(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{i1:u}=e,{i2:a}=e,{i3:c}=e,{max:f}=e,_={};function p(b){return{label:ge(b)+"A",title:b.toFixed(1)+" A",value:isNaN(b)?0:b,color:Rc(b?b/f*100:0)}}return t.$$set=b=>{"u1"in b&&l(1,n=b.u1),"u2"in b&&l(2,i=b.u2),"u3"in b&&l(3,o=b.u3),"i1"in b&&l(4,u=b.i1),"i2"in b&&l(5,a=b.i2),"i3"in b&&l(6,c=b.i3),"max"in b&&l(7,f=b.max)},t.$$.update=()=>{if(t.$$.dirty&254){let b=[],v=[];n>0&&(b.push({label:"L1"}),v.push(p(u))),i>0&&(b.push({label:"L2"}),v.push(p(a))),o>0&&(b.push({label:"L3"}),v.push(p(c))),l(0,_={title:"Amperage",padding:{top:20,right:15,bottom:20,left:35},y:{min:0,max:f,ticks:[{value:0,label:"0%"},{value:f/4,label:"25%"},{value:f/2,label:"50%"},{value:f/4*3,label:"75%"},{value:f,label:"100%"}]},x:{ticks:b},points:v})}},[_,n,i,o,u,a,c,f]}class pm extends Ee{constructor(e){super(),Pe(this,e,mm,cm,Ne,{u1:1,u2:2,u3:3,i1:4,i2:5,i3:6,max:7})}}function _m(t){let e,l,n,i,o,u,a,c=(typeof t[0]<"u"?t[0].toFixed(0):"-")+"",f,_,p,b,v,d,M=(typeof t[1]<"u"?t[1].toFixed(0):"-")+"",y,T,N,E,B,P,L,O=(typeof t[2]<"u"?t[2].toFixed(1):"-")+"",F,x,j,z,G,V,W=(typeof t[3]<"u"?t[3].toFixed(1):"-")+"",U,K;return{c(){e=m("div"),l=m("strong"),l.textContent="Reactive",n=h(),i=m("div"),o=m("div"),o.textContent="Instant in",u=h(),a=m("div"),f=S(c),_=S(" VAr"),p=h(),b=m("div"),b.textContent="Instant out",v=h(),d=m("div"),y=S(M),T=S(" VAr"),N=h(),E=m("div"),B=m("div"),B.textContent="Total in",P=h(),L=m("div"),F=S(O),x=S(" kVArh"),j=h(),z=m("div"),z.textContent="Total out",G=h(),V=m("div"),U=S(W),K=S(" kVArh"),r(a,"class","text-right"),r(d,"class","text-right"),r(i,"class","grid grid-cols-2 mt-4"),r(L,"class","text-right"),r(V,"class","text-right"),r(E,"class","grid grid-cols-2 mt-4"),r(e,"class","mx-2 text-sm")},m(H,Y){$(H,e,Y),s(e,l),s(e,n),s(e,i),s(i,o),s(i,u),s(i,a),s(a,f),s(a,_),s(i,p),s(i,b),s(i,v),s(i,d),s(d,y),s(d,T),s(e,N),s(e,E),s(E,B),s(E,P),s(E,L),s(L,F),s(L,x),s(E,j),s(E,z),s(E,G),s(E,V),s(V,U),s(V,K)},p(H,[Y]){Y&1&&c!==(c=(typeof H[0]<"u"?H[0].toFixed(0):"-")+"")&&X(f,c),Y&2&&M!==(M=(typeof H[1]<"u"?H[1].toFixed(0):"-")+"")&&X(y,M),Y&4&&O!==(O=(typeof H[2]<"u"?H[2].toFixed(1):"-")+"")&&X(F,O),Y&8&&W!==(W=(typeof H[3]<"u"?H[3].toFixed(1):"-")+"")&&X(U,W)},i:fe,o:fe,d(H){H&&C(e)}}}function dm(t,e,l){let{importInstant:n}=e,{exportInstant:i}=e,{importTotal:o}=e,{exportTotal:u}=e;return t.$$set=a=>{"importInstant"in a&&l(0,n=a.importInstant),"exportInstant"in a&&l(1,i=a.exportInstant),"importTotal"in a&&l(2,o=a.importTotal),"exportTotal"in a&&l(3,u=a.exportTotal)},[n,i,o,u]}class vm extends Ee{constructor(e){super(),Pe(this,e,dm,_m,Ne,{importInstant:0,exportInstant:1,importTotal:2,exportTotal:3})}}function Nu(t){let e;function l(o,u){return o[3]?bm:hm}let n=l(t),i=n(t);return{c(){i.c(),e=Ve()},m(o,u){i.m(o,u),$(o,e,u)},p(o,u){n===(n=l(o))&&i?i.p(o,u):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){i.d(o),o&&C(e)}}}function hm(t){let e,l,n,i,o,u,a=ge(t[1].h.u,2)+"",c,f,_,p,b,v,d=ge(t[1].d.u,1)+"",M,y,T,N,E,B,P=ge(t[1].m.u)+"",L,O,F,x,j,z,G=ge(t[0].last_month.u)+"",V,W,U,K,H=t[4]&&Au(t);return{c(){e=m("strong"),e.textContent="Consumption",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",o=h(),u=m("div"),c=S(a),f=S(" kWh"),_=h(),p=m("div"),p.textContent="Day",b=h(),v=m("div"),M=S(d),y=S(" kWh"),T=h(),N=m("div"),N.textContent="Month",E=h(),B=m("div"),L=S(P),O=S(" kWh"),F=h(),x=m("div"),x.textContent="Last month",j=h(),z=m("div"),V=S(G),W=S(" kWh"),U=h(),H&&H.c(),K=Ve(),r(u,"class","text-right"),r(v,"class","text-right"),r(B,"class","text-right"),r(z,"class","text-right"),r(n,"class","grid grid-cols-2 mb-3")},m(Y,Z){$(Y,e,Z),$(Y,l,Z),$(Y,n,Z),s(n,i),s(n,o),s(n,u),s(u,c),s(u,f),s(n,_),s(n,p),s(n,b),s(n,v),s(v,M),s(v,y),s(n,T),s(n,N),s(n,E),s(n,B),s(B,L),s(B,O),s(n,F),s(n,x),s(n,j),s(n,z),s(z,V),s(z,W),$(Y,U,Z),H&&H.m(Y,Z),$(Y,K,Z)},p(Y,Z){Z&2&&a!==(a=ge(Y[1].h.u,2)+"")&&X(c,a),Z&2&&d!==(d=ge(Y[1].d.u,1)+"")&&X(M,d),Z&2&&P!==(P=ge(Y[1].m.u)+"")&&X(L,P),Z&1&&G!==(G=ge(Y[0].last_month.u)+"")&&X(V,G),Y[4]?H?H.p(Y,Z):(H=Au(Y),H.c(),H.m(K.parentNode,K)):H&&(H.d(1),H=null)},d(Y){Y&&C(e),Y&&C(l),Y&&C(n),Y&&C(U),H&&H.d(Y),Y&&C(K)}}}function bm(t){let e,l,n,i,o,u,a=ge(t[1].h.u,2)+"",c,f,_,p,b,v,d,M=ge(t[1].d.u,1)+"",y,T,N,E,B,P,L,O=ge(t[1].m.u)+"",F,x,j,z,G,V,W,U=ge(t[0].last_month.u)+"",K,H,Y,Z,re,ue,ke,me,Se,je,Re,He=ge(t[1].h.p,2)+"",we,Te,Le,$e,w,g,k,A=ge(t[1].d.p,1)+"",I,Q,J,se,ce,ve,Me,oe=ge(t[1].m.p)+"",pe,Be,_e,ye,vt,Hl,tl,ct=ge(t[0].last_month.p)+"",Tl,pl,Ht,ht,Qe=t[4]&&Pu(t),Xe=t[4]&&Eu(t),Ze=t[4]&&Du(t),Ue=t[4]&&Iu(t),Je=t[4]&&Ru(t),We=t[4]&&Lu(t),xe=t[4]&&Ou(t),et=t[4]&&Fu(t);return{c(){e=m("strong"),e.textContent="Import",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",o=h(),u=m("div"),c=S(a),f=S(" kWh"),_=h(),Qe&&Qe.c(),p=h(),b=m("div"),b.textContent="Day",v=h(),d=m("div"),y=S(M),T=S(" kWh"),N=h(),Xe&&Xe.c(),E=h(),B=m("div"),B.textContent="Month",P=h(),L=m("div"),F=S(O),x=S(" kWh"),j=h(),Ze&&Ze.c(),z=h(),G=m("div"),G.textContent="Last mo.",V=h(),W=m("div"),K=S(U),H=S(" kWh"),Y=h(),Ue&&Ue.c(),re=h(),ue=m("strong"),ue.textContent="Export",ke=h(),me=m("div"),Se=m("div"),Se.textContent="Hour",je=h(),Re=m("div"),we=S(He),Te=S(" kWh"),Le=h(),Je&&Je.c(),$e=h(),w=m("div"),w.textContent="Day",g=h(),k=m("div"),I=S(A),Q=S(" kWh"),J=h(),We&&We.c(),se=h(),ce=m("div"),ce.textContent="Month",ve=h(),Me=m("div"),pe=S(oe),Be=S(" kWh"),_e=h(),xe&&xe.c(),ye=h(),vt=m("div"),vt.textContent="Last mo.",Hl=h(),tl=m("div"),Tl=S(ct),pl=S(" kWh"),Ht=h(),et&&et.c(),r(u,"class","text-right"),r(d,"class","text-right"),r(L,"class","text-right"),r(W,"class","text-right"),r(n,"class",Z="grid grid-cols-"+t[5]+" mb-3"),r(Re,"class","text-right"),r(k,"class","text-right"),r(Me,"class","text-right"),r(tl,"class","text-right"),r(me,"class",ht="grid grid-cols-"+t[5])},m(de,Ce){$(de,e,Ce),$(de,l,Ce),$(de,n,Ce),s(n,i),s(n,o),s(n,u),s(u,c),s(u,f),s(n,_),Qe&&Qe.m(n,null),s(n,p),s(n,b),s(n,v),s(n,d),s(d,y),s(d,T),s(n,N),Xe&&Xe.m(n,null),s(n,E),s(n,B),s(n,P),s(n,L),s(L,F),s(L,x),s(n,j),Ze&&Ze.m(n,null),s(n,z),s(n,G),s(n,V),s(n,W),s(W,K),s(W,H),s(n,Y),Ue&&Ue.m(n,null),$(de,re,Ce),$(de,ue,Ce),$(de,ke,Ce),$(de,me,Ce),s(me,Se),s(me,je),s(me,Re),s(Re,we),s(Re,Te),s(me,Le),Je&&Je.m(me,null),s(me,$e),s(me,w),s(me,g),s(me,k),s(k,I),s(k,Q),s(me,J),We&&We.m(me,null),s(me,se),s(me,ce),s(me,ve),s(me,Me),s(Me,pe),s(Me,Be),s(me,_e),xe&&xe.m(me,null),s(me,ye),s(me,vt),s(me,Hl),s(me,tl),s(tl,Tl),s(tl,pl),s(me,Ht),et&&et.m(me,null)},p(de,Ce){Ce&2&&a!==(a=ge(de[1].h.u,2)+"")&&X(c,a),de[4]?Qe?Qe.p(de,Ce):(Qe=Pu(de),Qe.c(),Qe.m(n,p)):Qe&&(Qe.d(1),Qe=null),Ce&2&&M!==(M=ge(de[1].d.u,1)+"")&&X(y,M),de[4]?Xe?Xe.p(de,Ce):(Xe=Eu(de),Xe.c(),Xe.m(n,E)):Xe&&(Xe.d(1),Xe=null),Ce&2&&O!==(O=ge(de[1].m.u)+"")&&X(F,O),de[4]?Ze?Ze.p(de,Ce):(Ze=Du(de),Ze.c(),Ze.m(n,z)):Ze&&(Ze.d(1),Ze=null),Ce&1&&U!==(U=ge(de[0].last_month.u)+"")&&X(K,U),de[4]?Ue?Ue.p(de,Ce):(Ue=Iu(de),Ue.c(),Ue.m(n,null)):Ue&&(Ue.d(1),Ue=null),Ce&32&&Z!==(Z="grid grid-cols-"+de[5]+" mb-3")&&r(n,"class",Z),Ce&2&&He!==(He=ge(de[1].h.p,2)+"")&&X(we,He),de[4]?Je?Je.p(de,Ce):(Je=Ru(de),Je.c(),Je.m(me,$e)):Je&&(Je.d(1),Je=null),Ce&2&&A!==(A=ge(de[1].d.p,1)+"")&&X(I,A),de[4]?We?We.p(de,Ce):(We=Lu(de),We.c(),We.m(me,se)):We&&(We.d(1),We=null),Ce&2&&oe!==(oe=ge(de[1].m.p)+"")&&X(pe,oe),de[4]?xe?xe.p(de,Ce):(xe=Ou(de),xe.c(),xe.m(me,ye)):xe&&(xe.d(1),xe=null),Ce&1&&ct!==(ct=ge(de[0].last_month.p)+"")&&X(Tl,ct),de[4]?et?et.p(de,Ce):(et=Fu(de),et.c(),et.m(me,null)):et&&(et.d(1),et=null),Ce&32&&ht!==(ht="grid grid-cols-"+de[5])&&r(me,"class",ht)},d(de){de&&C(e),de&&C(l),de&&C(n),Qe&&Qe.d(),Xe&&Xe.d(),Ze&&Ze.d(),Ue&&Ue.d(),de&&C(re),de&&C(ue),de&&C(ke),de&&C(me),Je&&Je.d(),We&&We.d(),xe&&xe.d(),et&&et.d()}}}function Au(t){let e,l,n,i,o,u,a=ge(t[1].h.c,2)+"",c,f,_,p,b,v,d,M=ge(t[1].d.c,1)+"",y,T,N,E,B,P,L,O=ge(t[1].m.c)+"",F,x,j,z,G,V,W,U=ge(t[0].last_month.c)+"",K,H,Y;return{c(){e=m("strong"),e.textContent="Cost",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",o=h(),u=m("div"),c=S(a),f=h(),_=S(t[2]),p=h(),b=m("div"),b.textContent="Day",v=h(),d=m("div"),y=S(M),T=h(),N=S(t[2]),E=h(),B=m("div"),B.textContent="Month",P=h(),L=m("div"),F=S(O),x=h(),j=S(t[2]),z=h(),G=m("div"),G.textContent="Last month",V=h(),W=m("div"),K=S(U),H=h(),Y=S(t[2]),r(u,"class","text-right"),r(d,"class","text-right"),r(L,"class","text-right"),r(W,"class","text-right"),r(n,"class","grid grid-cols-2")},m(Z,re){$(Z,e,re),$(Z,l,re),$(Z,n,re),s(n,i),s(n,o),s(n,u),s(u,c),s(u,f),s(u,_),s(n,p),s(n,b),s(n,v),s(n,d),s(d,y),s(d,T),s(d,N),s(n,E),s(n,B),s(n,P),s(n,L),s(L,F),s(L,x),s(L,j),s(n,z),s(n,G),s(n,V),s(n,W),s(W,K),s(W,H),s(W,Y)},p(Z,re){re&2&&a!==(a=ge(Z[1].h.c,2)+"")&&X(c,a),re&4&&X(_,Z[2]),re&2&&M!==(M=ge(Z[1].d.c,1)+"")&&X(y,M),re&4&&X(N,Z[2]),re&2&&O!==(O=ge(Z[1].m.c)+"")&&X(F,O),re&4&&X(j,Z[2]),re&1&&U!==(U=ge(Z[0].last_month.c)+"")&&X(K,U),re&4&&X(Y,Z[2])},d(Z){Z&&C(e),Z&&C(l),Z&&C(n)}}}function Pu(t){let e,l=ge(t[1].h.c,2)+"",n,i,o;return{c(){e=m("div"),n=S(l),i=h(),o=S(t[2]),r(e,"class","text-right")},m(u,a){$(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&2&&l!==(l=ge(u[1].h.c,2)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&C(e)}}}function Eu(t){let e,l=ge(t[1].d.c,1)+"",n,i,o;return{c(){e=m("div"),n=S(l),i=h(),o=S(t[2]),r(e,"class","text-right")},m(u,a){$(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&2&&l!==(l=ge(u[1].d.c,1)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&C(e)}}}function Du(t){let e,l=ge(t[1].m.c)+"",n,i,o;return{c(){e=m("div"),n=S(l),i=h(),o=S(t[2]),r(e,"class","text-right")},m(u,a){$(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&2&&l!==(l=ge(u[1].m.c)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&C(e)}}}function Iu(t){let e,l=ge(t[0].last_month.c)+"",n,i,o;return{c(){e=m("div"),n=S(l),i=h(),o=S(t[2]),r(e,"class","text-right")},m(u,a){$(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&1&&l!==(l=ge(u[0].last_month.c)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&C(e)}}}function Ru(t){let e,l=ge(t[1].h.i,2)+"",n,i,o;return{c(){e=m("div"),n=S(l),i=h(),o=S(t[2]),r(e,"class","text-right")},m(u,a){$(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&2&&l!==(l=ge(u[1].h.i,2)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&C(e)}}}function Lu(t){let e,l=ge(t[1].d.i,1)+"",n,i,o;return{c(){e=m("div"),n=S(l),i=h(),o=S(t[2]),r(e,"class","text-right")},m(u,a){$(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&2&&l!==(l=ge(u[1].d.i,1)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&C(e)}}}function Ou(t){let e,l=ge(t[1].m.i)+"",n,i,o;return{c(){e=m("div"),n=S(l),i=h(),o=S(t[2]),r(e,"class","text-right")},m(u,a){$(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&2&&l!==(l=ge(u[1].m.i)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&C(e)}}}function Fu(t){let e,l=ge(t[0].last_month.i)+"",n,i,o;return{c(){e=m("div"),n=S(l),i=h(),o=S(t[2]),r(e,"class","text-right")},m(u,a){$(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&1&&l!==(l=ge(u[0].last_month.i)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&C(e)}}}function gm(t){let e,l,n,i,o,u,a=t[1]&&Nu(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Real time calculation",n=h(),i=m("br"),o=m("br"),u=h(),a&&a.c(),r(e,"class","mx-2 text-sm")},m(c,f){$(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),s(e,u),a&&a.m(e,null)},p(c,[f]){c[1]?a?a.p(c,f):(a=Nu(c),a.c(),a.m(e,null)):a&&(a.d(1),a=null)},i:fe,o:fe,d(c){c&&C(e),a&&a.d()}}}function km(t,e,l){let{sysinfo:n}=e,{data:i}=e,{currency:o}=e,{hasExport:u}=e,a=!1,c=3;return t.$$set=f=>{"sysinfo"in f&&l(0,n=f.sysinfo),"data"in f&&l(1,i=f.data),"currency"in f&&l(2,o=f.currency),"hasExport"in f&&l(3,u=f.hasExport)},t.$$.update=()=>{t.$$.dirty&18&&(l(4,a=i&&i.h&&(Math.abs(i.h.c)>.01||Math.abs(i.d.c)>.01||Math.abs(i.m.c)>.01||Math.abs(i.h.i)>.01||Math.abs(i.d.i)>.01||Math.abs(i.m.i)>.01)),l(5,c=a?3:2))},[n,i,o,u,a,c]}class wm extends Ee{constructor(e){super(),Pe(this,e,km,gm,Ne,{sysinfo:0,data:1,currency:2,hasExport:3})}}function ym(t){let e,l,n=Ja(t[0].source)+"",i,o,u,a;return u=new pn({props:{config:t[1]}}),{c(){e=m("a"),l=S("Provided by: "),i=S(n),o=h(),ie(u.$$.fragment),r(e,"href","https://transparency.entsoe.eu/"),r(e,"target","_blank"),r(e,"class","text-xs float-right z-40")},m(c,f){$(c,e,f),s(e,l),s(e,i),$(c,o,f),le(u,c,f),a=!0},p(c,[f]){(!a||f&1)&&n!==(n=Ja(c[0].source)+"")&&X(i,n);const _={};f&2&&(_.config=c[1]),u.$set(_)},i(c){a||(D(u.$$.fragment,c),a=!0)},o(c){q(u.$$.fragment,c),a=!1},d(c){c&&C(e),c&&C(o),ne(u,c)}}}function Cm(t,e,l){let{json:n}=e,{sysinfo:i}=e,o={},u,a;return t.$$set=c=>{"json"in c&&l(0,n=c.json),"sysinfo"in c&&l(2,i=c.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&29){let c=n.currency,f=new Date().getUTCHours(),_=0,p=0,b=0,v=[],d=[],M=[];l(4,a=l(3,u=0));let y=new Date;for(fl(y,i.clock_offset-(24+y.getHours()-y.getUTCHours())%24),_=f;_<24&&(p=n[Oe(b++)],p!=null);_++)d.push({label:Oe(y.getHours())}),M.push(p*100),l(4,a=Math.min(a,p*100)),l(3,u=Math.max(u,p*100)),fl(y,1);for(_=0;_<24&&(p=n[Oe(b++)],p!=null);_++)d.push({label:Oe(y.getHours())}),M.push(p*100),l(4,a=Math.min(a,p*100)),l(3,u=Math.max(u,p*100)),fl(y,1);if(a>-100&&u<100){switch(c){case"NOK":case"SEK":case"DKK":c="\xF8re";break;case"EUR":c="cent";break;default:c=c+"/100"}for(l(4,a*=100),l(3,u*=100),_=0;_=0?P.toFixed(L):"",title:P>=0?P.toFixed(2)+" "+c:"",value:p>=0?Math.abs(p):0,label2:P<0?P.toFixed(L):"",title2:P<0?P.toFixed(2)+" "+c:"",value2:p<0?Math.abs(p):0,color:"#7c3aed"})}let N=Math.max(u,Math.abs(a));if(a<0){l(4,a=Math.min(N/4*-1,a));let P=Math.ceil(Math.abs(a)/N*4),L=a/P;for(_=1;_{"json"in c&&l(1,n=c.json),"sysinfo"in c&&l(2,i=c.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let c=0,f=[],_=[],p=[];l(4,a=l(3,u=0));let b=fl(new Date,-24),v=new Date().getUTCHours();for(fl(b,i.clock_offset-(24+b.getHours()-b.getUTCHours())%24),c=v;c<24;c++){let T=n["i"+Oe(c)],N=n["e"+Oe(c)];T===void 0&&(T=0),N===void 0&&(N=0),_.push({label:Oe(b.getHours())}),p.push({label:T.toFixed(1),title:T.toFixed(2)+" kWh",value:T*10,label2:N.toFixed(1),title2:N.toFixed(2)+" kWh",value2:N*10,color:"#7c3aed",color2:"#37829E"}),l(4,a=Math.max(a,N*10)),l(3,u=Math.max(u,T*10)),fl(b,1)}for(c=0;c{"json"in c&&l(1,n=c.json),"sysinfo"in c&&l(2,i=c.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let c=0,f=[],_=[],p=[];l(4,a=l(3,u=0));let b=new Date,v=new Date;for(fl(b,i.clock_offset-(24+b.getHours()-b.getUTCHours())%24),fl(v,i.clock_offset-(24+v.getHours()-v.getUTCHours())%24),v.setDate(0),c=b.getDate();c<=v.getDate();c++){let T=n["i"+Oe(c)],N=n["e"+Oe(c)];T===void 0&&(T=0),N===void 0&&(N=0),_.push({label:Oe(c)}),p.push({label:T.toFixed(T<10?1:0),title:T.toFixed(2)+" kWh",value:T,label2:N.toFixed(N<10?1:0),title2:N.toFixed(2)+" kWh",value2:N,color:"#7c3aed",color2:"#37829E"}),l(4,a=Math.max(a,N)),l(3,u=Math.max(u,T))}for(c=1;c{"json"in a&&l(1,n=a.json)},t.$$.update=()=>{if(t.$$.dirty&14){let a=0,c=0,f=[],_=[],p=[];n.s&&n.s.forEach((d,M)=>{var y=d.n?d.n:d.a;c=d.v,c==-127&&(c=0),_.push({label:y.slice(-4)}),p.push({label:c.toFixed(1),value:c,color:"#7c3aed"}),l(3,u=Math.min(u,c)),l(2,o=Math.max(o,c))}),l(2,o=Math.ceil(o)),l(3,u=Math.floor(u));let b=o;u<0&&(b+=Math.abs(u));let v=b/4;for(a=0;a<5;a++)c=u+v*a,f.push({value:c,label:c.toFixed(1)});l(0,i={title:"Temperature sensors (\xB0C)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:u,max:o,ticks:f},x:{ticks:_},points:p})}},[i,n,o,u]}class Im extends Ee{constructor(e){super(),Pe(this,e,Dm,Em,Ne,{json:1})}}function Rm(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}let Lm=0;function Om(t,e,l){let n={},i=0,o;return Hc.subscribe(u=>{l(2,o=u)}),jc(),t.$$.update=()=>{if(t.$$.dirty&6){let u=0,a=[],c=[],f=[];if(a.push({value:0,label:0}),o&&o.p)for(u=0;u0?Oe(_.d)+"."+no[new Date().getMonth()]:"-"}),l(1,i=Math.max(i,_.v))}if(o&&o.t){for(u=0;u=i)break;a.push({value:_,label:_})}a.push({label:o.m.toFixed(1),align:"right",color:"green",value:o.m})}o&&o.c&&(a.push({label:o.c.toFixed(0),color:"orange",value:o.c}),l(1,i=Math.max(i,o.c))),l(1,i=Math.ceil(i)),l(0,n={title:"Tariff peaks",padding:{top:20,right:35,bottom:20,left:35},y:{min:Lm,max:i,ticks:a},x:{ticks:c},points:f})}},[n,i,o]}class Fm extends Ee{constructor(e){super(),Pe(this,e,Om,Rm,Ne,{})}}function qu(t){let e,l,n,i,o,u,a=(t[0].mt?Cs(t[0].mt):"-")+"",c,f,_,p=(t[0].ic?t[0].ic.toFixed(1):"-")+"",b,v,d;return i=new Kc({props:{val:t[0].i?t[0].i:0,max:t[0].im?t[0].im:15e3,unit:"W",label:"Import",sub:t[0].p,subunit:t[0].pc,colorFn:Rc}}),{c(){e=m("div"),l=m("div"),n=m("div"),ie(i.$$.fragment),o=h(),u=m("div"),c=S(a),f=h(),_=m("div"),b=S(p),v=S(" kWh"),r(n,"class","col-span-2"),r(_,"class","text-right"),r(l,"class","grid grid-cols-2"),r(e,"class","cnt")},m(M,y){$(M,e,y),s(e,l),s(l,n),le(i,n,null),s(l,o),s(l,u),s(u,c),s(l,f),s(l,_),s(_,b),s(_,v),d=!0},p(M,y){const T={};y&1&&(T.val=M[0].i?M[0].i:0),y&1&&(T.max=M[0].im?M[0].im:15e3),y&1&&(T.sub=M[0].p),y&1&&(T.subunit=M[0].pc),i.$set(T),(!d||y&1)&&a!==(a=(M[0].mt?Cs(M[0].mt):"-")+"")&&X(c,a),(!d||y&1)&&p!==(p=(M[0].ic?M[0].ic.toFixed(1):"-")+"")&&X(b,p)},i(M){d||(D(i.$$.fragment,M),d=!0)},o(M){q(i.$$.fragment,M),d=!1},d(M){M&&C(e),ne(i)}}}function Bu(t){let e,l,n,i,o,u,a,c,f=(t[0].ec?t[0].ec.toFixed(1):"-")+"",_,p,b;return i=new Kc({props:{val:t[0].e?t[0].e:0,max:t[0].om?t[0].om*1e3:1e4,unit:"W",label:"Export",colorFn:k1}}),{c(){e=m("div"),l=m("div"),n=m("div"),ie(i.$$.fragment),o=h(),u=m("div"),a=h(),c=m("div"),_=S(f),p=S(" kWh"),r(n,"class","col-span-2"),r(c,"class","text-right"),r(l,"class","grid grid-cols-2"),r(e,"class","cnt")},m(v,d){$(v,e,d),s(e,l),s(l,n),le(i,n,null),s(l,o),s(l,u),s(l,a),s(l,c),s(c,_),s(c,p),b=!0},p(v,d){const M={};d&1&&(M.val=v[0].e?v[0].e:0),d&1&&(M.max=v[0].om?v[0].om*1e3:1e4),i.$set(M),(!b||d&1)&&f!==(f=(v[0].ec?v[0].ec.toFixed(1):"-")+"")&&X(_,f)},i(v){b||(D(i.$$.fragment,v),b=!0)},o(v){q(i.$$.fragment,v),b=!1},d(v){v&&C(e),ne(i)}}}function Uu(t){let e,l,n;return l=new fm({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,ds:t[0].ds}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt")},m(i,o){$(i,e,o),le(l,e,null),n=!0},p(i,o){const u={};o&1&&(u.u1=i[0].u1),o&1&&(u.u2=i[0].u2),o&1&&(u.u3=i[0].u3),o&1&&(u.ds=i[0].ds),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function ju(t){let e,l,n;return l=new pm({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,i1:t[0].i1,i2:t[0].i2,i3:t[0].i3,max:t[0].mf?t[0].mf:32}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt")},m(i,o){$(i,e,o),le(l,e,null),n=!0},p(i,o){const u={};o&1&&(u.u1=i[0].u1),o&1&&(u.u2=i[0].u2),o&1&&(u.u3=i[0].u3),o&1&&(u.i1=i[0].i1),o&1&&(u.i2=i[0].i2),o&1&&(u.i3=i[0].i3),o&1&&(u.max=i[0].mf?i[0].mf:32),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Hu(t){let e,l,n;return l=new vm({props:{importInstant:t[0].ri,exportInstant:t[0].re,importTotal:t[0].ric,exportTotal:t[0].rec}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt")},m(i,o){$(i,e,o),le(l,e,null),n=!0},p(i,o){const u={};o&1&&(u.importInstant=i[0].ri),o&1&&(u.exportInstant=i[0].re),o&1&&(u.importTotal=i[0].ric),o&1&&(u.exportTotal=i[0].rec),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Wu(t){let e,l,n;return l=new wm({props:{sysinfo:t[1],data:t[0].ea,currency:t[0].pc,hasExport:t[0].om>0||t[0].e>0}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt")},m(i,o){$(i,e,o),le(l,e,null),n=!0},p(i,o){const u={};o&2&&(u.sysinfo=i[1]),o&1&&(u.data=i[0].ea),o&1&&(u.currency=i[0].pc),o&1&&(u.hasExport=i[0].om>0||i[0].e>0),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function zu(t){let e,l,n;return l=new Fm({}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt h-64")},m(i,o){$(i,e,o),le(l,e,null),n=!0},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Gu(t){let e,l,n;return l=new $m({props:{json:t[2],sysinfo:t[1]}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){$(i,e,o),le(l,e,null),n=!0},p(i,o){const u={};o&4&&(u.json=i[2]),o&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Vu(t){let e,l,n;return l=new Tm({props:{json:t[3],sysinfo:t[1]}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){$(i,e,o),le(l,e,null),n=!0},p(i,o){const u={};o&8&&(u.json=i[3]),o&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Ku(t){let e,l,n;return l=new Pm({props:{json:t[4],sysinfo:t[1]}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){$(i,e,o),le(l,e,null),n=!0},p(i,o){const u={};o&16&&(u.json=i[4]),o&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Yu(t){let e,l,n;return l=new Im({props:{json:t[5]}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){$(i,e,o),le(l,e,null),n=!0},p(i,o){const u={};o&32&&(u.json=i[5]),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function qm(t){let e,l=Ke(t[1].ui.i,t[0].i),n,i=Ke(t[1].ui.e,t[0].om||t[0].e>0),o,u=Ke(t[1].ui.v,t[0].u1>100||t[0].u2>100||t[0].u3>100),a,c=Ke(t[1].ui.a,t[0].i1>.01||t[0].i2>.01||t[0].i3>.01),f,_=Ke(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),p,b=Ke(t[1].ui.c,t[0].ea),v,d=Ke(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("10YNO")||t[0].pr.startsWith("10Y1001A1001A4"))),M,y=Ke(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].p)),T,N=Ke(t[1].ui.d,t[3]),E,B=Ke(t[1].ui.m,t[4]),P,L=Ke(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[5].c>1),O,F=l&&qu(t),x=i&&Bu(t),j=u&&Uu(t),z=c&&ju(t),G=_&&Hu(t),V=b&&Wu(t),W=d&&zu(),U=y&&Gu(t),K=N&&Vu(t),H=B&&Ku(t),Y=L&&Yu(t);return{c(){e=m("div"),F&&F.c(),n=h(),x&&x.c(),o=h(),j&&j.c(),a=h(),z&&z.c(),f=h(),G&&G.c(),p=h(),V&&V.c(),v=h(),W&&W.c(),M=h(),U&&U.c(),T=h(),K&&K.c(),E=h(),H&&H.c(),P=h(),Y&&Y.c(),r(e,"class","grid 2xl:grid-cols-6 xl:grid-cols-5 lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2")},m(Z,re){$(Z,e,re),F&&F.m(e,null),s(e,n),x&&x.m(e,null),s(e,o),j&&j.m(e,null),s(e,a),z&&z.m(e,null),s(e,f),G&&G.m(e,null),s(e,p),V&&V.m(e,null),s(e,v),W&&W.m(e,null),s(e,M),U&&U.m(e,null),s(e,T),K&&K.m(e,null),s(e,E),H&&H.m(e,null),s(e,P),Y&&Y.m(e,null),O=!0},p(Z,[re]){re&3&&(l=Ke(Z[1].ui.i,Z[0].i)),l?F?(F.p(Z,re),re&3&&D(F,1)):(F=qu(Z),F.c(),D(F,1),F.m(e,n)):F&&(De(),q(F,1,1,()=>{F=null}),Ie()),re&3&&(i=Ke(Z[1].ui.e,Z[0].om||Z[0].e>0)),i?x?(x.p(Z,re),re&3&&D(x,1)):(x=Bu(Z),x.c(),D(x,1),x.m(e,o)):x&&(De(),q(x,1,1,()=>{x=null}),Ie()),re&3&&(u=Ke(Z[1].ui.v,Z[0].u1>100||Z[0].u2>100||Z[0].u3>100)),u?j?(j.p(Z,re),re&3&&D(j,1)):(j=Uu(Z),j.c(),D(j,1),j.m(e,a)):j&&(De(),q(j,1,1,()=>{j=null}),Ie()),re&3&&(c=Ke(Z[1].ui.a,Z[0].i1>.01||Z[0].i2>.01||Z[0].i3>.01)),c?z?(z.p(Z,re),re&3&&D(z,1)):(z=ju(Z),z.c(),D(z,1),z.m(e,f)):z&&(De(),q(z,1,1,()=>{z=null}),Ie()),re&3&&(_=Ke(Z[1].ui.r,Z[0].ri>0||Z[0].re>0||Z[0].ric>0||Z[0].rec>0)),_?G?(G.p(Z,re),re&3&&D(G,1)):(G=Hu(Z),G.c(),D(G,1),G.m(e,p)):G&&(De(),q(G,1,1,()=>{G=null}),Ie()),re&3&&(b=Ke(Z[1].ui.c,Z[0].ea)),b?V?(V.p(Z,re),re&3&&D(V,1)):(V=Wu(Z),V.c(),D(V,1),V.m(e,v)):V&&(De(),q(V,1,1,()=>{V=null}),Ie()),re&3&&(d=Ke(Z[1].ui.t,Z[0].pr&&(Z[0].pr.startsWith("10YNO")||Z[0].pr.startsWith("10Y1001A1001A4")))),d?W?re&3&&D(W,1):(W=zu(),W.c(),D(W,1),W.m(e,M)):W&&(De(),q(W,1,1,()=>{W=null}),Ie()),re&3&&(y=Ke(Z[1].ui.p,Z[0].pe&&!Number.isNaN(Z[0].p))),y?U?(U.p(Z,re),re&3&&D(U,1)):(U=Gu(Z),U.c(),D(U,1),U.m(e,T)):U&&(De(),q(U,1,1,()=>{U=null}),Ie()),re&10&&(N=Ke(Z[1].ui.d,Z[3])),N?K?(K.p(Z,re),re&10&&D(K,1)):(K=Vu(Z),K.c(),D(K,1),K.m(e,E)):K&&(De(),q(K,1,1,()=>{K=null}),Ie()),re&18&&(B=Ke(Z[1].ui.m,Z[4])),B?H?(H.p(Z,re),re&18&&D(H,1)):(H=Ku(Z),H.c(),D(H,1),H.m(e,P)):H&&(De(),q(H,1,1,()=>{H=null}),Ie()),re&35&&(L=Ke(Z[1].ui.s,Z[0].t&&Z[0].t!=-127&&Z[5].c>1)),L?Y?(Y.p(Z,re),re&35&&D(Y,1)):(Y=Yu(Z),Y.c(),D(Y,1),Y.m(e,null)):Y&&(De(),q(Y,1,1,()=>{Y=null}),Ie())},i(Z){O||(D(F),D(x),D(j),D(z),D(G),D(V),D(W),D(U),D(K),D(H),D(Y),O=!0)},o(Z){q(F),q(x),q(j),q(z),q(G),q(V),q(W),q(U),q(K),q(H),q(Y),O=!1},d(Z){Z&&C(e),F&&F.d(),x&&x.d(),j&&j.d(),z&&z.d(),G&&G.d(),V&&V.d(),W&&W.d(),U&&U.d(),K&&K.d(),H&&H.d(),Y&&Y.d()}}}function Bm(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,o={},u={},a={},c={};return Co.subscribe(f=>{l(2,o=f)}),Fc.subscribe(f=>{l(3,u=f)}),qc.subscribe(f=>{l(4,a=f)}),Uc.subscribe(f=>{l(5,c=f)}),t.$$set=f=>{"data"in f&&l(0,n=f.data),"sysinfo"in f&&l(1,i=f.sysinfo)},[n,i,o,u,a,c]}class Um extends Ee{constructor(e){super(),Pe(this,e,Bm,qm,Ne,{data:0,sysinfo:1})}}let fo={};const Ci=at(fo);async function jm(){fo=await(await fetch("/configuration.json")).json(),Ci.set(fo)}function Qu(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function Hm(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=3,e.value=e.__value},m(l,n){$(l,e,n)},d(l){l&&C(e)}}}function Wm(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=20,e.value=e.__value},m(l,n){$(l,e,n)},d(l){l&&C(e)}}}function Xu(t){let e;return{c(){e=m("option"),e.textContent="UART2",e.__value=113,e.value=e.__value},m(l,n){$(l,e,n)},d(l){l&&C(e)}}}function Zu(t){let e,l,n;return{c(){e=m("option"),e.textContent="UART1",l=h(),n=m("option"),n.textContent="UART2",e.__value=9,e.value=e.__value,n.__value=16,n.value=n.__value},m(i,o){$(i,e,o),$(i,l,o),$(i,n,o)},d(i){i&&C(e),i&&C(l),i&&C(n)}}}function Ju(t){let e;return{c(){e=m("option"),e.textContent="UART1",e.__value=18,e.value=e.__value},m(l,n){$(l,e,n)},d(l){l&&C(e)}}}function xu(t){let e,l,n;return{c(){e=m("option"),l=S("GPIO"),n=S(t[4]),e.__value=t[4],e.value=e.__value},m(i,o){$(i,e,o),s(e,l),s(e,n)},d(i){i&&C(e)}}}function ef(t){let e,l=t[4]>3&&!(t[0]=="esp32"&&(t[4]==9||t[4]==16))&&!(t[0]=="esp32s2"&&t[4]==18)&&!(t[0]=="esp8266"&&(t[4]==3||t[4]==113))&&xu(t);return{c(){l&&l.c(),e=Ve()},m(n,i){l&&l.m(n,i),$(n,e,i)},p(n,i){n[4]>3&&!(n[0]=="esp32"&&(n[4]==9||n[4]==16))&&!(n[0]=="esp32s2"&&n[4]==18)&&!(n[0]=="esp8266"&&(n[4]==3||n[4]==113))?l||(l=xu(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){l&&l.d(n),n&&C(e)}}}function zm(t){let e,l,n,i,o;function u(d,M){return d[0]=="esp32c3"?Wm:Hm}let a=u(t),c=a(t),f=t[0]=="esp8266"&&Xu(),_=(t[0]=="esp32"||t[0]=="esp32solo")&&Zu(),p=t[0]=="esp32s2"&&Ju(),b={length:t[1]+1},v=[];for(let d=0;d{"chip"in o&&l(0,n=o.chip)},t.$$.update=()=>{if(t.$$.dirty&1)switch(n){case"esp8266":l(1,i=16);break;case"esp32s2":l(1,i=44);break;case"esp32c3":l(1,i=19);break}},[n,i]}class Yc extends Ee{constructor(e){super(),Pe(this,e,Gm,zm,Ne,{chip:0})}}function tf(t){let e,l,n=t[1]&&lf(t);return{c(){e=m("div"),l=m("div"),n&&n.c(),r(l,"class","fixed inset-0 bg-gray-500 bg-opacity-50 flex items-center justify-center"),r(e,"class","z-50"),r(e,"aria-modal","true")},m(i,o){$(i,e,o),s(e,l),n&&n.m(l,null)},p(i,o){i[1]?n?n.p(i,o):(n=lf(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&C(e),n&&n.d()}}}function lf(t){let e,l;return{c(){e=m("div"),l=S(t[1]),r(e,"class","bg-white m-2 p-3 rounded-md shadow-lg pb-4 text-gray-700 w-96")},m(n,i){$(n,e,i),s(e,l)},p(n,i){i&2&&X(l,n[1])},d(n){n&&C(e)}}}function Vm(t){let e,l=t[0]&&tf(t);return{c(){l&&l.c(),e=Ve()},m(n,i){l&&l.m(n,i),$(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=tf(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:fe,o:fe,d(n){l&&l.d(n),n&&C(e)}}}function Km(t,e,l){let{active:n}=e,{message:i}=e;return t.$$set=o=>{"active"in o&&l(0,n=o.active),"message"in o&&l(1,i=o.message)},[n,i]}class It extends Ee{constructor(e){super(),Pe(this,e,Km,Vm,Ne,{active:0,message:1})}}function nf(t,e,l){const n=t.slice();return n[1]=e[l],n}function sf(t){let e,l,n=t[1]+"",i;return{c(){e=m("option"),l=S("Europe/"),i=S(n),e.__value="Europe/"+t[1],e.value=e.__value},m(o,u){$(o,e,u),s(e,l),s(e,i)},p:fe,d(o){o&&C(e)}}}function Ym(t){let e,l,n,i=t[0],o=[];for(let u=0;u>1&1,A=0;A0;g--)A[g]=A[g]?A[g-1]^P.EXPONENT[F._modN(P.LOG[A[g]]+w)]:A[g-1];A[0]=P.EXPONENT[F._modN(P.LOG[A[0]]+w)]}for(w=0;w<=k;w++)A[w]=P.LOG[A[w]]},_checkBadness:function(){var w,g,k,A,I,Q=0,J=this._badness,se=this.buffer,ce=this.width;for(I=0;Ice*ce;)oe-=ce*ce,Me++;for(Q+=Me*F.N4,A=0;A=J-2&&(w=J-2,I>9&&w--);var se=w;if(I>9){for(Q[se+2]=0,Q[se+3]=0;se--;)g=Q[se],Q[se+3]|=255&g<<4,Q[se+2]=g>>4;Q[2]|=255&w<<4,Q[1]=w>>4,Q[0]=64|w>>12}else{for(Q[se+1]=0,Q[se+2]=0;se--;)g=Q[se],Q[se+2]|=255&g<<4,Q[se+1]=g>>4;Q[1]|=255&w<<4,Q[0]=64|w>>4}for(se=w+3-(I<10);se=5&&(k+=F.N1+A[g]-5);for(g=3;gw||A[g-3]*3>=A[g]*4||A[g+3]*3>=A[g]*4)&&(k+=F.N3);return k},_finish:function(){this._stringBuffer=this.buffer.slice();var w,g,k=0,A=3e4;for(g=0;g<8&&(this._applyMask(g),w=this._checkBadness(),w>=1)A&1&&(I[Q-1-g+Q*8]=1,g<6?I[8+Q*g]=1:I[8+Q*(g+1)]=1);for(g=0;g<7;g++,A>>=1)A&1&&(I[8+Q*(Q-7+g)]=1,g?I[6-g+Q*8]=1:I[7+Q*8]=1)},_interleaveBlocks:function(){var w,g,k=this._dataBlock,A=this._ecc,I=this._eccBlock,Q=0,J=this._calculateMaxLength(),se=this._neccBlock1,ce=this._neccBlock2,ve=this._stringBuffer;for(w=0;w1)for(w=T.BLOCK[A],k=I-7;;){for(g=I-7;g>w-3&&(this._addAlignment(g,k),!(g6)for(w=O.BLOCK[Q-7],g=17,k=0;k<6;k++)for(A=0;A<3;A++,g--)1&(g>11?Q>>g-12:w>>g)?(I[5-k+J*(2-A+J-11)]=1,I[2-A+J-11+J*(5-k)]=1):(this._setMask(5-k,2-A+J-11),this._setMask(2-A+J-11,5-k))},_isMasked:function(w,g){var k=F._getMaskBit(w,g);return this._mask[k]===1},_pack:function(){var w,g,k,A=1,I=1,Q=this.width,J=Q-1,se=Q-1,ce=(this._dataBlock+this._eccBlock)*(this._neccBlock1+this._neccBlock2)+this._neccBlock2;for(g=0;gg&&(k=w,w=g,g=k),k=g,k+=g*g,k>>=1,k+=w,k},_modN:function(w){for(;w>=255;)w-=255,w=(w>>8)+(w&255);return w},N1:3,N2:3,N3:40,N4:10}),x=F,j=v.extend({draw:function(){this.element.src=this.qrious.toDataURL()},reset:function(){this.element.src=""},resize:function(){var w=this.element;w.width=w.height=this.qrious.size}}),z=j,G=p.extend(function(w,g,k,A){this.name=w,this.modifiable=Boolean(g),this.defaultValue=k,this._valueTransformer=A},{transform:function(w){var g=this._valueTransformer;return typeof g=="function"?g(w,this):w}}),V=G,W=p.extend(null,{abs:function(w){return w!=null?Math.abs(w):null},hasOwn:function(w,g){return Object.prototype.hasOwnProperty.call(w,g)},noop:function(){},toUpperCase:function(w){return w!=null?w.toUpperCase():null}}),U=W,K=p.extend(function(w){this.options={},w.forEach(function(g){this.options[g.name]=g},this)},{exists:function(w){return this.options[w]!=null},get:function(w,g){return K._get(this.options[w],g)},getAll:function(w){var g,k=this.options,A={};for(g in k)U.hasOwn(k,g)&&(A[g]=K._get(k[g],w));return A},init:function(w,g,k){typeof k!="function"&&(k=U.noop);var A,I;for(A in this.options)U.hasOwn(this.options,A)&&(I=this.options[A],K._set(I,I.defaultValue,g),K._createAccessor(I,g,k));this._setAll(w,g,!0)},set:function(w,g,k){return this._set(w,g,k)},setAll:function(w,g){return this._setAll(w,g)},_set:function(w,g,k,A){var I=this.options[w];if(!I)throw new Error("Invalid option: "+w);if(!I.modifiable&&!A)throw new Error("Option cannot be modified: "+w);return K._set(I,g,k)},_setAll:function(w,g,k){if(!w)return!1;var A,I=!1;for(A in w)U.hasOwn(w,A)&&this._set(A,w[A],g,k)&&(I=!0);return I}},{_createAccessor:function(w,g,k){var A={get:function(){return K._get(w,g)}};w.modifiable&&(A.set=function(I){K._set(w,I,g)&&k(I,w)}),Object.defineProperty(g,w.name,A)},_get:function(w,g){return g["_"+w.name]},_set:function(w,g,k){var A="_"+w.name,I=k[A],Q=w.transform(g!=null?g:w.defaultValue);return k[A]=Q,Q!==I}}),H=K,Y=p.extend(function(){this._services={}},{getService:function(w){var g=this._services[w];if(!g)throw new Error("Service is not being managed with name: "+w);return g},setService:function(w,g){if(this._services[w])throw new Error("Service is already managed with name: "+w);g&&(this._services[w]=g)}}),Z=Y,re=new H([new V("background",!0,"white"),new V("backgroundAlpha",!0,1,U.abs),new V("element"),new V("foreground",!0,"black"),new V("foregroundAlpha",!0,1,U.abs),new V("level",!0,"L",U.toUpperCase),new V("mime",!0,"image/png"),new V("padding",!0,null,U.abs),new V("size",!0,100,U.abs),new V("value",!0,"")]),ue=new Z,ke=p.extend(function(w){re.init(w,this,this.update.bind(this));var g=re.get("element",this),k=ue.getService("element"),A=g&&k.isCanvas(g)?g:k.createCanvas(),I=g&&k.isImage(g)?g:k.createImage();this._canvasRenderer=new M(this,A,!0),this._imageRenderer=new z(this,I,I===g),this.update()},{get:function(){return re.getAll(this)},set:function(w){re.setAll(w,this)&&this.update()},toDataURL:function(w){return this.canvas.toDataURL(w||this.mime)},update:function(){var w=new x({level:this.level,value:this.value});this._canvasRenderer.render(w),this._imageRenderer.render(w)}},{use:function(w){ue.setService(w.getName(),w)}});Object.defineProperties(ke.prototype,{canvas:{get:function(){return this._canvasRenderer.getElement()}},image:{get:function(){return this._imageRenderer.getElement()}}});var me=ke,Se=me,je=p.extend({getName:function(){}}),Re=je,He=Re.extend({createCanvas:function(){},createImage:function(){},getName:function(){return"element"},isCanvas:function(w){},isImage:function(w){}}),we=He,Te=we.extend({createCanvas:function(){return document.createElement("canvas")},createImage:function(){return document.createElement("img")},isCanvas:function(w){return w instanceof HTMLCanvasElement},isImage:function(w){return w instanceof HTMLImageElement}}),Le=Te;Se.use(new Le);var $e=Se;return $e})})(Xc);const ep=Xc.exports;function tp(t){let e,l;return{c(){e=m("img"),Js(e.src,l=t[2])||r(e,"src",l),r(e,"alt",t[0]),r(e,"class",t[1])},m(n,i){$(n,e,i)},p(n,[i]){i&4&&!Js(e.src,l=n[2])&&r(e,"src",l),i&1&&r(e,"alt",n[0]),i&2&&r(e,"class",n[1])},i:fe,o:fe,d(n){n&&C(e)}}}function lp(t,e,l){const n=new ep;let{errorCorrection:i="L"}=e,{background:o="#fff"}=e,{color:u="#000"}=e,{size:a="200"}=e,{value:c=""}=e,{padding:f=0}=e,{className:_="qrcode"}=e,p="";function b(){n.set({background:o,foreground:u,level:i,padding:f,size:a,value:c}),l(2,p=n.toDataURL("image/jpeg"))}return ic(()=>{b()}),t.$$set=v=>{"errorCorrection"in v&&l(3,i=v.errorCorrection),"background"in v&&l(4,o=v.background),"color"in v&&l(5,u=v.color),"size"in v&&l(6,a=v.size),"value"in v&&l(0,c=v.value),"padding"in v&&l(7,f=v.padding),"className"in v&&l(1,_=v.className)},t.$$.update=()=>{t.$$.dirty&1&&c&&b()},[c,_,p,i,o,u,a,f]}class np extends Ee{constructor(e){super(),Pe(this,e,lp,tp,Ne,{errorCorrection:3,background:4,color:5,size:6,value:0,padding:7,className:1})}}function of(t,e,l){const n=t.slice();return n[95]=e[l],n[96]=e,n[97]=l,n}function rf(t,e,l){const n=t.slice();return n[98]=e[l],n[99]=e,n[100]=l,n}function ip(t,e,l){const n=t.slice();return n[101]=e[l],n}function sp(t,e,l){const n=t.slice();return n[104]=e[l],n}function op(t){let e,l;return{c(){e=m("option"),l=S(t[104]),e.__value=t[104],e.value=e.__value},m(n,i){$(n,e,i),s(e,l)},p:fe,d(n){n&&C(e)}}}function af(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),r(l,"name","pt"),r(l,"type","text"),r(l,"class","in-s"),r(l,"placeholder","ENTSO-E API key, optional, read docs")},m(o,u){$(o,e,u),$(o,l,u),te(l,t[3].p.t),n||(i=ee(l,"input",t[22]),n=!0)},p(o,u){u[0]&8&&l.value!==o[3].p.t&&te(l,o[3].p.t)},d(o){o&&C(e),o&&C(l),n=!1,i()}}}function uf(t){let e,l,n,i,o,u,a,c,f,_,p,b,v;return{c(){e=m("div"),l=S("Username"),n=m("br"),i=h(),o=m("input"),u=h(),a=m("div"),c=S("Password"),f=m("br"),_=h(),p=m("input"),r(o,"name","gu"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1"),r(p,"name","gp"),r(p,"type","password"),r(p,"class","in-s"),r(a,"class","my-1")},m(d,M){$(d,e,M),s(e,l),s(e,n),s(e,i),s(e,o),te(o,t[3].g.u),$(d,u,M),$(d,a,M),s(a,c),s(a,f),s(a,_),s(a,p),te(p,t[3].g.p),b||(v=[ee(o,"input",t[24]),ee(p,"input",t[25])],b=!0)},p(d,M){M[0]&8&&o.value!==d[3].g.u&&te(o,d[3].g.u),M[0]&8&&p.value!==d[3].g.p&&te(p,d[3].g.p)},d(d){d&&C(e),d&&C(u),d&&C(a),b=!1,ze(v)}}}function rp(t){let e,l=t[101]*100+"",n;return{c(){e=m("option"),n=S(l),e.__value=t[101]*100,e.value=e.__value},m(i,o){$(i,e,o),s(e,n)},p:fe,d(i){i&&C(e)}}}function ff(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),r(l,"name","mek"),r(l,"type","text"),r(l,"class","in-s")},m(o,u){$(o,e,u),$(o,l,u),te(l,t[3].m.e.k),n||(i=ee(l,"input",t[34]),n=!0)},p(o,u){u[0]&8&&l.value!==o[3].m.e.k&&te(l,o[3].m.e.k)},d(o){o&&C(e),o&&C(l),n=!1,i()}}}function cf(t){let e,l,n,i,o,u,a;return{c(){e=m("div"),l=S("Authentication key"),n=m("br"),i=h(),o=m("input"),r(o,"name","mea"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1")},m(c,f){$(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),te(o,t[3].m.e.a),u||(a=ee(o,"input",t[35]),u=!0)},p(c,f){f[0]&8&&o.value!==c[3].m.e.a&&te(o,c[3].m.e.a)},d(c){c&&C(e),u=!1,a()}}}function mf(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,M,y,T,N,E,B,P,L,O,F,x,j;return{c(){e=m("div"),l=m("div"),n=S("Watt"),i=m("br"),o=h(),u=m("input"),a=h(),c=m("div"),f=S("Volt"),_=m("br"),p=h(),b=m("input"),v=h(),d=m("div"),M=S("Amp"),y=m("br"),T=h(),N=m("input"),E=h(),B=m("div"),P=S("kWh"),L=m("br"),O=h(),F=m("input"),r(u,"name","mmw"),r(u,"type","number"),r(u,"min","0.00"),r(u,"max","1000"),r(u,"step","0.001"),r(u,"class","in-f tr w-full"),r(l,"class","w-1/4"),r(b,"name","mmv"),r(b,"type","number"),r(b,"min","0.00"),r(b,"max","1000"),r(b,"step","0.001"),r(b,"class","in-m tr w-full"),r(c,"class","w-1/4"),r(N,"name","mma"),r(N,"type","number"),r(N,"min","0.00"),r(N,"max","1000"),r(N,"step","0.001"),r(N,"class","in-m tr w-full"),r(d,"class","w-1/4"),r(F,"name","mmc"),r(F,"type","number"),r(F,"min","0.00"),r(F,"max","1000"),r(F,"step","0.001"),r(F,"class","in-l tr w-full"),r(B,"class","w-1/4"),r(e,"class","flex my-1")},m(z,G){$(z,e,G),s(e,l),s(l,n),s(l,i),s(l,o),s(l,u),te(u,t[3].m.m.w),s(e,a),s(e,c),s(c,f),s(c,_),s(c,p),s(c,b),te(b,t[3].m.m.v),s(e,v),s(e,d),s(d,M),s(d,y),s(d,T),s(d,N),te(N,t[3].m.m.a),s(e,E),s(e,B),s(B,P),s(B,L),s(B,O),s(B,F),te(F,t[3].m.m.c),x||(j=[ee(u,"input",t[37]),ee(b,"input",t[38]),ee(N,"input",t[39]),ee(F,"input",t[40])],x=!0)},p(z,G){G[0]&8&&he(u.value)!==z[3].m.m.w&&te(u,z[3].m.m.w),G[0]&8&&he(b.value)!==z[3].m.m.v&&te(b,z[3].m.m.v),G[0]&8&&he(N.value)!==z[3].m.m.a&&te(N,z[3].m.m.a),G[0]&8&&he(F.value)!==z[3].m.m.c&&te(F,z[3].m.m.c)},d(z){z&&C(e),x=!1,ze(j)}}}function pf(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,M,y;return{c(){e=m("div"),l=S("Gateway"),n=m("br"),i=h(),o=m("input"),u=h(),a=m("div"),c=S("DNS"),f=m("br"),_=h(),p=m("div"),b=m("input"),v=h(),d=m("input"),r(o,"name","ng"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1"),r(b,"name","nd1"),r(b,"type","text"),r(b,"class","in-f w-full"),r(d,"name","nd2"),r(d,"type","text"),r(d,"class","in-l w-full"),r(p,"class","flex"),r(a,"class","my-1")},m(T,N){$(T,e,N),s(e,l),s(e,n),s(e,i),s(e,o),te(o,t[3].n.g),$(T,u,N),$(T,a,N),s(a,c),s(a,f),s(a,_),s(a,p),s(p,b),te(b,t[3].n.d1),s(p,v),s(p,d),te(d,t[3].n.d2),M||(y=[ee(o,"input",t[49]),ee(b,"input",t[50]),ee(d,"input",t[51])],M=!0)},p(T,N){N[0]&8&&o.value!==T[3].n.g&&te(o,T[3].n.g),N[0]&8&&b.value!==T[3].n.d1&&te(b,T[3].n.d1),N[0]&8&&d.value!==T[3].n.d2&&te(d,T[3].n.d2)},d(T){T&&C(e),T&&C(u),T&&C(a),M=!1,ze(y)}}}function _f(t){let e,l,n,i,o;return{c(){e=m("label"),l=m("input"),n=S(" SSL"),r(l,"type","checkbox"),r(l,"name","qs"),l.__value="true",l.value=l.__value,r(l,"class","rounded mb-1"),r(e,"class","float-right mr-3")},m(u,a){$(u,e,a),s(e,l),l.checked=t[3].q.s.e,s(e,n),i||(o=[ee(l,"change",t[55]),ee(l,"change",t[14])],i=!0)},p(u,a){a[0]&8&&(l.checked=u[3].q.s.e)},d(u){u&&C(e),i=!1,ze(o)}}}function df(t){let e,l,n,i,o,u,a,c,f,_,p,b,v;const d=[up,ap],M=[];function y(O,F){return O[3].q.s.c?0:1}n=y(t),i=M[n]=d[n](t);const T=[pp,mp],N=[];function E(O,F){return O[3].q.s.r?0:1}a=E(t),c=N[a]=T[a](t);const B=[hp,vp],P=[];function L(O,F){return O[3].q.s.k?0:1}return p=L(t),b=P[p]=B[p](t),{c(){e=m("div"),l=m("span"),i.c(),o=h(),u=m("span"),c.c(),f=h(),_=m("span"),b.c(),r(l,"class","flex pr-2"),r(u,"class","flex pr-2"),r(_,"class","flex pr-2"),r(e,"class","my-1 flex")},m(O,F){$(O,e,F),s(e,l),M[n].m(l,null),s(e,o),s(e,u),N[a].m(u,null),s(e,f),s(e,_),P[p].m(_,null),v=!0},p(O,F){let x=n;n=y(O),n===x?M[n].p(O,F):(De(),q(M[x],1,1,()=>{M[x]=null}),Ie(),i=M[n],i?i.p(O,F):(i=M[n]=d[n](O),i.c()),D(i,1),i.m(l,null));let j=a;a=E(O),a===j?N[a].p(O,F):(De(),q(N[j],1,1,()=>{N[j]=null}),Ie(),c=N[a],c?c.p(O,F):(c=N[a]=T[a](O),c.c()),D(c,1),c.m(u,null));let z=p;p=L(O),p===z?P[p].p(O,F):(De(),q(P[z],1,1,()=>{P[z]=null}),Ie(),b=P[p],b?b.p(O,F):(b=P[p]=B[p](O),b.c()),D(b,1),b.m(_,null))},i(O){v||(D(i),D(c),D(b),v=!0)},o(O){q(i),q(c),q(b),v=!1},d(O){O&&C(e),M[n].d(),N[a].d(),P[p].d()}}}function ap(t){let e,l;return e=new el({props:{to:"/mqtt-ca",$$slots:{default:[fp]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i[3]&16384&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function up(t){let e,l,n,i,o,u,a,c;return l=new el({props:{to:"/mqtt-ca",$$slots:{default:[cp]},$$scope:{ctx:t}}}),o=new To({}),{c(){e=m("span"),ie(l.$$.fragment),n=h(),i=m("span"),ie(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,_){$(f,e,_),le(l,e,null),$(f,n,_),$(f,i,_),le(o,i,null),u=!0,a||(c=[ee(i,"click",t[11]),ee(i,"keypress",t[11])],a=!0)},p(f,_){const p={};_[3]&16384&&(p.$$scope={dirty:_,ctx:f}),l.$set(p)},i(f){u||(D(l.$$.fragment,f),D(o.$$.fragment,f),u=!0)},o(f){q(l.$$.fragment,f),q(o.$$.fragment,f),u=!1},d(f){f&&C(e),ne(l),f&&C(n),f&&C(i),ne(o),a=!1,ze(c)}}}function fp(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload CA",title:"Click here to upload CA"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function cp(t){let e;return{c(){e=S("CA OK")},m(l,n){$(l,e,n)},d(l){l&&C(e)}}}function mp(t){let e,l;return e=new el({props:{to:"/mqtt-cert",$$slots:{default:[_p]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i[3]&16384&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function pp(t){let e,l,n,i,o,u,a,c;return l=new el({props:{to:"/mqtt-cert",$$slots:{default:[dp]},$$scope:{ctx:t}}}),o=new To({}),{c(){e=m("span"),ie(l.$$.fragment),n=h(),i=m("span"),ie(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,_){$(f,e,_),le(l,e,null),$(f,n,_),$(f,i,_),le(o,i,null),u=!0,a||(c=[ee(i,"click",t[12]),ee(i,"keypress",t[12])],a=!0)},p(f,_){const p={};_[3]&16384&&(p.$$scope={dirty:_,ctx:f}),l.$set(p)},i(f){u||(D(l.$$.fragment,f),D(o.$$.fragment,f),u=!0)},o(f){q(l.$$.fragment,f),q(o.$$.fragment,f),u=!1},d(f){f&&C(e),ne(l),f&&C(n),f&&C(i),ne(o),a=!1,ze(c)}}}function _p(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload cert",title:"Click here to upload certificate"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function dp(t){let e;return{c(){e=S("Cert OK")},m(l,n){$(l,e,n)},d(l){l&&C(e)}}}function vp(t){let e,l;return e=new el({props:{to:"/mqtt-key",$$slots:{default:[bp]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i[3]&16384&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function hp(t){let e,l,n,i,o,u,a,c;return l=new el({props:{to:"/mqtt-key",$$slots:{default:[gp]},$$scope:{ctx:t}}}),o=new To({}),{c(){e=m("span"),ie(l.$$.fragment),n=h(),i=m("span"),ie(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,_){$(f,e,_),le(l,e,null),$(f,n,_),$(f,i,_),le(o,i,null),u=!0,a||(c=[ee(i,"click",t[13]),ee(i,"keypress",t[13])],a=!0)},p(f,_){const p={};_[3]&16384&&(p.$$scope={dirty:_,ctx:f}),l.$set(p)},i(f){u||(D(l.$$.fragment,f),D(o.$$.fragment,f),u=!0)},o(f){q(l.$$.fragment,f),q(o.$$.fragment,f),u=!1},d(f){f&&C(e),ne(l),f&&C(n),f&&C(i),ne(o),a=!1,ze(c)}}}function bp(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload key",title:"Click here to upload key"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function gp(t){let e;return{c(){e=S("Key OK")},m(l,n){$(l,e,n)},d(l){l&&C(e)}}}function vf(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,M,y,T,N,E,B,P,L,O,F,x,j,z,G,V,W,U,K;return o=new Bt({}),{c(){e=m("div"),l=m("strong"),l.textContent="Domoticz",n=h(),i=m("a"),ie(o.$$.fragment),u=h(),a=m("input"),c=h(),f=m("div"),_=m("div"),p=S("Electricity IDX"),b=m("br"),v=h(),d=m("input"),M=h(),y=m("div"),T=S("Current IDX"),N=m("br"),E=h(),B=m("input"),P=h(),L=m("div"),O=S(`Voltage IDX: L1, L2 & L3 - `),F=m("div"),x=m("input"),j=h(),z=m("input"),G=h(),V=m("input"),r(l,"class","text-sm"),r(i,"href",Ut("MQTT-configuration#domoticz")),r(i,"target","_blank"),r(i,"class","float-right"),r(a,"type","hidden"),r(a,"name","o"),a.value="true",r(d,"name","oe"),r(d,"type","text"),r(d,"class","in-f tr w-full"),r(_,"class","w-1/2"),r(B,"name","oc"),r(B,"type","text"),r(B,"class","in-l tr w-full"),r(y,"class","w-1/2"),r(f,"class","my-1 flex"),r(x,"name","ou1"),r(x,"type","text"),r(x,"class","in-f tr w-1/3"),r(z,"name","ou2"),r(z,"type","text"),r(z,"class","in-m tr w-1/3"),r(V,"name","ou3"),r(V,"type","text"),r(V,"class","in-l tr w-1/3"),r(F,"class","flex"),r(L,"class","my-1"),r(e,"class","cnt")},m(H,Y){$(H,e,Y),s(e,l),s(e,n),s(e,i),le(o,i,null),s(e,u),s(e,a),s(e,c),s(e,f),s(f,_),s(_,p),s(_,b),s(_,v),s(_,d),te(d,t[3].o.e),s(f,M),s(f,y),s(y,T),s(y,N),s(y,E),s(y,B),te(B,t[3].o.c),s(e,P),s(e,L),s(L,O),s(L,F),s(F,x),te(x,t[3].o.u1),s(F,j),s(F,z),te(z,t[3].o.u2),s(F,G),s(F,V),te(V,t[3].o.u3),W=!0,U||(K=[ee(d,"input",t[63]),ee(B,"input",t[64]),ee(x,"input",t[65]),ee(z,"input",t[66]),ee(V,"input",t[67])],U=!0)},p(H,Y){Y[0]&8&&d.value!==H[3].o.e&&te(d,H[3].o.e),Y[0]&8&&B.value!==H[3].o.c&&te(B,H[3].o.c),Y[0]&8&&x.value!==H[3].o.u1&&te(x,H[3].o.u1),Y[0]&8&&z.value!==H[3].o.u2&&te(z,H[3].o.u2),Y[0]&8&&V.value!==H[3].o.u3&&te(V,H[3].o.u3)},i(H){W||(D(o.$$.fragment,H),W=!0)},o(H){q(o.$$.fragment,H),W=!1},d(H){H&&C(e),ne(o),U=!1,ze(K)}}}function hf(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,M,y,T,N,E,B,P,L,O,F,x,j,z,G,V;return o=new Bt({}),{c(){e=m("div"),l=m("strong"),l.textContent="Home-Assistant",n=h(),i=m("a"),ie(o.$$.fragment),u=h(),a=m("input"),c=h(),f=m("div"),_=S("Discovery topic prefix"),p=m("br"),b=h(),v=m("input"),d=h(),M=m("div"),y=S("Hostname for URL"),T=m("br"),N=h(),E=m("input"),P=h(),L=m("div"),O=S("Name tag"),F=m("br"),x=h(),j=m("input"),r(l,"class","text-sm"),r(i,"href",Ut("MQTT-configuration#home-assistant")),r(i,"target","_blank"),r(i,"class","float-right"),r(a,"type","hidden"),r(a,"name","h"),a.value="true",r(v,"name","ht"),r(v,"type","text"),r(v,"class","in-s"),r(v,"placeholder","homeassistant"),r(f,"class","my-1"),r(E,"name","hh"),r(E,"type","text"),r(E,"class","in-s"),r(E,"placeholder",B=t[3].g.h+".local"),r(M,"class","my-1"),r(j,"name","hn"),r(j,"type","text"),r(j,"class","in-s"),r(L,"class","my-1"),r(e,"class","cnt")},m(W,U){$(W,e,U),s(e,l),s(e,n),s(e,i),le(o,i,null),s(e,u),s(e,a),s(e,c),s(e,f),s(f,_),s(f,p),s(f,b),s(f,v),te(v,t[3].h.t),s(e,d),s(e,M),s(M,y),s(M,T),s(M,N),s(M,E),te(E,t[3].h.h),s(e,P),s(e,L),s(L,O),s(L,F),s(L,x),s(L,j),te(j,t[3].h.n),z=!0,G||(V=[ee(v,"input",t[68]),ee(E,"input",t[69]),ee(j,"input",t[70])],G=!0)},p(W,U){U[0]&8&&v.value!==W[3].h.t&&te(v,W[3].h.t),(!z||U[0]&8&&B!==(B=W[3].g.h+".local"))&&r(E,"placeholder",B),U[0]&8&&E.value!==W[3].h.h&&te(E,W[3].h.h),U[0]&8&&j.value!==W[3].h.n&&te(j,W[3].h.n)},i(W){z||(D(o.$$.fragment,W),z=!0)},o(W){q(o.$$.fragment,W),z=!1},d(W){W&&C(e),ne(o),G=!1,ze(V)}}}function bf(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d=t[3].c.es&&gf(t);return{c(){e=m("div"),l=m("input"),n=h(),i=m("strong"),i.textContent="Cloud connections",o=h(),u=m("div"),a=m("label"),c=m("input"),f=S(" Energy Speedometer"),_=h(),d&&d.c(),r(l,"type","hidden"),r(l,"name","c"),l.value="true",r(i,"class","text-sm"),r(c,"type","checkbox"),r(c,"class","rounded mb-1"),r(c,"name","ces"),c.__value="true",c.value=c.__value,r(u,"class","my-1"),r(e,"class","cnt")},m(M,y){$(M,e,y),s(e,l),s(e,n),s(e,i),s(e,o),s(e,u),s(u,a),s(a,c),c.checked=t[3].c.es,s(a,f),s(u,_),d&&d.m(u,null),p=!0,b||(v=ee(c,"change",t[71]),b=!0)},p(M,y){y[0]&8&&(c.checked=M[3].c.es),M[3].c.es?d?(d.p(M,y),y[0]&8&&D(d,1)):(d=gf(M),d.c(),D(d,1),d.m(u,null)):d&&(De(),q(d,1,1,()=>{d=null}),Ie())},i(M){p||(D(d),p=!0)},o(M){q(d),p=!1},d(M){M&&C(e),d&&d.d(),b=!1,v()}}}function gf(t){let e,l,n=t[0].mac+"",i,o,u,a,c=(t[0].meter.id?t[0].meter.id:"missing, required")+"",f,_,p,b,v=t[0].mac&&t[0].meter.id&&kf(t);return{c(){e=m("div"),l=S("MAC: "),i=S(n),o=h(),u=m("div"),a=S("Meter ID: "),f=S(c),_=h(),v&&v.c(),p=Ve(),r(e,"class","pl-5"),r(u,"class","pl-5")},m(d,M){$(d,e,M),s(e,l),s(e,i),$(d,o,M),$(d,u,M),s(u,a),s(u,f),$(d,_,M),v&&v.m(d,M),$(d,p,M),b=!0},p(d,M){(!b||M[0]&1)&&n!==(n=d[0].mac+"")&&X(i,n),(!b||M[0]&1)&&c!==(c=(d[0].meter.id?d[0].meter.id:"missing, required")+"")&&X(f,c),d[0].mac&&d[0].meter.id?v?(v.p(d,M),M[0]&1&&D(v,1)):(v=kf(d),v.c(),D(v,1),v.m(p.parentNode,p)):v&&(De(),q(v,1,1,()=>{v=null}),Ie())},i(d){b||(D(v),b=!0)},o(d){q(v),b=!1},d(d){d&&C(e),d&&C(o),d&&C(u),d&&C(_),v&&v.d(d),d&&C(p)}}}function kf(t){let e,l,n;return l=new np({props:{value:'{"mac":"'+t[0].mac+'","meter":"'+t[0].meter.id+'"}'}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","pl-2")},m(i,o){$(i,e,o),le(l,e,null),n=!0},p(i,o){const u={};o[0]&1&&(u.value='{"mac":"'+i[0].mac+'","meter":"'+i[0].meter.id+'"}'),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function wf(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,M,y,T,N,E;o=new Bt({});let B={length:9},P=[];for(let L=0;L20&&Mf(t),_=t[0].chip=="esp8266"&&Nf(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Hardware",n=h(),i=m("a"),ie(o.$$.fragment),u=h(),f&&f.c(),a=h(),_&&_.c(),r(l,"class","text-sm"),r(i,"href",Ut("GPIO-configuration")),r(i,"target","_blank"),r(i,"class","float-right"),r(e,"class","cnt")},m(p,b){$(p,e,b),s(e,l),s(e,n),s(e,i),le(o,i,null),s(e,u),f&&f.m(e,null),s(e,a),_&&_.m(e,null),c=!0},p(p,b){p[0].board>20?f?(f.p(p,b),b[0]&1&&D(f,1)):(f=Mf(p),f.c(),D(f,1),f.m(e,a)):f&&(De(),q(f,1,1,()=>{f=null}),Ie()),p[0].chip=="esp8266"?_?_.p(p,b):(_=Nf(p),_.c(),_.m(e,null)):_&&(_.d(1),_=null)},i(p){c||(D(o.$$.fragment,p),D(f),c=!0)},o(p){q(o.$$.fragment,p),q(f),c=!1},d(p){p&&C(e),ne(o),f&&f.d(),_&&_.d()}}}function Mf(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,M,y,T,N,E,B,P,L,O,F,x,j,z,G,V,W,U,K,H,Y,Z,re,ue,ke,me,Se,je,Re,He,we,Te,Le,$e,w,g,k,A,I,Q,J,se,ce,ve,Me,oe;b=new Yc({props:{chip:t[0].chip}});let pe=t[0].chip!="esp8266"&&Sf(t),Be=t[3].i.v.p>0&&Tf(t);return{c(){e=m("input"),l=h(),n=m("div"),i=m("div"),o=S("HAN"),u=m("label"),a=m("input"),c=S(" pullup"),f=m("br"),_=h(),p=m("select"),ie(b.$$.fragment),v=h(),d=m("div"),M=S("AP button"),y=m("br"),T=h(),N=m("input"),E=h(),B=m("div"),P=S("LED"),L=m("label"),O=m("input"),F=S(" inv"),x=m("br"),j=h(),z=m("div"),G=m("input"),V=h(),W=m("div"),U=S("RGB"),K=m("label"),H=m("input"),Y=S(" inverted"),Z=m("br"),re=h(),ue=m("div"),ke=m("input"),me=h(),Se=m("input"),je=h(),Re=m("input"),He=h(),we=m("div"),Te=S("Temperature"),Le=m("br"),$e=h(),w=m("input"),g=h(),k=m("div"),A=S("Analog temp"),I=m("br"),Q=h(),J=m("input"),se=h(),pe&&pe.c(),ce=h(),Be&&Be.c(),r(e,"type","hidden"),r(e,"name","i"),e.value="true",r(a,"name","ihu"),a.__value="true",a.value=a.__value,r(a,"type","checkbox"),r(a,"class","rounded mb-1"),r(u,"class","ml-2"),r(p,"name","ihp"),r(p,"class","in-f w-full"),t[3].i.h.p===void 0&&tt(()=>t[76].call(p)),r(i,"class","w-1/3"),r(N,"name","ia"),r(N,"type","number"),r(N,"min","0"),r(N,"max",t[6]),r(N,"class","in-m tr w-full"),r(d,"class","w-1/3"),r(O,"name","ili"),O.__value="true",O.value=O.__value,r(O,"type","checkbox"),r(O,"class","rounded mb-1"),r(L,"class","ml-4"),r(G,"name","ilp"),r(G,"type","number"),r(G,"min","0"),r(G,"max",t[6]),r(G,"class","in-l tr w-full"),r(z,"class","flex"),r(B,"class","w-1/3"),r(H,"name","iri"),H.__value="true",H.value=H.__value,r(H,"type","checkbox"),r(H,"class","rounded mb-1"),r(K,"class","ml-4"),r(ke,"name","irr"),r(ke,"type","number"),r(ke,"min","0"),r(ke,"max",t[6]),r(ke,"class","in-f tr w-1/3"),r(Se,"name","irg"),r(Se,"type","number"),r(Se,"min","0"),r(Se,"max",t[6]),r(Se,"class","in-m tr w-1/3"),r(Re,"name","irb"),r(Re,"type","number"),r(Re,"min","0"),r(Re,"max",t[6]),r(Re,"class","in-l tr w-1/3"),r(ue,"class","flex"),r(W,"class","w-full"),r(w,"name","itd"),r(w,"type","number"),r(w,"min","0"),r(w,"max",t[6]),r(w,"class","in-f tr w-full"),r(we,"class","my-1 w-1/3"),r(J,"name","ita"),r(J,"type","number"),r(J,"min","0"),r(J,"max",t[6]),r(J,"class","in-l tr w-full"),r(k,"class","my-1 pr-1 w-1/3"),r(n,"class","flex flex-wrap")},m(_e,ye){$(_e,e,ye),$(_e,l,ye),$(_e,n,ye),s(n,i),s(i,o),s(i,u),s(u,a),a.checked=t[3].i.h.u,s(u,c),s(i,f),s(i,_),s(i,p),le(b,p,null),qe(p,t[3].i.h.p,!0),s(n,v),s(n,d),s(d,M),s(d,y),s(d,T),s(d,N),te(N,t[3].i.a),s(n,E),s(n,B),s(B,P),s(B,L),s(L,O),O.checked=t[3].i.l.i,s(L,F),s(B,x),s(B,j),s(B,z),s(z,G),te(G,t[3].i.l.p),s(n,V),s(n,W),s(W,U),s(W,K),s(K,H),H.checked=t[3].i.r.i,s(K,Y),s(W,Z),s(W,re),s(W,ue),s(ue,ke),te(ke,t[3].i.r.r),s(ue,me),s(ue,Se),te(Se,t[3].i.r.g),s(ue,je),s(ue,Re),te(Re,t[3].i.r.b),s(n,He),s(n,we),s(we,Te),s(we,Le),s(we,$e),s(we,w),te(w,t[3].i.t.d),s(n,g),s(n,k),s(k,A),s(k,I),s(k,Q),s(k,J),te(J,t[3].i.t.a),s(n,se),pe&&pe.m(n,null),s(n,ce),Be&&Be.m(n,null),ve=!0,Me||(oe=[ee(a,"change",t[75]),ee(p,"change",t[76]),ee(N,"input",t[77]),ee(O,"change",t[78]),ee(G,"input",t[79]),ee(H,"change",t[80]),ee(ke,"input",t[81]),ee(Se,"input",t[82]),ee(Re,"input",t[83]),ee(w,"input",t[84]),ee(J,"input",t[85])],Me=!0)},p(_e,ye){ye[0]&8&&(a.checked=_e[3].i.h.u);const vt={};ye[0]&1&&(vt.chip=_e[0].chip),b.$set(vt),ye[0]&8&&qe(p,_e[3].i.h.p),(!ve||ye[0]&64)&&r(N,"max",_e[6]),ye[0]&8&&he(N.value)!==_e[3].i.a&&te(N,_e[3].i.a),ye[0]&8&&(O.checked=_e[3].i.l.i),(!ve||ye[0]&64)&&r(G,"max",_e[6]),ye[0]&8&&he(G.value)!==_e[3].i.l.p&&te(G,_e[3].i.l.p),ye[0]&8&&(H.checked=_e[3].i.r.i),(!ve||ye[0]&64)&&r(ke,"max",_e[6]),ye[0]&8&&he(ke.value)!==_e[3].i.r.r&&te(ke,_e[3].i.r.r),(!ve||ye[0]&64)&&r(Se,"max",_e[6]),ye[0]&8&&he(Se.value)!==_e[3].i.r.g&&te(Se,_e[3].i.r.g),(!ve||ye[0]&64)&&r(Re,"max",_e[6]),ye[0]&8&&he(Re.value)!==_e[3].i.r.b&&te(Re,_e[3].i.r.b),(!ve||ye[0]&64)&&r(w,"max",_e[6]),ye[0]&8&&he(w.value)!==_e[3].i.t.d&&te(w,_e[3].i.t.d),(!ve||ye[0]&64)&&r(J,"max",_e[6]),ye[0]&8&&he(J.value)!==_e[3].i.t.a&&te(J,_e[3].i.t.a),_e[0].chip!="esp8266"?pe?pe.p(_e,ye):(pe=Sf(_e),pe.c(),pe.m(n,ce)):pe&&(pe.d(1),pe=null),_e[3].i.v.p>0?Be?Be.p(_e,ye):(Be=Tf(_e),Be.c(),Be.m(n,null)):Be&&(Be.d(1),Be=null)},i(_e){ve||(D(b.$$.fragment,_e),ve=!0)},o(_e){q(b.$$.fragment,_e),ve=!1},d(_e){_e&&C(e),_e&&C(l),_e&&C(n),ne(b),pe&&pe.d(),Be&&Be.d(),Me=!1,ze(oe)}}}function Sf(t){let e,l,n,i,o,u,a;return{c(){e=m("div"),l=S("Vcc"),n=m("br"),i=h(),o=m("input"),r(o,"name","ivp"),r(o,"type","number"),r(o,"min","0"),r(o,"max",t[6]),r(o,"class","in-s tr w-full"),r(e,"class","my-1 pl-1 w-1/3")},m(c,f){$(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),te(o,t[3].i.v.p),u||(a=ee(o,"input",t[86]),u=!0)},p(c,f){f[0]&64&&r(o,"max",c[6]),f[0]&8&&he(o.value)!==c[3].i.v.p&&te(o,c[3].i.v.p)},d(c){c&&C(e),u=!1,a()}}}function Tf(t){let e,l,n,i,o,u,a,c,f,_;return{c(){e=m("div"),l=S("Voltage divider"),n=m("br"),i=h(),o=m("div"),u=m("input"),a=h(),c=m("input"),r(u,"name","ivdv"),r(u,"type","number"),r(u,"min","0"),r(u,"max","65535"),r(u,"class","in-f tr w-full"),r(u,"placeholder","VCC"),r(c,"name","ivdg"),r(c,"type","number"),r(c,"min","0"),r(c,"max","65535"),r(c,"class","in-l tr w-full"),r(c,"placeholder","GND"),r(o,"class","flex"),r(e,"class","my-1")},m(p,b){$(p,e,b),s(e,l),s(e,n),s(e,i),s(e,o),s(o,u),te(u,t[3].i.v.d.v),s(o,a),s(o,c),te(c,t[3].i.v.d.g),f||(_=[ee(u,"input",t[87]),ee(c,"input",t[88])],f=!0)},p(p,b){b[0]&8&&he(u.value)!==p[3].i.v.d.v&&te(u,p[3].i.v.d.v),b[0]&8&&he(c.value)!==p[3].i.v.d.g&&te(c,p[3].i.v.d.g)},d(p){p&&C(e),f=!1,ze(_)}}}function Nf(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,M,y,T,N=(t[0].board==2||t[0].board==100)&&Af(t);return{c(){e=m("input"),l=h(),n=m("div"),i=m("div"),o=S("Vcc offset"),u=m("br"),a=h(),c=m("input"),f=h(),_=m("div"),p=S("Multiplier"),b=m("br"),v=h(),d=m("input"),M=h(),N&&N.c(),r(e,"type","hidden"),r(e,"name","iv"),e.value="true",r(c,"name","ivo"),r(c,"type","number"),r(c,"min","0.0"),r(c,"max","3.5"),r(c,"step","0.01"),r(c,"class","in-f tr w-full"),r(i,"class","w-1/3"),r(d,"name","ivm"),r(d,"type","number"),r(d,"min","0.1"),r(d,"max","10"),r(d,"step","0.01"),r(d,"class","in-l tr w-full"),r(_,"class","w-1/3 pr-1"),r(n,"class","my-1 flex flex-wrap")},m(E,B){$(E,e,B),$(E,l,B),$(E,n,B),s(n,i),s(i,o),s(i,u),s(i,a),s(i,c),te(c,t[3].i.v.o),s(n,f),s(n,_),s(_,p),s(_,b),s(_,v),s(_,d),te(d,t[3].i.v.m),s(n,M),N&&N.m(n,null),y||(T=[ee(c,"input",t[89]),ee(d,"input",t[90])],y=!0)},p(E,B){B[0]&8&&he(c.value)!==E[3].i.v.o&&te(c,E[3].i.v.o),B[0]&8&&he(d.value)!==E[3].i.v.m&&te(d,E[3].i.v.m),E[0].board==2||E[0].board==100?N?N.p(E,B):(N=Af(E),N.c(),N.m(n,null)):N&&(N.d(1),N=null)},d(E){E&&C(e),E&&C(l),E&&C(n),N&&N.d(),y=!1,ze(T)}}}function Af(t){let e,l,n,i,o,u,a;return{c(){e=m("div"),l=S("Boot limit"),n=m("br"),i=h(),o=m("input"),r(o,"name","ivb"),r(o,"type","number"),r(o,"min","2.5"),r(o,"max","3.5"),r(o,"step","0.1"),r(o,"class","in-s tr w-full"),r(e,"class","w-1/3 pl-1")},m(c,f){$(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),te(o,t[3].i.v.b),u||(a=ee(o,"input",t[91]),u=!0)},p(c,f){f[0]&8&&he(o.value)!==c[3].i.v.b&&te(o,c[3].i.v.b)},d(c){c&&C(e),u=!1,a()}}}function Pf(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,M,y,T=t[3].d.t&&Ef();return{c(){e=m("div"),e.textContent="Debug can cause sudden reboots. Do not leave on!",l=h(),n=m("div"),i=m("label"),o=m("input"),u=S(" Enable telnet"),a=h(),T&&T.c(),c=h(),f=m("div"),_=m("select"),p=m("option"),p.textContent="Verbose",b=m("option"),b.textContent="Debug",v=m("option"),v.textContent="Info",d=m("option"),d.textContent="Warning",r(e,"class","bd-red"),r(o,"type","checkbox"),r(o,"name","dt"),o.__value="true",o.value=o.__value,r(o,"class","rounded mb-1"),r(n,"class","my-1"),p.__value=1,p.value=p.__value,b.__value=2,b.value=b.__value,v.__value=3,v.value=v.__value,d.__value=4,d.value=d.__value,r(_,"name","dl"),r(_,"class","in-s"),t[3].d.l===void 0&&tt(()=>t[94].call(_)),r(f,"class","my-1")},m(N,E){$(N,e,E),$(N,l,E),$(N,n,E),s(n,i),s(i,o),o.checked=t[3].d.t,s(i,u),$(N,a,E),T&&T.m(N,E),$(N,c,E),$(N,f,E),s(f,_),s(_,p),s(_,b),s(_,v),s(_,d),qe(_,t[3].d.l,!0),M||(y=[ee(o,"change",t[93]),ee(_,"change",t[94])],M=!0)},p(N,E){E[0]&8&&(o.checked=N[3].d.t),N[3].d.t?T||(T=Ef(),T.c(),T.m(c.parentNode,c)):T&&(T.d(1),T=null),E[0]&8&&qe(_,N[3].d.l)},d(N){N&&C(e),N&&C(l),N&&C(n),N&&C(a),T&&T.d(N),N&&C(c),N&&C(f),M=!1,ze(y)}}}function Ef(t){let e;return{c(){e=m("div"),e.textContent="Telnet is unsafe and should be off when not in use",r(e,"class","bd-red")},m(l,n){$(l,e,n)},d(l){l&&C(e)}}}function kp(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,M,y,T,N,E,B,P,L,O,F,x,j,z,G,V,W,U,K,H,Y,Z,re,ue,ke,me,Se,je,Re,He,we,Te,Le,$e,w,g,k,A,I,Q,J,se,ce,ve,Me,oe,pe,Be,_e,ye,vt,Hl,tl,ct,Tl,pl,Ht,ht,Qe,Xe,Ze,Ue,Je,We,xe,et,de,Ce,Ei,_l,_n,Tt,Di,Ii,Ri,dl,Li,Oi,Fi,Nt,Nl,Al,Pl,qi,Ge,Ae,vl,Ts,El,Rt,Bi,Wl,Ao,ll,Ui,Po,Ns,Eo,ci,Wt,Do,Io,Dl,nl,Il,Ro,ji,Lo,pt,Rl,Oo,Hi,dn,vn,hn,bn,Wi,Fo,At,zi,qo,zl,Bo,Uo,jo,il,gn,kn,Ho,wn,Gl,Wo,zo,Go,yn,zt,Vo,Gi,Ko,Vl,Yo,Qo,Xo,Cn,Gt,Zo,Vi,Jo,As,xo,Kl,Ki,Vt,er,tr,lr,Ps,Yi,Kt,nr,ir,sr,mt,Qi,or,$n,Mn,rr,mi,ar,Yl,ur,fr,cr,hl,mr,Ql,pr,_r,dr,bl,vr,Sn,Xl,hr,br,gr,Lt,Tn,Nn,An,Pn,kr,Zl,wr,yr,Cr,En,Ot,$r,Xi,Mr,Zi,Ji,Yt,Sr,Tr,ut,xi,Nr,Dn,In,Ar,Jl,Pr,Er,Dr,Ll,sl,Rn,Ln,Ir,Pt,es,ts,Rr,Et,On,ls,ns,Lr,Es,is,ss,Qt,Or,Fr,pi,qr,Ol,Br,_i,Xt,Ur,jr,Hr,os,gl,Wr,Ye,rs,zr,Fn,qn,Gr,di,Vr,ol,Kr,Ds,Yr,Qr,Bn,kl,Xr,Zt,Zr,Is,xl,Jr,xr,ea,wl,ta,en,la,na,ia,yl,sa,Un,jn,oa,ra,aa,Cl,ua,Hn,fa,ca,ma,bt,Wn,zn,Gn,Vn,Kn,Yn,pa,tn,_a,da,va,$l,ha,Rs,Ls,Os,Fs=t[3].p.r.startsWith("10YNO")||t[3].p.r.startsWith("10Y1001A1001A4"),qs,rl,as,ba,Qn,Xn,ga,vi,ka,hi,wa,Bs,Dt,us,ya,Zn,Jn,Ca,bi,$a,fs,cs,Jt,Ma,Sa,Ta,Fl,Us,xn,Na,ms,ei,Aa,ps,js,ln,Hs,nn,Ws,sn,zs,on,Ft,Gs,Pa;a=new Bt({}),F=new Xm({});let Zc=["NOK","SEK","DKK","EUR"],gi=[];for(let R=0;R<4;R+=1)gi[R]=op(sp(t,Zc,R));let gt=t[3].p.e&&t[0].chip!="esp8266"&&af(t),kt=t[3].g.s>0&&uf(t);Rt=new Bt({});let Jc=[24,48,96,192,384,576,1152],ki=[];for(let R=0;R<7;R+=1)ki[R]=rp(ip(t,Jc,R));let wt=t[3].m.e.e&&ff(t),yt=t[3].m.e.e&&cf(t),Ct=t[3].m.m.e&&mf(t);Mn=new Bt({}),In=new Bt({}),On=new Qc({});let $t=t[3].n.m=="static"&&pf(t);qn=new Bt({});let Mt=t[0].chip!="esp8266"&&_f(t),lt=t[3].q.s.e&&df(t),nt=t[3].q.m==3&&vf(t),it=t[3].q.m==4&&hf(t),st=t[3].c.es!=null&&bf(t),ot=Fs&&wf(t);Xn=new Bt({});let ti=t[7],_t=[];for(let R=0;R20||t[0].chip=="esp8266")&&$f(t);Jn=new Bt({});let St=t[3].d.s&&Pf(t);return ln=new It({props:{active:t[1],message:"Loading configuration"}}),nn=new It({props:{active:t[2],message:"Saving configuration"}}),sn=new It({props:{active:t[4],message:"Performing factory reset"}}),on=new It({props:{active:t[5],message:"Device have been factory reset and switched to AP mode"}}),{c(){e=m("form"),l=m("div"),n=m("div"),i=m("strong"),i.textContent="General",o=h(),u=m("a"),ie(a.$$.fragment),c=h(),f=m("input"),_=h(),p=m("div"),b=m("div"),v=m("div"),d=S("Hostname"),M=m("br"),y=h(),T=m("input"),N=h(),E=m("div"),B=S("Time zone"),P=m("br"),L=h(),O=m("select"),ie(F.$$.fragment),x=h(),j=m("input"),z=h(),G=m("div"),V=m("div"),W=m("div"),U=S("Price region"),K=m("br"),H=h(),Y=m("select"),Z=m("optgroup"),re=m("option"),re.textContent="NO1",ue=m("option"),ue.textContent="NO2",ke=m("option"),ke.textContent="NO3",me=m("option"),me.textContent="NO4",Se=m("option"),Se.textContent="NO5",je=m("optgroup"),Re=m("option"),Re.textContent="SE1",He=m("option"),He.textContent="SE2",we=m("option"),we.textContent="SE3",Te=m("option"),Te.textContent="SE4",Le=m("optgroup"),$e=m("option"),$e.textContent="DK1",w=m("option"),w.textContent="DK2",g=m("option"),g.textContent="Austria",k=m("option"),k.textContent="Belgium",A=m("option"),A.textContent="Czech Republic",I=m("option"),I.textContent="Estonia",Q=m("option"),Q.textContent="Finland",J=m("option"),J.textContent="France",se=m("option"),se.textContent="Germany",ce=m("option"),ce.textContent="Great Britain",ve=m("option"),ve.textContent="Latvia",Me=m("option"),Me.textContent="Lithuania",oe=m("option"),oe.textContent="Netherland",pe=m("option"),pe.textContent="Poland",Be=m("option"),Be.textContent="Switzerland",_e=h(),ye=m("div"),vt=S("Currency"),Hl=m("br"),tl=h(),ct=m("select");for(let R=0;R<4;R+=1)gi[R].c();Tl=h(),pl=m("div"),Ht=m("div"),ht=m("div"),Qe=S("Fixed price"),Xe=m("br"),Ze=h(),Ue=m("input"),Je=h(),We=m("div"),xe=S("Multiplier"),et=m("br"),de=h(),Ce=m("input"),Ei=h(),_l=m("div"),_n=m("label"),Tt=m("input"),Di=S(" Enable price fetch from remote server"),Ii=h(),gt&>.c(),Ri=h(),dl=m("div"),Li=S("Security"),Oi=m("br"),Fi=h(),Nt=m("select"),Nl=m("option"),Nl.textContent="None",Al=m("option"),Al.textContent="Only configuration",Pl=m("option"),Pl.textContent="Everything",qi=h(),kt&&kt.c(),Ge=h(),Ae=m("div"),vl=m("strong"),vl.textContent="Meter",Ts=h(),El=m("a"),ie(Rt.$$.fragment),Bi=h(),Wl=m("input"),Ao=h(),ll=m("div"),Ui=m("span"),Ui.textContent="Buffer size",Po=h(),Ns=m("span"),Ns.textContent="Serial conf.",Eo=h(),ci=m("label"),Wt=m("input"),Do=S(" inverted"),Io=h(),Dl=m("div"),nl=m("select"),Il=m("option"),Ro=S("Autodetect");for(let R=0;R<7;R+=1)ki[R].c();Lo=h(),pt=m("select"),Rl=m("option"),Oo=S("-"),dn=m("option"),dn.textContent="7N1",vn=m("option"),vn.textContent="8N1",hn=m("option"),hn.textContent="7E1",bn=m("option"),bn.textContent="8E1",Fo=h(),At=m("input"),qo=h(),zl=m("div"),Bo=S("Voltage"),Uo=m("br"),jo=h(),il=m("select"),gn=m("option"),gn.textContent="400V (TN)",kn=m("option"),kn.textContent="230V (IT/TT)",Ho=h(),wn=m("div"),Gl=m("div"),Wo=S("Main fuse"),zo=m("br"),Go=h(),yn=m("label"),zt=m("input"),Vo=h(),Gi=m("span"),Gi.textContent="A",Ko=h(),Vl=m("div"),Yo=S("Production"),Qo=m("br"),Xo=h(),Cn=m("label"),Gt=m("input"),Zo=h(),Vi=m("span"),Vi.textContent="kWp",Jo=h(),As=m("div"),xo=h(),Kl=m("div"),Ki=m("label"),Vt=m("input"),er=S(" Meter is encrypted"),tr=h(),wt&&wt.c(),lr=h(),yt&&yt.c(),Ps=h(),Yi=m("label"),Kt=m("input"),nr=S(" Multipliers"),ir=h(),Ct&&Ct.c(),sr=h(),mt=m("div"),Qi=m("strong"),Qi.textContent="WiFi",or=h(),$n=m("a"),ie(Mn.$$.fragment),rr=h(),mi=m("input"),ar=h(),Yl=m("div"),ur=S("SSID"),fr=m("br"),cr=h(),hl=m("input"),mr=h(),Ql=m("div"),pr=S("Password"),_r=m("br"),dr=h(),bl=m("input"),vr=h(),Sn=m("div"),Xl=m("div"),hr=S("Power saving"),br=m("br"),gr=h(),Lt=m("select"),Tn=m("option"),Tn.textContent="Default",Nn=m("option"),Nn.textContent="Off",An=m("option"),An.textContent="Minimum",Pn=m("option"),Pn.textContent="Maximum",kr=h(),Zl=m("div"),wr=S("Power"),yr=m("br"),Cr=h(),En=m("div"),Ot=m("input"),$r=h(),Xi=m("span"),Xi.textContent="dBm",Mr=h(),Zi=m("div"),Ji=m("label"),Yt=m("input"),Sr=S(" Allow 802.11b legacy rates"),Tr=h(),ut=m("div"),xi=m("strong"),xi.textContent="Network",Nr=h(),Dn=m("a"),ie(In.$$.fragment),Ar=h(),Jl=m("div"),Pr=S("IP"),Er=m("br"),Dr=h(),Ll=m("div"),sl=m("select"),Rn=m("option"),Rn.textContent="DHCP",Ln=m("option"),Ln.textContent="Static",Ir=h(),Pt=m("input"),Rr=h(),Et=m("select"),ie(On.$$.fragment),Lr=h(),$t&&$t.c(),Es=h(),is=m("div"),ss=m("label"),Qt=m("input"),Or=S(" enable mDNS"),Fr=h(),pi=m("input"),qr=h(),Ol=m("div"),Br=S("NTP "),_i=m("label"),Xt=m("input"),Ur=S(" obtain from DHCP"),jr=m("br"),Hr=h(),os=m("div"),gl=m("input"),Wr=h(),Ye=m("div"),rs=m("strong"),rs.textContent="MQTT",zr=h(),Fn=m("a"),ie(qn.$$.fragment),Gr=h(),di=m("input"),Vr=h(),ol=m("div"),Kr=S(`Server - `),Mt&&Mt.c(),Ds=h(),Yr=m("br"),Qr=h(),Bn=m("div"),kl=m("input"),Xr=h(),Zt=m("input"),Zr=h(),lt&<.c(),Is=h(),xl=m("div"),Jr=S("Username"),xr=m("br"),ea=h(),wl=m("input"),ta=h(),en=m("div"),la=S("Password"),na=m("br"),ia=h(),yl=m("input"),sa=h(),Un=m("div"),jn=m("div"),oa=S("Client ID"),ra=m("br"),aa=h(),Cl=m("input"),ua=h(),Hn=m("div"),fa=S("Payload"),ca=m("br"),ma=h(),bt=m("select"),Wn=m("option"),Wn.textContent="JSON",zn=m("option"),zn.textContent="Raw (minimal)",Gn=m("option"),Gn.textContent="Raw (full)",Vn=m("option"),Vn.textContent="Domoticz",Kn=m("option"),Kn.textContent="HomeAssistant",Yn=m("option"),Yn.textContent="HEX dump",pa=h(),tn=m("div"),_a=S("Publish topic"),da=m("br"),va=h(),$l=m("input"),ha=h(),nt&&nt.c(),Rs=h(),it&&it.c(),Ls=h(),st&&st.c(),Os=h(),ot&&ot.c(),qs=h(),rl=m("div"),as=m("strong"),as.textContent="User interface",ba=h(),Qn=m("a"),ie(Xn.$$.fragment),ga=h(),vi=m("input"),ka=h(),hi=m("div");for(let R=0;R<_t.length;R+=1)_t[R].c();wa=h(),rt&&rt.c(),Bs=h(),Dt=m("div"),us=m("strong"),us.textContent="Debugging",ya=h(),Zn=m("a"),ie(Jn.$$.fragment),Ca=h(),bi=m("input"),$a=h(),fs=m("div"),cs=m("label"),Jt=m("input"),Ma=S(" Enable debugging"),Sa=h(),St&&St.c(),Ta=h(),Fl=m("div"),Us=m("div"),xn=m("button"),xn.textContent="Factory reset",Na=h(),ms=m("div"),ei=m("button"),ei.textContent="Reboot",Aa=h(),ps=m("div"),ps.innerHTML='',js=h(),ie(ln.$$.fragment),Hs=h(),ie(nn.$$.fragment),Ws=h(),ie(sn.$$.fragment),zs=h(),ie(on.$$.fragment),r(i,"class","text-sm"),r(u,"href",Ut("General-configuration")),r(u,"target","_blank"),r(u,"class","float-right"),r(f,"type","hidden"),r(f,"name","g"),f.value="true",r(T,"name","gh"),r(T,"type","text"),r(T,"class","in-f w-full"),r(T,"pattern","[A-Za-z0-9-]+"),r(O,"name","gt"),r(O,"class","in-l w-full"),t[3].g.t===void 0&&tt(()=>t[16].call(O)),r(b,"class","flex"),r(p,"class","my-1"),r(j,"type","hidden"),r(j,"name","p"),j.value="true",re.__value="10YNO-1--------2",re.value=re.__value,ue.__value="10YNO-2--------T",ue.value=ue.__value,ke.__value="10YNO-3--------J",ke.value=ke.__value,me.__value="10YNO-4--------9",me.value=me.__value,Se.__value="10Y1001A1001A48H",Se.value=Se.__value,r(Z,"label","Norway"),Re.__value="10Y1001A1001A44P",Re.value=Re.__value,He.__value="10Y1001A1001A45N",He.value=He.__value,we.__value="10Y1001A1001A46L",we.value=we.__value,Te.__value="10Y1001A1001A47J",Te.value=Te.__value,r(je,"label","Sweden"),$e.__value="10YDK-1--------W",$e.value=$e.__value,w.__value="10YDK-2--------M",w.value=w.__value,r(Le,"label","Denmark"),g.__value="10YAT-APG------L",g.value=g.__value,k.__value="10YBE----------2",k.value=k.__value,A.__value="10YCZ-CEPS-----N",A.value=A.__value,I.__value="10Y1001A1001A39I",I.value=I.__value,Q.__value="10YFI-1--------U",Q.value=Q.__value,J.__value="10YFR-RTE------C",J.value=J.__value,se.__value="10Y1001A1001A83F",se.value=se.__value,ce.__value="10YGB----------A",ce.value=ce.__value,ve.__value="10YLV-1001A00074",ve.value=ve.__value,Me.__value="10YLT-1001A0008Q",Me.value=Me.__value,oe.__value="10YNL----------L",oe.value=oe.__value,pe.__value="10YPL-AREA-----S",pe.value=pe.__value,Be.__value="10YCH-SWISSGRIDZ",Be.value=Be.__value,r(Y,"name","pr"),r(Y,"class","in-f w-full"),t[3].p.r===void 0&&tt(()=>t[17].call(Y)),r(W,"class","w-full"),r(ct,"name","pc"),r(ct,"class","in-l"),t[3].p.c===void 0&&tt(()=>t[18].call(ct)),r(V,"class","flex"),r(G,"class","my-1"),r(Ue,"name","pf"),r(Ue,"type","number"),r(Ue,"min","0.001"),r(Ue,"max","65"),r(Ue,"step","0.001"),r(Ue,"class","in-f tr w-full"),r(ht,"class","w-1/2"),r(Ce,"name","pm"),r(Ce,"type","number"),r(Ce,"min","0.001"),r(Ce,"max","1000"),r(Ce,"step","0.001"),r(Ce,"class","in-l tr w-full"),r(We,"class","w-1/2"),r(Ht,"class","flex"),r(pl,"class","my-1"),r(Tt,"type","checkbox"),r(Tt,"name","pe"),Tt.__value="true",Tt.value=Tt.__value,r(Tt,"class","rounded mb-1"),r(_l,"class","my-1"),Nl.__value=0,Nl.value=Nl.__value,Al.__value=1,Al.value=Al.__value,Pl.__value=2,Pl.value=Pl.__value,r(Nt,"name","gs"),r(Nt,"class","in-s"),t[3].g.s===void 0&&tt(()=>t[23].call(Nt)),r(dl,"class","my-1"),r(n,"class","cnt"),r(vl,"class","text-sm"),r(El,"href",Ut("Meter-configuration")),r(El,"target","_blank"),r(El,"class","float-right"),r(Wl,"type","hidden"),r(Wl,"name","m"),Wl.value="true",r(Ui,"class","float-right"),r(Wt,"name","mi"),Wt.__value="true",Wt.value=Wt.__value,r(Wt,"type","checkbox"),r(Wt,"class","rounded mb-1"),r(ci,"class","mt-2 ml-3 whitespace-nowrap"),Il.__value=0,Il.value=Il.__value,Il.disabled=ji=t[3].m.b!=0,r(nl,"name","mb"),r(nl,"class","in-f tr w-1/2"),t[3].m.b===void 0&&tt(()=>t[27].call(nl)),Rl.__value=0,Rl.value=Rl.__value,Rl.disabled=Hi=t[3].m.b!=0,dn.__value=2,dn.value=dn.__value,vn.__value=3,vn.value=vn.__value,hn.__value=10,hn.value=hn.__value,bn.__value=11,bn.value=bn.__value,r(pt,"name","mp"),r(pt,"class","in-m"),pt.disabled=Wi=t[3].m.b==0,t[3].m.p===void 0&&tt(()=>t[28].call(pt)),r(At,"name","ms"),r(At,"type","number"),r(At,"min",64),r(At,"max",zi=t[0].chip=="esp8266"?t[3].i.h.p==3||t[3].i.h.p==113?512:128:4096),r(At,"step",64),r(At,"class","in-l tr w-1/2"),r(Dl,"class","flex w-full"),r(ll,"class","my-1"),gn.__value=2,gn.value=gn.__value,kn.__value=1,kn.value=kn.__value,r(il,"name","md"),r(il,"class","in-s"),t[3].m.d===void 0&&tt(()=>t[30].call(il)),r(zl,"class","my-1"),r(zt,"name","mf"),r(zt,"type","number"),r(zt,"min","5"),r(zt,"max","65535"),r(zt,"class","in-f tr w-full"),r(Gi,"class","in-post"),r(yn,"class","flex"),r(Gl,"class","mx-1"),r(Gt,"name","mr"),r(Gt,"type","number"),r(Gt,"min","0"),r(Gt,"max","65535"),r(Gt,"class","in-f tr w-full"),r(Vi,"class","in-post"),r(Cn,"class","flex"),r(Vl,"class","mx-1"),r(wn,"class","my-1 flex"),r(As,"class","my-1"),r(Vt,"type","checkbox"),r(Vt,"name","me"),Vt.__value="true",Vt.value=Vt.__value,r(Vt,"class","rounded mb-1"),r(Kl,"class","my-1"),r(Kt,"type","checkbox"),r(Kt,"name","mm"),Kt.__value="true",Kt.value=Kt.__value,r(Kt,"class","rounded mb-1"),r(Ae,"class","cnt"),r(Qi,"class","text-sm"),r($n,"href",Ut("WiFi-configuration")),r($n,"target","_blank"),r($n,"class","float-right"),r(mi,"type","hidden"),r(mi,"name","w"),mi.value="true",r(hl,"name","ws"),r(hl,"type","text"),r(hl,"class","in-s"),r(Yl,"class","my-1"),r(bl,"name","wp"),r(bl,"type","password"),r(bl,"class","in-s"),r(Ql,"class","my-1"),Tn.__value=255,Tn.value=Tn.__value,Nn.__value=0,Nn.value=Nn.__value,An.__value=1,An.value=An.__value,Pn.__value=2,Pn.value=Pn.__value,r(Lt,"name","wz"),r(Lt,"class","in-s"),t[3].w.z===void 0&&tt(()=>t[43].call(Lt)),r(Xl,"class","w-1/2"),r(Ot,"name","ww"),r(Ot,"type","number"),r(Ot,"min","0"),r(Ot,"max","20.5"),r(Ot,"step","0.5"),r(Ot,"class","in-f tr w-full"),r(Xi,"class","in-post"),r(En,"class","flex"),r(Zl,"class","ml-2 w-1/2"),r(Sn,"class","my-1 flex"),r(Yt,"type","checkbox"),r(Yt,"name","wb"),Yt.__value="true",Yt.value=Yt.__value,r(Yt,"class","rounded mb-1"),r(Zi,"class","my-3"),r(mt,"class","cnt"),r(xi,"class","text-sm"),r(Dn,"href",Ut("Network-configuration")),r(Dn,"target","_blank"),r(Dn,"class","float-right"),Rn.__value="dhcp",Rn.value=Rn.__value,Ln.__value="static",Ln.value=Ln.__value,r(sl,"name","nm"),r(sl,"class","in-f"),t[3].n.m===void 0&&tt(()=>t[46].call(sl)),r(Pt,"name","ni"),r(Pt,"type","text"),r(Pt,"class","in-m w-full"),Pt.disabled=es=t[3].n.m=="dhcp",Pt.required=ts=t[3].n.m=="static",r(Et,"name","ns"),r(Et,"class","in-l"),Et.disabled=ls=t[3].n.m=="dhcp",Et.required=ns=t[3].n.m=="static",t[3].n.s===void 0&&tt(()=>t[48].call(Et)),r(Ll,"class","flex"),r(Jl,"class","my-1"),r(Qt,"name","nd"),Qt.__value="true",Qt.value=Qt.__value,r(Qt,"type","checkbox"),r(Qt,"class","rounded mb-1"),r(is,"class","my-1"),r(pi,"type","hidden"),r(pi,"name","ntp"),pi.value="true",r(Xt,"name","ntpd"),Xt.__value="true",Xt.value=Xt.__value,r(Xt,"type","checkbox"),r(Xt,"class","rounded mb-1"),r(_i,"class","ml-4"),r(gl,"name","ntph"),r(gl,"type","text"),r(gl,"class","in-s"),r(os,"class","flex"),r(Ol,"class","my-1"),r(ut,"class","cnt"),r(rs,"class","text-sm"),r(Fn,"href",Ut("MQTT-configuration")),r(Fn,"target","_blank"),r(Fn,"class","float-right"),r(di,"type","hidden"),r(di,"name","q"),di.value="true",r(kl,"name","qh"),r(kl,"type","text"),r(kl,"class","in-f w-3/4"),r(Zt,"name","qp"),r(Zt,"type","number"),r(Zt,"min","1024"),r(Zt,"max","65535"),r(Zt,"class","in-l tr w-1/4"),r(Bn,"class","flex"),r(ol,"class","my-1"),r(wl,"name","qu"),r(wl,"type","text"),r(wl,"class","in-s"),r(xl,"class","my-1"),r(yl,"name","qa"),r(yl,"type","password"),r(yl,"class","in-s"),r(en,"class","my-1"),r(Cl,"name","qc"),r(Cl,"type","text"),r(Cl,"class","in-f w-full"),Wn.__value=0,Wn.value=Wn.__value,zn.__value=1,zn.value=zn.__value,Gn.__value=2,Gn.value=Gn.__value,Vn.__value=3,Vn.value=Vn.__value,Kn.__value=4,Kn.value=Kn.__value,Yn.__value=255,Yn.value=Yn.__value,r(bt,"name","qm"),r(bt,"class","in-l"),t[3].q.m===void 0&&tt(()=>t[61].call(bt)),r(Un,"class","my-1 flex"),r($l,"name","qb"),r($l,"type","text"),r($l,"class","in-s"),r(tn,"class","my-1"),r(Ye,"class","cnt"),r(as,"class","text-sm"),r(Qn,"href",Ut("User-interface")),r(Qn,"target","_blank"),r(Qn,"class","float-right"),r(vi,"type","hidden"),r(vi,"name","u"),vi.value="true",r(hi,"class","flex flex-wrap"),r(rl,"class","cnt"),r(us,"class","text-sm"),r(Zn,"href","https://amsleser.no/blog/post/24-telnet-debug"),r(Zn,"target","_blank"),r(Zn,"class","float-right"),r(bi,"type","hidden"),r(bi,"name","d"),bi.value="true",r(Jt,"type","checkbox"),r(Jt,"name","ds"),Jt.__value="true",Jt.value=Jt.__value,r(Jt,"class","rounded mb-1"),r(fs,"class","mt-3"),r(Dt,"class","cnt"),r(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),r(xn,"type","button"),r(xn,"class","py-2 px-4 rounded bg-red-500 text-white ml-2"),r(ei,"type","button"),r(ei,"class","py-2 px-4 rounded bg-yellow-500 text-white"),r(ms,"class","text-center"),r(ps,"class","text-right"),r(Fl,"class","grid grid-cols-3"),r(e,"autocomplete","off")},m(R,ae){$(R,e,ae),s(e,l),s(l,n),s(n,i),s(n,o),s(n,u),le(a,u,null),s(n,c),s(n,f),s(n,_),s(n,p),s(p,b),s(b,v),s(v,d),s(v,M),s(v,y),s(v,T),te(T,t[3].g.h),s(b,N),s(b,E),s(E,B),s(E,P),s(E,L),s(E,O),le(F,O,null),qe(O,t[3].g.t,!0),s(n,x),s(n,j),s(n,z),s(n,G),s(G,V),s(V,W),s(W,U),s(W,K),s(W,H),s(W,Y),s(Y,Z),s(Z,re),s(Z,ue),s(Z,ke),s(Z,me),s(Z,Se),s(Y,je),s(je,Re),s(je,He),s(je,we),s(je,Te),s(Y,Le),s(Le,$e),s(Le,w),s(Y,g),s(Y,k),s(Y,A),s(Y,I),s(Y,Q),s(Y,J),s(Y,se),s(Y,ce),s(Y,ve),s(Y,Me),s(Y,oe),s(Y,pe),s(Y,Be),qe(Y,t[3].p.r,!0),s(V,_e),s(V,ye),s(ye,vt),s(ye,Hl),s(ye,tl),s(ye,ct);for(let ft=0;ft<4;ft+=1)gi[ft]&&gi[ft].m(ct,null);qe(ct,t[3].p.c,!0),s(n,Tl),s(n,pl),s(pl,Ht),s(Ht,ht),s(ht,Qe),s(ht,Xe),s(ht,Ze),s(ht,Ue),te(Ue,t[3].p.f),s(Ht,Je),s(Ht,We),s(We,xe),s(We,et),s(We,de),s(We,Ce),te(Ce,t[3].p.m),s(n,Ei),s(n,_l),s(_l,_n),s(_n,Tt),Tt.checked=t[3].p.e,s(_n,Di),s(_l,Ii),gt&>.m(_l,null),s(n,Ri),s(n,dl),s(dl,Li),s(dl,Oi),s(dl,Fi),s(dl,Nt),s(Nt,Nl),s(Nt,Al),s(Nt,Pl),qe(Nt,t[3].g.s,!0),s(n,qi),kt&&kt.m(n,null),s(l,Ge),s(l,Ae),s(Ae,vl),s(Ae,Ts),s(Ae,El),le(Rt,El,null),s(Ae,Bi),s(Ae,Wl),s(Ae,Ao),s(Ae,ll),s(ll,Ui),s(ll,Po),s(ll,Ns),s(ll,Eo),s(ll,ci),s(ci,Wt),Wt.checked=t[3].m.i,s(ci,Do),s(ll,Io),s(ll,Dl),s(Dl,nl),s(nl,Il),s(Il,Ro);for(let ft=0;ft<7;ft+=1)ki[ft]&&ki[ft].m(nl,null);qe(nl,t[3].m.b,!0),s(Dl,Lo),s(Dl,pt),s(pt,Rl),s(Rl,Oo),s(pt,dn),s(pt,vn),s(pt,hn),s(pt,bn),qe(pt,t[3].m.p,!0),s(Dl,Fo),s(Dl,At),te(At,t[3].m.s),s(Ae,qo),s(Ae,zl),s(zl,Bo),s(zl,Uo),s(zl,jo),s(zl,il),s(il,gn),s(il,kn),qe(il,t[3].m.d,!0),s(Ae,Ho),s(Ae,wn),s(wn,Gl),s(Gl,Wo),s(Gl,zo),s(Gl,Go),s(Gl,yn),s(yn,zt),te(zt,t[3].m.f),s(yn,Vo),s(yn,Gi),s(wn,Ko),s(wn,Vl),s(Vl,Yo),s(Vl,Qo),s(Vl,Xo),s(Vl,Cn),s(Cn,Gt),te(Gt,t[3].m.r),s(Cn,Zo),s(Cn,Vi),s(Ae,Jo),s(Ae,As),s(Ae,xo),s(Ae,Kl),s(Kl,Ki),s(Ki,Vt),Vt.checked=t[3].m.e.e,s(Ki,er),s(Kl,tr),wt&&wt.m(Kl,null),s(Ae,lr),yt&&yt.m(Ae,null),s(Ae,Ps),s(Ae,Yi),s(Yi,Kt),Kt.checked=t[3].m.m.e,s(Yi,nr),s(Ae,ir),Ct&&Ct.m(Ae,null),s(l,sr),s(l,mt),s(mt,Qi),s(mt,or),s(mt,$n),le(Mn,$n,null),s(mt,rr),s(mt,mi),s(mt,ar),s(mt,Yl),s(Yl,ur),s(Yl,fr),s(Yl,cr),s(Yl,hl),te(hl,t[3].w.s),s(mt,mr),s(mt,Ql),s(Ql,pr),s(Ql,_r),s(Ql,dr),s(Ql,bl),te(bl,t[3].w.p),s(mt,vr),s(mt,Sn),s(Sn,Xl),s(Xl,hr),s(Xl,br),s(Xl,gr),s(Xl,Lt),s(Lt,Tn),s(Lt,Nn),s(Lt,An),s(Lt,Pn),qe(Lt,t[3].w.z,!0),s(Sn,kr),s(Sn,Zl),s(Zl,wr),s(Zl,yr),s(Zl,Cr),s(Zl,En),s(En,Ot),te(Ot,t[3].w.w),s(En,$r),s(En,Xi),s(mt,Mr),s(mt,Zi),s(Zi,Ji),s(Ji,Yt),Yt.checked=t[3].w.b,s(Ji,Sr),s(l,Tr),s(l,ut),s(ut,xi),s(ut,Nr),s(ut,Dn),le(In,Dn,null),s(ut,Ar),s(ut,Jl),s(Jl,Pr),s(Jl,Er),s(Jl,Dr),s(Jl,Ll),s(Ll,sl),s(sl,Rn),s(sl,Ln),qe(sl,t[3].n.m,!0),s(Ll,Ir),s(Ll,Pt),te(Pt,t[3].n.i),s(Ll,Rr),s(Ll,Et),le(On,Et,null),qe(Et,t[3].n.s,!0),s(ut,Lr),$t&&$t.m(ut,null),s(ut,Es),s(ut,is),s(is,ss),s(ss,Qt),Qt.checked=t[3].n.d,s(ss,Or),s(ut,Fr),s(ut,pi),s(ut,qr),s(ut,Ol),s(Ol,Br),s(Ol,_i),s(_i,Xt),Xt.checked=t[3].n.h,s(_i,Ur),s(Ol,jr),s(Ol,Hr),s(Ol,os),s(os,gl),te(gl,t[3].n.n1),s(l,Wr),s(l,Ye),s(Ye,rs),s(Ye,zr),s(Ye,Fn),le(qn,Fn,null),s(Ye,Gr),s(Ye,di),s(Ye,Vr),s(Ye,ol),s(ol,Kr),Mt&&Mt.m(ol,null),s(ol,Ds),s(ol,Yr),s(ol,Qr),s(ol,Bn),s(Bn,kl),te(kl,t[3].q.h),s(Bn,Xr),s(Bn,Zt),te(Zt,t[3].q.p),s(Ye,Zr),lt&<.m(Ye,null),s(Ye,Is),s(Ye,xl),s(xl,Jr),s(xl,xr),s(xl,ea),s(xl,wl),te(wl,t[3].q.u),s(Ye,ta),s(Ye,en),s(en,la),s(en,na),s(en,ia),s(en,yl),te(yl,t[3].q.a),s(Ye,sa),s(Ye,Un),s(Un,jn),s(jn,oa),s(jn,ra),s(jn,aa),s(jn,Cl),te(Cl,t[3].q.c),s(Un,ua),s(Un,Hn),s(Hn,fa),s(Hn,ca),s(Hn,ma),s(Hn,bt),s(bt,Wn),s(bt,zn),s(bt,Gn),s(bt,Vn),s(bt,Kn),s(bt,Yn),qe(bt,t[3].q.m,!0),s(Ye,pa),s(Ye,tn),s(tn,_a),s(tn,da),s(tn,va),s(tn,$l),te($l,t[3].q.b),s(l,ha),nt&&nt.m(l,null),s(l,Rs),it&&it.m(l,null),s(l,Ls),st&&st.m(l,null),s(l,Os),ot&&ot.m(l,null),s(l,qs),s(l,rl),s(rl,as),s(rl,ba),s(rl,Qn),le(Xn,Qn,null),s(rl,ga),s(rl,vi),s(rl,ka),s(rl,hi);for(let ft=0;ft<_t.length;ft+=1)_t[ft]&&_t[ft].m(hi,null);s(l,wa),rt&&rt.m(l,null),s(l,Bs),s(l,Dt),s(Dt,us),s(Dt,ya),s(Dt,Zn),le(Jn,Zn,null),s(Dt,Ca),s(Dt,bi),s(Dt,$a),s(Dt,fs),s(fs,cs),s(cs,Jt),Jt.checked=t[3].d.s,s(cs,Ma),s(Dt,Sa),St&&St.m(Dt,null),s(e,Ta),s(e,Fl),s(Fl,Us),s(Us,xn),s(Fl,Na),s(Fl,ms),s(ms,ei),s(Fl,Aa),s(Fl,ps),$(R,js,ae),le(ln,R,ae),$(R,Hs,ae),le(nn,R,ae),$(R,Ws,ae),le(sn,R,ae),$(R,zs,ae),le(on,R,ae),Ft=!0,Gs||(Pa=[ee(T,"input",t[15]),ee(O,"change",t[16]),ee(Y,"change",t[17]),ee(ct,"change",t[18]),ee(Ue,"input",t[19]),ee(Ce,"input",t[20]),ee(Tt,"change",t[21]),ee(Nt,"change",t[23]),ee(Wt,"change",t[26]),ee(nl,"change",t[27]),ee(pt,"change",t[28]),ee(At,"input",t[29]),ee(il,"change",t[30]),ee(zt,"input",t[31]),ee(Gt,"input",t[32]),ee(Vt,"change",t[33]),ee(Kt,"change",t[36]),ee(hl,"input",t[41]),ee(bl,"input",t[42]),ee(Lt,"change",t[43]),ee(Ot,"input",t[44]),ee(Yt,"change",t[45]),ee(sl,"change",t[46]),ee(Pt,"input",t[47]),ee(Et,"change",t[48]),ee(Qt,"change",t[52]),ee(Xt,"change",t[53]),ee(gl,"input",t[54]),ee(kl,"input",t[56]),ee(Zt,"input",t[57]),ee(wl,"input",t[58]),ee(yl,"input",t[59]),ee(Cl,"input",t[60]),ee(bt,"change",t[61]),ee($l,"input",t[62]),ee(Jt,"change",t[92]),ee(xn,"click",t[8]),ee(ei,"click",t[10]),ee(e,"submit",Ms(t[9]))],Gs=!0)},p(R,ae){if(ae[0]&8&&T.value!==R[3].g.h&&te(T,R[3].g.h),ae[0]&8&&qe(O,R[3].g.t),ae[0]&8&&qe(Y,R[3].p.r),ae[0]&8&&qe(ct,R[3].p.c),ae[0]&8&&he(Ue.value)!==R[3].p.f&&te(Ue,R[3].p.f),ae[0]&8&&he(Ce.value)!==R[3].p.m&&te(Ce,R[3].p.m),ae[0]&8&&(Tt.checked=R[3].p.e),R[3].p.e&&R[0].chip!="esp8266"?gt?gt.p(R,ae):(gt=af(R),gt.c(),gt.m(_l,null)):gt&&(gt.d(1),gt=null),ae[0]&8&&qe(Nt,R[3].g.s),R[3].g.s>0?kt?kt.p(R,ae):(kt=uf(R),kt.c(),kt.m(n,null)):kt&&(kt.d(1),kt=null),ae[0]&8&&(Wt.checked=R[3].m.i),(!Ft||ae[0]&8&&ji!==(ji=R[3].m.b!=0))&&(Il.disabled=ji),ae[0]&8&&qe(nl,R[3].m.b),(!Ft||ae[0]&8&&Hi!==(Hi=R[3].m.b!=0))&&(Rl.disabled=Hi),(!Ft||ae[0]&8&&Wi!==(Wi=R[3].m.b==0))&&(pt.disabled=Wi),ae[0]&8&&qe(pt,R[3].m.p),(!Ft||ae[0]&9&&zi!==(zi=R[0].chip=="esp8266"?R[3].i.h.p==3||R[3].i.h.p==113?512:128:4096))&&r(At,"max",zi),ae[0]&8&&he(At.value)!==R[3].m.s&&te(At,R[3].m.s),ae[0]&8&&qe(il,R[3].m.d),ae[0]&8&&he(zt.value)!==R[3].m.f&&te(zt,R[3].m.f),ae[0]&8&&he(Gt.value)!==R[3].m.r&&te(Gt,R[3].m.r),ae[0]&8&&(Vt.checked=R[3].m.e.e),R[3].m.e.e?wt?wt.p(R,ae):(wt=ff(R),wt.c(),wt.m(Kl,null)):wt&&(wt.d(1),wt=null),R[3].m.e.e?yt?yt.p(R,ae):(yt=cf(R),yt.c(),yt.m(Ae,Ps)):yt&&(yt.d(1),yt=null),ae[0]&8&&(Kt.checked=R[3].m.m.e),R[3].m.m.e?Ct?Ct.p(R,ae):(Ct=mf(R),Ct.c(),Ct.m(Ae,null)):Ct&&(Ct.d(1),Ct=null),ae[0]&8&&hl.value!==R[3].w.s&&te(hl,R[3].w.s),ae[0]&8&&bl.value!==R[3].w.p&&te(bl,R[3].w.p),ae[0]&8&&qe(Lt,R[3].w.z),ae[0]&8&&he(Ot.value)!==R[3].w.w&&te(Ot,R[3].w.w),ae[0]&8&&(Yt.checked=R[3].w.b),ae[0]&8&&qe(sl,R[3].n.m),(!Ft||ae[0]&8&&es!==(es=R[3].n.m=="dhcp"))&&(Pt.disabled=es),(!Ft||ae[0]&8&&ts!==(ts=R[3].n.m=="static"))&&(Pt.required=ts),ae[0]&8&&Pt.value!==R[3].n.i&&te(Pt,R[3].n.i),(!Ft||ae[0]&8&&ls!==(ls=R[3].n.m=="dhcp"))&&(Et.disabled=ls),(!Ft||ae[0]&8&&ns!==(ns=R[3].n.m=="static"))&&(Et.required=ns),ae[0]&8&&qe(Et,R[3].n.s),R[3].n.m=="static"?$t?$t.p(R,ae):($t=pf(R),$t.c(),$t.m(ut,Es)):$t&&($t.d(1),$t=null),ae[0]&8&&(Qt.checked=R[3].n.d),ae[0]&8&&(Xt.checked=R[3].n.h),ae[0]&8&&gl.value!==R[3].n.n1&&te(gl,R[3].n.n1),R[0].chip!="esp8266"?Mt?Mt.p(R,ae):(Mt=_f(R),Mt.c(),Mt.m(ol,Ds)):Mt&&(Mt.d(1),Mt=null),ae[0]&8&&kl.value!==R[3].q.h&&te(kl,R[3].q.h),ae[0]&8&&he(Zt.value)!==R[3].q.p&&te(Zt,R[3].q.p),R[3].q.s.e?lt?(lt.p(R,ae),ae[0]&8&&D(lt,1)):(lt=df(R),lt.c(),D(lt,1),lt.m(Ye,Is)):lt&&(De(),q(lt,1,1,()=>{lt=null}),Ie()),ae[0]&8&&wl.value!==R[3].q.u&&te(wl,R[3].q.u),ae[0]&8&&yl.value!==R[3].q.a&&te(yl,R[3].q.a),ae[0]&8&&Cl.value!==R[3].q.c&&te(Cl,R[3].q.c),ae[0]&8&&qe(bt,R[3].q.m),ae[0]&8&&$l.value!==R[3].q.b&&te($l,R[3].q.b),R[3].q.m==3?nt?(nt.p(R,ae),ae[0]&8&&D(nt,1)):(nt=vf(R),nt.c(),D(nt,1),nt.m(l,Rs)):nt&&(De(),q(nt,1,1,()=>{nt=null}),Ie()),R[3].q.m==4?it?(it.p(R,ae),ae[0]&8&&D(it,1)):(it=hf(R),it.c(),D(it,1),it.m(l,Ls)):it&&(De(),q(it,1,1,()=>{it=null}),Ie()),R[3].c.es!=null?st?(st.p(R,ae),ae[0]&8&&D(st,1)):(st=bf(R),st.c(),D(st,1),st.m(l,Os)):st&&(De(),q(st,1,1,()=>{st=null}),Ie()),ae[0]&8&&(Fs=R[3].p.r.startsWith("10YNO")||R[3].p.r.startsWith("10Y1001A1001A4")),Fs?ot?(ot.p(R,ae),ae[0]&8&&D(ot,1)):(ot=wf(R),ot.c(),D(ot,1),ot.m(l,qs)):ot&&(De(),q(ot,1,1,()=>{ot=null}),Ie()),ae[0]&136){ti=R[7];let qt;for(qt=0;qt20||R[0].chip=="esp8266"?rt?(rt.p(R,ae),ae[0]&1&&D(rt,1)):(rt=$f(R),rt.c(),D(rt,1),rt.m(l,Bs)):rt&&(De(),q(rt,1,1,()=>{rt=null}),Ie()),ae[0]&8&&(Jt.checked=R[3].d.s),R[3].d.s?St?St.p(R,ae):(St=Pf(R),St.c(),St.m(Dt,null)):St&&(St.d(1),St=null);const ft={};ae[0]&2&&(ft.active=R[1]),ln.$set(ft);const Ea={};ae[0]&4&&(Ea.active=R[2]),nn.$set(Ea);const Da={};ae[0]&16&&(Da.active=R[4]),sn.$set(Da);const Ia={};ae[0]&32&&(Ia.active=R[5]),on.$set(Ia)},i(R){Ft||(D(a.$$.fragment,R),D(F.$$.fragment,R),D(Rt.$$.fragment,R),D(Mn.$$.fragment,R),D(In.$$.fragment,R),D(On.$$.fragment,R),D(qn.$$.fragment,R),D(lt),D(nt),D(it),D(st),D(ot),D(Xn.$$.fragment,R),D(rt),D(Jn.$$.fragment,R),D(ln.$$.fragment,R),D(nn.$$.fragment,R),D(sn.$$.fragment,R),D(on.$$.fragment,R),Ft=!0)},o(R){q(a.$$.fragment,R),q(F.$$.fragment,R),q(Rt.$$.fragment,R),q(Mn.$$.fragment,R),q(In.$$.fragment,R),q(On.$$.fragment,R),q(qn.$$.fragment,R),q(lt),q(nt),q(it),q(st),q(ot),q(Xn.$$.fragment,R),q(rt),q(Jn.$$.fragment,R),q(ln.$$.fragment,R),q(nn.$$.fragment,R),q(sn.$$.fragment,R),q(on.$$.fragment,R),Ft=!1},d(R){R&&C(e),ne(a),ne(F),cl(gi,R),gt&>.d(),kt&&kt.d(),ne(Rt),cl(ki,R),wt&&wt.d(),yt&&yt.d(),Ct&&Ct.d(),ne(Mn),ne(In),ne(On),$t&&$t.d(),ne(qn),Mt&&Mt.d(),lt&<.d(),nt&&nt.d(),it&&it.d(),st&&st.d(),ot&&ot.d(),ne(Xn),cl(_t,R),rt&&rt.d(),ne(Jn),St&&St.d(),R&&C(js),ne(ln,R),R&&C(Hs),ne(nn,R),R&&C(Ws),ne(sn,R),R&&C(zs),ne(on,R),Gs=!1,ze(Pa)}}}async function wp(){await(await fetch("/reboot",{method:"POST"})).json()}function yp(t,e,l){let{sysinfo:n={}}=e,i=[{name:"Import gauge",key:"i"},{name:"Export gauge",key:"e"},{name:"Voltage",key:"v"},{name:"Amperage",key:"a"},{name:"Reactive",key:"r"},{name:"Realtime",key:"c"},{name:"Peaks",key:"t"},{name:"Price",key:"p"},{name:"Day plot",key:"d"},{name:"Month plot",key:"m"},{name:"Temperature plot",key:"s"}],o=!0,u=!1,a={g:{t:"",h:"",s:0,u:"",p:""},m:{b:2400,p:11,i:!1,d:0,f:0,r:0,e:{e:!1,k:"",a:""},m:{e:!1,w:!1,v:!1,a:!1,c:!1}},w:{s:"",p:"",w:0,z:255,a:!0,b:!0},n:{m:"",i:"",s:"",g:"",d1:"",d2:"",d:!1,n1:"",n2:"",h:!1},q:{h:"",p:1883,u:"",a:"",b:"",s:{e:!1,c:!1,r:!0,k:!1}},o:{e:"",c:"",u1:"",u2:"",u3:""},t:{t:[0,0,0,0,0,0,0,0,0,0],h:1},p:{e:!1,t:"",r:"",c:"",m:1,f:null},d:{s:!1,t:!1,l:5},u:{i:0,e:0,v:0,a:0,r:0,c:0,t:0,p:0,d:0,m:0,s:0},i:{h:{p:null,u:!0},a:null,l:{p:null,i:!1},r:{r:null,g:null,b:null,i:!1},t:{d:null,a:null},v:{p:null,d:{v:null,g:null},o:null,m:null,b:null}},h:{t:"",h:"",n:""},c:{es:null}};Ci.subscribe(Ge=>{Ge.version&&(l(3,a=Ge),l(1,o=!1))}),jm();let c=!1,f=!1;async function _(){if(confirm("Are you sure you want to factory reset the device?")){l(4,c=!0);const Ge=new URLSearchParams;Ge.append("perform","true");let vl=await(await fetch("/reset",{method:"POST",body:Ge})).json();l(4,c=!1),l(5,f=vl.success)}}async function p(Ge){l(2,u=!0);const Ae=new FormData(Ge.target),vl=new URLSearchParams;for(let Rt of Ae){const[Bi,Wl]=Rt;vl.append(Bi,Wl)}let El=await(await fetch("/save",{method:"POST",body:vl})).json();jt.update(Rt=>(Rt.booting=El.reboot,Rt.ui=a.u,Rt)),l(2,u=!1),oi("/")}const b=function(){confirm("Are you sure you want to reboot the device?")&&(jt.update(Ge=>(Ge.booting=!0,Ge)),wp())};async function v(){confirm("Are you sure you want to delete CA?")&&(await(await fetch("/mqtt-ca",{method:"POST"})).text(),Ci.update(Ae=>(Ae.q.s.c=!1,Ae)))}async function d(){confirm("Are you sure you want to delete cert?")&&(await(await fetch("/mqtt-cert",{method:"POST"})).text(),Ci.update(Ae=>(Ae.q.s.r=!1,Ae)))}async function M(){confirm("Are you sure you want to delete key?")&&(await(await fetch("/mqtt-key",{method:"POST"})).text(),Ci.update(Ae=>(Ae.q.s.k=!1,Ae)))}const y=function(){a.q.s.e?a.q.p==1883&&l(3,a.q.p=8883,a):a.q.p==8883&&l(3,a.q.p=1883,a)};let T=44;function N(){a.g.h=this.value,l(3,a)}function E(){a.g.t=dt(this),l(3,a)}function B(){a.p.r=dt(this),l(3,a)}function P(){a.p.c=dt(this),l(3,a)}function L(){a.p.f=he(this.value),l(3,a)}function O(){a.p.m=he(this.value),l(3,a)}function F(){a.p.e=this.checked,l(3,a)}function x(){a.p.t=this.value,l(3,a)}function j(){a.g.s=dt(this),l(3,a)}function z(){a.g.u=this.value,l(3,a)}function G(){a.g.p=this.value,l(3,a)}function V(){a.m.i=this.checked,l(3,a)}function W(){a.m.b=dt(this),l(3,a)}function U(){a.m.p=dt(this),l(3,a)}function K(){a.m.s=he(this.value),l(3,a)}function H(){a.m.d=dt(this),l(3,a)}function Y(){a.m.f=he(this.value),l(3,a)}function Z(){a.m.r=he(this.value),l(3,a)}function re(){a.m.e.e=this.checked,l(3,a)}function ue(){a.m.e.k=this.value,l(3,a)}function ke(){a.m.e.a=this.value,l(3,a)}function me(){a.m.m.e=this.checked,l(3,a)}function Se(){a.m.m.w=he(this.value),l(3,a)}function je(){a.m.m.v=he(this.value),l(3,a)}function Re(){a.m.m.a=he(this.value),l(3,a)}function He(){a.m.m.c=he(this.value),l(3,a)}function we(){a.w.s=this.value,l(3,a)}function Te(){a.w.p=this.value,l(3,a)}function Le(){a.w.z=dt(this),l(3,a)}function $e(){a.w.w=he(this.value),l(3,a)}function w(){a.w.b=this.checked,l(3,a)}function g(){a.n.m=dt(this),l(3,a)}function k(){a.n.i=this.value,l(3,a)}function A(){a.n.s=dt(this),l(3,a)}function I(){a.n.g=this.value,l(3,a)}function Q(){a.n.d1=this.value,l(3,a)}function J(){a.n.d2=this.value,l(3,a)}function se(){a.n.d=this.checked,l(3,a)}function ce(){a.n.h=this.checked,l(3,a)}function ve(){a.n.n1=this.value,l(3,a)}function Me(){a.q.s.e=this.checked,l(3,a)}function oe(){a.q.h=this.value,l(3,a)}function pe(){a.q.p=he(this.value),l(3,a)}function Be(){a.q.u=this.value,l(3,a)}function _e(){a.q.a=this.value,l(3,a)}function ye(){a.q.c=this.value,l(3,a)}function vt(){a.q.m=dt(this),l(3,a)}function Hl(){a.q.b=this.value,l(3,a)}function tl(){a.o.e=this.value,l(3,a)}function ct(){a.o.c=this.value,l(3,a)}function Tl(){a.o.u1=this.value,l(3,a)}function pl(){a.o.u2=this.value,l(3,a)}function Ht(){a.o.u3=this.value,l(3,a)}function ht(){a.h.t=this.value,l(3,a)}function Qe(){a.h.h=this.value,l(3,a)}function Xe(){a.h.n=this.value,l(3,a)}function Ze(){a.c.es=this.checked,l(3,a)}function Ue(Ge){a.t.t[Ge]=he(this.value),l(3,a)}function Je(){a.t.h=he(this.value),l(3,a)}function We(Ge){a.u[Ge.key]=dt(this),l(3,a)}function xe(){a.i.h.u=this.checked,l(3,a)}function et(){a.i.h.p=dt(this),l(3,a)}function de(){a.i.a=he(this.value),l(3,a)}function Ce(){a.i.l.i=this.checked,l(3,a)}function Ei(){a.i.l.p=he(this.value),l(3,a)}function _l(){a.i.r.i=this.checked,l(3,a)}function _n(){a.i.r.r=he(this.value),l(3,a)}function Tt(){a.i.r.g=he(this.value),l(3,a)}function Di(){a.i.r.b=he(this.value),l(3,a)}function Ii(){a.i.t.d=he(this.value),l(3,a)}function Ri(){a.i.t.a=he(this.value),l(3,a)}function dl(){a.i.v.p=he(this.value),l(3,a)}function Li(){a.i.v.d.v=he(this.value),l(3,a)}function Oi(){a.i.v.d.g=he(this.value),l(3,a)}function Fi(){a.i.v.o=he(this.value),l(3,a)}function Nt(){a.i.v.m=he(this.value),l(3,a)}function Nl(){a.i.v.b=he(this.value),l(3,a)}function Al(){a.d.s=this.checked,l(3,a)}function Pl(){a.d.t=this.checked,l(3,a)}function qi(){a.d.l=dt(this),l(3,a)}return t.$$set=Ge=>{"sysinfo"in Ge&&l(0,n=Ge.sysinfo)},t.$$.update=()=>{t.$$.dirty[0]&1&&l(6,T=n.chip=="esp8266"?16:n.chip=="esp32s2"?44:39)},[n,o,u,a,c,f,T,i,_,p,b,v,d,M,y,N,E,B,P,L,O,F,x,j,z,G,V,W,U,K,H,Y,Z,re,ue,ke,me,Se,je,Re,He,we,Te,Le,$e,w,g,k,A,I,Q,J,se,ce,ve,Me,oe,pe,Be,_e,ye,vt,Hl,tl,ct,Tl,pl,Ht,ht,Qe,Xe,Ze,Ue,Je,We,xe,et,de,Ce,Ei,_l,_n,Tt,Di,Ii,Ri,dl,Li,Oi,Fi,Nt,Nl,Al,Pl,qi]}class Cp extends Ee{constructor(e){super(),Pe(this,e,yp,kp,Ne,{sysinfo:0},null,[-1,-1,-1,-1])}}function Df(t,e,l){const n=t.slice();return n[20]=e[l],n}function $p(t){let e=be(t[1].chip,t[1].board)+"",l;return{c(){l=S(e)},m(n,i){$(n,l,i)},p(n,i){i&2&&e!==(e=be(n[1].chip,n[1].board)+"")&&X(l,e)},d(n){n&&C(l)}}}function If(t){let e,l,n=t[1].apmac+"",i,o,u,a,c,f,_,p,b,v=Za(t[1])+"",d,M,y=t[1].boot_reason+"",T,N,E=t[1].ex_cause+"",B,P,L;const O=[Sp,Mp],F=[];function x(j,z){return j[0].u>0?0:1}return c=x(t),f=F[c]=O[c](t),{c(){e=m("div"),l=S("AP MAC: "),i=S(n),o=h(),u=m("div"),a=S(`Last boot: - `),f.c(),_=h(),p=m("div"),b=S("Reason: "),d=S(v),M=S(" ("),T=S(y),N=S("/"),B=S(E),P=S(")"),r(e,"class","my-2"),r(u,"class","my-2"),r(p,"class","my-2")},m(j,z){$(j,e,z),s(e,l),s(e,i),$(j,o,z),$(j,u,z),s(u,a),F[c].m(u,null),$(j,_,z),$(j,p,z),s(p,b),s(p,d),s(p,M),s(p,T),s(p,N),s(p,B),s(p,P),L=!0},p(j,z){(!L||z&2)&&n!==(n=j[1].apmac+"")&&X(i,n);let G=c;c=x(j),c===G?F[c].p(j,z):(De(),q(F[G],1,1,()=>{F[G]=null}),Ie(),f=F[c],f?f.p(j,z):(f=F[c]=O[c](j),f.c()),D(f,1),f.m(u,null)),(!L||z&2)&&v!==(v=Za(j[1])+"")&&X(d,v),(!L||z&2)&&y!==(y=j[1].boot_reason+"")&&X(T,y),(!L||z&2)&&E!==(E=j[1].ex_cause+"")&&X(B,E)},i(j){L||(D(f),L=!0)},o(j){q(f),L=!1},d(j){j&&C(e),j&&C(o),j&&C(u),F[c].d(),j&&C(_),j&&C(p)}}}function Mp(t){let e;return{c(){e=S("-")},m(l,n){$(l,e,n)},p:fe,i:fe,o:fe,d(l){l&&C(e)}}}function Sp(t){let e,l;return e=new Gc({props:{timestamp:new Date(new Date().getTime()-t[0].u*1e3),fullTimeColor:""}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.timestamp=new Date(new Date().getTime()-n[0].u*1e3)),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function Tp(t){let e;return{c(){e=m("span"),e.textContent="Update consents",r(e,"class","btn-pri-sm")},m(l,n){$(l,e,n)},p:fe,d(l){l&&C(e)}}}function Rf(t){let e,l,n,i,o,u=Cs(t[1].meter.mfg)+"",a,c,f,_,p=(t[1].meter.model?t[1].meter.model:"unknown")+"",b,v,d,M,y=(t[1].meter.id?t[1].meter.id:"unknown")+"",T;return{c(){e=m("div"),l=m("strong"),l.textContent="Meter",n=h(),i=m("div"),o=S("Manufacturer: "),a=S(u),c=h(),f=m("div"),_=S("Model: "),b=S(p),v=h(),d=m("div"),M=S("ID: "),T=S(y),r(l,"class","text-sm"),r(i,"class","my-2"),r(f,"class","my-2"),r(d,"class","my-2"),r(e,"class","cnt")},m(N,E){$(N,e,E),s(e,l),s(e,n),s(e,i),s(i,o),s(i,a),s(e,c),s(e,f),s(f,_),s(f,b),s(e,v),s(e,d),s(d,M),s(d,T)},p(N,E){E&2&&u!==(u=Cs(N[1].meter.mfg)+"")&&X(a,u),E&2&&p!==(p=(N[1].meter.model?N[1].meter.model:"unknown")+"")&&X(b,p),E&2&&y!==(y=(N[1].meter.id?N[1].meter.id:"unknown")+"")&&X(T,y)},d(N){N&&C(e)}}}function Lf(t){let e,l,n,i,o,u=t[1].net.ip+"",a,c,f,_,p=t[1].net.mask+"",b,v,d,M,y=t[1].net.gw+"",T,N,E,B,P=t[1].net.dns1+"",L,O,F=t[1].net.dns2&&Of(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Network",n=h(),i=m("div"),o=S("IP: "),a=S(u),c=h(),f=m("div"),_=S("Mask: "),b=S(p),v=h(),d=m("div"),M=S("Gateway: "),T=S(y),N=h(),E=m("div"),B=S("DNS: "),L=S(P),O=h(),F&&F.c(),r(l,"class","text-sm"),r(i,"class","my-2"),r(f,"class","my-2"),r(d,"class","my-2"),r(E,"class","my-2"),r(e,"class","cnt")},m(x,j){$(x,e,j),s(e,l),s(e,n),s(e,i),s(i,o),s(i,a),s(e,c),s(e,f),s(f,_),s(f,b),s(e,v),s(e,d),s(d,M),s(d,T),s(e,N),s(e,E),s(E,B),s(E,L),s(E,O),F&&F.m(E,null)},p(x,j){j&2&&u!==(u=x[1].net.ip+"")&&X(a,u),j&2&&p!==(p=x[1].net.mask+"")&&X(b,p),j&2&&y!==(y=x[1].net.gw+"")&&X(T,y),j&2&&P!==(P=x[1].net.dns1+"")&&X(L,P),x[1].net.dns2?F?F.p(x,j):(F=Of(x),F.c(),F.m(E,null)):F&&(F.d(1),F=null)},d(x){x&&C(e),F&&F.d()}}}function Of(t){let e,l=t[1].net.dns2+"",n;return{c(){e=S("/ "),n=S(l)},m(i,o){$(i,e,o),$(i,n,o)},p(i,o){o&2&&l!==(l=i[1].net.dns2+"")&&X(n,l)},d(i){i&&C(e),i&&C(n)}}}function Ff(t){let e,l,n,i=t[1].upgrade.t+"",o,u,a=t[1].version+"",c,f,_=t[1].upgrade.x+"",p,b,v=t[1].upgrade.e+"",d,M;return{c(){e=m("div"),l=m("div"),n=S("Previous upgrade attempt ("),o=S(i),u=S(") does not match current version ("),c=S(a),f=S(") ["),p=S(_),b=S("/"),d=S(v),M=S("]"),r(l,"class","bd-yellow"),r(e,"class","my-2")},m(y,T){$(y,e,T),s(e,l),s(l,n),s(l,o),s(l,u),s(l,c),s(l,f),s(l,p),s(l,b),s(l,d),s(l,M)},p(y,T){T&2&&i!==(i=y[1].upgrade.t+"")&&X(o,i),T&2&&a!==(a=y[1].version+"")&&X(c,a),T&2&&_!==(_=y[1].upgrade.x+"")&&X(p,_),T&2&&v!==(v=y[1].upgrade.e+"")&&X(d,v)},d(y){y&&C(e)}}}function qf(t){let e,l,n,i=t[2].tag_name+"",o,u,a,c,f,_,p=(t[1].security==0||t[0].a)&&t[1].fwconsent===1&&t[2]&&t[2].tag_name!=t[1].version&&Bf(t),b=t[1].fwconsent===2&&Uf();return{c(){e=m("div"),l=S(`Latest version: - `),n=m("a"),o=S(i),a=h(),p&&p.c(),c=h(),b&&b.c(),f=Ve(),r(n,"href",u=t[2].html_url),r(n,"class","ml-2 text-blue-600 hover:text-blue-800"),r(n,"target","_blank"),r(n,"rel","noreferrer"),r(e,"class","my-2 flex")},m(v,d){$(v,e,d),s(e,l),s(e,n),s(n,o),s(e,a),p&&p.m(e,null),$(v,c,d),b&&b.m(v,d),$(v,f,d),_=!0},p(v,d){(!_||d&4)&&i!==(i=v[2].tag_name+"")&&X(o,i),(!_||d&4&&u!==(u=v[2].html_url))&&r(n,"href",u),(v[1].security==0||v[0].a)&&v[1].fwconsent===1&&v[2]&&v[2].tag_name!=v[1].version?p?(p.p(v,d),d&7&&D(p,1)):(p=Bf(v),p.c(),D(p,1),p.m(e,null)):p&&(De(),q(p,1,1,()=>{p=null}),Ie()),v[1].fwconsent===2?b||(b=Uf(),b.c(),b.m(f.parentNode,f)):b&&(b.d(1),b=null)},i(v){_||(D(p),_=!0)},o(v){q(p),_=!1},d(v){v&&C(e),p&&p.d(),v&&C(c),b&&b.d(v),v&&C(f)}}}function Bf(t){let e,l,n,i,o,u;return n=new Vc({}),{c(){e=m("div"),l=m("button"),ie(n.$$.fragment),r(e,"class","flex-none ml-2 text-green-500"),r(e,"title","Install this version")},m(a,c){$(a,e,c),s(e,l),le(n,l,null),i=!0,o||(u=ee(l,"click",t[10]),o=!0)},p:fe,i(a){i||(D(n.$$.fragment,a),i=!0)},o(a){q(n.$$.fragment,a),i=!1},d(a){a&&C(e),ne(n),o=!1,u()}}}function Uf(t){let e;return{c(){e=m("div"),e.innerHTML='
You have disabled one-click firmware upgrade, link to self-upgrade is disabled
',r(e,"class","my-2")},m(l,n){$(l,e,n)},d(l){l&&C(e)}}}function jf(t){let e,l=$s(be(t[1].chip,t[1].board))+"",n;return{c(){e=m("div"),n=S(l),r(e,"class","bd-red")},m(i,o){$(i,e,o),s(e,n)},p(i,o){o&2&&l!==(l=$s(be(i[1].chip,i[1].board))+"")&&X(n,l)},d(i){i&&C(e)}}}function Hf(t){let e,l,n,i,o,u;function a(_,p){return _[4].length==0?Ap:Np}let c=a(t),f=c(t);return{c(){e=m("div"),l=m("form"),n=m("input"),i=h(),f.c(),nc(n,"display","none"),r(n,"name","file"),r(n,"type","file"),r(n,"accept",".bin"),r(l,"action","/firmware"),r(l,"enctype","multipart/form-data"),r(l,"method","post"),r(l,"autocomplete","off"),r(e,"class","my-2 flex")},m(_,p){$(_,e,p),s(e,l),s(l,n),t[12](n),s(l,i),f.m(l,null),o||(u=[ee(n,"change",t[13]),ee(l,"submit",t[15])],o=!0)},p(_,p){c===(c=a(_))&&f?f.p(_,p):(f.d(1),f=c(_),f&&(f.c(),f.m(l,null)))},d(_){_&&C(e),t[12](null),f.d(),o=!1,ze(u)}}}function Np(t){let e=t[4][0].name+"",l,n,i;return{c(){l=S(e),n=h(),i=m("button"),i.textContent="Upload",r(i,"type","submit"),r(i,"class","btn-pri-sm float-right")},m(o,u){$(o,l,u),$(o,n,u),$(o,i,u)},p(o,u){u&16&&e!==(e=o[4][0].name+"")&&X(l,e)},d(o){o&&C(l),o&&C(n),o&&C(i)}}}function Ap(t){let e,l,n;return{c(){e=m("button"),e.textContent="Select firmware file for upgrade",r(e,"type","button"),r(e,"class","btn-pri-sm float-right")},m(i,o){$(i,e,o),l||(n=ee(e,"click",t[14]),l=!0)},p:fe,d(i){i&&C(e),l=!1,n()}}}function Wf(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,M=t[9],y=[];for(let P=0;P Include Secrets
(SSID, PSK, passwords and tokens)',c=h(),T&&T.c(),f=h(),_=m("form"),p=m("input"),b=h(),B.c(),r(l,"class","text-sm"),r(a,"class","my-1 mx-3 col-span-2"),r(o,"class","grid grid-cols-2"),r(i,"method","get"),r(i,"action","/configfile.cfg"),r(i,"autocomplete","off"),nc(p,"display","none"),r(p,"name","file"),r(p,"type","file"),r(p,"accept",".cfg"),r(_,"action","/configfile"),r(_,"enctype","multipart/form-data"),r(_,"method","post"),r(_,"autocomplete","off"),r(e,"class","cnt")},m(P,L){$(P,e,L),s(e,l),s(e,n),s(e,i),s(i,o);for(let O=0;O{A=null}),Ie());const _e={};pe&8388608&&(_e.$$scope={dirty:pe,ctx:oe}),x.$set(_e),oe[1].meter?I?I.p(oe,pe):(I=Rf(oe),I.c(),I.m(e,V)):I&&(I.d(1),I=null),oe[1].net?Q?Q.p(oe,pe):(Q=Lf(oe),Q.c(),Q.m(e,W)):Q&&(Q.d(1),Q=null),(!w||pe&2)&&re!==(re=oe[1].version+"")&&X(ue,re),oe[1].upgrade.t&&oe[1].upgrade.t!=oe[1].version?J?J.p(oe,pe):(J=Ff(oe),J.c(),J.m(U,me)):J&&(J.d(1),J=null),oe[2]?se?(se.p(oe,pe),pe&4&&D(se,1)):(se=qf(oe),se.c(),D(se,1),se.m(U,Se)):se&&(De(),q(se,1,1,()=>{se=null}),Ie()),pe&3&&(je=(oe[1].security==0||oe[0].a)&&ri(oe[1].board)),je?ce?ce.p(oe,pe):(ce=jf(oe),ce.c(),ce.m(U,Re)):ce&&(ce.d(1),ce=null),oe[1].security==0||oe[0].a?ve?ve.p(oe,pe):(ve=Hf(oe),ve.c(),ve.m(U,null)):ve&&(ve.d(1),ve=null),oe[1].security==0||oe[0].a?Me?Me.p(oe,pe):(Me=Wf(oe),Me.c(),Me.m(e,null)):Me&&(Me.d(1),Me=null);const ye={};pe&32&&(ye.active=oe[5]),Te.$set(ye);const vt={};pe&256&&(vt.active=oe[8]),$e.$set(vt)},i(oe){w||(D(y.$$.fragment,oe),D(A),D(x.$$.fragment,oe),D(se),D(Te.$$.fragment,oe),D($e.$$.fragment,oe),w=!0)},o(oe){q(y.$$.fragment,oe),q(A),q(x.$$.fragment,oe),q(se),q(Te.$$.fragment,oe),q($e.$$.fragment,oe),w=!1},d(oe){oe&&C(e),ne(y),A&&A.d(),ne(x),I&&I.d(),Q&&Q.d(),J&&J.d(),se&&se.d(),ce&&ce.d(),ve&&ve.d(),Me&&Me.d(),oe&&C(we),ne(Te,oe),oe&&C(Le),ne($e,oe),g=!1,k()}}}async function Ip(){await(await fetch("/reboot",{method:"POST"})).json()}function Rp(t,e,l){let{data:n}=e,{sysinfo:i}=e,o=[{name:"WiFi",key:"iw"},{name:"MQTT",key:"im"},{name:"Web",key:"ie"},{name:"Meter",key:"it"},{name:"Thresholds",key:"ih"},{name:"GPIO",key:"ig"},{name:"NTP",key:"in"},{name:"Price API",key:"is"}],u={};So.subscribe(O=>{l(2,u=zc(i.version,O)),u||l(2,u=O[0])});function a(){confirm("Do you want to upgrade this device to "+u.tag_name+"?")&&(i.board!=2&&i.board!=4&&i.board!=7||confirm($s(be(i.chip,i.board))))&&(jt.update(O=>(O.upgrading=!0,O)),Wc(u.tag_name))}const c=function(){confirm("Are you sure you want to reboot the device?")&&(jt.update(O=>(O.booting=!0,O)),Ip())};let f,_=[],p=!1,b,v=[],d=!1;yo();function M(O){ws[O?"unshift":"push"](()=>{f=O,l(3,f)})}function y(){_=this.files,l(4,_)}const T=()=>{f.click()},N=()=>l(5,p=!0);function E(O){ws[O?"unshift":"push"](()=>{b=O,l(6,b)})}function B(){v=this.files,l(7,v)}const P=()=>{b.click()},L=()=>l(8,d=!0);return t.$$set=O=>{"data"in O&&l(0,n=O.data),"sysinfo"in O&&l(1,i=O.sysinfo)},[n,i,u,f,_,p,b,v,d,o,a,c,M,y,T,N,E,B,P,L]}class Lp extends Ee{constructor(e){super(),Pe(this,e,Rp,Dp,Ne,{data:0,sysinfo:1})}}function Vf(t){let e,l,n=be(t[0],7)+"",i,o,u=be(t[0],5)+"",a,c,f=be(t[0],4)+"",_,p,b=be(t[0],3)+"",v,d,M,y,T=be(t[0],2)+"",N,E,B=be(t[0],1)+"",P,L,O=be(t[0],0)+"",F,x,j,z,G=be(t[0],101)+"",V,W,U=be(t[0],100)+"",K;return{c(){e=m("optgroup"),l=m("option"),i=S(n),o=m("option"),a=S(u),c=m("option"),_=S(f),p=m("option"),v=S(b),d=h(),M=m("optgroup"),y=m("option"),N=S(T),E=m("option"),P=S(B),L=m("option"),F=S(O),x=h(),j=m("optgroup"),z=m("option"),V=S(G),W=m("option"),K=S(U),l.__value=7,l.value=l.__value,o.__value=5,o.value=o.__value,c.__value=4,c.value=c.__value,p.__value=3,p.value=p.__value,r(e,"label","amsleser.no"),y.__value=2,y.value=y.__value,E.__value=1,E.value=E.__value,L.__value=0,L.value=L.__value,r(M,"label","Custom hardware"),z.__value=101,z.value=z.__value,W.__value=100,W.value=W.__value,r(j,"label","Generic hardware")},m(H,Y){$(H,e,Y),s(e,l),s(l,i),s(e,o),s(o,a),s(e,c),s(c,_),s(e,p),s(p,v),$(H,d,Y),$(H,M,Y),s(M,y),s(y,N),s(M,E),s(E,P),s(M,L),s(L,F),$(H,x,Y),$(H,j,Y),s(j,z),s(z,V),s(j,W),s(W,K)},p(H,Y){Y&1&&n!==(n=be(H[0],7)+"")&&X(i,n),Y&1&&u!==(u=be(H[0],5)+"")&&X(a,u),Y&1&&f!==(f=be(H[0],4)+"")&&X(_,f),Y&1&&b!==(b=be(H[0],3)+"")&&X(v,b),Y&1&&T!==(T=be(H[0],2)+"")&&X(N,T),Y&1&&B!==(B=be(H[0],1)+"")&&X(P,B),Y&1&&O!==(O=be(H[0],0)+"")&&X(F,O),Y&1&&G!==(G=be(H[0],101)+"")&&X(V,G),Y&1&&U!==(U=be(H[0],100)+"")&&X(K,U)},d(H){H&&C(e),H&&C(d),H&&C(M),H&&C(x),H&&C(j)}}}function Kf(t){let e,l,n=be(t[0],201)+"",i,o,u=be(t[0],202)+"",a,c,f=be(t[0],203)+"",_,p,b=be(t[0],200)+"",v;return{c(){e=m("optgroup"),l=m("option"),i=S(n),o=m("option"),a=S(u),c=m("option"),_=S(f),p=m("option"),v=S(b),l.__value=201,l.value=l.__value,o.__value=202,o.value=o.__value,c.__value=203,c.value=c.__value,p.__value=200,p.value=p.__value,r(e,"label","Generic hardware")},m(d,M){$(d,e,M),s(e,l),s(l,i),s(e,o),s(o,a),s(e,c),s(c,_),s(e,p),s(p,v)},p(d,M){M&1&&n!==(n=be(d[0],201)+"")&&X(i,n),M&1&&u!==(u=be(d[0],202)+"")&&X(a,u),M&1&&f!==(f=be(d[0],203)+"")&&X(_,f),M&1&&b!==(b=be(d[0],200)+"")&&X(v,b)},d(d){d&&C(e)}}}function Yf(t){let e,l,n=be(t[0],7)+"",i,o,u=be(t[0],6)+"",a,c,f=be(t[0],5)+"",_,p,b,v,d=be(t[0],51)+"",M,y,T=be(t[0],50)+"",N;return{c(){e=m("optgroup"),l=m("option"),i=S(n),o=m("option"),a=S(u),c=m("option"),_=S(f),p=h(),b=m("optgroup"),v=m("option"),M=S(d),y=m("option"),N=S(T),l.__value=7,l.value=l.__value,o.__value=6,o.value=o.__value,c.__value=5,c.value=c.__value,r(e,"label","amsleser.no"),v.__value=51,v.value=v.__value,y.__value=50,y.value=y.__value,r(b,"label","Generic hardware")},m(E,B){$(E,e,B),s(e,l),s(l,i),s(e,o),s(o,a),s(e,c),s(c,_),$(E,p,B),$(E,b,B),s(b,v),s(v,M),s(b,y),s(y,N)},p(E,B){B&1&&n!==(n=be(E[0],7)+"")&&X(i,n),B&1&&u!==(u=be(E[0],6)+"")&&X(a,u),B&1&&f!==(f=be(E[0],5)+"")&&X(_,f),B&1&&d!==(d=be(E[0],51)+"")&&X(M,d),B&1&&T!==(T=be(E[0],50)+"")&&X(N,T)},d(E){E&&C(e),E&&C(p),E&&C(b)}}}function Qf(t){let e,l,n=be(t[0],8)+"",i,o,u,a,c=be(t[0],71)+"",f,_,p=be(t[0],70)+"",b;return{c(){e=m("optgroup"),l=m("option"),i=S(n),o=h(),u=m("optgroup"),a=m("option"),f=S(c),_=m("option"),b=S(p),l.__value=8,l.value=l.__value,r(e,"label","Custom hardware"),a.__value=71,a.value=a.__value,_.__value=70,_.value=_.__value,r(u,"label","Generic hardware")},m(v,d){$(v,e,d),s(e,l),s(l,i),$(v,o,d),$(v,u,d),s(u,a),s(a,f),s(u,_),s(_,b)},p(v,d){d&1&&n!==(n=be(v[0],8)+"")&&X(i,n),d&1&&c!==(c=be(v[0],71)+"")&&X(f,c),d&1&&p!==(p=be(v[0],70)+"")&&X(b,p)},d(v){v&&C(e),v&&C(o),v&&C(u)}}}function Xf(t){let e,l,n=be(t[0],200)+"",i;return{c(){e=m("optgroup"),l=m("option"),i=S(n),l.__value=200,l.value=l.__value,r(e,"label","Generic hardware")},m(o,u){$(o,e,u),s(e,l),s(l,i)},p(o,u){u&1&&n!==(n=be(o[0],200)+"")&&X(i,n)},d(o){o&&C(e)}}}function Op(t){let e,l,n,i,o,u,a,c=t[0]=="esp8266"&&Vf(t),f=t[0]=="esp32"&&Kf(t),_=t[0]=="esp32s2"&&Yf(t),p=t[0]=="esp32c3"&&Qf(t),b=t[0]=="esp32solo"&&Xf(t);return{c(){e=m("option"),l=h(),c&&c.c(),n=h(),f&&f.c(),i=h(),_&&_.c(),o=h(),p&&p.c(),u=h(),b&&b.c(),a=Ve(),e.__value=-1,e.value=e.__value},m(v,d){$(v,e,d),$(v,l,d),c&&c.m(v,d),$(v,n,d),f&&f.m(v,d),$(v,i,d),_&&_.m(v,d),$(v,o,d),p&&p.m(v,d),$(v,u,d),b&&b.m(v,d),$(v,a,d)},p(v,[d]){v[0]=="esp8266"?c?c.p(v,d):(c=Vf(v),c.c(),c.m(n.parentNode,n)):c&&(c.d(1),c=null),v[0]=="esp32"?f?f.p(v,d):(f=Kf(v),f.c(),f.m(i.parentNode,i)):f&&(f.d(1),f=null),v[0]=="esp32s2"?_?_.p(v,d):(_=Yf(v),_.c(),_.m(o.parentNode,o)):_&&(_.d(1),_=null),v[0]=="esp32c3"?p?p.p(v,d):(p=Qf(v),p.c(),p.m(u.parentNode,u)):p&&(p.d(1),p=null),v[0]=="esp32solo"?b?b.p(v,d):(b=Xf(v),b.c(),b.m(a.parentNode,a)):b&&(b.d(1),b=null)},i:fe,o:fe,d(v){v&&C(e),v&&C(l),c&&c.d(v),v&&C(n),f&&f.d(v),v&&C(i),_&&_.d(v),v&&C(o),p&&p.d(v),v&&C(u),b&&b.d(v),v&&C(a)}}}function Fp(t,e,l){let{chip:n}=e;return t.$$set=i=>{"chip"in i&&l(0,n=i.chip)},[n]}class qp extends Ee{constructor(e){super(),Pe(this,e,Fp,Op,Ne,{chip:0})}}function Zf(t){let e;return{c(){e=m("div"),e.textContent="WARNING: Changing this configuration will affect basic configuration of your device. Only make changes here if instructed by vendor",r(e,"class","bd-red")},m(l,n){$(l,e,n)},d(l){l&&C(e)}}}function Jf(t){let e,l,n,i,o,u,a;return u=new Yc({props:{chip:t[0].chip}}),{c(){e=m("div"),l=S("HAN GPIO"),n=m("br"),i=h(),o=m("select"),ie(u.$$.fragment),r(o,"name","vh"),r(o,"class","in-s"),r(e,"class","my-3")},m(c,f){$(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),le(u,o,null),a=!0},p(c,f){const _={};f&1&&(_.chip=c[0].chip),u.$set(_)},i(c){a||(D(u.$$.fragment,c),a=!0)},o(c){q(u.$$.fragment,c),a=!1},d(c){c&&C(e),ne(u)}}}function Bp(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,M,y,T,N,E,B,P,L,O,F,x,j,z,G,V,W=t[0].usrcfg&&Zf();d=new qp({props:{chip:t[0].chip}});let U=t[0].board&&t[0].board>20&&Jf(t);return j=new It({props:{active:t[1],message:"Saving device configuration"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),o=h(),u=m("strong"),u.textContent="Initial configuration",a=h(),W&&W.c(),c=h(),f=m("div"),_=S("Board type"),p=m("br"),b=h(),v=m("select"),ie(d.$$.fragment),M=h(),U&&U.c(),y=h(),T=m("div"),N=m("label"),E=m("input"),B=S(" Clear all other configuration"),P=h(),L=m("div"),L.innerHTML='',O=h(),F=m("span"),F.textContent="\xA0",x=h(),ie(j.$$.fragment),r(i,"type","hidden"),r(i,"name","v"),i.value="true",r(u,"class","text-sm"),r(v,"name","vb"),r(v,"class","in-s"),t[0].board===void 0&&tt(()=>t[4].call(v)),r(f,"class","my-3"),r(E,"type","checkbox"),r(E,"name","vr"),E.__value="true",E.value=E.__value,r(E,"class","rounded mb-1"),r(T,"class","my-3"),r(L,"class","my-3"),r(F,"class","clear-both"),r(n,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(K,H){$(K,e,H),s(e,l),s(l,n),s(n,i),s(n,o),s(n,u),s(n,a),W&&W.m(n,null),s(n,c),s(n,f),s(f,_),s(f,p),s(f,b),s(f,v),le(d,v,null),qe(v,t[0].board,!0),s(n,M),U&&U.m(n,null),s(n,y),s(n,T),s(T,N),s(N,E),E.checked=t[2],s(N,B),s(n,P),s(n,L),s(n,O),s(n,F),$(K,x,H),le(j,K,H),z=!0,G||(V=[ee(v,"change",t[4]),ee(E,"change",t[5]),ee(n,"submit",Ms(t[3]))],G=!0)},p(K,[H]){K[0].usrcfg?W||(W=Zf(),W.c(),W.m(n,c)):W&&(W.d(1),W=null);const Y={};H&1&&(Y.chip=K[0].chip),d.$set(Y),H&1&&qe(v,K[0].board),K[0].board&&K[0].board>20?U?(U.p(K,H),H&1&&D(U,1)):(U=Jf(K),U.c(),D(U,1),U.m(n,y)):U&&(De(),q(U,1,1,()=>{U=null}),Ie()),H&4&&(E.checked=K[2]);const Z={};H&2&&(Z.active=K[1]),j.$set(Z)},i(K){z||(D(d.$$.fragment,K),D(U),D(j.$$.fragment,K),z=!0)},o(K){q(d.$$.fragment,K),q(U),q(j.$$.fragment,K),z=!1},d(K){K&&C(e),W&&W.d(),ne(d),U&&U.d(),K&&C(x),ne(j,K),G=!1,ze(V)}}}function Up(t,e,l){let{sysinfo:n={}}=e,i=!1;async function o(f){l(1,i=!0);const _=new FormData(f.target),p=new URLSearchParams;for(let d of _){const[M,y]=d;p.append(M,y)}let v=await(await fetch("/save",{method:"POST",body:p})).json();l(1,i=!1),jt.update(d=>(d.vndcfg=v.success,d.booting=v.reboot,d)),oi(n.usrcfg?"/":"/setup")}let u=!1;function a(){n.board=dt(this),l(0,n)}function c(){u=this.checked,l(2,u),l(0,n)}return t.$$set=f=>{"sysinfo"in f&&l(0,n=f.sysinfo)},t.$$.update=()=>{t.$$.dirty&1&&l(2,u=!n.usrcfg)},[n,i,u,o,a,c]}class jp extends Ee{constructor(e){super(),Pe(this,e,Up,Bp,Ne,{sysinfo:0})}}function xf(t){let e,l,n,i,o,u,a,c;return a=new Qc({}),{c(){e=m("br"),l=h(),n=m("div"),i=m("input"),o=h(),u=m("select"),ie(a.$$.fragment),r(i,"name","si"),r(i,"type","text"),r(i,"class","in-f w-full"),i.required=t[1],r(u,"name","su"),r(u,"class","in-l"),u.required=t[1],r(n,"class","flex")},m(f,_){$(f,e,_),$(f,l,_),$(f,n,_),s(n,i),s(n,o),s(n,u),le(a,u,null),c=!0},p(f,_){(!c||_&2)&&(i.required=f[1]),(!c||_&2)&&(u.required=f[1])},i(f){c||(D(a.$$.fragment,f),c=!0)},o(f){q(a.$$.fragment,f),c=!1},d(f){f&&C(e),f&&C(l),f&&C(n),ne(a)}}}function ec(t){let e;return{c(){e=m("div"),e.innerHTML=`
Gateway
+Occurred in: ${i}`:"",a=ko(t),u=fc(e)?e(a):e;return`<${a}> ${u}${o}`}const Mc=t=>(...e)=>t(N0(...e)),$c=Mc(t=>{throw new Error(t)}),ys=Mc(console.warn),Ua=4,A0=3,P0=2,E0=1,D0=1;function I0(t,e){const l=t.default?0:ml(t.fullPath).reduce((n,i)=>{let o=n;return o+=Ua,g0(i)?o+=D0:k0(i)?o+=P0:bc(i)?o-=Ua+E0:o+=A0,o},0);return{route:t,score:l,index:e}}function R0(t){return t.map(I0).sort((e,l)=>e.scorel.score?-1:e.index-l.index)}function Sc(t,e){let l,n;const[i]=e.split("?"),o=ml(i),a=o[0]==="",u=R0(t);for(let c=0,f=u.length;c({..._,params:b,uri:$});if(_.default){n=v(e);continue}const d=ml(_.fullPath),S=Math.max(o.length,d.length);let w=0;for(;w{f===".."?c.pop():f!=="."&&c.push(f)}),Ks(`/${c.join("/")}`,n)}function ja(t,e){const{pathname:l,hash:n="",search:i="",state:o}=t,a=ml(e,!0),u=ml(l,!0);for(;a.length;)a[0]!==u[0]&&$c(mn,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),a.shift(),u.shift();return{pathname:Ai(...u),hash:n,search:i,state:o}}const Ha=t=>t.length===1?"":t,wo=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,o=i?Ha(wi(t,l)):"",a=i?wi(t,0,l):t,u=n?Ha(wi(a,e)):"";return{pathname:(n?wi(a,0,e):a)||"/",search:u,hash:o}},O0=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function F0(t,e,l){return Ai(l,L0(t,e))}function q0(t,e){const l=bo(w0(t)),n=ml(l,!0),i=ml(e,!0).slice(0,n.length),o=Tc({fullPath:l},Ai(...i));return o&&o.uri}const Ys="POP",B0="PUSH",U0="REPLACE";function Qs(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function j0(t){let e=[],l=Qs(t),n=Ys;const i=(o=e)=>o.forEach(a=>a({location:l,action:n}));return{get location(){return l},listen(o){e.push(o);const a=()=>{l=Qs(t),n=Ys,i([o])};i([o]);const u=pc(t,"popstate",a);return()=>{u(),e=e.filter(c=>c!==o)}},navigate(o,a){const{state:u={},replace:c=!1}=a||{};if(n=c?U0:B0,cc(o))a&&ys(Cc,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=Ys,t.history.go(o);else{const f={...u,_key:d0()};try{t.history[c?"replaceState":"pushState"](f,"",o)}catch{t.location[c?"replace":"assign"](o)}}l=Qs(t),i()}}}function Xs(t,e){return{...wo(e),state:t}}function H0(t="/"){let e=0,l=[Xs(null,t)];return{get entries(){return l},get location(){return l[e]},addEventListener(){},removeEventListener(){},history:{get state(){return l[e].state},pushState(n,i,o){e++,l=l.slice(0,e),l.push(Xs(n,o))},replaceState(n,i,o){l[e]=Xs(n,o)},go(n){const i=e+n;i<0||i>l.length-1||(e=i)}}}}const W0=!!(!Ul&&window.document&&window.document.createElement),z0=!Ul&&window.location.origin==="null",Nc=j0(W0&&!z0?window:H0()),{navigate:oi}=Nc;let Sl=null,Ac=!0;function G0(t,e){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;nSl.level||t.level===Sl.level&&G0(t.routerId,Sl.routerId))&&(Sl=t)}function K0(){Sl=null}function Y0(){Ac=!1}function Wa(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=pc(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function Q0(t,e){return Number(t.dataset.svnavRouteEnd)===e}function X0(t){return/^H[1-6]$/i.test(t.tagName)}function za(t,e=document){return e.querySelector(t)}function Z0(t){let l=za(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!Q0(l,t);){if(X0(l))return l;const n=za("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function J0(t){Promise.resolve(ai(t.focusElement)).then(e=>{const l=e||Z0(t.id);l||ys(mn,`Could not find an element to focus. You should always render a header for accessibility reasons, or set a custom focus element via the "useFocus" hook. If you don't want this Route or Router to manage focus, pass "primary={false}" to it.`,t,Ss),!Wa(l)&&Wa(document.documentElement)})}const x0=(t,e,l)=>(n,i)=>f0().then(()=>{if(!Sl||Ac){Y0();return}if(n&&J0(Sl.route),t.announcements&&i){const{path:o,fullPath:a,meta:u,params:c,uri:f}=Sl.route,_=t.createAnnouncement({path:o,fullPath:a,meta:u,params:c,uri:f},ai(l));Promise.resolve(_).then(p=>{e.set(p)})}K0()}),e1="position:fixed;top:-1px;left:0;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;";function t1(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},_c(t[6],e1)],i={};for(let o=0;o`Navigated to ${ue.uri}`,announcements:!0,...d},$=_,N=bo(_),E=Bl(to),B=Bl(fi),P=!E,L=n1(),O=v&&!(B&&!B.manageFocus),F=at("");ul(t,F,ue=>l(0,u=ue));const x=B?B.disableInlineStyles:S,j=at([]);ul(t,j,ue=>l(20,a=ue));const z=at(null);ul(t,z,ue=>l(18,i=ue));let G=!1;const V=P?0:B.level+1,U=P?at((()=>ja(Ul?wo(p):b.location,N))()):E;ul(t,U,ue=>l(17,n=ue));const K=at(n);ul(t,K,ue=>l(19,o=ue));const H=x0(w,F,U),Y=ue=>ke=>ke.filter(me=>me.id!==ue);function Z(ue){if(Ul){if(G)return;const ke=Tc(ue,n.pathname);if(ke)return G=!0,ke}else j.update(ke=>{const me=Y(ue.id)(ke);return me.push(ue),me})}function re(ue){j.update(Y(ue))}return!P&&_!==Ga&&ys(mn,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:_}),P&&(sc(()=>b.listen(ke=>{const me=ja(ke.location,N);K.set(n),U.set(me)})),$i(to,U)),$i(fi,{activeRoute:z,registerRoute:Z,unregisterRoute:re,manageFocus:O,level:V,id:L,history:P?b:B.history,basepath:P?N:B.basepath,disableInlineStyles:x}),t.$$set=ue=>{"basepath"in ue&&l(11,_=ue.basepath),"url"in ue&&l(12,p=ue.url),"history"in ue&&l(13,b=ue.history),"primary"in ue&&l(14,v=ue.primary),"a11y"in ue&&l(15,d=ue.a11y),"disableInlineStyles"in ue&&l(16,S=ue.disableInlineStyles),"$$scope"in ue&&l(21,f=ue.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&_!==$&&ys(mn,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const ue=Sc(a,n.pathname);z.set(ue)}if(t.$$.dirty[0]&655360&&P){const ue=!!n.hash,ke=!ue&&O,me=!ue||n.pathname!==o.pathname;H(ke,me)}t.$$.dirty[0]&262144&&O&&i&&i.primary&&V0({level:V,routerId:L,route:i})},[u,w,P,L,O,F,x,j,z,U,K,_,p,b,v,d,S,n,i,o,a,f,c]}class s1 extends Ee{constructor(e){super(),Pe(this,e,i1,l1,Ne,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}const Pc=s1;function Pi(t,e,l=fi,n=mn){Bl(l)||$c(t,o=>`You cannot use ${o} outside of a ${ko(n)}.`,e)}const o1=t=>{const{subscribe:e}=Bl(t);return{subscribe:e}};function Ec(){return Pi(kc),o1(to)}function Dc(){const{history:t}=Bl(fi);return t}function Ic(){const t=Bl(vc);return t?v0(t,e=>e.base):at("/")}function Rc(){Pi(yc);const t=Ic(),{basepath:e}=Bl(fi);return n=>F0(n,ai(t),e)}function r1(){Pi(wc);const t=Rc(),{navigate:e}=Dc();return(n,i)=>{const o=cc(n)?n:t(n);return e(o,i)}}const a1=t=>({params:t&16,location:t&8}),Va=t=>({params:Ul?ai(t[10]):t[4],location:t[3],navigate:t[11]});function Ka(t){let e,l;return e=new Pc({props:{primary:t[1],$$slots:{default:[c1]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.primary=n[1]),i&528409&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function u1(t){let e;const l=t[18].default,n=po(l,t,t[19],Va);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&524312)&&vo(n,l,i,i[19],e?_o(l,i[19],o,a1):ho(i[19]),Va)},i(i){e||(D(n,i),e=!0)},o(i){q(n,i),e=!1},d(i){n&&n.d(i)}}}function f1(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},Ul?ai(t[10]):t[4],t[12]];var o=t[0];function a(u){let c={};for(let f=0;f{ne(_,1)}),Ie()}o?(e=Oa(o,a()),ie(e.$$.fragment),D(e.$$.fragment,1),le(e,l.parentNode,l)):e=null}else o&&e.$set(f)},i(u){n||(e&&D(e.$$.fragment,u),n=!0)},o(u){e&&q(e.$$.fragment,u),n=!1},d(u){u&&C(l),e&&ne(e,u)}}}function c1(t){let e,l,n,i;const o=[f1,u1],a=[];function u(c,f){return c[0]!==null?0:1}return e=u(t),l=a[e]=o[e](t),{c(){l.c(),n=Ve()},m(c,f){a[e].m(c,f),M(c,n,f),i=!0},p(c,f){let _=e;e=u(c),e===_?a[e].p(c,f):(De(),q(a[_],1,1,()=>{a[_]=null}),Ie(),l=a[e],l?l.p(c,f):(l=a[e]=o[e](c),l.c()),D(l,1),l.m(n.parentNode,n))},i(c){i||(D(l),i=!0)},o(c){q(l),i=!1},d(c){a[e].d(c),c&&C(n)}}}function m1(t){let e,l,n,i,o,a=[eo(t[7]),{"data-svnav-route-start":t[5]}],u={};for(let p=0;p{c=null}),Ie())},i(p){o||(D(c),o=!0)},o(p){q(c),o=!1},d(p){p&&C(e),p&&C(l),c&&c.d(p),p&&C(n),p&&C(i)}}}const p1=mc();function _1(t,e,l){let n;const i=["path","component","meta","primary"];let o=ks(e,i),a,u,c,f,{$$slots:_={},$$scope:p}=e,{path:b=""}=e,{component:v=null}=e,{meta:d={}}=e,{primary:S=!0}=e;Pi(Ss,e);const w=p1(),{registerRoute:$,unregisterRoute:N,activeRoute:E,disableInlineStyles:B}=Bl(fi);ul(t,E,G=>l(16,a=G));const P=Ic();ul(t,P,G=>l(17,c=G));const L=Ec();ul(t,L,G=>l(3,u=G));const O=at(null);let F;const x=at(),j=at({});ul(t,j,G=>l(4,f=G)),$i(vc,x),$i(h0,j),$i(b0,O);const z=r1();return Ul||a0(()=>N(w)),t.$$set=G=>{l(24,e=xt(xt({},e),gs(G))),l(12,o=ks(e,i)),"path"in G&&l(13,b=G.path),"component"in G&&l(0,v=G.component),"meta"in G&&l(14,d=G.meta),"primary"in G&&l(1,S=G.primary),"$$scope"in G&&l(19,p=G.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const G=b==="",V=Ai(c,b),W={id:w,path:b,meta:d,default:G,fullPath:G?"":V,base:G?c:q0(V,u.pathname),primary:S,focusElement:O};x.set(W),l(15,F=$(W))}if(t.$$.dirty&98304&&l(2,n=!!(F||a&&a.id===w)),t.$$.dirty&98308&&n){const{params:G}=F||a;j.set(G)}},e=gs(e),[v,S,n,u,f,w,E,B,P,L,j,z,o,b,d,F,a,c,_,p]}class d1 extends Ee{constructor(e){super(),Pe(this,e,_1,m1,Ne,{path:13,component:0,meta:14,primary:1})}}const $l=d1;function v1(t){let e,l,n,i;const o=t[13].default,a=po(o,t,t[12],null);let u=[{href:t[0]},t[2],t[1]],c={};for(let f=0;fl(11,p=O));const E=u0(),B=Rc(),{navigate:P}=Dc();function L(O){E("click",O),_0(O)&&(O.preventDefault(),P(n,{state:w,replace:a||S}))}return t.$$set=O=>{l(19,e=xt(xt({},e),gs(O))),l(18,_=ks(e,f)),"to"in O&&l(5,d=O.to),"replace"in O&&l(6,S=O.replace),"state"in O&&l(7,w=O.state),"getProps"in O&&l(8,$=O.getProps),"$$scope"in O&&l(12,v=O.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=B(d,p)),t.$$.dirty&2049&&l(10,i=lo(p.pathname,n)),t.$$.dirty&2049&&l(9,o=n===p.pathname),t.$$.dirty&2049&&(a=wo(n)===O0(p)),t.$$.dirty&512&&l(2,u=o?{"aria-current":"page"}:{}),l(1,c=(()=>{if(fc($)){const O=$({location:p,href:n,isPartiallyCurrent:i,isCurrent:o});return{..._,...O}}return _})())},e=gs(e),[n,c,u,N,L,d,S,w,$,o,i,p,v,b]}class b1 extends Ee{constructor(e){super(),Pe(this,e,h1,v1,Ne,{to:5,replace:6,state:7,getProps:8})}}const el=b1;let no=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function ql(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function g1(t){return t>218&&t<242?"#32d900":t>212&&t<248?"#b1d900":t>208&&t<252?"#ffb800":"#d90000"}function Lc(t,e){let l;return t>90?l="#d90000":t>85?l="#e32100":t>80?l="#ffb800":t>75?l="#dcd800":l="#32d900",l+(e?"88":"")}function k1(t){return t>75?"#32d900":t>50?"#77d900":t>25?"#94d900":"#dcd800"}function Cs(t){switch(t){case 1:return"Aidon";case 2:return"Kaifa";case 3:return"Kamstrup";case 8:return"Iskra";case 9:return"Landis+Gyr";case 10:return"Sagemcom";default:return"Unknown"}}function Oe(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function be(t,e){switch(e){case 5:switch(t){case"esp8266":return"Pow-K (GPIO12)";case"esp32s2":return"Pow-K+"}case 7:switch(t){case"esp8266":return"Pow-U (GPIO12)";case"esp32s2":return"Pow-U+"}case 6:return"Pow-P1";case 51:return"Wemos S2 mini";case 50:return"Generic ESP32-S2";case 201:return"Wemos LOLIN D32";case 202:return"Adafruit HUZZAH32";case 203:return"DevKitC";case 200:return"Generic ESP32";case 2:return"HAN Reader 2.0 by Max Spencer";case 0:return"Custom hardware by Roar Fredriksen";case 1:return"Kamstrup module by Egil Opsahl";case 8:return"\xB5HAN mosquito by dbeinder";case 3:return"Pow-K (UART0)";case 4:return"Pow-U (UART0)";case 101:return"Wemos D1 mini";case 100:return"Generic ESP8266";case 70:return"Generic ESP32-C3";case 71:return"ESP32-C3-DevKitM-1"}}function Ya(t){switch(t){case-1:return"Parse error";case-2:return"Incomplete data received";case-3:return"Payload boundry flag missing";case-4:return"Header checksum error";case-5:return"Footer checksum error";case-9:return"Unknown data received, check meter config";case-41:return"Frame length not equal";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid";case 90:return"No HAN data received for at least 30s";case 91:return"Serial break";case 92:return"Serial buffer full";case 93:return"Serial FIFO overflow";case 94:return"Serial frame error";case 95:return"Serial parity error";case 96:return"RX error";case 98:return"Exception in code, debugging necessary";case 99:return"Autodetection failed"}return t<0?"Unspecified error "+t:""}function Qa(t){switch(t){case-3:return"Connection failed";case-4:return"Network timeout";case-10:return"Connection denied";case-11:return"Failed to subscribe";case-13:return"Connection lost"}return t<0?"Unspecified error "+t:""}function Xa(t){switch(t){case 400:return"Unrecognized data in request";case 401:case 403:return"Unauthorized, check API key";case 404:return"Price unavailable, not found";case 425:return"Server says its too early";case 429:return"Exceeded API rate limit";case 500:return"Internal server error";case-1:return"Connection error";case-2:return"Incomplete data received";case-3:return"Invalid data, tag missing";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid"}return t<0?"Unspecified error "+t:""}function ri(t){switch(t){case 2:case 4:case 7:return!0}return!1}function Ke(t,e){return t==1||t==2&&e}function Ut(t){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+t}function ge(t,e){return isNaN(t)?"-":(isNaN(e)&&(e=t<10?1:0),t.toFixed(e))}function fl(t,e){return t.setTime(t.getTime()+e*36e5),t}function Za(t){if(t.chip=="esp8266")switch(t.boot_reason){case 0:return"Normal";case 1:return"WDT reset";case 2:return"Exception reset";case 3:return"Soft WDT reset";case 4:return"Software restart";case 5:return"Deep sleep";case 6:return"External reset";default:return"Unknown (8266)"}else switch(t.boot_reason){case 1:return"Vbat power on reset";case 3:return"Software reset";case 4:return"WDT reset";case 5:return"Deep sleep";case 6:return"SLC reset";case 7:return"Timer Group0 WDT reset";case 8:return"Timer Group1 WDT reset";case 9:return"RTC WDT reset";case 10:return"Instrusion test reset CPU";case 11:return"Time Group reset CPU";case 12:return"Software reset CPU";case 13:return"RTC WTD reset CPU";case 14:return"PRO CPU";case 15:return"Brownout";case 16:return"RTC reset";default:return"Unknown"}}function Ja(t){return t=="EOE"?"ENTSO-E":t=="HKS"?"hvakosterstrommen.no":t=="EDS"?"Energy Data Service":t=="MIX"?"Mixed sources":"Unknown ("+t+")"}async function jl(t,e={}){const{timeout:l=8e3}=e,n=new AbortController,i=setTimeout(()=>n.abort(),l),o=await fetch(t,{...e,signal:n.signal});return clearTimeout(i),o}let al={version:"",chip:"",mac:null,apmac:null,vndcfg:null,usrcfg:null,fwconsent:null,booting:!1,upgrading:!1,ui:{},security:0,boot_reason:0,upgrade:{x:-1,e:0,f:null,t:null},trying:null};const jt=at(al);async function yo(){al=await(await jl("/sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),jt.set(al)}let vs=0,xa=-127,eu=null,w1={};const y1=dc(w1,t=>{let e;async function l(){jl("/data.json").then(n=>n.json()).then(n=>{t(n),xa!=n.t&&(xa=n.t,setTimeout(Uc,2e3)),eu==null&&n.pe&&n.p!=null&&(eu=n.p,Fc()),al.upgrading?window.location.reload():(!al||!al.chip||al.booting||vs>1&&!ri(al.board))&&(yo(),an&&clearTimeout(an),an=setTimeout(Mo,2e3),un&&clearTimeout(un),un=setTimeout($o,3e3));let i=5e3;if(ri(al.board)&&n.v>2.5){let o=3.3-Math.min(3.3,n.v);o>0&&(i=Math.max(o,.1)*10*5e3)}i>5e3&&console.log("Scheduling next data fetch in "+i+"ms"),e&&clearTimeout(e),e=setTimeout(l,i),vs=0}).catch(n=>{vs++,vs>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(l,15e3)):e=setTimeout(l,ri(al.board)?1e4:5e3)})}return l(),function(){clearTimeout(e)}});let io={},yi;const Co=at(io);async function Oc(){let t=!1;if(Co.update(e=>{for(var l=0;l<36;l++){if(e[Oe(l)]==null){t=l<12;break}e[Oe(l)]=e[Oe(l+1)]}return e}),t)Fc();else{let e=new Date;yi=setTimeout(Oc,(60-e.getMinutes())*6e4)}}async function Fc(){yi&&(clearTimeout(yi),yi=0),io=await(await jl("/energyprice.json")).json(),Co.set(io);let e=new Date;yi=setTimeout(Oc,(60-e.getMinutes())*6e4)}let so={},an;async function Mo(){an&&(clearTimeout(an),an=0),so=await(await jl("/dayplot.json")).json(),qc.set(so);let e=new Date;an=setTimeout(Mo,(60-e.getMinutes())*6e4+20)}const qc=at(so,t=>(Mo(),function(){}));let oo={},un;async function $o(){un&&(clearTimeout(un),un=0),oo=await(await jl("/monthplot.json")).json(),Bc.set(oo);let e=new Date;un=setTimeout($o,(24-e.getHours())*36e5+40)}const Bc=at(oo,t=>($o(),function(){}));let ro={};async function Uc(){ro=await(await jl("/temperature.json")).json(),jc.set(ro)}const jc=at(ro,t=>(Uc(),function(){}));let ao={},hs;async function Hc(){hs&&(clearTimeout(hs),hs=0),ao=await(await jl("/tariff.json")).json(),Wc.set(ao);let e=new Date;hs=setTimeout(Hc,(60-e.getMinutes())*6e4+30)}const Wc=at(ao,t=>function(){});let uo=[];const So=at(uo);async function C1(){uo=await(await jl("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),So.set(uo)}function Ms(t){return"WARNING: "+t+" must be connected to an external power supply during firmware upgrade. Failure to do so may cause power-down during upload resulting in non-functioning unit."}async function zc(t){await(await fetch("/upgrade?expected_version="+t,{method:"POST"})).json()}function Gc(t,e){if(/^v\d{1,2}\.\d{1,2}\.\d{1,2}$/.test(t)){let l=t.substring(1).split("."),n=parseInt(l[0]),i=parseInt(l[1]),o=parseInt(l[2]),a=[...e];a.reverse();let u,c,f;for(let _=0;_o&&(u=p):S==i+1&&(c=p);else if(d==n+1)if(f){let $=f.tag_name.substring(1).split(".");parseInt($[0]);let N=parseInt($[1]);parseInt($[2]),S==N&&(f=p)}else f=p}return c||f||u||!1}else return e[0]}const M1="/github.svg";function tu(t){let e,l;function n(a,u){return a[1]>1?E1:a[1]>0?P1:a[2]>1?A1:a[2]>0?N1:a[3]>1?T1:a[3]>0?S1:$1}let i=n(t),o=i(t);return{c(){e=T(`Up + `),o.c(),l=Ve()},m(a,u){M(a,e,u),o.m(a,u),M(a,l,u)},p(a,u){i===(i=n(a))&&o?o.p(a,u):(o.d(1),o=i(a),o&&(o.c(),o.m(l.parentNode,l)))},d(a){a&&C(e),o.d(a),a&&C(l)}}}function $1(t){let e,l;return{c(){e=T(t[0]),l=T(" seconds")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&1&&X(e,n[0])},d(n){n&&C(e),n&&C(l)}}}function S1(t){let e,l;return{c(){e=T(t[3]),l=T(" minute")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&8&&X(e,n[3])},d(n){n&&C(e),n&&C(l)}}}function T1(t){let e,l;return{c(){e=T(t[3]),l=T(" minutes")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&8&&X(e,n[3])},d(n){n&&C(e),n&&C(l)}}}function N1(t){let e,l;return{c(){e=T(t[2]),l=T(" hour")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&4&&X(e,n[2])},d(n){n&&C(e),n&&C(l)}}}function A1(t){let e,l;return{c(){e=T(t[2]),l=T(" hours")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&4&&X(e,n[2])},d(n){n&&C(e),n&&C(l)}}}function P1(t){let e,l;return{c(){e=T(t[1]),l=T(" day")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&2&&X(e,n[1])},d(n){n&&C(e),n&&C(l)}}}function E1(t){let e,l;return{c(){e=T(t[1]),l=T(" days")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&2&&X(e,n[1])},d(n){n&&C(e),n&&C(l)}}}function D1(t){let e,l=t[0]&&tu(t);return{c(){l&&l.c(),e=Ve()},m(n,i){l&&l.m(n,i),M(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=tu(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:fe,o:fe,d(n){l&&l.d(n),n&&C(e)}}}function I1(t,e,l){let{epoch:n}=e,i=0,o=0,a=0;return t.$$set=u=>{"epoch"in u&&l(0,n=u.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(l(1,i=Math.floor(n/86400)),l(2,o=Math.floor(n/3600)),l(3,a=Math.floor(n/60)))},[n,i,o,a]}class R1 extends Ee{constructor(e){super(),Pe(this,e,I1,D1,Ne,{epoch:0})}}function L1(t){let e,l,n;return{c(){e=m("span"),l=T(t[2]),r(e,"title",t[1]),r(e,"class",n="bd-"+t[0])},m(i,o){M(i,e,o),s(e,l)},p(i,[o]){o&4&&X(l,i[2]),o&2&&r(e,"title",i[1]),o&1&&n!==(n="bd-"+i[0])&&r(e,"class",n)},i:fe,o:fe,d(i){i&&C(e)}}}function O1(t,e,l){let{color:n}=e,{title:i}=e,{text:o}=e;return t.$$set=a=>{"color"in a&&l(0,n=a.color),"title"in a&&l(1,i=a.title),"text"in a&&l(2,o=a.text)},[n,i,o]}class fn extends Ee{constructor(e){super(),Pe(this,e,O1,L1,Ne,{color:0,title:1,text:2})}}function F1(t){let e,l=`${Oe(t[0].getDate())}.${Oe(t[0].getMonth()+1)}.${t[0].getFullYear()} ${Oe(t[0].getHours())}:${Oe(t[0].getMinutes())}`,n;return{c(){e=m("span"),n=T(l),r(e,"class",t[1])},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=`${Oe(i[0].getDate())}.${Oe(i[0].getMonth()+1)}.${i[0].getFullYear()} ${Oe(i[0].getHours())}:${Oe(i[0].getMinutes())}`)&&X(n,l),o&2&&r(e,"class",i[1])},d(i){i&&C(e)}}}function q1(t){let e=`${Oe(t[0].getDate())}. ${no[t[0].getMonth()]} ${Oe(t[0].getHours())}:${Oe(t[0].getMinutes())}`,l;return{c(){l=T(e)},m(n,i){M(n,l,i)},p(n,i){i&1&&e!==(e=`${Oe(n[0].getDate())}. ${no[n[0].getMonth()]} ${Oe(n[0].getHours())}:${Oe(n[0].getMinutes())}`)&&X(l,e)},d(n){n&&C(l)}}}function B1(t){let e;function l(o,a){return o[2]?q1:F1}let n=l(t),i=n(t);return{c(){i.c(),e=Ve()},m(o,a){i.m(o,a),M(o,e,a)},p(o,[a]){n===(n=l(o))&&i?i.p(o,a):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},i:fe,o:fe,d(o){i.d(o),o&&C(e)}}}function U1(t,e,l){let{timestamp:n}=e,{fullTimeColor:i}=e,{offset:o}=e,a;return t.$$set=u=>{"timestamp"in u&&l(0,n=u.timestamp),"fullTimeColor"in u&&l(1,i=u.fullTimeColor),"offset"in u&&l(3,o=u.offset)},t.$$.update=()=>{t.$$.dirty&9&&(l(2,a=Math.abs(new Date().getTime()-n.getTime())<3e5),isNaN(o)||fl(n,o-(24+n.getHours()-n.getUTCHours())%24))},[n,i,a,o]}class Vc extends Ee{constructor(e){super(),Pe(this,e,U1,B1,Ne,{timestamp:0,fullTimeColor:1,offset:3})}}function j1(t){let e,l,n;return{c(){e=Fe("svg"),l=Fe("path"),n=Fe("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 011.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 01-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.397.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 01-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.505-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.107-1.204l-.527-.738a1.125 1.125 0 01.12-1.45l.773-.773a1.125 1.125 0 011.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894z"),r(n,"stroke-linecap","round"),r(n,"stroke-linejoin","round"),r(n,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(i,o){M(i,e,o),s(e,l),s(e,n)},p:fe,i:fe,o:fe,d(i){i&&C(e)}}}class H1 extends Ee{constructor(e){super(),Pe(this,e,null,j1,Ne,{})}}function W1(t){let e,l;return{c(){e=Fe("svg"),l=Fe("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(n,i){M(n,e,i),s(e,l)},p:fe,i:fe,o:fe,d(n){n&&C(e)}}}class z1 extends Ee{constructor(e){super(),Pe(this,e,null,W1,Ne,{})}}function G1(t){let e,l;return{c(){e=Fe("svg"),l=Fe("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(n,i){M(n,e,i),s(e,l)},p:fe,i:fe,o:fe,d(n){n&&C(e)}}}class Bt extends Ee{constructor(e){super(),Pe(this,e,null,G1,Ne,{})}}function V1(t){let e,l;return{c(){e=Fe("svg"),l=Fe("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M9 8.25H7.5a2.25 2.25 0 00-2.25 2.25v9a2.25 2.25 0 002.25 2.25h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25H15M9 12l3 3m0 0l3-3m-3 3V2.25"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(n,i){M(n,e,i),s(e,l)},p:fe,i:fe,o:fe,d(n){n&&C(e)}}}class Kc extends Ee{constructor(e){super(),Pe(this,e,null,V1,Ne,{})}}function K1(t){let e,l,n=t[1].version+"",i;return{c(){e=T("AMS reader "),l=m("span"),i=T(n)},m(o,a){M(o,e,a),M(o,l,a),s(l,i)},p(o,a){a&2&&n!==(n=o[1].version+"")&&X(i,n)},d(o){o&&C(e),o&&C(l)}}}function lu(t){let e,l=(t[0].t>-50?t[0].t.toFixed(1):"-")+"",n,i;return{c(){e=m("div"),n=T(l),i=T("\xB0C"),r(e,"class","flex-none my-auto")},m(o,a){M(o,e,a),s(e,n),s(e,i)},p(o,a){a&1&&l!==(l=(o[0].t>-50?o[0].t.toFixed(1):"-")+"")&&X(n,l)},d(o){o&&C(e)}}}function nu(t){let e,l="HAN: "+Ya(t[0].he),n;return{c(){e=m("div"),n=T(l),r(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="HAN: "+Ya(i[0].he))&&X(n,l)},d(i){i&&C(e)}}}function iu(t){let e,l="MQTT: "+Qa(t[0].me),n;return{c(){e=m("div"),n=T(l),r(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="MQTT: "+Qa(i[0].me))&&X(n,l)},d(i){i&&C(e)}}}function su(t){let e,l="PriceAPI: "+Xa(t[0].ee),n;return{c(){e=m("div"),n=T(l),r(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="PriceAPI: "+Xa(i[0].ee))&&X(n,l)},d(i){i&&C(e)}}}function ou(t){let e,l,n,i,o,a;return l=new el({props:{to:"/configuration",$$slots:{default:[Y1]},$$scope:{ctx:t}}}),o=new el({props:{to:"/status",$$slots:{default:[Q1]},$$scope:{ctx:t}}}),{c(){e=m("div"),ie(l.$$.fragment),n=h(),i=m("div"),ie(o.$$.fragment),r(e,"class","flex-none px-1 mt-1"),r(e,"title","Configuration"),r(i,"class","flex-none px-1 mt-1"),r(i,"title","Device information")},m(u,c){M(u,e,c),le(l,e,null),M(u,n,c),M(u,i,c),le(o,i,null),a=!0},i(u){a||(D(l.$$.fragment,u),D(o.$$.fragment,u),a=!0)},o(u){q(l.$$.fragment,u),q(o.$$.fragment,u),a=!1},d(u){u&&C(e),ne(l),u&&C(n),u&&C(i),ne(o)}}}function Y1(t){let e,l;return e=new H1({}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function Q1(t){let e,l;return e=new z1({}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function ru(t){let e,l,n,i,o;const a=[Z1,X1],u=[];function c(f,_){return f[1].security==0||f[0].a?0:1}return l=c(t),n=u[l]=a[l](t),{c(){e=m("div"),n.c(),r(e,"class","flex-none mr-3 text-yellow-500"),r(e,"title",i="New version: "+t[2].tag_name)},m(f,_){M(f,e,_),u[l].m(e,null),o=!0},p(f,_){let p=l;l=c(f),l===p?u[l].p(f,_):(De(),q(u[p],1,1,()=>{u[p]=null}),Ie(),n=u[l],n?n.p(f,_):(n=u[l]=a[l](f),n.c()),D(n,1),n.m(e,null)),(!o||_&4&&i!==(i="New version: "+f[2].tag_name))&&r(e,"title",i)},i(f){o||(D(n),o=!0)},o(f){q(n),o=!1},d(f){f&&C(e),u[l].d()}}}function X1(t){let e,l,n=t[2].tag_name+"",i;return{c(){e=m("span"),l=T("New version: "),i=T(n)},m(o,a){M(o,e,a),s(e,l),s(e,i)},p(o,a){a&4&&n!==(n=o[2].tag_name+"")&&X(i,n)},i:fe,o:fe,d(o){o&&C(e)}}}function Z1(t){let e,l,n,i=t[2].tag_name+"",o,a,u,c,f,_;return u=new Kc({}),{c(){e=m("button"),l=m("span"),n=T("New version: "),o=T(i),a=h(),ie(u.$$.fragment),r(l,"class","mt-1"),r(e,"class","flex")},m(p,b){M(p,e,b),s(e,l),s(l,n),s(l,o),s(e,a),le(u,e,null),c=!0,f||(_=ee(e,"click",t[3]),f=!0)},p(p,b){(!c||b&4)&&i!==(i=p[2].tag_name+"")&&X(o,i)},i(p){c||(D(u.$$.fragment,p),c=!0)},o(p){q(u.$$.fragment,p),c=!1},d(p){p&&C(e),ne(u),f=!1,_()}}}function J1(t){let e,l,n,i,o,a,u,c,f,_,p,b,v=(t[0].m?(t[0].m/1e3).toFixed(1):"-")+"",d,S,w,$,N,E,B,P,L,O,F,x,j,z,G,V,W,U,K,H,Y,Z,re,ue,ke,me,Se,je,Re,He;i=new el({props:{to:"/",$$slots:{default:[K1]},$$scope:{ctx:t}}}),c=new R1({props:{epoch:t[0].u}});let we=t[0].t>-50&&lu(t);N=new fn({props:{title:"ESP",text:t[1].booting?"Booting":t[0].v>2?t[0].v.toFixed(2)+"V":"ESP",color:ql(t[1].booting?2:t[0].em)}}),B=new fn({props:{title:"HAN",text:"HAN",color:ql(t[1].booting?9:t[0].hm)}}),L=new fn({props:{title:"WiFi",text:t[0].r?t[0].r.toFixed(0)+"dBm":"WiFi",color:ql(t[1].booting?9:t[0].wm)}}),F=new fn({props:{title:"MQTT",text:"MQTT",color:ql(t[1].booting?9:t[0].mm)}});let Te=(t[0].he<0||t[0].he>0)&&nu(t),Le=t[0].me<0&&iu(t),Me=(t[0].ee>0||t[0].ee<0)&&su(t);re=new Vc({props:{timestamp:t[0].c?new Date(t[0].c*1e3):new Date(0),offset:t[1].clock_offset,fullTimeColor:"text-red-500"}});let y=t[1].vndcfg&&t[1].usrcfg&&ou(t);je=new Bt({});let g=t[1].fwconsent===1&&t[2]&&ru(t);return{c(){e=m("nav"),l=m("div"),n=m("div"),ie(i.$$.fragment),o=h(),a=m("div"),u=m("div"),ie(c.$$.fragment),f=h(),we&&we.c(),_=h(),p=m("div"),b=T("Free mem: "),d=T(v),S=T("kb"),w=h(),$=m("div"),ie(N.$$.fragment),E=h(),ie(B.$$.fragment),P=h(),ie(L.$$.fragment),O=h(),ie(F.$$.fragment),x=h(),Te&&Te.c(),j=h(),Le&&Le.c(),z=h(),Me&&Me.c(),G=h(),V=m("div"),W=m("div"),U=m("a"),K=m("img"),Y=h(),Z=m("div"),ie(re.$$.fragment),ue=h(),y&&y.c(),ke=h(),me=m("div"),Se=m("a"),ie(je.$$.fragment),Re=h(),g&&g.c(),r(n,"class","flex text-lg text-gray-100 p-2"),r(u,"class","flex-none my-auto"),r(p,"class","flex-none my-auto"),r(a,"class","flex-none my-auto p-2 flex space-x-4"),r($,"class","flex-auto flex-wrap my-auto justify-center p-2"),r(K,"class","gh-logo"),Js(K.src,H=M1)||r(K,"src",H),r(K,"alt","GitHub repo"),r(U,"class","float-right"),r(U,"href","https://github.com/UtilitechAS/amsreader-firmware"),r(U,"target","_blank"),r(U,"rel","noreferrer"),r(U,"aria-label","GitHub"),r(W,"class","flex-none"),r(Z,"class","flex-none my-auto px-2"),r(Se,"href",Ut("")),r(Se,"target","_blank"),r(Se,"rel","noreferrer"),r(me,"class","flex-none px-1 mt-1"),r(me,"title","Documentation"),r(V,"class","flex-auto p-2 flex flex-row-reverse flex-wrap"),r(l,"class","flex flex-wrap space-x-4 text-sm text-gray-300"),r(e,"class","bg-violet-600 p-1 rounded-md mx-2")},m(k,A){M(k,e,A),s(e,l),s(l,n),le(i,n,null),s(l,o),s(l,a),s(a,u),le(c,u,null),s(a,f),we&&we.m(a,null),s(a,_),s(a,p),s(p,b),s(p,d),s(p,S),s(l,w),s(l,$),le(N,$,null),s($,E),le(B,$,null),s($,P),le(L,$,null),s($,O),le(F,$,null),s(l,x),Te&&Te.m(l,null),s(l,j),Le&&Le.m(l,null),s(l,z),Me&&Me.m(l,null),s(l,G),s(l,V),s(V,W),s(W,U),s(U,K),s(V,Y),s(V,Z),le(re,Z,null),s(V,ue),y&&y.m(V,null),s(V,ke),s(V,me),s(me,Se),le(je,Se,null),s(V,Re),g&&g.m(V,null),He=!0},p(k,[A]){const I={};A&18&&(I.$$scope={dirty:A,ctx:k}),i.$set(I);const Q={};A&1&&(Q.epoch=k[0].u),c.$set(Q),k[0].t>-50?we?we.p(k,A):(we=lu(k),we.c(),we.m(a,_)):we&&(we.d(1),we=null),(!He||A&1)&&v!==(v=(k[0].m?(k[0].m/1e3).toFixed(1):"-")+"")&&X(d,v);const J={};A&3&&(J.text=k[1].booting?"Booting":k[0].v>2?k[0].v.toFixed(2)+"V":"ESP"),A&3&&(J.color=ql(k[1].booting?2:k[0].em)),N.$set(J);const se={};A&3&&(se.color=ql(k[1].booting?9:k[0].hm)),B.$set(se);const ce={};A&1&&(ce.text=k[0].r?k[0].r.toFixed(0)+"dBm":"WiFi"),A&3&&(ce.color=ql(k[1].booting?9:k[0].wm)),L.$set(ce);const ve={};A&3&&(ve.color=ql(k[1].booting?9:k[0].mm)),F.$set(ve),k[0].he<0||k[0].he>0?Te?Te.p(k,A):(Te=nu(k),Te.c(),Te.m(l,j)):Te&&(Te.d(1),Te=null),k[0].me<0?Le?Le.p(k,A):(Le=iu(k),Le.c(),Le.m(l,z)):Le&&(Le.d(1),Le=null),k[0].ee>0||k[0].ee<0?Me?Me.p(k,A):(Me=su(k),Me.c(),Me.m(l,G)):Me&&(Me.d(1),Me=null);const $e={};A&1&&($e.timestamp=k[0].c?new Date(k[0].c*1e3):new Date(0)),A&2&&($e.offset=k[1].clock_offset),re.$set($e),k[1].vndcfg&&k[1].usrcfg?y?A&2&&D(y,1):(y=ou(k),y.c(),D(y,1),y.m(V,ke)):y&&(De(),q(y,1,1,()=>{y=null}),Ie()),k[1].fwconsent===1&&k[2]?g?(g.p(k,A),A&6&&D(g,1)):(g=ru(k),g.c(),D(g,1),g.m(V,null)):g&&(De(),q(g,1,1,()=>{g=null}),Ie())},i(k){He||(D(i.$$.fragment,k),D(c.$$.fragment,k),D(N.$$.fragment,k),D(B.$$.fragment,k),D(L.$$.fragment,k),D(F.$$.fragment,k),D(re.$$.fragment,k),D(y),D(je.$$.fragment,k),D(g),He=!0)},o(k){q(i.$$.fragment,k),q(c.$$.fragment,k),q(N.$$.fragment,k),q(B.$$.fragment,k),q(L.$$.fragment,k),q(F.$$.fragment,k),q(re.$$.fragment,k),q(y),q(je.$$.fragment,k),q(g),He=!1},d(k){k&&C(e),ne(i),ne(c),we&&we.d(),ne(N),ne(B),ne(L),ne(F),Te&&Te.d(),Le&&Le.d(),Me&&Me.d(),ne(re),y&&y.d(),ne(je),g&&g.d()}}}function x1(t,e,l){let{data:n={}}=e,i={},o={};function a(){confirm("Do you want to upgrade this device to "+o.tag_name+"?")&&(!ri(i.board)||confirm(Ms(be(i.chip,i.board))))&&(jt.update(u=>(u.upgrading=!0,u)),zc(o.tag_name))}return jt.subscribe(u=>{l(1,i=u),u.fwconsent===1&&C1()}),So.subscribe(u=>{l(2,o=Gc(i.version,u))}),t.$$set=u=>{"data"in u&&l(0,n=u.data)},[n,i,o,a]}class em extends Ee{constructor(e){super(),Pe(this,e,x1,J1,Ne,{data:0})}}function tm(t){let e,l,n,i;return{c(){e=Fe("svg"),l=Fe("path"),n=Fe("path"),r(l,"d",Zs(150,150,115,210,510)),r(l,"stroke","#eee"),r(l,"fill","none"),r(l,"stroke-width","55"),r(n,"d",i=Zs(150,150,115,210,210+300*t[0]/100)),r(n,"stroke",t[1]),r(n,"fill","none"),r(n,"stroke-width","55"),r(e,"viewBox","0 0 300 300"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"height","100%")},m(o,a){M(o,e,a),s(e,l),s(e,n)},p(o,[a]){a&1&&i!==(i=Zs(150,150,115,210,210+300*o[0]/100))&&r(n,"d",i),a&2&&r(n,"stroke",o[1])},i:fe,o:fe,d(o){o&&C(e)}}}function au(t,e,l,n){var i=(n-90)*Math.PI/180;return{x:t+l*Math.cos(i),y:e+l*Math.sin(i)}}function Zs(t,e,l,n,i){var o=au(t,e,l,i),a=au(t,e,l,n),u=i-n<=180?"0":"1",c=["M",o.x,o.y,"A",l,l,0,u,0,a.x,a.y].join(" ");return c}function lm(t,e,l){let{pct:n=0}=e,{color:i="red"}=e;return t.$$set=o=>{"pct"in o&&l(0,n=o.pct),"color"in o&&l(1,i=o.color)},[n,i]}class nm extends Ee{constructor(e){super(),Pe(this,e,lm,tm,Ne,{pct:0,color:1})}}function uu(t){let e,l,n,i,o,a,u,c;return{c(){e=m("br"),l=h(),n=m("span"),i=T(t[3]),o=h(),a=m("span"),u=T(t[4]),c=T("/kWh"),r(n,"class","pl-sub"),r(a,"class","pl-snt")},m(f,_){M(f,e,_),M(f,l,_),M(f,n,_),s(n,i),M(f,o,_),M(f,a,_),s(a,u),s(a,c)},p(f,_){_&8&&X(i,f[3]),_&16&&X(u,f[4])},d(f){f&&C(e),f&&C(l),f&&C(n),f&&C(o),f&&C(a)}}}function im(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,w;l=new nm({props:{pct:t[6],color:t[5](t[6])}});let $=t[3]&&uu(t);return{c(){e=m("div"),ie(l.$$.fragment),n=h(),i=m("span"),o=m("span"),a=T(t[2]),u=h(),c=m("br"),f=h(),_=m("span"),p=T(t[0]),b=h(),v=m("span"),d=T(t[1]),S=h(),$&&$.c(),r(o,"class","pl-lab"),r(_,"class","pl-val"),r(v,"class","pl-unt"),r(i,"class","pl-ov"),r(e,"class","pl-root")},m(N,E){M(N,e,E),le(l,e,null),s(e,n),s(e,i),s(i,o),s(o,a),s(i,u),s(i,c),s(i,f),s(i,_),s(_,p),s(i,b),s(i,v),s(v,d),s(i,S),$&&$.m(i,null),w=!0},p(N,[E]){const B={};E&64&&(B.pct=N[6]),E&96&&(B.color=N[5](N[6])),l.$set(B),(!w||E&4)&&X(a,N[2]),(!w||E&1)&&X(p,N[0]),(!w||E&2)&&X(d,N[1]),N[3]?$?$.p(N,E):($=uu(N),$.c(),$.m(i,null)):$&&($.d(1),$=null)},i(N){w||(D(l.$$.fragment,N),w=!0)},o(N){q(l.$$.fragment,N),w=!1},d(N){N&&C(e),ne(l),$&&$.d()}}}function sm(t,e,l){let{val:n}=e,{max:i}=e,{unit:o}=e,{label:a}=e,{sub:u=""}=e,{subunit:c=""}=e,{colorFn:f}=e,_=0;return t.$$set=p=>{"val"in p&&l(0,n=p.val),"max"in p&&l(7,i=p.max),"unit"in p&&l(1,o=p.unit),"label"in p&&l(2,a=p.label),"sub"in p&&l(3,u=p.sub),"subunit"in p&&l(4,c=p.subunit),"colorFn"in p&&l(5,f=p.colorFn)},t.$$.update=()=>{t.$$.dirty&129&&l(6,_=Math.min(n,i)/i*100)},[n,o,a,u,c,f,_,i]}class Yc extends Ee{constructor(e){super(),Pe(this,e,sm,im,Ne,{val:0,max:7,unit:1,label:2,sub:3,subunit:4,colorFn:5})}}function fu(t,e,l){const n=t.slice();return n[11]=e[l],n[13]=l,n}function cu(t,e,l){const n=t.slice();return n[11]=e[l],n[13]=l,n}function mu(t,e,l){const n=t.slice();return n[15]=e[l],n}function pu(t){let e,l,n,i,o,a,u=t[0].title&&_u(t),c=t[0].y.ticks,f=[];for(let d=0;dt[9].call(e))},m(o,a){M(o,e,a),s(e,n),i=ic(e,t[9].bind(e))},p(o,a){a&1&&l!==(l=o[0].title+"")&&X(n,l)},d(o){o&&C(e),i()}}}function du(t){let e,l,n,i=t[15].label+"",o,a,u,c;return{c(){e=Fe("g"),l=Fe("line"),n=Fe("text"),o=T(i),r(l,"x2","100%"),r(n,"y","-4"),r(n,"x",a=t[15].align=="right"?"85%":""),r(e,"class",u="tick tick-"+t[15].value+" tick-"+t[15].color),r(e,"transform",c="translate(0, "+t[7](t[15].value)+")")},m(f,_){M(f,e,_),s(e,l),s(e,n),s(n,o)},p(f,_){_&1&&i!==(i=f[15].label+"")&&X(o,i),_&1&&a!==(a=f[15].align=="right"?"85%":"")&&r(n,"x",a),_&1&&u!==(u="tick tick-"+f[15].value+" tick-"+f[15].color)&&r(e,"class",u),_&129&&c!==(c="translate(0, "+f[7](f[15].value)+")")&&r(e,"transform",c)},d(f){f&&C(e)}}}function vu(t){let e=!isNaN(t[7](t[15].value)),l,n=e&&du(t);return{c(){n&&n.c(),l=Ve()},m(i,o){n&&n.m(i,o),M(i,l,o)},p(i,o){o&129&&(e=!isNaN(i[7](i[15].value))),e?n?n.p(i,o):(n=du(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&C(l)}}}function hu(t){let e,l,n=(t[3]>20||t[13]%2==0)&&bu(t);return{c(){e=Fe("g"),n&&n.c(),r(e,"class","tick"),r(e,"transform",l="translate("+t[6](t[13])+","+t[4]+")")},m(i,o){M(i,e,o),n&&n.m(e,null)},p(i,o){i[3]>20||i[13]%2==0?n?n.p(i,o):(n=bu(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o&80&&l!==(l="translate("+i[6](i[13])+","+i[4]+")")&&r(e,"transform",l)},d(i){i&&C(e),n&&n.d()}}}function bu(t){let e,l=t[11].label+"",n,i;return{c(){e=Fe("text"),n=T(l),r(e,"x",i=t[3]/2),r(e,"y","-4")},m(o,a){M(o,e,a),s(e,n)},p(o,a){a&1&&l!==(l=o[11].label+"")&&X(n,l),a&8&&i!==(i=o[3]/2)&&r(e,"x",i)},d(o){o&&C(e)}}}function gu(t){let e=!isNaN(t[6](t[13])),l,n=e&&hu(t);return{c(){n&&n.c(),l=Ve()},m(i,o){n&&n.m(i,o),M(i,l,o)},p(i,o){o&64&&(e=!isNaN(i[6](i[13]))),e?n?n.p(i,o):(n=hu(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&C(l)}}}function ku(t){let e,l,n=t[11].value!==void 0&&wu(t),i=t[11].value2>1e-4&&Mu(t);return{c(){e=Fe("g"),n&&n.c(),l=Fe("g"),i&&i.c()},m(o,a){M(o,e,a),n&&n.m(e,null),M(o,l,a),i&&i.m(l,null)},p(o,a){o[11].value!==void 0?n?n.p(o,a):(n=wu(o),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o[11].value2>1e-4?i?i.p(o,a):(i=Mu(o),i.c(),i.m(l,null)):i&&(i.d(1),i=null)},d(o){o&&C(e),n&&n.d(),o&&C(l),i&&i.d()}}}function wu(t){let e,l,n,i,o,a,u,c=t[3]>15&&yu(t);return{c(){e=Fe("rect"),c&&c.c(),u=Ve(),r(e,"x",l=t[6](t[13])+2),r(e,"y",n=t[7](t[11].value)),r(e,"width",i=t[3]-4),r(e,"height",o=t[7](t[0].y.min)-t[7](Math.min(t[0].y.min,0)+t[11].value)),r(e,"fill",a=t[11].color)},m(f,_){M(f,e,_),c&&c.m(f,_),M(f,u,_)},p(f,_){_&64&&l!==(l=f[6](f[13])+2)&&r(e,"x",l),_&129&&n!==(n=f[7](f[11].value))&&r(e,"y",n),_&8&&i!==(i=f[3]-4)&&r(e,"width",i),_&129&&o!==(o=f[7](f[0].y.min)-f[7](Math.min(f[0].y.min,0)+f[11].value))&&r(e,"height",o),_&1&&a!==(a=f[11].color)&&r(e,"fill",a),f[3]>15?c?c.p(f,_):(c=yu(f),c.c(),c.m(u.parentNode,u)):c&&(c.d(1),c=null)},d(f){f&&C(e),c&&c.d(f),f&&C(u)}}}function yu(t){let e,l=t[11].label+"",n,i,o,a,u,c,f=t[11].title&&Cu(t);return{c(){e=Fe("text"),n=T(l),f&&f.c(),c=Ve(),r(e,"width",i=t[3]-4),r(e,"dominant-baseline","middle"),r(e,"text-anchor",o=t[3]t[7](0)-t[8]?t[11].color:"white"),r(e,"transform",u="translate("+(t[6](t[13])+t[3]/2)+" "+(t[7](t[11].value)>t[7](0)-t[8]?t[7](t[11].value)-t[8]:t[7](t[11].value)+10)+") rotate("+(t[3]_[7](0)-_[8]?_[11].color:"white")&&r(e,"fill",a),p&457&&u!==(u="translate("+(_[6](_[13])+_[3]/2)+" "+(_[7](_[11].value)>_[7](0)-_[8]?_[7](_[11].value)-_[8]:_[7](_[11].value)+10)+") rotate("+(_[3]15&&$u(t);return{c(){e=Fe("rect"),c&&c.c(),u=Ve(),r(e,"x",l=t[6](t[13])+2),r(e,"y",n=t[7](0)),r(e,"width",i=t[3]-4),r(e,"height",o=t[7](t[0].y.min)-t[7](t[0].y.min+t[11].value2)),r(e,"fill",a=t[11].color2?t[11].color2:t[11].color)},m(f,_){M(f,e,_),c&&c.m(f,_),M(f,u,_)},p(f,_){_&64&&l!==(l=f[6](f[13])+2)&&r(e,"x",l),_&128&&n!==(n=f[7](0))&&r(e,"y",n),_&8&&i!==(i=f[3]-4)&&r(e,"width",i),_&129&&o!==(o=f[7](f[0].y.min)-f[7](f[0].y.min+f[11].value2))&&r(e,"height",o),_&1&&a!==(a=f[11].color2?f[11].color2:f[11].color)&&r(e,"fill",a),f[3]>15?c?c.p(f,_):(c=$u(f),c.c(),c.m(u.parentNode,u)):c&&(c.d(1),c=null)},d(f){f&&C(e),c&&c.d(f),f&&C(u)}}}function $u(t){let e,l=t[11].label2+"",n,i,o,a,u,c=t[11].title2&&Su(t);return{c(){e=Fe("text"),n=T(l),c&&c.c(),u=Ve(),r(e,"width",i=t[3]-4),r(e,"dominant-baseline","middle"),r(e,"text-anchor","middle"),r(e,"fill",o=t[7](-t[11].value2)t[10].call(e))},m(i,o){M(i,e,o),n&&n.m(e,null),l=ic(e,t[10].bind(e))},p(i,[o]){i[0].x.ticks&&i[0].points&&i[4]?n?n.p(i,o):(n=pu(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},i:fe,o:fe,d(i){i&&C(e),n&&n.d(),l()}}}let cn=30;function rm(t,e,l){let{config:n}=e,i,o,a,u,c,f,_,p=0;function b(){p=this.clientHeight,l(5,p)}function v(){i=this.clientWidth,o=this.clientHeight,l(1,i),l(2,o)}return t.$$set=d=>{"config"in d&&l(0,n=d.config)},t.$$.update=()=>{if(t.$$.dirty&63){l(4,f=o-p);let d=i-(n.padding.left+n.padding.right);l(3,a=d/n.points.length),l(8,_=an.y.max?$=n.padding.bottom:wf||$<0?0:$})}},[n,i,o,a,f,p,u,c,_,b,v]}class pn extends Ee{constructor(e){super(),Pe(this,e,rm,om,Ne,{config:0})}}function am(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function um(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{ds:a}=e,u={};function c(f){return{label:ge(f)+"V",title:f.toFixed(1)+" V",value:isNaN(f)?0:f,color:g1(f||0)}}return t.$$set=f=>{"u1"in f&&l(1,n=f.u1),"u2"in f&&l(2,i=f.u2),"u3"in f&&l(3,o=f.u3),"ds"in f&&l(4,a=f.ds)},t.$$.update=()=>{if(t.$$.dirty&30){let f=[],_=[];n>0&&(f.push({label:a===1?"L1-L2":"L1"}),_.push(c(n))),i>0&&(f.push({label:a===1?"L1-L3":"L2"}),_.push(c(i))),o>0&&(f.push({label:a===1?"L2-L3":"L3"}),_.push(c(o))),l(0,u={title:"Voltage",padding:{top:20,right:15,bottom:20,left:35},y:{min:200,max:260,ticks:[{value:207,label:"-10%"},{value:230,label:"230v"},{value:253,label:"+10%"}]},x:{ticks:f},points:_})}},[u,n,i,o,a]}class fm extends Ee{constructor(e){super(),Pe(this,e,um,am,Ne,{u1:1,u2:2,u3:3,ds:4})}}function cm(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function mm(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{i1:a}=e,{i2:u}=e,{i2e:c}=e,{i3:f}=e,{max:_}=e,p={};function b(v,d){return{label:ge(v)+"A",title:(d?"Estimated ":"")+v.toFixed(1)+" A",value:isNaN(v)?0:v,color:Lc(v?v/_*100:0,d)}}return t.$$set=v=>{"u1"in v&&l(1,n=v.u1),"u2"in v&&l(2,i=v.u2),"u3"in v&&l(3,o=v.u3),"i1"in v&&l(4,a=v.i1),"i2"in v&&l(5,u=v.i2),"i2e"in v&&l(6,c=v.i2e),"i3"in v&&l(7,f=v.i3),"max"in v&&l(8,_=v.max)},t.$$.update=()=>{if(t.$$.dirty&510){let v=[],d=[];n>0&&(v.push({label:"L1"}),d.push(b(a))),i>0&&(v.push({label:"L2"}),d.push(b(u,c))),o>0&&(v.push({label:"L3"}),d.push(b(f))),l(0,p={title:"Amperage",padding:{top:20,right:15,bottom:20,left:35},y:{min:0,max:_,ticks:[{value:0,label:"0%"},{value:_/4,label:"25%"},{value:_/2,label:"50%"},{value:_/4*3,label:"75%"},{value:_,label:"100%"}]},x:{ticks:v},points:d})}},[p,n,i,o,a,u,c,f,_]}class pm extends Ee{constructor(e){super(),Pe(this,e,mm,cm,Ne,{u1:1,u2:2,u3:3,i1:4,i2:5,i2e:6,i3:7,max:8})}}function _m(t){let e,l,n,i,o,a,u,c=(typeof t[0]<"u"?t[0].toFixed(0):"-")+"",f,_,p,b,v,d,S=(typeof t[1]<"u"?t[1].toFixed(0):"-")+"",w,$,N,E,B,P,L,O=(typeof t[2]<"u"?t[2].toFixed(1):"-")+"",F,x,j,z,G,V,W=(typeof t[3]<"u"?t[3].toFixed(1):"-")+"",U,K;return{c(){e=m("div"),l=m("strong"),l.textContent="Reactive",n=h(),i=m("div"),o=m("div"),o.textContent="Instant in",a=h(),u=m("div"),f=T(c),_=T(" VAr"),p=h(),b=m("div"),b.textContent="Instant out",v=h(),d=m("div"),w=T(S),$=T(" VAr"),N=h(),E=m("div"),B=m("div"),B.textContent="Total in",P=h(),L=m("div"),F=T(O),x=T(" kVArh"),j=h(),z=m("div"),z.textContent="Total out",G=h(),V=m("div"),U=T(W),K=T(" kVArh"),r(u,"class","text-right"),r(d,"class","text-right"),r(i,"class","grid grid-cols-2 mt-4"),r(L,"class","text-right"),r(V,"class","text-right"),r(E,"class","grid grid-cols-2 mt-4"),r(e,"class","mx-2 text-sm")},m(H,Y){M(H,e,Y),s(e,l),s(e,n),s(e,i),s(i,o),s(i,a),s(i,u),s(u,f),s(u,_),s(i,p),s(i,b),s(i,v),s(i,d),s(d,w),s(d,$),s(e,N),s(e,E),s(E,B),s(E,P),s(E,L),s(L,F),s(L,x),s(E,j),s(E,z),s(E,G),s(E,V),s(V,U),s(V,K)},p(H,[Y]){Y&1&&c!==(c=(typeof H[0]<"u"?H[0].toFixed(0):"-")+"")&&X(f,c),Y&2&&S!==(S=(typeof H[1]<"u"?H[1].toFixed(0):"-")+"")&&X(w,S),Y&4&&O!==(O=(typeof H[2]<"u"?H[2].toFixed(1):"-")+"")&&X(F,O),Y&8&&W!==(W=(typeof H[3]<"u"?H[3].toFixed(1):"-")+"")&&X(U,W)},i:fe,o:fe,d(H){H&&C(e)}}}function dm(t,e,l){let{importInstant:n}=e,{exportInstant:i}=e,{importTotal:o}=e,{exportTotal:a}=e;return t.$$set=u=>{"importInstant"in u&&l(0,n=u.importInstant),"exportInstant"in u&&l(1,i=u.exportInstant),"importTotal"in u&&l(2,o=u.importTotal),"exportTotal"in u&&l(3,a=u.exportTotal)},[n,i,o,a]}class vm extends Ee{constructor(e){super(),Pe(this,e,dm,_m,Ne,{importInstant:0,exportInstant:1,importTotal:2,exportTotal:3})}}function Nu(t){let e;function l(o,a){return o[3]?bm:hm}let n=l(t),i=n(t);return{c(){i.c(),e=Ve()},m(o,a){i.m(o,a),M(o,e,a)},p(o,a){n===(n=l(o))&&i?i.p(o,a):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){i.d(o),o&&C(e)}}}function hm(t){let e,l,n,i,o,a,u=ge(t[1].h.u,2)+"",c,f,_,p,b,v,d=ge(t[1].d.u,1)+"",S,w,$,N,E,B,P=ge(t[1].m.u)+"",L,O,F,x,j,z,G=ge(t[0].last_month.u)+"",V,W,U,K,H=t[4]&&Au(t);return{c(){e=m("strong"),e.textContent="Consumption",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",o=h(),a=m("div"),c=T(u),f=T(" kWh"),_=h(),p=m("div"),p.textContent="Day",b=h(),v=m("div"),S=T(d),w=T(" kWh"),$=h(),N=m("div"),N.textContent="Month",E=h(),B=m("div"),L=T(P),O=T(" kWh"),F=h(),x=m("div"),x.textContent="Last month",j=h(),z=m("div"),V=T(G),W=T(" kWh"),U=h(),H&&H.c(),K=Ve(),r(a,"class","text-right"),r(v,"class","text-right"),r(B,"class","text-right"),r(z,"class","text-right"),r(n,"class","grid grid-cols-2 mb-3")},m(Y,Z){M(Y,e,Z),M(Y,l,Z),M(Y,n,Z),s(n,i),s(n,o),s(n,a),s(a,c),s(a,f),s(n,_),s(n,p),s(n,b),s(n,v),s(v,S),s(v,w),s(n,$),s(n,N),s(n,E),s(n,B),s(B,L),s(B,O),s(n,F),s(n,x),s(n,j),s(n,z),s(z,V),s(z,W),M(Y,U,Z),H&&H.m(Y,Z),M(Y,K,Z)},p(Y,Z){Z&2&&u!==(u=ge(Y[1].h.u,2)+"")&&X(c,u),Z&2&&d!==(d=ge(Y[1].d.u,1)+"")&&X(S,d),Z&2&&P!==(P=ge(Y[1].m.u)+"")&&X(L,P),Z&1&&G!==(G=ge(Y[0].last_month.u)+"")&&X(V,G),Y[4]?H?H.p(Y,Z):(H=Au(Y),H.c(),H.m(K.parentNode,K)):H&&(H.d(1),H=null)},d(Y){Y&&C(e),Y&&C(l),Y&&C(n),Y&&C(U),H&&H.d(Y),Y&&C(K)}}}function bm(t){let e,l,n,i,o,a,u=ge(t[1].h.u,2)+"",c,f,_,p,b,v,d,S=ge(t[1].d.u,1)+"",w,$,N,E,B,P,L,O=ge(t[1].m.u)+"",F,x,j,z,G,V,W,U=ge(t[0].last_month.u)+"",K,H,Y,Z,re,ue,ke,me,Se,je,Re,He=ge(t[1].h.p,2)+"",we,Te,Le,Me,y,g,k,A=ge(t[1].d.p,1)+"",I,Q,J,se,ce,ve,$e,oe=ge(t[1].m.p)+"",pe,Be,_e,ye,vt,Hl,tl,ct=ge(t[0].last_month.p)+"",Tl,pl,Ht,ht,Xe=t[4]&&Pu(t),Ze=t[4]&&Eu(t),Je=t[4]&&Du(t),Ue=t[4]&&Iu(t),xe=t[4]&&Ru(t),We=t[4]&&Lu(t),et=t[4]&&Ou(t),tt=t[4]&&Fu(t);return{c(){e=m("strong"),e.textContent="Import",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",o=h(),a=m("div"),c=T(u),f=T(" kWh"),_=h(),Xe&&Xe.c(),p=h(),b=m("div"),b.textContent="Day",v=h(),d=m("div"),w=T(S),$=T(" kWh"),N=h(),Ze&&Ze.c(),E=h(),B=m("div"),B.textContent="Month",P=h(),L=m("div"),F=T(O),x=T(" kWh"),j=h(),Je&&Je.c(),z=h(),G=m("div"),G.textContent="Last mo.",V=h(),W=m("div"),K=T(U),H=T(" kWh"),Y=h(),Ue&&Ue.c(),re=h(),ue=m("strong"),ue.textContent="Export",ke=h(),me=m("div"),Se=m("div"),Se.textContent="Hour",je=h(),Re=m("div"),we=T(He),Te=T(" kWh"),Le=h(),xe&&xe.c(),Me=h(),y=m("div"),y.textContent="Day",g=h(),k=m("div"),I=T(A),Q=T(" kWh"),J=h(),We&&We.c(),se=h(),ce=m("div"),ce.textContent="Month",ve=h(),$e=m("div"),pe=T(oe),Be=T(" kWh"),_e=h(),et&&et.c(),ye=h(),vt=m("div"),vt.textContent="Last mo.",Hl=h(),tl=m("div"),Tl=T(ct),pl=T(" kWh"),Ht=h(),tt&&tt.c(),r(a,"class","text-right"),r(d,"class","text-right"),r(L,"class","text-right"),r(W,"class","text-right"),r(n,"class",Z="grid grid-cols-"+t[5]+" mb-3"),r(Re,"class","text-right"),r(k,"class","text-right"),r($e,"class","text-right"),r(tl,"class","text-right"),r(me,"class",ht="grid grid-cols-"+t[5])},m(de,Ce){M(de,e,Ce),M(de,l,Ce),M(de,n,Ce),s(n,i),s(n,o),s(n,a),s(a,c),s(a,f),s(n,_),Xe&&Xe.m(n,null),s(n,p),s(n,b),s(n,v),s(n,d),s(d,w),s(d,$),s(n,N),Ze&&Ze.m(n,null),s(n,E),s(n,B),s(n,P),s(n,L),s(L,F),s(L,x),s(n,j),Je&&Je.m(n,null),s(n,z),s(n,G),s(n,V),s(n,W),s(W,K),s(W,H),s(n,Y),Ue&&Ue.m(n,null),M(de,re,Ce),M(de,ue,Ce),M(de,ke,Ce),M(de,me,Ce),s(me,Se),s(me,je),s(me,Re),s(Re,we),s(Re,Te),s(me,Le),xe&&xe.m(me,null),s(me,Me),s(me,y),s(me,g),s(me,k),s(k,I),s(k,Q),s(me,J),We&&We.m(me,null),s(me,se),s(me,ce),s(me,ve),s(me,$e),s($e,pe),s($e,Be),s(me,_e),et&&et.m(me,null),s(me,ye),s(me,vt),s(me,Hl),s(me,tl),s(tl,Tl),s(tl,pl),s(me,Ht),tt&&tt.m(me,null)},p(de,Ce){Ce&2&&u!==(u=ge(de[1].h.u,2)+"")&&X(c,u),de[4]?Xe?Xe.p(de,Ce):(Xe=Pu(de),Xe.c(),Xe.m(n,p)):Xe&&(Xe.d(1),Xe=null),Ce&2&&S!==(S=ge(de[1].d.u,1)+"")&&X(w,S),de[4]?Ze?Ze.p(de,Ce):(Ze=Eu(de),Ze.c(),Ze.m(n,E)):Ze&&(Ze.d(1),Ze=null),Ce&2&&O!==(O=ge(de[1].m.u)+"")&&X(F,O),de[4]?Je?Je.p(de,Ce):(Je=Du(de),Je.c(),Je.m(n,z)):Je&&(Je.d(1),Je=null),Ce&1&&U!==(U=ge(de[0].last_month.u)+"")&&X(K,U),de[4]?Ue?Ue.p(de,Ce):(Ue=Iu(de),Ue.c(),Ue.m(n,null)):Ue&&(Ue.d(1),Ue=null),Ce&32&&Z!==(Z="grid grid-cols-"+de[5]+" mb-3")&&r(n,"class",Z),Ce&2&&He!==(He=ge(de[1].h.p,2)+"")&&X(we,He),de[4]?xe?xe.p(de,Ce):(xe=Ru(de),xe.c(),xe.m(me,Me)):xe&&(xe.d(1),xe=null),Ce&2&&A!==(A=ge(de[1].d.p,1)+"")&&X(I,A),de[4]?We?We.p(de,Ce):(We=Lu(de),We.c(),We.m(me,se)):We&&(We.d(1),We=null),Ce&2&&oe!==(oe=ge(de[1].m.p)+"")&&X(pe,oe),de[4]?et?et.p(de,Ce):(et=Ou(de),et.c(),et.m(me,ye)):et&&(et.d(1),et=null),Ce&1&&ct!==(ct=ge(de[0].last_month.p)+"")&&X(Tl,ct),de[4]?tt?tt.p(de,Ce):(tt=Fu(de),tt.c(),tt.m(me,null)):tt&&(tt.d(1),tt=null),Ce&32&&ht!==(ht="grid grid-cols-"+de[5])&&r(me,"class",ht)},d(de){de&&C(e),de&&C(l),de&&C(n),Xe&&Xe.d(),Ze&&Ze.d(),Je&&Je.d(),Ue&&Ue.d(),de&&C(re),de&&C(ue),de&&C(ke),de&&C(me),xe&&xe.d(),We&&We.d(),et&&et.d(),tt&&tt.d()}}}function Au(t){let e,l,n,i,o,a,u=ge(t[1].h.c,2)+"",c,f,_,p,b,v,d,S=ge(t[1].d.c,1)+"",w,$,N,E,B,P,L,O=ge(t[1].m.c)+"",F,x,j,z,G,V,W,U=ge(t[0].last_month.c)+"",K,H,Y;return{c(){e=m("strong"),e.textContent="Cost",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",o=h(),a=m("div"),c=T(u),f=h(),_=T(t[2]),p=h(),b=m("div"),b.textContent="Day",v=h(),d=m("div"),w=T(S),$=h(),N=T(t[2]),E=h(),B=m("div"),B.textContent="Month",P=h(),L=m("div"),F=T(O),x=h(),j=T(t[2]),z=h(),G=m("div"),G.textContent="Last month",V=h(),W=m("div"),K=T(U),H=h(),Y=T(t[2]),r(a,"class","text-right"),r(d,"class","text-right"),r(L,"class","text-right"),r(W,"class","text-right"),r(n,"class","grid grid-cols-2")},m(Z,re){M(Z,e,re),M(Z,l,re),M(Z,n,re),s(n,i),s(n,o),s(n,a),s(a,c),s(a,f),s(a,_),s(n,p),s(n,b),s(n,v),s(n,d),s(d,w),s(d,$),s(d,N),s(n,E),s(n,B),s(n,P),s(n,L),s(L,F),s(L,x),s(L,j),s(n,z),s(n,G),s(n,V),s(n,W),s(W,K),s(W,H),s(W,Y)},p(Z,re){re&2&&u!==(u=ge(Z[1].h.c,2)+"")&&X(c,u),re&4&&X(_,Z[2]),re&2&&S!==(S=ge(Z[1].d.c,1)+"")&&X(w,S),re&4&&X(N,Z[2]),re&2&&O!==(O=ge(Z[1].m.c)+"")&&X(F,O),re&4&&X(j,Z[2]),re&1&&U!==(U=ge(Z[0].last_month.c)+"")&&X(K,U),re&4&&X(Y,Z[2])},d(Z){Z&&C(e),Z&&C(l),Z&&C(n)}}}function Pu(t){let e,l=ge(t[1].h.c,2)+"",n,i,o;return{c(){e=m("div"),n=T(l),i=h(),o=T(t[2]),r(e,"class","text-right")},m(a,u){M(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&2&&l!==(l=ge(a[1].h.c,2)+"")&&X(n,l),u&4&&X(o,a[2])},d(a){a&&C(e)}}}function Eu(t){let e,l=ge(t[1].d.c,1)+"",n,i,o;return{c(){e=m("div"),n=T(l),i=h(),o=T(t[2]),r(e,"class","text-right")},m(a,u){M(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&2&&l!==(l=ge(a[1].d.c,1)+"")&&X(n,l),u&4&&X(o,a[2])},d(a){a&&C(e)}}}function Du(t){let e,l=ge(t[1].m.c)+"",n,i,o;return{c(){e=m("div"),n=T(l),i=h(),o=T(t[2]),r(e,"class","text-right")},m(a,u){M(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&2&&l!==(l=ge(a[1].m.c)+"")&&X(n,l),u&4&&X(o,a[2])},d(a){a&&C(e)}}}function Iu(t){let e,l=ge(t[0].last_month.c)+"",n,i,o;return{c(){e=m("div"),n=T(l),i=h(),o=T(t[2]),r(e,"class","text-right")},m(a,u){M(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&1&&l!==(l=ge(a[0].last_month.c)+"")&&X(n,l),u&4&&X(o,a[2])},d(a){a&&C(e)}}}function Ru(t){let e,l=ge(t[1].h.i,2)+"",n,i,o;return{c(){e=m("div"),n=T(l),i=h(),o=T(t[2]),r(e,"class","text-right")},m(a,u){M(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&2&&l!==(l=ge(a[1].h.i,2)+"")&&X(n,l),u&4&&X(o,a[2])},d(a){a&&C(e)}}}function Lu(t){let e,l=ge(t[1].d.i,1)+"",n,i,o;return{c(){e=m("div"),n=T(l),i=h(),o=T(t[2]),r(e,"class","text-right")},m(a,u){M(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&2&&l!==(l=ge(a[1].d.i,1)+"")&&X(n,l),u&4&&X(o,a[2])},d(a){a&&C(e)}}}function Ou(t){let e,l=ge(t[1].m.i)+"",n,i,o;return{c(){e=m("div"),n=T(l),i=h(),o=T(t[2]),r(e,"class","text-right")},m(a,u){M(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&2&&l!==(l=ge(a[1].m.i)+"")&&X(n,l),u&4&&X(o,a[2])},d(a){a&&C(e)}}}function Fu(t){let e,l=ge(t[0].last_month.i)+"",n,i,o;return{c(){e=m("div"),n=T(l),i=h(),o=T(t[2]),r(e,"class","text-right")},m(a,u){M(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&1&&l!==(l=ge(a[0].last_month.i)+"")&&X(n,l),u&4&&X(o,a[2])},d(a){a&&C(e)}}}function gm(t){let e,l,n,i,o,a,u=t[1]&&Nu(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Real time calculation",n=h(),i=m("br"),o=m("br"),a=h(),u&&u.c(),r(e,"class","mx-2 text-sm")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),s(e,a),u&&u.m(e,null)},p(c,[f]){c[1]?u?u.p(c,f):(u=Nu(c),u.c(),u.m(e,null)):u&&(u.d(1),u=null)},i:fe,o:fe,d(c){c&&C(e),u&&u.d()}}}function km(t,e,l){let{sysinfo:n}=e,{data:i}=e,{currency:o}=e,{hasExport:a}=e,u=!1,c=3;return t.$$set=f=>{"sysinfo"in f&&l(0,n=f.sysinfo),"data"in f&&l(1,i=f.data),"currency"in f&&l(2,o=f.currency),"hasExport"in f&&l(3,a=f.hasExport)},t.$$.update=()=>{t.$$.dirty&18&&(l(4,u=i&&i.h&&(Math.abs(i.h.c)>.01||Math.abs(i.d.c)>.01||Math.abs(i.m.c)>.01||Math.abs(i.h.i)>.01||Math.abs(i.d.i)>.01||Math.abs(i.m.i)>.01)),l(5,c=u?3:2))},[n,i,o,a,u,c]}class wm extends Ee{constructor(e){super(),Pe(this,e,km,gm,Ne,{sysinfo:0,data:1,currency:2,hasExport:3})}}function ym(t){let e,l,n=Ja(t[0].source)+"",i,o,a,u;return a=new pn({props:{config:t[1]}}),{c(){e=m("a"),l=T("Provided by: "),i=T(n),o=h(),ie(a.$$.fragment),r(e,"href","https://transparency.entsoe.eu/"),r(e,"target","_blank"),r(e,"class","text-xs float-right z-40")},m(c,f){M(c,e,f),s(e,l),s(e,i),M(c,o,f),le(a,c,f),u=!0},p(c,[f]){(!u||f&1)&&n!==(n=Ja(c[0].source)+"")&&X(i,n);const _={};f&2&&(_.config=c[1]),a.$set(_)},i(c){u||(D(a.$$.fragment,c),u=!0)},o(c){q(a.$$.fragment,c),u=!1},d(c){c&&C(e),c&&C(o),ne(a,c)}}}function Cm(t,e,l){let{json:n}=e,{sysinfo:i}=e,o={},a,u;return t.$$set=c=>{"json"in c&&l(0,n=c.json),"sysinfo"in c&&l(2,i=c.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&29){let c=n.currency,f=new Date().getUTCHours(),_=0,p=0,b=0,v=[],d=[],S=[];l(4,u=l(3,a=0));let w=new Date;for(fl(w,i.clock_offset-(24+w.getHours()-w.getUTCHours())%24),_=f;_<24&&(p=n[Oe(b++)],p!=null);_++)d.push({label:Oe(w.getHours())}),S.push(p*100),l(4,u=Math.min(u,p*100)),l(3,a=Math.max(a,p*100)),fl(w,1);for(_=0;_<24&&(p=n[Oe(b++)],p!=null);_++)d.push({label:Oe(w.getHours())}),S.push(p*100),l(4,u=Math.min(u,p*100)),l(3,a=Math.max(a,p*100)),fl(w,1);if(u>-100&&a<100){switch(c){case"NOK":case"SEK":case"DKK":c="\xF8re";break;case"EUR":c="cent";break;default:c=c+"/100"}for(l(4,u*=100),l(3,a*=100),_=0;_=0?P.toFixed(L):"",title:P>=0?P.toFixed(2)+" "+c:"",value:p>=0?Math.abs(p):0,label2:P<0?P.toFixed(L):"",title2:P<0?P.toFixed(2)+" "+c:"",value2:p<0?Math.abs(p):0,color:"#7c3aed"})}let N=Math.max(a,Math.abs(u));if(u<0){l(4,u=Math.min(N/4*-1,u));let P=Math.ceil(Math.abs(u)/N*4),L=u/P;for(_=1;_{"json"in c&&l(1,n=c.json),"sysinfo"in c&&l(2,i=c.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let c=0,f=[],_=[],p=[];l(4,u=l(3,a=0));let b=fl(new Date,-24),v=new Date().getUTCHours();for(fl(b,i.clock_offset-(24+b.getHours()-b.getUTCHours())%24),c=v;c<24;c++){let $=n["i"+Oe(c)],N=n["e"+Oe(c)];$===void 0&&($=0),N===void 0&&(N=0),_.push({label:Oe(b.getHours())}),p.push({label:$.toFixed(1),title:$.toFixed(2)+" kWh",value:$*10,label2:N.toFixed(1),title2:N.toFixed(2)+" kWh",value2:N*10,color:"#7c3aed",color2:"#37829E"}),l(4,u=Math.max(u,N*10)),l(3,a=Math.max(a,$*10)),fl(b,1)}for(c=0;c{"json"in c&&l(1,n=c.json),"sysinfo"in c&&l(2,i=c.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let c=0,f=[],_=[],p=[];l(4,u=l(3,a=0));let b=new Date,v=new Date;for(fl(b,i.clock_offset-(24+b.getHours()-b.getUTCHours())%24),fl(v,i.clock_offset-(24+v.getHours()-v.getUTCHours())%24),v.setDate(0),c=b.getDate();c<=v.getDate();c++){let $=n["i"+Oe(c)],N=n["e"+Oe(c)];$===void 0&&($=0),N===void 0&&(N=0),_.push({label:Oe(c)}),p.push({label:$.toFixed($<10?1:0),title:$.toFixed(2)+" kWh",value:$,label2:N.toFixed(N<10?1:0),title2:N.toFixed(2)+" kWh",value2:N,color:"#7c3aed",color2:"#37829E"}),l(4,u=Math.max(u,N)),l(3,a=Math.max(a,$))}for(c=1;c{"json"in u&&l(1,n=u.json)},t.$$.update=()=>{if(t.$$.dirty&14){let u=0,c=0,f=[],_=[],p=[];n.s&&n.s.forEach((d,S)=>{var w=d.n?d.n:d.a;c=d.v,c==-127&&(c=0),_.push({label:w.slice(-4)}),p.push({label:c.toFixed(1),value:c,color:"#7c3aed"}),l(3,a=Math.min(a,c)),l(2,o=Math.max(o,c))}),l(2,o=Math.ceil(o)),l(3,a=Math.floor(a));let b=o;a<0&&(b+=Math.abs(a));let v=b/4;for(u=0;u<5;u++)c=a+v*u,f.push({value:c,label:c.toFixed(1)});l(0,i={title:"Temperature sensors (\xB0C)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:a,max:o,ticks:f},x:{ticks:_},points:p})}},[i,n,o,a]}class Im extends Ee{constructor(e){super(),Pe(this,e,Dm,Em,Ne,{json:1})}}function Rm(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}let Lm=0;function Om(t,e,l){let n={},i=0,o;return Wc.subscribe(a=>{l(2,o=a)}),Hc(),t.$$.update=()=>{if(t.$$.dirty&6){let a=0,u=[],c=[],f=[];if(u.push({value:0,label:0}),o&&o.p)for(a=0;a0?Oe(_.d)+"."+no[new Date().getMonth()]:"-"}),l(1,i=Math.max(i,_.v))}if(o&&o.t){for(a=0;a=i)break;u.push({value:_,label:_})}u.push({label:o.m.toFixed(1),align:"right",color:"green",value:o.m})}o&&o.c&&(u.push({label:o.c.toFixed(0),color:"orange",value:o.c}),l(1,i=Math.max(i,o.c))),l(1,i=Math.ceil(i)),l(0,n={title:"Tariff peaks",padding:{top:20,right:35,bottom:20,left:35},y:{min:Lm,max:i,ticks:u},x:{ticks:c},points:f})}},[n,i,o]}class Fm extends Ee{constructor(e){super(),Pe(this,e,Om,Rm,Ne,{})}}function qu(t){let e,l,n,i,o,a,u=(t[0].mt?Cs(t[0].mt):"-")+"",c,f,_,p=(t[0].ic?t[0].ic.toFixed(1):"-")+"",b,v,d;return i=new Yc({props:{val:t[0].i?t[0].i:0,max:t[0].im?t[0].im:15e3,unit:"W",label:"Import",sub:t[0].p,subunit:t[0].pc,colorFn:Lc}}),{c(){e=m("div"),l=m("div"),n=m("div"),ie(i.$$.fragment),o=h(),a=m("div"),c=T(u),f=h(),_=m("div"),b=T(p),v=T(" kWh"),r(n,"class","col-span-2"),r(_,"class","text-right"),r(l,"class","grid grid-cols-2"),r(e,"class","cnt")},m(S,w){M(S,e,w),s(e,l),s(l,n),le(i,n,null),s(l,o),s(l,a),s(a,c),s(l,f),s(l,_),s(_,b),s(_,v),d=!0},p(S,w){const $={};w&1&&($.val=S[0].i?S[0].i:0),w&1&&($.max=S[0].im?S[0].im:15e3),w&1&&($.sub=S[0].p),w&1&&($.subunit=S[0].pc),i.$set($),(!d||w&1)&&u!==(u=(S[0].mt?Cs(S[0].mt):"-")+"")&&X(c,u),(!d||w&1)&&p!==(p=(S[0].ic?S[0].ic.toFixed(1):"-")+"")&&X(b,p)},i(S){d||(D(i.$$.fragment,S),d=!0)},o(S){q(i.$$.fragment,S),d=!1},d(S){S&&C(e),ne(i)}}}function Bu(t){let e,l,n,i,o,a,u,c,f=(t[0].ec?t[0].ec.toFixed(1):"-")+"",_,p,b;return i=new Yc({props:{val:t[0].e?t[0].e:0,max:t[0].om?t[0].om*1e3:1e4,unit:"W",label:"Export",colorFn:k1}}),{c(){e=m("div"),l=m("div"),n=m("div"),ie(i.$$.fragment),o=h(),a=m("div"),u=h(),c=m("div"),_=T(f),p=T(" kWh"),r(n,"class","col-span-2"),r(c,"class","text-right"),r(l,"class","grid grid-cols-2"),r(e,"class","cnt")},m(v,d){M(v,e,d),s(e,l),s(l,n),le(i,n,null),s(l,o),s(l,a),s(l,u),s(l,c),s(c,_),s(c,p),b=!0},p(v,d){const S={};d&1&&(S.val=v[0].e?v[0].e:0),d&1&&(S.max=v[0].om?v[0].om*1e3:1e4),i.$set(S),(!b||d&1)&&f!==(f=(v[0].ec?v[0].ec.toFixed(1):"-")+"")&&X(_,f)},i(v){b||(D(i.$$.fragment,v),b=!0)},o(v){q(i.$$.fragment,v),b=!1},d(v){v&&C(e),ne(i)}}}function Uu(t){let e,l,n;return l=new fm({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,ds:t[0].ds}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt")},m(i,o){M(i,e,o),le(l,e,null),n=!0},p(i,o){const a={};o&1&&(a.u1=i[0].u1),o&1&&(a.u2=i[0].u2),o&1&&(a.u3=i[0].u3),o&1&&(a.ds=i[0].ds),l.$set(a)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function ju(t){let e,l,n;return l=new pm({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,i1:t[0].i1,i2:t[0].i2,i2e:t[0].i2e,i3:t[0].i3,max:t[0].mf?t[0].mf:32}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt")},m(i,o){M(i,e,o),le(l,e,null),n=!0},p(i,o){const a={};o&1&&(a.u1=i[0].u1),o&1&&(a.u2=i[0].u2),o&1&&(a.u3=i[0].u3),o&1&&(a.i1=i[0].i1),o&1&&(a.i2=i[0].i2),o&1&&(a.i2e=i[0].i2e),o&1&&(a.i3=i[0].i3),o&1&&(a.max=i[0].mf?i[0].mf:32),l.$set(a)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Hu(t){let e,l,n;return l=new vm({props:{importInstant:t[0].ri,exportInstant:t[0].re,importTotal:t[0].ric,exportTotal:t[0].rec}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt")},m(i,o){M(i,e,o),le(l,e,null),n=!0},p(i,o){const a={};o&1&&(a.importInstant=i[0].ri),o&1&&(a.exportInstant=i[0].re),o&1&&(a.importTotal=i[0].ric),o&1&&(a.exportTotal=i[0].rec),l.$set(a)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Wu(t){let e,l,n;return l=new wm({props:{sysinfo:t[1],data:t[0].ea,currency:t[0].pc,hasExport:t[0].om>0||t[0].e>0}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt")},m(i,o){M(i,e,o),le(l,e,null),n=!0},p(i,o){const a={};o&2&&(a.sysinfo=i[1]),o&1&&(a.data=i[0].ea),o&1&&(a.currency=i[0].pc),o&1&&(a.hasExport=i[0].om>0||i[0].e>0),l.$set(a)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function zu(t){let e,l,n;return l=new Fm({}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt h-64")},m(i,o){M(i,e,o),le(l,e,null),n=!0},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Gu(t){let e,l,n;return l=new Mm({props:{json:t[2],sysinfo:t[1]}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){M(i,e,o),le(l,e,null),n=!0},p(i,o){const a={};o&4&&(a.json=i[2]),o&2&&(a.sysinfo=i[1]),l.$set(a)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Vu(t){let e,l,n;return l=new Tm({props:{json:t[3],sysinfo:t[1]}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){M(i,e,o),le(l,e,null),n=!0},p(i,o){const a={};o&8&&(a.json=i[3]),o&2&&(a.sysinfo=i[1]),l.$set(a)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Ku(t){let e,l,n;return l=new Pm({props:{json:t[4],sysinfo:t[1]}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){M(i,e,o),le(l,e,null),n=!0},p(i,o){const a={};o&16&&(a.json=i[4]),o&2&&(a.sysinfo=i[1]),l.$set(a)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Yu(t){let e,l,n;return l=new Im({props:{json:t[5]}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){M(i,e,o),le(l,e,null),n=!0},p(i,o){const a={};o&32&&(a.json=i[5]),l.$set(a)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function qm(t){let e,l=Ke(t[1].ui.i,t[0].i),n,i=Ke(t[1].ui.e,t[0].om||t[0].e>0),o,a=Ke(t[1].ui.v,t[0].u1>100||t[0].u2>100||t[0].u3>100),u,c=Ke(t[1].ui.a,t[0].i1>.01||t[0].i2>.01||t[0].i3>.01),f,_=Ke(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),p,b=Ke(t[1].ui.c,t[0].ea),v,d=Ke(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("10YNO")||t[0].pr.startsWith("10Y1001A1001A4"))),S,w=Ke(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].p)),$,N=Ke(t[1].ui.d,t[3]),E,B=Ke(t[1].ui.m,t[4]),P,L=Ke(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[5].c>1),O,F=l&&qu(t),x=i&&Bu(t),j=a&&Uu(t),z=c&&ju(t),G=_&&Hu(t),V=b&&Wu(t),W=d&&zu(),U=w&&Gu(t),K=N&&Vu(t),H=B&&Ku(t),Y=L&&Yu(t);return{c(){e=m("div"),F&&F.c(),n=h(),x&&x.c(),o=h(),j&&j.c(),u=h(),z&&z.c(),f=h(),G&&G.c(),p=h(),V&&V.c(),v=h(),W&&W.c(),S=h(),U&&U.c(),$=h(),K&&K.c(),E=h(),H&&H.c(),P=h(),Y&&Y.c(),r(e,"class","grid 2xl:grid-cols-6 xl:grid-cols-5 lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2")},m(Z,re){M(Z,e,re),F&&F.m(e,null),s(e,n),x&&x.m(e,null),s(e,o),j&&j.m(e,null),s(e,u),z&&z.m(e,null),s(e,f),G&&G.m(e,null),s(e,p),V&&V.m(e,null),s(e,v),W&&W.m(e,null),s(e,S),U&&U.m(e,null),s(e,$),K&&K.m(e,null),s(e,E),H&&H.m(e,null),s(e,P),Y&&Y.m(e,null),O=!0},p(Z,[re]){re&3&&(l=Ke(Z[1].ui.i,Z[0].i)),l?F?(F.p(Z,re),re&3&&D(F,1)):(F=qu(Z),F.c(),D(F,1),F.m(e,n)):F&&(De(),q(F,1,1,()=>{F=null}),Ie()),re&3&&(i=Ke(Z[1].ui.e,Z[0].om||Z[0].e>0)),i?x?(x.p(Z,re),re&3&&D(x,1)):(x=Bu(Z),x.c(),D(x,1),x.m(e,o)):x&&(De(),q(x,1,1,()=>{x=null}),Ie()),re&3&&(a=Ke(Z[1].ui.v,Z[0].u1>100||Z[0].u2>100||Z[0].u3>100)),a?j?(j.p(Z,re),re&3&&D(j,1)):(j=Uu(Z),j.c(),D(j,1),j.m(e,u)):j&&(De(),q(j,1,1,()=>{j=null}),Ie()),re&3&&(c=Ke(Z[1].ui.a,Z[0].i1>.01||Z[0].i2>.01||Z[0].i3>.01)),c?z?(z.p(Z,re),re&3&&D(z,1)):(z=ju(Z),z.c(),D(z,1),z.m(e,f)):z&&(De(),q(z,1,1,()=>{z=null}),Ie()),re&3&&(_=Ke(Z[1].ui.r,Z[0].ri>0||Z[0].re>0||Z[0].ric>0||Z[0].rec>0)),_?G?(G.p(Z,re),re&3&&D(G,1)):(G=Hu(Z),G.c(),D(G,1),G.m(e,p)):G&&(De(),q(G,1,1,()=>{G=null}),Ie()),re&3&&(b=Ke(Z[1].ui.c,Z[0].ea)),b?V?(V.p(Z,re),re&3&&D(V,1)):(V=Wu(Z),V.c(),D(V,1),V.m(e,v)):V&&(De(),q(V,1,1,()=>{V=null}),Ie()),re&3&&(d=Ke(Z[1].ui.t,Z[0].pr&&(Z[0].pr.startsWith("10YNO")||Z[0].pr.startsWith("10Y1001A1001A4")))),d?W?re&3&&D(W,1):(W=zu(),W.c(),D(W,1),W.m(e,S)):W&&(De(),q(W,1,1,()=>{W=null}),Ie()),re&3&&(w=Ke(Z[1].ui.p,Z[0].pe&&!Number.isNaN(Z[0].p))),w?U?(U.p(Z,re),re&3&&D(U,1)):(U=Gu(Z),U.c(),D(U,1),U.m(e,$)):U&&(De(),q(U,1,1,()=>{U=null}),Ie()),re&10&&(N=Ke(Z[1].ui.d,Z[3])),N?K?(K.p(Z,re),re&10&&D(K,1)):(K=Vu(Z),K.c(),D(K,1),K.m(e,E)):K&&(De(),q(K,1,1,()=>{K=null}),Ie()),re&18&&(B=Ke(Z[1].ui.m,Z[4])),B?H?(H.p(Z,re),re&18&&D(H,1)):(H=Ku(Z),H.c(),D(H,1),H.m(e,P)):H&&(De(),q(H,1,1,()=>{H=null}),Ie()),re&35&&(L=Ke(Z[1].ui.s,Z[0].t&&Z[0].t!=-127&&Z[5].c>1)),L?Y?(Y.p(Z,re),re&35&&D(Y,1)):(Y=Yu(Z),Y.c(),D(Y,1),Y.m(e,null)):Y&&(De(),q(Y,1,1,()=>{Y=null}),Ie())},i(Z){O||(D(F),D(x),D(j),D(z),D(G),D(V),D(W),D(U),D(K),D(H),D(Y),O=!0)},o(Z){q(F),q(x),q(j),q(z),q(G),q(V),q(W),q(U),q(K),q(H),q(Y),O=!1},d(Z){Z&&C(e),F&&F.d(),x&&x.d(),j&&j.d(),z&&z.d(),G&&G.d(),V&&V.d(),W&&W.d(),U&&U.d(),K&&K.d(),H&&H.d(),Y&&Y.d()}}}function Bm(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,o={},a={},u={},c={};return Co.subscribe(f=>{l(2,o=f)}),qc.subscribe(f=>{l(3,a=f)}),Bc.subscribe(f=>{l(4,u=f)}),jc.subscribe(f=>{l(5,c=f)}),t.$$set=f=>{"data"in f&&l(0,n=f.data),"sysinfo"in f&&l(1,i=f.sysinfo)},[n,i,o,a,u,c]}class Um extends Ee{constructor(e){super(),Pe(this,e,Bm,qm,Ne,{data:0,sysinfo:1})}}let fo={};const Ci=at(fo);async function jm(){fo=await(await fetch("/configuration.json")).json(),Ci.set(fo)}function Qu(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function Hm(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=3,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function Wm(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=20,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function Xu(t){let e;return{c(){e=m("option"),e.textContent="UART2",e.__value=113,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function Zu(t){let e,l,n;return{c(){e=m("option"),e.textContent="UART1",l=h(),n=m("option"),n.textContent="UART2",e.__value=9,e.value=e.__value,n.__value=16,n.value=n.__value},m(i,o){M(i,e,o),M(i,l,o),M(i,n,o)},d(i){i&&C(e),i&&C(l),i&&C(n)}}}function Ju(t){let e;return{c(){e=m("option"),e.textContent="UART1",e.__value=18,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function xu(t){let e,l,n;return{c(){e=m("option"),l=T("GPIO"),n=T(t[4]),e.__value=t[4],e.value=e.__value},m(i,o){M(i,e,o),s(e,l),s(e,n)},d(i){i&&C(e)}}}function ef(t){let e,l=t[4]>3&&!(t[0]=="esp32"&&(t[4]==9||t[4]==16))&&!(t[0]=="esp32s2"&&t[4]==18)&&!(t[0]=="esp8266"&&(t[4]==3||t[4]==113))&&xu(t);return{c(){l&&l.c(),e=Ve()},m(n,i){l&&l.m(n,i),M(n,e,i)},p(n,i){n[4]>3&&!(n[0]=="esp32"&&(n[4]==9||n[4]==16))&&!(n[0]=="esp32s2"&&n[4]==18)&&!(n[0]=="esp8266"&&(n[4]==3||n[4]==113))?l||(l=xu(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){l&&l.d(n),n&&C(e)}}}function zm(t){let e,l,n,i,o;function a(d,S){return d[0]=="esp32c3"?Wm:Hm}let u=a(t),c=u(t),f=t[0]=="esp8266"&&Xu(),_=(t[0]=="esp32"||t[0]=="esp32solo")&&Zu(),p=t[0]=="esp32s2"&&Ju(),b={length:t[1]+1},v=[];for(let d=0;d{"chip"in o&&l(0,n=o.chip)},t.$$.update=()=>{if(t.$$.dirty&1)switch(n){case"esp8266":l(1,i=16);break;case"esp32s2":l(1,i=44);break;case"esp32c3":l(1,i=19);break}},[n,i]}class Qc extends Ee{constructor(e){super(),Pe(this,e,Gm,zm,Ne,{chip:0})}}function tf(t){let e,l,n=t[1]&&lf(t);return{c(){e=m("div"),l=m("div"),n&&n.c(),r(l,"class","fixed inset-0 bg-gray-500 bg-opacity-50 flex items-center justify-center"),r(e,"class","z-50"),r(e,"aria-modal","true")},m(i,o){M(i,e,o),s(e,l),n&&n.m(l,null)},p(i,o){i[1]?n?n.p(i,o):(n=lf(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&C(e),n&&n.d()}}}function lf(t){let e,l;return{c(){e=m("div"),l=T(t[1]),r(e,"class","bg-white m-2 p-3 rounded-md shadow-lg pb-4 text-gray-700 w-96")},m(n,i){M(n,e,i),s(e,l)},p(n,i){i&2&&X(l,n[1])},d(n){n&&C(e)}}}function Vm(t){let e,l=t[0]&&tf(t);return{c(){l&&l.c(),e=Ve()},m(n,i){l&&l.m(n,i),M(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=tf(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:fe,o:fe,d(n){l&&l.d(n),n&&C(e)}}}function Km(t,e,l){let{active:n}=e,{message:i}=e;return t.$$set=o=>{"active"in o&&l(0,n=o.active),"message"in o&&l(1,i=o.message)},[n,i]}class It extends Ee{constructor(e){super(),Pe(this,e,Km,Vm,Ne,{active:0,message:1})}}function nf(t,e,l){const n=t.slice();return n[1]=e[l],n}function sf(t){let e,l,n=t[1]+"",i;return{c(){e=m("option"),l=T("Europe/"),i=T(n),e.__value="Europe/"+t[1],e.value=e.__value},m(o,a){M(o,e,a),s(e,l),s(e,i)},p:fe,d(o){o&&C(e)}}}function Ym(t){let e,l,n,i=t[0],o=[];for(let a=0;a>1&1,A=0;A0;g--)A[g]=A[g]?A[g-1]^P.EXPONENT[F._modN(P.LOG[A[g]]+y)]:A[g-1];A[0]=P.EXPONENT[F._modN(P.LOG[A[0]]+y)]}for(y=0;y<=k;y++)A[y]=P.LOG[A[y]]},_checkBadness:function(){var y,g,k,A,I,Q=0,J=this._badness,se=this.buffer,ce=this.width;for(I=0;Ice*ce;)oe-=ce*ce,$e++;for(Q+=$e*F.N4,A=0;A=J-2&&(y=J-2,I>9&&y--);var se=y;if(I>9){for(Q[se+2]=0,Q[se+3]=0;se--;)g=Q[se],Q[se+3]|=255&g<<4,Q[se+2]=g>>4;Q[2]|=255&y<<4,Q[1]=y>>4,Q[0]=64|y>>12}else{for(Q[se+1]=0,Q[se+2]=0;se--;)g=Q[se],Q[se+2]|=255&g<<4,Q[se+1]=g>>4;Q[1]|=255&y<<4,Q[0]=64|y>>4}for(se=y+3-(I<10);se=5&&(k+=F.N1+A[g]-5);for(g=3;gy||A[g-3]*3>=A[g]*4||A[g+3]*3>=A[g]*4)&&(k+=F.N3);return k},_finish:function(){this._stringBuffer=this.buffer.slice();var y,g,k=0,A=3e4;for(g=0;g<8&&(this._applyMask(g),y=this._checkBadness(),y>=1)A&1&&(I[Q-1-g+Q*8]=1,g<6?I[8+Q*g]=1:I[8+Q*(g+1)]=1);for(g=0;g<7;g++,A>>=1)A&1&&(I[8+Q*(Q-7+g)]=1,g?I[6-g+Q*8]=1:I[7+Q*8]=1)},_interleaveBlocks:function(){var y,g,k=this._dataBlock,A=this._ecc,I=this._eccBlock,Q=0,J=this._calculateMaxLength(),se=this._neccBlock1,ce=this._neccBlock2,ve=this._stringBuffer;for(y=0;y1)for(y=$.BLOCK[A],k=I-7;;){for(g=I-7;g>y-3&&(this._addAlignment(g,k),!(g6)for(y=O.BLOCK[Q-7],g=17,k=0;k<6;k++)for(A=0;A<3;A++,g--)1&(g>11?Q>>g-12:y>>g)?(I[5-k+J*(2-A+J-11)]=1,I[2-A+J-11+J*(5-k)]=1):(this._setMask(5-k,2-A+J-11),this._setMask(2-A+J-11,5-k))},_isMasked:function(y,g){var k=F._getMaskBit(y,g);return this._mask[k]===1},_pack:function(){var y,g,k,A=1,I=1,Q=this.width,J=Q-1,se=Q-1,ce=(this._dataBlock+this._eccBlock)*(this._neccBlock1+this._neccBlock2)+this._neccBlock2;for(g=0;gg&&(k=y,y=g,g=k),k=g,k+=g*g,k>>=1,k+=y,k},_modN:function(y){for(;y>=255;)y-=255,y=(y>>8)+(y&255);return y},N1:3,N2:3,N3:40,N4:10}),x=F,j=v.extend({draw:function(){this.element.src=this.qrious.toDataURL()},reset:function(){this.element.src=""},resize:function(){var y=this.element;y.width=y.height=this.qrious.size}}),z=j,G=p.extend(function(y,g,k,A){this.name=y,this.modifiable=Boolean(g),this.defaultValue=k,this._valueTransformer=A},{transform:function(y){var g=this._valueTransformer;return typeof g=="function"?g(y,this):y}}),V=G,W=p.extend(null,{abs:function(y){return y!=null?Math.abs(y):null},hasOwn:function(y,g){return Object.prototype.hasOwnProperty.call(y,g)},noop:function(){},toUpperCase:function(y){return y!=null?y.toUpperCase():null}}),U=W,K=p.extend(function(y){this.options={},y.forEach(function(g){this.options[g.name]=g},this)},{exists:function(y){return this.options[y]!=null},get:function(y,g){return K._get(this.options[y],g)},getAll:function(y){var g,k=this.options,A={};for(g in k)U.hasOwn(k,g)&&(A[g]=K._get(k[g],y));return A},init:function(y,g,k){typeof k!="function"&&(k=U.noop);var A,I;for(A in this.options)U.hasOwn(this.options,A)&&(I=this.options[A],K._set(I,I.defaultValue,g),K._createAccessor(I,g,k));this._setAll(y,g,!0)},set:function(y,g,k){return this._set(y,g,k)},setAll:function(y,g){return this._setAll(y,g)},_set:function(y,g,k,A){var I=this.options[y];if(!I)throw new Error("Invalid option: "+y);if(!I.modifiable&&!A)throw new Error("Option cannot be modified: "+y);return K._set(I,g,k)},_setAll:function(y,g,k){if(!y)return!1;var A,I=!1;for(A in y)U.hasOwn(y,A)&&this._set(A,y[A],g,k)&&(I=!0);return I}},{_createAccessor:function(y,g,k){var A={get:function(){return K._get(y,g)}};y.modifiable&&(A.set=function(I){K._set(y,I,g)&&k(I,y)}),Object.defineProperty(g,y.name,A)},_get:function(y,g){return g["_"+y.name]},_set:function(y,g,k){var A="_"+y.name,I=k[A],Q=y.transform(g!=null?g:y.defaultValue);return k[A]=Q,Q!==I}}),H=K,Y=p.extend(function(){this._services={}},{getService:function(y){var g=this._services[y];if(!g)throw new Error("Service is not being managed with name: "+y);return g},setService:function(y,g){if(this._services[y])throw new Error("Service is already managed with name: "+y);g&&(this._services[y]=g)}}),Z=Y,re=new H([new V("background",!0,"white"),new V("backgroundAlpha",!0,1,U.abs),new V("element"),new V("foreground",!0,"black"),new V("foregroundAlpha",!0,1,U.abs),new V("level",!0,"L",U.toUpperCase),new V("mime",!0,"image/png"),new V("padding",!0,null,U.abs),new V("size",!0,100,U.abs),new V("value",!0,"")]),ue=new Z,ke=p.extend(function(y){re.init(y,this,this.update.bind(this));var g=re.get("element",this),k=ue.getService("element"),A=g&&k.isCanvas(g)?g:k.createCanvas(),I=g&&k.isImage(g)?g:k.createImage();this._canvasRenderer=new S(this,A,!0),this._imageRenderer=new z(this,I,I===g),this.update()},{get:function(){return re.getAll(this)},set:function(y){re.setAll(y,this)&&this.update()},toDataURL:function(y){return this.canvas.toDataURL(y||this.mime)},update:function(){var y=new x({level:this.level,value:this.value});this._canvasRenderer.render(y),this._imageRenderer.render(y)}},{use:function(y){ue.setService(y.getName(),y)}});Object.defineProperties(ke.prototype,{canvas:{get:function(){return this._canvasRenderer.getElement()}},image:{get:function(){return this._imageRenderer.getElement()}}});var me=ke,Se=me,je=p.extend({getName:function(){}}),Re=je,He=Re.extend({createCanvas:function(){},createImage:function(){},getName:function(){return"element"},isCanvas:function(y){},isImage:function(y){}}),we=He,Te=we.extend({createCanvas:function(){return document.createElement("canvas")},createImage:function(){return document.createElement("img")},isCanvas:function(y){return y instanceof HTMLCanvasElement},isImage:function(y){return y instanceof HTMLImageElement}}),Le=Te;Se.use(new Le);var Me=Se;return Me})})(Zc);const ep=Zc.exports;function tp(t){let e,l;return{c(){e=m("img"),Js(e.src,l=t[2])||r(e,"src",l),r(e,"alt",t[0]),r(e,"class",t[1])},m(n,i){M(n,e,i)},p(n,[i]){i&4&&!Js(e.src,l=n[2])&&r(e,"src",l),i&1&&r(e,"alt",n[0]),i&2&&r(e,"class",n[1])},i:fe,o:fe,d(n){n&&C(e)}}}function lp(t,e,l){const n=new ep;let{errorCorrection:i="L"}=e,{background:o="#fff"}=e,{color:a="#000"}=e,{size:u="200"}=e,{value:c=""}=e,{padding:f=0}=e,{className:_="qrcode"}=e,p="";function b(){n.set({background:o,foreground:a,level:i,padding:f,size:u,value:c}),l(2,p=n.toDataURL("image/jpeg"))}return sc(()=>{b()}),t.$$set=v=>{"errorCorrection"in v&&l(3,i=v.errorCorrection),"background"in v&&l(4,o=v.background),"color"in v&&l(5,a=v.color),"size"in v&&l(6,u=v.size),"value"in v&&l(0,c=v.value),"padding"in v&&l(7,f=v.padding),"className"in v&&l(1,_=v.className)},t.$$.update=()=>{t.$$.dirty&1&&c&&b()},[c,_,p,i,o,a,u,f]}class np extends Ee{constructor(e){super(),Pe(this,e,lp,tp,Ne,{errorCorrection:3,background:4,color:5,size:6,value:0,padding:7,className:1})}}function of(t,e,l){const n=t.slice();return n[95]=e[l],n[96]=e,n[97]=l,n}function rf(t,e,l){const n=t.slice();return n[98]=e[l],n[99]=e,n[100]=l,n}function ip(t,e,l){const n=t.slice();return n[101]=e[l],n}function sp(t,e,l){const n=t.slice();return n[104]=e[l],n}function op(t){let e,l;return{c(){e=m("option"),l=T(t[104]),e.__value=t[104],e.value=e.__value},m(n,i){M(n,e,i),s(e,l)},p:fe,d(n){n&&C(e)}}}function af(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),r(l,"name","pt"),r(l,"type","text"),r(l,"class","in-s"),r(l,"placeholder","ENTSO-E API key, optional, read docs")},m(o,a){M(o,e,a),M(o,l,a),te(l,t[3].p.t),n||(i=ee(l,"input",t[22]),n=!0)},p(o,a){a[0]&8&&l.value!==o[3].p.t&&te(l,o[3].p.t)},d(o){o&&C(e),o&&C(l),n=!1,i()}}}function uf(t){let e,l,n,i,o,a,u,c,f,_,p,b,v;return{c(){e=m("div"),l=T("Username"),n=m("br"),i=h(),o=m("input"),a=h(),u=m("div"),c=T("Password"),f=m("br"),_=h(),p=m("input"),r(o,"name","gu"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1"),r(p,"name","gp"),r(p,"type","password"),r(p,"class","in-s"),r(u,"class","my-1")},m(d,S){M(d,e,S),s(e,l),s(e,n),s(e,i),s(e,o),te(o,t[3].g.u),M(d,a,S),M(d,u,S),s(u,c),s(u,f),s(u,_),s(u,p),te(p,t[3].g.p),b||(v=[ee(o,"input",t[24]),ee(p,"input",t[25])],b=!0)},p(d,S){S[0]&8&&o.value!==d[3].g.u&&te(o,d[3].g.u),S[0]&8&&p.value!==d[3].g.p&&te(p,d[3].g.p)},d(d){d&&C(e),d&&C(a),d&&C(u),b=!1,ze(v)}}}function rp(t){let e,l=t[101]*100+"",n;return{c(){e=m("option"),n=T(l),e.__value=t[101]*100,e.value=e.__value},m(i,o){M(i,e,o),s(e,n)},p:fe,d(i){i&&C(e)}}}function ff(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),r(l,"name","mek"),r(l,"type","text"),r(l,"class","in-s")},m(o,a){M(o,e,a),M(o,l,a),te(l,t[3].m.e.k),n||(i=ee(l,"input",t[34]),n=!0)},p(o,a){a[0]&8&&l.value!==o[3].m.e.k&&te(l,o[3].m.e.k)},d(o){o&&C(e),o&&C(l),n=!1,i()}}}function cf(t){let e,l,n,i,o,a,u;return{c(){e=m("div"),l=T("Authentication key"),n=m("br"),i=h(),o=m("input"),r(o,"name","mea"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),te(o,t[3].m.e.a),a||(u=ee(o,"input",t[35]),a=!0)},p(c,f){f[0]&8&&o.value!==c[3].m.e.a&&te(o,c[3].m.e.a)},d(c){c&&C(e),a=!1,u()}}}function mf(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,w,$,N,E,B,P,L,O,F,x,j;return{c(){e=m("div"),l=m("div"),n=T("Watt"),i=m("br"),o=h(),a=m("input"),u=h(),c=m("div"),f=T("Volt"),_=m("br"),p=h(),b=m("input"),v=h(),d=m("div"),S=T("Amp"),w=m("br"),$=h(),N=m("input"),E=h(),B=m("div"),P=T("kWh"),L=m("br"),O=h(),F=m("input"),r(a,"name","mmw"),r(a,"type","number"),r(a,"min","0.00"),r(a,"max","1000"),r(a,"step","0.001"),r(a,"class","in-f tr w-full"),r(l,"class","w-1/4"),r(b,"name","mmv"),r(b,"type","number"),r(b,"min","0.00"),r(b,"max","1000"),r(b,"step","0.001"),r(b,"class","in-m tr w-full"),r(c,"class","w-1/4"),r(N,"name","mma"),r(N,"type","number"),r(N,"min","0.00"),r(N,"max","1000"),r(N,"step","0.001"),r(N,"class","in-m tr w-full"),r(d,"class","w-1/4"),r(F,"name","mmc"),r(F,"type","number"),r(F,"min","0.00"),r(F,"max","1000"),r(F,"step","0.001"),r(F,"class","in-l tr w-full"),r(B,"class","w-1/4"),r(e,"class","flex my-1")},m(z,G){M(z,e,G),s(e,l),s(l,n),s(l,i),s(l,o),s(l,a),te(a,t[3].m.m.w),s(e,u),s(e,c),s(c,f),s(c,_),s(c,p),s(c,b),te(b,t[3].m.m.v),s(e,v),s(e,d),s(d,S),s(d,w),s(d,$),s(d,N),te(N,t[3].m.m.a),s(e,E),s(e,B),s(B,P),s(B,L),s(B,O),s(B,F),te(F,t[3].m.m.c),x||(j=[ee(a,"input",t[37]),ee(b,"input",t[38]),ee(N,"input",t[39]),ee(F,"input",t[40])],x=!0)},p(z,G){G[0]&8&&he(a.value)!==z[3].m.m.w&&te(a,z[3].m.m.w),G[0]&8&&he(b.value)!==z[3].m.m.v&&te(b,z[3].m.m.v),G[0]&8&&he(N.value)!==z[3].m.m.a&&te(N,z[3].m.m.a),G[0]&8&&he(F.value)!==z[3].m.m.c&&te(F,z[3].m.m.c)},d(z){z&&C(e),x=!1,ze(j)}}}function pf(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,w;return{c(){e=m("div"),l=T("Gateway"),n=m("br"),i=h(),o=m("input"),a=h(),u=m("div"),c=T("DNS"),f=m("br"),_=h(),p=m("div"),b=m("input"),v=h(),d=m("input"),r(o,"name","ng"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1"),r(b,"name","nd1"),r(b,"type","text"),r(b,"class","in-f w-full"),r(d,"name","nd2"),r(d,"type","text"),r(d,"class","in-l w-full"),r(p,"class","flex"),r(u,"class","my-1")},m($,N){M($,e,N),s(e,l),s(e,n),s(e,i),s(e,o),te(o,t[3].n.g),M($,a,N),M($,u,N),s(u,c),s(u,f),s(u,_),s(u,p),s(p,b),te(b,t[3].n.d1),s(p,v),s(p,d),te(d,t[3].n.d2),S||(w=[ee(o,"input",t[49]),ee(b,"input",t[50]),ee(d,"input",t[51])],S=!0)},p($,N){N[0]&8&&o.value!==$[3].n.g&&te(o,$[3].n.g),N[0]&8&&b.value!==$[3].n.d1&&te(b,$[3].n.d1),N[0]&8&&d.value!==$[3].n.d2&&te(d,$[3].n.d2)},d($){$&&C(e),$&&C(a),$&&C(u),S=!1,ze(w)}}}function _f(t){let e,l,n,i,o;return{c(){e=m("label"),l=m("input"),n=T(" SSL"),r(l,"type","checkbox"),r(l,"name","qs"),l.__value="true",l.value=l.__value,r(l,"class","rounded mb-1"),r(e,"class","float-right mr-3")},m(a,u){M(a,e,u),s(e,l),l.checked=t[3].q.s.e,s(e,n),i||(o=[ee(l,"change",t[55]),ee(l,"change",t[14])],i=!0)},p(a,u){u[0]&8&&(l.checked=a[3].q.s.e)},d(a){a&&C(e),i=!1,ze(o)}}}function df(t){let e,l,n,i,o,a,u,c,f,_,p,b,v;const d=[up,ap],S=[];function w(O,F){return O[3].q.s.c?0:1}n=w(t),i=S[n]=d[n](t);const $=[pp,mp],N=[];function E(O,F){return O[3].q.s.r?0:1}u=E(t),c=N[u]=$[u](t);const B=[hp,vp],P=[];function L(O,F){return O[3].q.s.k?0:1}return p=L(t),b=P[p]=B[p](t),{c(){e=m("div"),l=m("span"),i.c(),o=h(),a=m("span"),c.c(),f=h(),_=m("span"),b.c(),r(l,"class","flex pr-2"),r(a,"class","flex pr-2"),r(_,"class","flex pr-2"),r(e,"class","my-1 flex")},m(O,F){M(O,e,F),s(e,l),S[n].m(l,null),s(e,o),s(e,a),N[u].m(a,null),s(e,f),s(e,_),P[p].m(_,null),v=!0},p(O,F){let x=n;n=w(O),n===x?S[n].p(O,F):(De(),q(S[x],1,1,()=>{S[x]=null}),Ie(),i=S[n],i?i.p(O,F):(i=S[n]=d[n](O),i.c()),D(i,1),i.m(l,null));let j=u;u=E(O),u===j?N[u].p(O,F):(De(),q(N[j],1,1,()=>{N[j]=null}),Ie(),c=N[u],c?c.p(O,F):(c=N[u]=$[u](O),c.c()),D(c,1),c.m(a,null));let z=p;p=L(O),p===z?P[p].p(O,F):(De(),q(P[z],1,1,()=>{P[z]=null}),Ie(),b=P[p],b?b.p(O,F):(b=P[p]=B[p](O),b.c()),D(b,1),b.m(_,null))},i(O){v||(D(i),D(c),D(b),v=!0)},o(O){q(i),q(c),q(b),v=!1},d(O){O&&C(e),S[n].d(),N[u].d(),P[p].d()}}}function ap(t){let e,l;return e=new el({props:{to:"/mqtt-ca",$$slots:{default:[fp]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i[3]&16384&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function up(t){let e,l,n,i,o,a,u,c;return l=new el({props:{to:"/mqtt-ca",$$slots:{default:[cp]},$$scope:{ctx:t}}}),o=new To({}),{c(){e=m("span"),ie(l.$$.fragment),n=h(),i=m("span"),ie(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,_){M(f,e,_),le(l,e,null),M(f,n,_),M(f,i,_),le(o,i,null),a=!0,u||(c=[ee(i,"click",t[11]),ee(i,"keypress",t[11])],u=!0)},p(f,_){const p={};_[3]&16384&&(p.$$scope={dirty:_,ctx:f}),l.$set(p)},i(f){a||(D(l.$$.fragment,f),D(o.$$.fragment,f),a=!0)},o(f){q(l.$$.fragment,f),q(o.$$.fragment,f),a=!1},d(f){f&&C(e),ne(l),f&&C(n),f&&C(i),ne(o),u=!1,ze(c)}}}function fp(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload CA",title:"Click here to upload CA"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function cp(t){let e;return{c(){e=T("CA OK")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function mp(t){let e,l;return e=new el({props:{to:"/mqtt-cert",$$slots:{default:[_p]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i[3]&16384&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function pp(t){let e,l,n,i,o,a,u,c;return l=new el({props:{to:"/mqtt-cert",$$slots:{default:[dp]},$$scope:{ctx:t}}}),o=new To({}),{c(){e=m("span"),ie(l.$$.fragment),n=h(),i=m("span"),ie(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,_){M(f,e,_),le(l,e,null),M(f,n,_),M(f,i,_),le(o,i,null),a=!0,u||(c=[ee(i,"click",t[12]),ee(i,"keypress",t[12])],u=!0)},p(f,_){const p={};_[3]&16384&&(p.$$scope={dirty:_,ctx:f}),l.$set(p)},i(f){a||(D(l.$$.fragment,f),D(o.$$.fragment,f),a=!0)},o(f){q(l.$$.fragment,f),q(o.$$.fragment,f),a=!1},d(f){f&&C(e),ne(l),f&&C(n),f&&C(i),ne(o),u=!1,ze(c)}}}function _p(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload cert",title:"Click here to upload certificate"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function dp(t){let e;return{c(){e=T("Cert OK")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function vp(t){let e,l;return e=new el({props:{to:"/mqtt-key",$$slots:{default:[bp]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i[3]&16384&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function hp(t){let e,l,n,i,o,a,u,c;return l=new el({props:{to:"/mqtt-key",$$slots:{default:[gp]},$$scope:{ctx:t}}}),o=new To({}),{c(){e=m("span"),ie(l.$$.fragment),n=h(),i=m("span"),ie(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,_){M(f,e,_),le(l,e,null),M(f,n,_),M(f,i,_),le(o,i,null),a=!0,u||(c=[ee(i,"click",t[13]),ee(i,"keypress",t[13])],u=!0)},p(f,_){const p={};_[3]&16384&&(p.$$scope={dirty:_,ctx:f}),l.$set(p)},i(f){a||(D(l.$$.fragment,f),D(o.$$.fragment,f),a=!0)},o(f){q(l.$$.fragment,f),q(o.$$.fragment,f),a=!1},d(f){f&&C(e),ne(l),f&&C(n),f&&C(i),ne(o),u=!1,ze(c)}}}function bp(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload key",title:"Click here to upload key"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function gp(t){let e;return{c(){e=T("Key OK")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function vf(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,w,$,N,E,B,P,L,O,F,x,j,z,G,V,W,U,K;return o=new Bt({}),{c(){e=m("div"),l=m("strong"),l.textContent="Domoticz",n=h(),i=m("a"),ie(o.$$.fragment),a=h(),u=m("input"),c=h(),f=m("div"),_=m("div"),p=T("Electricity IDX"),b=m("br"),v=h(),d=m("input"),S=h(),w=m("div"),$=T("Current IDX"),N=m("br"),E=h(),B=m("input"),P=h(),L=m("div"),O=T(`Voltage IDX: L1, L2 & L3 + `),F=m("div"),x=m("input"),j=h(),z=m("input"),G=h(),V=m("input"),r(l,"class","text-sm"),r(i,"href",Ut("MQTT-configuration#domoticz")),r(i,"target","_blank"),r(i,"class","float-right"),r(u,"type","hidden"),r(u,"name","o"),u.value="true",r(d,"name","oe"),r(d,"type","text"),r(d,"class","in-f tr w-full"),r(_,"class","w-1/2"),r(B,"name","oc"),r(B,"type","text"),r(B,"class","in-l tr w-full"),r(w,"class","w-1/2"),r(f,"class","my-1 flex"),r(x,"name","ou1"),r(x,"type","text"),r(x,"class","in-f tr w-1/3"),r(z,"name","ou2"),r(z,"type","text"),r(z,"class","in-m tr w-1/3"),r(V,"name","ou3"),r(V,"type","text"),r(V,"class","in-l tr w-1/3"),r(F,"class","flex"),r(L,"class","my-1"),r(e,"class","cnt")},m(H,Y){M(H,e,Y),s(e,l),s(e,n),s(e,i),le(o,i,null),s(e,a),s(e,u),s(e,c),s(e,f),s(f,_),s(_,p),s(_,b),s(_,v),s(_,d),te(d,t[3].o.e),s(f,S),s(f,w),s(w,$),s(w,N),s(w,E),s(w,B),te(B,t[3].o.c),s(e,P),s(e,L),s(L,O),s(L,F),s(F,x),te(x,t[3].o.u1),s(F,j),s(F,z),te(z,t[3].o.u2),s(F,G),s(F,V),te(V,t[3].o.u3),W=!0,U||(K=[ee(d,"input",t[63]),ee(B,"input",t[64]),ee(x,"input",t[65]),ee(z,"input",t[66]),ee(V,"input",t[67])],U=!0)},p(H,Y){Y[0]&8&&d.value!==H[3].o.e&&te(d,H[3].o.e),Y[0]&8&&B.value!==H[3].o.c&&te(B,H[3].o.c),Y[0]&8&&x.value!==H[3].o.u1&&te(x,H[3].o.u1),Y[0]&8&&z.value!==H[3].o.u2&&te(z,H[3].o.u2),Y[0]&8&&V.value!==H[3].o.u3&&te(V,H[3].o.u3)},i(H){W||(D(o.$$.fragment,H),W=!0)},o(H){q(o.$$.fragment,H),W=!1},d(H){H&&C(e),ne(o),U=!1,ze(K)}}}function hf(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,w,$,N,E,B,P,L,O,F,x,j,z,G,V;return o=new Bt({}),{c(){e=m("div"),l=m("strong"),l.textContent="Home-Assistant",n=h(),i=m("a"),ie(o.$$.fragment),a=h(),u=m("input"),c=h(),f=m("div"),_=T("Discovery topic prefix"),p=m("br"),b=h(),v=m("input"),d=h(),S=m("div"),w=T("Hostname for URL"),$=m("br"),N=h(),E=m("input"),P=h(),L=m("div"),O=T("Name tag"),F=m("br"),x=h(),j=m("input"),r(l,"class","text-sm"),r(i,"href",Ut("MQTT-configuration#home-assistant")),r(i,"target","_blank"),r(i,"class","float-right"),r(u,"type","hidden"),r(u,"name","h"),u.value="true",r(v,"name","ht"),r(v,"type","text"),r(v,"class","in-s"),r(v,"placeholder","homeassistant"),r(f,"class","my-1"),r(E,"name","hh"),r(E,"type","text"),r(E,"class","in-s"),r(E,"placeholder",B=t[3].g.h+".local"),r(S,"class","my-1"),r(j,"name","hn"),r(j,"type","text"),r(j,"class","in-s"),r(L,"class","my-1"),r(e,"class","cnt")},m(W,U){M(W,e,U),s(e,l),s(e,n),s(e,i),le(o,i,null),s(e,a),s(e,u),s(e,c),s(e,f),s(f,_),s(f,p),s(f,b),s(f,v),te(v,t[3].h.t),s(e,d),s(e,S),s(S,w),s(S,$),s(S,N),s(S,E),te(E,t[3].h.h),s(e,P),s(e,L),s(L,O),s(L,F),s(L,x),s(L,j),te(j,t[3].h.n),z=!0,G||(V=[ee(v,"input",t[68]),ee(E,"input",t[69]),ee(j,"input",t[70])],G=!0)},p(W,U){U[0]&8&&v.value!==W[3].h.t&&te(v,W[3].h.t),(!z||U[0]&8&&B!==(B=W[3].g.h+".local"))&&r(E,"placeholder",B),U[0]&8&&E.value!==W[3].h.h&&te(E,W[3].h.h),U[0]&8&&j.value!==W[3].h.n&&te(j,W[3].h.n)},i(W){z||(D(o.$$.fragment,W),z=!0)},o(W){q(o.$$.fragment,W),z=!1},d(W){W&&C(e),ne(o),G=!1,ze(V)}}}function bf(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d=t[3].c.es&&gf(t);return{c(){e=m("div"),l=m("input"),n=h(),i=m("strong"),i.textContent="Cloud connections",o=h(),a=m("div"),u=m("label"),c=m("input"),f=T(" Energy Speedometer"),_=h(),d&&d.c(),r(l,"type","hidden"),r(l,"name","c"),l.value="true",r(i,"class","text-sm"),r(c,"type","checkbox"),r(c,"class","rounded mb-1"),r(c,"name","ces"),c.__value="true",c.value=c.__value,r(a,"class","my-1"),r(e,"class","cnt")},m(S,w){M(S,e,w),s(e,l),s(e,n),s(e,i),s(e,o),s(e,a),s(a,u),s(u,c),c.checked=t[3].c.es,s(u,f),s(a,_),d&&d.m(a,null),p=!0,b||(v=ee(c,"change",t[71]),b=!0)},p(S,w){w[0]&8&&(c.checked=S[3].c.es),S[3].c.es?d?(d.p(S,w),w[0]&8&&D(d,1)):(d=gf(S),d.c(),D(d,1),d.m(a,null)):d&&(De(),q(d,1,1,()=>{d=null}),Ie())},i(S){p||(D(d),p=!0)},o(S){q(d),p=!1},d(S){S&&C(e),d&&d.d(),b=!1,v()}}}function gf(t){let e,l,n=t[0].mac+"",i,o,a,u,c=(t[0].meter.id?t[0].meter.id:"missing, required")+"",f,_,p,b,v=t[0].mac&&t[0].meter.id&&kf(t);return{c(){e=m("div"),l=T("MAC: "),i=T(n),o=h(),a=m("div"),u=T("Meter ID: "),f=T(c),_=h(),v&&v.c(),p=Ve(),r(e,"class","pl-5"),r(a,"class","pl-5")},m(d,S){M(d,e,S),s(e,l),s(e,i),M(d,o,S),M(d,a,S),s(a,u),s(a,f),M(d,_,S),v&&v.m(d,S),M(d,p,S),b=!0},p(d,S){(!b||S[0]&1)&&n!==(n=d[0].mac+"")&&X(i,n),(!b||S[0]&1)&&c!==(c=(d[0].meter.id?d[0].meter.id:"missing, required")+"")&&X(f,c),d[0].mac&&d[0].meter.id?v?(v.p(d,S),S[0]&1&&D(v,1)):(v=kf(d),v.c(),D(v,1),v.m(p.parentNode,p)):v&&(De(),q(v,1,1,()=>{v=null}),Ie())},i(d){b||(D(v),b=!0)},o(d){q(v),b=!1},d(d){d&&C(e),d&&C(o),d&&C(a),d&&C(_),v&&v.d(d),d&&C(p)}}}function kf(t){let e,l,n;return l=new np({props:{value:'{"mac":"'+t[0].mac+'","meter":"'+t[0].meter.id+'"}'}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","pl-2")},m(i,o){M(i,e,o),le(l,e,null),n=!0},p(i,o){const a={};o[0]&1&&(a.value='{"mac":"'+i[0].mac+'","meter":"'+i[0].meter.id+'"}'),l.$set(a)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function wf(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,w,$,N,E;o=new Bt({});let B={length:9},P=[];for(let L=0;L20&&$f(t),_=t[0].chip=="esp8266"&&Nf(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Hardware",n=h(),i=m("a"),ie(o.$$.fragment),a=h(),f&&f.c(),u=h(),_&&_.c(),r(l,"class","text-sm"),r(i,"href",Ut("GPIO-configuration")),r(i,"target","_blank"),r(i,"class","float-right"),r(e,"class","cnt")},m(p,b){M(p,e,b),s(e,l),s(e,n),s(e,i),le(o,i,null),s(e,a),f&&f.m(e,null),s(e,u),_&&_.m(e,null),c=!0},p(p,b){p[0].board>20?f?(f.p(p,b),b[0]&1&&D(f,1)):(f=$f(p),f.c(),D(f,1),f.m(e,u)):f&&(De(),q(f,1,1,()=>{f=null}),Ie()),p[0].chip=="esp8266"?_?_.p(p,b):(_=Nf(p),_.c(),_.m(e,null)):_&&(_.d(1),_=null)},i(p){c||(D(o.$$.fragment,p),D(f),c=!0)},o(p){q(o.$$.fragment,p),q(f),c=!1},d(p){p&&C(e),ne(o),f&&f.d(),_&&_.d()}}}function $f(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,w,$,N,E,B,P,L,O,F,x,j,z,G,V,W,U,K,H,Y,Z,re,ue,ke,me,Se,je,Re,He,we,Te,Le,Me,y,g,k,A,I,Q,J,se,ce,ve,$e,oe;b=new Qc({props:{chip:t[0].chip}});let pe=t[0].chip!="esp8266"&&Sf(t),Be=t[3].i.v.p>0&&Tf(t);return{c(){e=m("input"),l=h(),n=m("div"),i=m("div"),o=T("HAN"),a=m("label"),u=m("input"),c=T(" pullup"),f=m("br"),_=h(),p=m("select"),ie(b.$$.fragment),v=h(),d=m("div"),S=T("AP button"),w=m("br"),$=h(),N=m("input"),E=h(),B=m("div"),P=T("LED"),L=m("label"),O=m("input"),F=T(" inv"),x=m("br"),j=h(),z=m("div"),G=m("input"),V=h(),W=m("div"),U=T("RGB"),K=m("label"),H=m("input"),Y=T(" inverted"),Z=m("br"),re=h(),ue=m("div"),ke=m("input"),me=h(),Se=m("input"),je=h(),Re=m("input"),He=h(),we=m("div"),Te=T("Temperature"),Le=m("br"),Me=h(),y=m("input"),g=h(),k=m("div"),A=T("Analog temp"),I=m("br"),Q=h(),J=m("input"),se=h(),pe&&pe.c(),ce=h(),Be&&Be.c(),r(e,"type","hidden"),r(e,"name","i"),e.value="true",r(u,"name","ihu"),u.__value="true",u.value=u.__value,r(u,"type","checkbox"),r(u,"class","rounded mb-1"),r(a,"class","ml-2"),r(p,"name","ihp"),r(p,"class","in-f w-full"),t[3].i.h.p===void 0&&Qe(()=>t[76].call(p)),r(i,"class","w-1/3"),r(N,"name","ia"),r(N,"type","number"),r(N,"min","0"),r(N,"max",t[6]),r(N,"class","in-m tr w-full"),r(d,"class","w-1/3"),r(O,"name","ili"),O.__value="true",O.value=O.__value,r(O,"type","checkbox"),r(O,"class","rounded mb-1"),r(L,"class","ml-4"),r(G,"name","ilp"),r(G,"type","number"),r(G,"min","0"),r(G,"max",t[6]),r(G,"class","in-l tr w-full"),r(z,"class","flex"),r(B,"class","w-1/3"),r(H,"name","iri"),H.__value="true",H.value=H.__value,r(H,"type","checkbox"),r(H,"class","rounded mb-1"),r(K,"class","ml-4"),r(ke,"name","irr"),r(ke,"type","number"),r(ke,"min","0"),r(ke,"max",t[6]),r(ke,"class","in-f tr w-1/3"),r(Se,"name","irg"),r(Se,"type","number"),r(Se,"min","0"),r(Se,"max",t[6]),r(Se,"class","in-m tr w-1/3"),r(Re,"name","irb"),r(Re,"type","number"),r(Re,"min","0"),r(Re,"max",t[6]),r(Re,"class","in-l tr w-1/3"),r(ue,"class","flex"),r(W,"class","w-full"),r(y,"name","itd"),r(y,"type","number"),r(y,"min","0"),r(y,"max",t[6]),r(y,"class","in-f tr w-full"),r(we,"class","my-1 w-1/3"),r(J,"name","ita"),r(J,"type","number"),r(J,"min","0"),r(J,"max",t[6]),r(J,"class","in-l tr w-full"),r(k,"class","my-1 pr-1 w-1/3"),r(n,"class","flex flex-wrap")},m(_e,ye){M(_e,e,ye),M(_e,l,ye),M(_e,n,ye),s(n,i),s(i,o),s(i,a),s(a,u),u.checked=t[3].i.h.u,s(a,c),s(i,f),s(i,_),s(i,p),le(b,p,null),qe(p,t[3].i.h.p,!0),s(n,v),s(n,d),s(d,S),s(d,w),s(d,$),s(d,N),te(N,t[3].i.a),s(n,E),s(n,B),s(B,P),s(B,L),s(L,O),O.checked=t[3].i.l.i,s(L,F),s(B,x),s(B,j),s(B,z),s(z,G),te(G,t[3].i.l.p),s(n,V),s(n,W),s(W,U),s(W,K),s(K,H),H.checked=t[3].i.r.i,s(K,Y),s(W,Z),s(W,re),s(W,ue),s(ue,ke),te(ke,t[3].i.r.r),s(ue,me),s(ue,Se),te(Se,t[3].i.r.g),s(ue,je),s(ue,Re),te(Re,t[3].i.r.b),s(n,He),s(n,we),s(we,Te),s(we,Le),s(we,Me),s(we,y),te(y,t[3].i.t.d),s(n,g),s(n,k),s(k,A),s(k,I),s(k,Q),s(k,J),te(J,t[3].i.t.a),s(n,se),pe&&pe.m(n,null),s(n,ce),Be&&Be.m(n,null),ve=!0,$e||(oe=[ee(u,"change",t[75]),ee(p,"change",t[76]),ee(N,"input",t[77]),ee(O,"change",t[78]),ee(G,"input",t[79]),ee(H,"change",t[80]),ee(ke,"input",t[81]),ee(Se,"input",t[82]),ee(Re,"input",t[83]),ee(y,"input",t[84]),ee(J,"input",t[85])],$e=!0)},p(_e,ye){ye[0]&8&&(u.checked=_e[3].i.h.u);const vt={};ye[0]&1&&(vt.chip=_e[0].chip),b.$set(vt),ye[0]&8&&qe(p,_e[3].i.h.p),(!ve||ye[0]&64)&&r(N,"max",_e[6]),ye[0]&8&&he(N.value)!==_e[3].i.a&&te(N,_e[3].i.a),ye[0]&8&&(O.checked=_e[3].i.l.i),(!ve||ye[0]&64)&&r(G,"max",_e[6]),ye[0]&8&&he(G.value)!==_e[3].i.l.p&&te(G,_e[3].i.l.p),ye[0]&8&&(H.checked=_e[3].i.r.i),(!ve||ye[0]&64)&&r(ke,"max",_e[6]),ye[0]&8&&he(ke.value)!==_e[3].i.r.r&&te(ke,_e[3].i.r.r),(!ve||ye[0]&64)&&r(Se,"max",_e[6]),ye[0]&8&&he(Se.value)!==_e[3].i.r.g&&te(Se,_e[3].i.r.g),(!ve||ye[0]&64)&&r(Re,"max",_e[6]),ye[0]&8&&he(Re.value)!==_e[3].i.r.b&&te(Re,_e[3].i.r.b),(!ve||ye[0]&64)&&r(y,"max",_e[6]),ye[0]&8&&he(y.value)!==_e[3].i.t.d&&te(y,_e[3].i.t.d),(!ve||ye[0]&64)&&r(J,"max",_e[6]),ye[0]&8&&he(J.value)!==_e[3].i.t.a&&te(J,_e[3].i.t.a),_e[0].chip!="esp8266"?pe?pe.p(_e,ye):(pe=Sf(_e),pe.c(),pe.m(n,ce)):pe&&(pe.d(1),pe=null),_e[3].i.v.p>0?Be?Be.p(_e,ye):(Be=Tf(_e),Be.c(),Be.m(n,null)):Be&&(Be.d(1),Be=null)},i(_e){ve||(D(b.$$.fragment,_e),ve=!0)},o(_e){q(b.$$.fragment,_e),ve=!1},d(_e){_e&&C(e),_e&&C(l),_e&&C(n),ne(b),pe&&pe.d(),Be&&Be.d(),$e=!1,ze(oe)}}}function Sf(t){let e,l,n,i,o,a,u;return{c(){e=m("div"),l=T("Vcc"),n=m("br"),i=h(),o=m("input"),r(o,"name","ivp"),r(o,"type","number"),r(o,"min","0"),r(o,"max",t[6]),r(o,"class","in-s tr w-full"),r(e,"class","my-1 pl-1 w-1/3")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),te(o,t[3].i.v.p),a||(u=ee(o,"input",t[86]),a=!0)},p(c,f){f[0]&64&&r(o,"max",c[6]),f[0]&8&&he(o.value)!==c[3].i.v.p&&te(o,c[3].i.v.p)},d(c){c&&C(e),a=!1,u()}}}function Tf(t){let e,l,n,i,o,a,u,c,f,_;return{c(){e=m("div"),l=T("Voltage divider"),n=m("br"),i=h(),o=m("div"),a=m("input"),u=h(),c=m("input"),r(a,"name","ivdv"),r(a,"type","number"),r(a,"min","0"),r(a,"max","65535"),r(a,"class","in-f tr w-full"),r(a,"placeholder","VCC"),r(c,"name","ivdg"),r(c,"type","number"),r(c,"min","0"),r(c,"max","65535"),r(c,"class","in-l tr w-full"),r(c,"placeholder","GND"),r(o,"class","flex"),r(e,"class","my-1")},m(p,b){M(p,e,b),s(e,l),s(e,n),s(e,i),s(e,o),s(o,a),te(a,t[3].i.v.d.v),s(o,u),s(o,c),te(c,t[3].i.v.d.g),f||(_=[ee(a,"input",t[87]),ee(c,"input",t[88])],f=!0)},p(p,b){b[0]&8&&he(a.value)!==p[3].i.v.d.v&&te(a,p[3].i.v.d.v),b[0]&8&&he(c.value)!==p[3].i.v.d.g&&te(c,p[3].i.v.d.g)},d(p){p&&C(e),f=!1,ze(_)}}}function Nf(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,w,$,N=(t[0].board==2||t[0].board==100)&&Af(t);return{c(){e=m("input"),l=h(),n=m("div"),i=m("div"),o=T("Vcc offset"),a=m("br"),u=h(),c=m("input"),f=h(),_=m("div"),p=T("Multiplier"),b=m("br"),v=h(),d=m("input"),S=h(),N&&N.c(),r(e,"type","hidden"),r(e,"name","iv"),e.value="true",r(c,"name","ivo"),r(c,"type","number"),r(c,"min","0.0"),r(c,"max","3.5"),r(c,"step","0.01"),r(c,"class","in-f tr w-full"),r(i,"class","w-1/3"),r(d,"name","ivm"),r(d,"type","number"),r(d,"min","0.1"),r(d,"max","10"),r(d,"step","0.01"),r(d,"class","in-l tr w-full"),r(_,"class","w-1/3 pr-1"),r(n,"class","my-1 flex flex-wrap")},m(E,B){M(E,e,B),M(E,l,B),M(E,n,B),s(n,i),s(i,o),s(i,a),s(i,u),s(i,c),te(c,t[3].i.v.o),s(n,f),s(n,_),s(_,p),s(_,b),s(_,v),s(_,d),te(d,t[3].i.v.m),s(n,S),N&&N.m(n,null),w||($=[ee(c,"input",t[89]),ee(d,"input",t[90])],w=!0)},p(E,B){B[0]&8&&he(c.value)!==E[3].i.v.o&&te(c,E[3].i.v.o),B[0]&8&&he(d.value)!==E[3].i.v.m&&te(d,E[3].i.v.m),E[0].board==2||E[0].board==100?N?N.p(E,B):(N=Af(E),N.c(),N.m(n,null)):N&&(N.d(1),N=null)},d(E){E&&C(e),E&&C(l),E&&C(n),N&&N.d(),w=!1,ze($)}}}function Af(t){let e,l,n,i,o,a,u;return{c(){e=m("div"),l=T("Boot limit"),n=m("br"),i=h(),o=m("input"),r(o,"name","ivb"),r(o,"type","number"),r(o,"min","2.5"),r(o,"max","3.5"),r(o,"step","0.1"),r(o,"class","in-s tr w-full"),r(e,"class","w-1/3 pl-1")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),te(o,t[3].i.v.b),a||(u=ee(o,"input",t[91]),a=!0)},p(c,f){f[0]&8&&he(o.value)!==c[3].i.v.b&&te(o,c[3].i.v.b)},d(c){c&&C(e),a=!1,u()}}}function Pf(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,w,$=t[3].d.t&&Ef();return{c(){e=m("div"),e.textContent="Debug can cause sudden reboots. Do not leave on!",l=h(),n=m("div"),i=m("label"),o=m("input"),a=T(" Enable telnet"),u=h(),$&&$.c(),c=h(),f=m("div"),_=m("select"),p=m("option"),p.textContent="Verbose",b=m("option"),b.textContent="Debug",v=m("option"),v.textContent="Info",d=m("option"),d.textContent="Warning",r(e,"class","bd-red"),r(o,"type","checkbox"),r(o,"name","dt"),o.__value="true",o.value=o.__value,r(o,"class","rounded mb-1"),r(n,"class","my-1"),p.__value=1,p.value=p.__value,b.__value=2,b.value=b.__value,v.__value=3,v.value=v.__value,d.__value=4,d.value=d.__value,r(_,"name","dl"),r(_,"class","in-s"),t[3].d.l===void 0&&Qe(()=>t[94].call(_)),r(f,"class","my-1")},m(N,E){M(N,e,E),M(N,l,E),M(N,n,E),s(n,i),s(i,o),o.checked=t[3].d.t,s(i,a),M(N,u,E),$&&$.m(N,E),M(N,c,E),M(N,f,E),s(f,_),s(_,p),s(_,b),s(_,v),s(_,d),qe(_,t[3].d.l,!0),S||(w=[ee(o,"change",t[93]),ee(_,"change",t[94])],S=!0)},p(N,E){E[0]&8&&(o.checked=N[3].d.t),N[3].d.t?$||($=Ef(),$.c(),$.m(c.parentNode,c)):$&&($.d(1),$=null),E[0]&8&&qe(_,N[3].d.l)},d(N){N&&C(e),N&&C(l),N&&C(n),N&&C(u),$&&$.d(N),N&&C(c),N&&C(f),S=!1,ze(w)}}}function Ef(t){let e;return{c(){e=m("div"),e.textContent="Telnet is unsafe and should be off when not in use",r(e,"class","bd-red")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function kp(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,w,$,N,E,B,P,L,O,F,x,j,z,G,V,W,U,K,H,Y,Z,re,ue,ke,me,Se,je,Re,He,we,Te,Le,Me,y,g,k,A,I,Q,J,se,ce,ve,$e,oe,pe,Be,_e,ye,vt,Hl,tl,ct,Tl,pl,Ht,ht,Xe,Ze,Je,Ue,xe,We,et,tt,de,Ce,Ei,_l,_n,Tt,Di,Ii,Ri,dl,Li,Oi,Fi,Nt,Nl,Al,Pl,qi,Ge,Ae,vl,Ts,El,Rt,Bi,Wl,Ao,ll,Ui,Po,Ns,Eo,ci,Wt,Do,Io,Dl,nl,Il,Ro,ji,Lo,pt,Rl,Oo,Hi,dn,vn,hn,bn,Wi,Fo,At,zi,qo,zl,Bo,Uo,jo,il,gn,kn,Ho,wn,Gl,Wo,zo,Go,yn,zt,Vo,Gi,Ko,Vl,Yo,Qo,Xo,Cn,Gt,Zo,Vi,Jo,As,xo,Kl,Ki,Vt,er,tr,lr,Ps,Yi,Kt,nr,ir,sr,mt,Qi,or,Mn,$n,rr,mi,ar,Yl,ur,fr,cr,hl,mr,Ql,pr,_r,dr,bl,vr,Sn,Xl,hr,br,gr,Lt,Tn,Nn,An,Pn,kr,Zl,wr,yr,Cr,En,Ot,Mr,Xi,$r,Zi,Ji,Yt,Sr,Tr,ut,xi,Nr,Dn,In,Ar,Jl,Pr,Er,Dr,Ll,sl,Rn,Ln,Ir,Pt,es,ts,Rr,Et,On,ls,ns,Lr,Es,is,ss,Qt,Or,Fr,pi,qr,Ol,Br,_i,Xt,Ur,jr,Hr,os,gl,Wr,Ye,rs,zr,Fn,qn,Gr,di,Vr,ol,Kr,Ds,Yr,Qr,Bn,kl,Xr,Zt,Zr,Is,xl,Jr,xr,ea,wl,ta,en,la,na,ia,yl,sa,Un,jn,oa,ra,aa,Cl,ua,Hn,fa,ca,ma,bt,Wn,zn,Gn,Vn,Kn,Yn,pa,tn,_a,da,va,Ml,ha,Rs,Ls,Os,Fs=t[3].p.r.startsWith("10YNO")||t[3].p.r.startsWith("10Y1001A1001A4"),qs,rl,as,ba,Qn,Xn,ga,vi,ka,hi,wa,Bs,Dt,us,ya,Zn,Jn,Ca,bi,Ma,fs,cs,Jt,$a,Sa,Ta,Fl,Us,xn,Na,ms,ei,Aa,ps,js,ln,Hs,nn,Ws,sn,zs,on,Ft,Gs,Pa;u=new Bt({}),F=new Xm({});let Jc=["NOK","SEK","DKK","EUR"],gi=[];for(let R=0;R<4;R+=1)gi[R]=op(sp(t,Jc,R));let gt=t[3].p.e&&t[0].chip!="esp8266"&&af(t),kt=t[3].g.s>0&&uf(t);Rt=new Bt({});let xc=[24,48,96,192,384,576,1152],ki=[];for(let R=0;R<7;R+=1)ki[R]=rp(ip(t,xc,R));let wt=t[3].m.e.e&&ff(t),yt=t[3].m.e.e&&cf(t),Ct=t[3].m.m.e&&mf(t);$n=new Bt({}),In=new Bt({}),On=new Xc({});let Mt=t[3].n.m=="static"&&pf(t);qn=new Bt({});let $t=t[0].chip!="esp8266"&&_f(t),lt=t[3].q.s.e&&df(t),nt=t[3].q.m==3&&vf(t),it=t[3].q.m==4&&hf(t),st=t[3].c.es!=null&&bf(t),ot=Fs&&wf(t);Xn=new Bt({});let ti=t[7],_t=[];for(let R=0;R20||t[0].chip=="esp8266")&&Mf(t);Jn=new Bt({});let St=t[3].d.s&&Pf(t);return ln=new It({props:{active:t[1],message:"Loading configuration"}}),nn=new It({props:{active:t[2],message:"Saving configuration"}}),sn=new It({props:{active:t[4],message:"Performing factory reset"}}),on=new It({props:{active:t[5],message:"Device have been factory reset and switched to AP mode"}}),{c(){e=m("form"),l=m("div"),n=m("div"),i=m("strong"),i.textContent="General",o=h(),a=m("a"),ie(u.$$.fragment),c=h(),f=m("input"),_=h(),p=m("div"),b=m("div"),v=m("div"),d=T("Hostname"),S=m("br"),w=h(),$=m("input"),N=h(),E=m("div"),B=T("Time zone"),P=m("br"),L=h(),O=m("select"),ie(F.$$.fragment),x=h(),j=m("input"),z=h(),G=m("div"),V=m("div"),W=m("div"),U=T("Price region"),K=m("br"),H=h(),Y=m("select"),Z=m("optgroup"),re=m("option"),re.textContent="NO1",ue=m("option"),ue.textContent="NO2",ke=m("option"),ke.textContent="NO3",me=m("option"),me.textContent="NO4",Se=m("option"),Se.textContent="NO5",je=m("optgroup"),Re=m("option"),Re.textContent="SE1",He=m("option"),He.textContent="SE2",we=m("option"),we.textContent="SE3",Te=m("option"),Te.textContent="SE4",Le=m("optgroup"),Me=m("option"),Me.textContent="DK1",y=m("option"),y.textContent="DK2",g=m("option"),g.textContent="Austria",k=m("option"),k.textContent="Belgium",A=m("option"),A.textContent="Czech Republic",I=m("option"),I.textContent="Estonia",Q=m("option"),Q.textContent="Finland",J=m("option"),J.textContent="France",se=m("option"),se.textContent="Germany",ce=m("option"),ce.textContent="Great Britain",ve=m("option"),ve.textContent="Latvia",$e=m("option"),$e.textContent="Lithuania",oe=m("option"),oe.textContent="Netherland",pe=m("option"),pe.textContent="Poland",Be=m("option"),Be.textContent="Switzerland",_e=h(),ye=m("div"),vt=T("Currency"),Hl=m("br"),tl=h(),ct=m("select");for(let R=0;R<4;R+=1)gi[R].c();Tl=h(),pl=m("div"),Ht=m("div"),ht=m("div"),Xe=T("Fixed price"),Ze=m("br"),Je=h(),Ue=m("input"),xe=h(),We=m("div"),et=T("Multiplier"),tt=m("br"),de=h(),Ce=m("input"),Ei=h(),_l=m("div"),_n=m("label"),Tt=m("input"),Di=T(" Enable price fetch from remote server"),Ii=h(),gt&>.c(),Ri=h(),dl=m("div"),Li=T("Security"),Oi=m("br"),Fi=h(),Nt=m("select"),Nl=m("option"),Nl.textContent="None",Al=m("option"),Al.textContent="Only configuration",Pl=m("option"),Pl.textContent="Everything",qi=h(),kt&&kt.c(),Ge=h(),Ae=m("div"),vl=m("strong"),vl.textContent="Meter",Ts=h(),El=m("a"),ie(Rt.$$.fragment),Bi=h(),Wl=m("input"),Ao=h(),ll=m("div"),Ui=m("span"),Ui.textContent="Buffer size",Po=h(),Ns=m("span"),Ns.textContent="Serial conf.",Eo=h(),ci=m("label"),Wt=m("input"),Do=T(" inverted"),Io=h(),Dl=m("div"),nl=m("select"),Il=m("option"),Ro=T("Autodetect");for(let R=0;R<7;R+=1)ki[R].c();Lo=h(),pt=m("select"),Rl=m("option"),Oo=T("-"),dn=m("option"),dn.textContent="7N1",vn=m("option"),vn.textContent="8N1",hn=m("option"),hn.textContent="7E1",bn=m("option"),bn.textContent="8E1",Fo=h(),At=m("input"),qo=h(),zl=m("div"),Bo=T("Voltage"),Uo=m("br"),jo=h(),il=m("select"),gn=m("option"),gn.textContent="400V (TN)",kn=m("option"),kn.textContent="230V (IT/TT)",Ho=h(),wn=m("div"),Gl=m("div"),Wo=T("Main fuse"),zo=m("br"),Go=h(),yn=m("label"),zt=m("input"),Vo=h(),Gi=m("span"),Gi.textContent="A",Ko=h(),Vl=m("div"),Yo=T("Production"),Qo=m("br"),Xo=h(),Cn=m("label"),Gt=m("input"),Zo=h(),Vi=m("span"),Vi.textContent="kWp",Jo=h(),As=m("div"),xo=h(),Kl=m("div"),Ki=m("label"),Vt=m("input"),er=T(" Meter is encrypted"),tr=h(),wt&&wt.c(),lr=h(),yt&&yt.c(),Ps=h(),Yi=m("label"),Kt=m("input"),nr=T(" Multipliers"),ir=h(),Ct&&Ct.c(),sr=h(),mt=m("div"),Qi=m("strong"),Qi.textContent="WiFi",or=h(),Mn=m("a"),ie($n.$$.fragment),rr=h(),mi=m("input"),ar=h(),Yl=m("div"),ur=T("SSID"),fr=m("br"),cr=h(),hl=m("input"),mr=h(),Ql=m("div"),pr=T("Password"),_r=m("br"),dr=h(),bl=m("input"),vr=h(),Sn=m("div"),Xl=m("div"),hr=T("Power saving"),br=m("br"),gr=h(),Lt=m("select"),Tn=m("option"),Tn.textContent="Default",Nn=m("option"),Nn.textContent="Off",An=m("option"),An.textContent="Minimum",Pn=m("option"),Pn.textContent="Maximum",kr=h(),Zl=m("div"),wr=T("Power"),yr=m("br"),Cr=h(),En=m("div"),Ot=m("input"),Mr=h(),Xi=m("span"),Xi.textContent="dBm",$r=h(),Zi=m("div"),Ji=m("label"),Yt=m("input"),Sr=T(" Allow 802.11b legacy rates"),Tr=h(),ut=m("div"),xi=m("strong"),xi.textContent="Network",Nr=h(),Dn=m("a"),ie(In.$$.fragment),Ar=h(),Jl=m("div"),Pr=T("IP"),Er=m("br"),Dr=h(),Ll=m("div"),sl=m("select"),Rn=m("option"),Rn.textContent="DHCP",Ln=m("option"),Ln.textContent="Static",Ir=h(),Pt=m("input"),Rr=h(),Et=m("select"),ie(On.$$.fragment),Lr=h(),Mt&&Mt.c(),Es=h(),is=m("div"),ss=m("label"),Qt=m("input"),Or=T(" enable mDNS"),Fr=h(),pi=m("input"),qr=h(),Ol=m("div"),Br=T("NTP "),_i=m("label"),Xt=m("input"),Ur=T(" obtain from DHCP"),jr=m("br"),Hr=h(),os=m("div"),gl=m("input"),Wr=h(),Ye=m("div"),rs=m("strong"),rs.textContent="MQTT",zr=h(),Fn=m("a"),ie(qn.$$.fragment),Gr=h(),di=m("input"),Vr=h(),ol=m("div"),Kr=T(`Server + `),$t&&$t.c(),Ds=h(),Yr=m("br"),Qr=h(),Bn=m("div"),kl=m("input"),Xr=h(),Zt=m("input"),Zr=h(),lt&<.c(),Is=h(),xl=m("div"),Jr=T("Username"),xr=m("br"),ea=h(),wl=m("input"),ta=h(),en=m("div"),la=T("Password"),na=m("br"),ia=h(),yl=m("input"),sa=h(),Un=m("div"),jn=m("div"),oa=T("Client ID"),ra=m("br"),aa=h(),Cl=m("input"),ua=h(),Hn=m("div"),fa=T("Payload"),ca=m("br"),ma=h(),bt=m("select"),Wn=m("option"),Wn.textContent="JSON",zn=m("option"),zn.textContent="Raw (minimal)",Gn=m("option"),Gn.textContent="Raw (full)",Vn=m("option"),Vn.textContent="Domoticz",Kn=m("option"),Kn.textContent="HomeAssistant",Yn=m("option"),Yn.textContent="HEX dump",pa=h(),tn=m("div"),_a=T("Publish topic"),da=m("br"),va=h(),Ml=m("input"),ha=h(),nt&&nt.c(),Rs=h(),it&&it.c(),Ls=h(),st&&st.c(),Os=h(),ot&&ot.c(),qs=h(),rl=m("div"),as=m("strong"),as.textContent="User interface",ba=h(),Qn=m("a"),ie(Xn.$$.fragment),ga=h(),vi=m("input"),ka=h(),hi=m("div");for(let R=0;R<_t.length;R+=1)_t[R].c();wa=h(),rt&&rt.c(),Bs=h(),Dt=m("div"),us=m("strong"),us.textContent="Debugging",ya=h(),Zn=m("a"),ie(Jn.$$.fragment),Ca=h(),bi=m("input"),Ma=h(),fs=m("div"),cs=m("label"),Jt=m("input"),$a=T(" Enable debugging"),Sa=h(),St&&St.c(),Ta=h(),Fl=m("div"),Us=m("div"),xn=m("button"),xn.textContent="Factory reset",Na=h(),ms=m("div"),ei=m("button"),ei.textContent="Reboot",Aa=h(),ps=m("div"),ps.innerHTML='',js=h(),ie(ln.$$.fragment),Hs=h(),ie(nn.$$.fragment),Ws=h(),ie(sn.$$.fragment),zs=h(),ie(on.$$.fragment),r(i,"class","text-sm"),r(a,"href",Ut("General-configuration")),r(a,"target","_blank"),r(a,"class","float-right"),r(f,"type","hidden"),r(f,"name","g"),f.value="true",r($,"name","gh"),r($,"type","text"),r($,"class","in-f w-full"),r($,"pattern","[A-Za-z0-9-]+"),r(O,"name","gt"),r(O,"class","in-l w-full"),t[3].g.t===void 0&&Qe(()=>t[16].call(O)),r(b,"class","flex"),r(p,"class","my-1"),r(j,"type","hidden"),r(j,"name","p"),j.value="true",re.__value="10YNO-1--------2",re.value=re.__value,ue.__value="10YNO-2--------T",ue.value=ue.__value,ke.__value="10YNO-3--------J",ke.value=ke.__value,me.__value="10YNO-4--------9",me.value=me.__value,Se.__value="10Y1001A1001A48H",Se.value=Se.__value,r(Z,"label","Norway"),Re.__value="10Y1001A1001A44P",Re.value=Re.__value,He.__value="10Y1001A1001A45N",He.value=He.__value,we.__value="10Y1001A1001A46L",we.value=we.__value,Te.__value="10Y1001A1001A47J",Te.value=Te.__value,r(je,"label","Sweden"),Me.__value="10YDK-1--------W",Me.value=Me.__value,y.__value="10YDK-2--------M",y.value=y.__value,r(Le,"label","Denmark"),g.__value="10YAT-APG------L",g.value=g.__value,k.__value="10YBE----------2",k.value=k.__value,A.__value="10YCZ-CEPS-----N",A.value=A.__value,I.__value="10Y1001A1001A39I",I.value=I.__value,Q.__value="10YFI-1--------U",Q.value=Q.__value,J.__value="10YFR-RTE------C",J.value=J.__value,se.__value="10Y1001A1001A83F",se.value=se.__value,ce.__value="10YGB----------A",ce.value=ce.__value,ve.__value="10YLV-1001A00074",ve.value=ve.__value,$e.__value="10YLT-1001A0008Q",$e.value=$e.__value,oe.__value="10YNL----------L",oe.value=oe.__value,pe.__value="10YPL-AREA-----S",pe.value=pe.__value,Be.__value="10YCH-SWISSGRIDZ",Be.value=Be.__value,r(Y,"name","pr"),r(Y,"class","in-f w-full"),t[3].p.r===void 0&&Qe(()=>t[17].call(Y)),r(W,"class","w-full"),r(ct,"name","pc"),r(ct,"class","in-l"),t[3].p.c===void 0&&Qe(()=>t[18].call(ct)),r(V,"class","flex"),r(G,"class","my-1"),r(Ue,"name","pf"),r(Ue,"type","number"),r(Ue,"min","0.001"),r(Ue,"max","65"),r(Ue,"step","0.001"),r(Ue,"class","in-f tr w-full"),r(ht,"class","w-1/2"),r(Ce,"name","pm"),r(Ce,"type","number"),r(Ce,"min","0.001"),r(Ce,"max","1000"),r(Ce,"step","0.001"),r(Ce,"class","in-l tr w-full"),r(We,"class","w-1/2"),r(Ht,"class","flex"),r(pl,"class","my-1"),r(Tt,"type","checkbox"),r(Tt,"name","pe"),Tt.__value="true",Tt.value=Tt.__value,r(Tt,"class","rounded mb-1"),r(_l,"class","my-1"),Nl.__value=0,Nl.value=Nl.__value,Al.__value=1,Al.value=Al.__value,Pl.__value=2,Pl.value=Pl.__value,r(Nt,"name","gs"),r(Nt,"class","in-s"),t[3].g.s===void 0&&Qe(()=>t[23].call(Nt)),r(dl,"class","my-1"),r(n,"class","cnt"),r(vl,"class","text-sm"),r(El,"href",Ut("Meter-configuration")),r(El,"target","_blank"),r(El,"class","float-right"),r(Wl,"type","hidden"),r(Wl,"name","m"),Wl.value="true",r(Ui,"class","float-right"),r(Wt,"name","mi"),Wt.__value="true",Wt.value=Wt.__value,r(Wt,"type","checkbox"),r(Wt,"class","rounded mb-1"),r(ci,"class","mt-2 ml-3 whitespace-nowrap"),Il.__value=0,Il.value=Il.__value,Il.disabled=ji=t[3].m.b!=0,r(nl,"name","mb"),r(nl,"class","in-f tr w-1/2"),t[3].m.b===void 0&&Qe(()=>t[27].call(nl)),Rl.__value=0,Rl.value=Rl.__value,Rl.disabled=Hi=t[3].m.b!=0,dn.__value=2,dn.value=dn.__value,vn.__value=3,vn.value=vn.__value,hn.__value=10,hn.value=hn.__value,bn.__value=11,bn.value=bn.__value,r(pt,"name","mp"),r(pt,"class","in-m"),pt.disabled=Wi=t[3].m.b==0,t[3].m.p===void 0&&Qe(()=>t[28].call(pt)),r(At,"name","ms"),r(At,"type","number"),r(At,"min",64),r(At,"max",zi=t[0].chip=="esp8266"?t[3].i.h.p==3||t[3].i.h.p==113?512:128:4096),r(At,"step",64),r(At,"class","in-l tr w-1/2"),r(Dl,"class","flex w-full"),r(ll,"class","my-1"),gn.__value=2,gn.value=gn.__value,kn.__value=1,kn.value=kn.__value,r(il,"name","md"),r(il,"class","in-s"),t[3].m.d===void 0&&Qe(()=>t[30].call(il)),r(zl,"class","my-1"),r(zt,"name","mf"),r(zt,"type","number"),r(zt,"min","5"),r(zt,"max","65535"),r(zt,"class","in-f tr w-full"),r(Gi,"class","in-post"),r(yn,"class","flex"),r(Gl,"class","mx-1"),r(Gt,"name","mr"),r(Gt,"type","number"),r(Gt,"min","0"),r(Gt,"max","65535"),r(Gt,"class","in-f tr w-full"),r(Vi,"class","in-post"),r(Cn,"class","flex"),r(Vl,"class","mx-1"),r(wn,"class","my-1 flex"),r(As,"class","my-1"),r(Vt,"type","checkbox"),r(Vt,"name","me"),Vt.__value="true",Vt.value=Vt.__value,r(Vt,"class","rounded mb-1"),r(Kl,"class","my-1"),r(Kt,"type","checkbox"),r(Kt,"name","mm"),Kt.__value="true",Kt.value=Kt.__value,r(Kt,"class","rounded mb-1"),r(Ae,"class","cnt"),r(Qi,"class","text-sm"),r(Mn,"href",Ut("WiFi-configuration")),r(Mn,"target","_blank"),r(Mn,"class","float-right"),r(mi,"type","hidden"),r(mi,"name","w"),mi.value="true",r(hl,"name","ws"),r(hl,"type","text"),r(hl,"class","in-s"),r(Yl,"class","my-1"),r(bl,"name","wp"),r(bl,"type","password"),r(bl,"class","in-s"),r(Ql,"class","my-1"),Tn.__value=255,Tn.value=Tn.__value,Nn.__value=0,Nn.value=Nn.__value,An.__value=1,An.value=An.__value,Pn.__value=2,Pn.value=Pn.__value,r(Lt,"name","wz"),r(Lt,"class","in-s"),t[3].w.z===void 0&&Qe(()=>t[43].call(Lt)),r(Xl,"class","w-1/2"),r(Ot,"name","ww"),r(Ot,"type","number"),r(Ot,"min","0"),r(Ot,"max","20.5"),r(Ot,"step","0.5"),r(Ot,"class","in-f tr w-full"),r(Xi,"class","in-post"),r(En,"class","flex"),r(Zl,"class","ml-2 w-1/2"),r(Sn,"class","my-1 flex"),r(Yt,"type","checkbox"),r(Yt,"name","wb"),Yt.__value="true",Yt.value=Yt.__value,r(Yt,"class","rounded mb-1"),r(Zi,"class","my-3"),r(mt,"class","cnt"),r(xi,"class","text-sm"),r(Dn,"href",Ut("Network-configuration")),r(Dn,"target","_blank"),r(Dn,"class","float-right"),Rn.__value="dhcp",Rn.value=Rn.__value,Ln.__value="static",Ln.value=Ln.__value,r(sl,"name","nm"),r(sl,"class","in-f"),t[3].n.m===void 0&&Qe(()=>t[46].call(sl)),r(Pt,"name","ni"),r(Pt,"type","text"),r(Pt,"class","in-m w-full"),Pt.disabled=es=t[3].n.m=="dhcp",Pt.required=ts=t[3].n.m=="static",r(Et,"name","ns"),r(Et,"class","in-l"),Et.disabled=ls=t[3].n.m=="dhcp",Et.required=ns=t[3].n.m=="static",t[3].n.s===void 0&&Qe(()=>t[48].call(Et)),r(Ll,"class","flex"),r(Jl,"class","my-1"),r(Qt,"name","nd"),Qt.__value="true",Qt.value=Qt.__value,r(Qt,"type","checkbox"),r(Qt,"class","rounded mb-1"),r(is,"class","my-1"),r(pi,"type","hidden"),r(pi,"name","ntp"),pi.value="true",r(Xt,"name","ntpd"),Xt.__value="true",Xt.value=Xt.__value,r(Xt,"type","checkbox"),r(Xt,"class","rounded mb-1"),r(_i,"class","ml-4"),r(gl,"name","ntph"),r(gl,"type","text"),r(gl,"class","in-s"),r(os,"class","flex"),r(Ol,"class","my-1"),r(ut,"class","cnt"),r(rs,"class","text-sm"),r(Fn,"href",Ut("MQTT-configuration")),r(Fn,"target","_blank"),r(Fn,"class","float-right"),r(di,"type","hidden"),r(di,"name","q"),di.value="true",r(kl,"name","qh"),r(kl,"type","text"),r(kl,"class","in-f w-3/4"),r(Zt,"name","qp"),r(Zt,"type","number"),r(Zt,"min","1024"),r(Zt,"max","65535"),r(Zt,"class","in-l tr w-1/4"),r(Bn,"class","flex"),r(ol,"class","my-1"),r(wl,"name","qu"),r(wl,"type","text"),r(wl,"class","in-s"),r(xl,"class","my-1"),r(yl,"name","qa"),r(yl,"type","password"),r(yl,"class","in-s"),r(en,"class","my-1"),r(Cl,"name","qc"),r(Cl,"type","text"),r(Cl,"class","in-f w-full"),Wn.__value=0,Wn.value=Wn.__value,zn.__value=1,zn.value=zn.__value,Gn.__value=2,Gn.value=Gn.__value,Vn.__value=3,Vn.value=Vn.__value,Kn.__value=4,Kn.value=Kn.__value,Yn.__value=255,Yn.value=Yn.__value,r(bt,"name","qm"),r(bt,"class","in-l"),t[3].q.m===void 0&&Qe(()=>t[61].call(bt)),r(Un,"class","my-1 flex"),r(Ml,"name","qb"),r(Ml,"type","text"),r(Ml,"class","in-s"),r(tn,"class","my-1"),r(Ye,"class","cnt"),r(as,"class","text-sm"),r(Qn,"href",Ut("User-interface")),r(Qn,"target","_blank"),r(Qn,"class","float-right"),r(vi,"type","hidden"),r(vi,"name","u"),vi.value="true",r(hi,"class","flex flex-wrap"),r(rl,"class","cnt"),r(us,"class","text-sm"),r(Zn,"href","https://amsleser.no/blog/post/24-telnet-debug"),r(Zn,"target","_blank"),r(Zn,"class","float-right"),r(bi,"type","hidden"),r(bi,"name","d"),bi.value="true",r(Jt,"type","checkbox"),r(Jt,"name","ds"),Jt.__value="true",Jt.value=Jt.__value,r(Jt,"class","rounded mb-1"),r(fs,"class","mt-3"),r(Dt,"class","cnt"),r(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),r(xn,"type","button"),r(xn,"class","py-2 px-4 rounded bg-red-500 text-white ml-2"),r(ei,"type","button"),r(ei,"class","py-2 px-4 rounded bg-yellow-500 text-white"),r(ms,"class","text-center"),r(ps,"class","text-right"),r(Fl,"class","grid grid-cols-3"),r(e,"autocomplete","off")},m(R,ae){M(R,e,ae),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),le(u,a,null),s(n,c),s(n,f),s(n,_),s(n,p),s(p,b),s(b,v),s(v,d),s(v,S),s(v,w),s(v,$),te($,t[3].g.h),s(b,N),s(b,E),s(E,B),s(E,P),s(E,L),s(E,O),le(F,O,null),qe(O,t[3].g.t,!0),s(n,x),s(n,j),s(n,z),s(n,G),s(G,V),s(V,W),s(W,U),s(W,K),s(W,H),s(W,Y),s(Y,Z),s(Z,re),s(Z,ue),s(Z,ke),s(Z,me),s(Z,Se),s(Y,je),s(je,Re),s(je,He),s(je,we),s(je,Te),s(Y,Le),s(Le,Me),s(Le,y),s(Y,g),s(Y,k),s(Y,A),s(Y,I),s(Y,Q),s(Y,J),s(Y,se),s(Y,ce),s(Y,ve),s(Y,$e),s(Y,oe),s(Y,pe),s(Y,Be),qe(Y,t[3].p.r,!0),s(V,_e),s(V,ye),s(ye,vt),s(ye,Hl),s(ye,tl),s(ye,ct);for(let ft=0;ft<4;ft+=1)gi[ft]&&gi[ft].m(ct,null);qe(ct,t[3].p.c,!0),s(n,Tl),s(n,pl),s(pl,Ht),s(Ht,ht),s(ht,Xe),s(ht,Ze),s(ht,Je),s(ht,Ue),te(Ue,t[3].p.f),s(Ht,xe),s(Ht,We),s(We,et),s(We,tt),s(We,de),s(We,Ce),te(Ce,t[3].p.m),s(n,Ei),s(n,_l),s(_l,_n),s(_n,Tt),Tt.checked=t[3].p.e,s(_n,Di),s(_l,Ii),gt&>.m(_l,null),s(n,Ri),s(n,dl),s(dl,Li),s(dl,Oi),s(dl,Fi),s(dl,Nt),s(Nt,Nl),s(Nt,Al),s(Nt,Pl),qe(Nt,t[3].g.s,!0),s(n,qi),kt&&kt.m(n,null),s(l,Ge),s(l,Ae),s(Ae,vl),s(Ae,Ts),s(Ae,El),le(Rt,El,null),s(Ae,Bi),s(Ae,Wl),s(Ae,Ao),s(Ae,ll),s(ll,Ui),s(ll,Po),s(ll,Ns),s(ll,Eo),s(ll,ci),s(ci,Wt),Wt.checked=t[3].m.i,s(ci,Do),s(ll,Io),s(ll,Dl),s(Dl,nl),s(nl,Il),s(Il,Ro);for(let ft=0;ft<7;ft+=1)ki[ft]&&ki[ft].m(nl,null);qe(nl,t[3].m.b,!0),s(Dl,Lo),s(Dl,pt),s(pt,Rl),s(Rl,Oo),s(pt,dn),s(pt,vn),s(pt,hn),s(pt,bn),qe(pt,t[3].m.p,!0),s(Dl,Fo),s(Dl,At),te(At,t[3].m.s),s(Ae,qo),s(Ae,zl),s(zl,Bo),s(zl,Uo),s(zl,jo),s(zl,il),s(il,gn),s(il,kn),qe(il,t[3].m.d,!0),s(Ae,Ho),s(Ae,wn),s(wn,Gl),s(Gl,Wo),s(Gl,zo),s(Gl,Go),s(Gl,yn),s(yn,zt),te(zt,t[3].m.f),s(yn,Vo),s(yn,Gi),s(wn,Ko),s(wn,Vl),s(Vl,Yo),s(Vl,Qo),s(Vl,Xo),s(Vl,Cn),s(Cn,Gt),te(Gt,t[3].m.r),s(Cn,Zo),s(Cn,Vi),s(Ae,Jo),s(Ae,As),s(Ae,xo),s(Ae,Kl),s(Kl,Ki),s(Ki,Vt),Vt.checked=t[3].m.e.e,s(Ki,er),s(Kl,tr),wt&&wt.m(Kl,null),s(Ae,lr),yt&&yt.m(Ae,null),s(Ae,Ps),s(Ae,Yi),s(Yi,Kt),Kt.checked=t[3].m.m.e,s(Yi,nr),s(Ae,ir),Ct&&Ct.m(Ae,null),s(l,sr),s(l,mt),s(mt,Qi),s(mt,or),s(mt,Mn),le($n,Mn,null),s(mt,rr),s(mt,mi),s(mt,ar),s(mt,Yl),s(Yl,ur),s(Yl,fr),s(Yl,cr),s(Yl,hl),te(hl,t[3].w.s),s(mt,mr),s(mt,Ql),s(Ql,pr),s(Ql,_r),s(Ql,dr),s(Ql,bl),te(bl,t[3].w.p),s(mt,vr),s(mt,Sn),s(Sn,Xl),s(Xl,hr),s(Xl,br),s(Xl,gr),s(Xl,Lt),s(Lt,Tn),s(Lt,Nn),s(Lt,An),s(Lt,Pn),qe(Lt,t[3].w.z,!0),s(Sn,kr),s(Sn,Zl),s(Zl,wr),s(Zl,yr),s(Zl,Cr),s(Zl,En),s(En,Ot),te(Ot,t[3].w.w),s(En,Mr),s(En,Xi),s(mt,$r),s(mt,Zi),s(Zi,Ji),s(Ji,Yt),Yt.checked=t[3].w.b,s(Ji,Sr),s(l,Tr),s(l,ut),s(ut,xi),s(ut,Nr),s(ut,Dn),le(In,Dn,null),s(ut,Ar),s(ut,Jl),s(Jl,Pr),s(Jl,Er),s(Jl,Dr),s(Jl,Ll),s(Ll,sl),s(sl,Rn),s(sl,Ln),qe(sl,t[3].n.m,!0),s(Ll,Ir),s(Ll,Pt),te(Pt,t[3].n.i),s(Ll,Rr),s(Ll,Et),le(On,Et,null),qe(Et,t[3].n.s,!0),s(ut,Lr),Mt&&Mt.m(ut,null),s(ut,Es),s(ut,is),s(is,ss),s(ss,Qt),Qt.checked=t[3].n.d,s(ss,Or),s(ut,Fr),s(ut,pi),s(ut,qr),s(ut,Ol),s(Ol,Br),s(Ol,_i),s(_i,Xt),Xt.checked=t[3].n.h,s(_i,Ur),s(Ol,jr),s(Ol,Hr),s(Ol,os),s(os,gl),te(gl,t[3].n.n1),s(l,Wr),s(l,Ye),s(Ye,rs),s(Ye,zr),s(Ye,Fn),le(qn,Fn,null),s(Ye,Gr),s(Ye,di),s(Ye,Vr),s(Ye,ol),s(ol,Kr),$t&&$t.m(ol,null),s(ol,Ds),s(ol,Yr),s(ol,Qr),s(ol,Bn),s(Bn,kl),te(kl,t[3].q.h),s(Bn,Xr),s(Bn,Zt),te(Zt,t[3].q.p),s(Ye,Zr),lt&<.m(Ye,null),s(Ye,Is),s(Ye,xl),s(xl,Jr),s(xl,xr),s(xl,ea),s(xl,wl),te(wl,t[3].q.u),s(Ye,ta),s(Ye,en),s(en,la),s(en,na),s(en,ia),s(en,yl),te(yl,t[3].q.a),s(Ye,sa),s(Ye,Un),s(Un,jn),s(jn,oa),s(jn,ra),s(jn,aa),s(jn,Cl),te(Cl,t[3].q.c),s(Un,ua),s(Un,Hn),s(Hn,fa),s(Hn,ca),s(Hn,ma),s(Hn,bt),s(bt,Wn),s(bt,zn),s(bt,Gn),s(bt,Vn),s(bt,Kn),s(bt,Yn),qe(bt,t[3].q.m,!0),s(Ye,pa),s(Ye,tn),s(tn,_a),s(tn,da),s(tn,va),s(tn,Ml),te(Ml,t[3].q.b),s(l,ha),nt&&nt.m(l,null),s(l,Rs),it&&it.m(l,null),s(l,Ls),st&&st.m(l,null),s(l,Os),ot&&ot.m(l,null),s(l,qs),s(l,rl),s(rl,as),s(rl,ba),s(rl,Qn),le(Xn,Qn,null),s(rl,ga),s(rl,vi),s(rl,ka),s(rl,hi);for(let ft=0;ft<_t.length;ft+=1)_t[ft]&&_t[ft].m(hi,null);s(l,wa),rt&&rt.m(l,null),s(l,Bs),s(l,Dt),s(Dt,us),s(Dt,ya),s(Dt,Zn),le(Jn,Zn,null),s(Dt,Ca),s(Dt,bi),s(Dt,Ma),s(Dt,fs),s(fs,cs),s(cs,Jt),Jt.checked=t[3].d.s,s(cs,$a),s(Dt,Sa),St&&St.m(Dt,null),s(e,Ta),s(e,Fl),s(Fl,Us),s(Us,xn),s(Fl,Na),s(Fl,ms),s(ms,ei),s(Fl,Aa),s(Fl,ps),M(R,js,ae),le(ln,R,ae),M(R,Hs,ae),le(nn,R,ae),M(R,Ws,ae),le(sn,R,ae),M(R,zs,ae),le(on,R,ae),Ft=!0,Gs||(Pa=[ee($,"input",t[15]),ee(O,"change",t[16]),ee(Y,"change",t[17]),ee(ct,"change",t[18]),ee(Ue,"input",t[19]),ee(Ce,"input",t[20]),ee(Tt,"change",t[21]),ee(Nt,"change",t[23]),ee(Wt,"change",t[26]),ee(nl,"change",t[27]),ee(pt,"change",t[28]),ee(At,"input",t[29]),ee(il,"change",t[30]),ee(zt,"input",t[31]),ee(Gt,"input",t[32]),ee(Vt,"change",t[33]),ee(Kt,"change",t[36]),ee(hl,"input",t[41]),ee(bl,"input",t[42]),ee(Lt,"change",t[43]),ee(Ot,"input",t[44]),ee(Yt,"change",t[45]),ee(sl,"change",t[46]),ee(Pt,"input",t[47]),ee(Et,"change",t[48]),ee(Qt,"change",t[52]),ee(Xt,"change",t[53]),ee(gl,"input",t[54]),ee(kl,"input",t[56]),ee(Zt,"input",t[57]),ee(wl,"input",t[58]),ee(yl,"input",t[59]),ee(Cl,"input",t[60]),ee(bt,"change",t[61]),ee(Ml,"input",t[62]),ee(Jt,"change",t[92]),ee(xn,"click",t[8]),ee(ei,"click",t[10]),ee(e,"submit",$s(t[9]))],Gs=!0)},p(R,ae){if(ae[0]&8&&$.value!==R[3].g.h&&te($,R[3].g.h),ae[0]&8&&qe(O,R[3].g.t),ae[0]&8&&qe(Y,R[3].p.r),ae[0]&8&&qe(ct,R[3].p.c),ae[0]&8&&he(Ue.value)!==R[3].p.f&&te(Ue,R[3].p.f),ae[0]&8&&he(Ce.value)!==R[3].p.m&&te(Ce,R[3].p.m),ae[0]&8&&(Tt.checked=R[3].p.e),R[3].p.e&&R[0].chip!="esp8266"?gt?gt.p(R,ae):(gt=af(R),gt.c(),gt.m(_l,null)):gt&&(gt.d(1),gt=null),ae[0]&8&&qe(Nt,R[3].g.s),R[3].g.s>0?kt?kt.p(R,ae):(kt=uf(R),kt.c(),kt.m(n,null)):kt&&(kt.d(1),kt=null),ae[0]&8&&(Wt.checked=R[3].m.i),(!Ft||ae[0]&8&&ji!==(ji=R[3].m.b!=0))&&(Il.disabled=ji),ae[0]&8&&qe(nl,R[3].m.b),(!Ft||ae[0]&8&&Hi!==(Hi=R[3].m.b!=0))&&(Rl.disabled=Hi),(!Ft||ae[0]&8&&Wi!==(Wi=R[3].m.b==0))&&(pt.disabled=Wi),ae[0]&8&&qe(pt,R[3].m.p),(!Ft||ae[0]&9&&zi!==(zi=R[0].chip=="esp8266"?R[3].i.h.p==3||R[3].i.h.p==113?512:128:4096))&&r(At,"max",zi),ae[0]&8&&he(At.value)!==R[3].m.s&&te(At,R[3].m.s),ae[0]&8&&qe(il,R[3].m.d),ae[0]&8&&he(zt.value)!==R[3].m.f&&te(zt,R[3].m.f),ae[0]&8&&he(Gt.value)!==R[3].m.r&&te(Gt,R[3].m.r),ae[0]&8&&(Vt.checked=R[3].m.e.e),R[3].m.e.e?wt?wt.p(R,ae):(wt=ff(R),wt.c(),wt.m(Kl,null)):wt&&(wt.d(1),wt=null),R[3].m.e.e?yt?yt.p(R,ae):(yt=cf(R),yt.c(),yt.m(Ae,Ps)):yt&&(yt.d(1),yt=null),ae[0]&8&&(Kt.checked=R[3].m.m.e),R[3].m.m.e?Ct?Ct.p(R,ae):(Ct=mf(R),Ct.c(),Ct.m(Ae,null)):Ct&&(Ct.d(1),Ct=null),ae[0]&8&&hl.value!==R[3].w.s&&te(hl,R[3].w.s),ae[0]&8&&bl.value!==R[3].w.p&&te(bl,R[3].w.p),ae[0]&8&&qe(Lt,R[3].w.z),ae[0]&8&&he(Ot.value)!==R[3].w.w&&te(Ot,R[3].w.w),ae[0]&8&&(Yt.checked=R[3].w.b),ae[0]&8&&qe(sl,R[3].n.m),(!Ft||ae[0]&8&&es!==(es=R[3].n.m=="dhcp"))&&(Pt.disabled=es),(!Ft||ae[0]&8&&ts!==(ts=R[3].n.m=="static"))&&(Pt.required=ts),ae[0]&8&&Pt.value!==R[3].n.i&&te(Pt,R[3].n.i),(!Ft||ae[0]&8&&ls!==(ls=R[3].n.m=="dhcp"))&&(Et.disabled=ls),(!Ft||ae[0]&8&&ns!==(ns=R[3].n.m=="static"))&&(Et.required=ns),ae[0]&8&&qe(Et,R[3].n.s),R[3].n.m=="static"?Mt?Mt.p(R,ae):(Mt=pf(R),Mt.c(),Mt.m(ut,Es)):Mt&&(Mt.d(1),Mt=null),ae[0]&8&&(Qt.checked=R[3].n.d),ae[0]&8&&(Xt.checked=R[3].n.h),ae[0]&8&&gl.value!==R[3].n.n1&&te(gl,R[3].n.n1),R[0].chip!="esp8266"?$t?$t.p(R,ae):($t=_f(R),$t.c(),$t.m(ol,Ds)):$t&&($t.d(1),$t=null),ae[0]&8&&kl.value!==R[3].q.h&&te(kl,R[3].q.h),ae[0]&8&&he(Zt.value)!==R[3].q.p&&te(Zt,R[3].q.p),R[3].q.s.e?lt?(lt.p(R,ae),ae[0]&8&&D(lt,1)):(lt=df(R),lt.c(),D(lt,1),lt.m(Ye,Is)):lt&&(De(),q(lt,1,1,()=>{lt=null}),Ie()),ae[0]&8&&wl.value!==R[3].q.u&&te(wl,R[3].q.u),ae[0]&8&&yl.value!==R[3].q.a&&te(yl,R[3].q.a),ae[0]&8&&Cl.value!==R[3].q.c&&te(Cl,R[3].q.c),ae[0]&8&&qe(bt,R[3].q.m),ae[0]&8&&Ml.value!==R[3].q.b&&te(Ml,R[3].q.b),R[3].q.m==3?nt?(nt.p(R,ae),ae[0]&8&&D(nt,1)):(nt=vf(R),nt.c(),D(nt,1),nt.m(l,Rs)):nt&&(De(),q(nt,1,1,()=>{nt=null}),Ie()),R[3].q.m==4?it?(it.p(R,ae),ae[0]&8&&D(it,1)):(it=hf(R),it.c(),D(it,1),it.m(l,Ls)):it&&(De(),q(it,1,1,()=>{it=null}),Ie()),R[3].c.es!=null?st?(st.p(R,ae),ae[0]&8&&D(st,1)):(st=bf(R),st.c(),D(st,1),st.m(l,Os)):st&&(De(),q(st,1,1,()=>{st=null}),Ie()),ae[0]&8&&(Fs=R[3].p.r.startsWith("10YNO")||R[3].p.r.startsWith("10Y1001A1001A4")),Fs?ot?(ot.p(R,ae),ae[0]&8&&D(ot,1)):(ot=wf(R),ot.c(),D(ot,1),ot.m(l,qs)):ot&&(De(),q(ot,1,1,()=>{ot=null}),Ie()),ae[0]&136){ti=R[7];let qt;for(qt=0;qt20||R[0].chip=="esp8266"?rt?(rt.p(R,ae),ae[0]&1&&D(rt,1)):(rt=Mf(R),rt.c(),D(rt,1),rt.m(l,Bs)):rt&&(De(),q(rt,1,1,()=>{rt=null}),Ie()),ae[0]&8&&(Jt.checked=R[3].d.s),R[3].d.s?St?St.p(R,ae):(St=Pf(R),St.c(),St.m(Dt,null)):St&&(St.d(1),St=null);const ft={};ae[0]&2&&(ft.active=R[1]),ln.$set(ft);const Ea={};ae[0]&4&&(Ea.active=R[2]),nn.$set(Ea);const Da={};ae[0]&16&&(Da.active=R[4]),sn.$set(Da);const Ia={};ae[0]&32&&(Ia.active=R[5]),on.$set(Ia)},i(R){Ft||(D(u.$$.fragment,R),D(F.$$.fragment,R),D(Rt.$$.fragment,R),D($n.$$.fragment,R),D(In.$$.fragment,R),D(On.$$.fragment,R),D(qn.$$.fragment,R),D(lt),D(nt),D(it),D(st),D(ot),D(Xn.$$.fragment,R),D(rt),D(Jn.$$.fragment,R),D(ln.$$.fragment,R),D(nn.$$.fragment,R),D(sn.$$.fragment,R),D(on.$$.fragment,R),Ft=!0)},o(R){q(u.$$.fragment,R),q(F.$$.fragment,R),q(Rt.$$.fragment,R),q($n.$$.fragment,R),q(In.$$.fragment,R),q(On.$$.fragment,R),q(qn.$$.fragment,R),q(lt),q(nt),q(it),q(st),q(ot),q(Xn.$$.fragment,R),q(rt),q(Jn.$$.fragment,R),q(ln.$$.fragment,R),q(nn.$$.fragment,R),q(sn.$$.fragment,R),q(on.$$.fragment,R),Ft=!1},d(R){R&&C(e),ne(u),ne(F),cl(gi,R),gt&>.d(),kt&&kt.d(),ne(Rt),cl(ki,R),wt&&wt.d(),yt&&yt.d(),Ct&&Ct.d(),ne($n),ne(In),ne(On),Mt&&Mt.d(),ne(qn),$t&&$t.d(),lt&<.d(),nt&&nt.d(),it&&it.d(),st&&st.d(),ot&&ot.d(),ne(Xn),cl(_t,R),rt&&rt.d(),ne(Jn),St&&St.d(),R&&C(js),ne(ln,R),R&&C(Hs),ne(nn,R),R&&C(Ws),ne(sn,R),R&&C(zs),ne(on,R),Gs=!1,ze(Pa)}}}async function wp(){await(await fetch("/reboot",{method:"POST"})).json()}function yp(t,e,l){let{sysinfo:n={}}=e,i=[{name:"Import gauge",key:"i"},{name:"Export gauge",key:"e"},{name:"Voltage",key:"v"},{name:"Amperage",key:"a"},{name:"Reactive",key:"r"},{name:"Realtime",key:"c"},{name:"Peaks",key:"t"},{name:"Price",key:"p"},{name:"Day plot",key:"d"},{name:"Month plot",key:"m"},{name:"Temperature plot",key:"s"}],o=!0,a=!1,u={g:{t:"",h:"",s:0,u:"",p:""},m:{b:2400,p:11,i:!1,d:0,f:0,r:0,e:{e:!1,k:"",a:""},m:{e:!1,w:!1,v:!1,a:!1,c:!1}},w:{s:"",p:"",w:0,z:255,a:!0,b:!0},n:{m:"",i:"",s:"",g:"",d1:"",d2:"",d:!1,n1:"",n2:"",h:!1},q:{h:"",p:1883,u:"",a:"",b:"",s:{e:!1,c:!1,r:!0,k:!1}},o:{e:"",c:"",u1:"",u2:"",u3:""},t:{t:[0,0,0,0,0,0,0,0,0,0],h:1},p:{e:!1,t:"",r:"",c:"",m:1,f:null},d:{s:!1,t:!1,l:5},u:{i:0,e:0,v:0,a:0,r:0,c:0,t:0,p:0,d:0,m:0,s:0},i:{h:{p:null,u:!0},a:null,l:{p:null,i:!1},r:{r:null,g:null,b:null,i:!1},t:{d:null,a:null},v:{p:null,d:{v:null,g:null},o:null,m:null,b:null}},h:{t:"",h:"",n:""},c:{es:null}};Ci.subscribe(Ge=>{Ge.version&&(l(3,u=Ge),l(1,o=!1))}),jm();let c=!1,f=!1;async function _(){if(confirm("Are you sure you want to factory reset the device?")){l(4,c=!0);const Ge=new URLSearchParams;Ge.append("perform","true");let vl=await(await fetch("/reset",{method:"POST",body:Ge})).json();l(4,c=!1),l(5,f=vl.success)}}async function p(Ge){l(2,a=!0);const Ae=new FormData(Ge.target),vl=new URLSearchParams;for(let Rt of Ae){const[Bi,Wl]=Rt;vl.append(Bi,Wl)}let El=await(await fetch("/save",{method:"POST",body:vl})).json();jt.update(Rt=>(Rt.booting=El.reboot,Rt.ui=u.u,Rt)),l(2,a=!1),oi("/")}const b=function(){confirm("Are you sure you want to reboot the device?")&&(jt.update(Ge=>(Ge.booting=!0,Ge)),wp())};async function v(){confirm("Are you sure you want to delete CA?")&&(await(await fetch("/mqtt-ca",{method:"POST"})).text(),Ci.update(Ae=>(Ae.q.s.c=!1,Ae)))}async function d(){confirm("Are you sure you want to delete cert?")&&(await(await fetch("/mqtt-cert",{method:"POST"})).text(),Ci.update(Ae=>(Ae.q.s.r=!1,Ae)))}async function S(){confirm("Are you sure you want to delete key?")&&(await(await fetch("/mqtt-key",{method:"POST"})).text(),Ci.update(Ae=>(Ae.q.s.k=!1,Ae)))}const w=function(){u.q.s.e?u.q.p==1883&&l(3,u.q.p=8883,u):u.q.p==8883&&l(3,u.q.p=1883,u)};let $=44;function N(){u.g.h=this.value,l(3,u)}function E(){u.g.t=dt(this),l(3,u)}function B(){u.p.r=dt(this),l(3,u)}function P(){u.p.c=dt(this),l(3,u)}function L(){u.p.f=he(this.value),l(3,u)}function O(){u.p.m=he(this.value),l(3,u)}function F(){u.p.e=this.checked,l(3,u)}function x(){u.p.t=this.value,l(3,u)}function j(){u.g.s=dt(this),l(3,u)}function z(){u.g.u=this.value,l(3,u)}function G(){u.g.p=this.value,l(3,u)}function V(){u.m.i=this.checked,l(3,u)}function W(){u.m.b=dt(this),l(3,u)}function U(){u.m.p=dt(this),l(3,u)}function K(){u.m.s=he(this.value),l(3,u)}function H(){u.m.d=dt(this),l(3,u)}function Y(){u.m.f=he(this.value),l(3,u)}function Z(){u.m.r=he(this.value),l(3,u)}function re(){u.m.e.e=this.checked,l(3,u)}function ue(){u.m.e.k=this.value,l(3,u)}function ke(){u.m.e.a=this.value,l(3,u)}function me(){u.m.m.e=this.checked,l(3,u)}function Se(){u.m.m.w=he(this.value),l(3,u)}function je(){u.m.m.v=he(this.value),l(3,u)}function Re(){u.m.m.a=he(this.value),l(3,u)}function He(){u.m.m.c=he(this.value),l(3,u)}function we(){u.w.s=this.value,l(3,u)}function Te(){u.w.p=this.value,l(3,u)}function Le(){u.w.z=dt(this),l(3,u)}function Me(){u.w.w=he(this.value),l(3,u)}function y(){u.w.b=this.checked,l(3,u)}function g(){u.n.m=dt(this),l(3,u)}function k(){u.n.i=this.value,l(3,u)}function A(){u.n.s=dt(this),l(3,u)}function I(){u.n.g=this.value,l(3,u)}function Q(){u.n.d1=this.value,l(3,u)}function J(){u.n.d2=this.value,l(3,u)}function se(){u.n.d=this.checked,l(3,u)}function ce(){u.n.h=this.checked,l(3,u)}function ve(){u.n.n1=this.value,l(3,u)}function $e(){u.q.s.e=this.checked,l(3,u)}function oe(){u.q.h=this.value,l(3,u)}function pe(){u.q.p=he(this.value),l(3,u)}function Be(){u.q.u=this.value,l(3,u)}function _e(){u.q.a=this.value,l(3,u)}function ye(){u.q.c=this.value,l(3,u)}function vt(){u.q.m=dt(this),l(3,u)}function Hl(){u.q.b=this.value,l(3,u)}function tl(){u.o.e=this.value,l(3,u)}function ct(){u.o.c=this.value,l(3,u)}function Tl(){u.o.u1=this.value,l(3,u)}function pl(){u.o.u2=this.value,l(3,u)}function Ht(){u.o.u3=this.value,l(3,u)}function ht(){u.h.t=this.value,l(3,u)}function Xe(){u.h.h=this.value,l(3,u)}function Ze(){u.h.n=this.value,l(3,u)}function Je(){u.c.es=this.checked,l(3,u)}function Ue(Ge){u.t.t[Ge]=he(this.value),l(3,u)}function xe(){u.t.h=he(this.value),l(3,u)}function We(Ge){u.u[Ge.key]=dt(this),l(3,u)}function et(){u.i.h.u=this.checked,l(3,u)}function tt(){u.i.h.p=dt(this),l(3,u)}function de(){u.i.a=he(this.value),l(3,u)}function Ce(){u.i.l.i=this.checked,l(3,u)}function Ei(){u.i.l.p=he(this.value),l(3,u)}function _l(){u.i.r.i=this.checked,l(3,u)}function _n(){u.i.r.r=he(this.value),l(3,u)}function Tt(){u.i.r.g=he(this.value),l(3,u)}function Di(){u.i.r.b=he(this.value),l(3,u)}function Ii(){u.i.t.d=he(this.value),l(3,u)}function Ri(){u.i.t.a=he(this.value),l(3,u)}function dl(){u.i.v.p=he(this.value),l(3,u)}function Li(){u.i.v.d.v=he(this.value),l(3,u)}function Oi(){u.i.v.d.g=he(this.value),l(3,u)}function Fi(){u.i.v.o=he(this.value),l(3,u)}function Nt(){u.i.v.m=he(this.value),l(3,u)}function Nl(){u.i.v.b=he(this.value),l(3,u)}function Al(){u.d.s=this.checked,l(3,u)}function Pl(){u.d.t=this.checked,l(3,u)}function qi(){u.d.l=dt(this),l(3,u)}return t.$$set=Ge=>{"sysinfo"in Ge&&l(0,n=Ge.sysinfo)},t.$$.update=()=>{t.$$.dirty[0]&1&&l(6,$=n.chip=="esp8266"?16:n.chip=="esp32s2"?44:39)},[n,o,a,u,c,f,$,i,_,p,b,v,d,S,w,N,E,B,P,L,O,F,x,j,z,G,V,W,U,K,H,Y,Z,re,ue,ke,me,Se,je,Re,He,we,Te,Le,Me,y,g,k,A,I,Q,J,se,ce,ve,$e,oe,pe,Be,_e,ye,vt,Hl,tl,ct,Tl,pl,Ht,ht,Xe,Ze,Je,Ue,xe,We,et,tt,de,Ce,Ei,_l,_n,Tt,Di,Ii,Ri,dl,Li,Oi,Fi,Nt,Nl,Al,Pl,qi]}class Cp extends Ee{constructor(e){super(),Pe(this,e,yp,kp,Ne,{sysinfo:0},null,[-1,-1,-1,-1])}}function Df(t,e,l){const n=t.slice();return n[20]=e[l],n}function Mp(t){let e=be(t[1].chip,t[1].board)+"",l;return{c(){l=T(e)},m(n,i){M(n,l,i)},p(n,i){i&2&&e!==(e=be(n[1].chip,n[1].board)+"")&&X(l,e)},d(n){n&&C(l)}}}function If(t){let e,l,n=t[1].apmac+"",i,o,a,u,c,f,_,p,b,v=Za(t[1])+"",d,S,w=t[1].boot_reason+"",$,N,E=t[1].ex_cause+"",B,P,L;const O=[Sp,$p],F=[];function x(j,z){return j[0].u>0?0:1}return c=x(t),f=F[c]=O[c](t),{c(){e=m("div"),l=T("AP MAC: "),i=T(n),o=h(),a=m("div"),u=T(`Last boot: + `),f.c(),_=h(),p=m("div"),b=T("Reason: "),d=T(v),S=T(" ("),$=T(w),N=T("/"),B=T(E),P=T(")"),r(e,"class","my-2"),r(a,"class","my-2"),r(p,"class","my-2")},m(j,z){M(j,e,z),s(e,l),s(e,i),M(j,o,z),M(j,a,z),s(a,u),F[c].m(a,null),M(j,_,z),M(j,p,z),s(p,b),s(p,d),s(p,S),s(p,$),s(p,N),s(p,B),s(p,P),L=!0},p(j,z){(!L||z&2)&&n!==(n=j[1].apmac+"")&&X(i,n);let G=c;c=x(j),c===G?F[c].p(j,z):(De(),q(F[G],1,1,()=>{F[G]=null}),Ie(),f=F[c],f?f.p(j,z):(f=F[c]=O[c](j),f.c()),D(f,1),f.m(a,null)),(!L||z&2)&&v!==(v=Za(j[1])+"")&&X(d,v),(!L||z&2)&&w!==(w=j[1].boot_reason+"")&&X($,w),(!L||z&2)&&E!==(E=j[1].ex_cause+"")&&X(B,E)},i(j){L||(D(f),L=!0)},o(j){q(f),L=!1},d(j){j&&C(e),j&&C(o),j&&C(a),F[c].d(),j&&C(_),j&&C(p)}}}function $p(t){let e;return{c(){e=T("-")},m(l,n){M(l,e,n)},p:fe,i:fe,o:fe,d(l){l&&C(e)}}}function Sp(t){let e,l;return e=new Vc({props:{timestamp:new Date(new Date().getTime()-t[0].u*1e3),fullTimeColor:""}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.timestamp=new Date(new Date().getTime()-n[0].u*1e3)),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function Tp(t){let e;return{c(){e=m("span"),e.textContent="Update consents",r(e,"class","btn-pri-sm")},m(l,n){M(l,e,n)},p:fe,d(l){l&&C(e)}}}function Rf(t){let e,l,n,i,o,a=Cs(t[1].meter.mfg)+"",u,c,f,_,p=(t[1].meter.model?t[1].meter.model:"unknown")+"",b,v,d,S,w=(t[1].meter.id?t[1].meter.id:"unknown")+"",$;return{c(){e=m("div"),l=m("strong"),l.textContent="Meter",n=h(),i=m("div"),o=T("Manufacturer: "),u=T(a),c=h(),f=m("div"),_=T("Model: "),b=T(p),v=h(),d=m("div"),S=T("ID: "),$=T(w),r(l,"class","text-sm"),r(i,"class","my-2"),r(f,"class","my-2"),r(d,"class","my-2"),r(e,"class","cnt")},m(N,E){M(N,e,E),s(e,l),s(e,n),s(e,i),s(i,o),s(i,u),s(e,c),s(e,f),s(f,_),s(f,b),s(e,v),s(e,d),s(d,S),s(d,$)},p(N,E){E&2&&a!==(a=Cs(N[1].meter.mfg)+"")&&X(u,a),E&2&&p!==(p=(N[1].meter.model?N[1].meter.model:"unknown")+"")&&X(b,p),E&2&&w!==(w=(N[1].meter.id?N[1].meter.id:"unknown")+"")&&X($,w)},d(N){N&&C(e)}}}function Lf(t){let e,l,n,i,o,a=t[1].net.ip+"",u,c,f,_,p=t[1].net.mask+"",b,v,d,S,w=t[1].net.gw+"",$,N,E,B,P=t[1].net.dns1+"",L,O,F=t[1].net.dns2&&Of(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Network",n=h(),i=m("div"),o=T("IP: "),u=T(a),c=h(),f=m("div"),_=T("Mask: "),b=T(p),v=h(),d=m("div"),S=T("Gateway: "),$=T(w),N=h(),E=m("div"),B=T("DNS: "),L=T(P),O=h(),F&&F.c(),r(l,"class","text-sm"),r(i,"class","my-2"),r(f,"class","my-2"),r(d,"class","my-2"),r(E,"class","my-2"),r(e,"class","cnt")},m(x,j){M(x,e,j),s(e,l),s(e,n),s(e,i),s(i,o),s(i,u),s(e,c),s(e,f),s(f,_),s(f,b),s(e,v),s(e,d),s(d,S),s(d,$),s(e,N),s(e,E),s(E,B),s(E,L),s(E,O),F&&F.m(E,null)},p(x,j){j&2&&a!==(a=x[1].net.ip+"")&&X(u,a),j&2&&p!==(p=x[1].net.mask+"")&&X(b,p),j&2&&w!==(w=x[1].net.gw+"")&&X($,w),j&2&&P!==(P=x[1].net.dns1+"")&&X(L,P),x[1].net.dns2?F?F.p(x,j):(F=Of(x),F.c(),F.m(E,null)):F&&(F.d(1),F=null)},d(x){x&&C(e),F&&F.d()}}}function Of(t){let e,l=t[1].net.dns2+"",n;return{c(){e=T("/ "),n=T(l)},m(i,o){M(i,e,o),M(i,n,o)},p(i,o){o&2&&l!==(l=i[1].net.dns2+"")&&X(n,l)},d(i){i&&C(e),i&&C(n)}}}function Ff(t){let e,l,n,i=t[1].upgrade.t+"",o,a,u=t[1].version+"",c,f,_=t[1].upgrade.x+"",p,b,v=t[1].upgrade.e+"",d,S;return{c(){e=m("div"),l=m("div"),n=T("Previous upgrade attempt ("),o=T(i),a=T(") does not match current version ("),c=T(u),f=T(") ["),p=T(_),b=T("/"),d=T(v),S=T("]"),r(l,"class","bd-yellow"),r(e,"class","my-2")},m(w,$){M(w,e,$),s(e,l),s(l,n),s(l,o),s(l,a),s(l,c),s(l,f),s(l,p),s(l,b),s(l,d),s(l,S)},p(w,$){$&2&&i!==(i=w[1].upgrade.t+"")&&X(o,i),$&2&&u!==(u=w[1].version+"")&&X(c,u),$&2&&_!==(_=w[1].upgrade.x+"")&&X(p,_),$&2&&v!==(v=w[1].upgrade.e+"")&&X(d,v)},d(w){w&&C(e)}}}function qf(t){let e,l,n,i=t[2].tag_name+"",o,a,u,c,f,_,p=(t[1].security==0||t[0].a)&&t[1].fwconsent===1&&t[2]&&t[2].tag_name!=t[1].version&&Bf(t),b=t[1].fwconsent===2&&Uf();return{c(){e=m("div"),l=T(`Latest version: + `),n=m("a"),o=T(i),u=h(),p&&p.c(),c=h(),b&&b.c(),f=Ve(),r(n,"href",a=t[2].html_url),r(n,"class","ml-2 text-blue-600 hover:text-blue-800"),r(n,"target","_blank"),r(n,"rel","noreferrer"),r(e,"class","my-2 flex")},m(v,d){M(v,e,d),s(e,l),s(e,n),s(n,o),s(e,u),p&&p.m(e,null),M(v,c,d),b&&b.m(v,d),M(v,f,d),_=!0},p(v,d){(!_||d&4)&&i!==(i=v[2].tag_name+"")&&X(o,i),(!_||d&4&&a!==(a=v[2].html_url))&&r(n,"href",a),(v[1].security==0||v[0].a)&&v[1].fwconsent===1&&v[2]&&v[2].tag_name!=v[1].version?p?(p.p(v,d),d&7&&D(p,1)):(p=Bf(v),p.c(),D(p,1),p.m(e,null)):p&&(De(),q(p,1,1,()=>{p=null}),Ie()),v[1].fwconsent===2?b||(b=Uf(),b.c(),b.m(f.parentNode,f)):b&&(b.d(1),b=null)},i(v){_||(D(p),_=!0)},o(v){q(p),_=!1},d(v){v&&C(e),p&&p.d(),v&&C(c),b&&b.d(v),v&&C(f)}}}function Bf(t){let e,l,n,i,o,a;return n=new Kc({}),{c(){e=m("div"),l=m("button"),ie(n.$$.fragment),r(e,"class","flex-none ml-2 text-green-500"),r(e,"title","Install this version")},m(u,c){M(u,e,c),s(e,l),le(n,l,null),i=!0,o||(a=ee(l,"click",t[10]),o=!0)},p:fe,i(u){i||(D(n.$$.fragment,u),i=!0)},o(u){q(n.$$.fragment,u),i=!1},d(u){u&&C(e),ne(n),o=!1,a()}}}function Uf(t){let e;return{c(){e=m("div"),e.innerHTML='
You have disabled one-click firmware upgrade, link to self-upgrade is disabled
',r(e,"class","my-2")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function jf(t){let e,l=Ms(be(t[1].chip,t[1].board))+"",n;return{c(){e=m("div"),n=T(l),r(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&2&&l!==(l=Ms(be(i[1].chip,i[1].board))+"")&&X(n,l)},d(i){i&&C(e)}}}function Hf(t){let e,l,n,i,o,a;function u(_,p){return _[4].length==0?Ap:Np}let c=u(t),f=c(t);return{c(){e=m("div"),l=m("form"),n=m("input"),i=h(),f.c(),nc(n,"display","none"),r(n,"name","file"),r(n,"type","file"),r(n,"accept",".bin"),r(l,"action","/firmware"),r(l,"enctype","multipart/form-data"),r(l,"method","post"),r(l,"autocomplete","off"),r(e,"class","my-2 flex")},m(_,p){M(_,e,p),s(e,l),s(l,n),t[12](n),s(l,i),f.m(l,null),o||(a=[ee(n,"change",t[13]),ee(l,"submit",t[15])],o=!0)},p(_,p){c===(c=u(_))&&f?f.p(_,p):(f.d(1),f=c(_),f&&(f.c(),f.m(l,null)))},d(_){_&&C(e),t[12](null),f.d(),o=!1,ze(a)}}}function Np(t){let e=t[4][0].name+"",l,n,i;return{c(){l=T(e),n=h(),i=m("button"),i.textContent="Upload",r(i,"type","submit"),r(i,"class","btn-pri-sm float-right")},m(o,a){M(o,l,a),M(o,n,a),M(o,i,a)},p(o,a){a&16&&e!==(e=o[4][0].name+"")&&X(l,e)},d(o){o&&C(l),o&&C(n),o&&C(i)}}}function Ap(t){let e,l,n;return{c(){e=m("button"),e.textContent="Select firmware file for upgrade",r(e,"type","button"),r(e,"class","btn-pri-sm float-right")},m(i,o){M(i,e,o),l||(n=ee(e,"click",t[14]),l=!0)},p:fe,d(i){i&&C(e),l=!1,n()}}}function Wf(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S=t[9],w=[];for(let P=0;P Include Secrets
(SSID, PSK, passwords and tokens)',c=h(),$&&$.c(),f=h(),_=m("form"),p=m("input"),b=h(),B.c(),r(l,"class","text-sm"),r(u,"class","my-1 mx-3 col-span-2"),r(o,"class","grid grid-cols-2"),r(i,"method","get"),r(i,"action","/configfile.cfg"),r(i,"autocomplete","off"),nc(p,"display","none"),r(p,"name","file"),r(p,"type","file"),r(p,"accept",".cfg"),r(_,"action","/configfile"),r(_,"enctype","multipart/form-data"),r(_,"method","post"),r(_,"autocomplete","off"),r(e,"class","cnt")},m(P,L){M(P,e,L),s(e,l),s(e,n),s(e,i),s(i,o);for(let O=0;O{A=null}),Ie());const _e={};pe&8388608&&(_e.$$scope={dirty:pe,ctx:oe}),x.$set(_e),oe[1].meter?I?I.p(oe,pe):(I=Rf(oe),I.c(),I.m(e,V)):I&&(I.d(1),I=null),oe[1].net?Q?Q.p(oe,pe):(Q=Lf(oe),Q.c(),Q.m(e,W)):Q&&(Q.d(1),Q=null),(!y||pe&2)&&re!==(re=oe[1].version+"")&&X(ue,re),oe[1].upgrade.t&&oe[1].upgrade.t!=oe[1].version?J?J.p(oe,pe):(J=Ff(oe),J.c(),J.m(U,me)):J&&(J.d(1),J=null),oe[2]?se?(se.p(oe,pe),pe&4&&D(se,1)):(se=qf(oe),se.c(),D(se,1),se.m(U,Se)):se&&(De(),q(se,1,1,()=>{se=null}),Ie()),pe&3&&(je=(oe[1].security==0||oe[0].a)&&ri(oe[1].board)),je?ce?ce.p(oe,pe):(ce=jf(oe),ce.c(),ce.m(U,Re)):ce&&(ce.d(1),ce=null),oe[1].security==0||oe[0].a?ve?ve.p(oe,pe):(ve=Hf(oe),ve.c(),ve.m(U,null)):ve&&(ve.d(1),ve=null),oe[1].security==0||oe[0].a?$e?$e.p(oe,pe):($e=Wf(oe),$e.c(),$e.m(e,null)):$e&&($e.d(1),$e=null);const ye={};pe&32&&(ye.active=oe[5]),Te.$set(ye);const vt={};pe&256&&(vt.active=oe[8]),Me.$set(vt)},i(oe){y||(D(w.$$.fragment,oe),D(A),D(x.$$.fragment,oe),D(se),D(Te.$$.fragment,oe),D(Me.$$.fragment,oe),y=!0)},o(oe){q(w.$$.fragment,oe),q(A),q(x.$$.fragment,oe),q(se),q(Te.$$.fragment,oe),q(Me.$$.fragment,oe),y=!1},d(oe){oe&&C(e),ne(w),A&&A.d(),ne(x),I&&I.d(),Q&&Q.d(),J&&J.d(),se&&se.d(),ce&&ce.d(),ve&&ve.d(),$e&&$e.d(),oe&&C(we),ne(Te,oe),oe&&C(Le),ne(Me,oe),g=!1,k()}}}async function Ip(){await(await fetch("/reboot",{method:"POST"})).json()}function Rp(t,e,l){let{data:n}=e,{sysinfo:i}=e,o=[{name:"WiFi",key:"iw"},{name:"MQTT",key:"im"},{name:"Web",key:"ie"},{name:"Meter",key:"it"},{name:"Thresholds",key:"ih"},{name:"GPIO",key:"ig"},{name:"NTP",key:"in"},{name:"Price API",key:"is"}],a={};So.subscribe(O=>{l(2,a=Gc(i.version,O)),a||l(2,a=O[0])});function u(){confirm("Do you want to upgrade this device to "+a.tag_name+"?")&&(i.board!=2&&i.board!=4&&i.board!=7||confirm(Ms(be(i.chip,i.board))))&&(jt.update(O=>(O.upgrading=!0,O)),zc(a.tag_name))}const c=function(){confirm("Are you sure you want to reboot the device?")&&(jt.update(O=>(O.booting=!0,O)),Ip())};let f,_=[],p=!1,b,v=[],d=!1;yo();function S(O){ws[O?"unshift":"push"](()=>{f=O,l(3,f)})}function w(){_=this.files,l(4,_)}const $=()=>{f.click()},N=()=>l(5,p=!0);function E(O){ws[O?"unshift":"push"](()=>{b=O,l(6,b)})}function B(){v=this.files,l(7,v)}const P=()=>{b.click()},L=()=>l(8,d=!0);return t.$$set=O=>{"data"in O&&l(0,n=O.data),"sysinfo"in O&&l(1,i=O.sysinfo)},[n,i,a,f,_,p,b,v,d,o,u,c,S,w,$,N,E,B,P,L]}class Lp extends Ee{constructor(e){super(),Pe(this,e,Rp,Dp,Ne,{data:0,sysinfo:1})}}function Vf(t){let e,l,n=be(t[0],7)+"",i,o,a=be(t[0],5)+"",u,c,f=be(t[0],4)+"",_,p,b=be(t[0],3)+"",v,d,S,w,$=be(t[0],2)+"",N,E,B=be(t[0],1)+"",P,L,O=be(t[0],0)+"",F,x,j,z,G=be(t[0],101)+"",V,W,U=be(t[0],100)+"",K;return{c(){e=m("optgroup"),l=m("option"),i=T(n),o=m("option"),u=T(a),c=m("option"),_=T(f),p=m("option"),v=T(b),d=h(),S=m("optgroup"),w=m("option"),N=T($),E=m("option"),P=T(B),L=m("option"),F=T(O),x=h(),j=m("optgroup"),z=m("option"),V=T(G),W=m("option"),K=T(U),l.__value=7,l.value=l.__value,o.__value=5,o.value=o.__value,c.__value=4,c.value=c.__value,p.__value=3,p.value=p.__value,r(e,"label","amsleser.no"),w.__value=2,w.value=w.__value,E.__value=1,E.value=E.__value,L.__value=0,L.value=L.__value,r(S,"label","Custom hardware"),z.__value=101,z.value=z.__value,W.__value=100,W.value=W.__value,r(j,"label","Generic hardware")},m(H,Y){M(H,e,Y),s(e,l),s(l,i),s(e,o),s(o,u),s(e,c),s(c,_),s(e,p),s(p,v),M(H,d,Y),M(H,S,Y),s(S,w),s(w,N),s(S,E),s(E,P),s(S,L),s(L,F),M(H,x,Y),M(H,j,Y),s(j,z),s(z,V),s(j,W),s(W,K)},p(H,Y){Y&1&&n!==(n=be(H[0],7)+"")&&X(i,n),Y&1&&a!==(a=be(H[0],5)+"")&&X(u,a),Y&1&&f!==(f=be(H[0],4)+"")&&X(_,f),Y&1&&b!==(b=be(H[0],3)+"")&&X(v,b),Y&1&&$!==($=be(H[0],2)+"")&&X(N,$),Y&1&&B!==(B=be(H[0],1)+"")&&X(P,B),Y&1&&O!==(O=be(H[0],0)+"")&&X(F,O),Y&1&&G!==(G=be(H[0],101)+"")&&X(V,G),Y&1&&U!==(U=be(H[0],100)+"")&&X(K,U)},d(H){H&&C(e),H&&C(d),H&&C(S),H&&C(x),H&&C(j)}}}function Kf(t){let e,l,n=be(t[0],201)+"",i,o,a=be(t[0],202)+"",u,c,f=be(t[0],203)+"",_,p,b=be(t[0],200)+"",v;return{c(){e=m("optgroup"),l=m("option"),i=T(n),o=m("option"),u=T(a),c=m("option"),_=T(f),p=m("option"),v=T(b),l.__value=201,l.value=l.__value,o.__value=202,o.value=o.__value,c.__value=203,c.value=c.__value,p.__value=200,p.value=p.__value,r(e,"label","Generic hardware")},m(d,S){M(d,e,S),s(e,l),s(l,i),s(e,o),s(o,u),s(e,c),s(c,_),s(e,p),s(p,v)},p(d,S){S&1&&n!==(n=be(d[0],201)+"")&&X(i,n),S&1&&a!==(a=be(d[0],202)+"")&&X(u,a),S&1&&f!==(f=be(d[0],203)+"")&&X(_,f),S&1&&b!==(b=be(d[0],200)+"")&&X(v,b)},d(d){d&&C(e)}}}function Yf(t){let e,l,n=be(t[0],7)+"",i,o,a=be(t[0],6)+"",u,c,f=be(t[0],5)+"",_,p,b,v,d=be(t[0],51)+"",S,w,$=be(t[0],50)+"",N;return{c(){e=m("optgroup"),l=m("option"),i=T(n),o=m("option"),u=T(a),c=m("option"),_=T(f),p=h(),b=m("optgroup"),v=m("option"),S=T(d),w=m("option"),N=T($),l.__value=7,l.value=l.__value,o.__value=6,o.value=o.__value,c.__value=5,c.value=c.__value,r(e,"label","amsleser.no"),v.__value=51,v.value=v.__value,w.__value=50,w.value=w.__value,r(b,"label","Generic hardware")},m(E,B){M(E,e,B),s(e,l),s(l,i),s(e,o),s(o,u),s(e,c),s(c,_),M(E,p,B),M(E,b,B),s(b,v),s(v,S),s(b,w),s(w,N)},p(E,B){B&1&&n!==(n=be(E[0],7)+"")&&X(i,n),B&1&&a!==(a=be(E[0],6)+"")&&X(u,a),B&1&&f!==(f=be(E[0],5)+"")&&X(_,f),B&1&&d!==(d=be(E[0],51)+"")&&X(S,d),B&1&&$!==($=be(E[0],50)+"")&&X(N,$)},d(E){E&&C(e),E&&C(p),E&&C(b)}}}function Qf(t){let e,l,n=be(t[0],8)+"",i,o,a,u,c=be(t[0],71)+"",f,_,p=be(t[0],70)+"",b;return{c(){e=m("optgroup"),l=m("option"),i=T(n),o=h(),a=m("optgroup"),u=m("option"),f=T(c),_=m("option"),b=T(p),l.__value=8,l.value=l.__value,r(e,"label","Custom hardware"),u.__value=71,u.value=u.__value,_.__value=70,_.value=_.__value,r(a,"label","Generic hardware")},m(v,d){M(v,e,d),s(e,l),s(l,i),M(v,o,d),M(v,a,d),s(a,u),s(u,f),s(a,_),s(_,b)},p(v,d){d&1&&n!==(n=be(v[0],8)+"")&&X(i,n),d&1&&c!==(c=be(v[0],71)+"")&&X(f,c),d&1&&p!==(p=be(v[0],70)+"")&&X(b,p)},d(v){v&&C(e),v&&C(o),v&&C(a)}}}function Xf(t){let e,l,n=be(t[0],200)+"",i;return{c(){e=m("optgroup"),l=m("option"),i=T(n),l.__value=200,l.value=l.__value,r(e,"label","Generic hardware")},m(o,a){M(o,e,a),s(e,l),s(l,i)},p(o,a){a&1&&n!==(n=be(o[0],200)+"")&&X(i,n)},d(o){o&&C(e)}}}function Op(t){let e,l,n,i,o,a,u,c=t[0]=="esp8266"&&Vf(t),f=t[0]=="esp32"&&Kf(t),_=t[0]=="esp32s2"&&Yf(t),p=t[0]=="esp32c3"&&Qf(t),b=t[0]=="esp32solo"&&Xf(t);return{c(){e=m("option"),l=h(),c&&c.c(),n=h(),f&&f.c(),i=h(),_&&_.c(),o=h(),p&&p.c(),a=h(),b&&b.c(),u=Ve(),e.__value=-1,e.value=e.__value},m(v,d){M(v,e,d),M(v,l,d),c&&c.m(v,d),M(v,n,d),f&&f.m(v,d),M(v,i,d),_&&_.m(v,d),M(v,o,d),p&&p.m(v,d),M(v,a,d),b&&b.m(v,d),M(v,u,d)},p(v,[d]){v[0]=="esp8266"?c?c.p(v,d):(c=Vf(v),c.c(),c.m(n.parentNode,n)):c&&(c.d(1),c=null),v[0]=="esp32"?f?f.p(v,d):(f=Kf(v),f.c(),f.m(i.parentNode,i)):f&&(f.d(1),f=null),v[0]=="esp32s2"?_?_.p(v,d):(_=Yf(v),_.c(),_.m(o.parentNode,o)):_&&(_.d(1),_=null),v[0]=="esp32c3"?p?p.p(v,d):(p=Qf(v),p.c(),p.m(a.parentNode,a)):p&&(p.d(1),p=null),v[0]=="esp32solo"?b?b.p(v,d):(b=Xf(v),b.c(),b.m(u.parentNode,u)):b&&(b.d(1),b=null)},i:fe,o:fe,d(v){v&&C(e),v&&C(l),c&&c.d(v),v&&C(n),f&&f.d(v),v&&C(i),_&&_.d(v),v&&C(o),p&&p.d(v),v&&C(a),b&&b.d(v),v&&C(u)}}}function Fp(t,e,l){let{chip:n}=e;return t.$$set=i=>{"chip"in i&&l(0,n=i.chip)},[n]}class qp extends Ee{constructor(e){super(),Pe(this,e,Fp,Op,Ne,{chip:0})}}function Zf(t){let e;return{c(){e=m("div"),e.textContent="WARNING: Changing this configuration will affect basic configuration of your device. Only make changes here if instructed by vendor",r(e,"class","bd-red")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function Jf(t){let e,l,n,i,o,a,u;return a=new Qc({props:{chip:t[0].chip}}),{c(){e=m("div"),l=T("HAN GPIO"),n=m("br"),i=h(),o=m("select"),ie(a.$$.fragment),r(o,"name","vh"),r(o,"class","in-s"),r(e,"class","my-3")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),le(a,o,null),u=!0},p(c,f){const _={};f&1&&(_.chip=c[0].chip),a.$set(_)},i(c){u||(D(a.$$.fragment,c),u=!0)},o(c){q(a.$$.fragment,c),u=!1},d(c){c&&C(e),ne(a)}}}function Bp(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,w,$,N,E,B,P,L,O,F,x,j,z,G,V,W=t[0].usrcfg&&Zf();d=new qp({props:{chip:t[0].chip}});let U=t[0].board&&t[0].board>20&&Jf(t);return j=new It({props:{active:t[1],message:"Saving device configuration"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),o=h(),a=m("strong"),a.textContent="Initial configuration",u=h(),W&&W.c(),c=h(),f=m("div"),_=T("Board type"),p=m("br"),b=h(),v=m("select"),ie(d.$$.fragment),S=h(),U&&U.c(),w=h(),$=m("div"),N=m("label"),E=m("input"),B=T(" Clear all other configuration"),P=h(),L=m("div"),L.innerHTML='',O=h(),F=m("span"),F.textContent="\xA0",x=h(),ie(j.$$.fragment),r(i,"type","hidden"),r(i,"name","v"),i.value="true",r(a,"class","text-sm"),r(v,"name","vb"),r(v,"class","in-s"),t[0].board===void 0&&Qe(()=>t[4].call(v)),r(f,"class","my-3"),r(E,"type","checkbox"),r(E,"name","vr"),E.__value="true",E.value=E.__value,r(E,"class","rounded mb-1"),r($,"class","my-3"),r(L,"class","my-3"),r(F,"class","clear-both"),r(n,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(K,H){M(K,e,H),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),s(n,u),W&&W.m(n,null),s(n,c),s(n,f),s(f,_),s(f,p),s(f,b),s(f,v),le(d,v,null),qe(v,t[0].board,!0),s(n,S),U&&U.m(n,null),s(n,w),s(n,$),s($,N),s(N,E),E.checked=t[2],s(N,B),s(n,P),s(n,L),s(n,O),s(n,F),M(K,x,H),le(j,K,H),z=!0,G||(V=[ee(v,"change",t[4]),ee(E,"change",t[5]),ee(n,"submit",$s(t[3]))],G=!0)},p(K,[H]){K[0].usrcfg?W||(W=Zf(),W.c(),W.m(n,c)):W&&(W.d(1),W=null);const Y={};H&1&&(Y.chip=K[0].chip),d.$set(Y),H&1&&qe(v,K[0].board),K[0].board&&K[0].board>20?U?(U.p(K,H),H&1&&D(U,1)):(U=Jf(K),U.c(),D(U,1),U.m(n,w)):U&&(De(),q(U,1,1,()=>{U=null}),Ie()),H&4&&(E.checked=K[2]);const Z={};H&2&&(Z.active=K[1]),j.$set(Z)},i(K){z||(D(d.$$.fragment,K),D(U),D(j.$$.fragment,K),z=!0)},o(K){q(d.$$.fragment,K),q(U),q(j.$$.fragment,K),z=!1},d(K){K&&C(e),W&&W.d(),ne(d),U&&U.d(),K&&C(x),ne(j,K),G=!1,ze(V)}}}function Up(t,e,l){let{sysinfo:n={}}=e,i=!1;async function o(f){l(1,i=!0);const _=new FormData(f.target),p=new URLSearchParams;for(let d of _){const[S,w]=d;p.append(S,w)}let v=await(await fetch("/save",{method:"POST",body:p})).json();l(1,i=!1),jt.update(d=>(d.vndcfg=v.success,d.booting=v.reboot,d)),oi(n.usrcfg?"/":"/setup")}let a=!1;function u(){n.board=dt(this),l(0,n)}function c(){a=this.checked,l(2,a),l(0,n)}return t.$$set=f=>{"sysinfo"in f&&l(0,n=f.sysinfo)},t.$$.update=()=>{t.$$.dirty&1&&l(2,a=!n.usrcfg)},[n,i,a,o,u,c]}class jp extends Ee{constructor(e){super(),Pe(this,e,Up,Bp,Ne,{sysinfo:0})}}function xf(t){let e,l,n,i,o,a,u,c;return u=new Xc({}),{c(){e=m("br"),l=h(),n=m("div"),i=m("input"),o=h(),a=m("select"),ie(u.$$.fragment),r(i,"name","si"),r(i,"type","text"),r(i,"class","in-f w-full"),i.required=t[1],r(a,"name","su"),r(a,"class","in-l"),a.required=t[1],r(n,"class","flex")},m(f,_){M(f,e,_),M(f,l,_),M(f,n,_),s(n,i),s(n,o),s(n,a),le(u,a,null),c=!0},p(f,_){(!c||_&2)&&(i.required=f[1]),(!c||_&2)&&(a.required=f[1])},i(f){c||(D(u.$$.fragment,f),c=!0)},o(f){q(u.$$.fragment,f),c=!1},d(f){f&&C(e),f&&C(l),f&&C(n),ne(u)}}}function ec(t){let e;return{c(){e=m("div"),e.innerHTML=`
Gateway
DNS
-
`,r(e,"class","my-3 flex")},m(l,n){$(l,e,n)},d(l){l&&C(e)}}}function Hp(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,M,y,T,N,E,B,P,L,O,F,x,j,z,G,V=t[1]&&xf(t),W=t[1]&&ec();return x=new It({props:{active:t[2],message:"Saving your configuration to the device"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),o=h(),u=m("strong"),u.textContent="Setup",a=h(),c=m("div"),c.innerHTML=`SSID
+
`,r(e,"class","my-3 flex")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function Hp(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,w,$,N,E,B,P,L,O,F,x,j,z,G,V=t[1]&&xf(t),W=t[1]&&ec();return x=new It({props:{active:t[2],message:"Saving your configuration to the device"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),o=h(),a=m("strong"),a.textContent="Setup",u=h(),c=m("div"),c.innerHTML=`SSID
`,f=h(),_=m("div"),_.innerHTML=`PSK
- `,p=h(),b=m("div"),v=S(`Hostname - `),d=m("input"),M=h(),y=m("div"),T=m("label"),N=m("input"),E=S(" Static IP"),B=h(),V&&V.c(),P=h(),W&&W.c(),L=h(),O=m("div"),O.innerHTML='',F=h(),ie(x.$$.fragment),r(i,"type","hidden"),r(i,"name","s"),i.value="true",r(u,"class","text-sm"),r(c,"class","my-3"),r(_,"class","my-3"),r(d,"name","sh"),r(d,"type","text"),r(d,"class","in-s"),r(d,"maxlength","32"),r(d,"pattern","[a-z0-9_-]+"),r(d,"placeholder","Optional, ex.: ams-reader"),r(d,"autocomplete","off"),r(N,"type","checkbox"),r(N,"name","sm"),N.__value="static",N.value=N.__value,r(N,"class","rounded mb-1"),r(y,"class","my-3"),r(O,"class","my-3"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(U,K){$(U,e,K),s(e,l),s(l,n),s(n,i),s(n,o),s(n,u),s(n,a),s(n,c),s(n,f),s(n,_),s(n,p),s(n,b),s(b,v),s(b,d),te(d,t[0].hostname),s(n,M),s(n,y),s(y,T),s(T,N),N.checked=t[1],s(T,E),s(y,B),V&&V.m(y,null),s(n,P),W&&W.m(n,null),s(n,L),s(n,O),$(U,F,K),le(x,U,K),j=!0,z||(G=[ee(d,"input",t[4]),ee(N,"change",t[5]),ee(n,"submit",Ms(t[3]))],z=!0)},p(U,[K]){K&1&&d.value!==U[0].hostname&&te(d,U[0].hostname),K&2&&(N.checked=U[1]),U[1]?V?(V.p(U,K),K&2&&D(V,1)):(V=xf(U),V.c(),D(V,1),V.m(y,null)):V&&(De(),q(V,1,1,()=>{V=null}),Ie()),U[1]?W||(W=ec(),W.c(),W.m(n,L)):W&&(W.d(1),W=null);const H={};K&4&&(H.active=U[2]),x.$set(H)},i(U){j||(D(V),D(x.$$.fragment,U),j=!0)},o(U){q(V),q(x.$$.fragment,U),j=!1},d(U){U&&C(e),V&&V.d(),W&&W.d(),U&&C(F),ne(x,U),z=!1,ze(G)}}}function Wp(t,e,l){let{sysinfo:n={}}=e,i=!1,o=!1,u=0;function a(){var p="";u++;var b=function(){setTimeout(a,1e3)};if(n.net.ip&&u%3==0){if(!n.net.ip){b();return}p="http://"+n.net.ip}else n.hostname&&u%3==1?p="http://"+n.hostname:n.hostname&&u%3==2?p="http://"+n.hostname+".local":p="";console&&console.log("Trying url "+p),jt.update(d=>(d.trying=p,d));var v=new XMLHttpRequest;v.timeout=5e3,v.addEventListener("abort",b),v.addEventListener("error",b),v.addEventListener("timeout",b),v.addEventListener("load",function(d){window.location.href=p||"/"}),v.open("GET",p+"/is-alive",!0),v.send()}async function c(p){l(2,o=!0);const b=new FormData(p.target),v=new URLSearchParams;for(let y of b){const[T,N]=y;v.append(T,N)}let M=await(await fetch("/save",{method:"POST",body:v})).json();l(2,o=!1),jt.update(y=>(y.hostname=b.get("sh"),y.usrcfg=M.success,y.booting=M.reboot,i&&(y.net.ip=b.get("si"),y.net.mask=b.get("su"),y.net.gw=b.get("sg"),y.net.dns1=b.get("sd")),setTimeout(a,5e3),y))}function f(){n.hostname=this.value,l(0,n)}function _(){i=this.checked,l(1,i)}return t.$$set=p=>{"sysinfo"in p&&l(0,n=p.sysinfo)},[n,i,o,c,f,_]}class zp extends Ee{constructor(e){super(),Pe(this,e,Wp,Hp,Ne,{sysinfo:0})}}function Gp(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,M,y,T;return d=new It({props:{active:t[2],message:"Uploading file, please wait"}}),{c(){e=m("div"),l=m("div"),n=m("strong"),i=S("Upload "),o=S(t[1]),u=h(),a=m("p"),a.textContent="Select a suitable file and click upload",c=h(),f=m("form"),_=m("input"),p=h(),b=m("div"),b.innerHTML='',v=h(),ie(d.$$.fragment),r(a,"class","mb-4"),r(_,"name","file"),r(_,"type","file"),r(b,"class","w-full text-right mt-4"),r(f,"action",t[0]),r(f,"enctype","multipart/form-data"),r(f,"method","post"),r(f,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2")},m(N,E){$(N,e,E),s(e,l),s(l,n),s(n,i),s(n,o),s(l,u),s(l,a),s(l,c),s(l,f),s(f,_),s(f,p),s(f,b),$(N,v,E),le(d,N,E),M=!0,y||(T=ee(f,"submit",t[3]),y=!0)},p(N,[E]){(!M||E&2)&&X(o,N[1]),(!M||E&1)&&r(f,"action",N[0]);const B={};E&4&&(B.active=N[2]),d.$set(B)},i(N){M||(D(d.$$.fragment,N),M=!0)},o(N){q(d.$$.fragment,N),M=!1},d(N){N&&C(e),N&&C(v),ne(d,N),y=!1,T()}}}function Vp(t,e,l){let{action:n}=e,{title:i}=e,o=!1;const u=()=>l(2,o=!0);return t.$$set=a=>{"action"in a&&l(0,n=a.action),"title"in a&&l(1,i=a.title)},[n,i,o,u]}class No extends Ee{constructor(e){super(),Pe(this,e,Vp,Gp,Ne,{action:0,title:1})}}function Kp(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,M,y,T,N,E,B,P,L,O,F,x,j,z,G,V,W,U;return G=new It({props:{active:t[1],message:"Saving preferences"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("div"),i.textContent="Various permissions we need to do stuff:",o=h(),u=m("hr"),a=h(),c=m("div"),f=S("Enable one-click upgrade? (implies data collection)"),_=m("br"),p=h(),b=m("a"),v=S("Read more"),d=m("br"),M=h(),y=m("label"),T=m("input"),E=S(" Yes"),B=m("label"),P=m("input"),O=S(" No"),F=m("br"),x=h(),j=m("div"),j.innerHTML='',z=h(),ie(G.$$.fragment),r(b,"href",Ut("Data-collection-on-one-click-firmware-upgrade")),r(b,"target","_blank"),r(b,"class","text-blue-600 hover:text-blue-800"),r(T,"type","radio"),r(T,"name","sf"),T.value=1,T.checked=N=t[0].fwconsent===1,r(T,"class","rounded m-2"),T.required=!0,r(P,"type","radio"),r(P,"name","sf"),P.value=2,P.checked=L=t[0].fwconsent===2,r(P,"class","rounded m-2"),P.required=!0,r(c,"class","my-3"),r(j,"class","my-3"),r(n,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-3 lg:grid-cols-2")},m(K,H){$(K,e,H),s(e,l),s(l,n),s(n,i),s(n,o),s(n,u),s(n,a),s(n,c),s(c,f),s(c,_),s(c,p),s(c,b),s(b,v),s(c,d),s(c,M),s(c,y),s(y,T),s(y,E),s(c,B),s(B,P),s(B,O),s(c,F),s(n,x),s(n,j),$(K,z,H),le(G,K,H),V=!0,W||(U=ee(n,"submit",Ms(t[2])),W=!0)},p(K,[H]){(!V||H&1&&N!==(N=K[0].fwconsent===1))&&(T.checked=N),(!V||H&1&&L!==(L=K[0].fwconsent===2))&&(P.checked=L);const Y={};H&2&&(Y.active=K[1]),G.$set(Y)},i(K){V||(D(G.$$.fragment,K),V=!0)},o(K){q(G.$$.fragment,K),V=!1},d(K){K&&C(e),K&&C(z),ne(G,K),W=!1,U()}}}function Yp(t,e,l){let{sysinfo:n={}}=e,i=!1;async function o(u){l(1,i=!0);const a=new FormData(u.target),c=new URLSearchParams;for(let p of a){const[b,v]=p;c.append(b,v)}let _=await(await fetch("/save",{method:"POST",body:c})).json();l(1,i=!1),jt.update(p=>(p.fwconsent=a.sf===!0?1:a.sf===!1?2:0,p.booting=_.reboot,p)),oi("/")}return t.$$set=u=>{"sysinfo"in u&&l(0,n=u.sysinfo)},[n,i,o]}class Qp extends Ee{constructor(e){super(),Pe(this,e,Yp,Kp,Ne,{sysinfo:0})}}function Xp(t){let e,l;return e=new Um({props:{data:t[1],sysinfo:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.data=n[1]),i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function Zp(t){let e,l;return e=new Cp({props:{sysinfo:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function Jp(t){let e,l;return e=new Lp({props:{sysinfo:t[0],data:t[1]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),i&2&&(o.data=n[1]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function xp(t){let e,l;return e=new No({props:{title:"CA",action:"/mqtt-ca"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function e_(t){let e,l;return e=new No({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function t_(t){let e,l;return e=new No({props:{title:"private key",action:"/mqtt-key"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function l_(t){let e,l;return e=new Qp({props:{sysinfo:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function n_(t){let e,l;return e=new zp({props:{sysinfo:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function i_(t){let e,l;return e=new jp({props:{sysinfo:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function s_(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,M,y,T,N,E,B;return e=new em({props:{data:t[1]}}),n=new Ml({props:{path:"/",$$slots:{default:[Xp]},$$scope:{ctx:t}}}),o=new Ml({props:{path:"/configuration",$$slots:{default:[Zp]},$$scope:{ctx:t}}}),a=new Ml({props:{path:"/status",$$slots:{default:[Jp]},$$scope:{ctx:t}}}),f=new Ml({props:{path:"/mqtt-ca",$$slots:{default:[xp]},$$scope:{ctx:t}}}),p=new Ml({props:{path:"/mqtt-cert",$$slots:{default:[e_]},$$scope:{ctx:t}}}),v=new Ml({props:{path:"/mqtt-key",$$slots:{default:[t_]},$$scope:{ctx:t}}}),M=new Ml({props:{path:"/consent",$$slots:{default:[l_]},$$scope:{ctx:t}}}),T=new Ml({props:{path:"/setup",$$slots:{default:[n_]},$$scope:{ctx:t}}}),E=new Ml({props:{path:"/vendor",$$slots:{default:[i_]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment),l=h(),ie(n.$$.fragment),i=h(),ie(o.$$.fragment),u=h(),ie(a.$$.fragment),c=h(),ie(f.$$.fragment),_=h(),ie(p.$$.fragment),b=h(),ie(v.$$.fragment),d=h(),ie(M.$$.fragment),y=h(),ie(T.$$.fragment),N=h(),ie(E.$$.fragment)},m(P,L){le(e,P,L),$(P,l,L),le(n,P,L),$(P,i,L),le(o,P,L),$(P,u,L),le(a,P,L),$(P,c,L),le(f,P,L),$(P,_,L),le(p,P,L),$(P,b,L),le(v,P,L),$(P,d,L),le(M,P,L),$(P,y,L),le(T,P,L),$(P,N,L),le(E,P,L),B=!0},p(P,L){const O={};L&2&&(O.data=P[1]),e.$set(O);const F={};L&7&&(F.$$scope={dirty:L,ctx:P}),n.$set(F);const x={};L&5&&(x.$$scope={dirty:L,ctx:P}),o.$set(x);const j={};L&7&&(j.$$scope={dirty:L,ctx:P}),a.$set(j);const z={};L&4&&(z.$$scope={dirty:L,ctx:P}),f.$set(z);const G={};L&4&&(G.$$scope={dirty:L,ctx:P}),p.$set(G);const V={};L&4&&(V.$$scope={dirty:L,ctx:P}),v.$set(V);const W={};L&5&&(W.$$scope={dirty:L,ctx:P}),M.$set(W);const U={};L&5&&(U.$$scope={dirty:L,ctx:P}),T.$set(U);const K={};L&5&&(K.$$scope={dirty:L,ctx:P}),E.$set(K)},i(P){B||(D(e.$$.fragment,P),D(n.$$.fragment,P),D(o.$$.fragment,P),D(a.$$.fragment,P),D(f.$$.fragment,P),D(p.$$.fragment,P),D(v.$$.fragment,P),D(M.$$.fragment,P),D(T.$$.fragment,P),D(E.$$.fragment,P),B=!0)},o(P){q(e.$$.fragment,P),q(n.$$.fragment,P),q(o.$$.fragment,P),q(a.$$.fragment,P),q(f.$$.fragment,P),q(p.$$.fragment,P),q(v.$$.fragment,P),q(M.$$.fragment,P),q(T.$$.fragment,P),q(E.$$.fragment,P),B=!1},d(P){ne(e,P),P&&C(l),ne(n,P),P&&C(i),ne(o,P),P&&C(u),ne(a,P),P&&C(c),ne(f,P),P&&C(_),ne(p,P),P&&C(b),ne(v,P),P&&C(d),ne(M,P),P&&C(y),ne(T,P),P&&C(N),ne(E,P)}}}function o_(t){let e,l,n,i;const o=[u_,a_],u=[];function a(c,f){return c[0].trying?0:1}return e=a(t),l=u[e]=o[e](t),{c(){l.c(),n=Ve()},m(c,f){u[e].m(c,f),$(c,n,f),i=!0},p(c,f){let _=e;e=a(c),e===_?u[e].p(c,f):(De(),q(u[_],1,1,()=>{u[_]=null}),Ie(),l=u[e],l?l.p(c,f):(l=u[e]=o[e](c),l.c()),D(l,1),l.m(n.parentNode,n))},i(c){i||(D(l),i=!0)},o(c){q(l),i=!1},d(c){u[e].d(c),c&&C(n)}}}function r_(t){let e,l;return e=new It({props:{active:"true",message:"Device is upgrading, please wait"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function a_(t){let e,l;return e=new It({props:{active:"true",message:"Device is booting, please wait"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function u_(t){let e,l;return e=new It({props:{active:"true",message:"Device is booting, please wait. Trying to reach it on "+t[0].trying}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.message="Device is booting, please wait. Trying to reach it on "+n[0].trying),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function f_(t){let e,l,n,i,o,u;l=new Ac({props:{$$slots:{default:[s_]},$$scope:{ctx:t}}});const a=[r_,o_],c=[];function f(_,p){return _[0].upgrading?0:_[0].booting?1:-1}return~(i=f(t))&&(o=c[i]=a[i](t)),{c(){e=m("div"),ie(l.$$.fragment),n=h(),o&&o.c(),r(e,"class","container mx-auto m-3")},m(_,p){$(_,e,p),le(l,e,null),s(e,n),~i&&c[i].m(e,null),u=!0},p(_,[p]){const b={};p&7&&(b.$$scope={dirty:p,ctx:_}),l.$set(b);let v=i;i=f(_),i===v?~i&&c[i].p(_,p):(o&&(De(),q(c[v],1,1,()=>{c[v]=null}),Ie()),~i?(o=c[i],o?o.p(_,p):(o=c[i]=a[i](_),o.c()),D(o,1),o.m(e,null)):o=null)},i(_){u||(D(l.$$.fragment,_),D(o),u=!0)},o(_){q(l.$$.fragment,_),q(o),u=!1},d(_){_&&C(e),ne(l),~i&&c[i].d()}}}function c_(t,e,l){let n={};jt.subscribe(o=>{l(0,n=o),n.vndcfg===!1?oi("/vendor"):n.usrcfg===!1?oi("/setup"):n.fwconsent===0&&oi("/consent")}),yo();let i={};return y1.subscribe(o=>{l(1,i=o)}),[n,i]}class m_ extends Ee{constructor(e){super(),Pe(this,e,c_,f_,Ne,{})}}new m_({target:document.getElementById("app")}); + `,p=h(),b=m("div"),v=T(`Hostname + `),d=m("input"),S=h(),w=m("div"),$=m("label"),N=m("input"),E=T(" Static IP"),B=h(),V&&V.c(),P=h(),W&&W.c(),L=h(),O=m("div"),O.innerHTML='',F=h(),ie(x.$$.fragment),r(i,"type","hidden"),r(i,"name","s"),i.value="true",r(a,"class","text-sm"),r(c,"class","my-3"),r(_,"class","my-3"),r(d,"name","sh"),r(d,"type","text"),r(d,"class","in-s"),r(d,"maxlength","32"),r(d,"pattern","[a-z0-9_-]+"),r(d,"placeholder","Optional, ex.: ams-reader"),r(d,"autocomplete","off"),r(N,"type","checkbox"),r(N,"name","sm"),N.__value="static",N.value=N.__value,r(N,"class","rounded mb-1"),r(w,"class","my-3"),r(O,"class","my-3"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(U,K){M(U,e,K),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),s(n,u),s(n,c),s(n,f),s(n,_),s(n,p),s(n,b),s(b,v),s(b,d),te(d,t[0].hostname),s(n,S),s(n,w),s(w,$),s($,N),N.checked=t[1],s($,E),s(w,B),V&&V.m(w,null),s(n,P),W&&W.m(n,null),s(n,L),s(n,O),M(U,F,K),le(x,U,K),j=!0,z||(G=[ee(d,"input",t[4]),ee(N,"change",t[5]),ee(n,"submit",$s(t[3]))],z=!0)},p(U,[K]){K&1&&d.value!==U[0].hostname&&te(d,U[0].hostname),K&2&&(N.checked=U[1]),U[1]?V?(V.p(U,K),K&2&&D(V,1)):(V=xf(U),V.c(),D(V,1),V.m(w,null)):V&&(De(),q(V,1,1,()=>{V=null}),Ie()),U[1]?W||(W=ec(),W.c(),W.m(n,L)):W&&(W.d(1),W=null);const H={};K&4&&(H.active=U[2]),x.$set(H)},i(U){j||(D(V),D(x.$$.fragment,U),j=!0)},o(U){q(V),q(x.$$.fragment,U),j=!1},d(U){U&&C(e),V&&V.d(),W&&W.d(),U&&C(F),ne(x,U),z=!1,ze(G)}}}function Wp(t,e,l){let{sysinfo:n={}}=e,i=!1,o=!1,a=0;function u(){var p="";a++;var b=function(){setTimeout(u,1e3)};if(n.net.ip&&a%3==0){if(!n.net.ip){b();return}p="http://"+n.net.ip}else n.hostname&&a%3==1?p="http://"+n.hostname:n.hostname&&a%3==2?p="http://"+n.hostname+".local":p="";console&&console.log("Trying url "+p),jt.update(d=>(d.trying=p,d));var v=new XMLHttpRequest;v.timeout=5e3,v.addEventListener("abort",b),v.addEventListener("error",b),v.addEventListener("timeout",b),v.addEventListener("load",function(d){window.location.href=p||"/"}),v.open("GET",p+"/is-alive",!0),v.send()}async function c(p){l(2,o=!0);const b=new FormData(p.target),v=new URLSearchParams;for(let w of b){const[$,N]=w;v.append($,N)}let S=await(await fetch("/save",{method:"POST",body:v})).json();l(2,o=!1),jt.update(w=>(w.hostname=b.get("sh"),w.usrcfg=S.success,w.booting=S.reboot,i&&(w.net.ip=b.get("si"),w.net.mask=b.get("su"),w.net.gw=b.get("sg"),w.net.dns1=b.get("sd")),setTimeout(u,5e3),w))}function f(){n.hostname=this.value,l(0,n)}function _(){i=this.checked,l(1,i)}return t.$$set=p=>{"sysinfo"in p&&l(0,n=p.sysinfo)},[n,i,o,c,f,_]}class zp extends Ee{constructor(e){super(),Pe(this,e,Wp,Hp,Ne,{sysinfo:0})}}function Gp(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,w,$;return d=new It({props:{active:t[2],message:"Uploading file, please wait"}}),{c(){e=m("div"),l=m("div"),n=m("strong"),i=T("Upload "),o=T(t[1]),a=h(),u=m("p"),u.textContent="Select a suitable file and click upload",c=h(),f=m("form"),_=m("input"),p=h(),b=m("div"),b.innerHTML='',v=h(),ie(d.$$.fragment),r(u,"class","mb-4"),r(_,"name","file"),r(_,"type","file"),r(b,"class","w-full text-right mt-4"),r(f,"action",t[0]),r(f,"enctype","multipart/form-data"),r(f,"method","post"),r(f,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2")},m(N,E){M(N,e,E),s(e,l),s(l,n),s(n,i),s(n,o),s(l,a),s(l,u),s(l,c),s(l,f),s(f,_),s(f,p),s(f,b),M(N,v,E),le(d,N,E),S=!0,w||($=ee(f,"submit",t[3]),w=!0)},p(N,[E]){(!S||E&2)&&X(o,N[1]),(!S||E&1)&&r(f,"action",N[0]);const B={};E&4&&(B.active=N[2]),d.$set(B)},i(N){S||(D(d.$$.fragment,N),S=!0)},o(N){q(d.$$.fragment,N),S=!1},d(N){N&&C(e),N&&C(v),ne(d,N),w=!1,$()}}}function Vp(t,e,l){let{action:n}=e,{title:i}=e,o=!1;const a=()=>l(2,o=!0);return t.$$set=u=>{"action"in u&&l(0,n=u.action),"title"in u&&l(1,i=u.title)},[n,i,o,a]}class No extends Ee{constructor(e){super(),Pe(this,e,Vp,Gp,Ne,{action:0,title:1})}}function Kp(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,w,$,N,E,B,P,L,O,F,x,j,z,G,V,W,U;return G=new It({props:{active:t[1],message:"Saving preferences"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("div"),i.textContent="Various permissions we need to do stuff:",o=h(),a=m("hr"),u=h(),c=m("div"),f=T("Enable one-click upgrade? (implies data collection)"),_=m("br"),p=h(),b=m("a"),v=T("Read more"),d=m("br"),S=h(),w=m("label"),$=m("input"),E=T(" Yes"),B=m("label"),P=m("input"),O=T(" No"),F=m("br"),x=h(),j=m("div"),j.innerHTML='',z=h(),ie(G.$$.fragment),r(b,"href",Ut("Data-collection-on-one-click-firmware-upgrade")),r(b,"target","_blank"),r(b,"class","text-blue-600 hover:text-blue-800"),r($,"type","radio"),r($,"name","sf"),$.value=1,$.checked=N=t[0].fwconsent===1,r($,"class","rounded m-2"),$.required=!0,r(P,"type","radio"),r(P,"name","sf"),P.value=2,P.checked=L=t[0].fwconsent===2,r(P,"class","rounded m-2"),P.required=!0,r(c,"class","my-3"),r(j,"class","my-3"),r(n,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-3 lg:grid-cols-2")},m(K,H){M(K,e,H),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),s(n,u),s(n,c),s(c,f),s(c,_),s(c,p),s(c,b),s(b,v),s(c,d),s(c,S),s(c,w),s(w,$),s(w,E),s(c,B),s(B,P),s(B,O),s(c,F),s(n,x),s(n,j),M(K,z,H),le(G,K,H),V=!0,W||(U=ee(n,"submit",$s(t[2])),W=!0)},p(K,[H]){(!V||H&1&&N!==(N=K[0].fwconsent===1))&&($.checked=N),(!V||H&1&&L!==(L=K[0].fwconsent===2))&&(P.checked=L);const Y={};H&2&&(Y.active=K[1]),G.$set(Y)},i(K){V||(D(G.$$.fragment,K),V=!0)},o(K){q(G.$$.fragment,K),V=!1},d(K){K&&C(e),K&&C(z),ne(G,K),W=!1,U()}}}function Yp(t,e,l){let{sysinfo:n={}}=e,i=!1;async function o(a){l(1,i=!0);const u=new FormData(a.target),c=new URLSearchParams;for(let p of u){const[b,v]=p;c.append(b,v)}let _=await(await fetch("/save",{method:"POST",body:c})).json();l(1,i=!1),jt.update(p=>(p.fwconsent=u.sf===!0?1:u.sf===!1?2:0,p.booting=_.reboot,p)),oi("/")}return t.$$set=a=>{"sysinfo"in a&&l(0,n=a.sysinfo)},[n,i,o]}class Qp extends Ee{constructor(e){super(),Pe(this,e,Yp,Kp,Ne,{sysinfo:0})}}function Xp(t){let e,l;return e=new Um({props:{data:t[1],sysinfo:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.data=n[1]),i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function Zp(t){let e,l;return e=new Cp({props:{sysinfo:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function Jp(t){let e,l;return e=new Lp({props:{sysinfo:t[0],data:t[1]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),i&2&&(o.data=n[1]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function xp(t){let e,l;return e=new No({props:{title:"CA",action:"/mqtt-ca"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function e_(t){let e,l;return e=new No({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function t_(t){let e,l;return e=new No({props:{title:"private key",action:"/mqtt-key"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function l_(t){let e,l;return e=new Qp({props:{sysinfo:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function n_(t){let e,l;return e=new zp({props:{sysinfo:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function i_(t){let e,l;return e=new jp({props:{sysinfo:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function s_(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,w,$,N,E,B;return e=new em({props:{data:t[1]}}),n=new $l({props:{path:"/",$$slots:{default:[Xp]},$$scope:{ctx:t}}}),o=new $l({props:{path:"/configuration",$$slots:{default:[Zp]},$$scope:{ctx:t}}}),u=new $l({props:{path:"/status",$$slots:{default:[Jp]},$$scope:{ctx:t}}}),f=new $l({props:{path:"/mqtt-ca",$$slots:{default:[xp]},$$scope:{ctx:t}}}),p=new $l({props:{path:"/mqtt-cert",$$slots:{default:[e_]},$$scope:{ctx:t}}}),v=new $l({props:{path:"/mqtt-key",$$slots:{default:[t_]},$$scope:{ctx:t}}}),S=new $l({props:{path:"/consent",$$slots:{default:[l_]},$$scope:{ctx:t}}}),$=new $l({props:{path:"/setup",$$slots:{default:[n_]},$$scope:{ctx:t}}}),E=new $l({props:{path:"/vendor",$$slots:{default:[i_]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment),l=h(),ie(n.$$.fragment),i=h(),ie(o.$$.fragment),a=h(),ie(u.$$.fragment),c=h(),ie(f.$$.fragment),_=h(),ie(p.$$.fragment),b=h(),ie(v.$$.fragment),d=h(),ie(S.$$.fragment),w=h(),ie($.$$.fragment),N=h(),ie(E.$$.fragment)},m(P,L){le(e,P,L),M(P,l,L),le(n,P,L),M(P,i,L),le(o,P,L),M(P,a,L),le(u,P,L),M(P,c,L),le(f,P,L),M(P,_,L),le(p,P,L),M(P,b,L),le(v,P,L),M(P,d,L),le(S,P,L),M(P,w,L),le($,P,L),M(P,N,L),le(E,P,L),B=!0},p(P,L){const O={};L&2&&(O.data=P[1]),e.$set(O);const F={};L&7&&(F.$$scope={dirty:L,ctx:P}),n.$set(F);const x={};L&5&&(x.$$scope={dirty:L,ctx:P}),o.$set(x);const j={};L&7&&(j.$$scope={dirty:L,ctx:P}),u.$set(j);const z={};L&4&&(z.$$scope={dirty:L,ctx:P}),f.$set(z);const G={};L&4&&(G.$$scope={dirty:L,ctx:P}),p.$set(G);const V={};L&4&&(V.$$scope={dirty:L,ctx:P}),v.$set(V);const W={};L&5&&(W.$$scope={dirty:L,ctx:P}),S.$set(W);const U={};L&5&&(U.$$scope={dirty:L,ctx:P}),$.$set(U);const K={};L&5&&(K.$$scope={dirty:L,ctx:P}),E.$set(K)},i(P){B||(D(e.$$.fragment,P),D(n.$$.fragment,P),D(o.$$.fragment,P),D(u.$$.fragment,P),D(f.$$.fragment,P),D(p.$$.fragment,P),D(v.$$.fragment,P),D(S.$$.fragment,P),D($.$$.fragment,P),D(E.$$.fragment,P),B=!0)},o(P){q(e.$$.fragment,P),q(n.$$.fragment,P),q(o.$$.fragment,P),q(u.$$.fragment,P),q(f.$$.fragment,P),q(p.$$.fragment,P),q(v.$$.fragment,P),q(S.$$.fragment,P),q($.$$.fragment,P),q(E.$$.fragment,P),B=!1},d(P){ne(e,P),P&&C(l),ne(n,P),P&&C(i),ne(o,P),P&&C(a),ne(u,P),P&&C(c),ne(f,P),P&&C(_),ne(p,P),P&&C(b),ne(v,P),P&&C(d),ne(S,P),P&&C(w),ne($,P),P&&C(N),ne(E,P)}}}function o_(t){let e,l,n,i;const o=[u_,a_],a=[];function u(c,f){return c[0].trying?0:1}return e=u(t),l=a[e]=o[e](t),{c(){l.c(),n=Ve()},m(c,f){a[e].m(c,f),M(c,n,f),i=!0},p(c,f){let _=e;e=u(c),e===_?a[e].p(c,f):(De(),q(a[_],1,1,()=>{a[_]=null}),Ie(),l=a[e],l?l.p(c,f):(l=a[e]=o[e](c),l.c()),D(l,1),l.m(n.parentNode,n))},i(c){i||(D(l),i=!0)},o(c){q(l),i=!1},d(c){a[e].d(c),c&&C(n)}}}function r_(t){let e,l;return e=new It({props:{active:"true",message:"Device is upgrading, please wait"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function a_(t){let e,l;return e=new It({props:{active:"true",message:"Device is booting, please wait"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function u_(t){let e,l;return e=new It({props:{active:"true",message:"Device is booting, please wait. Trying to reach it on "+t[0].trying}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.message="Device is booting, please wait. Trying to reach it on "+n[0].trying),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function f_(t){let e,l,n,i,o,a;l=new Pc({props:{$$slots:{default:[s_]},$$scope:{ctx:t}}});const u=[r_,o_],c=[];function f(_,p){return _[0].upgrading?0:_[0].booting?1:-1}return~(i=f(t))&&(o=c[i]=u[i](t)),{c(){e=m("div"),ie(l.$$.fragment),n=h(),o&&o.c(),r(e,"class","container mx-auto m-3")},m(_,p){M(_,e,p),le(l,e,null),s(e,n),~i&&c[i].m(e,null),a=!0},p(_,[p]){const b={};p&7&&(b.$$scope={dirty:p,ctx:_}),l.$set(b);let v=i;i=f(_),i===v?~i&&c[i].p(_,p):(o&&(De(),q(c[v],1,1,()=>{c[v]=null}),Ie()),~i?(o=c[i],o?o.p(_,p):(o=c[i]=u[i](_),o.c()),D(o,1),o.m(e,null)):o=null)},i(_){a||(D(l.$$.fragment,_),D(o),a=!0)},o(_){q(l.$$.fragment,_),q(o),a=!1},d(_){_&&C(e),ne(l),~i&&c[i].d()}}}function c_(t,e,l){let n={};jt.subscribe(o=>{l(0,n=o),n.vndcfg===!1?oi("/vendor"):n.usrcfg===!1?oi("/setup"):n.fwconsent===0&&oi("/consent")}),yo();let i={};return y1.subscribe(o=>{l(1,i=o)}),[n,i]}class m_ extends Ee{constructor(e){super(),Pe(this,e,c_,f_,Ne,{})}}new m_({target:document.getElementById("app")}); diff --git a/lib/SvelteUi/app/src/lib/AmpPlot.svelte b/lib/SvelteUi/app/src/lib/AmpPlot.svelte index db00d355..cf8b0e2a 100644 --- a/lib/SvelteUi/app/src/lib/AmpPlot.svelte +++ b/lib/SvelteUi/app/src/lib/AmpPlot.svelte @@ -7,17 +7,18 @@ export let u3; export let i1; export let i2; + export let i2e; export let i3; export let max; let config = {}; - function point(v) { + function point(v,e) { return { label: fmtnum(v) + 'A', - title: v.toFixed(1) + ' A', + title: (e ? 'Estimated ' : '') + v.toFixed(1) + ' A', value: isNaN(v) ? 0 : v, - color: ampcol(v ? (v)/(max)*100 : 0) + color: ampcol(v ? (v)/(max)*100 : 0, e) }; }; @@ -30,7 +31,7 @@ } if(u2 > 0) { xTicks.push({ label: 'L2' }); - points.push(point(i2)); + points.push(point(i2, i2e)); } if(u3 > 0) { xTicks.push({ label: 'L3' }); diff --git a/lib/SvelteUi/app/src/lib/BarChart.svelte b/lib/SvelteUi/app/src/lib/BarChart.svelte index 6b7b4464..e1a64db6 100644 --- a/lib/SvelteUi/app/src/lib/BarChart.svelte +++ b/lib/SvelteUi/app/src/lib/BarChart.svelte @@ -9,9 +9,10 @@ let heightAvailable; let labelOffset; let vertSwitch = 30; + let titleHeight = 0; $: { - heightAvailable = height-(config.title ? 20 : 0); + heightAvailable = height-titleHeight; let innerWidth = width - (config.padding.left + config.padding.right); barWidth = innerWidth / config.points.length; labelOffset = barWidth < vertSwitch ? 30 : 15; @@ -36,7 +37,7 @@
{#if config.x.ticks && config.points && heightAvailable} {#if config.title} - {config.title} +
{config.title}
{/if} diff --git a/lib/SvelteUi/app/src/lib/Dashboard.svelte b/lib/SvelteUi/app/src/lib/Dashboard.svelte index d541e638..a81bdbbf 100644 --- a/lib/SvelteUi/app/src/lib/Dashboard.svelte +++ b/lib/SvelteUi/app/src/lib/Dashboard.svelte @@ -62,7 +62,7 @@ {/if} {#if uiVisibility(sysinfo.ui.a, data.i1 > 0.01 || data.i2 > 0.01 || data.i3 > 0.01)}
- +
{/if} {#if uiVisibility(sysinfo.ui.r, data.ri > 0 || data.re > 0 || data.ric > 0 || data.rec > 0)} diff --git a/lib/SvelteUi/app/src/lib/Helpers.js b/lib/SvelteUi/app/src/lib/Helpers.js index 9cf0e7d7..600ea0aa 100644 --- a/lib/SvelteUi/app/src/lib/Helpers.js +++ b/lib/SvelteUi/app/src/lib/Helpers.js @@ -11,12 +11,15 @@ export function voltcol(volt) { return '#d90000'; }; -export function ampcol(pct) { - if(pct > 90) return '#d90000'; - else if(pct > 85) return'#e32100'; - else if(pct > 80) return '#ffb800'; - else if(pct > 75) return '#dcd800'; - else return '#32d900'; +export function ampcol(pct, est) { + let col; + if(pct > 90) col = '#d90000'; + else if(pct > 85) col = '#e32100'; + else if(pct > 80) col = '#ffb800'; + else if(pct > 75) col = '#dcd800'; + else col = '#32d900'; + + return col+(est?'88':''); }; export function exportcol(pct) { diff --git a/lib/SvelteUi/json/data.json b/lib/SvelteUi/json/data.json index 9d167151..bf54ebfa 100644 --- a/lib/SvelteUi/json/data.json +++ b/lib/SvelteUi/json/data.json @@ -15,6 +15,7 @@ "u3" : %.2f, "i1" : %.2f, "i2" : %.2f, + "i2e" : %s, "i3" : %.2f, "f" : %.2f, "f1" : %.2f, diff --git a/lib/SvelteUi/src/AmsWebServer.cpp b/lib/SvelteUi/src/AmsWebServer.cpp index 51d94331..7fa42e41 100644 --- a/lib/SvelteUi/src/AmsWebServer.cpp +++ b/lib/SvelteUi/src/AmsWebServer.cpp @@ -464,6 +464,7 @@ void AmsWebServer::dataJson() { meterState->getL3Voltage(), meterState->getL1Current(), meterState->getL2Current(), + meterState->isL2currentEstimated() ? "true" : "false", meterState->getL3Current(), meterState->getPowerFactor(), meterState->getL1PowerFactor(), diff --git a/src/IEC6205675.cpp b/src/IEC6205675.cpp index 5dc8f03f..c15269c8 100644 --- a/src/IEC6205675.cpp +++ b/src/IEC6205675.cpp @@ -102,6 +102,7 @@ IEC6205675::IEC6205675(const char* d, uint8_t useMeterType, MeterConfig* meterCo l2voltage = sqrt(pow(l1voltage - l3voltage * cos(60 * (PI/180)), 2) + pow(l3voltage * sin(60 * (PI/180)),2)); if(l2voltage > 0) { l2current = (((activeImportPower - activeExportPower) * sqrt(3)) - (l1voltage * l1current) - (l3voltage * l3current)) / l2voltage; + l2currentEstimated = true; } } @@ -493,6 +494,7 @@ IEC6205675::IEC6205675(const char* d, uint8_t useMeterType, MeterConfig* meterCo if(activeExportPower == 0.0) { l2current = max((float) 0.0, l2current); } + l2currentEstimated = true; } } else if(twoPhase && l1current > 0.0 && l2current > 0.0 && l3current > 0.0) { l2voltage = sqrt(pow(l1voltage - l3voltage * cos(60.0 * (PI/180.0)), 2) + pow(l3voltage * sin(60.0 * (PI/180.0)),2)); From 9efc19090eb57c35df06a8817a9111bc5c3f5ff2 Mon Sep 17 00:00:00 2001 From: Gunnar Skjold Date: Mon, 4 Dec 2023 12:17:07 +0100 Subject: [PATCH 06/16] Improved feedback for upgrade error --- lib/SvelteUi/app/dist/index.js | 18 +++++++++--------- lib/SvelteUi/app/src/lib/Helpers.js | 18 ++++++++++++++++++ lib/SvelteUi/app/src/lib/StatusPage.svelte | 4 ++-- 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/lib/SvelteUi/app/dist/index.js b/lib/SvelteUi/app/dist/index.js index f49f1eb2..5b90e006 100644 --- a/lib/SvelteUi/app/dist/index.js +++ b/lib/SvelteUi/app/dist/index.js @@ -1,14 +1,14 @@ -(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function l(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerpolicy&&(o.referrerPolicy=i.referrerpolicy),i.crossorigin==="use-credentials"?o.credentials="include":i.crossorigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(i){if(i.ep)return;i.ep=!0;const o=l(i);fetch(i.href,o)}})();function fe(){}function xt(t,e){for(const l in e)t[l]=e[l];return t}function tc(t){return t()}function La(){return Object.create(null)}function ze(t){t.forEach(tc)}function co(t){return typeof t=="function"}function Ne(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let _s;function Js(t,e){return _s||(_s=document.createElement("a")),_s.href=e,t===_s.href}function e0(t){return Object.keys(t).length===0}function mo(t,...e){if(t==null)return fe;const l=t.subscribe(...e);return l.unsubscribe?()=>l.unsubscribe():l}function ai(t){let e;return mo(t,l=>e=l)(),e}function ul(t,e,l){t.$$.on_destroy.push(mo(e,l))}function po(t,e,l,n){if(t){const i=lc(t,e,l,n);return t[0](i)}}function lc(t,e,l,n){return t[1]&&n?xt(l.ctx.slice(),t[1](n(e))):l.ctx}function _o(t,e,l,n){if(t[2]&&n){const i=t[2](n(l));if(e.dirty===void 0)return i;if(typeof i=="object"){const o=[],a=Math.max(e.dirty.length,i.length);for(let u=0;u32){const e=[],l=t.ctx.length/32;for(let n=0;nt.removeEventListener(e,l,n)}function $s(t){return function(e){return e.preventDefault(),t.call(this,e)}}function r(t,e,l){l==null?t.removeAttribute(e):t.getAttribute(e)!==l&&t.setAttribute(e,l)}const l0=["width","height"];function ui(t,e){const l=Object.getOwnPropertyDescriptors(t.__proto__);for(const n in e)e[n]==null?t.removeAttribute(n):n==="style"?t.style.cssText=e[n]:n==="__value"?t.value=t[n]=e[n]:l[n]&&l[n].set&&l0.indexOf(n)===-1?t[n]=e[n]:r(t,n,e[n])}function he(t){return t===""?null:+t}function n0(t){return Array.from(t.childNodes)}function X(t,e){e=""+e,t.data!==e&&(t.data=e)}function i0(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function s0(t,e,l){~t0.indexOf(l)?i0(t,e):X(t,e)}function te(t,e){t.value=e==null?"":e}function nc(t,e,l,n){l==null?t.style.removeProperty(e):t.style.setProperty(e,l,n?"important":"")}function qe(t,e,l){for(let n=0;n{a.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{o=ee(n.contentWindow,"resize",e),e()}),s(t,n),()=>{(i||o&&n.contentWindow)&&o(),C(n)}}function r0(t,e,{bubbles:l=!1,cancelable:n=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(t,l,n,e),i}function Oa(t,e){return new t(e)}let Si;function Mi(t){Si=t}function Ti(){if(!Si)throw new Error("Function called outside component initialization");return Si}function sc(t){Ti().$$.on_mount.push(t)}function a0(t){Ti().$$.on_destroy.push(t)}function u0(){const t=Ti();return(e,l,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const o=r0(e,l,{cancelable:n});return i.slice().forEach(a=>{a.call(t,o)}),!o.defaultPrevented}return!0}}function $i(t,e){return Ti().$$.context.set(t,e),e}function Bl(t){return Ti().$$.context.get(t)}const ii=[],ws=[];let si=[];const Fa=[],oc=Promise.resolve();let xs=!1;function rc(){xs||(xs=!0,oc.then(ac))}function f0(){return rc(),oc}function Qe(t){si.push(t)}const Vs=new Set;let li=0;function ac(){if(li!==0)return;const t=Si;do{try{for(;lit.indexOf(n)===-1?e.push(n):l.push(n)),l.forEach(n=>n()),si=e}const bs=new Set;let rn;function De(){rn={r:0,c:[],p:rn}}function Ie(){rn.r||ze(rn.c),rn=rn.p}function D(t,e){t&&t.i&&(bs.delete(t),t.i(e))}function q(t,e,l,n){if(t&&t.o){if(bs.has(t))return;bs.add(t),rn.c.push(()=>{bs.delete(t),n&&(l&&t.d(1),n())}),t.o(e)}else n&&n()}function uc(t,e){const l={},n={},i={$$scope:1};let o=t.length;for(;o--;){const a=t[o],u=e[o];if(u){for(const c in a)c in u||(n[c]=1);for(const c in u)i[c]||(l[c]=u[c],i[c]=1);t[o]=u}else for(const c in a)i[c]=1}for(const a in n)a in l||(l[a]=void 0);return l}function qa(t){return typeof t=="object"&&t!==null?t:{}}function ie(t){t&&t.c()}function le(t,e,l,n){const{fragment:i,after_update:o}=t.$$;i&&i.m(e,l),n||Qe(()=>{const a=t.$$.on_mount.map(tc).filter(co);t.$$.on_destroy?t.$$.on_destroy.push(...a):ze(a),t.$$.on_mount=[]}),o.forEach(Qe)}function ne(t,e){const l=t.$$;l.fragment!==null&&(m0(l.after_update),ze(l.on_destroy),l.fragment&&l.fragment.d(e),l.on_destroy=l.fragment=null,l.ctx=[])}function p0(t,e){t.$$.dirty[0]===-1&&(ii.push(t),rc(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const d=v.length?v[0]:b;return f.ctx&&i(f.ctx[p],f.ctx[p]=d)&&(!f.skip_bound&&f.bound[p]&&f.bound[p](d),_&&p0(t,p)),b}):[],f.update(),_=!0,ze(f.before_update),f.fragment=n?n(f.ctx):!1,e.target){if(e.hydrate){const p=n0(e.target);f.fragment&&f.fragment.l(p),p.forEach(C)}else f.fragment&&f.fragment.c();e.intro&&D(t.$$.fragment),le(t,e.target,e.anchor,e.customElement),ac()}Mi(c)}class Ee{$destroy(){ne(this,1),this.$destroy=fe}$on(e,l){if(!co(l))return fe;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(l),()=>{const i=n.indexOf(l);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!e0(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Ba=t=>typeof t>"u",fc=t=>typeof t=="function",cc=t=>typeof t=="number";function _0(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function mc(){let t=0;return()=>t++}function d0(){return Math.random().toString(36).substring(2)}const Ul=typeof window>"u";function pc(t,e,l){return t.addEventListener(e,l),()=>t.removeEventListener(e,l)}const _c=(t,e)=>t?{}:{style:e},eo=t=>({"aria-hidden":"true",..._c(t,"display:none;")}),ni=[];function dc(t,e){return{subscribe:at(t,e).subscribe}}function at(t,e=fe){let l;const n=new Set;function i(u){if(Ne(t,u)&&(t=u,l)){const c=!ni.length;for(const f of n)f[1](),ni.push(f,t);if(c){for(let f=0;f{n.delete(f),n.size===0&&l&&(l(),l=null)}}return{set:i,update:o,subscribe:a}}function v0(t,e,l){const n=!Array.isArray(t),i=n?[t]:t,o=e.length<2;return dc(l,a=>{let u=!1;const c=[];let f=0,_=fe;const p=()=>{if(f)return;_();const v=e(n?c[0]:c,a);o?a(v):_=co(v)?v:fe},b=i.map((v,d)=>mo(v,S=>{c[d]=S,f&=~(1<{f|=1<`@@svnav-ctx__${t}`,to=Ni("LOCATION"),fi=Ni("ROUTER"),vc=Ni("ROUTE"),h0=Ni("ROUTE_PARAMS"),b0=Ni("FOCUS_ELEM"),hc=/^:(.+)/,wi=(t,e,l)=>t.substr(e,l),lo=(t,e)=>wi(t,0,e.length)===e,g0=t=>t==="",k0=t=>hc.test(t),bc=t=>t[0]==="*",w0=t=>t.replace(/\*.*$/,""),gc=t=>t.replace(/(^\/+|\/+$)/g,"");function ml(t,e=!1){const l=gc(t).split("/");return e?l.filter(Boolean):l}const Ks=(t,e)=>t+(e?`?${e}`:""),bo=t=>`/${gc(t)}`;function Ai(...t){const e=n=>ml(n,!0).join("/"),l=t.map(e).join("/");return bo(l)}const go=1,Ss=2,mn=3,y0=4,kc=5,C0=6,wc=7,M0=8,$0=9,yc=10,Cc=11,S0={[go]:"Link",[Ss]:"Route",[mn]:"Router",[y0]:"useFocus",[kc]:"useLocation",[C0]:"useMatch",[wc]:"useNavigate",[M0]:"useParams",[$0]:"useResolvable",[yc]:"useResolve",[Cc]:"navigate"},ko=t=>S0[t];function T0(t,e){let l;return t===Ss?l=e.path?`path="${e.path}"`:"default":t===go?l=`to="${e.to}"`:t===mn&&(l=`basepath="${e.basepath||""}"`),`<${ko(t)} ${l||""} />`}function N0(t,e,l,n){const i=l&&T0(n||t,l),o=i?` +(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function l(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerpolicy&&(o.referrerPolicy=i.referrerpolicy),i.crossorigin==="use-credentials"?o.credentials="include":i.crossorigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(i){if(i.ep)return;i.ep=!0;const o=l(i);fetch(i.href,o)}})();function fe(){}function xt(t,e){for(const l in e)t[l]=e[l];return t}function lc(t){return t()}function La(){return Object.create(null)}function ze(t){t.forEach(lc)}function co(t){return typeof t=="function"}function Ne(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let _s;function Js(t,e){return _s||(_s=document.createElement("a")),_s.href=e,t===_s.href}function t0(t){return Object.keys(t).length===0}function mo(t,...e){if(t==null)return fe;const l=t.subscribe(...e);return l.unsubscribe?()=>l.unsubscribe():l}function ai(t){let e;return mo(t,l=>e=l)(),e}function ul(t,e,l){t.$$.on_destroy.push(mo(e,l))}function po(t,e,l,n){if(t){const i=nc(t,e,l,n);return t[0](i)}}function nc(t,e,l,n){return t[1]&&n?xt(l.ctx.slice(),t[1](n(e))):l.ctx}function _o(t,e,l,n){if(t[2]&&n){const i=t[2](n(l));if(e.dirty===void 0)return i;if(typeof i=="object"){const o=[],a=Math.max(e.dirty.length,i.length);for(let u=0;u32){const e=[],l=t.ctx.length/32;for(let n=0;nt.removeEventListener(e,l,n)}function Ss(t){return function(e){return e.preventDefault(),t.call(this,e)}}function r(t,e,l){l==null?t.removeAttribute(e):t.getAttribute(e)!==l&&t.setAttribute(e,l)}const n0=["width","height"];function ui(t,e){const l=Object.getOwnPropertyDescriptors(t.__proto__);for(const n in e)e[n]==null?t.removeAttribute(n):n==="style"?t.style.cssText=e[n]:n==="__value"?t.value=t[n]=e[n]:l[n]&&l[n].set&&n0.indexOf(n)===-1?t[n]=e[n]:r(t,n,e[n])}function he(t){return t===""?null:+t}function i0(t){return Array.from(t.childNodes)}function Z(t,e){e=""+e,t.data!==e&&(t.data=e)}function s0(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function o0(t,e,l){~l0.indexOf(l)?s0(t,e):Z(t,e)}function te(t,e){t.value=e==null?"":e}function ic(t,e,l,n){l==null?t.style.removeProperty(e):t.style.setProperty(e,l,n?"important":"")}function qe(t,e,l){for(let n=0;n{a.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{o=ee(n.contentWindow,"resize",e),e()}),s(t,n),()=>{(i||o&&n.contentWindow)&&o(),C(n)}}function a0(t,e,{bubbles:l=!1,cancelable:n=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(t,l,n,e),i}function Oa(t,e){return new t(e)}let $i;function Mi(t){$i=t}function Ti(){if(!$i)throw new Error("Function called outside component initialization");return $i}function oc(t){Ti().$$.on_mount.push(t)}function u0(t){Ti().$$.on_destroy.push(t)}function f0(){const t=Ti();return(e,l,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const o=a0(e,l,{cancelable:n});return i.slice().forEach(a=>{a.call(t,o)}),!o.defaultPrevented}return!0}}function Si(t,e){return Ti().$$.context.set(t,e),e}function Bl(t){return Ti().$$.context.get(t)}const ii=[],ws=[];let si=[];const Fa=[],rc=Promise.resolve();let xs=!1;function ac(){xs||(xs=!0,rc.then(uc))}function c0(){return ac(),rc}function Qe(t){si.push(t)}const Vs=new Set;let li=0;function uc(){if(li!==0)return;const t=$i;do{try{for(;lit.indexOf(n)===-1?e.push(n):l.push(n)),l.forEach(n=>n()),si=e}const bs=new Set;let rn;function De(){rn={r:0,c:[],p:rn}}function Ie(){rn.r||ze(rn.c),rn=rn.p}function D(t,e){t&&t.i&&(bs.delete(t),t.i(e))}function q(t,e,l,n){if(t&&t.o){if(bs.has(t))return;bs.add(t),rn.c.push(()=>{bs.delete(t),n&&(l&&t.d(1),n())}),t.o(e)}else n&&n()}function fc(t,e){const l={},n={},i={$$scope:1};let o=t.length;for(;o--;){const a=t[o],u=e[o];if(u){for(const c in a)c in u||(n[c]=1);for(const c in u)i[c]||(l[c]=u[c],i[c]=1);t[o]=u}else for(const c in a)i[c]=1}for(const a in n)a in l||(l[a]=void 0);return l}function qa(t){return typeof t=="object"&&t!==null?t:{}}function ie(t){t&&t.c()}function le(t,e,l,n){const{fragment:i,after_update:o}=t.$$;i&&i.m(e,l),n||Qe(()=>{const a=t.$$.on_mount.map(lc).filter(co);t.$$.on_destroy?t.$$.on_destroy.push(...a):ze(a),t.$$.on_mount=[]}),o.forEach(Qe)}function ne(t,e){const l=t.$$;l.fragment!==null&&(p0(l.after_update),ze(l.on_destroy),l.fragment&&l.fragment.d(e),l.on_destroy=l.fragment=null,l.ctx=[])}function _0(t,e){t.$$.dirty[0]===-1&&(ii.push(t),ac(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const d=v.length?v[0]:b;return f.ctx&&i(f.ctx[p],f.ctx[p]=d)&&(!f.skip_bound&&f.bound[p]&&f.bound[p](d),_&&_0(t,p)),b}):[],f.update(),_=!0,ze(f.before_update),f.fragment=n?n(f.ctx):!1,e.target){if(e.hydrate){const p=i0(e.target);f.fragment&&f.fragment.l(p),p.forEach(C)}else f.fragment&&f.fragment.c();e.intro&&D(t.$$.fragment),le(t,e.target,e.anchor,e.customElement),uc()}Mi(c)}class Ee{$destroy(){ne(this,1),this.$destroy=fe}$on(e,l){if(!co(l))return fe;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(l),()=>{const i=n.indexOf(l);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!t0(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Ba=t=>typeof t>"u",cc=t=>typeof t=="function",mc=t=>typeof t=="number";function d0(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function pc(){let t=0;return()=>t++}function v0(){return Math.random().toString(36).substring(2)}const Ul=typeof window>"u";function _c(t,e,l){return t.addEventListener(e,l),()=>t.removeEventListener(e,l)}const dc=(t,e)=>t?{}:{style:e},eo=t=>({"aria-hidden":"true",...dc(t,"display:none;")}),ni=[];function vc(t,e){return{subscribe:at(t,e).subscribe}}function at(t,e=fe){let l;const n=new Set;function i(u){if(Ne(t,u)&&(t=u,l)){const c=!ni.length;for(const f of n)f[1](),ni.push(f,t);if(c){for(let f=0;f{n.delete(f),n.size===0&&l&&(l(),l=null)}}return{set:i,update:o,subscribe:a}}function h0(t,e,l){const n=!Array.isArray(t),i=n?[t]:t,o=e.length<2;return vc(l,a=>{let u=!1;const c=[];let f=0,_=fe;const p=()=>{if(f)return;_();const v=e(n?c[0]:c,a);o?a(v):_=co(v)?v:fe},b=i.map((v,d)=>mo(v,S=>{c[d]=S,f&=~(1<{f|=1<`@@svnav-ctx__${t}`,to=Ni("LOCATION"),fi=Ni("ROUTER"),hc=Ni("ROUTE"),b0=Ni("ROUTE_PARAMS"),g0=Ni("FOCUS_ELEM"),bc=/^:(.+)/,wi=(t,e,l)=>t.substr(e,l),lo=(t,e)=>wi(t,0,e.length)===e,k0=t=>t==="",w0=t=>bc.test(t),gc=t=>t[0]==="*",y0=t=>t.replace(/\*.*$/,""),kc=t=>t.replace(/(^\/+|\/+$)/g,"");function ml(t,e=!1){const l=kc(t).split("/");return e?l.filter(Boolean):l}const Ks=(t,e)=>t+(e?`?${e}`:""),bo=t=>`/${kc(t)}`;function Ai(...t){const e=n=>ml(n,!0).join("/"),l=t.map(e).join("/");return bo(l)}const go=1,$s=2,mn=3,C0=4,wc=5,M0=6,yc=7,S0=8,$0=9,Cc=10,Mc=11,T0={[go]:"Link",[$s]:"Route",[mn]:"Router",[C0]:"useFocus",[wc]:"useLocation",[M0]:"useMatch",[yc]:"useNavigate",[S0]:"useParams",[$0]:"useResolvable",[Cc]:"useResolve",[Mc]:"navigate"},ko=t=>T0[t];function N0(t,e){let l;return t===$s?l=e.path?`path="${e.path}"`:"default":t===go?l=`to="${e.to}"`:t===mn&&(l=`basepath="${e.basepath||""}"`),`<${ko(t)} ${l||""} />`}function A0(t,e,l,n){const i=l&&N0(n||t,l),o=i?` -Occurred in: ${i}`:"",a=ko(t),u=fc(e)?e(a):e;return`<${a}> ${u}${o}`}const Mc=t=>(...e)=>t(N0(...e)),$c=Mc(t=>{throw new Error(t)}),ys=Mc(console.warn),Ua=4,A0=3,P0=2,E0=1,D0=1;function I0(t,e){const l=t.default?0:ml(t.fullPath).reduce((n,i)=>{let o=n;return o+=Ua,g0(i)?o+=D0:k0(i)?o+=P0:bc(i)?o-=Ua+E0:o+=A0,o},0);return{route:t,score:l,index:e}}function R0(t){return t.map(I0).sort((e,l)=>e.scorel.score?-1:e.index-l.index)}function Sc(t,e){let l,n;const[i]=e.split("?"),o=ml(i),a=o[0]==="",u=R0(t);for(let c=0,f=u.length;c({..._,params:b,uri:$});if(_.default){n=v(e);continue}const d=ml(_.fullPath),S=Math.max(o.length,d.length);let w=0;for(;w{f===".."?c.pop():f!=="."&&c.push(f)}),Ks(`/${c.join("/")}`,n)}function ja(t,e){const{pathname:l,hash:n="",search:i="",state:o}=t,a=ml(e,!0),u=ml(l,!0);for(;a.length;)a[0]!==u[0]&&$c(mn,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),a.shift(),u.shift();return{pathname:Ai(...u),hash:n,search:i,state:o}}const Ha=t=>t.length===1?"":t,wo=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,o=i?Ha(wi(t,l)):"",a=i?wi(t,0,l):t,u=n?Ha(wi(a,e)):"";return{pathname:(n?wi(a,0,e):a)||"/",search:u,hash:o}},O0=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function F0(t,e,l){return Ai(l,L0(t,e))}function q0(t,e){const l=bo(w0(t)),n=ml(l,!0),i=ml(e,!0).slice(0,n.length),o=Tc({fullPath:l},Ai(...i));return o&&o.uri}const Ys="POP",B0="PUSH",U0="REPLACE";function Qs(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function j0(t){let e=[],l=Qs(t),n=Ys;const i=(o=e)=>o.forEach(a=>a({location:l,action:n}));return{get location(){return l},listen(o){e.push(o);const a=()=>{l=Qs(t),n=Ys,i([o])};i([o]);const u=pc(t,"popstate",a);return()=>{u(),e=e.filter(c=>c!==o)}},navigate(o,a){const{state:u={},replace:c=!1}=a||{};if(n=c?U0:B0,cc(o))a&&ys(Cc,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=Ys,t.history.go(o);else{const f={...u,_key:d0()};try{t.history[c?"replaceState":"pushState"](f,"",o)}catch{t.location[c?"replace":"assign"](o)}}l=Qs(t),i()}}}function Xs(t,e){return{...wo(e),state:t}}function H0(t="/"){let e=0,l=[Xs(null,t)];return{get entries(){return l},get location(){return l[e]},addEventListener(){},removeEventListener(){},history:{get state(){return l[e].state},pushState(n,i,o){e++,l=l.slice(0,e),l.push(Xs(n,o))},replaceState(n,i,o){l[e]=Xs(n,o)},go(n){const i=e+n;i<0||i>l.length-1||(e=i)}}}}const W0=!!(!Ul&&window.document&&window.document.createElement),z0=!Ul&&window.location.origin==="null",Nc=j0(W0&&!z0?window:H0()),{navigate:oi}=Nc;let Sl=null,Ac=!0;function G0(t,e){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;nSl.level||t.level===Sl.level&&G0(t.routerId,Sl.routerId))&&(Sl=t)}function K0(){Sl=null}function Y0(){Ac=!1}function Wa(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=pc(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function Q0(t,e){return Number(t.dataset.svnavRouteEnd)===e}function X0(t){return/^H[1-6]$/i.test(t.tagName)}function za(t,e=document){return e.querySelector(t)}function Z0(t){let l=za(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!Q0(l,t);){if(X0(l))return l;const n=za("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function J0(t){Promise.resolve(ai(t.focusElement)).then(e=>{const l=e||Z0(t.id);l||ys(mn,`Could not find an element to focus. You should always render a header for accessibility reasons, or set a custom focus element via the "useFocus" hook. If you don't want this Route or Router to manage focus, pass "primary={false}" to it.`,t,Ss),!Wa(l)&&Wa(document.documentElement)})}const x0=(t,e,l)=>(n,i)=>f0().then(()=>{if(!Sl||Ac){Y0();return}if(n&&J0(Sl.route),t.announcements&&i){const{path:o,fullPath:a,meta:u,params:c,uri:f}=Sl.route,_=t.createAnnouncement({path:o,fullPath:a,meta:u,params:c,uri:f},ai(l));Promise.resolve(_).then(p=>{e.set(p)})}K0()}),e1="position:fixed;top:-1px;left:0;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;";function t1(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},_c(t[6],e1)],i={};for(let o=0;o`Navigated to ${ue.uri}`,announcements:!0,...d},$=_,N=bo(_),E=Bl(to),B=Bl(fi),P=!E,L=n1(),O=v&&!(B&&!B.manageFocus),F=at("");ul(t,F,ue=>l(0,u=ue));const x=B?B.disableInlineStyles:S,j=at([]);ul(t,j,ue=>l(20,a=ue));const z=at(null);ul(t,z,ue=>l(18,i=ue));let G=!1;const V=P?0:B.level+1,U=P?at((()=>ja(Ul?wo(p):b.location,N))()):E;ul(t,U,ue=>l(17,n=ue));const K=at(n);ul(t,K,ue=>l(19,o=ue));const H=x0(w,F,U),Y=ue=>ke=>ke.filter(me=>me.id!==ue);function Z(ue){if(Ul){if(G)return;const ke=Tc(ue,n.pathname);if(ke)return G=!0,ke}else j.update(ke=>{const me=Y(ue.id)(ke);return me.push(ue),me})}function re(ue){j.update(Y(ue))}return!P&&_!==Ga&&ys(mn,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:_}),P&&(sc(()=>b.listen(ke=>{const me=ja(ke.location,N);K.set(n),U.set(me)})),$i(to,U)),$i(fi,{activeRoute:z,registerRoute:Z,unregisterRoute:re,manageFocus:O,level:V,id:L,history:P?b:B.history,basepath:P?N:B.basepath,disableInlineStyles:x}),t.$$set=ue=>{"basepath"in ue&&l(11,_=ue.basepath),"url"in ue&&l(12,p=ue.url),"history"in ue&&l(13,b=ue.history),"primary"in ue&&l(14,v=ue.primary),"a11y"in ue&&l(15,d=ue.a11y),"disableInlineStyles"in ue&&l(16,S=ue.disableInlineStyles),"$$scope"in ue&&l(21,f=ue.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&_!==$&&ys(mn,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const ue=Sc(a,n.pathname);z.set(ue)}if(t.$$.dirty[0]&655360&&P){const ue=!!n.hash,ke=!ue&&O,me=!ue||n.pathname!==o.pathname;H(ke,me)}t.$$.dirty[0]&262144&&O&&i&&i.primary&&V0({level:V,routerId:L,route:i})},[u,w,P,L,O,F,x,j,z,U,K,_,p,b,v,d,S,n,i,o,a,f,c]}class s1 extends Ee{constructor(e){super(),Pe(this,e,i1,l1,Ne,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}const Pc=s1;function Pi(t,e,l=fi,n=mn){Bl(l)||$c(t,o=>`You cannot use ${o} outside of a ${ko(n)}.`,e)}const o1=t=>{const{subscribe:e}=Bl(t);return{subscribe:e}};function Ec(){return Pi(kc),o1(to)}function Dc(){const{history:t}=Bl(fi);return t}function Ic(){const t=Bl(vc);return t?v0(t,e=>e.base):at("/")}function Rc(){Pi(yc);const t=Ic(),{basepath:e}=Bl(fi);return n=>F0(n,ai(t),e)}function r1(){Pi(wc);const t=Rc(),{navigate:e}=Dc();return(n,i)=>{const o=cc(n)?n:t(n);return e(o,i)}}const a1=t=>({params:t&16,location:t&8}),Va=t=>({params:Ul?ai(t[10]):t[4],location:t[3],navigate:t[11]});function Ka(t){let e,l;return e=new Pc({props:{primary:t[1],$$slots:{default:[c1]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.primary=n[1]),i&528409&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function u1(t){let e;const l=t[18].default,n=po(l,t,t[19],Va);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&524312)&&vo(n,l,i,i[19],e?_o(l,i[19],o,a1):ho(i[19]),Va)},i(i){e||(D(n,i),e=!0)},o(i){q(n,i),e=!1},d(i){n&&n.d(i)}}}function f1(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},Ul?ai(t[10]):t[4],t[12]];var o=t[0];function a(u){let c={};for(let f=0;f{ne(_,1)}),Ie()}o?(e=Oa(o,a()),ie(e.$$.fragment),D(e.$$.fragment,1),le(e,l.parentNode,l)):e=null}else o&&e.$set(f)},i(u){n||(e&&D(e.$$.fragment,u),n=!0)},o(u){e&&q(e.$$.fragment,u),n=!1},d(u){u&&C(l),e&&ne(e,u)}}}function c1(t){let e,l,n,i;const o=[f1,u1],a=[];function u(c,f){return c[0]!==null?0:1}return e=u(t),l=a[e]=o[e](t),{c(){l.c(),n=Ve()},m(c,f){a[e].m(c,f),M(c,n,f),i=!0},p(c,f){let _=e;e=u(c),e===_?a[e].p(c,f):(De(),q(a[_],1,1,()=>{a[_]=null}),Ie(),l=a[e],l?l.p(c,f):(l=a[e]=o[e](c),l.c()),D(l,1),l.m(n.parentNode,n))},i(c){i||(D(l),i=!0)},o(c){q(l),i=!1},d(c){a[e].d(c),c&&C(n)}}}function m1(t){let e,l,n,i,o,a=[eo(t[7]),{"data-svnav-route-start":t[5]}],u={};for(let p=0;p{c=null}),Ie())},i(p){o||(D(c),o=!0)},o(p){q(c),o=!1},d(p){p&&C(e),p&&C(l),c&&c.d(p),p&&C(n),p&&C(i)}}}const p1=mc();function _1(t,e,l){let n;const i=["path","component","meta","primary"];let o=ks(e,i),a,u,c,f,{$$slots:_={},$$scope:p}=e,{path:b=""}=e,{component:v=null}=e,{meta:d={}}=e,{primary:S=!0}=e;Pi(Ss,e);const w=p1(),{registerRoute:$,unregisterRoute:N,activeRoute:E,disableInlineStyles:B}=Bl(fi);ul(t,E,G=>l(16,a=G));const P=Ic();ul(t,P,G=>l(17,c=G));const L=Ec();ul(t,L,G=>l(3,u=G));const O=at(null);let F;const x=at(),j=at({});ul(t,j,G=>l(4,f=G)),$i(vc,x),$i(h0,j),$i(b0,O);const z=r1();return Ul||a0(()=>N(w)),t.$$set=G=>{l(24,e=xt(xt({},e),gs(G))),l(12,o=ks(e,i)),"path"in G&&l(13,b=G.path),"component"in G&&l(0,v=G.component),"meta"in G&&l(14,d=G.meta),"primary"in G&&l(1,S=G.primary),"$$scope"in G&&l(19,p=G.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const G=b==="",V=Ai(c,b),W={id:w,path:b,meta:d,default:G,fullPath:G?"":V,base:G?c:q0(V,u.pathname),primary:S,focusElement:O};x.set(W),l(15,F=$(W))}if(t.$$.dirty&98304&&l(2,n=!!(F||a&&a.id===w)),t.$$.dirty&98308&&n){const{params:G}=F||a;j.set(G)}},e=gs(e),[v,S,n,u,f,w,E,B,P,L,j,z,o,b,d,F,a,c,_,p]}class d1 extends Ee{constructor(e){super(),Pe(this,e,_1,m1,Ne,{path:13,component:0,meta:14,primary:1})}}const $l=d1;function v1(t){let e,l,n,i;const o=t[13].default,a=po(o,t,t[12],null);let u=[{href:t[0]},t[2],t[1]],c={};for(let f=0;fl(11,p=O));const E=u0(),B=Rc(),{navigate:P}=Dc();function L(O){E("click",O),_0(O)&&(O.preventDefault(),P(n,{state:w,replace:a||S}))}return t.$$set=O=>{l(19,e=xt(xt({},e),gs(O))),l(18,_=ks(e,f)),"to"in O&&l(5,d=O.to),"replace"in O&&l(6,S=O.replace),"state"in O&&l(7,w=O.state),"getProps"in O&&l(8,$=O.getProps),"$$scope"in O&&l(12,v=O.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=B(d,p)),t.$$.dirty&2049&&l(10,i=lo(p.pathname,n)),t.$$.dirty&2049&&l(9,o=n===p.pathname),t.$$.dirty&2049&&(a=wo(n)===O0(p)),t.$$.dirty&512&&l(2,u=o?{"aria-current":"page"}:{}),l(1,c=(()=>{if(fc($)){const O=$({location:p,href:n,isPartiallyCurrent:i,isCurrent:o});return{..._,...O}}return _})())},e=gs(e),[n,c,u,N,L,d,S,w,$,o,i,p,v,b]}class b1 extends Ee{constructor(e){super(),Pe(this,e,h1,v1,Ne,{to:5,replace:6,state:7,getProps:8})}}const el=b1;let no=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function ql(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function g1(t){return t>218&&t<242?"#32d900":t>212&&t<248?"#b1d900":t>208&&t<252?"#ffb800":"#d90000"}function Lc(t,e){let l;return t>90?l="#d90000":t>85?l="#e32100":t>80?l="#ffb800":t>75?l="#dcd800":l="#32d900",l+(e?"88":"")}function k1(t){return t>75?"#32d900":t>50?"#77d900":t>25?"#94d900":"#dcd800"}function Cs(t){switch(t){case 1:return"Aidon";case 2:return"Kaifa";case 3:return"Kamstrup";case 8:return"Iskra";case 9:return"Landis+Gyr";case 10:return"Sagemcom";default:return"Unknown"}}function Oe(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function be(t,e){switch(e){case 5:switch(t){case"esp8266":return"Pow-K (GPIO12)";case"esp32s2":return"Pow-K+"}case 7:switch(t){case"esp8266":return"Pow-U (GPIO12)";case"esp32s2":return"Pow-U+"}case 6:return"Pow-P1";case 51:return"Wemos S2 mini";case 50:return"Generic ESP32-S2";case 201:return"Wemos LOLIN D32";case 202:return"Adafruit HUZZAH32";case 203:return"DevKitC";case 200:return"Generic ESP32";case 2:return"HAN Reader 2.0 by Max Spencer";case 0:return"Custom hardware by Roar Fredriksen";case 1:return"Kamstrup module by Egil Opsahl";case 8:return"\xB5HAN mosquito by dbeinder";case 3:return"Pow-K (UART0)";case 4:return"Pow-U (UART0)";case 101:return"Wemos D1 mini";case 100:return"Generic ESP8266";case 70:return"Generic ESP32-C3";case 71:return"ESP32-C3-DevKitM-1"}}function Ya(t){switch(t){case-1:return"Parse error";case-2:return"Incomplete data received";case-3:return"Payload boundry flag missing";case-4:return"Header checksum error";case-5:return"Footer checksum error";case-9:return"Unknown data received, check meter config";case-41:return"Frame length not equal";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid";case 90:return"No HAN data received for at least 30s";case 91:return"Serial break";case 92:return"Serial buffer full";case 93:return"Serial FIFO overflow";case 94:return"Serial frame error";case 95:return"Serial parity error";case 96:return"RX error";case 98:return"Exception in code, debugging necessary";case 99:return"Autodetection failed"}return t<0?"Unspecified error "+t:""}function Qa(t){switch(t){case-3:return"Connection failed";case-4:return"Network timeout";case-10:return"Connection denied";case-11:return"Failed to subscribe";case-13:return"Connection lost"}return t<0?"Unspecified error "+t:""}function Xa(t){switch(t){case 400:return"Unrecognized data in request";case 401:case 403:return"Unauthorized, check API key";case 404:return"Price unavailable, not found";case 425:return"Server says its too early";case 429:return"Exceeded API rate limit";case 500:return"Internal server error";case-1:return"Connection error";case-2:return"Incomplete data received";case-3:return"Invalid data, tag missing";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid"}return t<0?"Unspecified error "+t:""}function ri(t){switch(t){case 2:case 4:case 7:return!0}return!1}function Ke(t,e){return t==1||t==2&&e}function Ut(t){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+t}function ge(t,e){return isNaN(t)?"-":(isNaN(e)&&(e=t<10?1:0),t.toFixed(e))}function fl(t,e){return t.setTime(t.getTime()+e*36e5),t}function Za(t){if(t.chip=="esp8266")switch(t.boot_reason){case 0:return"Normal";case 1:return"WDT reset";case 2:return"Exception reset";case 3:return"Soft WDT reset";case 4:return"Software restart";case 5:return"Deep sleep";case 6:return"External reset";default:return"Unknown (8266)"}else switch(t.boot_reason){case 1:return"Vbat power on reset";case 3:return"Software reset";case 4:return"WDT reset";case 5:return"Deep sleep";case 6:return"SLC reset";case 7:return"Timer Group0 WDT reset";case 8:return"Timer Group1 WDT reset";case 9:return"RTC WDT reset";case 10:return"Instrusion test reset CPU";case 11:return"Time Group reset CPU";case 12:return"Software reset CPU";case 13:return"RTC WTD reset CPU";case 14:return"PRO CPU";case 15:return"Brownout";case 16:return"RTC reset";default:return"Unknown"}}function Ja(t){return t=="EOE"?"ENTSO-E":t=="HKS"?"hvakosterstrommen.no":t=="EDS"?"Energy Data Service":t=="MIX"?"Mixed sources":"Unknown ("+t+")"}async function jl(t,e={}){const{timeout:l=8e3}=e,n=new AbortController,i=setTimeout(()=>n.abort(),l),o=await fetch(t,{...e,signal:n.signal});return clearTimeout(i),o}let al={version:"",chip:"",mac:null,apmac:null,vndcfg:null,usrcfg:null,fwconsent:null,booting:!1,upgrading:!1,ui:{},security:0,boot_reason:0,upgrade:{x:-1,e:0,f:null,t:null},trying:null};const jt=at(al);async function yo(){al=await(await jl("/sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),jt.set(al)}let vs=0,xa=-127,eu=null,w1={};const y1=dc(w1,t=>{let e;async function l(){jl("/data.json").then(n=>n.json()).then(n=>{t(n),xa!=n.t&&(xa=n.t,setTimeout(Uc,2e3)),eu==null&&n.pe&&n.p!=null&&(eu=n.p,Fc()),al.upgrading?window.location.reload():(!al||!al.chip||al.booting||vs>1&&!ri(al.board))&&(yo(),an&&clearTimeout(an),an=setTimeout(Mo,2e3),un&&clearTimeout(un),un=setTimeout($o,3e3));let i=5e3;if(ri(al.board)&&n.v>2.5){let o=3.3-Math.min(3.3,n.v);o>0&&(i=Math.max(o,.1)*10*5e3)}i>5e3&&console.log("Scheduling next data fetch in "+i+"ms"),e&&clearTimeout(e),e=setTimeout(l,i),vs=0}).catch(n=>{vs++,vs>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(l,15e3)):e=setTimeout(l,ri(al.board)?1e4:5e3)})}return l(),function(){clearTimeout(e)}});let io={},yi;const Co=at(io);async function Oc(){let t=!1;if(Co.update(e=>{for(var l=0;l<36;l++){if(e[Oe(l)]==null){t=l<12;break}e[Oe(l)]=e[Oe(l+1)]}return e}),t)Fc();else{let e=new Date;yi=setTimeout(Oc,(60-e.getMinutes())*6e4)}}async function Fc(){yi&&(clearTimeout(yi),yi=0),io=await(await jl("/energyprice.json")).json(),Co.set(io);let e=new Date;yi=setTimeout(Oc,(60-e.getMinutes())*6e4)}let so={},an;async function Mo(){an&&(clearTimeout(an),an=0),so=await(await jl("/dayplot.json")).json(),qc.set(so);let e=new Date;an=setTimeout(Mo,(60-e.getMinutes())*6e4+20)}const qc=at(so,t=>(Mo(),function(){}));let oo={},un;async function $o(){un&&(clearTimeout(un),un=0),oo=await(await jl("/monthplot.json")).json(),Bc.set(oo);let e=new Date;un=setTimeout($o,(24-e.getHours())*36e5+40)}const Bc=at(oo,t=>($o(),function(){}));let ro={};async function Uc(){ro=await(await jl("/temperature.json")).json(),jc.set(ro)}const jc=at(ro,t=>(Uc(),function(){}));let ao={},hs;async function Hc(){hs&&(clearTimeout(hs),hs=0),ao=await(await jl("/tariff.json")).json(),Wc.set(ao);let e=new Date;hs=setTimeout(Hc,(60-e.getMinutes())*6e4+30)}const Wc=at(ao,t=>function(){});let uo=[];const So=at(uo);async function C1(){uo=await(await jl("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),So.set(uo)}function Ms(t){return"WARNING: "+t+" must be connected to an external power supply during firmware upgrade. Failure to do so may cause power-down during upload resulting in non-functioning unit."}async function zc(t){await(await fetch("/upgrade?expected_version="+t,{method:"POST"})).json()}function Gc(t,e){if(/^v\d{1,2}\.\d{1,2}\.\d{1,2}$/.test(t)){let l=t.substring(1).split("."),n=parseInt(l[0]),i=parseInt(l[1]),o=parseInt(l[2]),a=[...e];a.reverse();let u,c,f;for(let _=0;_o&&(u=p):S==i+1&&(c=p);else if(d==n+1)if(f){let $=f.tag_name.substring(1).split(".");parseInt($[0]);let N=parseInt($[1]);parseInt($[2]),S==N&&(f=p)}else f=p}return c||f||u||!1}else return e[0]}const M1="/github.svg";function tu(t){let e,l;function n(a,u){return a[1]>1?E1:a[1]>0?P1:a[2]>1?A1:a[2]>0?N1:a[3]>1?T1:a[3]>0?S1:$1}let i=n(t),o=i(t);return{c(){e=T(`Up - `),o.c(),l=Ve()},m(a,u){M(a,e,u),o.m(a,u),M(a,l,u)},p(a,u){i===(i=n(a))&&o?o.p(a,u):(o.d(1),o=i(a),o&&(o.c(),o.m(l.parentNode,l)))},d(a){a&&C(e),o.d(a),a&&C(l)}}}function $1(t){let e,l;return{c(){e=T(t[0]),l=T(" seconds")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&1&&X(e,n[0])},d(n){n&&C(e),n&&C(l)}}}function S1(t){let e,l;return{c(){e=T(t[3]),l=T(" minute")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&8&&X(e,n[3])},d(n){n&&C(e),n&&C(l)}}}function T1(t){let e,l;return{c(){e=T(t[3]),l=T(" minutes")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&8&&X(e,n[3])},d(n){n&&C(e),n&&C(l)}}}function N1(t){let e,l;return{c(){e=T(t[2]),l=T(" hour")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&4&&X(e,n[2])},d(n){n&&C(e),n&&C(l)}}}function A1(t){let e,l;return{c(){e=T(t[2]),l=T(" hours")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&4&&X(e,n[2])},d(n){n&&C(e),n&&C(l)}}}function P1(t){let e,l;return{c(){e=T(t[1]),l=T(" day")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&2&&X(e,n[1])},d(n){n&&C(e),n&&C(l)}}}function E1(t){let e,l;return{c(){e=T(t[1]),l=T(" days")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&2&&X(e,n[1])},d(n){n&&C(e),n&&C(l)}}}function D1(t){let e,l=t[0]&&tu(t);return{c(){l&&l.c(),e=Ve()},m(n,i){l&&l.m(n,i),M(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=tu(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:fe,o:fe,d(n){l&&l.d(n),n&&C(e)}}}function I1(t,e,l){let{epoch:n}=e,i=0,o=0,a=0;return t.$$set=u=>{"epoch"in u&&l(0,n=u.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(l(1,i=Math.floor(n/86400)),l(2,o=Math.floor(n/3600)),l(3,a=Math.floor(n/60)))},[n,i,o,a]}class R1 extends Ee{constructor(e){super(),Pe(this,e,I1,D1,Ne,{epoch:0})}}function L1(t){let e,l,n;return{c(){e=m("span"),l=T(t[2]),r(e,"title",t[1]),r(e,"class",n="bd-"+t[0])},m(i,o){M(i,e,o),s(e,l)},p(i,[o]){o&4&&X(l,i[2]),o&2&&r(e,"title",i[1]),o&1&&n!==(n="bd-"+i[0])&&r(e,"class",n)},i:fe,o:fe,d(i){i&&C(e)}}}function O1(t,e,l){let{color:n}=e,{title:i}=e,{text:o}=e;return t.$$set=a=>{"color"in a&&l(0,n=a.color),"title"in a&&l(1,i=a.title),"text"in a&&l(2,o=a.text)},[n,i,o]}class fn extends Ee{constructor(e){super(),Pe(this,e,O1,L1,Ne,{color:0,title:1,text:2})}}function F1(t){let e,l=`${Oe(t[0].getDate())}.${Oe(t[0].getMonth()+1)}.${t[0].getFullYear()} ${Oe(t[0].getHours())}:${Oe(t[0].getMinutes())}`,n;return{c(){e=m("span"),n=T(l),r(e,"class",t[1])},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=`${Oe(i[0].getDate())}.${Oe(i[0].getMonth()+1)}.${i[0].getFullYear()} ${Oe(i[0].getHours())}:${Oe(i[0].getMinutes())}`)&&X(n,l),o&2&&r(e,"class",i[1])},d(i){i&&C(e)}}}function q1(t){let e=`${Oe(t[0].getDate())}. ${no[t[0].getMonth()]} ${Oe(t[0].getHours())}:${Oe(t[0].getMinutes())}`,l;return{c(){l=T(e)},m(n,i){M(n,l,i)},p(n,i){i&1&&e!==(e=`${Oe(n[0].getDate())}. ${no[n[0].getMonth()]} ${Oe(n[0].getHours())}:${Oe(n[0].getMinutes())}`)&&X(l,e)},d(n){n&&C(l)}}}function B1(t){let e;function l(o,a){return o[2]?q1:F1}let n=l(t),i=n(t);return{c(){i.c(),e=Ve()},m(o,a){i.m(o,a),M(o,e,a)},p(o,[a]){n===(n=l(o))&&i?i.p(o,a):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},i:fe,o:fe,d(o){i.d(o),o&&C(e)}}}function U1(t,e,l){let{timestamp:n}=e,{fullTimeColor:i}=e,{offset:o}=e,a;return t.$$set=u=>{"timestamp"in u&&l(0,n=u.timestamp),"fullTimeColor"in u&&l(1,i=u.fullTimeColor),"offset"in u&&l(3,o=u.offset)},t.$$.update=()=>{t.$$.dirty&9&&(l(2,a=Math.abs(new Date().getTime()-n.getTime())<3e5),isNaN(o)||fl(n,o-(24+n.getHours()-n.getUTCHours())%24))},[n,i,a,o]}class Vc extends Ee{constructor(e){super(),Pe(this,e,U1,B1,Ne,{timestamp:0,fullTimeColor:1,offset:3})}}function j1(t){let e,l,n;return{c(){e=Fe("svg"),l=Fe("path"),n=Fe("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 011.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 01-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.397.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 01-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.505-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.107-1.204l-.527-.738a1.125 1.125 0 01.12-1.45l.773-.773a1.125 1.125 0 011.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894z"),r(n,"stroke-linecap","round"),r(n,"stroke-linejoin","round"),r(n,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(i,o){M(i,e,o),s(e,l),s(e,n)},p:fe,i:fe,o:fe,d(i){i&&C(e)}}}class H1 extends Ee{constructor(e){super(),Pe(this,e,null,j1,Ne,{})}}function W1(t){let e,l;return{c(){e=Fe("svg"),l=Fe("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(n,i){M(n,e,i),s(e,l)},p:fe,i:fe,o:fe,d(n){n&&C(e)}}}class z1 extends Ee{constructor(e){super(),Pe(this,e,null,W1,Ne,{})}}function G1(t){let e,l;return{c(){e=Fe("svg"),l=Fe("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(n,i){M(n,e,i),s(e,l)},p:fe,i:fe,o:fe,d(n){n&&C(e)}}}class Bt extends Ee{constructor(e){super(),Pe(this,e,null,G1,Ne,{})}}function V1(t){let e,l;return{c(){e=Fe("svg"),l=Fe("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M9 8.25H7.5a2.25 2.25 0 00-2.25 2.25v9a2.25 2.25 0 002.25 2.25h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25H15M9 12l3 3m0 0l3-3m-3 3V2.25"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(n,i){M(n,e,i),s(e,l)},p:fe,i:fe,o:fe,d(n){n&&C(e)}}}class Kc extends Ee{constructor(e){super(),Pe(this,e,null,V1,Ne,{})}}function K1(t){let e,l,n=t[1].version+"",i;return{c(){e=T("AMS reader "),l=m("span"),i=T(n)},m(o,a){M(o,e,a),M(o,l,a),s(l,i)},p(o,a){a&2&&n!==(n=o[1].version+"")&&X(i,n)},d(o){o&&C(e),o&&C(l)}}}function lu(t){let e,l=(t[0].t>-50?t[0].t.toFixed(1):"-")+"",n,i;return{c(){e=m("div"),n=T(l),i=T("\xB0C"),r(e,"class","flex-none my-auto")},m(o,a){M(o,e,a),s(e,n),s(e,i)},p(o,a){a&1&&l!==(l=(o[0].t>-50?o[0].t.toFixed(1):"-")+"")&&X(n,l)},d(o){o&&C(e)}}}function nu(t){let e,l="HAN: "+Ya(t[0].he),n;return{c(){e=m("div"),n=T(l),r(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="HAN: "+Ya(i[0].he))&&X(n,l)},d(i){i&&C(e)}}}function iu(t){let e,l="MQTT: "+Qa(t[0].me),n;return{c(){e=m("div"),n=T(l),r(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="MQTT: "+Qa(i[0].me))&&X(n,l)},d(i){i&&C(e)}}}function su(t){let e,l="PriceAPI: "+Xa(t[0].ee),n;return{c(){e=m("div"),n=T(l),r(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="PriceAPI: "+Xa(i[0].ee))&&X(n,l)},d(i){i&&C(e)}}}function ou(t){let e,l,n,i,o,a;return l=new el({props:{to:"/configuration",$$slots:{default:[Y1]},$$scope:{ctx:t}}}),o=new el({props:{to:"/status",$$slots:{default:[Q1]},$$scope:{ctx:t}}}),{c(){e=m("div"),ie(l.$$.fragment),n=h(),i=m("div"),ie(o.$$.fragment),r(e,"class","flex-none px-1 mt-1"),r(e,"title","Configuration"),r(i,"class","flex-none px-1 mt-1"),r(i,"title","Device information")},m(u,c){M(u,e,c),le(l,e,null),M(u,n,c),M(u,i,c),le(o,i,null),a=!0},i(u){a||(D(l.$$.fragment,u),D(o.$$.fragment,u),a=!0)},o(u){q(l.$$.fragment,u),q(o.$$.fragment,u),a=!1},d(u){u&&C(e),ne(l),u&&C(n),u&&C(i),ne(o)}}}function Y1(t){let e,l;return e=new H1({}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function Q1(t){let e,l;return e=new z1({}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function ru(t){let e,l,n,i,o;const a=[Z1,X1],u=[];function c(f,_){return f[1].security==0||f[0].a?0:1}return l=c(t),n=u[l]=a[l](t),{c(){e=m("div"),n.c(),r(e,"class","flex-none mr-3 text-yellow-500"),r(e,"title",i="New version: "+t[2].tag_name)},m(f,_){M(f,e,_),u[l].m(e,null),o=!0},p(f,_){let p=l;l=c(f),l===p?u[l].p(f,_):(De(),q(u[p],1,1,()=>{u[p]=null}),Ie(),n=u[l],n?n.p(f,_):(n=u[l]=a[l](f),n.c()),D(n,1),n.m(e,null)),(!o||_&4&&i!==(i="New version: "+f[2].tag_name))&&r(e,"title",i)},i(f){o||(D(n),o=!0)},o(f){q(n),o=!1},d(f){f&&C(e),u[l].d()}}}function X1(t){let e,l,n=t[2].tag_name+"",i;return{c(){e=m("span"),l=T("New version: "),i=T(n)},m(o,a){M(o,e,a),s(e,l),s(e,i)},p(o,a){a&4&&n!==(n=o[2].tag_name+"")&&X(i,n)},i:fe,o:fe,d(o){o&&C(e)}}}function Z1(t){let e,l,n,i=t[2].tag_name+"",o,a,u,c,f,_;return u=new Kc({}),{c(){e=m("button"),l=m("span"),n=T("New version: "),o=T(i),a=h(),ie(u.$$.fragment),r(l,"class","mt-1"),r(e,"class","flex")},m(p,b){M(p,e,b),s(e,l),s(l,n),s(l,o),s(e,a),le(u,e,null),c=!0,f||(_=ee(e,"click",t[3]),f=!0)},p(p,b){(!c||b&4)&&i!==(i=p[2].tag_name+"")&&X(o,i)},i(p){c||(D(u.$$.fragment,p),c=!0)},o(p){q(u.$$.fragment,p),c=!1},d(p){p&&C(e),ne(u),f=!1,_()}}}function J1(t){let e,l,n,i,o,a,u,c,f,_,p,b,v=(t[0].m?(t[0].m/1e3).toFixed(1):"-")+"",d,S,w,$,N,E,B,P,L,O,F,x,j,z,G,V,W,U,K,H,Y,Z,re,ue,ke,me,Se,je,Re,He;i=new el({props:{to:"/",$$slots:{default:[K1]},$$scope:{ctx:t}}}),c=new R1({props:{epoch:t[0].u}});let we=t[0].t>-50&&lu(t);N=new fn({props:{title:"ESP",text:t[1].booting?"Booting":t[0].v>2?t[0].v.toFixed(2)+"V":"ESP",color:ql(t[1].booting?2:t[0].em)}}),B=new fn({props:{title:"HAN",text:"HAN",color:ql(t[1].booting?9:t[0].hm)}}),L=new fn({props:{title:"WiFi",text:t[0].r?t[0].r.toFixed(0)+"dBm":"WiFi",color:ql(t[1].booting?9:t[0].wm)}}),F=new fn({props:{title:"MQTT",text:"MQTT",color:ql(t[1].booting?9:t[0].mm)}});let Te=(t[0].he<0||t[0].he>0)&&nu(t),Le=t[0].me<0&&iu(t),Me=(t[0].ee>0||t[0].ee<0)&&su(t);re=new Vc({props:{timestamp:t[0].c?new Date(t[0].c*1e3):new Date(0),offset:t[1].clock_offset,fullTimeColor:"text-red-500"}});let y=t[1].vndcfg&&t[1].usrcfg&&ou(t);je=new Bt({});let g=t[1].fwconsent===1&&t[2]&&ru(t);return{c(){e=m("nav"),l=m("div"),n=m("div"),ie(i.$$.fragment),o=h(),a=m("div"),u=m("div"),ie(c.$$.fragment),f=h(),we&&we.c(),_=h(),p=m("div"),b=T("Free mem: "),d=T(v),S=T("kb"),w=h(),$=m("div"),ie(N.$$.fragment),E=h(),ie(B.$$.fragment),P=h(),ie(L.$$.fragment),O=h(),ie(F.$$.fragment),x=h(),Te&&Te.c(),j=h(),Le&&Le.c(),z=h(),Me&&Me.c(),G=h(),V=m("div"),W=m("div"),U=m("a"),K=m("img"),Y=h(),Z=m("div"),ie(re.$$.fragment),ue=h(),y&&y.c(),ke=h(),me=m("div"),Se=m("a"),ie(je.$$.fragment),Re=h(),g&&g.c(),r(n,"class","flex text-lg text-gray-100 p-2"),r(u,"class","flex-none my-auto"),r(p,"class","flex-none my-auto"),r(a,"class","flex-none my-auto p-2 flex space-x-4"),r($,"class","flex-auto flex-wrap my-auto justify-center p-2"),r(K,"class","gh-logo"),Js(K.src,H=M1)||r(K,"src",H),r(K,"alt","GitHub repo"),r(U,"class","float-right"),r(U,"href","https://github.com/UtilitechAS/amsreader-firmware"),r(U,"target","_blank"),r(U,"rel","noreferrer"),r(U,"aria-label","GitHub"),r(W,"class","flex-none"),r(Z,"class","flex-none my-auto px-2"),r(Se,"href",Ut("")),r(Se,"target","_blank"),r(Se,"rel","noreferrer"),r(me,"class","flex-none px-1 mt-1"),r(me,"title","Documentation"),r(V,"class","flex-auto p-2 flex flex-row-reverse flex-wrap"),r(l,"class","flex flex-wrap space-x-4 text-sm text-gray-300"),r(e,"class","bg-violet-600 p-1 rounded-md mx-2")},m(k,A){M(k,e,A),s(e,l),s(l,n),le(i,n,null),s(l,o),s(l,a),s(a,u),le(c,u,null),s(a,f),we&&we.m(a,null),s(a,_),s(a,p),s(p,b),s(p,d),s(p,S),s(l,w),s(l,$),le(N,$,null),s($,E),le(B,$,null),s($,P),le(L,$,null),s($,O),le(F,$,null),s(l,x),Te&&Te.m(l,null),s(l,j),Le&&Le.m(l,null),s(l,z),Me&&Me.m(l,null),s(l,G),s(l,V),s(V,W),s(W,U),s(U,K),s(V,Y),s(V,Z),le(re,Z,null),s(V,ue),y&&y.m(V,null),s(V,ke),s(V,me),s(me,Se),le(je,Se,null),s(V,Re),g&&g.m(V,null),He=!0},p(k,[A]){const I={};A&18&&(I.$$scope={dirty:A,ctx:k}),i.$set(I);const Q={};A&1&&(Q.epoch=k[0].u),c.$set(Q),k[0].t>-50?we?we.p(k,A):(we=lu(k),we.c(),we.m(a,_)):we&&(we.d(1),we=null),(!He||A&1)&&v!==(v=(k[0].m?(k[0].m/1e3).toFixed(1):"-")+"")&&X(d,v);const J={};A&3&&(J.text=k[1].booting?"Booting":k[0].v>2?k[0].v.toFixed(2)+"V":"ESP"),A&3&&(J.color=ql(k[1].booting?2:k[0].em)),N.$set(J);const se={};A&3&&(se.color=ql(k[1].booting?9:k[0].hm)),B.$set(se);const ce={};A&1&&(ce.text=k[0].r?k[0].r.toFixed(0)+"dBm":"WiFi"),A&3&&(ce.color=ql(k[1].booting?9:k[0].wm)),L.$set(ce);const ve={};A&3&&(ve.color=ql(k[1].booting?9:k[0].mm)),F.$set(ve),k[0].he<0||k[0].he>0?Te?Te.p(k,A):(Te=nu(k),Te.c(),Te.m(l,j)):Te&&(Te.d(1),Te=null),k[0].me<0?Le?Le.p(k,A):(Le=iu(k),Le.c(),Le.m(l,z)):Le&&(Le.d(1),Le=null),k[0].ee>0||k[0].ee<0?Me?Me.p(k,A):(Me=su(k),Me.c(),Me.m(l,G)):Me&&(Me.d(1),Me=null);const $e={};A&1&&($e.timestamp=k[0].c?new Date(k[0].c*1e3):new Date(0)),A&2&&($e.offset=k[1].clock_offset),re.$set($e),k[1].vndcfg&&k[1].usrcfg?y?A&2&&D(y,1):(y=ou(k),y.c(),D(y,1),y.m(V,ke)):y&&(De(),q(y,1,1,()=>{y=null}),Ie()),k[1].fwconsent===1&&k[2]?g?(g.p(k,A),A&6&&D(g,1)):(g=ru(k),g.c(),D(g,1),g.m(V,null)):g&&(De(),q(g,1,1,()=>{g=null}),Ie())},i(k){He||(D(i.$$.fragment,k),D(c.$$.fragment,k),D(N.$$.fragment,k),D(B.$$.fragment,k),D(L.$$.fragment,k),D(F.$$.fragment,k),D(re.$$.fragment,k),D(y),D(je.$$.fragment,k),D(g),He=!0)},o(k){q(i.$$.fragment,k),q(c.$$.fragment,k),q(N.$$.fragment,k),q(B.$$.fragment,k),q(L.$$.fragment,k),q(F.$$.fragment,k),q(re.$$.fragment,k),q(y),q(je.$$.fragment,k),q(g),He=!1},d(k){k&&C(e),ne(i),ne(c),we&&we.d(),ne(N),ne(B),ne(L),ne(F),Te&&Te.d(),Le&&Le.d(),Me&&Me.d(),ne(re),y&&y.d(),ne(je),g&&g.d()}}}function x1(t,e,l){let{data:n={}}=e,i={},o={};function a(){confirm("Do you want to upgrade this device to "+o.tag_name+"?")&&(!ri(i.board)||confirm(Ms(be(i.chip,i.board))))&&(jt.update(u=>(u.upgrading=!0,u)),zc(o.tag_name))}return jt.subscribe(u=>{l(1,i=u),u.fwconsent===1&&C1()}),So.subscribe(u=>{l(2,o=Gc(i.version,u))}),t.$$set=u=>{"data"in u&&l(0,n=u.data)},[n,i,o,a]}class em extends Ee{constructor(e){super(),Pe(this,e,x1,J1,Ne,{data:0})}}function tm(t){let e,l,n,i;return{c(){e=Fe("svg"),l=Fe("path"),n=Fe("path"),r(l,"d",Zs(150,150,115,210,510)),r(l,"stroke","#eee"),r(l,"fill","none"),r(l,"stroke-width","55"),r(n,"d",i=Zs(150,150,115,210,210+300*t[0]/100)),r(n,"stroke",t[1]),r(n,"fill","none"),r(n,"stroke-width","55"),r(e,"viewBox","0 0 300 300"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"height","100%")},m(o,a){M(o,e,a),s(e,l),s(e,n)},p(o,[a]){a&1&&i!==(i=Zs(150,150,115,210,210+300*o[0]/100))&&r(n,"d",i),a&2&&r(n,"stroke",o[1])},i:fe,o:fe,d(o){o&&C(e)}}}function au(t,e,l,n){var i=(n-90)*Math.PI/180;return{x:t+l*Math.cos(i),y:e+l*Math.sin(i)}}function Zs(t,e,l,n,i){var o=au(t,e,l,i),a=au(t,e,l,n),u=i-n<=180?"0":"1",c=["M",o.x,o.y,"A",l,l,0,u,0,a.x,a.y].join(" ");return c}function lm(t,e,l){let{pct:n=0}=e,{color:i="red"}=e;return t.$$set=o=>{"pct"in o&&l(0,n=o.pct),"color"in o&&l(1,i=o.color)},[n,i]}class nm extends Ee{constructor(e){super(),Pe(this,e,lm,tm,Ne,{pct:0,color:1})}}function uu(t){let e,l,n,i,o,a,u,c;return{c(){e=m("br"),l=h(),n=m("span"),i=T(t[3]),o=h(),a=m("span"),u=T(t[4]),c=T("/kWh"),r(n,"class","pl-sub"),r(a,"class","pl-snt")},m(f,_){M(f,e,_),M(f,l,_),M(f,n,_),s(n,i),M(f,o,_),M(f,a,_),s(a,u),s(a,c)},p(f,_){_&8&&X(i,f[3]),_&16&&X(u,f[4])},d(f){f&&C(e),f&&C(l),f&&C(n),f&&C(o),f&&C(a)}}}function im(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,w;l=new nm({props:{pct:t[6],color:t[5](t[6])}});let $=t[3]&&uu(t);return{c(){e=m("div"),ie(l.$$.fragment),n=h(),i=m("span"),o=m("span"),a=T(t[2]),u=h(),c=m("br"),f=h(),_=m("span"),p=T(t[0]),b=h(),v=m("span"),d=T(t[1]),S=h(),$&&$.c(),r(o,"class","pl-lab"),r(_,"class","pl-val"),r(v,"class","pl-unt"),r(i,"class","pl-ov"),r(e,"class","pl-root")},m(N,E){M(N,e,E),le(l,e,null),s(e,n),s(e,i),s(i,o),s(o,a),s(i,u),s(i,c),s(i,f),s(i,_),s(_,p),s(i,b),s(i,v),s(v,d),s(i,S),$&&$.m(i,null),w=!0},p(N,[E]){const B={};E&64&&(B.pct=N[6]),E&96&&(B.color=N[5](N[6])),l.$set(B),(!w||E&4)&&X(a,N[2]),(!w||E&1)&&X(p,N[0]),(!w||E&2)&&X(d,N[1]),N[3]?$?$.p(N,E):($=uu(N),$.c(),$.m(i,null)):$&&($.d(1),$=null)},i(N){w||(D(l.$$.fragment,N),w=!0)},o(N){q(l.$$.fragment,N),w=!1},d(N){N&&C(e),ne(l),$&&$.d()}}}function sm(t,e,l){let{val:n}=e,{max:i}=e,{unit:o}=e,{label:a}=e,{sub:u=""}=e,{subunit:c=""}=e,{colorFn:f}=e,_=0;return t.$$set=p=>{"val"in p&&l(0,n=p.val),"max"in p&&l(7,i=p.max),"unit"in p&&l(1,o=p.unit),"label"in p&&l(2,a=p.label),"sub"in p&&l(3,u=p.sub),"subunit"in p&&l(4,c=p.subunit),"colorFn"in p&&l(5,f=p.colorFn)},t.$$.update=()=>{t.$$.dirty&129&&l(6,_=Math.min(n,i)/i*100)},[n,o,a,u,c,f,_,i]}class Yc extends Ee{constructor(e){super(),Pe(this,e,sm,im,Ne,{val:0,max:7,unit:1,label:2,sub:3,subunit:4,colorFn:5})}}function fu(t,e,l){const n=t.slice();return n[11]=e[l],n[13]=l,n}function cu(t,e,l){const n=t.slice();return n[11]=e[l],n[13]=l,n}function mu(t,e,l){const n=t.slice();return n[15]=e[l],n}function pu(t){let e,l,n,i,o,a,u=t[0].title&&_u(t),c=t[0].y.ticks,f=[];for(let d=0;dt[9].call(e))},m(o,a){M(o,e,a),s(e,n),i=ic(e,t[9].bind(e))},p(o,a){a&1&&l!==(l=o[0].title+"")&&X(n,l)},d(o){o&&C(e),i()}}}function du(t){let e,l,n,i=t[15].label+"",o,a,u,c;return{c(){e=Fe("g"),l=Fe("line"),n=Fe("text"),o=T(i),r(l,"x2","100%"),r(n,"y","-4"),r(n,"x",a=t[15].align=="right"?"85%":""),r(e,"class",u="tick tick-"+t[15].value+" tick-"+t[15].color),r(e,"transform",c="translate(0, "+t[7](t[15].value)+")")},m(f,_){M(f,e,_),s(e,l),s(e,n),s(n,o)},p(f,_){_&1&&i!==(i=f[15].label+"")&&X(o,i),_&1&&a!==(a=f[15].align=="right"?"85%":"")&&r(n,"x",a),_&1&&u!==(u="tick tick-"+f[15].value+" tick-"+f[15].color)&&r(e,"class",u),_&129&&c!==(c="translate(0, "+f[7](f[15].value)+")")&&r(e,"transform",c)},d(f){f&&C(e)}}}function vu(t){let e=!isNaN(t[7](t[15].value)),l,n=e&&du(t);return{c(){n&&n.c(),l=Ve()},m(i,o){n&&n.m(i,o),M(i,l,o)},p(i,o){o&129&&(e=!isNaN(i[7](i[15].value))),e?n?n.p(i,o):(n=du(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&C(l)}}}function hu(t){let e,l,n=(t[3]>20||t[13]%2==0)&&bu(t);return{c(){e=Fe("g"),n&&n.c(),r(e,"class","tick"),r(e,"transform",l="translate("+t[6](t[13])+","+t[4]+")")},m(i,o){M(i,e,o),n&&n.m(e,null)},p(i,o){i[3]>20||i[13]%2==0?n?n.p(i,o):(n=bu(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o&80&&l!==(l="translate("+i[6](i[13])+","+i[4]+")")&&r(e,"transform",l)},d(i){i&&C(e),n&&n.d()}}}function bu(t){let e,l=t[11].label+"",n,i;return{c(){e=Fe("text"),n=T(l),r(e,"x",i=t[3]/2),r(e,"y","-4")},m(o,a){M(o,e,a),s(e,n)},p(o,a){a&1&&l!==(l=o[11].label+"")&&X(n,l),a&8&&i!==(i=o[3]/2)&&r(e,"x",i)},d(o){o&&C(e)}}}function gu(t){let e=!isNaN(t[6](t[13])),l,n=e&&hu(t);return{c(){n&&n.c(),l=Ve()},m(i,o){n&&n.m(i,o),M(i,l,o)},p(i,o){o&64&&(e=!isNaN(i[6](i[13]))),e?n?n.p(i,o):(n=hu(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&C(l)}}}function ku(t){let e,l,n=t[11].value!==void 0&&wu(t),i=t[11].value2>1e-4&&Mu(t);return{c(){e=Fe("g"),n&&n.c(),l=Fe("g"),i&&i.c()},m(o,a){M(o,e,a),n&&n.m(e,null),M(o,l,a),i&&i.m(l,null)},p(o,a){o[11].value!==void 0?n?n.p(o,a):(n=wu(o),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o[11].value2>1e-4?i?i.p(o,a):(i=Mu(o),i.c(),i.m(l,null)):i&&(i.d(1),i=null)},d(o){o&&C(e),n&&n.d(),o&&C(l),i&&i.d()}}}function wu(t){let e,l,n,i,o,a,u,c=t[3]>15&&yu(t);return{c(){e=Fe("rect"),c&&c.c(),u=Ve(),r(e,"x",l=t[6](t[13])+2),r(e,"y",n=t[7](t[11].value)),r(e,"width",i=t[3]-4),r(e,"height",o=t[7](t[0].y.min)-t[7](Math.min(t[0].y.min,0)+t[11].value)),r(e,"fill",a=t[11].color)},m(f,_){M(f,e,_),c&&c.m(f,_),M(f,u,_)},p(f,_){_&64&&l!==(l=f[6](f[13])+2)&&r(e,"x",l),_&129&&n!==(n=f[7](f[11].value))&&r(e,"y",n),_&8&&i!==(i=f[3]-4)&&r(e,"width",i),_&129&&o!==(o=f[7](f[0].y.min)-f[7](Math.min(f[0].y.min,0)+f[11].value))&&r(e,"height",o),_&1&&a!==(a=f[11].color)&&r(e,"fill",a),f[3]>15?c?c.p(f,_):(c=yu(f),c.c(),c.m(u.parentNode,u)):c&&(c.d(1),c=null)},d(f){f&&C(e),c&&c.d(f),f&&C(u)}}}function yu(t){let e,l=t[11].label+"",n,i,o,a,u,c,f=t[11].title&&Cu(t);return{c(){e=Fe("text"),n=T(l),f&&f.c(),c=Ve(),r(e,"width",i=t[3]-4),r(e,"dominant-baseline","middle"),r(e,"text-anchor",o=t[3]t[7](0)-t[8]?t[11].color:"white"),r(e,"transform",u="translate("+(t[6](t[13])+t[3]/2)+" "+(t[7](t[11].value)>t[7](0)-t[8]?t[7](t[11].value)-t[8]:t[7](t[11].value)+10)+") rotate("+(t[3]_[7](0)-_[8]?_[11].color:"white")&&r(e,"fill",a),p&457&&u!==(u="translate("+(_[6](_[13])+_[3]/2)+" "+(_[7](_[11].value)>_[7](0)-_[8]?_[7](_[11].value)-_[8]:_[7](_[11].value)+10)+") rotate("+(_[3]15&&$u(t);return{c(){e=Fe("rect"),c&&c.c(),u=Ve(),r(e,"x",l=t[6](t[13])+2),r(e,"y",n=t[7](0)),r(e,"width",i=t[3]-4),r(e,"height",o=t[7](t[0].y.min)-t[7](t[0].y.min+t[11].value2)),r(e,"fill",a=t[11].color2?t[11].color2:t[11].color)},m(f,_){M(f,e,_),c&&c.m(f,_),M(f,u,_)},p(f,_){_&64&&l!==(l=f[6](f[13])+2)&&r(e,"x",l),_&128&&n!==(n=f[7](0))&&r(e,"y",n),_&8&&i!==(i=f[3]-4)&&r(e,"width",i),_&129&&o!==(o=f[7](f[0].y.min)-f[7](f[0].y.min+f[11].value2))&&r(e,"height",o),_&1&&a!==(a=f[11].color2?f[11].color2:f[11].color)&&r(e,"fill",a),f[3]>15?c?c.p(f,_):(c=$u(f),c.c(),c.m(u.parentNode,u)):c&&(c.d(1),c=null)},d(f){f&&C(e),c&&c.d(f),f&&C(u)}}}function $u(t){let e,l=t[11].label2+"",n,i,o,a,u,c=t[11].title2&&Su(t);return{c(){e=Fe("text"),n=T(l),c&&c.c(),u=Ve(),r(e,"width",i=t[3]-4),r(e,"dominant-baseline","middle"),r(e,"text-anchor","middle"),r(e,"fill",o=t[7](-t[11].value2)t[10].call(e))},m(i,o){M(i,e,o),n&&n.m(e,null),l=ic(e,t[10].bind(e))},p(i,[o]){i[0].x.ticks&&i[0].points&&i[4]?n?n.p(i,o):(n=pu(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},i:fe,o:fe,d(i){i&&C(e),n&&n.d(),l()}}}let cn=30;function rm(t,e,l){let{config:n}=e,i,o,a,u,c,f,_,p=0;function b(){p=this.clientHeight,l(5,p)}function v(){i=this.clientWidth,o=this.clientHeight,l(1,i),l(2,o)}return t.$$set=d=>{"config"in d&&l(0,n=d.config)},t.$$.update=()=>{if(t.$$.dirty&63){l(4,f=o-p);let d=i-(n.padding.left+n.padding.right);l(3,a=d/n.points.length),l(8,_=an.y.max?$=n.padding.bottom:wf||$<0?0:$})}},[n,i,o,a,f,p,u,c,_,b,v]}class pn extends Ee{constructor(e){super(),Pe(this,e,rm,om,Ne,{config:0})}}function am(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function um(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{ds:a}=e,u={};function c(f){return{label:ge(f)+"V",title:f.toFixed(1)+" V",value:isNaN(f)?0:f,color:g1(f||0)}}return t.$$set=f=>{"u1"in f&&l(1,n=f.u1),"u2"in f&&l(2,i=f.u2),"u3"in f&&l(3,o=f.u3),"ds"in f&&l(4,a=f.ds)},t.$$.update=()=>{if(t.$$.dirty&30){let f=[],_=[];n>0&&(f.push({label:a===1?"L1-L2":"L1"}),_.push(c(n))),i>0&&(f.push({label:a===1?"L1-L3":"L2"}),_.push(c(i))),o>0&&(f.push({label:a===1?"L2-L3":"L3"}),_.push(c(o))),l(0,u={title:"Voltage",padding:{top:20,right:15,bottom:20,left:35},y:{min:200,max:260,ticks:[{value:207,label:"-10%"},{value:230,label:"230v"},{value:253,label:"+10%"}]},x:{ticks:f},points:_})}},[u,n,i,o,a]}class fm extends Ee{constructor(e){super(),Pe(this,e,um,am,Ne,{u1:1,u2:2,u3:3,ds:4})}}function cm(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function mm(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{i1:a}=e,{i2:u}=e,{i2e:c}=e,{i3:f}=e,{max:_}=e,p={};function b(v,d){return{label:ge(v)+"A",title:(d?"Estimated ":"")+v.toFixed(1)+" A",value:isNaN(v)?0:v,color:Lc(v?v/_*100:0,d)}}return t.$$set=v=>{"u1"in v&&l(1,n=v.u1),"u2"in v&&l(2,i=v.u2),"u3"in v&&l(3,o=v.u3),"i1"in v&&l(4,a=v.i1),"i2"in v&&l(5,u=v.i2),"i2e"in v&&l(6,c=v.i2e),"i3"in v&&l(7,f=v.i3),"max"in v&&l(8,_=v.max)},t.$$.update=()=>{if(t.$$.dirty&510){let v=[],d=[];n>0&&(v.push({label:"L1"}),d.push(b(a))),i>0&&(v.push({label:"L2"}),d.push(b(u,c))),o>0&&(v.push({label:"L3"}),d.push(b(f))),l(0,p={title:"Amperage",padding:{top:20,right:15,bottom:20,left:35},y:{min:0,max:_,ticks:[{value:0,label:"0%"},{value:_/4,label:"25%"},{value:_/2,label:"50%"},{value:_/4*3,label:"75%"},{value:_,label:"100%"}]},x:{ticks:v},points:d})}},[p,n,i,o,a,u,c,f,_]}class pm extends Ee{constructor(e){super(),Pe(this,e,mm,cm,Ne,{u1:1,u2:2,u3:3,i1:4,i2:5,i2e:6,i3:7,max:8})}}function _m(t){let e,l,n,i,o,a,u,c=(typeof t[0]<"u"?t[0].toFixed(0):"-")+"",f,_,p,b,v,d,S=(typeof t[1]<"u"?t[1].toFixed(0):"-")+"",w,$,N,E,B,P,L,O=(typeof t[2]<"u"?t[2].toFixed(1):"-")+"",F,x,j,z,G,V,W=(typeof t[3]<"u"?t[3].toFixed(1):"-")+"",U,K;return{c(){e=m("div"),l=m("strong"),l.textContent="Reactive",n=h(),i=m("div"),o=m("div"),o.textContent="Instant in",a=h(),u=m("div"),f=T(c),_=T(" VAr"),p=h(),b=m("div"),b.textContent="Instant out",v=h(),d=m("div"),w=T(S),$=T(" VAr"),N=h(),E=m("div"),B=m("div"),B.textContent="Total in",P=h(),L=m("div"),F=T(O),x=T(" kVArh"),j=h(),z=m("div"),z.textContent="Total out",G=h(),V=m("div"),U=T(W),K=T(" kVArh"),r(u,"class","text-right"),r(d,"class","text-right"),r(i,"class","grid grid-cols-2 mt-4"),r(L,"class","text-right"),r(V,"class","text-right"),r(E,"class","grid grid-cols-2 mt-4"),r(e,"class","mx-2 text-sm")},m(H,Y){M(H,e,Y),s(e,l),s(e,n),s(e,i),s(i,o),s(i,a),s(i,u),s(u,f),s(u,_),s(i,p),s(i,b),s(i,v),s(i,d),s(d,w),s(d,$),s(e,N),s(e,E),s(E,B),s(E,P),s(E,L),s(L,F),s(L,x),s(E,j),s(E,z),s(E,G),s(E,V),s(V,U),s(V,K)},p(H,[Y]){Y&1&&c!==(c=(typeof H[0]<"u"?H[0].toFixed(0):"-")+"")&&X(f,c),Y&2&&S!==(S=(typeof H[1]<"u"?H[1].toFixed(0):"-")+"")&&X(w,S),Y&4&&O!==(O=(typeof H[2]<"u"?H[2].toFixed(1):"-")+"")&&X(F,O),Y&8&&W!==(W=(typeof H[3]<"u"?H[3].toFixed(1):"-")+"")&&X(U,W)},i:fe,o:fe,d(H){H&&C(e)}}}function dm(t,e,l){let{importInstant:n}=e,{exportInstant:i}=e,{importTotal:o}=e,{exportTotal:a}=e;return t.$$set=u=>{"importInstant"in u&&l(0,n=u.importInstant),"exportInstant"in u&&l(1,i=u.exportInstant),"importTotal"in u&&l(2,o=u.importTotal),"exportTotal"in u&&l(3,a=u.exportTotal)},[n,i,o,a]}class vm extends Ee{constructor(e){super(),Pe(this,e,dm,_m,Ne,{importInstant:0,exportInstant:1,importTotal:2,exportTotal:3})}}function Nu(t){let e;function l(o,a){return o[3]?bm:hm}let n=l(t),i=n(t);return{c(){i.c(),e=Ve()},m(o,a){i.m(o,a),M(o,e,a)},p(o,a){n===(n=l(o))&&i?i.p(o,a):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){i.d(o),o&&C(e)}}}function hm(t){let e,l,n,i,o,a,u=ge(t[1].h.u,2)+"",c,f,_,p,b,v,d=ge(t[1].d.u,1)+"",S,w,$,N,E,B,P=ge(t[1].m.u)+"",L,O,F,x,j,z,G=ge(t[0].last_month.u)+"",V,W,U,K,H=t[4]&&Au(t);return{c(){e=m("strong"),e.textContent="Consumption",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",o=h(),a=m("div"),c=T(u),f=T(" kWh"),_=h(),p=m("div"),p.textContent="Day",b=h(),v=m("div"),S=T(d),w=T(" kWh"),$=h(),N=m("div"),N.textContent="Month",E=h(),B=m("div"),L=T(P),O=T(" kWh"),F=h(),x=m("div"),x.textContent="Last month",j=h(),z=m("div"),V=T(G),W=T(" kWh"),U=h(),H&&H.c(),K=Ve(),r(a,"class","text-right"),r(v,"class","text-right"),r(B,"class","text-right"),r(z,"class","text-right"),r(n,"class","grid grid-cols-2 mb-3")},m(Y,Z){M(Y,e,Z),M(Y,l,Z),M(Y,n,Z),s(n,i),s(n,o),s(n,a),s(a,c),s(a,f),s(n,_),s(n,p),s(n,b),s(n,v),s(v,S),s(v,w),s(n,$),s(n,N),s(n,E),s(n,B),s(B,L),s(B,O),s(n,F),s(n,x),s(n,j),s(n,z),s(z,V),s(z,W),M(Y,U,Z),H&&H.m(Y,Z),M(Y,K,Z)},p(Y,Z){Z&2&&u!==(u=ge(Y[1].h.u,2)+"")&&X(c,u),Z&2&&d!==(d=ge(Y[1].d.u,1)+"")&&X(S,d),Z&2&&P!==(P=ge(Y[1].m.u)+"")&&X(L,P),Z&1&&G!==(G=ge(Y[0].last_month.u)+"")&&X(V,G),Y[4]?H?H.p(Y,Z):(H=Au(Y),H.c(),H.m(K.parentNode,K)):H&&(H.d(1),H=null)},d(Y){Y&&C(e),Y&&C(l),Y&&C(n),Y&&C(U),H&&H.d(Y),Y&&C(K)}}}function bm(t){let e,l,n,i,o,a,u=ge(t[1].h.u,2)+"",c,f,_,p,b,v,d,S=ge(t[1].d.u,1)+"",w,$,N,E,B,P,L,O=ge(t[1].m.u)+"",F,x,j,z,G,V,W,U=ge(t[0].last_month.u)+"",K,H,Y,Z,re,ue,ke,me,Se,je,Re,He=ge(t[1].h.p,2)+"",we,Te,Le,Me,y,g,k,A=ge(t[1].d.p,1)+"",I,Q,J,se,ce,ve,$e,oe=ge(t[1].m.p)+"",pe,Be,_e,ye,vt,Hl,tl,ct=ge(t[0].last_month.p)+"",Tl,pl,Ht,ht,Xe=t[4]&&Pu(t),Ze=t[4]&&Eu(t),Je=t[4]&&Du(t),Ue=t[4]&&Iu(t),xe=t[4]&&Ru(t),We=t[4]&&Lu(t),et=t[4]&&Ou(t),tt=t[4]&&Fu(t);return{c(){e=m("strong"),e.textContent="Import",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",o=h(),a=m("div"),c=T(u),f=T(" kWh"),_=h(),Xe&&Xe.c(),p=h(),b=m("div"),b.textContent="Day",v=h(),d=m("div"),w=T(S),$=T(" kWh"),N=h(),Ze&&Ze.c(),E=h(),B=m("div"),B.textContent="Month",P=h(),L=m("div"),F=T(O),x=T(" kWh"),j=h(),Je&&Je.c(),z=h(),G=m("div"),G.textContent="Last mo.",V=h(),W=m("div"),K=T(U),H=T(" kWh"),Y=h(),Ue&&Ue.c(),re=h(),ue=m("strong"),ue.textContent="Export",ke=h(),me=m("div"),Se=m("div"),Se.textContent="Hour",je=h(),Re=m("div"),we=T(He),Te=T(" kWh"),Le=h(),xe&&xe.c(),Me=h(),y=m("div"),y.textContent="Day",g=h(),k=m("div"),I=T(A),Q=T(" kWh"),J=h(),We&&We.c(),se=h(),ce=m("div"),ce.textContent="Month",ve=h(),$e=m("div"),pe=T(oe),Be=T(" kWh"),_e=h(),et&&et.c(),ye=h(),vt=m("div"),vt.textContent="Last mo.",Hl=h(),tl=m("div"),Tl=T(ct),pl=T(" kWh"),Ht=h(),tt&&tt.c(),r(a,"class","text-right"),r(d,"class","text-right"),r(L,"class","text-right"),r(W,"class","text-right"),r(n,"class",Z="grid grid-cols-"+t[5]+" mb-3"),r(Re,"class","text-right"),r(k,"class","text-right"),r($e,"class","text-right"),r(tl,"class","text-right"),r(me,"class",ht="grid grid-cols-"+t[5])},m(de,Ce){M(de,e,Ce),M(de,l,Ce),M(de,n,Ce),s(n,i),s(n,o),s(n,a),s(a,c),s(a,f),s(n,_),Xe&&Xe.m(n,null),s(n,p),s(n,b),s(n,v),s(n,d),s(d,w),s(d,$),s(n,N),Ze&&Ze.m(n,null),s(n,E),s(n,B),s(n,P),s(n,L),s(L,F),s(L,x),s(n,j),Je&&Je.m(n,null),s(n,z),s(n,G),s(n,V),s(n,W),s(W,K),s(W,H),s(n,Y),Ue&&Ue.m(n,null),M(de,re,Ce),M(de,ue,Ce),M(de,ke,Ce),M(de,me,Ce),s(me,Se),s(me,je),s(me,Re),s(Re,we),s(Re,Te),s(me,Le),xe&&xe.m(me,null),s(me,Me),s(me,y),s(me,g),s(me,k),s(k,I),s(k,Q),s(me,J),We&&We.m(me,null),s(me,se),s(me,ce),s(me,ve),s(me,$e),s($e,pe),s($e,Be),s(me,_e),et&&et.m(me,null),s(me,ye),s(me,vt),s(me,Hl),s(me,tl),s(tl,Tl),s(tl,pl),s(me,Ht),tt&&tt.m(me,null)},p(de,Ce){Ce&2&&u!==(u=ge(de[1].h.u,2)+"")&&X(c,u),de[4]?Xe?Xe.p(de,Ce):(Xe=Pu(de),Xe.c(),Xe.m(n,p)):Xe&&(Xe.d(1),Xe=null),Ce&2&&S!==(S=ge(de[1].d.u,1)+"")&&X(w,S),de[4]?Ze?Ze.p(de,Ce):(Ze=Eu(de),Ze.c(),Ze.m(n,E)):Ze&&(Ze.d(1),Ze=null),Ce&2&&O!==(O=ge(de[1].m.u)+"")&&X(F,O),de[4]?Je?Je.p(de,Ce):(Je=Du(de),Je.c(),Je.m(n,z)):Je&&(Je.d(1),Je=null),Ce&1&&U!==(U=ge(de[0].last_month.u)+"")&&X(K,U),de[4]?Ue?Ue.p(de,Ce):(Ue=Iu(de),Ue.c(),Ue.m(n,null)):Ue&&(Ue.d(1),Ue=null),Ce&32&&Z!==(Z="grid grid-cols-"+de[5]+" mb-3")&&r(n,"class",Z),Ce&2&&He!==(He=ge(de[1].h.p,2)+"")&&X(we,He),de[4]?xe?xe.p(de,Ce):(xe=Ru(de),xe.c(),xe.m(me,Me)):xe&&(xe.d(1),xe=null),Ce&2&&A!==(A=ge(de[1].d.p,1)+"")&&X(I,A),de[4]?We?We.p(de,Ce):(We=Lu(de),We.c(),We.m(me,se)):We&&(We.d(1),We=null),Ce&2&&oe!==(oe=ge(de[1].m.p)+"")&&X(pe,oe),de[4]?et?et.p(de,Ce):(et=Ou(de),et.c(),et.m(me,ye)):et&&(et.d(1),et=null),Ce&1&&ct!==(ct=ge(de[0].last_month.p)+"")&&X(Tl,ct),de[4]?tt?tt.p(de,Ce):(tt=Fu(de),tt.c(),tt.m(me,null)):tt&&(tt.d(1),tt=null),Ce&32&&ht!==(ht="grid grid-cols-"+de[5])&&r(me,"class",ht)},d(de){de&&C(e),de&&C(l),de&&C(n),Xe&&Xe.d(),Ze&&Ze.d(),Je&&Je.d(),Ue&&Ue.d(),de&&C(re),de&&C(ue),de&&C(ke),de&&C(me),xe&&xe.d(),We&&We.d(),et&&et.d(),tt&&tt.d()}}}function Au(t){let e,l,n,i,o,a,u=ge(t[1].h.c,2)+"",c,f,_,p,b,v,d,S=ge(t[1].d.c,1)+"",w,$,N,E,B,P,L,O=ge(t[1].m.c)+"",F,x,j,z,G,V,W,U=ge(t[0].last_month.c)+"",K,H,Y;return{c(){e=m("strong"),e.textContent="Cost",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",o=h(),a=m("div"),c=T(u),f=h(),_=T(t[2]),p=h(),b=m("div"),b.textContent="Day",v=h(),d=m("div"),w=T(S),$=h(),N=T(t[2]),E=h(),B=m("div"),B.textContent="Month",P=h(),L=m("div"),F=T(O),x=h(),j=T(t[2]),z=h(),G=m("div"),G.textContent="Last month",V=h(),W=m("div"),K=T(U),H=h(),Y=T(t[2]),r(a,"class","text-right"),r(d,"class","text-right"),r(L,"class","text-right"),r(W,"class","text-right"),r(n,"class","grid grid-cols-2")},m(Z,re){M(Z,e,re),M(Z,l,re),M(Z,n,re),s(n,i),s(n,o),s(n,a),s(a,c),s(a,f),s(a,_),s(n,p),s(n,b),s(n,v),s(n,d),s(d,w),s(d,$),s(d,N),s(n,E),s(n,B),s(n,P),s(n,L),s(L,F),s(L,x),s(L,j),s(n,z),s(n,G),s(n,V),s(n,W),s(W,K),s(W,H),s(W,Y)},p(Z,re){re&2&&u!==(u=ge(Z[1].h.c,2)+"")&&X(c,u),re&4&&X(_,Z[2]),re&2&&S!==(S=ge(Z[1].d.c,1)+"")&&X(w,S),re&4&&X(N,Z[2]),re&2&&O!==(O=ge(Z[1].m.c)+"")&&X(F,O),re&4&&X(j,Z[2]),re&1&&U!==(U=ge(Z[0].last_month.c)+"")&&X(K,U),re&4&&X(Y,Z[2])},d(Z){Z&&C(e),Z&&C(l),Z&&C(n)}}}function Pu(t){let e,l=ge(t[1].h.c,2)+"",n,i,o;return{c(){e=m("div"),n=T(l),i=h(),o=T(t[2]),r(e,"class","text-right")},m(a,u){M(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&2&&l!==(l=ge(a[1].h.c,2)+"")&&X(n,l),u&4&&X(o,a[2])},d(a){a&&C(e)}}}function Eu(t){let e,l=ge(t[1].d.c,1)+"",n,i,o;return{c(){e=m("div"),n=T(l),i=h(),o=T(t[2]),r(e,"class","text-right")},m(a,u){M(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&2&&l!==(l=ge(a[1].d.c,1)+"")&&X(n,l),u&4&&X(o,a[2])},d(a){a&&C(e)}}}function Du(t){let e,l=ge(t[1].m.c)+"",n,i,o;return{c(){e=m("div"),n=T(l),i=h(),o=T(t[2]),r(e,"class","text-right")},m(a,u){M(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&2&&l!==(l=ge(a[1].m.c)+"")&&X(n,l),u&4&&X(o,a[2])},d(a){a&&C(e)}}}function Iu(t){let e,l=ge(t[0].last_month.c)+"",n,i,o;return{c(){e=m("div"),n=T(l),i=h(),o=T(t[2]),r(e,"class","text-right")},m(a,u){M(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&1&&l!==(l=ge(a[0].last_month.c)+"")&&X(n,l),u&4&&X(o,a[2])},d(a){a&&C(e)}}}function Ru(t){let e,l=ge(t[1].h.i,2)+"",n,i,o;return{c(){e=m("div"),n=T(l),i=h(),o=T(t[2]),r(e,"class","text-right")},m(a,u){M(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&2&&l!==(l=ge(a[1].h.i,2)+"")&&X(n,l),u&4&&X(o,a[2])},d(a){a&&C(e)}}}function Lu(t){let e,l=ge(t[1].d.i,1)+"",n,i,o;return{c(){e=m("div"),n=T(l),i=h(),o=T(t[2]),r(e,"class","text-right")},m(a,u){M(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&2&&l!==(l=ge(a[1].d.i,1)+"")&&X(n,l),u&4&&X(o,a[2])},d(a){a&&C(e)}}}function Ou(t){let e,l=ge(t[1].m.i)+"",n,i,o;return{c(){e=m("div"),n=T(l),i=h(),o=T(t[2]),r(e,"class","text-right")},m(a,u){M(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&2&&l!==(l=ge(a[1].m.i)+"")&&X(n,l),u&4&&X(o,a[2])},d(a){a&&C(e)}}}function Fu(t){let e,l=ge(t[0].last_month.i)+"",n,i,o;return{c(){e=m("div"),n=T(l),i=h(),o=T(t[2]),r(e,"class","text-right")},m(a,u){M(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&1&&l!==(l=ge(a[0].last_month.i)+"")&&X(n,l),u&4&&X(o,a[2])},d(a){a&&C(e)}}}function gm(t){let e,l,n,i,o,a,u=t[1]&&Nu(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Real time calculation",n=h(),i=m("br"),o=m("br"),a=h(),u&&u.c(),r(e,"class","mx-2 text-sm")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),s(e,a),u&&u.m(e,null)},p(c,[f]){c[1]?u?u.p(c,f):(u=Nu(c),u.c(),u.m(e,null)):u&&(u.d(1),u=null)},i:fe,o:fe,d(c){c&&C(e),u&&u.d()}}}function km(t,e,l){let{sysinfo:n}=e,{data:i}=e,{currency:o}=e,{hasExport:a}=e,u=!1,c=3;return t.$$set=f=>{"sysinfo"in f&&l(0,n=f.sysinfo),"data"in f&&l(1,i=f.data),"currency"in f&&l(2,o=f.currency),"hasExport"in f&&l(3,a=f.hasExport)},t.$$.update=()=>{t.$$.dirty&18&&(l(4,u=i&&i.h&&(Math.abs(i.h.c)>.01||Math.abs(i.d.c)>.01||Math.abs(i.m.c)>.01||Math.abs(i.h.i)>.01||Math.abs(i.d.i)>.01||Math.abs(i.m.i)>.01)),l(5,c=u?3:2))},[n,i,o,a,u,c]}class wm extends Ee{constructor(e){super(),Pe(this,e,km,gm,Ne,{sysinfo:0,data:1,currency:2,hasExport:3})}}function ym(t){let e,l,n=Ja(t[0].source)+"",i,o,a,u;return a=new pn({props:{config:t[1]}}),{c(){e=m("a"),l=T("Provided by: "),i=T(n),o=h(),ie(a.$$.fragment),r(e,"href","https://transparency.entsoe.eu/"),r(e,"target","_blank"),r(e,"class","text-xs float-right z-40")},m(c,f){M(c,e,f),s(e,l),s(e,i),M(c,o,f),le(a,c,f),u=!0},p(c,[f]){(!u||f&1)&&n!==(n=Ja(c[0].source)+"")&&X(i,n);const _={};f&2&&(_.config=c[1]),a.$set(_)},i(c){u||(D(a.$$.fragment,c),u=!0)},o(c){q(a.$$.fragment,c),u=!1},d(c){c&&C(e),c&&C(o),ne(a,c)}}}function Cm(t,e,l){let{json:n}=e,{sysinfo:i}=e,o={},a,u;return t.$$set=c=>{"json"in c&&l(0,n=c.json),"sysinfo"in c&&l(2,i=c.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&29){let c=n.currency,f=new Date().getUTCHours(),_=0,p=0,b=0,v=[],d=[],S=[];l(4,u=l(3,a=0));let w=new Date;for(fl(w,i.clock_offset-(24+w.getHours()-w.getUTCHours())%24),_=f;_<24&&(p=n[Oe(b++)],p!=null);_++)d.push({label:Oe(w.getHours())}),S.push(p*100),l(4,u=Math.min(u,p*100)),l(3,a=Math.max(a,p*100)),fl(w,1);for(_=0;_<24&&(p=n[Oe(b++)],p!=null);_++)d.push({label:Oe(w.getHours())}),S.push(p*100),l(4,u=Math.min(u,p*100)),l(3,a=Math.max(a,p*100)),fl(w,1);if(u>-100&&a<100){switch(c){case"NOK":case"SEK":case"DKK":c="\xF8re";break;case"EUR":c="cent";break;default:c=c+"/100"}for(l(4,u*=100),l(3,a*=100),_=0;_=0?P.toFixed(L):"",title:P>=0?P.toFixed(2)+" "+c:"",value:p>=0?Math.abs(p):0,label2:P<0?P.toFixed(L):"",title2:P<0?P.toFixed(2)+" "+c:"",value2:p<0?Math.abs(p):0,color:"#7c3aed"})}let N=Math.max(a,Math.abs(u));if(u<0){l(4,u=Math.min(N/4*-1,u));let P=Math.ceil(Math.abs(u)/N*4),L=u/P;for(_=1;_{"json"in c&&l(1,n=c.json),"sysinfo"in c&&l(2,i=c.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let c=0,f=[],_=[],p=[];l(4,u=l(3,a=0));let b=fl(new Date,-24),v=new Date().getUTCHours();for(fl(b,i.clock_offset-(24+b.getHours()-b.getUTCHours())%24),c=v;c<24;c++){let $=n["i"+Oe(c)],N=n["e"+Oe(c)];$===void 0&&($=0),N===void 0&&(N=0),_.push({label:Oe(b.getHours())}),p.push({label:$.toFixed(1),title:$.toFixed(2)+" kWh",value:$*10,label2:N.toFixed(1),title2:N.toFixed(2)+" kWh",value2:N*10,color:"#7c3aed",color2:"#37829E"}),l(4,u=Math.max(u,N*10)),l(3,a=Math.max(a,$*10)),fl(b,1)}for(c=0;c{"json"in c&&l(1,n=c.json),"sysinfo"in c&&l(2,i=c.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let c=0,f=[],_=[],p=[];l(4,u=l(3,a=0));let b=new Date,v=new Date;for(fl(b,i.clock_offset-(24+b.getHours()-b.getUTCHours())%24),fl(v,i.clock_offset-(24+v.getHours()-v.getUTCHours())%24),v.setDate(0),c=b.getDate();c<=v.getDate();c++){let $=n["i"+Oe(c)],N=n["e"+Oe(c)];$===void 0&&($=0),N===void 0&&(N=0),_.push({label:Oe(c)}),p.push({label:$.toFixed($<10?1:0),title:$.toFixed(2)+" kWh",value:$,label2:N.toFixed(N<10?1:0),title2:N.toFixed(2)+" kWh",value2:N,color:"#7c3aed",color2:"#37829E"}),l(4,u=Math.max(u,N)),l(3,a=Math.max(a,$))}for(c=1;c{"json"in u&&l(1,n=u.json)},t.$$.update=()=>{if(t.$$.dirty&14){let u=0,c=0,f=[],_=[],p=[];n.s&&n.s.forEach((d,S)=>{var w=d.n?d.n:d.a;c=d.v,c==-127&&(c=0),_.push({label:w.slice(-4)}),p.push({label:c.toFixed(1),value:c,color:"#7c3aed"}),l(3,a=Math.min(a,c)),l(2,o=Math.max(o,c))}),l(2,o=Math.ceil(o)),l(3,a=Math.floor(a));let b=o;a<0&&(b+=Math.abs(a));let v=b/4;for(u=0;u<5;u++)c=a+v*u,f.push({value:c,label:c.toFixed(1)});l(0,i={title:"Temperature sensors (\xB0C)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:a,max:o,ticks:f},x:{ticks:_},points:p})}},[i,n,o,a]}class Im extends Ee{constructor(e){super(),Pe(this,e,Dm,Em,Ne,{json:1})}}function Rm(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}let Lm=0;function Om(t,e,l){let n={},i=0,o;return Wc.subscribe(a=>{l(2,o=a)}),Hc(),t.$$.update=()=>{if(t.$$.dirty&6){let a=0,u=[],c=[],f=[];if(u.push({value:0,label:0}),o&&o.p)for(a=0;a0?Oe(_.d)+"."+no[new Date().getMonth()]:"-"}),l(1,i=Math.max(i,_.v))}if(o&&o.t){for(a=0;a=i)break;u.push({value:_,label:_})}u.push({label:o.m.toFixed(1),align:"right",color:"green",value:o.m})}o&&o.c&&(u.push({label:o.c.toFixed(0),color:"orange",value:o.c}),l(1,i=Math.max(i,o.c))),l(1,i=Math.ceil(i)),l(0,n={title:"Tariff peaks",padding:{top:20,right:35,bottom:20,left:35},y:{min:Lm,max:i,ticks:u},x:{ticks:c},points:f})}},[n,i,o]}class Fm extends Ee{constructor(e){super(),Pe(this,e,Om,Rm,Ne,{})}}function qu(t){let e,l,n,i,o,a,u=(t[0].mt?Cs(t[0].mt):"-")+"",c,f,_,p=(t[0].ic?t[0].ic.toFixed(1):"-")+"",b,v,d;return i=new Yc({props:{val:t[0].i?t[0].i:0,max:t[0].im?t[0].im:15e3,unit:"W",label:"Import",sub:t[0].p,subunit:t[0].pc,colorFn:Lc}}),{c(){e=m("div"),l=m("div"),n=m("div"),ie(i.$$.fragment),o=h(),a=m("div"),c=T(u),f=h(),_=m("div"),b=T(p),v=T(" kWh"),r(n,"class","col-span-2"),r(_,"class","text-right"),r(l,"class","grid grid-cols-2"),r(e,"class","cnt")},m(S,w){M(S,e,w),s(e,l),s(l,n),le(i,n,null),s(l,o),s(l,a),s(a,c),s(l,f),s(l,_),s(_,b),s(_,v),d=!0},p(S,w){const $={};w&1&&($.val=S[0].i?S[0].i:0),w&1&&($.max=S[0].im?S[0].im:15e3),w&1&&($.sub=S[0].p),w&1&&($.subunit=S[0].pc),i.$set($),(!d||w&1)&&u!==(u=(S[0].mt?Cs(S[0].mt):"-")+"")&&X(c,u),(!d||w&1)&&p!==(p=(S[0].ic?S[0].ic.toFixed(1):"-")+"")&&X(b,p)},i(S){d||(D(i.$$.fragment,S),d=!0)},o(S){q(i.$$.fragment,S),d=!1},d(S){S&&C(e),ne(i)}}}function Bu(t){let e,l,n,i,o,a,u,c,f=(t[0].ec?t[0].ec.toFixed(1):"-")+"",_,p,b;return i=new Yc({props:{val:t[0].e?t[0].e:0,max:t[0].om?t[0].om*1e3:1e4,unit:"W",label:"Export",colorFn:k1}}),{c(){e=m("div"),l=m("div"),n=m("div"),ie(i.$$.fragment),o=h(),a=m("div"),u=h(),c=m("div"),_=T(f),p=T(" kWh"),r(n,"class","col-span-2"),r(c,"class","text-right"),r(l,"class","grid grid-cols-2"),r(e,"class","cnt")},m(v,d){M(v,e,d),s(e,l),s(l,n),le(i,n,null),s(l,o),s(l,a),s(l,u),s(l,c),s(c,_),s(c,p),b=!0},p(v,d){const S={};d&1&&(S.val=v[0].e?v[0].e:0),d&1&&(S.max=v[0].om?v[0].om*1e3:1e4),i.$set(S),(!b||d&1)&&f!==(f=(v[0].ec?v[0].ec.toFixed(1):"-")+"")&&X(_,f)},i(v){b||(D(i.$$.fragment,v),b=!0)},o(v){q(i.$$.fragment,v),b=!1},d(v){v&&C(e),ne(i)}}}function Uu(t){let e,l,n;return l=new fm({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,ds:t[0].ds}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt")},m(i,o){M(i,e,o),le(l,e,null),n=!0},p(i,o){const a={};o&1&&(a.u1=i[0].u1),o&1&&(a.u2=i[0].u2),o&1&&(a.u3=i[0].u3),o&1&&(a.ds=i[0].ds),l.$set(a)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function ju(t){let e,l,n;return l=new pm({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,i1:t[0].i1,i2:t[0].i2,i2e:t[0].i2e,i3:t[0].i3,max:t[0].mf?t[0].mf:32}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt")},m(i,o){M(i,e,o),le(l,e,null),n=!0},p(i,o){const a={};o&1&&(a.u1=i[0].u1),o&1&&(a.u2=i[0].u2),o&1&&(a.u3=i[0].u3),o&1&&(a.i1=i[0].i1),o&1&&(a.i2=i[0].i2),o&1&&(a.i2e=i[0].i2e),o&1&&(a.i3=i[0].i3),o&1&&(a.max=i[0].mf?i[0].mf:32),l.$set(a)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Hu(t){let e,l,n;return l=new vm({props:{importInstant:t[0].ri,exportInstant:t[0].re,importTotal:t[0].ric,exportTotal:t[0].rec}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt")},m(i,o){M(i,e,o),le(l,e,null),n=!0},p(i,o){const a={};o&1&&(a.importInstant=i[0].ri),o&1&&(a.exportInstant=i[0].re),o&1&&(a.importTotal=i[0].ric),o&1&&(a.exportTotal=i[0].rec),l.$set(a)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Wu(t){let e,l,n;return l=new wm({props:{sysinfo:t[1],data:t[0].ea,currency:t[0].pc,hasExport:t[0].om>0||t[0].e>0}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt")},m(i,o){M(i,e,o),le(l,e,null),n=!0},p(i,o){const a={};o&2&&(a.sysinfo=i[1]),o&1&&(a.data=i[0].ea),o&1&&(a.currency=i[0].pc),o&1&&(a.hasExport=i[0].om>0||i[0].e>0),l.$set(a)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function zu(t){let e,l,n;return l=new Fm({}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt h-64")},m(i,o){M(i,e,o),le(l,e,null),n=!0},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Gu(t){let e,l,n;return l=new Mm({props:{json:t[2],sysinfo:t[1]}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){M(i,e,o),le(l,e,null),n=!0},p(i,o){const a={};o&4&&(a.json=i[2]),o&2&&(a.sysinfo=i[1]),l.$set(a)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Vu(t){let e,l,n;return l=new Tm({props:{json:t[3],sysinfo:t[1]}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){M(i,e,o),le(l,e,null),n=!0},p(i,o){const a={};o&8&&(a.json=i[3]),o&2&&(a.sysinfo=i[1]),l.$set(a)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Ku(t){let e,l,n;return l=new Pm({props:{json:t[4],sysinfo:t[1]}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){M(i,e,o),le(l,e,null),n=!0},p(i,o){const a={};o&16&&(a.json=i[4]),o&2&&(a.sysinfo=i[1]),l.$set(a)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Yu(t){let e,l,n;return l=new Im({props:{json:t[5]}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){M(i,e,o),le(l,e,null),n=!0},p(i,o){const a={};o&32&&(a.json=i[5]),l.$set(a)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function qm(t){let e,l=Ke(t[1].ui.i,t[0].i),n,i=Ke(t[1].ui.e,t[0].om||t[0].e>0),o,a=Ke(t[1].ui.v,t[0].u1>100||t[0].u2>100||t[0].u3>100),u,c=Ke(t[1].ui.a,t[0].i1>.01||t[0].i2>.01||t[0].i3>.01),f,_=Ke(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),p,b=Ke(t[1].ui.c,t[0].ea),v,d=Ke(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("10YNO")||t[0].pr.startsWith("10Y1001A1001A4"))),S,w=Ke(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].p)),$,N=Ke(t[1].ui.d,t[3]),E,B=Ke(t[1].ui.m,t[4]),P,L=Ke(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[5].c>1),O,F=l&&qu(t),x=i&&Bu(t),j=a&&Uu(t),z=c&&ju(t),G=_&&Hu(t),V=b&&Wu(t),W=d&&zu(),U=w&&Gu(t),K=N&&Vu(t),H=B&&Ku(t),Y=L&&Yu(t);return{c(){e=m("div"),F&&F.c(),n=h(),x&&x.c(),o=h(),j&&j.c(),u=h(),z&&z.c(),f=h(),G&&G.c(),p=h(),V&&V.c(),v=h(),W&&W.c(),S=h(),U&&U.c(),$=h(),K&&K.c(),E=h(),H&&H.c(),P=h(),Y&&Y.c(),r(e,"class","grid 2xl:grid-cols-6 xl:grid-cols-5 lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2")},m(Z,re){M(Z,e,re),F&&F.m(e,null),s(e,n),x&&x.m(e,null),s(e,o),j&&j.m(e,null),s(e,u),z&&z.m(e,null),s(e,f),G&&G.m(e,null),s(e,p),V&&V.m(e,null),s(e,v),W&&W.m(e,null),s(e,S),U&&U.m(e,null),s(e,$),K&&K.m(e,null),s(e,E),H&&H.m(e,null),s(e,P),Y&&Y.m(e,null),O=!0},p(Z,[re]){re&3&&(l=Ke(Z[1].ui.i,Z[0].i)),l?F?(F.p(Z,re),re&3&&D(F,1)):(F=qu(Z),F.c(),D(F,1),F.m(e,n)):F&&(De(),q(F,1,1,()=>{F=null}),Ie()),re&3&&(i=Ke(Z[1].ui.e,Z[0].om||Z[0].e>0)),i?x?(x.p(Z,re),re&3&&D(x,1)):(x=Bu(Z),x.c(),D(x,1),x.m(e,o)):x&&(De(),q(x,1,1,()=>{x=null}),Ie()),re&3&&(a=Ke(Z[1].ui.v,Z[0].u1>100||Z[0].u2>100||Z[0].u3>100)),a?j?(j.p(Z,re),re&3&&D(j,1)):(j=Uu(Z),j.c(),D(j,1),j.m(e,u)):j&&(De(),q(j,1,1,()=>{j=null}),Ie()),re&3&&(c=Ke(Z[1].ui.a,Z[0].i1>.01||Z[0].i2>.01||Z[0].i3>.01)),c?z?(z.p(Z,re),re&3&&D(z,1)):(z=ju(Z),z.c(),D(z,1),z.m(e,f)):z&&(De(),q(z,1,1,()=>{z=null}),Ie()),re&3&&(_=Ke(Z[1].ui.r,Z[0].ri>0||Z[0].re>0||Z[0].ric>0||Z[0].rec>0)),_?G?(G.p(Z,re),re&3&&D(G,1)):(G=Hu(Z),G.c(),D(G,1),G.m(e,p)):G&&(De(),q(G,1,1,()=>{G=null}),Ie()),re&3&&(b=Ke(Z[1].ui.c,Z[0].ea)),b?V?(V.p(Z,re),re&3&&D(V,1)):(V=Wu(Z),V.c(),D(V,1),V.m(e,v)):V&&(De(),q(V,1,1,()=>{V=null}),Ie()),re&3&&(d=Ke(Z[1].ui.t,Z[0].pr&&(Z[0].pr.startsWith("10YNO")||Z[0].pr.startsWith("10Y1001A1001A4")))),d?W?re&3&&D(W,1):(W=zu(),W.c(),D(W,1),W.m(e,S)):W&&(De(),q(W,1,1,()=>{W=null}),Ie()),re&3&&(w=Ke(Z[1].ui.p,Z[0].pe&&!Number.isNaN(Z[0].p))),w?U?(U.p(Z,re),re&3&&D(U,1)):(U=Gu(Z),U.c(),D(U,1),U.m(e,$)):U&&(De(),q(U,1,1,()=>{U=null}),Ie()),re&10&&(N=Ke(Z[1].ui.d,Z[3])),N?K?(K.p(Z,re),re&10&&D(K,1)):(K=Vu(Z),K.c(),D(K,1),K.m(e,E)):K&&(De(),q(K,1,1,()=>{K=null}),Ie()),re&18&&(B=Ke(Z[1].ui.m,Z[4])),B?H?(H.p(Z,re),re&18&&D(H,1)):(H=Ku(Z),H.c(),D(H,1),H.m(e,P)):H&&(De(),q(H,1,1,()=>{H=null}),Ie()),re&35&&(L=Ke(Z[1].ui.s,Z[0].t&&Z[0].t!=-127&&Z[5].c>1)),L?Y?(Y.p(Z,re),re&35&&D(Y,1)):(Y=Yu(Z),Y.c(),D(Y,1),Y.m(e,null)):Y&&(De(),q(Y,1,1,()=>{Y=null}),Ie())},i(Z){O||(D(F),D(x),D(j),D(z),D(G),D(V),D(W),D(U),D(K),D(H),D(Y),O=!0)},o(Z){q(F),q(x),q(j),q(z),q(G),q(V),q(W),q(U),q(K),q(H),q(Y),O=!1},d(Z){Z&&C(e),F&&F.d(),x&&x.d(),j&&j.d(),z&&z.d(),G&&G.d(),V&&V.d(),W&&W.d(),U&&U.d(),K&&K.d(),H&&H.d(),Y&&Y.d()}}}function Bm(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,o={},a={},u={},c={};return Co.subscribe(f=>{l(2,o=f)}),qc.subscribe(f=>{l(3,a=f)}),Bc.subscribe(f=>{l(4,u=f)}),jc.subscribe(f=>{l(5,c=f)}),t.$$set=f=>{"data"in f&&l(0,n=f.data),"sysinfo"in f&&l(1,i=f.sysinfo)},[n,i,o,a,u,c]}class Um extends Ee{constructor(e){super(),Pe(this,e,Bm,qm,Ne,{data:0,sysinfo:1})}}let fo={};const Ci=at(fo);async function jm(){fo=await(await fetch("/configuration.json")).json(),Ci.set(fo)}function Qu(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function Hm(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=3,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function Wm(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=20,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function Xu(t){let e;return{c(){e=m("option"),e.textContent="UART2",e.__value=113,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function Zu(t){let e,l,n;return{c(){e=m("option"),e.textContent="UART1",l=h(),n=m("option"),n.textContent="UART2",e.__value=9,e.value=e.__value,n.__value=16,n.value=n.__value},m(i,o){M(i,e,o),M(i,l,o),M(i,n,o)},d(i){i&&C(e),i&&C(l),i&&C(n)}}}function Ju(t){let e;return{c(){e=m("option"),e.textContent="UART1",e.__value=18,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function xu(t){let e,l,n;return{c(){e=m("option"),l=T("GPIO"),n=T(t[4]),e.__value=t[4],e.value=e.__value},m(i,o){M(i,e,o),s(e,l),s(e,n)},d(i){i&&C(e)}}}function ef(t){let e,l=t[4]>3&&!(t[0]=="esp32"&&(t[4]==9||t[4]==16))&&!(t[0]=="esp32s2"&&t[4]==18)&&!(t[0]=="esp8266"&&(t[4]==3||t[4]==113))&&xu(t);return{c(){l&&l.c(),e=Ve()},m(n,i){l&&l.m(n,i),M(n,e,i)},p(n,i){n[4]>3&&!(n[0]=="esp32"&&(n[4]==9||n[4]==16))&&!(n[0]=="esp32s2"&&n[4]==18)&&!(n[0]=="esp8266"&&(n[4]==3||n[4]==113))?l||(l=xu(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){l&&l.d(n),n&&C(e)}}}function zm(t){let e,l,n,i,o;function a(d,S){return d[0]=="esp32c3"?Wm:Hm}let u=a(t),c=u(t),f=t[0]=="esp8266"&&Xu(),_=(t[0]=="esp32"||t[0]=="esp32solo")&&Zu(),p=t[0]=="esp32s2"&&Ju(),b={length:t[1]+1},v=[];for(let d=0;d{"chip"in o&&l(0,n=o.chip)},t.$$.update=()=>{if(t.$$.dirty&1)switch(n){case"esp8266":l(1,i=16);break;case"esp32s2":l(1,i=44);break;case"esp32c3":l(1,i=19);break}},[n,i]}class Qc extends Ee{constructor(e){super(),Pe(this,e,Gm,zm,Ne,{chip:0})}}function tf(t){let e,l,n=t[1]&&lf(t);return{c(){e=m("div"),l=m("div"),n&&n.c(),r(l,"class","fixed inset-0 bg-gray-500 bg-opacity-50 flex items-center justify-center"),r(e,"class","z-50"),r(e,"aria-modal","true")},m(i,o){M(i,e,o),s(e,l),n&&n.m(l,null)},p(i,o){i[1]?n?n.p(i,o):(n=lf(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&C(e),n&&n.d()}}}function lf(t){let e,l;return{c(){e=m("div"),l=T(t[1]),r(e,"class","bg-white m-2 p-3 rounded-md shadow-lg pb-4 text-gray-700 w-96")},m(n,i){M(n,e,i),s(e,l)},p(n,i){i&2&&X(l,n[1])},d(n){n&&C(e)}}}function Vm(t){let e,l=t[0]&&tf(t);return{c(){l&&l.c(),e=Ve()},m(n,i){l&&l.m(n,i),M(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=tf(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:fe,o:fe,d(n){l&&l.d(n),n&&C(e)}}}function Km(t,e,l){let{active:n}=e,{message:i}=e;return t.$$set=o=>{"active"in o&&l(0,n=o.active),"message"in o&&l(1,i=o.message)},[n,i]}class It extends Ee{constructor(e){super(),Pe(this,e,Km,Vm,Ne,{active:0,message:1})}}function nf(t,e,l){const n=t.slice();return n[1]=e[l],n}function sf(t){let e,l,n=t[1]+"",i;return{c(){e=m("option"),l=T("Europe/"),i=T(n),e.__value="Europe/"+t[1],e.value=e.__value},m(o,a){M(o,e,a),s(e,l),s(e,i)},p:fe,d(o){o&&C(e)}}}function Ym(t){let e,l,n,i=t[0],o=[];for(let a=0;a>1&1,A=0;A0;g--)A[g]=A[g]?A[g-1]^P.EXPONENT[F._modN(P.LOG[A[g]]+y)]:A[g-1];A[0]=P.EXPONENT[F._modN(P.LOG[A[0]]+y)]}for(y=0;y<=k;y++)A[y]=P.LOG[A[y]]},_checkBadness:function(){var y,g,k,A,I,Q=0,J=this._badness,se=this.buffer,ce=this.width;for(I=0;Ice*ce;)oe-=ce*ce,$e++;for(Q+=$e*F.N4,A=0;A=J-2&&(y=J-2,I>9&&y--);var se=y;if(I>9){for(Q[se+2]=0,Q[se+3]=0;se--;)g=Q[se],Q[se+3]|=255&g<<4,Q[se+2]=g>>4;Q[2]|=255&y<<4,Q[1]=y>>4,Q[0]=64|y>>12}else{for(Q[se+1]=0,Q[se+2]=0;se--;)g=Q[se],Q[se+2]|=255&g<<4,Q[se+1]=g>>4;Q[1]|=255&y<<4,Q[0]=64|y>>4}for(se=y+3-(I<10);se=5&&(k+=F.N1+A[g]-5);for(g=3;gy||A[g-3]*3>=A[g]*4||A[g+3]*3>=A[g]*4)&&(k+=F.N3);return k},_finish:function(){this._stringBuffer=this.buffer.slice();var y,g,k=0,A=3e4;for(g=0;g<8&&(this._applyMask(g),y=this._checkBadness(),y>=1)A&1&&(I[Q-1-g+Q*8]=1,g<6?I[8+Q*g]=1:I[8+Q*(g+1)]=1);for(g=0;g<7;g++,A>>=1)A&1&&(I[8+Q*(Q-7+g)]=1,g?I[6-g+Q*8]=1:I[7+Q*8]=1)},_interleaveBlocks:function(){var y,g,k=this._dataBlock,A=this._ecc,I=this._eccBlock,Q=0,J=this._calculateMaxLength(),se=this._neccBlock1,ce=this._neccBlock2,ve=this._stringBuffer;for(y=0;y1)for(y=$.BLOCK[A],k=I-7;;){for(g=I-7;g>y-3&&(this._addAlignment(g,k),!(g6)for(y=O.BLOCK[Q-7],g=17,k=0;k<6;k++)for(A=0;A<3;A++,g--)1&(g>11?Q>>g-12:y>>g)?(I[5-k+J*(2-A+J-11)]=1,I[2-A+J-11+J*(5-k)]=1):(this._setMask(5-k,2-A+J-11),this._setMask(2-A+J-11,5-k))},_isMasked:function(y,g){var k=F._getMaskBit(y,g);return this._mask[k]===1},_pack:function(){var y,g,k,A=1,I=1,Q=this.width,J=Q-1,se=Q-1,ce=(this._dataBlock+this._eccBlock)*(this._neccBlock1+this._neccBlock2)+this._neccBlock2;for(g=0;gg&&(k=y,y=g,g=k),k=g,k+=g*g,k>>=1,k+=y,k},_modN:function(y){for(;y>=255;)y-=255,y=(y>>8)+(y&255);return y},N1:3,N2:3,N3:40,N4:10}),x=F,j=v.extend({draw:function(){this.element.src=this.qrious.toDataURL()},reset:function(){this.element.src=""},resize:function(){var y=this.element;y.width=y.height=this.qrious.size}}),z=j,G=p.extend(function(y,g,k,A){this.name=y,this.modifiable=Boolean(g),this.defaultValue=k,this._valueTransformer=A},{transform:function(y){var g=this._valueTransformer;return typeof g=="function"?g(y,this):y}}),V=G,W=p.extend(null,{abs:function(y){return y!=null?Math.abs(y):null},hasOwn:function(y,g){return Object.prototype.hasOwnProperty.call(y,g)},noop:function(){},toUpperCase:function(y){return y!=null?y.toUpperCase():null}}),U=W,K=p.extend(function(y){this.options={},y.forEach(function(g){this.options[g.name]=g},this)},{exists:function(y){return this.options[y]!=null},get:function(y,g){return K._get(this.options[y],g)},getAll:function(y){var g,k=this.options,A={};for(g in k)U.hasOwn(k,g)&&(A[g]=K._get(k[g],y));return A},init:function(y,g,k){typeof k!="function"&&(k=U.noop);var A,I;for(A in this.options)U.hasOwn(this.options,A)&&(I=this.options[A],K._set(I,I.defaultValue,g),K._createAccessor(I,g,k));this._setAll(y,g,!0)},set:function(y,g,k){return this._set(y,g,k)},setAll:function(y,g){return this._setAll(y,g)},_set:function(y,g,k,A){var I=this.options[y];if(!I)throw new Error("Invalid option: "+y);if(!I.modifiable&&!A)throw new Error("Option cannot be modified: "+y);return K._set(I,g,k)},_setAll:function(y,g,k){if(!y)return!1;var A,I=!1;for(A in y)U.hasOwn(y,A)&&this._set(A,y[A],g,k)&&(I=!0);return I}},{_createAccessor:function(y,g,k){var A={get:function(){return K._get(y,g)}};y.modifiable&&(A.set=function(I){K._set(y,I,g)&&k(I,y)}),Object.defineProperty(g,y.name,A)},_get:function(y,g){return g["_"+y.name]},_set:function(y,g,k){var A="_"+y.name,I=k[A],Q=y.transform(g!=null?g:y.defaultValue);return k[A]=Q,Q!==I}}),H=K,Y=p.extend(function(){this._services={}},{getService:function(y){var g=this._services[y];if(!g)throw new Error("Service is not being managed with name: "+y);return g},setService:function(y,g){if(this._services[y])throw new Error("Service is already managed with name: "+y);g&&(this._services[y]=g)}}),Z=Y,re=new H([new V("background",!0,"white"),new V("backgroundAlpha",!0,1,U.abs),new V("element"),new V("foreground",!0,"black"),new V("foregroundAlpha",!0,1,U.abs),new V("level",!0,"L",U.toUpperCase),new V("mime",!0,"image/png"),new V("padding",!0,null,U.abs),new V("size",!0,100,U.abs),new V("value",!0,"")]),ue=new Z,ke=p.extend(function(y){re.init(y,this,this.update.bind(this));var g=re.get("element",this),k=ue.getService("element"),A=g&&k.isCanvas(g)?g:k.createCanvas(),I=g&&k.isImage(g)?g:k.createImage();this._canvasRenderer=new S(this,A,!0),this._imageRenderer=new z(this,I,I===g),this.update()},{get:function(){return re.getAll(this)},set:function(y){re.setAll(y,this)&&this.update()},toDataURL:function(y){return this.canvas.toDataURL(y||this.mime)},update:function(){var y=new x({level:this.level,value:this.value});this._canvasRenderer.render(y),this._imageRenderer.render(y)}},{use:function(y){ue.setService(y.getName(),y)}});Object.defineProperties(ke.prototype,{canvas:{get:function(){return this._canvasRenderer.getElement()}},image:{get:function(){return this._imageRenderer.getElement()}}});var me=ke,Se=me,je=p.extend({getName:function(){}}),Re=je,He=Re.extend({createCanvas:function(){},createImage:function(){},getName:function(){return"element"},isCanvas:function(y){},isImage:function(y){}}),we=He,Te=we.extend({createCanvas:function(){return document.createElement("canvas")},createImage:function(){return document.createElement("img")},isCanvas:function(y){return y instanceof HTMLCanvasElement},isImage:function(y){return y instanceof HTMLImageElement}}),Le=Te;Se.use(new Le);var Me=Se;return Me})})(Zc);const ep=Zc.exports;function tp(t){let e,l;return{c(){e=m("img"),Js(e.src,l=t[2])||r(e,"src",l),r(e,"alt",t[0]),r(e,"class",t[1])},m(n,i){M(n,e,i)},p(n,[i]){i&4&&!Js(e.src,l=n[2])&&r(e,"src",l),i&1&&r(e,"alt",n[0]),i&2&&r(e,"class",n[1])},i:fe,o:fe,d(n){n&&C(e)}}}function lp(t,e,l){const n=new ep;let{errorCorrection:i="L"}=e,{background:o="#fff"}=e,{color:a="#000"}=e,{size:u="200"}=e,{value:c=""}=e,{padding:f=0}=e,{className:_="qrcode"}=e,p="";function b(){n.set({background:o,foreground:a,level:i,padding:f,size:u,value:c}),l(2,p=n.toDataURL("image/jpeg"))}return sc(()=>{b()}),t.$$set=v=>{"errorCorrection"in v&&l(3,i=v.errorCorrection),"background"in v&&l(4,o=v.background),"color"in v&&l(5,a=v.color),"size"in v&&l(6,u=v.size),"value"in v&&l(0,c=v.value),"padding"in v&&l(7,f=v.padding),"className"in v&&l(1,_=v.className)},t.$$.update=()=>{t.$$.dirty&1&&c&&b()},[c,_,p,i,o,a,u,f]}class np extends Ee{constructor(e){super(),Pe(this,e,lp,tp,Ne,{errorCorrection:3,background:4,color:5,size:6,value:0,padding:7,className:1})}}function of(t,e,l){const n=t.slice();return n[95]=e[l],n[96]=e,n[97]=l,n}function rf(t,e,l){const n=t.slice();return n[98]=e[l],n[99]=e,n[100]=l,n}function ip(t,e,l){const n=t.slice();return n[101]=e[l],n}function sp(t,e,l){const n=t.slice();return n[104]=e[l],n}function op(t){let e,l;return{c(){e=m("option"),l=T(t[104]),e.__value=t[104],e.value=e.__value},m(n,i){M(n,e,i),s(e,l)},p:fe,d(n){n&&C(e)}}}function af(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),r(l,"name","pt"),r(l,"type","text"),r(l,"class","in-s"),r(l,"placeholder","ENTSO-E API key, optional, read docs")},m(o,a){M(o,e,a),M(o,l,a),te(l,t[3].p.t),n||(i=ee(l,"input",t[22]),n=!0)},p(o,a){a[0]&8&&l.value!==o[3].p.t&&te(l,o[3].p.t)},d(o){o&&C(e),o&&C(l),n=!1,i()}}}function uf(t){let e,l,n,i,o,a,u,c,f,_,p,b,v;return{c(){e=m("div"),l=T("Username"),n=m("br"),i=h(),o=m("input"),a=h(),u=m("div"),c=T("Password"),f=m("br"),_=h(),p=m("input"),r(o,"name","gu"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1"),r(p,"name","gp"),r(p,"type","password"),r(p,"class","in-s"),r(u,"class","my-1")},m(d,S){M(d,e,S),s(e,l),s(e,n),s(e,i),s(e,o),te(o,t[3].g.u),M(d,a,S),M(d,u,S),s(u,c),s(u,f),s(u,_),s(u,p),te(p,t[3].g.p),b||(v=[ee(o,"input",t[24]),ee(p,"input",t[25])],b=!0)},p(d,S){S[0]&8&&o.value!==d[3].g.u&&te(o,d[3].g.u),S[0]&8&&p.value!==d[3].g.p&&te(p,d[3].g.p)},d(d){d&&C(e),d&&C(a),d&&C(u),b=!1,ze(v)}}}function rp(t){let e,l=t[101]*100+"",n;return{c(){e=m("option"),n=T(l),e.__value=t[101]*100,e.value=e.__value},m(i,o){M(i,e,o),s(e,n)},p:fe,d(i){i&&C(e)}}}function ff(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),r(l,"name","mek"),r(l,"type","text"),r(l,"class","in-s")},m(o,a){M(o,e,a),M(o,l,a),te(l,t[3].m.e.k),n||(i=ee(l,"input",t[34]),n=!0)},p(o,a){a[0]&8&&l.value!==o[3].m.e.k&&te(l,o[3].m.e.k)},d(o){o&&C(e),o&&C(l),n=!1,i()}}}function cf(t){let e,l,n,i,o,a,u;return{c(){e=m("div"),l=T("Authentication key"),n=m("br"),i=h(),o=m("input"),r(o,"name","mea"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),te(o,t[3].m.e.a),a||(u=ee(o,"input",t[35]),a=!0)},p(c,f){f[0]&8&&o.value!==c[3].m.e.a&&te(o,c[3].m.e.a)},d(c){c&&C(e),a=!1,u()}}}function mf(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,w,$,N,E,B,P,L,O,F,x,j;return{c(){e=m("div"),l=m("div"),n=T("Watt"),i=m("br"),o=h(),a=m("input"),u=h(),c=m("div"),f=T("Volt"),_=m("br"),p=h(),b=m("input"),v=h(),d=m("div"),S=T("Amp"),w=m("br"),$=h(),N=m("input"),E=h(),B=m("div"),P=T("kWh"),L=m("br"),O=h(),F=m("input"),r(a,"name","mmw"),r(a,"type","number"),r(a,"min","0.00"),r(a,"max","1000"),r(a,"step","0.001"),r(a,"class","in-f tr w-full"),r(l,"class","w-1/4"),r(b,"name","mmv"),r(b,"type","number"),r(b,"min","0.00"),r(b,"max","1000"),r(b,"step","0.001"),r(b,"class","in-m tr w-full"),r(c,"class","w-1/4"),r(N,"name","mma"),r(N,"type","number"),r(N,"min","0.00"),r(N,"max","1000"),r(N,"step","0.001"),r(N,"class","in-m tr w-full"),r(d,"class","w-1/4"),r(F,"name","mmc"),r(F,"type","number"),r(F,"min","0.00"),r(F,"max","1000"),r(F,"step","0.001"),r(F,"class","in-l tr w-full"),r(B,"class","w-1/4"),r(e,"class","flex my-1")},m(z,G){M(z,e,G),s(e,l),s(l,n),s(l,i),s(l,o),s(l,a),te(a,t[3].m.m.w),s(e,u),s(e,c),s(c,f),s(c,_),s(c,p),s(c,b),te(b,t[3].m.m.v),s(e,v),s(e,d),s(d,S),s(d,w),s(d,$),s(d,N),te(N,t[3].m.m.a),s(e,E),s(e,B),s(B,P),s(B,L),s(B,O),s(B,F),te(F,t[3].m.m.c),x||(j=[ee(a,"input",t[37]),ee(b,"input",t[38]),ee(N,"input",t[39]),ee(F,"input",t[40])],x=!0)},p(z,G){G[0]&8&&he(a.value)!==z[3].m.m.w&&te(a,z[3].m.m.w),G[0]&8&&he(b.value)!==z[3].m.m.v&&te(b,z[3].m.m.v),G[0]&8&&he(N.value)!==z[3].m.m.a&&te(N,z[3].m.m.a),G[0]&8&&he(F.value)!==z[3].m.m.c&&te(F,z[3].m.m.c)},d(z){z&&C(e),x=!1,ze(j)}}}function pf(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,w;return{c(){e=m("div"),l=T("Gateway"),n=m("br"),i=h(),o=m("input"),a=h(),u=m("div"),c=T("DNS"),f=m("br"),_=h(),p=m("div"),b=m("input"),v=h(),d=m("input"),r(o,"name","ng"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1"),r(b,"name","nd1"),r(b,"type","text"),r(b,"class","in-f w-full"),r(d,"name","nd2"),r(d,"type","text"),r(d,"class","in-l w-full"),r(p,"class","flex"),r(u,"class","my-1")},m($,N){M($,e,N),s(e,l),s(e,n),s(e,i),s(e,o),te(o,t[3].n.g),M($,a,N),M($,u,N),s(u,c),s(u,f),s(u,_),s(u,p),s(p,b),te(b,t[3].n.d1),s(p,v),s(p,d),te(d,t[3].n.d2),S||(w=[ee(o,"input",t[49]),ee(b,"input",t[50]),ee(d,"input",t[51])],S=!0)},p($,N){N[0]&8&&o.value!==$[3].n.g&&te(o,$[3].n.g),N[0]&8&&b.value!==$[3].n.d1&&te(b,$[3].n.d1),N[0]&8&&d.value!==$[3].n.d2&&te(d,$[3].n.d2)},d($){$&&C(e),$&&C(a),$&&C(u),S=!1,ze(w)}}}function _f(t){let e,l,n,i,o;return{c(){e=m("label"),l=m("input"),n=T(" SSL"),r(l,"type","checkbox"),r(l,"name","qs"),l.__value="true",l.value=l.__value,r(l,"class","rounded mb-1"),r(e,"class","float-right mr-3")},m(a,u){M(a,e,u),s(e,l),l.checked=t[3].q.s.e,s(e,n),i||(o=[ee(l,"change",t[55]),ee(l,"change",t[14])],i=!0)},p(a,u){u[0]&8&&(l.checked=a[3].q.s.e)},d(a){a&&C(e),i=!1,ze(o)}}}function df(t){let e,l,n,i,o,a,u,c,f,_,p,b,v;const d=[up,ap],S=[];function w(O,F){return O[3].q.s.c?0:1}n=w(t),i=S[n]=d[n](t);const $=[pp,mp],N=[];function E(O,F){return O[3].q.s.r?0:1}u=E(t),c=N[u]=$[u](t);const B=[hp,vp],P=[];function L(O,F){return O[3].q.s.k?0:1}return p=L(t),b=P[p]=B[p](t),{c(){e=m("div"),l=m("span"),i.c(),o=h(),a=m("span"),c.c(),f=h(),_=m("span"),b.c(),r(l,"class","flex pr-2"),r(a,"class","flex pr-2"),r(_,"class","flex pr-2"),r(e,"class","my-1 flex")},m(O,F){M(O,e,F),s(e,l),S[n].m(l,null),s(e,o),s(e,a),N[u].m(a,null),s(e,f),s(e,_),P[p].m(_,null),v=!0},p(O,F){let x=n;n=w(O),n===x?S[n].p(O,F):(De(),q(S[x],1,1,()=>{S[x]=null}),Ie(),i=S[n],i?i.p(O,F):(i=S[n]=d[n](O),i.c()),D(i,1),i.m(l,null));let j=u;u=E(O),u===j?N[u].p(O,F):(De(),q(N[j],1,1,()=>{N[j]=null}),Ie(),c=N[u],c?c.p(O,F):(c=N[u]=$[u](O),c.c()),D(c,1),c.m(a,null));let z=p;p=L(O),p===z?P[p].p(O,F):(De(),q(P[z],1,1,()=>{P[z]=null}),Ie(),b=P[p],b?b.p(O,F):(b=P[p]=B[p](O),b.c()),D(b,1),b.m(_,null))},i(O){v||(D(i),D(c),D(b),v=!0)},o(O){q(i),q(c),q(b),v=!1},d(O){O&&C(e),S[n].d(),N[u].d(),P[p].d()}}}function ap(t){let e,l;return e=new el({props:{to:"/mqtt-ca",$$slots:{default:[fp]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i[3]&16384&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function up(t){let e,l,n,i,o,a,u,c;return l=new el({props:{to:"/mqtt-ca",$$slots:{default:[cp]},$$scope:{ctx:t}}}),o=new To({}),{c(){e=m("span"),ie(l.$$.fragment),n=h(),i=m("span"),ie(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,_){M(f,e,_),le(l,e,null),M(f,n,_),M(f,i,_),le(o,i,null),a=!0,u||(c=[ee(i,"click",t[11]),ee(i,"keypress",t[11])],u=!0)},p(f,_){const p={};_[3]&16384&&(p.$$scope={dirty:_,ctx:f}),l.$set(p)},i(f){a||(D(l.$$.fragment,f),D(o.$$.fragment,f),a=!0)},o(f){q(l.$$.fragment,f),q(o.$$.fragment,f),a=!1},d(f){f&&C(e),ne(l),f&&C(n),f&&C(i),ne(o),u=!1,ze(c)}}}function fp(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload CA",title:"Click here to upload CA"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function cp(t){let e;return{c(){e=T("CA OK")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function mp(t){let e,l;return e=new el({props:{to:"/mqtt-cert",$$slots:{default:[_p]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i[3]&16384&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function pp(t){let e,l,n,i,o,a,u,c;return l=new el({props:{to:"/mqtt-cert",$$slots:{default:[dp]},$$scope:{ctx:t}}}),o=new To({}),{c(){e=m("span"),ie(l.$$.fragment),n=h(),i=m("span"),ie(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,_){M(f,e,_),le(l,e,null),M(f,n,_),M(f,i,_),le(o,i,null),a=!0,u||(c=[ee(i,"click",t[12]),ee(i,"keypress",t[12])],u=!0)},p(f,_){const p={};_[3]&16384&&(p.$$scope={dirty:_,ctx:f}),l.$set(p)},i(f){a||(D(l.$$.fragment,f),D(o.$$.fragment,f),a=!0)},o(f){q(l.$$.fragment,f),q(o.$$.fragment,f),a=!1},d(f){f&&C(e),ne(l),f&&C(n),f&&C(i),ne(o),u=!1,ze(c)}}}function _p(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload cert",title:"Click here to upload certificate"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function dp(t){let e;return{c(){e=T("Cert OK")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function vp(t){let e,l;return e=new el({props:{to:"/mqtt-key",$$slots:{default:[bp]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i[3]&16384&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function hp(t){let e,l,n,i,o,a,u,c;return l=new el({props:{to:"/mqtt-key",$$slots:{default:[gp]},$$scope:{ctx:t}}}),o=new To({}),{c(){e=m("span"),ie(l.$$.fragment),n=h(),i=m("span"),ie(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,_){M(f,e,_),le(l,e,null),M(f,n,_),M(f,i,_),le(o,i,null),a=!0,u||(c=[ee(i,"click",t[13]),ee(i,"keypress",t[13])],u=!0)},p(f,_){const p={};_[3]&16384&&(p.$$scope={dirty:_,ctx:f}),l.$set(p)},i(f){a||(D(l.$$.fragment,f),D(o.$$.fragment,f),a=!0)},o(f){q(l.$$.fragment,f),q(o.$$.fragment,f),a=!1},d(f){f&&C(e),ne(l),f&&C(n),f&&C(i),ne(o),u=!1,ze(c)}}}function bp(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload key",title:"Click here to upload key"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function gp(t){let e;return{c(){e=T("Key OK")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function vf(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,w,$,N,E,B,P,L,O,F,x,j,z,G,V,W,U,K;return o=new Bt({}),{c(){e=m("div"),l=m("strong"),l.textContent="Domoticz",n=h(),i=m("a"),ie(o.$$.fragment),a=h(),u=m("input"),c=h(),f=m("div"),_=m("div"),p=T("Electricity IDX"),b=m("br"),v=h(),d=m("input"),S=h(),w=m("div"),$=T("Current IDX"),N=m("br"),E=h(),B=m("input"),P=h(),L=m("div"),O=T(`Voltage IDX: L1, L2 & L3 - `),F=m("div"),x=m("input"),j=h(),z=m("input"),G=h(),V=m("input"),r(l,"class","text-sm"),r(i,"href",Ut("MQTT-configuration#domoticz")),r(i,"target","_blank"),r(i,"class","float-right"),r(u,"type","hidden"),r(u,"name","o"),u.value="true",r(d,"name","oe"),r(d,"type","text"),r(d,"class","in-f tr w-full"),r(_,"class","w-1/2"),r(B,"name","oc"),r(B,"type","text"),r(B,"class","in-l tr w-full"),r(w,"class","w-1/2"),r(f,"class","my-1 flex"),r(x,"name","ou1"),r(x,"type","text"),r(x,"class","in-f tr w-1/3"),r(z,"name","ou2"),r(z,"type","text"),r(z,"class","in-m tr w-1/3"),r(V,"name","ou3"),r(V,"type","text"),r(V,"class","in-l tr w-1/3"),r(F,"class","flex"),r(L,"class","my-1"),r(e,"class","cnt")},m(H,Y){M(H,e,Y),s(e,l),s(e,n),s(e,i),le(o,i,null),s(e,a),s(e,u),s(e,c),s(e,f),s(f,_),s(_,p),s(_,b),s(_,v),s(_,d),te(d,t[3].o.e),s(f,S),s(f,w),s(w,$),s(w,N),s(w,E),s(w,B),te(B,t[3].o.c),s(e,P),s(e,L),s(L,O),s(L,F),s(F,x),te(x,t[3].o.u1),s(F,j),s(F,z),te(z,t[3].o.u2),s(F,G),s(F,V),te(V,t[3].o.u3),W=!0,U||(K=[ee(d,"input",t[63]),ee(B,"input",t[64]),ee(x,"input",t[65]),ee(z,"input",t[66]),ee(V,"input",t[67])],U=!0)},p(H,Y){Y[0]&8&&d.value!==H[3].o.e&&te(d,H[3].o.e),Y[0]&8&&B.value!==H[3].o.c&&te(B,H[3].o.c),Y[0]&8&&x.value!==H[3].o.u1&&te(x,H[3].o.u1),Y[0]&8&&z.value!==H[3].o.u2&&te(z,H[3].o.u2),Y[0]&8&&V.value!==H[3].o.u3&&te(V,H[3].o.u3)},i(H){W||(D(o.$$.fragment,H),W=!0)},o(H){q(o.$$.fragment,H),W=!1},d(H){H&&C(e),ne(o),U=!1,ze(K)}}}function hf(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,w,$,N,E,B,P,L,O,F,x,j,z,G,V;return o=new Bt({}),{c(){e=m("div"),l=m("strong"),l.textContent="Home-Assistant",n=h(),i=m("a"),ie(o.$$.fragment),a=h(),u=m("input"),c=h(),f=m("div"),_=T("Discovery topic prefix"),p=m("br"),b=h(),v=m("input"),d=h(),S=m("div"),w=T("Hostname for URL"),$=m("br"),N=h(),E=m("input"),P=h(),L=m("div"),O=T("Name tag"),F=m("br"),x=h(),j=m("input"),r(l,"class","text-sm"),r(i,"href",Ut("MQTT-configuration#home-assistant")),r(i,"target","_blank"),r(i,"class","float-right"),r(u,"type","hidden"),r(u,"name","h"),u.value="true",r(v,"name","ht"),r(v,"type","text"),r(v,"class","in-s"),r(v,"placeholder","homeassistant"),r(f,"class","my-1"),r(E,"name","hh"),r(E,"type","text"),r(E,"class","in-s"),r(E,"placeholder",B=t[3].g.h+".local"),r(S,"class","my-1"),r(j,"name","hn"),r(j,"type","text"),r(j,"class","in-s"),r(L,"class","my-1"),r(e,"class","cnt")},m(W,U){M(W,e,U),s(e,l),s(e,n),s(e,i),le(o,i,null),s(e,a),s(e,u),s(e,c),s(e,f),s(f,_),s(f,p),s(f,b),s(f,v),te(v,t[3].h.t),s(e,d),s(e,S),s(S,w),s(S,$),s(S,N),s(S,E),te(E,t[3].h.h),s(e,P),s(e,L),s(L,O),s(L,F),s(L,x),s(L,j),te(j,t[3].h.n),z=!0,G||(V=[ee(v,"input",t[68]),ee(E,"input",t[69]),ee(j,"input",t[70])],G=!0)},p(W,U){U[0]&8&&v.value!==W[3].h.t&&te(v,W[3].h.t),(!z||U[0]&8&&B!==(B=W[3].g.h+".local"))&&r(E,"placeholder",B),U[0]&8&&E.value!==W[3].h.h&&te(E,W[3].h.h),U[0]&8&&j.value!==W[3].h.n&&te(j,W[3].h.n)},i(W){z||(D(o.$$.fragment,W),z=!0)},o(W){q(o.$$.fragment,W),z=!1},d(W){W&&C(e),ne(o),G=!1,ze(V)}}}function bf(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d=t[3].c.es&&gf(t);return{c(){e=m("div"),l=m("input"),n=h(),i=m("strong"),i.textContent="Cloud connections",o=h(),a=m("div"),u=m("label"),c=m("input"),f=T(" Energy Speedometer"),_=h(),d&&d.c(),r(l,"type","hidden"),r(l,"name","c"),l.value="true",r(i,"class","text-sm"),r(c,"type","checkbox"),r(c,"class","rounded mb-1"),r(c,"name","ces"),c.__value="true",c.value=c.__value,r(a,"class","my-1"),r(e,"class","cnt")},m(S,w){M(S,e,w),s(e,l),s(e,n),s(e,i),s(e,o),s(e,a),s(a,u),s(u,c),c.checked=t[3].c.es,s(u,f),s(a,_),d&&d.m(a,null),p=!0,b||(v=ee(c,"change",t[71]),b=!0)},p(S,w){w[0]&8&&(c.checked=S[3].c.es),S[3].c.es?d?(d.p(S,w),w[0]&8&&D(d,1)):(d=gf(S),d.c(),D(d,1),d.m(a,null)):d&&(De(),q(d,1,1,()=>{d=null}),Ie())},i(S){p||(D(d),p=!0)},o(S){q(d),p=!1},d(S){S&&C(e),d&&d.d(),b=!1,v()}}}function gf(t){let e,l,n=t[0].mac+"",i,o,a,u,c=(t[0].meter.id?t[0].meter.id:"missing, required")+"",f,_,p,b,v=t[0].mac&&t[0].meter.id&&kf(t);return{c(){e=m("div"),l=T("MAC: "),i=T(n),o=h(),a=m("div"),u=T("Meter ID: "),f=T(c),_=h(),v&&v.c(),p=Ve(),r(e,"class","pl-5"),r(a,"class","pl-5")},m(d,S){M(d,e,S),s(e,l),s(e,i),M(d,o,S),M(d,a,S),s(a,u),s(a,f),M(d,_,S),v&&v.m(d,S),M(d,p,S),b=!0},p(d,S){(!b||S[0]&1)&&n!==(n=d[0].mac+"")&&X(i,n),(!b||S[0]&1)&&c!==(c=(d[0].meter.id?d[0].meter.id:"missing, required")+"")&&X(f,c),d[0].mac&&d[0].meter.id?v?(v.p(d,S),S[0]&1&&D(v,1)):(v=kf(d),v.c(),D(v,1),v.m(p.parentNode,p)):v&&(De(),q(v,1,1,()=>{v=null}),Ie())},i(d){b||(D(v),b=!0)},o(d){q(v),b=!1},d(d){d&&C(e),d&&C(o),d&&C(a),d&&C(_),v&&v.d(d),d&&C(p)}}}function kf(t){let e,l,n;return l=new np({props:{value:'{"mac":"'+t[0].mac+'","meter":"'+t[0].meter.id+'"}'}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","pl-2")},m(i,o){M(i,e,o),le(l,e,null),n=!0},p(i,o){const a={};o[0]&1&&(a.value='{"mac":"'+i[0].mac+'","meter":"'+i[0].meter.id+'"}'),l.$set(a)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function wf(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,w,$,N,E;o=new Bt({});let B={length:9},P=[];for(let L=0;L20&&$f(t),_=t[0].chip=="esp8266"&&Nf(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Hardware",n=h(),i=m("a"),ie(o.$$.fragment),a=h(),f&&f.c(),u=h(),_&&_.c(),r(l,"class","text-sm"),r(i,"href",Ut("GPIO-configuration")),r(i,"target","_blank"),r(i,"class","float-right"),r(e,"class","cnt")},m(p,b){M(p,e,b),s(e,l),s(e,n),s(e,i),le(o,i,null),s(e,a),f&&f.m(e,null),s(e,u),_&&_.m(e,null),c=!0},p(p,b){p[0].board>20?f?(f.p(p,b),b[0]&1&&D(f,1)):(f=$f(p),f.c(),D(f,1),f.m(e,u)):f&&(De(),q(f,1,1,()=>{f=null}),Ie()),p[0].chip=="esp8266"?_?_.p(p,b):(_=Nf(p),_.c(),_.m(e,null)):_&&(_.d(1),_=null)},i(p){c||(D(o.$$.fragment,p),D(f),c=!0)},o(p){q(o.$$.fragment,p),q(f),c=!1},d(p){p&&C(e),ne(o),f&&f.d(),_&&_.d()}}}function $f(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,w,$,N,E,B,P,L,O,F,x,j,z,G,V,W,U,K,H,Y,Z,re,ue,ke,me,Se,je,Re,He,we,Te,Le,Me,y,g,k,A,I,Q,J,se,ce,ve,$e,oe;b=new Qc({props:{chip:t[0].chip}});let pe=t[0].chip!="esp8266"&&Sf(t),Be=t[3].i.v.p>0&&Tf(t);return{c(){e=m("input"),l=h(),n=m("div"),i=m("div"),o=T("HAN"),a=m("label"),u=m("input"),c=T(" pullup"),f=m("br"),_=h(),p=m("select"),ie(b.$$.fragment),v=h(),d=m("div"),S=T("AP button"),w=m("br"),$=h(),N=m("input"),E=h(),B=m("div"),P=T("LED"),L=m("label"),O=m("input"),F=T(" inv"),x=m("br"),j=h(),z=m("div"),G=m("input"),V=h(),W=m("div"),U=T("RGB"),K=m("label"),H=m("input"),Y=T(" inverted"),Z=m("br"),re=h(),ue=m("div"),ke=m("input"),me=h(),Se=m("input"),je=h(),Re=m("input"),He=h(),we=m("div"),Te=T("Temperature"),Le=m("br"),Me=h(),y=m("input"),g=h(),k=m("div"),A=T("Analog temp"),I=m("br"),Q=h(),J=m("input"),se=h(),pe&&pe.c(),ce=h(),Be&&Be.c(),r(e,"type","hidden"),r(e,"name","i"),e.value="true",r(u,"name","ihu"),u.__value="true",u.value=u.__value,r(u,"type","checkbox"),r(u,"class","rounded mb-1"),r(a,"class","ml-2"),r(p,"name","ihp"),r(p,"class","in-f w-full"),t[3].i.h.p===void 0&&Qe(()=>t[76].call(p)),r(i,"class","w-1/3"),r(N,"name","ia"),r(N,"type","number"),r(N,"min","0"),r(N,"max",t[6]),r(N,"class","in-m tr w-full"),r(d,"class","w-1/3"),r(O,"name","ili"),O.__value="true",O.value=O.__value,r(O,"type","checkbox"),r(O,"class","rounded mb-1"),r(L,"class","ml-4"),r(G,"name","ilp"),r(G,"type","number"),r(G,"min","0"),r(G,"max",t[6]),r(G,"class","in-l tr w-full"),r(z,"class","flex"),r(B,"class","w-1/3"),r(H,"name","iri"),H.__value="true",H.value=H.__value,r(H,"type","checkbox"),r(H,"class","rounded mb-1"),r(K,"class","ml-4"),r(ke,"name","irr"),r(ke,"type","number"),r(ke,"min","0"),r(ke,"max",t[6]),r(ke,"class","in-f tr w-1/3"),r(Se,"name","irg"),r(Se,"type","number"),r(Se,"min","0"),r(Se,"max",t[6]),r(Se,"class","in-m tr w-1/3"),r(Re,"name","irb"),r(Re,"type","number"),r(Re,"min","0"),r(Re,"max",t[6]),r(Re,"class","in-l tr w-1/3"),r(ue,"class","flex"),r(W,"class","w-full"),r(y,"name","itd"),r(y,"type","number"),r(y,"min","0"),r(y,"max",t[6]),r(y,"class","in-f tr w-full"),r(we,"class","my-1 w-1/3"),r(J,"name","ita"),r(J,"type","number"),r(J,"min","0"),r(J,"max",t[6]),r(J,"class","in-l tr w-full"),r(k,"class","my-1 pr-1 w-1/3"),r(n,"class","flex flex-wrap")},m(_e,ye){M(_e,e,ye),M(_e,l,ye),M(_e,n,ye),s(n,i),s(i,o),s(i,a),s(a,u),u.checked=t[3].i.h.u,s(a,c),s(i,f),s(i,_),s(i,p),le(b,p,null),qe(p,t[3].i.h.p,!0),s(n,v),s(n,d),s(d,S),s(d,w),s(d,$),s(d,N),te(N,t[3].i.a),s(n,E),s(n,B),s(B,P),s(B,L),s(L,O),O.checked=t[3].i.l.i,s(L,F),s(B,x),s(B,j),s(B,z),s(z,G),te(G,t[3].i.l.p),s(n,V),s(n,W),s(W,U),s(W,K),s(K,H),H.checked=t[3].i.r.i,s(K,Y),s(W,Z),s(W,re),s(W,ue),s(ue,ke),te(ke,t[3].i.r.r),s(ue,me),s(ue,Se),te(Se,t[3].i.r.g),s(ue,je),s(ue,Re),te(Re,t[3].i.r.b),s(n,He),s(n,we),s(we,Te),s(we,Le),s(we,Me),s(we,y),te(y,t[3].i.t.d),s(n,g),s(n,k),s(k,A),s(k,I),s(k,Q),s(k,J),te(J,t[3].i.t.a),s(n,se),pe&&pe.m(n,null),s(n,ce),Be&&Be.m(n,null),ve=!0,$e||(oe=[ee(u,"change",t[75]),ee(p,"change",t[76]),ee(N,"input",t[77]),ee(O,"change",t[78]),ee(G,"input",t[79]),ee(H,"change",t[80]),ee(ke,"input",t[81]),ee(Se,"input",t[82]),ee(Re,"input",t[83]),ee(y,"input",t[84]),ee(J,"input",t[85])],$e=!0)},p(_e,ye){ye[0]&8&&(u.checked=_e[3].i.h.u);const vt={};ye[0]&1&&(vt.chip=_e[0].chip),b.$set(vt),ye[0]&8&&qe(p,_e[3].i.h.p),(!ve||ye[0]&64)&&r(N,"max",_e[6]),ye[0]&8&&he(N.value)!==_e[3].i.a&&te(N,_e[3].i.a),ye[0]&8&&(O.checked=_e[3].i.l.i),(!ve||ye[0]&64)&&r(G,"max",_e[6]),ye[0]&8&&he(G.value)!==_e[3].i.l.p&&te(G,_e[3].i.l.p),ye[0]&8&&(H.checked=_e[3].i.r.i),(!ve||ye[0]&64)&&r(ke,"max",_e[6]),ye[0]&8&&he(ke.value)!==_e[3].i.r.r&&te(ke,_e[3].i.r.r),(!ve||ye[0]&64)&&r(Se,"max",_e[6]),ye[0]&8&&he(Se.value)!==_e[3].i.r.g&&te(Se,_e[3].i.r.g),(!ve||ye[0]&64)&&r(Re,"max",_e[6]),ye[0]&8&&he(Re.value)!==_e[3].i.r.b&&te(Re,_e[3].i.r.b),(!ve||ye[0]&64)&&r(y,"max",_e[6]),ye[0]&8&&he(y.value)!==_e[3].i.t.d&&te(y,_e[3].i.t.d),(!ve||ye[0]&64)&&r(J,"max",_e[6]),ye[0]&8&&he(J.value)!==_e[3].i.t.a&&te(J,_e[3].i.t.a),_e[0].chip!="esp8266"?pe?pe.p(_e,ye):(pe=Sf(_e),pe.c(),pe.m(n,ce)):pe&&(pe.d(1),pe=null),_e[3].i.v.p>0?Be?Be.p(_e,ye):(Be=Tf(_e),Be.c(),Be.m(n,null)):Be&&(Be.d(1),Be=null)},i(_e){ve||(D(b.$$.fragment,_e),ve=!0)},o(_e){q(b.$$.fragment,_e),ve=!1},d(_e){_e&&C(e),_e&&C(l),_e&&C(n),ne(b),pe&&pe.d(),Be&&Be.d(),$e=!1,ze(oe)}}}function Sf(t){let e,l,n,i,o,a,u;return{c(){e=m("div"),l=T("Vcc"),n=m("br"),i=h(),o=m("input"),r(o,"name","ivp"),r(o,"type","number"),r(o,"min","0"),r(o,"max",t[6]),r(o,"class","in-s tr w-full"),r(e,"class","my-1 pl-1 w-1/3")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),te(o,t[3].i.v.p),a||(u=ee(o,"input",t[86]),a=!0)},p(c,f){f[0]&64&&r(o,"max",c[6]),f[0]&8&&he(o.value)!==c[3].i.v.p&&te(o,c[3].i.v.p)},d(c){c&&C(e),a=!1,u()}}}function Tf(t){let e,l,n,i,o,a,u,c,f,_;return{c(){e=m("div"),l=T("Voltage divider"),n=m("br"),i=h(),o=m("div"),a=m("input"),u=h(),c=m("input"),r(a,"name","ivdv"),r(a,"type","number"),r(a,"min","0"),r(a,"max","65535"),r(a,"class","in-f tr w-full"),r(a,"placeholder","VCC"),r(c,"name","ivdg"),r(c,"type","number"),r(c,"min","0"),r(c,"max","65535"),r(c,"class","in-l tr w-full"),r(c,"placeholder","GND"),r(o,"class","flex"),r(e,"class","my-1")},m(p,b){M(p,e,b),s(e,l),s(e,n),s(e,i),s(e,o),s(o,a),te(a,t[3].i.v.d.v),s(o,u),s(o,c),te(c,t[3].i.v.d.g),f||(_=[ee(a,"input",t[87]),ee(c,"input",t[88])],f=!0)},p(p,b){b[0]&8&&he(a.value)!==p[3].i.v.d.v&&te(a,p[3].i.v.d.v),b[0]&8&&he(c.value)!==p[3].i.v.d.g&&te(c,p[3].i.v.d.g)},d(p){p&&C(e),f=!1,ze(_)}}}function Nf(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,w,$,N=(t[0].board==2||t[0].board==100)&&Af(t);return{c(){e=m("input"),l=h(),n=m("div"),i=m("div"),o=T("Vcc offset"),a=m("br"),u=h(),c=m("input"),f=h(),_=m("div"),p=T("Multiplier"),b=m("br"),v=h(),d=m("input"),S=h(),N&&N.c(),r(e,"type","hidden"),r(e,"name","iv"),e.value="true",r(c,"name","ivo"),r(c,"type","number"),r(c,"min","0.0"),r(c,"max","3.5"),r(c,"step","0.01"),r(c,"class","in-f tr w-full"),r(i,"class","w-1/3"),r(d,"name","ivm"),r(d,"type","number"),r(d,"min","0.1"),r(d,"max","10"),r(d,"step","0.01"),r(d,"class","in-l tr w-full"),r(_,"class","w-1/3 pr-1"),r(n,"class","my-1 flex flex-wrap")},m(E,B){M(E,e,B),M(E,l,B),M(E,n,B),s(n,i),s(i,o),s(i,a),s(i,u),s(i,c),te(c,t[3].i.v.o),s(n,f),s(n,_),s(_,p),s(_,b),s(_,v),s(_,d),te(d,t[3].i.v.m),s(n,S),N&&N.m(n,null),w||($=[ee(c,"input",t[89]),ee(d,"input",t[90])],w=!0)},p(E,B){B[0]&8&&he(c.value)!==E[3].i.v.o&&te(c,E[3].i.v.o),B[0]&8&&he(d.value)!==E[3].i.v.m&&te(d,E[3].i.v.m),E[0].board==2||E[0].board==100?N?N.p(E,B):(N=Af(E),N.c(),N.m(n,null)):N&&(N.d(1),N=null)},d(E){E&&C(e),E&&C(l),E&&C(n),N&&N.d(),w=!1,ze($)}}}function Af(t){let e,l,n,i,o,a,u;return{c(){e=m("div"),l=T("Boot limit"),n=m("br"),i=h(),o=m("input"),r(o,"name","ivb"),r(o,"type","number"),r(o,"min","2.5"),r(o,"max","3.5"),r(o,"step","0.1"),r(o,"class","in-s tr w-full"),r(e,"class","w-1/3 pl-1")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),te(o,t[3].i.v.b),a||(u=ee(o,"input",t[91]),a=!0)},p(c,f){f[0]&8&&he(o.value)!==c[3].i.v.b&&te(o,c[3].i.v.b)},d(c){c&&C(e),a=!1,u()}}}function Pf(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,w,$=t[3].d.t&&Ef();return{c(){e=m("div"),e.textContent="Debug can cause sudden reboots. Do not leave on!",l=h(),n=m("div"),i=m("label"),o=m("input"),a=T(" Enable telnet"),u=h(),$&&$.c(),c=h(),f=m("div"),_=m("select"),p=m("option"),p.textContent="Verbose",b=m("option"),b.textContent="Debug",v=m("option"),v.textContent="Info",d=m("option"),d.textContent="Warning",r(e,"class","bd-red"),r(o,"type","checkbox"),r(o,"name","dt"),o.__value="true",o.value=o.__value,r(o,"class","rounded mb-1"),r(n,"class","my-1"),p.__value=1,p.value=p.__value,b.__value=2,b.value=b.__value,v.__value=3,v.value=v.__value,d.__value=4,d.value=d.__value,r(_,"name","dl"),r(_,"class","in-s"),t[3].d.l===void 0&&Qe(()=>t[94].call(_)),r(f,"class","my-1")},m(N,E){M(N,e,E),M(N,l,E),M(N,n,E),s(n,i),s(i,o),o.checked=t[3].d.t,s(i,a),M(N,u,E),$&&$.m(N,E),M(N,c,E),M(N,f,E),s(f,_),s(_,p),s(_,b),s(_,v),s(_,d),qe(_,t[3].d.l,!0),S||(w=[ee(o,"change",t[93]),ee(_,"change",t[94])],S=!0)},p(N,E){E[0]&8&&(o.checked=N[3].d.t),N[3].d.t?$||($=Ef(),$.c(),$.m(c.parentNode,c)):$&&($.d(1),$=null),E[0]&8&&qe(_,N[3].d.l)},d(N){N&&C(e),N&&C(l),N&&C(n),N&&C(u),$&&$.d(N),N&&C(c),N&&C(f),S=!1,ze(w)}}}function Ef(t){let e;return{c(){e=m("div"),e.textContent="Telnet is unsafe and should be off when not in use",r(e,"class","bd-red")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function kp(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,w,$,N,E,B,P,L,O,F,x,j,z,G,V,W,U,K,H,Y,Z,re,ue,ke,me,Se,je,Re,He,we,Te,Le,Me,y,g,k,A,I,Q,J,se,ce,ve,$e,oe,pe,Be,_e,ye,vt,Hl,tl,ct,Tl,pl,Ht,ht,Xe,Ze,Je,Ue,xe,We,et,tt,de,Ce,Ei,_l,_n,Tt,Di,Ii,Ri,dl,Li,Oi,Fi,Nt,Nl,Al,Pl,qi,Ge,Ae,vl,Ts,El,Rt,Bi,Wl,Ao,ll,Ui,Po,Ns,Eo,ci,Wt,Do,Io,Dl,nl,Il,Ro,ji,Lo,pt,Rl,Oo,Hi,dn,vn,hn,bn,Wi,Fo,At,zi,qo,zl,Bo,Uo,jo,il,gn,kn,Ho,wn,Gl,Wo,zo,Go,yn,zt,Vo,Gi,Ko,Vl,Yo,Qo,Xo,Cn,Gt,Zo,Vi,Jo,As,xo,Kl,Ki,Vt,er,tr,lr,Ps,Yi,Kt,nr,ir,sr,mt,Qi,or,Mn,$n,rr,mi,ar,Yl,ur,fr,cr,hl,mr,Ql,pr,_r,dr,bl,vr,Sn,Xl,hr,br,gr,Lt,Tn,Nn,An,Pn,kr,Zl,wr,yr,Cr,En,Ot,Mr,Xi,$r,Zi,Ji,Yt,Sr,Tr,ut,xi,Nr,Dn,In,Ar,Jl,Pr,Er,Dr,Ll,sl,Rn,Ln,Ir,Pt,es,ts,Rr,Et,On,ls,ns,Lr,Es,is,ss,Qt,Or,Fr,pi,qr,Ol,Br,_i,Xt,Ur,jr,Hr,os,gl,Wr,Ye,rs,zr,Fn,qn,Gr,di,Vr,ol,Kr,Ds,Yr,Qr,Bn,kl,Xr,Zt,Zr,Is,xl,Jr,xr,ea,wl,ta,en,la,na,ia,yl,sa,Un,jn,oa,ra,aa,Cl,ua,Hn,fa,ca,ma,bt,Wn,zn,Gn,Vn,Kn,Yn,pa,tn,_a,da,va,Ml,ha,Rs,Ls,Os,Fs=t[3].p.r.startsWith("10YNO")||t[3].p.r.startsWith("10Y1001A1001A4"),qs,rl,as,ba,Qn,Xn,ga,vi,ka,hi,wa,Bs,Dt,us,ya,Zn,Jn,Ca,bi,Ma,fs,cs,Jt,$a,Sa,Ta,Fl,Us,xn,Na,ms,ei,Aa,ps,js,ln,Hs,nn,Ws,sn,zs,on,Ft,Gs,Pa;u=new Bt({}),F=new Xm({});let Jc=["NOK","SEK","DKK","EUR"],gi=[];for(let R=0;R<4;R+=1)gi[R]=op(sp(t,Jc,R));let gt=t[3].p.e&&t[0].chip!="esp8266"&&af(t),kt=t[3].g.s>0&&uf(t);Rt=new Bt({});let xc=[24,48,96,192,384,576,1152],ki=[];for(let R=0;R<7;R+=1)ki[R]=rp(ip(t,xc,R));let wt=t[3].m.e.e&&ff(t),yt=t[3].m.e.e&&cf(t),Ct=t[3].m.m.e&&mf(t);$n=new Bt({}),In=new Bt({}),On=new Xc({});let Mt=t[3].n.m=="static"&&pf(t);qn=new Bt({});let $t=t[0].chip!="esp8266"&&_f(t),lt=t[3].q.s.e&&df(t),nt=t[3].q.m==3&&vf(t),it=t[3].q.m==4&&hf(t),st=t[3].c.es!=null&&bf(t),ot=Fs&&wf(t);Xn=new Bt({});let ti=t[7],_t=[];for(let R=0;R20||t[0].chip=="esp8266")&&Mf(t);Jn=new Bt({});let St=t[3].d.s&&Pf(t);return ln=new It({props:{active:t[1],message:"Loading configuration"}}),nn=new It({props:{active:t[2],message:"Saving configuration"}}),sn=new It({props:{active:t[4],message:"Performing factory reset"}}),on=new It({props:{active:t[5],message:"Device have been factory reset and switched to AP mode"}}),{c(){e=m("form"),l=m("div"),n=m("div"),i=m("strong"),i.textContent="General",o=h(),a=m("a"),ie(u.$$.fragment),c=h(),f=m("input"),_=h(),p=m("div"),b=m("div"),v=m("div"),d=T("Hostname"),S=m("br"),w=h(),$=m("input"),N=h(),E=m("div"),B=T("Time zone"),P=m("br"),L=h(),O=m("select"),ie(F.$$.fragment),x=h(),j=m("input"),z=h(),G=m("div"),V=m("div"),W=m("div"),U=T("Price region"),K=m("br"),H=h(),Y=m("select"),Z=m("optgroup"),re=m("option"),re.textContent="NO1",ue=m("option"),ue.textContent="NO2",ke=m("option"),ke.textContent="NO3",me=m("option"),me.textContent="NO4",Se=m("option"),Se.textContent="NO5",je=m("optgroup"),Re=m("option"),Re.textContent="SE1",He=m("option"),He.textContent="SE2",we=m("option"),we.textContent="SE3",Te=m("option"),Te.textContent="SE4",Le=m("optgroup"),Me=m("option"),Me.textContent="DK1",y=m("option"),y.textContent="DK2",g=m("option"),g.textContent="Austria",k=m("option"),k.textContent="Belgium",A=m("option"),A.textContent="Czech Republic",I=m("option"),I.textContent="Estonia",Q=m("option"),Q.textContent="Finland",J=m("option"),J.textContent="France",se=m("option"),se.textContent="Germany",ce=m("option"),ce.textContent="Great Britain",ve=m("option"),ve.textContent="Latvia",$e=m("option"),$e.textContent="Lithuania",oe=m("option"),oe.textContent="Netherland",pe=m("option"),pe.textContent="Poland",Be=m("option"),Be.textContent="Switzerland",_e=h(),ye=m("div"),vt=T("Currency"),Hl=m("br"),tl=h(),ct=m("select");for(let R=0;R<4;R+=1)gi[R].c();Tl=h(),pl=m("div"),Ht=m("div"),ht=m("div"),Xe=T("Fixed price"),Ze=m("br"),Je=h(),Ue=m("input"),xe=h(),We=m("div"),et=T("Multiplier"),tt=m("br"),de=h(),Ce=m("input"),Ei=h(),_l=m("div"),_n=m("label"),Tt=m("input"),Di=T(" Enable price fetch from remote server"),Ii=h(),gt&>.c(),Ri=h(),dl=m("div"),Li=T("Security"),Oi=m("br"),Fi=h(),Nt=m("select"),Nl=m("option"),Nl.textContent="None",Al=m("option"),Al.textContent="Only configuration",Pl=m("option"),Pl.textContent="Everything",qi=h(),kt&&kt.c(),Ge=h(),Ae=m("div"),vl=m("strong"),vl.textContent="Meter",Ts=h(),El=m("a"),ie(Rt.$$.fragment),Bi=h(),Wl=m("input"),Ao=h(),ll=m("div"),Ui=m("span"),Ui.textContent="Buffer size",Po=h(),Ns=m("span"),Ns.textContent="Serial conf.",Eo=h(),ci=m("label"),Wt=m("input"),Do=T(" inverted"),Io=h(),Dl=m("div"),nl=m("select"),Il=m("option"),Ro=T("Autodetect");for(let R=0;R<7;R+=1)ki[R].c();Lo=h(),pt=m("select"),Rl=m("option"),Oo=T("-"),dn=m("option"),dn.textContent="7N1",vn=m("option"),vn.textContent="8N1",hn=m("option"),hn.textContent="7E1",bn=m("option"),bn.textContent="8E1",Fo=h(),At=m("input"),qo=h(),zl=m("div"),Bo=T("Voltage"),Uo=m("br"),jo=h(),il=m("select"),gn=m("option"),gn.textContent="400V (TN)",kn=m("option"),kn.textContent="230V (IT/TT)",Ho=h(),wn=m("div"),Gl=m("div"),Wo=T("Main fuse"),zo=m("br"),Go=h(),yn=m("label"),zt=m("input"),Vo=h(),Gi=m("span"),Gi.textContent="A",Ko=h(),Vl=m("div"),Yo=T("Production"),Qo=m("br"),Xo=h(),Cn=m("label"),Gt=m("input"),Zo=h(),Vi=m("span"),Vi.textContent="kWp",Jo=h(),As=m("div"),xo=h(),Kl=m("div"),Ki=m("label"),Vt=m("input"),er=T(" Meter is encrypted"),tr=h(),wt&&wt.c(),lr=h(),yt&&yt.c(),Ps=h(),Yi=m("label"),Kt=m("input"),nr=T(" Multipliers"),ir=h(),Ct&&Ct.c(),sr=h(),mt=m("div"),Qi=m("strong"),Qi.textContent="WiFi",or=h(),Mn=m("a"),ie($n.$$.fragment),rr=h(),mi=m("input"),ar=h(),Yl=m("div"),ur=T("SSID"),fr=m("br"),cr=h(),hl=m("input"),mr=h(),Ql=m("div"),pr=T("Password"),_r=m("br"),dr=h(),bl=m("input"),vr=h(),Sn=m("div"),Xl=m("div"),hr=T("Power saving"),br=m("br"),gr=h(),Lt=m("select"),Tn=m("option"),Tn.textContent="Default",Nn=m("option"),Nn.textContent="Off",An=m("option"),An.textContent="Minimum",Pn=m("option"),Pn.textContent="Maximum",kr=h(),Zl=m("div"),wr=T("Power"),yr=m("br"),Cr=h(),En=m("div"),Ot=m("input"),Mr=h(),Xi=m("span"),Xi.textContent="dBm",$r=h(),Zi=m("div"),Ji=m("label"),Yt=m("input"),Sr=T(" Allow 802.11b legacy rates"),Tr=h(),ut=m("div"),xi=m("strong"),xi.textContent="Network",Nr=h(),Dn=m("a"),ie(In.$$.fragment),Ar=h(),Jl=m("div"),Pr=T("IP"),Er=m("br"),Dr=h(),Ll=m("div"),sl=m("select"),Rn=m("option"),Rn.textContent="DHCP",Ln=m("option"),Ln.textContent="Static",Ir=h(),Pt=m("input"),Rr=h(),Et=m("select"),ie(On.$$.fragment),Lr=h(),Mt&&Mt.c(),Es=h(),is=m("div"),ss=m("label"),Qt=m("input"),Or=T(" enable mDNS"),Fr=h(),pi=m("input"),qr=h(),Ol=m("div"),Br=T("NTP "),_i=m("label"),Xt=m("input"),Ur=T(" obtain from DHCP"),jr=m("br"),Hr=h(),os=m("div"),gl=m("input"),Wr=h(),Ye=m("div"),rs=m("strong"),rs.textContent="MQTT",zr=h(),Fn=m("a"),ie(qn.$$.fragment),Gr=h(),di=m("input"),Vr=h(),ol=m("div"),Kr=T(`Server - `),$t&&$t.c(),Ds=h(),Yr=m("br"),Qr=h(),Bn=m("div"),kl=m("input"),Xr=h(),Zt=m("input"),Zr=h(),lt&<.c(),Is=h(),xl=m("div"),Jr=T("Username"),xr=m("br"),ea=h(),wl=m("input"),ta=h(),en=m("div"),la=T("Password"),na=m("br"),ia=h(),yl=m("input"),sa=h(),Un=m("div"),jn=m("div"),oa=T("Client ID"),ra=m("br"),aa=h(),Cl=m("input"),ua=h(),Hn=m("div"),fa=T("Payload"),ca=m("br"),ma=h(),bt=m("select"),Wn=m("option"),Wn.textContent="JSON",zn=m("option"),zn.textContent="Raw (minimal)",Gn=m("option"),Gn.textContent="Raw (full)",Vn=m("option"),Vn.textContent="Domoticz",Kn=m("option"),Kn.textContent="HomeAssistant",Yn=m("option"),Yn.textContent="HEX dump",pa=h(),tn=m("div"),_a=T("Publish topic"),da=m("br"),va=h(),Ml=m("input"),ha=h(),nt&&nt.c(),Rs=h(),it&&it.c(),Ls=h(),st&&st.c(),Os=h(),ot&&ot.c(),qs=h(),rl=m("div"),as=m("strong"),as.textContent="User interface",ba=h(),Qn=m("a"),ie(Xn.$$.fragment),ga=h(),vi=m("input"),ka=h(),hi=m("div");for(let R=0;R<_t.length;R+=1)_t[R].c();wa=h(),rt&&rt.c(),Bs=h(),Dt=m("div"),us=m("strong"),us.textContent="Debugging",ya=h(),Zn=m("a"),ie(Jn.$$.fragment),Ca=h(),bi=m("input"),Ma=h(),fs=m("div"),cs=m("label"),Jt=m("input"),$a=T(" Enable debugging"),Sa=h(),St&&St.c(),Ta=h(),Fl=m("div"),Us=m("div"),xn=m("button"),xn.textContent="Factory reset",Na=h(),ms=m("div"),ei=m("button"),ei.textContent="Reboot",Aa=h(),ps=m("div"),ps.innerHTML='',js=h(),ie(ln.$$.fragment),Hs=h(),ie(nn.$$.fragment),Ws=h(),ie(sn.$$.fragment),zs=h(),ie(on.$$.fragment),r(i,"class","text-sm"),r(a,"href",Ut("General-configuration")),r(a,"target","_blank"),r(a,"class","float-right"),r(f,"type","hidden"),r(f,"name","g"),f.value="true",r($,"name","gh"),r($,"type","text"),r($,"class","in-f w-full"),r($,"pattern","[A-Za-z0-9-]+"),r(O,"name","gt"),r(O,"class","in-l w-full"),t[3].g.t===void 0&&Qe(()=>t[16].call(O)),r(b,"class","flex"),r(p,"class","my-1"),r(j,"type","hidden"),r(j,"name","p"),j.value="true",re.__value="10YNO-1--------2",re.value=re.__value,ue.__value="10YNO-2--------T",ue.value=ue.__value,ke.__value="10YNO-3--------J",ke.value=ke.__value,me.__value="10YNO-4--------9",me.value=me.__value,Se.__value="10Y1001A1001A48H",Se.value=Se.__value,r(Z,"label","Norway"),Re.__value="10Y1001A1001A44P",Re.value=Re.__value,He.__value="10Y1001A1001A45N",He.value=He.__value,we.__value="10Y1001A1001A46L",we.value=we.__value,Te.__value="10Y1001A1001A47J",Te.value=Te.__value,r(je,"label","Sweden"),Me.__value="10YDK-1--------W",Me.value=Me.__value,y.__value="10YDK-2--------M",y.value=y.__value,r(Le,"label","Denmark"),g.__value="10YAT-APG------L",g.value=g.__value,k.__value="10YBE----------2",k.value=k.__value,A.__value="10YCZ-CEPS-----N",A.value=A.__value,I.__value="10Y1001A1001A39I",I.value=I.__value,Q.__value="10YFI-1--------U",Q.value=Q.__value,J.__value="10YFR-RTE------C",J.value=J.__value,se.__value="10Y1001A1001A83F",se.value=se.__value,ce.__value="10YGB----------A",ce.value=ce.__value,ve.__value="10YLV-1001A00074",ve.value=ve.__value,$e.__value="10YLT-1001A0008Q",$e.value=$e.__value,oe.__value="10YNL----------L",oe.value=oe.__value,pe.__value="10YPL-AREA-----S",pe.value=pe.__value,Be.__value="10YCH-SWISSGRIDZ",Be.value=Be.__value,r(Y,"name","pr"),r(Y,"class","in-f w-full"),t[3].p.r===void 0&&Qe(()=>t[17].call(Y)),r(W,"class","w-full"),r(ct,"name","pc"),r(ct,"class","in-l"),t[3].p.c===void 0&&Qe(()=>t[18].call(ct)),r(V,"class","flex"),r(G,"class","my-1"),r(Ue,"name","pf"),r(Ue,"type","number"),r(Ue,"min","0.001"),r(Ue,"max","65"),r(Ue,"step","0.001"),r(Ue,"class","in-f tr w-full"),r(ht,"class","w-1/2"),r(Ce,"name","pm"),r(Ce,"type","number"),r(Ce,"min","0.001"),r(Ce,"max","1000"),r(Ce,"step","0.001"),r(Ce,"class","in-l tr w-full"),r(We,"class","w-1/2"),r(Ht,"class","flex"),r(pl,"class","my-1"),r(Tt,"type","checkbox"),r(Tt,"name","pe"),Tt.__value="true",Tt.value=Tt.__value,r(Tt,"class","rounded mb-1"),r(_l,"class","my-1"),Nl.__value=0,Nl.value=Nl.__value,Al.__value=1,Al.value=Al.__value,Pl.__value=2,Pl.value=Pl.__value,r(Nt,"name","gs"),r(Nt,"class","in-s"),t[3].g.s===void 0&&Qe(()=>t[23].call(Nt)),r(dl,"class","my-1"),r(n,"class","cnt"),r(vl,"class","text-sm"),r(El,"href",Ut("Meter-configuration")),r(El,"target","_blank"),r(El,"class","float-right"),r(Wl,"type","hidden"),r(Wl,"name","m"),Wl.value="true",r(Ui,"class","float-right"),r(Wt,"name","mi"),Wt.__value="true",Wt.value=Wt.__value,r(Wt,"type","checkbox"),r(Wt,"class","rounded mb-1"),r(ci,"class","mt-2 ml-3 whitespace-nowrap"),Il.__value=0,Il.value=Il.__value,Il.disabled=ji=t[3].m.b!=0,r(nl,"name","mb"),r(nl,"class","in-f tr w-1/2"),t[3].m.b===void 0&&Qe(()=>t[27].call(nl)),Rl.__value=0,Rl.value=Rl.__value,Rl.disabled=Hi=t[3].m.b!=0,dn.__value=2,dn.value=dn.__value,vn.__value=3,vn.value=vn.__value,hn.__value=10,hn.value=hn.__value,bn.__value=11,bn.value=bn.__value,r(pt,"name","mp"),r(pt,"class","in-m"),pt.disabled=Wi=t[3].m.b==0,t[3].m.p===void 0&&Qe(()=>t[28].call(pt)),r(At,"name","ms"),r(At,"type","number"),r(At,"min",64),r(At,"max",zi=t[0].chip=="esp8266"?t[3].i.h.p==3||t[3].i.h.p==113?512:128:4096),r(At,"step",64),r(At,"class","in-l tr w-1/2"),r(Dl,"class","flex w-full"),r(ll,"class","my-1"),gn.__value=2,gn.value=gn.__value,kn.__value=1,kn.value=kn.__value,r(il,"name","md"),r(il,"class","in-s"),t[3].m.d===void 0&&Qe(()=>t[30].call(il)),r(zl,"class","my-1"),r(zt,"name","mf"),r(zt,"type","number"),r(zt,"min","5"),r(zt,"max","65535"),r(zt,"class","in-f tr w-full"),r(Gi,"class","in-post"),r(yn,"class","flex"),r(Gl,"class","mx-1"),r(Gt,"name","mr"),r(Gt,"type","number"),r(Gt,"min","0"),r(Gt,"max","65535"),r(Gt,"class","in-f tr w-full"),r(Vi,"class","in-post"),r(Cn,"class","flex"),r(Vl,"class","mx-1"),r(wn,"class","my-1 flex"),r(As,"class","my-1"),r(Vt,"type","checkbox"),r(Vt,"name","me"),Vt.__value="true",Vt.value=Vt.__value,r(Vt,"class","rounded mb-1"),r(Kl,"class","my-1"),r(Kt,"type","checkbox"),r(Kt,"name","mm"),Kt.__value="true",Kt.value=Kt.__value,r(Kt,"class","rounded mb-1"),r(Ae,"class","cnt"),r(Qi,"class","text-sm"),r(Mn,"href",Ut("WiFi-configuration")),r(Mn,"target","_blank"),r(Mn,"class","float-right"),r(mi,"type","hidden"),r(mi,"name","w"),mi.value="true",r(hl,"name","ws"),r(hl,"type","text"),r(hl,"class","in-s"),r(Yl,"class","my-1"),r(bl,"name","wp"),r(bl,"type","password"),r(bl,"class","in-s"),r(Ql,"class","my-1"),Tn.__value=255,Tn.value=Tn.__value,Nn.__value=0,Nn.value=Nn.__value,An.__value=1,An.value=An.__value,Pn.__value=2,Pn.value=Pn.__value,r(Lt,"name","wz"),r(Lt,"class","in-s"),t[3].w.z===void 0&&Qe(()=>t[43].call(Lt)),r(Xl,"class","w-1/2"),r(Ot,"name","ww"),r(Ot,"type","number"),r(Ot,"min","0"),r(Ot,"max","20.5"),r(Ot,"step","0.5"),r(Ot,"class","in-f tr w-full"),r(Xi,"class","in-post"),r(En,"class","flex"),r(Zl,"class","ml-2 w-1/2"),r(Sn,"class","my-1 flex"),r(Yt,"type","checkbox"),r(Yt,"name","wb"),Yt.__value="true",Yt.value=Yt.__value,r(Yt,"class","rounded mb-1"),r(Zi,"class","my-3"),r(mt,"class","cnt"),r(xi,"class","text-sm"),r(Dn,"href",Ut("Network-configuration")),r(Dn,"target","_blank"),r(Dn,"class","float-right"),Rn.__value="dhcp",Rn.value=Rn.__value,Ln.__value="static",Ln.value=Ln.__value,r(sl,"name","nm"),r(sl,"class","in-f"),t[3].n.m===void 0&&Qe(()=>t[46].call(sl)),r(Pt,"name","ni"),r(Pt,"type","text"),r(Pt,"class","in-m w-full"),Pt.disabled=es=t[3].n.m=="dhcp",Pt.required=ts=t[3].n.m=="static",r(Et,"name","ns"),r(Et,"class","in-l"),Et.disabled=ls=t[3].n.m=="dhcp",Et.required=ns=t[3].n.m=="static",t[3].n.s===void 0&&Qe(()=>t[48].call(Et)),r(Ll,"class","flex"),r(Jl,"class","my-1"),r(Qt,"name","nd"),Qt.__value="true",Qt.value=Qt.__value,r(Qt,"type","checkbox"),r(Qt,"class","rounded mb-1"),r(is,"class","my-1"),r(pi,"type","hidden"),r(pi,"name","ntp"),pi.value="true",r(Xt,"name","ntpd"),Xt.__value="true",Xt.value=Xt.__value,r(Xt,"type","checkbox"),r(Xt,"class","rounded mb-1"),r(_i,"class","ml-4"),r(gl,"name","ntph"),r(gl,"type","text"),r(gl,"class","in-s"),r(os,"class","flex"),r(Ol,"class","my-1"),r(ut,"class","cnt"),r(rs,"class","text-sm"),r(Fn,"href",Ut("MQTT-configuration")),r(Fn,"target","_blank"),r(Fn,"class","float-right"),r(di,"type","hidden"),r(di,"name","q"),di.value="true",r(kl,"name","qh"),r(kl,"type","text"),r(kl,"class","in-f w-3/4"),r(Zt,"name","qp"),r(Zt,"type","number"),r(Zt,"min","1024"),r(Zt,"max","65535"),r(Zt,"class","in-l tr w-1/4"),r(Bn,"class","flex"),r(ol,"class","my-1"),r(wl,"name","qu"),r(wl,"type","text"),r(wl,"class","in-s"),r(xl,"class","my-1"),r(yl,"name","qa"),r(yl,"type","password"),r(yl,"class","in-s"),r(en,"class","my-1"),r(Cl,"name","qc"),r(Cl,"type","text"),r(Cl,"class","in-f w-full"),Wn.__value=0,Wn.value=Wn.__value,zn.__value=1,zn.value=zn.__value,Gn.__value=2,Gn.value=Gn.__value,Vn.__value=3,Vn.value=Vn.__value,Kn.__value=4,Kn.value=Kn.__value,Yn.__value=255,Yn.value=Yn.__value,r(bt,"name","qm"),r(bt,"class","in-l"),t[3].q.m===void 0&&Qe(()=>t[61].call(bt)),r(Un,"class","my-1 flex"),r(Ml,"name","qb"),r(Ml,"type","text"),r(Ml,"class","in-s"),r(tn,"class","my-1"),r(Ye,"class","cnt"),r(as,"class","text-sm"),r(Qn,"href",Ut("User-interface")),r(Qn,"target","_blank"),r(Qn,"class","float-right"),r(vi,"type","hidden"),r(vi,"name","u"),vi.value="true",r(hi,"class","flex flex-wrap"),r(rl,"class","cnt"),r(us,"class","text-sm"),r(Zn,"href","https://amsleser.no/blog/post/24-telnet-debug"),r(Zn,"target","_blank"),r(Zn,"class","float-right"),r(bi,"type","hidden"),r(bi,"name","d"),bi.value="true",r(Jt,"type","checkbox"),r(Jt,"name","ds"),Jt.__value="true",Jt.value=Jt.__value,r(Jt,"class","rounded mb-1"),r(fs,"class","mt-3"),r(Dt,"class","cnt"),r(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),r(xn,"type","button"),r(xn,"class","py-2 px-4 rounded bg-red-500 text-white ml-2"),r(ei,"type","button"),r(ei,"class","py-2 px-4 rounded bg-yellow-500 text-white"),r(ms,"class","text-center"),r(ps,"class","text-right"),r(Fl,"class","grid grid-cols-3"),r(e,"autocomplete","off")},m(R,ae){M(R,e,ae),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),le(u,a,null),s(n,c),s(n,f),s(n,_),s(n,p),s(p,b),s(b,v),s(v,d),s(v,S),s(v,w),s(v,$),te($,t[3].g.h),s(b,N),s(b,E),s(E,B),s(E,P),s(E,L),s(E,O),le(F,O,null),qe(O,t[3].g.t,!0),s(n,x),s(n,j),s(n,z),s(n,G),s(G,V),s(V,W),s(W,U),s(W,K),s(W,H),s(W,Y),s(Y,Z),s(Z,re),s(Z,ue),s(Z,ke),s(Z,me),s(Z,Se),s(Y,je),s(je,Re),s(je,He),s(je,we),s(je,Te),s(Y,Le),s(Le,Me),s(Le,y),s(Y,g),s(Y,k),s(Y,A),s(Y,I),s(Y,Q),s(Y,J),s(Y,se),s(Y,ce),s(Y,ve),s(Y,$e),s(Y,oe),s(Y,pe),s(Y,Be),qe(Y,t[3].p.r,!0),s(V,_e),s(V,ye),s(ye,vt),s(ye,Hl),s(ye,tl),s(ye,ct);for(let ft=0;ft<4;ft+=1)gi[ft]&&gi[ft].m(ct,null);qe(ct,t[3].p.c,!0),s(n,Tl),s(n,pl),s(pl,Ht),s(Ht,ht),s(ht,Xe),s(ht,Ze),s(ht,Je),s(ht,Ue),te(Ue,t[3].p.f),s(Ht,xe),s(Ht,We),s(We,et),s(We,tt),s(We,de),s(We,Ce),te(Ce,t[3].p.m),s(n,Ei),s(n,_l),s(_l,_n),s(_n,Tt),Tt.checked=t[3].p.e,s(_n,Di),s(_l,Ii),gt&>.m(_l,null),s(n,Ri),s(n,dl),s(dl,Li),s(dl,Oi),s(dl,Fi),s(dl,Nt),s(Nt,Nl),s(Nt,Al),s(Nt,Pl),qe(Nt,t[3].g.s,!0),s(n,qi),kt&&kt.m(n,null),s(l,Ge),s(l,Ae),s(Ae,vl),s(Ae,Ts),s(Ae,El),le(Rt,El,null),s(Ae,Bi),s(Ae,Wl),s(Ae,Ao),s(Ae,ll),s(ll,Ui),s(ll,Po),s(ll,Ns),s(ll,Eo),s(ll,ci),s(ci,Wt),Wt.checked=t[3].m.i,s(ci,Do),s(ll,Io),s(ll,Dl),s(Dl,nl),s(nl,Il),s(Il,Ro);for(let ft=0;ft<7;ft+=1)ki[ft]&&ki[ft].m(nl,null);qe(nl,t[3].m.b,!0),s(Dl,Lo),s(Dl,pt),s(pt,Rl),s(Rl,Oo),s(pt,dn),s(pt,vn),s(pt,hn),s(pt,bn),qe(pt,t[3].m.p,!0),s(Dl,Fo),s(Dl,At),te(At,t[3].m.s),s(Ae,qo),s(Ae,zl),s(zl,Bo),s(zl,Uo),s(zl,jo),s(zl,il),s(il,gn),s(il,kn),qe(il,t[3].m.d,!0),s(Ae,Ho),s(Ae,wn),s(wn,Gl),s(Gl,Wo),s(Gl,zo),s(Gl,Go),s(Gl,yn),s(yn,zt),te(zt,t[3].m.f),s(yn,Vo),s(yn,Gi),s(wn,Ko),s(wn,Vl),s(Vl,Yo),s(Vl,Qo),s(Vl,Xo),s(Vl,Cn),s(Cn,Gt),te(Gt,t[3].m.r),s(Cn,Zo),s(Cn,Vi),s(Ae,Jo),s(Ae,As),s(Ae,xo),s(Ae,Kl),s(Kl,Ki),s(Ki,Vt),Vt.checked=t[3].m.e.e,s(Ki,er),s(Kl,tr),wt&&wt.m(Kl,null),s(Ae,lr),yt&&yt.m(Ae,null),s(Ae,Ps),s(Ae,Yi),s(Yi,Kt),Kt.checked=t[3].m.m.e,s(Yi,nr),s(Ae,ir),Ct&&Ct.m(Ae,null),s(l,sr),s(l,mt),s(mt,Qi),s(mt,or),s(mt,Mn),le($n,Mn,null),s(mt,rr),s(mt,mi),s(mt,ar),s(mt,Yl),s(Yl,ur),s(Yl,fr),s(Yl,cr),s(Yl,hl),te(hl,t[3].w.s),s(mt,mr),s(mt,Ql),s(Ql,pr),s(Ql,_r),s(Ql,dr),s(Ql,bl),te(bl,t[3].w.p),s(mt,vr),s(mt,Sn),s(Sn,Xl),s(Xl,hr),s(Xl,br),s(Xl,gr),s(Xl,Lt),s(Lt,Tn),s(Lt,Nn),s(Lt,An),s(Lt,Pn),qe(Lt,t[3].w.z,!0),s(Sn,kr),s(Sn,Zl),s(Zl,wr),s(Zl,yr),s(Zl,Cr),s(Zl,En),s(En,Ot),te(Ot,t[3].w.w),s(En,Mr),s(En,Xi),s(mt,$r),s(mt,Zi),s(Zi,Ji),s(Ji,Yt),Yt.checked=t[3].w.b,s(Ji,Sr),s(l,Tr),s(l,ut),s(ut,xi),s(ut,Nr),s(ut,Dn),le(In,Dn,null),s(ut,Ar),s(ut,Jl),s(Jl,Pr),s(Jl,Er),s(Jl,Dr),s(Jl,Ll),s(Ll,sl),s(sl,Rn),s(sl,Ln),qe(sl,t[3].n.m,!0),s(Ll,Ir),s(Ll,Pt),te(Pt,t[3].n.i),s(Ll,Rr),s(Ll,Et),le(On,Et,null),qe(Et,t[3].n.s,!0),s(ut,Lr),Mt&&Mt.m(ut,null),s(ut,Es),s(ut,is),s(is,ss),s(ss,Qt),Qt.checked=t[3].n.d,s(ss,Or),s(ut,Fr),s(ut,pi),s(ut,qr),s(ut,Ol),s(Ol,Br),s(Ol,_i),s(_i,Xt),Xt.checked=t[3].n.h,s(_i,Ur),s(Ol,jr),s(Ol,Hr),s(Ol,os),s(os,gl),te(gl,t[3].n.n1),s(l,Wr),s(l,Ye),s(Ye,rs),s(Ye,zr),s(Ye,Fn),le(qn,Fn,null),s(Ye,Gr),s(Ye,di),s(Ye,Vr),s(Ye,ol),s(ol,Kr),$t&&$t.m(ol,null),s(ol,Ds),s(ol,Yr),s(ol,Qr),s(ol,Bn),s(Bn,kl),te(kl,t[3].q.h),s(Bn,Xr),s(Bn,Zt),te(Zt,t[3].q.p),s(Ye,Zr),lt&<.m(Ye,null),s(Ye,Is),s(Ye,xl),s(xl,Jr),s(xl,xr),s(xl,ea),s(xl,wl),te(wl,t[3].q.u),s(Ye,ta),s(Ye,en),s(en,la),s(en,na),s(en,ia),s(en,yl),te(yl,t[3].q.a),s(Ye,sa),s(Ye,Un),s(Un,jn),s(jn,oa),s(jn,ra),s(jn,aa),s(jn,Cl),te(Cl,t[3].q.c),s(Un,ua),s(Un,Hn),s(Hn,fa),s(Hn,ca),s(Hn,ma),s(Hn,bt),s(bt,Wn),s(bt,zn),s(bt,Gn),s(bt,Vn),s(bt,Kn),s(bt,Yn),qe(bt,t[3].q.m,!0),s(Ye,pa),s(Ye,tn),s(tn,_a),s(tn,da),s(tn,va),s(tn,Ml),te(Ml,t[3].q.b),s(l,ha),nt&&nt.m(l,null),s(l,Rs),it&&it.m(l,null),s(l,Ls),st&&st.m(l,null),s(l,Os),ot&&ot.m(l,null),s(l,qs),s(l,rl),s(rl,as),s(rl,ba),s(rl,Qn),le(Xn,Qn,null),s(rl,ga),s(rl,vi),s(rl,ka),s(rl,hi);for(let ft=0;ft<_t.length;ft+=1)_t[ft]&&_t[ft].m(hi,null);s(l,wa),rt&&rt.m(l,null),s(l,Bs),s(l,Dt),s(Dt,us),s(Dt,ya),s(Dt,Zn),le(Jn,Zn,null),s(Dt,Ca),s(Dt,bi),s(Dt,Ma),s(Dt,fs),s(fs,cs),s(cs,Jt),Jt.checked=t[3].d.s,s(cs,$a),s(Dt,Sa),St&&St.m(Dt,null),s(e,Ta),s(e,Fl),s(Fl,Us),s(Us,xn),s(Fl,Na),s(Fl,ms),s(ms,ei),s(Fl,Aa),s(Fl,ps),M(R,js,ae),le(ln,R,ae),M(R,Hs,ae),le(nn,R,ae),M(R,Ws,ae),le(sn,R,ae),M(R,zs,ae),le(on,R,ae),Ft=!0,Gs||(Pa=[ee($,"input",t[15]),ee(O,"change",t[16]),ee(Y,"change",t[17]),ee(ct,"change",t[18]),ee(Ue,"input",t[19]),ee(Ce,"input",t[20]),ee(Tt,"change",t[21]),ee(Nt,"change",t[23]),ee(Wt,"change",t[26]),ee(nl,"change",t[27]),ee(pt,"change",t[28]),ee(At,"input",t[29]),ee(il,"change",t[30]),ee(zt,"input",t[31]),ee(Gt,"input",t[32]),ee(Vt,"change",t[33]),ee(Kt,"change",t[36]),ee(hl,"input",t[41]),ee(bl,"input",t[42]),ee(Lt,"change",t[43]),ee(Ot,"input",t[44]),ee(Yt,"change",t[45]),ee(sl,"change",t[46]),ee(Pt,"input",t[47]),ee(Et,"change",t[48]),ee(Qt,"change",t[52]),ee(Xt,"change",t[53]),ee(gl,"input",t[54]),ee(kl,"input",t[56]),ee(Zt,"input",t[57]),ee(wl,"input",t[58]),ee(yl,"input",t[59]),ee(Cl,"input",t[60]),ee(bt,"change",t[61]),ee(Ml,"input",t[62]),ee(Jt,"change",t[92]),ee(xn,"click",t[8]),ee(ei,"click",t[10]),ee(e,"submit",$s(t[9]))],Gs=!0)},p(R,ae){if(ae[0]&8&&$.value!==R[3].g.h&&te($,R[3].g.h),ae[0]&8&&qe(O,R[3].g.t),ae[0]&8&&qe(Y,R[3].p.r),ae[0]&8&&qe(ct,R[3].p.c),ae[0]&8&&he(Ue.value)!==R[3].p.f&&te(Ue,R[3].p.f),ae[0]&8&&he(Ce.value)!==R[3].p.m&&te(Ce,R[3].p.m),ae[0]&8&&(Tt.checked=R[3].p.e),R[3].p.e&&R[0].chip!="esp8266"?gt?gt.p(R,ae):(gt=af(R),gt.c(),gt.m(_l,null)):gt&&(gt.d(1),gt=null),ae[0]&8&&qe(Nt,R[3].g.s),R[3].g.s>0?kt?kt.p(R,ae):(kt=uf(R),kt.c(),kt.m(n,null)):kt&&(kt.d(1),kt=null),ae[0]&8&&(Wt.checked=R[3].m.i),(!Ft||ae[0]&8&&ji!==(ji=R[3].m.b!=0))&&(Il.disabled=ji),ae[0]&8&&qe(nl,R[3].m.b),(!Ft||ae[0]&8&&Hi!==(Hi=R[3].m.b!=0))&&(Rl.disabled=Hi),(!Ft||ae[0]&8&&Wi!==(Wi=R[3].m.b==0))&&(pt.disabled=Wi),ae[0]&8&&qe(pt,R[3].m.p),(!Ft||ae[0]&9&&zi!==(zi=R[0].chip=="esp8266"?R[3].i.h.p==3||R[3].i.h.p==113?512:128:4096))&&r(At,"max",zi),ae[0]&8&&he(At.value)!==R[3].m.s&&te(At,R[3].m.s),ae[0]&8&&qe(il,R[3].m.d),ae[0]&8&&he(zt.value)!==R[3].m.f&&te(zt,R[3].m.f),ae[0]&8&&he(Gt.value)!==R[3].m.r&&te(Gt,R[3].m.r),ae[0]&8&&(Vt.checked=R[3].m.e.e),R[3].m.e.e?wt?wt.p(R,ae):(wt=ff(R),wt.c(),wt.m(Kl,null)):wt&&(wt.d(1),wt=null),R[3].m.e.e?yt?yt.p(R,ae):(yt=cf(R),yt.c(),yt.m(Ae,Ps)):yt&&(yt.d(1),yt=null),ae[0]&8&&(Kt.checked=R[3].m.m.e),R[3].m.m.e?Ct?Ct.p(R,ae):(Ct=mf(R),Ct.c(),Ct.m(Ae,null)):Ct&&(Ct.d(1),Ct=null),ae[0]&8&&hl.value!==R[3].w.s&&te(hl,R[3].w.s),ae[0]&8&&bl.value!==R[3].w.p&&te(bl,R[3].w.p),ae[0]&8&&qe(Lt,R[3].w.z),ae[0]&8&&he(Ot.value)!==R[3].w.w&&te(Ot,R[3].w.w),ae[0]&8&&(Yt.checked=R[3].w.b),ae[0]&8&&qe(sl,R[3].n.m),(!Ft||ae[0]&8&&es!==(es=R[3].n.m=="dhcp"))&&(Pt.disabled=es),(!Ft||ae[0]&8&&ts!==(ts=R[3].n.m=="static"))&&(Pt.required=ts),ae[0]&8&&Pt.value!==R[3].n.i&&te(Pt,R[3].n.i),(!Ft||ae[0]&8&&ls!==(ls=R[3].n.m=="dhcp"))&&(Et.disabled=ls),(!Ft||ae[0]&8&&ns!==(ns=R[3].n.m=="static"))&&(Et.required=ns),ae[0]&8&&qe(Et,R[3].n.s),R[3].n.m=="static"?Mt?Mt.p(R,ae):(Mt=pf(R),Mt.c(),Mt.m(ut,Es)):Mt&&(Mt.d(1),Mt=null),ae[0]&8&&(Qt.checked=R[3].n.d),ae[0]&8&&(Xt.checked=R[3].n.h),ae[0]&8&&gl.value!==R[3].n.n1&&te(gl,R[3].n.n1),R[0].chip!="esp8266"?$t?$t.p(R,ae):($t=_f(R),$t.c(),$t.m(ol,Ds)):$t&&($t.d(1),$t=null),ae[0]&8&&kl.value!==R[3].q.h&&te(kl,R[3].q.h),ae[0]&8&&he(Zt.value)!==R[3].q.p&&te(Zt,R[3].q.p),R[3].q.s.e?lt?(lt.p(R,ae),ae[0]&8&&D(lt,1)):(lt=df(R),lt.c(),D(lt,1),lt.m(Ye,Is)):lt&&(De(),q(lt,1,1,()=>{lt=null}),Ie()),ae[0]&8&&wl.value!==R[3].q.u&&te(wl,R[3].q.u),ae[0]&8&&yl.value!==R[3].q.a&&te(yl,R[3].q.a),ae[0]&8&&Cl.value!==R[3].q.c&&te(Cl,R[3].q.c),ae[0]&8&&qe(bt,R[3].q.m),ae[0]&8&&Ml.value!==R[3].q.b&&te(Ml,R[3].q.b),R[3].q.m==3?nt?(nt.p(R,ae),ae[0]&8&&D(nt,1)):(nt=vf(R),nt.c(),D(nt,1),nt.m(l,Rs)):nt&&(De(),q(nt,1,1,()=>{nt=null}),Ie()),R[3].q.m==4?it?(it.p(R,ae),ae[0]&8&&D(it,1)):(it=hf(R),it.c(),D(it,1),it.m(l,Ls)):it&&(De(),q(it,1,1,()=>{it=null}),Ie()),R[3].c.es!=null?st?(st.p(R,ae),ae[0]&8&&D(st,1)):(st=bf(R),st.c(),D(st,1),st.m(l,Os)):st&&(De(),q(st,1,1,()=>{st=null}),Ie()),ae[0]&8&&(Fs=R[3].p.r.startsWith("10YNO")||R[3].p.r.startsWith("10Y1001A1001A4")),Fs?ot?(ot.p(R,ae),ae[0]&8&&D(ot,1)):(ot=wf(R),ot.c(),D(ot,1),ot.m(l,qs)):ot&&(De(),q(ot,1,1,()=>{ot=null}),Ie()),ae[0]&136){ti=R[7];let qt;for(qt=0;qt20||R[0].chip=="esp8266"?rt?(rt.p(R,ae),ae[0]&1&&D(rt,1)):(rt=Mf(R),rt.c(),D(rt,1),rt.m(l,Bs)):rt&&(De(),q(rt,1,1,()=>{rt=null}),Ie()),ae[0]&8&&(Jt.checked=R[3].d.s),R[3].d.s?St?St.p(R,ae):(St=Pf(R),St.c(),St.m(Dt,null)):St&&(St.d(1),St=null);const ft={};ae[0]&2&&(ft.active=R[1]),ln.$set(ft);const Ea={};ae[0]&4&&(Ea.active=R[2]),nn.$set(Ea);const Da={};ae[0]&16&&(Da.active=R[4]),sn.$set(Da);const Ia={};ae[0]&32&&(Ia.active=R[5]),on.$set(Ia)},i(R){Ft||(D(u.$$.fragment,R),D(F.$$.fragment,R),D(Rt.$$.fragment,R),D($n.$$.fragment,R),D(In.$$.fragment,R),D(On.$$.fragment,R),D(qn.$$.fragment,R),D(lt),D(nt),D(it),D(st),D(ot),D(Xn.$$.fragment,R),D(rt),D(Jn.$$.fragment,R),D(ln.$$.fragment,R),D(nn.$$.fragment,R),D(sn.$$.fragment,R),D(on.$$.fragment,R),Ft=!0)},o(R){q(u.$$.fragment,R),q(F.$$.fragment,R),q(Rt.$$.fragment,R),q($n.$$.fragment,R),q(In.$$.fragment,R),q(On.$$.fragment,R),q(qn.$$.fragment,R),q(lt),q(nt),q(it),q(st),q(ot),q(Xn.$$.fragment,R),q(rt),q(Jn.$$.fragment,R),q(ln.$$.fragment,R),q(nn.$$.fragment,R),q(sn.$$.fragment,R),q(on.$$.fragment,R),Ft=!1},d(R){R&&C(e),ne(u),ne(F),cl(gi,R),gt&>.d(),kt&&kt.d(),ne(Rt),cl(ki,R),wt&&wt.d(),yt&&yt.d(),Ct&&Ct.d(),ne($n),ne(In),ne(On),Mt&&Mt.d(),ne(qn),$t&&$t.d(),lt&<.d(),nt&&nt.d(),it&&it.d(),st&&st.d(),ot&&ot.d(),ne(Xn),cl(_t,R),rt&&rt.d(),ne(Jn),St&&St.d(),R&&C(js),ne(ln,R),R&&C(Hs),ne(nn,R),R&&C(Ws),ne(sn,R),R&&C(zs),ne(on,R),Gs=!1,ze(Pa)}}}async function wp(){await(await fetch("/reboot",{method:"POST"})).json()}function yp(t,e,l){let{sysinfo:n={}}=e,i=[{name:"Import gauge",key:"i"},{name:"Export gauge",key:"e"},{name:"Voltage",key:"v"},{name:"Amperage",key:"a"},{name:"Reactive",key:"r"},{name:"Realtime",key:"c"},{name:"Peaks",key:"t"},{name:"Price",key:"p"},{name:"Day plot",key:"d"},{name:"Month plot",key:"m"},{name:"Temperature plot",key:"s"}],o=!0,a=!1,u={g:{t:"",h:"",s:0,u:"",p:""},m:{b:2400,p:11,i:!1,d:0,f:0,r:0,e:{e:!1,k:"",a:""},m:{e:!1,w:!1,v:!1,a:!1,c:!1}},w:{s:"",p:"",w:0,z:255,a:!0,b:!0},n:{m:"",i:"",s:"",g:"",d1:"",d2:"",d:!1,n1:"",n2:"",h:!1},q:{h:"",p:1883,u:"",a:"",b:"",s:{e:!1,c:!1,r:!0,k:!1}},o:{e:"",c:"",u1:"",u2:"",u3:""},t:{t:[0,0,0,0,0,0,0,0,0,0],h:1},p:{e:!1,t:"",r:"",c:"",m:1,f:null},d:{s:!1,t:!1,l:5},u:{i:0,e:0,v:0,a:0,r:0,c:0,t:0,p:0,d:0,m:0,s:0},i:{h:{p:null,u:!0},a:null,l:{p:null,i:!1},r:{r:null,g:null,b:null,i:!1},t:{d:null,a:null},v:{p:null,d:{v:null,g:null},o:null,m:null,b:null}},h:{t:"",h:"",n:""},c:{es:null}};Ci.subscribe(Ge=>{Ge.version&&(l(3,u=Ge),l(1,o=!1))}),jm();let c=!1,f=!1;async function _(){if(confirm("Are you sure you want to factory reset the device?")){l(4,c=!0);const Ge=new URLSearchParams;Ge.append("perform","true");let vl=await(await fetch("/reset",{method:"POST",body:Ge})).json();l(4,c=!1),l(5,f=vl.success)}}async function p(Ge){l(2,a=!0);const Ae=new FormData(Ge.target),vl=new URLSearchParams;for(let Rt of Ae){const[Bi,Wl]=Rt;vl.append(Bi,Wl)}let El=await(await fetch("/save",{method:"POST",body:vl})).json();jt.update(Rt=>(Rt.booting=El.reboot,Rt.ui=u.u,Rt)),l(2,a=!1),oi("/")}const b=function(){confirm("Are you sure you want to reboot the device?")&&(jt.update(Ge=>(Ge.booting=!0,Ge)),wp())};async function v(){confirm("Are you sure you want to delete CA?")&&(await(await fetch("/mqtt-ca",{method:"POST"})).text(),Ci.update(Ae=>(Ae.q.s.c=!1,Ae)))}async function d(){confirm("Are you sure you want to delete cert?")&&(await(await fetch("/mqtt-cert",{method:"POST"})).text(),Ci.update(Ae=>(Ae.q.s.r=!1,Ae)))}async function S(){confirm("Are you sure you want to delete key?")&&(await(await fetch("/mqtt-key",{method:"POST"})).text(),Ci.update(Ae=>(Ae.q.s.k=!1,Ae)))}const w=function(){u.q.s.e?u.q.p==1883&&l(3,u.q.p=8883,u):u.q.p==8883&&l(3,u.q.p=1883,u)};let $=44;function N(){u.g.h=this.value,l(3,u)}function E(){u.g.t=dt(this),l(3,u)}function B(){u.p.r=dt(this),l(3,u)}function P(){u.p.c=dt(this),l(3,u)}function L(){u.p.f=he(this.value),l(3,u)}function O(){u.p.m=he(this.value),l(3,u)}function F(){u.p.e=this.checked,l(3,u)}function x(){u.p.t=this.value,l(3,u)}function j(){u.g.s=dt(this),l(3,u)}function z(){u.g.u=this.value,l(3,u)}function G(){u.g.p=this.value,l(3,u)}function V(){u.m.i=this.checked,l(3,u)}function W(){u.m.b=dt(this),l(3,u)}function U(){u.m.p=dt(this),l(3,u)}function K(){u.m.s=he(this.value),l(3,u)}function H(){u.m.d=dt(this),l(3,u)}function Y(){u.m.f=he(this.value),l(3,u)}function Z(){u.m.r=he(this.value),l(3,u)}function re(){u.m.e.e=this.checked,l(3,u)}function ue(){u.m.e.k=this.value,l(3,u)}function ke(){u.m.e.a=this.value,l(3,u)}function me(){u.m.m.e=this.checked,l(3,u)}function Se(){u.m.m.w=he(this.value),l(3,u)}function je(){u.m.m.v=he(this.value),l(3,u)}function Re(){u.m.m.a=he(this.value),l(3,u)}function He(){u.m.m.c=he(this.value),l(3,u)}function we(){u.w.s=this.value,l(3,u)}function Te(){u.w.p=this.value,l(3,u)}function Le(){u.w.z=dt(this),l(3,u)}function Me(){u.w.w=he(this.value),l(3,u)}function y(){u.w.b=this.checked,l(3,u)}function g(){u.n.m=dt(this),l(3,u)}function k(){u.n.i=this.value,l(3,u)}function A(){u.n.s=dt(this),l(3,u)}function I(){u.n.g=this.value,l(3,u)}function Q(){u.n.d1=this.value,l(3,u)}function J(){u.n.d2=this.value,l(3,u)}function se(){u.n.d=this.checked,l(3,u)}function ce(){u.n.h=this.checked,l(3,u)}function ve(){u.n.n1=this.value,l(3,u)}function $e(){u.q.s.e=this.checked,l(3,u)}function oe(){u.q.h=this.value,l(3,u)}function pe(){u.q.p=he(this.value),l(3,u)}function Be(){u.q.u=this.value,l(3,u)}function _e(){u.q.a=this.value,l(3,u)}function ye(){u.q.c=this.value,l(3,u)}function vt(){u.q.m=dt(this),l(3,u)}function Hl(){u.q.b=this.value,l(3,u)}function tl(){u.o.e=this.value,l(3,u)}function ct(){u.o.c=this.value,l(3,u)}function Tl(){u.o.u1=this.value,l(3,u)}function pl(){u.o.u2=this.value,l(3,u)}function Ht(){u.o.u3=this.value,l(3,u)}function ht(){u.h.t=this.value,l(3,u)}function Xe(){u.h.h=this.value,l(3,u)}function Ze(){u.h.n=this.value,l(3,u)}function Je(){u.c.es=this.checked,l(3,u)}function Ue(Ge){u.t.t[Ge]=he(this.value),l(3,u)}function xe(){u.t.h=he(this.value),l(3,u)}function We(Ge){u.u[Ge.key]=dt(this),l(3,u)}function et(){u.i.h.u=this.checked,l(3,u)}function tt(){u.i.h.p=dt(this),l(3,u)}function de(){u.i.a=he(this.value),l(3,u)}function Ce(){u.i.l.i=this.checked,l(3,u)}function Ei(){u.i.l.p=he(this.value),l(3,u)}function _l(){u.i.r.i=this.checked,l(3,u)}function _n(){u.i.r.r=he(this.value),l(3,u)}function Tt(){u.i.r.g=he(this.value),l(3,u)}function Di(){u.i.r.b=he(this.value),l(3,u)}function Ii(){u.i.t.d=he(this.value),l(3,u)}function Ri(){u.i.t.a=he(this.value),l(3,u)}function dl(){u.i.v.p=he(this.value),l(3,u)}function Li(){u.i.v.d.v=he(this.value),l(3,u)}function Oi(){u.i.v.d.g=he(this.value),l(3,u)}function Fi(){u.i.v.o=he(this.value),l(3,u)}function Nt(){u.i.v.m=he(this.value),l(3,u)}function Nl(){u.i.v.b=he(this.value),l(3,u)}function Al(){u.d.s=this.checked,l(3,u)}function Pl(){u.d.t=this.checked,l(3,u)}function qi(){u.d.l=dt(this),l(3,u)}return t.$$set=Ge=>{"sysinfo"in Ge&&l(0,n=Ge.sysinfo)},t.$$.update=()=>{t.$$.dirty[0]&1&&l(6,$=n.chip=="esp8266"?16:n.chip=="esp32s2"?44:39)},[n,o,a,u,c,f,$,i,_,p,b,v,d,S,w,N,E,B,P,L,O,F,x,j,z,G,V,W,U,K,H,Y,Z,re,ue,ke,me,Se,je,Re,He,we,Te,Le,Me,y,g,k,A,I,Q,J,se,ce,ve,$e,oe,pe,Be,_e,ye,vt,Hl,tl,ct,Tl,pl,Ht,ht,Xe,Ze,Je,Ue,xe,We,et,tt,de,Ce,Ei,_l,_n,Tt,Di,Ii,Ri,dl,Li,Oi,Fi,Nt,Nl,Al,Pl,qi]}class Cp extends Ee{constructor(e){super(),Pe(this,e,yp,kp,Ne,{sysinfo:0},null,[-1,-1,-1,-1])}}function Df(t,e,l){const n=t.slice();return n[20]=e[l],n}function Mp(t){let e=be(t[1].chip,t[1].board)+"",l;return{c(){l=T(e)},m(n,i){M(n,l,i)},p(n,i){i&2&&e!==(e=be(n[1].chip,n[1].board)+"")&&X(l,e)},d(n){n&&C(l)}}}function If(t){let e,l,n=t[1].apmac+"",i,o,a,u,c,f,_,p,b,v=Za(t[1])+"",d,S,w=t[1].boot_reason+"",$,N,E=t[1].ex_cause+"",B,P,L;const O=[Sp,$p],F=[];function x(j,z){return j[0].u>0?0:1}return c=x(t),f=F[c]=O[c](t),{c(){e=m("div"),l=T("AP MAC: "),i=T(n),o=h(),a=m("div"),u=T(`Last boot: - `),f.c(),_=h(),p=m("div"),b=T("Reason: "),d=T(v),S=T(" ("),$=T(w),N=T("/"),B=T(E),P=T(")"),r(e,"class","my-2"),r(a,"class","my-2"),r(p,"class","my-2")},m(j,z){M(j,e,z),s(e,l),s(e,i),M(j,o,z),M(j,a,z),s(a,u),F[c].m(a,null),M(j,_,z),M(j,p,z),s(p,b),s(p,d),s(p,S),s(p,$),s(p,N),s(p,B),s(p,P),L=!0},p(j,z){(!L||z&2)&&n!==(n=j[1].apmac+"")&&X(i,n);let G=c;c=x(j),c===G?F[c].p(j,z):(De(),q(F[G],1,1,()=>{F[G]=null}),Ie(),f=F[c],f?f.p(j,z):(f=F[c]=O[c](j),f.c()),D(f,1),f.m(a,null)),(!L||z&2)&&v!==(v=Za(j[1])+"")&&X(d,v),(!L||z&2)&&w!==(w=j[1].boot_reason+"")&&X($,w),(!L||z&2)&&E!==(E=j[1].ex_cause+"")&&X(B,E)},i(j){L||(D(f),L=!0)},o(j){q(f),L=!1},d(j){j&&C(e),j&&C(o),j&&C(a),F[c].d(),j&&C(_),j&&C(p)}}}function $p(t){let e;return{c(){e=T("-")},m(l,n){M(l,e,n)},p:fe,i:fe,o:fe,d(l){l&&C(e)}}}function Sp(t){let e,l;return e=new Vc({props:{timestamp:new Date(new Date().getTime()-t[0].u*1e3),fullTimeColor:""}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.timestamp=new Date(new Date().getTime()-n[0].u*1e3)),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function Tp(t){let e;return{c(){e=m("span"),e.textContent="Update consents",r(e,"class","btn-pri-sm")},m(l,n){M(l,e,n)},p:fe,d(l){l&&C(e)}}}function Rf(t){let e,l,n,i,o,a=Cs(t[1].meter.mfg)+"",u,c,f,_,p=(t[1].meter.model?t[1].meter.model:"unknown")+"",b,v,d,S,w=(t[1].meter.id?t[1].meter.id:"unknown")+"",$;return{c(){e=m("div"),l=m("strong"),l.textContent="Meter",n=h(),i=m("div"),o=T("Manufacturer: "),u=T(a),c=h(),f=m("div"),_=T("Model: "),b=T(p),v=h(),d=m("div"),S=T("ID: "),$=T(w),r(l,"class","text-sm"),r(i,"class","my-2"),r(f,"class","my-2"),r(d,"class","my-2"),r(e,"class","cnt")},m(N,E){M(N,e,E),s(e,l),s(e,n),s(e,i),s(i,o),s(i,u),s(e,c),s(e,f),s(f,_),s(f,b),s(e,v),s(e,d),s(d,S),s(d,$)},p(N,E){E&2&&a!==(a=Cs(N[1].meter.mfg)+"")&&X(u,a),E&2&&p!==(p=(N[1].meter.model?N[1].meter.model:"unknown")+"")&&X(b,p),E&2&&w!==(w=(N[1].meter.id?N[1].meter.id:"unknown")+"")&&X($,w)},d(N){N&&C(e)}}}function Lf(t){let e,l,n,i,o,a=t[1].net.ip+"",u,c,f,_,p=t[1].net.mask+"",b,v,d,S,w=t[1].net.gw+"",$,N,E,B,P=t[1].net.dns1+"",L,O,F=t[1].net.dns2&&Of(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Network",n=h(),i=m("div"),o=T("IP: "),u=T(a),c=h(),f=m("div"),_=T("Mask: "),b=T(p),v=h(),d=m("div"),S=T("Gateway: "),$=T(w),N=h(),E=m("div"),B=T("DNS: "),L=T(P),O=h(),F&&F.c(),r(l,"class","text-sm"),r(i,"class","my-2"),r(f,"class","my-2"),r(d,"class","my-2"),r(E,"class","my-2"),r(e,"class","cnt")},m(x,j){M(x,e,j),s(e,l),s(e,n),s(e,i),s(i,o),s(i,u),s(e,c),s(e,f),s(f,_),s(f,b),s(e,v),s(e,d),s(d,S),s(d,$),s(e,N),s(e,E),s(E,B),s(E,L),s(E,O),F&&F.m(E,null)},p(x,j){j&2&&a!==(a=x[1].net.ip+"")&&X(u,a),j&2&&p!==(p=x[1].net.mask+"")&&X(b,p),j&2&&w!==(w=x[1].net.gw+"")&&X($,w),j&2&&P!==(P=x[1].net.dns1+"")&&X(L,P),x[1].net.dns2?F?F.p(x,j):(F=Of(x),F.c(),F.m(E,null)):F&&(F.d(1),F=null)},d(x){x&&C(e),F&&F.d()}}}function Of(t){let e,l=t[1].net.dns2+"",n;return{c(){e=T("/ "),n=T(l)},m(i,o){M(i,e,o),M(i,n,o)},p(i,o){o&2&&l!==(l=i[1].net.dns2+"")&&X(n,l)},d(i){i&&C(e),i&&C(n)}}}function Ff(t){let e,l,n,i=t[1].upgrade.t+"",o,a,u=t[1].version+"",c,f,_=t[1].upgrade.x+"",p,b,v=t[1].upgrade.e+"",d,S;return{c(){e=m("div"),l=m("div"),n=T("Previous upgrade attempt ("),o=T(i),a=T(") does not match current version ("),c=T(u),f=T(") ["),p=T(_),b=T("/"),d=T(v),S=T("]"),r(l,"class","bd-yellow"),r(e,"class","my-2")},m(w,$){M(w,e,$),s(e,l),s(l,n),s(l,o),s(l,a),s(l,c),s(l,f),s(l,p),s(l,b),s(l,d),s(l,S)},p(w,$){$&2&&i!==(i=w[1].upgrade.t+"")&&X(o,i),$&2&&u!==(u=w[1].version+"")&&X(c,u),$&2&&_!==(_=w[1].upgrade.x+"")&&X(p,_),$&2&&v!==(v=w[1].upgrade.e+"")&&X(d,v)},d(w){w&&C(e)}}}function qf(t){let e,l,n,i=t[2].tag_name+"",o,a,u,c,f,_,p=(t[1].security==0||t[0].a)&&t[1].fwconsent===1&&t[2]&&t[2].tag_name!=t[1].version&&Bf(t),b=t[1].fwconsent===2&&Uf();return{c(){e=m("div"),l=T(`Latest version: - `),n=m("a"),o=T(i),u=h(),p&&p.c(),c=h(),b&&b.c(),f=Ve(),r(n,"href",a=t[2].html_url),r(n,"class","ml-2 text-blue-600 hover:text-blue-800"),r(n,"target","_blank"),r(n,"rel","noreferrer"),r(e,"class","my-2 flex")},m(v,d){M(v,e,d),s(e,l),s(e,n),s(n,o),s(e,u),p&&p.m(e,null),M(v,c,d),b&&b.m(v,d),M(v,f,d),_=!0},p(v,d){(!_||d&4)&&i!==(i=v[2].tag_name+"")&&X(o,i),(!_||d&4&&a!==(a=v[2].html_url))&&r(n,"href",a),(v[1].security==0||v[0].a)&&v[1].fwconsent===1&&v[2]&&v[2].tag_name!=v[1].version?p?(p.p(v,d),d&7&&D(p,1)):(p=Bf(v),p.c(),D(p,1),p.m(e,null)):p&&(De(),q(p,1,1,()=>{p=null}),Ie()),v[1].fwconsent===2?b||(b=Uf(),b.c(),b.m(f.parentNode,f)):b&&(b.d(1),b=null)},i(v){_||(D(p),_=!0)},o(v){q(p),_=!1},d(v){v&&C(e),p&&p.d(),v&&C(c),b&&b.d(v),v&&C(f)}}}function Bf(t){let e,l,n,i,o,a;return n=new Kc({}),{c(){e=m("div"),l=m("button"),ie(n.$$.fragment),r(e,"class","flex-none ml-2 text-green-500"),r(e,"title","Install this version")},m(u,c){M(u,e,c),s(e,l),le(n,l,null),i=!0,o||(a=ee(l,"click",t[10]),o=!0)},p:fe,i(u){i||(D(n.$$.fragment,u),i=!0)},o(u){q(n.$$.fragment,u),i=!1},d(u){u&&C(e),ne(n),o=!1,a()}}}function Uf(t){let e;return{c(){e=m("div"),e.innerHTML='
You have disabled one-click firmware upgrade, link to self-upgrade is disabled
',r(e,"class","my-2")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function jf(t){let e,l=Ms(be(t[1].chip,t[1].board))+"",n;return{c(){e=m("div"),n=T(l),r(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&2&&l!==(l=Ms(be(i[1].chip,i[1].board))+"")&&X(n,l)},d(i){i&&C(e)}}}function Hf(t){let e,l,n,i,o,a;function u(_,p){return _[4].length==0?Ap:Np}let c=u(t),f=c(t);return{c(){e=m("div"),l=m("form"),n=m("input"),i=h(),f.c(),nc(n,"display","none"),r(n,"name","file"),r(n,"type","file"),r(n,"accept",".bin"),r(l,"action","/firmware"),r(l,"enctype","multipart/form-data"),r(l,"method","post"),r(l,"autocomplete","off"),r(e,"class","my-2 flex")},m(_,p){M(_,e,p),s(e,l),s(l,n),t[12](n),s(l,i),f.m(l,null),o||(a=[ee(n,"change",t[13]),ee(l,"submit",t[15])],o=!0)},p(_,p){c===(c=u(_))&&f?f.p(_,p):(f.d(1),f=c(_),f&&(f.c(),f.m(l,null)))},d(_){_&&C(e),t[12](null),f.d(),o=!1,ze(a)}}}function Np(t){let e=t[4][0].name+"",l,n,i;return{c(){l=T(e),n=h(),i=m("button"),i.textContent="Upload",r(i,"type","submit"),r(i,"class","btn-pri-sm float-right")},m(o,a){M(o,l,a),M(o,n,a),M(o,i,a)},p(o,a){a&16&&e!==(e=o[4][0].name+"")&&X(l,e)},d(o){o&&C(l),o&&C(n),o&&C(i)}}}function Ap(t){let e,l,n;return{c(){e=m("button"),e.textContent="Select firmware file for upgrade",r(e,"type","button"),r(e,"class","btn-pri-sm float-right")},m(i,o){M(i,e,o),l||(n=ee(e,"click",t[14]),l=!0)},p:fe,d(i){i&&C(e),l=!1,n()}}}function Wf(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S=t[9],w=[];for(let P=0;P Include Secrets
(SSID, PSK, passwords and tokens)',c=h(),$&&$.c(),f=h(),_=m("form"),p=m("input"),b=h(),B.c(),r(l,"class","text-sm"),r(u,"class","my-1 mx-3 col-span-2"),r(o,"class","grid grid-cols-2"),r(i,"method","get"),r(i,"action","/configfile.cfg"),r(i,"autocomplete","off"),nc(p,"display","none"),r(p,"name","file"),r(p,"type","file"),r(p,"accept",".cfg"),r(_,"action","/configfile"),r(_,"enctype","multipart/form-data"),r(_,"method","post"),r(_,"autocomplete","off"),r(e,"class","cnt")},m(P,L){M(P,e,L),s(e,l),s(e,n),s(e,i),s(i,o);for(let O=0;O{A=null}),Ie());const _e={};pe&8388608&&(_e.$$scope={dirty:pe,ctx:oe}),x.$set(_e),oe[1].meter?I?I.p(oe,pe):(I=Rf(oe),I.c(),I.m(e,V)):I&&(I.d(1),I=null),oe[1].net?Q?Q.p(oe,pe):(Q=Lf(oe),Q.c(),Q.m(e,W)):Q&&(Q.d(1),Q=null),(!y||pe&2)&&re!==(re=oe[1].version+"")&&X(ue,re),oe[1].upgrade.t&&oe[1].upgrade.t!=oe[1].version?J?J.p(oe,pe):(J=Ff(oe),J.c(),J.m(U,me)):J&&(J.d(1),J=null),oe[2]?se?(se.p(oe,pe),pe&4&&D(se,1)):(se=qf(oe),se.c(),D(se,1),se.m(U,Se)):se&&(De(),q(se,1,1,()=>{se=null}),Ie()),pe&3&&(je=(oe[1].security==0||oe[0].a)&&ri(oe[1].board)),je?ce?ce.p(oe,pe):(ce=jf(oe),ce.c(),ce.m(U,Re)):ce&&(ce.d(1),ce=null),oe[1].security==0||oe[0].a?ve?ve.p(oe,pe):(ve=Hf(oe),ve.c(),ve.m(U,null)):ve&&(ve.d(1),ve=null),oe[1].security==0||oe[0].a?$e?$e.p(oe,pe):($e=Wf(oe),$e.c(),$e.m(e,null)):$e&&($e.d(1),$e=null);const ye={};pe&32&&(ye.active=oe[5]),Te.$set(ye);const vt={};pe&256&&(vt.active=oe[8]),Me.$set(vt)},i(oe){y||(D(w.$$.fragment,oe),D(A),D(x.$$.fragment,oe),D(se),D(Te.$$.fragment,oe),D(Me.$$.fragment,oe),y=!0)},o(oe){q(w.$$.fragment,oe),q(A),q(x.$$.fragment,oe),q(se),q(Te.$$.fragment,oe),q(Me.$$.fragment,oe),y=!1},d(oe){oe&&C(e),ne(w),A&&A.d(),ne(x),I&&I.d(),Q&&Q.d(),J&&J.d(),se&&se.d(),ce&&ce.d(),ve&&ve.d(),$e&&$e.d(),oe&&C(we),ne(Te,oe),oe&&C(Le),ne(Me,oe),g=!1,k()}}}async function Ip(){await(await fetch("/reboot",{method:"POST"})).json()}function Rp(t,e,l){let{data:n}=e,{sysinfo:i}=e,o=[{name:"WiFi",key:"iw"},{name:"MQTT",key:"im"},{name:"Web",key:"ie"},{name:"Meter",key:"it"},{name:"Thresholds",key:"ih"},{name:"GPIO",key:"ig"},{name:"NTP",key:"in"},{name:"Price API",key:"is"}],a={};So.subscribe(O=>{l(2,a=Gc(i.version,O)),a||l(2,a=O[0])});function u(){confirm("Do you want to upgrade this device to "+a.tag_name+"?")&&(i.board!=2&&i.board!=4&&i.board!=7||confirm(Ms(be(i.chip,i.board))))&&(jt.update(O=>(O.upgrading=!0,O)),zc(a.tag_name))}const c=function(){confirm("Are you sure you want to reboot the device?")&&(jt.update(O=>(O.booting=!0,O)),Ip())};let f,_=[],p=!1,b,v=[],d=!1;yo();function S(O){ws[O?"unshift":"push"](()=>{f=O,l(3,f)})}function w(){_=this.files,l(4,_)}const $=()=>{f.click()},N=()=>l(5,p=!0);function E(O){ws[O?"unshift":"push"](()=>{b=O,l(6,b)})}function B(){v=this.files,l(7,v)}const P=()=>{b.click()},L=()=>l(8,d=!0);return t.$$set=O=>{"data"in O&&l(0,n=O.data),"sysinfo"in O&&l(1,i=O.sysinfo)},[n,i,a,f,_,p,b,v,d,o,u,c,S,w,$,N,E,B,P,L]}class Lp extends Ee{constructor(e){super(),Pe(this,e,Rp,Dp,Ne,{data:0,sysinfo:1})}}function Vf(t){let e,l,n=be(t[0],7)+"",i,o,a=be(t[0],5)+"",u,c,f=be(t[0],4)+"",_,p,b=be(t[0],3)+"",v,d,S,w,$=be(t[0],2)+"",N,E,B=be(t[0],1)+"",P,L,O=be(t[0],0)+"",F,x,j,z,G=be(t[0],101)+"",V,W,U=be(t[0],100)+"",K;return{c(){e=m("optgroup"),l=m("option"),i=T(n),o=m("option"),u=T(a),c=m("option"),_=T(f),p=m("option"),v=T(b),d=h(),S=m("optgroup"),w=m("option"),N=T($),E=m("option"),P=T(B),L=m("option"),F=T(O),x=h(),j=m("optgroup"),z=m("option"),V=T(G),W=m("option"),K=T(U),l.__value=7,l.value=l.__value,o.__value=5,o.value=o.__value,c.__value=4,c.value=c.__value,p.__value=3,p.value=p.__value,r(e,"label","amsleser.no"),w.__value=2,w.value=w.__value,E.__value=1,E.value=E.__value,L.__value=0,L.value=L.__value,r(S,"label","Custom hardware"),z.__value=101,z.value=z.__value,W.__value=100,W.value=W.__value,r(j,"label","Generic hardware")},m(H,Y){M(H,e,Y),s(e,l),s(l,i),s(e,o),s(o,u),s(e,c),s(c,_),s(e,p),s(p,v),M(H,d,Y),M(H,S,Y),s(S,w),s(w,N),s(S,E),s(E,P),s(S,L),s(L,F),M(H,x,Y),M(H,j,Y),s(j,z),s(z,V),s(j,W),s(W,K)},p(H,Y){Y&1&&n!==(n=be(H[0],7)+"")&&X(i,n),Y&1&&a!==(a=be(H[0],5)+"")&&X(u,a),Y&1&&f!==(f=be(H[0],4)+"")&&X(_,f),Y&1&&b!==(b=be(H[0],3)+"")&&X(v,b),Y&1&&$!==($=be(H[0],2)+"")&&X(N,$),Y&1&&B!==(B=be(H[0],1)+"")&&X(P,B),Y&1&&O!==(O=be(H[0],0)+"")&&X(F,O),Y&1&&G!==(G=be(H[0],101)+"")&&X(V,G),Y&1&&U!==(U=be(H[0],100)+"")&&X(K,U)},d(H){H&&C(e),H&&C(d),H&&C(S),H&&C(x),H&&C(j)}}}function Kf(t){let e,l,n=be(t[0],201)+"",i,o,a=be(t[0],202)+"",u,c,f=be(t[0],203)+"",_,p,b=be(t[0],200)+"",v;return{c(){e=m("optgroup"),l=m("option"),i=T(n),o=m("option"),u=T(a),c=m("option"),_=T(f),p=m("option"),v=T(b),l.__value=201,l.value=l.__value,o.__value=202,o.value=o.__value,c.__value=203,c.value=c.__value,p.__value=200,p.value=p.__value,r(e,"label","Generic hardware")},m(d,S){M(d,e,S),s(e,l),s(l,i),s(e,o),s(o,u),s(e,c),s(c,_),s(e,p),s(p,v)},p(d,S){S&1&&n!==(n=be(d[0],201)+"")&&X(i,n),S&1&&a!==(a=be(d[0],202)+"")&&X(u,a),S&1&&f!==(f=be(d[0],203)+"")&&X(_,f),S&1&&b!==(b=be(d[0],200)+"")&&X(v,b)},d(d){d&&C(e)}}}function Yf(t){let e,l,n=be(t[0],7)+"",i,o,a=be(t[0],6)+"",u,c,f=be(t[0],5)+"",_,p,b,v,d=be(t[0],51)+"",S,w,$=be(t[0],50)+"",N;return{c(){e=m("optgroup"),l=m("option"),i=T(n),o=m("option"),u=T(a),c=m("option"),_=T(f),p=h(),b=m("optgroup"),v=m("option"),S=T(d),w=m("option"),N=T($),l.__value=7,l.value=l.__value,o.__value=6,o.value=o.__value,c.__value=5,c.value=c.__value,r(e,"label","amsleser.no"),v.__value=51,v.value=v.__value,w.__value=50,w.value=w.__value,r(b,"label","Generic hardware")},m(E,B){M(E,e,B),s(e,l),s(l,i),s(e,o),s(o,u),s(e,c),s(c,_),M(E,p,B),M(E,b,B),s(b,v),s(v,S),s(b,w),s(w,N)},p(E,B){B&1&&n!==(n=be(E[0],7)+"")&&X(i,n),B&1&&a!==(a=be(E[0],6)+"")&&X(u,a),B&1&&f!==(f=be(E[0],5)+"")&&X(_,f),B&1&&d!==(d=be(E[0],51)+"")&&X(S,d),B&1&&$!==($=be(E[0],50)+"")&&X(N,$)},d(E){E&&C(e),E&&C(p),E&&C(b)}}}function Qf(t){let e,l,n=be(t[0],8)+"",i,o,a,u,c=be(t[0],71)+"",f,_,p=be(t[0],70)+"",b;return{c(){e=m("optgroup"),l=m("option"),i=T(n),o=h(),a=m("optgroup"),u=m("option"),f=T(c),_=m("option"),b=T(p),l.__value=8,l.value=l.__value,r(e,"label","Custom hardware"),u.__value=71,u.value=u.__value,_.__value=70,_.value=_.__value,r(a,"label","Generic hardware")},m(v,d){M(v,e,d),s(e,l),s(l,i),M(v,o,d),M(v,a,d),s(a,u),s(u,f),s(a,_),s(_,b)},p(v,d){d&1&&n!==(n=be(v[0],8)+"")&&X(i,n),d&1&&c!==(c=be(v[0],71)+"")&&X(f,c),d&1&&p!==(p=be(v[0],70)+"")&&X(b,p)},d(v){v&&C(e),v&&C(o),v&&C(a)}}}function Xf(t){let e,l,n=be(t[0],200)+"",i;return{c(){e=m("optgroup"),l=m("option"),i=T(n),l.__value=200,l.value=l.__value,r(e,"label","Generic hardware")},m(o,a){M(o,e,a),s(e,l),s(l,i)},p(o,a){a&1&&n!==(n=be(o[0],200)+"")&&X(i,n)},d(o){o&&C(e)}}}function Op(t){let e,l,n,i,o,a,u,c=t[0]=="esp8266"&&Vf(t),f=t[0]=="esp32"&&Kf(t),_=t[0]=="esp32s2"&&Yf(t),p=t[0]=="esp32c3"&&Qf(t),b=t[0]=="esp32solo"&&Xf(t);return{c(){e=m("option"),l=h(),c&&c.c(),n=h(),f&&f.c(),i=h(),_&&_.c(),o=h(),p&&p.c(),a=h(),b&&b.c(),u=Ve(),e.__value=-1,e.value=e.__value},m(v,d){M(v,e,d),M(v,l,d),c&&c.m(v,d),M(v,n,d),f&&f.m(v,d),M(v,i,d),_&&_.m(v,d),M(v,o,d),p&&p.m(v,d),M(v,a,d),b&&b.m(v,d),M(v,u,d)},p(v,[d]){v[0]=="esp8266"?c?c.p(v,d):(c=Vf(v),c.c(),c.m(n.parentNode,n)):c&&(c.d(1),c=null),v[0]=="esp32"?f?f.p(v,d):(f=Kf(v),f.c(),f.m(i.parentNode,i)):f&&(f.d(1),f=null),v[0]=="esp32s2"?_?_.p(v,d):(_=Yf(v),_.c(),_.m(o.parentNode,o)):_&&(_.d(1),_=null),v[0]=="esp32c3"?p?p.p(v,d):(p=Qf(v),p.c(),p.m(a.parentNode,a)):p&&(p.d(1),p=null),v[0]=="esp32solo"?b?b.p(v,d):(b=Xf(v),b.c(),b.m(u.parentNode,u)):b&&(b.d(1),b=null)},i:fe,o:fe,d(v){v&&C(e),v&&C(l),c&&c.d(v),v&&C(n),f&&f.d(v),v&&C(i),_&&_.d(v),v&&C(o),p&&p.d(v),v&&C(a),b&&b.d(v),v&&C(u)}}}function Fp(t,e,l){let{chip:n}=e;return t.$$set=i=>{"chip"in i&&l(0,n=i.chip)},[n]}class qp extends Ee{constructor(e){super(),Pe(this,e,Fp,Op,Ne,{chip:0})}}function Zf(t){let e;return{c(){e=m("div"),e.textContent="WARNING: Changing this configuration will affect basic configuration of your device. Only make changes here if instructed by vendor",r(e,"class","bd-red")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function Jf(t){let e,l,n,i,o,a,u;return a=new Qc({props:{chip:t[0].chip}}),{c(){e=m("div"),l=T("HAN GPIO"),n=m("br"),i=h(),o=m("select"),ie(a.$$.fragment),r(o,"name","vh"),r(o,"class","in-s"),r(e,"class","my-3")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),le(a,o,null),u=!0},p(c,f){const _={};f&1&&(_.chip=c[0].chip),a.$set(_)},i(c){u||(D(a.$$.fragment,c),u=!0)},o(c){q(a.$$.fragment,c),u=!1},d(c){c&&C(e),ne(a)}}}function Bp(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,w,$,N,E,B,P,L,O,F,x,j,z,G,V,W=t[0].usrcfg&&Zf();d=new qp({props:{chip:t[0].chip}});let U=t[0].board&&t[0].board>20&&Jf(t);return j=new It({props:{active:t[1],message:"Saving device configuration"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),o=h(),a=m("strong"),a.textContent="Initial configuration",u=h(),W&&W.c(),c=h(),f=m("div"),_=T("Board type"),p=m("br"),b=h(),v=m("select"),ie(d.$$.fragment),S=h(),U&&U.c(),w=h(),$=m("div"),N=m("label"),E=m("input"),B=T(" Clear all other configuration"),P=h(),L=m("div"),L.innerHTML='',O=h(),F=m("span"),F.textContent="\xA0",x=h(),ie(j.$$.fragment),r(i,"type","hidden"),r(i,"name","v"),i.value="true",r(a,"class","text-sm"),r(v,"name","vb"),r(v,"class","in-s"),t[0].board===void 0&&Qe(()=>t[4].call(v)),r(f,"class","my-3"),r(E,"type","checkbox"),r(E,"name","vr"),E.__value="true",E.value=E.__value,r(E,"class","rounded mb-1"),r($,"class","my-3"),r(L,"class","my-3"),r(F,"class","clear-both"),r(n,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(K,H){M(K,e,H),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),s(n,u),W&&W.m(n,null),s(n,c),s(n,f),s(f,_),s(f,p),s(f,b),s(f,v),le(d,v,null),qe(v,t[0].board,!0),s(n,S),U&&U.m(n,null),s(n,w),s(n,$),s($,N),s(N,E),E.checked=t[2],s(N,B),s(n,P),s(n,L),s(n,O),s(n,F),M(K,x,H),le(j,K,H),z=!0,G||(V=[ee(v,"change",t[4]),ee(E,"change",t[5]),ee(n,"submit",$s(t[3]))],G=!0)},p(K,[H]){K[0].usrcfg?W||(W=Zf(),W.c(),W.m(n,c)):W&&(W.d(1),W=null);const Y={};H&1&&(Y.chip=K[0].chip),d.$set(Y),H&1&&qe(v,K[0].board),K[0].board&&K[0].board>20?U?(U.p(K,H),H&1&&D(U,1)):(U=Jf(K),U.c(),D(U,1),U.m(n,w)):U&&(De(),q(U,1,1,()=>{U=null}),Ie()),H&4&&(E.checked=K[2]);const Z={};H&2&&(Z.active=K[1]),j.$set(Z)},i(K){z||(D(d.$$.fragment,K),D(U),D(j.$$.fragment,K),z=!0)},o(K){q(d.$$.fragment,K),q(U),q(j.$$.fragment,K),z=!1},d(K){K&&C(e),W&&W.d(),ne(d),U&&U.d(),K&&C(x),ne(j,K),G=!1,ze(V)}}}function Up(t,e,l){let{sysinfo:n={}}=e,i=!1;async function o(f){l(1,i=!0);const _=new FormData(f.target),p=new URLSearchParams;for(let d of _){const[S,w]=d;p.append(S,w)}let v=await(await fetch("/save",{method:"POST",body:p})).json();l(1,i=!1),jt.update(d=>(d.vndcfg=v.success,d.booting=v.reboot,d)),oi(n.usrcfg?"/":"/setup")}let a=!1;function u(){n.board=dt(this),l(0,n)}function c(){a=this.checked,l(2,a),l(0,n)}return t.$$set=f=>{"sysinfo"in f&&l(0,n=f.sysinfo)},t.$$.update=()=>{t.$$.dirty&1&&l(2,a=!n.usrcfg)},[n,i,a,o,u,c]}class jp extends Ee{constructor(e){super(),Pe(this,e,Up,Bp,Ne,{sysinfo:0})}}function xf(t){let e,l,n,i,o,a,u,c;return u=new Xc({}),{c(){e=m("br"),l=h(),n=m("div"),i=m("input"),o=h(),a=m("select"),ie(u.$$.fragment),r(i,"name","si"),r(i,"type","text"),r(i,"class","in-f w-full"),i.required=t[1],r(a,"name","su"),r(a,"class","in-l"),a.required=t[1],r(n,"class","flex")},m(f,_){M(f,e,_),M(f,l,_),M(f,n,_),s(n,i),s(n,o),s(n,a),le(u,a,null),c=!0},p(f,_){(!c||_&2)&&(i.required=f[1]),(!c||_&2)&&(a.required=f[1])},i(f){c||(D(u.$$.fragment,f),c=!0)},o(f){q(u.$$.fragment,f),c=!1},d(f){f&&C(e),f&&C(l),f&&C(n),ne(u)}}}function ec(t){let e;return{c(){e=m("div"),e.innerHTML=`
Gateway
+Occurred in: ${i}`:"",a=ko(t),u=cc(e)?e(a):e;return`<${a}> ${u}${o}`}const Sc=t=>(...e)=>t(A0(...e)),$c=Sc(t=>{throw new Error(t)}),ys=Sc(console.warn),Ua=4,P0=3,E0=2,D0=1,I0=1;function R0(t,e){const l=t.default?0:ml(t.fullPath).reduce((n,i)=>{let o=n;return o+=Ua,k0(i)?o+=I0:w0(i)?o+=E0:gc(i)?o-=Ua+D0:o+=P0,o},0);return{route:t,score:l,index:e}}function L0(t){return t.map(R0).sort((e,l)=>e.scorel.score?-1:e.index-l.index)}function Tc(t,e){let l,n;const[i]=e.split("?"),o=ml(i),a=o[0]==="",u=L0(t);for(let c=0,f=u.length;c({..._,params:b,uri:$});if(_.default){n=v(e);continue}const d=ml(_.fullPath),S=Math.max(o.length,d.length);let y=0;for(;y{f===".."?c.pop():f!=="."&&c.push(f)}),Ks(`/${c.join("/")}`,n)}function ja(t,e){const{pathname:l,hash:n="",search:i="",state:o}=t,a=ml(e,!0),u=ml(l,!0);for(;a.length;)a[0]!==u[0]&&$c(mn,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),a.shift(),u.shift();return{pathname:Ai(...u),hash:n,search:i,state:o}}const Ha=t=>t.length===1?"":t,wo=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,o=i?Ha(wi(t,l)):"",a=i?wi(t,0,l):t,u=n?Ha(wi(a,e)):"";return{pathname:(n?wi(a,0,e):a)||"/",search:u,hash:o}},F0=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function q0(t,e,l){return Ai(l,O0(t,e))}function B0(t,e){const l=bo(y0(t)),n=ml(l,!0),i=ml(e,!0).slice(0,n.length),o=Nc({fullPath:l},Ai(...i));return o&&o.uri}const Ys="POP",U0="PUSH",j0="REPLACE";function Qs(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function H0(t){let e=[],l=Qs(t),n=Ys;const i=(o=e)=>o.forEach(a=>a({location:l,action:n}));return{get location(){return l},listen(o){e.push(o);const a=()=>{l=Qs(t),n=Ys,i([o])};i([o]);const u=_c(t,"popstate",a);return()=>{u(),e=e.filter(c=>c!==o)}},navigate(o,a){const{state:u={},replace:c=!1}=a||{};if(n=c?j0:U0,mc(o))a&&ys(Mc,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=Ys,t.history.go(o);else{const f={...u,_key:v0()};try{t.history[c?"replaceState":"pushState"](f,"",o)}catch{t.location[c?"replace":"assign"](o)}}l=Qs(t),i()}}}function Xs(t,e){return{...wo(e),state:t}}function W0(t="/"){let e=0,l=[Xs(null,t)];return{get entries(){return l},get location(){return l[e]},addEventListener(){},removeEventListener(){},history:{get state(){return l[e].state},pushState(n,i,o){e++,l=l.slice(0,e),l.push(Xs(n,o))},replaceState(n,i,o){l[e]=Xs(n,o)},go(n){const i=e+n;i<0||i>l.length-1||(e=i)}}}}const z0=!!(!Ul&&window.document&&window.document.createElement),G0=!Ul&&window.location.origin==="null",Ac=H0(z0&&!G0?window:W0()),{navigate:oi}=Ac;let $l=null,Pc=!0;function V0(t,e){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;n$l.level||t.level===$l.level&&V0(t.routerId,$l.routerId))&&($l=t)}function Y0(){$l=null}function Q0(){Pc=!1}function Wa(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=_c(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function X0(t,e){return Number(t.dataset.svnavRouteEnd)===e}function Z0(t){return/^H[1-6]$/i.test(t.tagName)}function za(t,e=document){return e.querySelector(t)}function J0(t){let l=za(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!X0(l,t);){if(Z0(l))return l;const n=za("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function x0(t){Promise.resolve(ai(t.focusElement)).then(e=>{const l=e||J0(t.id);l||ys(mn,`Could not find an element to focus. You should always render a header for accessibility reasons, or set a custom focus element via the "useFocus" hook. If you don't want this Route or Router to manage focus, pass "primary={false}" to it.`,t,$s),!Wa(l)&&Wa(document.documentElement)})}const e1=(t,e,l)=>(n,i)=>c0().then(()=>{if(!$l||Pc){Q0();return}if(n&&x0($l.route),t.announcements&&i){const{path:o,fullPath:a,meta:u,params:c,uri:f}=$l.route,_=t.createAnnouncement({path:o,fullPath:a,meta:u,params:c,uri:f},ai(l));Promise.resolve(_).then(p=>{e.set(p)})}Y0()}),t1="position:fixed;top:-1px;left:0;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;";function l1(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},dc(t[6],t1)],i={};for(let o=0;o`Navigated to ${ue.uri}`,announcements:!0,...d},$=_,N=bo(_),E=Bl(to),B=Bl(fi),P=!E,L=i1(),O=v&&!(B&&!B.manageFocus),F=at("");ul(t,F,ue=>l(0,u=ue));const x=B?B.disableInlineStyles:S,j=at([]);ul(t,j,ue=>l(20,a=ue));const z=at(null);ul(t,z,ue=>l(18,i=ue));let G=!1;const V=P?0:B.level+1,U=P?at((()=>ja(Ul?wo(p):b.location,N))()):E;ul(t,U,ue=>l(17,n=ue));const K=at(n);ul(t,K,ue=>l(19,o=ue));const H=e1(y,F,U),Y=ue=>ke=>ke.filter(me=>me.id!==ue);function X(ue){if(Ul){if(G)return;const ke=Nc(ue,n.pathname);if(ke)return G=!0,ke}else j.update(ke=>{const me=Y(ue.id)(ke);return me.push(ue),me})}function re(ue){j.update(Y(ue))}return!P&&_!==Ga&&ys(mn,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:_}),P&&(oc(()=>b.listen(ke=>{const me=ja(ke.location,N);K.set(n),U.set(me)})),Si(to,U)),Si(fi,{activeRoute:z,registerRoute:X,unregisterRoute:re,manageFocus:O,level:V,id:L,history:P?b:B.history,basepath:P?N:B.basepath,disableInlineStyles:x}),t.$$set=ue=>{"basepath"in ue&&l(11,_=ue.basepath),"url"in ue&&l(12,p=ue.url),"history"in ue&&l(13,b=ue.history),"primary"in ue&&l(14,v=ue.primary),"a11y"in ue&&l(15,d=ue.a11y),"disableInlineStyles"in ue&&l(16,S=ue.disableInlineStyles),"$$scope"in ue&&l(21,f=ue.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&_!==$&&ys(mn,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const ue=Tc(a,n.pathname);z.set(ue)}if(t.$$.dirty[0]&655360&&P){const ue=!!n.hash,ke=!ue&&O,me=!ue||n.pathname!==o.pathname;H(ke,me)}t.$$.dirty[0]&262144&&O&&i&&i.primary&&K0({level:V,routerId:L,route:i})},[u,y,P,L,O,F,x,j,z,U,K,_,p,b,v,d,S,n,i,o,a,f,c]}class o1 extends Ee{constructor(e){super(),Pe(this,e,s1,n1,Ne,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}const Ec=o1;function Pi(t,e,l=fi,n=mn){Bl(l)||$c(t,o=>`You cannot use ${o} outside of a ${ko(n)}.`,e)}const r1=t=>{const{subscribe:e}=Bl(t);return{subscribe:e}};function Dc(){return Pi(wc),r1(to)}function Ic(){const{history:t}=Bl(fi);return t}function Rc(){const t=Bl(hc);return t?h0(t,e=>e.base):at("/")}function Lc(){Pi(Cc);const t=Rc(),{basepath:e}=Bl(fi);return n=>q0(n,ai(t),e)}function a1(){Pi(yc);const t=Lc(),{navigate:e}=Ic();return(n,i)=>{const o=mc(n)?n:t(n);return e(o,i)}}const u1=t=>({params:t&16,location:t&8}),Va=t=>({params:Ul?ai(t[10]):t[4],location:t[3],navigate:t[11]});function Ka(t){let e,l;return e=new Ec({props:{primary:t[1],$$slots:{default:[m1]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.primary=n[1]),i&528409&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function f1(t){let e;const l=t[18].default,n=po(l,t,t[19],Va);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&524312)&&vo(n,l,i,i[19],e?_o(l,i[19],o,u1):ho(i[19]),Va)},i(i){e||(D(n,i),e=!0)},o(i){q(n,i),e=!1},d(i){n&&n.d(i)}}}function c1(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},Ul?ai(t[10]):t[4],t[12]];var o=t[0];function a(u){let c={};for(let f=0;f{ne(_,1)}),Ie()}o?(e=Oa(o,a()),ie(e.$$.fragment),D(e.$$.fragment,1),le(e,l.parentNode,l)):e=null}else o&&e.$set(f)},i(u){n||(e&&D(e.$$.fragment,u),n=!0)},o(u){e&&q(e.$$.fragment,u),n=!1},d(u){u&&C(l),e&&ne(e,u)}}}function m1(t){let e,l,n,i;const o=[c1,f1],a=[];function u(c,f){return c[0]!==null?0:1}return e=u(t),l=a[e]=o[e](t),{c(){l.c(),n=Ve()},m(c,f){a[e].m(c,f),M(c,n,f),i=!0},p(c,f){let _=e;e=u(c),e===_?a[e].p(c,f):(De(),q(a[_],1,1,()=>{a[_]=null}),Ie(),l=a[e],l?l.p(c,f):(l=a[e]=o[e](c),l.c()),D(l,1),l.m(n.parentNode,n))},i(c){i||(D(l),i=!0)},o(c){q(l),i=!1},d(c){a[e].d(c),c&&C(n)}}}function p1(t){let e,l,n,i,o,a=[eo(t[7]),{"data-svnav-route-start":t[5]}],u={};for(let p=0;p{c=null}),Ie())},i(p){o||(D(c),o=!0)},o(p){q(c),o=!1},d(p){p&&C(e),p&&C(l),c&&c.d(p),p&&C(n),p&&C(i)}}}const _1=pc();function d1(t,e,l){let n;const i=["path","component","meta","primary"];let o=ks(e,i),a,u,c,f,{$$slots:_={},$$scope:p}=e,{path:b=""}=e,{component:v=null}=e,{meta:d={}}=e,{primary:S=!0}=e;Pi($s,e);const y=_1(),{registerRoute:$,unregisterRoute:N,activeRoute:E,disableInlineStyles:B}=Bl(fi);ul(t,E,G=>l(16,a=G));const P=Rc();ul(t,P,G=>l(17,c=G));const L=Dc();ul(t,L,G=>l(3,u=G));const O=at(null);let F;const x=at(),j=at({});ul(t,j,G=>l(4,f=G)),Si(hc,x),Si(b0,j),Si(g0,O);const z=a1();return Ul||u0(()=>N(y)),t.$$set=G=>{l(24,e=xt(xt({},e),gs(G))),l(12,o=ks(e,i)),"path"in G&&l(13,b=G.path),"component"in G&&l(0,v=G.component),"meta"in G&&l(14,d=G.meta),"primary"in G&&l(1,S=G.primary),"$$scope"in G&&l(19,p=G.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const G=b==="",V=Ai(c,b),W={id:y,path:b,meta:d,default:G,fullPath:G?"":V,base:G?c:B0(V,u.pathname),primary:S,focusElement:O};x.set(W),l(15,F=$(W))}if(t.$$.dirty&98304&&l(2,n=!!(F||a&&a.id===y)),t.$$.dirty&98308&&n){const{params:G}=F||a;j.set(G)}},e=gs(e),[v,S,n,u,f,y,E,B,P,L,j,z,o,b,d,F,a,c,_,p]}class v1 extends Ee{constructor(e){super(),Pe(this,e,d1,p1,Ne,{path:13,component:0,meta:14,primary:1})}}const Sl=v1;function h1(t){let e,l,n,i;const o=t[13].default,a=po(o,t,t[12],null);let u=[{href:t[0]},t[2],t[1]],c={};for(let f=0;fl(11,p=O));const E=f0(),B=Lc(),{navigate:P}=Ic();function L(O){E("click",O),d0(O)&&(O.preventDefault(),P(n,{state:y,replace:a||S}))}return t.$$set=O=>{l(19,e=xt(xt({},e),gs(O))),l(18,_=ks(e,f)),"to"in O&&l(5,d=O.to),"replace"in O&&l(6,S=O.replace),"state"in O&&l(7,y=O.state),"getProps"in O&&l(8,$=O.getProps),"$$scope"in O&&l(12,v=O.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=B(d,p)),t.$$.dirty&2049&&l(10,i=lo(p.pathname,n)),t.$$.dirty&2049&&l(9,o=n===p.pathname),t.$$.dirty&2049&&(a=wo(n)===F0(p)),t.$$.dirty&512&&l(2,u=o?{"aria-current":"page"}:{}),l(1,c=(()=>{if(cc($)){const O=$({location:p,href:n,isPartiallyCurrent:i,isCurrent:o});return{..._,...O}}return _})())},e=gs(e),[n,c,u,N,L,d,S,y,$,o,i,p,v,b]}class g1 extends Ee{constructor(e){super(),Pe(this,e,b1,h1,Ne,{to:5,replace:6,state:7,getProps:8})}}const el=g1;let no=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function ql(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function k1(t){return t>218&&t<242?"#32d900":t>212&&t<248?"#b1d900":t>208&&t<252?"#ffb800":"#d90000"}function Oc(t,e){let l;return t>90?l="#d90000":t>85?l="#e32100":t>80?l="#ffb800":t>75?l="#dcd800":l="#32d900",l+(e?"88":"")}function w1(t){return t>75?"#32d900":t>50?"#77d900":t>25?"#94d900":"#dcd800"}function Cs(t){switch(t){case 1:return"Aidon";case 2:return"Kaifa";case 3:return"Kamstrup";case 8:return"Iskra";case 9:return"Landis+Gyr";case 10:return"Sagemcom";default:return"Unknown"}}function Oe(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function be(t,e){switch(e){case 5:switch(t){case"esp8266":return"Pow-K (GPIO12)";case"esp32s2":return"Pow-K+"}case 7:switch(t){case"esp8266":return"Pow-U (GPIO12)";case"esp32s2":return"Pow-U+"}case 6:return"Pow-P1";case 51:return"Wemos S2 mini";case 50:return"Generic ESP32-S2";case 201:return"Wemos LOLIN D32";case 202:return"Adafruit HUZZAH32";case 203:return"DevKitC";case 200:return"Generic ESP32";case 2:return"HAN Reader 2.0 by Max Spencer";case 0:return"Custom hardware by Roar Fredriksen";case 1:return"Kamstrup module by Egil Opsahl";case 8:return"\xB5HAN mosquito by dbeinder";case 3:return"Pow-K (UART0)";case 4:return"Pow-U (UART0)";case 101:return"Wemos D1 mini";case 100:return"Generic ESP8266";case 70:return"Generic ESP32-C3";case 71:return"ESP32-C3-DevKitM-1"}}function Ya(t){switch(t){case-1:return"Parse error";case-2:return"Incomplete data received";case-3:return"Payload boundry flag missing";case-4:return"Header checksum error";case-5:return"Footer checksum error";case-9:return"Unknown data received, check meter config";case-41:return"Frame length not equal";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid";case 90:return"No HAN data received for at least 30s";case 91:return"Serial break";case 92:return"Serial buffer full";case 93:return"Serial FIFO overflow";case 94:return"Serial frame error";case 95:return"Serial parity error";case 96:return"RX error";case 98:return"Exception in code, debugging necessary";case 99:return"Autodetection failed"}return t<0?"Unspecified error "+t:""}function Qa(t){switch(t){case-3:return"Connection failed";case-4:return"Network timeout";case-10:return"Connection denied";case-11:return"Failed to subscribe";case-13:return"Connection lost"}return t<0?"Unspecified error "+t:""}function Xa(t){switch(t){case 400:return"Unrecognized data in request";case 401:case 403:return"Unauthorized, check API key";case 404:return"Price unavailable, not found";case 425:return"Server says its too early";case 429:return"Exceeded API rate limit";case 500:return"Internal server error";case-1:return"Connection error";case-2:return"Incomplete data received";case-3:return"Invalid data, tag missing";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid"}return t<0?"Unspecified error "+t:""}function Za(t){switch(t){case 255:return"Unable to start upgrade";case-1:return"Connection refused";case-2:return"Failed to send headers";case-3:return"Failed to send payload";case-4:return"Not connected";case-5:return"Connection lost";case-6:return"No stream";case-7:return"Not a HTTP server";case-8:return"Not enough memory";case-9:return"Encoding error";case-10:return"Stream write";case-11:return"Read timeout"}return"Unknown "+t}function ri(t){switch(t){case 2:case 4:case 7:return!0}return!1}function Ke(t,e){return t==1||t==2&&e}function Ut(t){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+t}function ge(t,e){return isNaN(t)?"-":(isNaN(e)&&(e=t<10?1:0),t.toFixed(e))}function fl(t,e){return t.setTime(t.getTime()+e*36e5),t}function Ja(t){if(t.chip=="esp8266")switch(t.boot_reason){case 0:return"Normal";case 1:return"WDT reset";case 2:return"Exception reset";case 3:return"Soft WDT reset";case 4:return"Software restart";case 5:return"Deep sleep";case 6:return"External reset";default:return"Unknown (8266)"}else switch(t.boot_reason){case 1:return"Vbat power on reset";case 3:return"Software reset";case 4:return"WDT reset";case 5:return"Deep sleep";case 6:return"SLC reset";case 7:return"Timer Group0 WDT reset";case 8:return"Timer Group1 WDT reset";case 9:return"RTC WDT reset";case 10:return"Instrusion test reset CPU";case 11:return"Time Group reset CPU";case 12:return"Software reset CPU";case 13:return"RTC WTD reset CPU";case 14:return"PRO CPU";case 15:return"Brownout";case 16:return"RTC reset";default:return"Unknown"}}function xa(t){return t=="EOE"?"ENTSO-E":t=="HKS"?"hvakosterstrommen.no":t=="EDS"?"Energy Data Service":t=="MIX"?"Mixed sources":"Unknown ("+t+")"}async function jl(t,e={}){const{timeout:l=8e3}=e,n=new AbortController,i=setTimeout(()=>n.abort(),l),o=await fetch(t,{...e,signal:n.signal});return clearTimeout(i),o}let al={version:"",chip:"",mac:null,apmac:null,vndcfg:null,usrcfg:null,fwconsent:null,booting:!1,upgrading:!1,ui:{},security:0,boot_reason:0,upgrade:{x:-1,e:0,f:null,t:null},trying:null};const jt=at(al);async function yo(){al=await(await jl("/sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),jt.set(al)}let vs=0,eu=-127,tu=null,y1={};const C1=vc(y1,t=>{let e;async function l(){jl("/data.json").then(n=>n.json()).then(n=>{t(n),eu!=n.t&&(eu=n.t,setTimeout(jc,2e3)),tu==null&&n.pe&&n.p!=null&&(tu=n.p,qc()),al.upgrading?window.location.reload():(!al||!al.chip||al.booting||vs>1&&!ri(al.board))&&(yo(),an&&clearTimeout(an),an=setTimeout(Mo,2e3),un&&clearTimeout(un),un=setTimeout(So,3e3));let i=5e3;if(ri(al.board)&&n.v>2.5){let o=3.3-Math.min(3.3,n.v);o>0&&(i=Math.max(o,.1)*10*5e3)}i>5e3&&console.log("Scheduling next data fetch in "+i+"ms"),e&&clearTimeout(e),e=setTimeout(l,i),vs=0}).catch(n=>{vs++,vs>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(l,15e3)):e=setTimeout(l,ri(al.board)?1e4:5e3)})}return l(),function(){clearTimeout(e)}});let io={},yi;const Co=at(io);async function Fc(){let t=!1;if(Co.update(e=>{for(var l=0;l<36;l++){if(e[Oe(l)]==null){t=l<12;break}e[Oe(l)]=e[Oe(l+1)]}return e}),t)qc();else{let e=new Date;yi=setTimeout(Fc,(60-e.getMinutes())*6e4)}}async function qc(){yi&&(clearTimeout(yi),yi=0),io=await(await jl("/energyprice.json")).json(),Co.set(io);let e=new Date;yi=setTimeout(Fc,(60-e.getMinutes())*6e4)}let so={},an;async function Mo(){an&&(clearTimeout(an),an=0),so=await(await jl("/dayplot.json")).json(),Bc.set(so);let e=new Date;an=setTimeout(Mo,(60-e.getMinutes())*6e4+20)}const Bc=at(so,t=>(Mo(),function(){}));let oo={},un;async function So(){un&&(clearTimeout(un),un=0),oo=await(await jl("/monthplot.json")).json(),Uc.set(oo);let e=new Date;un=setTimeout(So,(24-e.getHours())*36e5+40)}const Uc=at(oo,t=>(So(),function(){}));let ro={};async function jc(){ro=await(await jl("/temperature.json")).json(),Hc.set(ro)}const Hc=at(ro,t=>(jc(),function(){}));let ao={},hs;async function Wc(){hs&&(clearTimeout(hs),hs=0),ao=await(await jl("/tariff.json")).json(),zc.set(ao);let e=new Date;hs=setTimeout(Wc,(60-e.getMinutes())*6e4+30)}const zc=at(ao,t=>function(){});let uo=[];const $o=at(uo);async function M1(){uo=await(await jl("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),$o.set(uo)}function Ms(t){return"WARNING: "+t+" must be connected to an external power supply during firmware upgrade. Failure to do so may cause power-down during upload resulting in non-functioning unit."}async function Gc(t){await(await fetch("/upgrade?expected_version="+t,{method:"POST"})).json()}function Vc(t,e){if(/^v\d{1,2}\.\d{1,2}\.\d{1,2}$/.test(t)){let l=t.substring(1).split("."),n=parseInt(l[0]),i=parseInt(l[1]),o=parseInt(l[2]),a=[...e];a.reverse();let u,c,f;for(let _=0;_o&&(u=p):S==i+1&&(c=p);else if(d==n+1)if(f){let $=f.tag_name.substring(1).split(".");parseInt($[0]);let N=parseInt($[1]);parseInt($[2]),S==N&&(f=p)}else f=p}return c||f||u||!1}else return e[0]}const S1="/github.svg";function lu(t){let e,l;function n(a,u){return a[1]>1?D1:a[1]>0?E1:a[2]>1?P1:a[2]>0?A1:a[3]>1?N1:a[3]>0?T1:$1}let i=n(t),o=i(t);return{c(){e=T(`Up + `),o.c(),l=Ve()},m(a,u){M(a,e,u),o.m(a,u),M(a,l,u)},p(a,u){i===(i=n(a))&&o?o.p(a,u):(o.d(1),o=i(a),o&&(o.c(),o.m(l.parentNode,l)))},d(a){a&&C(e),o.d(a),a&&C(l)}}}function $1(t){let e,l;return{c(){e=T(t[0]),l=T(" seconds")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&1&&Z(e,n[0])},d(n){n&&C(e),n&&C(l)}}}function T1(t){let e,l;return{c(){e=T(t[3]),l=T(" minute")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&8&&Z(e,n[3])},d(n){n&&C(e),n&&C(l)}}}function N1(t){let e,l;return{c(){e=T(t[3]),l=T(" minutes")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&8&&Z(e,n[3])},d(n){n&&C(e),n&&C(l)}}}function A1(t){let e,l;return{c(){e=T(t[2]),l=T(" hour")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&4&&Z(e,n[2])},d(n){n&&C(e),n&&C(l)}}}function P1(t){let e,l;return{c(){e=T(t[2]),l=T(" hours")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&4&&Z(e,n[2])},d(n){n&&C(e),n&&C(l)}}}function E1(t){let e,l;return{c(){e=T(t[1]),l=T(" day")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&2&&Z(e,n[1])},d(n){n&&C(e),n&&C(l)}}}function D1(t){let e,l;return{c(){e=T(t[1]),l=T(" days")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&2&&Z(e,n[1])},d(n){n&&C(e),n&&C(l)}}}function I1(t){let e,l=t[0]&&lu(t);return{c(){l&&l.c(),e=Ve()},m(n,i){l&&l.m(n,i),M(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=lu(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:fe,o:fe,d(n){l&&l.d(n),n&&C(e)}}}function R1(t,e,l){let{epoch:n}=e,i=0,o=0,a=0;return t.$$set=u=>{"epoch"in u&&l(0,n=u.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(l(1,i=Math.floor(n/86400)),l(2,o=Math.floor(n/3600)),l(3,a=Math.floor(n/60)))},[n,i,o,a]}class L1 extends Ee{constructor(e){super(),Pe(this,e,R1,I1,Ne,{epoch:0})}}function O1(t){let e,l,n;return{c(){e=m("span"),l=T(t[2]),r(e,"title",t[1]),r(e,"class",n="bd-"+t[0])},m(i,o){M(i,e,o),s(e,l)},p(i,[o]){o&4&&Z(l,i[2]),o&2&&r(e,"title",i[1]),o&1&&n!==(n="bd-"+i[0])&&r(e,"class",n)},i:fe,o:fe,d(i){i&&C(e)}}}function F1(t,e,l){let{color:n}=e,{title:i}=e,{text:o}=e;return t.$$set=a=>{"color"in a&&l(0,n=a.color),"title"in a&&l(1,i=a.title),"text"in a&&l(2,o=a.text)},[n,i,o]}class fn extends Ee{constructor(e){super(),Pe(this,e,F1,O1,Ne,{color:0,title:1,text:2})}}function q1(t){let e,l=`${Oe(t[0].getDate())}.${Oe(t[0].getMonth()+1)}.${t[0].getFullYear()} ${Oe(t[0].getHours())}:${Oe(t[0].getMinutes())}`,n;return{c(){e=m("span"),n=T(l),r(e,"class",t[1])},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=`${Oe(i[0].getDate())}.${Oe(i[0].getMonth()+1)}.${i[0].getFullYear()} ${Oe(i[0].getHours())}:${Oe(i[0].getMinutes())}`)&&Z(n,l),o&2&&r(e,"class",i[1])},d(i){i&&C(e)}}}function B1(t){let e=`${Oe(t[0].getDate())}. ${no[t[0].getMonth()]} ${Oe(t[0].getHours())}:${Oe(t[0].getMinutes())}`,l;return{c(){l=T(e)},m(n,i){M(n,l,i)},p(n,i){i&1&&e!==(e=`${Oe(n[0].getDate())}. ${no[n[0].getMonth()]} ${Oe(n[0].getHours())}:${Oe(n[0].getMinutes())}`)&&Z(l,e)},d(n){n&&C(l)}}}function U1(t){let e;function l(o,a){return o[2]?B1:q1}let n=l(t),i=n(t);return{c(){i.c(),e=Ve()},m(o,a){i.m(o,a),M(o,e,a)},p(o,[a]){n===(n=l(o))&&i?i.p(o,a):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},i:fe,o:fe,d(o){i.d(o),o&&C(e)}}}function j1(t,e,l){let{timestamp:n}=e,{fullTimeColor:i}=e,{offset:o}=e,a;return t.$$set=u=>{"timestamp"in u&&l(0,n=u.timestamp),"fullTimeColor"in u&&l(1,i=u.fullTimeColor),"offset"in u&&l(3,o=u.offset)},t.$$.update=()=>{t.$$.dirty&9&&(l(2,a=Math.abs(new Date().getTime()-n.getTime())<3e5),isNaN(o)||fl(n,o-(24+n.getHours()-n.getUTCHours())%24))},[n,i,a,o]}class Kc extends Ee{constructor(e){super(),Pe(this,e,j1,U1,Ne,{timestamp:0,fullTimeColor:1,offset:3})}}function H1(t){let e,l,n;return{c(){e=Fe("svg"),l=Fe("path"),n=Fe("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 011.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 01-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.397.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 01-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.505-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.107-1.204l-.527-.738a1.125 1.125 0 01.12-1.45l.773-.773a1.125 1.125 0 011.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894z"),r(n,"stroke-linecap","round"),r(n,"stroke-linejoin","round"),r(n,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(i,o){M(i,e,o),s(e,l),s(e,n)},p:fe,i:fe,o:fe,d(i){i&&C(e)}}}class W1 extends Ee{constructor(e){super(),Pe(this,e,null,H1,Ne,{})}}function z1(t){let e,l;return{c(){e=Fe("svg"),l=Fe("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(n,i){M(n,e,i),s(e,l)},p:fe,i:fe,o:fe,d(n){n&&C(e)}}}class G1 extends Ee{constructor(e){super(),Pe(this,e,null,z1,Ne,{})}}function V1(t){let e,l;return{c(){e=Fe("svg"),l=Fe("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(n,i){M(n,e,i),s(e,l)},p:fe,i:fe,o:fe,d(n){n&&C(e)}}}class Bt extends Ee{constructor(e){super(),Pe(this,e,null,V1,Ne,{})}}function K1(t){let e,l;return{c(){e=Fe("svg"),l=Fe("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M9 8.25H7.5a2.25 2.25 0 00-2.25 2.25v9a2.25 2.25 0 002.25 2.25h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25H15M9 12l3 3m0 0l3-3m-3 3V2.25"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(n,i){M(n,e,i),s(e,l)},p:fe,i:fe,o:fe,d(n){n&&C(e)}}}class Yc extends Ee{constructor(e){super(),Pe(this,e,null,K1,Ne,{})}}function Y1(t){let e,l,n=t[1].version+"",i;return{c(){e=T("AMS reader "),l=m("span"),i=T(n)},m(o,a){M(o,e,a),M(o,l,a),s(l,i)},p(o,a){a&2&&n!==(n=o[1].version+"")&&Z(i,n)},d(o){o&&C(e),o&&C(l)}}}function nu(t){let e,l=(t[0].t>-50?t[0].t.toFixed(1):"-")+"",n,i;return{c(){e=m("div"),n=T(l),i=T("\xB0C"),r(e,"class","flex-none my-auto")},m(o,a){M(o,e,a),s(e,n),s(e,i)},p(o,a){a&1&&l!==(l=(o[0].t>-50?o[0].t.toFixed(1):"-")+"")&&Z(n,l)},d(o){o&&C(e)}}}function iu(t){let e,l="HAN: "+Ya(t[0].he),n;return{c(){e=m("div"),n=T(l),r(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="HAN: "+Ya(i[0].he))&&Z(n,l)},d(i){i&&C(e)}}}function su(t){let e,l="MQTT: "+Qa(t[0].me),n;return{c(){e=m("div"),n=T(l),r(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="MQTT: "+Qa(i[0].me))&&Z(n,l)},d(i){i&&C(e)}}}function ou(t){let e,l="PriceAPI: "+Xa(t[0].ee),n;return{c(){e=m("div"),n=T(l),r(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="PriceAPI: "+Xa(i[0].ee))&&Z(n,l)},d(i){i&&C(e)}}}function ru(t){let e,l,n,i,o,a;return l=new el({props:{to:"/configuration",$$slots:{default:[Q1]},$$scope:{ctx:t}}}),o=new el({props:{to:"/status",$$slots:{default:[X1]},$$scope:{ctx:t}}}),{c(){e=m("div"),ie(l.$$.fragment),n=h(),i=m("div"),ie(o.$$.fragment),r(e,"class","flex-none px-1 mt-1"),r(e,"title","Configuration"),r(i,"class","flex-none px-1 mt-1"),r(i,"title","Device information")},m(u,c){M(u,e,c),le(l,e,null),M(u,n,c),M(u,i,c),le(o,i,null),a=!0},i(u){a||(D(l.$$.fragment,u),D(o.$$.fragment,u),a=!0)},o(u){q(l.$$.fragment,u),q(o.$$.fragment,u),a=!1},d(u){u&&C(e),ne(l),u&&C(n),u&&C(i),ne(o)}}}function Q1(t){let e,l;return e=new W1({}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function X1(t){let e,l;return e=new G1({}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function au(t){let e,l,n,i,o;const a=[J1,Z1],u=[];function c(f,_){return f[1].security==0||f[0].a?0:1}return l=c(t),n=u[l]=a[l](t),{c(){e=m("div"),n.c(),r(e,"class","flex-none mr-3 text-yellow-500"),r(e,"title",i="New version: "+t[2].tag_name)},m(f,_){M(f,e,_),u[l].m(e,null),o=!0},p(f,_){let p=l;l=c(f),l===p?u[l].p(f,_):(De(),q(u[p],1,1,()=>{u[p]=null}),Ie(),n=u[l],n?n.p(f,_):(n=u[l]=a[l](f),n.c()),D(n,1),n.m(e,null)),(!o||_&4&&i!==(i="New version: "+f[2].tag_name))&&r(e,"title",i)},i(f){o||(D(n),o=!0)},o(f){q(n),o=!1},d(f){f&&C(e),u[l].d()}}}function Z1(t){let e,l,n=t[2].tag_name+"",i;return{c(){e=m("span"),l=T("New version: "),i=T(n)},m(o,a){M(o,e,a),s(e,l),s(e,i)},p(o,a){a&4&&n!==(n=o[2].tag_name+"")&&Z(i,n)},i:fe,o:fe,d(o){o&&C(e)}}}function J1(t){let e,l,n,i=t[2].tag_name+"",o,a,u,c,f,_;return u=new Yc({}),{c(){e=m("button"),l=m("span"),n=T("New version: "),o=T(i),a=h(),ie(u.$$.fragment),r(l,"class","mt-1"),r(e,"class","flex")},m(p,b){M(p,e,b),s(e,l),s(l,n),s(l,o),s(e,a),le(u,e,null),c=!0,f||(_=ee(e,"click",t[3]),f=!0)},p(p,b){(!c||b&4)&&i!==(i=p[2].tag_name+"")&&Z(o,i)},i(p){c||(D(u.$$.fragment,p),c=!0)},o(p){q(u.$$.fragment,p),c=!1},d(p){p&&C(e),ne(u),f=!1,_()}}}function x1(t){let e,l,n,i,o,a,u,c,f,_,p,b,v=(t[0].m?(t[0].m/1e3).toFixed(1):"-")+"",d,S,y,$,N,E,B,P,L,O,F,x,j,z,G,V,W,U,K,H,Y,X,re,ue,ke,me,$e,je,Re,He;i=new el({props:{to:"/",$$slots:{default:[Y1]},$$scope:{ctx:t}}}),c=new L1({props:{epoch:t[0].u}});let we=t[0].t>-50&&nu(t);N=new fn({props:{title:"ESP",text:t[1].booting?"Booting":t[0].v>2?t[0].v.toFixed(2)+"V":"ESP",color:ql(t[1].booting?2:t[0].em)}}),B=new fn({props:{title:"HAN",text:"HAN",color:ql(t[1].booting?9:t[0].hm)}}),L=new fn({props:{title:"WiFi",text:t[0].r?t[0].r.toFixed(0)+"dBm":"WiFi",color:ql(t[1].booting?9:t[0].wm)}}),F=new fn({props:{title:"MQTT",text:"MQTT",color:ql(t[1].booting?9:t[0].mm)}});let Te=(t[0].he<0||t[0].he>0)&&iu(t),Le=t[0].me<0&&su(t),Me=(t[0].ee>0||t[0].ee<0)&&ou(t);re=new Kc({props:{timestamp:t[0].c?new Date(t[0].c*1e3):new Date(0),offset:t[1].clock_offset,fullTimeColor:"text-red-500"}});let w=t[1].vndcfg&&t[1].usrcfg&&ru(t);je=new Bt({});let g=t[1].fwconsent===1&&t[2]&&au(t);return{c(){e=m("nav"),l=m("div"),n=m("div"),ie(i.$$.fragment),o=h(),a=m("div"),u=m("div"),ie(c.$$.fragment),f=h(),we&&we.c(),_=h(),p=m("div"),b=T("Free mem: "),d=T(v),S=T("kb"),y=h(),$=m("div"),ie(N.$$.fragment),E=h(),ie(B.$$.fragment),P=h(),ie(L.$$.fragment),O=h(),ie(F.$$.fragment),x=h(),Te&&Te.c(),j=h(),Le&&Le.c(),z=h(),Me&&Me.c(),G=h(),V=m("div"),W=m("div"),U=m("a"),K=m("img"),Y=h(),X=m("div"),ie(re.$$.fragment),ue=h(),w&&w.c(),ke=h(),me=m("div"),$e=m("a"),ie(je.$$.fragment),Re=h(),g&&g.c(),r(n,"class","flex text-lg text-gray-100 p-2"),r(u,"class","flex-none my-auto"),r(p,"class","flex-none my-auto"),r(a,"class","flex-none my-auto p-2 flex space-x-4"),r($,"class","flex-auto flex-wrap my-auto justify-center p-2"),r(K,"class","gh-logo"),Js(K.src,H=S1)||r(K,"src",H),r(K,"alt","GitHub repo"),r(U,"class","float-right"),r(U,"href","https://github.com/UtilitechAS/amsreader-firmware"),r(U,"target","_blank"),r(U,"rel","noreferrer"),r(U,"aria-label","GitHub"),r(W,"class","flex-none"),r(X,"class","flex-none my-auto px-2"),r($e,"href",Ut("")),r($e,"target","_blank"),r($e,"rel","noreferrer"),r(me,"class","flex-none px-1 mt-1"),r(me,"title","Documentation"),r(V,"class","flex-auto p-2 flex flex-row-reverse flex-wrap"),r(l,"class","flex flex-wrap space-x-4 text-sm text-gray-300"),r(e,"class","bg-violet-600 p-1 rounded-md mx-2")},m(k,A){M(k,e,A),s(e,l),s(l,n),le(i,n,null),s(l,o),s(l,a),s(a,u),le(c,u,null),s(a,f),we&&we.m(a,null),s(a,_),s(a,p),s(p,b),s(p,d),s(p,S),s(l,y),s(l,$),le(N,$,null),s($,E),le(B,$,null),s($,P),le(L,$,null),s($,O),le(F,$,null),s(l,x),Te&&Te.m(l,null),s(l,j),Le&&Le.m(l,null),s(l,z),Me&&Me.m(l,null),s(l,G),s(l,V),s(V,W),s(W,U),s(U,K),s(V,Y),s(V,X),le(re,X,null),s(V,ue),w&&w.m(V,null),s(V,ke),s(V,me),s(me,$e),le(je,$e,null),s(V,Re),g&&g.m(V,null),He=!0},p(k,[A]){const I={};A&18&&(I.$$scope={dirty:A,ctx:k}),i.$set(I);const Q={};A&1&&(Q.epoch=k[0].u),c.$set(Q),k[0].t>-50?we?we.p(k,A):(we=nu(k),we.c(),we.m(a,_)):we&&(we.d(1),we=null),(!He||A&1)&&v!==(v=(k[0].m?(k[0].m/1e3).toFixed(1):"-")+"")&&Z(d,v);const J={};A&3&&(J.text=k[1].booting?"Booting":k[0].v>2?k[0].v.toFixed(2)+"V":"ESP"),A&3&&(J.color=ql(k[1].booting?2:k[0].em)),N.$set(J);const se={};A&3&&(se.color=ql(k[1].booting?9:k[0].hm)),B.$set(se);const ce={};A&1&&(ce.text=k[0].r?k[0].r.toFixed(0)+"dBm":"WiFi"),A&3&&(ce.color=ql(k[1].booting?9:k[0].wm)),L.$set(ce);const ve={};A&3&&(ve.color=ql(k[1].booting?9:k[0].mm)),F.$set(ve),k[0].he<0||k[0].he>0?Te?Te.p(k,A):(Te=iu(k),Te.c(),Te.m(l,j)):Te&&(Te.d(1),Te=null),k[0].me<0?Le?Le.p(k,A):(Le=su(k),Le.c(),Le.m(l,z)):Le&&(Le.d(1),Le=null),k[0].ee>0||k[0].ee<0?Me?Me.p(k,A):(Me=ou(k),Me.c(),Me.m(l,G)):Me&&(Me.d(1),Me=null);const Se={};A&1&&(Se.timestamp=k[0].c?new Date(k[0].c*1e3):new Date(0)),A&2&&(Se.offset=k[1].clock_offset),re.$set(Se),k[1].vndcfg&&k[1].usrcfg?w?A&2&&D(w,1):(w=ru(k),w.c(),D(w,1),w.m(V,ke)):w&&(De(),q(w,1,1,()=>{w=null}),Ie()),k[1].fwconsent===1&&k[2]?g?(g.p(k,A),A&6&&D(g,1)):(g=au(k),g.c(),D(g,1),g.m(V,null)):g&&(De(),q(g,1,1,()=>{g=null}),Ie())},i(k){He||(D(i.$$.fragment,k),D(c.$$.fragment,k),D(N.$$.fragment,k),D(B.$$.fragment,k),D(L.$$.fragment,k),D(F.$$.fragment,k),D(re.$$.fragment,k),D(w),D(je.$$.fragment,k),D(g),He=!0)},o(k){q(i.$$.fragment,k),q(c.$$.fragment,k),q(N.$$.fragment,k),q(B.$$.fragment,k),q(L.$$.fragment,k),q(F.$$.fragment,k),q(re.$$.fragment,k),q(w),q(je.$$.fragment,k),q(g),He=!1},d(k){k&&C(e),ne(i),ne(c),we&&we.d(),ne(N),ne(B),ne(L),ne(F),Te&&Te.d(),Le&&Le.d(),Me&&Me.d(),ne(re),w&&w.d(),ne(je),g&&g.d()}}}function em(t,e,l){let{data:n={}}=e,i={},o={};function a(){confirm("Do you want to upgrade this device to "+o.tag_name+"?")&&(!ri(i.board)||confirm(Ms(be(i.chip,i.board))))&&(jt.update(u=>(u.upgrading=!0,u)),Gc(o.tag_name))}return jt.subscribe(u=>{l(1,i=u),u.fwconsent===1&&M1()}),$o.subscribe(u=>{l(2,o=Vc(i.version,u))}),t.$$set=u=>{"data"in u&&l(0,n=u.data)},[n,i,o,a]}class tm extends Ee{constructor(e){super(),Pe(this,e,em,x1,Ne,{data:0})}}function lm(t){let e,l,n,i;return{c(){e=Fe("svg"),l=Fe("path"),n=Fe("path"),r(l,"d",Zs(150,150,115,210,510)),r(l,"stroke","#eee"),r(l,"fill","none"),r(l,"stroke-width","55"),r(n,"d",i=Zs(150,150,115,210,210+300*t[0]/100)),r(n,"stroke",t[1]),r(n,"fill","none"),r(n,"stroke-width","55"),r(e,"viewBox","0 0 300 300"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"height","100%")},m(o,a){M(o,e,a),s(e,l),s(e,n)},p(o,[a]){a&1&&i!==(i=Zs(150,150,115,210,210+300*o[0]/100))&&r(n,"d",i),a&2&&r(n,"stroke",o[1])},i:fe,o:fe,d(o){o&&C(e)}}}function uu(t,e,l,n){var i=(n-90)*Math.PI/180;return{x:t+l*Math.cos(i),y:e+l*Math.sin(i)}}function Zs(t,e,l,n,i){var o=uu(t,e,l,i),a=uu(t,e,l,n),u=i-n<=180?"0":"1",c=["M",o.x,o.y,"A",l,l,0,u,0,a.x,a.y].join(" ");return c}function nm(t,e,l){let{pct:n=0}=e,{color:i="red"}=e;return t.$$set=o=>{"pct"in o&&l(0,n=o.pct),"color"in o&&l(1,i=o.color)},[n,i]}class im extends Ee{constructor(e){super(),Pe(this,e,nm,lm,Ne,{pct:0,color:1})}}function fu(t){let e,l,n,i,o,a,u,c;return{c(){e=m("br"),l=h(),n=m("span"),i=T(t[3]),o=h(),a=m("span"),u=T(t[4]),c=T("/kWh"),r(n,"class","pl-sub"),r(a,"class","pl-snt")},m(f,_){M(f,e,_),M(f,l,_),M(f,n,_),s(n,i),M(f,o,_),M(f,a,_),s(a,u),s(a,c)},p(f,_){_&8&&Z(i,f[3]),_&16&&Z(u,f[4])},d(f){f&&C(e),f&&C(l),f&&C(n),f&&C(o),f&&C(a)}}}function sm(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,y;l=new im({props:{pct:t[6],color:t[5](t[6])}});let $=t[3]&&fu(t);return{c(){e=m("div"),ie(l.$$.fragment),n=h(),i=m("span"),o=m("span"),a=T(t[2]),u=h(),c=m("br"),f=h(),_=m("span"),p=T(t[0]),b=h(),v=m("span"),d=T(t[1]),S=h(),$&&$.c(),r(o,"class","pl-lab"),r(_,"class","pl-val"),r(v,"class","pl-unt"),r(i,"class","pl-ov"),r(e,"class","pl-root")},m(N,E){M(N,e,E),le(l,e,null),s(e,n),s(e,i),s(i,o),s(o,a),s(i,u),s(i,c),s(i,f),s(i,_),s(_,p),s(i,b),s(i,v),s(v,d),s(i,S),$&&$.m(i,null),y=!0},p(N,[E]){const B={};E&64&&(B.pct=N[6]),E&96&&(B.color=N[5](N[6])),l.$set(B),(!y||E&4)&&Z(a,N[2]),(!y||E&1)&&Z(p,N[0]),(!y||E&2)&&Z(d,N[1]),N[3]?$?$.p(N,E):($=fu(N),$.c(),$.m(i,null)):$&&($.d(1),$=null)},i(N){y||(D(l.$$.fragment,N),y=!0)},o(N){q(l.$$.fragment,N),y=!1},d(N){N&&C(e),ne(l),$&&$.d()}}}function om(t,e,l){let{val:n}=e,{max:i}=e,{unit:o}=e,{label:a}=e,{sub:u=""}=e,{subunit:c=""}=e,{colorFn:f}=e,_=0;return t.$$set=p=>{"val"in p&&l(0,n=p.val),"max"in p&&l(7,i=p.max),"unit"in p&&l(1,o=p.unit),"label"in p&&l(2,a=p.label),"sub"in p&&l(3,u=p.sub),"subunit"in p&&l(4,c=p.subunit),"colorFn"in p&&l(5,f=p.colorFn)},t.$$.update=()=>{t.$$.dirty&129&&l(6,_=Math.min(n,i)/i*100)},[n,o,a,u,c,f,_,i]}class Qc extends Ee{constructor(e){super(),Pe(this,e,om,sm,Ne,{val:0,max:7,unit:1,label:2,sub:3,subunit:4,colorFn:5})}}function cu(t,e,l){const n=t.slice();return n[11]=e[l],n[13]=l,n}function mu(t,e,l){const n=t.slice();return n[11]=e[l],n[13]=l,n}function pu(t,e,l){const n=t.slice();return n[15]=e[l],n}function _u(t){let e,l,n,i,o,a,u=t[0].title&&du(t),c=t[0].y.ticks,f=[];for(let d=0;dt[9].call(e))},m(o,a){M(o,e,a),s(e,n),i=sc(e,t[9].bind(e))},p(o,a){a&1&&l!==(l=o[0].title+"")&&Z(n,l)},d(o){o&&C(e),i()}}}function vu(t){let e,l,n,i=t[15].label+"",o,a,u,c;return{c(){e=Fe("g"),l=Fe("line"),n=Fe("text"),o=T(i),r(l,"x2","100%"),r(n,"y","-4"),r(n,"x",a=t[15].align=="right"?"85%":""),r(e,"class",u="tick tick-"+t[15].value+" tick-"+t[15].color),r(e,"transform",c="translate(0, "+t[7](t[15].value)+")")},m(f,_){M(f,e,_),s(e,l),s(e,n),s(n,o)},p(f,_){_&1&&i!==(i=f[15].label+"")&&Z(o,i),_&1&&a!==(a=f[15].align=="right"?"85%":"")&&r(n,"x",a),_&1&&u!==(u="tick tick-"+f[15].value+" tick-"+f[15].color)&&r(e,"class",u),_&129&&c!==(c="translate(0, "+f[7](f[15].value)+")")&&r(e,"transform",c)},d(f){f&&C(e)}}}function hu(t){let e=!isNaN(t[7](t[15].value)),l,n=e&&vu(t);return{c(){n&&n.c(),l=Ve()},m(i,o){n&&n.m(i,o),M(i,l,o)},p(i,o){o&129&&(e=!isNaN(i[7](i[15].value))),e?n?n.p(i,o):(n=vu(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&C(l)}}}function bu(t){let e,l,n=(t[3]>20||t[13]%2==0)&&gu(t);return{c(){e=Fe("g"),n&&n.c(),r(e,"class","tick"),r(e,"transform",l="translate("+t[6](t[13])+","+t[4]+")")},m(i,o){M(i,e,o),n&&n.m(e,null)},p(i,o){i[3]>20||i[13]%2==0?n?n.p(i,o):(n=gu(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o&80&&l!==(l="translate("+i[6](i[13])+","+i[4]+")")&&r(e,"transform",l)},d(i){i&&C(e),n&&n.d()}}}function gu(t){let e,l=t[11].label+"",n,i;return{c(){e=Fe("text"),n=T(l),r(e,"x",i=t[3]/2),r(e,"y","-4")},m(o,a){M(o,e,a),s(e,n)},p(o,a){a&1&&l!==(l=o[11].label+"")&&Z(n,l),a&8&&i!==(i=o[3]/2)&&r(e,"x",i)},d(o){o&&C(e)}}}function ku(t){let e=!isNaN(t[6](t[13])),l,n=e&&bu(t);return{c(){n&&n.c(),l=Ve()},m(i,o){n&&n.m(i,o),M(i,l,o)},p(i,o){o&64&&(e=!isNaN(i[6](i[13]))),e?n?n.p(i,o):(n=bu(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&C(l)}}}function wu(t){let e,l,n=t[11].value!==void 0&&yu(t),i=t[11].value2>1e-4&&Su(t);return{c(){e=Fe("g"),n&&n.c(),l=Fe("g"),i&&i.c()},m(o,a){M(o,e,a),n&&n.m(e,null),M(o,l,a),i&&i.m(l,null)},p(o,a){o[11].value!==void 0?n?n.p(o,a):(n=yu(o),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o[11].value2>1e-4?i?i.p(o,a):(i=Su(o),i.c(),i.m(l,null)):i&&(i.d(1),i=null)},d(o){o&&C(e),n&&n.d(),o&&C(l),i&&i.d()}}}function yu(t){let e,l,n,i,o,a,u,c=t[3]>15&&Cu(t);return{c(){e=Fe("rect"),c&&c.c(),u=Ve(),r(e,"x",l=t[6](t[13])+2),r(e,"y",n=t[7](t[11].value)),r(e,"width",i=t[3]-4),r(e,"height",o=t[7](t[0].y.min)-t[7](Math.min(t[0].y.min,0)+t[11].value)),r(e,"fill",a=t[11].color)},m(f,_){M(f,e,_),c&&c.m(f,_),M(f,u,_)},p(f,_){_&64&&l!==(l=f[6](f[13])+2)&&r(e,"x",l),_&129&&n!==(n=f[7](f[11].value))&&r(e,"y",n),_&8&&i!==(i=f[3]-4)&&r(e,"width",i),_&129&&o!==(o=f[7](f[0].y.min)-f[7](Math.min(f[0].y.min,0)+f[11].value))&&r(e,"height",o),_&1&&a!==(a=f[11].color)&&r(e,"fill",a),f[3]>15?c?c.p(f,_):(c=Cu(f),c.c(),c.m(u.parentNode,u)):c&&(c.d(1),c=null)},d(f){f&&C(e),c&&c.d(f),f&&C(u)}}}function Cu(t){let e,l=t[11].label+"",n,i,o,a,u,c,f=t[11].title&&Mu(t);return{c(){e=Fe("text"),n=T(l),f&&f.c(),c=Ve(),r(e,"width",i=t[3]-4),r(e,"dominant-baseline","middle"),r(e,"text-anchor",o=t[3]t[7](0)-t[8]?t[11].color:"white"),r(e,"transform",u="translate("+(t[6](t[13])+t[3]/2)+" "+(t[7](t[11].value)>t[7](0)-t[8]?t[7](t[11].value)-t[8]:t[7](t[11].value)+10)+") rotate("+(t[3]_[7](0)-_[8]?_[11].color:"white")&&r(e,"fill",a),p&457&&u!==(u="translate("+(_[6](_[13])+_[3]/2)+" "+(_[7](_[11].value)>_[7](0)-_[8]?_[7](_[11].value)-_[8]:_[7](_[11].value)+10)+") rotate("+(_[3]15&&$u(t);return{c(){e=Fe("rect"),c&&c.c(),u=Ve(),r(e,"x",l=t[6](t[13])+2),r(e,"y",n=t[7](0)),r(e,"width",i=t[3]-4),r(e,"height",o=t[7](t[0].y.min)-t[7](t[0].y.min+t[11].value2)),r(e,"fill",a=t[11].color2?t[11].color2:t[11].color)},m(f,_){M(f,e,_),c&&c.m(f,_),M(f,u,_)},p(f,_){_&64&&l!==(l=f[6](f[13])+2)&&r(e,"x",l),_&128&&n!==(n=f[7](0))&&r(e,"y",n),_&8&&i!==(i=f[3]-4)&&r(e,"width",i),_&129&&o!==(o=f[7](f[0].y.min)-f[7](f[0].y.min+f[11].value2))&&r(e,"height",o),_&1&&a!==(a=f[11].color2?f[11].color2:f[11].color)&&r(e,"fill",a),f[3]>15?c?c.p(f,_):(c=$u(f),c.c(),c.m(u.parentNode,u)):c&&(c.d(1),c=null)},d(f){f&&C(e),c&&c.d(f),f&&C(u)}}}function $u(t){let e,l=t[11].label2+"",n,i,o,a,u,c=t[11].title2&&Tu(t);return{c(){e=Fe("text"),n=T(l),c&&c.c(),u=Ve(),r(e,"width",i=t[3]-4),r(e,"dominant-baseline","middle"),r(e,"text-anchor","middle"),r(e,"fill",o=t[7](-t[11].value2)t[10].call(e))},m(i,o){M(i,e,o),n&&n.m(e,null),l=sc(e,t[10].bind(e))},p(i,[o]){i[0].x.ticks&&i[0].points&&i[4]?n?n.p(i,o):(n=_u(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},i:fe,o:fe,d(i){i&&C(e),n&&n.d(),l()}}}let cn=30;function am(t,e,l){let{config:n}=e,i,o,a,u,c,f,_,p=0;function b(){p=this.clientHeight,l(5,p)}function v(){i=this.clientWidth,o=this.clientHeight,l(1,i),l(2,o)}return t.$$set=d=>{"config"in d&&l(0,n=d.config)},t.$$.update=()=>{if(t.$$.dirty&63){l(4,f=o-p);let d=i-(n.padding.left+n.padding.right);l(3,a=d/n.points.length),l(8,_=an.y.max?$=n.padding.bottom:yf||$<0?0:$})}},[n,i,o,a,f,p,u,c,_,b,v]}class pn extends Ee{constructor(e){super(),Pe(this,e,am,rm,Ne,{config:0})}}function um(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function fm(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{ds:a}=e,u={};function c(f){return{label:ge(f)+"V",title:f.toFixed(1)+" V",value:isNaN(f)?0:f,color:k1(f||0)}}return t.$$set=f=>{"u1"in f&&l(1,n=f.u1),"u2"in f&&l(2,i=f.u2),"u3"in f&&l(3,o=f.u3),"ds"in f&&l(4,a=f.ds)},t.$$.update=()=>{if(t.$$.dirty&30){let f=[],_=[];n>0&&(f.push({label:a===1?"L1-L2":"L1"}),_.push(c(n))),i>0&&(f.push({label:a===1?"L1-L3":"L2"}),_.push(c(i))),o>0&&(f.push({label:a===1?"L2-L3":"L3"}),_.push(c(o))),l(0,u={title:"Voltage",padding:{top:20,right:15,bottom:20,left:35},y:{min:200,max:260,ticks:[{value:207,label:"-10%"},{value:230,label:"230v"},{value:253,label:"+10%"}]},x:{ticks:f},points:_})}},[u,n,i,o,a]}class cm extends Ee{constructor(e){super(),Pe(this,e,fm,um,Ne,{u1:1,u2:2,u3:3,ds:4})}}function mm(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function pm(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{i1:a}=e,{i2:u}=e,{i2e:c}=e,{i3:f}=e,{max:_}=e,p={};function b(v,d){return{label:ge(v)+"A",title:(d?"Estimated ":"")+v.toFixed(1)+" A",value:isNaN(v)?0:v,color:Oc(v?v/_*100:0,d)}}return t.$$set=v=>{"u1"in v&&l(1,n=v.u1),"u2"in v&&l(2,i=v.u2),"u3"in v&&l(3,o=v.u3),"i1"in v&&l(4,a=v.i1),"i2"in v&&l(5,u=v.i2),"i2e"in v&&l(6,c=v.i2e),"i3"in v&&l(7,f=v.i3),"max"in v&&l(8,_=v.max)},t.$$.update=()=>{if(t.$$.dirty&510){let v=[],d=[];n>0&&(v.push({label:"L1"}),d.push(b(a))),i>0&&(v.push({label:"L2"}),d.push(b(u,c))),o>0&&(v.push({label:"L3"}),d.push(b(f))),l(0,p={title:"Amperage",padding:{top:20,right:15,bottom:20,left:35},y:{min:0,max:_,ticks:[{value:0,label:"0%"},{value:_/4,label:"25%"},{value:_/2,label:"50%"},{value:_/4*3,label:"75%"},{value:_,label:"100%"}]},x:{ticks:v},points:d})}},[p,n,i,o,a,u,c,f,_]}class _m extends Ee{constructor(e){super(),Pe(this,e,pm,mm,Ne,{u1:1,u2:2,u3:3,i1:4,i2:5,i2e:6,i3:7,max:8})}}function dm(t){let e,l,n,i,o,a,u,c=(typeof t[0]<"u"?t[0].toFixed(0):"-")+"",f,_,p,b,v,d,S=(typeof t[1]<"u"?t[1].toFixed(0):"-")+"",y,$,N,E,B,P,L,O=(typeof t[2]<"u"?t[2].toFixed(1):"-")+"",F,x,j,z,G,V,W=(typeof t[3]<"u"?t[3].toFixed(1):"-")+"",U,K;return{c(){e=m("div"),l=m("strong"),l.textContent="Reactive",n=h(),i=m("div"),o=m("div"),o.textContent="Instant in",a=h(),u=m("div"),f=T(c),_=T(" VAr"),p=h(),b=m("div"),b.textContent="Instant out",v=h(),d=m("div"),y=T(S),$=T(" VAr"),N=h(),E=m("div"),B=m("div"),B.textContent="Total in",P=h(),L=m("div"),F=T(O),x=T(" kVArh"),j=h(),z=m("div"),z.textContent="Total out",G=h(),V=m("div"),U=T(W),K=T(" kVArh"),r(u,"class","text-right"),r(d,"class","text-right"),r(i,"class","grid grid-cols-2 mt-4"),r(L,"class","text-right"),r(V,"class","text-right"),r(E,"class","grid grid-cols-2 mt-4"),r(e,"class","mx-2 text-sm")},m(H,Y){M(H,e,Y),s(e,l),s(e,n),s(e,i),s(i,o),s(i,a),s(i,u),s(u,f),s(u,_),s(i,p),s(i,b),s(i,v),s(i,d),s(d,y),s(d,$),s(e,N),s(e,E),s(E,B),s(E,P),s(E,L),s(L,F),s(L,x),s(E,j),s(E,z),s(E,G),s(E,V),s(V,U),s(V,K)},p(H,[Y]){Y&1&&c!==(c=(typeof H[0]<"u"?H[0].toFixed(0):"-")+"")&&Z(f,c),Y&2&&S!==(S=(typeof H[1]<"u"?H[1].toFixed(0):"-")+"")&&Z(y,S),Y&4&&O!==(O=(typeof H[2]<"u"?H[2].toFixed(1):"-")+"")&&Z(F,O),Y&8&&W!==(W=(typeof H[3]<"u"?H[3].toFixed(1):"-")+"")&&Z(U,W)},i:fe,o:fe,d(H){H&&C(e)}}}function vm(t,e,l){let{importInstant:n}=e,{exportInstant:i}=e,{importTotal:o}=e,{exportTotal:a}=e;return t.$$set=u=>{"importInstant"in u&&l(0,n=u.importInstant),"exportInstant"in u&&l(1,i=u.exportInstant),"importTotal"in u&&l(2,o=u.importTotal),"exportTotal"in u&&l(3,a=u.exportTotal)},[n,i,o,a]}class hm extends Ee{constructor(e){super(),Pe(this,e,vm,dm,Ne,{importInstant:0,exportInstant:1,importTotal:2,exportTotal:3})}}function Au(t){let e;function l(o,a){return o[3]?gm:bm}let n=l(t),i=n(t);return{c(){i.c(),e=Ve()},m(o,a){i.m(o,a),M(o,e,a)},p(o,a){n===(n=l(o))&&i?i.p(o,a):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){i.d(o),o&&C(e)}}}function bm(t){let e,l,n,i,o,a,u=ge(t[1].h.u,2)+"",c,f,_,p,b,v,d=ge(t[1].d.u,1)+"",S,y,$,N,E,B,P=ge(t[1].m.u)+"",L,O,F,x,j,z,G=ge(t[0].last_month.u)+"",V,W,U,K,H=t[4]&&Pu(t);return{c(){e=m("strong"),e.textContent="Consumption",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",o=h(),a=m("div"),c=T(u),f=T(" kWh"),_=h(),p=m("div"),p.textContent="Day",b=h(),v=m("div"),S=T(d),y=T(" kWh"),$=h(),N=m("div"),N.textContent="Month",E=h(),B=m("div"),L=T(P),O=T(" kWh"),F=h(),x=m("div"),x.textContent="Last month",j=h(),z=m("div"),V=T(G),W=T(" kWh"),U=h(),H&&H.c(),K=Ve(),r(a,"class","text-right"),r(v,"class","text-right"),r(B,"class","text-right"),r(z,"class","text-right"),r(n,"class","grid grid-cols-2 mb-3")},m(Y,X){M(Y,e,X),M(Y,l,X),M(Y,n,X),s(n,i),s(n,o),s(n,a),s(a,c),s(a,f),s(n,_),s(n,p),s(n,b),s(n,v),s(v,S),s(v,y),s(n,$),s(n,N),s(n,E),s(n,B),s(B,L),s(B,O),s(n,F),s(n,x),s(n,j),s(n,z),s(z,V),s(z,W),M(Y,U,X),H&&H.m(Y,X),M(Y,K,X)},p(Y,X){X&2&&u!==(u=ge(Y[1].h.u,2)+"")&&Z(c,u),X&2&&d!==(d=ge(Y[1].d.u,1)+"")&&Z(S,d),X&2&&P!==(P=ge(Y[1].m.u)+"")&&Z(L,P),X&1&&G!==(G=ge(Y[0].last_month.u)+"")&&Z(V,G),Y[4]?H?H.p(Y,X):(H=Pu(Y),H.c(),H.m(K.parentNode,K)):H&&(H.d(1),H=null)},d(Y){Y&&C(e),Y&&C(l),Y&&C(n),Y&&C(U),H&&H.d(Y),Y&&C(K)}}}function gm(t){let e,l,n,i,o,a,u=ge(t[1].h.u,2)+"",c,f,_,p,b,v,d,S=ge(t[1].d.u,1)+"",y,$,N,E,B,P,L,O=ge(t[1].m.u)+"",F,x,j,z,G,V,W,U=ge(t[0].last_month.u)+"",K,H,Y,X,re,ue,ke,me,$e,je,Re,He=ge(t[1].h.p,2)+"",we,Te,Le,Me,w,g,k,A=ge(t[1].d.p,1)+"",I,Q,J,se,ce,ve,Se,oe=ge(t[1].m.p)+"",pe,Be,_e,ye,vt,Hl,tl,ct=ge(t[0].last_month.p)+"",Tl,pl,Ht,ht,Xe=t[4]&&Eu(t),Ze=t[4]&&Du(t),Je=t[4]&&Iu(t),Ue=t[4]&&Ru(t),xe=t[4]&&Lu(t),We=t[4]&&Ou(t),et=t[4]&&Fu(t),tt=t[4]&&qu(t);return{c(){e=m("strong"),e.textContent="Import",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",o=h(),a=m("div"),c=T(u),f=T(" kWh"),_=h(),Xe&&Xe.c(),p=h(),b=m("div"),b.textContent="Day",v=h(),d=m("div"),y=T(S),$=T(" kWh"),N=h(),Ze&&Ze.c(),E=h(),B=m("div"),B.textContent="Month",P=h(),L=m("div"),F=T(O),x=T(" kWh"),j=h(),Je&&Je.c(),z=h(),G=m("div"),G.textContent="Last mo.",V=h(),W=m("div"),K=T(U),H=T(" kWh"),Y=h(),Ue&&Ue.c(),re=h(),ue=m("strong"),ue.textContent="Export",ke=h(),me=m("div"),$e=m("div"),$e.textContent="Hour",je=h(),Re=m("div"),we=T(He),Te=T(" kWh"),Le=h(),xe&&xe.c(),Me=h(),w=m("div"),w.textContent="Day",g=h(),k=m("div"),I=T(A),Q=T(" kWh"),J=h(),We&&We.c(),se=h(),ce=m("div"),ce.textContent="Month",ve=h(),Se=m("div"),pe=T(oe),Be=T(" kWh"),_e=h(),et&&et.c(),ye=h(),vt=m("div"),vt.textContent="Last mo.",Hl=h(),tl=m("div"),Tl=T(ct),pl=T(" kWh"),Ht=h(),tt&&tt.c(),r(a,"class","text-right"),r(d,"class","text-right"),r(L,"class","text-right"),r(W,"class","text-right"),r(n,"class",X="grid grid-cols-"+t[5]+" mb-3"),r(Re,"class","text-right"),r(k,"class","text-right"),r(Se,"class","text-right"),r(tl,"class","text-right"),r(me,"class",ht="grid grid-cols-"+t[5])},m(de,Ce){M(de,e,Ce),M(de,l,Ce),M(de,n,Ce),s(n,i),s(n,o),s(n,a),s(a,c),s(a,f),s(n,_),Xe&&Xe.m(n,null),s(n,p),s(n,b),s(n,v),s(n,d),s(d,y),s(d,$),s(n,N),Ze&&Ze.m(n,null),s(n,E),s(n,B),s(n,P),s(n,L),s(L,F),s(L,x),s(n,j),Je&&Je.m(n,null),s(n,z),s(n,G),s(n,V),s(n,W),s(W,K),s(W,H),s(n,Y),Ue&&Ue.m(n,null),M(de,re,Ce),M(de,ue,Ce),M(de,ke,Ce),M(de,me,Ce),s(me,$e),s(me,je),s(me,Re),s(Re,we),s(Re,Te),s(me,Le),xe&&xe.m(me,null),s(me,Me),s(me,w),s(me,g),s(me,k),s(k,I),s(k,Q),s(me,J),We&&We.m(me,null),s(me,se),s(me,ce),s(me,ve),s(me,Se),s(Se,pe),s(Se,Be),s(me,_e),et&&et.m(me,null),s(me,ye),s(me,vt),s(me,Hl),s(me,tl),s(tl,Tl),s(tl,pl),s(me,Ht),tt&&tt.m(me,null)},p(de,Ce){Ce&2&&u!==(u=ge(de[1].h.u,2)+"")&&Z(c,u),de[4]?Xe?Xe.p(de,Ce):(Xe=Eu(de),Xe.c(),Xe.m(n,p)):Xe&&(Xe.d(1),Xe=null),Ce&2&&S!==(S=ge(de[1].d.u,1)+"")&&Z(y,S),de[4]?Ze?Ze.p(de,Ce):(Ze=Du(de),Ze.c(),Ze.m(n,E)):Ze&&(Ze.d(1),Ze=null),Ce&2&&O!==(O=ge(de[1].m.u)+"")&&Z(F,O),de[4]?Je?Je.p(de,Ce):(Je=Iu(de),Je.c(),Je.m(n,z)):Je&&(Je.d(1),Je=null),Ce&1&&U!==(U=ge(de[0].last_month.u)+"")&&Z(K,U),de[4]?Ue?Ue.p(de,Ce):(Ue=Ru(de),Ue.c(),Ue.m(n,null)):Ue&&(Ue.d(1),Ue=null),Ce&32&&X!==(X="grid grid-cols-"+de[5]+" mb-3")&&r(n,"class",X),Ce&2&&He!==(He=ge(de[1].h.p,2)+"")&&Z(we,He),de[4]?xe?xe.p(de,Ce):(xe=Lu(de),xe.c(),xe.m(me,Me)):xe&&(xe.d(1),xe=null),Ce&2&&A!==(A=ge(de[1].d.p,1)+"")&&Z(I,A),de[4]?We?We.p(de,Ce):(We=Ou(de),We.c(),We.m(me,se)):We&&(We.d(1),We=null),Ce&2&&oe!==(oe=ge(de[1].m.p)+"")&&Z(pe,oe),de[4]?et?et.p(de,Ce):(et=Fu(de),et.c(),et.m(me,ye)):et&&(et.d(1),et=null),Ce&1&&ct!==(ct=ge(de[0].last_month.p)+"")&&Z(Tl,ct),de[4]?tt?tt.p(de,Ce):(tt=qu(de),tt.c(),tt.m(me,null)):tt&&(tt.d(1),tt=null),Ce&32&&ht!==(ht="grid grid-cols-"+de[5])&&r(me,"class",ht)},d(de){de&&C(e),de&&C(l),de&&C(n),Xe&&Xe.d(),Ze&&Ze.d(),Je&&Je.d(),Ue&&Ue.d(),de&&C(re),de&&C(ue),de&&C(ke),de&&C(me),xe&&xe.d(),We&&We.d(),et&&et.d(),tt&&tt.d()}}}function Pu(t){let e,l,n,i,o,a,u=ge(t[1].h.c,2)+"",c,f,_,p,b,v,d,S=ge(t[1].d.c,1)+"",y,$,N,E,B,P,L,O=ge(t[1].m.c)+"",F,x,j,z,G,V,W,U=ge(t[0].last_month.c)+"",K,H,Y;return{c(){e=m("strong"),e.textContent="Cost",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",o=h(),a=m("div"),c=T(u),f=h(),_=T(t[2]),p=h(),b=m("div"),b.textContent="Day",v=h(),d=m("div"),y=T(S),$=h(),N=T(t[2]),E=h(),B=m("div"),B.textContent="Month",P=h(),L=m("div"),F=T(O),x=h(),j=T(t[2]),z=h(),G=m("div"),G.textContent="Last month",V=h(),W=m("div"),K=T(U),H=h(),Y=T(t[2]),r(a,"class","text-right"),r(d,"class","text-right"),r(L,"class","text-right"),r(W,"class","text-right"),r(n,"class","grid grid-cols-2")},m(X,re){M(X,e,re),M(X,l,re),M(X,n,re),s(n,i),s(n,o),s(n,a),s(a,c),s(a,f),s(a,_),s(n,p),s(n,b),s(n,v),s(n,d),s(d,y),s(d,$),s(d,N),s(n,E),s(n,B),s(n,P),s(n,L),s(L,F),s(L,x),s(L,j),s(n,z),s(n,G),s(n,V),s(n,W),s(W,K),s(W,H),s(W,Y)},p(X,re){re&2&&u!==(u=ge(X[1].h.c,2)+"")&&Z(c,u),re&4&&Z(_,X[2]),re&2&&S!==(S=ge(X[1].d.c,1)+"")&&Z(y,S),re&4&&Z(N,X[2]),re&2&&O!==(O=ge(X[1].m.c)+"")&&Z(F,O),re&4&&Z(j,X[2]),re&1&&U!==(U=ge(X[0].last_month.c)+"")&&Z(K,U),re&4&&Z(Y,X[2])},d(X){X&&C(e),X&&C(l),X&&C(n)}}}function Eu(t){let e,l=ge(t[1].h.c,2)+"",n,i,o;return{c(){e=m("div"),n=T(l),i=h(),o=T(t[2]),r(e,"class","text-right")},m(a,u){M(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&2&&l!==(l=ge(a[1].h.c,2)+"")&&Z(n,l),u&4&&Z(o,a[2])},d(a){a&&C(e)}}}function Du(t){let e,l=ge(t[1].d.c,1)+"",n,i,o;return{c(){e=m("div"),n=T(l),i=h(),o=T(t[2]),r(e,"class","text-right")},m(a,u){M(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&2&&l!==(l=ge(a[1].d.c,1)+"")&&Z(n,l),u&4&&Z(o,a[2])},d(a){a&&C(e)}}}function Iu(t){let e,l=ge(t[1].m.c)+"",n,i,o;return{c(){e=m("div"),n=T(l),i=h(),o=T(t[2]),r(e,"class","text-right")},m(a,u){M(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&2&&l!==(l=ge(a[1].m.c)+"")&&Z(n,l),u&4&&Z(o,a[2])},d(a){a&&C(e)}}}function Ru(t){let e,l=ge(t[0].last_month.c)+"",n,i,o;return{c(){e=m("div"),n=T(l),i=h(),o=T(t[2]),r(e,"class","text-right")},m(a,u){M(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&1&&l!==(l=ge(a[0].last_month.c)+"")&&Z(n,l),u&4&&Z(o,a[2])},d(a){a&&C(e)}}}function Lu(t){let e,l=ge(t[1].h.i,2)+"",n,i,o;return{c(){e=m("div"),n=T(l),i=h(),o=T(t[2]),r(e,"class","text-right")},m(a,u){M(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&2&&l!==(l=ge(a[1].h.i,2)+"")&&Z(n,l),u&4&&Z(o,a[2])},d(a){a&&C(e)}}}function Ou(t){let e,l=ge(t[1].d.i,1)+"",n,i,o;return{c(){e=m("div"),n=T(l),i=h(),o=T(t[2]),r(e,"class","text-right")},m(a,u){M(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&2&&l!==(l=ge(a[1].d.i,1)+"")&&Z(n,l),u&4&&Z(o,a[2])},d(a){a&&C(e)}}}function Fu(t){let e,l=ge(t[1].m.i)+"",n,i,o;return{c(){e=m("div"),n=T(l),i=h(),o=T(t[2]),r(e,"class","text-right")},m(a,u){M(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&2&&l!==(l=ge(a[1].m.i)+"")&&Z(n,l),u&4&&Z(o,a[2])},d(a){a&&C(e)}}}function qu(t){let e,l=ge(t[0].last_month.i)+"",n,i,o;return{c(){e=m("div"),n=T(l),i=h(),o=T(t[2]),r(e,"class","text-right")},m(a,u){M(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&1&&l!==(l=ge(a[0].last_month.i)+"")&&Z(n,l),u&4&&Z(o,a[2])},d(a){a&&C(e)}}}function km(t){let e,l,n,i,o,a,u=t[1]&&Au(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Real time calculation",n=h(),i=m("br"),o=m("br"),a=h(),u&&u.c(),r(e,"class","mx-2 text-sm")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),s(e,a),u&&u.m(e,null)},p(c,[f]){c[1]?u?u.p(c,f):(u=Au(c),u.c(),u.m(e,null)):u&&(u.d(1),u=null)},i:fe,o:fe,d(c){c&&C(e),u&&u.d()}}}function wm(t,e,l){let{sysinfo:n}=e,{data:i}=e,{currency:o}=e,{hasExport:a}=e,u=!1,c=3;return t.$$set=f=>{"sysinfo"in f&&l(0,n=f.sysinfo),"data"in f&&l(1,i=f.data),"currency"in f&&l(2,o=f.currency),"hasExport"in f&&l(3,a=f.hasExport)},t.$$.update=()=>{t.$$.dirty&18&&(l(4,u=i&&i.h&&(Math.abs(i.h.c)>.01||Math.abs(i.d.c)>.01||Math.abs(i.m.c)>.01||Math.abs(i.h.i)>.01||Math.abs(i.d.i)>.01||Math.abs(i.m.i)>.01)),l(5,c=u?3:2))},[n,i,o,a,u,c]}class ym extends Ee{constructor(e){super(),Pe(this,e,wm,km,Ne,{sysinfo:0,data:1,currency:2,hasExport:3})}}function Cm(t){let e,l,n=xa(t[0].source)+"",i,o,a,u;return a=new pn({props:{config:t[1]}}),{c(){e=m("a"),l=T("Provided by: "),i=T(n),o=h(),ie(a.$$.fragment),r(e,"href","https://transparency.entsoe.eu/"),r(e,"target","_blank"),r(e,"class","text-xs float-right z-40")},m(c,f){M(c,e,f),s(e,l),s(e,i),M(c,o,f),le(a,c,f),u=!0},p(c,[f]){(!u||f&1)&&n!==(n=xa(c[0].source)+"")&&Z(i,n);const _={};f&2&&(_.config=c[1]),a.$set(_)},i(c){u||(D(a.$$.fragment,c),u=!0)},o(c){q(a.$$.fragment,c),u=!1},d(c){c&&C(e),c&&C(o),ne(a,c)}}}function Mm(t,e,l){let{json:n}=e,{sysinfo:i}=e,o={},a,u;return t.$$set=c=>{"json"in c&&l(0,n=c.json),"sysinfo"in c&&l(2,i=c.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&29){let c=n.currency,f=new Date().getUTCHours(),_=0,p=0,b=0,v=[],d=[],S=[];l(4,u=l(3,a=0));let y=new Date;for(fl(y,i.clock_offset-(24+y.getHours()-y.getUTCHours())%24),_=f;_<24&&(p=n[Oe(b++)],p!=null);_++)d.push({label:Oe(y.getHours())}),S.push(p*100),l(4,u=Math.min(u,p*100)),l(3,a=Math.max(a,p*100)),fl(y,1);for(_=0;_<24&&(p=n[Oe(b++)],p!=null);_++)d.push({label:Oe(y.getHours())}),S.push(p*100),l(4,u=Math.min(u,p*100)),l(3,a=Math.max(a,p*100)),fl(y,1);if(u>-100&&a<100){switch(c){case"NOK":case"SEK":case"DKK":c="\xF8re";break;case"EUR":c="cent";break;default:c=c+"/100"}for(l(4,u*=100),l(3,a*=100),_=0;_=0?P.toFixed(L):"",title:P>=0?P.toFixed(2)+" "+c:"",value:p>=0?Math.abs(p):0,label2:P<0?P.toFixed(L):"",title2:P<0?P.toFixed(2)+" "+c:"",value2:p<0?Math.abs(p):0,color:"#7c3aed"})}let N=Math.max(a,Math.abs(u));if(u<0){l(4,u=Math.min(N/4*-1,u));let P=Math.ceil(Math.abs(u)/N*4),L=u/P;for(_=1;_{"json"in c&&l(1,n=c.json),"sysinfo"in c&&l(2,i=c.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let c=0,f=[],_=[],p=[];l(4,u=l(3,a=0));let b=fl(new Date,-24),v=new Date().getUTCHours();for(fl(b,i.clock_offset-(24+b.getHours()-b.getUTCHours())%24),c=v;c<24;c++){let $=n["i"+Oe(c)],N=n["e"+Oe(c)];$===void 0&&($=0),N===void 0&&(N=0),_.push({label:Oe(b.getHours())}),p.push({label:$.toFixed(1),title:$.toFixed(2)+" kWh",value:$*10,label2:N.toFixed(1),title2:N.toFixed(2)+" kWh",value2:N*10,color:"#7c3aed",color2:"#37829E"}),l(4,u=Math.max(u,N*10)),l(3,a=Math.max(a,$*10)),fl(b,1)}for(c=0;c{"json"in c&&l(1,n=c.json),"sysinfo"in c&&l(2,i=c.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let c=0,f=[],_=[],p=[];l(4,u=l(3,a=0));let b=new Date,v=new Date;for(fl(b,i.clock_offset-(24+b.getHours()-b.getUTCHours())%24),fl(v,i.clock_offset-(24+v.getHours()-v.getUTCHours())%24),v.setDate(0),c=b.getDate();c<=v.getDate();c++){let $=n["i"+Oe(c)],N=n["e"+Oe(c)];$===void 0&&($=0),N===void 0&&(N=0),_.push({label:Oe(c)}),p.push({label:$.toFixed($<10?1:0),title:$.toFixed(2)+" kWh",value:$,label2:N.toFixed(N<10?1:0),title2:N.toFixed(2)+" kWh",value2:N,color:"#7c3aed",color2:"#37829E"}),l(4,u=Math.max(u,N)),l(3,a=Math.max(a,$))}for(c=1;c{"json"in u&&l(1,n=u.json)},t.$$.update=()=>{if(t.$$.dirty&14){let u=0,c=0,f=[],_=[],p=[];n.s&&n.s.forEach((d,S)=>{var y=d.n?d.n:d.a;c=d.v,c==-127&&(c=0),_.push({label:y.slice(-4)}),p.push({label:c.toFixed(1),value:c,color:"#7c3aed"}),l(3,a=Math.min(a,c)),l(2,o=Math.max(o,c))}),l(2,o=Math.ceil(o)),l(3,a=Math.floor(a));let b=o;a<0&&(b+=Math.abs(a));let v=b/4;for(u=0;u<5;u++)c=a+v*u,f.push({value:c,label:c.toFixed(1)});l(0,i={title:"Temperature sensors (\xB0C)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:a,max:o,ticks:f},x:{ticks:_},points:p})}},[i,n,o,a]}class Rm extends Ee{constructor(e){super(),Pe(this,e,Im,Dm,Ne,{json:1})}}function Lm(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}let Om=0;function Fm(t,e,l){let n={},i=0,o;return zc.subscribe(a=>{l(2,o=a)}),Wc(),t.$$.update=()=>{if(t.$$.dirty&6){let a=0,u=[],c=[],f=[];if(u.push({value:0,label:0}),o&&o.p)for(a=0;a0?Oe(_.d)+"."+no[new Date().getMonth()]:"-"}),l(1,i=Math.max(i,_.v))}if(o&&o.t){for(a=0;a=i)break;u.push({value:_,label:_})}u.push({label:o.m.toFixed(1),align:"right",color:"green",value:o.m})}o&&o.c&&(u.push({label:o.c.toFixed(0),color:"orange",value:o.c}),l(1,i=Math.max(i,o.c))),l(1,i=Math.ceil(i)),l(0,n={title:"Tariff peaks",padding:{top:20,right:35,bottom:20,left:35},y:{min:Om,max:i,ticks:u},x:{ticks:c},points:f})}},[n,i,o]}class qm extends Ee{constructor(e){super(),Pe(this,e,Fm,Lm,Ne,{})}}function Bu(t){let e,l,n,i,o,a,u=(t[0].mt?Cs(t[0].mt):"-")+"",c,f,_,p=(t[0].ic?t[0].ic.toFixed(1):"-")+"",b,v,d;return i=new Qc({props:{val:t[0].i?t[0].i:0,max:t[0].im?t[0].im:15e3,unit:"W",label:"Import",sub:t[0].p,subunit:t[0].pc,colorFn:Oc}}),{c(){e=m("div"),l=m("div"),n=m("div"),ie(i.$$.fragment),o=h(),a=m("div"),c=T(u),f=h(),_=m("div"),b=T(p),v=T(" kWh"),r(n,"class","col-span-2"),r(_,"class","text-right"),r(l,"class","grid grid-cols-2"),r(e,"class","cnt")},m(S,y){M(S,e,y),s(e,l),s(l,n),le(i,n,null),s(l,o),s(l,a),s(a,c),s(l,f),s(l,_),s(_,b),s(_,v),d=!0},p(S,y){const $={};y&1&&($.val=S[0].i?S[0].i:0),y&1&&($.max=S[0].im?S[0].im:15e3),y&1&&($.sub=S[0].p),y&1&&($.subunit=S[0].pc),i.$set($),(!d||y&1)&&u!==(u=(S[0].mt?Cs(S[0].mt):"-")+"")&&Z(c,u),(!d||y&1)&&p!==(p=(S[0].ic?S[0].ic.toFixed(1):"-")+"")&&Z(b,p)},i(S){d||(D(i.$$.fragment,S),d=!0)},o(S){q(i.$$.fragment,S),d=!1},d(S){S&&C(e),ne(i)}}}function Uu(t){let e,l,n,i,o,a,u,c,f=(t[0].ec?t[0].ec.toFixed(1):"-")+"",_,p,b;return i=new Qc({props:{val:t[0].e?t[0].e:0,max:t[0].om?t[0].om*1e3:1e4,unit:"W",label:"Export",colorFn:w1}}),{c(){e=m("div"),l=m("div"),n=m("div"),ie(i.$$.fragment),o=h(),a=m("div"),u=h(),c=m("div"),_=T(f),p=T(" kWh"),r(n,"class","col-span-2"),r(c,"class","text-right"),r(l,"class","grid grid-cols-2"),r(e,"class","cnt")},m(v,d){M(v,e,d),s(e,l),s(l,n),le(i,n,null),s(l,o),s(l,a),s(l,u),s(l,c),s(c,_),s(c,p),b=!0},p(v,d){const S={};d&1&&(S.val=v[0].e?v[0].e:0),d&1&&(S.max=v[0].om?v[0].om*1e3:1e4),i.$set(S),(!b||d&1)&&f!==(f=(v[0].ec?v[0].ec.toFixed(1):"-")+"")&&Z(_,f)},i(v){b||(D(i.$$.fragment,v),b=!0)},o(v){q(i.$$.fragment,v),b=!1},d(v){v&&C(e),ne(i)}}}function ju(t){let e,l,n;return l=new cm({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,ds:t[0].ds}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt")},m(i,o){M(i,e,o),le(l,e,null),n=!0},p(i,o){const a={};o&1&&(a.u1=i[0].u1),o&1&&(a.u2=i[0].u2),o&1&&(a.u3=i[0].u3),o&1&&(a.ds=i[0].ds),l.$set(a)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Hu(t){let e,l,n;return l=new _m({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,i1:t[0].i1,i2:t[0].i2,i2e:t[0].i2e,i3:t[0].i3,max:t[0].mf?t[0].mf:32}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt")},m(i,o){M(i,e,o),le(l,e,null),n=!0},p(i,o){const a={};o&1&&(a.u1=i[0].u1),o&1&&(a.u2=i[0].u2),o&1&&(a.u3=i[0].u3),o&1&&(a.i1=i[0].i1),o&1&&(a.i2=i[0].i2),o&1&&(a.i2e=i[0].i2e),o&1&&(a.i3=i[0].i3),o&1&&(a.max=i[0].mf?i[0].mf:32),l.$set(a)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Wu(t){let e,l,n;return l=new hm({props:{importInstant:t[0].ri,exportInstant:t[0].re,importTotal:t[0].ric,exportTotal:t[0].rec}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt")},m(i,o){M(i,e,o),le(l,e,null),n=!0},p(i,o){const a={};o&1&&(a.importInstant=i[0].ri),o&1&&(a.exportInstant=i[0].re),o&1&&(a.importTotal=i[0].ric),o&1&&(a.exportTotal=i[0].rec),l.$set(a)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function zu(t){let e,l,n;return l=new ym({props:{sysinfo:t[1],data:t[0].ea,currency:t[0].pc,hasExport:t[0].om>0||t[0].e>0}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt")},m(i,o){M(i,e,o),le(l,e,null),n=!0},p(i,o){const a={};o&2&&(a.sysinfo=i[1]),o&1&&(a.data=i[0].ea),o&1&&(a.currency=i[0].pc),o&1&&(a.hasExport=i[0].om>0||i[0].e>0),l.$set(a)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Gu(t){let e,l,n;return l=new qm({}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt h-64")},m(i,o){M(i,e,o),le(l,e,null),n=!0},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Vu(t){let e,l,n;return l=new Sm({props:{json:t[2],sysinfo:t[1]}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){M(i,e,o),le(l,e,null),n=!0},p(i,o){const a={};o&4&&(a.json=i[2]),o&2&&(a.sysinfo=i[1]),l.$set(a)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Ku(t){let e,l,n;return l=new Nm({props:{json:t[3],sysinfo:t[1]}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){M(i,e,o),le(l,e,null),n=!0},p(i,o){const a={};o&8&&(a.json=i[3]),o&2&&(a.sysinfo=i[1]),l.$set(a)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Yu(t){let e,l,n;return l=new Em({props:{json:t[4],sysinfo:t[1]}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){M(i,e,o),le(l,e,null),n=!0},p(i,o){const a={};o&16&&(a.json=i[4]),o&2&&(a.sysinfo=i[1]),l.$set(a)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Qu(t){let e,l,n;return l=new Rm({props:{json:t[5]}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){M(i,e,o),le(l,e,null),n=!0},p(i,o){const a={};o&32&&(a.json=i[5]),l.$set(a)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Bm(t){let e,l=Ke(t[1].ui.i,t[0].i),n,i=Ke(t[1].ui.e,t[0].om||t[0].e>0),o,a=Ke(t[1].ui.v,t[0].u1>100||t[0].u2>100||t[0].u3>100),u,c=Ke(t[1].ui.a,t[0].i1>.01||t[0].i2>.01||t[0].i3>.01),f,_=Ke(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),p,b=Ke(t[1].ui.c,t[0].ea),v,d=Ke(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("10YNO")||t[0].pr.startsWith("10Y1001A1001A4"))),S,y=Ke(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].p)),$,N=Ke(t[1].ui.d,t[3]),E,B=Ke(t[1].ui.m,t[4]),P,L=Ke(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[5].c>1),O,F=l&&Bu(t),x=i&&Uu(t),j=a&&ju(t),z=c&&Hu(t),G=_&&Wu(t),V=b&&zu(t),W=d&&Gu(),U=y&&Vu(t),K=N&&Ku(t),H=B&&Yu(t),Y=L&&Qu(t);return{c(){e=m("div"),F&&F.c(),n=h(),x&&x.c(),o=h(),j&&j.c(),u=h(),z&&z.c(),f=h(),G&&G.c(),p=h(),V&&V.c(),v=h(),W&&W.c(),S=h(),U&&U.c(),$=h(),K&&K.c(),E=h(),H&&H.c(),P=h(),Y&&Y.c(),r(e,"class","grid 2xl:grid-cols-6 xl:grid-cols-5 lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2")},m(X,re){M(X,e,re),F&&F.m(e,null),s(e,n),x&&x.m(e,null),s(e,o),j&&j.m(e,null),s(e,u),z&&z.m(e,null),s(e,f),G&&G.m(e,null),s(e,p),V&&V.m(e,null),s(e,v),W&&W.m(e,null),s(e,S),U&&U.m(e,null),s(e,$),K&&K.m(e,null),s(e,E),H&&H.m(e,null),s(e,P),Y&&Y.m(e,null),O=!0},p(X,[re]){re&3&&(l=Ke(X[1].ui.i,X[0].i)),l?F?(F.p(X,re),re&3&&D(F,1)):(F=Bu(X),F.c(),D(F,1),F.m(e,n)):F&&(De(),q(F,1,1,()=>{F=null}),Ie()),re&3&&(i=Ke(X[1].ui.e,X[0].om||X[0].e>0)),i?x?(x.p(X,re),re&3&&D(x,1)):(x=Uu(X),x.c(),D(x,1),x.m(e,o)):x&&(De(),q(x,1,1,()=>{x=null}),Ie()),re&3&&(a=Ke(X[1].ui.v,X[0].u1>100||X[0].u2>100||X[0].u3>100)),a?j?(j.p(X,re),re&3&&D(j,1)):(j=ju(X),j.c(),D(j,1),j.m(e,u)):j&&(De(),q(j,1,1,()=>{j=null}),Ie()),re&3&&(c=Ke(X[1].ui.a,X[0].i1>.01||X[0].i2>.01||X[0].i3>.01)),c?z?(z.p(X,re),re&3&&D(z,1)):(z=Hu(X),z.c(),D(z,1),z.m(e,f)):z&&(De(),q(z,1,1,()=>{z=null}),Ie()),re&3&&(_=Ke(X[1].ui.r,X[0].ri>0||X[0].re>0||X[0].ric>0||X[0].rec>0)),_?G?(G.p(X,re),re&3&&D(G,1)):(G=Wu(X),G.c(),D(G,1),G.m(e,p)):G&&(De(),q(G,1,1,()=>{G=null}),Ie()),re&3&&(b=Ke(X[1].ui.c,X[0].ea)),b?V?(V.p(X,re),re&3&&D(V,1)):(V=zu(X),V.c(),D(V,1),V.m(e,v)):V&&(De(),q(V,1,1,()=>{V=null}),Ie()),re&3&&(d=Ke(X[1].ui.t,X[0].pr&&(X[0].pr.startsWith("10YNO")||X[0].pr.startsWith("10Y1001A1001A4")))),d?W?re&3&&D(W,1):(W=Gu(),W.c(),D(W,1),W.m(e,S)):W&&(De(),q(W,1,1,()=>{W=null}),Ie()),re&3&&(y=Ke(X[1].ui.p,X[0].pe&&!Number.isNaN(X[0].p))),y?U?(U.p(X,re),re&3&&D(U,1)):(U=Vu(X),U.c(),D(U,1),U.m(e,$)):U&&(De(),q(U,1,1,()=>{U=null}),Ie()),re&10&&(N=Ke(X[1].ui.d,X[3])),N?K?(K.p(X,re),re&10&&D(K,1)):(K=Ku(X),K.c(),D(K,1),K.m(e,E)):K&&(De(),q(K,1,1,()=>{K=null}),Ie()),re&18&&(B=Ke(X[1].ui.m,X[4])),B?H?(H.p(X,re),re&18&&D(H,1)):(H=Yu(X),H.c(),D(H,1),H.m(e,P)):H&&(De(),q(H,1,1,()=>{H=null}),Ie()),re&35&&(L=Ke(X[1].ui.s,X[0].t&&X[0].t!=-127&&X[5].c>1)),L?Y?(Y.p(X,re),re&35&&D(Y,1)):(Y=Qu(X),Y.c(),D(Y,1),Y.m(e,null)):Y&&(De(),q(Y,1,1,()=>{Y=null}),Ie())},i(X){O||(D(F),D(x),D(j),D(z),D(G),D(V),D(W),D(U),D(K),D(H),D(Y),O=!0)},o(X){q(F),q(x),q(j),q(z),q(G),q(V),q(W),q(U),q(K),q(H),q(Y),O=!1},d(X){X&&C(e),F&&F.d(),x&&x.d(),j&&j.d(),z&&z.d(),G&&G.d(),V&&V.d(),W&&W.d(),U&&U.d(),K&&K.d(),H&&H.d(),Y&&Y.d()}}}function Um(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,o={},a={},u={},c={};return Co.subscribe(f=>{l(2,o=f)}),Bc.subscribe(f=>{l(3,a=f)}),Uc.subscribe(f=>{l(4,u=f)}),Hc.subscribe(f=>{l(5,c=f)}),t.$$set=f=>{"data"in f&&l(0,n=f.data),"sysinfo"in f&&l(1,i=f.sysinfo)},[n,i,o,a,u,c]}class jm extends Ee{constructor(e){super(),Pe(this,e,Um,Bm,Ne,{data:0,sysinfo:1})}}let fo={};const Ci=at(fo);async function Hm(){fo=await(await fetch("/configuration.json")).json(),Ci.set(fo)}function Xu(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function Wm(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=3,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function zm(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=20,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function Zu(t){let e;return{c(){e=m("option"),e.textContent="UART2",e.__value=113,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function Ju(t){let e,l,n;return{c(){e=m("option"),e.textContent="UART1",l=h(),n=m("option"),n.textContent="UART2",e.__value=9,e.value=e.__value,n.__value=16,n.value=n.__value},m(i,o){M(i,e,o),M(i,l,o),M(i,n,o)},d(i){i&&C(e),i&&C(l),i&&C(n)}}}function xu(t){let e;return{c(){e=m("option"),e.textContent="UART1",e.__value=18,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function ef(t){let e,l,n;return{c(){e=m("option"),l=T("GPIO"),n=T(t[4]),e.__value=t[4],e.value=e.__value},m(i,o){M(i,e,o),s(e,l),s(e,n)},d(i){i&&C(e)}}}function tf(t){let e,l=t[4]>3&&!(t[0]=="esp32"&&(t[4]==9||t[4]==16))&&!(t[0]=="esp32s2"&&t[4]==18)&&!(t[0]=="esp8266"&&(t[4]==3||t[4]==113))&&ef(t);return{c(){l&&l.c(),e=Ve()},m(n,i){l&&l.m(n,i),M(n,e,i)},p(n,i){n[4]>3&&!(n[0]=="esp32"&&(n[4]==9||n[4]==16))&&!(n[0]=="esp32s2"&&n[4]==18)&&!(n[0]=="esp8266"&&(n[4]==3||n[4]==113))?l||(l=ef(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){l&&l.d(n),n&&C(e)}}}function Gm(t){let e,l,n,i,o;function a(d,S){return d[0]=="esp32c3"?zm:Wm}let u=a(t),c=u(t),f=t[0]=="esp8266"&&Zu(),_=(t[0]=="esp32"||t[0]=="esp32solo")&&Ju(),p=t[0]=="esp32s2"&&xu(),b={length:t[1]+1},v=[];for(let d=0;d{"chip"in o&&l(0,n=o.chip)},t.$$.update=()=>{if(t.$$.dirty&1)switch(n){case"esp8266":l(1,i=16);break;case"esp32s2":l(1,i=44);break;case"esp32c3":l(1,i=19);break}},[n,i]}class Xc extends Ee{constructor(e){super(),Pe(this,e,Vm,Gm,Ne,{chip:0})}}function lf(t){let e,l,n=t[1]&&nf(t);return{c(){e=m("div"),l=m("div"),n&&n.c(),r(l,"class","fixed inset-0 bg-gray-500 bg-opacity-50 flex items-center justify-center"),r(e,"class","z-50"),r(e,"aria-modal","true")},m(i,o){M(i,e,o),s(e,l),n&&n.m(l,null)},p(i,o){i[1]?n?n.p(i,o):(n=nf(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&C(e),n&&n.d()}}}function nf(t){let e,l;return{c(){e=m("div"),l=T(t[1]),r(e,"class","bg-white m-2 p-3 rounded-md shadow-lg pb-4 text-gray-700 w-96")},m(n,i){M(n,e,i),s(e,l)},p(n,i){i&2&&Z(l,n[1])},d(n){n&&C(e)}}}function Km(t){let e,l=t[0]&&lf(t);return{c(){l&&l.c(),e=Ve()},m(n,i){l&&l.m(n,i),M(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=lf(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:fe,o:fe,d(n){l&&l.d(n),n&&C(e)}}}function Ym(t,e,l){let{active:n}=e,{message:i}=e;return t.$$set=o=>{"active"in o&&l(0,n=o.active),"message"in o&&l(1,i=o.message)},[n,i]}class It extends Ee{constructor(e){super(),Pe(this,e,Ym,Km,Ne,{active:0,message:1})}}function sf(t,e,l){const n=t.slice();return n[1]=e[l],n}function of(t){let e,l,n=t[1]+"",i;return{c(){e=m("option"),l=T("Europe/"),i=T(n),e.__value="Europe/"+t[1],e.value=e.__value},m(o,a){M(o,e,a),s(e,l),s(e,i)},p:fe,d(o){o&&C(e)}}}function Qm(t){let e,l,n,i=t[0],o=[];for(let a=0;a>1&1,A=0;A0;g--)A[g]=A[g]?A[g-1]^P.EXPONENT[F._modN(P.LOG[A[g]]+w)]:A[g-1];A[0]=P.EXPONENT[F._modN(P.LOG[A[0]]+w)]}for(w=0;w<=k;w++)A[w]=P.LOG[A[w]]},_checkBadness:function(){var w,g,k,A,I,Q=0,J=this._badness,se=this.buffer,ce=this.width;for(I=0;Ice*ce;)oe-=ce*ce,Se++;for(Q+=Se*F.N4,A=0;A=J-2&&(w=J-2,I>9&&w--);var se=w;if(I>9){for(Q[se+2]=0,Q[se+3]=0;se--;)g=Q[se],Q[se+3]|=255&g<<4,Q[se+2]=g>>4;Q[2]|=255&w<<4,Q[1]=w>>4,Q[0]=64|w>>12}else{for(Q[se+1]=0,Q[se+2]=0;se--;)g=Q[se],Q[se+2]|=255&g<<4,Q[se+1]=g>>4;Q[1]|=255&w<<4,Q[0]=64|w>>4}for(se=w+3-(I<10);se=5&&(k+=F.N1+A[g]-5);for(g=3;gw||A[g-3]*3>=A[g]*4||A[g+3]*3>=A[g]*4)&&(k+=F.N3);return k},_finish:function(){this._stringBuffer=this.buffer.slice();var w,g,k=0,A=3e4;for(g=0;g<8&&(this._applyMask(g),w=this._checkBadness(),w>=1)A&1&&(I[Q-1-g+Q*8]=1,g<6?I[8+Q*g]=1:I[8+Q*(g+1)]=1);for(g=0;g<7;g++,A>>=1)A&1&&(I[8+Q*(Q-7+g)]=1,g?I[6-g+Q*8]=1:I[7+Q*8]=1)},_interleaveBlocks:function(){var w,g,k=this._dataBlock,A=this._ecc,I=this._eccBlock,Q=0,J=this._calculateMaxLength(),se=this._neccBlock1,ce=this._neccBlock2,ve=this._stringBuffer;for(w=0;w1)for(w=$.BLOCK[A],k=I-7;;){for(g=I-7;g>w-3&&(this._addAlignment(g,k),!(g6)for(w=O.BLOCK[Q-7],g=17,k=0;k<6;k++)for(A=0;A<3;A++,g--)1&(g>11?Q>>g-12:w>>g)?(I[5-k+J*(2-A+J-11)]=1,I[2-A+J-11+J*(5-k)]=1):(this._setMask(5-k,2-A+J-11),this._setMask(2-A+J-11,5-k))},_isMasked:function(w,g){var k=F._getMaskBit(w,g);return this._mask[k]===1},_pack:function(){var w,g,k,A=1,I=1,Q=this.width,J=Q-1,se=Q-1,ce=(this._dataBlock+this._eccBlock)*(this._neccBlock1+this._neccBlock2)+this._neccBlock2;for(g=0;gg&&(k=w,w=g,g=k),k=g,k+=g*g,k>>=1,k+=w,k},_modN:function(w){for(;w>=255;)w-=255,w=(w>>8)+(w&255);return w},N1:3,N2:3,N3:40,N4:10}),x=F,j=v.extend({draw:function(){this.element.src=this.qrious.toDataURL()},reset:function(){this.element.src=""},resize:function(){var w=this.element;w.width=w.height=this.qrious.size}}),z=j,G=p.extend(function(w,g,k,A){this.name=w,this.modifiable=Boolean(g),this.defaultValue=k,this._valueTransformer=A},{transform:function(w){var g=this._valueTransformer;return typeof g=="function"?g(w,this):w}}),V=G,W=p.extend(null,{abs:function(w){return w!=null?Math.abs(w):null},hasOwn:function(w,g){return Object.prototype.hasOwnProperty.call(w,g)},noop:function(){},toUpperCase:function(w){return w!=null?w.toUpperCase():null}}),U=W,K=p.extend(function(w){this.options={},w.forEach(function(g){this.options[g.name]=g},this)},{exists:function(w){return this.options[w]!=null},get:function(w,g){return K._get(this.options[w],g)},getAll:function(w){var g,k=this.options,A={};for(g in k)U.hasOwn(k,g)&&(A[g]=K._get(k[g],w));return A},init:function(w,g,k){typeof k!="function"&&(k=U.noop);var A,I;for(A in this.options)U.hasOwn(this.options,A)&&(I=this.options[A],K._set(I,I.defaultValue,g),K._createAccessor(I,g,k));this._setAll(w,g,!0)},set:function(w,g,k){return this._set(w,g,k)},setAll:function(w,g){return this._setAll(w,g)},_set:function(w,g,k,A){var I=this.options[w];if(!I)throw new Error("Invalid option: "+w);if(!I.modifiable&&!A)throw new Error("Option cannot be modified: "+w);return K._set(I,g,k)},_setAll:function(w,g,k){if(!w)return!1;var A,I=!1;for(A in w)U.hasOwn(w,A)&&this._set(A,w[A],g,k)&&(I=!0);return I}},{_createAccessor:function(w,g,k){var A={get:function(){return K._get(w,g)}};w.modifiable&&(A.set=function(I){K._set(w,I,g)&&k(I,w)}),Object.defineProperty(g,w.name,A)},_get:function(w,g){return g["_"+w.name]},_set:function(w,g,k){var A="_"+w.name,I=k[A],Q=w.transform(g!=null?g:w.defaultValue);return k[A]=Q,Q!==I}}),H=K,Y=p.extend(function(){this._services={}},{getService:function(w){var g=this._services[w];if(!g)throw new Error("Service is not being managed with name: "+w);return g},setService:function(w,g){if(this._services[w])throw new Error("Service is already managed with name: "+w);g&&(this._services[w]=g)}}),X=Y,re=new H([new V("background",!0,"white"),new V("backgroundAlpha",!0,1,U.abs),new V("element"),new V("foreground",!0,"black"),new V("foregroundAlpha",!0,1,U.abs),new V("level",!0,"L",U.toUpperCase),new V("mime",!0,"image/png"),new V("padding",!0,null,U.abs),new V("size",!0,100,U.abs),new V("value",!0,"")]),ue=new X,ke=p.extend(function(w){re.init(w,this,this.update.bind(this));var g=re.get("element",this),k=ue.getService("element"),A=g&&k.isCanvas(g)?g:k.createCanvas(),I=g&&k.isImage(g)?g:k.createImage();this._canvasRenderer=new S(this,A,!0),this._imageRenderer=new z(this,I,I===g),this.update()},{get:function(){return re.getAll(this)},set:function(w){re.setAll(w,this)&&this.update()},toDataURL:function(w){return this.canvas.toDataURL(w||this.mime)},update:function(){var w=new x({level:this.level,value:this.value});this._canvasRenderer.render(w),this._imageRenderer.render(w)}},{use:function(w){ue.setService(w.getName(),w)}});Object.defineProperties(ke.prototype,{canvas:{get:function(){return this._canvasRenderer.getElement()}},image:{get:function(){return this._imageRenderer.getElement()}}});var me=ke,$e=me,je=p.extend({getName:function(){}}),Re=je,He=Re.extend({createCanvas:function(){},createImage:function(){},getName:function(){return"element"},isCanvas:function(w){},isImage:function(w){}}),we=He,Te=we.extend({createCanvas:function(){return document.createElement("canvas")},createImage:function(){return document.createElement("img")},isCanvas:function(w){return w instanceof HTMLCanvasElement},isImage:function(w){return w instanceof HTMLImageElement}}),Le=Te;$e.use(new Le);var Me=$e;return Me})})(Jc);const tp=Jc.exports;function lp(t){let e,l;return{c(){e=m("img"),Js(e.src,l=t[2])||r(e,"src",l),r(e,"alt",t[0]),r(e,"class",t[1])},m(n,i){M(n,e,i)},p(n,[i]){i&4&&!Js(e.src,l=n[2])&&r(e,"src",l),i&1&&r(e,"alt",n[0]),i&2&&r(e,"class",n[1])},i:fe,o:fe,d(n){n&&C(e)}}}function np(t,e,l){const n=new tp;let{errorCorrection:i="L"}=e,{background:o="#fff"}=e,{color:a="#000"}=e,{size:u="200"}=e,{value:c=""}=e,{padding:f=0}=e,{className:_="qrcode"}=e,p="";function b(){n.set({background:o,foreground:a,level:i,padding:f,size:u,value:c}),l(2,p=n.toDataURL("image/jpeg"))}return oc(()=>{b()}),t.$$set=v=>{"errorCorrection"in v&&l(3,i=v.errorCorrection),"background"in v&&l(4,o=v.background),"color"in v&&l(5,a=v.color),"size"in v&&l(6,u=v.size),"value"in v&&l(0,c=v.value),"padding"in v&&l(7,f=v.padding),"className"in v&&l(1,_=v.className)},t.$$.update=()=>{t.$$.dirty&1&&c&&b()},[c,_,p,i,o,a,u,f]}class ip extends Ee{constructor(e){super(),Pe(this,e,np,lp,Ne,{errorCorrection:3,background:4,color:5,size:6,value:0,padding:7,className:1})}}function rf(t,e,l){const n=t.slice();return n[95]=e[l],n[96]=e,n[97]=l,n}function af(t,e,l){const n=t.slice();return n[98]=e[l],n[99]=e,n[100]=l,n}function sp(t,e,l){const n=t.slice();return n[101]=e[l],n}function op(t,e,l){const n=t.slice();return n[104]=e[l],n}function rp(t){let e,l;return{c(){e=m("option"),l=T(t[104]),e.__value=t[104],e.value=e.__value},m(n,i){M(n,e,i),s(e,l)},p:fe,d(n){n&&C(e)}}}function uf(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),r(l,"name","pt"),r(l,"type","text"),r(l,"class","in-s"),r(l,"placeholder","ENTSO-E API key, optional, read docs")},m(o,a){M(o,e,a),M(o,l,a),te(l,t[3].p.t),n||(i=ee(l,"input",t[22]),n=!0)},p(o,a){a[0]&8&&l.value!==o[3].p.t&&te(l,o[3].p.t)},d(o){o&&C(e),o&&C(l),n=!1,i()}}}function ff(t){let e,l,n,i,o,a,u,c,f,_,p,b,v;return{c(){e=m("div"),l=T("Username"),n=m("br"),i=h(),o=m("input"),a=h(),u=m("div"),c=T("Password"),f=m("br"),_=h(),p=m("input"),r(o,"name","gu"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1"),r(p,"name","gp"),r(p,"type","password"),r(p,"class","in-s"),r(u,"class","my-1")},m(d,S){M(d,e,S),s(e,l),s(e,n),s(e,i),s(e,o),te(o,t[3].g.u),M(d,a,S),M(d,u,S),s(u,c),s(u,f),s(u,_),s(u,p),te(p,t[3].g.p),b||(v=[ee(o,"input",t[24]),ee(p,"input",t[25])],b=!0)},p(d,S){S[0]&8&&o.value!==d[3].g.u&&te(o,d[3].g.u),S[0]&8&&p.value!==d[3].g.p&&te(p,d[3].g.p)},d(d){d&&C(e),d&&C(a),d&&C(u),b=!1,ze(v)}}}function ap(t){let e,l=t[101]*100+"",n;return{c(){e=m("option"),n=T(l),e.__value=t[101]*100,e.value=e.__value},m(i,o){M(i,e,o),s(e,n)},p:fe,d(i){i&&C(e)}}}function cf(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),r(l,"name","mek"),r(l,"type","text"),r(l,"class","in-s")},m(o,a){M(o,e,a),M(o,l,a),te(l,t[3].m.e.k),n||(i=ee(l,"input",t[34]),n=!0)},p(o,a){a[0]&8&&l.value!==o[3].m.e.k&&te(l,o[3].m.e.k)},d(o){o&&C(e),o&&C(l),n=!1,i()}}}function mf(t){let e,l,n,i,o,a,u;return{c(){e=m("div"),l=T("Authentication key"),n=m("br"),i=h(),o=m("input"),r(o,"name","mea"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),te(o,t[3].m.e.a),a||(u=ee(o,"input",t[35]),a=!0)},p(c,f){f[0]&8&&o.value!==c[3].m.e.a&&te(o,c[3].m.e.a)},d(c){c&&C(e),a=!1,u()}}}function pf(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,y,$,N,E,B,P,L,O,F,x,j;return{c(){e=m("div"),l=m("div"),n=T("Watt"),i=m("br"),o=h(),a=m("input"),u=h(),c=m("div"),f=T("Volt"),_=m("br"),p=h(),b=m("input"),v=h(),d=m("div"),S=T("Amp"),y=m("br"),$=h(),N=m("input"),E=h(),B=m("div"),P=T("kWh"),L=m("br"),O=h(),F=m("input"),r(a,"name","mmw"),r(a,"type","number"),r(a,"min","0.00"),r(a,"max","1000"),r(a,"step","0.001"),r(a,"class","in-f tr w-full"),r(l,"class","w-1/4"),r(b,"name","mmv"),r(b,"type","number"),r(b,"min","0.00"),r(b,"max","1000"),r(b,"step","0.001"),r(b,"class","in-m tr w-full"),r(c,"class","w-1/4"),r(N,"name","mma"),r(N,"type","number"),r(N,"min","0.00"),r(N,"max","1000"),r(N,"step","0.001"),r(N,"class","in-m tr w-full"),r(d,"class","w-1/4"),r(F,"name","mmc"),r(F,"type","number"),r(F,"min","0.00"),r(F,"max","1000"),r(F,"step","0.001"),r(F,"class","in-l tr w-full"),r(B,"class","w-1/4"),r(e,"class","flex my-1")},m(z,G){M(z,e,G),s(e,l),s(l,n),s(l,i),s(l,o),s(l,a),te(a,t[3].m.m.w),s(e,u),s(e,c),s(c,f),s(c,_),s(c,p),s(c,b),te(b,t[3].m.m.v),s(e,v),s(e,d),s(d,S),s(d,y),s(d,$),s(d,N),te(N,t[3].m.m.a),s(e,E),s(e,B),s(B,P),s(B,L),s(B,O),s(B,F),te(F,t[3].m.m.c),x||(j=[ee(a,"input",t[37]),ee(b,"input",t[38]),ee(N,"input",t[39]),ee(F,"input",t[40])],x=!0)},p(z,G){G[0]&8&&he(a.value)!==z[3].m.m.w&&te(a,z[3].m.m.w),G[0]&8&&he(b.value)!==z[3].m.m.v&&te(b,z[3].m.m.v),G[0]&8&&he(N.value)!==z[3].m.m.a&&te(N,z[3].m.m.a),G[0]&8&&he(F.value)!==z[3].m.m.c&&te(F,z[3].m.m.c)},d(z){z&&C(e),x=!1,ze(j)}}}function _f(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,y;return{c(){e=m("div"),l=T("Gateway"),n=m("br"),i=h(),o=m("input"),a=h(),u=m("div"),c=T("DNS"),f=m("br"),_=h(),p=m("div"),b=m("input"),v=h(),d=m("input"),r(o,"name","ng"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1"),r(b,"name","nd1"),r(b,"type","text"),r(b,"class","in-f w-full"),r(d,"name","nd2"),r(d,"type","text"),r(d,"class","in-l w-full"),r(p,"class","flex"),r(u,"class","my-1")},m($,N){M($,e,N),s(e,l),s(e,n),s(e,i),s(e,o),te(o,t[3].n.g),M($,a,N),M($,u,N),s(u,c),s(u,f),s(u,_),s(u,p),s(p,b),te(b,t[3].n.d1),s(p,v),s(p,d),te(d,t[3].n.d2),S||(y=[ee(o,"input",t[49]),ee(b,"input",t[50]),ee(d,"input",t[51])],S=!0)},p($,N){N[0]&8&&o.value!==$[3].n.g&&te(o,$[3].n.g),N[0]&8&&b.value!==$[3].n.d1&&te(b,$[3].n.d1),N[0]&8&&d.value!==$[3].n.d2&&te(d,$[3].n.d2)},d($){$&&C(e),$&&C(a),$&&C(u),S=!1,ze(y)}}}function df(t){let e,l,n,i,o;return{c(){e=m("label"),l=m("input"),n=T(" SSL"),r(l,"type","checkbox"),r(l,"name","qs"),l.__value="true",l.value=l.__value,r(l,"class","rounded mb-1"),r(e,"class","float-right mr-3")},m(a,u){M(a,e,u),s(e,l),l.checked=t[3].q.s.e,s(e,n),i||(o=[ee(l,"change",t[55]),ee(l,"change",t[14])],i=!0)},p(a,u){u[0]&8&&(l.checked=a[3].q.s.e)},d(a){a&&C(e),i=!1,ze(o)}}}function vf(t){let e,l,n,i,o,a,u,c,f,_,p,b,v;const d=[fp,up],S=[];function y(O,F){return O[3].q.s.c?0:1}n=y(t),i=S[n]=d[n](t);const $=[_p,pp],N=[];function E(O,F){return O[3].q.s.r?0:1}u=E(t),c=N[u]=$[u](t);const B=[bp,hp],P=[];function L(O,F){return O[3].q.s.k?0:1}return p=L(t),b=P[p]=B[p](t),{c(){e=m("div"),l=m("span"),i.c(),o=h(),a=m("span"),c.c(),f=h(),_=m("span"),b.c(),r(l,"class","flex pr-2"),r(a,"class","flex pr-2"),r(_,"class","flex pr-2"),r(e,"class","my-1 flex")},m(O,F){M(O,e,F),s(e,l),S[n].m(l,null),s(e,o),s(e,a),N[u].m(a,null),s(e,f),s(e,_),P[p].m(_,null),v=!0},p(O,F){let x=n;n=y(O),n===x?S[n].p(O,F):(De(),q(S[x],1,1,()=>{S[x]=null}),Ie(),i=S[n],i?i.p(O,F):(i=S[n]=d[n](O),i.c()),D(i,1),i.m(l,null));let j=u;u=E(O),u===j?N[u].p(O,F):(De(),q(N[j],1,1,()=>{N[j]=null}),Ie(),c=N[u],c?c.p(O,F):(c=N[u]=$[u](O),c.c()),D(c,1),c.m(a,null));let z=p;p=L(O),p===z?P[p].p(O,F):(De(),q(P[z],1,1,()=>{P[z]=null}),Ie(),b=P[p],b?b.p(O,F):(b=P[p]=B[p](O),b.c()),D(b,1),b.m(_,null))},i(O){v||(D(i),D(c),D(b),v=!0)},o(O){q(i),q(c),q(b),v=!1},d(O){O&&C(e),S[n].d(),N[u].d(),P[p].d()}}}function up(t){let e,l;return e=new el({props:{to:"/mqtt-ca",$$slots:{default:[cp]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i[3]&16384&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function fp(t){let e,l,n,i,o,a,u,c;return l=new el({props:{to:"/mqtt-ca",$$slots:{default:[mp]},$$scope:{ctx:t}}}),o=new To({}),{c(){e=m("span"),ie(l.$$.fragment),n=h(),i=m("span"),ie(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,_){M(f,e,_),le(l,e,null),M(f,n,_),M(f,i,_),le(o,i,null),a=!0,u||(c=[ee(i,"click",t[11]),ee(i,"keypress",t[11])],u=!0)},p(f,_){const p={};_[3]&16384&&(p.$$scope={dirty:_,ctx:f}),l.$set(p)},i(f){a||(D(l.$$.fragment,f),D(o.$$.fragment,f),a=!0)},o(f){q(l.$$.fragment,f),q(o.$$.fragment,f),a=!1},d(f){f&&C(e),ne(l),f&&C(n),f&&C(i),ne(o),u=!1,ze(c)}}}function cp(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload CA",title:"Click here to upload CA"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function mp(t){let e;return{c(){e=T("CA OK")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function pp(t){let e,l;return e=new el({props:{to:"/mqtt-cert",$$slots:{default:[dp]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i[3]&16384&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function _p(t){let e,l,n,i,o,a,u,c;return l=new el({props:{to:"/mqtt-cert",$$slots:{default:[vp]},$$scope:{ctx:t}}}),o=new To({}),{c(){e=m("span"),ie(l.$$.fragment),n=h(),i=m("span"),ie(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,_){M(f,e,_),le(l,e,null),M(f,n,_),M(f,i,_),le(o,i,null),a=!0,u||(c=[ee(i,"click",t[12]),ee(i,"keypress",t[12])],u=!0)},p(f,_){const p={};_[3]&16384&&(p.$$scope={dirty:_,ctx:f}),l.$set(p)},i(f){a||(D(l.$$.fragment,f),D(o.$$.fragment,f),a=!0)},o(f){q(l.$$.fragment,f),q(o.$$.fragment,f),a=!1},d(f){f&&C(e),ne(l),f&&C(n),f&&C(i),ne(o),u=!1,ze(c)}}}function dp(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload cert",title:"Click here to upload certificate"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function vp(t){let e;return{c(){e=T("Cert OK")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function hp(t){let e,l;return e=new el({props:{to:"/mqtt-key",$$slots:{default:[gp]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i[3]&16384&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function bp(t){let e,l,n,i,o,a,u,c;return l=new el({props:{to:"/mqtt-key",$$slots:{default:[kp]},$$scope:{ctx:t}}}),o=new To({}),{c(){e=m("span"),ie(l.$$.fragment),n=h(),i=m("span"),ie(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,_){M(f,e,_),le(l,e,null),M(f,n,_),M(f,i,_),le(o,i,null),a=!0,u||(c=[ee(i,"click",t[13]),ee(i,"keypress",t[13])],u=!0)},p(f,_){const p={};_[3]&16384&&(p.$$scope={dirty:_,ctx:f}),l.$set(p)},i(f){a||(D(l.$$.fragment,f),D(o.$$.fragment,f),a=!0)},o(f){q(l.$$.fragment,f),q(o.$$.fragment,f),a=!1},d(f){f&&C(e),ne(l),f&&C(n),f&&C(i),ne(o),u=!1,ze(c)}}}function gp(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload key",title:"Click here to upload key"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function kp(t){let e;return{c(){e=T("Key OK")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function hf(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,y,$,N,E,B,P,L,O,F,x,j,z,G,V,W,U,K;return o=new Bt({}),{c(){e=m("div"),l=m("strong"),l.textContent="Domoticz",n=h(),i=m("a"),ie(o.$$.fragment),a=h(),u=m("input"),c=h(),f=m("div"),_=m("div"),p=T("Electricity IDX"),b=m("br"),v=h(),d=m("input"),S=h(),y=m("div"),$=T("Current IDX"),N=m("br"),E=h(),B=m("input"),P=h(),L=m("div"),O=T(`Voltage IDX: L1, L2 & L3 + `),F=m("div"),x=m("input"),j=h(),z=m("input"),G=h(),V=m("input"),r(l,"class","text-sm"),r(i,"href",Ut("MQTT-configuration#domoticz")),r(i,"target","_blank"),r(i,"class","float-right"),r(u,"type","hidden"),r(u,"name","o"),u.value="true",r(d,"name","oe"),r(d,"type","text"),r(d,"class","in-f tr w-full"),r(_,"class","w-1/2"),r(B,"name","oc"),r(B,"type","text"),r(B,"class","in-l tr w-full"),r(y,"class","w-1/2"),r(f,"class","my-1 flex"),r(x,"name","ou1"),r(x,"type","text"),r(x,"class","in-f tr w-1/3"),r(z,"name","ou2"),r(z,"type","text"),r(z,"class","in-m tr w-1/3"),r(V,"name","ou3"),r(V,"type","text"),r(V,"class","in-l tr w-1/3"),r(F,"class","flex"),r(L,"class","my-1"),r(e,"class","cnt")},m(H,Y){M(H,e,Y),s(e,l),s(e,n),s(e,i),le(o,i,null),s(e,a),s(e,u),s(e,c),s(e,f),s(f,_),s(_,p),s(_,b),s(_,v),s(_,d),te(d,t[3].o.e),s(f,S),s(f,y),s(y,$),s(y,N),s(y,E),s(y,B),te(B,t[3].o.c),s(e,P),s(e,L),s(L,O),s(L,F),s(F,x),te(x,t[3].o.u1),s(F,j),s(F,z),te(z,t[3].o.u2),s(F,G),s(F,V),te(V,t[3].o.u3),W=!0,U||(K=[ee(d,"input",t[63]),ee(B,"input",t[64]),ee(x,"input",t[65]),ee(z,"input",t[66]),ee(V,"input",t[67])],U=!0)},p(H,Y){Y[0]&8&&d.value!==H[3].o.e&&te(d,H[3].o.e),Y[0]&8&&B.value!==H[3].o.c&&te(B,H[3].o.c),Y[0]&8&&x.value!==H[3].o.u1&&te(x,H[3].o.u1),Y[0]&8&&z.value!==H[3].o.u2&&te(z,H[3].o.u2),Y[0]&8&&V.value!==H[3].o.u3&&te(V,H[3].o.u3)},i(H){W||(D(o.$$.fragment,H),W=!0)},o(H){q(o.$$.fragment,H),W=!1},d(H){H&&C(e),ne(o),U=!1,ze(K)}}}function bf(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,y,$,N,E,B,P,L,O,F,x,j,z,G,V;return o=new Bt({}),{c(){e=m("div"),l=m("strong"),l.textContent="Home-Assistant",n=h(),i=m("a"),ie(o.$$.fragment),a=h(),u=m("input"),c=h(),f=m("div"),_=T("Discovery topic prefix"),p=m("br"),b=h(),v=m("input"),d=h(),S=m("div"),y=T("Hostname for URL"),$=m("br"),N=h(),E=m("input"),P=h(),L=m("div"),O=T("Name tag"),F=m("br"),x=h(),j=m("input"),r(l,"class","text-sm"),r(i,"href",Ut("MQTT-configuration#home-assistant")),r(i,"target","_blank"),r(i,"class","float-right"),r(u,"type","hidden"),r(u,"name","h"),u.value="true",r(v,"name","ht"),r(v,"type","text"),r(v,"class","in-s"),r(v,"placeholder","homeassistant"),r(f,"class","my-1"),r(E,"name","hh"),r(E,"type","text"),r(E,"class","in-s"),r(E,"placeholder",B=t[3].g.h+".local"),r(S,"class","my-1"),r(j,"name","hn"),r(j,"type","text"),r(j,"class","in-s"),r(L,"class","my-1"),r(e,"class","cnt")},m(W,U){M(W,e,U),s(e,l),s(e,n),s(e,i),le(o,i,null),s(e,a),s(e,u),s(e,c),s(e,f),s(f,_),s(f,p),s(f,b),s(f,v),te(v,t[3].h.t),s(e,d),s(e,S),s(S,y),s(S,$),s(S,N),s(S,E),te(E,t[3].h.h),s(e,P),s(e,L),s(L,O),s(L,F),s(L,x),s(L,j),te(j,t[3].h.n),z=!0,G||(V=[ee(v,"input",t[68]),ee(E,"input",t[69]),ee(j,"input",t[70])],G=!0)},p(W,U){U[0]&8&&v.value!==W[3].h.t&&te(v,W[3].h.t),(!z||U[0]&8&&B!==(B=W[3].g.h+".local"))&&r(E,"placeholder",B),U[0]&8&&E.value!==W[3].h.h&&te(E,W[3].h.h),U[0]&8&&j.value!==W[3].h.n&&te(j,W[3].h.n)},i(W){z||(D(o.$$.fragment,W),z=!0)},o(W){q(o.$$.fragment,W),z=!1},d(W){W&&C(e),ne(o),G=!1,ze(V)}}}function gf(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d=t[3].c.es&&kf(t);return{c(){e=m("div"),l=m("input"),n=h(),i=m("strong"),i.textContent="Cloud connections",o=h(),a=m("div"),u=m("label"),c=m("input"),f=T(" Energy Speedometer"),_=h(),d&&d.c(),r(l,"type","hidden"),r(l,"name","c"),l.value="true",r(i,"class","text-sm"),r(c,"type","checkbox"),r(c,"class","rounded mb-1"),r(c,"name","ces"),c.__value="true",c.value=c.__value,r(a,"class","my-1"),r(e,"class","cnt")},m(S,y){M(S,e,y),s(e,l),s(e,n),s(e,i),s(e,o),s(e,a),s(a,u),s(u,c),c.checked=t[3].c.es,s(u,f),s(a,_),d&&d.m(a,null),p=!0,b||(v=ee(c,"change",t[71]),b=!0)},p(S,y){y[0]&8&&(c.checked=S[3].c.es),S[3].c.es?d?(d.p(S,y),y[0]&8&&D(d,1)):(d=kf(S),d.c(),D(d,1),d.m(a,null)):d&&(De(),q(d,1,1,()=>{d=null}),Ie())},i(S){p||(D(d),p=!0)},o(S){q(d),p=!1},d(S){S&&C(e),d&&d.d(),b=!1,v()}}}function kf(t){let e,l,n=t[0].mac+"",i,o,a,u,c=(t[0].meter.id?t[0].meter.id:"missing, required")+"",f,_,p,b,v=t[0].mac&&t[0].meter.id&&wf(t);return{c(){e=m("div"),l=T("MAC: "),i=T(n),o=h(),a=m("div"),u=T("Meter ID: "),f=T(c),_=h(),v&&v.c(),p=Ve(),r(e,"class","pl-5"),r(a,"class","pl-5")},m(d,S){M(d,e,S),s(e,l),s(e,i),M(d,o,S),M(d,a,S),s(a,u),s(a,f),M(d,_,S),v&&v.m(d,S),M(d,p,S),b=!0},p(d,S){(!b||S[0]&1)&&n!==(n=d[0].mac+"")&&Z(i,n),(!b||S[0]&1)&&c!==(c=(d[0].meter.id?d[0].meter.id:"missing, required")+"")&&Z(f,c),d[0].mac&&d[0].meter.id?v?(v.p(d,S),S[0]&1&&D(v,1)):(v=wf(d),v.c(),D(v,1),v.m(p.parentNode,p)):v&&(De(),q(v,1,1,()=>{v=null}),Ie())},i(d){b||(D(v),b=!0)},o(d){q(v),b=!1},d(d){d&&C(e),d&&C(o),d&&C(a),d&&C(_),v&&v.d(d),d&&C(p)}}}function wf(t){let e,l,n;return l=new ip({props:{value:'{"mac":"'+t[0].mac+'","meter":"'+t[0].meter.id+'"}'}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","pl-2")},m(i,o){M(i,e,o),le(l,e,null),n=!0},p(i,o){const a={};o[0]&1&&(a.value='{"mac":"'+i[0].mac+'","meter":"'+i[0].meter.id+'"}'),l.$set(a)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function yf(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,y,$,N,E;o=new Bt({});let B={length:9},P=[];for(let L=0;L20&&$f(t),_=t[0].chip=="esp8266"&&Af(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Hardware",n=h(),i=m("a"),ie(o.$$.fragment),a=h(),f&&f.c(),u=h(),_&&_.c(),r(l,"class","text-sm"),r(i,"href",Ut("GPIO-configuration")),r(i,"target","_blank"),r(i,"class","float-right"),r(e,"class","cnt")},m(p,b){M(p,e,b),s(e,l),s(e,n),s(e,i),le(o,i,null),s(e,a),f&&f.m(e,null),s(e,u),_&&_.m(e,null),c=!0},p(p,b){p[0].board>20?f?(f.p(p,b),b[0]&1&&D(f,1)):(f=$f(p),f.c(),D(f,1),f.m(e,u)):f&&(De(),q(f,1,1,()=>{f=null}),Ie()),p[0].chip=="esp8266"?_?_.p(p,b):(_=Af(p),_.c(),_.m(e,null)):_&&(_.d(1),_=null)},i(p){c||(D(o.$$.fragment,p),D(f),c=!0)},o(p){q(o.$$.fragment,p),q(f),c=!1},d(p){p&&C(e),ne(o),f&&f.d(),_&&_.d()}}}function $f(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,y,$,N,E,B,P,L,O,F,x,j,z,G,V,W,U,K,H,Y,X,re,ue,ke,me,$e,je,Re,He,we,Te,Le,Me,w,g,k,A,I,Q,J,se,ce,ve,Se,oe;b=new Xc({props:{chip:t[0].chip}});let pe=t[0].chip!="esp8266"&&Tf(t),Be=t[3].i.v.p>0&&Nf(t);return{c(){e=m("input"),l=h(),n=m("div"),i=m("div"),o=T("HAN"),a=m("label"),u=m("input"),c=T(" pullup"),f=m("br"),_=h(),p=m("select"),ie(b.$$.fragment),v=h(),d=m("div"),S=T("AP button"),y=m("br"),$=h(),N=m("input"),E=h(),B=m("div"),P=T("LED"),L=m("label"),O=m("input"),F=T(" inv"),x=m("br"),j=h(),z=m("div"),G=m("input"),V=h(),W=m("div"),U=T("RGB"),K=m("label"),H=m("input"),Y=T(" inverted"),X=m("br"),re=h(),ue=m("div"),ke=m("input"),me=h(),$e=m("input"),je=h(),Re=m("input"),He=h(),we=m("div"),Te=T("Temperature"),Le=m("br"),Me=h(),w=m("input"),g=h(),k=m("div"),A=T("Analog temp"),I=m("br"),Q=h(),J=m("input"),se=h(),pe&&pe.c(),ce=h(),Be&&Be.c(),r(e,"type","hidden"),r(e,"name","i"),e.value="true",r(u,"name","ihu"),u.__value="true",u.value=u.__value,r(u,"type","checkbox"),r(u,"class","rounded mb-1"),r(a,"class","ml-2"),r(p,"name","ihp"),r(p,"class","in-f w-full"),t[3].i.h.p===void 0&&Qe(()=>t[76].call(p)),r(i,"class","w-1/3"),r(N,"name","ia"),r(N,"type","number"),r(N,"min","0"),r(N,"max",t[6]),r(N,"class","in-m tr w-full"),r(d,"class","w-1/3"),r(O,"name","ili"),O.__value="true",O.value=O.__value,r(O,"type","checkbox"),r(O,"class","rounded mb-1"),r(L,"class","ml-4"),r(G,"name","ilp"),r(G,"type","number"),r(G,"min","0"),r(G,"max",t[6]),r(G,"class","in-l tr w-full"),r(z,"class","flex"),r(B,"class","w-1/3"),r(H,"name","iri"),H.__value="true",H.value=H.__value,r(H,"type","checkbox"),r(H,"class","rounded mb-1"),r(K,"class","ml-4"),r(ke,"name","irr"),r(ke,"type","number"),r(ke,"min","0"),r(ke,"max",t[6]),r(ke,"class","in-f tr w-1/3"),r($e,"name","irg"),r($e,"type","number"),r($e,"min","0"),r($e,"max",t[6]),r($e,"class","in-m tr w-1/3"),r(Re,"name","irb"),r(Re,"type","number"),r(Re,"min","0"),r(Re,"max",t[6]),r(Re,"class","in-l tr w-1/3"),r(ue,"class","flex"),r(W,"class","w-full"),r(w,"name","itd"),r(w,"type","number"),r(w,"min","0"),r(w,"max",t[6]),r(w,"class","in-f tr w-full"),r(we,"class","my-1 w-1/3"),r(J,"name","ita"),r(J,"type","number"),r(J,"min","0"),r(J,"max",t[6]),r(J,"class","in-l tr w-full"),r(k,"class","my-1 pr-1 w-1/3"),r(n,"class","flex flex-wrap")},m(_e,ye){M(_e,e,ye),M(_e,l,ye),M(_e,n,ye),s(n,i),s(i,o),s(i,a),s(a,u),u.checked=t[3].i.h.u,s(a,c),s(i,f),s(i,_),s(i,p),le(b,p,null),qe(p,t[3].i.h.p,!0),s(n,v),s(n,d),s(d,S),s(d,y),s(d,$),s(d,N),te(N,t[3].i.a),s(n,E),s(n,B),s(B,P),s(B,L),s(L,O),O.checked=t[3].i.l.i,s(L,F),s(B,x),s(B,j),s(B,z),s(z,G),te(G,t[3].i.l.p),s(n,V),s(n,W),s(W,U),s(W,K),s(K,H),H.checked=t[3].i.r.i,s(K,Y),s(W,X),s(W,re),s(W,ue),s(ue,ke),te(ke,t[3].i.r.r),s(ue,me),s(ue,$e),te($e,t[3].i.r.g),s(ue,je),s(ue,Re),te(Re,t[3].i.r.b),s(n,He),s(n,we),s(we,Te),s(we,Le),s(we,Me),s(we,w),te(w,t[3].i.t.d),s(n,g),s(n,k),s(k,A),s(k,I),s(k,Q),s(k,J),te(J,t[3].i.t.a),s(n,se),pe&&pe.m(n,null),s(n,ce),Be&&Be.m(n,null),ve=!0,Se||(oe=[ee(u,"change",t[75]),ee(p,"change",t[76]),ee(N,"input",t[77]),ee(O,"change",t[78]),ee(G,"input",t[79]),ee(H,"change",t[80]),ee(ke,"input",t[81]),ee($e,"input",t[82]),ee(Re,"input",t[83]),ee(w,"input",t[84]),ee(J,"input",t[85])],Se=!0)},p(_e,ye){ye[0]&8&&(u.checked=_e[3].i.h.u);const vt={};ye[0]&1&&(vt.chip=_e[0].chip),b.$set(vt),ye[0]&8&&qe(p,_e[3].i.h.p),(!ve||ye[0]&64)&&r(N,"max",_e[6]),ye[0]&8&&he(N.value)!==_e[3].i.a&&te(N,_e[3].i.a),ye[0]&8&&(O.checked=_e[3].i.l.i),(!ve||ye[0]&64)&&r(G,"max",_e[6]),ye[0]&8&&he(G.value)!==_e[3].i.l.p&&te(G,_e[3].i.l.p),ye[0]&8&&(H.checked=_e[3].i.r.i),(!ve||ye[0]&64)&&r(ke,"max",_e[6]),ye[0]&8&&he(ke.value)!==_e[3].i.r.r&&te(ke,_e[3].i.r.r),(!ve||ye[0]&64)&&r($e,"max",_e[6]),ye[0]&8&&he($e.value)!==_e[3].i.r.g&&te($e,_e[3].i.r.g),(!ve||ye[0]&64)&&r(Re,"max",_e[6]),ye[0]&8&&he(Re.value)!==_e[3].i.r.b&&te(Re,_e[3].i.r.b),(!ve||ye[0]&64)&&r(w,"max",_e[6]),ye[0]&8&&he(w.value)!==_e[3].i.t.d&&te(w,_e[3].i.t.d),(!ve||ye[0]&64)&&r(J,"max",_e[6]),ye[0]&8&&he(J.value)!==_e[3].i.t.a&&te(J,_e[3].i.t.a),_e[0].chip!="esp8266"?pe?pe.p(_e,ye):(pe=Tf(_e),pe.c(),pe.m(n,ce)):pe&&(pe.d(1),pe=null),_e[3].i.v.p>0?Be?Be.p(_e,ye):(Be=Nf(_e),Be.c(),Be.m(n,null)):Be&&(Be.d(1),Be=null)},i(_e){ve||(D(b.$$.fragment,_e),ve=!0)},o(_e){q(b.$$.fragment,_e),ve=!1},d(_e){_e&&C(e),_e&&C(l),_e&&C(n),ne(b),pe&&pe.d(),Be&&Be.d(),Se=!1,ze(oe)}}}function Tf(t){let e,l,n,i,o,a,u;return{c(){e=m("div"),l=T("Vcc"),n=m("br"),i=h(),o=m("input"),r(o,"name","ivp"),r(o,"type","number"),r(o,"min","0"),r(o,"max",t[6]),r(o,"class","in-s tr w-full"),r(e,"class","my-1 pl-1 w-1/3")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),te(o,t[3].i.v.p),a||(u=ee(o,"input",t[86]),a=!0)},p(c,f){f[0]&64&&r(o,"max",c[6]),f[0]&8&&he(o.value)!==c[3].i.v.p&&te(o,c[3].i.v.p)},d(c){c&&C(e),a=!1,u()}}}function Nf(t){let e,l,n,i,o,a,u,c,f,_;return{c(){e=m("div"),l=T("Voltage divider"),n=m("br"),i=h(),o=m("div"),a=m("input"),u=h(),c=m("input"),r(a,"name","ivdv"),r(a,"type","number"),r(a,"min","0"),r(a,"max","65535"),r(a,"class","in-f tr w-full"),r(a,"placeholder","VCC"),r(c,"name","ivdg"),r(c,"type","number"),r(c,"min","0"),r(c,"max","65535"),r(c,"class","in-l tr w-full"),r(c,"placeholder","GND"),r(o,"class","flex"),r(e,"class","my-1")},m(p,b){M(p,e,b),s(e,l),s(e,n),s(e,i),s(e,o),s(o,a),te(a,t[3].i.v.d.v),s(o,u),s(o,c),te(c,t[3].i.v.d.g),f||(_=[ee(a,"input",t[87]),ee(c,"input",t[88])],f=!0)},p(p,b){b[0]&8&&he(a.value)!==p[3].i.v.d.v&&te(a,p[3].i.v.d.v),b[0]&8&&he(c.value)!==p[3].i.v.d.g&&te(c,p[3].i.v.d.g)},d(p){p&&C(e),f=!1,ze(_)}}}function Af(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,y,$,N=(t[0].board==2||t[0].board==100)&&Pf(t);return{c(){e=m("input"),l=h(),n=m("div"),i=m("div"),o=T("Vcc offset"),a=m("br"),u=h(),c=m("input"),f=h(),_=m("div"),p=T("Multiplier"),b=m("br"),v=h(),d=m("input"),S=h(),N&&N.c(),r(e,"type","hidden"),r(e,"name","iv"),e.value="true",r(c,"name","ivo"),r(c,"type","number"),r(c,"min","0.0"),r(c,"max","3.5"),r(c,"step","0.01"),r(c,"class","in-f tr w-full"),r(i,"class","w-1/3"),r(d,"name","ivm"),r(d,"type","number"),r(d,"min","0.1"),r(d,"max","10"),r(d,"step","0.01"),r(d,"class","in-l tr w-full"),r(_,"class","w-1/3 pr-1"),r(n,"class","my-1 flex flex-wrap")},m(E,B){M(E,e,B),M(E,l,B),M(E,n,B),s(n,i),s(i,o),s(i,a),s(i,u),s(i,c),te(c,t[3].i.v.o),s(n,f),s(n,_),s(_,p),s(_,b),s(_,v),s(_,d),te(d,t[3].i.v.m),s(n,S),N&&N.m(n,null),y||($=[ee(c,"input",t[89]),ee(d,"input",t[90])],y=!0)},p(E,B){B[0]&8&&he(c.value)!==E[3].i.v.o&&te(c,E[3].i.v.o),B[0]&8&&he(d.value)!==E[3].i.v.m&&te(d,E[3].i.v.m),E[0].board==2||E[0].board==100?N?N.p(E,B):(N=Pf(E),N.c(),N.m(n,null)):N&&(N.d(1),N=null)},d(E){E&&C(e),E&&C(l),E&&C(n),N&&N.d(),y=!1,ze($)}}}function Pf(t){let e,l,n,i,o,a,u;return{c(){e=m("div"),l=T("Boot limit"),n=m("br"),i=h(),o=m("input"),r(o,"name","ivb"),r(o,"type","number"),r(o,"min","2.5"),r(o,"max","3.5"),r(o,"step","0.1"),r(o,"class","in-s tr w-full"),r(e,"class","w-1/3 pl-1")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),te(o,t[3].i.v.b),a||(u=ee(o,"input",t[91]),a=!0)},p(c,f){f[0]&8&&he(o.value)!==c[3].i.v.b&&te(o,c[3].i.v.b)},d(c){c&&C(e),a=!1,u()}}}function Ef(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,y,$=t[3].d.t&&Df();return{c(){e=m("div"),e.textContent="Debug can cause sudden reboots. Do not leave on!",l=h(),n=m("div"),i=m("label"),o=m("input"),a=T(" Enable telnet"),u=h(),$&&$.c(),c=h(),f=m("div"),_=m("select"),p=m("option"),p.textContent="Verbose",b=m("option"),b.textContent="Debug",v=m("option"),v.textContent="Info",d=m("option"),d.textContent="Warning",r(e,"class","bd-red"),r(o,"type","checkbox"),r(o,"name","dt"),o.__value="true",o.value=o.__value,r(o,"class","rounded mb-1"),r(n,"class","my-1"),p.__value=1,p.value=p.__value,b.__value=2,b.value=b.__value,v.__value=3,v.value=v.__value,d.__value=4,d.value=d.__value,r(_,"name","dl"),r(_,"class","in-s"),t[3].d.l===void 0&&Qe(()=>t[94].call(_)),r(f,"class","my-1")},m(N,E){M(N,e,E),M(N,l,E),M(N,n,E),s(n,i),s(i,o),o.checked=t[3].d.t,s(i,a),M(N,u,E),$&&$.m(N,E),M(N,c,E),M(N,f,E),s(f,_),s(_,p),s(_,b),s(_,v),s(_,d),qe(_,t[3].d.l,!0),S||(y=[ee(o,"change",t[93]),ee(_,"change",t[94])],S=!0)},p(N,E){E[0]&8&&(o.checked=N[3].d.t),N[3].d.t?$||($=Df(),$.c(),$.m(c.parentNode,c)):$&&($.d(1),$=null),E[0]&8&&qe(_,N[3].d.l)},d(N){N&&C(e),N&&C(l),N&&C(n),N&&C(u),$&&$.d(N),N&&C(c),N&&C(f),S=!1,ze(y)}}}function Df(t){let e;return{c(){e=m("div"),e.textContent="Telnet is unsafe and should be off when not in use",r(e,"class","bd-red")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function wp(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,y,$,N,E,B,P,L,O,F,x,j,z,G,V,W,U,K,H,Y,X,re,ue,ke,me,$e,je,Re,He,we,Te,Le,Me,w,g,k,A,I,Q,J,se,ce,ve,Se,oe,pe,Be,_e,ye,vt,Hl,tl,ct,Tl,pl,Ht,ht,Xe,Ze,Je,Ue,xe,We,et,tt,de,Ce,Ei,_l,_n,Tt,Di,Ii,Ri,dl,Li,Oi,Fi,Nt,Nl,Al,Pl,qi,Ge,Ae,vl,Ts,El,Rt,Bi,Wl,Ao,ll,Ui,Po,Ns,Eo,ci,Wt,Do,Io,Dl,nl,Il,Ro,ji,Lo,pt,Rl,Oo,Hi,dn,vn,hn,bn,Wi,Fo,At,zi,qo,zl,Bo,Uo,jo,il,gn,kn,Ho,wn,Gl,Wo,zo,Go,yn,zt,Vo,Gi,Ko,Vl,Yo,Qo,Xo,Cn,Gt,Zo,Vi,Jo,As,xo,Kl,Ki,Vt,er,tr,lr,Ps,Yi,Kt,nr,ir,sr,mt,Qi,or,Mn,Sn,rr,mi,ar,Yl,ur,fr,cr,hl,mr,Ql,pr,_r,dr,bl,vr,$n,Xl,hr,br,gr,Lt,Tn,Nn,An,Pn,kr,Zl,wr,yr,Cr,En,Ot,Mr,Xi,Sr,Zi,Ji,Yt,$r,Tr,ut,xi,Nr,Dn,In,Ar,Jl,Pr,Er,Dr,Ll,sl,Rn,Ln,Ir,Pt,es,ts,Rr,Et,On,ls,ns,Lr,Es,is,ss,Qt,Or,Fr,pi,qr,Ol,Br,_i,Xt,Ur,jr,Hr,os,gl,Wr,Ye,rs,zr,Fn,qn,Gr,di,Vr,ol,Kr,Ds,Yr,Qr,Bn,kl,Xr,Zt,Zr,Is,xl,Jr,xr,ea,wl,ta,en,la,na,ia,yl,sa,Un,jn,oa,ra,aa,Cl,ua,Hn,fa,ca,ma,bt,Wn,zn,Gn,Vn,Kn,Yn,pa,tn,_a,da,va,Ml,ha,Rs,Ls,Os,Fs=t[3].p.r.startsWith("10YNO")||t[3].p.r.startsWith("10Y1001A1001A4"),qs,rl,as,ba,Qn,Xn,ga,vi,ka,hi,wa,Bs,Dt,us,ya,Zn,Jn,Ca,bi,Ma,fs,cs,Jt,Sa,$a,Ta,Fl,Us,xn,Na,ms,ei,Aa,ps,js,ln,Hs,nn,Ws,sn,zs,on,Ft,Gs,Pa;u=new Bt({}),F=new Zm({});let xc=["NOK","SEK","DKK","EUR"],gi=[];for(let R=0;R<4;R+=1)gi[R]=rp(op(t,xc,R));let gt=t[3].p.e&&t[0].chip!="esp8266"&&uf(t),kt=t[3].g.s>0&&ff(t);Rt=new Bt({});let e0=[24,48,96,192,384,576,1152],ki=[];for(let R=0;R<7;R+=1)ki[R]=ap(sp(t,e0,R));let wt=t[3].m.e.e&&cf(t),yt=t[3].m.e.e&&mf(t),Ct=t[3].m.m.e&&pf(t);Sn=new Bt({}),In=new Bt({}),On=new Zc({});let Mt=t[3].n.m=="static"&&_f(t);qn=new Bt({});let St=t[0].chip!="esp8266"&&df(t),lt=t[3].q.s.e&&vf(t),nt=t[3].q.m==3&&hf(t),it=t[3].q.m==4&&bf(t),st=t[3].c.es!=null&&gf(t),ot=Fs&&yf(t);Xn=new Bt({});let ti=t[7],_t=[];for(let R=0;R20||t[0].chip=="esp8266")&&Sf(t);Jn=new Bt({});let $t=t[3].d.s&&Ef(t);return ln=new It({props:{active:t[1],message:"Loading configuration"}}),nn=new It({props:{active:t[2],message:"Saving configuration"}}),sn=new It({props:{active:t[4],message:"Performing factory reset"}}),on=new It({props:{active:t[5],message:"Device have been factory reset and switched to AP mode"}}),{c(){e=m("form"),l=m("div"),n=m("div"),i=m("strong"),i.textContent="General",o=h(),a=m("a"),ie(u.$$.fragment),c=h(),f=m("input"),_=h(),p=m("div"),b=m("div"),v=m("div"),d=T("Hostname"),S=m("br"),y=h(),$=m("input"),N=h(),E=m("div"),B=T("Time zone"),P=m("br"),L=h(),O=m("select"),ie(F.$$.fragment),x=h(),j=m("input"),z=h(),G=m("div"),V=m("div"),W=m("div"),U=T("Price region"),K=m("br"),H=h(),Y=m("select"),X=m("optgroup"),re=m("option"),re.textContent="NO1",ue=m("option"),ue.textContent="NO2",ke=m("option"),ke.textContent="NO3",me=m("option"),me.textContent="NO4",$e=m("option"),$e.textContent="NO5",je=m("optgroup"),Re=m("option"),Re.textContent="SE1",He=m("option"),He.textContent="SE2",we=m("option"),we.textContent="SE3",Te=m("option"),Te.textContent="SE4",Le=m("optgroup"),Me=m("option"),Me.textContent="DK1",w=m("option"),w.textContent="DK2",g=m("option"),g.textContent="Austria",k=m("option"),k.textContent="Belgium",A=m("option"),A.textContent="Czech Republic",I=m("option"),I.textContent="Estonia",Q=m("option"),Q.textContent="Finland",J=m("option"),J.textContent="France",se=m("option"),se.textContent="Germany",ce=m("option"),ce.textContent="Great Britain",ve=m("option"),ve.textContent="Latvia",Se=m("option"),Se.textContent="Lithuania",oe=m("option"),oe.textContent="Netherland",pe=m("option"),pe.textContent="Poland",Be=m("option"),Be.textContent="Switzerland",_e=h(),ye=m("div"),vt=T("Currency"),Hl=m("br"),tl=h(),ct=m("select");for(let R=0;R<4;R+=1)gi[R].c();Tl=h(),pl=m("div"),Ht=m("div"),ht=m("div"),Xe=T("Fixed price"),Ze=m("br"),Je=h(),Ue=m("input"),xe=h(),We=m("div"),et=T("Multiplier"),tt=m("br"),de=h(),Ce=m("input"),Ei=h(),_l=m("div"),_n=m("label"),Tt=m("input"),Di=T(" Enable price fetch from remote server"),Ii=h(),gt&>.c(),Ri=h(),dl=m("div"),Li=T("Security"),Oi=m("br"),Fi=h(),Nt=m("select"),Nl=m("option"),Nl.textContent="None",Al=m("option"),Al.textContent="Only configuration",Pl=m("option"),Pl.textContent="Everything",qi=h(),kt&&kt.c(),Ge=h(),Ae=m("div"),vl=m("strong"),vl.textContent="Meter",Ts=h(),El=m("a"),ie(Rt.$$.fragment),Bi=h(),Wl=m("input"),Ao=h(),ll=m("div"),Ui=m("span"),Ui.textContent="Buffer size",Po=h(),Ns=m("span"),Ns.textContent="Serial conf.",Eo=h(),ci=m("label"),Wt=m("input"),Do=T(" inverted"),Io=h(),Dl=m("div"),nl=m("select"),Il=m("option"),Ro=T("Autodetect");for(let R=0;R<7;R+=1)ki[R].c();Lo=h(),pt=m("select"),Rl=m("option"),Oo=T("-"),dn=m("option"),dn.textContent="7N1",vn=m("option"),vn.textContent="8N1",hn=m("option"),hn.textContent="7E1",bn=m("option"),bn.textContent="8E1",Fo=h(),At=m("input"),qo=h(),zl=m("div"),Bo=T("Voltage"),Uo=m("br"),jo=h(),il=m("select"),gn=m("option"),gn.textContent="400V (TN)",kn=m("option"),kn.textContent="230V (IT/TT)",Ho=h(),wn=m("div"),Gl=m("div"),Wo=T("Main fuse"),zo=m("br"),Go=h(),yn=m("label"),zt=m("input"),Vo=h(),Gi=m("span"),Gi.textContent="A",Ko=h(),Vl=m("div"),Yo=T("Production"),Qo=m("br"),Xo=h(),Cn=m("label"),Gt=m("input"),Zo=h(),Vi=m("span"),Vi.textContent="kWp",Jo=h(),As=m("div"),xo=h(),Kl=m("div"),Ki=m("label"),Vt=m("input"),er=T(" Meter is encrypted"),tr=h(),wt&&wt.c(),lr=h(),yt&&yt.c(),Ps=h(),Yi=m("label"),Kt=m("input"),nr=T(" Multipliers"),ir=h(),Ct&&Ct.c(),sr=h(),mt=m("div"),Qi=m("strong"),Qi.textContent="WiFi",or=h(),Mn=m("a"),ie(Sn.$$.fragment),rr=h(),mi=m("input"),ar=h(),Yl=m("div"),ur=T("SSID"),fr=m("br"),cr=h(),hl=m("input"),mr=h(),Ql=m("div"),pr=T("Password"),_r=m("br"),dr=h(),bl=m("input"),vr=h(),$n=m("div"),Xl=m("div"),hr=T("Power saving"),br=m("br"),gr=h(),Lt=m("select"),Tn=m("option"),Tn.textContent="Default",Nn=m("option"),Nn.textContent="Off",An=m("option"),An.textContent="Minimum",Pn=m("option"),Pn.textContent="Maximum",kr=h(),Zl=m("div"),wr=T("Power"),yr=m("br"),Cr=h(),En=m("div"),Ot=m("input"),Mr=h(),Xi=m("span"),Xi.textContent="dBm",Sr=h(),Zi=m("div"),Ji=m("label"),Yt=m("input"),$r=T(" Allow 802.11b legacy rates"),Tr=h(),ut=m("div"),xi=m("strong"),xi.textContent="Network",Nr=h(),Dn=m("a"),ie(In.$$.fragment),Ar=h(),Jl=m("div"),Pr=T("IP"),Er=m("br"),Dr=h(),Ll=m("div"),sl=m("select"),Rn=m("option"),Rn.textContent="DHCP",Ln=m("option"),Ln.textContent="Static",Ir=h(),Pt=m("input"),Rr=h(),Et=m("select"),ie(On.$$.fragment),Lr=h(),Mt&&Mt.c(),Es=h(),is=m("div"),ss=m("label"),Qt=m("input"),Or=T(" enable mDNS"),Fr=h(),pi=m("input"),qr=h(),Ol=m("div"),Br=T("NTP "),_i=m("label"),Xt=m("input"),Ur=T(" obtain from DHCP"),jr=m("br"),Hr=h(),os=m("div"),gl=m("input"),Wr=h(),Ye=m("div"),rs=m("strong"),rs.textContent="MQTT",zr=h(),Fn=m("a"),ie(qn.$$.fragment),Gr=h(),di=m("input"),Vr=h(),ol=m("div"),Kr=T(`Server + `),St&&St.c(),Ds=h(),Yr=m("br"),Qr=h(),Bn=m("div"),kl=m("input"),Xr=h(),Zt=m("input"),Zr=h(),lt&<.c(),Is=h(),xl=m("div"),Jr=T("Username"),xr=m("br"),ea=h(),wl=m("input"),ta=h(),en=m("div"),la=T("Password"),na=m("br"),ia=h(),yl=m("input"),sa=h(),Un=m("div"),jn=m("div"),oa=T("Client ID"),ra=m("br"),aa=h(),Cl=m("input"),ua=h(),Hn=m("div"),fa=T("Payload"),ca=m("br"),ma=h(),bt=m("select"),Wn=m("option"),Wn.textContent="JSON",zn=m("option"),zn.textContent="Raw (minimal)",Gn=m("option"),Gn.textContent="Raw (full)",Vn=m("option"),Vn.textContent="Domoticz",Kn=m("option"),Kn.textContent="HomeAssistant",Yn=m("option"),Yn.textContent="HEX dump",pa=h(),tn=m("div"),_a=T("Publish topic"),da=m("br"),va=h(),Ml=m("input"),ha=h(),nt&&nt.c(),Rs=h(),it&&it.c(),Ls=h(),st&&st.c(),Os=h(),ot&&ot.c(),qs=h(),rl=m("div"),as=m("strong"),as.textContent="User interface",ba=h(),Qn=m("a"),ie(Xn.$$.fragment),ga=h(),vi=m("input"),ka=h(),hi=m("div");for(let R=0;R<_t.length;R+=1)_t[R].c();wa=h(),rt&&rt.c(),Bs=h(),Dt=m("div"),us=m("strong"),us.textContent="Debugging",ya=h(),Zn=m("a"),ie(Jn.$$.fragment),Ca=h(),bi=m("input"),Ma=h(),fs=m("div"),cs=m("label"),Jt=m("input"),Sa=T(" Enable debugging"),$a=h(),$t&&$t.c(),Ta=h(),Fl=m("div"),Us=m("div"),xn=m("button"),xn.textContent="Factory reset",Na=h(),ms=m("div"),ei=m("button"),ei.textContent="Reboot",Aa=h(),ps=m("div"),ps.innerHTML='',js=h(),ie(ln.$$.fragment),Hs=h(),ie(nn.$$.fragment),Ws=h(),ie(sn.$$.fragment),zs=h(),ie(on.$$.fragment),r(i,"class","text-sm"),r(a,"href",Ut("General-configuration")),r(a,"target","_blank"),r(a,"class","float-right"),r(f,"type","hidden"),r(f,"name","g"),f.value="true",r($,"name","gh"),r($,"type","text"),r($,"class","in-f w-full"),r($,"pattern","[A-Za-z0-9-]+"),r(O,"name","gt"),r(O,"class","in-l w-full"),t[3].g.t===void 0&&Qe(()=>t[16].call(O)),r(b,"class","flex"),r(p,"class","my-1"),r(j,"type","hidden"),r(j,"name","p"),j.value="true",re.__value="10YNO-1--------2",re.value=re.__value,ue.__value="10YNO-2--------T",ue.value=ue.__value,ke.__value="10YNO-3--------J",ke.value=ke.__value,me.__value="10YNO-4--------9",me.value=me.__value,$e.__value="10Y1001A1001A48H",$e.value=$e.__value,r(X,"label","Norway"),Re.__value="10Y1001A1001A44P",Re.value=Re.__value,He.__value="10Y1001A1001A45N",He.value=He.__value,we.__value="10Y1001A1001A46L",we.value=we.__value,Te.__value="10Y1001A1001A47J",Te.value=Te.__value,r(je,"label","Sweden"),Me.__value="10YDK-1--------W",Me.value=Me.__value,w.__value="10YDK-2--------M",w.value=w.__value,r(Le,"label","Denmark"),g.__value="10YAT-APG------L",g.value=g.__value,k.__value="10YBE----------2",k.value=k.__value,A.__value="10YCZ-CEPS-----N",A.value=A.__value,I.__value="10Y1001A1001A39I",I.value=I.__value,Q.__value="10YFI-1--------U",Q.value=Q.__value,J.__value="10YFR-RTE------C",J.value=J.__value,se.__value="10Y1001A1001A83F",se.value=se.__value,ce.__value="10YGB----------A",ce.value=ce.__value,ve.__value="10YLV-1001A00074",ve.value=ve.__value,Se.__value="10YLT-1001A0008Q",Se.value=Se.__value,oe.__value="10YNL----------L",oe.value=oe.__value,pe.__value="10YPL-AREA-----S",pe.value=pe.__value,Be.__value="10YCH-SWISSGRIDZ",Be.value=Be.__value,r(Y,"name","pr"),r(Y,"class","in-f w-full"),t[3].p.r===void 0&&Qe(()=>t[17].call(Y)),r(W,"class","w-full"),r(ct,"name","pc"),r(ct,"class","in-l"),t[3].p.c===void 0&&Qe(()=>t[18].call(ct)),r(V,"class","flex"),r(G,"class","my-1"),r(Ue,"name","pf"),r(Ue,"type","number"),r(Ue,"min","0.001"),r(Ue,"max","65"),r(Ue,"step","0.001"),r(Ue,"class","in-f tr w-full"),r(ht,"class","w-1/2"),r(Ce,"name","pm"),r(Ce,"type","number"),r(Ce,"min","0.001"),r(Ce,"max","1000"),r(Ce,"step","0.001"),r(Ce,"class","in-l tr w-full"),r(We,"class","w-1/2"),r(Ht,"class","flex"),r(pl,"class","my-1"),r(Tt,"type","checkbox"),r(Tt,"name","pe"),Tt.__value="true",Tt.value=Tt.__value,r(Tt,"class","rounded mb-1"),r(_l,"class","my-1"),Nl.__value=0,Nl.value=Nl.__value,Al.__value=1,Al.value=Al.__value,Pl.__value=2,Pl.value=Pl.__value,r(Nt,"name","gs"),r(Nt,"class","in-s"),t[3].g.s===void 0&&Qe(()=>t[23].call(Nt)),r(dl,"class","my-1"),r(n,"class","cnt"),r(vl,"class","text-sm"),r(El,"href",Ut("Meter-configuration")),r(El,"target","_blank"),r(El,"class","float-right"),r(Wl,"type","hidden"),r(Wl,"name","m"),Wl.value="true",r(Ui,"class","float-right"),r(Wt,"name","mi"),Wt.__value="true",Wt.value=Wt.__value,r(Wt,"type","checkbox"),r(Wt,"class","rounded mb-1"),r(ci,"class","mt-2 ml-3 whitespace-nowrap"),Il.__value=0,Il.value=Il.__value,Il.disabled=ji=t[3].m.b!=0,r(nl,"name","mb"),r(nl,"class","in-f tr w-1/2"),t[3].m.b===void 0&&Qe(()=>t[27].call(nl)),Rl.__value=0,Rl.value=Rl.__value,Rl.disabled=Hi=t[3].m.b!=0,dn.__value=2,dn.value=dn.__value,vn.__value=3,vn.value=vn.__value,hn.__value=10,hn.value=hn.__value,bn.__value=11,bn.value=bn.__value,r(pt,"name","mp"),r(pt,"class","in-m"),pt.disabled=Wi=t[3].m.b==0,t[3].m.p===void 0&&Qe(()=>t[28].call(pt)),r(At,"name","ms"),r(At,"type","number"),r(At,"min",64),r(At,"max",zi=t[0].chip=="esp8266"?t[3].i.h.p==3||t[3].i.h.p==113?512:128:4096),r(At,"step",64),r(At,"class","in-l tr w-1/2"),r(Dl,"class","flex w-full"),r(ll,"class","my-1"),gn.__value=2,gn.value=gn.__value,kn.__value=1,kn.value=kn.__value,r(il,"name","md"),r(il,"class","in-s"),t[3].m.d===void 0&&Qe(()=>t[30].call(il)),r(zl,"class","my-1"),r(zt,"name","mf"),r(zt,"type","number"),r(zt,"min","5"),r(zt,"max","65535"),r(zt,"class","in-f tr w-full"),r(Gi,"class","in-post"),r(yn,"class","flex"),r(Gl,"class","mx-1"),r(Gt,"name","mr"),r(Gt,"type","number"),r(Gt,"min","0"),r(Gt,"max","65535"),r(Gt,"class","in-f tr w-full"),r(Vi,"class","in-post"),r(Cn,"class","flex"),r(Vl,"class","mx-1"),r(wn,"class","my-1 flex"),r(As,"class","my-1"),r(Vt,"type","checkbox"),r(Vt,"name","me"),Vt.__value="true",Vt.value=Vt.__value,r(Vt,"class","rounded mb-1"),r(Kl,"class","my-1"),r(Kt,"type","checkbox"),r(Kt,"name","mm"),Kt.__value="true",Kt.value=Kt.__value,r(Kt,"class","rounded mb-1"),r(Ae,"class","cnt"),r(Qi,"class","text-sm"),r(Mn,"href",Ut("WiFi-configuration")),r(Mn,"target","_blank"),r(Mn,"class","float-right"),r(mi,"type","hidden"),r(mi,"name","w"),mi.value="true",r(hl,"name","ws"),r(hl,"type","text"),r(hl,"class","in-s"),r(Yl,"class","my-1"),r(bl,"name","wp"),r(bl,"type","password"),r(bl,"class","in-s"),r(Ql,"class","my-1"),Tn.__value=255,Tn.value=Tn.__value,Nn.__value=0,Nn.value=Nn.__value,An.__value=1,An.value=An.__value,Pn.__value=2,Pn.value=Pn.__value,r(Lt,"name","wz"),r(Lt,"class","in-s"),t[3].w.z===void 0&&Qe(()=>t[43].call(Lt)),r(Xl,"class","w-1/2"),r(Ot,"name","ww"),r(Ot,"type","number"),r(Ot,"min","0"),r(Ot,"max","20.5"),r(Ot,"step","0.5"),r(Ot,"class","in-f tr w-full"),r(Xi,"class","in-post"),r(En,"class","flex"),r(Zl,"class","ml-2 w-1/2"),r($n,"class","my-1 flex"),r(Yt,"type","checkbox"),r(Yt,"name","wb"),Yt.__value="true",Yt.value=Yt.__value,r(Yt,"class","rounded mb-1"),r(Zi,"class","my-3"),r(mt,"class","cnt"),r(xi,"class","text-sm"),r(Dn,"href",Ut("Network-configuration")),r(Dn,"target","_blank"),r(Dn,"class","float-right"),Rn.__value="dhcp",Rn.value=Rn.__value,Ln.__value="static",Ln.value=Ln.__value,r(sl,"name","nm"),r(sl,"class","in-f"),t[3].n.m===void 0&&Qe(()=>t[46].call(sl)),r(Pt,"name","ni"),r(Pt,"type","text"),r(Pt,"class","in-m w-full"),Pt.disabled=es=t[3].n.m=="dhcp",Pt.required=ts=t[3].n.m=="static",r(Et,"name","ns"),r(Et,"class","in-l"),Et.disabled=ls=t[3].n.m=="dhcp",Et.required=ns=t[3].n.m=="static",t[3].n.s===void 0&&Qe(()=>t[48].call(Et)),r(Ll,"class","flex"),r(Jl,"class","my-1"),r(Qt,"name","nd"),Qt.__value="true",Qt.value=Qt.__value,r(Qt,"type","checkbox"),r(Qt,"class","rounded mb-1"),r(is,"class","my-1"),r(pi,"type","hidden"),r(pi,"name","ntp"),pi.value="true",r(Xt,"name","ntpd"),Xt.__value="true",Xt.value=Xt.__value,r(Xt,"type","checkbox"),r(Xt,"class","rounded mb-1"),r(_i,"class","ml-4"),r(gl,"name","ntph"),r(gl,"type","text"),r(gl,"class","in-s"),r(os,"class","flex"),r(Ol,"class","my-1"),r(ut,"class","cnt"),r(rs,"class","text-sm"),r(Fn,"href",Ut("MQTT-configuration")),r(Fn,"target","_blank"),r(Fn,"class","float-right"),r(di,"type","hidden"),r(di,"name","q"),di.value="true",r(kl,"name","qh"),r(kl,"type","text"),r(kl,"class","in-f w-3/4"),r(Zt,"name","qp"),r(Zt,"type","number"),r(Zt,"min","1024"),r(Zt,"max","65535"),r(Zt,"class","in-l tr w-1/4"),r(Bn,"class","flex"),r(ol,"class","my-1"),r(wl,"name","qu"),r(wl,"type","text"),r(wl,"class","in-s"),r(xl,"class","my-1"),r(yl,"name","qa"),r(yl,"type","password"),r(yl,"class","in-s"),r(en,"class","my-1"),r(Cl,"name","qc"),r(Cl,"type","text"),r(Cl,"class","in-f w-full"),Wn.__value=0,Wn.value=Wn.__value,zn.__value=1,zn.value=zn.__value,Gn.__value=2,Gn.value=Gn.__value,Vn.__value=3,Vn.value=Vn.__value,Kn.__value=4,Kn.value=Kn.__value,Yn.__value=255,Yn.value=Yn.__value,r(bt,"name","qm"),r(bt,"class","in-l"),t[3].q.m===void 0&&Qe(()=>t[61].call(bt)),r(Un,"class","my-1 flex"),r(Ml,"name","qb"),r(Ml,"type","text"),r(Ml,"class","in-s"),r(tn,"class","my-1"),r(Ye,"class","cnt"),r(as,"class","text-sm"),r(Qn,"href",Ut("User-interface")),r(Qn,"target","_blank"),r(Qn,"class","float-right"),r(vi,"type","hidden"),r(vi,"name","u"),vi.value="true",r(hi,"class","flex flex-wrap"),r(rl,"class","cnt"),r(us,"class","text-sm"),r(Zn,"href","https://amsleser.no/blog/post/24-telnet-debug"),r(Zn,"target","_blank"),r(Zn,"class","float-right"),r(bi,"type","hidden"),r(bi,"name","d"),bi.value="true",r(Jt,"type","checkbox"),r(Jt,"name","ds"),Jt.__value="true",Jt.value=Jt.__value,r(Jt,"class","rounded mb-1"),r(fs,"class","mt-3"),r(Dt,"class","cnt"),r(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),r(xn,"type","button"),r(xn,"class","py-2 px-4 rounded bg-red-500 text-white ml-2"),r(ei,"type","button"),r(ei,"class","py-2 px-4 rounded bg-yellow-500 text-white"),r(ms,"class","text-center"),r(ps,"class","text-right"),r(Fl,"class","grid grid-cols-3"),r(e,"autocomplete","off")},m(R,ae){M(R,e,ae),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),le(u,a,null),s(n,c),s(n,f),s(n,_),s(n,p),s(p,b),s(b,v),s(v,d),s(v,S),s(v,y),s(v,$),te($,t[3].g.h),s(b,N),s(b,E),s(E,B),s(E,P),s(E,L),s(E,O),le(F,O,null),qe(O,t[3].g.t,!0),s(n,x),s(n,j),s(n,z),s(n,G),s(G,V),s(V,W),s(W,U),s(W,K),s(W,H),s(W,Y),s(Y,X),s(X,re),s(X,ue),s(X,ke),s(X,me),s(X,$e),s(Y,je),s(je,Re),s(je,He),s(je,we),s(je,Te),s(Y,Le),s(Le,Me),s(Le,w),s(Y,g),s(Y,k),s(Y,A),s(Y,I),s(Y,Q),s(Y,J),s(Y,se),s(Y,ce),s(Y,ve),s(Y,Se),s(Y,oe),s(Y,pe),s(Y,Be),qe(Y,t[3].p.r,!0),s(V,_e),s(V,ye),s(ye,vt),s(ye,Hl),s(ye,tl),s(ye,ct);for(let ft=0;ft<4;ft+=1)gi[ft]&&gi[ft].m(ct,null);qe(ct,t[3].p.c,!0),s(n,Tl),s(n,pl),s(pl,Ht),s(Ht,ht),s(ht,Xe),s(ht,Ze),s(ht,Je),s(ht,Ue),te(Ue,t[3].p.f),s(Ht,xe),s(Ht,We),s(We,et),s(We,tt),s(We,de),s(We,Ce),te(Ce,t[3].p.m),s(n,Ei),s(n,_l),s(_l,_n),s(_n,Tt),Tt.checked=t[3].p.e,s(_n,Di),s(_l,Ii),gt&>.m(_l,null),s(n,Ri),s(n,dl),s(dl,Li),s(dl,Oi),s(dl,Fi),s(dl,Nt),s(Nt,Nl),s(Nt,Al),s(Nt,Pl),qe(Nt,t[3].g.s,!0),s(n,qi),kt&&kt.m(n,null),s(l,Ge),s(l,Ae),s(Ae,vl),s(Ae,Ts),s(Ae,El),le(Rt,El,null),s(Ae,Bi),s(Ae,Wl),s(Ae,Ao),s(Ae,ll),s(ll,Ui),s(ll,Po),s(ll,Ns),s(ll,Eo),s(ll,ci),s(ci,Wt),Wt.checked=t[3].m.i,s(ci,Do),s(ll,Io),s(ll,Dl),s(Dl,nl),s(nl,Il),s(Il,Ro);for(let ft=0;ft<7;ft+=1)ki[ft]&&ki[ft].m(nl,null);qe(nl,t[3].m.b,!0),s(Dl,Lo),s(Dl,pt),s(pt,Rl),s(Rl,Oo),s(pt,dn),s(pt,vn),s(pt,hn),s(pt,bn),qe(pt,t[3].m.p,!0),s(Dl,Fo),s(Dl,At),te(At,t[3].m.s),s(Ae,qo),s(Ae,zl),s(zl,Bo),s(zl,Uo),s(zl,jo),s(zl,il),s(il,gn),s(il,kn),qe(il,t[3].m.d,!0),s(Ae,Ho),s(Ae,wn),s(wn,Gl),s(Gl,Wo),s(Gl,zo),s(Gl,Go),s(Gl,yn),s(yn,zt),te(zt,t[3].m.f),s(yn,Vo),s(yn,Gi),s(wn,Ko),s(wn,Vl),s(Vl,Yo),s(Vl,Qo),s(Vl,Xo),s(Vl,Cn),s(Cn,Gt),te(Gt,t[3].m.r),s(Cn,Zo),s(Cn,Vi),s(Ae,Jo),s(Ae,As),s(Ae,xo),s(Ae,Kl),s(Kl,Ki),s(Ki,Vt),Vt.checked=t[3].m.e.e,s(Ki,er),s(Kl,tr),wt&&wt.m(Kl,null),s(Ae,lr),yt&&yt.m(Ae,null),s(Ae,Ps),s(Ae,Yi),s(Yi,Kt),Kt.checked=t[3].m.m.e,s(Yi,nr),s(Ae,ir),Ct&&Ct.m(Ae,null),s(l,sr),s(l,mt),s(mt,Qi),s(mt,or),s(mt,Mn),le(Sn,Mn,null),s(mt,rr),s(mt,mi),s(mt,ar),s(mt,Yl),s(Yl,ur),s(Yl,fr),s(Yl,cr),s(Yl,hl),te(hl,t[3].w.s),s(mt,mr),s(mt,Ql),s(Ql,pr),s(Ql,_r),s(Ql,dr),s(Ql,bl),te(bl,t[3].w.p),s(mt,vr),s(mt,$n),s($n,Xl),s(Xl,hr),s(Xl,br),s(Xl,gr),s(Xl,Lt),s(Lt,Tn),s(Lt,Nn),s(Lt,An),s(Lt,Pn),qe(Lt,t[3].w.z,!0),s($n,kr),s($n,Zl),s(Zl,wr),s(Zl,yr),s(Zl,Cr),s(Zl,En),s(En,Ot),te(Ot,t[3].w.w),s(En,Mr),s(En,Xi),s(mt,Sr),s(mt,Zi),s(Zi,Ji),s(Ji,Yt),Yt.checked=t[3].w.b,s(Ji,$r),s(l,Tr),s(l,ut),s(ut,xi),s(ut,Nr),s(ut,Dn),le(In,Dn,null),s(ut,Ar),s(ut,Jl),s(Jl,Pr),s(Jl,Er),s(Jl,Dr),s(Jl,Ll),s(Ll,sl),s(sl,Rn),s(sl,Ln),qe(sl,t[3].n.m,!0),s(Ll,Ir),s(Ll,Pt),te(Pt,t[3].n.i),s(Ll,Rr),s(Ll,Et),le(On,Et,null),qe(Et,t[3].n.s,!0),s(ut,Lr),Mt&&Mt.m(ut,null),s(ut,Es),s(ut,is),s(is,ss),s(ss,Qt),Qt.checked=t[3].n.d,s(ss,Or),s(ut,Fr),s(ut,pi),s(ut,qr),s(ut,Ol),s(Ol,Br),s(Ol,_i),s(_i,Xt),Xt.checked=t[3].n.h,s(_i,Ur),s(Ol,jr),s(Ol,Hr),s(Ol,os),s(os,gl),te(gl,t[3].n.n1),s(l,Wr),s(l,Ye),s(Ye,rs),s(Ye,zr),s(Ye,Fn),le(qn,Fn,null),s(Ye,Gr),s(Ye,di),s(Ye,Vr),s(Ye,ol),s(ol,Kr),St&&St.m(ol,null),s(ol,Ds),s(ol,Yr),s(ol,Qr),s(ol,Bn),s(Bn,kl),te(kl,t[3].q.h),s(Bn,Xr),s(Bn,Zt),te(Zt,t[3].q.p),s(Ye,Zr),lt&<.m(Ye,null),s(Ye,Is),s(Ye,xl),s(xl,Jr),s(xl,xr),s(xl,ea),s(xl,wl),te(wl,t[3].q.u),s(Ye,ta),s(Ye,en),s(en,la),s(en,na),s(en,ia),s(en,yl),te(yl,t[3].q.a),s(Ye,sa),s(Ye,Un),s(Un,jn),s(jn,oa),s(jn,ra),s(jn,aa),s(jn,Cl),te(Cl,t[3].q.c),s(Un,ua),s(Un,Hn),s(Hn,fa),s(Hn,ca),s(Hn,ma),s(Hn,bt),s(bt,Wn),s(bt,zn),s(bt,Gn),s(bt,Vn),s(bt,Kn),s(bt,Yn),qe(bt,t[3].q.m,!0),s(Ye,pa),s(Ye,tn),s(tn,_a),s(tn,da),s(tn,va),s(tn,Ml),te(Ml,t[3].q.b),s(l,ha),nt&&nt.m(l,null),s(l,Rs),it&&it.m(l,null),s(l,Ls),st&&st.m(l,null),s(l,Os),ot&&ot.m(l,null),s(l,qs),s(l,rl),s(rl,as),s(rl,ba),s(rl,Qn),le(Xn,Qn,null),s(rl,ga),s(rl,vi),s(rl,ka),s(rl,hi);for(let ft=0;ft<_t.length;ft+=1)_t[ft]&&_t[ft].m(hi,null);s(l,wa),rt&&rt.m(l,null),s(l,Bs),s(l,Dt),s(Dt,us),s(Dt,ya),s(Dt,Zn),le(Jn,Zn,null),s(Dt,Ca),s(Dt,bi),s(Dt,Ma),s(Dt,fs),s(fs,cs),s(cs,Jt),Jt.checked=t[3].d.s,s(cs,Sa),s(Dt,$a),$t&&$t.m(Dt,null),s(e,Ta),s(e,Fl),s(Fl,Us),s(Us,xn),s(Fl,Na),s(Fl,ms),s(ms,ei),s(Fl,Aa),s(Fl,ps),M(R,js,ae),le(ln,R,ae),M(R,Hs,ae),le(nn,R,ae),M(R,Ws,ae),le(sn,R,ae),M(R,zs,ae),le(on,R,ae),Ft=!0,Gs||(Pa=[ee($,"input",t[15]),ee(O,"change",t[16]),ee(Y,"change",t[17]),ee(ct,"change",t[18]),ee(Ue,"input",t[19]),ee(Ce,"input",t[20]),ee(Tt,"change",t[21]),ee(Nt,"change",t[23]),ee(Wt,"change",t[26]),ee(nl,"change",t[27]),ee(pt,"change",t[28]),ee(At,"input",t[29]),ee(il,"change",t[30]),ee(zt,"input",t[31]),ee(Gt,"input",t[32]),ee(Vt,"change",t[33]),ee(Kt,"change",t[36]),ee(hl,"input",t[41]),ee(bl,"input",t[42]),ee(Lt,"change",t[43]),ee(Ot,"input",t[44]),ee(Yt,"change",t[45]),ee(sl,"change",t[46]),ee(Pt,"input",t[47]),ee(Et,"change",t[48]),ee(Qt,"change",t[52]),ee(Xt,"change",t[53]),ee(gl,"input",t[54]),ee(kl,"input",t[56]),ee(Zt,"input",t[57]),ee(wl,"input",t[58]),ee(yl,"input",t[59]),ee(Cl,"input",t[60]),ee(bt,"change",t[61]),ee(Ml,"input",t[62]),ee(Jt,"change",t[92]),ee(xn,"click",t[8]),ee(ei,"click",t[10]),ee(e,"submit",Ss(t[9]))],Gs=!0)},p(R,ae){if(ae[0]&8&&$.value!==R[3].g.h&&te($,R[3].g.h),ae[0]&8&&qe(O,R[3].g.t),ae[0]&8&&qe(Y,R[3].p.r),ae[0]&8&&qe(ct,R[3].p.c),ae[0]&8&&he(Ue.value)!==R[3].p.f&&te(Ue,R[3].p.f),ae[0]&8&&he(Ce.value)!==R[3].p.m&&te(Ce,R[3].p.m),ae[0]&8&&(Tt.checked=R[3].p.e),R[3].p.e&&R[0].chip!="esp8266"?gt?gt.p(R,ae):(gt=uf(R),gt.c(),gt.m(_l,null)):gt&&(gt.d(1),gt=null),ae[0]&8&&qe(Nt,R[3].g.s),R[3].g.s>0?kt?kt.p(R,ae):(kt=ff(R),kt.c(),kt.m(n,null)):kt&&(kt.d(1),kt=null),ae[0]&8&&(Wt.checked=R[3].m.i),(!Ft||ae[0]&8&&ji!==(ji=R[3].m.b!=0))&&(Il.disabled=ji),ae[0]&8&&qe(nl,R[3].m.b),(!Ft||ae[0]&8&&Hi!==(Hi=R[3].m.b!=0))&&(Rl.disabled=Hi),(!Ft||ae[0]&8&&Wi!==(Wi=R[3].m.b==0))&&(pt.disabled=Wi),ae[0]&8&&qe(pt,R[3].m.p),(!Ft||ae[0]&9&&zi!==(zi=R[0].chip=="esp8266"?R[3].i.h.p==3||R[3].i.h.p==113?512:128:4096))&&r(At,"max",zi),ae[0]&8&&he(At.value)!==R[3].m.s&&te(At,R[3].m.s),ae[0]&8&&qe(il,R[3].m.d),ae[0]&8&&he(zt.value)!==R[3].m.f&&te(zt,R[3].m.f),ae[0]&8&&he(Gt.value)!==R[3].m.r&&te(Gt,R[3].m.r),ae[0]&8&&(Vt.checked=R[3].m.e.e),R[3].m.e.e?wt?wt.p(R,ae):(wt=cf(R),wt.c(),wt.m(Kl,null)):wt&&(wt.d(1),wt=null),R[3].m.e.e?yt?yt.p(R,ae):(yt=mf(R),yt.c(),yt.m(Ae,Ps)):yt&&(yt.d(1),yt=null),ae[0]&8&&(Kt.checked=R[3].m.m.e),R[3].m.m.e?Ct?Ct.p(R,ae):(Ct=pf(R),Ct.c(),Ct.m(Ae,null)):Ct&&(Ct.d(1),Ct=null),ae[0]&8&&hl.value!==R[3].w.s&&te(hl,R[3].w.s),ae[0]&8&&bl.value!==R[3].w.p&&te(bl,R[3].w.p),ae[0]&8&&qe(Lt,R[3].w.z),ae[0]&8&&he(Ot.value)!==R[3].w.w&&te(Ot,R[3].w.w),ae[0]&8&&(Yt.checked=R[3].w.b),ae[0]&8&&qe(sl,R[3].n.m),(!Ft||ae[0]&8&&es!==(es=R[3].n.m=="dhcp"))&&(Pt.disabled=es),(!Ft||ae[0]&8&&ts!==(ts=R[3].n.m=="static"))&&(Pt.required=ts),ae[0]&8&&Pt.value!==R[3].n.i&&te(Pt,R[3].n.i),(!Ft||ae[0]&8&&ls!==(ls=R[3].n.m=="dhcp"))&&(Et.disabled=ls),(!Ft||ae[0]&8&&ns!==(ns=R[3].n.m=="static"))&&(Et.required=ns),ae[0]&8&&qe(Et,R[3].n.s),R[3].n.m=="static"?Mt?Mt.p(R,ae):(Mt=_f(R),Mt.c(),Mt.m(ut,Es)):Mt&&(Mt.d(1),Mt=null),ae[0]&8&&(Qt.checked=R[3].n.d),ae[0]&8&&(Xt.checked=R[3].n.h),ae[0]&8&&gl.value!==R[3].n.n1&&te(gl,R[3].n.n1),R[0].chip!="esp8266"?St?St.p(R,ae):(St=df(R),St.c(),St.m(ol,Ds)):St&&(St.d(1),St=null),ae[0]&8&&kl.value!==R[3].q.h&&te(kl,R[3].q.h),ae[0]&8&&he(Zt.value)!==R[3].q.p&&te(Zt,R[3].q.p),R[3].q.s.e?lt?(lt.p(R,ae),ae[0]&8&&D(lt,1)):(lt=vf(R),lt.c(),D(lt,1),lt.m(Ye,Is)):lt&&(De(),q(lt,1,1,()=>{lt=null}),Ie()),ae[0]&8&&wl.value!==R[3].q.u&&te(wl,R[3].q.u),ae[0]&8&&yl.value!==R[3].q.a&&te(yl,R[3].q.a),ae[0]&8&&Cl.value!==R[3].q.c&&te(Cl,R[3].q.c),ae[0]&8&&qe(bt,R[3].q.m),ae[0]&8&&Ml.value!==R[3].q.b&&te(Ml,R[3].q.b),R[3].q.m==3?nt?(nt.p(R,ae),ae[0]&8&&D(nt,1)):(nt=hf(R),nt.c(),D(nt,1),nt.m(l,Rs)):nt&&(De(),q(nt,1,1,()=>{nt=null}),Ie()),R[3].q.m==4?it?(it.p(R,ae),ae[0]&8&&D(it,1)):(it=bf(R),it.c(),D(it,1),it.m(l,Ls)):it&&(De(),q(it,1,1,()=>{it=null}),Ie()),R[3].c.es!=null?st?(st.p(R,ae),ae[0]&8&&D(st,1)):(st=gf(R),st.c(),D(st,1),st.m(l,Os)):st&&(De(),q(st,1,1,()=>{st=null}),Ie()),ae[0]&8&&(Fs=R[3].p.r.startsWith("10YNO")||R[3].p.r.startsWith("10Y1001A1001A4")),Fs?ot?(ot.p(R,ae),ae[0]&8&&D(ot,1)):(ot=yf(R),ot.c(),D(ot,1),ot.m(l,qs)):ot&&(De(),q(ot,1,1,()=>{ot=null}),Ie()),ae[0]&136){ti=R[7];let qt;for(qt=0;qt20||R[0].chip=="esp8266"?rt?(rt.p(R,ae),ae[0]&1&&D(rt,1)):(rt=Sf(R),rt.c(),D(rt,1),rt.m(l,Bs)):rt&&(De(),q(rt,1,1,()=>{rt=null}),Ie()),ae[0]&8&&(Jt.checked=R[3].d.s),R[3].d.s?$t?$t.p(R,ae):($t=Ef(R),$t.c(),$t.m(Dt,null)):$t&&($t.d(1),$t=null);const ft={};ae[0]&2&&(ft.active=R[1]),ln.$set(ft);const Ea={};ae[0]&4&&(Ea.active=R[2]),nn.$set(Ea);const Da={};ae[0]&16&&(Da.active=R[4]),sn.$set(Da);const Ia={};ae[0]&32&&(Ia.active=R[5]),on.$set(Ia)},i(R){Ft||(D(u.$$.fragment,R),D(F.$$.fragment,R),D(Rt.$$.fragment,R),D(Sn.$$.fragment,R),D(In.$$.fragment,R),D(On.$$.fragment,R),D(qn.$$.fragment,R),D(lt),D(nt),D(it),D(st),D(ot),D(Xn.$$.fragment,R),D(rt),D(Jn.$$.fragment,R),D(ln.$$.fragment,R),D(nn.$$.fragment,R),D(sn.$$.fragment,R),D(on.$$.fragment,R),Ft=!0)},o(R){q(u.$$.fragment,R),q(F.$$.fragment,R),q(Rt.$$.fragment,R),q(Sn.$$.fragment,R),q(In.$$.fragment,R),q(On.$$.fragment,R),q(qn.$$.fragment,R),q(lt),q(nt),q(it),q(st),q(ot),q(Xn.$$.fragment,R),q(rt),q(Jn.$$.fragment,R),q(ln.$$.fragment,R),q(nn.$$.fragment,R),q(sn.$$.fragment,R),q(on.$$.fragment,R),Ft=!1},d(R){R&&C(e),ne(u),ne(F),cl(gi,R),gt&>.d(),kt&&kt.d(),ne(Rt),cl(ki,R),wt&&wt.d(),yt&&yt.d(),Ct&&Ct.d(),ne(Sn),ne(In),ne(On),Mt&&Mt.d(),ne(qn),St&&St.d(),lt&<.d(),nt&&nt.d(),it&&it.d(),st&&st.d(),ot&&ot.d(),ne(Xn),cl(_t,R),rt&&rt.d(),ne(Jn),$t&&$t.d(),R&&C(js),ne(ln,R),R&&C(Hs),ne(nn,R),R&&C(Ws),ne(sn,R),R&&C(zs),ne(on,R),Gs=!1,ze(Pa)}}}async function yp(){await(await fetch("/reboot",{method:"POST"})).json()}function Cp(t,e,l){let{sysinfo:n={}}=e,i=[{name:"Import gauge",key:"i"},{name:"Export gauge",key:"e"},{name:"Voltage",key:"v"},{name:"Amperage",key:"a"},{name:"Reactive",key:"r"},{name:"Realtime",key:"c"},{name:"Peaks",key:"t"},{name:"Price",key:"p"},{name:"Day plot",key:"d"},{name:"Month plot",key:"m"},{name:"Temperature plot",key:"s"}],o=!0,a=!1,u={g:{t:"",h:"",s:0,u:"",p:""},m:{b:2400,p:11,i:!1,d:0,f:0,r:0,e:{e:!1,k:"",a:""},m:{e:!1,w:!1,v:!1,a:!1,c:!1}},w:{s:"",p:"",w:0,z:255,a:!0,b:!0},n:{m:"",i:"",s:"",g:"",d1:"",d2:"",d:!1,n1:"",n2:"",h:!1},q:{h:"",p:1883,u:"",a:"",b:"",s:{e:!1,c:!1,r:!0,k:!1}},o:{e:"",c:"",u1:"",u2:"",u3:""},t:{t:[0,0,0,0,0,0,0,0,0,0],h:1},p:{e:!1,t:"",r:"",c:"",m:1,f:null},d:{s:!1,t:!1,l:5},u:{i:0,e:0,v:0,a:0,r:0,c:0,t:0,p:0,d:0,m:0,s:0},i:{h:{p:null,u:!0},a:null,l:{p:null,i:!1},r:{r:null,g:null,b:null,i:!1},t:{d:null,a:null},v:{p:null,d:{v:null,g:null},o:null,m:null,b:null}},h:{t:"",h:"",n:""},c:{es:null}};Ci.subscribe(Ge=>{Ge.version&&(l(3,u=Ge),l(1,o=!1))}),Hm();let c=!1,f=!1;async function _(){if(confirm("Are you sure you want to factory reset the device?")){l(4,c=!0);const Ge=new URLSearchParams;Ge.append("perform","true");let vl=await(await fetch("/reset",{method:"POST",body:Ge})).json();l(4,c=!1),l(5,f=vl.success)}}async function p(Ge){l(2,a=!0);const Ae=new FormData(Ge.target),vl=new URLSearchParams;for(let Rt of Ae){const[Bi,Wl]=Rt;vl.append(Bi,Wl)}let El=await(await fetch("/save",{method:"POST",body:vl})).json();jt.update(Rt=>(Rt.booting=El.reboot,Rt.ui=u.u,Rt)),l(2,a=!1),oi("/")}const b=function(){confirm("Are you sure you want to reboot the device?")&&(jt.update(Ge=>(Ge.booting=!0,Ge)),yp())};async function v(){confirm("Are you sure you want to delete CA?")&&(await(await fetch("/mqtt-ca",{method:"POST"})).text(),Ci.update(Ae=>(Ae.q.s.c=!1,Ae)))}async function d(){confirm("Are you sure you want to delete cert?")&&(await(await fetch("/mqtt-cert",{method:"POST"})).text(),Ci.update(Ae=>(Ae.q.s.r=!1,Ae)))}async function S(){confirm("Are you sure you want to delete key?")&&(await(await fetch("/mqtt-key",{method:"POST"})).text(),Ci.update(Ae=>(Ae.q.s.k=!1,Ae)))}const y=function(){u.q.s.e?u.q.p==1883&&l(3,u.q.p=8883,u):u.q.p==8883&&l(3,u.q.p=1883,u)};let $=44;function N(){u.g.h=this.value,l(3,u)}function E(){u.g.t=dt(this),l(3,u)}function B(){u.p.r=dt(this),l(3,u)}function P(){u.p.c=dt(this),l(3,u)}function L(){u.p.f=he(this.value),l(3,u)}function O(){u.p.m=he(this.value),l(3,u)}function F(){u.p.e=this.checked,l(3,u)}function x(){u.p.t=this.value,l(3,u)}function j(){u.g.s=dt(this),l(3,u)}function z(){u.g.u=this.value,l(3,u)}function G(){u.g.p=this.value,l(3,u)}function V(){u.m.i=this.checked,l(3,u)}function W(){u.m.b=dt(this),l(3,u)}function U(){u.m.p=dt(this),l(3,u)}function K(){u.m.s=he(this.value),l(3,u)}function H(){u.m.d=dt(this),l(3,u)}function Y(){u.m.f=he(this.value),l(3,u)}function X(){u.m.r=he(this.value),l(3,u)}function re(){u.m.e.e=this.checked,l(3,u)}function ue(){u.m.e.k=this.value,l(3,u)}function ke(){u.m.e.a=this.value,l(3,u)}function me(){u.m.m.e=this.checked,l(3,u)}function $e(){u.m.m.w=he(this.value),l(3,u)}function je(){u.m.m.v=he(this.value),l(3,u)}function Re(){u.m.m.a=he(this.value),l(3,u)}function He(){u.m.m.c=he(this.value),l(3,u)}function we(){u.w.s=this.value,l(3,u)}function Te(){u.w.p=this.value,l(3,u)}function Le(){u.w.z=dt(this),l(3,u)}function Me(){u.w.w=he(this.value),l(3,u)}function w(){u.w.b=this.checked,l(3,u)}function g(){u.n.m=dt(this),l(3,u)}function k(){u.n.i=this.value,l(3,u)}function A(){u.n.s=dt(this),l(3,u)}function I(){u.n.g=this.value,l(3,u)}function Q(){u.n.d1=this.value,l(3,u)}function J(){u.n.d2=this.value,l(3,u)}function se(){u.n.d=this.checked,l(3,u)}function ce(){u.n.h=this.checked,l(3,u)}function ve(){u.n.n1=this.value,l(3,u)}function Se(){u.q.s.e=this.checked,l(3,u)}function oe(){u.q.h=this.value,l(3,u)}function pe(){u.q.p=he(this.value),l(3,u)}function Be(){u.q.u=this.value,l(3,u)}function _e(){u.q.a=this.value,l(3,u)}function ye(){u.q.c=this.value,l(3,u)}function vt(){u.q.m=dt(this),l(3,u)}function Hl(){u.q.b=this.value,l(3,u)}function tl(){u.o.e=this.value,l(3,u)}function ct(){u.o.c=this.value,l(3,u)}function Tl(){u.o.u1=this.value,l(3,u)}function pl(){u.o.u2=this.value,l(3,u)}function Ht(){u.o.u3=this.value,l(3,u)}function ht(){u.h.t=this.value,l(3,u)}function Xe(){u.h.h=this.value,l(3,u)}function Ze(){u.h.n=this.value,l(3,u)}function Je(){u.c.es=this.checked,l(3,u)}function Ue(Ge){u.t.t[Ge]=he(this.value),l(3,u)}function xe(){u.t.h=he(this.value),l(3,u)}function We(Ge){u.u[Ge.key]=dt(this),l(3,u)}function et(){u.i.h.u=this.checked,l(3,u)}function tt(){u.i.h.p=dt(this),l(3,u)}function de(){u.i.a=he(this.value),l(3,u)}function Ce(){u.i.l.i=this.checked,l(3,u)}function Ei(){u.i.l.p=he(this.value),l(3,u)}function _l(){u.i.r.i=this.checked,l(3,u)}function _n(){u.i.r.r=he(this.value),l(3,u)}function Tt(){u.i.r.g=he(this.value),l(3,u)}function Di(){u.i.r.b=he(this.value),l(3,u)}function Ii(){u.i.t.d=he(this.value),l(3,u)}function Ri(){u.i.t.a=he(this.value),l(3,u)}function dl(){u.i.v.p=he(this.value),l(3,u)}function Li(){u.i.v.d.v=he(this.value),l(3,u)}function Oi(){u.i.v.d.g=he(this.value),l(3,u)}function Fi(){u.i.v.o=he(this.value),l(3,u)}function Nt(){u.i.v.m=he(this.value),l(3,u)}function Nl(){u.i.v.b=he(this.value),l(3,u)}function Al(){u.d.s=this.checked,l(3,u)}function Pl(){u.d.t=this.checked,l(3,u)}function qi(){u.d.l=dt(this),l(3,u)}return t.$$set=Ge=>{"sysinfo"in Ge&&l(0,n=Ge.sysinfo)},t.$$.update=()=>{t.$$.dirty[0]&1&&l(6,$=n.chip=="esp8266"?16:n.chip=="esp32s2"?44:39)},[n,o,a,u,c,f,$,i,_,p,b,v,d,S,y,N,E,B,P,L,O,F,x,j,z,G,V,W,U,K,H,Y,X,re,ue,ke,me,$e,je,Re,He,we,Te,Le,Me,w,g,k,A,I,Q,J,se,ce,ve,Se,oe,pe,Be,_e,ye,vt,Hl,tl,ct,Tl,pl,Ht,ht,Xe,Ze,Je,Ue,xe,We,et,tt,de,Ce,Ei,_l,_n,Tt,Di,Ii,Ri,dl,Li,Oi,Fi,Nt,Nl,Al,Pl,qi]}class Mp extends Ee{constructor(e){super(),Pe(this,e,Cp,wp,Ne,{sysinfo:0},null,[-1,-1,-1,-1])}}function If(t,e,l){const n=t.slice();return n[20]=e[l],n}function Sp(t){let e=be(t[1].chip,t[1].board)+"",l;return{c(){l=T(e)},m(n,i){M(n,l,i)},p(n,i){i&2&&e!==(e=be(n[1].chip,n[1].board)+"")&&Z(l,e)},d(n){n&&C(l)}}}function Rf(t){let e,l,n=t[1].apmac+"",i,o,a,u,c,f,_,p,b,v=Ja(t[1])+"",d,S,y=t[1].boot_reason+"",$,N,E=t[1].ex_cause+"",B,P,L;const O=[Tp,$p],F=[];function x(j,z){return j[0].u>0?0:1}return c=x(t),f=F[c]=O[c](t),{c(){e=m("div"),l=T("AP MAC: "),i=T(n),o=h(),a=m("div"),u=T(`Last boot: + `),f.c(),_=h(),p=m("div"),b=T("Reason: "),d=T(v),S=T(" ("),$=T(y),N=T("/"),B=T(E),P=T(")"),r(e,"class","my-2"),r(a,"class","my-2"),r(p,"class","my-2")},m(j,z){M(j,e,z),s(e,l),s(e,i),M(j,o,z),M(j,a,z),s(a,u),F[c].m(a,null),M(j,_,z),M(j,p,z),s(p,b),s(p,d),s(p,S),s(p,$),s(p,N),s(p,B),s(p,P),L=!0},p(j,z){(!L||z&2)&&n!==(n=j[1].apmac+"")&&Z(i,n);let G=c;c=x(j),c===G?F[c].p(j,z):(De(),q(F[G],1,1,()=>{F[G]=null}),Ie(),f=F[c],f?f.p(j,z):(f=F[c]=O[c](j),f.c()),D(f,1),f.m(a,null)),(!L||z&2)&&v!==(v=Ja(j[1])+"")&&Z(d,v),(!L||z&2)&&y!==(y=j[1].boot_reason+"")&&Z($,y),(!L||z&2)&&E!==(E=j[1].ex_cause+"")&&Z(B,E)},i(j){L||(D(f),L=!0)},o(j){q(f),L=!1},d(j){j&&C(e),j&&C(o),j&&C(a),F[c].d(),j&&C(_),j&&C(p)}}}function $p(t){let e;return{c(){e=T("-")},m(l,n){M(l,e,n)},p:fe,i:fe,o:fe,d(l){l&&C(e)}}}function Tp(t){let e,l;return e=new Kc({props:{timestamp:new Date(new Date().getTime()-t[0].u*1e3),fullTimeColor:""}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.timestamp=new Date(new Date().getTime()-n[0].u*1e3)),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function Np(t){let e;return{c(){e=m("span"),e.textContent="Update consents",r(e,"class","btn-pri-sm")},m(l,n){M(l,e,n)},p:fe,d(l){l&&C(e)}}}function Lf(t){let e,l,n,i,o,a=Cs(t[1].meter.mfg)+"",u,c,f,_,p=(t[1].meter.model?t[1].meter.model:"unknown")+"",b,v,d,S,y=(t[1].meter.id?t[1].meter.id:"unknown")+"",$;return{c(){e=m("div"),l=m("strong"),l.textContent="Meter",n=h(),i=m("div"),o=T("Manufacturer: "),u=T(a),c=h(),f=m("div"),_=T("Model: "),b=T(p),v=h(),d=m("div"),S=T("ID: "),$=T(y),r(l,"class","text-sm"),r(i,"class","my-2"),r(f,"class","my-2"),r(d,"class","my-2"),r(e,"class","cnt")},m(N,E){M(N,e,E),s(e,l),s(e,n),s(e,i),s(i,o),s(i,u),s(e,c),s(e,f),s(f,_),s(f,b),s(e,v),s(e,d),s(d,S),s(d,$)},p(N,E){E&2&&a!==(a=Cs(N[1].meter.mfg)+"")&&Z(u,a),E&2&&p!==(p=(N[1].meter.model?N[1].meter.model:"unknown")+"")&&Z(b,p),E&2&&y!==(y=(N[1].meter.id?N[1].meter.id:"unknown")+"")&&Z($,y)},d(N){N&&C(e)}}}function Of(t){let e,l,n,i,o,a=t[1].net.ip+"",u,c,f,_,p=t[1].net.mask+"",b,v,d,S,y=t[1].net.gw+"",$,N,E,B,P=t[1].net.dns1+"",L,O,F=t[1].net.dns2&&Ff(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Network",n=h(),i=m("div"),o=T("IP: "),u=T(a),c=h(),f=m("div"),_=T("Mask: "),b=T(p),v=h(),d=m("div"),S=T("Gateway: "),$=T(y),N=h(),E=m("div"),B=T("DNS: "),L=T(P),O=h(),F&&F.c(),r(l,"class","text-sm"),r(i,"class","my-2"),r(f,"class","my-2"),r(d,"class","my-2"),r(E,"class","my-2"),r(e,"class","cnt")},m(x,j){M(x,e,j),s(e,l),s(e,n),s(e,i),s(i,o),s(i,u),s(e,c),s(e,f),s(f,_),s(f,b),s(e,v),s(e,d),s(d,S),s(d,$),s(e,N),s(e,E),s(E,B),s(E,L),s(E,O),F&&F.m(E,null)},p(x,j){j&2&&a!==(a=x[1].net.ip+"")&&Z(u,a),j&2&&p!==(p=x[1].net.mask+"")&&Z(b,p),j&2&&y!==(y=x[1].net.gw+"")&&Z($,y),j&2&&P!==(P=x[1].net.dns1+"")&&Z(L,P),x[1].net.dns2?F?F.p(x,j):(F=Ff(x),F.c(),F.m(E,null)):F&&(F.d(1),F=null)},d(x){x&&C(e),F&&F.d()}}}function Ff(t){let e,l=t[1].net.dns2+"",n;return{c(){e=T("/ "),n=T(l)},m(i,o){M(i,e,o),M(i,n,o)},p(i,o){o&2&&l!==(l=i[1].net.dns2+"")&&Z(n,l)},d(i){i&&C(e),i&&C(n)}}}function qf(t){let e,l,n,i=t[1].upgrade.f+"",o,a,u=t[1].upgrade.t+"",c,f,_=Za(t[1].upgrade.e)+"",p;return{c(){e=m("div"),l=m("div"),n=T("Previous upgrade attempt from "),o=T(i),a=T(" to "),c=T(u),f=T(" failed. "),p=T(_),r(l,"class","bd-yellow"),r(e,"class","my-2")},m(b,v){M(b,e,v),s(e,l),s(l,n),s(l,o),s(l,a),s(l,c),s(l,f),s(l,p)},p(b,v){v&2&&i!==(i=b[1].upgrade.f+"")&&Z(o,i),v&2&&u!==(u=b[1].upgrade.t+"")&&Z(c,u),v&2&&_!==(_=Za(b[1].upgrade.e)+"")&&Z(p,_)},d(b){b&&C(e)}}}function Bf(t){let e,l,n,i=t[2].tag_name+"",o,a,u,c,f,_,p=(t[1].security==0||t[0].a)&&t[1].fwconsent===1&&t[2]&&t[2].tag_name!=t[1].version&&Uf(t),b=t[1].fwconsent===2&&jf();return{c(){e=m("div"),l=T(`Latest version: + `),n=m("a"),o=T(i),u=h(),p&&p.c(),c=h(),b&&b.c(),f=Ve(),r(n,"href",a=t[2].html_url),r(n,"class","ml-2 text-blue-600 hover:text-blue-800"),r(n,"target","_blank"),r(n,"rel","noreferrer"),r(e,"class","my-2 flex")},m(v,d){M(v,e,d),s(e,l),s(e,n),s(n,o),s(e,u),p&&p.m(e,null),M(v,c,d),b&&b.m(v,d),M(v,f,d),_=!0},p(v,d){(!_||d&4)&&i!==(i=v[2].tag_name+"")&&Z(o,i),(!_||d&4&&a!==(a=v[2].html_url))&&r(n,"href",a),(v[1].security==0||v[0].a)&&v[1].fwconsent===1&&v[2]&&v[2].tag_name!=v[1].version?p?(p.p(v,d),d&7&&D(p,1)):(p=Uf(v),p.c(),D(p,1),p.m(e,null)):p&&(De(),q(p,1,1,()=>{p=null}),Ie()),v[1].fwconsent===2?b||(b=jf(),b.c(),b.m(f.parentNode,f)):b&&(b.d(1),b=null)},i(v){_||(D(p),_=!0)},o(v){q(p),_=!1},d(v){v&&C(e),p&&p.d(),v&&C(c),b&&b.d(v),v&&C(f)}}}function Uf(t){let e,l,n,i,o,a;return n=new Yc({}),{c(){e=m("div"),l=m("button"),ie(n.$$.fragment),r(e,"class","flex-none ml-2 text-green-500"),r(e,"title","Install this version")},m(u,c){M(u,e,c),s(e,l),le(n,l,null),i=!0,o||(a=ee(l,"click",t[10]),o=!0)},p:fe,i(u){i||(D(n.$$.fragment,u),i=!0)},o(u){q(n.$$.fragment,u),i=!1},d(u){u&&C(e),ne(n),o=!1,a()}}}function jf(t){let e;return{c(){e=m("div"),e.innerHTML='
You have disabled one-click firmware upgrade, link to self-upgrade is disabled
',r(e,"class","my-2")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function Hf(t){let e,l=Ms(be(t[1].chip,t[1].board))+"",n;return{c(){e=m("div"),n=T(l),r(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&2&&l!==(l=Ms(be(i[1].chip,i[1].board))+"")&&Z(n,l)},d(i){i&&C(e)}}}function Wf(t){let e,l,n,i,o,a;function u(_,p){return _[4].length==0?Pp:Ap}let c=u(t),f=c(t);return{c(){e=m("div"),l=m("form"),n=m("input"),i=h(),f.c(),ic(n,"display","none"),r(n,"name","file"),r(n,"type","file"),r(n,"accept",".bin"),r(l,"action","/firmware"),r(l,"enctype","multipart/form-data"),r(l,"method","post"),r(l,"autocomplete","off"),r(e,"class","my-2 flex")},m(_,p){M(_,e,p),s(e,l),s(l,n),t[12](n),s(l,i),f.m(l,null),o||(a=[ee(n,"change",t[13]),ee(l,"submit",t[15])],o=!0)},p(_,p){c===(c=u(_))&&f?f.p(_,p):(f.d(1),f=c(_),f&&(f.c(),f.m(l,null)))},d(_){_&&C(e),t[12](null),f.d(),o=!1,ze(a)}}}function Ap(t){let e=t[4][0].name+"",l,n,i;return{c(){l=T(e),n=h(),i=m("button"),i.textContent="Upload",r(i,"type","submit"),r(i,"class","btn-pri-sm float-right")},m(o,a){M(o,l,a),M(o,n,a),M(o,i,a)},p(o,a){a&16&&e!==(e=o[4][0].name+"")&&Z(l,e)},d(o){o&&C(l),o&&C(n),o&&C(i)}}}function Pp(t){let e,l,n;return{c(){e=m("button"),e.textContent="Select firmware file for upgrade",r(e,"type","button"),r(e,"class","btn-pri-sm float-right")},m(i,o){M(i,e,o),l||(n=ee(e,"click",t[14]),l=!0)},p:fe,d(i){i&&C(e),l=!1,n()}}}function zf(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S=t[9],y=[];for(let P=0;P Include Secrets
(SSID, PSK, passwords and tokens)',c=h(),$&&$.c(),f=h(),_=m("form"),p=m("input"),b=h(),B.c(),r(l,"class","text-sm"),r(u,"class","my-1 mx-3 col-span-2"),r(o,"class","grid grid-cols-2"),r(i,"method","get"),r(i,"action","/configfile.cfg"),r(i,"autocomplete","off"),ic(p,"display","none"),r(p,"name","file"),r(p,"type","file"),r(p,"accept",".cfg"),r(_,"action","/configfile"),r(_,"enctype","multipart/form-data"),r(_,"method","post"),r(_,"autocomplete","off"),r(e,"class","cnt")},m(P,L){M(P,e,L),s(e,l),s(e,n),s(e,i),s(i,o);for(let O=0;O{A=null}),Ie());const _e={};pe&8388608&&(_e.$$scope={dirty:pe,ctx:oe}),x.$set(_e),oe[1].meter?I?I.p(oe,pe):(I=Lf(oe),I.c(),I.m(e,V)):I&&(I.d(1),I=null),oe[1].net?Q?Q.p(oe,pe):(Q=Of(oe),Q.c(),Q.m(e,W)):Q&&(Q.d(1),Q=null),(!w||pe&2)&&re!==(re=oe[1].version+"")&&Z(ue,re),oe[1].upgrade.t&&oe[1].upgrade.t!=oe[1].version?J?J.p(oe,pe):(J=qf(oe),J.c(),J.m(U,me)):J&&(J.d(1),J=null),oe[2]?se?(se.p(oe,pe),pe&4&&D(se,1)):(se=Bf(oe),se.c(),D(se,1),se.m(U,$e)):se&&(De(),q(se,1,1,()=>{se=null}),Ie()),pe&3&&(je=(oe[1].security==0||oe[0].a)&&ri(oe[1].board)),je?ce?ce.p(oe,pe):(ce=Hf(oe),ce.c(),ce.m(U,Re)):ce&&(ce.d(1),ce=null),oe[1].security==0||oe[0].a?ve?ve.p(oe,pe):(ve=Wf(oe),ve.c(),ve.m(U,null)):ve&&(ve.d(1),ve=null),oe[1].security==0||oe[0].a?Se?Se.p(oe,pe):(Se=zf(oe),Se.c(),Se.m(e,null)):Se&&(Se.d(1),Se=null);const ye={};pe&32&&(ye.active=oe[5]),Te.$set(ye);const vt={};pe&256&&(vt.active=oe[8]),Me.$set(vt)},i(oe){w||(D(y.$$.fragment,oe),D(A),D(x.$$.fragment,oe),D(se),D(Te.$$.fragment,oe),D(Me.$$.fragment,oe),w=!0)},o(oe){q(y.$$.fragment,oe),q(A),q(x.$$.fragment,oe),q(se),q(Te.$$.fragment,oe),q(Me.$$.fragment,oe),w=!1},d(oe){oe&&C(e),ne(y),A&&A.d(),ne(x),I&&I.d(),Q&&Q.d(),J&&J.d(),se&&se.d(),ce&&ce.d(),ve&&ve.d(),Se&&Se.d(),oe&&C(we),ne(Te,oe),oe&&C(Le),ne(Me,oe),g=!1,k()}}}async function Rp(){await(await fetch("/reboot",{method:"POST"})).json()}function Lp(t,e,l){let{data:n}=e,{sysinfo:i}=e,o=[{name:"WiFi",key:"iw"},{name:"MQTT",key:"im"},{name:"Web",key:"ie"},{name:"Meter",key:"it"},{name:"Thresholds",key:"ih"},{name:"GPIO",key:"ig"},{name:"NTP",key:"in"},{name:"Price API",key:"is"}],a={};$o.subscribe(O=>{l(2,a=Vc(i.version,O)),a||l(2,a=O[0])});function u(){confirm("Do you want to upgrade this device to "+a.tag_name+"?")&&(i.board!=2&&i.board!=4&&i.board!=7||confirm(Ms(be(i.chip,i.board))))&&(jt.update(O=>(O.upgrading=!0,O)),Gc(a.tag_name))}const c=function(){confirm("Are you sure you want to reboot the device?")&&(jt.update(O=>(O.booting=!0,O)),Rp())};let f,_=[],p=!1,b,v=[],d=!1;yo();function S(O){ws[O?"unshift":"push"](()=>{f=O,l(3,f)})}function y(){_=this.files,l(4,_)}const $=()=>{f.click()},N=()=>l(5,p=!0);function E(O){ws[O?"unshift":"push"](()=>{b=O,l(6,b)})}function B(){v=this.files,l(7,v)}const P=()=>{b.click()},L=()=>l(8,d=!0);return t.$$set=O=>{"data"in O&&l(0,n=O.data),"sysinfo"in O&&l(1,i=O.sysinfo)},[n,i,a,f,_,p,b,v,d,o,u,c,S,y,$,N,E,B,P,L]}class Op extends Ee{constructor(e){super(),Pe(this,e,Lp,Ip,Ne,{data:0,sysinfo:1})}}function Kf(t){let e,l,n=be(t[0],7)+"",i,o,a=be(t[0],5)+"",u,c,f=be(t[0],4)+"",_,p,b=be(t[0],3)+"",v,d,S,y,$=be(t[0],2)+"",N,E,B=be(t[0],1)+"",P,L,O=be(t[0],0)+"",F,x,j,z,G=be(t[0],101)+"",V,W,U=be(t[0],100)+"",K;return{c(){e=m("optgroup"),l=m("option"),i=T(n),o=m("option"),u=T(a),c=m("option"),_=T(f),p=m("option"),v=T(b),d=h(),S=m("optgroup"),y=m("option"),N=T($),E=m("option"),P=T(B),L=m("option"),F=T(O),x=h(),j=m("optgroup"),z=m("option"),V=T(G),W=m("option"),K=T(U),l.__value=7,l.value=l.__value,o.__value=5,o.value=o.__value,c.__value=4,c.value=c.__value,p.__value=3,p.value=p.__value,r(e,"label","amsleser.no"),y.__value=2,y.value=y.__value,E.__value=1,E.value=E.__value,L.__value=0,L.value=L.__value,r(S,"label","Custom hardware"),z.__value=101,z.value=z.__value,W.__value=100,W.value=W.__value,r(j,"label","Generic hardware")},m(H,Y){M(H,e,Y),s(e,l),s(l,i),s(e,o),s(o,u),s(e,c),s(c,_),s(e,p),s(p,v),M(H,d,Y),M(H,S,Y),s(S,y),s(y,N),s(S,E),s(E,P),s(S,L),s(L,F),M(H,x,Y),M(H,j,Y),s(j,z),s(z,V),s(j,W),s(W,K)},p(H,Y){Y&1&&n!==(n=be(H[0],7)+"")&&Z(i,n),Y&1&&a!==(a=be(H[0],5)+"")&&Z(u,a),Y&1&&f!==(f=be(H[0],4)+"")&&Z(_,f),Y&1&&b!==(b=be(H[0],3)+"")&&Z(v,b),Y&1&&$!==($=be(H[0],2)+"")&&Z(N,$),Y&1&&B!==(B=be(H[0],1)+"")&&Z(P,B),Y&1&&O!==(O=be(H[0],0)+"")&&Z(F,O),Y&1&&G!==(G=be(H[0],101)+"")&&Z(V,G),Y&1&&U!==(U=be(H[0],100)+"")&&Z(K,U)},d(H){H&&C(e),H&&C(d),H&&C(S),H&&C(x),H&&C(j)}}}function Yf(t){let e,l,n=be(t[0],201)+"",i,o,a=be(t[0],202)+"",u,c,f=be(t[0],203)+"",_,p,b=be(t[0],200)+"",v;return{c(){e=m("optgroup"),l=m("option"),i=T(n),o=m("option"),u=T(a),c=m("option"),_=T(f),p=m("option"),v=T(b),l.__value=201,l.value=l.__value,o.__value=202,o.value=o.__value,c.__value=203,c.value=c.__value,p.__value=200,p.value=p.__value,r(e,"label","Generic hardware")},m(d,S){M(d,e,S),s(e,l),s(l,i),s(e,o),s(o,u),s(e,c),s(c,_),s(e,p),s(p,v)},p(d,S){S&1&&n!==(n=be(d[0],201)+"")&&Z(i,n),S&1&&a!==(a=be(d[0],202)+"")&&Z(u,a),S&1&&f!==(f=be(d[0],203)+"")&&Z(_,f),S&1&&b!==(b=be(d[0],200)+"")&&Z(v,b)},d(d){d&&C(e)}}}function Qf(t){let e,l,n=be(t[0],7)+"",i,o,a=be(t[0],6)+"",u,c,f=be(t[0],5)+"",_,p,b,v,d=be(t[0],51)+"",S,y,$=be(t[0],50)+"",N;return{c(){e=m("optgroup"),l=m("option"),i=T(n),o=m("option"),u=T(a),c=m("option"),_=T(f),p=h(),b=m("optgroup"),v=m("option"),S=T(d),y=m("option"),N=T($),l.__value=7,l.value=l.__value,o.__value=6,o.value=o.__value,c.__value=5,c.value=c.__value,r(e,"label","amsleser.no"),v.__value=51,v.value=v.__value,y.__value=50,y.value=y.__value,r(b,"label","Generic hardware")},m(E,B){M(E,e,B),s(e,l),s(l,i),s(e,o),s(o,u),s(e,c),s(c,_),M(E,p,B),M(E,b,B),s(b,v),s(v,S),s(b,y),s(y,N)},p(E,B){B&1&&n!==(n=be(E[0],7)+"")&&Z(i,n),B&1&&a!==(a=be(E[0],6)+"")&&Z(u,a),B&1&&f!==(f=be(E[0],5)+"")&&Z(_,f),B&1&&d!==(d=be(E[0],51)+"")&&Z(S,d),B&1&&$!==($=be(E[0],50)+"")&&Z(N,$)},d(E){E&&C(e),E&&C(p),E&&C(b)}}}function Xf(t){let e,l,n=be(t[0],8)+"",i,o,a,u,c=be(t[0],71)+"",f,_,p=be(t[0],70)+"",b;return{c(){e=m("optgroup"),l=m("option"),i=T(n),o=h(),a=m("optgroup"),u=m("option"),f=T(c),_=m("option"),b=T(p),l.__value=8,l.value=l.__value,r(e,"label","Custom hardware"),u.__value=71,u.value=u.__value,_.__value=70,_.value=_.__value,r(a,"label","Generic hardware")},m(v,d){M(v,e,d),s(e,l),s(l,i),M(v,o,d),M(v,a,d),s(a,u),s(u,f),s(a,_),s(_,b)},p(v,d){d&1&&n!==(n=be(v[0],8)+"")&&Z(i,n),d&1&&c!==(c=be(v[0],71)+"")&&Z(f,c),d&1&&p!==(p=be(v[0],70)+"")&&Z(b,p)},d(v){v&&C(e),v&&C(o),v&&C(a)}}}function Zf(t){let e,l,n=be(t[0],200)+"",i;return{c(){e=m("optgroup"),l=m("option"),i=T(n),l.__value=200,l.value=l.__value,r(e,"label","Generic hardware")},m(o,a){M(o,e,a),s(e,l),s(l,i)},p(o,a){a&1&&n!==(n=be(o[0],200)+"")&&Z(i,n)},d(o){o&&C(e)}}}function Fp(t){let e,l,n,i,o,a,u,c=t[0]=="esp8266"&&Kf(t),f=t[0]=="esp32"&&Yf(t),_=t[0]=="esp32s2"&&Qf(t),p=t[0]=="esp32c3"&&Xf(t),b=t[0]=="esp32solo"&&Zf(t);return{c(){e=m("option"),l=h(),c&&c.c(),n=h(),f&&f.c(),i=h(),_&&_.c(),o=h(),p&&p.c(),a=h(),b&&b.c(),u=Ve(),e.__value=-1,e.value=e.__value},m(v,d){M(v,e,d),M(v,l,d),c&&c.m(v,d),M(v,n,d),f&&f.m(v,d),M(v,i,d),_&&_.m(v,d),M(v,o,d),p&&p.m(v,d),M(v,a,d),b&&b.m(v,d),M(v,u,d)},p(v,[d]){v[0]=="esp8266"?c?c.p(v,d):(c=Kf(v),c.c(),c.m(n.parentNode,n)):c&&(c.d(1),c=null),v[0]=="esp32"?f?f.p(v,d):(f=Yf(v),f.c(),f.m(i.parentNode,i)):f&&(f.d(1),f=null),v[0]=="esp32s2"?_?_.p(v,d):(_=Qf(v),_.c(),_.m(o.parentNode,o)):_&&(_.d(1),_=null),v[0]=="esp32c3"?p?p.p(v,d):(p=Xf(v),p.c(),p.m(a.parentNode,a)):p&&(p.d(1),p=null),v[0]=="esp32solo"?b?b.p(v,d):(b=Zf(v),b.c(),b.m(u.parentNode,u)):b&&(b.d(1),b=null)},i:fe,o:fe,d(v){v&&C(e),v&&C(l),c&&c.d(v),v&&C(n),f&&f.d(v),v&&C(i),_&&_.d(v),v&&C(o),p&&p.d(v),v&&C(a),b&&b.d(v),v&&C(u)}}}function qp(t,e,l){let{chip:n}=e;return t.$$set=i=>{"chip"in i&&l(0,n=i.chip)},[n]}class Bp extends Ee{constructor(e){super(),Pe(this,e,qp,Fp,Ne,{chip:0})}}function Jf(t){let e;return{c(){e=m("div"),e.textContent="WARNING: Changing this configuration will affect basic configuration of your device. Only make changes here if instructed by vendor",r(e,"class","bd-red")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function xf(t){let e,l,n,i,o,a,u;return a=new Xc({props:{chip:t[0].chip}}),{c(){e=m("div"),l=T("HAN GPIO"),n=m("br"),i=h(),o=m("select"),ie(a.$$.fragment),r(o,"name","vh"),r(o,"class","in-s"),r(e,"class","my-3")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),le(a,o,null),u=!0},p(c,f){const _={};f&1&&(_.chip=c[0].chip),a.$set(_)},i(c){u||(D(a.$$.fragment,c),u=!0)},o(c){q(a.$$.fragment,c),u=!1},d(c){c&&C(e),ne(a)}}}function Up(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,y,$,N,E,B,P,L,O,F,x,j,z,G,V,W=t[0].usrcfg&&Jf();d=new Bp({props:{chip:t[0].chip}});let U=t[0].board&&t[0].board>20&&xf(t);return j=new It({props:{active:t[1],message:"Saving device configuration"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),o=h(),a=m("strong"),a.textContent="Initial configuration",u=h(),W&&W.c(),c=h(),f=m("div"),_=T("Board type"),p=m("br"),b=h(),v=m("select"),ie(d.$$.fragment),S=h(),U&&U.c(),y=h(),$=m("div"),N=m("label"),E=m("input"),B=T(" Clear all other configuration"),P=h(),L=m("div"),L.innerHTML='',O=h(),F=m("span"),F.textContent="\xA0",x=h(),ie(j.$$.fragment),r(i,"type","hidden"),r(i,"name","v"),i.value="true",r(a,"class","text-sm"),r(v,"name","vb"),r(v,"class","in-s"),t[0].board===void 0&&Qe(()=>t[4].call(v)),r(f,"class","my-3"),r(E,"type","checkbox"),r(E,"name","vr"),E.__value="true",E.value=E.__value,r(E,"class","rounded mb-1"),r($,"class","my-3"),r(L,"class","my-3"),r(F,"class","clear-both"),r(n,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(K,H){M(K,e,H),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),s(n,u),W&&W.m(n,null),s(n,c),s(n,f),s(f,_),s(f,p),s(f,b),s(f,v),le(d,v,null),qe(v,t[0].board,!0),s(n,S),U&&U.m(n,null),s(n,y),s(n,$),s($,N),s(N,E),E.checked=t[2],s(N,B),s(n,P),s(n,L),s(n,O),s(n,F),M(K,x,H),le(j,K,H),z=!0,G||(V=[ee(v,"change",t[4]),ee(E,"change",t[5]),ee(n,"submit",Ss(t[3]))],G=!0)},p(K,[H]){K[0].usrcfg?W||(W=Jf(),W.c(),W.m(n,c)):W&&(W.d(1),W=null);const Y={};H&1&&(Y.chip=K[0].chip),d.$set(Y),H&1&&qe(v,K[0].board),K[0].board&&K[0].board>20?U?(U.p(K,H),H&1&&D(U,1)):(U=xf(K),U.c(),D(U,1),U.m(n,y)):U&&(De(),q(U,1,1,()=>{U=null}),Ie()),H&4&&(E.checked=K[2]);const X={};H&2&&(X.active=K[1]),j.$set(X)},i(K){z||(D(d.$$.fragment,K),D(U),D(j.$$.fragment,K),z=!0)},o(K){q(d.$$.fragment,K),q(U),q(j.$$.fragment,K),z=!1},d(K){K&&C(e),W&&W.d(),ne(d),U&&U.d(),K&&C(x),ne(j,K),G=!1,ze(V)}}}function jp(t,e,l){let{sysinfo:n={}}=e,i=!1;async function o(f){l(1,i=!0);const _=new FormData(f.target),p=new URLSearchParams;for(let d of _){const[S,y]=d;p.append(S,y)}let v=await(await fetch("/save",{method:"POST",body:p})).json();l(1,i=!1),jt.update(d=>(d.vndcfg=v.success,d.booting=v.reboot,d)),oi(n.usrcfg?"/":"/setup")}let a=!1;function u(){n.board=dt(this),l(0,n)}function c(){a=this.checked,l(2,a),l(0,n)}return t.$$set=f=>{"sysinfo"in f&&l(0,n=f.sysinfo)},t.$$.update=()=>{t.$$.dirty&1&&l(2,a=!n.usrcfg)},[n,i,a,o,u,c]}class Hp extends Ee{constructor(e){super(),Pe(this,e,jp,Up,Ne,{sysinfo:0})}}function ec(t){let e,l,n,i,o,a,u,c;return u=new Zc({}),{c(){e=m("br"),l=h(),n=m("div"),i=m("input"),o=h(),a=m("select"),ie(u.$$.fragment),r(i,"name","si"),r(i,"type","text"),r(i,"class","in-f w-full"),i.required=t[1],r(a,"name","su"),r(a,"class","in-l"),a.required=t[1],r(n,"class","flex")},m(f,_){M(f,e,_),M(f,l,_),M(f,n,_),s(n,i),s(n,o),s(n,a),le(u,a,null),c=!0},p(f,_){(!c||_&2)&&(i.required=f[1]),(!c||_&2)&&(a.required=f[1])},i(f){c||(D(u.$$.fragment,f),c=!0)},o(f){q(u.$$.fragment,f),c=!1},d(f){f&&C(e),f&&C(l),f&&C(n),ne(u)}}}function tc(t){let e;return{c(){e=m("div"),e.innerHTML=`
Gateway
DNS
-
`,r(e,"class","my-3 flex")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function Hp(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,w,$,N,E,B,P,L,O,F,x,j,z,G,V=t[1]&&xf(t),W=t[1]&&ec();return x=new It({props:{active:t[2],message:"Saving your configuration to the device"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),o=h(),a=m("strong"),a.textContent="Setup",u=h(),c=m("div"),c.innerHTML=`SSID
+
`,r(e,"class","my-3 flex")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function Wp(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,y,$,N,E,B,P,L,O,F,x,j,z,G,V=t[1]&&ec(t),W=t[1]&&tc();return x=new It({props:{active:t[2],message:"Saving your configuration to the device"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),o=h(),a=m("strong"),a.textContent="Setup",u=h(),c=m("div"),c.innerHTML=`SSID
`,f=h(),_=m("div"),_.innerHTML=`PSK
`,p=h(),b=m("div"),v=T(`Hostname - `),d=m("input"),S=h(),w=m("div"),$=m("label"),N=m("input"),E=T(" Static IP"),B=h(),V&&V.c(),P=h(),W&&W.c(),L=h(),O=m("div"),O.innerHTML='',F=h(),ie(x.$$.fragment),r(i,"type","hidden"),r(i,"name","s"),i.value="true",r(a,"class","text-sm"),r(c,"class","my-3"),r(_,"class","my-3"),r(d,"name","sh"),r(d,"type","text"),r(d,"class","in-s"),r(d,"maxlength","32"),r(d,"pattern","[a-z0-9_-]+"),r(d,"placeholder","Optional, ex.: ams-reader"),r(d,"autocomplete","off"),r(N,"type","checkbox"),r(N,"name","sm"),N.__value="static",N.value=N.__value,r(N,"class","rounded mb-1"),r(w,"class","my-3"),r(O,"class","my-3"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(U,K){M(U,e,K),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),s(n,u),s(n,c),s(n,f),s(n,_),s(n,p),s(n,b),s(b,v),s(b,d),te(d,t[0].hostname),s(n,S),s(n,w),s(w,$),s($,N),N.checked=t[1],s($,E),s(w,B),V&&V.m(w,null),s(n,P),W&&W.m(n,null),s(n,L),s(n,O),M(U,F,K),le(x,U,K),j=!0,z||(G=[ee(d,"input",t[4]),ee(N,"change",t[5]),ee(n,"submit",$s(t[3]))],z=!0)},p(U,[K]){K&1&&d.value!==U[0].hostname&&te(d,U[0].hostname),K&2&&(N.checked=U[1]),U[1]?V?(V.p(U,K),K&2&&D(V,1)):(V=xf(U),V.c(),D(V,1),V.m(w,null)):V&&(De(),q(V,1,1,()=>{V=null}),Ie()),U[1]?W||(W=ec(),W.c(),W.m(n,L)):W&&(W.d(1),W=null);const H={};K&4&&(H.active=U[2]),x.$set(H)},i(U){j||(D(V),D(x.$$.fragment,U),j=!0)},o(U){q(V),q(x.$$.fragment,U),j=!1},d(U){U&&C(e),V&&V.d(),W&&W.d(),U&&C(F),ne(x,U),z=!1,ze(G)}}}function Wp(t,e,l){let{sysinfo:n={}}=e,i=!1,o=!1,a=0;function u(){var p="";a++;var b=function(){setTimeout(u,1e3)};if(n.net.ip&&a%3==0){if(!n.net.ip){b();return}p="http://"+n.net.ip}else n.hostname&&a%3==1?p="http://"+n.hostname:n.hostname&&a%3==2?p="http://"+n.hostname+".local":p="";console&&console.log("Trying url "+p),jt.update(d=>(d.trying=p,d));var v=new XMLHttpRequest;v.timeout=5e3,v.addEventListener("abort",b),v.addEventListener("error",b),v.addEventListener("timeout",b),v.addEventListener("load",function(d){window.location.href=p||"/"}),v.open("GET",p+"/is-alive",!0),v.send()}async function c(p){l(2,o=!0);const b=new FormData(p.target),v=new URLSearchParams;for(let w of b){const[$,N]=w;v.append($,N)}let S=await(await fetch("/save",{method:"POST",body:v})).json();l(2,o=!1),jt.update(w=>(w.hostname=b.get("sh"),w.usrcfg=S.success,w.booting=S.reboot,i&&(w.net.ip=b.get("si"),w.net.mask=b.get("su"),w.net.gw=b.get("sg"),w.net.dns1=b.get("sd")),setTimeout(u,5e3),w))}function f(){n.hostname=this.value,l(0,n)}function _(){i=this.checked,l(1,i)}return t.$$set=p=>{"sysinfo"in p&&l(0,n=p.sysinfo)},[n,i,o,c,f,_]}class zp extends Ee{constructor(e){super(),Pe(this,e,Wp,Hp,Ne,{sysinfo:0})}}function Gp(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,w,$;return d=new It({props:{active:t[2],message:"Uploading file, please wait"}}),{c(){e=m("div"),l=m("div"),n=m("strong"),i=T("Upload "),o=T(t[1]),a=h(),u=m("p"),u.textContent="Select a suitable file and click upload",c=h(),f=m("form"),_=m("input"),p=h(),b=m("div"),b.innerHTML='',v=h(),ie(d.$$.fragment),r(u,"class","mb-4"),r(_,"name","file"),r(_,"type","file"),r(b,"class","w-full text-right mt-4"),r(f,"action",t[0]),r(f,"enctype","multipart/form-data"),r(f,"method","post"),r(f,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2")},m(N,E){M(N,e,E),s(e,l),s(l,n),s(n,i),s(n,o),s(l,a),s(l,u),s(l,c),s(l,f),s(f,_),s(f,p),s(f,b),M(N,v,E),le(d,N,E),S=!0,w||($=ee(f,"submit",t[3]),w=!0)},p(N,[E]){(!S||E&2)&&X(o,N[1]),(!S||E&1)&&r(f,"action",N[0]);const B={};E&4&&(B.active=N[2]),d.$set(B)},i(N){S||(D(d.$$.fragment,N),S=!0)},o(N){q(d.$$.fragment,N),S=!1},d(N){N&&C(e),N&&C(v),ne(d,N),w=!1,$()}}}function Vp(t,e,l){let{action:n}=e,{title:i}=e,o=!1;const a=()=>l(2,o=!0);return t.$$set=u=>{"action"in u&&l(0,n=u.action),"title"in u&&l(1,i=u.title)},[n,i,o,a]}class No extends Ee{constructor(e){super(),Pe(this,e,Vp,Gp,Ne,{action:0,title:1})}}function Kp(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,w,$,N,E,B,P,L,O,F,x,j,z,G,V,W,U;return G=new It({props:{active:t[1],message:"Saving preferences"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("div"),i.textContent="Various permissions we need to do stuff:",o=h(),a=m("hr"),u=h(),c=m("div"),f=T("Enable one-click upgrade? (implies data collection)"),_=m("br"),p=h(),b=m("a"),v=T("Read more"),d=m("br"),S=h(),w=m("label"),$=m("input"),E=T(" Yes"),B=m("label"),P=m("input"),O=T(" No"),F=m("br"),x=h(),j=m("div"),j.innerHTML='',z=h(),ie(G.$$.fragment),r(b,"href",Ut("Data-collection-on-one-click-firmware-upgrade")),r(b,"target","_blank"),r(b,"class","text-blue-600 hover:text-blue-800"),r($,"type","radio"),r($,"name","sf"),$.value=1,$.checked=N=t[0].fwconsent===1,r($,"class","rounded m-2"),$.required=!0,r(P,"type","radio"),r(P,"name","sf"),P.value=2,P.checked=L=t[0].fwconsent===2,r(P,"class","rounded m-2"),P.required=!0,r(c,"class","my-3"),r(j,"class","my-3"),r(n,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-3 lg:grid-cols-2")},m(K,H){M(K,e,H),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),s(n,u),s(n,c),s(c,f),s(c,_),s(c,p),s(c,b),s(b,v),s(c,d),s(c,S),s(c,w),s(w,$),s(w,E),s(c,B),s(B,P),s(B,O),s(c,F),s(n,x),s(n,j),M(K,z,H),le(G,K,H),V=!0,W||(U=ee(n,"submit",$s(t[2])),W=!0)},p(K,[H]){(!V||H&1&&N!==(N=K[0].fwconsent===1))&&($.checked=N),(!V||H&1&&L!==(L=K[0].fwconsent===2))&&(P.checked=L);const Y={};H&2&&(Y.active=K[1]),G.$set(Y)},i(K){V||(D(G.$$.fragment,K),V=!0)},o(K){q(G.$$.fragment,K),V=!1},d(K){K&&C(e),K&&C(z),ne(G,K),W=!1,U()}}}function Yp(t,e,l){let{sysinfo:n={}}=e,i=!1;async function o(a){l(1,i=!0);const u=new FormData(a.target),c=new URLSearchParams;for(let p of u){const[b,v]=p;c.append(b,v)}let _=await(await fetch("/save",{method:"POST",body:c})).json();l(1,i=!1),jt.update(p=>(p.fwconsent=u.sf===!0?1:u.sf===!1?2:0,p.booting=_.reboot,p)),oi("/")}return t.$$set=a=>{"sysinfo"in a&&l(0,n=a.sysinfo)},[n,i,o]}class Qp extends Ee{constructor(e){super(),Pe(this,e,Yp,Kp,Ne,{sysinfo:0})}}function Xp(t){let e,l;return e=new Um({props:{data:t[1],sysinfo:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.data=n[1]),i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function Zp(t){let e,l;return e=new Cp({props:{sysinfo:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function Jp(t){let e,l;return e=new Lp({props:{sysinfo:t[0],data:t[1]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),i&2&&(o.data=n[1]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function xp(t){let e,l;return e=new No({props:{title:"CA",action:"/mqtt-ca"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function e_(t){let e,l;return e=new No({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function t_(t){let e,l;return e=new No({props:{title:"private key",action:"/mqtt-key"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function l_(t){let e,l;return e=new Qp({props:{sysinfo:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function n_(t){let e,l;return e=new zp({props:{sysinfo:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function i_(t){let e,l;return e=new jp({props:{sysinfo:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function s_(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,w,$,N,E,B;return e=new em({props:{data:t[1]}}),n=new $l({props:{path:"/",$$slots:{default:[Xp]},$$scope:{ctx:t}}}),o=new $l({props:{path:"/configuration",$$slots:{default:[Zp]},$$scope:{ctx:t}}}),u=new $l({props:{path:"/status",$$slots:{default:[Jp]},$$scope:{ctx:t}}}),f=new $l({props:{path:"/mqtt-ca",$$slots:{default:[xp]},$$scope:{ctx:t}}}),p=new $l({props:{path:"/mqtt-cert",$$slots:{default:[e_]},$$scope:{ctx:t}}}),v=new $l({props:{path:"/mqtt-key",$$slots:{default:[t_]},$$scope:{ctx:t}}}),S=new $l({props:{path:"/consent",$$slots:{default:[l_]},$$scope:{ctx:t}}}),$=new $l({props:{path:"/setup",$$slots:{default:[n_]},$$scope:{ctx:t}}}),E=new $l({props:{path:"/vendor",$$slots:{default:[i_]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment),l=h(),ie(n.$$.fragment),i=h(),ie(o.$$.fragment),a=h(),ie(u.$$.fragment),c=h(),ie(f.$$.fragment),_=h(),ie(p.$$.fragment),b=h(),ie(v.$$.fragment),d=h(),ie(S.$$.fragment),w=h(),ie($.$$.fragment),N=h(),ie(E.$$.fragment)},m(P,L){le(e,P,L),M(P,l,L),le(n,P,L),M(P,i,L),le(o,P,L),M(P,a,L),le(u,P,L),M(P,c,L),le(f,P,L),M(P,_,L),le(p,P,L),M(P,b,L),le(v,P,L),M(P,d,L),le(S,P,L),M(P,w,L),le($,P,L),M(P,N,L),le(E,P,L),B=!0},p(P,L){const O={};L&2&&(O.data=P[1]),e.$set(O);const F={};L&7&&(F.$$scope={dirty:L,ctx:P}),n.$set(F);const x={};L&5&&(x.$$scope={dirty:L,ctx:P}),o.$set(x);const j={};L&7&&(j.$$scope={dirty:L,ctx:P}),u.$set(j);const z={};L&4&&(z.$$scope={dirty:L,ctx:P}),f.$set(z);const G={};L&4&&(G.$$scope={dirty:L,ctx:P}),p.$set(G);const V={};L&4&&(V.$$scope={dirty:L,ctx:P}),v.$set(V);const W={};L&5&&(W.$$scope={dirty:L,ctx:P}),S.$set(W);const U={};L&5&&(U.$$scope={dirty:L,ctx:P}),$.$set(U);const K={};L&5&&(K.$$scope={dirty:L,ctx:P}),E.$set(K)},i(P){B||(D(e.$$.fragment,P),D(n.$$.fragment,P),D(o.$$.fragment,P),D(u.$$.fragment,P),D(f.$$.fragment,P),D(p.$$.fragment,P),D(v.$$.fragment,P),D(S.$$.fragment,P),D($.$$.fragment,P),D(E.$$.fragment,P),B=!0)},o(P){q(e.$$.fragment,P),q(n.$$.fragment,P),q(o.$$.fragment,P),q(u.$$.fragment,P),q(f.$$.fragment,P),q(p.$$.fragment,P),q(v.$$.fragment,P),q(S.$$.fragment,P),q($.$$.fragment,P),q(E.$$.fragment,P),B=!1},d(P){ne(e,P),P&&C(l),ne(n,P),P&&C(i),ne(o,P),P&&C(a),ne(u,P),P&&C(c),ne(f,P),P&&C(_),ne(p,P),P&&C(b),ne(v,P),P&&C(d),ne(S,P),P&&C(w),ne($,P),P&&C(N),ne(E,P)}}}function o_(t){let e,l,n,i;const o=[u_,a_],a=[];function u(c,f){return c[0].trying?0:1}return e=u(t),l=a[e]=o[e](t),{c(){l.c(),n=Ve()},m(c,f){a[e].m(c,f),M(c,n,f),i=!0},p(c,f){let _=e;e=u(c),e===_?a[e].p(c,f):(De(),q(a[_],1,1,()=>{a[_]=null}),Ie(),l=a[e],l?l.p(c,f):(l=a[e]=o[e](c),l.c()),D(l,1),l.m(n.parentNode,n))},i(c){i||(D(l),i=!0)},o(c){q(l),i=!1},d(c){a[e].d(c),c&&C(n)}}}function r_(t){let e,l;return e=new It({props:{active:"true",message:"Device is upgrading, please wait"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function a_(t){let e,l;return e=new It({props:{active:"true",message:"Device is booting, please wait"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function u_(t){let e,l;return e=new It({props:{active:"true",message:"Device is booting, please wait. Trying to reach it on "+t[0].trying}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.message="Device is booting, please wait. Trying to reach it on "+n[0].trying),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function f_(t){let e,l,n,i,o,a;l=new Pc({props:{$$slots:{default:[s_]},$$scope:{ctx:t}}});const u=[r_,o_],c=[];function f(_,p){return _[0].upgrading?0:_[0].booting?1:-1}return~(i=f(t))&&(o=c[i]=u[i](t)),{c(){e=m("div"),ie(l.$$.fragment),n=h(),o&&o.c(),r(e,"class","container mx-auto m-3")},m(_,p){M(_,e,p),le(l,e,null),s(e,n),~i&&c[i].m(e,null),a=!0},p(_,[p]){const b={};p&7&&(b.$$scope={dirty:p,ctx:_}),l.$set(b);let v=i;i=f(_),i===v?~i&&c[i].p(_,p):(o&&(De(),q(c[v],1,1,()=>{c[v]=null}),Ie()),~i?(o=c[i],o?o.p(_,p):(o=c[i]=u[i](_),o.c()),D(o,1),o.m(e,null)):o=null)},i(_){a||(D(l.$$.fragment,_),D(o),a=!0)},o(_){q(l.$$.fragment,_),q(o),a=!1},d(_){_&&C(e),ne(l),~i&&c[i].d()}}}function c_(t,e,l){let n={};jt.subscribe(o=>{l(0,n=o),n.vndcfg===!1?oi("/vendor"):n.usrcfg===!1?oi("/setup"):n.fwconsent===0&&oi("/consent")}),yo();let i={};return y1.subscribe(o=>{l(1,i=o)}),[n,i]}class m_ extends Ee{constructor(e){super(),Pe(this,e,c_,f_,Ne,{})}}new m_({target:document.getElementById("app")}); + `),d=m("input"),S=h(),y=m("div"),$=m("label"),N=m("input"),E=T(" Static IP"),B=h(),V&&V.c(),P=h(),W&&W.c(),L=h(),O=m("div"),O.innerHTML='',F=h(),ie(x.$$.fragment),r(i,"type","hidden"),r(i,"name","s"),i.value="true",r(a,"class","text-sm"),r(c,"class","my-3"),r(_,"class","my-3"),r(d,"name","sh"),r(d,"type","text"),r(d,"class","in-s"),r(d,"maxlength","32"),r(d,"pattern","[a-z0-9_-]+"),r(d,"placeholder","Optional, ex.: ams-reader"),r(d,"autocomplete","off"),r(N,"type","checkbox"),r(N,"name","sm"),N.__value="static",N.value=N.__value,r(N,"class","rounded mb-1"),r(y,"class","my-3"),r(O,"class","my-3"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(U,K){M(U,e,K),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),s(n,u),s(n,c),s(n,f),s(n,_),s(n,p),s(n,b),s(b,v),s(b,d),te(d,t[0].hostname),s(n,S),s(n,y),s(y,$),s($,N),N.checked=t[1],s($,E),s(y,B),V&&V.m(y,null),s(n,P),W&&W.m(n,null),s(n,L),s(n,O),M(U,F,K),le(x,U,K),j=!0,z||(G=[ee(d,"input",t[4]),ee(N,"change",t[5]),ee(n,"submit",Ss(t[3]))],z=!0)},p(U,[K]){K&1&&d.value!==U[0].hostname&&te(d,U[0].hostname),K&2&&(N.checked=U[1]),U[1]?V?(V.p(U,K),K&2&&D(V,1)):(V=ec(U),V.c(),D(V,1),V.m(y,null)):V&&(De(),q(V,1,1,()=>{V=null}),Ie()),U[1]?W||(W=tc(),W.c(),W.m(n,L)):W&&(W.d(1),W=null);const H={};K&4&&(H.active=U[2]),x.$set(H)},i(U){j||(D(V),D(x.$$.fragment,U),j=!0)},o(U){q(V),q(x.$$.fragment,U),j=!1},d(U){U&&C(e),V&&V.d(),W&&W.d(),U&&C(F),ne(x,U),z=!1,ze(G)}}}function zp(t,e,l){let{sysinfo:n={}}=e,i=!1,o=!1,a=0;function u(){var p="";a++;var b=function(){setTimeout(u,1e3)};if(n.net.ip&&a%3==0){if(!n.net.ip){b();return}p="http://"+n.net.ip}else n.hostname&&a%3==1?p="http://"+n.hostname:n.hostname&&a%3==2?p="http://"+n.hostname+".local":p="";console&&console.log("Trying url "+p),jt.update(d=>(d.trying=p,d));var v=new XMLHttpRequest;v.timeout=5e3,v.addEventListener("abort",b),v.addEventListener("error",b),v.addEventListener("timeout",b),v.addEventListener("load",function(d){window.location.href=p||"/"}),v.open("GET",p+"/is-alive",!0),v.send()}async function c(p){l(2,o=!0);const b=new FormData(p.target),v=new URLSearchParams;for(let y of b){const[$,N]=y;v.append($,N)}let S=await(await fetch("/save",{method:"POST",body:v})).json();l(2,o=!1),jt.update(y=>(y.hostname=b.get("sh"),y.usrcfg=S.success,y.booting=S.reboot,i&&(y.net.ip=b.get("si"),y.net.mask=b.get("su"),y.net.gw=b.get("sg"),y.net.dns1=b.get("sd")),setTimeout(u,5e3),y))}function f(){n.hostname=this.value,l(0,n)}function _(){i=this.checked,l(1,i)}return t.$$set=p=>{"sysinfo"in p&&l(0,n=p.sysinfo)},[n,i,o,c,f,_]}class Gp extends Ee{constructor(e){super(),Pe(this,e,zp,Wp,Ne,{sysinfo:0})}}function Vp(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,y,$;return d=new It({props:{active:t[2],message:"Uploading file, please wait"}}),{c(){e=m("div"),l=m("div"),n=m("strong"),i=T("Upload "),o=T(t[1]),a=h(),u=m("p"),u.textContent="Select a suitable file and click upload",c=h(),f=m("form"),_=m("input"),p=h(),b=m("div"),b.innerHTML='',v=h(),ie(d.$$.fragment),r(u,"class","mb-4"),r(_,"name","file"),r(_,"type","file"),r(b,"class","w-full text-right mt-4"),r(f,"action",t[0]),r(f,"enctype","multipart/form-data"),r(f,"method","post"),r(f,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2")},m(N,E){M(N,e,E),s(e,l),s(l,n),s(n,i),s(n,o),s(l,a),s(l,u),s(l,c),s(l,f),s(f,_),s(f,p),s(f,b),M(N,v,E),le(d,N,E),S=!0,y||($=ee(f,"submit",t[3]),y=!0)},p(N,[E]){(!S||E&2)&&Z(o,N[1]),(!S||E&1)&&r(f,"action",N[0]);const B={};E&4&&(B.active=N[2]),d.$set(B)},i(N){S||(D(d.$$.fragment,N),S=!0)},o(N){q(d.$$.fragment,N),S=!1},d(N){N&&C(e),N&&C(v),ne(d,N),y=!1,$()}}}function Kp(t,e,l){let{action:n}=e,{title:i}=e,o=!1;const a=()=>l(2,o=!0);return t.$$set=u=>{"action"in u&&l(0,n=u.action),"title"in u&&l(1,i=u.title)},[n,i,o,a]}class No extends Ee{constructor(e){super(),Pe(this,e,Kp,Vp,Ne,{action:0,title:1})}}function Yp(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,y,$,N,E,B,P,L,O,F,x,j,z,G,V,W,U;return G=new It({props:{active:t[1],message:"Saving preferences"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("div"),i.textContent="Various permissions we need to do stuff:",o=h(),a=m("hr"),u=h(),c=m("div"),f=T("Enable one-click upgrade? (implies data collection)"),_=m("br"),p=h(),b=m("a"),v=T("Read more"),d=m("br"),S=h(),y=m("label"),$=m("input"),E=T(" Yes"),B=m("label"),P=m("input"),O=T(" No"),F=m("br"),x=h(),j=m("div"),j.innerHTML='',z=h(),ie(G.$$.fragment),r(b,"href",Ut("Data-collection-on-one-click-firmware-upgrade")),r(b,"target","_blank"),r(b,"class","text-blue-600 hover:text-blue-800"),r($,"type","radio"),r($,"name","sf"),$.value=1,$.checked=N=t[0].fwconsent===1,r($,"class","rounded m-2"),$.required=!0,r(P,"type","radio"),r(P,"name","sf"),P.value=2,P.checked=L=t[0].fwconsent===2,r(P,"class","rounded m-2"),P.required=!0,r(c,"class","my-3"),r(j,"class","my-3"),r(n,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-3 lg:grid-cols-2")},m(K,H){M(K,e,H),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),s(n,u),s(n,c),s(c,f),s(c,_),s(c,p),s(c,b),s(b,v),s(c,d),s(c,S),s(c,y),s(y,$),s(y,E),s(c,B),s(B,P),s(B,O),s(c,F),s(n,x),s(n,j),M(K,z,H),le(G,K,H),V=!0,W||(U=ee(n,"submit",Ss(t[2])),W=!0)},p(K,[H]){(!V||H&1&&N!==(N=K[0].fwconsent===1))&&($.checked=N),(!V||H&1&&L!==(L=K[0].fwconsent===2))&&(P.checked=L);const Y={};H&2&&(Y.active=K[1]),G.$set(Y)},i(K){V||(D(G.$$.fragment,K),V=!0)},o(K){q(G.$$.fragment,K),V=!1},d(K){K&&C(e),K&&C(z),ne(G,K),W=!1,U()}}}function Qp(t,e,l){let{sysinfo:n={}}=e,i=!1;async function o(a){l(1,i=!0);const u=new FormData(a.target),c=new URLSearchParams;for(let p of u){const[b,v]=p;c.append(b,v)}let _=await(await fetch("/save",{method:"POST",body:c})).json();l(1,i=!1),jt.update(p=>(p.fwconsent=u.sf===!0?1:u.sf===!1?2:0,p.booting=_.reboot,p)),oi("/")}return t.$$set=a=>{"sysinfo"in a&&l(0,n=a.sysinfo)},[n,i,o]}class Xp extends Ee{constructor(e){super(),Pe(this,e,Qp,Yp,Ne,{sysinfo:0})}}function Zp(t){let e,l;return e=new jm({props:{data:t[1],sysinfo:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.data=n[1]),i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function Jp(t){let e,l;return e=new Mp({props:{sysinfo:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function xp(t){let e,l;return e=new Op({props:{sysinfo:t[0],data:t[1]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),i&2&&(o.data=n[1]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function e_(t){let e,l;return e=new No({props:{title:"CA",action:"/mqtt-ca"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function t_(t){let e,l;return e=new No({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function l_(t){let e,l;return e=new No({props:{title:"private key",action:"/mqtt-key"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function n_(t){let e,l;return e=new Xp({props:{sysinfo:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function i_(t){let e,l;return e=new Gp({props:{sysinfo:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function s_(t){let e,l;return e=new Hp({props:{sysinfo:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function o_(t){let e,l,n,i,o,a,u,c,f,_,p,b,v,d,S,y,$,N,E,B;return e=new tm({props:{data:t[1]}}),n=new Sl({props:{path:"/",$$slots:{default:[Zp]},$$scope:{ctx:t}}}),o=new Sl({props:{path:"/configuration",$$slots:{default:[Jp]},$$scope:{ctx:t}}}),u=new Sl({props:{path:"/status",$$slots:{default:[xp]},$$scope:{ctx:t}}}),f=new Sl({props:{path:"/mqtt-ca",$$slots:{default:[e_]},$$scope:{ctx:t}}}),p=new Sl({props:{path:"/mqtt-cert",$$slots:{default:[t_]},$$scope:{ctx:t}}}),v=new Sl({props:{path:"/mqtt-key",$$slots:{default:[l_]},$$scope:{ctx:t}}}),S=new Sl({props:{path:"/consent",$$slots:{default:[n_]},$$scope:{ctx:t}}}),$=new Sl({props:{path:"/setup",$$slots:{default:[i_]},$$scope:{ctx:t}}}),E=new Sl({props:{path:"/vendor",$$slots:{default:[s_]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment),l=h(),ie(n.$$.fragment),i=h(),ie(o.$$.fragment),a=h(),ie(u.$$.fragment),c=h(),ie(f.$$.fragment),_=h(),ie(p.$$.fragment),b=h(),ie(v.$$.fragment),d=h(),ie(S.$$.fragment),y=h(),ie($.$$.fragment),N=h(),ie(E.$$.fragment)},m(P,L){le(e,P,L),M(P,l,L),le(n,P,L),M(P,i,L),le(o,P,L),M(P,a,L),le(u,P,L),M(P,c,L),le(f,P,L),M(P,_,L),le(p,P,L),M(P,b,L),le(v,P,L),M(P,d,L),le(S,P,L),M(P,y,L),le($,P,L),M(P,N,L),le(E,P,L),B=!0},p(P,L){const O={};L&2&&(O.data=P[1]),e.$set(O);const F={};L&7&&(F.$$scope={dirty:L,ctx:P}),n.$set(F);const x={};L&5&&(x.$$scope={dirty:L,ctx:P}),o.$set(x);const j={};L&7&&(j.$$scope={dirty:L,ctx:P}),u.$set(j);const z={};L&4&&(z.$$scope={dirty:L,ctx:P}),f.$set(z);const G={};L&4&&(G.$$scope={dirty:L,ctx:P}),p.$set(G);const V={};L&4&&(V.$$scope={dirty:L,ctx:P}),v.$set(V);const W={};L&5&&(W.$$scope={dirty:L,ctx:P}),S.$set(W);const U={};L&5&&(U.$$scope={dirty:L,ctx:P}),$.$set(U);const K={};L&5&&(K.$$scope={dirty:L,ctx:P}),E.$set(K)},i(P){B||(D(e.$$.fragment,P),D(n.$$.fragment,P),D(o.$$.fragment,P),D(u.$$.fragment,P),D(f.$$.fragment,P),D(p.$$.fragment,P),D(v.$$.fragment,P),D(S.$$.fragment,P),D($.$$.fragment,P),D(E.$$.fragment,P),B=!0)},o(P){q(e.$$.fragment,P),q(n.$$.fragment,P),q(o.$$.fragment,P),q(u.$$.fragment,P),q(f.$$.fragment,P),q(p.$$.fragment,P),q(v.$$.fragment,P),q(S.$$.fragment,P),q($.$$.fragment,P),q(E.$$.fragment,P),B=!1},d(P){ne(e,P),P&&C(l),ne(n,P),P&&C(i),ne(o,P),P&&C(a),ne(u,P),P&&C(c),ne(f,P),P&&C(_),ne(p,P),P&&C(b),ne(v,P),P&&C(d),ne(S,P),P&&C(y),ne($,P),P&&C(N),ne(E,P)}}}function r_(t){let e,l,n,i;const o=[f_,u_],a=[];function u(c,f){return c[0].trying?0:1}return e=u(t),l=a[e]=o[e](t),{c(){l.c(),n=Ve()},m(c,f){a[e].m(c,f),M(c,n,f),i=!0},p(c,f){let _=e;e=u(c),e===_?a[e].p(c,f):(De(),q(a[_],1,1,()=>{a[_]=null}),Ie(),l=a[e],l?l.p(c,f):(l=a[e]=o[e](c),l.c()),D(l,1),l.m(n.parentNode,n))},i(c){i||(D(l),i=!0)},o(c){q(l),i=!1},d(c){a[e].d(c),c&&C(n)}}}function a_(t){let e,l;return e=new It({props:{active:"true",message:"Device is upgrading, please wait"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function u_(t){let e,l;return e=new It({props:{active:"true",message:"Device is booting, please wait"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function f_(t){let e,l;return e=new It({props:{active:"true",message:"Device is booting, please wait. Trying to reach it on "+t[0].trying}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.message="Device is booting, please wait. Trying to reach it on "+n[0].trying),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function c_(t){let e,l,n,i,o,a;l=new Ec({props:{$$slots:{default:[o_]},$$scope:{ctx:t}}});const u=[a_,r_],c=[];function f(_,p){return _[0].upgrading?0:_[0].booting?1:-1}return~(i=f(t))&&(o=c[i]=u[i](t)),{c(){e=m("div"),ie(l.$$.fragment),n=h(),o&&o.c(),r(e,"class","container mx-auto m-3")},m(_,p){M(_,e,p),le(l,e,null),s(e,n),~i&&c[i].m(e,null),a=!0},p(_,[p]){const b={};p&7&&(b.$$scope={dirty:p,ctx:_}),l.$set(b);let v=i;i=f(_),i===v?~i&&c[i].p(_,p):(o&&(De(),q(c[v],1,1,()=>{c[v]=null}),Ie()),~i?(o=c[i],o?o.p(_,p):(o=c[i]=u[i](_),o.c()),D(o,1),o.m(e,null)):o=null)},i(_){a||(D(l.$$.fragment,_),D(o),a=!0)},o(_){q(l.$$.fragment,_),q(o),a=!1},d(_){_&&C(e),ne(l),~i&&c[i].d()}}}function m_(t,e,l){let n={};jt.subscribe(o=>{l(0,n=o),n.vndcfg===!1?oi("/vendor"):n.usrcfg===!1?oi("/setup"):n.fwconsent===0&&oi("/consent")}),yo();let i={};return C1.subscribe(o=>{l(1,i=o)}),[n,i]}class p_ extends Ee{constructor(e){super(),Pe(this,e,m_,c_,Ne,{})}}new p_({target:document.getElementById("app")}); diff --git a/lib/SvelteUi/app/src/lib/Helpers.js b/lib/SvelteUi/app/src/lib/Helpers.js index 600ea0aa..7ec3761d 100644 --- a/lib/SvelteUi/app/src/lib/Helpers.js +++ b/lib/SvelteUi/app/src/lib/Helpers.js @@ -173,6 +173,24 @@ export function priceError(err) { return ""; } +export function httpError(err) { + switch(err) { + case 255: return "Unable to start upgrade"; + case -1: return "Connection refused"; + case -2: return "Failed to send headers"; + case -3: return "Failed to send payload"; + case -4: return "Not connected"; + case -5: return "Connection lost"; + case -6: return "No stream"; + case -7: return "Not a HTTP server"; + case -8: return "Not enough memory"; + case -9: return "Encoding error"; + case -10: return "Stream write"; + case -11: return "Read timeout"; + } + return "Unknown " + err; +} + export function isBusPowered(boardType) { switch(boardType) { case 2: diff --git a/lib/SvelteUi/app/src/lib/StatusPage.svelte b/lib/SvelteUi/app/src/lib/StatusPage.svelte index e8e96a41..0d91d42e 100644 --- a/lib/SvelteUi/app/src/lib/StatusPage.svelte +++ b/lib/SvelteUi/app/src/lib/StatusPage.svelte @@ -1,5 +1,5 @@ -Provided by: {getPriceSourceName(json.source)} +Provided by: {getPriceSourceName(json.source)} From c1b35b8ce09b05994fcf954fccffcbe485a66aa8 Mon Sep 17 00:00:00 2001 From: Gunnar Skjold Date: Mon, 4 Dec 2023 13:40:58 +0100 Subject: [PATCH 12/16] Some changes before release --- .github/workflows/release.yml | 2 ++ lib/SvelteUi/src/AmsWebServer.cpp | 2 +- platformio.ini | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 68cd8886..74f3a693 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,6 +28,8 @@ jobs: run: | sed -i 's/NO_AMS2MQTT_PRICE_KEY/AMS2MQTT_PRICE_KEY="${{secrets.AMS2MQTT_PRICE_KEY}}"/g' platformio.ini sed -i 's/NO_AMS2MQTT_PRICE_AUTHENTICATION/AMS2MQTT_PRICE_AUTHENTICATION="${{secrets.AMS2MQTT_PRICE_AUTHENTICATION}}"/g' platformio.ini + sed -i 's/NO_ENERGY_SPEEDOMETER_USER/ENERGY_SPEEDOMETER_USER=\"${{secrets.ENERGY_SPEEDOMETER_USER}}\"/g' platformio.ini + sed -i 's/NO_ENERGY_SPEEDOMETER_PASS/ENERGY_SPEEDOMETER_PASS=\"${{secrets.ENERGY_SPEEDOMETER_PASS}}\"/g' platformio.ini - name: Cache Python dependencies uses: actions/cache@v1 diff --git a/lib/SvelteUi/src/AmsWebServer.cpp b/lib/SvelteUi/src/AmsWebServer.cpp index cda61ac0..f7ba96b1 100644 --- a/lib/SvelteUi/src/AmsWebServer.cpp +++ b/lib/SvelteUi/src/AmsWebServer.cpp @@ -1002,7 +1002,7 @@ void AmsWebServer::configurationJson() { ); server.sendContent(buf); snprintf_P(buf, BufferSize, CONF_CLOUD_JSON, - #if defined(ENERGY_SPEEDOMETER_PASS) + #if defined(ESP32) && defined(ENERGY_SPEEDOMETER_PASS) sysConfig.energyspeedometer == 7 ? "true" : "false" #else "null" diff --git a/platformio.ini b/platformio.ini index fb865acd..48789bf4 100755 --- a/platformio.ini +++ b/platformio.ini @@ -14,6 +14,8 @@ build_flags = -D WEBSOCKET_DISABLED=1 -D NO_AMS2MQTT_PRICE_KEY -D NO_AMS2MQTT_PRICE_AUTHENTICATION + -D NO_ENERGY_SPEEDOMETER_USER + -D NO_ENERGY_SPEEDOMETER_PASS -fexceptions [esp32] From d823d747a5500893883ec254954177121ae53763 Mon Sep 17 00:00:00 2001 From: Gunnar Skjold Date: Mon, 4 Dec 2023 13:42:53 +0100 Subject: [PATCH 13/16] Updated build --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d39778a5..fb76ca01 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,6 +28,8 @@ jobs: run: | sed -i 's/NO_AMS2MQTT_PRICE_KEY/AMS2MQTT_PRICE_KEY="${{secrets.AMS2MQTT_PRICE_KEY}}"/g' platformio.ini sed -i 's/NO_AMS2MQTT_PRICE_AUTHENTICATION/AMS2MQTT_PRICE_AUTHENTICATION="${{secrets.AMS2MQTT_PRICE_AUTHENTICATION}}"/g' platformio.ini + sed -i 's/NO_ENERGY_SPEEDOMETER_USER/ENERGY_SPEEDOMETER_USER=\"${{secrets.ENERGY_SPEEDOMETER_USER}}\"/g' platformio.ini + sed -i 's/NO_ENERGY_SPEEDOMETER_PASS/ENERGY_SPEEDOMETER_PASS=\"${{secrets.ENERGY_SPEEDOMETER_PASS}}\"/g' platformio.ini - name: Cache Python dependencies uses: actions/cache@v1 From a121fbd28ece962dc09516085d6a0abea572f713 Mon Sep 17 00:00:00 2001 From: Gunnar Skjold Date: Mon, 4 Dec 2023 13:48:45 +0100 Subject: [PATCH 14/16] Updated build --- .github/workflows/build.yml | 4 ++-- .github/workflows/release.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fb76ca01..a6c2153d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,8 +28,8 @@ jobs: run: | sed -i 's/NO_AMS2MQTT_PRICE_KEY/AMS2MQTT_PRICE_KEY="${{secrets.AMS2MQTT_PRICE_KEY}}"/g' platformio.ini sed -i 's/NO_AMS2MQTT_PRICE_AUTHENTICATION/AMS2MQTT_PRICE_AUTHENTICATION="${{secrets.AMS2MQTT_PRICE_AUTHENTICATION}}"/g' platformio.ini - sed -i 's/NO_ENERGY_SPEEDOMETER_USER/ENERGY_SPEEDOMETER_USER=\"${{secrets.ENERGY_SPEEDOMETER_USER}}\"/g' platformio.ini - sed -i 's/NO_ENERGY_SPEEDOMETER_PASS/ENERGY_SPEEDOMETER_PASS=\"${{secrets.ENERGY_SPEEDOMETER_PASS}}\"/g' platformio.ini + sed -i 's/NO_ENERGY_SPEEDOMETER_USER/ENERGY_SPEEDOMETER_USER=\\"${{secrets.ENERGY_SPEEDOMETER_USER}}\\"/g' platformio.ini + sed -i 's/NO_ENERGY_SPEEDOMETER_PASS/ENERGY_SPEEDOMETER_PASS=\\"${{secrets.ENERGY_SPEEDOMETER_PASS}}\\"/g' platformio.ini - name: Cache Python dependencies uses: actions/cache@v1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 74f3a693..eaf3984e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,8 +28,8 @@ jobs: run: | sed -i 's/NO_AMS2MQTT_PRICE_KEY/AMS2MQTT_PRICE_KEY="${{secrets.AMS2MQTT_PRICE_KEY}}"/g' platformio.ini sed -i 's/NO_AMS2MQTT_PRICE_AUTHENTICATION/AMS2MQTT_PRICE_AUTHENTICATION="${{secrets.AMS2MQTT_PRICE_AUTHENTICATION}}"/g' platformio.ini - sed -i 's/NO_ENERGY_SPEEDOMETER_USER/ENERGY_SPEEDOMETER_USER=\"${{secrets.ENERGY_SPEEDOMETER_USER}}\"/g' platformio.ini - sed -i 's/NO_ENERGY_SPEEDOMETER_PASS/ENERGY_SPEEDOMETER_PASS=\"${{secrets.ENERGY_SPEEDOMETER_PASS}}\"/g' platformio.ini + sed -i 's/NO_ENERGY_SPEEDOMETER_USER/ENERGY_SPEEDOMETER_USER=\\"${{secrets.ENERGY_SPEEDOMETER_USER}}\\"/g' platformio.ini + sed -i 's/NO_ENERGY_SPEEDOMETER_PASS/ENERGY_SPEEDOMETER_PASS=\\"${{secrets.ENERGY_SPEEDOMETER_PASS}}\\"/g' platformio.ini - name: Cache Python dependencies uses: actions/cache@v1 From 8e9e60ec03514d405b896192dd1cb7cac50705b9 Mon Sep 17 00:00:00 2001 From: Gunnar Skjold Date: Mon, 4 Dec 2023 14:01:24 +0100 Subject: [PATCH 15/16] Fixed build --- src/AmsToMqttBridge.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/AmsToMqttBridge.cpp b/src/AmsToMqttBridge.cpp index e808ecd8..e0a2e156 100644 --- a/src/AmsToMqttBridge.cpp +++ b/src/AmsToMqttBridge.cpp @@ -98,7 +98,7 @@ AmsWebServer ws(commonBuffer, &Debug, &hw, &rdc); bool mqttEnabled = false; AmsMqttHandler* mqttHandler = NULL; -#if defined(ESP32) +#if defined(ESP32) && defined(ENERGY_SPEEDOMETER_PASS) JsonMqttHandler* energySpeedometer = NULL; MqttConfig energySpeedometerConfig = { "mqtt.sandtime.energy", @@ -564,7 +564,7 @@ void loop() { mqttHandler->disconnect(); } - #if defined(ENERGY_SPEEDOMETER_PASS) + #if defined(ESP32) && defined(ENERGY_SPEEDOMETER_PASS) if(sysConfig.energyspeedometer == 7) { if(!meterState.getMeterId().isEmpty()) { if(energySpeedometer == NULL) { @@ -756,7 +756,7 @@ void handleSystem(unsigned long now) { if(mqttHandler != NULL) { mqttHandler->publishSystem(&hw, eapi, &ea); } - #if defined(ENERGY_SPEEDOMETER_PASS) + #if defined(ESP32) && defined(ENERGY_SPEEDOMETER_PASS) if(energySpeedometer != NULL) { energySpeedometer->publishSystem(&hw, eapi, &ea); } @@ -1376,7 +1376,7 @@ void handleDataSuccess(AmsData* data) { delay(10); } } - #if defined(ENERGY_SPEEDOMETER_PASS) + #if defined(ESP32) && defined(ENERGY_SPEEDOMETER_PASS) if(energySpeedometer != NULL && energySpeedometer->publish(&meterState, &meterState, &ea, eapi)) { delay(10); } From ed899440ed7005561419bd280aba7cffc560ce7c Mon Sep 17 00:00:00 2001 From: Gunnar Skjold Date: Sun, 10 Dec 2023 09:17:44 +0100 Subject: [PATCH 16/16] Typ-o fix --- lib/SvelteUi/app/dist/index.js | 2 +- lib/SvelteUi/app/src/lib/Helpers.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/SvelteUi/app/dist/index.js b/lib/SvelteUi/app/dist/index.js index 00cacf48..04edfdce 100644 --- a/lib/SvelteUi/app/dist/index.js +++ b/lib/SvelteUi/app/dist/index.js @@ -1,6 +1,6 @@ (function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const r of i)if(r.type==="childList")for(const u of r.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&n(u)}).observe(document,{childList:!0,subtree:!0});function l(i){const r={};return i.integrity&&(r.integrity=i.integrity),i.referrerpolicy&&(r.referrerPolicy=i.referrerpolicy),i.crossorigin==="use-credentials"?r.credentials="include":i.crossorigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function n(i){if(i.ep)return;i.ep=!0;const r=l(i);fetch(i.href,r)}})();function fe(){}function xt(t,e){for(const l in e)t[l]=e[l];return t}function nc(t){return t()}function Oa(){return Object.create(null)}function ze(t){t.forEach(nc)}function cr(t){return typeof t=="function"}function Ne(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let _s;function Js(t,e){return _s||(_s=document.createElement("a")),_s.href=e,t===_s.href}function l0(t){return Object.keys(t).length===0}function mr(t,...e){if(t==null)return fe;const l=t.subscribe(...e);return l.unsubscribe?()=>l.unsubscribe():l}function ai(t){let e;return mr(t,l=>e=l)(),e}function ul(t,e,l){t.$$.on_destroy.push(mr(e,l))}function pr(t,e,l,n){if(t){const i=ic(t,e,l,n);return t[0](i)}}function ic(t,e,l,n){return t[1]&&n?xt(l.ctx.slice(),t[1](n(e))):l.ctx}function _r(t,e,l,n){if(t[2]&&n){const i=t[2](n(l));if(e.dirty===void 0)return i;if(typeof i=="object"){const r=[],u=Math.max(e.dirty.length,i.length);for(let a=0;a32){const e=[],l=t.ctx.length/32;for(let n=0;nt.removeEventListener(e,l,n)}function Ss(t){return function(e){return e.preventDefault(),t.call(this,e)}}function o(t,e,l){l==null?t.removeAttribute(e):t.getAttribute(e)!==l&&t.setAttribute(e,l)}const i0=["width","height"];function ui(t,e){const l=Object.getOwnPropertyDescriptors(t.__proto__);for(const n in e)e[n]==null?t.removeAttribute(n):n==="style"?t.style.cssText=e[n]:n==="__value"?t.value=t[n]=e[n]:l[n]&&l[n].set&&i0.indexOf(n)===-1?t[n]=e[n]:o(t,n,e[n])}function he(t){return t===""?null:+t}function s0(t){return Array.from(t.childNodes)}function Z(t,e){e=""+e,t.data!==e&&(t.data=e)}function r0(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function o0(t,e,l){~n0.indexOf(l)?r0(t,e):Z(t,e)}function te(t,e){t.value=e==null?"":e}function sc(t,e,l,n){l==null?t.style.removeProperty(e):t.style.setProperty(e,l,n?"important":"")}function qe(t,e,l){for(let n=0;n{u.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{r=ee(n.contentWindow,"resize",e),e()}),s(t,n),()=>{(i||r&&n.contentWindow)&&r(),C(n)}}function u0(t,e,{bubbles:l=!1,cancelable:n=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(t,l,n,e),i}function La(t,e){return new t(e)}let $i;function Mi(t){$i=t}function Ti(){if(!$i)throw new Error("Function called outside component initialization");return $i}function oc(t){Ti().$$.on_mount.push(t)}function f0(t){Ti().$$.on_destroy.push(t)}function c0(){const t=Ti();return(e,l,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const r=u0(e,l,{cancelable:n});return i.slice().forEach(u=>{u.call(t,r)}),!r.defaultPrevented}return!0}}function Si(t,e){return Ti().$$.context.set(t,e),e}function Bl(t){return Ti().$$.context.get(t)}const ii=[],ws=[];let si=[];const Fa=[],ac=Promise.resolve();let xs=!1;function uc(){xs||(xs=!0,ac.then(fc))}function m0(){return uc(),ac}function Qe(t){si.push(t)}const Vs=new Set;let li=0;function fc(){if(li!==0)return;const t=$i;do{try{for(;lit.indexOf(n)===-1?e.push(n):l.push(n)),l.forEach(n=>n()),si=e}const bs=new Set;let on;function De(){on={r:0,c:[],p:on}}function Ie(){on.r||ze(on.c),on=on.p}function D(t,e){t&&t.i&&(bs.delete(t),t.i(e))}function q(t,e,l,n){if(t&&t.o){if(bs.has(t))return;bs.add(t),on.c.push(()=>{bs.delete(t),n&&(l&&t.d(1),n())}),t.o(e)}else n&&n()}function cc(t,e){const l={},n={},i={$$scope:1};let r=t.length;for(;r--;){const u=t[r],a=e[r];if(a){for(const c in u)c in a||(n[c]=1);for(const c in a)i[c]||(l[c]=a[c],i[c]=1);t[r]=a}else for(const c in u)i[c]=1}for(const u in n)u in l||(l[u]=void 0);return l}function qa(t){return typeof t=="object"&&t!==null?t:{}}function ie(t){t&&t.c()}function le(t,e,l,n){const{fragment:i,after_update:r}=t.$$;i&&i.m(e,l),n||Qe(()=>{const u=t.$$.on_mount.map(nc).filter(cr);t.$$.on_destroy?t.$$.on_destroy.push(...u):ze(u),t.$$.on_mount=[]}),r.forEach(Qe)}function ne(t,e){const l=t.$$;l.fragment!==null&&(_0(l.after_update),ze(l.on_destroy),l.fragment&&l.fragment.d(e),l.on_destroy=l.fragment=null,l.ctx=[])}function d0(t,e){t.$$.dirty[0]===-1&&(ii.push(t),uc(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const d=v.length?v[0]:b;return f.ctx&&i(f.ctx[p],f.ctx[p]=d)&&(!f.skip_bound&&f.bound[p]&&f.bound[p](d),_&&d0(t,p)),b}):[],f.update(),_=!0,ze(f.before_update),f.fragment=n?n(f.ctx):!1,e.target){if(e.hydrate){const p=s0(e.target);f.fragment&&f.fragment.l(p),p.forEach(C)}else f.fragment&&f.fragment.c();e.intro&&D(t.$$.fragment),le(t,e.target,e.anchor,e.customElement),fc()}Mi(c)}class Pe{$destroy(){ne(this,1),this.$destroy=fe}$on(e,l){if(!cr(l))return fe;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(l),()=>{const i=n.indexOf(l);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!l0(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Ba=t=>typeof t>"u",mc=t=>typeof t=="function",pc=t=>typeof t=="number";function v0(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function _c(){let t=0;return()=>t++}function h0(){return Math.random().toString(36).substring(2)}const Ul=typeof window>"u";function dc(t,e,l){return t.addEventListener(e,l),()=>t.removeEventListener(e,l)}const vc=(t,e)=>t?{}:{style:e},er=t=>({"aria-hidden":"true",...vc(t,"display:none;")}),ni=[];function hc(t,e){return{subscribe:at(t,e).subscribe}}function at(t,e=fe){let l;const n=new Set;function i(a){if(Ne(t,a)&&(t=a,l)){const c=!ni.length;for(const f of n)f[1](),ni.push(f,t);if(c){for(let f=0;f{n.delete(f),n.size===0&&l&&(l(),l=null)}}return{set:i,update:r,subscribe:u}}function b0(t,e,l){const n=!Array.isArray(t),i=n?[t]:t,r=e.length<2;return hc(l,u=>{let a=!1;const c=[];let f=0,_=fe;const p=()=>{if(f)return;_();const v=e(n?c[0]:c,u);r?u(v):_=cr(v)?v:fe},b=i.map((v,d)=>mr(v,S=>{c[d]=S,f&=~(1<{f|=1<`@@svnav-ctx__${t}`,tr=Ni("LOCATION"),fi=Ni("ROUTER"),bc=Ni("ROUTE"),g0=Ni("ROUTE_PARAMS"),k0=Ni("FOCUS_ELEM"),gc=/^:(.+)/,wi=(t,e,l)=>t.substr(e,l),lr=(t,e)=>wi(t,0,e.length)===e,w0=t=>t==="",y0=t=>gc.test(t),kc=t=>t[0]==="*",C0=t=>t.replace(/\*.*$/,""),wc=t=>t.replace(/(^\/+|\/+$)/g,"");function ml(t,e=!1){const l=wc(t).split("/");return e?l.filter(Boolean):l}const Ks=(t,e)=>t+(e?`?${e}`:""),hr=t=>`/${wc(t)}`;function Ai(...t){const e=n=>ml(n,!0).join("/"),l=t.map(e).join("/");return hr(l)}const br=1,$s=2,mn=3,M0=4,yc=5,S0=6,Cc=7,$0=8,T0=9,Mc=10,Sc=11,N0={[br]:"Link",[$s]:"Route",[mn]:"Router",[M0]:"useFocus",[yc]:"useLocation",[S0]:"useMatch",[Cc]:"useNavigate",[$0]:"useParams",[T0]:"useResolvable",[Mc]:"useResolve",[Sc]:"navigate"},gr=t=>N0[t];function A0(t,e){let l;return t===$s?l=e.path?`path="${e.path}"`:"default":t===br?l=`to="${e.to}"`:t===mn&&(l=`basepath="${e.basepath||""}"`),`<${gr(t)} ${l||""} />`}function E0(t,e,l,n){const i=l&&A0(n||t,l),r=i?` -Occurred in: ${i}`:"",u=gr(t),a=mc(e)?e(u):e;return`<${u}> ${a}${r}`}const $c=t=>(...e)=>t(E0(...e)),Tc=$c(t=>{throw new Error(t)}),ys=$c(console.warn),Ua=4,P0=3,D0=2,I0=1,R0=1;function O0(t,e){const l=t.default?0:ml(t.fullPath).reduce((n,i)=>{let r=n;return r+=Ua,w0(i)?r+=R0:y0(i)?r+=D0:kc(i)?r-=Ua+I0:r+=P0,r},0);return{route:t,score:l,index:e}}function L0(t){return t.map(O0).sort((e,l)=>e.scorel.score?-1:e.index-l.index)}function Nc(t,e){let l,n;const[i]=e.split("?"),r=ml(i),u=r[0]==="",a=L0(t);for(let c=0,f=a.length;c({..._,params:b,uri:$});if(_.default){n=v(e);continue}const d=ml(_.fullPath),S=Math.max(r.length,d.length);let y=0;for(;y{f===".."?c.pop():f!=="."&&c.push(f)}),Ks(`/${c.join("/")}`,n)}function Ha(t,e){const{pathname:l,hash:n="",search:i="",state:r}=t,u=ml(e,!0),a=ml(l,!0);for(;u.length;)u[0]!==a[0]&&Tc(mn,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),u.shift(),a.shift();return{pathname:Ai(...a),hash:n,search:i,state:r}}const ja=t=>t.length===1?"":t,kr=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,r=i?ja(wi(t,l)):"",u=i?wi(t,0,l):t,a=n?ja(wi(u,e)):"";return{pathname:(n?wi(u,0,e):u)||"/",search:a,hash:r}},q0=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function B0(t,e,l){return Ai(l,F0(t,e))}function U0(t,e){const l=hr(C0(t)),n=ml(l,!0),i=ml(e,!0).slice(0,n.length),r=Ac({fullPath:l},Ai(...i));return r&&r.uri}const Ys="POP",H0="PUSH",j0="REPLACE";function Qs(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function W0(t){let e=[],l=Qs(t),n=Ys;const i=(r=e)=>r.forEach(u=>u({location:l,action:n}));return{get location(){return l},listen(r){e.push(r);const u=()=>{l=Qs(t),n=Ys,i([r])};i([r]);const a=dc(t,"popstate",u);return()=>{a(),e=e.filter(c=>c!==r)}},navigate(r,u){const{state:a={},replace:c=!1}=u||{};if(n=c?j0:H0,pc(r))u&&ys(Sc,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=Ys,t.history.go(r);else{const f={...a,_key:h0()};try{t.history[c?"replaceState":"pushState"](f,"",r)}catch{t.location[c?"replace":"assign"](r)}}l=Qs(t),i()}}}function Xs(t,e){return{...kr(e),state:t}}function z0(t="/"){let e=0,l=[Xs(null,t)];return{get entries(){return l},get location(){return l[e]},addEventListener(){},removeEventListener(){},history:{get state(){return l[e].state},pushState(n,i,r){e++,l=l.slice(0,e),l.push(Xs(n,r))},replaceState(n,i,r){l[e]=Xs(n,r)},go(n){const i=e+n;i<0||i>l.length-1||(e=i)}}}}const G0=!!(!Ul&&window.document&&window.document.createElement),V0=!Ul&&window.location.origin==="null",Ec=W0(G0&&!V0?window:z0()),{navigate:ri}=Ec;let $l=null,Pc=!0;function K0(t,e){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;n$l.level||t.level===$l.level&&K0(t.routerId,$l.routerId))&&($l=t)}function Q0(){$l=null}function X0(){Pc=!1}function Wa(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=dc(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function Z0(t,e){return Number(t.dataset.svnavRouteEnd)===e}function J0(t){return/^H[1-6]$/i.test(t.tagName)}function za(t,e=document){return e.querySelector(t)}function x0(t){let l=za(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!Z0(l,t);){if(J0(l))return l;const n=za("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function e1(t){Promise.resolve(ai(t.focusElement)).then(e=>{const l=e||x0(t.id);l||ys(mn,`Could not find an element to focus. You should always render a header for accessibility reasons, or set a custom focus element via the "useFocus" hook. If you don't want this Route or Router to manage focus, pass "primary={false}" to it.`,t,$s),!Wa(l)&&Wa(document.documentElement)})}const t1=(t,e,l)=>(n,i)=>m0().then(()=>{if(!$l||Pc){X0();return}if(n&&e1($l.route),t.announcements&&i){const{path:r,fullPath:u,meta:a,params:c,uri:f}=$l.route,_=t.createAnnouncement({path:r,fullPath:u,meta:a,params:c,uri:f},ai(l));Promise.resolve(_).then(p=>{e.set(p)})}Q0()}),l1="position:fixed;top:-1px;left:0;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;";function n1(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},vc(t[6],l1)],i={};for(let r=0;r`Navigated to ${ue.uri}`,announcements:!0,...d},$=_,N=hr(_),P=Bl(tr),B=Bl(fi),E=!P,O=s1(),L=v&&!(B&&!B.manageFocus),F=at("");ul(t,F,ue=>l(0,a=ue));const x=B?B.disableInlineStyles:S,H=at([]);ul(t,H,ue=>l(20,u=ue));const z=at(null);ul(t,z,ue=>l(18,i=ue));let G=!1;const V=E?0:B.level+1,U=E?at((()=>Ha(Ul?kr(p):b.location,N))()):P;ul(t,U,ue=>l(17,n=ue));const K=at(n);ul(t,K,ue=>l(19,r=ue));const j=t1(y,F,U),Y=ue=>ke=>ke.filter(me=>me.id!==ue);function X(ue){if(Ul){if(G)return;const ke=Ac(ue,n.pathname);if(ke)return G=!0,ke}else H.update(ke=>{const me=Y(ue.id)(ke);return me.push(ue),me})}function oe(ue){H.update(Y(ue))}return!E&&_!==Ga&&ys(mn,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:_}),E&&(oc(()=>b.listen(ke=>{const me=Ha(ke.location,N);K.set(n),U.set(me)})),Si(tr,U)),Si(fi,{activeRoute:z,registerRoute:X,unregisterRoute:oe,manageFocus:L,level:V,id:O,history:E?b:B.history,basepath:E?N:B.basepath,disableInlineStyles:x}),t.$$set=ue=>{"basepath"in ue&&l(11,_=ue.basepath),"url"in ue&&l(12,p=ue.url),"history"in ue&&l(13,b=ue.history),"primary"in ue&&l(14,v=ue.primary),"a11y"in ue&&l(15,d=ue.a11y),"disableInlineStyles"in ue&&l(16,S=ue.disableInlineStyles),"$$scope"in ue&&l(21,f=ue.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&_!==$&&ys(mn,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const ue=Nc(u,n.pathname);z.set(ue)}if(t.$$.dirty[0]&655360&&E){const ue=!!n.hash,ke=!ue&&L,me=!ue||n.pathname!==r.pathname;j(ke,me)}t.$$.dirty[0]&262144&&L&&i&&i.primary&&Y0({level:V,routerId:O,route:i})},[a,y,E,O,L,F,x,H,z,U,K,_,p,b,v,d,S,n,i,r,u,f,c]}class o1 extends Pe{constructor(e){super(),Ee(this,e,r1,i1,Ne,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}const Dc=o1;function Ei(t,e,l=fi,n=mn){Bl(l)||Tc(t,r=>`You cannot use ${r} outside of a ${gr(n)}.`,e)}const a1=t=>{const{subscribe:e}=Bl(t);return{subscribe:e}};function Ic(){return Ei(yc),a1(tr)}function Rc(){const{history:t}=Bl(fi);return t}function Oc(){const t=Bl(bc);return t?b0(t,e=>e.base):at("/")}function Lc(){Ei(Mc);const t=Oc(),{basepath:e}=Bl(fi);return n=>B0(n,ai(t),e)}function u1(){Ei(Cc);const t=Lc(),{navigate:e}=Rc();return(n,i)=>{const r=pc(n)?n:t(n);return e(r,i)}}const f1=t=>({params:t&16,location:t&8}),Va=t=>({params:Ul?ai(t[10]):t[4],location:t[3],navigate:t[11]});function Ka(t){let e,l;return e=new Dc({props:{primary:t[1],$$slots:{default:[p1]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const r={};i&2&&(r.primary=n[1]),i&528409&&(r.$$scope={dirty:i,ctx:n}),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function c1(t){let e;const l=t[18].default,n=pr(l,t,t[19],Va);return{c(){n&&n.c()},m(i,r){n&&n.m(i,r),e=!0},p(i,r){n&&n.p&&(!e||r&524312)&&dr(n,l,i,i[19],e?_r(l,i[19],r,f1):vr(i[19]),Va)},i(i){e||(D(n,i),e=!0)},o(i){q(n,i),e=!1},d(i){n&&n.d(i)}}}function m1(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},Ul?ai(t[10]):t[4],t[12]];var r=t[0];function u(a){let c={};for(let f=0;f{ne(_,1)}),Ie()}r?(e=La(r,u()),ie(e.$$.fragment),D(e.$$.fragment,1),le(e,l.parentNode,l)):e=null}else r&&e.$set(f)},i(a){n||(e&&D(e.$$.fragment,a),n=!0)},o(a){e&&q(e.$$.fragment,a),n=!1},d(a){a&&C(l),e&&ne(e,a)}}}function p1(t){let e,l,n,i;const r=[m1,c1],u=[];function a(c,f){return c[0]!==null?0:1}return e=a(t),l=u[e]=r[e](t),{c(){l.c(),n=Ve()},m(c,f){u[e].m(c,f),M(c,n,f),i=!0},p(c,f){let _=e;e=a(c),e===_?u[e].p(c,f):(De(),q(u[_],1,1,()=>{u[_]=null}),Ie(),l=u[e],l?l.p(c,f):(l=u[e]=r[e](c),l.c()),D(l,1),l.m(n.parentNode,n))},i(c){i||(D(l),i=!0)},o(c){q(l),i=!1},d(c){u[e].d(c),c&&C(n)}}}function _1(t){let e,l,n,i,r,u=[er(t[7]),{"data-svnav-route-start":t[5]}],a={};for(let p=0;p{c=null}),Ie())},i(p){r||(D(c),r=!0)},o(p){q(c),r=!1},d(p){p&&C(e),p&&C(l),c&&c.d(p),p&&C(n),p&&C(i)}}}const d1=_c();function v1(t,e,l){let n;const i=["path","component","meta","primary"];let r=ks(e,i),u,a,c,f,{$$slots:_={},$$scope:p}=e,{path:b=""}=e,{component:v=null}=e,{meta:d={}}=e,{primary:S=!0}=e;Ei($s,e);const y=d1(),{registerRoute:$,unregisterRoute:N,activeRoute:P,disableInlineStyles:B}=Bl(fi);ul(t,P,G=>l(16,u=G));const E=Oc();ul(t,E,G=>l(17,c=G));const O=Ic();ul(t,O,G=>l(3,a=G));const L=at(null);let F;const x=at(),H=at({});ul(t,H,G=>l(4,f=G)),Si(bc,x),Si(g0,H),Si(k0,L);const z=u1();return Ul||f0(()=>N(y)),t.$$set=G=>{l(24,e=xt(xt({},e),gs(G))),l(12,r=ks(e,i)),"path"in G&&l(13,b=G.path),"component"in G&&l(0,v=G.component),"meta"in G&&l(14,d=G.meta),"primary"in G&&l(1,S=G.primary),"$$scope"in G&&l(19,p=G.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const G=b==="",V=Ai(c,b),W={id:y,path:b,meta:d,default:G,fullPath:G?"":V,base:G?c:U0(V,a.pathname),primary:S,focusElement:L};x.set(W),l(15,F=$(W))}if(t.$$.dirty&98304&&l(2,n=!!(F||u&&u.id===y)),t.$$.dirty&98308&&n){const{params:G}=F||u;H.set(G)}},e=gs(e),[v,S,n,a,f,y,P,B,E,O,H,z,r,b,d,F,u,c,_,p]}class h1 extends Pe{constructor(e){super(),Ee(this,e,v1,_1,Ne,{path:13,component:0,meta:14,primary:1})}}const Sl=h1;function b1(t){let e,l,n,i;const r=t[13].default,u=pr(r,t,t[12],null);let a=[{href:t[0]},t[2],t[1]],c={};for(let f=0;fl(11,p=L));const P=c0(),B=Lc(),{navigate:E}=Rc();function O(L){P("click",L),v0(L)&&(L.preventDefault(),E(n,{state:y,replace:u||S}))}return t.$$set=L=>{l(19,e=xt(xt({},e),gs(L))),l(18,_=ks(e,f)),"to"in L&&l(5,d=L.to),"replace"in L&&l(6,S=L.replace),"state"in L&&l(7,y=L.state),"getProps"in L&&l(8,$=L.getProps),"$$scope"in L&&l(12,v=L.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=B(d,p)),t.$$.dirty&2049&&l(10,i=lr(p.pathname,n)),t.$$.dirty&2049&&l(9,r=n===p.pathname),t.$$.dirty&2049&&(u=kr(n)===q0(p)),t.$$.dirty&512&&l(2,a=r?{"aria-current":"page"}:{}),l(1,c=(()=>{if(mc($)){const L=$({location:p,href:n,isPartiallyCurrent:i,isCurrent:r});return{..._,...L}}return _})())},e=gs(e),[n,c,a,N,O,d,S,y,$,r,i,p,v,b]}class k1 extends Pe{constructor(e){super(),Ee(this,e,g1,b1,Ne,{to:5,replace:6,state:7,getProps:8})}}const el=k1;let nr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function ql(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function w1(t){return t>218&&t<242?"#32d900":t>212&&t<248?"#b1d900":t>208&&t<252?"#ffb800":"#d90000"}function Fc(t,e){let l;return t>90?l="#d90000":t>85?l="#e32100":t>80?l="#ffb800":t>75?l="#dcd800":l="#32d900",l+(e?"88":"")}function y1(t){return t>75?"#32d900":t>50?"#77d900":t>25?"#94d900":"#dcd800"}function Cs(t){switch(t){case 1:return"Aidon";case 2:return"Kaifa";case 3:return"Kamstrup";case 8:return"Iskra";case 9:return"Landis+Gyr";case 10:return"Sagemcom";default:return"Unknown"}}function Le(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function be(t,e){switch(e){case 5:switch(t){case"esp8266":return"Pow-K (GPIO12)";case"esp32s2":return"Pow-K+"}case 7:switch(t){case"esp8266":return"Pow-U (GPIO12)";case"esp32s2":return"Pow-U+"}case 6:return"Pow-P1";case 51:return"Wemos S2 mini";case 50:return"Generic ESP32-S2";case 201:return"Wemos LOLIN D32";case 202:return"Adafruit HUZZAH32";case 203:return"DevKitC";case 200:return"Generic ESP32";case 2:return"HAN Reader 2.0 by Max Spencer";case 0:return"Custom hardware by Roar Fredriksen";case 1:return"Kamstrup module by Egil Opsahl";case 8:return"\xB5HAN mosquito by dbeinder";case 3:return"Pow-K (UART0)";case 4:return"Pow-U (UART0)";case 101:return"Wemos D1 mini";case 100:return"Generic ESP8266";case 70:return"Generic ESP32-C3";case 71:return"ESP32-C3-DevKitM-1"}}function Ya(t){switch(t){case-1:return"Parse error";case-2:return"Incomplete data received";case-3:return"Payload boundry flag missing";case-4:return"Header checksum error";case-5:return"Footer checksum error";case-9:return"Unknown data received, check meter config";case-41:return"Frame length not equal";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid";case 90:return"No HAN data received for at least 30s";case 91:return"Serial break";case 92:return"Serial buffer full";case 93:return"Serial FIFO overflow";case 94:return"Serial frame error";case 95:return"Serial parity error";case 96:return"RX error";case 98:return"Exception in code, debugging necessary";case 99:return"Autodetection failed"}return t<0?"Unspecified error "+t:""}function Qa(t){switch(t){case-3:return"Connection failed";case-4:return"Network timeout";case-10:return"Connection denied";case-11:return"Failed to subscribe";case-13:return"Connection lost"}return t<0?"Unspecified error "+t:""}function Xa(t){switch(t){case 400:return"Unrecognized data in request";case 401:case 403:return"Unauthorized, check API key";case 404:return"Price unavailable, not found";case 425:return"Server says its too early";case 429:return"Exceeded API rate limit";case 500:return"Internal server error";case-1:return"Connection error";case-2:return"Incomplete data received";case-3:return"Invalid data, tag missing";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid"}return t<0?"Unspecified error "+t:""}function Za(t){switch(t){case 255:return"Unable to start upgrade";case-1:return"Connection refused";case-2:return"Failed to send headers";case-3:return"Failed to send payload";case-4:return"Not connected";case-5:return"Connection lost";case-6:return"No stream";case-7:return"Not a HTTP server";case-8:return"Not enough memory";case-9:return"Encoding error";case-10:return"Stream write";case-11:return"Read timeout"}return"Unknown "+t}function oi(t){switch(t){case 2:case 4:case 7:return!0}return!1}function Ke(t,e){return t==1||t==2&&e}function Ut(t){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+t}function ge(t,e){return isNaN(t)?"-":(isNaN(e)&&(e=t<10?1:0),t.toFixed(e))}function fl(t,e){return t.setTime(t.getTime()+e*36e5),t}function Ja(t){if(t.chip=="esp8266")switch(t.boot_reason){case 0:return"Normal";case 1:return"WDT reset";case 2:return"Exception reset";case 3:return"Soft WDT reset";case 4:return"Software restart";case 5:return"Deep sleep";case 6:return"External reset";default:return"Unknown (8266)"}else switch(t.boot_reason){case 1:return"Vbat power on reset";case 3:return"Software reset";case 4:return"WDT reset";case 5:return"Deep sleep";case 6:return"SLC reset";case 7:return"Timer Group0 WDT reset";case 8:return"Timer Group1 WDT reset";case 9:return"RTC WDT reset";case 10:return"Instrusion test reset CPU";case 11:return"Time Group reset CPU";case 12:return"Software reset CPU";case 13:return"RTC WTD reset CPU";case 14:return"PRO CPU";case 15:return"Brownout";case 16:return"RTC reset";default:return"Unknown"}}function xa(t){return t=="EOE"?"ENTSO-E":t=="HKS"?"hvakosterstrommen.no":t=="EDS"?"Energy Data Service":t=="MIX"?"Mixed sources":"Unknown ("+t+")"}function eu(t){return t=="EOE"?"https://transparency.entsoe.eu/-E":t=="HKS"?"https://www.hvakosterstrommen.no/":t=="EDS"?"https://www.energidataservice.dk/":"#"}async function Hl(t,e={}){const{timeout:l=8e3}=e,n=new AbortController,i=setTimeout(()=>n.abort(),l),r=await fetch(t,{...e,signal:n.signal});return clearTimeout(i),r}let al={version:"",chip:"",mac:null,apmac:null,vndcfg:null,usrcfg:null,fwconsent:null,booting:!1,upgrading:!1,ui:{},security:0,boot_reason:0,upgrade:{x:-1,e:0,f:null,t:null},trying:null};const Ht=at(al);async function wr(){al=await(await Hl("/sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),Ht.set(al)}let vs=0,tu=-127,lu=null,C1={};const M1=hc(C1,t=>{let e;async function l(){Hl("/data.json").then(n=>n.json()).then(n=>{t(n),tu!=n.t&&(tu=n.t,setTimeout(jc,2e3)),lu==null&&n.pe&&n.p!=null&&(lu=n.p,Bc()),al.upgrading?window.location.reload():(!al||!al.chip||al.booting||vs>1&&!oi(al.board))&&(wr(),an&&clearTimeout(an),an=setTimeout(Cr,2e3),un&&clearTimeout(un),un=setTimeout(Mr,3e3));let i=5e3;if(oi(al.board)&&n.v>2.5){let r=3.3-Math.min(3.3,n.v);r>0&&(i=Math.max(r,.1)*10*5e3)}i>5e3&&console.log("Scheduling next data fetch in "+i+"ms"),e&&clearTimeout(e),e=setTimeout(l,i),vs=0}).catch(n=>{vs++,vs>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(l,15e3)):e=setTimeout(l,oi(al.board)?1e4:5e3)})}return l(),function(){clearTimeout(e)}});let ir={},yi;const yr=at(ir);async function qc(){let t=!1;if(yr.update(e=>{for(var l=0;l<36;l++){if(e[Le(l)]==null){t=l<12;break}e[Le(l)]=e[Le(l+1)]}return e}),t)Bc();else{let e=new Date;yi=setTimeout(qc,(60-e.getMinutes())*6e4)}}async function Bc(){yi&&(clearTimeout(yi),yi=0),ir=await(await Hl("/energyprice.json")).json(),yr.set(ir);let e=new Date;yi=setTimeout(qc,(60-e.getMinutes())*6e4)}let sr={},an;async function Cr(){an&&(clearTimeout(an),an=0),sr=await(await Hl("/dayplot.json")).json(),Uc.set(sr);let e=new Date;an=setTimeout(Cr,(60-e.getMinutes())*6e4+20)}const Uc=at(sr,t=>(Cr(),function(){}));let rr={},un;async function Mr(){un&&(clearTimeout(un),un=0),rr=await(await Hl("/monthplot.json")).json(),Hc.set(rr);let e=new Date;un=setTimeout(Mr,(24-e.getHours())*36e5+40)}const Hc=at(rr,t=>(Mr(),function(){}));let or={};async function jc(){or=await(await Hl("/temperature.json")).json(),Wc.set(or)}const Wc=at(or,t=>(jc(),function(){}));let ar={},hs;async function zc(){hs&&(clearTimeout(hs),hs=0),ar=await(await Hl("/tariff.json")).json(),Gc.set(ar);let e=new Date;hs=setTimeout(zc,(60-e.getMinutes())*6e4+30)}const Gc=at(ar,t=>function(){});let ur=[];const Sr=at(ur);async function S1(){ur=await(await Hl("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),Sr.set(ur)}function Ms(t){return"WARNING: "+t+" must be connected to an external power supply during firmware upgrade. Failure to do so may cause power-down during upload resulting in non-functioning unit."}async function Vc(t){await(await fetch("/upgrade?expected_version="+t,{method:"POST"})).json()}function Kc(t,e){if(/^v\d{1,2}\.\d{1,2}\.\d{1,2}$/.test(t)){let l=t.substring(1).split("."),n=parseInt(l[0]),i=parseInt(l[1]),r=parseInt(l[2]),u=[...e];u.reverse();let a,c,f;for(let _=0;_r&&(a=p):S==i+1&&(c=p);else if(d==n+1)if(f){let $=f.tag_name.substring(1).split(".");parseInt($[0]);let N=parseInt($[1]);parseInt($[2]),S==N&&(f=p)}else f=p}return c||f||a||!1}else return e[0]}const $1="/github.svg";function nu(t){let e,l;function n(u,a){return u[1]>1?I1:u[1]>0?D1:u[2]>1?P1:u[2]>0?E1:u[3]>1?A1:u[3]>0?N1:T1}let i=n(t),r=i(t);return{c(){e=T(`Up +Occurred in: ${i}`:"",u=gr(t),a=mc(e)?e(u):e;return`<${u}> ${a}${r}`}const $c=t=>(...e)=>t(E0(...e)),Tc=$c(t=>{throw new Error(t)}),ys=$c(console.warn),Ua=4,P0=3,D0=2,I0=1,R0=1;function O0(t,e){const l=t.default?0:ml(t.fullPath).reduce((n,i)=>{let r=n;return r+=Ua,w0(i)?r+=R0:y0(i)?r+=D0:kc(i)?r-=Ua+I0:r+=P0,r},0);return{route:t,score:l,index:e}}function L0(t){return t.map(O0).sort((e,l)=>e.scorel.score?-1:e.index-l.index)}function Nc(t,e){let l,n;const[i]=e.split("?"),r=ml(i),u=r[0]==="",a=L0(t);for(let c=0,f=a.length;c({..._,params:b,uri:$});if(_.default){n=v(e);continue}const d=ml(_.fullPath),S=Math.max(r.length,d.length);let y=0;for(;y{f===".."?c.pop():f!=="."&&c.push(f)}),Ks(`/${c.join("/")}`,n)}function Ha(t,e){const{pathname:l,hash:n="",search:i="",state:r}=t,u=ml(e,!0),a=ml(l,!0);for(;u.length;)u[0]!==a[0]&&Tc(mn,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),u.shift(),a.shift();return{pathname:Ai(...a),hash:n,search:i,state:r}}const ja=t=>t.length===1?"":t,kr=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,r=i?ja(wi(t,l)):"",u=i?wi(t,0,l):t,a=n?ja(wi(u,e)):"";return{pathname:(n?wi(u,0,e):u)||"/",search:a,hash:r}},q0=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function B0(t,e,l){return Ai(l,F0(t,e))}function U0(t,e){const l=hr(C0(t)),n=ml(l,!0),i=ml(e,!0).slice(0,n.length),r=Ac({fullPath:l},Ai(...i));return r&&r.uri}const Ys="POP",H0="PUSH",j0="REPLACE";function Qs(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function W0(t){let e=[],l=Qs(t),n=Ys;const i=(r=e)=>r.forEach(u=>u({location:l,action:n}));return{get location(){return l},listen(r){e.push(r);const u=()=>{l=Qs(t),n=Ys,i([r])};i([r]);const a=dc(t,"popstate",u);return()=>{a(),e=e.filter(c=>c!==r)}},navigate(r,u){const{state:a={},replace:c=!1}=u||{};if(n=c?j0:H0,pc(r))u&&ys(Sc,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=Ys,t.history.go(r);else{const f={...a,_key:h0()};try{t.history[c?"replaceState":"pushState"](f,"",r)}catch{t.location[c?"replace":"assign"](r)}}l=Qs(t),i()}}}function Xs(t,e){return{...kr(e),state:t}}function z0(t="/"){let e=0,l=[Xs(null,t)];return{get entries(){return l},get location(){return l[e]},addEventListener(){},removeEventListener(){},history:{get state(){return l[e].state},pushState(n,i,r){e++,l=l.slice(0,e),l.push(Xs(n,r))},replaceState(n,i,r){l[e]=Xs(n,r)},go(n){const i=e+n;i<0||i>l.length-1||(e=i)}}}}const G0=!!(!Ul&&window.document&&window.document.createElement),V0=!Ul&&window.location.origin==="null",Ec=W0(G0&&!V0?window:z0()),{navigate:ri}=Ec;let $l=null,Pc=!0;function K0(t,e){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;n$l.level||t.level===$l.level&&K0(t.routerId,$l.routerId))&&($l=t)}function Q0(){$l=null}function X0(){Pc=!1}function Wa(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=dc(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function Z0(t,e){return Number(t.dataset.svnavRouteEnd)===e}function J0(t){return/^H[1-6]$/i.test(t.tagName)}function za(t,e=document){return e.querySelector(t)}function x0(t){let l=za(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!Z0(l,t);){if(J0(l))return l;const n=za("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function e1(t){Promise.resolve(ai(t.focusElement)).then(e=>{const l=e||x0(t.id);l||ys(mn,`Could not find an element to focus. You should always render a header for accessibility reasons, or set a custom focus element via the "useFocus" hook. If you don't want this Route or Router to manage focus, pass "primary={false}" to it.`,t,$s),!Wa(l)&&Wa(document.documentElement)})}const t1=(t,e,l)=>(n,i)=>m0().then(()=>{if(!$l||Pc){X0();return}if(n&&e1($l.route),t.announcements&&i){const{path:r,fullPath:u,meta:a,params:c,uri:f}=$l.route,_=t.createAnnouncement({path:r,fullPath:u,meta:a,params:c,uri:f},ai(l));Promise.resolve(_).then(p=>{e.set(p)})}Q0()}),l1="position:fixed;top:-1px;left:0;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;";function n1(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},vc(t[6],l1)],i={};for(let r=0;r`Navigated to ${ue.uri}`,announcements:!0,...d},$=_,N=hr(_),P=Bl(tr),B=Bl(fi),E=!P,O=s1(),L=v&&!(B&&!B.manageFocus),F=at("");ul(t,F,ue=>l(0,a=ue));const x=B?B.disableInlineStyles:S,H=at([]);ul(t,H,ue=>l(20,u=ue));const z=at(null);ul(t,z,ue=>l(18,i=ue));let G=!1;const V=E?0:B.level+1,U=E?at((()=>Ha(Ul?kr(p):b.location,N))()):P;ul(t,U,ue=>l(17,n=ue));const K=at(n);ul(t,K,ue=>l(19,r=ue));const j=t1(y,F,U),Y=ue=>ke=>ke.filter(me=>me.id!==ue);function X(ue){if(Ul){if(G)return;const ke=Ac(ue,n.pathname);if(ke)return G=!0,ke}else H.update(ke=>{const me=Y(ue.id)(ke);return me.push(ue),me})}function oe(ue){H.update(Y(ue))}return!E&&_!==Ga&&ys(mn,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:_}),E&&(oc(()=>b.listen(ke=>{const me=Ha(ke.location,N);K.set(n),U.set(me)})),Si(tr,U)),Si(fi,{activeRoute:z,registerRoute:X,unregisterRoute:oe,manageFocus:L,level:V,id:O,history:E?b:B.history,basepath:E?N:B.basepath,disableInlineStyles:x}),t.$$set=ue=>{"basepath"in ue&&l(11,_=ue.basepath),"url"in ue&&l(12,p=ue.url),"history"in ue&&l(13,b=ue.history),"primary"in ue&&l(14,v=ue.primary),"a11y"in ue&&l(15,d=ue.a11y),"disableInlineStyles"in ue&&l(16,S=ue.disableInlineStyles),"$$scope"in ue&&l(21,f=ue.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&_!==$&&ys(mn,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const ue=Nc(u,n.pathname);z.set(ue)}if(t.$$.dirty[0]&655360&&E){const ue=!!n.hash,ke=!ue&&L,me=!ue||n.pathname!==r.pathname;j(ke,me)}t.$$.dirty[0]&262144&&L&&i&&i.primary&&Y0({level:V,routerId:O,route:i})},[a,y,E,O,L,F,x,H,z,U,K,_,p,b,v,d,S,n,i,r,u,f,c]}class o1 extends Pe{constructor(e){super(),Ee(this,e,r1,i1,Ne,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}const Dc=o1;function Ei(t,e,l=fi,n=mn){Bl(l)||Tc(t,r=>`You cannot use ${r} outside of a ${gr(n)}.`,e)}const a1=t=>{const{subscribe:e}=Bl(t);return{subscribe:e}};function Ic(){return Ei(yc),a1(tr)}function Rc(){const{history:t}=Bl(fi);return t}function Oc(){const t=Bl(bc);return t?b0(t,e=>e.base):at("/")}function Lc(){Ei(Mc);const t=Oc(),{basepath:e}=Bl(fi);return n=>B0(n,ai(t),e)}function u1(){Ei(Cc);const t=Lc(),{navigate:e}=Rc();return(n,i)=>{const r=pc(n)?n:t(n);return e(r,i)}}const f1=t=>({params:t&16,location:t&8}),Va=t=>({params:Ul?ai(t[10]):t[4],location:t[3],navigate:t[11]});function Ka(t){let e,l;return e=new Dc({props:{primary:t[1],$$slots:{default:[p1]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const r={};i&2&&(r.primary=n[1]),i&528409&&(r.$$scope={dirty:i,ctx:n}),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function c1(t){let e;const l=t[18].default,n=pr(l,t,t[19],Va);return{c(){n&&n.c()},m(i,r){n&&n.m(i,r),e=!0},p(i,r){n&&n.p&&(!e||r&524312)&&dr(n,l,i,i[19],e?_r(l,i[19],r,f1):vr(i[19]),Va)},i(i){e||(D(n,i),e=!0)},o(i){q(n,i),e=!1},d(i){n&&n.d(i)}}}function m1(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},Ul?ai(t[10]):t[4],t[12]];var r=t[0];function u(a){let c={};for(let f=0;f{ne(_,1)}),Ie()}r?(e=La(r,u()),ie(e.$$.fragment),D(e.$$.fragment,1),le(e,l.parentNode,l)):e=null}else r&&e.$set(f)},i(a){n||(e&&D(e.$$.fragment,a),n=!0)},o(a){e&&q(e.$$.fragment,a),n=!1},d(a){a&&C(l),e&&ne(e,a)}}}function p1(t){let e,l,n,i;const r=[m1,c1],u=[];function a(c,f){return c[0]!==null?0:1}return e=a(t),l=u[e]=r[e](t),{c(){l.c(),n=Ve()},m(c,f){u[e].m(c,f),M(c,n,f),i=!0},p(c,f){let _=e;e=a(c),e===_?u[e].p(c,f):(De(),q(u[_],1,1,()=>{u[_]=null}),Ie(),l=u[e],l?l.p(c,f):(l=u[e]=r[e](c),l.c()),D(l,1),l.m(n.parentNode,n))},i(c){i||(D(l),i=!0)},o(c){q(l),i=!1},d(c){u[e].d(c),c&&C(n)}}}function _1(t){let e,l,n,i,r,u=[er(t[7]),{"data-svnav-route-start":t[5]}],a={};for(let p=0;p{c=null}),Ie())},i(p){r||(D(c),r=!0)},o(p){q(c),r=!1},d(p){p&&C(e),p&&C(l),c&&c.d(p),p&&C(n),p&&C(i)}}}const d1=_c();function v1(t,e,l){let n;const i=["path","component","meta","primary"];let r=ks(e,i),u,a,c,f,{$$slots:_={},$$scope:p}=e,{path:b=""}=e,{component:v=null}=e,{meta:d={}}=e,{primary:S=!0}=e;Ei($s,e);const y=d1(),{registerRoute:$,unregisterRoute:N,activeRoute:P,disableInlineStyles:B}=Bl(fi);ul(t,P,G=>l(16,u=G));const E=Oc();ul(t,E,G=>l(17,c=G));const O=Ic();ul(t,O,G=>l(3,a=G));const L=at(null);let F;const x=at(),H=at({});ul(t,H,G=>l(4,f=G)),Si(bc,x),Si(g0,H),Si(k0,L);const z=u1();return Ul||f0(()=>N(y)),t.$$set=G=>{l(24,e=xt(xt({},e),gs(G))),l(12,r=ks(e,i)),"path"in G&&l(13,b=G.path),"component"in G&&l(0,v=G.component),"meta"in G&&l(14,d=G.meta),"primary"in G&&l(1,S=G.primary),"$$scope"in G&&l(19,p=G.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const G=b==="",V=Ai(c,b),W={id:y,path:b,meta:d,default:G,fullPath:G?"":V,base:G?c:U0(V,a.pathname),primary:S,focusElement:L};x.set(W),l(15,F=$(W))}if(t.$$.dirty&98304&&l(2,n=!!(F||u&&u.id===y)),t.$$.dirty&98308&&n){const{params:G}=F||u;H.set(G)}},e=gs(e),[v,S,n,a,f,y,P,B,E,O,H,z,r,b,d,F,u,c,_,p]}class h1 extends Pe{constructor(e){super(),Ee(this,e,v1,_1,Ne,{path:13,component:0,meta:14,primary:1})}}const Sl=h1;function b1(t){let e,l,n,i;const r=t[13].default,u=pr(r,t,t[12],null);let a=[{href:t[0]},t[2],t[1]],c={};for(let f=0;fl(11,p=L));const P=c0(),B=Lc(),{navigate:E}=Rc();function O(L){P("click",L),v0(L)&&(L.preventDefault(),E(n,{state:y,replace:u||S}))}return t.$$set=L=>{l(19,e=xt(xt({},e),gs(L))),l(18,_=ks(e,f)),"to"in L&&l(5,d=L.to),"replace"in L&&l(6,S=L.replace),"state"in L&&l(7,y=L.state),"getProps"in L&&l(8,$=L.getProps),"$$scope"in L&&l(12,v=L.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=B(d,p)),t.$$.dirty&2049&&l(10,i=lr(p.pathname,n)),t.$$.dirty&2049&&l(9,r=n===p.pathname),t.$$.dirty&2049&&(u=kr(n)===q0(p)),t.$$.dirty&512&&l(2,a=r?{"aria-current":"page"}:{}),l(1,c=(()=>{if(mc($)){const L=$({location:p,href:n,isPartiallyCurrent:i,isCurrent:r});return{..._,...L}}return _})())},e=gs(e),[n,c,a,N,O,d,S,y,$,r,i,p,v,b]}class k1 extends Pe{constructor(e){super(),Ee(this,e,g1,b1,Ne,{to:5,replace:6,state:7,getProps:8})}}const el=k1;let nr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function ql(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function w1(t){return t>218&&t<242?"#32d900":t>212&&t<248?"#b1d900":t>208&&t<252?"#ffb800":"#d90000"}function Fc(t,e){let l;return t>90?l="#d90000":t>85?l="#e32100":t>80?l="#ffb800":t>75?l="#dcd800":l="#32d900",l+(e?"88":"")}function y1(t){return t>75?"#32d900":t>50?"#77d900":t>25?"#94d900":"#dcd800"}function Cs(t){switch(t){case 1:return"Aidon";case 2:return"Kaifa";case 3:return"Kamstrup";case 8:return"Iskra";case 9:return"Landis+Gyr";case 10:return"Sagemcom";default:return"Unknown"}}function Le(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function be(t,e){switch(e){case 5:switch(t){case"esp8266":return"Pow-K (GPIO12)";case"esp32s2":return"Pow-K+"}case 7:switch(t){case"esp8266":return"Pow-U (GPIO12)";case"esp32s2":return"Pow-U+"}case 6:return"Pow-P1";case 51:return"Wemos S2 mini";case 50:return"Generic ESP32-S2";case 201:return"Wemos LOLIN D32";case 202:return"Adafruit HUZZAH32";case 203:return"DevKitC";case 200:return"Generic ESP32";case 2:return"HAN Reader 2.0 by Max Spencer";case 0:return"Custom hardware by Roar Fredriksen";case 1:return"Kamstrup module by Egil Opsahl";case 8:return"\xB5HAN mosquito by dbeinder";case 3:return"Pow-K (UART0)";case 4:return"Pow-U (UART0)";case 101:return"Wemos D1 mini";case 100:return"Generic ESP8266";case 70:return"Generic ESP32-C3";case 71:return"ESP32-C3-DevKitM-1"}}function Ya(t){switch(t){case-1:return"Parse error";case-2:return"Incomplete data received";case-3:return"Payload boundry flag missing";case-4:return"Header checksum error";case-5:return"Footer checksum error";case-9:return"Unknown data received, check meter config";case-41:return"Frame length not equal";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid";case 90:return"No HAN data received for at least 30s";case 91:return"Serial break";case 92:return"Serial buffer full";case 93:return"Serial FIFO overflow";case 94:return"Serial frame error";case 95:return"Serial parity error";case 96:return"RX error";case 98:return"Exception in code, debugging necessary";case 99:return"Autodetection failed"}return t<0?"Unspecified error "+t:""}function Qa(t){switch(t){case-3:return"Connection failed";case-4:return"Network timeout";case-10:return"Connection denied";case-11:return"Failed to subscribe";case-13:return"Connection lost"}return t<0?"Unspecified error "+t:""}function Xa(t){switch(t){case 400:return"Unrecognized data in request";case 401:case 403:return"Unauthorized, check API key";case 404:return"Price unavailable, not found";case 425:return"Server says its too early";case 429:return"Exceeded API rate limit";case 500:return"Internal server error";case-1:return"Connection error";case-2:return"Incomplete data received";case-3:return"Invalid data, tag missing";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid"}return t<0?"Unspecified error "+t:""}function Za(t){switch(t){case 255:return"Unable to start upgrade";case-1:return"Connection refused";case-2:return"Failed to send headers";case-3:return"Failed to send payload";case-4:return"Not connected";case-5:return"Connection lost";case-6:return"No stream";case-7:return"Not a HTTP server";case-8:return"Not enough memory";case-9:return"Encoding error";case-10:return"Stream write";case-11:return"Read timeout"}return"Unknown "+t}function oi(t){switch(t){case 2:case 4:case 7:return!0}return!1}function Ke(t,e){return t==1||t==2&&e}function Ut(t){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+t}function ge(t,e){return isNaN(t)?"-":(isNaN(e)&&(e=t<10?1:0),t.toFixed(e))}function fl(t,e){return t.setTime(t.getTime()+e*36e5),t}function Ja(t){if(t.chip=="esp8266")switch(t.boot_reason){case 0:return"Normal";case 1:return"WDT reset";case 2:return"Exception reset";case 3:return"Soft WDT reset";case 4:return"Software restart";case 5:return"Deep sleep";case 6:return"External reset";default:return"Unknown (8266)"}else switch(t.boot_reason){case 1:return"Vbat power on reset";case 3:return"Software reset";case 4:return"WDT reset";case 5:return"Deep sleep";case 6:return"SLC reset";case 7:return"Timer Group0 WDT reset";case 8:return"Timer Group1 WDT reset";case 9:return"RTC WDT reset";case 10:return"Instrusion test reset CPU";case 11:return"Time Group reset CPU";case 12:return"Software reset CPU";case 13:return"RTC WTD reset CPU";case 14:return"PRO CPU";case 15:return"Brownout";case 16:return"RTC reset";default:return"Unknown"}}function xa(t){return t=="EOE"?"ENTSO-E":t=="HKS"?"hvakosterstrommen.no":t=="EDS"?"Energi Data Service":t=="MIX"?"Mixed sources":"Unknown ("+t+")"}function eu(t){return t=="EOE"?"https://transparency.entsoe.eu/-E":t=="HKS"?"https://www.hvakosterstrommen.no/":t=="EDS"?"https://www.energidataservice.dk/":"#"}async function Hl(t,e={}){const{timeout:l=8e3}=e,n=new AbortController,i=setTimeout(()=>n.abort(),l),r=await fetch(t,{...e,signal:n.signal});return clearTimeout(i),r}let al={version:"",chip:"",mac:null,apmac:null,vndcfg:null,usrcfg:null,fwconsent:null,booting:!1,upgrading:!1,ui:{},security:0,boot_reason:0,upgrade:{x:-1,e:0,f:null,t:null},trying:null};const Ht=at(al);async function wr(){al=await(await Hl("/sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),Ht.set(al)}let vs=0,tu=-127,lu=null,C1={};const M1=hc(C1,t=>{let e;async function l(){Hl("/data.json").then(n=>n.json()).then(n=>{t(n),tu!=n.t&&(tu=n.t,setTimeout(jc,2e3)),lu==null&&n.pe&&n.p!=null&&(lu=n.p,Bc()),al.upgrading?window.location.reload():(!al||!al.chip||al.booting||vs>1&&!oi(al.board))&&(wr(),an&&clearTimeout(an),an=setTimeout(Cr,2e3),un&&clearTimeout(un),un=setTimeout(Mr,3e3));let i=5e3;if(oi(al.board)&&n.v>2.5){let r=3.3-Math.min(3.3,n.v);r>0&&(i=Math.max(r,.1)*10*5e3)}i>5e3&&console.log("Scheduling next data fetch in "+i+"ms"),e&&clearTimeout(e),e=setTimeout(l,i),vs=0}).catch(n=>{vs++,vs>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(l,15e3)):e=setTimeout(l,oi(al.board)?1e4:5e3)})}return l(),function(){clearTimeout(e)}});let ir={},yi;const yr=at(ir);async function qc(){let t=!1;if(yr.update(e=>{for(var l=0;l<36;l++){if(e[Le(l)]==null){t=l<12;break}e[Le(l)]=e[Le(l+1)]}return e}),t)Bc();else{let e=new Date;yi=setTimeout(qc,(60-e.getMinutes())*6e4)}}async function Bc(){yi&&(clearTimeout(yi),yi=0),ir=await(await Hl("/energyprice.json")).json(),yr.set(ir);let e=new Date;yi=setTimeout(qc,(60-e.getMinutes())*6e4)}let sr={},an;async function Cr(){an&&(clearTimeout(an),an=0),sr=await(await Hl("/dayplot.json")).json(),Uc.set(sr);let e=new Date;an=setTimeout(Cr,(60-e.getMinutes())*6e4+20)}const Uc=at(sr,t=>(Cr(),function(){}));let rr={},un;async function Mr(){un&&(clearTimeout(un),un=0),rr=await(await Hl("/monthplot.json")).json(),Hc.set(rr);let e=new Date;un=setTimeout(Mr,(24-e.getHours())*36e5+40)}const Hc=at(rr,t=>(Mr(),function(){}));let or={};async function jc(){or=await(await Hl("/temperature.json")).json(),Wc.set(or)}const Wc=at(or,t=>(jc(),function(){}));let ar={},hs;async function zc(){hs&&(clearTimeout(hs),hs=0),ar=await(await Hl("/tariff.json")).json(),Gc.set(ar);let e=new Date;hs=setTimeout(zc,(60-e.getMinutes())*6e4+30)}const Gc=at(ar,t=>function(){});let ur=[];const Sr=at(ur);async function S1(){ur=await(await Hl("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),Sr.set(ur)}function Ms(t){return"WARNING: "+t+" must be connected to an external power supply during firmware upgrade. Failure to do so may cause power-down during upload resulting in non-functioning unit."}async function Vc(t){await(await fetch("/upgrade?expected_version="+t,{method:"POST"})).json()}function Kc(t,e){if(/^v\d{1,2}\.\d{1,2}\.\d{1,2}$/.test(t)){let l=t.substring(1).split("."),n=parseInt(l[0]),i=parseInt(l[1]),r=parseInt(l[2]),u=[...e];u.reverse();let a,c,f;for(let _=0;_r&&(a=p):S==i+1&&(c=p);else if(d==n+1)if(f){let $=f.tag_name.substring(1).split(".");parseInt($[0]);let N=parseInt($[1]);parseInt($[2]),S==N&&(f=p)}else f=p}return c||f||a||!1}else return e[0]}const $1="/github.svg";function nu(t){let e,l;function n(u,a){return u[1]>1?I1:u[1]>0?D1:u[2]>1?P1:u[2]>0?E1:u[3]>1?A1:u[3]>0?N1:T1}let i=n(t),r=i(t);return{c(){e=T(`Up `),r.c(),l=Ve()},m(u,a){M(u,e,a),r.m(u,a),M(u,l,a)},p(u,a){i===(i=n(u))&&r?r.p(u,a):(r.d(1),r=i(u),r&&(r.c(),r.m(l.parentNode,l)))},d(u){u&&C(e),r.d(u),u&&C(l)}}}function T1(t){let e,l;return{c(){e=T(t[0]),l=T(" seconds")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&1&&Z(e,n[0])},d(n){n&&C(e),n&&C(l)}}}function N1(t){let e,l;return{c(){e=T(t[3]),l=T(" minute")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&8&&Z(e,n[3])},d(n){n&&C(e),n&&C(l)}}}function A1(t){let e,l;return{c(){e=T(t[3]),l=T(" minutes")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&8&&Z(e,n[3])},d(n){n&&C(e),n&&C(l)}}}function E1(t){let e,l;return{c(){e=T(t[2]),l=T(" hour")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&4&&Z(e,n[2])},d(n){n&&C(e),n&&C(l)}}}function P1(t){let e,l;return{c(){e=T(t[2]),l=T(" hours")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&4&&Z(e,n[2])},d(n){n&&C(e),n&&C(l)}}}function D1(t){let e,l;return{c(){e=T(t[1]),l=T(" day")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&2&&Z(e,n[1])},d(n){n&&C(e),n&&C(l)}}}function I1(t){let e,l;return{c(){e=T(t[1]),l=T(" days")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&2&&Z(e,n[1])},d(n){n&&C(e),n&&C(l)}}}function R1(t){let e,l=t[0]&&nu(t);return{c(){l&&l.c(),e=Ve()},m(n,i){l&&l.m(n,i),M(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=nu(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:fe,o:fe,d(n){l&&l.d(n),n&&C(e)}}}function O1(t,e,l){let{epoch:n}=e,i=0,r=0,u=0;return t.$$set=a=>{"epoch"in a&&l(0,n=a.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(l(1,i=Math.floor(n/86400)),l(2,r=Math.floor(n/3600)),l(3,u=Math.floor(n/60)))},[n,i,r,u]}class L1 extends Pe{constructor(e){super(),Ee(this,e,O1,R1,Ne,{epoch:0})}}function F1(t){let e,l,n;return{c(){e=m("span"),l=T(t[2]),o(e,"title",t[1]),o(e,"class",n="bd-"+t[0])},m(i,r){M(i,e,r),s(e,l)},p(i,[r]){r&4&&Z(l,i[2]),r&2&&o(e,"title",i[1]),r&1&&n!==(n="bd-"+i[0])&&o(e,"class",n)},i:fe,o:fe,d(i){i&&C(e)}}}function q1(t,e,l){let{color:n}=e,{title:i}=e,{text:r}=e;return t.$$set=u=>{"color"in u&&l(0,n=u.color),"title"in u&&l(1,i=u.title),"text"in u&&l(2,r=u.text)},[n,i,r]}class fn extends Pe{constructor(e){super(),Ee(this,e,q1,F1,Ne,{color:0,title:1,text:2})}}function B1(t){let e,l=`${Le(t[0].getDate())}.${Le(t[0].getMonth()+1)}.${t[0].getFullYear()} ${Le(t[0].getHours())}:${Le(t[0].getMinutes())}`,n;return{c(){e=m("span"),n=T(l),o(e,"class",t[1])},m(i,r){M(i,e,r),s(e,n)},p(i,r){r&1&&l!==(l=`${Le(i[0].getDate())}.${Le(i[0].getMonth()+1)}.${i[0].getFullYear()} ${Le(i[0].getHours())}:${Le(i[0].getMinutes())}`)&&Z(n,l),r&2&&o(e,"class",i[1])},d(i){i&&C(e)}}}function U1(t){let e=`${Le(t[0].getDate())}. ${nr[t[0].getMonth()]} ${Le(t[0].getHours())}:${Le(t[0].getMinutes())}`,l;return{c(){l=T(e)},m(n,i){M(n,l,i)},p(n,i){i&1&&e!==(e=`${Le(n[0].getDate())}. ${nr[n[0].getMonth()]} ${Le(n[0].getHours())}:${Le(n[0].getMinutes())}`)&&Z(l,e)},d(n){n&&C(l)}}}function H1(t){let e;function l(r,u){return r[2]?U1:B1}let n=l(t),i=n(t);return{c(){i.c(),e=Ve()},m(r,u){i.m(r,u),M(r,e,u)},p(r,[u]){n===(n=l(r))&&i?i.p(r,u):(i.d(1),i=n(r),i&&(i.c(),i.m(e.parentNode,e)))},i:fe,o:fe,d(r){i.d(r),r&&C(e)}}}function j1(t,e,l){let{timestamp:n}=e,{fullTimeColor:i}=e,{offset:r}=e,u;return t.$$set=a=>{"timestamp"in a&&l(0,n=a.timestamp),"fullTimeColor"in a&&l(1,i=a.fullTimeColor),"offset"in a&&l(3,r=a.offset)},t.$$.update=()=>{t.$$.dirty&9&&(l(2,u=Math.abs(new Date().getTime()-n.getTime())<3e5),isNaN(r)||fl(n,r-(24+n.getHours()-n.getUTCHours())%24))},[n,i,u,r]}class Yc extends Pe{constructor(e){super(),Ee(this,e,j1,H1,Ne,{timestamp:0,fullTimeColor:1,offset:3})}}function W1(t){let e,l,n;return{c(){e=Fe("svg"),l=Fe("path"),n=Fe("path"),o(l,"stroke-linecap","round"),o(l,"stroke-linejoin","round"),o(l,"d","M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 011.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 01-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.397.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 01-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.505-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.107-1.204l-.527-.738a1.125 1.125 0 01.12-1.45l.773-.773a1.125 1.125 0 011.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894z"),o(n,"stroke-linecap","round"),o(n,"stroke-linejoin","round"),o(n,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),o(e,"xmlns","http://www.w3.org/2000/svg"),o(e,"fill","none"),o(e,"viewBox","0 0 24 24"),o(e,"stroke-width","1.5"),o(e,"stroke","currentColor"),o(e,"class","w-6 h-6")},m(i,r){M(i,e,r),s(e,l),s(e,n)},p:fe,i:fe,o:fe,d(i){i&&C(e)}}}class z1 extends Pe{constructor(e){super(),Ee(this,e,null,W1,Ne,{})}}function G1(t){let e,l;return{c(){e=Fe("svg"),l=Fe("path"),o(l,"stroke-linecap","round"),o(l,"stroke-linejoin","round"),o(l,"d","M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"),o(e,"xmlns","http://www.w3.org/2000/svg"),o(e,"fill","none"),o(e,"viewBox","0 0 24 24"),o(e,"stroke-width","1.5"),o(e,"stroke","currentColor"),o(e,"class","w-6 h-6")},m(n,i){M(n,e,i),s(e,l)},p:fe,i:fe,o:fe,d(n){n&&C(e)}}}class V1 extends Pe{constructor(e){super(),Ee(this,e,null,G1,Ne,{})}}function K1(t){let e,l;return{c(){e=Fe("svg"),l=Fe("path"),o(l,"stroke-linecap","round"),o(l,"stroke-linejoin","round"),o(l,"d","M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"),o(e,"xmlns","http://www.w3.org/2000/svg"),o(e,"fill","none"),o(e,"viewBox","0 0 24 24"),o(e,"stroke-width","1.5"),o(e,"stroke","currentColor"),o(e,"class","w-6 h-6")},m(n,i){M(n,e,i),s(e,l)},p:fe,i:fe,o:fe,d(n){n&&C(e)}}}class Bt extends Pe{constructor(e){super(),Ee(this,e,null,K1,Ne,{})}}function Y1(t){let e,l;return{c(){e=Fe("svg"),l=Fe("path"),o(l,"stroke-linecap","round"),o(l,"stroke-linejoin","round"),o(l,"d","M9 8.25H7.5a2.25 2.25 0 00-2.25 2.25v9a2.25 2.25 0 002.25 2.25h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25H15M9 12l3 3m0 0l3-3m-3 3V2.25"),o(e,"xmlns","http://www.w3.org/2000/svg"),o(e,"fill","none"),o(e,"viewBox","0 0 24 24"),o(e,"stroke-width","1.5"),o(e,"stroke","currentColor"),o(e,"class","w-6 h-6")},m(n,i){M(n,e,i),s(e,l)},p:fe,i:fe,o:fe,d(n){n&&C(e)}}}class Qc extends Pe{constructor(e){super(),Ee(this,e,null,Y1,Ne,{})}}function Q1(t){let e,l,n=t[1].version+"",i;return{c(){e=T("AMS reader "),l=m("span"),i=T(n)},m(r,u){M(r,e,u),M(r,l,u),s(l,i)},p(r,u){u&2&&n!==(n=r[1].version+"")&&Z(i,n)},d(r){r&&C(e),r&&C(l)}}}function iu(t){let e,l=(t[0].t>-50?t[0].t.toFixed(1):"-")+"",n,i;return{c(){e=m("div"),n=T(l),i=T("\xB0C"),o(e,"class","flex-none my-auto")},m(r,u){M(r,e,u),s(e,n),s(e,i)},p(r,u){u&1&&l!==(l=(r[0].t>-50?r[0].t.toFixed(1):"-")+"")&&Z(n,l)},d(r){r&&C(e)}}}function su(t){let e,l="HAN: "+Ya(t[0].he),n;return{c(){e=m("div"),n=T(l),o(e,"class","bd-red")},m(i,r){M(i,e,r),s(e,n)},p(i,r){r&1&&l!==(l="HAN: "+Ya(i[0].he))&&Z(n,l)},d(i){i&&C(e)}}}function ru(t){let e,l="MQTT: "+Qa(t[0].me),n;return{c(){e=m("div"),n=T(l),o(e,"class","bd-red")},m(i,r){M(i,e,r),s(e,n)},p(i,r){r&1&&l!==(l="MQTT: "+Qa(i[0].me))&&Z(n,l)},d(i){i&&C(e)}}}function ou(t){let e,l="PriceAPI: "+Xa(t[0].ee),n;return{c(){e=m("div"),n=T(l),o(e,"class","bd-red")},m(i,r){M(i,e,r),s(e,n)},p(i,r){r&1&&l!==(l="PriceAPI: "+Xa(i[0].ee))&&Z(n,l)},d(i){i&&C(e)}}}function au(t){let e,l,n,i,r,u;return l=new el({props:{to:"/configuration",$$slots:{default:[X1]},$$scope:{ctx:t}}}),r=new el({props:{to:"/status",$$slots:{default:[Z1]},$$scope:{ctx:t}}}),{c(){e=m("div"),ie(l.$$.fragment),n=h(),i=m("div"),ie(r.$$.fragment),o(e,"class","flex-none px-1 mt-1"),o(e,"title","Configuration"),o(i,"class","flex-none px-1 mt-1"),o(i,"title","Device information")},m(a,c){M(a,e,c),le(l,e,null),M(a,n,c),M(a,i,c),le(r,i,null),u=!0},i(a){u||(D(l.$$.fragment,a),D(r.$$.fragment,a),u=!0)},o(a){q(l.$$.fragment,a),q(r.$$.fragment,a),u=!1},d(a){a&&C(e),ne(l),a&&C(n),a&&C(i),ne(r)}}}function X1(t){let e,l;return e=new z1({}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function Z1(t){let e,l;return e=new V1({}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function uu(t){let e,l,n,i,r;const u=[x1,J1],a=[];function c(f,_){return f[1].security==0||f[0].a?0:1}return l=c(t),n=a[l]=u[l](t),{c(){e=m("div"),n.c(),o(e,"class","flex-none mr-3 text-yellow-500"),o(e,"title",i="New version: "+t[2].tag_name)},m(f,_){M(f,e,_),a[l].m(e,null),r=!0},p(f,_){let p=l;l=c(f),l===p?a[l].p(f,_):(De(),q(a[p],1,1,()=>{a[p]=null}),Ie(),n=a[l],n?n.p(f,_):(n=a[l]=u[l](f),n.c()),D(n,1),n.m(e,null)),(!r||_&4&&i!==(i="New version: "+f[2].tag_name))&&o(e,"title",i)},i(f){r||(D(n),r=!0)},o(f){q(n),r=!1},d(f){f&&C(e),a[l].d()}}}function J1(t){let e,l,n=t[2].tag_name+"",i;return{c(){e=m("span"),l=T("New version: "),i=T(n)},m(r,u){M(r,e,u),s(e,l),s(e,i)},p(r,u){u&4&&n!==(n=r[2].tag_name+"")&&Z(i,n)},i:fe,o:fe,d(r){r&&C(e)}}}function x1(t){let e,l,n,i=t[2].tag_name+"",r,u,a,c,f,_;return a=new Qc({}),{c(){e=m("button"),l=m("span"),n=T("New version: "),r=T(i),u=h(),ie(a.$$.fragment),o(l,"class","mt-1"),o(e,"class","flex")},m(p,b){M(p,e,b),s(e,l),s(l,n),s(l,r),s(e,u),le(a,e,null),c=!0,f||(_=ee(e,"click",t[3]),f=!0)},p(p,b){(!c||b&4)&&i!==(i=p[2].tag_name+"")&&Z(r,i)},i(p){c||(D(a.$$.fragment,p),c=!0)},o(p){q(a.$$.fragment,p),c=!1},d(p){p&&C(e),ne(a),f=!1,_()}}}function em(t){let e,l,n,i,r,u,a,c,f,_,p,b,v=(t[0].m?(t[0].m/1e3).toFixed(1):"-")+"",d,S,y,$,N,P,B,E,O,L,F,x,H,z,G,V,W,U,K,j,Y,X,oe,ue,ke,me,$e,He,Re,je;i=new el({props:{to:"/",$$slots:{default:[Q1]},$$scope:{ctx:t}}}),c=new L1({props:{epoch:t[0].u}});let we=t[0].t>-50&&iu(t);N=new fn({props:{title:"ESP",text:t[1].booting?"Booting":t[0].v>2?t[0].v.toFixed(2)+"V":"ESP",color:ql(t[1].booting?2:t[0].em)}}),B=new fn({props:{title:"HAN",text:"HAN",color:ql(t[1].booting?9:t[0].hm)}}),O=new fn({props:{title:"WiFi",text:t[0].r?t[0].r.toFixed(0)+"dBm":"WiFi",color:ql(t[1].booting?9:t[0].wm)}}),F=new fn({props:{title:"MQTT",text:"MQTT",color:ql(t[1].booting?9:t[0].mm)}});let Te=(t[0].he<0||t[0].he>0)&&su(t),Oe=t[0].me<0&&ru(t),Me=(t[0].ee>0||t[0].ee<0)&&ou(t);oe=new Yc({props:{timestamp:t[0].c?new Date(t[0].c*1e3):new Date(0),offset:t[1].clock_offset,fullTimeColor:"text-red-500"}});let w=t[1].vndcfg&&t[1].usrcfg&&au(t);He=new Bt({});let g=t[1].fwconsent===1&&t[2]&&uu(t);return{c(){e=m("nav"),l=m("div"),n=m("div"),ie(i.$$.fragment),r=h(),u=m("div"),a=m("div"),ie(c.$$.fragment),f=h(),we&&we.c(),_=h(),p=m("div"),b=T("Free mem: "),d=T(v),S=T("kb"),y=h(),$=m("div"),ie(N.$$.fragment),P=h(),ie(B.$$.fragment),E=h(),ie(O.$$.fragment),L=h(),ie(F.$$.fragment),x=h(),Te&&Te.c(),H=h(),Oe&&Oe.c(),z=h(),Me&&Me.c(),G=h(),V=m("div"),W=m("div"),U=m("a"),K=m("img"),Y=h(),X=m("div"),ie(oe.$$.fragment),ue=h(),w&&w.c(),ke=h(),me=m("div"),$e=m("a"),ie(He.$$.fragment),Re=h(),g&&g.c(),o(n,"class","flex text-lg text-gray-100 p-2"),o(a,"class","flex-none my-auto"),o(p,"class","flex-none my-auto"),o(u,"class","flex-none my-auto p-2 flex space-x-4"),o($,"class","flex-auto flex-wrap my-auto justify-center p-2"),o(K,"class","gh-logo"),Js(K.src,j=$1)||o(K,"src",j),o(K,"alt","GitHub repo"),o(U,"class","float-right"),o(U,"href","https://github.com/UtilitechAS/amsreader-firmware"),o(U,"target","_blank"),o(U,"rel","noreferrer"),o(U,"aria-label","GitHub"),o(W,"class","flex-none"),o(X,"class","flex-none my-auto px-2"),o($e,"href",Ut("")),o($e,"target","_blank"),o($e,"rel","noreferrer"),o(me,"class","flex-none px-1 mt-1"),o(me,"title","Documentation"),o(V,"class","flex-auto p-2 flex flex-row-reverse flex-wrap"),o(l,"class","flex flex-wrap space-x-4 text-sm text-gray-300"),o(e,"class","bg-violet-600 p-1 rounded-md mx-2")},m(k,A){M(k,e,A),s(e,l),s(l,n),le(i,n,null),s(l,r),s(l,u),s(u,a),le(c,a,null),s(u,f),we&&we.m(u,null),s(u,_),s(u,p),s(p,b),s(p,d),s(p,S),s(l,y),s(l,$),le(N,$,null),s($,P),le(B,$,null),s($,E),le(O,$,null),s($,L),le(F,$,null),s(l,x),Te&&Te.m(l,null),s(l,H),Oe&&Oe.m(l,null),s(l,z),Me&&Me.m(l,null),s(l,G),s(l,V),s(V,W),s(W,U),s(U,K),s(V,Y),s(V,X),le(oe,X,null),s(V,ue),w&&w.m(V,null),s(V,ke),s(V,me),s(me,$e),le(He,$e,null),s(V,Re),g&&g.m(V,null),je=!0},p(k,[A]){const I={};A&18&&(I.$$scope={dirty:A,ctx:k}),i.$set(I);const Q={};A&1&&(Q.epoch=k[0].u),c.$set(Q),k[0].t>-50?we?we.p(k,A):(we=iu(k),we.c(),we.m(u,_)):we&&(we.d(1),we=null),(!je||A&1)&&v!==(v=(k[0].m?(k[0].m/1e3).toFixed(1):"-")+"")&&Z(d,v);const J={};A&3&&(J.text=k[1].booting?"Booting":k[0].v>2?k[0].v.toFixed(2)+"V":"ESP"),A&3&&(J.color=ql(k[1].booting?2:k[0].em)),N.$set(J);const se={};A&3&&(se.color=ql(k[1].booting?9:k[0].hm)),B.$set(se);const ce={};A&1&&(ce.text=k[0].r?k[0].r.toFixed(0)+"dBm":"WiFi"),A&3&&(ce.color=ql(k[1].booting?9:k[0].wm)),O.$set(ce);const ve={};A&3&&(ve.color=ql(k[1].booting?9:k[0].mm)),F.$set(ve),k[0].he<0||k[0].he>0?Te?Te.p(k,A):(Te=su(k),Te.c(),Te.m(l,H)):Te&&(Te.d(1),Te=null),k[0].me<0?Oe?Oe.p(k,A):(Oe=ru(k),Oe.c(),Oe.m(l,z)):Oe&&(Oe.d(1),Oe=null),k[0].ee>0||k[0].ee<0?Me?Me.p(k,A):(Me=ou(k),Me.c(),Me.m(l,G)):Me&&(Me.d(1),Me=null);const Se={};A&1&&(Se.timestamp=k[0].c?new Date(k[0].c*1e3):new Date(0)),A&2&&(Se.offset=k[1].clock_offset),oe.$set(Se),k[1].vndcfg&&k[1].usrcfg?w?A&2&&D(w,1):(w=au(k),w.c(),D(w,1),w.m(V,ke)):w&&(De(),q(w,1,1,()=>{w=null}),Ie()),k[1].fwconsent===1&&k[2]?g?(g.p(k,A),A&6&&D(g,1)):(g=uu(k),g.c(),D(g,1),g.m(V,null)):g&&(De(),q(g,1,1,()=>{g=null}),Ie())},i(k){je||(D(i.$$.fragment,k),D(c.$$.fragment,k),D(N.$$.fragment,k),D(B.$$.fragment,k),D(O.$$.fragment,k),D(F.$$.fragment,k),D(oe.$$.fragment,k),D(w),D(He.$$.fragment,k),D(g),je=!0)},o(k){q(i.$$.fragment,k),q(c.$$.fragment,k),q(N.$$.fragment,k),q(B.$$.fragment,k),q(O.$$.fragment,k),q(F.$$.fragment,k),q(oe.$$.fragment,k),q(w),q(He.$$.fragment,k),q(g),je=!1},d(k){k&&C(e),ne(i),ne(c),we&&we.d(),ne(N),ne(B),ne(O),ne(F),Te&&Te.d(),Oe&&Oe.d(),Me&&Me.d(),ne(oe),w&&w.d(),ne(He),g&&g.d()}}}function tm(t,e,l){let{data:n={}}=e,i={},r={};function u(){confirm("Do you want to upgrade this device to "+r.tag_name+"?")&&(!oi(i.board)||confirm(Ms(be(i.chip,i.board))))&&(Ht.update(a=>(a.upgrading=!0,a)),Vc(r.tag_name))}return Ht.subscribe(a=>{l(1,i=a),a.fwconsent===1&&S1()}),Sr.subscribe(a=>{l(2,r=Kc(i.version,a))}),t.$$set=a=>{"data"in a&&l(0,n=a.data)},[n,i,r,u]}class lm extends Pe{constructor(e){super(),Ee(this,e,tm,em,Ne,{data:0})}}function nm(t){let e,l,n,i;return{c(){e=Fe("svg"),l=Fe("path"),n=Fe("path"),o(l,"d",Zs(150,150,115,210,510)),o(l,"stroke","#eee"),o(l,"fill","none"),o(l,"stroke-width","55"),o(n,"d",i=Zs(150,150,115,210,210+300*t[0]/100)),o(n,"stroke",t[1]),o(n,"fill","none"),o(n,"stroke-width","55"),o(e,"viewBox","0 0 300 300"),o(e,"xmlns","http://www.w3.org/2000/svg"),o(e,"height","100%")},m(r,u){M(r,e,u),s(e,l),s(e,n)},p(r,[u]){u&1&&i!==(i=Zs(150,150,115,210,210+300*r[0]/100))&&o(n,"d",i),u&2&&o(n,"stroke",r[1])},i:fe,o:fe,d(r){r&&C(e)}}}function fu(t,e,l,n){var i=(n-90)*Math.PI/180;return{x:t+l*Math.cos(i),y:e+l*Math.sin(i)}}function Zs(t,e,l,n,i){var r=fu(t,e,l,i),u=fu(t,e,l,n),a=i-n<=180?"0":"1",c=["M",r.x,r.y,"A",l,l,0,a,0,u.x,u.y].join(" ");return c}function im(t,e,l){let{pct:n=0}=e,{color:i="red"}=e;return t.$$set=r=>{"pct"in r&&l(0,n=r.pct),"color"in r&&l(1,i=r.color)},[n,i]}class sm extends Pe{constructor(e){super(),Ee(this,e,im,nm,Ne,{pct:0,color:1})}}function cu(t){let e,l,n,i,r,u,a,c;return{c(){e=m("br"),l=h(),n=m("span"),i=T(t[3]),r=h(),u=m("span"),a=T(t[4]),c=T("/kWh"),o(n,"class","pl-sub"),o(u,"class","pl-snt")},m(f,_){M(f,e,_),M(f,l,_),M(f,n,_),s(n,i),M(f,r,_),M(f,u,_),s(u,a),s(u,c)},p(f,_){_&8&&Z(i,f[3]),_&16&&Z(a,f[4])},d(f){f&&C(e),f&&C(l),f&&C(n),f&&C(r),f&&C(u)}}}function rm(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y;l=new sm({props:{pct:t[6],color:t[5](t[6])}});let $=t[3]&&cu(t);return{c(){e=m("div"),ie(l.$$.fragment),n=h(),i=m("span"),r=m("span"),u=T(t[2]),a=h(),c=m("br"),f=h(),_=m("span"),p=T(t[0]),b=h(),v=m("span"),d=T(t[1]),S=h(),$&&$.c(),o(r,"class","pl-lab"),o(_,"class","pl-val"),o(v,"class","pl-unt"),o(i,"class","pl-ov"),o(e,"class","pl-root")},m(N,P){M(N,e,P),le(l,e,null),s(e,n),s(e,i),s(i,r),s(r,u),s(i,a),s(i,c),s(i,f),s(i,_),s(_,p),s(i,b),s(i,v),s(v,d),s(i,S),$&&$.m(i,null),y=!0},p(N,[P]){const B={};P&64&&(B.pct=N[6]),P&96&&(B.color=N[5](N[6])),l.$set(B),(!y||P&4)&&Z(u,N[2]),(!y||P&1)&&Z(p,N[0]),(!y||P&2)&&Z(d,N[1]),N[3]?$?$.p(N,P):($=cu(N),$.c(),$.m(i,null)):$&&($.d(1),$=null)},i(N){y||(D(l.$$.fragment,N),y=!0)},o(N){q(l.$$.fragment,N),y=!1},d(N){N&&C(e),ne(l),$&&$.d()}}}function om(t,e,l){let{val:n}=e,{max:i}=e,{unit:r}=e,{label:u}=e,{sub:a=""}=e,{subunit:c=""}=e,{colorFn:f}=e,_=0;return t.$$set=p=>{"val"in p&&l(0,n=p.val),"max"in p&&l(7,i=p.max),"unit"in p&&l(1,r=p.unit),"label"in p&&l(2,u=p.label),"sub"in p&&l(3,a=p.sub),"subunit"in p&&l(4,c=p.subunit),"colorFn"in p&&l(5,f=p.colorFn)},t.$$.update=()=>{t.$$.dirty&129&&l(6,_=Math.min(n,i)/i*100)},[n,r,u,a,c,f,_,i]}class Xc extends Pe{constructor(e){super(),Ee(this,e,om,rm,Ne,{val:0,max:7,unit:1,label:2,sub:3,subunit:4,colorFn:5})}}function mu(t,e,l){const n=t.slice();return n[11]=e[l],n[13]=l,n}function pu(t,e,l){const n=t.slice();return n[11]=e[l],n[13]=l,n}function _u(t,e,l){const n=t.slice();return n[15]=e[l],n}function du(t){let e,l,n,i,r,u,a=t[0].title&&vu(t),c=t[0].y.ticks,f=[];for(let d=0;dt[9].call(e))},m(r,u){M(r,e,u),s(e,n),i=rc(e,t[9].bind(e))},p(r,u){u&1&&l!==(l=r[0].title+"")&&Z(n,l)},d(r){r&&C(e),i()}}}function hu(t){let e,l,n,i=t[15].label+"",r,u,a,c;return{c(){e=Fe("g"),l=Fe("line"),n=Fe("text"),r=T(i),o(l,"x2","100%"),o(n,"y","-4"),o(n,"x",u=t[15].align=="right"?"85%":""),o(e,"class",a="tick tick-"+t[15].value+" tick-"+t[15].color),o(e,"transform",c="translate(0, "+t[7](t[15].value)+")")},m(f,_){M(f,e,_),s(e,l),s(e,n),s(n,r)},p(f,_){_&1&&i!==(i=f[15].label+"")&&Z(r,i),_&1&&u!==(u=f[15].align=="right"?"85%":"")&&o(n,"x",u),_&1&&a!==(a="tick tick-"+f[15].value+" tick-"+f[15].color)&&o(e,"class",a),_&129&&c!==(c="translate(0, "+f[7](f[15].value)+")")&&o(e,"transform",c)},d(f){f&&C(e)}}}function bu(t){let e=!isNaN(t[7](t[15].value)),l,n=e&&hu(t);return{c(){n&&n.c(),l=Ve()},m(i,r){n&&n.m(i,r),M(i,l,r)},p(i,r){r&129&&(e=!isNaN(i[7](i[15].value))),e?n?n.p(i,r):(n=hu(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&C(l)}}}function gu(t){let e,l,n=(t[3]>20||t[13]%2==0)&&ku(t);return{c(){e=Fe("g"),n&&n.c(),o(e,"class","tick"),o(e,"transform",l="translate("+t[6](t[13])+","+t[4]+")")},m(i,r){M(i,e,r),n&&n.m(e,null)},p(i,r){i[3]>20||i[13]%2==0?n?n.p(i,r):(n=ku(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null),r&80&&l!==(l="translate("+i[6](i[13])+","+i[4]+")")&&o(e,"transform",l)},d(i){i&&C(e),n&&n.d()}}}function ku(t){let e,l=t[11].label+"",n,i;return{c(){e=Fe("text"),n=T(l),o(e,"x",i=t[3]/2),o(e,"y","-4")},m(r,u){M(r,e,u),s(e,n)},p(r,u){u&1&&l!==(l=r[11].label+"")&&Z(n,l),u&8&&i!==(i=r[3]/2)&&o(e,"x",i)},d(r){r&&C(e)}}}function wu(t){let e=!isNaN(t[6](t[13])),l,n=e&&gu(t);return{c(){n&&n.c(),l=Ve()},m(i,r){n&&n.m(i,r),M(i,l,r)},p(i,r){r&64&&(e=!isNaN(i[6](i[13]))),e?n?n.p(i,r):(n=gu(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&C(l)}}}function yu(t){let e,l,n=t[11].value!==void 0&&Cu(t),i=t[11].value2>1e-4&&$u(t);return{c(){e=Fe("g"),n&&n.c(),l=Fe("g"),i&&i.c()},m(r,u){M(r,e,u),n&&n.m(e,null),M(r,l,u),i&&i.m(l,null)},p(r,u){r[11].value!==void 0?n?n.p(r,u):(n=Cu(r),n.c(),n.m(e,null)):n&&(n.d(1),n=null),r[11].value2>1e-4?i?i.p(r,u):(i=$u(r),i.c(),i.m(l,null)):i&&(i.d(1),i=null)},d(r){r&&C(e),n&&n.d(),r&&C(l),i&&i.d()}}}function Cu(t){let e,l,n,i,r,u,a,c=t[3]>15&&Mu(t);return{c(){e=Fe("rect"),c&&c.c(),a=Ve(),o(e,"x",l=t[6](t[13])+2),o(e,"y",n=t[7](t[11].value)),o(e,"width",i=t[3]-4),o(e,"height",r=t[7](t[0].y.min)-t[7](Math.min(t[0].y.min,0)+t[11].value)),o(e,"fill",u=t[11].color)},m(f,_){M(f,e,_),c&&c.m(f,_),M(f,a,_)},p(f,_){_&64&&l!==(l=f[6](f[13])+2)&&o(e,"x",l),_&129&&n!==(n=f[7](f[11].value))&&o(e,"y",n),_&8&&i!==(i=f[3]-4)&&o(e,"width",i),_&129&&r!==(r=f[7](f[0].y.min)-f[7](Math.min(f[0].y.min,0)+f[11].value))&&o(e,"height",r),_&1&&u!==(u=f[11].color)&&o(e,"fill",u),f[3]>15?c?c.p(f,_):(c=Mu(f),c.c(),c.m(a.parentNode,a)):c&&(c.d(1),c=null)},d(f){f&&C(e),c&&c.d(f),f&&C(a)}}}function Mu(t){let e,l=t[11].label+"",n,i,r,u,a,c,f=t[11].title&&Su(t);return{c(){e=Fe("text"),n=T(l),f&&f.c(),c=Ve(),o(e,"width",i=t[3]-4),o(e,"dominant-baseline","middle"),o(e,"text-anchor",r=t[3]t[7](0)-t[8]?t[11].color:"white"),o(e,"transform",a="translate("+(t[6](t[13])+t[3]/2)+" "+(t[7](t[11].value)>t[7](0)-t[8]?t[7](t[11].value)-t[8]:t[7](t[11].value)+10)+") rotate("+(t[3]_[7](0)-_[8]?_[11].color:"white")&&o(e,"fill",u),p&457&&a!==(a="translate("+(_[6](_[13])+_[3]/2)+" "+(_[7](_[11].value)>_[7](0)-_[8]?_[7](_[11].value)-_[8]:_[7](_[11].value)+10)+") rotate("+(_[3]15&&Tu(t);return{c(){e=Fe("rect"),c&&c.c(),a=Ve(),o(e,"x",l=t[6](t[13])+2),o(e,"y",n=t[7](0)),o(e,"width",i=t[3]-4),o(e,"height",r=t[7](t[0].y.min)-t[7](t[0].y.min+t[11].value2)),o(e,"fill",u=t[11].color2?t[11].color2:t[11].color)},m(f,_){M(f,e,_),c&&c.m(f,_),M(f,a,_)},p(f,_){_&64&&l!==(l=f[6](f[13])+2)&&o(e,"x",l),_&128&&n!==(n=f[7](0))&&o(e,"y",n),_&8&&i!==(i=f[3]-4)&&o(e,"width",i),_&129&&r!==(r=f[7](f[0].y.min)-f[7](f[0].y.min+f[11].value2))&&o(e,"height",r),_&1&&u!==(u=f[11].color2?f[11].color2:f[11].color)&&o(e,"fill",u),f[3]>15?c?c.p(f,_):(c=Tu(f),c.c(),c.m(a.parentNode,a)):c&&(c.d(1),c=null)},d(f){f&&C(e),c&&c.d(f),f&&C(a)}}}function Tu(t){let e,l=t[11].label2+"",n,i,r,u,a,c=t[11].title2&&Nu(t);return{c(){e=Fe("text"),n=T(l),c&&c.c(),a=Ve(),o(e,"width",i=t[3]-4),o(e,"dominant-baseline","middle"),o(e,"text-anchor","middle"),o(e,"fill",r=t[7](-t[11].value2)t[10].call(e))},m(i,r){M(i,e,r),n&&n.m(e,null),l=rc(e,t[10].bind(e))},p(i,[r]){i[0].x.ticks&&i[0].points&&i[4]?n?n.p(i,r):(n=du(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},i:fe,o:fe,d(i){i&&C(e),n&&n.d(),l()}}}let cn=30;function um(t,e,l){let{config:n}=e,i,r,u,a,c,f,_,p=0;function b(){p=this.clientHeight,l(5,p)}function v(){i=this.clientWidth,r=this.clientHeight,l(1,i),l(2,r)}return t.$$set=d=>{"config"in d&&l(0,n=d.config)},t.$$.update=()=>{if(t.$$.dirty&63){l(4,f=r-p);let d=i-(n.padding.left+n.padding.right);l(3,u=d/n.points.length),l(8,_=un.y.max?$=n.padding.bottom:yf||$<0?0:$})}},[n,i,r,u,f,p,a,c,_,b,v]}class pn extends Pe{constructor(e){super(),Ee(this,e,um,am,Ne,{config:0})}}function fm(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,[i]){const r={};i&1&&(r.config=n[0]),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function cm(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:r}=e,{ds:u}=e,a={};function c(f){return{label:ge(f)+"V",title:f.toFixed(1)+" V",value:isNaN(f)?0:f,color:w1(f||0)}}return t.$$set=f=>{"u1"in f&&l(1,n=f.u1),"u2"in f&&l(2,i=f.u2),"u3"in f&&l(3,r=f.u3),"ds"in f&&l(4,u=f.ds)},t.$$.update=()=>{if(t.$$.dirty&30){let f=[],_=[];n>0&&(f.push({label:u===1?"L1-L2":"L1"}),_.push(c(n))),i>0&&(f.push({label:u===1?"L1-L3":"L2"}),_.push(c(i))),r>0&&(f.push({label:u===1?"L2-L3":"L3"}),_.push(c(r))),l(0,a={title:"Voltage",padding:{top:20,right:15,bottom:20,left:35},y:{min:200,max:260,ticks:[{value:207,label:"-10%"},{value:230,label:"230v"},{value:253,label:"+10%"}]},x:{ticks:f},points:_})}},[a,n,i,r,u]}class mm extends Pe{constructor(e){super(),Ee(this,e,cm,fm,Ne,{u1:1,u2:2,u3:3,ds:4})}}function pm(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,[i]){const r={};i&1&&(r.config=n[0]),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function _m(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:r}=e,{i1:u}=e,{i2:a}=e,{i2e:c}=e,{i3:f}=e,{max:_}=e,p={};function b(v,d){return{label:ge(v)+"A",title:(d?"Estimated ":"")+v.toFixed(1)+" A",value:isNaN(v)?0:v,color:Fc(v?v/_*100:0,d)}}return t.$$set=v=>{"u1"in v&&l(1,n=v.u1),"u2"in v&&l(2,i=v.u2),"u3"in v&&l(3,r=v.u3),"i1"in v&&l(4,u=v.i1),"i2"in v&&l(5,a=v.i2),"i2e"in v&&l(6,c=v.i2e),"i3"in v&&l(7,f=v.i3),"max"in v&&l(8,_=v.max)},t.$$.update=()=>{if(t.$$.dirty&510){let v=[],d=[];n>0&&(v.push({label:"L1"}),d.push(b(u))),i>0&&(v.push({label:"L2"}),d.push(b(a,c))),r>0&&(v.push({label:"L3"}),d.push(b(f))),l(0,p={title:"Amperage",padding:{top:20,right:15,bottom:20,left:35},y:{min:0,max:_,ticks:[{value:0,label:"0%"},{value:_/4,label:"25%"},{value:_/2,label:"50%"},{value:_/4*3,label:"75%"},{value:_,label:"100%"}]},x:{ticks:v},points:d})}},[p,n,i,r,u,a,c,f,_]}class dm extends Pe{constructor(e){super(),Ee(this,e,_m,pm,Ne,{u1:1,u2:2,u3:3,i1:4,i2:5,i2e:6,i3:7,max:8})}}function vm(t){let e,l,n,i,r,u,a,c=(typeof t[0]<"u"?t[0].toFixed(0):"-")+"",f,_,p,b,v,d,S=(typeof t[1]<"u"?t[1].toFixed(0):"-")+"",y,$,N,P,B,E,O,L=(typeof t[2]<"u"?t[2].toFixed(1):"-")+"",F,x,H,z,G,V,W=(typeof t[3]<"u"?t[3].toFixed(1):"-")+"",U,K;return{c(){e=m("div"),l=m("strong"),l.textContent="Reactive",n=h(),i=m("div"),r=m("div"),r.textContent="Instant in",u=h(),a=m("div"),f=T(c),_=T(" VAr"),p=h(),b=m("div"),b.textContent="Instant out",v=h(),d=m("div"),y=T(S),$=T(" VAr"),N=h(),P=m("div"),B=m("div"),B.textContent="Total in",E=h(),O=m("div"),F=T(L),x=T(" kVArh"),H=h(),z=m("div"),z.textContent="Total out",G=h(),V=m("div"),U=T(W),K=T(" kVArh"),o(a,"class","text-right"),o(d,"class","text-right"),o(i,"class","grid grid-cols-2 mt-4"),o(O,"class","text-right"),o(V,"class","text-right"),o(P,"class","grid grid-cols-2 mt-4"),o(e,"class","mx-2 text-sm")},m(j,Y){M(j,e,Y),s(e,l),s(e,n),s(e,i),s(i,r),s(i,u),s(i,a),s(a,f),s(a,_),s(i,p),s(i,b),s(i,v),s(i,d),s(d,y),s(d,$),s(e,N),s(e,P),s(P,B),s(P,E),s(P,O),s(O,F),s(O,x),s(P,H),s(P,z),s(P,G),s(P,V),s(V,U),s(V,K)},p(j,[Y]){Y&1&&c!==(c=(typeof j[0]<"u"?j[0].toFixed(0):"-")+"")&&Z(f,c),Y&2&&S!==(S=(typeof j[1]<"u"?j[1].toFixed(0):"-")+"")&&Z(y,S),Y&4&&L!==(L=(typeof j[2]<"u"?j[2].toFixed(1):"-")+"")&&Z(F,L),Y&8&&W!==(W=(typeof j[3]<"u"?j[3].toFixed(1):"-")+"")&&Z(U,W)},i:fe,o:fe,d(j){j&&C(e)}}}function hm(t,e,l){let{importInstant:n}=e,{exportInstant:i}=e,{importTotal:r}=e,{exportTotal:u}=e;return t.$$set=a=>{"importInstant"in a&&l(0,n=a.importInstant),"exportInstant"in a&&l(1,i=a.exportInstant),"importTotal"in a&&l(2,r=a.importTotal),"exportTotal"in a&&l(3,u=a.exportTotal)},[n,i,r,u]}class bm extends Pe{constructor(e){super(),Ee(this,e,hm,vm,Ne,{importInstant:0,exportInstant:1,importTotal:2,exportTotal:3})}}function Eu(t){let e;function l(r,u){return r[3]?km:gm}let n=l(t),i=n(t);return{c(){i.c(),e=Ve()},m(r,u){i.m(r,u),M(r,e,u)},p(r,u){n===(n=l(r))&&i?i.p(r,u):(i.d(1),i=n(r),i&&(i.c(),i.m(e.parentNode,e)))},d(r){i.d(r),r&&C(e)}}}function gm(t){let e,l,n,i,r,u,a=ge(t[1].h.u,2)+"",c,f,_,p,b,v,d=ge(t[1].d.u,1)+"",S,y,$,N,P,B,E=ge(t[1].m.u)+"",O,L,F,x,H,z,G=ge(t[0].last_month.u)+"",V,W,U,K,j=t[4]&&Pu(t);return{c(){e=m("strong"),e.textContent="Consumption",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",r=h(),u=m("div"),c=T(a),f=T(" kWh"),_=h(),p=m("div"),p.textContent="Day",b=h(),v=m("div"),S=T(d),y=T(" kWh"),$=h(),N=m("div"),N.textContent="Month",P=h(),B=m("div"),O=T(E),L=T(" kWh"),F=h(),x=m("div"),x.textContent="Last month",H=h(),z=m("div"),V=T(G),W=T(" kWh"),U=h(),j&&j.c(),K=Ve(),o(u,"class","text-right"),o(v,"class","text-right"),o(B,"class","text-right"),o(z,"class","text-right"),o(n,"class","grid grid-cols-2 mb-3")},m(Y,X){M(Y,e,X),M(Y,l,X),M(Y,n,X),s(n,i),s(n,r),s(n,u),s(u,c),s(u,f),s(n,_),s(n,p),s(n,b),s(n,v),s(v,S),s(v,y),s(n,$),s(n,N),s(n,P),s(n,B),s(B,O),s(B,L),s(n,F),s(n,x),s(n,H),s(n,z),s(z,V),s(z,W),M(Y,U,X),j&&j.m(Y,X),M(Y,K,X)},p(Y,X){X&2&&a!==(a=ge(Y[1].h.u,2)+"")&&Z(c,a),X&2&&d!==(d=ge(Y[1].d.u,1)+"")&&Z(S,d),X&2&&E!==(E=ge(Y[1].m.u)+"")&&Z(O,E),X&1&&G!==(G=ge(Y[0].last_month.u)+"")&&Z(V,G),Y[4]?j?j.p(Y,X):(j=Pu(Y),j.c(),j.m(K.parentNode,K)):j&&(j.d(1),j=null)},d(Y){Y&&C(e),Y&&C(l),Y&&C(n),Y&&C(U),j&&j.d(Y),Y&&C(K)}}}function km(t){let e,l,n,i,r,u,a=ge(t[1].h.u,2)+"",c,f,_,p,b,v,d,S=ge(t[1].d.u,1)+"",y,$,N,P,B,E,O,L=ge(t[1].m.u)+"",F,x,H,z,G,V,W,U=ge(t[0].last_month.u)+"",K,j,Y,X,oe,ue,ke,me,$e,He,Re,je=ge(t[1].h.p,2)+"",we,Te,Oe,Me,w,g,k,A=ge(t[1].d.p,1)+"",I,Q,J,se,ce,ve,Se,re=ge(t[1].m.p)+"",pe,Be,_e,ye,vt,jl,tl,ct=ge(t[0].last_month.p)+"",Tl,pl,jt,ht,Xe=t[4]&&Du(t),Ze=t[4]&&Iu(t),Je=t[4]&&Ru(t),Ue=t[4]&&Ou(t),xe=t[4]&&Lu(t),We=t[4]&&Fu(t),et=t[4]&&qu(t),tt=t[4]&&Bu(t);return{c(){e=m("strong"),e.textContent="Import",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",r=h(),u=m("div"),c=T(a),f=T(" kWh"),_=h(),Xe&&Xe.c(),p=h(),b=m("div"),b.textContent="Day",v=h(),d=m("div"),y=T(S),$=T(" kWh"),N=h(),Ze&&Ze.c(),P=h(),B=m("div"),B.textContent="Month",E=h(),O=m("div"),F=T(L),x=T(" kWh"),H=h(),Je&&Je.c(),z=h(),G=m("div"),G.textContent="Last mo.",V=h(),W=m("div"),K=T(U),j=T(" kWh"),Y=h(),Ue&&Ue.c(),oe=h(),ue=m("strong"),ue.textContent="Export",ke=h(),me=m("div"),$e=m("div"),$e.textContent="Hour",He=h(),Re=m("div"),we=T(je),Te=T(" kWh"),Oe=h(),xe&&xe.c(),Me=h(),w=m("div"),w.textContent="Day",g=h(),k=m("div"),I=T(A),Q=T(" kWh"),J=h(),We&&We.c(),se=h(),ce=m("div"),ce.textContent="Month",ve=h(),Se=m("div"),pe=T(re),Be=T(" kWh"),_e=h(),et&&et.c(),ye=h(),vt=m("div"),vt.textContent="Last mo.",jl=h(),tl=m("div"),Tl=T(ct),pl=T(" kWh"),jt=h(),tt&&tt.c(),o(u,"class","text-right"),o(d,"class","text-right"),o(O,"class","text-right"),o(W,"class","text-right"),o(n,"class",X="grid grid-cols-"+t[5]+" mb-3"),o(Re,"class","text-right"),o(k,"class","text-right"),o(Se,"class","text-right"),o(tl,"class","text-right"),o(me,"class",ht="grid grid-cols-"+t[5])},m(de,Ce){M(de,e,Ce),M(de,l,Ce),M(de,n,Ce),s(n,i),s(n,r),s(n,u),s(u,c),s(u,f),s(n,_),Xe&&Xe.m(n,null),s(n,p),s(n,b),s(n,v),s(n,d),s(d,y),s(d,$),s(n,N),Ze&&Ze.m(n,null),s(n,P),s(n,B),s(n,E),s(n,O),s(O,F),s(O,x),s(n,H),Je&&Je.m(n,null),s(n,z),s(n,G),s(n,V),s(n,W),s(W,K),s(W,j),s(n,Y),Ue&&Ue.m(n,null),M(de,oe,Ce),M(de,ue,Ce),M(de,ke,Ce),M(de,me,Ce),s(me,$e),s(me,He),s(me,Re),s(Re,we),s(Re,Te),s(me,Oe),xe&&xe.m(me,null),s(me,Me),s(me,w),s(me,g),s(me,k),s(k,I),s(k,Q),s(me,J),We&&We.m(me,null),s(me,se),s(me,ce),s(me,ve),s(me,Se),s(Se,pe),s(Se,Be),s(me,_e),et&&et.m(me,null),s(me,ye),s(me,vt),s(me,jl),s(me,tl),s(tl,Tl),s(tl,pl),s(me,jt),tt&&tt.m(me,null)},p(de,Ce){Ce&2&&a!==(a=ge(de[1].h.u,2)+"")&&Z(c,a),de[4]?Xe?Xe.p(de,Ce):(Xe=Du(de),Xe.c(),Xe.m(n,p)):Xe&&(Xe.d(1),Xe=null),Ce&2&&S!==(S=ge(de[1].d.u,1)+"")&&Z(y,S),de[4]?Ze?Ze.p(de,Ce):(Ze=Iu(de),Ze.c(),Ze.m(n,P)):Ze&&(Ze.d(1),Ze=null),Ce&2&&L!==(L=ge(de[1].m.u)+"")&&Z(F,L),de[4]?Je?Je.p(de,Ce):(Je=Ru(de),Je.c(),Je.m(n,z)):Je&&(Je.d(1),Je=null),Ce&1&&U!==(U=ge(de[0].last_month.u)+"")&&Z(K,U),de[4]?Ue?Ue.p(de,Ce):(Ue=Ou(de),Ue.c(),Ue.m(n,null)):Ue&&(Ue.d(1),Ue=null),Ce&32&&X!==(X="grid grid-cols-"+de[5]+" mb-3")&&o(n,"class",X),Ce&2&&je!==(je=ge(de[1].h.p,2)+"")&&Z(we,je),de[4]?xe?xe.p(de,Ce):(xe=Lu(de),xe.c(),xe.m(me,Me)):xe&&(xe.d(1),xe=null),Ce&2&&A!==(A=ge(de[1].d.p,1)+"")&&Z(I,A),de[4]?We?We.p(de,Ce):(We=Fu(de),We.c(),We.m(me,se)):We&&(We.d(1),We=null),Ce&2&&re!==(re=ge(de[1].m.p)+"")&&Z(pe,re),de[4]?et?et.p(de,Ce):(et=qu(de),et.c(),et.m(me,ye)):et&&(et.d(1),et=null),Ce&1&&ct!==(ct=ge(de[0].last_month.p)+"")&&Z(Tl,ct),de[4]?tt?tt.p(de,Ce):(tt=Bu(de),tt.c(),tt.m(me,null)):tt&&(tt.d(1),tt=null),Ce&32&&ht!==(ht="grid grid-cols-"+de[5])&&o(me,"class",ht)},d(de){de&&C(e),de&&C(l),de&&C(n),Xe&&Xe.d(),Ze&&Ze.d(),Je&&Je.d(),Ue&&Ue.d(),de&&C(oe),de&&C(ue),de&&C(ke),de&&C(me),xe&&xe.d(),We&&We.d(),et&&et.d(),tt&&tt.d()}}}function Pu(t){let e,l,n,i,r,u,a=ge(t[1].h.c,2)+"",c,f,_,p,b,v,d,S=ge(t[1].d.c,1)+"",y,$,N,P,B,E,O,L=ge(t[1].m.c)+"",F,x,H,z,G,V,W,U=ge(t[0].last_month.c)+"",K,j,Y;return{c(){e=m("strong"),e.textContent="Cost",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",r=h(),u=m("div"),c=T(a),f=h(),_=T(t[2]),p=h(),b=m("div"),b.textContent="Day",v=h(),d=m("div"),y=T(S),$=h(),N=T(t[2]),P=h(),B=m("div"),B.textContent="Month",E=h(),O=m("div"),F=T(L),x=h(),H=T(t[2]),z=h(),G=m("div"),G.textContent="Last month",V=h(),W=m("div"),K=T(U),j=h(),Y=T(t[2]),o(u,"class","text-right"),o(d,"class","text-right"),o(O,"class","text-right"),o(W,"class","text-right"),o(n,"class","grid grid-cols-2")},m(X,oe){M(X,e,oe),M(X,l,oe),M(X,n,oe),s(n,i),s(n,r),s(n,u),s(u,c),s(u,f),s(u,_),s(n,p),s(n,b),s(n,v),s(n,d),s(d,y),s(d,$),s(d,N),s(n,P),s(n,B),s(n,E),s(n,O),s(O,F),s(O,x),s(O,H),s(n,z),s(n,G),s(n,V),s(n,W),s(W,K),s(W,j),s(W,Y)},p(X,oe){oe&2&&a!==(a=ge(X[1].h.c,2)+"")&&Z(c,a),oe&4&&Z(_,X[2]),oe&2&&S!==(S=ge(X[1].d.c,1)+"")&&Z(y,S),oe&4&&Z(N,X[2]),oe&2&&L!==(L=ge(X[1].m.c)+"")&&Z(F,L),oe&4&&Z(H,X[2]),oe&1&&U!==(U=ge(X[0].last_month.c)+"")&&Z(K,U),oe&4&&Z(Y,X[2])},d(X){X&&C(e),X&&C(l),X&&C(n)}}}function Du(t){let e,l=ge(t[1].h.c,2)+"",n,i,r;return{c(){e=m("div"),n=T(l),i=h(),r=T(t[2]),o(e,"class","text-right")},m(u,a){M(u,e,a),s(e,n),s(e,i),s(e,r)},p(u,a){a&2&&l!==(l=ge(u[1].h.c,2)+"")&&Z(n,l),a&4&&Z(r,u[2])},d(u){u&&C(e)}}}function Iu(t){let e,l=ge(t[1].d.c,1)+"",n,i,r;return{c(){e=m("div"),n=T(l),i=h(),r=T(t[2]),o(e,"class","text-right")},m(u,a){M(u,e,a),s(e,n),s(e,i),s(e,r)},p(u,a){a&2&&l!==(l=ge(u[1].d.c,1)+"")&&Z(n,l),a&4&&Z(r,u[2])},d(u){u&&C(e)}}}function Ru(t){let e,l=ge(t[1].m.c)+"",n,i,r;return{c(){e=m("div"),n=T(l),i=h(),r=T(t[2]),o(e,"class","text-right")},m(u,a){M(u,e,a),s(e,n),s(e,i),s(e,r)},p(u,a){a&2&&l!==(l=ge(u[1].m.c)+"")&&Z(n,l),a&4&&Z(r,u[2])},d(u){u&&C(e)}}}function Ou(t){let e,l=ge(t[0].last_month.c)+"",n,i,r;return{c(){e=m("div"),n=T(l),i=h(),r=T(t[2]),o(e,"class","text-right")},m(u,a){M(u,e,a),s(e,n),s(e,i),s(e,r)},p(u,a){a&1&&l!==(l=ge(u[0].last_month.c)+"")&&Z(n,l),a&4&&Z(r,u[2])},d(u){u&&C(e)}}}function Lu(t){let e,l=ge(t[1].h.i,2)+"",n,i,r;return{c(){e=m("div"),n=T(l),i=h(),r=T(t[2]),o(e,"class","text-right")},m(u,a){M(u,e,a),s(e,n),s(e,i),s(e,r)},p(u,a){a&2&&l!==(l=ge(u[1].h.i,2)+"")&&Z(n,l),a&4&&Z(r,u[2])},d(u){u&&C(e)}}}function Fu(t){let e,l=ge(t[1].d.i,1)+"",n,i,r;return{c(){e=m("div"),n=T(l),i=h(),r=T(t[2]),o(e,"class","text-right")},m(u,a){M(u,e,a),s(e,n),s(e,i),s(e,r)},p(u,a){a&2&&l!==(l=ge(u[1].d.i,1)+"")&&Z(n,l),a&4&&Z(r,u[2])},d(u){u&&C(e)}}}function qu(t){let e,l=ge(t[1].m.i)+"",n,i,r;return{c(){e=m("div"),n=T(l),i=h(),r=T(t[2]),o(e,"class","text-right")},m(u,a){M(u,e,a),s(e,n),s(e,i),s(e,r)},p(u,a){a&2&&l!==(l=ge(u[1].m.i)+"")&&Z(n,l),a&4&&Z(r,u[2])},d(u){u&&C(e)}}}function Bu(t){let e,l=ge(t[0].last_month.i)+"",n,i,r;return{c(){e=m("div"),n=T(l),i=h(),r=T(t[2]),o(e,"class","text-right")},m(u,a){M(u,e,a),s(e,n),s(e,i),s(e,r)},p(u,a){a&1&&l!==(l=ge(u[0].last_month.i)+"")&&Z(n,l),a&4&&Z(r,u[2])},d(u){u&&C(e)}}}function wm(t){let e,l,n,i,r,u,a=t[1]&&Eu(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Real time calculation",n=h(),i=m("br"),r=m("br"),u=h(),a&&a.c(),o(e,"class","mx-2 text-sm")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,r),s(e,u),a&&a.m(e,null)},p(c,[f]){c[1]?a?a.p(c,f):(a=Eu(c),a.c(),a.m(e,null)):a&&(a.d(1),a=null)},i:fe,o:fe,d(c){c&&C(e),a&&a.d()}}}function ym(t,e,l){let{sysinfo:n}=e,{data:i}=e,{currency:r}=e,{hasExport:u}=e,a=!1,c=3;return t.$$set=f=>{"sysinfo"in f&&l(0,n=f.sysinfo),"data"in f&&l(1,i=f.data),"currency"in f&&l(2,r=f.currency),"hasExport"in f&&l(3,u=f.hasExport)},t.$$.update=()=>{t.$$.dirty&18&&(l(4,a=i&&i.h&&(Math.abs(i.h.c)>.01||Math.abs(i.d.c)>.01||Math.abs(i.m.c)>.01||Math.abs(i.h.i)>.01||Math.abs(i.d.i)>.01||Math.abs(i.m.i)>.01)),l(5,c=a?3:2))},[n,i,r,u,a,c]}class Cm extends Pe{constructor(e){super(),Ee(this,e,ym,wm,Ne,{sysinfo:0,data:1,currency:2,hasExport:3})}}function Mm(t){let e,l,n=xa(t[0].source)+"",i,r,u,a,c;return a=new pn({props:{config:t[1]}}),{c(){e=m("a"),l=T("Provided by: "),i=T(n),u=h(),ie(a.$$.fragment),o(e,"href",r=eu(t[0].source)),o(e,"target","_blank"),o(e,"class","text-xs float-right z-40")},m(f,_){M(f,e,_),s(e,l),s(e,i),M(f,u,_),le(a,f,_),c=!0},p(f,[_]){(!c||_&1)&&n!==(n=xa(f[0].source)+"")&&Z(i,n),(!c||_&1&&r!==(r=eu(f[0].source)))&&o(e,"href",r);const p={};_&2&&(p.config=f[1]),a.$set(p)},i(f){c||(D(a.$$.fragment,f),c=!0)},o(f){q(a.$$.fragment,f),c=!1},d(f){f&&C(e),f&&C(u),ne(a,f)}}}function Sm(t,e,l){let{json:n}=e,{sysinfo:i}=e,r={},u,a;return t.$$set=c=>{"json"in c&&l(0,n=c.json),"sysinfo"in c&&l(2,i=c.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&29){let c=n.currency,f=new Date().getUTCHours(),_=0,p=0,b=0,v=[],d=[],S=[];l(4,a=l(3,u=0));let y=new Date;for(fl(y,i.clock_offset-(24+y.getHours()-y.getUTCHours())%24),_=f;_<24&&(p=n[Le(b++)],p!=null);_++)d.push({label:Le(y.getHours())}),S.push(p*100),l(4,a=Math.min(a,p*100)),l(3,u=Math.max(u,p*100)),fl(y,1);for(_=0;_<24&&(p=n[Le(b++)],p!=null);_++)d.push({label:Le(y.getHours())}),S.push(p*100),l(4,a=Math.min(a,p*100)),l(3,u=Math.max(u,p*100)),fl(y,1);if(a>-100&&u<100){switch(c){case"NOK":case"DKK":c="\xF8re";break;case"SEK":c="\xF6re";break;case"EUR":c="cent";break;case"CHF":c="rp.";break;default:c=c+"/100"}for(l(4,a*=100),l(3,u*=100),_=0;_=0?E.toFixed(O):"",title:E>=0?E.toFixed(2)+" "+c:"",value:p>=0?Math.abs(p):0,label2:E<0?E.toFixed(O):"",title2:E<0?E.toFixed(2)+" "+c:"",value2:p<0?Math.abs(p):0,color:"#7c3aed"})}let N=Math.max(u,Math.abs(a));if(a<0){l(4,a=Math.min(N/4*-1,a));let E=Math.ceil(Math.abs(a)/N*4),O=a/E;for(_=1;_{"json"in c&&l(1,n=c.json),"sysinfo"in c&&l(2,i=c.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let c=0,f=[],_=[],p=[];l(4,a=l(3,u=0));let b=fl(new Date,-24),v=new Date().getUTCHours();for(fl(b,i.clock_offset-(24+b.getHours()-b.getUTCHours())%24),c=v;c<24;c++){let $=n["i"+Le(c)],N=n["e"+Le(c)];$===void 0&&($=0),N===void 0&&(N=0),_.push({label:Le(b.getHours())}),p.push({label:$.toFixed(1),title:$.toFixed(2)+" kWh",value:$*10,label2:N.toFixed(1),title2:N.toFixed(2)+" kWh",value2:N*10,color:"#7c3aed",color2:"#37829E"}),l(4,a=Math.max(a,N*10)),l(3,u=Math.max(u,$*10)),fl(b,1)}for(c=0;c{"json"in c&&l(1,n=c.json),"sysinfo"in c&&l(2,i=c.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let c=0,f=[],_=[],p=[];l(4,a=l(3,u=0));let b=new Date,v=new Date;for(fl(b,i.clock_offset-(24+b.getHours()-b.getUTCHours())%24),fl(v,i.clock_offset-(24+v.getHours()-v.getUTCHours())%24),v.setDate(0),c=b.getDate();c<=v.getDate();c++){let $=n["i"+Le(c)],N=n["e"+Le(c)];$===void 0&&($=0),N===void 0&&(N=0),_.push({label:Le(c)}),p.push({label:$.toFixed($<10?1:0),title:$.toFixed(2)+" kWh",value:$,label2:N.toFixed(N<10?1:0),title2:N.toFixed(2)+" kWh",value2:N,color:"#7c3aed",color2:"#37829E"}),l(4,a=Math.max(a,N)),l(3,u=Math.max(u,$))}for(c=1;c{"json"in a&&l(1,n=a.json)},t.$$.update=()=>{if(t.$$.dirty&14){let a=0,c=0,f=[],_=[],p=[];n.s&&n.s.forEach((d,S)=>{var y=d.n?d.n:d.a;c=d.v,c==-127&&(c=0),_.push({label:y.slice(-4)}),p.push({label:c.toFixed(1),value:c,color:"#7c3aed"}),l(3,u=Math.min(u,c)),l(2,r=Math.max(r,c))}),l(2,r=Math.ceil(r)),l(3,u=Math.floor(u));let b=r;u<0&&(b+=Math.abs(u));let v=b/4;for(a=0;a<5;a++)c=u+v*a,f.push({value:c,label:c.toFixed(1)});l(0,i={title:"Temperature sensors (\xB0C)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:u,max:r,ticks:f},x:{ticks:_},points:p})}},[i,n,r,u]}class Om extends Pe{constructor(e){super(),Ee(this,e,Rm,Im,Ne,{json:1})}}function Lm(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,[i]){const r={};i&1&&(r.config=n[0]),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}let Fm=0;function qm(t,e,l){let n={},i=0,r;return Gc.subscribe(u=>{l(2,r=u)}),zc(),t.$$.update=()=>{if(t.$$.dirty&6){let u=0,a=[],c=[],f=[];if(a.push({value:0,label:0}),r&&r.p)for(u=0;u0?Le(_.d)+"."+nr[new Date().getMonth()]:"-"}),l(1,i=Math.max(i,_.v))}if(r&&r.t){for(u=0;u=i)break;a.push({value:_,label:_})}a.push({label:r.m.toFixed(1),align:"right",color:"green",value:r.m})}r&&r.c&&(a.push({label:r.c.toFixed(0),color:"orange",value:r.c}),l(1,i=Math.max(i,r.c))),l(1,i=Math.ceil(i)),l(0,n={title:"Tariff peaks",padding:{top:20,right:35,bottom:20,left:35},y:{min:Fm,max:i,ticks:a},x:{ticks:c},points:f})}},[n,i,r]}class Bm extends Pe{constructor(e){super(),Ee(this,e,qm,Lm,Ne,{})}}function Uu(t){let e,l,n,i,r,u,a=(t[0].mt?Cs(t[0].mt):"-")+"",c,f,_,p=(t[0].ic?t[0].ic.toFixed(1):"-")+"",b,v,d;return i=new Xc({props:{val:t[0].i?t[0].i:0,max:t[0].im?t[0].im:15e3,unit:"W",label:"Import",sub:t[0].p,subunit:t[0].pc,colorFn:Fc}}),{c(){e=m("div"),l=m("div"),n=m("div"),ie(i.$$.fragment),r=h(),u=m("div"),c=T(a),f=h(),_=m("div"),b=T(p),v=T(" kWh"),o(n,"class","col-span-2"),o(_,"class","text-right"),o(l,"class","grid grid-cols-2"),o(e,"class","cnt")},m(S,y){M(S,e,y),s(e,l),s(l,n),le(i,n,null),s(l,r),s(l,u),s(u,c),s(l,f),s(l,_),s(_,b),s(_,v),d=!0},p(S,y){const $={};y&1&&($.val=S[0].i?S[0].i:0),y&1&&($.max=S[0].im?S[0].im:15e3),y&1&&($.sub=S[0].p),y&1&&($.subunit=S[0].pc),i.$set($),(!d||y&1)&&a!==(a=(S[0].mt?Cs(S[0].mt):"-")+"")&&Z(c,a),(!d||y&1)&&p!==(p=(S[0].ic?S[0].ic.toFixed(1):"-")+"")&&Z(b,p)},i(S){d||(D(i.$$.fragment,S),d=!0)},o(S){q(i.$$.fragment,S),d=!1},d(S){S&&C(e),ne(i)}}}function Hu(t){let e,l,n,i,r,u,a,c,f=(t[0].ec?t[0].ec.toFixed(1):"-")+"",_,p,b;return i=new Xc({props:{val:t[0].e?t[0].e:0,max:t[0].om?t[0].om*1e3:1e4,unit:"W",label:"Export",colorFn:y1}}),{c(){e=m("div"),l=m("div"),n=m("div"),ie(i.$$.fragment),r=h(),u=m("div"),a=h(),c=m("div"),_=T(f),p=T(" kWh"),o(n,"class","col-span-2"),o(c,"class","text-right"),o(l,"class","grid grid-cols-2"),o(e,"class","cnt")},m(v,d){M(v,e,d),s(e,l),s(l,n),le(i,n,null),s(l,r),s(l,u),s(l,a),s(l,c),s(c,_),s(c,p),b=!0},p(v,d){const S={};d&1&&(S.val=v[0].e?v[0].e:0),d&1&&(S.max=v[0].om?v[0].om*1e3:1e4),i.$set(S),(!b||d&1)&&f!==(f=(v[0].ec?v[0].ec.toFixed(1):"-")+"")&&Z(_,f)},i(v){b||(D(i.$$.fragment,v),b=!0)},o(v){q(i.$$.fragment,v),b=!1},d(v){v&&C(e),ne(i)}}}function ju(t){let e,l,n;return l=new mm({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,ds:t[0].ds}}),{c(){e=m("div"),ie(l.$$.fragment),o(e,"class","cnt")},m(i,r){M(i,e,r),le(l,e,null),n=!0},p(i,r){const u={};r&1&&(u.u1=i[0].u1),r&1&&(u.u2=i[0].u2),r&1&&(u.u3=i[0].u3),r&1&&(u.ds=i[0].ds),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Wu(t){let e,l,n;return l=new dm({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,i1:t[0].i1,i2:t[0].i2,i2e:t[0].i2e,i3:t[0].i3,max:t[0].mf?t[0].mf:32}}),{c(){e=m("div"),ie(l.$$.fragment),o(e,"class","cnt")},m(i,r){M(i,e,r),le(l,e,null),n=!0},p(i,r){const u={};r&1&&(u.u1=i[0].u1),r&1&&(u.u2=i[0].u2),r&1&&(u.u3=i[0].u3),r&1&&(u.i1=i[0].i1),r&1&&(u.i2=i[0].i2),r&1&&(u.i2e=i[0].i2e),r&1&&(u.i3=i[0].i3),r&1&&(u.max=i[0].mf?i[0].mf:32),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function zu(t){let e,l,n;return l=new bm({props:{importInstant:t[0].ri,exportInstant:t[0].re,importTotal:t[0].ric,exportTotal:t[0].rec}}),{c(){e=m("div"),ie(l.$$.fragment),o(e,"class","cnt")},m(i,r){M(i,e,r),le(l,e,null),n=!0},p(i,r){const u={};r&1&&(u.importInstant=i[0].ri),r&1&&(u.exportInstant=i[0].re),r&1&&(u.importTotal=i[0].ric),r&1&&(u.exportTotal=i[0].rec),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Gu(t){let e,l,n;return l=new Cm({props:{sysinfo:t[1],data:t[0].ea,currency:t[0].pc,hasExport:t[0].om>0||t[0].e>0}}),{c(){e=m("div"),ie(l.$$.fragment),o(e,"class","cnt")},m(i,r){M(i,e,r),le(l,e,null),n=!0},p(i,r){const u={};r&2&&(u.sysinfo=i[1]),r&1&&(u.data=i[0].ea),r&1&&(u.currency=i[0].pc),r&1&&(u.hasExport=i[0].om>0||i[0].e>0),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Vu(t){let e,l,n;return l=new Bm({}),{c(){e=m("div"),ie(l.$$.fragment),o(e,"class","cnt h-64")},m(i,r){M(i,e,r),le(l,e,null),n=!0},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Ku(t){let e,l,n;return l=new $m({props:{json:t[2],sysinfo:t[1]}}),{c(){e=m("div"),ie(l.$$.fragment),o(e,"class","cnt gwf")},m(i,r){M(i,e,r),le(l,e,null),n=!0},p(i,r){const u={};r&4&&(u.json=i[2]),r&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Yu(t){let e,l,n;return l=new Am({props:{json:t[3],sysinfo:t[1]}}),{c(){e=m("div"),ie(l.$$.fragment),o(e,"class","cnt gwf")},m(i,r){M(i,e,r),le(l,e,null),n=!0},p(i,r){const u={};r&8&&(u.json=i[3]),r&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Qu(t){let e,l,n;return l=new Dm({props:{json:t[4],sysinfo:t[1]}}),{c(){e=m("div"),ie(l.$$.fragment),o(e,"class","cnt gwf")},m(i,r){M(i,e,r),le(l,e,null),n=!0},p(i,r){const u={};r&16&&(u.json=i[4]),r&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Xu(t){let e,l,n;return l=new Om({props:{json:t[5]}}),{c(){e=m("div"),ie(l.$$.fragment),o(e,"class","cnt gwf")},m(i,r){M(i,e,r),le(l,e,null),n=!0},p(i,r){const u={};r&32&&(u.json=i[5]),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Um(t){let e,l=Ke(t[1].ui.i,t[0].i),n,i=Ke(t[1].ui.e,t[0].om||t[0].e>0),r,u=Ke(t[1].ui.v,t[0].u1>100||t[0].u2>100||t[0].u3>100),a,c=Ke(t[1].ui.a,t[0].i1>.01||t[0].i2>.01||t[0].i3>.01),f,_=Ke(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),p,b=Ke(t[1].ui.c,t[0].ea),v,d=Ke(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("10YNO")||t[0].pr.startsWith("10Y1001A1001A4"))),S,y=Ke(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].p)),$,N=Ke(t[1].ui.d,t[3]),P,B=Ke(t[1].ui.m,t[4]),E,O=Ke(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[5].c>1),L,F=l&&Uu(t),x=i&&Hu(t),H=u&&ju(t),z=c&&Wu(t),G=_&&zu(t),V=b&&Gu(t),W=d&&Vu(),U=y&&Ku(t),K=N&&Yu(t),j=B&&Qu(t),Y=O&&Xu(t);return{c(){e=m("div"),F&&F.c(),n=h(),x&&x.c(),r=h(),H&&H.c(),a=h(),z&&z.c(),f=h(),G&&G.c(),p=h(),V&&V.c(),v=h(),W&&W.c(),S=h(),U&&U.c(),$=h(),K&&K.c(),P=h(),j&&j.c(),E=h(),Y&&Y.c(),o(e,"class","grid 2xl:grid-cols-6 xl:grid-cols-5 lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2")},m(X,oe){M(X,e,oe),F&&F.m(e,null),s(e,n),x&&x.m(e,null),s(e,r),H&&H.m(e,null),s(e,a),z&&z.m(e,null),s(e,f),G&&G.m(e,null),s(e,p),V&&V.m(e,null),s(e,v),W&&W.m(e,null),s(e,S),U&&U.m(e,null),s(e,$),K&&K.m(e,null),s(e,P),j&&j.m(e,null),s(e,E),Y&&Y.m(e,null),L=!0},p(X,[oe]){oe&3&&(l=Ke(X[1].ui.i,X[0].i)),l?F?(F.p(X,oe),oe&3&&D(F,1)):(F=Uu(X),F.c(),D(F,1),F.m(e,n)):F&&(De(),q(F,1,1,()=>{F=null}),Ie()),oe&3&&(i=Ke(X[1].ui.e,X[0].om||X[0].e>0)),i?x?(x.p(X,oe),oe&3&&D(x,1)):(x=Hu(X),x.c(),D(x,1),x.m(e,r)):x&&(De(),q(x,1,1,()=>{x=null}),Ie()),oe&3&&(u=Ke(X[1].ui.v,X[0].u1>100||X[0].u2>100||X[0].u3>100)),u?H?(H.p(X,oe),oe&3&&D(H,1)):(H=ju(X),H.c(),D(H,1),H.m(e,a)):H&&(De(),q(H,1,1,()=>{H=null}),Ie()),oe&3&&(c=Ke(X[1].ui.a,X[0].i1>.01||X[0].i2>.01||X[0].i3>.01)),c?z?(z.p(X,oe),oe&3&&D(z,1)):(z=Wu(X),z.c(),D(z,1),z.m(e,f)):z&&(De(),q(z,1,1,()=>{z=null}),Ie()),oe&3&&(_=Ke(X[1].ui.r,X[0].ri>0||X[0].re>0||X[0].ric>0||X[0].rec>0)),_?G?(G.p(X,oe),oe&3&&D(G,1)):(G=zu(X),G.c(),D(G,1),G.m(e,p)):G&&(De(),q(G,1,1,()=>{G=null}),Ie()),oe&3&&(b=Ke(X[1].ui.c,X[0].ea)),b?V?(V.p(X,oe),oe&3&&D(V,1)):(V=Gu(X),V.c(),D(V,1),V.m(e,v)):V&&(De(),q(V,1,1,()=>{V=null}),Ie()),oe&3&&(d=Ke(X[1].ui.t,X[0].pr&&(X[0].pr.startsWith("10YNO")||X[0].pr.startsWith("10Y1001A1001A4")))),d?W?oe&3&&D(W,1):(W=Vu(),W.c(),D(W,1),W.m(e,S)):W&&(De(),q(W,1,1,()=>{W=null}),Ie()),oe&3&&(y=Ke(X[1].ui.p,X[0].pe&&!Number.isNaN(X[0].p))),y?U?(U.p(X,oe),oe&3&&D(U,1)):(U=Ku(X),U.c(),D(U,1),U.m(e,$)):U&&(De(),q(U,1,1,()=>{U=null}),Ie()),oe&10&&(N=Ke(X[1].ui.d,X[3])),N?K?(K.p(X,oe),oe&10&&D(K,1)):(K=Yu(X),K.c(),D(K,1),K.m(e,P)):K&&(De(),q(K,1,1,()=>{K=null}),Ie()),oe&18&&(B=Ke(X[1].ui.m,X[4])),B?j?(j.p(X,oe),oe&18&&D(j,1)):(j=Qu(X),j.c(),D(j,1),j.m(e,E)):j&&(De(),q(j,1,1,()=>{j=null}),Ie()),oe&35&&(O=Ke(X[1].ui.s,X[0].t&&X[0].t!=-127&&X[5].c>1)),O?Y?(Y.p(X,oe),oe&35&&D(Y,1)):(Y=Xu(X),Y.c(),D(Y,1),Y.m(e,null)):Y&&(De(),q(Y,1,1,()=>{Y=null}),Ie())},i(X){L||(D(F),D(x),D(H),D(z),D(G),D(V),D(W),D(U),D(K),D(j),D(Y),L=!0)},o(X){q(F),q(x),q(H),q(z),q(G),q(V),q(W),q(U),q(K),q(j),q(Y),L=!1},d(X){X&&C(e),F&&F.d(),x&&x.d(),H&&H.d(),z&&z.d(),G&&G.d(),V&&V.d(),W&&W.d(),U&&U.d(),K&&K.d(),j&&j.d(),Y&&Y.d()}}}function Hm(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,r={},u={},a={},c={};return yr.subscribe(f=>{l(2,r=f)}),Uc.subscribe(f=>{l(3,u=f)}),Hc.subscribe(f=>{l(4,a=f)}),Wc.subscribe(f=>{l(5,c=f)}),t.$$set=f=>{"data"in f&&l(0,n=f.data),"sysinfo"in f&&l(1,i=f.sysinfo)},[n,i,r,u,a,c]}class jm extends Pe{constructor(e){super(),Ee(this,e,Hm,Um,Ne,{data:0,sysinfo:1})}}let fr={};const Ci=at(fr);async function Wm(){fr=await(await fetch("/configuration.json")).json(),Ci.set(fr)}function Zu(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function zm(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=3,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function Gm(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=20,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function Ju(t){let e;return{c(){e=m("option"),e.textContent="UART2",e.__value=113,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function xu(t){let e,l,n;return{c(){e=m("option"),e.textContent="UART1",l=h(),n=m("option"),n.textContent="UART2",e.__value=9,e.value=e.__value,n.__value=16,n.value=n.__value},m(i,r){M(i,e,r),M(i,l,r),M(i,n,r)},d(i){i&&C(e),i&&C(l),i&&C(n)}}}function ef(t){let e;return{c(){e=m("option"),e.textContent="UART1",e.__value=18,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function tf(t){let e,l,n;return{c(){e=m("option"),l=T("GPIO"),n=T(t[4]),e.__value=t[4],e.value=e.__value},m(i,r){M(i,e,r),s(e,l),s(e,n)},d(i){i&&C(e)}}}function lf(t){let e,l=t[4]>3&&!(t[0]=="esp32"&&(t[4]==9||t[4]==16))&&!(t[0]=="esp32s2"&&t[4]==18)&&!(t[0]=="esp8266"&&(t[4]==3||t[4]==113))&&tf(t);return{c(){l&&l.c(),e=Ve()},m(n,i){l&&l.m(n,i),M(n,e,i)},p(n,i){n[4]>3&&!(n[0]=="esp32"&&(n[4]==9||n[4]==16))&&!(n[0]=="esp32s2"&&n[4]==18)&&!(n[0]=="esp8266"&&(n[4]==3||n[4]==113))?l||(l=tf(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){l&&l.d(n),n&&C(e)}}}function Vm(t){let e,l,n,i,r;function u(d,S){return d[0]=="esp32c3"?Gm:zm}let a=u(t),c=a(t),f=t[0]=="esp8266"&&Ju(),_=(t[0]=="esp32"||t[0]=="esp32solo")&&xu(),p=t[0]=="esp32s2"&&ef(),b={length:t[1]+1},v=[];for(let d=0;d{"chip"in r&&l(0,n=r.chip)},t.$$.update=()=>{if(t.$$.dirty&1)switch(n){case"esp8266":l(1,i=16);break;case"esp32s2":l(1,i=44);break;case"esp32c3":l(1,i=19);break}},[n,i]}class Zc extends Pe{constructor(e){super(),Ee(this,e,Km,Vm,Ne,{chip:0})}}function nf(t){let e,l,n=t[1]&&sf(t);return{c(){e=m("div"),l=m("div"),n&&n.c(),o(l,"class","fixed inset-0 bg-gray-500 bg-opacity-50 flex items-center justify-center"),o(e,"class","z-50"),o(e,"aria-modal","true")},m(i,r){M(i,e,r),s(e,l),n&&n.m(l,null)},p(i,r){i[1]?n?n.p(i,r):(n=sf(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&C(e),n&&n.d()}}}function sf(t){let e,l;return{c(){e=m("div"),l=T(t[1]),o(e,"class","bg-white m-2 p-3 rounded-md shadow-lg pb-4 text-gray-700 w-96")},m(n,i){M(n,e,i),s(e,l)},p(n,i){i&2&&Z(l,n[1])},d(n){n&&C(e)}}}function Ym(t){let e,l=t[0]&&nf(t);return{c(){l&&l.c(),e=Ve()},m(n,i){l&&l.m(n,i),M(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=nf(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:fe,o:fe,d(n){l&&l.d(n),n&&C(e)}}}function Qm(t,e,l){let{active:n}=e,{message:i}=e;return t.$$set=r=>{"active"in r&&l(0,n=r.active),"message"in r&&l(1,i=r.message)},[n,i]}class It extends Pe{constructor(e){super(),Ee(this,e,Qm,Ym,Ne,{active:0,message:1})}}function rf(t,e,l){const n=t.slice();return n[1]=e[l],n}function of(t){let e,l,n=t[1]+"",i;return{c(){e=m("option"),l=T("Europe/"),i=T(n),e.__value="Europe/"+t[1],e.value=e.__value},m(r,u){M(r,e,u),s(e,l),s(e,i)},p:fe,d(r){r&&C(e)}}}function Xm(t){let e,l,n,i=t[0],r=[];for(let u=0;u>1&1,A=0;A0;g--)A[g]=A[g]?A[g-1]^E.EXPONENT[F._modN(E.LOG[A[g]]+w)]:A[g-1];A[0]=E.EXPONENT[F._modN(E.LOG[A[0]]+w)]}for(w=0;w<=k;w++)A[w]=E.LOG[A[w]]},_checkBadness:function(){var w,g,k,A,I,Q=0,J=this._badness,se=this.buffer,ce=this.width;for(I=0;Ice*ce;)re-=ce*ce,Se++;for(Q+=Se*F.N4,A=0;A=J-2&&(w=J-2,I>9&&w--);var se=w;if(I>9){for(Q[se+2]=0,Q[se+3]=0;se--;)g=Q[se],Q[se+3]|=255&g<<4,Q[se+2]=g>>4;Q[2]|=255&w<<4,Q[1]=w>>4,Q[0]=64|w>>12}else{for(Q[se+1]=0,Q[se+2]=0;se--;)g=Q[se],Q[se+2]|=255&g<<4,Q[se+1]=g>>4;Q[1]|=255&w<<4,Q[0]=64|w>>4}for(se=w+3-(I<10);se=5&&(k+=F.N1+A[g]-5);for(g=3;gw||A[g-3]*3>=A[g]*4||A[g+3]*3>=A[g]*4)&&(k+=F.N3);return k},_finish:function(){this._stringBuffer=this.buffer.slice();var w,g,k=0,A=3e4;for(g=0;g<8&&(this._applyMask(g),w=this._checkBadness(),w>=1)A&1&&(I[Q-1-g+Q*8]=1,g<6?I[8+Q*g]=1:I[8+Q*(g+1)]=1);for(g=0;g<7;g++,A>>=1)A&1&&(I[8+Q*(Q-7+g)]=1,g?I[6-g+Q*8]=1:I[7+Q*8]=1)},_interleaveBlocks:function(){var w,g,k=this._dataBlock,A=this._ecc,I=this._eccBlock,Q=0,J=this._calculateMaxLength(),se=this._neccBlock1,ce=this._neccBlock2,ve=this._stringBuffer;for(w=0;w1)for(w=$.BLOCK[A],k=I-7;;){for(g=I-7;g>w-3&&(this._addAlignment(g,k),!(g6)for(w=L.BLOCK[Q-7],g=17,k=0;k<6;k++)for(A=0;A<3;A++,g--)1&(g>11?Q>>g-12:w>>g)?(I[5-k+J*(2-A+J-11)]=1,I[2-A+J-11+J*(5-k)]=1):(this._setMask(5-k,2-A+J-11),this._setMask(2-A+J-11,5-k))},_isMasked:function(w,g){var k=F._getMaskBit(w,g);return this._mask[k]===1},_pack:function(){var w,g,k,A=1,I=1,Q=this.width,J=Q-1,se=Q-1,ce=(this._dataBlock+this._eccBlock)*(this._neccBlock1+this._neccBlock2)+this._neccBlock2;for(g=0;gg&&(k=w,w=g,g=k),k=g,k+=g*g,k>>=1,k+=w,k},_modN:function(w){for(;w>=255;)w-=255,w=(w>>8)+(w&255);return w},N1:3,N2:3,N3:40,N4:10}),x=F,H=v.extend({draw:function(){this.element.src=this.qrious.toDataURL()},reset:function(){this.element.src=""},resize:function(){var w=this.element;w.width=w.height=this.qrious.size}}),z=H,G=p.extend(function(w,g,k,A){this.name=w,this.modifiable=Boolean(g),this.defaultValue=k,this._valueTransformer=A},{transform:function(w){var g=this._valueTransformer;return typeof g=="function"?g(w,this):w}}),V=G,W=p.extend(null,{abs:function(w){return w!=null?Math.abs(w):null},hasOwn:function(w,g){return Object.prototype.hasOwnProperty.call(w,g)},noop:function(){},toUpperCase:function(w){return w!=null?w.toUpperCase():null}}),U=W,K=p.extend(function(w){this.options={},w.forEach(function(g){this.options[g.name]=g},this)},{exists:function(w){return this.options[w]!=null},get:function(w,g){return K._get(this.options[w],g)},getAll:function(w){var g,k=this.options,A={};for(g in k)U.hasOwn(k,g)&&(A[g]=K._get(k[g],w));return A},init:function(w,g,k){typeof k!="function"&&(k=U.noop);var A,I;for(A in this.options)U.hasOwn(this.options,A)&&(I=this.options[A],K._set(I,I.defaultValue,g),K._createAccessor(I,g,k));this._setAll(w,g,!0)},set:function(w,g,k){return this._set(w,g,k)},setAll:function(w,g){return this._setAll(w,g)},_set:function(w,g,k,A){var I=this.options[w];if(!I)throw new Error("Invalid option: "+w);if(!I.modifiable&&!A)throw new Error("Option cannot be modified: "+w);return K._set(I,g,k)},_setAll:function(w,g,k){if(!w)return!1;var A,I=!1;for(A in w)U.hasOwn(w,A)&&this._set(A,w[A],g,k)&&(I=!0);return I}},{_createAccessor:function(w,g,k){var A={get:function(){return K._get(w,g)}};w.modifiable&&(A.set=function(I){K._set(w,I,g)&&k(I,w)}),Object.defineProperty(g,w.name,A)},_get:function(w,g){return g["_"+w.name]},_set:function(w,g,k){var A="_"+w.name,I=k[A],Q=w.transform(g!=null?g:w.defaultValue);return k[A]=Q,Q!==I}}),j=K,Y=p.extend(function(){this._services={}},{getService:function(w){var g=this._services[w];if(!g)throw new Error("Service is not being managed with name: "+w);return g},setService:function(w,g){if(this._services[w])throw new Error("Service is already managed with name: "+w);g&&(this._services[w]=g)}}),X=Y,oe=new j([new V("background",!0,"white"),new V("backgroundAlpha",!0,1,U.abs),new V("element"),new V("foreground",!0,"black"),new V("foregroundAlpha",!0,1,U.abs),new V("level",!0,"L",U.toUpperCase),new V("mime",!0,"image/png"),new V("padding",!0,null,U.abs),new V("size",!0,100,U.abs),new V("value",!0,"")]),ue=new X,ke=p.extend(function(w){oe.init(w,this,this.update.bind(this));var g=oe.get("element",this),k=ue.getService("element"),A=g&&k.isCanvas(g)?g:k.createCanvas(),I=g&&k.isImage(g)?g:k.createImage();this._canvasRenderer=new S(this,A,!0),this._imageRenderer=new z(this,I,I===g),this.update()},{get:function(){return oe.getAll(this)},set:function(w){oe.setAll(w,this)&&this.update()},toDataURL:function(w){return this.canvas.toDataURL(w||this.mime)},update:function(){var w=new x({level:this.level,value:this.value});this._canvasRenderer.render(w),this._imageRenderer.render(w)}},{use:function(w){ue.setService(w.getName(),w)}});Object.defineProperties(ke.prototype,{canvas:{get:function(){return this._canvasRenderer.getElement()}},image:{get:function(){return this._imageRenderer.getElement()}}});var me=ke,$e=me,He=p.extend({getName:function(){}}),Re=He,je=Re.extend({createCanvas:function(){},createImage:function(){},getName:function(){return"element"},isCanvas:function(w){},isImage:function(w){}}),we=je,Te=we.extend({createCanvas:function(){return document.createElement("canvas")},createImage:function(){return document.createElement("img")},isCanvas:function(w){return w instanceof HTMLCanvasElement},isImage:function(w){return w instanceof HTMLImageElement}}),Oe=Te;$e.use(new Oe);var Me=$e;return Me})})(xc);const lp=xc.exports;function np(t){let e,l;return{c(){e=m("img"),Js(e.src,l=t[2])||o(e,"src",l),o(e,"alt",t[0]),o(e,"class",t[1])},m(n,i){M(n,e,i)},p(n,[i]){i&4&&!Js(e.src,l=n[2])&&o(e,"src",l),i&1&&o(e,"alt",n[0]),i&2&&o(e,"class",n[1])},i:fe,o:fe,d(n){n&&C(e)}}}function ip(t,e,l){const n=new lp;let{errorCorrection:i="L"}=e,{background:r="#fff"}=e,{color:u="#000"}=e,{size:a="200"}=e,{value:c=""}=e,{padding:f=0}=e,{className:_="qrcode"}=e,p="";function b(){n.set({background:r,foreground:u,level:i,padding:f,size:a,value:c}),l(2,p=n.toDataURL("image/jpeg"))}return oc(()=>{b()}),t.$$set=v=>{"errorCorrection"in v&&l(3,i=v.errorCorrection),"background"in v&&l(4,r=v.background),"color"in v&&l(5,u=v.color),"size"in v&&l(6,a=v.size),"value"in v&&l(0,c=v.value),"padding"in v&&l(7,f=v.padding),"className"in v&&l(1,_=v.className)},t.$$.update=()=>{t.$$.dirty&1&&c&&b()},[c,_,p,i,r,u,a,f]}class sp extends Pe{constructor(e){super(),Ee(this,e,ip,np,Ne,{errorCorrection:3,background:4,color:5,size:6,value:0,padding:7,className:1})}}function af(t,e,l){const n=t.slice();return n[95]=e[l],n[96]=e,n[97]=l,n}function uf(t,e,l){const n=t.slice();return n[98]=e[l],n[99]=e,n[100]=l,n}function rp(t,e,l){const n=t.slice();return n[101]=e[l],n}function op(t,e,l){const n=t.slice();return n[104]=e[l],n}function ap(t){let e,l;return{c(){e=m("option"),l=T(t[104]),e.__value=t[104],e.value=e.__value},m(n,i){M(n,e,i),s(e,l)},p:fe,d(n){n&&C(e)}}}function ff(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),o(l,"name","pt"),o(l,"type","text"),o(l,"class","in-s"),o(l,"placeholder","ENTSO-E API key, optional, read docs")},m(r,u){M(r,e,u),M(r,l,u),te(l,t[3].p.t),n||(i=ee(l,"input",t[22]),n=!0)},p(r,u){u[0]&8&&l.value!==r[3].p.t&&te(l,r[3].p.t)},d(r){r&&C(e),r&&C(l),n=!1,i()}}}function cf(t){let e,l,n,i,r,u,a,c,f,_,p,b,v;return{c(){e=m("div"),l=T("Username"),n=m("br"),i=h(),r=m("input"),u=h(),a=m("div"),c=T("Password"),f=m("br"),_=h(),p=m("input"),o(r,"name","gu"),o(r,"type","text"),o(r,"class","in-s"),o(e,"class","my-1"),o(p,"name","gp"),o(p,"type","password"),o(p,"class","in-s"),o(a,"class","my-1")},m(d,S){M(d,e,S),s(e,l),s(e,n),s(e,i),s(e,r),te(r,t[3].g.u),M(d,u,S),M(d,a,S),s(a,c),s(a,f),s(a,_),s(a,p),te(p,t[3].g.p),b||(v=[ee(r,"input",t[24]),ee(p,"input",t[25])],b=!0)},p(d,S){S[0]&8&&r.value!==d[3].g.u&&te(r,d[3].g.u),S[0]&8&&p.value!==d[3].g.p&&te(p,d[3].g.p)},d(d){d&&C(e),d&&C(u),d&&C(a),b=!1,ze(v)}}}function up(t){let e,l=t[101]*100+"",n;return{c(){e=m("option"),n=T(l),e.__value=t[101]*100,e.value=e.__value},m(i,r){M(i,e,r),s(e,n)},p:fe,d(i){i&&C(e)}}}function mf(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),o(l,"name","mek"),o(l,"type","text"),o(l,"class","in-s")},m(r,u){M(r,e,u),M(r,l,u),te(l,t[3].m.e.k),n||(i=ee(l,"input",t[34]),n=!0)},p(r,u){u[0]&8&&l.value!==r[3].m.e.k&&te(l,r[3].m.e.k)},d(r){r&&C(e),r&&C(l),n=!1,i()}}}function pf(t){let e,l,n,i,r,u,a;return{c(){e=m("div"),l=T("Authentication key"),n=m("br"),i=h(),r=m("input"),o(r,"name","mea"),o(r,"type","text"),o(r,"class","in-s"),o(e,"class","my-1")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,r),te(r,t[3].m.e.a),u||(a=ee(r,"input",t[35]),u=!0)},p(c,f){f[0]&8&&r.value!==c[3].m.e.a&&te(r,c[3].m.e.a)},d(c){c&&C(e),u=!1,a()}}}function _f(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,$,N,P,B,E,O,L,F,x,H;return{c(){e=m("div"),l=m("div"),n=T("Watt"),i=m("br"),r=h(),u=m("input"),a=h(),c=m("div"),f=T("Volt"),_=m("br"),p=h(),b=m("input"),v=h(),d=m("div"),S=T("Amp"),y=m("br"),$=h(),N=m("input"),P=h(),B=m("div"),E=T("kWh"),O=m("br"),L=h(),F=m("input"),o(u,"name","mmw"),o(u,"type","number"),o(u,"min","0.00"),o(u,"max","1000"),o(u,"step","0.001"),o(u,"class","in-f tr w-full"),o(l,"class","w-1/4"),o(b,"name","mmv"),o(b,"type","number"),o(b,"min","0.00"),o(b,"max","1000"),o(b,"step","0.001"),o(b,"class","in-m tr w-full"),o(c,"class","w-1/4"),o(N,"name","mma"),o(N,"type","number"),o(N,"min","0.00"),o(N,"max","1000"),o(N,"step","0.001"),o(N,"class","in-m tr w-full"),o(d,"class","w-1/4"),o(F,"name","mmc"),o(F,"type","number"),o(F,"min","0.00"),o(F,"max","1000"),o(F,"step","0.001"),o(F,"class","in-l tr w-full"),o(B,"class","w-1/4"),o(e,"class","flex my-1")},m(z,G){M(z,e,G),s(e,l),s(l,n),s(l,i),s(l,r),s(l,u),te(u,t[3].m.m.w),s(e,a),s(e,c),s(c,f),s(c,_),s(c,p),s(c,b),te(b,t[3].m.m.v),s(e,v),s(e,d),s(d,S),s(d,y),s(d,$),s(d,N),te(N,t[3].m.m.a),s(e,P),s(e,B),s(B,E),s(B,O),s(B,L),s(B,F),te(F,t[3].m.m.c),x||(H=[ee(u,"input",t[37]),ee(b,"input",t[38]),ee(N,"input",t[39]),ee(F,"input",t[40])],x=!0)},p(z,G){G[0]&8&&he(u.value)!==z[3].m.m.w&&te(u,z[3].m.m.w),G[0]&8&&he(b.value)!==z[3].m.m.v&&te(b,z[3].m.m.v),G[0]&8&&he(N.value)!==z[3].m.m.a&&te(N,z[3].m.m.a),G[0]&8&&he(F.value)!==z[3].m.m.c&&te(F,z[3].m.m.c)},d(z){z&&C(e),x=!1,ze(H)}}}function df(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y;return{c(){e=m("div"),l=T("Gateway"),n=m("br"),i=h(),r=m("input"),u=h(),a=m("div"),c=T("DNS"),f=m("br"),_=h(),p=m("div"),b=m("input"),v=h(),d=m("input"),o(r,"name","ng"),o(r,"type","text"),o(r,"class","in-s"),o(e,"class","my-1"),o(b,"name","nd1"),o(b,"type","text"),o(b,"class","in-f w-full"),o(d,"name","nd2"),o(d,"type","text"),o(d,"class","in-l w-full"),o(p,"class","flex"),o(a,"class","my-1")},m($,N){M($,e,N),s(e,l),s(e,n),s(e,i),s(e,r),te(r,t[3].n.g),M($,u,N),M($,a,N),s(a,c),s(a,f),s(a,_),s(a,p),s(p,b),te(b,t[3].n.d1),s(p,v),s(p,d),te(d,t[3].n.d2),S||(y=[ee(r,"input",t[49]),ee(b,"input",t[50]),ee(d,"input",t[51])],S=!0)},p($,N){N[0]&8&&r.value!==$[3].n.g&&te(r,$[3].n.g),N[0]&8&&b.value!==$[3].n.d1&&te(b,$[3].n.d1),N[0]&8&&d.value!==$[3].n.d2&&te(d,$[3].n.d2)},d($){$&&C(e),$&&C(u),$&&C(a),S=!1,ze(y)}}}function vf(t){let e,l,n,i,r;return{c(){e=m("label"),l=m("input"),n=T(" SSL"),o(l,"type","checkbox"),o(l,"name","qs"),l.__value="true",l.value=l.__value,o(l,"class","rounded mb-1"),o(e,"class","float-right mr-3")},m(u,a){M(u,e,a),s(e,l),l.checked=t[3].q.s.e,s(e,n),i||(r=[ee(l,"change",t[55]),ee(l,"change",t[14])],i=!0)},p(u,a){a[0]&8&&(l.checked=u[3].q.s.e)},d(u){u&&C(e),i=!1,ze(r)}}}function hf(t){let e,l,n,i,r,u,a,c,f,_,p,b,v;const d=[cp,fp],S=[];function y(L,F){return L[3].q.s.c?0:1}n=y(t),i=S[n]=d[n](t);const $=[dp,_p],N=[];function P(L,F){return L[3].q.s.r?0:1}a=P(t),c=N[a]=$[a](t);const B=[gp,bp],E=[];function O(L,F){return L[3].q.s.k?0:1}return p=O(t),b=E[p]=B[p](t),{c(){e=m("div"),l=m("span"),i.c(),r=h(),u=m("span"),c.c(),f=h(),_=m("span"),b.c(),o(l,"class","flex pr-2"),o(u,"class","flex pr-2"),o(_,"class","flex pr-2"),o(e,"class","my-1 flex")},m(L,F){M(L,e,F),s(e,l),S[n].m(l,null),s(e,r),s(e,u),N[a].m(u,null),s(e,f),s(e,_),E[p].m(_,null),v=!0},p(L,F){let x=n;n=y(L),n===x?S[n].p(L,F):(De(),q(S[x],1,1,()=>{S[x]=null}),Ie(),i=S[n],i?i.p(L,F):(i=S[n]=d[n](L),i.c()),D(i,1),i.m(l,null));let H=a;a=P(L),a===H?N[a].p(L,F):(De(),q(N[H],1,1,()=>{N[H]=null}),Ie(),c=N[a],c?c.p(L,F):(c=N[a]=$[a](L),c.c()),D(c,1),c.m(u,null));let z=p;p=O(L),p===z?E[p].p(L,F):(De(),q(E[z],1,1,()=>{E[z]=null}),Ie(),b=E[p],b?b.p(L,F):(b=E[p]=B[p](L),b.c()),D(b,1),b.m(_,null))},i(L){v||(D(i),D(c),D(b),v=!0)},o(L){q(i),q(c),q(b),v=!1},d(L){L&&C(e),S[n].d(),N[a].d(),E[p].d()}}}function fp(t){let e,l;return e=new el({props:{to:"/mqtt-ca",$$slots:{default:[mp]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const r={};i[3]&16384&&(r.$$scope={dirty:i,ctx:n}),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function cp(t){let e,l,n,i,r,u,a,c;return l=new el({props:{to:"/mqtt-ca",$$slots:{default:[pp]},$$scope:{ctx:t}}}),r=new $r({}),{c(){e=m("span"),ie(l.$$.fragment),n=h(),i=m("span"),ie(r.$$.fragment),o(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),o(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,_){M(f,e,_),le(l,e,null),M(f,n,_),M(f,i,_),le(r,i,null),u=!0,a||(c=[ee(i,"click",t[11]),ee(i,"keypress",t[11])],a=!0)},p(f,_){const p={};_[3]&16384&&(p.$$scope={dirty:_,ctx:f}),l.$set(p)},i(f){u||(D(l.$$.fragment,f),D(r.$$.fragment,f),u=!0)},o(f){q(l.$$.fragment,f),q(r.$$.fragment,f),u=!1},d(f){f&&C(e),ne(l),f&&C(n),f&&C(i),ne(r),a=!1,ze(c)}}}function mp(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload CA",title:"Click here to upload CA"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function pp(t){let e;return{c(){e=T("CA OK")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function _p(t){let e,l;return e=new el({props:{to:"/mqtt-cert",$$slots:{default:[vp]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const r={};i[3]&16384&&(r.$$scope={dirty:i,ctx:n}),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function dp(t){let e,l,n,i,r,u,a,c;return l=new el({props:{to:"/mqtt-cert",$$slots:{default:[hp]},$$scope:{ctx:t}}}),r=new $r({}),{c(){e=m("span"),ie(l.$$.fragment),n=h(),i=m("span"),ie(r.$$.fragment),o(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),o(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,_){M(f,e,_),le(l,e,null),M(f,n,_),M(f,i,_),le(r,i,null),u=!0,a||(c=[ee(i,"click",t[12]),ee(i,"keypress",t[12])],a=!0)},p(f,_){const p={};_[3]&16384&&(p.$$scope={dirty:_,ctx:f}),l.$set(p)},i(f){u||(D(l.$$.fragment,f),D(r.$$.fragment,f),u=!0)},o(f){q(l.$$.fragment,f),q(r.$$.fragment,f),u=!1},d(f){f&&C(e),ne(l),f&&C(n),f&&C(i),ne(r),a=!1,ze(c)}}}function vp(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload cert",title:"Click here to upload certificate"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function hp(t){let e;return{c(){e=T("Cert OK")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function bp(t){let e,l;return e=new el({props:{to:"/mqtt-key",$$slots:{default:[kp]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const r={};i[3]&16384&&(r.$$scope={dirty:i,ctx:n}),e.$set(r)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function gp(t){let e,l,n,i,r,u,a,c;return l=new el({props:{to:"/mqtt-key",$$slots:{default:[wp]},$$scope:{ctx:t}}}),r=new $r({}),{c(){e=m("span"),ie(l.$$.fragment),n=h(),i=m("span"),ie(r.$$.fragment),o(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),o(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,_){M(f,e,_),le(l,e,null),M(f,n,_),M(f,i,_),le(r,i,null),u=!0,a||(c=[ee(i,"click",t[13]),ee(i,"keypress",t[13])],a=!0)},p(f,_){const p={};_[3]&16384&&(p.$$scope={dirty:_,ctx:f}),l.$set(p)},i(f){u||(D(l.$$.fragment,f),D(r.$$.fragment,f),u=!0)},o(f){q(l.$$.fragment,f),q(r.$$.fragment,f),u=!1},d(f){f&&C(e),ne(l),f&&C(n),f&&C(i),ne(r),a=!1,ze(c)}}}function kp(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload key",title:"Click here to upload key"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function wp(t){let e;return{c(){e=T("Key OK")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function bf(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,$,N,P,B,E,O,L,F,x,H,z,G,V,W,U,K;return r=new Bt({}),{c(){e=m("div"),l=m("strong"),l.textContent="Domoticz",n=h(),i=m("a"),ie(r.$$.fragment),u=h(),a=m("input"),c=h(),f=m("div"),_=m("div"),p=T("Electricity IDX"),b=m("br"),v=h(),d=m("input"),S=h(),y=m("div"),$=T("Current IDX"),N=m("br"),P=h(),B=m("input"),E=h(),O=m("div"),L=T(`Voltage IDX: L1, L2 & L3 `),F=m("div"),x=m("input"),H=h(),z=m("input"),G=h(),V=m("input"),o(l,"class","text-sm"),o(i,"href",Ut("MQTT-configuration#domoticz")),o(i,"target","_blank"),o(i,"class","float-right"),o(a,"type","hidden"),o(a,"name","o"),a.value="true",o(d,"name","oe"),o(d,"type","text"),o(d,"class","in-f tr w-full"),o(_,"class","w-1/2"),o(B,"name","oc"),o(B,"type","text"),o(B,"class","in-l tr w-full"),o(y,"class","w-1/2"),o(f,"class","my-1 flex"),o(x,"name","ou1"),o(x,"type","text"),o(x,"class","in-f tr w-1/3"),o(z,"name","ou2"),o(z,"type","text"),o(z,"class","in-m tr w-1/3"),o(V,"name","ou3"),o(V,"type","text"),o(V,"class","in-l tr w-1/3"),o(F,"class","flex"),o(O,"class","my-1"),o(e,"class","cnt")},m(j,Y){M(j,e,Y),s(e,l),s(e,n),s(e,i),le(r,i,null),s(e,u),s(e,a),s(e,c),s(e,f),s(f,_),s(_,p),s(_,b),s(_,v),s(_,d),te(d,t[3].o.e),s(f,S),s(f,y),s(y,$),s(y,N),s(y,P),s(y,B),te(B,t[3].o.c),s(e,E),s(e,O),s(O,L),s(O,F),s(F,x),te(x,t[3].o.u1),s(F,H),s(F,z),te(z,t[3].o.u2),s(F,G),s(F,V),te(V,t[3].o.u3),W=!0,U||(K=[ee(d,"input",t[63]),ee(B,"input",t[64]),ee(x,"input",t[65]),ee(z,"input",t[66]),ee(V,"input",t[67])],U=!0)},p(j,Y){Y[0]&8&&d.value!==j[3].o.e&&te(d,j[3].o.e),Y[0]&8&&B.value!==j[3].o.c&&te(B,j[3].o.c),Y[0]&8&&x.value!==j[3].o.u1&&te(x,j[3].o.u1),Y[0]&8&&z.value!==j[3].o.u2&&te(z,j[3].o.u2),Y[0]&8&&V.value!==j[3].o.u3&&te(V,j[3].o.u3)},i(j){W||(D(r.$$.fragment,j),W=!0)},o(j){q(r.$$.fragment,j),W=!1},d(j){j&&C(e),ne(r),U=!1,ze(K)}}}function gf(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,$,N,P,B,E,O,L,F,x,H,z,G,V;return r=new Bt({}),{c(){e=m("div"),l=m("strong"),l.textContent="Home-Assistant",n=h(),i=m("a"),ie(r.$$.fragment),u=h(),a=m("input"),c=h(),f=m("div"),_=T("Discovery topic prefix"),p=m("br"),b=h(),v=m("input"),d=h(),S=m("div"),y=T("Hostname for URL"),$=m("br"),N=h(),P=m("input"),E=h(),O=m("div"),L=T("Name tag"),F=m("br"),x=h(),H=m("input"),o(l,"class","text-sm"),o(i,"href",Ut("MQTT-configuration#home-assistant")),o(i,"target","_blank"),o(i,"class","float-right"),o(a,"type","hidden"),o(a,"name","h"),a.value="true",o(v,"name","ht"),o(v,"type","text"),o(v,"class","in-s"),o(v,"placeholder","homeassistant"),o(f,"class","my-1"),o(P,"name","hh"),o(P,"type","text"),o(P,"class","in-s"),o(P,"placeholder",B=t[3].g.h+".local"),o(S,"class","my-1"),o(H,"name","hn"),o(H,"type","text"),o(H,"class","in-s"),o(O,"class","my-1"),o(e,"class","cnt")},m(W,U){M(W,e,U),s(e,l),s(e,n),s(e,i),le(r,i,null),s(e,u),s(e,a),s(e,c),s(e,f),s(f,_),s(f,p),s(f,b),s(f,v),te(v,t[3].h.t),s(e,d),s(e,S),s(S,y),s(S,$),s(S,N),s(S,P),te(P,t[3].h.h),s(e,E),s(e,O),s(O,L),s(O,F),s(O,x),s(O,H),te(H,t[3].h.n),z=!0,G||(V=[ee(v,"input",t[68]),ee(P,"input",t[69]),ee(H,"input",t[70])],G=!0)},p(W,U){U[0]&8&&v.value!==W[3].h.t&&te(v,W[3].h.t),(!z||U[0]&8&&B!==(B=W[3].g.h+".local"))&&o(P,"placeholder",B),U[0]&8&&P.value!==W[3].h.h&&te(P,W[3].h.h),U[0]&8&&H.value!==W[3].h.n&&te(H,W[3].h.n)},i(W){z||(D(r.$$.fragment,W),z=!0)},o(W){q(r.$$.fragment,W),z=!1},d(W){W&&C(e),ne(r),G=!1,ze(V)}}}function kf(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d=t[3].c.es&&wf(t);return{c(){e=m("div"),l=m("input"),n=h(),i=m("strong"),i.textContent="Cloud connections",r=h(),u=m("div"),a=m("label"),c=m("input"),f=T(" Energy Speedometer"),_=h(),d&&d.c(),o(l,"type","hidden"),o(l,"name","c"),l.value="true",o(i,"class","text-sm"),o(c,"type","checkbox"),o(c,"class","rounded mb-1"),o(c,"name","ces"),c.__value="true",c.value=c.__value,o(u,"class","my-1"),o(e,"class","cnt")},m(S,y){M(S,e,y),s(e,l),s(e,n),s(e,i),s(e,r),s(e,u),s(u,a),s(a,c),c.checked=t[3].c.es,s(a,f),s(u,_),d&&d.m(u,null),p=!0,b||(v=ee(c,"change",t[71]),b=!0)},p(S,y){y[0]&8&&(c.checked=S[3].c.es),S[3].c.es?d?(d.p(S,y),y[0]&8&&D(d,1)):(d=wf(S),d.c(),D(d,1),d.m(u,null)):d&&(De(),q(d,1,1,()=>{d=null}),Ie())},i(S){p||(D(d),p=!0)},o(S){q(d),p=!1},d(S){S&&C(e),d&&d.d(),b=!1,v()}}}function wf(t){let e,l,n=t[0].mac+"",i,r,u,a,c=(t[0].meter.id?t[0].meter.id:"missing, required")+"",f,_,p,b,v=t[0].mac&&t[0].meter.id&&yf(t);return{c(){e=m("div"),l=T("MAC: "),i=T(n),r=h(),u=m("div"),a=T("Meter ID: "),f=T(c),_=h(),v&&v.c(),p=Ve(),o(e,"class","pl-5"),o(u,"class","pl-5")},m(d,S){M(d,e,S),s(e,l),s(e,i),M(d,r,S),M(d,u,S),s(u,a),s(u,f),M(d,_,S),v&&v.m(d,S),M(d,p,S),b=!0},p(d,S){(!b||S[0]&1)&&n!==(n=d[0].mac+"")&&Z(i,n),(!b||S[0]&1)&&c!==(c=(d[0].meter.id?d[0].meter.id:"missing, required")+"")&&Z(f,c),d[0].mac&&d[0].meter.id?v?(v.p(d,S),S[0]&1&&D(v,1)):(v=yf(d),v.c(),D(v,1),v.m(p.parentNode,p)):v&&(De(),q(v,1,1,()=>{v=null}),Ie())},i(d){b||(D(v),b=!0)},o(d){q(v),b=!1},d(d){d&&C(e),d&&C(r),d&&C(u),d&&C(_),v&&v.d(d),d&&C(p)}}}function yf(t){let e,l,n;return l=new sp({props:{value:'{"mac":"'+t[0].mac+'","meter":"'+t[0].meter.id+'"}'}}),{c(){e=m("div"),ie(l.$$.fragment),o(e,"class","pl-2")},m(i,r){M(i,e,r),le(l,e,null),n=!0},p(i,r){const u={};r[0]&1&&(u.value='{"mac":"'+i[0].mac+'","meter":"'+i[0].meter.id+'"}'),l.$set(u)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Cf(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,$,N,P;r=new Bt({});let B={length:9},E=[];for(let O=0;O20&&Tf(t),_=t[0].chip=="esp8266"&&Ef(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Hardware",n=h(),i=m("a"),ie(r.$$.fragment),u=h(),f&&f.c(),a=h(),_&&_.c(),o(l,"class","text-sm"),o(i,"href",Ut("GPIO-configuration")),o(i,"target","_blank"),o(i,"class","float-right"),o(e,"class","cnt")},m(p,b){M(p,e,b),s(e,l),s(e,n),s(e,i),le(r,i,null),s(e,u),f&&f.m(e,null),s(e,a),_&&_.m(e,null),c=!0},p(p,b){p[0].board>20?f?(f.p(p,b),b[0]&1&&D(f,1)):(f=Tf(p),f.c(),D(f,1),f.m(e,a)):f&&(De(),q(f,1,1,()=>{f=null}),Ie()),p[0].chip=="esp8266"?_?_.p(p,b):(_=Ef(p),_.c(),_.m(e,null)):_&&(_.d(1),_=null)},i(p){c||(D(r.$$.fragment,p),D(f),c=!0)},o(p){q(r.$$.fragment,p),q(f),c=!1},d(p){p&&C(e),ne(r),f&&f.d(),_&&_.d()}}}function Tf(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,$,N,P,B,E,O,L,F,x,H,z,G,V,W,U,K,j,Y,X,oe,ue,ke,me,$e,He,Re,je,we,Te,Oe,Me,w,g,k,A,I,Q,J,se,ce,ve,Se,re;b=new Zc({props:{chip:t[0].chip}});let pe=t[0].chip!="esp8266"&&Nf(t),Be=t[3].i.v.p>0&&Af(t);return{c(){e=m("input"),l=h(),n=m("div"),i=m("div"),r=T("HAN"),u=m("label"),a=m("input"),c=T(" pullup"),f=m("br"),_=h(),p=m("select"),ie(b.$$.fragment),v=h(),d=m("div"),S=T("AP button"),y=m("br"),$=h(),N=m("input"),P=h(),B=m("div"),E=T("LED"),O=m("label"),L=m("input"),F=T(" inv"),x=m("br"),H=h(),z=m("div"),G=m("input"),V=h(),W=m("div"),U=T("RGB"),K=m("label"),j=m("input"),Y=T(" inverted"),X=m("br"),oe=h(),ue=m("div"),ke=m("input"),me=h(),$e=m("input"),He=h(),Re=m("input"),je=h(),we=m("div"),Te=T("Temperature"),Oe=m("br"),Me=h(),w=m("input"),g=h(),k=m("div"),A=T("Analog temp"),I=m("br"),Q=h(),J=m("input"),se=h(),pe&&pe.c(),ce=h(),Be&&Be.c(),o(e,"type","hidden"),o(e,"name","i"),e.value="true",o(a,"name","ihu"),a.__value="true",a.value=a.__value,o(a,"type","checkbox"),o(a,"class","rounded mb-1"),o(u,"class","ml-2"),o(p,"name","ihp"),o(p,"class","in-f w-full"),t[3].i.h.p===void 0&&Qe(()=>t[76].call(p)),o(i,"class","w-1/3"),o(N,"name","ia"),o(N,"type","number"),o(N,"min","0"),o(N,"max",t[6]),o(N,"class","in-m tr w-full"),o(d,"class","w-1/3"),o(L,"name","ili"),L.__value="true",L.value=L.__value,o(L,"type","checkbox"),o(L,"class","rounded mb-1"),o(O,"class","ml-4"),o(G,"name","ilp"),o(G,"type","number"),o(G,"min","0"),o(G,"max",t[6]),o(G,"class","in-l tr w-full"),o(z,"class","flex"),o(B,"class","w-1/3"),o(j,"name","iri"),j.__value="true",j.value=j.__value,o(j,"type","checkbox"),o(j,"class","rounded mb-1"),o(K,"class","ml-4"),o(ke,"name","irr"),o(ke,"type","number"),o(ke,"min","0"),o(ke,"max",t[6]),o(ke,"class","in-f tr w-1/3"),o($e,"name","irg"),o($e,"type","number"),o($e,"min","0"),o($e,"max",t[6]),o($e,"class","in-m tr w-1/3"),o(Re,"name","irb"),o(Re,"type","number"),o(Re,"min","0"),o(Re,"max",t[6]),o(Re,"class","in-l tr w-1/3"),o(ue,"class","flex"),o(W,"class","w-full"),o(w,"name","itd"),o(w,"type","number"),o(w,"min","0"),o(w,"max",t[6]),o(w,"class","in-f tr w-full"),o(we,"class","my-1 w-1/3"),o(J,"name","ita"),o(J,"type","number"),o(J,"min","0"),o(J,"max",t[6]),o(J,"class","in-l tr w-full"),o(k,"class","my-1 pr-1 w-1/3"),o(n,"class","flex flex-wrap")},m(_e,ye){M(_e,e,ye),M(_e,l,ye),M(_e,n,ye),s(n,i),s(i,r),s(i,u),s(u,a),a.checked=t[3].i.h.u,s(u,c),s(i,f),s(i,_),s(i,p),le(b,p,null),qe(p,t[3].i.h.p,!0),s(n,v),s(n,d),s(d,S),s(d,y),s(d,$),s(d,N),te(N,t[3].i.a),s(n,P),s(n,B),s(B,E),s(B,O),s(O,L),L.checked=t[3].i.l.i,s(O,F),s(B,x),s(B,H),s(B,z),s(z,G),te(G,t[3].i.l.p),s(n,V),s(n,W),s(W,U),s(W,K),s(K,j),j.checked=t[3].i.r.i,s(K,Y),s(W,X),s(W,oe),s(W,ue),s(ue,ke),te(ke,t[3].i.r.r),s(ue,me),s(ue,$e),te($e,t[3].i.r.g),s(ue,He),s(ue,Re),te(Re,t[3].i.r.b),s(n,je),s(n,we),s(we,Te),s(we,Oe),s(we,Me),s(we,w),te(w,t[3].i.t.d),s(n,g),s(n,k),s(k,A),s(k,I),s(k,Q),s(k,J),te(J,t[3].i.t.a),s(n,se),pe&&pe.m(n,null),s(n,ce),Be&&Be.m(n,null),ve=!0,Se||(re=[ee(a,"change",t[75]),ee(p,"change",t[76]),ee(N,"input",t[77]),ee(L,"change",t[78]),ee(G,"input",t[79]),ee(j,"change",t[80]),ee(ke,"input",t[81]),ee($e,"input",t[82]),ee(Re,"input",t[83]),ee(w,"input",t[84]),ee(J,"input",t[85])],Se=!0)},p(_e,ye){ye[0]&8&&(a.checked=_e[3].i.h.u);const vt={};ye[0]&1&&(vt.chip=_e[0].chip),b.$set(vt),ye[0]&8&&qe(p,_e[3].i.h.p),(!ve||ye[0]&64)&&o(N,"max",_e[6]),ye[0]&8&&he(N.value)!==_e[3].i.a&&te(N,_e[3].i.a),ye[0]&8&&(L.checked=_e[3].i.l.i),(!ve||ye[0]&64)&&o(G,"max",_e[6]),ye[0]&8&&he(G.value)!==_e[3].i.l.p&&te(G,_e[3].i.l.p),ye[0]&8&&(j.checked=_e[3].i.r.i),(!ve||ye[0]&64)&&o(ke,"max",_e[6]),ye[0]&8&&he(ke.value)!==_e[3].i.r.r&&te(ke,_e[3].i.r.r),(!ve||ye[0]&64)&&o($e,"max",_e[6]),ye[0]&8&&he($e.value)!==_e[3].i.r.g&&te($e,_e[3].i.r.g),(!ve||ye[0]&64)&&o(Re,"max",_e[6]),ye[0]&8&&he(Re.value)!==_e[3].i.r.b&&te(Re,_e[3].i.r.b),(!ve||ye[0]&64)&&o(w,"max",_e[6]),ye[0]&8&&he(w.value)!==_e[3].i.t.d&&te(w,_e[3].i.t.d),(!ve||ye[0]&64)&&o(J,"max",_e[6]),ye[0]&8&&he(J.value)!==_e[3].i.t.a&&te(J,_e[3].i.t.a),_e[0].chip!="esp8266"?pe?pe.p(_e,ye):(pe=Nf(_e),pe.c(),pe.m(n,ce)):pe&&(pe.d(1),pe=null),_e[3].i.v.p>0?Be?Be.p(_e,ye):(Be=Af(_e),Be.c(),Be.m(n,null)):Be&&(Be.d(1),Be=null)},i(_e){ve||(D(b.$$.fragment,_e),ve=!0)},o(_e){q(b.$$.fragment,_e),ve=!1},d(_e){_e&&C(e),_e&&C(l),_e&&C(n),ne(b),pe&&pe.d(),Be&&Be.d(),Se=!1,ze(re)}}}function Nf(t){let e,l,n,i,r,u,a;return{c(){e=m("div"),l=T("Vcc"),n=m("br"),i=h(),r=m("input"),o(r,"name","ivp"),o(r,"type","number"),o(r,"min","0"),o(r,"max",t[6]),o(r,"class","in-s tr w-full"),o(e,"class","my-1 pl-1 w-1/3")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,r),te(r,t[3].i.v.p),u||(a=ee(r,"input",t[86]),u=!0)},p(c,f){f[0]&64&&o(r,"max",c[6]),f[0]&8&&he(r.value)!==c[3].i.v.p&&te(r,c[3].i.v.p)},d(c){c&&C(e),u=!1,a()}}}function Af(t){let e,l,n,i,r,u,a,c,f,_;return{c(){e=m("div"),l=T("Voltage divider"),n=m("br"),i=h(),r=m("div"),u=m("input"),a=h(),c=m("input"),o(u,"name","ivdv"),o(u,"type","number"),o(u,"min","0"),o(u,"max","65535"),o(u,"class","in-f tr w-full"),o(u,"placeholder","VCC"),o(c,"name","ivdg"),o(c,"type","number"),o(c,"min","0"),o(c,"max","65535"),o(c,"class","in-l tr w-full"),o(c,"placeholder","GND"),o(r,"class","flex"),o(e,"class","my-1")},m(p,b){M(p,e,b),s(e,l),s(e,n),s(e,i),s(e,r),s(r,u),te(u,t[3].i.v.d.v),s(r,a),s(r,c),te(c,t[3].i.v.d.g),f||(_=[ee(u,"input",t[87]),ee(c,"input",t[88])],f=!0)},p(p,b){b[0]&8&&he(u.value)!==p[3].i.v.d.v&&te(u,p[3].i.v.d.v),b[0]&8&&he(c.value)!==p[3].i.v.d.g&&te(c,p[3].i.v.d.g)},d(p){p&&C(e),f=!1,ze(_)}}}function Ef(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,$,N=(t[0].board==2||t[0].board==100)&&Pf(t);return{c(){e=m("input"),l=h(),n=m("div"),i=m("div"),r=T("Vcc offset"),u=m("br"),a=h(),c=m("input"),f=h(),_=m("div"),p=T("Multiplier"),b=m("br"),v=h(),d=m("input"),S=h(),N&&N.c(),o(e,"type","hidden"),o(e,"name","iv"),e.value="true",o(c,"name","ivo"),o(c,"type","number"),o(c,"min","0.0"),o(c,"max","3.5"),o(c,"step","0.01"),o(c,"class","in-f tr w-full"),o(i,"class","w-1/3"),o(d,"name","ivm"),o(d,"type","number"),o(d,"min","0.1"),o(d,"max","10"),o(d,"step","0.01"),o(d,"class","in-l tr w-full"),o(_,"class","w-1/3 pr-1"),o(n,"class","my-1 flex flex-wrap")},m(P,B){M(P,e,B),M(P,l,B),M(P,n,B),s(n,i),s(i,r),s(i,u),s(i,a),s(i,c),te(c,t[3].i.v.o),s(n,f),s(n,_),s(_,p),s(_,b),s(_,v),s(_,d),te(d,t[3].i.v.m),s(n,S),N&&N.m(n,null),y||($=[ee(c,"input",t[89]),ee(d,"input",t[90])],y=!0)},p(P,B){B[0]&8&&he(c.value)!==P[3].i.v.o&&te(c,P[3].i.v.o),B[0]&8&&he(d.value)!==P[3].i.v.m&&te(d,P[3].i.v.m),P[0].board==2||P[0].board==100?N?N.p(P,B):(N=Pf(P),N.c(),N.m(n,null)):N&&(N.d(1),N=null)},d(P){P&&C(e),P&&C(l),P&&C(n),N&&N.d(),y=!1,ze($)}}}function Pf(t){let e,l,n,i,r,u,a;return{c(){e=m("div"),l=T("Boot limit"),n=m("br"),i=h(),r=m("input"),o(r,"name","ivb"),o(r,"type","number"),o(r,"min","2.5"),o(r,"max","3.5"),o(r,"step","0.1"),o(r,"class","in-s tr w-full"),o(e,"class","w-1/3 pl-1")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,r),te(r,t[3].i.v.b),u||(a=ee(r,"input",t[91]),u=!0)},p(c,f){f[0]&8&&he(r.value)!==c[3].i.v.b&&te(r,c[3].i.v.b)},d(c){c&&C(e),u=!1,a()}}}function Df(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,$=t[3].d.t&&If();return{c(){e=m("div"),e.textContent="Debug can cause sudden reboots. Do not leave on!",l=h(),n=m("div"),i=m("label"),r=m("input"),u=T(" Enable telnet"),a=h(),$&&$.c(),c=h(),f=m("div"),_=m("select"),p=m("option"),p.textContent="Verbose",b=m("option"),b.textContent="Debug",v=m("option"),v.textContent="Info",d=m("option"),d.textContent="Warning",o(e,"class","bd-red"),o(r,"type","checkbox"),o(r,"name","dt"),r.__value="true",r.value=r.__value,o(r,"class","rounded mb-1"),o(n,"class","my-1"),p.__value=1,p.value=p.__value,b.__value=2,b.value=b.__value,v.__value=3,v.value=v.__value,d.__value=4,d.value=d.__value,o(_,"name","dl"),o(_,"class","in-s"),t[3].d.l===void 0&&Qe(()=>t[94].call(_)),o(f,"class","my-1")},m(N,P){M(N,e,P),M(N,l,P),M(N,n,P),s(n,i),s(i,r),r.checked=t[3].d.t,s(i,u),M(N,a,P),$&&$.m(N,P),M(N,c,P),M(N,f,P),s(f,_),s(_,p),s(_,b),s(_,v),s(_,d),qe(_,t[3].d.l,!0),S||(y=[ee(r,"change",t[93]),ee(_,"change",t[94])],S=!0)},p(N,P){P[0]&8&&(r.checked=N[3].d.t),N[3].d.t?$||($=If(),$.c(),$.m(c.parentNode,c)):$&&($.d(1),$=null),P[0]&8&&qe(_,N[3].d.l)},d(N){N&&C(e),N&&C(l),N&&C(n),N&&C(a),$&&$.d(N),N&&C(c),N&&C(f),S=!1,ze(y)}}}function If(t){let e;return{c(){e=m("div"),e.textContent="Telnet is unsafe and should be off when not in use",o(e,"class","bd-red")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function yp(t){let e,l,n,i,r,u,a,c,f,_,p,b,v,d,S,y,$,N,P,B,E,O,L,F,x,H,z,G,V,W,U,K,j,Y,X,oe,ue,ke,me,$e,He,Re,je,we,Te,Oe,Me,w,g,k,A,I,Q,J,se,ce,ve,Se,re,pe,Be,_e,ye,vt,jl,tl,ct,Tl,pl,jt,ht,Xe,Ze,Je,Ue,xe,We,et,tt,de,Ce,Pi,_l,_n,Tt,Di,Ii,Ri,dl,Oi,Li,Fi,Nt,Nl,Al,El,qi,Ge,Ae,vl,Ts,Pl,Rt,Bi,Wl,Nr,ll,Ui,Ar,Ns,Er,ci,Wt,Pr,Dr,Dl,nl,Il,Ir,Hi,Rr,pt,Rl,Or,ji,dn,vn,hn,bn,Wi,Lr,At,zi,Fr,zl,qr,Br,Ur,il,gn,kn,Hr,wn,Gl,jr,Wr,zr,yn,zt,Gr,Gi,Vr,Vl,Kr,Yr,Qr,Cn,Gt,Xr,Vi,Zr,As,Jr,Kl,Ki,Vt,xr,eo,to,Es,Yi,Kt,lo,no,io,mt,Qi,so,Mn,Sn,ro,mi,oo,Yl,ao,uo,fo,hl,co,Ql,mo,po,_o,bl,vo,$n,Xl,ho,bo,go,Ot,Tn,Nn,An,En,ko,Zl,wo,yo,Co,Pn,Lt,Mo,Xi,So,Zi,Ji,Yt,$o,To,ut,xi,No,Dn,In,Ao,Jl,Eo,Po,Do,Ol,sl,Rn,On,Io,Et,es,ts,Ro,Pt,Ln,ls,ns,Oo,Ps,is,ss,Qt,Lo,Fo,pi,qo,Ll,Bo,_i,Xt,Uo,Ho,jo,rs,gl,Wo,Ye,os,zo,Fn,qn,Go,di,Vo,rl,Ko,Ds,Yo,Qo,Bn,kl,Xo,Zt,Zo,Is,xl,Jo,xo,ea,wl,ta,en,la,na,ia,yl,sa,Un,Hn,ra,oa,aa,Cl,ua,jn,fa,ca,ma,bt,Wn,zn,Gn,Vn,Kn,Yn,pa,tn,_a,da,va,Ml,ha,Rs,Os,Ls,Fs=t[3].p.r.startsWith("10YNO")||t[3].p.r.startsWith("10Y1001A1001A4"),qs,ol,as,ba,Qn,Xn,ga,vi,ka,hi,wa,Bs,Dt,us,ya,Zn,Jn,Ca,bi,Ma,fs,cs,Jt,Sa,$a,Ta,Fl,Us,xn,Na,ms,ei,Aa,ps,Hs,ln,js,nn,Ws,sn,zs,rn,Ft,Gs,Ea;a=new Bt({}),F=new Jm({});let e0=["NOK","SEK","DKK","EUR","CHF"],gi=[];for(let R=0;R<5;R+=1)gi[R]=ap(op(t,e0,R));let gt=t[3].p.e&&t[0].chip!="esp8266"&&ff(t),kt=t[3].g.s>0&&cf(t);Rt=new Bt({});let t0=[24,48,96,192,384,576,1152],ki=[];for(let R=0;R<7;R+=1)ki[R]=up(rp(t,t0,R));let wt=t[3].m.e.e&&mf(t),yt=t[3].m.e.e&&pf(t),Ct=t[3].m.m.e&&_f(t);Sn=new Bt({}),In=new Bt({}),Ln=new Jc({});let Mt=t[3].n.m=="static"&&df(t);qn=new Bt({});let St=t[0].chip!="esp8266"&&vf(t),lt=t[3].q.s.e&&hf(t),nt=t[3].q.m==3&&bf(t),it=t[3].q.m==4&&gf(t),st=t[3].c.es!=null&&kf(t),rt=Fs&&Cf(t);Xn=new Bt({});let ti=t[7],_t=[];for(let R=0;R20||t[0].chip=="esp8266")&&$f(t);Jn=new Bt({});let $t=t[3].d.s&&Df(t);return ln=new It({props:{active:t[1],message:"Loading configuration"}}),nn=new It({props:{active:t[2],message:"Saving configuration"}}),sn=new It({props:{active:t[4],message:"Performing factory reset"}}),rn=new It({props:{active:t[5],message:"Device have been factory reset and switched to AP mode"}}),{c(){e=m("form"),l=m("div"),n=m("div"),i=m("strong"),i.textContent="General",r=h(),u=m("a"),ie(a.$$.fragment),c=h(),f=m("input"),_=h(),p=m("div"),b=m("div"),v=m("div"),d=T("Hostname"),S=m("br"),y=h(),$=m("input"),N=h(),P=m("div"),B=T("Time zone"),E=m("br"),O=h(),L=m("select"),ie(F.$$.fragment),x=h(),H=m("input"),z=h(),G=m("div"),V=m("div"),W=m("div"),U=T("Price region"),K=m("br"),j=h(),Y=m("select"),X=m("optgroup"),oe=m("option"),oe.textContent="NO1",ue=m("option"),ue.textContent="NO2",ke=m("option"),ke.textContent="NO3",me=m("option"),me.textContent="NO4",$e=m("option"),$e.textContent="NO5",He=m("optgroup"),Re=m("option"),Re.textContent="SE1",je=m("option"),je.textContent="SE2",we=m("option"),we.textContent="SE3",Te=m("option"),Te.textContent="SE4",Oe=m("optgroup"),Me=m("option"),Me.textContent="DK1",w=m("option"),w.textContent="DK2",g=m("option"),g.textContent="Austria",k=m("option"),k.textContent="Belgium",A=m("option"),A.textContent="Czech Republic",I=m("option"),I.textContent="Estonia",Q=m("option"),Q.textContent="Finland",J=m("option"),J.textContent="France",se=m("option"),se.textContent="Germany",ce=m("option"),ce.textContent="Great Britain",ve=m("option"),ve.textContent="Latvia",Se=m("option"),Se.textContent="Lithuania",re=m("option"),re.textContent="Netherland",pe=m("option"),pe.textContent="Poland",Be=m("option"),Be.textContent="Switzerland",_e=h(),ye=m("div"),vt=T("Currency"),jl=m("br"),tl=h(),ct=m("select");for(let R=0;R<5;R+=1)gi[R].c();Tl=h(),pl=m("div"),jt=m("div"),ht=m("div"),Xe=T("Fixed price"),Ze=m("br"),Je=h(),Ue=m("input"),xe=h(),We=m("div"),et=T("Multiplier"),tt=m("br"),de=h(),Ce=m("input"),Pi=h(),_l=m("div"),_n=m("label"),Tt=m("input"),Di=T(" Enable price fetch from remote server"),Ii=h(),gt&>.c(),Ri=h(),dl=m("div"),Oi=T("Security"),Li=m("br"),Fi=h(),Nt=m("select"),Nl=m("option"),Nl.textContent="None",Al=m("option"),Al.textContent="Only configuration",El=m("option"),El.textContent="Everything",qi=h(),kt&&kt.c(),Ge=h(),Ae=m("div"),vl=m("strong"),vl.textContent="Meter",Ts=h(),Pl=m("a"),ie(Rt.$$.fragment),Bi=h(),Wl=m("input"),Nr=h(),ll=m("div"),Ui=m("span"),Ui.textContent="Buffer size",Ar=h(),Ns=m("span"),Ns.textContent="Serial conf.",Er=h(),ci=m("label"),Wt=m("input"),Pr=T(" inverted"),Dr=h(),Dl=m("div"),nl=m("select"),Il=m("option"),Ir=T("Autodetect");for(let R=0;R<7;R+=1)ki[R].c();Rr=h(),pt=m("select"),Rl=m("option"),Or=T("-"),dn=m("option"),dn.textContent="7N1",vn=m("option"),vn.textContent="8N1",hn=m("option"),hn.textContent="7E1",bn=m("option"),bn.textContent="8E1",Lr=h(),At=m("input"),Fr=h(),zl=m("div"),qr=T("Voltage"),Br=m("br"),Ur=h(),il=m("select"),gn=m("option"),gn.textContent="400V (TN)",kn=m("option"),kn.textContent="230V (IT/TT)",Hr=h(),wn=m("div"),Gl=m("div"),jr=T("Main fuse"),Wr=m("br"),zr=h(),yn=m("label"),zt=m("input"),Gr=h(),Gi=m("span"),Gi.textContent="A",Vr=h(),Vl=m("div"),Kr=T("Production"),Yr=m("br"),Qr=h(),Cn=m("label"),Gt=m("input"),Xr=h(),Vi=m("span"),Vi.textContent="kWp",Zr=h(),As=m("div"),Jr=h(),Kl=m("div"),Ki=m("label"),Vt=m("input"),xr=T(" Meter is encrypted"),eo=h(),wt&&wt.c(),to=h(),yt&&yt.c(),Es=h(),Yi=m("label"),Kt=m("input"),lo=T(" Multipliers"),no=h(),Ct&&Ct.c(),io=h(),mt=m("div"),Qi=m("strong"),Qi.textContent="WiFi",so=h(),Mn=m("a"),ie(Sn.$$.fragment),ro=h(),mi=m("input"),oo=h(),Yl=m("div"),ao=T("SSID"),uo=m("br"),fo=h(),hl=m("input"),co=h(),Ql=m("div"),mo=T("Password"),po=m("br"),_o=h(),bl=m("input"),vo=h(),$n=m("div"),Xl=m("div"),ho=T("Power saving"),bo=m("br"),go=h(),Ot=m("select"),Tn=m("option"),Tn.textContent="Default",Nn=m("option"),Nn.textContent="Off",An=m("option"),An.textContent="Minimum",En=m("option"),En.textContent="Maximum",ko=h(),Zl=m("div"),wo=T("Power"),yo=m("br"),Co=h(),Pn=m("div"),Lt=m("input"),Mo=h(),Xi=m("span"),Xi.textContent="dBm",So=h(),Zi=m("div"),Ji=m("label"),Yt=m("input"),$o=T(" Allow 802.11b legacy rates"),To=h(),ut=m("div"),xi=m("strong"),xi.textContent="Network",No=h(),Dn=m("a"),ie(In.$$.fragment),Ao=h(),Jl=m("div"),Eo=T("IP"),Po=m("br"),Do=h(),Ol=m("div"),sl=m("select"),Rn=m("option"),Rn.textContent="DHCP",On=m("option"),On.textContent="Static",Io=h(),Et=m("input"),Ro=h(),Pt=m("select"),ie(Ln.$$.fragment),Oo=h(),Mt&&Mt.c(),Ps=h(),is=m("div"),ss=m("label"),Qt=m("input"),Lo=T(" enable mDNS"),Fo=h(),pi=m("input"),qo=h(),Ll=m("div"),Bo=T("NTP "),_i=m("label"),Xt=m("input"),Uo=T(" obtain from DHCP"),Ho=m("br"),jo=h(),rs=m("div"),gl=m("input"),Wo=h(),Ye=m("div"),os=m("strong"),os.textContent="MQTT",zo=h(),Fn=m("a"),ie(qn.$$.fragment),Go=h(),di=m("input"),Vo=h(),rl=m("div"),Ko=T(`Server `),St&&St.c(),Ds=h(),Yo=m("br"),Qo=h(),Bn=m("div"),kl=m("input"),Xo=h(),Zt=m("input"),Zo=h(),lt&<.c(),Is=h(),xl=m("div"),Jo=T("Username"),xo=m("br"),ea=h(),wl=m("input"),ta=h(),en=m("div"),la=T("Password"),na=m("br"),ia=h(),yl=m("input"),sa=h(),Un=m("div"),Hn=m("div"),ra=T("Client ID"),oa=m("br"),aa=h(),Cl=m("input"),ua=h(),jn=m("div"),fa=T("Payload"),ca=m("br"),ma=h(),bt=m("select"),Wn=m("option"),Wn.textContent="JSON",zn=m("option"),zn.textContent="Raw (minimal)",Gn=m("option"),Gn.textContent="Raw (full)",Vn=m("option"),Vn.textContent="Domoticz",Kn=m("option"),Kn.textContent="HomeAssistant",Yn=m("option"),Yn.textContent="HEX dump",pa=h(),tn=m("div"),_a=T("Publish topic"),da=m("br"),va=h(),Ml=m("input"),ha=h(),nt&&nt.c(),Rs=h(),it&&it.c(),Os=h(),st&&st.c(),Ls=h(),rt&&rt.c(),qs=h(),ol=m("div"),as=m("strong"),as.textContent="User interface",ba=h(),Qn=m("a"),ie(Xn.$$.fragment),ga=h(),vi=m("input"),ka=h(),hi=m("div");for(let R=0;R<_t.length;R+=1)_t[R].c();wa=h(),ot&&ot.c(),Bs=h(),Dt=m("div"),us=m("strong"),us.textContent="Debugging",ya=h(),Zn=m("a"),ie(Jn.$$.fragment),Ca=h(),bi=m("input"),Ma=h(),fs=m("div"),cs=m("label"),Jt=m("input"),Sa=T(" Enable debugging"),$a=h(),$t&&$t.c(),Ta=h(),Fl=m("div"),Us=m("div"),xn=m("button"),xn.textContent="Factory reset",Na=h(),ms=m("div"),ei=m("button"),ei.textContent="Reboot",Aa=h(),ps=m("div"),ps.innerHTML='',Hs=h(),ie(ln.$$.fragment),js=h(),ie(nn.$$.fragment),Ws=h(),ie(sn.$$.fragment),zs=h(),ie(rn.$$.fragment),o(i,"class","text-sm"),o(u,"href",Ut("General-configuration")),o(u,"target","_blank"),o(u,"class","float-right"),o(f,"type","hidden"),o(f,"name","g"),f.value="true",o($,"name","gh"),o($,"type","text"),o($,"class","in-f w-full"),o($,"pattern","[A-Za-z0-9-]+"),o(L,"name","gt"),o(L,"class","in-l w-full"),t[3].g.t===void 0&&Qe(()=>t[16].call(L)),o(b,"class","flex"),o(p,"class","my-1"),o(H,"type","hidden"),o(H,"name","p"),H.value="true",oe.__value="10YNO-1--------2",oe.value=oe.__value,ue.__value="10YNO-2--------T",ue.value=ue.__value,ke.__value="10YNO-3--------J",ke.value=ke.__value,me.__value="10YNO-4--------9",me.value=me.__value,$e.__value="10Y1001A1001A48H",$e.value=$e.__value,o(X,"label","Norway"),Re.__value="10Y1001A1001A44P",Re.value=Re.__value,je.__value="10Y1001A1001A45N",je.value=je.__value,we.__value="10Y1001A1001A46L",we.value=we.__value,Te.__value="10Y1001A1001A47J",Te.value=Te.__value,o(He,"label","Sweden"),Me.__value="10YDK-1--------W",Me.value=Me.__value,w.__value="10YDK-2--------M",w.value=w.__value,o(Oe,"label","Denmark"),g.__value="10YAT-APG------L",g.value=g.__value,k.__value="10YBE----------2",k.value=k.__value,A.__value="10YCZ-CEPS-----N",A.value=A.__value,I.__value="10Y1001A1001A39I",I.value=I.__value,Q.__value="10YFI-1--------U",Q.value=Q.__value,J.__value="10YFR-RTE------C",J.value=J.__value,se.__value="10Y1001A1001A83F",se.value=se.__value,ce.__value="10YGB----------A",ce.value=ce.__value,ve.__value="10YLV-1001A00074",ve.value=ve.__value,Se.__value="10YLT-1001A0008Q",Se.value=Se.__value,re.__value="10YNL----------L",re.value=re.__value,pe.__value="10YPL-AREA-----S",pe.value=pe.__value,Be.__value="10YCH-SWISSGRIDZ",Be.value=Be.__value,o(Y,"name","pr"),o(Y,"class","in-f w-full"),t[3].p.r===void 0&&Qe(()=>t[17].call(Y)),o(W,"class","w-full"),o(ct,"name","pc"),o(ct,"class","in-l"),t[3].p.c===void 0&&Qe(()=>t[18].call(ct)),o(V,"class","flex"),o(G,"class","my-1"),o(Ue,"name","pf"),o(Ue,"type","number"),o(Ue,"min","0.001"),o(Ue,"max","65"),o(Ue,"step","0.001"),o(Ue,"class","in-f tr w-full"),o(ht,"class","w-1/2"),o(Ce,"name","pm"),o(Ce,"type","number"),o(Ce,"min","0.001"),o(Ce,"max","1000"),o(Ce,"step","0.001"),o(Ce,"class","in-l tr w-full"),o(We,"class","w-1/2"),o(jt,"class","flex"),o(pl,"class","my-1"),o(Tt,"type","checkbox"),o(Tt,"name","pe"),Tt.__value="true",Tt.value=Tt.__value,o(Tt,"class","rounded mb-1"),o(_l,"class","my-1"),Nl.__value=0,Nl.value=Nl.__value,Al.__value=1,Al.value=Al.__value,El.__value=2,El.value=El.__value,o(Nt,"name","gs"),o(Nt,"class","in-s"),t[3].g.s===void 0&&Qe(()=>t[23].call(Nt)),o(dl,"class","my-1"),o(n,"class","cnt"),o(vl,"class","text-sm"),o(Pl,"href",Ut("Meter-configuration")),o(Pl,"target","_blank"),o(Pl,"class","float-right"),o(Wl,"type","hidden"),o(Wl,"name","m"),Wl.value="true",o(Ui,"class","float-right"),o(Wt,"name","mi"),Wt.__value="true",Wt.value=Wt.__value,o(Wt,"type","checkbox"),o(Wt,"class","rounded mb-1"),o(ci,"class","mt-2 ml-3 whitespace-nowrap"),Il.__value=0,Il.value=Il.__value,Il.disabled=Hi=t[3].m.b!=0,o(nl,"name","mb"),o(nl,"class","in-f tr w-1/2"),t[3].m.b===void 0&&Qe(()=>t[27].call(nl)),Rl.__value=0,Rl.value=Rl.__value,Rl.disabled=ji=t[3].m.b!=0,dn.__value=2,dn.value=dn.__value,vn.__value=3,vn.value=vn.__value,hn.__value=10,hn.value=hn.__value,bn.__value=11,bn.value=bn.__value,o(pt,"name","mp"),o(pt,"class","in-m"),pt.disabled=Wi=t[3].m.b==0,t[3].m.p===void 0&&Qe(()=>t[28].call(pt)),o(At,"name","ms"),o(At,"type","number"),o(At,"min",64),o(At,"max",zi=t[0].chip=="esp8266"?t[3].i.h.p==3||t[3].i.h.p==113?512:128:4096),o(At,"step",64),o(At,"class","in-l tr w-1/2"),o(Dl,"class","flex w-full"),o(ll,"class","my-1"),gn.__value=2,gn.value=gn.__value,kn.__value=1,kn.value=kn.__value,o(il,"name","md"),o(il,"class","in-s"),t[3].m.d===void 0&&Qe(()=>t[30].call(il)),o(zl,"class","my-1"),o(zt,"name","mf"),o(zt,"type","number"),o(zt,"min","5"),o(zt,"max","65535"),o(zt,"class","in-f tr w-full"),o(Gi,"class","in-post"),o(yn,"class","flex"),o(Gl,"class","mx-1"),o(Gt,"name","mr"),o(Gt,"type","number"),o(Gt,"min","0"),o(Gt,"max","65535"),o(Gt,"class","in-f tr w-full"),o(Vi,"class","in-post"),o(Cn,"class","flex"),o(Vl,"class","mx-1"),o(wn,"class","my-1 flex"),o(As,"class","my-1"),o(Vt,"type","checkbox"),o(Vt,"name","me"),Vt.__value="true",Vt.value=Vt.__value,o(Vt,"class","rounded mb-1"),o(Kl,"class","my-1"),o(Kt,"type","checkbox"),o(Kt,"name","mm"),Kt.__value="true",Kt.value=Kt.__value,o(Kt,"class","rounded mb-1"),o(Ae,"class","cnt"),o(Qi,"class","text-sm"),o(Mn,"href",Ut("WiFi-configuration")),o(Mn,"target","_blank"),o(Mn,"class","float-right"),o(mi,"type","hidden"),o(mi,"name","w"),mi.value="true",o(hl,"name","ws"),o(hl,"type","text"),o(hl,"class","in-s"),o(Yl,"class","my-1"),o(bl,"name","wp"),o(bl,"type","password"),o(bl,"class","in-s"),o(Ql,"class","my-1"),Tn.__value=255,Tn.value=Tn.__value,Nn.__value=0,Nn.value=Nn.__value,An.__value=1,An.value=An.__value,En.__value=2,En.value=En.__value,o(Ot,"name","wz"),o(Ot,"class","in-s"),t[3].w.z===void 0&&Qe(()=>t[43].call(Ot)),o(Xl,"class","w-1/2"),o(Lt,"name","ww"),o(Lt,"type","number"),o(Lt,"min","0"),o(Lt,"max","20.5"),o(Lt,"step","0.5"),o(Lt,"class","in-f tr w-full"),o(Xi,"class","in-post"),o(Pn,"class","flex"),o(Zl,"class","ml-2 w-1/2"),o($n,"class","my-1 flex"),o(Yt,"type","checkbox"),o(Yt,"name","wb"),Yt.__value="true",Yt.value=Yt.__value,o(Yt,"class","rounded mb-1"),o(Zi,"class","my-3"),o(mt,"class","cnt"),o(xi,"class","text-sm"),o(Dn,"href",Ut("Network-configuration")),o(Dn,"target","_blank"),o(Dn,"class","float-right"),Rn.__value="dhcp",Rn.value=Rn.__value,On.__value="static",On.value=On.__value,o(sl,"name","nm"),o(sl,"class","in-f"),t[3].n.m===void 0&&Qe(()=>t[46].call(sl)),o(Et,"name","ni"),o(Et,"type","text"),o(Et,"class","in-m w-full"),Et.disabled=es=t[3].n.m=="dhcp",Et.required=ts=t[3].n.m=="static",o(Pt,"name","ns"),o(Pt,"class","in-l"),Pt.disabled=ls=t[3].n.m=="dhcp",Pt.required=ns=t[3].n.m=="static",t[3].n.s===void 0&&Qe(()=>t[48].call(Pt)),o(Ol,"class","flex"),o(Jl,"class","my-1"),o(Qt,"name","nd"),Qt.__value="true",Qt.value=Qt.__value,o(Qt,"type","checkbox"),o(Qt,"class","rounded mb-1"),o(is,"class","my-1"),o(pi,"type","hidden"),o(pi,"name","ntp"),pi.value="true",o(Xt,"name","ntpd"),Xt.__value="true",Xt.value=Xt.__value,o(Xt,"type","checkbox"),o(Xt,"class","rounded mb-1"),o(_i,"class","ml-4"),o(gl,"name","ntph"),o(gl,"type","text"),o(gl,"class","in-s"),o(rs,"class","flex"),o(Ll,"class","my-1"),o(ut,"class","cnt"),o(os,"class","text-sm"),o(Fn,"href",Ut("MQTT-configuration")),o(Fn,"target","_blank"),o(Fn,"class","float-right"),o(di,"type","hidden"),o(di,"name","q"),di.value="true",o(kl,"name","qh"),o(kl,"type","text"),o(kl,"class","in-f w-3/4"),o(Zt,"name","qp"),o(Zt,"type","number"),o(Zt,"min","1024"),o(Zt,"max","65535"),o(Zt,"class","in-l tr w-1/4"),o(Bn,"class","flex"),o(rl,"class","my-1"),o(wl,"name","qu"),o(wl,"type","text"),o(wl,"class","in-s"),o(xl,"class","my-1"),o(yl,"name","qa"),o(yl,"type","password"),o(yl,"class","in-s"),o(en,"class","my-1"),o(Cl,"name","qc"),o(Cl,"type","text"),o(Cl,"class","in-f w-full"),Wn.__value=0,Wn.value=Wn.__value,zn.__value=1,zn.value=zn.__value,Gn.__value=2,Gn.value=Gn.__value,Vn.__value=3,Vn.value=Vn.__value,Kn.__value=4,Kn.value=Kn.__value,Yn.__value=255,Yn.value=Yn.__value,o(bt,"name","qm"),o(bt,"class","in-l"),t[3].q.m===void 0&&Qe(()=>t[61].call(bt)),o(Un,"class","my-1 flex"),o(Ml,"name","qb"),o(Ml,"type","text"),o(Ml,"class","in-s"),o(tn,"class","my-1"),o(Ye,"class","cnt"),o(as,"class","text-sm"),o(Qn,"href",Ut("User-interface")),o(Qn,"target","_blank"),o(Qn,"class","float-right"),o(vi,"type","hidden"),o(vi,"name","u"),vi.value="true",o(hi,"class","flex flex-wrap"),o(ol,"class","cnt"),o(us,"class","text-sm"),o(Zn,"href","https://amsleser.no/blog/post/24-telnet-debug"),o(Zn,"target","_blank"),o(Zn,"class","float-right"),o(bi,"type","hidden"),o(bi,"name","d"),bi.value="true",o(Jt,"type","checkbox"),o(Jt,"name","ds"),Jt.__value="true",Jt.value=Jt.__value,o(Jt,"class","rounded mb-1"),o(fs,"class","mt-3"),o(Dt,"class","cnt"),o(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),o(xn,"type","button"),o(xn,"class","py-2 px-4 rounded bg-red-500 text-white ml-2"),o(ei,"type","button"),o(ei,"class","py-2 px-4 rounded bg-yellow-500 text-white"),o(ms,"class","text-center"),o(ps,"class","text-right"),o(Fl,"class","grid grid-cols-3"),o(e,"autocomplete","off")},m(R,ae){M(R,e,ae),s(e,l),s(l,n),s(n,i),s(n,r),s(n,u),le(a,u,null),s(n,c),s(n,f),s(n,_),s(n,p),s(p,b),s(b,v),s(v,d),s(v,S),s(v,y),s(v,$),te($,t[3].g.h),s(b,N),s(b,P),s(P,B),s(P,E),s(P,O),s(P,L),le(F,L,null),qe(L,t[3].g.t,!0),s(n,x),s(n,H),s(n,z),s(n,G),s(G,V),s(V,W),s(W,U),s(W,K),s(W,j),s(W,Y),s(Y,X),s(X,oe),s(X,ue),s(X,ke),s(X,me),s(X,$e),s(Y,He),s(He,Re),s(He,je),s(He,we),s(He,Te),s(Y,Oe),s(Oe,Me),s(Oe,w),s(Y,g),s(Y,k),s(Y,A),s(Y,I),s(Y,Q),s(Y,J),s(Y,se),s(Y,ce),s(Y,ve),s(Y,Se),s(Y,re),s(Y,pe),s(Y,Be),qe(Y,t[3].p.r,!0),s(V,_e),s(V,ye),s(ye,vt),s(ye,jl),s(ye,tl),s(ye,ct);for(let ft=0;ft<5;ft+=1)gi[ft]&&gi[ft].m(ct,null);qe(ct,t[3].p.c,!0),s(n,Tl),s(n,pl),s(pl,jt),s(jt,ht),s(ht,Xe),s(ht,Ze),s(ht,Je),s(ht,Ue),te(Ue,t[3].p.f),s(jt,xe),s(jt,We),s(We,et),s(We,tt),s(We,de),s(We,Ce),te(Ce,t[3].p.m),s(n,Pi),s(n,_l),s(_l,_n),s(_n,Tt),Tt.checked=t[3].p.e,s(_n,Di),s(_l,Ii),gt&>.m(_l,null),s(n,Ri),s(n,dl),s(dl,Oi),s(dl,Li),s(dl,Fi),s(dl,Nt),s(Nt,Nl),s(Nt,Al),s(Nt,El),qe(Nt,t[3].g.s,!0),s(n,qi),kt&&kt.m(n,null),s(l,Ge),s(l,Ae),s(Ae,vl),s(Ae,Ts),s(Ae,Pl),le(Rt,Pl,null),s(Ae,Bi),s(Ae,Wl),s(Ae,Nr),s(Ae,ll),s(ll,Ui),s(ll,Ar),s(ll,Ns),s(ll,Er),s(ll,ci),s(ci,Wt),Wt.checked=t[3].m.i,s(ci,Pr),s(ll,Dr),s(ll,Dl),s(Dl,nl),s(nl,Il),s(Il,Ir);for(let ft=0;ft<7;ft+=1)ki[ft]&&ki[ft].m(nl,null);qe(nl,t[3].m.b,!0),s(Dl,Rr),s(Dl,pt),s(pt,Rl),s(Rl,Or),s(pt,dn),s(pt,vn),s(pt,hn),s(pt,bn),qe(pt,t[3].m.p,!0),s(Dl,Lr),s(Dl,At),te(At,t[3].m.s),s(Ae,Fr),s(Ae,zl),s(zl,qr),s(zl,Br),s(zl,Ur),s(zl,il),s(il,gn),s(il,kn),qe(il,t[3].m.d,!0),s(Ae,Hr),s(Ae,wn),s(wn,Gl),s(Gl,jr),s(Gl,Wr),s(Gl,zr),s(Gl,yn),s(yn,zt),te(zt,t[3].m.f),s(yn,Gr),s(yn,Gi),s(wn,Vr),s(wn,Vl),s(Vl,Kr),s(Vl,Yr),s(Vl,Qr),s(Vl,Cn),s(Cn,Gt),te(Gt,t[3].m.r),s(Cn,Xr),s(Cn,Vi),s(Ae,Zr),s(Ae,As),s(Ae,Jr),s(Ae,Kl),s(Kl,Ki),s(Ki,Vt),Vt.checked=t[3].m.e.e,s(Ki,xr),s(Kl,eo),wt&&wt.m(Kl,null),s(Ae,to),yt&&yt.m(Ae,null),s(Ae,Es),s(Ae,Yi),s(Yi,Kt),Kt.checked=t[3].m.m.e,s(Yi,lo),s(Ae,no),Ct&&Ct.m(Ae,null),s(l,io),s(l,mt),s(mt,Qi),s(mt,so),s(mt,Mn),le(Sn,Mn,null),s(mt,ro),s(mt,mi),s(mt,oo),s(mt,Yl),s(Yl,ao),s(Yl,uo),s(Yl,fo),s(Yl,hl),te(hl,t[3].w.s),s(mt,co),s(mt,Ql),s(Ql,mo),s(Ql,po),s(Ql,_o),s(Ql,bl),te(bl,t[3].w.p),s(mt,vo),s(mt,$n),s($n,Xl),s(Xl,ho),s(Xl,bo),s(Xl,go),s(Xl,Ot),s(Ot,Tn),s(Ot,Nn),s(Ot,An),s(Ot,En),qe(Ot,t[3].w.z,!0),s($n,ko),s($n,Zl),s(Zl,wo),s(Zl,yo),s(Zl,Co),s(Zl,Pn),s(Pn,Lt),te(Lt,t[3].w.w),s(Pn,Mo),s(Pn,Xi),s(mt,So),s(mt,Zi),s(Zi,Ji),s(Ji,Yt),Yt.checked=t[3].w.b,s(Ji,$o),s(l,To),s(l,ut),s(ut,xi),s(ut,No),s(ut,Dn),le(In,Dn,null),s(ut,Ao),s(ut,Jl),s(Jl,Eo),s(Jl,Po),s(Jl,Do),s(Jl,Ol),s(Ol,sl),s(sl,Rn),s(sl,On),qe(sl,t[3].n.m,!0),s(Ol,Io),s(Ol,Et),te(Et,t[3].n.i),s(Ol,Ro),s(Ol,Pt),le(Ln,Pt,null),qe(Pt,t[3].n.s,!0),s(ut,Oo),Mt&&Mt.m(ut,null),s(ut,Ps),s(ut,is),s(is,ss),s(ss,Qt),Qt.checked=t[3].n.d,s(ss,Lo),s(ut,Fo),s(ut,pi),s(ut,qo),s(ut,Ll),s(Ll,Bo),s(Ll,_i),s(_i,Xt),Xt.checked=t[3].n.h,s(_i,Uo),s(Ll,Ho),s(Ll,jo),s(Ll,rs),s(rs,gl),te(gl,t[3].n.n1),s(l,Wo),s(l,Ye),s(Ye,os),s(Ye,zo),s(Ye,Fn),le(qn,Fn,null),s(Ye,Go),s(Ye,di),s(Ye,Vo),s(Ye,rl),s(rl,Ko),St&&St.m(rl,null),s(rl,Ds),s(rl,Yo),s(rl,Qo),s(rl,Bn),s(Bn,kl),te(kl,t[3].q.h),s(Bn,Xo),s(Bn,Zt),te(Zt,t[3].q.p),s(Ye,Zo),lt&<.m(Ye,null),s(Ye,Is),s(Ye,xl),s(xl,Jo),s(xl,xo),s(xl,ea),s(xl,wl),te(wl,t[3].q.u),s(Ye,ta),s(Ye,en),s(en,la),s(en,na),s(en,ia),s(en,yl),te(yl,t[3].q.a),s(Ye,sa),s(Ye,Un),s(Un,Hn),s(Hn,ra),s(Hn,oa),s(Hn,aa),s(Hn,Cl),te(Cl,t[3].q.c),s(Un,ua),s(Un,jn),s(jn,fa),s(jn,ca),s(jn,ma),s(jn,bt),s(bt,Wn),s(bt,zn),s(bt,Gn),s(bt,Vn),s(bt,Kn),s(bt,Yn),qe(bt,t[3].q.m,!0),s(Ye,pa),s(Ye,tn),s(tn,_a),s(tn,da),s(tn,va),s(tn,Ml),te(Ml,t[3].q.b),s(l,ha),nt&&nt.m(l,null),s(l,Rs),it&&it.m(l,null),s(l,Os),st&&st.m(l,null),s(l,Ls),rt&&rt.m(l,null),s(l,qs),s(l,ol),s(ol,as),s(ol,ba),s(ol,Qn),le(Xn,Qn,null),s(ol,ga),s(ol,vi),s(ol,ka),s(ol,hi);for(let ft=0;ft<_t.length;ft+=1)_t[ft]&&_t[ft].m(hi,null);s(l,wa),ot&&ot.m(l,null),s(l,Bs),s(l,Dt),s(Dt,us),s(Dt,ya),s(Dt,Zn),le(Jn,Zn,null),s(Dt,Ca),s(Dt,bi),s(Dt,Ma),s(Dt,fs),s(fs,cs),s(cs,Jt),Jt.checked=t[3].d.s,s(cs,Sa),s(Dt,$a),$t&&$t.m(Dt,null),s(e,Ta),s(e,Fl),s(Fl,Us),s(Us,xn),s(Fl,Na),s(Fl,ms),s(ms,ei),s(Fl,Aa),s(Fl,ps),M(R,Hs,ae),le(ln,R,ae),M(R,js,ae),le(nn,R,ae),M(R,Ws,ae),le(sn,R,ae),M(R,zs,ae),le(rn,R,ae),Ft=!0,Gs||(Ea=[ee($,"input",t[15]),ee(L,"change",t[16]),ee(Y,"change",t[17]),ee(ct,"change",t[18]),ee(Ue,"input",t[19]),ee(Ce,"input",t[20]),ee(Tt,"change",t[21]),ee(Nt,"change",t[23]),ee(Wt,"change",t[26]),ee(nl,"change",t[27]),ee(pt,"change",t[28]),ee(At,"input",t[29]),ee(il,"change",t[30]),ee(zt,"input",t[31]),ee(Gt,"input",t[32]),ee(Vt,"change",t[33]),ee(Kt,"change",t[36]),ee(hl,"input",t[41]),ee(bl,"input",t[42]),ee(Ot,"change",t[43]),ee(Lt,"input",t[44]),ee(Yt,"change",t[45]),ee(sl,"change",t[46]),ee(Et,"input",t[47]),ee(Pt,"change",t[48]),ee(Qt,"change",t[52]),ee(Xt,"change",t[53]),ee(gl,"input",t[54]),ee(kl,"input",t[56]),ee(Zt,"input",t[57]),ee(wl,"input",t[58]),ee(yl,"input",t[59]),ee(Cl,"input",t[60]),ee(bt,"change",t[61]),ee(Ml,"input",t[62]),ee(Jt,"change",t[92]),ee(xn,"click",t[8]),ee(ei,"click",t[10]),ee(e,"submit",Ss(t[9]))],Gs=!0)},p(R,ae){if(ae[0]&8&&$.value!==R[3].g.h&&te($,R[3].g.h),ae[0]&8&&qe(L,R[3].g.t),ae[0]&8&&qe(Y,R[3].p.r),ae[0]&8&&qe(ct,R[3].p.c),ae[0]&8&&he(Ue.value)!==R[3].p.f&&te(Ue,R[3].p.f),ae[0]&8&&he(Ce.value)!==R[3].p.m&&te(Ce,R[3].p.m),ae[0]&8&&(Tt.checked=R[3].p.e),R[3].p.e&&R[0].chip!="esp8266"?gt?gt.p(R,ae):(gt=ff(R),gt.c(),gt.m(_l,null)):gt&&(gt.d(1),gt=null),ae[0]&8&&qe(Nt,R[3].g.s),R[3].g.s>0?kt?kt.p(R,ae):(kt=cf(R),kt.c(),kt.m(n,null)):kt&&(kt.d(1),kt=null),ae[0]&8&&(Wt.checked=R[3].m.i),(!Ft||ae[0]&8&&Hi!==(Hi=R[3].m.b!=0))&&(Il.disabled=Hi),ae[0]&8&&qe(nl,R[3].m.b),(!Ft||ae[0]&8&&ji!==(ji=R[3].m.b!=0))&&(Rl.disabled=ji),(!Ft||ae[0]&8&&Wi!==(Wi=R[3].m.b==0))&&(pt.disabled=Wi),ae[0]&8&&qe(pt,R[3].m.p),(!Ft||ae[0]&9&&zi!==(zi=R[0].chip=="esp8266"?R[3].i.h.p==3||R[3].i.h.p==113?512:128:4096))&&o(At,"max",zi),ae[0]&8&&he(At.value)!==R[3].m.s&&te(At,R[3].m.s),ae[0]&8&&qe(il,R[3].m.d),ae[0]&8&&he(zt.value)!==R[3].m.f&&te(zt,R[3].m.f),ae[0]&8&&he(Gt.value)!==R[3].m.r&&te(Gt,R[3].m.r),ae[0]&8&&(Vt.checked=R[3].m.e.e),R[3].m.e.e?wt?wt.p(R,ae):(wt=mf(R),wt.c(),wt.m(Kl,null)):wt&&(wt.d(1),wt=null),R[3].m.e.e?yt?yt.p(R,ae):(yt=pf(R),yt.c(),yt.m(Ae,Es)):yt&&(yt.d(1),yt=null),ae[0]&8&&(Kt.checked=R[3].m.m.e),R[3].m.m.e?Ct?Ct.p(R,ae):(Ct=_f(R),Ct.c(),Ct.m(Ae,null)):Ct&&(Ct.d(1),Ct=null),ae[0]&8&&hl.value!==R[3].w.s&&te(hl,R[3].w.s),ae[0]&8&&bl.value!==R[3].w.p&&te(bl,R[3].w.p),ae[0]&8&&qe(Ot,R[3].w.z),ae[0]&8&&he(Lt.value)!==R[3].w.w&&te(Lt,R[3].w.w),ae[0]&8&&(Yt.checked=R[3].w.b),ae[0]&8&&qe(sl,R[3].n.m),(!Ft||ae[0]&8&&es!==(es=R[3].n.m=="dhcp"))&&(Et.disabled=es),(!Ft||ae[0]&8&&ts!==(ts=R[3].n.m=="static"))&&(Et.required=ts),ae[0]&8&&Et.value!==R[3].n.i&&te(Et,R[3].n.i),(!Ft||ae[0]&8&&ls!==(ls=R[3].n.m=="dhcp"))&&(Pt.disabled=ls),(!Ft||ae[0]&8&&ns!==(ns=R[3].n.m=="static"))&&(Pt.required=ns),ae[0]&8&&qe(Pt,R[3].n.s),R[3].n.m=="static"?Mt?Mt.p(R,ae):(Mt=df(R),Mt.c(),Mt.m(ut,Ps)):Mt&&(Mt.d(1),Mt=null),ae[0]&8&&(Qt.checked=R[3].n.d),ae[0]&8&&(Xt.checked=R[3].n.h),ae[0]&8&&gl.value!==R[3].n.n1&&te(gl,R[3].n.n1),R[0].chip!="esp8266"?St?St.p(R,ae):(St=vf(R),St.c(),St.m(rl,Ds)):St&&(St.d(1),St=null),ae[0]&8&&kl.value!==R[3].q.h&&te(kl,R[3].q.h),ae[0]&8&&he(Zt.value)!==R[3].q.p&&te(Zt,R[3].q.p),R[3].q.s.e?lt?(lt.p(R,ae),ae[0]&8&&D(lt,1)):(lt=hf(R),lt.c(),D(lt,1),lt.m(Ye,Is)):lt&&(De(),q(lt,1,1,()=>{lt=null}),Ie()),ae[0]&8&&wl.value!==R[3].q.u&&te(wl,R[3].q.u),ae[0]&8&&yl.value!==R[3].q.a&&te(yl,R[3].q.a),ae[0]&8&&Cl.value!==R[3].q.c&&te(Cl,R[3].q.c),ae[0]&8&&qe(bt,R[3].q.m),ae[0]&8&&Ml.value!==R[3].q.b&&te(Ml,R[3].q.b),R[3].q.m==3?nt?(nt.p(R,ae),ae[0]&8&&D(nt,1)):(nt=bf(R),nt.c(),D(nt,1),nt.m(l,Rs)):nt&&(De(),q(nt,1,1,()=>{nt=null}),Ie()),R[3].q.m==4?it?(it.p(R,ae),ae[0]&8&&D(it,1)):(it=gf(R),it.c(),D(it,1),it.m(l,Os)):it&&(De(),q(it,1,1,()=>{it=null}),Ie()),R[3].c.es!=null?st?(st.p(R,ae),ae[0]&8&&D(st,1)):(st=kf(R),st.c(),D(st,1),st.m(l,Ls)):st&&(De(),q(st,1,1,()=>{st=null}),Ie()),ae[0]&8&&(Fs=R[3].p.r.startsWith("10YNO")||R[3].p.r.startsWith("10Y1001A1001A4")),Fs?rt?(rt.p(R,ae),ae[0]&8&&D(rt,1)):(rt=Cf(R),rt.c(),D(rt,1),rt.m(l,qs)):rt&&(De(),q(rt,1,1,()=>{rt=null}),Ie()),ae[0]&136){ti=R[7];let qt;for(qt=0;qt20||R[0].chip=="esp8266"?ot?(ot.p(R,ae),ae[0]&1&&D(ot,1)):(ot=$f(R),ot.c(),D(ot,1),ot.m(l,Bs)):ot&&(De(),q(ot,1,1,()=>{ot=null}),Ie()),ae[0]&8&&(Jt.checked=R[3].d.s),R[3].d.s?$t?$t.p(R,ae):($t=Df(R),$t.c(),$t.m(Dt,null)):$t&&($t.d(1),$t=null);const ft={};ae[0]&2&&(ft.active=R[1]),ln.$set(ft);const Pa={};ae[0]&4&&(Pa.active=R[2]),nn.$set(Pa);const Da={};ae[0]&16&&(Da.active=R[4]),sn.$set(Da);const Ia={};ae[0]&32&&(Ia.active=R[5]),rn.$set(Ia)},i(R){Ft||(D(a.$$.fragment,R),D(F.$$.fragment,R),D(Rt.$$.fragment,R),D(Sn.$$.fragment,R),D(In.$$.fragment,R),D(Ln.$$.fragment,R),D(qn.$$.fragment,R),D(lt),D(nt),D(it),D(st),D(rt),D(Xn.$$.fragment,R),D(ot),D(Jn.$$.fragment,R),D(ln.$$.fragment,R),D(nn.$$.fragment,R),D(sn.$$.fragment,R),D(rn.$$.fragment,R),Ft=!0)},o(R){q(a.$$.fragment,R),q(F.$$.fragment,R),q(Rt.$$.fragment,R),q(Sn.$$.fragment,R),q(In.$$.fragment,R),q(Ln.$$.fragment,R),q(qn.$$.fragment,R),q(lt),q(nt),q(it),q(st),q(rt),q(Xn.$$.fragment,R),q(ot),q(Jn.$$.fragment,R),q(ln.$$.fragment,R),q(nn.$$.fragment,R),q(sn.$$.fragment,R),q(rn.$$.fragment,R),Ft=!1},d(R){R&&C(e),ne(a),ne(F),cl(gi,R),gt&>.d(),kt&&kt.d(),ne(Rt),cl(ki,R),wt&&wt.d(),yt&&yt.d(),Ct&&Ct.d(),ne(Sn),ne(In),ne(Ln),Mt&&Mt.d(),ne(qn),St&&St.d(),lt&<.d(),nt&&nt.d(),it&&it.d(),st&&st.d(),rt&&rt.d(),ne(Xn),cl(_t,R),ot&&ot.d(),ne(Jn),$t&&$t.d(),R&&C(Hs),ne(ln,R),R&&C(js),ne(nn,R),R&&C(Ws),ne(sn,R),R&&C(zs),ne(rn,R),Gs=!1,ze(Ea)}}}async function Cp(){await(await fetch("/reboot",{method:"POST"})).json()}function Mp(t,e,l){let{sysinfo:n={}}=e,i=[{name:"Import gauge",key:"i"},{name:"Export gauge",key:"e"},{name:"Voltage",key:"v"},{name:"Amperage",key:"a"},{name:"Reactive",key:"r"},{name:"Realtime",key:"c"},{name:"Peaks",key:"t"},{name:"Price",key:"p"},{name:"Day plot",key:"d"},{name:"Month plot",key:"m"},{name:"Temperature plot",key:"s"}],r=!0,u=!1,a={g:{t:"",h:"",s:0,u:"",p:""},m:{b:2400,p:11,i:!1,d:0,f:0,r:0,e:{e:!1,k:"",a:""},m:{e:!1,w:!1,v:!1,a:!1,c:!1}},w:{s:"",p:"",w:0,z:255,a:!0,b:!0},n:{m:"",i:"",s:"",g:"",d1:"",d2:"",d:!1,n1:"",n2:"",h:!1},q:{h:"",p:1883,u:"",a:"",b:"",s:{e:!1,c:!1,r:!0,k:!1}},o:{e:"",c:"",u1:"",u2:"",u3:""},t:{t:[0,0,0,0,0,0,0,0,0,0],h:1},p:{e:!1,t:"",r:"",c:"",m:1,f:null},d:{s:!1,t:!1,l:5},u:{i:0,e:0,v:0,a:0,r:0,c:0,t:0,p:0,d:0,m:0,s:0},i:{h:{p:null,u:!0},a:null,l:{p:null,i:!1},r:{r:null,g:null,b:null,i:!1},t:{d:null,a:null},v:{p:null,d:{v:null,g:null},o:null,m:null,b:null}},h:{t:"",h:"",n:""},c:{es:null}};Ci.subscribe(Ge=>{Ge.version&&(l(3,a=Ge),l(1,r=!1))}),Wm();let c=!1,f=!1;async function _(){if(confirm("Are you sure you want to factory reset the device?")){l(4,c=!0);const Ge=new URLSearchParams;Ge.append("perform","true");let vl=await(await fetch("/reset",{method:"POST",body:Ge})).json();l(4,c=!1),l(5,f=vl.success)}}async function p(Ge){l(2,u=!0);const Ae=new FormData(Ge.target),vl=new URLSearchParams;for(let Rt of Ae){const[Bi,Wl]=Rt;vl.append(Bi,Wl)}let Pl=await(await fetch("/save",{method:"POST",body:vl})).json();Ht.update(Rt=>(Rt.booting=Pl.reboot,Rt.ui=a.u,Rt)),l(2,u=!1),ri("/")}const b=function(){confirm("Are you sure you want to reboot the device?")&&(Ht.update(Ge=>(Ge.booting=!0,Ge)),Cp())};async function v(){confirm("Are you sure you want to delete CA?")&&(await(await fetch("/mqtt-ca",{method:"POST"})).text(),Ci.update(Ae=>(Ae.q.s.c=!1,Ae)))}async function d(){confirm("Are you sure you want to delete cert?")&&(await(await fetch("/mqtt-cert",{method:"POST"})).text(),Ci.update(Ae=>(Ae.q.s.r=!1,Ae)))}async function S(){confirm("Are you sure you want to delete key?")&&(await(await fetch("/mqtt-key",{method:"POST"})).text(),Ci.update(Ae=>(Ae.q.s.k=!1,Ae)))}const y=function(){a.q.s.e?a.q.p==1883&&l(3,a.q.p=8883,a):a.q.p==8883&&l(3,a.q.p=1883,a)};let $=44;function N(){a.g.h=this.value,l(3,a)}function P(){a.g.t=dt(this),l(3,a)}function B(){a.p.r=dt(this),l(3,a)}function E(){a.p.c=dt(this),l(3,a)}function O(){a.p.f=he(this.value),l(3,a)}function L(){a.p.m=he(this.value),l(3,a)}function F(){a.p.e=this.checked,l(3,a)}function x(){a.p.t=this.value,l(3,a)}function H(){a.g.s=dt(this),l(3,a)}function z(){a.g.u=this.value,l(3,a)}function G(){a.g.p=this.value,l(3,a)}function V(){a.m.i=this.checked,l(3,a)}function W(){a.m.b=dt(this),l(3,a)}function U(){a.m.p=dt(this),l(3,a)}function K(){a.m.s=he(this.value),l(3,a)}function j(){a.m.d=dt(this),l(3,a)}function Y(){a.m.f=he(this.value),l(3,a)}function X(){a.m.r=he(this.value),l(3,a)}function oe(){a.m.e.e=this.checked,l(3,a)}function ue(){a.m.e.k=this.value,l(3,a)}function ke(){a.m.e.a=this.value,l(3,a)}function me(){a.m.m.e=this.checked,l(3,a)}function $e(){a.m.m.w=he(this.value),l(3,a)}function He(){a.m.m.v=he(this.value),l(3,a)}function Re(){a.m.m.a=he(this.value),l(3,a)}function je(){a.m.m.c=he(this.value),l(3,a)}function we(){a.w.s=this.value,l(3,a)}function Te(){a.w.p=this.value,l(3,a)}function Oe(){a.w.z=dt(this),l(3,a)}function Me(){a.w.w=he(this.value),l(3,a)}function w(){a.w.b=this.checked,l(3,a)}function g(){a.n.m=dt(this),l(3,a)}function k(){a.n.i=this.value,l(3,a)}function A(){a.n.s=dt(this),l(3,a)}function I(){a.n.g=this.value,l(3,a)}function Q(){a.n.d1=this.value,l(3,a)}function J(){a.n.d2=this.value,l(3,a)}function se(){a.n.d=this.checked,l(3,a)}function ce(){a.n.h=this.checked,l(3,a)}function ve(){a.n.n1=this.value,l(3,a)}function Se(){a.q.s.e=this.checked,l(3,a)}function re(){a.q.h=this.value,l(3,a)}function pe(){a.q.p=he(this.value),l(3,a)}function Be(){a.q.u=this.value,l(3,a)}function _e(){a.q.a=this.value,l(3,a)}function ye(){a.q.c=this.value,l(3,a)}function vt(){a.q.m=dt(this),l(3,a)}function jl(){a.q.b=this.value,l(3,a)}function tl(){a.o.e=this.value,l(3,a)}function ct(){a.o.c=this.value,l(3,a)}function Tl(){a.o.u1=this.value,l(3,a)}function pl(){a.o.u2=this.value,l(3,a)}function jt(){a.o.u3=this.value,l(3,a)}function ht(){a.h.t=this.value,l(3,a)}function Xe(){a.h.h=this.value,l(3,a)}function Ze(){a.h.n=this.value,l(3,a)}function Je(){a.c.es=this.checked,l(3,a)}function Ue(Ge){a.t.t[Ge]=he(this.value),l(3,a)}function xe(){a.t.h=he(this.value),l(3,a)}function We(Ge){a.u[Ge.key]=dt(this),l(3,a)}function et(){a.i.h.u=this.checked,l(3,a)}function tt(){a.i.h.p=dt(this),l(3,a)}function de(){a.i.a=he(this.value),l(3,a)}function Ce(){a.i.l.i=this.checked,l(3,a)}function Pi(){a.i.l.p=he(this.value),l(3,a)}function _l(){a.i.r.i=this.checked,l(3,a)}function _n(){a.i.r.r=he(this.value),l(3,a)}function Tt(){a.i.r.g=he(this.value),l(3,a)}function Di(){a.i.r.b=he(this.value),l(3,a)}function Ii(){a.i.t.d=he(this.value),l(3,a)}function Ri(){a.i.t.a=he(this.value),l(3,a)}function dl(){a.i.v.p=he(this.value),l(3,a)}function Oi(){a.i.v.d.v=he(this.value),l(3,a)}function Li(){a.i.v.d.g=he(this.value),l(3,a)}function Fi(){a.i.v.o=he(this.value),l(3,a)}function Nt(){a.i.v.m=he(this.value),l(3,a)}function Nl(){a.i.v.b=he(this.value),l(3,a)}function Al(){a.d.s=this.checked,l(3,a)}function El(){a.d.t=this.checked,l(3,a)}function qi(){a.d.l=dt(this),l(3,a)}return t.$$set=Ge=>{"sysinfo"in Ge&&l(0,n=Ge.sysinfo)},t.$$.update=()=>{t.$$.dirty[0]&1&&l(6,$=n.chip=="esp8266"?16:n.chip=="esp32s2"?44:39)},[n,r,u,a,c,f,$,i,_,p,b,v,d,S,y,N,P,B,E,O,L,F,x,H,z,G,V,W,U,K,j,Y,X,oe,ue,ke,me,$e,He,Re,je,we,Te,Oe,Me,w,g,k,A,I,Q,J,se,ce,ve,Se,re,pe,Be,_e,ye,vt,jl,tl,ct,Tl,pl,jt,ht,Xe,Ze,Je,Ue,xe,We,et,tt,de,Ce,Pi,_l,_n,Tt,Di,Ii,Ri,dl,Oi,Li,Fi,Nt,Nl,Al,El,qi]}class Sp extends Pe{constructor(e){super(),Ee(this,e,Mp,yp,Ne,{sysinfo:0},null,[-1,-1,-1,-1])}}function Rf(t,e,l){const n=t.slice();return n[20]=e[l],n}function $p(t){let e=be(t[1].chip,t[1].board)+"",l;return{c(){l=T(e)},m(n,i){M(n,l,i)},p(n,i){i&2&&e!==(e=be(n[1].chip,n[1].board)+"")&&Z(l,e)},d(n){n&&C(l)}}}function Of(t){let e,l,n=t[1].apmac+"",i,r,u,a,c,f,_,p,b,v=Ja(t[1])+"",d,S,y=t[1].boot_reason+"",$,N,P=t[1].ex_cause+"",B,E,O;const L=[Np,Tp],F=[];function x(H,z){return H[0].u>0?0:1}return c=x(t),f=F[c]=L[c](t),{c(){e=m("div"),l=T("AP MAC: "),i=T(n),r=h(),u=m("div"),a=T(`Last boot: diff --git a/lib/SvelteUi/app/src/lib/Helpers.js b/lib/SvelteUi/app/src/lib/Helpers.js index c8743797..63b5638c 100644 --- a/lib/SvelteUi/app/src/lib/Helpers.js +++ b/lib/SvelteUi/app/src/lib/Helpers.js @@ -258,7 +258,7 @@ export function getResetReason(sysinfo) { export function getPriceSourceName(code) { if(code == "EOE") return "ENTSO-E"; if(code == "HKS") return "hvakosterstrommen.no"; - if(code == "EDS") return "Energy Data Service"; + if(code == "EDS") return "Energi Data Service"; if(code == "MIX") return "Mixed sources"; return "Unknown (" + code + ")"; }