commit ff2be5372c12df90f344740c89fe07b10e21ca2f Author: status-im-auto Date: Tue Sep 6 18:31:23 2022 +0000 Updates diff --git a/relay-angular-chat/3rdpartylicenses.txt b/relay-angular-chat/3rdpartylicenses.txt new file mode 100644 index 0000000..cb6c30f --- /dev/null +++ b/relay-angular-chat/3rdpartylicenses.txt @@ -0,0 +1,2917 @@ +@achingbrain/nat-port-mapper +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +@angular/common +MIT + +@angular/core +MIT + +@angular/platform-browser +MIT + +@babel/runtime +MIT +MIT License + +Copyright (c) 2014-present Sebastian McKenzie and other contributors + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +@chainsafe/libp2p-gossipsub +Apache-2.0 + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +@chainsafe/libp2p-noise +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +@libp2p/components +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +@libp2p/connection +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +@libp2p/crypto +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +@libp2p/interface-connection +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +@libp2p/interface-connection-encrypter +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +@libp2p/interface-peer-discovery +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +@libp2p/interface-peer-id +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +@libp2p/interface-peer-store +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +@libp2p/interface-pubsub +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +@libp2p/interface-registrar +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +@libp2p/interface-transport +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +@libp2p/interfaces +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +@libp2p/logger +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +@libp2p/mplex +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +@libp2p/multistream-select +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +@libp2p/peer-collections +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +@libp2p/peer-id +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +@libp2p/peer-id-factory +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +@libp2p/peer-record +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +@libp2p/peer-store +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +@libp2p/pubsub +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +@libp2p/topology +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +@libp2p/tracked-map +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +@libp2p/utils +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +@libp2p/websockets +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +@multiformats/mafmt +Apache-2.0 OR MIT +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + +@multiformats/multiaddr +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +@multiformats/multiaddr-to-uri +Apache-2.0 or MIT +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + +@noble/ed25519 +MIT +The MIT License (MIT) + +Copyright (c) 2019 Paul Miller (https://paulmillr.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the “Software”), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +@noble/secp256k1 +MIT +The MIT License (MIT) + +Copyright (c) 2019 Paul Miller (https://paulmillr.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the “Software”), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +@protobufjs/aspromise +BSD-3-Clause +Copyright (c) 2016, Daniel Wirtz All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +* Neither the name of its author, nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +@protobufjs/base64 +BSD-3-Clause +Copyright (c) 2016, Daniel Wirtz All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +* Neither the name of its author, nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +@protobufjs/codegen +BSD-3-Clause +Copyright (c) 2016, Daniel Wirtz All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +* Neither the name of its author, nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +@protobufjs/eventemitter +BSD-3-Clause +Copyright (c) 2016, Daniel Wirtz All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +* Neither the name of its author, nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +@protobufjs/fetch +BSD-3-Clause +Copyright (c) 2016, Daniel Wirtz All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +* Neither the name of its author, nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +@protobufjs/float +BSD-3-Clause +Copyright (c) 2016, Daniel Wirtz All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +* Neither the name of its author, nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +@protobufjs/inquire +BSD-3-Clause +Copyright (c) 2016, Daniel Wirtz All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +* Neither the name of its author, nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +@protobufjs/path +BSD-3-Clause +Copyright (c) 2016, Daniel Wirtz All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +* Neither the name of its author, nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +@protobufjs/pool +BSD-3-Clause +Copyright (c) 2016, Daniel Wirtz All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +* Neither the name of its author, nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +@protobufjs/utf8 +BSD-3-Clause +Copyright (c) 2016, Daniel Wirtz All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +* Neither the name of its author, nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +@stablelib/binary +MIT +This software is licensed under the MIT license: + +Copyright (C) 2016 Dmitry Chestnykh + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +@stablelib/chacha +MIT +This software is licensed under the MIT license: + +Copyright (C) 2016 Dmitry Chestnykh + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +@stablelib/chacha20poly1305 +MIT +This software is licensed under the MIT license: + +Copyright (C) 2016 Dmitry Chestnykh + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +@stablelib/constant-time +MIT +This software is licensed under the MIT license: + +Copyright (C) 2016 Dmitry Chestnykh + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +--- + +This software includes code derived from other projects: + +Copyright (c) 2012 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +@stablelib/hash +MIT +This software is licensed under the MIT license: + +Copyright (C) 2016 Dmitry Chestnykh + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +@stablelib/hkdf +MIT +This software is licensed under the MIT license: + +Copyright (C) 2016 Dmitry Chestnykh + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +@stablelib/hmac +MIT +This software is licensed under the MIT license: + +Copyright (C) 2016 Dmitry Chestnykh + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +@stablelib/int +MIT +This software is licensed under the MIT license: + +Copyright (C) 2016 Dmitry Chestnykh + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +@stablelib/poly1305 +MIT +This software is licensed under the MIT license: + +Copyright (C) 2016 Dmitry Chestnykh + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +--- + +This software includes code derived from other projects: + +TweetNaCl.js +https://tweetnacl.js.org + +Public domain code written by Dmitry Chestnykh, Devi Mandiri, AndSDev, +derived from public domain code in TweetNaCl by Bernard van Gastel, +Daniel J. Bernstein, Peter Schwabe, Sjaak Smetsers, Tanja Lange, +Wesley Janssen. + +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + + +Poly1305-donna +https://github.com/floodyberry/poly1305-donna + +by Andrew Moon +MIT or PUBLIC DOMAIN + + +@stablelib/random +MIT +This software is licensed under the MIT license: + +Copyright (C) 2016 Dmitry Chestnykh + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +@stablelib/sha256 +MIT +This software is licensed under the MIT license: + +Copyright (C) 2016 Dmitry Chestnykh + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +@stablelib/wipe +MIT +This software is licensed under the MIT license: + +Copyright (C) 2016 Dmitry Chestnykh + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +@stablelib/x25519 +MIT +This software is licensed under the MIT license: + +Copyright (C) 2016 Dmitry Chestnykh + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +--- + +This software includes code derived from other projects: + + +TweetNaCl.js +https://tweetnacl.js.org + +Public domain code written by Dmitry Chestnykh, Devi Mandiri, AndSDev, +derived from public domain code in TweetNaCl by Bernard van Gastel, +Daniel J. Bernstein, Peter Schwabe, Sjaak Smetsers, Tanja Lange, +Wesley Janssen. + +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + + +abortable-iterator +MIT +MIT License + +Copyright (c) 2018 Alan Shaw + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +any-signal +MIT +MIT License + +Copyright (c) 2019 Jacob Heun + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +byte-access +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +clone-regexp +MIT +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +datastore-core +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +debug +MIT +(The MIT License) + +Copyright (c) 2014-2017 TJ Holowaychuk +Copyright (c) 2018-2021 Josh Junon + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the 'Software'), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT +LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + + +denque +Apache-2.0 +Copyright (c) 2018 Mike Diarmid (Salakar) + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this library except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + + +dns-over-http-resolver +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +err-code +MIT + +event-iterator +MIT + +eventemitter3 +MIT +The MIT License (MIT) + +Copyright (c) 2014 Arnout Kazemier + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +events +MIT +MIT + +Copyright Joyent, Inc. and other Node contributors. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the +following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +USE OR OTHER DEALINGS IN THE SOFTWARE. + + +fast-fifo +MIT +The MIT License (MIT) + +Copyright (c) 2019 Mathias Buus + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + +function-timeout +MIT +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +get-iterator +MIT +MIT License + +Copyright (c) 2018 Alan Shaw + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +hashlru +MIT +Copyright (c) 2016 'Dominic Tarr' + +Permission is hereby granted, free of charge, +to any person obtaining a copy of this software and +associated documentation files (the "Software"), to +deal in the Software without restriction, including +without limitation the rights to use, copy, modify, +merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom +the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +interface-datastore +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +ip-regex +MIT +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +ipaddr.js +MIT +Copyright (C) 2011-2017 whitequark + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + +is-electron +MIT +The MIT License (MIT) + +Copyright (c) 2016-2018 Cheton Wu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +is-ip +MIT +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +is-loopback-addr +MIT +MIT License + +Copyright (c) 2020 Vasco Santos + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +is-plain-obj +MIT +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +is-regexp +MIT +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +iso-url +MIT +MIT License + +Copyright (c) Hugo Dias (hugodias.me) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +it-all +ISC + +it-drain +ISC + +it-filter +ISC + +it-first +ISC + +it-foreach +ISC + +it-handshake +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +it-length-prefixed +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +it-map +ISC + +it-merge +ISC + +it-pair +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +it-pb-stream +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +it-pipe +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +it-pushable +MIT +MIT License + +Copyright (c) 2019 Alan Shaw + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +it-reader +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +it-sort +ISC + +it-take +ISC + +it-ws +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +js-sha3 +MIT +Copyright 2015-2018 Chen, Yi-Cyuan + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +js-waku +MIT OR Apache-2.0 + +libp2p +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +longbits +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +merge-options +MIT +The MIT License (MIT) + +Copyright (c) Michael Mayer + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +mortice +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +ms +MIT +The MIT License (MIT) + +Copyright (c) 2016 Zeit, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +multiformats +(Apache-2.0 AND MIT) +Copyright 2020 Protocol Labs + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + + +mutable-proxy +MIT +The MIT License (MIT) +Copyright (c) 2016 John Griffing + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +nanoid +MIT +The MIT License (MIT) + +Copyright 2017 Andrey Sitnik + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +native-fetch +MIT + +netmask +MIT + +node-forge +(BSD-3-Clause OR GPL-2.0) +You may use the Forge project under the terms of either the BSD License or the +GNU General Public License (GPL) Version 2. + +The BSD License is recommended for most projects. It is simple and easy to +understand and it places almost no restrictions on what you can do with the +Forge project. + +If the GPL suits your project better you are also free to use Forge under +that license. + +You don't have to do anything special to choose one license or the other and +you don't have to notify anyone which license you are using. You are free to +use this project in commercial projects as long as the copyright header is +left intact. + +If you are a commercial entity and use this set of libraries in your +commercial software then reasonable payment to Digital Bazaar, if you can +afford it, is not required but is expected and would be appreciated. If this +library saves you time, then it's saving you money. The cost of developing +the Forge software was on the order of several hundred hours and tens of +thousands of dollars. We are attempting to strike a balance between helping +the development community while not being taken advantage of by lucrative +commercial entities for our efforts. + +------------------------------------------------------------------------------- +New BSD License (3-clause) +Copyright (c) 2010, Digital Bazaar, Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of Digital Bazaar, Inc. nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL DIGITAL BAZAAR BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +------------------------------------------------------------------------------- + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + 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 +this service 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. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +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 +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the 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 a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE 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. + + + +observable-webworkers +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +p-defer +MIT +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +p-event +MIT +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +p-fifo +MIT +MIT License + +Copyright (c) 2019 Alan Shaw + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +p-limit +MIT +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +p-queue +MIT +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +p-reflect +MIT +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +p-settle +MIT +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +p-timeout +MIT +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +private-ip +MIT +The MIT License (MIT) + +Copyright (c) 2016 Damir Mustafin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +protobufjs +BSD-3-Clause +This license applies to all parts of protobuf.js except those files +either explicitly including or referencing a different license or +located in a directory containing a different LICENSE file. + +--- + +Copyright (c) 2016, Daniel Wirtz All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +* Neither the name of its author, nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +--- + +Code generated by the command line utilities is owned by the owner +of the input file used when generating it. This code is not +standalone and requires a support library to be linked with it. This +support library is itself covered by the above license. + + +protons-runtime +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +receptacle +MIT + +retimer +MIT +The MIT License (MIT) + +Copyright (c) 2015 Matteo Collina + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + + +rxjs +Apache-2.0 + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright (c) 2015-2018 Google, Inc., Netflix, Inc., Microsoft Corp. and contributors + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + + +sanitize-filename +WTFPL OR ISC +This project is licensed under the [WTFPL][] and [ISC][] licenses. + +[WTFPL]: https://en.wikipedia.org/wiki/WTFPL +[ISC]: https://opensource.org/licenses/ISC + +## WTFPL + +DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE +Version 2, December 2004 + +Copyright (C) 2004 Sam Hocevar \ + +Everyone is permitted to copy and distribute verbatim or modified copies +of this license document, and changing it is allowed as long as the name +is changed. + +DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE TERMS AND CONDITIONS FOR +COPYING, DISTRIBUTION AND MODIFICATION + +0. You just DO WHAT THE FUCK YOU WANT TO. + +## ISC + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + +set-delayed-interval +MIT +MIT License + +Copyright (c) 2020 Vasco Santos + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +super-regex +MIT +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +timeout-abort-controller +MIT +MIT License + +Copyright (c) 2019 Jacob Heun + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +truncate-utf8-bytes +WTFPL + +tslib +0BSD +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + +uint8-varint +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +uint8arraylist +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +uint8arrays +MIT + +utf8-byte-length +WTFPL + +uuid +MIT +The MIT License (MIT) + +Copyright (c) 2010-2020 Robert Kieffer and other contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +varint +MIT + +wherearewe +Apache-2.0 OR MIT +This project is dual licensed under MIT and Apache-2.0. + +MIT: https://www.opensource.org/licenses/mit +Apache-2.0: https://www.apache.org/licenses/license-2.0 + + +yocto-queue +MIT +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +zone.js +MIT +The MIT License + +Copyright (c) 2010-2022 Google LLC. https://angular.io/license + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/relay-angular-chat/favicon.ico b/relay-angular-chat/favicon.ico new file mode 100644 index 0000000..997406a Binary files /dev/null and b/relay-angular-chat/favicon.ico differ diff --git a/relay-angular-chat/index.html b/relay-angular-chat/index.html new file mode 100644 index 0000000..c5387d9 --- /dev/null +++ b/relay-angular-chat/index.html @@ -0,0 +1,12 @@ + + + RelayAngularChat + + + + + + + + + \ No newline at end of file diff --git a/relay-angular-chat/main.12089dc23166e9e6.js b/relay-angular-chat/main.12089dc23166e9e6.js new file mode 100644 index 0000000..533fdd1 --- /dev/null +++ b/relay-angular-chat/main.12089dc23166e9e6.js @@ -0,0 +1 @@ +(self.webpackChunkrelay_angular_chat=self.webpackChunkrelay_angular_chat||[]).push([[179],{1873:(J,G,N)=>{"use strict";J.exports=N(4729)},4729:(J,G,N)=>{"use strict";var h=G;function u(){h.util._configure(),h.Writer._configure(h.BufferWriter),h.Reader._configure(h.BufferReader)}h.build="minimal",h.Writer=N(3542),h.BufferWriter=N(989),h.Reader=N(6913),h.BufferReader=N(1872),h.util=N(6138),h.rpc=N(9852),h.roots=N(935),h.configure=u,u()},6913:(J,G,N)=>{"use strict";J.exports=v;var u,h=N(6138),g=h.LongBits,b=h.utf8;function w(E,y){return RangeError("index out of range: "+E.pos+" + "+(y||1)+" > "+E.len)}function v(E){this.buf=E,this.pos=0,this.len=E.length}var y,l=typeof Uint8Array<"u"?function(y){if(y instanceof Uint8Array||Array.isArray(y))return new v(y);throw Error("illegal buffer")}:function(y){if(Array.isArray(y))return new v(y);throw Error("illegal buffer")},p=function(){return h.Buffer?function(f){return(v.create=function(A){return h.Buffer.isBuffer(A)?new u(A):l(A)})(f)}:l};function d(){var E=new g(0,0),y=0;if(!(this.len-this.pos>4)){for(;y<3;++y){if(this.pos>=this.len)throw w(this);if(E.lo=(E.lo|(127&this.buf[this.pos])<<7*y)>>>0,this.buf[this.pos++]<128)return E}return E.lo=(E.lo|(127&this.buf[this.pos++])<<7*y)>>>0,E}for(;y<4;++y)if(E.lo=(E.lo|(127&this.buf[this.pos])<<7*y)>>>0,this.buf[this.pos++]<128)return E;if(E.lo=(E.lo|(127&this.buf[this.pos])<<28)>>>0,E.hi=(E.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return E;if(y=0,this.len-this.pos>4){for(;y<5;++y)if(E.hi=(E.hi|(127&this.buf[this.pos])<<7*y+3)>>>0,this.buf[this.pos++]<128)return E}else for(;y<5;++y){if(this.pos>=this.len)throw w(this);if(E.hi=(E.hi|(127&this.buf[this.pos])<<7*y+3)>>>0,this.buf[this.pos++]<128)return E}throw Error("invalid varint encoding")}function _(E,y){return(E[y-4]|E[y-3]<<8|E[y-2]<<16|E[y-1]<<24)>>>0}function I(){if(this.pos+8>this.len)throw w(this,8);return new g(_(this.buf,this.pos+=4),_(this.buf,this.pos+=4))}v.create=p(),v.prototype._slice=h.Array.prototype.subarray||h.Array.prototype.slice,v.prototype.uint32=(y=4294967295,function(){if(y=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128||(y=(y|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)||(y=(y|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)||(y=(y|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)||(y=(y|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128))return y;if((this.pos+=5)>this.len)throw this.pos=this.len,w(this,10);return y}),v.prototype.int32=function(){return 0|this.uint32()},v.prototype.sint32=function(){var y=this.uint32();return y>>>1^-(1&y)|0},v.prototype.bool=function(){return 0!==this.uint32()},v.prototype.fixed32=function(){if(this.pos+4>this.len)throw w(this,4);return _(this.buf,this.pos+=4)},v.prototype.sfixed32=function(){if(this.pos+4>this.len)throw w(this,4);return 0|_(this.buf,this.pos+=4)},v.prototype.float=function(){if(this.pos+4>this.len)throw w(this,4);var y=h.float.readFloatLE(this.buf,this.pos);return this.pos+=4,y},v.prototype.double=function(){if(this.pos+8>this.len)throw w(this,4);var y=h.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,y},v.prototype.bytes=function(){var y=this.uint32(),f=this.pos,C=this.pos+y;if(C>this.len)throw w(this,y);return this.pos+=y,Array.isArray(this.buf)?this.buf.slice(f,C):f===C?new this.buf.constructor(0):this._slice.call(this.buf,f,C)},v.prototype.string=function(){var y=this.bytes();return b.read(y,0,y.length)},v.prototype.skip=function(y){if("number"==typeof y){if(this.pos+y>this.len)throw w(this,y);this.pos+=y}else do{if(this.pos>=this.len)throw w(this)}while(128&this.buf[this.pos++]);return this},v.prototype.skipType=function(E){switch(E){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(E=7&this.uint32());)this.skipType(E);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+E+" at offset "+this.pos)}return this},v._configure=function(E){u=E,v.create=p(),u._configure();var y=h.Long?"toLong":"toNumber";h.merge(v.prototype,{int64:function(){return d.call(this)[y](!1)},uint64:function(){return d.call(this)[y](!0)},sint64:function(){return d.call(this).zzDecode()[y](!1)},fixed64:function(){return I.call(this)[y](!0)},sfixed64:function(){return I.call(this)[y](!1)}})}},1872:(J,G,N)=>{"use strict";J.exports=g;var h=N(6913);(g.prototype=Object.create(h.prototype)).constructor=g;var u=N(6138);function g(b){h.call(this,b)}g._configure=function(){u.Buffer&&(g.prototype._slice=u.Buffer.prototype.slice)},g.prototype.string=function(){var w=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+w,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+w,this.len))},g._configure()},935:J=>{"use strict";J.exports={}},9852:(J,G,N)=>{"use strict";G.Service=N(3939)},3939:(J,G,N)=>{"use strict";J.exports=u;var h=N(6138);function u(g,b,w){if("function"!=typeof g)throw TypeError("rpcImpl must be a function");h.EventEmitter.call(this),this.rpcImpl=g,this.requestDelimited=Boolean(b),this.responseDelimited=Boolean(w)}(u.prototype=Object.create(h.EventEmitter.prototype)).constructor=u,u.prototype.rpcCall=function g(b,w,v,l,p){if(!l)throw TypeError("request must be specified");var d=this;if(!p)return h.asPromise(g,d,b,w,v,l);if(d.rpcImpl)try{return d.rpcImpl(b,w[d.requestDelimited?"encodeDelimited":"encode"](l).finish(),function(I,E){if(I)return d.emit("error",I,b),p(I);if(null!==E){if(!(E instanceof v))try{E=v[d.responseDelimited?"decodeDelimited":"decode"](E)}catch(y){return d.emit("error",y,b),p(y)}return d.emit("data",E,b),p(null,E)}d.end(!0)})}catch(_){return d.emit("error",_,b),void setTimeout(function(){p(_)},0)}else setTimeout(function(){p(Error("already ended"))},0)},u.prototype.end=function(b){return this.rpcImpl&&(b||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},6723:(J,G,N)=>{"use strict";J.exports=u;var h=N(6138);function u(v,l){this.lo=v>>>0,this.hi=l>>>0}var g=u.zero=new u(0,0);g.toNumber=function(){return 0},g.zzEncode=g.zzDecode=function(){return this},g.length=function(){return 1};var b=u.zeroHash="\0\0\0\0\0\0\0\0";u.fromNumber=function(l){if(0===l)return g;var p=l<0;p&&(l=-l);var d=l>>>0,_=(l-d)/4294967296>>>0;return p&&(_=~_>>>0,d=~d>>>0,++d>4294967295&&(d=0,++_>4294967295&&(_=0))),new u(d,_)},u.from=function(l){if("number"==typeof l)return u.fromNumber(l);if(h.isString(l)){if(!h.Long)return u.fromNumber(parseInt(l,10));l=h.Long.fromString(l)}return l.low||l.high?new u(l.low>>>0,l.high>>>0):g},u.prototype.toNumber=function(l){if(!l&&this.hi>>>31){var p=1+~this.lo>>>0,d=~this.hi>>>0;return p||(d=d+1>>>0),-(p+4294967296*d)}return this.lo+4294967296*this.hi},u.prototype.toLong=function(l){return h.Long?new h.Long(0|this.lo,0|this.hi,Boolean(l)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(l)}};var w=String.prototype.charCodeAt;u.fromHash=function(l){return l===b?g:new u((w.call(l,0)|w.call(l,1)<<8|w.call(l,2)<<16|w.call(l,3)<<24)>>>0,(w.call(l,4)|w.call(l,5)<<8|w.call(l,6)<<16|w.call(l,7)<<24)>>>0)},u.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},u.prototype.zzEncode=function(){var l=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^l)>>>0,this.lo=(this.lo<<1^l)>>>0,this},u.prototype.zzDecode=function(){var l=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^l)>>>0,this.hi=(this.hi>>>1^l)>>>0,this},u.prototype.length=function(){var l=this.lo,p=(this.lo>>>28|this.hi<<4)>>>0,d=this.hi>>>24;return 0===d?0===p?l<16384?l<128?1:2:l<2097152?3:4:p<16384?p<128?5:6:p<2097152?7:8:d<128?9:10}},6138:function(J,G,N){"use strict";var h=G;function u(b,w,v){for(var l=Object.keys(w),p=0;p0)},h.Buffer=function(){try{var b=h.inquire("buffer").Buffer;return b.prototype.utf8Write?b:null}catch{return null}}(),h._Buffer_from=null,h._Buffer_allocUnsafe=null,h.newBuffer=function(w){return"number"==typeof w?h.Buffer?h._Buffer_allocUnsafe(w):new h.Array(w):h.Buffer?h._Buffer_from(w):typeof Uint8Array>"u"?w:new Uint8Array(w)},h.Array=typeof Uint8Array<"u"?Uint8Array:Array,h.Long=h.global.dcodeIO&&h.global.dcodeIO.Long||h.global.Long||h.inquire("long"),h.key2Re=/^true|false|0|1$/,h.key32Re=/^-?(?:0|[1-9][0-9]*)$/,h.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,h.longToHash=function(w){return w?h.LongBits.from(w).toHash():h.LongBits.zeroHash},h.longFromHash=function(w,v){var l=h.LongBits.fromHash(w);return h.Long?h.Long.fromBits(l.lo,l.hi,v):l.toNumber(Boolean(v))},h.merge=u,h.lcFirst=function(w){return w.charAt(0).toLowerCase()+w.substring(1)},h.newError=g,h.ProtocolError=g("ProtocolError"),h.oneOfGetter=function(w){for(var v={},l=0;l-1;--d)if(1===v[p[d]]&&null!=this[p[d]])return p[d]}},h.oneOfSetter=function(w){return function(v){for(var l=0;l{"use strict";J.exports=d;var u,h=N(6138),g=h.LongBits,b=h.base64,w=h.utf8;function v(P,D,x){this.fn=P,this.len=D,this.next=void 0,this.val=x}function l(){}function p(P){this.head=P.head,this.tail=P.tail,this.len=P.len,this.next=P.states}function d(){this.len=0,this.head=new v(l,0,0),this.tail=this.head,this.states=null}var _=function(){return h.Buffer?function(){return(d.create=function(){return new u})()}:function(){return new d}};function I(P,D,x){D[x]=255&P}function y(P,D){this.len=P,this.next=void 0,this.val=D}function f(P,D,x){for(;P.hi;)D[x++]=127&P.lo|128,P.lo=(P.lo>>>7|P.hi<<25)>>>0,P.hi>>>=7;for(;P.lo>127;)D[x++]=127&P.lo|128,P.lo=P.lo>>>7;D[x++]=P.lo}function C(P,D,x){D[x]=255&P,D[x+1]=P>>>8&255,D[x+2]=P>>>16&255,D[x+3]=P>>>24}d.create=_(),d.alloc=function(D){return new h.Array(D)},h.Array!==Array&&(d.alloc=h.pool(d.alloc,h.Array.prototype.subarray)),d.prototype._push=function(D,x,M){return this.tail=this.tail.next=new v(D,x,M),this.len+=x,this},(y.prototype=Object.create(v.prototype)).fn=function E(P,D,x){for(;P>127;)D[x++]=127&P|128,P>>>=7;D[x]=P},d.prototype.uint32=function(D){return this.len+=(this.tail=this.tail.next=new y((D>>>=0)<128?1:D<16384?2:D<2097152?3:D<268435456?4:5,D)).len,this},d.prototype.int32=function(D){return D<0?this._push(f,10,g.fromNumber(D)):this.uint32(D)},d.prototype.sint32=function(D){return this.uint32((D<<1^D>>31)>>>0)},d.prototype.int64=d.prototype.uint64=function(D){var x=g.from(D);return this._push(f,x.length(),x)},d.prototype.sint64=function(D){var x=g.from(D).zzEncode();return this._push(f,x.length(),x)},d.prototype.bool=function(D){return this._push(I,1,D?1:0)},d.prototype.sfixed32=d.prototype.fixed32=function(D){return this._push(C,4,D>>>0)},d.prototype.sfixed64=d.prototype.fixed64=function(D){var x=g.from(D);return this._push(C,4,x.lo)._push(C,4,x.hi)},d.prototype.float=function(D){return this._push(h.float.writeFloatLE,4,D)},d.prototype.double=function(D){return this._push(h.float.writeDoubleLE,8,D)};var A=h.Array.prototype.set?function(D,x,M){x.set(D,M)}:function(D,x,M){for(var B=0;B>>0;if(!x)return this._push(I,1,0);if(h.isString(D)){var M=d.alloc(x=b.length(D));b.decode(D,M,0),D=M}return this.uint32(x)._push(A,x,D)},d.prototype.string=function(D){var x=w.length(D);return x?this.uint32(x)._push(w.write,x,D):this._push(I,1,0)},d.prototype.fork=function(){return this.states=new p(this),this.head=this.tail=new v(l,0,0),this.len=0,this},d.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new v(l,0,0),this.len=0),this},d.prototype.ldelim=function(){var D=this.head,x=this.tail,M=this.len;return this.reset().uint32(M),M&&(this.tail.next=D.next,this.tail=x,this.len+=M),this},d.prototype.finish=function(){for(var D=this.head.next,x=this.constructor.alloc(this.len),M=0;D;)D.fn(D.val,x,M),M+=D.len,D=D.next;return x},d._configure=function(P){u=P,d.create=_(),u._configure()}},989:(J,G,N)=>{"use strict";J.exports=g;var h=N(3542);(g.prototype=Object.create(h.prototype)).constructor=g;var u=N(6138);function g(){h.call(this)}function b(w,v,l){w.length<40?u.utf8.write(w,v,l):v.utf8Write?v.utf8Write(w,l):v.write(w,l)}g._configure=function(){g.alloc=u._Buffer_allocUnsafe,g.writeBytesBuffer=u.Buffer&&u.Buffer.prototype instanceof Uint8Array&&"set"===u.Buffer.prototype.set.name?function(v,l,p){l.set(v,p)}:function(v,l,p){if(v.copy)v.copy(l,p,0,v.length);else for(var d=0;d>>0;return this.uint32(l),l&&this._push(g.writeBytesBuffer,l,v),this},g.prototype.string=function(v){var l=u.Buffer.byteLength(v);return this.uint32(l),l&&this._push(b,l,v),this},g._configure()},623:(J,G,N)=>{"use strict";var h={};N.r(h),N.d(h,{identity:()=>cF});var u={};N.r(u),N.d(u,{base2:()=>uF});var g={};N.r(g),N.d(g,{base8:()=>lF});var b={};N.r(b),N.d(b,{base10:()=>fF});var w={};N.r(w),N.d(w,{base16:()=>dF,base16upper:()=>hF});var v={};N.r(v),N.d(v,{base32:()=>Ro,base32hex:()=>mF,base32hexpad:()=>EF,base32hexpadupper:()=>wF,base32hexupper:()=>vF,base32pad:()=>gF,base32padupper:()=>yF,base32upper:()=>pF,base32z:()=>bF});var l={};N.r(l),N.d(l,{base36:()=>_F,base36upper:()=>DF});var p={};N.r(p),N.d(p,{base58btc:()=>Ci,base58flickr:()=>SF});var d={};N.r(d),N.d(d,{base64:()=>Lh,base64pad:()=>IF,base64url:()=>CF,base64urlpad:()=>TF});var _={};N.r(_),N.d(_,{base256emoji:()=>NF});var I={};N.r(I),N.d(I,{sha256:()=>Li,sha512:()=>JF});var E={};N.r(E),N.d(E,{identity:()=>gu});var y={};N.r(y),N.d(y,{code:()=>nU,decode:()=>iU,encode:()=>rU,name:()=>tU});var f={};N.r(f),N.d(f,{code:()=>cU,decode:()=>lU,encode:()=>uU,name:()=>aU});var C={};N.r(C),N.d(C,{RsaPrivateKey:()=>qh,RsaPublicKey:()=>Ym,fromJwk:()=>eV,generateKeyPair:()=>tV,unmarshalRsaPrivateKey:()=>XU,unmarshalRsaPublicKey:()=>JU});var A={};N.r(A),N.d(A,{Ed25519PrivateKey:()=>ff,Ed25519PublicKey:()=>mv,generateKeyPair:()=>CV,generateKeyPairFromSeed:()=>TV,unmarshalEd25519PrivateKey:()=>SV,unmarshalEd25519PublicKey:()=>IV});var P={};function D(n){return"function"==typeof n}function x(n){const t=n(r=>{Error.call(r),r.stack=(new Error).stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}N.r(P),N.d(P,{Secp256k1PrivateKey:()=>Dv,Secp256k1PublicKey:()=>_v,generateKeyPair:()=>kV,unmarshalSecp256k1PrivateKey:()=>OV,unmarshalSecp256k1PublicKey:()=>LV});const M=x(n=>function(t){n(this),this.message=t?`${t.length} errors occurred during unsubscription:\n${t.map((r,i)=>`${i+1}) ${r.toString()}`).join("\n ")}`:"",this.name="UnsubscriptionError",this.errors=t});function B(n,e){if(n){const t=n.indexOf(e);0<=t&&n.splice(t,1)}}class F{constructor(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}unsubscribe(){let e;if(!this.closed){this.closed=!0;const{_parentage:t}=this;if(t)if(this._parentage=null,Array.isArray(t))for(const s of t)s.remove(this);else t.remove(this);const{initialTeardown:r}=this;if(D(r))try{r()}catch(s){e=s instanceof M?s.errors:[s]}const{_finalizers:i}=this;if(i){this._finalizers=null;for(const s of i)try{O(s)}catch(o){e=e??[],o instanceof M?e=[...e,...o.errors]:e.push(o)}}if(e)throw new M(e)}}add(e){var t;if(e&&e!==this)if(this.closed)O(e);else{if(e instanceof F){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=null!==(t=this._finalizers)&&void 0!==t?t:[]).push(e)}}_hasParent(e){const{_parentage:t}=this;return t===e||Array.isArray(t)&&t.includes(e)}_addParent(e){const{_parentage:t}=this;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e}_removeParent(e){const{_parentage:t}=this;t===e?this._parentage=null:Array.isArray(t)&&B(t,e)}remove(e){const{_finalizers:t}=this;t&&B(t,e),e instanceof F&&e._removeParent(this)}}F.EMPTY=(()=>{const n=new F;return n.closed=!0,n})();const z=F.EMPTY;function S(n){return n instanceof F||n&&"closed"in n&&D(n.remove)&&D(n.add)&&D(n.unsubscribe)}function O(n){D(n)?n():n.unsubscribe()}const H={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},L={setTimeout(n,e,...t){const{delegate:r}=L;return r?.setTimeout?r.setTimeout(n,e,...t):setTimeout(n,e,...t)},clearTimeout(n){const{delegate:e}=L;return(e?.clearTimeout||clearTimeout)(n)},delegate:void 0};function j(n){L.setTimeout(()=>{const{onUnhandledError:e}=H;if(!e)throw n;e(n)})}function re(){}const $=q("C",void 0,void 0);function q(n,e,t){return{kind:n,value:e,error:t}}let ne=null;function oe(n){if(H.useDeprecatedSynchronousErrorHandling){const e=!ne;if(e&&(ne={errorThrown:!1,error:null}),n(),e){const{errorThrown:t,error:r}=ne;if(ne=null,t)throw r}}else n()}class pe extends F{constructor(e){super(),this.isStopped=!1,e?(this.destination=e,S(e)&&e.add(this)):this.destination=Ce}static create(e,t,r){return new we(e,t,r)}next(e){this.isStopped?Ee(function Z(n){return q("N",n,void 0)}(e),this):this._next(e)}error(e){this.isStopped?Ee(function te(n){return q("E",void 0,n)}(e),this):(this.isStopped=!0,this._error(e))}complete(){this.isStopped?Ee($,this):(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe(),this.destination=null)}_next(e){this.destination.next(e)}_error(e){try{this.destination.error(e)}finally{this.unsubscribe()}}_complete(){try{this.destination.complete()}finally{this.unsubscribe()}}}const ke=Function.prototype.bind;function Se(n,e){return ke.call(n,e)}class Pe{constructor(e){this.partialObserver=e}next(e){const{partialObserver:t}=this;if(t.next)try{t.next(e)}catch(r){$e(r)}}error(e){const{partialObserver:t}=this;if(t.error)try{t.error(e)}catch(r){$e(r)}else $e(e)}complete(){const{partialObserver:e}=this;if(e.complete)try{e.complete()}catch(t){$e(t)}}}class we extends pe{constructor(e,t,r){let i;if(super(),D(e)||!e)i={next:e??void 0,error:t??void 0,complete:r??void 0};else{let s;this&&H.useDeprecatedNextContext?(s=Object.create(e),s.unsubscribe=()=>this.unsubscribe(),i={next:e.next&&Se(e.next,s),error:e.error&&Se(e.error,s),complete:e.complete&&Se(e.complete,s)}):i=e}this.destination=new Pe(i)}}function $e(n){H.useDeprecatedSynchronousErrorHandling?function de(n){H.useDeprecatedSynchronousErrorHandling&&ne&&(ne.errorThrown=!0,ne.error=n)}(n):j(n)}function Ee(n,e){const{onStoppedNotification:t}=H;t&&L.setTimeout(()=>t(n,e))}const Ce={closed:!0,next:re,error:function K(n){throw n},complete:re},xe="function"==typeof Symbol&&Symbol.observable||"@@observable";function Ke(n){return n}let Xe=(()=>{class n{constructor(t){t&&(this._subscribe=t)}lift(t){const r=new n;return r.source=this,r.operator=t,r}subscribe(t,r,i){const s=function Dt(n){return n&&n instanceof pe||function pt(n){return n&&D(n.next)&&D(n.error)&&D(n.complete)}(n)&&S(n)}(t)?t:new we(t,r,i);return oe(()=>{const{operator:o,source:a}=this;s.add(o?o.call(s,a):a?this._subscribe(s):this._trySubscribe(s))}),s}_trySubscribe(t){try{return this._subscribe(t)}catch(r){t.error(r)}}forEach(t,r){return new(r=Ot(r))((i,s)=>{const o=new we({next:a=>{try{t(a)}catch(c){s(c),o.unsubscribe()}},error:s,complete:i});this.subscribe(o)})}_subscribe(t){var r;return null===(r=this.source)||void 0===r?void 0:r.subscribe(t)}[xe](){return this}pipe(...t){return function Je(n){return 0===n.length?Ke:1===n.length?n[0]:function(t){return n.reduce((r,i)=>i(r),t)}}(t)(this)}toPromise(t){return new(t=Ot(t))((r,i)=>{let s;this.subscribe(o=>s=o,o=>i(o),()=>r(s))})}}return n.create=e=>new n(e),n})();function Ot(n){var e;return null!==(e=n??H.Promise)&&void 0!==e?e:Promise}const Wr=x(n=>function(){n(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"});let Sr=(()=>{class n extends Xe{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(t){const r=new ni(this,this);return r.operator=t,r}_throwIfClosed(){if(this.closed)throw new Wr}next(t){oe(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(const r of this.currentObservers)r.next(t)}})}error(t){oe(()=>{if(this._throwIfClosed(),!this.isStopped){this.hasError=this.isStopped=!0,this.thrownError=t;const{observers:r}=this;for(;r.length;)r.shift().error(t)}})}complete(){oe(()=>{if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;const{observers:t}=this;for(;t.length;)t.shift().complete()}})}unsubscribe(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null}get observed(){var t;return(null===(t=this.observers)||void 0===t?void 0:t.length)>0}_trySubscribe(t){return this._throwIfClosed(),super._trySubscribe(t)}_subscribe(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)}_innerSubscribe(t){const{hasError:r,isStopped:i,observers:s}=this;return r||i?z:(this.currentObservers=null,s.push(t),new F(()=>{this.currentObservers=null,B(s,t)}))}_checkFinalizedStatuses(t){const{hasError:r,thrownError:i,isStopped:s}=this;r?t.error(i):s&&t.complete()}asObservable(){const t=new Xe;return t.source=this,t}}return n.create=(e,t)=>new ni(e,t),n})();class ni extends Sr{constructor(e,t){super(),this.destination=e,this.source=t}next(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===r||r.call(t,e)}error(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===r||r.call(t,e)}complete(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)}_subscribe(e){var t,r;return null!==(r=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==r?r:z}}function fe(n){return e=>{if(function ie(n){return D(n?.lift)}(e))return e.lift(function(t){try{return n(t,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}function ye(n,e,t,r,i){return new me(n,e,t,r,i)}class me extends pe{constructor(e,t,r,i,s,o){super(e),this.onFinalize=s,this.shouldUnsubscribe=o,this._next=t?function(a){try{t(a)}catch(c){e.error(c)}}:super._next,this._error=i?function(a){try{i(a)}catch(c){e.error(c)}finally{this.unsubscribe()}}:super._error,this._complete=r?function(){try{r()}catch(a){e.error(a)}finally{this.unsubscribe()}}:super._complete}unsubscribe(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){const{closed:t}=this;super.unsubscribe(),!t&&(null===(e=this.onFinalize)||void 0===e||e.call(this))}}}function Bt(n){return this instanceof Bt?(this.v=n,this):new Bt(n)}function yn(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,r=t.apply(n,e||[]),s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(k){r[k]&&(i[k]=function(U){return new Promise(function(Q,X){s.push([k,U,Q,X])>1||a(k,U)})})}function a(k,U){try{!function c(k){k.value instanceof Bt?Promise.resolve(k.value.v).then(m,T):R(s[0][2],k)}(r[k](U))}catch(Q){R(s[0][3],Q)}}function m(k){a("next",k)}function T(k){a("throw",k)}function R(k,U){k(U),s.shift(),s.length&&a(s[0][0],s[0][1])}}function ft(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,e=n[Symbol.asyncIterator];return e?e.call(n):(n=function dt(n){var e="function"==typeof Symbol&&Symbol.iterator,t=e&&n[e],r=0;if(t)return t.call(n);if(n&&"number"==typeof n.length)return{next:function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}(n),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(s){t[s]=n[s]&&function(o){return new Promise(function(a,c){!function i(s,o,a,c){Promise.resolve(c).then(function(m){s({value:m,done:a})},o)}(a,c,(o=n[s](o)).done,o.value)})}}}const bn=n=>n&&"number"==typeof n.length&&"function"!=typeof n;function vr(n){return D(n?.then)}function rr(n){return D(n[xe])}function _n(n){return Symbol.asyncIterator&&D(n?.[Symbol.asyncIterator])}function Ft(n){return new TypeError(`You provided ${null!==n&&"object"==typeof n?"an invalid object":`'${n}'`} where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`)}const ce=function ut(){return"function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator"}();function ve(n){return D(n?.[ce])}function yt(n){return yn(this,arguments,function*(){const t=n.getReader();try{for(;;){const{value:r,done:i}=yield Bt(t.read());if(i)return yield Bt(void 0);yield yield Bt(r)}}finally{t.releaseLock()}})}function St(n){return D(n?.getReader)}function mn(n){if(n instanceof Xe)return n;if(null!=n){if(rr(n))return function Ge(n){return new Xe(e=>{const t=n[xe]();if(D(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}(n);if(bn(n))return function Qe(n){return new Xe(e=>{for(let t=0;t{n.then(t=>{e.closed||(e.next(t),e.complete())},t=>e.error(t)).then(null,j)})}(n);if(_n(n))return ht(n);if(ve(n))return function ze(n){return new Xe(e=>{for(const t of n)if(e.next(t),e.closed)return;e.complete()})}(n);if(St(n))return function Et(n){return ht(yt(n))}(n)}throw Ft(n)}function ht(n){return new Xe(e=>{(function lt(n,e){var t,r,i,s;return function ge(n,e,t,r){return new(t||(t=Promise))(function(s,o){function a(T){try{m(r.next(T))}catch(R){o(R)}}function c(T){try{m(r.throw(T))}catch(R){o(R)}}function m(T){T.done?s(T.value):function i(s){return s instanceof t?s:new t(function(o){o(s)})}(T.value).then(a,c)}m((r=r.apply(n,e||[])).next())})}(this,void 0,void 0,function*(){try{for(t=ft(n);!(r=yield t.next()).done;)if(e.next(r.value),e.closed)return}catch(o){i={error:o}}finally{try{r&&!r.done&&(s=t.return)&&(yield s.call(t))}finally{if(i)throw i.error}}e.complete()})})(n,e).catch(t=>e.error(t))})}function It(n,e,t,r=0,i=!1){const s=e.schedule(function(){t(),i?n.add(this.schedule(null,r)):this.unsubscribe()},r);if(n.add(s),!i)return s}function Ut(n,e,t=1/0){return D(e)?Ut((r,i)=>function _e(n,e){return fe((t,r)=>{let i=0;t.subscribe(ye(r,s=>{r.next(n.call(e,s,i++))}))})}((s,o)=>e(r,s,i,o))(mn(n(r,i))),t):("number"==typeof e&&(t=e),fe((r,i)=>function jt(n,e,t,r,i,s,o,a){const c=[];let m=0,T=0,R=!1;const k=()=>{R&&!c.length&&!m&&e.complete()},U=X=>m{s&&e.next(X),m++;let ae=!1;mn(t(X,T++)).subscribe(ye(e,he=>{i?.(he),s?U(he):e.next(he)},()=>{ae=!0},void 0,()=>{if(ae)try{for(m--;c.length&&mQ(he)):Q(he)}k()}catch(he){e.error(he)}}))};return n.subscribe(ye(e,U,()=>{R=!0,k()})),()=>{a?.()}}(r,i,n,t)))}const Tn=new Xe(n=>n.complete());function Zo(n){return n[n.length-1]}function Y(n,e=0){return fe((t,r)=>{t.subscribe(ye(r,i=>It(r,n,()=>r.next(i),e),()=>It(r,n,()=>r.complete(),e),i=>It(r,n,()=>r.error(i),e)))})}function ee(n,e=0){return fe((t,r)=>{r.add(n.schedule(()=>t.subscribe(r),e))})}function Ze(n,e){if(!n)throw new Error("Iterable cannot be null");return new Xe(t=>{It(t,e,()=>{const r=n[Symbol.asyncIterator]();It(t,e,()=>{r.next().then(i=>{i.done?t.complete():t.next(i.value)})},0,!0)})})}function mi(...n){const e=function ka(n){return function La(n){return n&&D(n.schedule)}(Zo(n))?n.pop():void 0}(n),t=function W(n,e){return"number"==typeof Zo(n)?n.pop():e}(n,1/0),r=n;return r.length?1===r.length?mn(r[0]):function Nn(n=1/0){return Ut(Ke,n)}(t)(function Ri(n,e){return e?function Ir(n,e){if(null!=n){if(rr(n))return function le(n,e){return mn(n).pipe(ee(e),Y(e))}(n,e);if(bn(n))return function He(n,e){return new Xe(t=>{let r=0;return e.schedule(function(){r===n.length?t.complete():(t.next(n[r++]),t.closed||this.schedule())})})}(n,e);if(vr(n))return function Oe(n,e){return mn(n).pipe(ee(e),Y(e))}(n,e);if(_n(n))return Ze(n,e);if(ve(n))return function tt(n,e){return new Xe(t=>{let r;return It(t,e,()=>{r=n[ce](),It(t,e,()=>{let i,s;try{({value:i,done:s}=r.next())}catch(o){return void t.error(o)}s?t.complete():t.next(i)},0,!0)}),()=>D(r?.return)&&r.return()})}(n,e);if(St(n))return function on(n,e){return Ze(yt(n),e)}(n,e)}throw Ft(n)}(n,e):mn(n)}(r,e)):Tn}function Xo(n,e,...t){if(!0===e)return void n();if(!1===e)return;const r=new we({next:()=>{r.unsubscribe(),n()}});return e(...t).subscribe(r)}function Xt(n){for(let e in n)if(n[e]===Xt)return e;throw Error("Could not find renamed property on target object.")}function Dn(n){if("string"==typeof n)return n;if(Array.isArray(n))return"["+n.map(Dn).join(", ")+"]";if(null==n)return""+n;if(n.overriddenName)return`${n.overriddenName}`;if(n.name)return`${n.name}`;const e=n.toString();if(null==e)return""+e;const t=e.indexOf("\n");return-1===t?e:e.substring(0,t)}function ns(n,e){return null==n||""===n?null===e?"":e:null==e||""===e?n:n+" "+e}const el=Xt({__forward_ref__:Xt});function ag(n){return n.__forward_ref__=ag,n.toString=function(){return Dn(this())},n}function Nt(n){return function cg(n){return"function"==typeof n&&n.hasOwnProperty(el)&&n.__forward_ref__===ag}(n)?n():n}class xt extends Error{constructor(e,t){super(function Yf(n,e){return`NG0${Math.abs(n)}${e?": "+e.trim():""}`}(e,t)),this.code=e}}function Vt(n){return"string"==typeof n?n:null==n?"":String(n)}function Zf(n,e){throw new xt(-201,!1)}function Ki(n,e){null==n&&function Mn(n,e,t,r){throw new Error(`ASSERTION ERROR: ${n}`+(null==r?"":` [Expected=> ${t} ${r} ${e} <=Actual]`))}(e,n,null,"!=")}function Jn(n){return{token:n.token,providedIn:n.providedIn||null,factory:n.factory,value:void 0}}function vc(n){return{providers:n.providers||[],imports:n.imports||[]}}function Xf(n){return bb(n,Jf)||bb(n,Db)}function bb(n,e){return n.hasOwnProperty(e)?n[e]:null}function _b(n){return n&&(n.hasOwnProperty(ug)||n.hasOwnProperty(bP))?n[ug]:null}const Jf=Xt({\u0275prov:Xt}),ug=Xt({\u0275inj:Xt}),Db=Xt({ngInjectableDef:Xt}),bP=Xt({ngInjectorDef:Xt});var Lt=(()=>((Lt=Lt||{})[Lt.Default=0]="Default",Lt[Lt.Host=1]="Host",Lt[Lt.Self=2]="Self",Lt[Lt.SkipSelf=4]="SkipSelf",Lt[Lt.Optional=8]="Optional",Lt))();let lg;function rs(n){const e=lg;return lg=n,e}function Sb(n,e,t){const r=Xf(n);return r&&"root"==r.providedIn?void 0===r.value?r.value=r.factory():r.value:t&Lt.Optional?null:void 0!==e?e:void Zf(Dn(n))}function Jo(n){return{toString:n}.toString()}var _s=(()=>((_s=_s||{})[_s.OnPush=0]="OnPush",_s[_s.Default=1]="Default",_s))(),zs=(()=>{return(n=zs||(zs={}))[n.Emulated=0]="Emulated",n[n.None=2]="None",n[n.ShadowDom=3]="ShadowDom",zs;var n})();const jn=(()=>typeof globalThis<"u"&&globalThis||typeof global<"u"&&global||typeof window<"u"&&window||typeof self<"u"&&typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&self)(),Ec={},xn=[],ed=Xt({\u0275cmp:Xt}),fg=Xt({\u0275dir:Xt}),dg=Xt({\u0275pipe:Xt}),Ib=Xt({\u0275mod:Xt}),po=Xt({\u0275fac:Xt}),tl=Xt({__NG_ELEMENT_ID__:Xt});let DP=0;function td(n){return Jo(()=>{const t=!0===n.standalone,r={},i={type:n.type,providersResolver:null,decls:n.decls,vars:n.vars,factory:null,template:n.template||null,consts:n.consts||null,ngContentSelectors:n.ngContentSelectors,hostBindings:n.hostBindings||null,hostVars:n.hostVars||0,hostAttrs:n.hostAttrs||null,contentQueries:n.contentQueries||null,declaredInputs:r,inputs:null,outputs:null,exportAs:n.exportAs||null,onPush:n.changeDetection===_s.OnPush,directiveDefs:null,pipeDefs:null,standalone:t,dependencies:t&&n.dependencies||null,getStandaloneInjector:null,selectors:n.selectors||xn,viewQuery:n.viewQuery||null,features:n.features||null,data:n.data||{},encapsulation:n.encapsulation||zs.Emulated,id:"c"+DP++,styles:n.styles||xn,_:null,setInput:null,schemas:n.schemas||null,tView:null},s=n.dependencies,o=n.features;return i.inputs=Ab(n.inputs,r),i.outputs=Ab(n.outputs),o&&o.forEach(a=>a(i)),i.directiveDefs=s?()=>("function"==typeof s?s():s).map(Cb).filter(Tb):null,i.pipeDefs=s?()=>("function"==typeof s?s():s).map(wi).filter(Tb):null,i})}function Cb(n){return kn(n)||Ei(n)}function Tb(n){return null!==n}function nl(n){return Jo(()=>({type:n.type,bootstrap:n.bootstrap||xn,declarations:n.declarations||xn,imports:n.imports||xn,exports:n.exports||xn,transitiveCompileScopes:null,schemas:n.schemas||null,id:n.id||null}))}function Ab(n,e){if(null==n)return Ec;const t={};for(const r in n)if(n.hasOwnProperty(r)){let i=n[r],s=i;Array.isArray(i)&&(s=i[1],i=i[0]),t[i]=r,e&&(e[i]=s)}return t}const is=td;function kn(n){return n[ed]||null}function Ei(n){return n[fg]||null}function wi(n){return n[dg]||null}function Ni(n){return Array.isArray(n)&&"object"==typeof n[1]}function Ss(n){return Array.isArray(n)&&!0===n[1]}function gg(n){return 0!=(8&n.flags)}function sd(n){return 2==(2&n.flags)}function od(n){return 1==(1&n.flags)}function Is(n){return null!==n.template}function xP(n){return 0!=(256&n[2])}function Ha(n,e){return n.hasOwnProperty(po)?n[po]:null}class NP{constructor(e,t,r){this.previousValue=e,this.currentValue=t,this.firstChange=r}isFirstChange(){return this.firstChange}}function Pb(n){return n.type.prototype.ngOnChanges&&(n.setInput=OP),MP}function MP(){const n=Mb(this),e=n?.current;if(e){const t=n.previous;if(t===Ec)n.previous=e;else for(let r in e)t[r]=e[r];n.current=null,this.ngOnChanges(e)}}function OP(n,e,t,r){const i=Mb(n)||function LP(n,e){return n[Nb]=e}(n,{previous:Ec,current:null}),s=i.current||(i.current={}),o=i.previous,a=this.declaredInputs[t],c=o[a];s[a]=new NP(c&&c.currentValue,e,o===Ec),n[r]=e}const Nb="__ngSimpleChanges__";function Mb(n){return n[Nb]||null}function Cr(n){for(;Array.isArray(n);)n=n[0];return n}function as(n,e){return Cr(e[n.index])}function wg(n,e){return n.data[e]}function Gi(n,e){const t=e[n];return Ni(t)?t:t[0]}function ud(n){return 64==(64&n[2])}function ea(n,e){return null==e?null:n[e]}function Lb(n){n[18]=0}function bg(n,e){n[5]+=e;let t=n,r=n[3];for(;null!==r&&(1===e&&1===t[5]||-1===e&&0===t[5]);)r[5]+=e,t=r,r=r[3]}const kt={lFrame:$b(null),bindingsEnabled:!0};function Bb(){return kt.bindingsEnabled}function Ve(){return kt.lFrame.lView}function pn(){return kt.lFrame.tView}function Lr(){let n=Fb();for(;null!==n&&64===n.type;)n=n.parent;return n}function Fb(){return kt.lFrame.currentTNode}function Ws(n,e){const t=kt.lFrame;t.currentTNode=n,t.isParent=e}function _g(){return kt.lFrame.isParent}function Ic(){return kt.lFrame.bindingIndex++}function ZP(n,e){const t=kt.lFrame;t.bindingIndex=t.bindingRootIndex=n,Sg(e)}function Sg(n){kt.lFrame.currentDirectiveIndex=n}function Cg(n){kt.lFrame.currentQueryIndex=n}function JP(n){const e=n[1];return 2===e.type?e.declTNode:1===e.type?n[6]:null}function Kb(n,e,t){if(t&Lt.SkipSelf){let i=e,s=n;for(;!(i=i.parent,null!==i||t&Lt.Host||(i=JP(s),null===i||(s=s[15],10&i.type))););if(null===i)return!1;e=i,n=s}const r=kt.lFrame=jb();return r.currentTNode=e,r.lView=n,!0}function Tg(n){const e=jb(),t=n[1];kt.lFrame=e,e.currentTNode=t.firstChild,e.lView=n,e.tView=t,e.contextLView=n,e.bindingIndex=t.bindingStartIndex,e.inI18n=!1}function jb(){const n=kt.lFrame,e=null===n?null:n.child;return null===e?$b(n):e}function $b(n){const e={currentTNode:null,isParent:!0,lView:null,tView:null,selectedIndex:-1,contextLView:null,elementDepthCount:0,currentNamespace:null,currentDirectiveIndex:-1,bindingRootIndex:-1,bindingIndex:-1,currentQueryIndex:0,parent:n,child:null,inI18n:!1};return null!==n&&(n.child=e),e}function Gb(){const n=kt.lFrame;return kt.lFrame=n.parent,n.currentTNode=null,n.lView=null,n}const zb=Gb;function Ag(){const n=Gb();n.isParent=!0,n.tView=null,n.selectedIndex=-1,n.contextLView=null,n.elementDepthCount=0,n.currentDirectiveIndex=-1,n.currentNamespace=null,n.bindingRootIndex=-1,n.bindingIndex=-1,n.currentQueryIndex=0}function _i(){return kt.lFrame.selectedIndex}function ta(n){kt.lFrame.selectedIndex=n}function fd(n,e){for(let t=e.directiveStart,r=e.directiveEnd;t=r)break}else e[c]<0&&(n[18]+=65536),(a>11>16&&(3&n[2])===e){n[2]+=2048;try{s.call(a)}finally{}}}else try{s.call(a)}finally{}}class cl{constructor(e,t,r){this.factory=e,this.resolving=!1,this.canSeeViewProviders=t,this.injectImpl=r}}function pd(n,e,t){let r=0;for(;re){o=s-1;break}}}for(;s>16}(n),r=e;for(;t>0;)r=r[15],t--;return r}let Pg=!0;function yd(n){const e=Pg;return Pg=n,e}let pN=0;const qs={};function ll(n,e){const t=Mg(n,e);if(-1!==t)return t;const r=e[1];r.firstCreatePass&&(n.injectorIndex=e.length,Ng(r.data,n),Ng(e,null),Ng(r.blueprint,null));const i=md(n,e),s=n.injectorIndex;if(Zb(i)){const o=Cc(i),a=Tc(i,e),c=a[1].data;for(let m=0;m<8;m++)e[s+m]=a[o+m]|c[o+m]}return e[s+8]=i,s}function Ng(n,e){n.push(0,0,0,0,0,0,0,0,e)}function Mg(n,e){return-1===n.injectorIndex||n.parent&&n.parent.injectorIndex===n.injectorIndex||null===e[n.injectorIndex+8]?-1:n.injectorIndex}function md(n,e){if(n.parent&&-1!==n.parent.injectorIndex)return n.parent.injectorIndex;let t=0,r=null,i=e;for(;null!==i;){if(r=o_(i),null===r)return-1;if(t++,i=i[15],-1!==r.injectorIndex)return r.injectorIndex|t<<16}return-1}function vd(n,e,t){!function gN(n,e,t){let r;"string"==typeof t?r=t.charCodeAt(0)||0:t.hasOwnProperty(tl)&&(r=t[tl]),null==r&&(r=t[tl]=pN++);const i=255&r;e.data[n+(i>>5)]|=1<=0?255&e:EN:e}(t);if("function"==typeof s){if(!Kb(e,n,r))return r&Lt.Host?e_(i,0,r):t_(e,t,r,i);try{const o=s(r);if(null!=o||r&Lt.Optional)return o;Zf()}finally{zb()}}else if("number"==typeof s){let o=null,a=Mg(n,e),c=-1,m=r&Lt.Host?e[16][6]:null;for((-1===a||r&Lt.SkipSelf)&&(c=-1===a?md(n,e):e[a+8],-1!==c&&s_(r,!1)?(o=e[1],a=Cc(c),e=Tc(c,e)):a=-1);-1!==a;){const T=e[1];if(i_(s,a,T.data)){const R=mN(a,e,t,o,r,m);if(R!==qs)return R}c=e[a+8],-1!==c&&s_(r,e[1].data[a+8]===m)&&i_(s,a,e)?(o=T,a=Cc(c),e=Tc(c,e)):a=-1}}return i}function mN(n,e,t,r,i,s){const o=e[1],a=o.data[n+8],T=function Ed(n,e,t,r,i){const s=n.providerIndexes,o=e.data,a=1048575&s,c=n.directiveStart,T=s>>20,k=i?a+T:n.directiveEnd;for(let U=r?a:a+T;U=c&&Q.type===t)return U}if(i){const U=o[c];if(U&&Is(U)&&U.type===t)return c}return null}(a,o,t,null==r?sd(a)&&Pg:r!=o&&0!=(3&a.type),i&Lt.Host&&s===a);return null!==T?fl(e,o,T,a):qs}function fl(n,e,t,r){let i=n[t];const s=e.data;if(function uN(n){return n instanceof cl}(i)){const o=i;o.resolving&&function pP(n,e){const t=e?`. Dependency path: ${e.join(" > ")} > ${n}`:"";throw new xt(-200,`Circular dependency in DI detected for ${n}${t}`)}(function An(n){return"function"==typeof n?n.name||n.toString():"object"==typeof n&&null!=n&&"function"==typeof n.type?n.type.name||n.type.toString():Vt(n)}(s[t]));const a=yd(o.canSeeViewProviders);o.resolving=!0;const c=o.injectImpl?rs(o.injectImpl):null;Kb(n,r,Lt.Default);try{i=n[t]=o.factory(void 0,s,n,r),e.firstCreatePass&&t>=r.directiveStart&&function aN(n,e,t){const{ngOnChanges:r,ngOnInit:i,ngDoCheck:s}=e.type.prototype;if(r){const o=Pb(e);(t.preOrderHooks||(t.preOrderHooks=[])).push(n,o),(t.preOrderCheckHooks||(t.preOrderCheckHooks=[])).push(n,o)}i&&(t.preOrderHooks||(t.preOrderHooks=[])).push(0-n,i),s&&((t.preOrderHooks||(t.preOrderHooks=[])).push(n,s),(t.preOrderCheckHooks||(t.preOrderCheckHooks=[])).push(n,s))}(t,s[t],e)}finally{null!==c&&rs(c),yd(a),o.resolving=!1,zb()}}return i}function i_(n,e,t){return!!(t[e+(n>>5)]&1<{const r=function kg(n){return function(...t){if(n){const r=n(...t);for(const i in r)this[i]=r[i]}}}(e);function i(...s){if(this instanceof i)return r.apply(this,s),this;const o=new i(...s);return a.annotation=o,a;function a(c,m,T){const R=c.hasOwnProperty(Rc)?c[Rc]:Object.defineProperty(c,Rc,{value:[]})[Rc];for(;R.length<=T;)R.push(null);return(R[T]=R[T]||[]).push(o),c}}return t&&(i.prototype=Object.create(t.prototype)),i.prototype.ngMetadataName=n,i.annotationCls=i,i})}class an{constructor(e,t){this._desc=e,this.ngMetadataName="InjectionToken",this.\u0275prov=void 0,"number"==typeof t?this.__NG_ELEMENT_ID__=t:void 0!==t&&(this.\u0275prov=Jn({token:this,providedIn:t.providedIn||"root",factory:t.factory}))}get multi(){return this}toString(){return`InjectionToken ${this._desc}`}}function mo(n,e){n.forEach(t=>Array.isArray(t)?mo(t,e):e(t))}function c_(n,e,t){e>=n.length?n.push(t):n.splice(e,0,t)}function wd(n,e){return e>=n.length-1?n.pop():n.splice(e,1)[0]}const gl={},Vg="__NG_DI_FLAG__",_d="ngTempTokenPath",MN=/\n/gm,d_="__source";let yl;function Oc(n){const e=yl;return yl=n,e}function LN(n,e=Lt.Default){if(void 0===yl)throw new xt(-203,!1);return null===yl?Sb(n,void 0,e):yl.get(n,e&Lt.Optional?null:void 0,e)}function On(n,e=Lt.Default){return(function _P(){return lg}()||LN)(Nt(n),e)}function Hg(n){const e=[];for(let t=0;t{const o=s;Yg(o,t,[],r)&&(i||(i=[]),i.push(o))}),void 0!==i&&V_(i,t),t}function V_(n,e){for(let t=0;t{e.push(s)})}}function Yg(n,e,t,r){if(!(n=Nt(n)))return!1;let i=null,s=_b(n);const o=!s&&kn(n);if(s||o){if(o&&!o.standalone)return!1;i=n}else{const c=n.ngModule;if(s=_b(c),!s)return!1;i=c}const a=r.has(i);if(o){if(a)return!1;if(r.add(i),o.dependencies){const c="function"==typeof o.dependencies?o.dependencies():o.dependencies;for(const m of c)Yg(m,e,t,r)}}else{if(!s)return!1;{if(null!=s.imports&&!a){let m;r.add(i);try{mo(s.imports,T=>{Yg(T,e,t,r)&&(m||(m=[]),m.push(T))})}finally{}void 0!==m&&V_(m,e)}if(!a){const m=Ha(i)||(()=>new i);e.push({provide:i,useFactory:m,deps:xn},{provide:B_,useValue:i,multi:!0},{provide:L_,useValue:()=>On(i),multi:!0})}const c=s.providers;null==c||a||mo(c,T=>{e.push(T)})}}return i!==n&&void 0!==n.providers}const _M=Xt({provide:String,useValue:Xt});function Zg(n){return null!==n&&"object"==typeof n&&_M in n}function Ka(n){return"function"==typeof n}const Xg=new an("Set Injector scope."),Pd={},SM={};let Jg;function Nd(){return void 0===Jg&&(Jg=new F_),Jg}class Bc{}class j_ extends Bc{constructor(e,t,r,i){super(),this.parent=t,this.source=r,this.scopes=i,this.records=new Map,this._ngOnDestroyHooks=new Set,this._onDestroyHooks=[],this._destroyed=!1,ty(e,o=>this.processProvider(o)),this.records.set(k_,Fc(void 0,this)),i.has("environment")&&this.records.set(Bc,Fc(void 0,this));const s=this.records.get(Xg);null!=s&&"string"==typeof s.value&&this.scopes.add(s.value),this.injectorDefTypes=new Set(this.get(B_.multi,xn,Lt.Self))}get destroyed(){return this._destroyed}destroy(){this.assertNotDestroyed(),this._destroyed=!0;try{for(const e of this._ngOnDestroyHooks)e.ngOnDestroy();for(const e of this._onDestroyHooks)e()}finally{this.records.clear(),this._ngOnDestroyHooks.clear(),this.injectorDefTypes.clear(),this._onDestroyHooks.length=0}}onDestroy(e){this._onDestroyHooks.push(e)}runInContext(e){this.assertNotDestroyed();const t=Oc(this),r=rs(void 0);try{return e()}finally{Oc(t),rs(r)}}get(e,t=gl,r=Lt.Default){this.assertNotDestroyed();const i=Oc(this),s=rs(void 0);try{if(!(r&Lt.SkipSelf)){let a=this.records.get(e);if(void 0===a){const c=function xM(n){return"function"==typeof n||"object"==typeof n&&n instanceof an}(e)&&Xf(e);a=c&&this.injectableDefInScope(c)?Fc(ey(e),Pd):null,this.records.set(e,a)}if(null!=a)return this.hydrate(e,a)}return(r&Lt.Self?Nd():this.parent).get(e,t=r&Lt.Optional&&t===gl?null:t)}catch(o){if("NullInjectorError"===o.name){if((o[_d]=o[_d]||[]).unshift(Dn(e)),i)throw o;return function FN(n,e,t,r){const i=n[_d];throw e[d_]&&i.unshift(e[d_]),n.message=function UN(n,e,t,r=null){n=n&&"\n"===n.charAt(0)&&"\u0275"==n.charAt(1)?n.slice(2):n;let i=Dn(e);if(Array.isArray(e))i=e.map(Dn).join(" -> ");else if("object"==typeof e){let s=[];for(let o in e)if(e.hasOwnProperty(o)){let a=e[o];s.push(o+":"+("string"==typeof a?JSON.stringify(a):Dn(a)))}i=`{${s.join(", ")}}`}return`${t}${r?"("+r+")":""}[${i}]: ${n.replace(MN,"\n ")}`}("\n"+n.message,i,t,r),n.ngTokenPath=i,n[_d]=null,n}(o,e,"R3InjectorError",this.source)}throw o}finally{rs(s),Oc(i)}}resolveInjectorInitializers(){const e=Oc(this),t=rs(void 0);try{const r=this.get(L_.multi,xn,Lt.Self);for(const i of r)i()}finally{Oc(e),rs(t)}}toString(){const e=[],t=this.records;for(const r of t.keys())e.push(Dn(r));return`R3Injector[${e.join(", ")}]`}assertNotDestroyed(){if(this._destroyed)throw new xt(205,!1)}processProvider(e){let t=Ka(e=Nt(e))?e:Nt(e&&e.provide);const r=function CM(n){return Zg(n)?Fc(void 0,n.useValue):Fc(function $_(n,e,t){let r;if(Ka(n)){const i=Nt(n);return Ha(i)||ey(i)}if(Zg(n))r=()=>Nt(n.useValue);else if(function K_(n){return!(!n||!n.useFactory)}(n))r=()=>n.useFactory(...Hg(n.deps||[]));else if(function H_(n){return!(!n||!n.useExisting)}(n))r=()=>On(Nt(n.useExisting));else{const i=Nt(n&&(n.useClass||n.provide));if(!function TM(n){return!!n.deps}(n))return Ha(i)||ey(i);r=()=>new i(...Hg(n.deps))}return r}(n),Pd)}(e);if(Ka(e)||!0!==e.multi)this.records.get(t);else{let i=this.records.get(t);i||(i=Fc(void 0,Pd,!0),i.factory=()=>Hg(i.multi),this.records.set(t,i)),t=e,i.multi.push(e)}this.records.set(t,r)}hydrate(e,t){return t.value===Pd&&(t.value=SM,t.value=t.factory()),"object"==typeof t.value&&t.value&&function AM(n){return null!==n&&"object"==typeof n&&"function"==typeof n.ngOnDestroy}(t.value)&&this._ngOnDestroyHooks.add(t.value),t.value}injectableDefInScope(e){if(!e.providedIn)return!1;const t=Nt(e.providedIn);return"string"==typeof t?"any"===t||this.scopes.has(t):this.injectorDefTypes.has(t)}}function ey(n){const e=Xf(n),t=null!==e?e.factory:Ha(n);if(null!==t)return t;if(n instanceof an)throw new xt(204,!1);if(n instanceof Function)return function IM(n){const e=n.length;if(e>0)throw function pl(n,e){const t=[];for(let r=0;rt.factory(n):()=>new n}(n);throw new xt(204,!1)}function Fc(n,e,t=!1){return{factory:n,value:e,multi:t?[]:void 0}}function RM(n){return!!n.\u0275providers}function ty(n,e){for(const t of n)Array.isArray(t)?ty(t,e):RM(t)?ty(t.\u0275providers,e):e(t)}class G_{}class MM{resolveComponentFactory(e){throw function NM(n){const e=Error(`No component factory found for ${Dn(n)}. Did you add it to @NgModule.entryComponents?`);return e.ngComponent=n,e}(e)}}let Md=(()=>{class n{}return n.NULL=new MM,n})();function OM(){return Uc(Lr(),Ve())}function Uc(n,e){return new Vc(as(n,e))}let Vc=(()=>{class n{constructor(t){this.nativeElement=t}}return n.__NG_ELEMENT_ID__=OM,n})();class W_{}let BM=(()=>{class n{}return n.\u0275prov=Jn({token:n,providedIn:"root",factory:()=>null}),n})();class ny{constructor(e){this.full=e,this.major=e.split(".")[0],this.minor=e.split(".")[1],this.patch=e.split(".").slice(2).join(".")}}const FM=new ny("14.2.0"),ry={};function cy(n){return n.ngOriginalError}class Hc{constructor(){this._console=console}handleError(e){const t=this._findOriginalError(e);this._console.error("ERROR",e),t&&this._console.error("ORIGINAL ERROR",t)}_findOriginalError(e){let t=e&&cy(e);for(;t&&cy(t);)t=cy(t);return t||null}}const uy=new Map;let YM=0;const fy="__ngContext__";function si(n,e){Ni(e)?(n[fy]=e[20],function XM(n){uy.set(n[20],n)}(e)):n[fy]=e}function Dl(n){const e=n[fy];return"number"==typeof e?function e1(n){return uy.get(n)||null}(e):e||null}function dy(n){const e=Dl(n);return e?Ni(e)?e:e.lView:null}var Mi=(()=>((Mi=Mi||{})[Mi.Important=1]="Important",Mi[Mi.DashCase=2]="DashCase",Mi))();function py(n,e){return undefined(n,e)}function Sl(n){const e=n[3];return Ss(e)?e[3]:e}function gy(n){return a1(n[13])}function yy(n){return a1(n[4])}function a1(n){for(;null!==n&&!Ss(n);)n=n[4];return n}function jc(n,e,t,r,i){if(null!=r){let s,o=!1;Ss(r)?s=r:Ni(r)&&(o=!0,r=r[0]);const a=Cr(r);0===n&&null!==t?null==i?h1(e,t,a):ja(e,t,a,i||null,!0):1===n&&null!==t?ja(e,t,a,i||null,!0):2===n?function w1(n,e,t){const r=Od(n,e);r&&function I3(n,e,t,r){n.removeChild(e,t,r)}(n,r,e,t)}(e,a,o):3===n&&e.destroyNode(a),null!=s&&function A3(n,e,t,r,i){const s=t[7];s!==Cr(t)&&jc(e,n,r,s,i);for(let a=10;a0&&(n[t-1][4]=r[4]);const s=wd(n,10+e);!function m3(n,e){Il(n,e,e[11],2,null,null),e[0]=null,e[6]=null}(r[1],r);const o=s[19];null!==o&&o.detachView(s[1]),r[3]=null,r[4]=null,r[2]&=-65}return r}function l1(n,e){if(!(128&e[2])){const t=e[11];t.destroyNode&&Il(n,e,t,3,null,null),function w3(n){let e=n[13];if(!e)return wy(n[1],n);for(;e;){let t=null;if(Ni(e))t=e[13];else{const r=e[10];r&&(t=r)}if(!t){for(;e&&!e[4]&&e!==n;)Ni(e)&&wy(e[1],e),e=e[3];null===e&&(e=n),Ni(e)&&wy(e[1],e),t=e&&e[4]}e=t}}(e)}}function wy(n,e){if(!(128&e[2])){e[2]&=-65,e[2]|=128,function S3(n,e){let t;if(null!=n&&null!=(t=n.destroyHooks))for(let r=0;r=0?r[i=m]():r[i=-m].unsubscribe(),s+=2}else{const o=r[i=t[s+1]];t[s].call(o)}if(null!==r){for(let s=i+1;ss?"":i[R+1].toLowerCase();const U=8&r?k:null;if(U&&-1!==D1(U,m,0)||2&r&&m!==k){if(Cs(r))return!1;o=!0}}}}else{if(!o&&!Cs(r)&&!Cs(c))return!1;if(o&&Cs(c))continue;o=!1,r=c|1&r}}return Cs(r)||o}function Cs(n){return 0==(1&n)}function M3(n,e,t,r){if(null===e)return-1;let i=0;if(r||!t){let s=!1;for(;i-1)for(t++;t0?'="'+a+'"':"")+"]"}else 8&r?i+="."+o:4&r&&(i+=" "+o);else""!==i&&!Cs(o)&&(e+=T1(s,i),i=""),r=o,s=s||!Cs(r);t++}return""!==i&&(e+=T1(s,i)),e}const Ht={};function Cl(n){A1(pn(),Ve(),_i()+n,!1)}function A1(n,e,t,r){if(!r)if(3==(3&e[2])){const s=n.preOrderCheckHooks;null!==s&&dd(e,s,t)}else{const s=n.preOrderHooks;null!==s&&hd(e,s,0,t)}ta(t)}function N1(n,e=null,t=null,r){const i=M1(n,e,t,r);return i.resolveInjectorInitializers(),i}function M1(n,e=null,t=null,r,i=new Set){const s=[t||xn,bM(n)];return r=r||("object"==typeof n?void 0:Dn(n)),new j_(s,e||Nd(),r||null,i)}let $a=(()=>{class n{static create(t,r){if(Array.isArray(t))return N1({name:""},r,t,"");{const i=t.name??"";return N1({name:i},t.parent,t.providers,i)}}}return n.THROW_IF_NOT_FOUND=gl,n.NULL=new F_,n.\u0275prov=Jn({token:n,providedIn:"any",factory:()=>On(k_)}),n.__NG_ELEMENT_ID__=-1,n})();function qt(n,e=Lt.Default){const t=Ve();return null===t?On(n,e):n_(Lr(),t,Nt(n),e)}function Y1(n,e){const t=n.contentQueries;if(null!==t)for(let r=0;r22&&A1(n,e,22,!1),t(r,i)}finally{ta(s)}}function Vy(n,e,t){!Bb()||(function TO(n,e,t,r){const i=t.directiveStart,s=t.directiveEnd;n.firstCreatePass||ll(t,e),si(r,e);const o=t.initialInputs;for(let a=i;a0;){const t=n[--e];if("number"==typeof t&&t<0)return t}return 0})(a)!=c&&a.push(c),a.push(r,i,o)}}function sD(n,e){null!==n.hostBindings&&n.hostBindings(1,e)}function oD(n,e){e.flags|=2,(n.components||(n.components=[])).push(e.index)}function PO(n,e,t){if(t){if(e.exportAs)for(let r=0;r0&&Gy(t)}}function Gy(n){for(let r=gy(n);null!==r;r=yy(r))for(let i=10;i0&&Gy(s)}const t=n[1].components;if(null!==t)for(let r=0;r0&&Gy(i)}}function FO(n,e){const t=Gi(e,n),r=t[1];(function UO(n,e){for(let t=e.length;t-1&&(Ey(e,r),wd(t,r))}this._attachedToViewContainer=!1}l1(this._lView[1],this._lView)}onDestroy(e){!function eD(n,e,t,r){const i=fD(e);null===t?i.push(r):(i.push(t),n.firstCreatePass&&dD(n).push(r,i.length-1))}(this._lView[1],this._lView,null,e)}markForCheck(){zy(this._cdRefInjectingView||this._lView)}detach(){this._lView[2]&=-65}reattach(){this._lView[2]|=64}detectChanges(){!function Wy(n,e,t){const r=e[10];r.begin&&r.begin();try{Tl(n,e,n.template,t)}catch(i){throw pD(e,i),i}finally{r.end&&r.end()}}(this._lView[1],this._lView,this.context)}checkNoChanges(){}attachToViewContainerRef(){if(this._appRef)throw new xt(902,!1);this._attachedToViewContainer=!0}detachFromAppRef(){this._appRef=null,function E3(n,e){Il(n,e,e[11],2,null,null)}(this._lView[1],this._lView)}attachToAppRef(e){if(this._attachedToViewContainer)throw new xt(902,!1);this._appRef=e}}class HO extends Al{constructor(e){super(e),this._view=e}detectChanges(){!function lD(n){!function VO(n){for(let e=0;e0&&Sy(m,R,Re.join(" "))}if(he=wg(Q,22),void 0!==t){const ue=he.projection=[];for(let Re=0;Rea(Cr(Le[r.index])):r.index;let Re=null;if(!a&&c&&(Re=function pL(n,e,t,r){const i=n.cleanup;if(null!=i)for(let s=0;sc?a[c]:null}"string"==typeof o&&(s+=2)}return null}(n,e,i,r.index)),null!==Re)(Re.__ngLastListenerFn__||Re).__ngNextListenerFn__=s,Re.__ngLastListenerFn__=s,U=!1;else{s=OD(r,e,R,s,!1);const Le=t.listen(he,i,s);k.push(s,Le),T&&T.push(i,ue,Ae,Ae+1)}}else s=OD(r,e,R,s,!1);const Q=r.outputs;let X;if(U&&null!==Q&&(X=Q[i])){const ae=X.length;if(ae)for(let he=0;het()),this.destroyCbs=null}onDestroy(e){this.destroyCbs.push(e)}}class y0 extends class n4{}{constructor(e){super(),this.moduleType=e}create(e){return new ZS(this.moduleType,e)}}function v0(n){return e=>{setTimeout(n,void 0,e)}}const Do=class M4 extends Sr{constructor(e=!1){super(),this.__isAsync=e}emit(e){super.next(e)}subscribe(e,t,r){let i=e,s=t||(()=>null),o=r;if(e&&"object"==typeof e){const c=e;i=c.next?.bind(c),s=c.error?.bind(c),o=c.complete?.bind(c)}this.__isAsync&&(s=v0(s),i&&(i=v0(i)),o&&(o=v0(o)));const a=super.subscribe({next:i,error:s,complete:o});return e instanceof F&&e.add(a),a}};let So=(()=>{class n{}return n.__NG_ELEMENT_ID__=B4,n})();const L4=So,k4=class extends L4{constructor(e,t,r){super(),this._declarationLView=e,this._declarationTContainer=t,this.elementRef=r}createEmbeddedView(e,t){const r=this._declarationTContainer.tViews,i=Hd(this._declarationLView,r,e,16,null,r.declTNode,null,null,null,null,t||null);i[17]=this._declarationLView[this._declarationTContainer.index];const o=this._declarationLView[19];return null!==o&&(i[19]=o.createEmbeddedView(r)),Kd(r,i,e),new Al(i)}};function B4(){return function th(n,e){return 4&n.type?new k4(e,n,Uc(n,e)):null}(Lr(),Ve())}let eo=(()=>{class n{}return n.__NG_ELEMENT_ID__=F4,n})();function F4(){return function dI(n,e){let t;const r=e[n.index];if(Ss(r))t=r;else{let i;if(8&n.type)i=Cr(r);else{const s=e[11];i=s.createComment("");const o=as(n,e);ja(s,Od(s,o),i,function C3(n,e){return n.nextSibling(e)}(s,o),!1)}e[n.index]=t=uD(r,e,i,n),jd(e,t)}return new lI(t,n,e)}(Lr(),Ve())}const U4=eo,lI=class extends U4{constructor(e,t,r){super(),this._lContainer=e,this._hostTNode=t,this._hostLView=r}get element(){return Uc(this._hostTNode,this._hostLView)}get injector(){return new Ac(this._hostTNode,this._hostLView)}get parentInjector(){const e=md(this._hostTNode,this._hostLView);if(Zb(e)){const t=Tc(e,this._hostLView),r=Cc(e);return new Ac(t[1].data[r+8],t)}return new Ac(null,this._hostLView)}clear(){for(;this.length>0;)this.remove(this.length-1)}get(e){const t=fI(this._lContainer);return null!==t&&t[e]||null}get length(){return this._lContainer.length-10}createEmbeddedView(e,t,r){let i,s;"number"==typeof r?i=r:null!=r&&(i=r.index,s=r.injector);const o=e.createEmbeddedView(t||{},s);return this.insert(o,i),o}createComponent(e,t,r,i,s){const o=e&&!function hl(n){return"function"==typeof n}(e);let a;if(o)a=t;else{const R=t||{};a=R.index,r=R.injector,i=R.projectableNodes,s=R.environmentInjector||R.ngModuleRef}const c=o?e:new xl(kn(e)),m=r||this.parentInjector;if(!s&&null==c.ngModule){const k=(o?m:this.parentInjector).get(Bc,null);k&&(s=k)}const T=c.create(m,i,void 0,s);return this.insert(T.hostView,a),T}insert(e,t){const r=e._lView,i=r[1];if(function HP(n){return Ss(n[3])}(r)){const T=this.indexOf(e);if(-1!==T)this.detach(T);else{const R=r[3],k=new lI(R,R[6],R[3]);k.detach(k.indexOf(e))}}const s=this._adjustIndex(t),o=this._lContainer;!function b3(n,e,t,r){const i=10+r,s=t.length;r>0&&(t[i-1][4]=e),r{class n{constructor(t){this.appInits=t,this.resolve=rh,this.reject=rh,this.initialized=!1,this.done=!1,this.donePromise=new Promise((r,i)=>{this.resolve=r,this.reject=i})}runInitializers(){if(this.initialized)return;const t=[],r=()=>{this.done=!0,this.resolve()};if(this.appInits)for(let i=0;i{s.subscribe({complete:a,error:c})});t.push(o)}}Promise.all(t).then(()=>{r()}).catch(i=>{this.reject(i)}),0===t.length&&r(),this.initialized=!0}}return n.\u0275fac=function(t){return new(t||n)(On(kI,8))},n.\u0275prov=Jn({token:n,factory:n.\u0275fac,providedIn:"root"}),n})();const Vl=new an("AppId",{providedIn:"root",factory:function BI(){return`${R0()}${R0()}${R0()}`}});function R0(){return String.fromCharCode(97+Math.floor(25*Math.random()))}const FI=new an("Platform Initializer"),UI=new an("Platform ID",{providedIn:"platform",factory:()=>"unknown"}),vk=new an("appBootstrapListener"),Io=new an("LocaleId",{providedIn:"root",factory:()=>function kN(n,e=Lt.Default){return"number"!=typeof e&&(e=0|(e.optional&&8)|(e.host&&1)|(e.self&&2)|(e.skipSelf&&4)),On(n,e)}(Io,Lt.Optional|Lt.SkipSelf)||function Ek(){return typeof $localize<"u"&&$localize.locale||su}()}),Sk=(()=>Promise.resolve(0))();function P0(n){typeof Zone>"u"?Sk.then(()=>{n&&n.apply(null,null)}):Zone.current.scheduleMicroTask("scheduleMicrotask",n)}class ai{constructor({enableLongStackTrace:e=!1,shouldCoalesceEventChangeDetection:t=!1,shouldCoalesceRunChangeDetection:r=!1}){if(this.hasPendingMacrotasks=!1,this.hasPendingMicrotasks=!1,this.isStable=!0,this.onUnstable=new Do(!1),this.onMicrotaskEmpty=new Do(!1),this.onStable=new Do(!1),this.onError=new Do(!1),typeof Zone>"u")throw new xt(908,!1);Zone.assertZonePatched();const i=this;if(i._nesting=0,i._outer=i._inner=Zone.current,Zone.AsyncStackTaggingZoneSpec){const s=Zone.AsyncStackTaggingZoneSpec;i._inner=i._inner.fork(new s("Angular"))}Zone.TaskTrackingZoneSpec&&(i._inner=i._inner.fork(new Zone.TaskTrackingZoneSpec)),e&&Zone.longStackTraceZoneSpec&&(i._inner=i._inner.fork(Zone.longStackTraceZoneSpec)),i.shouldCoalesceEventChangeDetection=!r&&t,i.shouldCoalesceRunChangeDetection=r,i.lastRequestAnimationFrameId=-1,i.nativeRequestAnimationFrame=function Ik(){let n=jn.requestAnimationFrame,e=jn.cancelAnimationFrame;if(typeof Zone<"u"&&n&&e){const t=n[Zone.__symbol__("OriginalDelegate")];t&&(n=t);const r=e[Zone.__symbol__("OriginalDelegate")];r&&(e=r)}return{nativeRequestAnimationFrame:n,nativeCancelAnimationFrame:e}}().nativeRequestAnimationFrame,function Ak(n){const e=()=>{!function Tk(n){n.isCheckStableRunning||-1!==n.lastRequestAnimationFrameId||(n.lastRequestAnimationFrameId=n.nativeRequestAnimationFrame.call(jn,()=>{n.fakeTopEventTask||(n.fakeTopEventTask=Zone.root.scheduleEventTask("fakeTopEventTask",()=>{n.lastRequestAnimationFrameId=-1,M0(n),n.isCheckStableRunning=!0,N0(n),n.isCheckStableRunning=!1},void 0,()=>{},()=>{})),n.fakeTopEventTask.invoke()}),M0(n))}(n)};n._inner=n._inner.fork({name:"angular",properties:{isAngularZone:!0},onInvokeTask:(t,r,i,s,o,a)=>{try{return KI(n),t.invokeTask(i,s,o,a)}finally{(n.shouldCoalesceEventChangeDetection&&"eventTask"===s.type||n.shouldCoalesceRunChangeDetection)&&e(),jI(n)}},onInvoke:(t,r,i,s,o,a,c)=>{try{return KI(n),t.invoke(i,s,o,a,c)}finally{n.shouldCoalesceRunChangeDetection&&e(),jI(n)}},onHasTask:(t,r,i,s)=>{t.hasTask(i,s),r===i&&("microTask"==s.change?(n._hasPendingMicrotasks=s.microTask,M0(n),N0(n)):"macroTask"==s.change&&(n.hasPendingMacrotasks=s.macroTask))},onHandleError:(t,r,i,s)=>(t.handleError(i,s),n.runOutsideAngular(()=>n.onError.emit(s)),!1)})}(i)}static isInAngularZone(){return typeof Zone<"u"&&!0===Zone.current.get("isAngularZone")}static assertInAngularZone(){if(!ai.isInAngularZone())throw new xt(909,!1)}static assertNotInAngularZone(){if(ai.isInAngularZone())throw new xt(909,!1)}run(e,t,r){return this._inner.run(e,t,r)}runTask(e,t,r,i){const s=this._inner,o=s.scheduleEventTask("NgZoneEvent: "+i,e,Ck,rh,rh);try{return s.runTask(o,t,r)}finally{s.cancelTask(o)}}runGuarded(e,t,r){return this._inner.runGuarded(e,t,r)}runOutsideAngular(e){return this._outer.run(e)}}const Ck={};function N0(n){if(0==n._nesting&&!n.hasPendingMicrotasks&&!n.isStable)try{n._nesting++,n.onMicrotaskEmpty.emit(null)}finally{if(n._nesting--,!n.hasPendingMicrotasks)try{n.runOutsideAngular(()=>n.onStable.emit(null))}finally{n.isStable=!0}}}function M0(n){n.hasPendingMicrotasks=!!(n._hasPendingMicrotasks||(n.shouldCoalesceEventChangeDetection||n.shouldCoalesceRunChangeDetection)&&-1!==n.lastRequestAnimationFrameId)}function KI(n){n._nesting++,n.isStable&&(n.isStable=!1,n.onUnstable.emit(null))}function jI(n){n._nesting--,N0(n)}class xk{constructor(){this.hasPendingMicrotasks=!1,this.hasPendingMacrotasks=!1,this.isStable=!0,this.onUnstable=new Do,this.onMicrotaskEmpty=new Do,this.onStable=new Do,this.onError=new Do}run(e,t,r){return e.apply(t,r)}runGuarded(e,t,r){return e.apply(t,r)}runOutsideAngular(e){return e()}runTask(e,t,r,i){return e.apply(t,r)}}const $I=new an(""),sh=new an("");let k0,O0=(()=>{class n{constructor(t,r,i){this._ngZone=t,this.registry=r,this._pendingCount=0,this._isZoneStable=!0,this._didWork=!1,this._callbacks=[],this.taskTrackingZone=null,k0||(function Rk(n){k0=n}(i),i.addToWindow(r)),this._watchAngularEvents(),t.run(()=>{this.taskTrackingZone=typeof Zone>"u"?null:Zone.current.get("TaskTrackingZone")})}_watchAngularEvents(){this._ngZone.onUnstable.subscribe({next:()=>{this._didWork=!0,this._isZoneStable=!1}}),this._ngZone.runOutsideAngular(()=>{this._ngZone.onStable.subscribe({next:()=>{ai.assertNotInAngularZone(),P0(()=>{this._isZoneStable=!0,this._runCallbacksIfReady()})}})})}increasePendingRequestCount(){return this._pendingCount+=1,this._didWork=!0,this._pendingCount}decreasePendingRequestCount(){if(this._pendingCount-=1,this._pendingCount<0)throw new Error("pending async requests below zero");return this._runCallbacksIfReady(),this._pendingCount}isStable(){return this._isZoneStable&&0===this._pendingCount&&!this._ngZone.hasPendingMacrotasks}_runCallbacksIfReady(){if(this.isStable())P0(()=>{for(;0!==this._callbacks.length;){let t=this._callbacks.pop();clearTimeout(t.timeoutId),t.doneCb(this._didWork)}this._didWork=!1});else{let t=this.getPendingTasks();this._callbacks=this._callbacks.filter(r=>!r.updateCb||!r.updateCb(t)||(clearTimeout(r.timeoutId),!1)),this._didWork=!0}}getPendingTasks(){return this.taskTrackingZone?this.taskTrackingZone.macroTasks.map(t=>({source:t.source,creationLocation:t.creationLocation,data:t.data})):[]}addCallback(t,r,i){let s=-1;r&&r>0&&(s=setTimeout(()=>{this._callbacks=this._callbacks.filter(o=>o.timeoutId!==s),t(this._didWork,this.getPendingTasks())},r)),this._callbacks.push({doneCb:t,timeoutId:s,updateCb:i})}whenStable(t,r,i){if(i&&!this.taskTrackingZone)throw new Error('Task tracking zone is required when passing an update callback to whenStable(). Is "zone.js/plugins/task-tracking" loaded?');this.addCallback(t,r,i),this._runCallbacksIfReady()}getPendingRequestCount(){return this._pendingCount}registerApplication(t){this.registry.registerApplication(t,this)}unregisterApplication(t){this.registry.unregisterApplication(t)}findProviders(t,r,i){return[]}}return n.\u0275fac=function(t){return new(t||n)(On(ai),On(L0),On(sh))},n.\u0275prov=Jn({token:n,factory:n.\u0275fac}),n})(),L0=(()=>{class n{constructor(){this._applications=new Map}registerApplication(t,r){this._applications.set(t,r)}unregisterApplication(t){this._applications.delete(t)}unregisterAllApplications(){this._applications.clear()}getTestability(t){return this._applications.get(t)||null}getAllTestabilities(){return Array.from(this._applications.values())}getAllRootElements(){return Array.from(this._applications.keys())}findTestabilityInTree(t,r=!0){return k0?.findTestabilityInTree(this,t,r)??null}}return n.\u0275fac=function(t){return new(t||n)},n.\u0275prov=Jn({token:n,factory:n.\u0275fac,providedIn:"platform"}),n})(),oa=null;const GI=new an("AllowMultipleToken"),B0=new an("PlatformDestroyListeners");function WI(n,e,t=[]){const r=`Platform: ${e}`,i=new an(r);return(s=[])=>{let o=F0();if(!o||o.injector.get(GI,!1)){const a=[...t,...s,{provide:i,useValue:!0}];n?n(a):function Mk(n){if(oa&&!oa.get(GI,!1))throw new xt(400,!1);oa=n;const e=n.get(QI);(function zI(n){const e=n.get(FI,null);e&&e.forEach(t=>t())})(n)}(function qI(n=[],e){return $a.create({name:e,providers:[{provide:Xg,useValue:"platform"},{provide:B0,useValue:new Set([()=>oa=null])},...n]})}(a,r))}return function Lk(n){const e=F0();if(!e)throw new xt(401,!1);return e}()}}function F0(){return oa?.get(QI)??null}let QI=(()=>{class n{constructor(t){this._injector=t,this._modules=[],this._destroyListeners=[],this._destroyed=!1}bootstrapModuleFactory(t,r){const i=function ZI(n,e){let t;return t="noop"===n?new xk:("zone.js"===n?void 0:n)||new ai(e),t}(r?.ngZone,function YI(n){return{enableLongStackTrace:!1,shouldCoalesceEventChangeDetection:!(!n||!n.ngZoneEventCoalescing)||!1,shouldCoalesceRunChangeDetection:!(!n||!n.ngZoneRunCoalescing)||!1}}(r)),s=[{provide:ai,useValue:i}];return i.run(()=>{const o=$a.create({providers:s,parent:this.injector,name:t.moduleType.name}),a=t.create(o),c=a.injector.get(Hc,null);if(!c)throw new xt(402,!1);return i.runOutsideAngular(()=>{const m=i.onError.subscribe({next:T=>{c.handleError(T)}});a.onDestroy(()=>{oh(this._modules,a),m.unsubscribe()})}),function XI(n,e,t){try{const r=t();return r0(r)?r.catch(i=>{throw e.runOutsideAngular(()=>n.handleError(i)),i}):r}catch(r){throw e.runOutsideAngular(()=>n.handleError(r)),r}}(c,i,()=>{const m=a.injector.get(ih);return m.runInitializers(),m.donePromise.then(()=>(function CS(n){Ki(n,"Expected localeId to be defined"),"string"==typeof n&&(IS=n.toLowerCase().replace(/_/g,"-"))}(a.injector.get(Io,su)||su),this._moduleDoBootstrap(a),a))})})}bootstrapModule(t,r=[]){const i=JI({},r);return function Pk(n,e,t){const r=new y0(t);return Promise.resolve(r)}(0,0,t).then(s=>this.bootstrapModuleFactory(s,i))}_moduleDoBootstrap(t){const r=t.injector.get(U0);if(t._bootstrapComponents.length>0)t._bootstrapComponents.forEach(i=>r.bootstrap(i));else{if(!t.instance.ngDoBootstrap)throw new xt(403,!1);t.instance.ngDoBootstrap(r)}this._modules.push(t)}onDestroy(t){this._destroyListeners.push(t)}get injector(){return this._injector}destroy(){if(this._destroyed)throw new xt(404,!1);this._modules.slice().forEach(r=>r.destroy()),this._destroyListeners.forEach(r=>r());const t=this._injector.get(B0,null);t&&(t.forEach(r=>r()),t.clear()),this._destroyed=!0}get destroyed(){return this._destroyed}}return n.\u0275fac=function(t){return new(t||n)(On($a))},n.\u0275prov=Jn({token:n,factory:n.\u0275fac,providedIn:"platform"}),n})();function JI(n,e){return Array.isArray(e)?e.reduce(JI,n):{...n,...e}}let U0=(()=>{class n{constructor(t,r,i){this._zone=t,this._injector=r,this._exceptionHandler=i,this._bootstrapListeners=[],this._views=[],this._runningTick=!1,this._stable=!0,this._destroyed=!1,this._destroyListeners=[],this.componentTypes=[],this.components=[],this._onMicrotaskEmptySubscription=this._zone.onMicrotaskEmpty.subscribe({next:()=>{this._zone.run(()=>{this.tick()})}});const s=new Xe(a=>{this._stable=this._zone.isStable&&!this._zone.hasPendingMacrotasks&&!this._zone.hasPendingMicrotasks,this._zone.runOutsideAngular(()=>{a.next(this._stable),a.complete()})}),o=new Xe(a=>{let c;this._zone.runOutsideAngular(()=>{c=this._zone.onStable.subscribe(()=>{ai.assertNotInAngularZone(),P0(()=>{!this._stable&&!this._zone.hasPendingMacrotasks&&!this._zone.hasPendingMicrotasks&&(this._stable=!0,a.next(!0))})})});const m=this._zone.onUnstable.subscribe(()=>{ai.assertInAngularZone(),this._stable&&(this._stable=!1,this._zone.runOutsideAngular(()=>{a.next(!1)}))});return()=>{c.unsubscribe(),m.unsubscribe()}});this.isStable=mi(s,o.pipe(function bs(n={}){const{connector:e=(()=>new Sr),resetOnError:t=!0,resetOnComplete:r=!0,resetOnRefCountZero:i=!0}=n;return s=>{let o,a,c,m=0,T=!1,R=!1;const k=()=>{a?.unsubscribe(),a=void 0},U=()=>{k(),o=c=void 0,T=R=!1},Q=()=>{const X=o;U(),X?.unsubscribe()};return fe((X,ae)=>{m++,!R&&!T&&k();const he=c=c??e();ae.add(()=>{m--,0===m&&!R&&!T&&(a=Xo(Q,i))}),he.subscribe(ae),!o&&m>0&&(o=new we({next:Ae=>he.next(Ae),error:Ae=>{R=!0,k(),a=Xo(U,t,Ae),he.error(Ae)},complete:()=>{T=!0,k(),a=Xo(U,r),he.complete()}}),mn(X).subscribe(o))})(s)}}()))}get destroyed(){return this._destroyed}get injector(){return this._injector}bootstrap(t,r){const i=t instanceof G_;if(!this._injector.get(ih).done)throw!i&&function rl(n){const e=kn(n)||Ei(n)||wi(n);return null!==e&&e.standalone}(t),new xt(405,false);let o;o=i?t:this._injector.get(Md).resolveComponentFactory(t),this.componentTypes.push(o.componentType);const a=function Nk(n){return n.isBoundToModule}(o)?void 0:this._injector.get(au),m=o.create($a.NULL,[],r||o.selector,a),T=m.location.nativeElement,R=m.injector.get($I,null);return R?.registerApplication(T),m.onDestroy(()=>{this.detachView(m.hostView),oh(this.components,m),R?.unregisterApplication(T)}),this._loadComponent(m),m}tick(){if(this._runningTick)throw new xt(101,!1);try{this._runningTick=!0;for(let t of this._views)t.detectChanges()}catch(t){this._zone.runOutsideAngular(()=>this._exceptionHandler.handleError(t))}finally{this._runningTick=!1}}attachView(t){const r=t;this._views.push(r),r.attachToAppRef(this)}detachView(t){const r=t;oh(this._views,r),r.detachFromAppRef()}_loadComponent(t){this.attachView(t.hostView),this.tick(),this.components.push(t),this._injector.get(vk,[]).concat(this._bootstrapListeners).forEach(i=>i(t))}ngOnDestroy(){if(!this._destroyed)try{this._destroyListeners.forEach(t=>t()),this._views.slice().forEach(t=>t.destroy()),this._onMicrotaskEmptySubscription.unsubscribe()}finally{this._destroyed=!0,this._views=[],this._bootstrapListeners=[],this._destroyListeners=[]}}onDestroy(t){return this._destroyListeners.push(t),()=>oh(this._destroyListeners,t)}destroy(){if(this._destroyed)throw new xt(406,!1);const t=this._injector;t.destroy&&!t.destroyed&&t.destroy()}get viewCount(){return this._views.length}warnIfDestroyed(){}}return n.\u0275fac=function(t){return new(t||n)(On(ai),On(Bc),On(Hc))},n.\u0275prov=Jn({token:n,factory:n.\u0275fac,providedIn:"root"}),n})();function oh(n,e){const t=n.indexOf(e);t>-1&&n.splice(t,1)}let tC=!0;class oC{constructor(){}supports(e){return Rl(e)}create(e){return new zk(e)}}const Gk=(n,e)=>e;class zk{constructor(e){this.length=0,this._linkedRecords=null,this._unlinkedRecords=null,this._previousItHead=null,this._itHead=null,this._itTail=null,this._additionsHead=null,this._additionsTail=null,this._movesHead=null,this._movesTail=null,this._removalsHead=null,this._removalsTail=null,this._identityChangesHead=null,this._identityChangesTail=null,this._trackByFn=e||Gk}forEachItem(e){let t;for(t=this._itHead;null!==t;t=t._next)e(t)}forEachOperation(e){let t=this._itHead,r=this._removalsHead,i=0,s=null;for(;t||r;){const o=!r||t&&t.currentIndex{o=this._trackByFn(i,a),null!==t&&Object.is(t.trackById,o)?(r&&(t=this._verifyReinsertion(t,a,o,i)),Object.is(t.item,a)||this._addIdentityChange(t,a)):(t=this._mismatch(t,a,o,i),r=!0),t=t._next,i++}),this.length=i;return this._truncate(t),this.collection=e,this.isDirty}get isDirty(){return null!==this._additionsHead||null!==this._movesHead||null!==this._removalsHead||null!==this._identityChangesHead}_reset(){if(this.isDirty){let e;for(e=this._previousItHead=this._itHead;null!==e;e=e._next)e._nextPrevious=e._next;for(e=this._additionsHead;null!==e;e=e._nextAdded)e.previousIndex=e.currentIndex;for(this._additionsHead=this._additionsTail=null,e=this._movesHead;null!==e;e=e._nextMoved)e.previousIndex=e.currentIndex;this._movesHead=this._movesTail=null,this._removalsHead=this._removalsTail=null,this._identityChangesHead=this._identityChangesTail=null}}_mismatch(e,t,r,i){let s;return null===e?s=this._itTail:(s=e._prev,this._remove(e)),null!==(e=null===this._unlinkedRecords?null:this._unlinkedRecords.get(r,null))?(Object.is(e.item,t)||this._addIdentityChange(e,t),this._reinsertAfter(e,s,i)):null!==(e=null===this._linkedRecords?null:this._linkedRecords.get(r,i))?(Object.is(e.item,t)||this._addIdentityChange(e,t),this._moveAfter(e,s,i)):e=this._addAfter(new Wk(t,r),s,i),e}_verifyReinsertion(e,t,r,i){let s=null===this._unlinkedRecords?null:this._unlinkedRecords.get(r,null);return null!==s?e=this._reinsertAfter(s,e._prev,i):e.currentIndex!=i&&(e.currentIndex=i,this._addToMoves(e,i)),e}_truncate(e){for(;null!==e;){const t=e._next;this._addToRemovals(this._unlink(e)),e=t}null!==this._unlinkedRecords&&this._unlinkedRecords.clear(),null!==this._additionsTail&&(this._additionsTail._nextAdded=null),null!==this._movesTail&&(this._movesTail._nextMoved=null),null!==this._itTail&&(this._itTail._next=null),null!==this._removalsTail&&(this._removalsTail._nextRemoved=null),null!==this._identityChangesTail&&(this._identityChangesTail._nextIdentityChange=null)}_reinsertAfter(e,t,r){null!==this._unlinkedRecords&&this._unlinkedRecords.remove(e);const i=e._prevRemoved,s=e._nextRemoved;return null===i?this._removalsHead=s:i._nextRemoved=s,null===s?this._removalsTail=i:s._prevRemoved=i,this._insertAfter(e,t,r),this._addToMoves(e,r),e}_moveAfter(e,t,r){return this._unlink(e),this._insertAfter(e,t,r),this._addToMoves(e,r),e}_addAfter(e,t,r){return this._insertAfter(e,t,r),this._additionsTail=null===this._additionsTail?this._additionsHead=e:this._additionsTail._nextAdded=e,e}_insertAfter(e,t,r){const i=null===t?this._itHead:t._next;return e._next=i,e._prev=t,null===i?this._itTail=e:i._prev=e,null===t?this._itHead=e:t._next=e,null===this._linkedRecords&&(this._linkedRecords=new aC),this._linkedRecords.put(e),e.currentIndex=r,e}_remove(e){return this._addToRemovals(this._unlink(e))}_unlink(e){null!==this._linkedRecords&&this._linkedRecords.remove(e);const t=e._prev,r=e._next;return null===t?this._itHead=r:t._next=r,null===r?this._itTail=t:r._prev=t,e}_addToMoves(e,t){return e.previousIndex===t||(this._movesTail=null===this._movesTail?this._movesHead=e:this._movesTail._nextMoved=e),e}_addToRemovals(e){return null===this._unlinkedRecords&&(this._unlinkedRecords=new aC),this._unlinkedRecords.put(e),e.currentIndex=null,e._nextRemoved=null,null===this._removalsTail?(this._removalsTail=this._removalsHead=e,e._prevRemoved=null):(e._prevRemoved=this._removalsTail,this._removalsTail=this._removalsTail._nextRemoved=e),e}_addIdentityChange(e,t){return e.item=t,this._identityChangesTail=null===this._identityChangesTail?this._identityChangesHead=e:this._identityChangesTail._nextIdentityChange=e,e}}class Wk{constructor(e,t){this.item=e,this.trackById=t,this.currentIndex=null,this.previousIndex=null,this._nextPrevious=null,this._prev=null,this._next=null,this._prevDup=null,this._nextDup=null,this._prevRemoved=null,this._nextRemoved=null,this._nextAdded=null,this._nextMoved=null,this._nextIdentityChange=null}}class qk{constructor(){this._head=null,this._tail=null}add(e){null===this._head?(this._head=this._tail=e,e._nextDup=null,e._prevDup=null):(this._tail._nextDup=e,e._prevDup=this._tail,e._nextDup=null,this._tail=e)}get(e,t){let r;for(r=this._head;null!==r;r=r._nextDup)if((null===t||t<=r.currentIndex)&&Object.is(r.trackById,e))return r;return null}remove(e){const t=e._prevDup,r=e._nextDup;return null===t?this._head=r:t._nextDup=r,null===r?this._tail=t:r._prevDup=t,null===this._head}}class aC{constructor(){this.map=new Map}put(e){const t=e.trackById;let r=this.map.get(t);r||(r=new qk,this.map.set(t,r)),r.add(e)}get(e,t){const i=this.map.get(e);return i?i.get(e,t):null}remove(e){const t=e.trackById;return this.map.get(t).remove(e)&&this.map.delete(t),e}get isEmpty(){return 0===this.map.size}clear(){this.map.clear()}}function cC(n,e,t){const r=n.previousIndex;if(null===r)return r;let i=0;return t&&r{class n{constructor(t){this.factories=t}static create(t,r){if(null!=r){const i=r.factories.slice();t=t.concat(i)}return new n(t)}static extend(t){return{provide:n,useFactory:r=>n.create(t,r||lC()),deps:[[n,new Sd,new Dd]]}}find(t){const r=this.factories.find(i=>i.supports(t));if(null!=r)return r;throw new xt(901,!1)}}return n.\u0275prov=Jn({token:n,providedIn:"root",factory:lC}),n})();const Jk=WI(null,"core",[]);let e6=(()=>{class n{constructor(t){}}return n.\u0275fac=function(t){return new(t||n)(On(U0))},n.\u0275mod=nl({type:n}),n.\u0275inj=vc({}),n})(),lh=null;function Kl(){return lh}const To=new an("DocumentToken");class G6{constructor(e,t,r,i){this.$implicit=e,this.ngForOf=t,this.index=r,this.count=i}get first(){return 0===this.index}get last(){return this.index===this.count-1}get even(){return this.index%2==0}get odd(){return!this.even}}let DC=(()=>{class n{constructor(t,r,i){this._viewContainer=t,this._template=r,this._differs=i,this._ngForOf=null,this._ngForOfDirty=!0,this._differ=null}set ngForOf(t){this._ngForOf=t,this._ngForOfDirty=!0}set ngForTrackBy(t){this._trackByFn=t}get ngForTrackBy(){return this._trackByFn}set ngForTemplate(t){t&&(this._template=t)}ngDoCheck(){if(this._ngForOfDirty){this._ngForOfDirty=!1;const t=this._ngForOf;!this._differ&&t&&(this._differ=this._differs.find(t).create(this.ngForTrackBy))}if(this._differ){const t=this._differ.diff(this._ngForOf);t&&this._applyChanges(t)}}_applyChanges(t){const r=this._viewContainer;t.forEachOperation((i,s,o)=>{if(null==i.previousIndex)r.createEmbeddedView(this._template,new G6(i.item,this._ngForOf,-1,-1),null===o?void 0:o);else if(null==o)r.remove(null===s?void 0:s);else if(null!==s){const a=r.get(s);r.move(a,o),SC(a,i)}});for(let i=0,s=r.length;i{SC(r.get(i.currentIndex),i)})}static ngTemplateContextGuard(t,r){return!0}}return n.\u0275fac=function(t){return new(t||n)(qt(eo),qt(So),qt(uh))},n.\u0275dir=is({type:n,selectors:[["","ngFor","","ngForOf",""]],inputs:{ngForOf:"ngForOf",ngForTrackBy:"ngForTrackBy",ngForTemplate:"ngForTemplate"},standalone:!0}),n})();function SC(n,e){n.context.$implicit=e.item}let bB=(()=>{class n{}return n.\u0275fac=function(t){return new(t||n)},n.\u0275mod=nl({type:n}),n.\u0275inj=vc({}),n})();class sm extends class $B extends class r6{}{constructor(){super(...arguments),this.supportsDOMEvents=!0}}{static makeCurrent(){!function n6(n){lh||(lh=n)}(new sm)}onAndCancel(e,t,r){return e.addEventListener(t,r,!1),()=>{e.removeEventListener(t,r,!1)}}dispatchEvent(e,t){e.dispatchEvent(t)}remove(e){e.parentNode&&e.parentNode.removeChild(e)}createElement(e,t){return(t=t||this.getDefaultDocument()).createElement(e)}createHtmlDocument(){return document.implementation.createHTMLDocument("fakeTitle")}getDefaultDocument(){return document}isElementNode(e){return e.nodeType===Node.ELEMENT_NODE}isShadowRoot(e){return e instanceof DocumentFragment}getGlobalEventTarget(e,t){return"window"===t?window:"document"===t?e:"body"===t?e.body:null}getBaseHref(e){const t=function GB(){return zl=zl||document.querySelector("base"),zl?zl.getAttribute("href"):null}();return null==t?null:function zB(n){bh=bh||document.createElement("a"),bh.setAttribute("href",n);const e=bh.pathname;return"/"===e.charAt(0)?e:`/${e}`}(t)}resetBaseElement(){zl=null}getUserAgent(){return window.navigator.userAgent}getCookie(e){return function K6(n,e){e=encodeURIComponent(e);for(const t of n.split(";")){const r=t.indexOf("="),[i,s]=-1==r?[t,""]:[t.slice(0,r),t.slice(r+1)];if(i.trim()===e)return decodeURIComponent(s)}return null}(document.cookie,e)}}let bh,zl=null;const MC=new an("TRANSITION_ID"),qB=[{provide:kI,useFactory:function WB(n,e,t){return()=>{t.get(ih).donePromise.then(()=>{const r=Kl(),i=e.querySelectorAll(`style[ng-transition="${n}"]`);for(let s=0;s{class n{build(){return new XMLHttpRequest}}return n.\u0275fac=function(t){return new(t||n)},n.\u0275prov=Jn({token:n,factory:n.\u0275fac}),n})();const _h=new an("EventManagerPlugins");let Dh=(()=>{class n{constructor(t,r){this._zone=r,this._eventNameToPlugin=new Map,t.forEach(i=>i.manager=this),this._plugins=t.slice().reverse()}addEventListener(t,r,i){return this._findPluginFor(r).addEventListener(t,r,i)}addGlobalEventListener(t,r,i){return this._findPluginFor(r).addGlobalEventListener(t,r,i)}getZone(){return this._zone}_findPluginFor(t){const r=this._eventNameToPlugin.get(t);if(r)return r;const i=this._plugins;for(let s=0;s{class n{constructor(){this._stylesSet=new Set}addStyles(t){const r=new Set;t.forEach(i=>{this._stylesSet.has(i)||(this._stylesSet.add(i),r.add(i))}),this.onStylesAdded(r)}onStylesAdded(t){}getAllStyles(){return Array.from(this._stylesSet)}}return n.\u0275fac=function(t){return new(t||n)},n.\u0275prov=Jn({token:n,factory:n.\u0275fac}),n})(),Wl=(()=>{class n extends LC{constructor(t){super(),this._doc=t,this._hostNodes=new Map,this._hostNodes.set(t.head,[])}_addStylesToHost(t,r,i){t.forEach(s=>{const o=this._doc.createElement("style");o.textContent=s,i.push(r.appendChild(o))})}addHost(t){const r=[];this._addStylesToHost(this._stylesSet,t,r),this._hostNodes.set(t,r)}removeHost(t){const r=this._hostNodes.get(t);r&&r.forEach(kC),this._hostNodes.delete(t)}onStylesAdded(t){this._hostNodes.forEach((r,i)=>{this._addStylesToHost(t,i,r)})}ngOnDestroy(){this._hostNodes.forEach(t=>t.forEach(kC))}}return n.\u0275fac=function(t){return new(t||n)(On(To))},n.\u0275prov=Jn({token:n,factory:n.\u0275fac}),n})();function kC(n){Kl().remove(n)}const om={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/",math:"http://www.w3.org/1998/MathML/"},am=/%COMP%/g;function Sh(n,e,t){for(let r=0;r{if("__ngUnwrap__"===e)return n;!1===n(e)&&(e.preventDefault(),e.returnValue=!1)}}let cm=(()=>{class n{constructor(t,r,i){this.eventManager=t,this.sharedStylesHost=r,this.appId=i,this.rendererByCompId=new Map,this.defaultRenderer=new um(t)}createRenderer(t,r){if(!t||!r)return this.defaultRenderer;switch(r.encapsulation){case zs.Emulated:{let i=this.rendererByCompId.get(r.id);return i||(i=new n5(this.eventManager,this.sharedStylesHost,r,this.appId),this.rendererByCompId.set(r.id,i)),i.applyToHost(t),i}case 1:case zs.ShadowDom:return new r5(this.eventManager,this.sharedStylesHost,t,r);default:if(!this.rendererByCompId.has(r.id)){const i=Sh(r.id,r.styles,[]);this.sharedStylesHost.addStyles(i),this.rendererByCompId.set(r.id,this.defaultRenderer)}return this.defaultRenderer}}begin(){}end(){}}return n.\u0275fac=function(t){return new(t||n)(On(Dh),On(Wl),On(Vl))},n.\u0275prov=Jn({token:n,factory:n.\u0275fac}),n})();class um{constructor(e){this.eventManager=e,this.data=Object.create(null),this.destroyNode=null}destroy(){}createElement(e,t){return t?document.createElementNS(om[t]||t,e):document.createElement(e)}createComment(e){return document.createComment(e)}createText(e){return document.createTextNode(e)}appendChild(e,t){(HC(e)?e.content:e).appendChild(t)}insertBefore(e,t,r){e&&(HC(e)?e.content:e).insertBefore(t,r)}removeChild(e,t){e&&e.removeChild(t)}selectRootElement(e,t){let r="string"==typeof e?document.querySelector(e):e;if(!r)throw new Error(`The selector "${e}" did not match any elements`);return t||(r.textContent=""),r}parentNode(e){return e.parentNode}nextSibling(e){return e.nextSibling}setAttribute(e,t,r,i){if(i){t=i+":"+t;const s=om[i];s?e.setAttributeNS(s,t,r):e.setAttribute(t,r)}else e.setAttribute(t,r)}removeAttribute(e,t,r){if(r){const i=om[r];i?e.removeAttributeNS(i,t):e.removeAttribute(`${r}:${t}`)}else e.removeAttribute(t)}addClass(e,t){e.classList.add(t)}removeClass(e,t){e.classList.remove(t)}setStyle(e,t,r,i){i&(Mi.DashCase|Mi.Important)?e.style.setProperty(t,r,i&Mi.Important?"important":""):e.style[t]=r}removeStyle(e,t,r){r&Mi.DashCase?e.style.removeProperty(t):e.style[t]=""}setProperty(e,t,r){e[t]=r}setValue(e,t){e.nodeValue=t}listen(e,t,r){return"string"==typeof e?this.eventManager.addGlobalEventListener(e,t,UC(r)):this.eventManager.addEventListener(e,t,UC(r))}}function HC(n){return"TEMPLATE"===n.tagName&&void 0!==n.content}class n5 extends um{constructor(e,t,r,i){super(e),this.component=r;const s=Sh(i+"-"+r.id,r.styles,[]);t.addStyles(s),this.contentAttr=function JB(n){return"_ngcontent-%COMP%".replace(am,n)}(i+"-"+r.id),this.hostAttr=function e5(n){return"_nghost-%COMP%".replace(am,n)}(i+"-"+r.id)}applyToHost(e){super.setAttribute(e,this.hostAttr,"")}createElement(e,t){const r=super.createElement(e,t);return super.setAttribute(r,this.contentAttr,""),r}}class r5 extends um{constructor(e,t,r,i){super(e),this.sharedStylesHost=t,this.hostEl=r,this.shadowRoot=r.attachShadow({mode:"open"}),this.sharedStylesHost.addHost(this.shadowRoot);const s=Sh(i.id,i.styles,[]);for(let o=0;o{class n extends OC{constructor(t){super(t)}supports(t){return!0}addEventListener(t,r,i){return t.addEventListener(r,i,!1),()=>this.removeEventListener(t,r,i)}removeEventListener(t,r,i){return t.removeEventListener(r,i)}}return n.\u0275fac=function(t){return new(t||n)(On(To))},n.\u0275prov=Jn({token:n,factory:n.\u0275fac}),n})();const KC=["alt","control","meta","shift"],s5={"\b":"Backspace","\t":"Tab","\x7f":"Delete","\x1b":"Escape",Del:"Delete",Esc:"Escape",Left:"ArrowLeft",Right:"ArrowRight",Up:"ArrowUp",Down:"ArrowDown",Menu:"ContextMenu",Scroll:"ScrollLock",Win:"OS"},o5={alt:n=>n.altKey,control:n=>n.ctrlKey,meta:n=>n.metaKey,shift:n=>n.shiftKey};let a5=(()=>{class n extends OC{constructor(t){super(t)}supports(t){return null!=n.parseEventName(t)}addEventListener(t,r,i){const s=n.parseEventName(r),o=n.eventCallback(s.fullKey,i,this.manager.getZone());return this.manager.getZone().runOutsideAngular(()=>Kl().onAndCancel(t,s.domEventName,o))}static parseEventName(t){const r=t.toLowerCase().split("."),i=r.shift();if(0===r.length||"keydown"!==i&&"keyup"!==i)return null;const s=n._normalizeKey(r.pop());let o="",a=r.indexOf("code");if(a>-1&&(r.splice(a,1),o="code."),KC.forEach(m=>{const T=r.indexOf(m);T>-1&&(r.splice(T,1),o+=m+".")}),o+=s,0!=r.length||0===s.length)return null;const c={};return c.domEventName=i,c.fullKey=o,c}static matchEventFullKeyCode(t,r){let i=s5[t.key]||t.key,s="";return r.indexOf("code.")>-1&&(i=t.code,s="code."),!(null==i||!i)&&(i=i.toLowerCase()," "===i?i="space":"."===i&&(i="dot"),KC.forEach(o=>{o!==i&&(0,o5[o])(t)&&(s+=o+".")}),s+=i,s===r)}static eventCallback(t,r,i){return s=>{n.matchEventFullKeyCode(s,t)&&i.runGuarded(()=>r(s))}}static _normalizeKey(t){return"esc"===t?"escape":t}}return n.\u0275fac=function(t){return new(t||n)(On(To))},n.\u0275prov=Jn({token:n,factory:n.\u0275fac}),n})();const $C=[{provide:UI,useValue:"browser"},{provide:FI,useValue:function c5(){sm.makeCurrent()},multi:!0},{provide:To,useFactory:function l5(){return function QN(n){jg=n}(document),document},deps:[]}],f5=WI(Jk,"browser",$C),GC=new an(""),zC=[{provide:sh,useClass:class QB{addToWindow(e){jn.getAngularTestability=(r,i=!0)=>{const s=e.findTestabilityInTree(r,i);if(null==s)throw new Error("Could not find testability for element.");return s},jn.getAllAngularTestabilities=()=>e.getAllTestabilities(),jn.getAllAngularRootElements=()=>e.getAllRootElements(),jn.frameworkStabilizers||(jn.frameworkStabilizers=[]),jn.frameworkStabilizers.push(r=>{const i=jn.getAllAngularTestabilities();let s=i.length,o=!1;const a=function(c){o=o||c,s--,0==s&&r(o)};i.forEach(function(c){c.whenStable(a)})})}findTestabilityInTree(e,t,r){return null==t?null:e.getTestability(t)??(r?Kl().isShadowRoot(t)?this.findTestabilityInTree(e,t.host,!0):this.findTestabilityInTree(e,t.parentElement,!0):null)}},deps:[]},{provide:$I,useClass:O0,deps:[ai,L0,sh]},{provide:O0,useClass:O0,deps:[ai,L0,sh]}],WC=[{provide:Xg,useValue:"root"},{provide:Hc,useFactory:function u5(){return new Hc},deps:[]},{provide:_h,useClass:i5,multi:!0,deps:[To,ai,UI]},{provide:_h,useClass:a5,multi:!0,deps:[To]},{provide:cm,useClass:cm,deps:[Dh,Wl,Vl]},{provide:W_,useExisting:cm},{provide:LC,useExisting:Wl},{provide:Wl,useClass:Wl,deps:[To]},{provide:Dh,useClass:Dh,deps:[_h,ai]},{provide:class CB{},useClass:YB,deps:[]},[]];let d5=(()=>{class n{constructor(t){}static withServerTransition(t){return{ngModule:n,providers:[{provide:Vl,useValue:t.appId},{provide:MC,useExisting:Vl},qB]}}}return n.\u0275fac=function(t){return new(t||n)(On(GC,12))},n.\u0275mod=nl({type:n}),n.\u0275inj=vc({providers:[...WC,...zC],imports:[bB,e6]}),n})();typeof window<"u"&&window;class _5 extends Sr{constructor(e){super(),this._value=e}get value(){return this.getValue()}_subscribe(e){const t=super._subscribe(e);return!t.closed&&e.next(this._value),t}getValue(){const{hasError:e,thrownError:t,_value:r}=this;if(e)throw t;return this._throwIfClosed(),r}next(e){super.next(this._value=e)}}function YC(n,e,t,r,i,s,o){try{var a=n[s](o),c=a.value}catch(m){return void t(m)}a.done?e(c):Promise.resolve(c).then(r,i)}function V(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var s=n.apply(e,t);function o(c){YC(s,r,i,o,a,"next",c)}function a(c){YC(s,r,i,o,a,"throw",c)}o(void 0)})}}function ZC(n){this.wrapped=n}function ql(n){var e,t;function i(o,a){try{var c=n[o](a),m=c.value,T=m instanceof ZC;Promise.resolve(T?m.wrapped:m).then(function(R){T?i("return"===o?"return":"next",R):s(c.done?"return":"normal",R)},function(R){i("throw",R)})}catch(R){s("throw",R)}}function s(o,a){switch(o){case"return":e.resolve({value:a,done:!0});break;case"throw":e.reject(a);break;default:e.resolve({value:a,done:!1})}(e=e.next)?i(e.key,e.arg):t=null}this._invoke=function r(o,a){return new Promise(function(c,m){var T={key:o,arg:a,resolve:c,reject:m,next:null};t?t=t.next=T:(e=t=T,i(o,a))})},"function"!=typeof n.return&&(this.return=void 0)}function un(n){return function(){return new ql(n.apply(this,arguments))}}function ct(n){return new ZC(n)}function Tt(n){var e,t,r,i=2;for(typeof Symbol<"u"&&(t=Symbol.asyncIterator,r=Symbol.iterator);i--;){if(t&&null!=(e=n[t]))return e.call(n);if(r&&null!=(e=n[r]))return new Ih(e.call(n));t="@@asyncIterator",r="@@iterator"}throw new TypeError("Object is not async iterable")}function Ih(n){function e(t){if(Object(t)!==t)return Promise.reject(new TypeError(t+" is not an object."));var r=t.done;return Promise.resolve(t.value).then(function(i){return{value:i,done:r}})}return(Ih=function(r){this.s=r,this.n=r.next}).prototype={s:null,n:null,next:function(){return e(this.n.apply(this.s,arguments))},return:function(r){var i=this.s.return;return void 0===i?Promise.resolve({value:r,done:!0}):e(i.apply(this.s,arguments))},throw:function(r){var i=this.s.return;return void 0===i?Promise.reject(r):e(i.apply(this.s,arguments))}},new Ih(n)}function jr(n,e){var t={},r=!1;function i(s,o){return r=!0,o=new Promise(function(a){a(n[s](o))}),{done:!1,value:e(o)}}return t[typeof Symbol<"u"&&Symbol.iterator||"@@iterator"]=function(){return this},t.next=function(s){return r?(r=!1,s):i("next",s)},"function"==typeof n.throw&&(t.throw=function(s){if(r)throw r=!1,s;return i("throw",s)}),"function"==typeof n.return&&(t.return=function(s){return r?(r=!1,s):i("return",s)}),t}function ca(n=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.alloc?globalThis.Buffer.alloc(n):new Uint8Array(n)}function xo(n=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?globalThis.Buffer.allocUnsafe(n):new Uint8Array(n)}function or(n,e){e||(e=n.reduce((i,s)=>i+s.length,0));const t=xo(e);let r=0;for(const i of n)t.set(i,r),r+=i.length;return t}function $r(n,e){if(n===e)return!0;if(n.byteLength!==e.byteLength)return!1;for(let t=0;t0&&this.appendAll(e)}*[Symbol.iterator](){yield*this.bufs}get byteLength(){return this.length}append(...e){this.appendAll(e)}appendAll(e){let t=0;for(const r of e)if(r instanceof Uint8Array)t+=r.byteLength,this.bufs.push(r);else{if(!dm(r))throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");t+=r.byteLength,this.bufs.push(...r.bufs)}this.length+=t}prepend(...e){this.prependAll(e)}prependAll(e){let t=0;for(const r of e.reverse())if(r instanceof Uint8Array)t+=r.byteLength,this.bufs.unshift(r);else{if(!dm(r))throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");t+=r.byteLength,this.bufs.unshift(...r.bufs)}this.length+=t}get(e){const t=JC(this.bufs,e);return t.buf[t.index]}set(e,t){const r=JC(this.bufs,e);r.buf[r.index]=t}write(e,t=0){if(e instanceof Uint8Array)for(let r=0;r0;){if(!(e>=this.bufs[0].byteLength)){this.bufs[0]=this.bufs[0].subarray(e),this.length-=e;break}e-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift()}}slice(e,t){const{bufs:r,length:i}=this._subList(e,t);return or(r,i)}subarray(e,t){const{bufs:r,length:i}=this._subList(e,t);return 1===r.length?r[0]:or(r,i)}sublist(e,t){const{bufs:r,length:i}=this._subList(e,t),s=new $n;return s.length=i,s.bufs=r,s}_subList(e,t){if((e=e??0)<0&&(e=this.length+e),(t=t??this.length)<0&&(t=this.length+t),e<0||t>this.length)throw new RangeError("index is out of bounds");if(e===t)return{bufs:[],length:0};if(0===e&&t===this.length)return{bufs:[...this.bufs],length:this.length};const r=[];let i=0;for(let s=0;s=c)continue;const m=e>=a&&ea&&t<=c;if(m&&T){if(e===a&&t===c){r.push(o);break}const R=e-a;r.push(o.subarray(R,R+(t-e)));break}if(m){if(0===e){r.push(o);continue}r.push(o.subarray(e-a))}else{if(T){if(t===c){r.push(o);break}r.push(o.subarray(0,t-a));break}r.push(o)}}return{bufs:r,length:t-e}}getInt8(e){const t=this.subarray(e,e+1);return new DataView(t.buffer,t.byteOffset,t.byteLength).getInt8(0)}setInt8(e,t){const r=xo(1);new DataView(r.buffer,r.byteOffset,r.byteLength).setInt8(0,t),this.write(r,e)}getInt16(e,t){const r=this.subarray(e,e+2);return new DataView(r.buffer,r.byteOffset,r.byteLength).getInt16(0,t)}setInt16(e,t,r){const i=ca(2);new DataView(i.buffer,i.byteOffset,i.byteLength).setInt16(0,t,r),this.write(i,e)}getInt32(e,t){const r=this.subarray(e,e+4);return new DataView(r.buffer,r.byteOffset,r.byteLength).getInt32(0,t)}setInt32(e,t,r){const i=ca(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setInt32(0,t,r),this.write(i,e)}getBigInt64(e,t){const r=this.subarray(e,e+8);return new DataView(r.buffer,r.byteOffset,r.byteLength).getBigInt64(0,t)}setBigInt64(e,t,r){const i=ca(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setBigInt64(0,t,r),this.write(i,e)}getUint8(e){const t=this.subarray(e,e+1);return new DataView(t.buffer,t.byteOffset,t.byteLength).getUint8(0)}setUint8(e,t){const r=xo(1);new DataView(r.buffer,r.byteOffset,r.byteLength).setUint8(0,t),this.write(r,e)}getUint16(e,t){const r=this.subarray(e,e+2);return new DataView(r.buffer,r.byteOffset,r.byteLength).getUint16(0,t)}setUint16(e,t,r){const i=ca(2);new DataView(i.buffer,i.byteOffset,i.byteLength).setUint16(0,t,r),this.write(i,e)}getUint32(e,t){const r=this.subarray(e,e+4);return new DataView(r.buffer,r.byteOffset,r.byteLength).getUint32(0,t)}setUint32(e,t,r){const i=ca(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setUint32(0,t,r),this.write(i,e)}getBigUint64(e,t){const r=this.subarray(e,e+8);return new DataView(r.buffer,r.byteOffset,r.byteLength).getBigUint64(0,t)}setBigUint64(e,t,r){const i=ca(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setBigUint64(0,t,r),this.write(i,e)}getFloat32(e,t){const r=this.subarray(e,e+4);return new DataView(r.buffer,r.byteOffset,r.byteLength).getFloat32(0,t)}setFloat32(e,t,r){const i=ca(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat32(0,t,r),this.write(i,e)}getFloat64(e,t){const r=this.subarray(e,e+8);return new DataView(r.buffer,r.byteOffset,r.byteLength).getFloat64(0,t)}setFloat64(e,t,r){const i=ca(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat64(0,t,r),this.write(i,e)}equals(e){if(null==e||!(e instanceof $n)||e.bufs.length!==this.bufs.length)return!1;for(let t=0;ti+s.byteLength,0)),r.length=t,r}}class e2{constructor(e){if(!(e>0)||0!=(e-1&e))throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(e),this.mask=e-1,this.top=0,this.btm=0,this.next=null}push(e){return void 0===this.buffer[this.top]&&(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){const e=this.buffer[this.btm];if(void 0!==e)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}isEmpty(){return void 0===this.buffer[this.btm]}}class hm{constructor(e={}){this.hwm=e.splitLimit??16,this.head=new e2(this.hwm),this.tail=this.head,this.size=0}calculateSize(e){return null!=e?.byteLength?e.byteLength:1}push(e){null!=e?.value&&(this.size+=this.calculateSize(e.value)),this.head.push(e)||(this.head=this.head.next=new e2(2*this.head.buffer.length),this.head.push(e))}shift(){let e=this.tail.shift();if(void 0===e&&null!=this.tail.next){const t=this.tail.next;this.tail.next=null,this.tail=t,e=this.tail.shift()}return null!=e?.value&&(this.size-=this.calculateSize(e.value)),e}isEmpty(){return this.head.isEmpty()}}function lu(n={}){return t2(t=>{const r=t.shift();if(null==r)return{done:!0};if(null!=r.error)throw r.error;return{done:!0===r.done,value:r.value}},n)}function t2(n,e){let i,s,o,t=(e=e??{}).onEnd,r=new hm;const a=function(){var X=V(function*(){return r.isEmpty()?o?{done:!0}:yield new Promise((ae,he)=>{s=Ae=>{s=null,r.push(Ae);try{ae(n(r))}catch(ue){he(ue)}return i}}):n(r)});return function(){return X.apply(this,arguments)}}(),c=X=>null!=s?s(X):(r.push(X),i),T=X=>{if(o)return i;if(!0!==e?.objectMode&&null==X?.byteLength)throw new Error("objectMode was not true but tried to push non-Uint8Array value");return c({done:!1,value:X})},R=X=>o?i:(o=!0,null!=X?(X=>(r=new hm,null!=s?s({error:X}):(r.push({error:X}),i)))(X):c({done:!0}));if(i={[Symbol.asyncIterator](){return this},next:a,return:()=>(r=new hm,R(),{done:!0}),throw:X=>(R(X),{done:!0}),push:T,end:R,get readableLength(){return r.size}},null==t)return i;const Q=i;return i={[Symbol.asyncIterator](){return this},next:()=>Q.next(),throw:X=>(Q.throw(X),null!=t&&(t(X),t=void 0),{done:!0}),return:()=>(Q.return(),null!=t&&(t(),t=void 0),{done:!0}),push:T,end:X=>(Q.end(X),null!=t&&(t(X),t=void 0),i),get readableLength(){return Q.readableLength}},i}function pm(){const n={};return n.promise=new Promise((e,t)=>{n.resolve=e,n.reject=t}),n}function Ch(n){const e=lu(),t=function D5(n){const e=un(function*(){let t=yield,r=new $n;var o,i=!1,s=!1;try{for(var c,a=Tt(n);i=!(c=yield ct(a.next())).done;i=!1){const m=c.value;if(null!=t)for(r.append(m);r.length>=t;){const T=r.sublist(0,t);if(r.consume(t),t=yield T,null==t){r.length>0&&(t=yield r,r=new $n);break}}else r.append(m),t=yield r,r=new $n}}catch(m){s=!0,o=m}finally{try{i&&null!=a.return&&(yield ct(a.return()))}finally{if(s)throw o}}if(null!=t)throw Object.assign(new Error(`stream ended before ${t} bytes became available`),{code:"ERR_UNDER_READ",buffer:r})})();return e.next(),e}(n.source),r=pm();let i;const s=n.sink(un(function*(){yield*jr(Tt(e),ct);const a=yield ct(r.promise);yield*jr(Tt(a),ct)})());s.catch(a=>{i=a});const o={sink:(a=V(function*(c){return null!=i?yield Promise.reject(i):(r.resolve(c),yield s)}),function(m){return a.apply(this,arguments)}),source:t};var a;return{reader:t,writer:e,stream:o,rest:()=>e.end(),write:e.push,read:function(){var a=V(function*(){const c=yield t.next();if(null!=c.value)return c.value});return function(){return a.apply(this,arguments)}}()}}function gm(n){return n instanceof Uint8Array?{get:e=>n[e],set(e,t){n[e]=t}}:{get:e=>n.get(e),set(e,t){n.set(e,t)}}}const n2=4294967296;class qr{constructor(e=0,t=0){this.hi=e,this.lo=t}toBigInt(e){if(!0===e)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31!=0){const t=1+~this.lo>>>0;let r=~this.hi>>>0;return 0===t&&(r=r+1>>>0),-(BigInt(t)+(BigInt(r)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toNumber(e){return Number(this.toBigInt(e))}zzDecode(){const e=-(1&this.lo);return new qr((this.hi>>>1^e)>>>0,((this.lo>>>1|this.hi<<31)^e)>>>0)}zzEncode(){const e=this.hi>>31;return new qr(((this.hi<<1|this.lo>>>31)^e)>>>0,(this.lo<<1^e)>>>0)}toBytes(e,t=0){const r=gm(e);for(;this.hi>0;)r.set(t++,127&this.lo|128),this.lo=(this.lo>>>7|this.hi<<25)>>>0,this.hi>>>=7;for(;this.lo>127;)r.set(t++,127&this.lo|128),this.lo=this.lo>>>7;r.set(t++,this.lo)}static fromBigInt(e){if(0n===e)return new qr;const t=e<0;t&&(e=-e);let r=0|Number(e>>32n),i=0|Number(e-(BigInt(r)<<32n));return t&&(r=~r>>>0,i=~i>>>0,++i>n2&&(i=0,++r>n2&&(r=0))),new qr(r,i)}static fromNumber(e){if(0===e)return new qr;const t=e<0;t&&(e=-e);let r=e>>>0,i=(e-r)/4294967296>>>0;return t&&(i=~i>>>0,r=~r>>>0,++r>4294967295&&(r=0,++i>4294967295&&(i=0))),new qr(i,r)}static fromBytes(e,t=0){const r=gm(e),i=new qr;let s=0;if(e.length-t>4){for(;s<4;++s)if(i.lo=(i.lo|(127&r.get(t))<<7*s)>>>0,r.get(t++)<128)return i;if(i.lo=(i.lo|(127&r.get(t))<<28)>>>0,i.hi=(i.hi|(127&r.get(t))>>4)>>>0,r.get(t++)<128)return i;s=0}else for(;s<4;++s){if(t>=e.length)throw RangeError(`index out of range: ${t} > ${e.length}`);if(i.lo=(i.lo|(127&r.get(t))<<7*s)>>>0,r.get(t++)<128)return i}if(e.length-t>4){for(;s<5;++s)if(i.hi=(i.hi|(127&r.get(t))<<7*s+3)>>>0,r.get(t++)<128)return i}else if(t=e.length)throw RangeError(`index out of range: ${t} > ${e.length}`);if(i.hi=(i.hi|(127&r.get(t))<<7*s+3)>>>0,r.get(t++)<128)return i}throw RangeError("invalid varint encoding")}}const I5=Math.pow(2,7),C5=Math.pow(2,14),T5=Math.pow(2,21),A5=Math.pow(2,28),x5=Math.pow(2,35),R5=Math.pow(2,42),P5=Math.pow(2,49),N5=Math.pow(2,56),M5=Math.pow(2,63),Qt={encodingLength:n=>nNumber.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return null==e&&(e=xo(Qt.encodingLength(n))),qr.fromNumber(n).toBytes(e,t),e},decode:(n,e=0)=>qr.fromBytes(n,e).toNumber(!0)},Th={encodingLength:n=>n<0?10:Qt.encodingLength(n),encode:(n,e,t)=>(null==e&&(e=xo(Th.encodingLength(n))),n<0?(qr.fromNumber(n).toBytes(e,t),e):Qt.encode(n,e,t)),decode:(n,e=0)=>qr.fromBytes(n,e).toNumber(!1)},ym={encodingLength:n=>Qt.encodingLength(n>=0?2*n:-2*n-1),encode:(n,e,t)=>Qt.encode(n=n>=0?2*n:-2*n-1,e,t),decode(n,e=0){const t=Qt.decode(n,e);return 0!=(1&t)?(t+1)/-2:t/2}},Ah=n=>{const e=Qt.encodingLength(n),t=function O5(n){return null!=globalThis?.Buffer?.allocUnsafe?globalThis.Buffer.allocUnsafe(n):new Uint8Array(n)}(e);return Qt.encode(n,t),Ah.bytes=e,t};function to(n){const e=(n=n??{}).lengthEncoder??Ah;return function(){var r=un(function*(i){var a,s=!1,o=!1;try{for(var m,c=Tt(i);s=!(m=yield ct(c.next())).done;s=!1){const T=m.value,R=e(T.byteLength);R instanceof Uint8Array?yield R:yield*jr(Tt(R),ct),T instanceof Uint8Array?yield T:yield*jr(Tt(T),ct)}}catch(T){o=!0,a=T}finally{try{s&&null!=c.return&&(yield ct(c.return()))}finally{if(o)throw a}}});return function(s){return r.apply(this,arguments)}}()}Ah.bytes=0,to.single=(n,e)=>new $n(((e=e??{}).lengthEncoder??Ah)(n.byteLength),n);var se=N(2535),ua=(()=>{return(n=ua||(ua={}))[n.LENGTH=0]="LENGTH",n[n.DATA=1]="DATA",ua;var n})();const mm=n=>{const e=Qt.decode(n);return mm.bytes=Qt.encodingLength(e),e};function Ms(n){return function(){var t=un(function*(r){const i=new $n;let s=ua.LENGTH,o=-1;const a=n?.lengthDecoder??mm,c=n?.maxLengthLength??8,m=n?.maxDataLength??4194304;var k,T=!1,R=!1;try{for(var Q,U=Tt(r);T=!(Q=yield ct(U.next())).done;T=!1)for(i.append(Q.value);i.byteLength>0;){if(s===ua.LENGTH)try{if(o=a(i),o<0)throw se(new Error("invalid message length"),"ERR_INVALID_MSG_LENGTH");if(o>m)throw se(new Error("message length too long"),"ERR_MSG_DATA_TOO_LONG");i.consume(a.bytes),null!=n?.onLength&&n.onLength(o),s=ua.DATA}catch(ae){if(ae instanceof RangeError){if(i.byteLength>c)throw se(new Error("message length length too long"),"ERR_MSG_LENGTH_TOO_LONG");break}throw ae}if(s===ua.DATA){if(i.byteLength0)throw se(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")});return function(i){return t.apply(this,arguments)}}()}function r2(n,e={}){const t=Ch(n),r=Ms.fromReader(t.reader,e),i={read:(s=V(function*(o){const{value:a}=yield t.reader.next(o);if(null==a)throw new Error("Value is null");return a}),function(a){return s.apply(this,arguments)}),readLP:function(){var s=V(function*(){const{value:o}=yield r.next();if(null==o)throw new Error("Value is null");return o});return function(){return s.apply(this,arguments)}}(),readPB:function(){var s=V(function*(o){const a=yield i.readLP();if(null==a)throw new Error("Value is null");const c=a instanceof Uint8Array?a:a.slice();return o.decode(c)});return function(a){return s.apply(this,arguments)}}(),write:s=>{s instanceof Uint8Array?t.writer.push(s):t.writer.push(s.slice())},writeLP:s=>{i.write(to.single(s,e))},writePB:(s,o)=>{i.writeLP(o.encode(s))},pb:s=>{return{read:(o=V(function*(){return yield i.readPB(s)}),function(){return o.apply(this,arguments)}),write:o=>i.writePB(o,s)};var o},unwrap:()=>(t.rest(),t.stream)};var s;return i}function i2(){const n=pm();let e=!1;return{sink:(t=V(function*(r){if(e)throw new Error("already piped");e=!0,n.resolve(r)}),function(i){return t.apply(this,arguments)}),source:un(function*(){const t=yield ct(n.promise);yield*jr(Tt(t),ct)})()};var t}mm.bytes=0,Ms.fromReader=(n,e)=>{let t=1;const r=un(function*(){for(;;)try{const{done:s,value:o}=yield ct(n.next(t));if(!0===s)return;null!=o&&(yield o)}catch(s){if("ERR_UNDER_READ"===s.code)return{done:!0,value:null};throw s}finally{t=1}})();return Ms({...e??{},onLength:s=>{t=s}})(r)};var xh=N(5061);const s2=n=>null!=n&&("function"==typeof n[Symbol.asyncIterator]||"function"==typeof n[Symbol.iterator]||"function"==typeof n.next),vm=n=>null!=n&&"function"==typeof n.sink&&s2(n.source),U5=n=>e=>{const t=n.sink(e);if(null!=t.then){const r=lu({objectMode:!0});return t.then(()=>{r.end()},s=>{r.end(s)}),xh(r,function(){var s=un(function*(){yield*jr(Tt(n.source),ct),r.end()});return function(){return s.apply(this,arguments)}}()())}return n.source};function Ln(n,...e){if(vm(n)){const r=n;n=()=>r.source}else if(s2(n)){const r=n;n=()=>r}const t=[n,...e];if(t.length>1&&vm(t[t.length-1])&&(t[t.length-1]=t[t.length-1].sink),t.length>2)for(let r=1;r{let e;for(;n.length>0;)e=n.shift()(e);return e})(...t)}const Ql=65535,V5=Boolean(globalThis.process?.env?.DUMP_SESSION_KEYS);var H5=N(5705),Em=N(5006),a2=N(893),c2=N(5876);const K5={hashSHA256:n=>(0,a2.vp)(n),getHKDF(n,e){const i=new H5.t(a2.mE,e,n).expand(96);return[i.subarray(0,32),i.subarray(32,64),i.subarray(64,96)]},generateX25519KeyPair(){const n=Em.Au();return{publicKey:n.publicKey,privateKey:n.secretKey}},generateX25519KeyPairFromSeed(n){const e=Em._w(n);return{publicKey:e.publicKey,privateKey:e.secretKey}},generateX25519SharedKey:(n,e)=>Em.gi(n,e),chaCha20Poly1305Encrypt:(n,e,t,r)=>new c2.OK(r).seal(e,n,t),chaCha20Poly1305Decrypt:(n,e,t,r)=>new c2.OK(r).open(e,n,t)},Rh=n=>{const e=globalThis.Buffer?globalThis.Buffer.allocUnsafe(2):new Uint8Array(2);return new DataView(e.buffer,e.byteOffset,e.byteLength).setUint16(0,n,!1),e};Rh.bytes=2;const Ph=n=>{if(n.length<2)throw RangeError("Could not decode int16BE");return n instanceof Uint8Array?new DataView(n.buffer,n.byteOffset,n.byteLength).getUint16(0,!1):n.getUint16(0)};function u2(n){return or([n.ne,n.ciphertext],n.ne.length+n.ciphertext.length)}function l2(n){return or([n.ne,n.ns,n.ciphertext],n.ne.length+n.ns.length+n.ciphertext.length)}function wm(n){if(n.length<32)throw new Error("Cannot decode stage 0 MessageBuffer: length less than 32 bytes.");return{ne:n.subarray(0,32),ciphertext:n.subarray(32,n.length),ns:new Uint8Array(0)}}function bm(n){if(n.length<80)throw new Error("Cannot decode stage 1 MessageBuffer: length less than 80 bytes.");return{ne:n.subarray(0,32),ns:n.subarray(32,80),ciphertext:n.subarray(80,n.length)}}Ph.bytes=2;var _m=N(3863),Dm=N.n(_m);const Sm=_m.Reader;function ui(n,e){const t=Sm.create(n instanceof Uint8Array?n:n.subarray());return e.decode(t)}["uint64","int64","sint64","fixed64","sfixed64"].forEach(n=>{const e=Sm.prototype[n];Sm.prototype[n]=function(){return BigInt(e.call(this).toString())}});const Im=_m.Writer;function li(n,e){const t=Im.create();return e.encode(n,t,{lengthDelimited:!1}),t.finish()}["uint64","int64","sint64","fixed64","sfixed64"].forEach(n=>{const e=Im.prototype[n];Im.prototype[n]=function(t){return e.call(this,t.toString())}});var Yl=(()=>{return(n=Yl||(Yl={}))[n.VARINT=0]="VARINT",n[n.BIT64=1]="BIT64",n[n.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",n[n.START_GROUP=3]="START_GROUP",n[n.END_GROUP=4]="END_GROUP",n[n.BIT32=5]="BIT32",Yl;var n})();function f2(n,e,t,r){return{name:n,type:e,encode:t,decode:r}}function Nh(n){function e(i){if(null==n[i.toString()])throw new Error("Invalid enum value");return n[i]}return f2("enum",Yl.VARINT,function(s,o){const a=e(s);o.int32(a)},function(s){return e(s.uint32())})}function fi(n,e){return f2("message",Yl.LENGTH_DELIMITED,n,e)}var fu,du,dr=(()=>{return(n=dr||(dr={})).RSA="RSA",n.Ed25519="Ed25519",n.Secp256k1="Secp256k1",dr;var n})(),Mh=(()=>{return(n=Mh||(Mh={}))[n.RSA=0]="RSA",n[n.Ed25519=1]="Ed25519",n[n.Secp256k1=2]="Secp256k1",Mh;var n})();(dr||(dr={})).codec=()=>Nh(Mh),function(n){let e;n.codec=()=>(null==e&&(e=fi((t,r,i={})=>{if(!1!==i.lengthDelimited&&r.fork(),null==t.Type)throw new Error('Protocol error: required field "Type" was not found in object');if(r.uint32(8),dr.codec().encode(t.Type,r),null==t.Data)throw new Error('Protocol error: required field "Data" was not found in object');r.uint32(18),r.bytes(t.Data),!1!==i.lengthDelimited&&r.ldelim()},(t,r)=>{const i={Type:dr.RSA,Data:new Uint8Array(0)},s=null==r?t.len:t.pos+r;for(;t.pos>>3){case 1:i.Type=dr.codec().decode(t);break;case 2:i.Data=t.bytes();break;default:t.skipType(7&o)}}if(null==i.Type)throw new Error('Protocol error: value for required field "Type" was not found in protobuf');if(null==i.Data)throw new Error('Protocol error: value for required field "Data" was not found in protobuf');return i})),e),n.encode=t=>li(t,n.codec()),n.decode=t=>ui(t,n.codec())}(fu||(fu={})),function(n){let e;n.codec=()=>(null==e&&(e=fi((t,r,i={})=>{if(!1!==i.lengthDelimited&&r.fork(),null==t.Type)throw new Error('Protocol error: required field "Type" was not found in object');if(r.uint32(8),dr.codec().encode(t.Type,r),null==t.Data)throw new Error('Protocol error: required field "Data" was not found in object');r.uint32(18),r.bytes(t.Data),!1!==i.lengthDelimited&&r.ldelim()},(t,r)=>{const i={Type:dr.RSA,Data:new Uint8Array(0)},s=null==r?t.len:t.pos+r;for(;t.pos>>3){case 1:i.Type=dr.codec().decode(t);break;case 2:i.Data=t.bytes();break;default:t.skipType(7&o)}}if(null==i.Type)throw new Error('Protocol error: value for required field "Type" was not found in protobuf');if(null==i.Data)throw new Error('Protocol error: value for required field "Data" was not found in protobuf');return i})),e),n.encode=t=>li(t,n.codec()),n.decode=t=>ui(t,n.codec())}(du||(du={})),N(7791),N(2158);var Gn=N(8659);const Z5=function q5(n,e){if(n.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r>>0,ue=new Uint8Array(Ae);Q[X];){var Re=t[Q.charCodeAt(X)];if(255===Re)return;for(var Le=0,Fe=Ae-1;(0!==Re||Le>>0)%256>>>0,Re=Re/256>>>0;if(0!==Re)throw new Error("Non-zero carry");he=Le,X++}if(" "!==Q[X]){for(var wt=Ae-he;wt!==Ae&&0===ue[wt];)wt++;for(var mt=new Uint8Array(ae+(Ae-wt)),Zt=ae;wt!==Ae;)mt[Zt++]=ue[wt++];return mt}}}return{encode:function R(Q){if(Q instanceof Uint8Array||(ArrayBuffer.isView(Q)?Q=new Uint8Array(Q.buffer,Q.byteOffset,Q.byteLength):Array.isArray(Q)&&(Q=Uint8Array.from(Q))),!(Q instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===Q.length)return"";for(var X=0,ae=0,he=0,Ae=Q.length;he!==Ae&&0===Q[he];)he++,X++;for(var ue=(Ae-he)*T+1>>>0,Re=new Uint8Array(ue);he!==Ae;){for(var Le=Q[he],Fe=0,wt=ue-1;(0!==Le||Fe>>0)%a>>>0,Le=Le/a>>>0;if(0!==Le)throw new Error("Non-zero carry");ae=Fe,he++}for(var mt=ue-ae;mt!==ue&&0===Re[mt];)mt++;for(var Zt=c.repeat(X);mt{if(n instanceof Uint8Array&&"Uint8Array"===n.constructor.name)return n;if(n instanceof ArrayBuffer)return new Uint8Array(n);if(ArrayBuffer.isView(n))return new Uint8Array(n.buffer,n.byteOffset,n.byteLength);throw new Error("Unknown type, must be binary type")});class nF{constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class rF{constructor(e,t,r){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r}decode(e){if("string"==typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return d2(this,e)}}class iF{constructor(e){this.decoders=e}or(e){return d2(this,e)}decode(e){const r=this.decoders[e[0]];if(r)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const d2=(n,e)=>new iF({...n.decoders||{[n.prefix]:n},...e.decoders||{[e.prefix]:e}});class sF{constructor(e,t,r,i){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=i,this.encoder=new nF(e,t,r),this.decoder=new rF(e,t,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Oh=({name:n,prefix:e,encode:t,decode:r})=>new sF(n,e,t,r),Zl=({prefix:n,name:e,alphabet:t})=>{const{encode:r,decode:i}=Z5(t,e);return Oh({prefix:n,name:e,encode:r,decode:s=>hu(i(s))})},Qr=({name:n,prefix:e,bitsPerChar:t,alphabet:r})=>Oh({prefix:e,name:n,encode:i=>((n,e,t)=>{const r="="===e[e.length-1],i=(1<t;)o-=t,s+=e[i&a>>o];if(o&&(s+=e[i&a<((n,e,t,r)=>{const i={};for(let T=0;T=8&&(a-=8,o[m++]=255&c>>a)}if(a>=t||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o})(i,r,t,n)}),cF=Oh({prefix:"\0",name:"identity",encode:n=>(n=>(new TextDecoder).decode(n))(n),decode:n=>(n=>(new TextEncoder).encode(n))(n)}),uF=Qr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),lF=Qr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),fF=Zl({prefix:"9",name:"base10",alphabet:"0123456789"}),dF=Qr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),hF=Qr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),Ro=Qr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),pF=Qr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),gF=Qr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),yF=Qr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),mF=Qr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),vF=Qr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),EF=Qr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),wF=Qr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),bF=Qr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),_F=Zl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),DF=Zl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Ci=Zl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),SF=Zl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Lh=Qr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),IF=Qr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),CF=Qr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),TF=Qr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),h2=Array.from("\u{1f680}\u{1fa90}\u2604\u{1f6f0}\u{1f30c}\u{1f311}\u{1f312}\u{1f313}\u{1f314}\u{1f315}\u{1f316}\u{1f317}\u{1f318}\u{1f30d}\u{1f30f}\u{1f30e}\u{1f409}\u2600\u{1f4bb}\u{1f5a5}\u{1f4be}\u{1f4bf}\u{1f602}\u2764\u{1f60d}\u{1f923}\u{1f60a}\u{1f64f}\u{1f495}\u{1f62d}\u{1f618}\u{1f44d}\u{1f605}\u{1f44f}\u{1f601}\u{1f525}\u{1f970}\u{1f494}\u{1f496}\u{1f499}\u{1f622}\u{1f914}\u{1f606}\u{1f644}\u{1f4aa}\u{1f609}\u263a\u{1f44c}\u{1f917}\u{1f49c}\u{1f614}\u{1f60e}\u{1f607}\u{1f339}\u{1f926}\u{1f389}\u{1f49e}\u270c\u2728\u{1f937}\u{1f631}\u{1f60c}\u{1f338}\u{1f64c}\u{1f60b}\u{1f497}\u{1f49a}\u{1f60f}\u{1f49b}\u{1f642}\u{1f493}\u{1f929}\u{1f604}\u{1f600}\u{1f5a4}\u{1f603}\u{1f4af}\u{1f648}\u{1f447}\u{1f3b6}\u{1f612}\u{1f92d}\u2763\u{1f61c}\u{1f48b}\u{1f440}\u{1f62a}\u{1f611}\u{1f4a5}\u{1f64b}\u{1f61e}\u{1f629}\u{1f621}\u{1f92a}\u{1f44a}\u{1f973}\u{1f625}\u{1f924}\u{1f449}\u{1f483}\u{1f633}\u270b\u{1f61a}\u{1f61d}\u{1f634}\u{1f31f}\u{1f62c}\u{1f643}\u{1f340}\u{1f337}\u{1f63b}\u{1f613}\u2b50\u2705\u{1f97a}\u{1f308}\u{1f608}\u{1f918}\u{1f4a6}\u2714\u{1f623}\u{1f3c3}\u{1f490}\u2639\u{1f38a}\u{1f498}\u{1f620}\u261d\u{1f615}\u{1f33a}\u{1f382}\u{1f33b}\u{1f610}\u{1f595}\u{1f49d}\u{1f64a}\u{1f639}\u{1f5e3}\u{1f4ab}\u{1f480}\u{1f451}\u{1f3b5}\u{1f91e}\u{1f61b}\u{1f534}\u{1f624}\u{1f33c}\u{1f62b}\u26bd\u{1f919}\u2615\u{1f3c6}\u{1f92b}\u{1f448}\u{1f62e}\u{1f646}\u{1f37b}\u{1f343}\u{1f436}\u{1f481}\u{1f632}\u{1f33f}\u{1f9e1}\u{1f381}\u26a1\u{1f31e}\u{1f388}\u274c\u270a\u{1f44b}\u{1f630}\u{1f928}\u{1f636}\u{1f91d}\u{1f6b6}\u{1f4b0}\u{1f353}\u{1f4a2}\u{1f91f}\u{1f641}\u{1f6a8}\u{1f4a8}\u{1f92c}\u2708\u{1f380}\u{1f37a}\u{1f913}\u{1f619}\u{1f49f}\u{1f331}\u{1f616}\u{1f476}\u{1f974}\u25b6\u27a1\u2753\u{1f48e}\u{1f4b8}\u2b07\u{1f628}\u{1f31a}\u{1f98b}\u{1f637}\u{1f57a}\u26a0\u{1f645}\u{1f61f}\u{1f635}\u{1f44e}\u{1f932}\u{1f920}\u{1f927}\u{1f4cc}\u{1f535}\u{1f485}\u{1f9d0}\u{1f43e}\u{1f352}\u{1f617}\u{1f911}\u{1f30a}\u{1f92f}\u{1f437}\u260e\u{1f4a7}\u{1f62f}\u{1f486}\u{1f446}\u{1f3a4}\u{1f647}\u{1f351}\u2744\u{1f334}\u{1f4a3}\u{1f438}\u{1f48c}\u{1f4cd}\u{1f940}\u{1f922}\u{1f445}\u{1f4a1}\u{1f4a9}\u{1f450}\u{1f4f8}\u{1f47b}\u{1f910}\u{1f92e}\u{1f3bc}\u{1f975}\u{1f6a9}\u{1f34e}\u{1f34a}\u{1f47c}\u{1f48d}\u{1f4e3}\u{1f942}"),AF=h2.reduce((n,e,t)=>(n[t]=e,n),[]),xF=h2.reduce((n,e,t)=>(n[e.codePointAt(0)]=t,n),[]),NF=Oh({prefix:"\u{1f680}",name:"base256emoji",encode:function RF(n){return n.reduce((e,t)=>e+AF[t],"")},decode:function PF(n){const e=[];for(const t of n){const r=xF[t.codePointAt(0)];if(void 0===r)throw new Error(`Non-base256emoji character: ${t}`);e.push(r)}return new Uint8Array(e)}});var kF=Math.pow(2,31),UF=Math.pow(2,7),VF=Math.pow(2,14),HF=Math.pow(2,21),KF=Math.pow(2,28),jF=Math.pow(2,35),$F=Math.pow(2,42),GF=Math.pow(2,49),zF=Math.pow(2,56),WF=Math.pow(2,63),QF={encode:function g2(n,e,t){e=e||[];for(var r=t=t||0;n>=kF;)e[t++]=255&n|128,n/=128;for(;-128&n;)e[t++]=255&n|128,n>>>=7;return e[t]=0|n,g2.bytes=t-r+1,e},decode:function Cm(n,r){var o,t=0,i=0,s=r=r||0,a=n.length;do{if(s>=a)throw Cm.bytes=0,new RangeError("Could not decode varint");o=n[s++],t+=i<28?(127&o)<=128);return Cm.bytes=s-r,t},encodingLength:function(n){return n[kh.decode(n),kh.decode.bytes],Bh=(n,e,t=0)=>(kh.encode(n,e,t),e),Fh=n=>kh.encodingLength(n),pu=(n,e)=>{const t=e.byteLength,r=Fh(n),i=r+Fh(t),s=new Uint8Array(i+t);return Bh(n,s,0),Bh(t,s,r),s.set(e,i),new Am(n,t,e,s)},Uh=n=>{const e=hu(n),[t,r]=Tm(e),[i,s]=Tm(e.subarray(r)),o=e.subarray(r+s);if(o.byteLength!==i)throw new Error("Incorrect length");return new Am(t,i,o,e)};class Am{constructor(e,t,r,i){this.code=e,this.size=t,this.digest=r,this.bytes=i}}const m2=({name:n,code:e,encode:t})=>new XF(n,e,t);class XF{constructor(e,t,r){this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?pu(this.code,t):t.then(r=>pu(this.code,r))}throw Error("Unknown type, must be binary type")}}const v2=n=>function(){var e=V(function*(t){return new Uint8Array(yield crypto.subtle.digest(n,t))});return function(t){return e.apply(this,arguments)}}(),Li=m2({name:"sha2-256",code:18,encode:v2("SHA-256")}),JF=m2({name:"sha2-512",code:19,encode:v2("SHA-512")}),w2=hu,gu={code:0,name:"identity",encode:w2,digest:n=>pu(0,w2(n))},tU="raw",nU=85,rU=n=>hu(n),iU=n=>hu(n),sU=new TextEncoder,oU=new TextDecoder,aU="json",cU=512,uU=n=>sU.encode(JSON.stringify(n)),lU=n=>JSON.parse(oU.decode(n));class Rr{constructor(e,t,r,i){this.code=t,this.version=e,this.multihash=r,this.bytes=i,this.byteOffset=i.byteOffset,this.byteLength=i.byteLength,this.asCID=this,this._baseCache=new Map,Object.defineProperties(this,{byteOffset:Hh,byteLength:Hh,code:Vh,version:Vh,multihash:Vh,bytes:Vh,_baseCache:Hh,asCID:Hh})}toV0(){if(0===this.version)return this;{const{code:e,multihash:t}=this;if(e!==Xl)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==pU)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return Rr.createV0(t)}}toV1(){switch(this.version){case 0:{const{code:e,digest:t}=this.multihash,r=pu(e,t);return Rr.createV1(this.code,r)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}equals(e){return e&&this.code===e.code&&this.version===e.version&&((n,e)=>n===e||n.code===e.code&&n.size===e.size&&((n,e)=>{if(n===e)return!0;if(n.byteLength!==e.byteLength)return!1;for(let t=0;t{const[R,k]=Tm(e.subarray(t));return t+=k,R};let i=r(),s=Xl;if(18===i?(i=0,t=0):1===i&&(s=r()),0!==i&&1!==i)throw new RangeError(`Invalid CID version ${i}`);const o=t,a=r(),c=r(),m=t+c;return{version:i,codec:s,multihashCode:a,digestSize:c,multihashSize:m-o,size:m}}static parse(e,t){const[r,i]=fU(e,t),s=Rr.decode(i);return s._baseCache.set(r,e),s}}const fU=(n,e)=>{switch(n[0]){case"Q":return[Ci.prefix,(e||Ci).decode(`${Ci.prefix}${n}`)];case Ci.prefix:return[Ci.prefix,(e||Ci).decode(n)];case Ro.prefix:return[Ro.prefix,(e||Ro).decode(n)];default:if(null==e)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[n[0],e.decode(n)]}},dU=(n,e,t)=>{const{prefix:r}=t;if(r!==Ci.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);const i=e.get(r);if(null==i){const s=t.encode(n).slice(1);return e.set(r,s),s}return i},hU=(n,e,t)=>{const{prefix:r}=t,i=e.get(r);if(null==i){const s=t.encode(n);return e.set(r,s),s}return i},Xl=112,pU=18,b2=(n,e,t)=>{const r=Fh(n),i=r+Fh(e),s=new Uint8Array(i+t.byteLength);return Bh(n,s,0),Bh(e,s,r),s.set(t,i),s},_2=Symbol.for("@ipld/js-cid/CID"),Vh={writable:!1,configurable:!1,enumerable:!0},Hh={writable:!1,enumerable:!1,configurable:!1},yU=(n,e)=>{if(!n.test("0.0.0-dev"))throw new Error(e);console.warn(e)},mU="CID.isCID(v) is deprecated and will be removed in the next major release.\nFollowing code pattern:\n\nif (CID.isCID(value)) {\n doSomethingWithCID(value)\n}\n\nIs replaced with:\n\nconst cid = CID.asCID(value)\nif (cid) {\n // Make sure to use cid instead of value\n doSomethingWithCID(cid)\n}\n",Jl={...h,...u,...g,...b,...w,...v,...l,...p,...d,..._};function D2(n,e,t,r){return{name:n,prefix:e,encoder:{name:n,prefix:e,encode:t},decoder:{decode:r}}}const S2=D2("utf8","u",n=>"u"+new TextDecoder("utf8").decode(n),n=>(new TextEncoder).encode(n.substring(1))),xm=D2("ascii","a",n=>{let e="a";for(let t=0;t{const e=xo((n=n.substring(1)).length);for(let t=0;te)throw new Error("byte array longer than desired length");t=or([new Uint8Array(e-t.length),t])}return Mt(t,"base64url")}function Os(n){const e=function bU(n,e){let t=_t(n,"base64urlpad");if(null!=e){if(t.length>e)throw new Error("byte array longer than desired length");t=or([new Uint8Array(e-t.length),t])}return t}(n);return new Gn.jsbn.BigInteger(Mt(e,"base16"),16)}N(730);function R2(n){const e=n?.algorithm??"AES-GCM";let t=n?.keyLength??16;const r=n?.nonceLength??12,i=n?.digest??"SHA-256",s=n?.saltLength??16,o=n?.iterations??32767,a=no.get();function m(){return(m=V(function*(U,Q){const X=a.getRandomValues(new Uint8Array(s)),ae=a.getRandomValues(new Uint8Array(r)),he={name:e,iv:ae};"string"==typeof Q&&(Q=_t(Q));const Ae={name:"PBKDF2",salt:X,iterations:o,hash:{name:i}},ue=yield a.subtle.importKey("raw",Q,{name:"PBKDF2"},!1,["deriveKey","deriveBits"]),Re=yield a.subtle.deriveKey(Ae,ue,{name:e,length:t},!0,["encrypt"]),Le=yield a.subtle.encrypt(he,Re,U);return or([X,he.iv,new Uint8Array(Le)])})).apply(this,arguments)}function R(){return(R=V(function*(U,Q){const X=U.slice(0,s),ae=U.slice(s,s+r),he=U.slice(s+r),Ae={name:e,iv:ae};"string"==typeof Q&&(Q=_t(Q));const ue={name:"PBKDF2",salt:X,iterations:o,hash:{name:i}},Re=yield a.subtle.importKey("raw",Q,{name:"PBKDF2"},!1,["deriveKey","deriveBits"]),Le=yield a.subtle.deriveKey(ue,Re,{name:e,length:t},!0,["decrypt"]),Fe=yield a.subtle.decrypt(Ae,Le,he);return new Uint8Array(Fe)})).apply(this,arguments)}return t*=8,{encrypt:function c(U,Q){return m.apply(this,arguments)},decrypt:function T(U,Q){return R.apply(this,arguments)}}}function SU(n,e){return Om.apply(this,arguments)}function Om(){return(Om=V(function*(n,e){const t=Lh.decode(n);return yield R2().decrypt(t,e)})).apply(this,arguments)}Object.keys({"P-256":256,"P-384":384,"P-521":521}).join(" / "),N(8985);var IU=N(5856),CU=N.t(IU,2);const gn=BigInt(0),Un=BigInt(1),br=BigInt(2),ef=BigInt(3),TU=BigInt(8),Lm=br**BigInt(256),Sn={a:gn,b:BigInt(7),P:Lm-br**BigInt(32)-BigInt(977),n:Lm-BigInt("432420386565659656852420866394968145599"),h:Un,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee")};function P2(n){const{a:e,b:t}=Sn,r=it(n*n),i=it(r*n);return it(i+e*n+t)}const Kh=Sn.a===gn;class Bn{constructor(e,t,r){this.x=e,this.y=t,this.z=r}static fromAffine(e){if(!(e instanceof dn))throw new TypeError("JacobianPoint#fromAffine: expected Point");return new Bn(e.x,e.y,Un)}static toAffineBatch(e){const t=function PU(n,e=Sn.P){const t=new Array(n.length),i=Eu(n.reduce((s,o,a)=>o===gn?s:(t[a]=s,it(s*o,e)),Un),e);return n.reduceRight((s,o,a)=>o===gn?s:(t[a]=it(s*t[a],e),it(s*o,e)),i),t}(e.map(r=>r.z));return e.map((r,i)=>r.toAffine(t[i]))}static normalizeZ(e){return Bn.toAffineBatch(e).map(Bn.fromAffine)}equals(e){if(!(e instanceof Bn))throw new TypeError("JacobianPoint expected");const{x:t,y:r,z:i}=this,{x:s,y:o,z:a}=e,c=it(i**br),m=it(a**br),T=it(t*m),R=it(s*c),k=it(it(r*a)*m),U=it(it(o*i)*c);return T===R&&k===U}negate(){return new Bn(this.x,it(-this.y),this.z)}double(){const{x:e,y:t,z:r}=this,i=it(e**br),s=it(t**br),o=it(s**br),a=it(br*(it((e+s)**br)-i-o)),c=it(ef*i),m=it(c**br),T=it(m-br*a),R=it(c*(a-T)-TU*o),k=it(br*t*r);return new Bn(T,R,k)}add(e){if(!(e instanceof Bn))throw new TypeError("JacobianPoint expected");const{x:t,y:r,z:i}=this,{x:s,y:o,z:a}=e;if(s===gn||o===gn)return this;if(t===gn||r===gn)return e;const c=it(i**br),m=it(a**br),T=it(t*m),R=it(s*c),k=it(it(r*a)*m),U=it(it(o*i)*c),Q=it(R-T),X=it(U-k);if(Q===gn)return X===gn?this.double():Bn.ZERO;const ae=it(Q**br),he=it(Q*ae),Ae=it(T*ae),ue=it(X**br-he-br*Ae),Re=it(X*(Ae-ue)-k*he),Le=it(i*a*Q);return new Bn(ue,Re,Le)}subtract(e){return this.add(e.negate())}multiplyUnsafe(e){const t=Bn.ZERO;if("bigint"==typeof e&&e===gn)return t;let r=O2(e);if(r===Un)return this;if(!Kh){let R=t,k=this;for(;r>gn;)r&Un&&(R=R.add(k)),k=k.double(),r>>=Un;return R}let{k1neg:i,k1:s,k2neg:o,k2:a}=k2(r),c=t,m=t,T=this;for(;s>gn||a>gn;)s&Un&&(c=c.add(T)),a&Un&&(m=m.add(T)),T=T.double(),s>>=Un,a>>=Un;return i&&(c=c.negate()),o&&(m=m.negate()),m=new Bn(it(m.x*Sn.beta),m.y,m.z),c.add(m)}precomputeWindow(e){const t=Kh?128/e+1:256/e+1,r=[];let i=this,s=i;for(let o=0;o>=R,Q>c&&(Q-=T,e+=Un),0===Q){let X=i[U];k%2&&(X=X.negate()),o=o.add(X)}else{let X=i[U+Math.abs(Q)-1];Q<0&&(X=X.negate()),s=s.add(X)}}return{p:s,f:o}}multiply(e,t){let i,s,r=O2(e);if(Kh){const{k1neg:o,k1:a,k2neg:c,k2:m}=k2(r);let{p:T,f:R}=this.wNAF(a,t),{p:k,f:U}=this.wNAF(m,t);o&&(T=T.negate()),c&&(k=k.negate()),k=new Bn(it(k.x*Sn.beta),k.y,k.z),i=T.add(k),s=R.add(U)}else{const{p:o,f:a}=this.wNAF(r,t);i=o,s=a}return Bn.normalizeZ([i,s])[0]}toAffine(e=Eu(this.z)){const{x:t,y:r,z:i}=this,s=e,o=it(s*s),a=it(o*s),c=it(t*o),m=it(r*a);if(it(i*s)!==Un)throw new Error("invZ was invalid");return new dn(c,m)}}Bn.BASE=new Bn(Sn.Gx,Sn.Gy,Un),Bn.ZERO=new Bn(gn,Un,gn);const km=new WeakMap;class dn{constructor(e,t){this.x=e,this.y=t}_setWindowSize(e){this._WINDOW_SIZE=e,km.delete(this)}static fromCompressedHex(e){const t=32===e.length,r=Ti(t?e:e.subarray(1));if(!Gh(r))throw new Error("Point is not on curve");let s=function RU(n){const{P:e}=Sn,t=BigInt(6),r=BigInt(11),i=BigInt(22),s=BigInt(23),o=BigInt(44),a=BigInt(88),c=n*n*n%e,m=c*c*n%e,T=fs(m,ef)*m%e,R=fs(T,ef)*m%e,k=fs(R,br)*c%e,U=fs(k,r)*k%e,Q=fs(U,i)*U%e,X=fs(Q,o)*Q%e,ae=fs(X,a)*X%e,he=fs(ae,o)*Q%e,Ae=fs(he,ef)*m%e,ue=fs(Ae,s)*U%e,Re=fs(ue,t)*c%e;return fs(Re,br)}(P2(r));const o=(s&Un)===Un;t?o&&(s=it(-s)):1==(1&e[0])!==o&&(s=it(-s));const a=new dn(r,s);return a.assertValidity(),a}static fromUncompressedHex(e){const t=Ti(e.subarray(1,33)),r=Ti(e.subarray(33,65)),i=new dn(t,r);return i.assertValidity(),i}static fromHex(e){const t=Ls(e),r=t.length,i=t[0];if(32===r||33===r&&(2===i||3===i))return this.fromCompressedHex(t);if(65===r&&4===i)return this.fromUncompressedHex(t);throw new Error(`Point.fromHex: received invalid point. Expected 32-33 compressed bytes or 65 uncompressed bytes, not ${r}`)}static fromPrivateKey(e){return dn.BASE.multiply(io(e))}static fromSignature(e,t,r){const i=B2(e=Ls(e)),{r:s,s:o}=V2(t);if(0!==r&&1!==r)throw new Error("Cannot recover signature: invalid recovery bit");const c=dn.fromHex((1&r?"03":"02")+No(s)),{n:m}=Sn,T=Eu(s,m),R=it(-i*T,m),k=it(o*T,m),U=dn.BASE.multiplyAndAddUnsafe(c,R,k);if(!U)throw new Error("Cannot recover signature: point at infinify");return U.assertValidity(),U}toRawBytes(e=!1){return Mo(this.toHex(e))}toHex(e=!1){const t=No(this.x);return e?`${this.y&Un?"03":"02"}${t}`:`04${t}${No(this.y)}`}toHexX(){return this.toHex(!0).slice(2)}toRawX(){return this.toRawBytes(!0).slice(1)}assertValidity(){const e="Point is not on elliptic curve",{x:t,y:r}=this;if(!Gh(t)||!Gh(r))throw new Error(e);const i=it(r*r);if(it(i-P2(t))!==gn)throw new Error(e)}equals(e){return this.x===e.x&&this.y===e.y}negate(){return new dn(this.x,it(-this.y))}double(){return Bn.fromAffine(this).double().toAffine()}add(e){return Bn.fromAffine(this).add(Bn.fromAffine(e)).toAffine()}subtract(e){return this.add(e.negate())}multiply(e){return Bn.fromAffine(this).multiply(e,this).toAffine()}multiplyAndAddUnsafe(e,t,r){const i=Bn.fromAffine(this),s=t===gn||t===Un||this!==dn.BASE?i.multiplyUnsafe(t):i.multiply(t),o=Bn.fromAffine(e).multiplyUnsafe(r),a=s.add(o);return a.equals(Bn.ZERO)?void 0:a.toAffine()}}function N2(n){return Number.parseInt(n[0],16)>=8?"00"+n:n}function M2(n){if(n.length<2||2!==n[0])throw new Error(`Invalid signature integer tag: ${mu(n)}`);const e=n[1],t=n.subarray(2,e+2);if(!e||t.length!==e)throw new Error("Invalid signature integer: wrong length");if(0===t[0]&&t[1]<=127)throw new Error("Invalid signature integer: trailing length");return{data:Ti(t),left:n.subarray(e+2)}}dn.BASE=new dn(Sn.Gx,Sn.Gy),dn.ZERO=new dn(gn,gn);class Po{constructor(e,t){this.r=e,this.s=t,this.assertValidity()}static fromCompact(e){const t=tf(e),r="Signature.fromCompact";if("string"!=typeof e&&!t)throw new TypeError(`${r}: Expected string or Uint8Array`);const i=t?mu(e):e;if(128!==i.length)throw new Error(`${r}: Expected 64-byte hex`);return new Po(jh(i.slice(0,64)),jh(i.slice(64,128)))}static fromDER(e){const t=tf(e);if("string"!=typeof e&&!t)throw new TypeError("Signature.fromDER: Expected string or Uint8Array");const{r,s:i}=function AU(n){if(n.length<2||48!=n[0])throw new Error(`Invalid signature tag: ${mu(n)}`);if(n[1]!==n.length-2)throw new Error("Invalid signature: incorrect length");const{data:e,left:t}=M2(n.subarray(2)),{data:r,left:i}=M2(t);if(i.length)throw new Error(`Invalid signature: left bytes after parsing: ${mu(i)}`);return{r:e,s:r}}(t?e:Mo(e));return new Po(r,i)}static fromHex(e){return this.fromDER(e)}assertValidity(){const{r:e,s:t}=this;if(!wu(e))throw new Error("Invalid Signature: r must be 0 < r < n");if(!wu(t))throw new Error("Invalid Signature: s must be 0 < s < n")}hasHighS(){return this.s>Sn.n>>Un}normalizeS(){return this.hasHighS()?new Po(this.r,Sn.n-this.s):this}toDERRawBytes(e=!1){return Mo(this.toDERHex(e))}toDERHex(e=!1){const t=N2(nf(this.s));if(e)return t;const r=N2(nf(this.r)),i=nf(r.length/2),s=nf(t.length/2);return`30${nf(r.length/2+t.length/2+4)}02${i}${r}02${s}${t}`}toRawBytes(){return this.toDERRawBytes()}toHex(){return this.toDERHex()}toCompactRawBytes(){return Mo(this.toCompactHex())}toCompactHex(){return No(this.r)+No(this.s)}}function yu(...n){if(!n.every(tf))throw new Error("Uint8Array list expected");if(1===n.length)return n[0];const e=n.reduce((r,i)=>r+i.length,0),t=new Uint8Array(e);for(let r=0,i=0;re.toString(16).padStart(2,"0"));function mu(n){if(!(n instanceof Uint8Array))throw new Error("Expected Uint8Array");let e="";for(let t=0;tLm)throw new Error("Expected number < 2^256");return n.toString(16).padStart(64,"0")}function vu(n){return Mo(No(n))}function nf(n){const e=n.toString(16);return 1&e.length?`0${e}`:e}function jh(n){if("string"!=typeof n)throw new TypeError("hexToNumber: expected string, got "+typeof n);return BigInt(`0x${n}`)}function Mo(n){if("string"!=typeof n)throw new TypeError("hexToBytes: expected string, got "+typeof n);if(n.length%2)throw new Error("hexToBytes: received invalid unpadded hex"+n.length);const e=new Uint8Array(n.length/2);for(let t=0;t0)return BigInt(n);if("bigint"==typeof n&&wu(n))return n;throw new TypeError("Expected valid private scalar: 0 < scalar < curve.n")}function it(n,e=Sn.P){const t=n%e;return t>=gn?t:e+t}function fs(n,e){const{P:t}=Sn;let r=n;for(;e-- >gn;)r*=r,r%=t;return r}function Eu(n,e=Sn.P){if(n===gn||e<=gn)throw new Error(`invert: expected positive integers, got n=${n} mod=${e}`);let t=it(n,e),r=e,i=gn,s=Un,o=Un,a=gn;for(;t!==gn;){const m=r/t,T=r%t,R=i-o*m,k=s-a*m;r=t,t=T,i=o,s=a,o=R,a=k}if(r!==Un)throw new Error("invert: does not exist");return it(i,e)}const L2=(n,e)=>(n+e/br)/e,$h=br**BigInt(128);function k2(n){const{n:e}=Sn,t=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Un*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=t,o=L2(s*n,e),a=L2(-r*n,e);let c=it(n-o*t-a*i,e),m=it(-o*r-a*s,e);const T=c>$h,R=m>$h;if(T&&(c=e-c),R&&(m=e-m),c>$h||m>$h)throw new Error("splitScalarEndo: Endomorphism failed, k="+n);return{k1neg:T,k1:c,k2neg:R,k2:m}}function B2(n){const{n:e}=Sn,r=8*n.length-256;let i=Ti(n);return r>0&&(i>>=BigInt(r)),i>=e&&(i-=e),i}class F2{constructor(){this.v=new Uint8Array(32).fill(1),this.k=new Uint8Array(32).fill(0),this.counter=0}hmac(...e){return er.hmacSha256(this.k,...e)}hmacSync(...e){if("function"!=typeof er.hmacSha256Sync)throw new Error("utils.hmacSha256Sync is undefined, you need to set it");const t=er.hmacSha256Sync(this.k,...e);if(t instanceof Promise)throw new Error("To use sync sign(), ensure utils.hmacSha256 is sync");return t}incr(){if(this.counter>=1e3)throw new Error("Tried 1,000 k values for sign(), all were invalid");this.counter+=1}reseed(e=new Uint8Array){var t=this;return V(function*(){t.k=yield t.hmac(t.v,Uint8Array.from([0]),e),t.v=yield t.hmac(t.v),0!==e.length&&(t.k=yield t.hmac(t.v,Uint8Array.from([1]),e),t.v=yield t.hmac(t.v))})()}reseedSync(e=new Uint8Array){this.k=this.hmacSync(this.v,Uint8Array.from([0]),e),this.v=this.hmacSync(this.v),0!==e.length&&(this.k=this.hmacSync(this.v,Uint8Array.from([1]),e),this.v=this.hmacSync(this.v))}generate(){var e=this;return V(function*(){return e.incr(),e.v=yield e.hmac(e.v),e.v})()}generateSync(){return this.incr(),this.v=this.hmacSync(this.v),this.v}}function wu(n){return gn0)e=BigInt(n);else if("string"==typeof n){if(64!==n.length)throw new Error("Expected 32 bytes of private key");e=jh(n)}else{if(!tf(n))throw new TypeError("Expected valid private key");if(32!==n.length)throw new Error("Expected 32 bytes of private key");e=Ti(n)}if(!wu(e))throw new Error("Expected private key: 0 < key < n");return e}function Bm(n){return n instanceof dn?(n.assertValidity(),n):dn.fromHex(n)}function V2(n){if(n instanceof Po)return n.assertValidity(),n;try{return Po.fromDER(n)}catch{return Po.fromCompact(n)}}function rf(n,e=!1){return dn.fromPrivateKey(n).toRawBytes(e)}function H2(n){const e=tf(n),t="string"==typeof n,r=(e||t)&&n.length;return e?33===r||65===r:t?66===r||130===r:n instanceof dn}function K2(n){return Ti(n.length>32?n.slice(0,32):n)}function OU(n){const e=K2(n),t=it(e,Sn.n);return j2(tvu(it(io(n)+io(e),Sn.n)),privateNegate:n=>{const e=io(n);return vu(Sn.n-e)},pointAddScalar:(n,e,t)=>{const r=dn.fromHex(n),i=io(e),s=dn.BASE.multiplyAndAddUnsafe(r,i,Un);if(!s)throw new Error("Tweaked point at infinity");return s.toRawBytes(t)},pointMultiply:(n,e,t)=>{const r=dn.fromHex(n),i=Ti(Ls(e));return r.multiply(i).toRawBytes(t)},hashToPrivateKey:n=>{if((n=Ls(n)).length<40||n.length>1024)throw new Error("Expected 40-1024 bytes of private key as per FIPS 186");return vu(it(Ti(n),Sn.n-Un)+Un)},randomBytes:(n=32)=>{if(Qi.web)return Qi.web.getRandomValues(new Uint8Array(n));if(Qi.node){const{randomBytes:e}=Qi.node;return Uint8Array.from(e(n))}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>er.hashToPrivateKey(er.randomBytes(40)),bytesToHex:mu,hexToBytes:Mo,concatBytes:yu,mod:it,invert:Eu,sha256:(n=V(function*(...e){if(Qi.web){const t=yield Qi.web.subtle.digest("SHA-256",yu(...e));return new Uint8Array(t)}if(Qi.node){const{createHash:t}=Qi.node,r=t("sha256");return e.forEach(i=>r.update(i)),Uint8Array.from(r.digest())}throw new Error("The environment doesn't have sha256 function")}),function(){return n.apply(this,arguments)}),hmacSha256:function(){var n=V(function*(e,...t){if(Qi.web){const r=yield Qi.web.subtle.importKey("raw",e,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),i=yu(...t),s=yield Qi.web.subtle.sign("HMAC",r,i);return new Uint8Array(s)}if(Qi.node){const{createHmac:r}=Qi.node,i=r("sha256",e);return t.forEach(s=>i.update(s)),Uint8Array.from(i.digest())}throw new Error("The environment doesn't have hmac-sha256 function")});return function(t){return n.apply(this,arguments)}}(),sha256Sync:void 0,hmacSha256Sync:void 0,taggedHash:function(){var n=V(function*(e,...t){let r=Wh[e];if(void 0===r){const i=yield er.sha256(Uint8Array.from(e,s=>s.charCodeAt(0)));r=yu(i,i),Wh[e]=r}return er.sha256(r,...t)});return function(t){return n.apply(this,arguments)}}(),taggedHashSync:(n,...e)=>{if("function"!=typeof er.sha256Sync)throw new Error("utils.sha256Sync is undefined, you need to set it");let t=Wh[n];if(void 0===t){const r=er.sha256Sync(Uint8Array.from(n,i=>i.charCodeAt(0)));t=yu(r,r),Wh[n]=t}return er.sha256Sync(t,...e)},precompute(n=8,e=dn.BASE){const t=e===dn.BASE?e:new dn(e.x,e.y);return t._setWindowSize(n),t.multiply(ef),t}};var n;function sf(n){if(isNaN(n)||n<=0)throw se(new Error("random bytes length must be a Number bigger than 0"),"ERR_INVALID_LENGTH");return er.randomBytes(n)}function VU(n){const e=Gn.asn1.fromDer(Mt(n,"ascii")),t=Gn.pki.privateKeyFromAsn1(e);return{kty:"RSA",n:ro(t.n),e:ro(t.e),d:ro(t.d),p:ro(t.p),q:ro(t.q),dp:ro(t.dP),dq:ro(t.dQ),qi:ro(t.qInv),alg:"RS256"}}function tT(n,e){return e.map(t=>Os(n[t]))}function zU(n){return Km.apply(this,arguments)}function Km(){return Km=V(function*(n){const e=yield no.get().subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:n,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"]),t=yield rT(e);return{privateKey:t[0],publicKey:t[1]}}),Km.apply(this,arguments)}function nT(n){return jm.apply(this,arguments)}function jm(){return jm=V(function*(n){const t=[yield no.get().subtle.importKey("jwk",n,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]),yield QU(n)],r=yield rT({privateKey:t[0],publicKey:t[1]});return{privateKey:r[0],publicKey:r[1]}}),jm.apply(this,arguments)}function $m(){return $m=V(function*(n,e){const t=yield no.get().subtle.importKey("jwk",n,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]),r=yield no.get().subtle.sign({name:"RSASSA-PKCS1-v1_5"},t,Uint8Array.from(e));return new Uint8Array(r,0,r.byteLength)}),$m.apply(this,arguments)}function Gm(){return Gm=V(function*(n,e,t){const r=yield no.get().subtle.importKey("jwk",n,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]);return yield no.get().subtle.verify({name:"RSASSA-PKCS1-v1_5"},r,e,t)}),Gm.apply(this,arguments)}function rT(n){return zm.apply(this,arguments)}function zm(){return zm=V(function*(n){if(null==n.privateKey||null==n.publicKey)throw se(new Error("Private and public key are required"),"ERR_INVALID_PARAMETERS");return yield Promise.all([no.get().subtle.exportKey("jwk",n.privateKey),no.get().subtle.exportKey("jwk",n.publicKey)])}),zm.apply(this,arguments)}function QU(n){return Wm.apply(this,arguments)}function Wm(){return Wm=V(function*(n){return yield no.get().subtle.importKey("jwk",{kty:n.kty,n:n.n,e:n.e},{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["verify"])}),Wm.apply(this,arguments)}function iT(n,e,t,r){const i=e?function GU(n){return Gn.pki.setRsaPublicKey(...tT(n,["n","e"]))}(n):function $U(n){return Gn.pki.setRsaPrivateKey(...tT(n,["n","e","d","p","q","dp","dq","qi"]))}(n);return _t(r(Mt(Uint8Array.from(t),"ascii"),i),"ascii")}function qm(n,e){return Qm.apply(this,arguments)}function Qm(){return Qm=V(function*(n,e){const r=yield R2().encrypt(n,e);return Lh.encode(r)}),Qm.apply(this,arguments)}N(5517);class Ym{constructor(e){this._key=e}verify(e,t){var r=this;return V(function*(){return yield function qU(n,e,t){return Gm.apply(this,arguments)}(r._key,t,e)})()}marshal(){return function jU(n){if(null==n.n||null==n.e)throw se(new Error("JWK was missing components"),"ERR_INVALID_PARAMETERS");const e=Gn.pki.publicKeyToAsn1({n:Os(n.n),e:Os(n.e)});return _t(Gn.asn1.toDer(e).getBytes(),"ascii")}(this._key)}get bytes(){return fu.encode({Type:dr.RSA,Data:this.marshal()}).subarray()}encrypt(e){return function YU(n,e){return iT(n,!0,e,(t,r)=>r.encrypt(t))}(this._key,e)}equals(e){return $r(this.bytes,e.bytes)}hash(){var e=this;return V(function*(){const{bytes:t}=yield Li.digest(e.bytes);return t})()}}class qh{constructor(e,t){this._key=e,this._publicKey=t}genSecret(){return sf(16)}sign(e){var t=this;return V(function*(){return yield function WU(n,e){return $m.apply(this,arguments)}(t._key,e)})()}get public(){if(null==this._publicKey)throw se(new Error("public key not provided"),"ERR_PUBKEY_NOT_PROVIDED");return new Ym(this._publicKey)}decrypt(e){return function ZU(n,e){return iT(n,!1,e,(t,r)=>r.decrypt(t))}(this._key,e)}marshal(){return function HU(n){if(null==n.n||null==n.e||null==n.d||null==n.p||null==n.q||null==n.dp||null==n.dq||null==n.qi)throw se(new Error("JWK was missing components"),"ERR_INVALID_PARAMETERS");const e=Gn.pki.privateKeyToAsn1({n:Os(n.n),e:Os(n.e),d:Os(n.d),p:Os(n.p),q:Os(n.q),dP:Os(n.dp),dQ:Os(n.dq),qInv:Os(n.qi)});return _t(Gn.asn1.toDer(e).getBytes(),"ascii")}(this._key)}get bytes(){return du.encode({Type:dr.RSA,Data:this.marshal()}).subarray()}equals(e){return $r(this.bytes,e.bytes)}hash(){var e=this;return V(function*(){const{bytes:t}=yield Li.digest(e.bytes);return t})()}id(){var e=this;return V(function*(){return Mt(yield e.public.hash(),"base58btc")})()}export(e,t="pkcs-8"){var r=this;return V(function*(){if("pkcs-8"===t){const i=new Gn.util.ByteBuffer(r.marshal()),s=Gn.asn1.fromDer(i),o=Gn.pki.privateKeyFromAsn1(s);return Gn.pki.encryptRsaPrivateKey(o,e,{algorithm:"aes256",count:1e4,saltSize:16,prfAlgorithm:"sha512"})}if("libp2p-key"===t)return yield qm(r.bytes,e);throw se(new Error(`export format '${t}' is not supported`),"ERR_INVALID_EXPORT_FORMAT")})()}}function XU(n){return Zm.apply(this,arguments)}function Zm(){return Zm=V(function*(n){const e=VU(n),t=yield nT(e);return new qh(t.privateKey,t.publicKey)}),Zm.apply(this,arguments)}function JU(n){const e=function KU(n){const e=Gn.asn1.fromDer(Mt(n,"ascii")),t=Gn.pki.publicKeyFromAsn1(e);return{kty:"RSA",n:ro(t.n),e:ro(t.e)}}(n);return new Ym(e)}function eV(n){return Xm.apply(this,arguments)}function Xm(){return Xm=V(function*(n){const e=yield nT(n);return new qh(e.privateKey,e.publicKey)}),Xm.apply(this,arguments)}function tV(n){return Jm.apply(this,arguments)}function Jm(){return Jm=V(function*(n){const e=yield zU(n);return new qh(e.privateKey,e.publicKey)}),Jm.apply(this,arguments)}var nV=N(7420),rV=N.t(nV,2);const mr=BigInt(0),nn=BigInt(1),Yr=BigInt(2),sT=BigInt(255),oT=Yr**BigInt(252)+BigInt("27742317777372353535851937790883648493"),zn=Object.freeze({a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),P:Yr**sT-BigInt(19),l:oT,n:oT,h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960")}),aT=Yr**BigInt(256),of=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),iV=(BigInt("6853475219497561581579357271197624642482790079785650197046958215289687604742"),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235")),sV=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),oV=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),aV=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952");class In{constructor(e,t,r,i){this.x=e,this.y=t,this.z=r,this.t=i}static fromAffine(e){if(!(e instanceof hr))throw new TypeError("ExtendedPoint#fromAffine: expected Point");return e.equals(hr.ZERO)?In.ZERO:new In(e.x,e.y,nn,Me(e.x*e.y))}static toAffineBatch(e){const t=function uV(n,e=zn.P){const t=new Array(n.length),i=Qh(n.reduce((s,o,a)=>o===mr?s:(t[a]=s,Me(s*o,e)),nn),e);return n.reduceRight((s,o,a)=>o===mr?s:(t[a]=Me(s*t[a],e),Me(s*o,e)),i),t}(e.map(r=>r.z));return e.map((r,i)=>r.toAffine(t[i]))}static normalizeZ(e){return this.toAffineBatch(e).map(this.fromAffine)}equals(e){cT(e);const{x:t,y:r,z:i}=this,{x:s,y:o,z:a}=e,c=Me(t*a),m=Me(s*i),T=Me(r*a),R=Me(o*i);return c===m&&T===R}negate(){return new In(Me(-this.x),this.y,this.z,Me(-this.t))}double(){const{x:e,y:t,z:r}=this,{a:i}=zn,s=Me(e**Yr),o=Me(t**Yr),a=Me(Yr*Me(r**Yr)),c=Me(i*s),m=Me(Me((e+t)**Yr)-s-o),T=c+o,R=T-a,k=c-o,U=Me(m*R),Q=Me(T*k),X=Me(m*k),ae=Me(R*T);return new In(U,Q,ae,X)}add(e){cT(e);const{x:t,y:r,z:i,t:s}=this,{x:o,y:a,z:c,t:m}=e,T=Me((r-t)*(a+o)),R=Me((r+t)*(a-o)),k=Me(R-T);if(k===mr)return this.double();const U=Me(i*Yr*m),Q=Me(s*Yr*c),X=Q+U,ae=R+T,he=Q-U,Ae=Me(X*k),ue=Me(ae*he),Re=Me(X*he),Le=Me(k*ae);return new In(Ae,ue,Le,Re)}subtract(e){return this.add(e.negate())}precomputeWindow(e){const t=1+256/e,r=[];let i=this,s=i;for(let o=0;o>=R,Q>c&&(Q-=T,e+=nn),0===Q){let X=i[U];k%2&&(X=X.negate()),o=o.add(X)}else{let X=i[U+Math.abs(Q)-1];Q<0&&(X=X.negate()),s=s.add(X)}}return In.normalizeZ([s,o])[0]}multiply(e,t){return this.wNAF(Iu(e,zn.l),t)}multiplyUnsafe(e){let t=Iu(e,zn.l,!1);const r=In.BASE,i=In.ZERO;if(t===mr)return i;if(this.equals(i)||t===nn)return this;if(this.equals(r))return this.wNAF(t);let s=i,o=this;for(;t>mr;)t&nn&&(s=s.add(o)),o=o.double(),t>>=nn;return s}isSmallOrder(){return this.multiplyUnsafe(zn.h).equals(In.ZERO)}isTorsionFree(){return this.multiplyUnsafe(zn.l).equals(In.ZERO)}toAffine(e=Qh(this.z)){const{x:t,y:r,z:i}=this,s=Me(t*e),o=Me(r*e);if(Me(i*e)!==nn)throw new Error("invZ was invalid");return new hr(s,o)}fromRistrettoBytes(){tv()}toRistrettoBytes(){tv()}fromRistrettoHash(){tv()}}function cT(n){if(!(n instanceof In))throw new TypeError("ExtendedPoint expected")}function ev(n){if(!(n instanceof ds))throw new TypeError("RistrettoPoint expected")}function tv(){throw new Error("Legacy method: switch to RistrettoPoint")}In.BASE=new In(zn.Gx,zn.Gy,nn,Me(zn.Gx*zn.Gy)),In.ZERO=new In(mr,nn,nn,mr);class ds{constructor(e){this.ep=e}static calcElligatorRistrettoMap(e){const{d:t}=zn,r=Me(of*e*e),i=Me((r+nn)*oV);let s=BigInt(-1);const o=Me((s-t*r)*Me(r+t));let{isValid:a,value:c}=sv(i,o),m=Me(c*e);fa(m)||(m=Me(-m)),a||(c=m),a||(s=r);const T=Me(s*(r-nn)*aV-o),R=c*c,k=Me((c+c)*o),U=Me(T*iV),Q=Me(nn-R),X=Me(nn+R);return new In(Me(k*X),Me(Q*U),Me(U*X),Me(k*Q))}static hashToCurve(e){const t=iv((e=Bs(e,64)).slice(0,32)),r=this.calcElligatorRistrettoMap(t),i=iv(e.slice(32,64)),s=this.calcElligatorRistrettoMap(i);return new ds(r.add(s))}static fromHex(e){e=Bs(e,32);const{a:t,d:r}=zn,i="RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint",s=iv(e);if(!function lV(n,e){if(n.length!==e.length)return!1;for(let t=0;t=i)throw new Error("Expected 0 < hex < P");if(!t&&o>=aT)throw new Error("Expected 0 < hex < 2**256");const a=Me(o*o),c=Me(a-nn),m=Me(r*a+nn);let{isValid:T,value:R}=sv(c,m);if(!T)throw new Error("Point.fromHex: invalid y coordinate");return 0!=(128&e[31])!=((R&nn)===nn)&&(R=Me(-R)),new hr(R,o)}static fromPrivateKey(e){return V(function*(){return(yield uf(e)).point})()}toRawBytes(){const e=Du(this.y);return e[31]|=this.x&nn?128:0,e}toHex(){return af(this.toRawBytes())}toX25519(){const{y:e}=this;return Du(Me((nn+e)*Qh(nn-e)))}isTorsionFree(){return In.fromAffine(this).isTorsionFree()}equals(e){return this.x===e.x&&this.y===e.y}negate(){return new hr(Me(-this.x),this.y)}add(e){return In.fromAffine(this).add(In.fromAffine(e)).toAffine()}subtract(e){return this.add(e.negate())}multiply(e){return In.fromAffine(this).multiply(e,this).toAffine()}}hr.BASE=new hr(zn.Gx,zn.Gy),hr.ZERO=new hr(mr,nn);class _u{constructor(e,t){this.r=e,this.s=t,this.assertValidity()}static fromHex(e){const t=Bs(e,64),r=hr.fromHex(t.slice(0,32),!1),i=Qa(t.slice(32,64));return new _u(r,i)}assertValidity(){const{r:e,s:t}=this;if(!(e instanceof hr))throw new Error("Expected Point instance");return Iu(t,zn.l,!1),this}toRawBytes(){const e=new Uint8Array(64);return e.set(this.r.toRawBytes()),e.set(Du(this.s),32),e}toHex(){return af(this.toRawBytes())}}function uT(...n){if(!n.every(r=>r instanceof Uint8Array))throw new Error("Expected Uint8Array list");if(1===n.length)return n[0];const e=n.reduce((r,i)=>r+i.length,0),t=new Uint8Array(e);for(let r=0,i=0;re.toString(16).padStart(2,"0"));function af(n){if(!(n instanceof Uint8Array))throw new Error("Uint8Array expected");let e="";for(let t=0;t=mr?t:e+t}function Qh(n,e=zn.P){if(n===mr||e<=mr)throw new Error(`invert: expected positive integers, got n=${n} mod=${e}`);let t=Me(n,e),r=e,i=mr,s=nn,o=nn,a=mr;for(;t!==mr;){const m=r/t,T=r%t,R=i-o*m,k=s-a*m;r=t,t=T,i=o,s=a,o=R,a=k}if(r!==nn)throw new Error("invert: does not exist");return Me(i,e)}function ks(n,e){const{P:t}=zn;let r=n;for(;e-- >mr;)r*=r,r%=t;return r}function sv(n,e){const t=Me(e*e*e),r=Me(t*t*e);let s=Me(n*t*function fT(n){const{P:e}=zn,t=BigInt(5),r=BigInt(10),i=BigInt(20),s=BigInt(40),o=BigInt(80),c=n*n%e*n%e,m=ks(c,Yr)*c%e,T=ks(m,nn)*n%e,R=ks(T,t)*T%e,k=ks(R,r)*R%e,U=ks(k,i)*k%e,Q=ks(U,s)*U%e,X=ks(Q,o)*Q%e,ae=ks(X,o)*Q%e,he=ks(ae,r)*R%e;return{pow_p_5_8:ks(he,Yr)*n%e,b2:c}}(n*r).pow_p_5_8);const o=Me(e*s*s),a=s,c=Me(s*of),m=o===n,T=o===Me(-n),R=o===Me(-n*of);return m&&(s=a),(T||R)&&(s=c),fa(s)&&(s=Me(-s)),{isValid:m||T,value:s}}function dT(n){return sv(nn,n)}function Su(n){return Me(Qa(n),zn.l)}function Bs(n,e){const t=n instanceof Uint8Array?Uint8Array.from(n):rv(n);if("number"==typeof e&&t.length!==e)throw new Error(`Expected ${e} bytes`);return t}function Iu(n,e,t=!0){if(!e)throw new TypeError("Specify max value");if("number"==typeof n&&Number.isSafeInteger(n)&&(n=BigInt(n)),"bigint"==typeof n&&n{if((n=Bs(n)).length<40||n.length>1024)throw new Error("Expected 40-1024 bytes of private key as per FIPS 186");return Me(Qa(n),zn.l-nn)+nn},randomBytes:(n=32)=>{if(da.web)return da.web.getRandomValues(new Uint8Array(n));if(da.node){const{randomBytes:e}=da.node;return new Uint8Array(e(n).buffer)}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>Ya.randomBytes(32),sha512:function(){var n=V(function*(...e){const t=uT(...e);if(da.web){const r=yield da.web.subtle.digest("SHA-512",t.buffer);return new Uint8Array(r)}if(da.node)return Uint8Array.from(da.node.createHash("sha512").update(t).digest());throw new Error("The environment doesn't have sha512 function")});return function(){return n.apply(this,arguments)}}(),precompute(n=8,e=hr.BASE){const t=e.equals(hr.BASE)?e:new hr(e.x,e.y);return t._setWindowSize(n),t.multiply(Yr),t},sha512Sync:void 0};function wV(){return hv.apply(this,arguments)}function hv(){return hv=V(function*(){const n=Ya.randomPrivateKey(),e=yield yT(n);return{privateKey:ET(n,e),publicKey:e}}),hv.apply(this,arguments)}function bV(n){return pv.apply(this,arguments)}function pv(){return pv=V(function*(n){if(32!==n.length)throw new TypeError('"seed" must be 32 bytes in length.');if(!(n instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, or Uint8Array.');const e=n,t=yield yT(e);return{privateKey:ET(e,t),publicKey:t}}),pv.apply(this,arguments)}function gv(){return gv=V(function*(n,e){const t=n.slice(0,32);return yield hV(e,t)}),gv.apply(this,arguments)}function yv(){return yv=V(function*(n,e,t){return yield gV(e,t,n)}),yv.apply(this,arguments)}function ET(n,e){const t=new Uint8Array(64);for(let r=0;r<32;r++)t[r]=n[r],t[32+r]=e[r];return t}Object.defineProperties(Ya,{sha512Sync:{configurable:!1,get:()=>cf,set(n){cf||(cf=n)}}});class mv{constructor(e){this._key=Cu(e,32)}verify(e,t){var r=this;return V(function*(){return yield function DV(n,e,t){return yv.apply(this,arguments)}(r._key,t,e)})()}marshal(){return this._key}get bytes(){return fu.encode({Type:dr.Ed25519,Data:this.marshal()}).subarray()}equals(e){return $r(this.bytes,e.bytes)}hash(){var e=this;return V(function*(){const{bytes:t}=yield Li.digest(e.bytes);return t})()}}class ff{constructor(e,t){this._key=Cu(e,64),this._publicKey=Cu(t,32)}sign(e){var t=this;return V(function*(){return yield function _V(n,e){return gv.apply(this,arguments)}(t._key,e)})()}get public(){return new mv(this._publicKey)}marshal(){return this._key}get bytes(){return du.encode({Type:dr.Ed25519,Data:this.marshal()}).subarray()}equals(e){return $r(this.bytes,e.bytes)}hash(){var e=this;return V(function*(){const{bytes:t}=yield Li.digest(e.bytes);return t})()}id(){var e=this;return V(function*(){const t=yield gu.digest(e.public.bytes);return Ci.encode(t.bytes).substring(1)})()}export(e,t="libp2p-key"){var r=this;return V(function*(){if("libp2p-key"===t)return yield qm(r.bytes,e);throw se(new Error(`export format '${t}' is not supported`),"ERR_INVALID_EXPORT_FORMAT")})()}}function SV(n){if(n.length>64){const r=(n=Cu(n,96)).slice(0,64),i=n.slice(64,n.length);return new ff(r,i)}const e=(n=Cu(n,64)).slice(0,64),t=n.slice(32);return new ff(e,t)}function IV(n){return n=Cu(n,32),new mv(n)}function CV(){return vv.apply(this,arguments)}function vv(){return vv=V(function*(){const{privateKey:n,publicKey:e}=yield wV();return new ff(n,e)}),vv.apply(this,arguments)}function TV(n){return Ev.apply(this,arguments)}function Ev(){return Ev=V(function*(n){const{privateKey:e,publicKey:t}=yield bV(n);return new ff(e,t)}),Ev.apply(this,arguments)}function Cu(n,e){if((n=Uint8Array.from(n??[])).length!==e)throw se(new Error(`Key must be a Uint8Array of length ${e}, got ${n.length}`),"ERR_INVALID_KEY_TYPE");return n}function AV(){return er.randomPrivateKey()}function wv(){return wv=V(function*(n,e){const{digest:t}=yield Li.digest(e);try{return yield z2(t,n)}catch(r){throw se(r,"ERR_INVALID_INPUT")}}),wv.apply(this,arguments)}function bv(){return bv=V(function*(n,e,t){try{const{digest:r}=yield Li.digest(t);return kU(e,r,n)}catch(r){throw se(r,"ERR_INVALID_INPUT")}}),bv.apply(this,arguments)}function wT(n){try{dn.fromHex(n)}catch(e){throw se(e,"ERR_INVALID_PUBLIC_KEY")}}class _v{constructor(e){wT(e),this._key=e}verify(e,t){var r=this;return V(function*(){return yield function RV(n,e,t){return bv.apply(this,arguments)}(r._key,t,e)})()}marshal(){return function PV(n){return dn.fromHex(n).toRawBytes(!0)}(this._key)}get bytes(){return fu.encode({Type:dr.Secp256k1,Data:this.marshal()}).subarray()}equals(e){return $r(this.bytes,e.bytes)}hash(){var e=this;return V(function*(){const{bytes:t}=yield Li.digest(e.bytes);return t})()}}class Dv{constructor(e,t){this._key=e,this._publicKey=t??function MV(n){try{return rf(n,!0)}catch(e){throw se(e,"ERR_INVALID_PRIVATE_KEY")}}(e),function NV(n){try{rf(n,!0)}catch(e){throw se(e,"ERR_INVALID_PRIVATE_KEY")}}(this._key),wT(this._publicKey)}sign(e){var t=this;return V(function*(){return yield function xV(n,e){return wv.apply(this,arguments)}(t._key,e)})()}get public(){return new _v(this._publicKey)}marshal(){return this._key}get bytes(){return du.encode({Type:dr.Secp256k1,Data:this.marshal()}).subarray()}equals(e){return $r(this.bytes,e.bytes)}hash(){var e=this;return V(function*(){const{bytes:t}=yield Li.digest(e.bytes);return t})()}id(){var e=this;return V(function*(){return Mt(yield e.public.hash(),"base58btc")})()}export(e,t="libp2p-key"){var r=this;return V(function*(){if("libp2p-key"===t)return yield qm(r.bytes,e);throw se(new Error(`export format '${t}' is not supported`),"ERR_INVALID_EXPORT_FORMAT")})()}}function OV(n){return new Dv(n)}function LV(n){return new _v(n)}function kV(){return Sv.apply(this,arguments)}function Sv(){return Sv=V(function*(){const n=yield AV();return new Dv(n)}),Sv.apply(this,arguments)}const Oo={rsa:C,ed25519:A,secp256k1:P};function Iv(n){const e=Object.keys(Oo).join(" / ");return se(new Error(`invalid or unsupported key type ${n}. Must be ${e}`),"ERR_UNSUPPORTED_KEY_TYPE")}function Cv(n){if("rsa"===(n=n.toLowerCase())||"ed25519"===n||"secp256k1"===n)return Oo[n];throw Iv(n)}function bT(n,e){return Tv.apply(this,arguments)}function Tv(){return Tv=V(function*(n,e){return yield Cv(n).generateKeyPair(e??2048)}),Tv.apply(this,arguments)}function Tu(n){const e=fu.decode(n),t=e.Data;switch(e.Type){case dr.RSA:return Oo.rsa.unmarshalRsaPublicKey(t);case dr.Ed25519:return Oo.ed25519.unmarshalEd25519PublicKey(t);case dr.Secp256k1:return Oo.secp256k1.unmarshalSecp256k1PublicKey(t);default:throw Iv(e.Type)}}function BV(n,e){return Cv(e=(e??"rsa").toLowerCase()),n.bytes}function Au(n){return xv.apply(this,arguments)}function xv(){return xv=V(function*(n){const e=du.decode(n),t=e.Data;switch(e.Type){case dr.RSA:return yield Oo.rsa.unmarshalRsaPrivateKey(t);case dr.Ed25519:return Oo.ed25519.unmarshalEd25519PrivateKey(t);case dr.Secp256k1:return Oo.secp256k1.unmarshalSecp256k1PrivateKey(t);default:throw Iv(e.Type)}}),xv.apply(this,arguments)}function FV(n,e){return Cv(e=(e??"rsa").toLowerCase()),n.bytes}function Rv(n,e){return Pv.apply(this,arguments)}function Pv(){return Pv=V(function*(n,e){try{const i=yield SU(n,e);return yield Au(i)}catch{}const t=Gn.pki.decryptRsaPrivateKey(n,e);if(null===t)throw se(new Error("Cannot read the key, most likely the password is wrong or not a RSA key"),"ERR_CANNOT_DECRYPT_PEM");let r=Gn.asn1.toDer(Gn.pki.privateKeyToAsn1(t));return r=_t(r.getBytes(),"ascii"),yield Oo.rsa.unmarshalRsaPrivateKey(r)}),Pv.apply(this,arguments)}const _T=Symbol.for("@libp2p/peer-id");function DT(n){return null!=n&&Boolean(n[_T])}const ST=Object.values(Jl).map(n=>n.decoder).reduce((n,e)=>n.or(e),Jl.identity.decoder);class Jh{constructor(e){this.type=e.type,this.multihash=e.multihash,this.privateKey=e.privateKey,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return`PeerId(${this.toString()})`}get[_T](){return!0}toString(){return null==this.string&&(this.string=Ci.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return Rr.createV1(114,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){if(e instanceof Uint8Array)return $r(this.multihash.bytes,e);if("string"==typeof e)return _r(e).equals(this);if(null!=e?.multihash?.bytes)return $r(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}}class df extends Jh{constructor(e){super({...e,type:"RSA"}),this.type="RSA",this.publicKey=e.publicKey}}class hf extends Jh{constructor(e){super({...e,type:"Ed25519"}),this.type="Ed25519",this.publicKey=e.multihash.digest}}class pf extends Jh{constructor(e){super({...e,type:"secp256k1"}),this.type="secp256k1",this.publicKey=e.multihash.digest}}function Zr(n){if("RSA"===n.type)return new df(n);if("Ed25519"===n.type)return new hf(n);if("secp256k1"===n.type)return new pf(n);throw se(new Error("Not a PeerId"),"ERR_INVALID_PARAMETERS")}function _r(n,e){if(e=e??ST,"1"===n.charAt(0)||"Q"===n.charAt(0)){const t=Uh(Ci.decode(`z${n}`));return n.startsWith("12D")?new hf({multihash:t}):n.startsWith("16U")?new pf({multihash:t}):new df({multihash:t})}return pa(ST.decode(n))}function pa(n){try{const e=Uh(n);if(e.code===gu.code){if(36===e.digest.length)return new hf({multihash:e});if(37===e.digest.length)return new pf({multihash:e})}if(e.code===Li.code)return new df({multihash:e})}catch{return function UV(n){if(null==n||null==n.multihash||null==n.version||1===n.version&&114!==n.code)throw new Error("Supplied PeerID CID is invalid");const e=n.multihash;if(e.code===Li.code)return new df({multihash:n.multihash});if(e.code===gu.code){if(36===e.digest.length)return new hf({multihash:n.multihash});if(37===e.digest.length)return new pf({multihash:n.multihash})}throw new Error("Supplied PeerID CID is invalid")}(Rr.decode(n))}throw new Error("Supplied PeerID CID is invalid")}function xu(n,e){return Ov.apply(this,arguments)}function Ov(){return Ov=V(function*(n,e){return 36===n.length?new hf({multihash:pu(gu.code,n),privateKey:e}):37===n.length?new pf({multihash:pu(gu.code,n),privateKey:e}):new df({multihash:yield Li.digest(n),publicKey:n,privateKey:e})}),Ov.apply(this,arguments)}function CT(n){return null!=globalThis?.Buffer?.allocUnsafe?globalThis.Buffer.allocUnsafe(n):new Uint8Array(n)}var tr=(()=>(function(n){n[n.VARINT=0]="VARINT",n[n.BIT64=1]="BIT64",n[n.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",n[n.START_GROUP=3]="START_GROUP",n[n.END_GROUP=4]="END_GROUP",n[n.BIT32=5]="BIT32"}(tr||(tr={})),tr))();function di(n,e,t,r,i){return{name:n,type:e,encode:t,decode:r,encodingLength:i}}di("bool",tr.VARINT,function(e){return Uint8Array.from([e?1:0])},function(e,t){return e.get(t)>0},function(){return 1});const Lv=di("bytes",tr.LENGTH_DELIMITED,function(e){return new $n(Qt.encode(e.byteLength),e)},function(e,t){const r=Qt.decode(e,t);return t+=Qt.encodingLength(r),e.subarray(t,t+r)},function(e){const t=e.byteLength;return Qt.encodingLength(t)+t});di("double",tr.BIT64,function(e){const t=new $n(new Uint8Array(8));return t.setFloat64(0,e,!0),t},function(e,t){return e.getFloat64(t,!0)},function(){return 8});const xT=(di("fixed32",tr.BIT32,function(e){const t=new $n(new Uint8Array(4));return t.setInt32(0,e,!0),t},function(e,t){return e.getInt32(t,!0)},function(){return 4}),function(e){return 8}),RT=(di("fixed64",tr.BIT64,function(e){const t=new $n(new Uint8Array(8));return t.setBigInt64(0,e,!0),t},function(e,t){return e.getBigInt64(t,!0)},xT),function(){return 4}),PT=(di("float",tr.BIT32,function(e){const t=new $n(new Uint8Array(4));return t.setFloat32(0,e,!0),t},function(e,t){return e.getFloat32(t,!0)},RT),function(e){return e<0?10:Th.encodingLength(e)}),NT=(di("int32",tr.VARINT,function(e){const t=new Uint8Array(PT(e));return Th.encode(e,t)},function(e,t){return 0|Th.decode(e,t)},PT),0x7fn),Za={encodingLength(n){let e=0;for(;n>=0x80n;e++)n>>=7n;return e+1},encode(n,e,t=0){null==e&&(e=xo(Za.encodingLength(n)));const r=gm(e);for(;NT>=7n;return r.set(t,Number(n)),e},decode:(n,e=0)=>qr.fromBytes(n,e).toBigInt(!0)},ep={encodingLength:n=>n<0n?10:Za.encodingLength(n),encode:(n,e,t)=>(null==e&&(e=xo(ep.encodingLength(n))),n<0n?(qr.fromBigInt(n).toBytes(e,t),e):Za.encode(n,e,t)),decode:(n,e=0)=>qr.fromBytes(n,e).toBigInt(!1)},tp={encodingLength:n=>Za.encodingLength(n>=0?2n*n:-2n*n-1n),encode:(n,e,t)=>(null==e&&(e=xo(tp.encodingLength(n))),qr.fromBigInt(n).zzEncode().toBytes(e,t),e),decode:(n,e=0)=>qr.fromBytes(n,e).zzDecode().toBigInt(!1)},MT=function(e){return e<0n?10:ep.encodingLength(e)};di("int64",tr.VARINT,function(e){const t=new Uint8Array(MT(e));return ep.encode(e,t)},function(e,t){return 0n|ep.decode(e,t)},MT);const LT=(di("sfixed32",tr.BIT32,function(e){const t=new $n(new Uint8Array(4));return t.setInt32(0,e,!0),t},function(e,t){return e.getInt32(t,!0)},function(){return 4}),function(){return 8});var kv;di("sfixed64",tr.BIT64,function(e){const t=new $n(new Uint8Array(8));return t.setBigInt64(0,e,!0),t},function(e,t){return e.getBigInt64(t,!0)},LT),di("sint32",tr.VARINT,function(e){return ym.encode(e)},function(e,t){return ym.decode(e,t)},function(e){return ym.encodingLength(e)}),di("sint64",tr.VARINT,function(e){return tp.encode(e)},function(e,t){return tp.decode(e,t)},function(e){return tp.encodingLength(e)}),di("string",tr.LENGTH_DELIMITED,function(e){const t=_t(e);return new $n(Qt.encode(t.byteLength),t)},function(e,t){const r=Qt.decode(e,t);return t+=Qt.encodingLength(r),Mt(e.subarray(t,t+r))},function(e){const t=_t(e).byteLength;return Qt.encodingLength(t)+t}),di("uint32",tr.VARINT,function(e){return Qt.encode(e)},function(e,t){return Qt.decode(e,t)},function(e){return Qt.encodingLength(e)}),di("uint64",tr.VARINT,function(e){return Za.encode(e)},function(e,t){return Za.decode(e,t)},function(e){return Za.encodingLength(e)}),function(n){let e;var t;(t=e=n.NoiseHandshakePayload||(n.NoiseHandshakePayload={})).codec=()=>function o7(n){return di("message",tr.LENGTH_DELIMITED,function(s){const o=new $n;function a(m,T,R){if(null==m){if(!0===R.optional)return;throw new Error(`Non optional field "${R.name}" was ${null===m?"null":"undefined"}`)}const k=T<<3|R.codec.type,U=CT(Qt.encodingLength(k));Qt.encode(k,U);const Q=R.codec.encode(m);o.append(U),o.append(Q)}for(const[m,T]of Object.entries(n)){const R=parseInt(m);if(!0===T.repeats){if(!Array.isArray(s[T.name]))throw new Error(`Repeating field "${T.name}" was not an array`);for(const k of s[T.name])a(k,R,T)}else a(s[T.name],R,T)}const c=Qt.encode(o.length);return new $n(c,o)},function(s,o){const a=Qt.decode(s,o),c=(o+=Qt.encodingLength(a))+a,m={};for(;o>3];let Q=0;if(R===tr.VARINT)if(null!=U){const X=U.codec.decode(s,o);Q=U.codec.encodingLength(X)}else{const X=Qt.decode(s,o);Q=Qt.encodingLength(X)}else if(R===tr.BIT64)Q=8;else if(R===tr.LENGTH_DELIMITED){const X=Qt.decode(s,o);Q=X+Qt.encodingLength(X)}else if(R===tr.BIT32)Q=4;else{if(R===tr.START_GROUP)throw new Error("Unsupported wire type START_GROUP");if(R===tr.END_GROUP)throw new Error("Unsupported wire type END_GROUP")}if(null!=U){const X=U.codec.decode(s,o);!0===U.repeats?(null==m[U.name]&&(m[U.name]=[]),m[U.name].push(X)):m[U.name]=X}o+=Q}for(const T of Object.values(n))!0===T.repeats&&null==m[T.name]&&(m[T.name]=[]);return m},function(s){let o=0;for(const a of Object.values(n))o+=a.codec.encodingLength(s[a.name]);return Qt.encodingLength(o)+o})}({1:{name:"identityKey",codec:Lv},2:{name:"identitySig",codec:Lv},3:{name:"data",codec:Lv}}),t.encode=r=>function HV(n,e){const t=e.encode(n),r=Qt.encodingLength(Qt.decode(t));return t instanceof Uint8Array?new $n(t.subarray(r)):t.sublist(r)}(r,t.codec()),t.decode=r=>function VV(n,e){const t=CT(Qt.encodingLength(n.byteLength));return Qt.encode(n.byteLength,t),e.decode(new $n(t,n),0)}(r,t.codec())}(kv||(kv={}));const kT=kv.NoiseHandshakePayload;function Bv(){return Bv=V(function*(n,e,t){const r=yield A7(n,BT(e)),i=t??new Uint8Array(0);if(null==n.publicKey)throw new Error("PublicKey was missing from local PeerId");return T7(n.publicKey,r,i)}),Bv.apply(this,arguments)}function T7(n,e,t){return kT.encode({identityKey:n,identitySig:e,data:t??new Uint8Array(0)}).subarray()}function A7(n,e){return Fv.apply(this,arguments)}function Fv(){return Fv=V(function*(n,e){if(null==n.privateKey)throw new Error("PrivateKey was missing from PeerId");return yield(yield Au(n.privateKey)).sign(e)}),Fv.apply(this,arguments)}function gf(n){return Uv.apply(this,arguments)}function Uv(){return Uv=V(function*(n){return yield xu(n.identityKey)}),Uv.apply(this,arguments)}function yf(n){return kT.decode(n)}function BT(n){const e=_t("noise-libp2p-static-key:");return or([e,n],e.length+n.length)}function mf(n,e,t){return Vv.apply(this,arguments)}function Vv(){return Vv=V(function*(n,e,t){const r=yield xu(e.identityKey);if(!r.equals(t))throw new Error("Peer ID doesn't match libp2p public key.");const i=BT(n);if(null==r.publicKey)throw new Error("PublicKey was missing from PeerId");if(null==e.identitySig)throw new Error("Signature was missing from message");if(!(yield Tu(r.publicKey).verify(i,e.identitySig)))throw new Error("Static key doesn't match to peer that signed payload!");return r}),Vv.apply(this,arguments)}function Xa(n){return!(!(n instanceof Uint8Array)||32!==n.length)}var Ur=N(1455);function Gt(n){return Object.assign(Ur(n),{error:Ur(`${n}:error`),trace:Ur(`${n}:trace`)})}Ur.formatters.b=n=>null==n?"undefined":Ci.baseEncode(n),Ur.formatters.t=n=>null==n?"undefined":Ro.baseEncode(n),Ur.formatters.m=n=>null==n?"undefined":Lh.baseEncode(n),Ur.formatters.p=n=>null==n?"undefined":n.toString(),Ur.formatters.c=n=>null==n?"undefined":n.toString(),Ur.formatters.k=n=>null==n?"undefined":n.toString();const ln=Gt("libp2p:noise");let hs;function FT(n){hs(`LOCAL_STATIC_PUBLIC_KEY ${Mt(n.publicKey,"hex")}`),hs(`LOCAL_STATIC_PRIVATE_KEY ${Mt(n.privateKey,"hex")}`)}function vf(n){n?(hs(`LOCAL_PUBLIC_EPHEMERAL_KEY ${Mt(n.publicKey,"hex")}`),hs(`LOCAL_PRIVATE_EPHEMERAL_KEY ${Mt(n.privateKey,"hex")}`)):hs("Missing local ephemeral keys.")}function Hv(n){hs(`REMOTE_STATIC_PUBLIC_KEY ${Mt(n,"hex")}`)}function Ru(n){hs(`REMOTE_EPHEMERAL_PUBLIC_KEY ${Mt(n,"hex")}`)}function UT(n){n.cs1&&n.cs2?(hs(`CIPHER_STATE_1 ${n.cs1.n.getUint64()} ${Mt(n.cs1.k,"hex")}`),hs(`CIPHER_STATE_2 ${n.cs2.n.getUint64()} ${Mt(n.cs2.k,"hex")}`)):hs("Missing cipher state.")}hs=V5?ln:Object.assign(()=>{},{enabled:!1,trace:()=>{},error:()=>{}});class N7{constructor(e=0){this.n=e,this.bytes=new Uint8Array(12),this.view=new DataView(this.bytes.buffer,this.bytes.byteOffset,this.bytes.byteLength),this.view.setUint32(4,e,!0)}increment(){this.n++,this.view.setUint32(4,this.n,!0)}getBytes(){return this.bytes}getUint64(){return this.n}assertValue(){if(this.n>4294967295)throw new Error("Cipherstate has reached maximum n, a new handshake must be performed")}}class VT{constructor(e){this.crypto=e}encryptWithAd(e,t,r){const i=this.encrypt(e.k,e.n,t,r);return e.n.increment(),i}decryptWithAd(e,t,r){const{plaintext:i,valid:s}=this.decrypt(e.k,e.n,t,r);return e.n.increment(),{plaintext:i,valid:s}}hasKey(e){return!this.isEmptyKey(e.k)}createEmptyKey(){return new Uint8Array(32)}isEmptyKey(e){return $r(this.createEmptyKey(),e)}encrypt(e,t,r,i){return t.assertValue(),this.crypto.chaCha20Poly1305Encrypt(i,t.getBytes(),r,e)}encryptAndHash(e,t){let r;return r=this.hasKey(e.cs)?this.encryptWithAd(e.cs,e.h,t):t,this.mixHash(e,r),r}decrypt(e,t,r,i){t.assertValue();const s=this.crypto.chaCha20Poly1305Decrypt(i,t.getBytes(),r,e);return s?{plaintext:s,valid:!0}:{plaintext:new Uint8Array(0),valid:!1}}decryptAndHash(e,t){let r,i=!0;return this.hasKey(e.cs)?({plaintext:r,valid:i}=this.decryptWithAd(e.cs,e.h,t)):r=t,this.mixHash(e,t),{plaintext:r,valid:i}}dh(e,t){try{const r=this.crypto.generateX25519SharedKey(e,t);return 32===r.length?r:r.subarray(0,32)}catch(r){return ln(r.message),new Uint8Array(32)}}mixHash(e,t){e.h=this.getHash(e.h,t)}getHash(e,t){return this.crypto.hashSHA256(or([e,t],e.length+t.length))}mixKey(e,t){const[r,i]=this.crypto.getHKDF(e.ck,t);e.cs=this.initializeKey(i),e.ck=r}initializeKey(e){return{k:e,n:new N7}}initializeSymmetric(e){const t=_t(e,"utf-8"),r=this.hashProtocolName(t),i=r,s=this.createEmptyKey();return{cs:this.initializeKey(s),ck:i,h:r}}hashProtocolName(e){if(e.length<=32){const t=new Uint8Array(32);return t.set(e),t}return this.getHash(e,new Uint8Array(0))}split(e){const[t,r]=this.crypto.getHKDF(e.ck,new Uint8Array(0));return{cs1:this.initializeKey(t),cs2:this.initializeKey(r)}}writeMessageRegular(e,t){const r=this.encryptWithAd(e,new Uint8Array(0),t);return{ne:this.createEmptyKey(),ns:new Uint8Array(0),ciphertext:r}}readMessageRegular(e,t){return this.decryptWithAd(e,new Uint8Array(0),t.ciphertext)}}class M7 extends VT{initSession(e,t,r,i){const s=this.createEmptyKey();let o;return o=e?this.initializeInitiator(t,r,i,s):this.initializeResponder(t,r,i,s),{hs:o,i:e,mc:0}}sendMessage(e,t){let r;if(0===e.mc)r=this.writeMessageA(e.hs,t);else if(1===e.mc){const{messageBuffer:i,h:s,cs1:o,cs2:a}=this.writeMessageB(e.hs,t);r=i,e.h=s,e.cs1=o,e.cs2=a}else{if(!(e.mc>1))throw new Error("Session invalid.");if(e.i){if(!e.cs1)throw new Error("CS1 (cipher state) is not defined");r=this.writeMessageRegular(e.cs1,t)}else{if(!e.cs2)throw new Error("CS2 (cipher state) is not defined");r=this.writeMessageRegular(e.cs2,t)}}return e.mc++,r}recvMessage(e,t){let r=new Uint8Array(0),i=!1;if(0===e.mc&&({plaintext:r,valid:i}=this.readMessageA(e.hs,t)),1===e.mc){const{plaintext:s,valid:o,h:a,cs1:c,cs2:m}=this.readMessageB(e.hs,t);r=s,i=o,e.h=a,e.cs1=c,e.cs2=m}return e.mc++,{plaintext:r,valid:i}}writeMessageA(e,t){e.e=this.crypto.generateX25519KeyPair();const r=e.e.publicKey;this.mixHash(e.ss,r),this.mixKey(e.ss,this.dh(e.e.privateKey,e.rs));const s=this.encryptAndHash(e.ss,e.s.publicKey);return this.mixKey(e.ss,this.dh(e.s.privateKey,e.rs)),{ne:r,ns:s,ciphertext:this.encryptAndHash(e.ss,t)}}writeMessageB(e,t){e.e=this.crypto.generateX25519KeyPair();const r=e.e.publicKey;this.mixHash(e.ss,r),this.mixKey(e.ss,this.dh(e.e.privateKey,e.re)),this.mixKey(e.ss,this.dh(e.e.privateKey,e.rs));const i=this.encryptAndHash(e.ss,t),o={ne:r,ns:this.createEmptyKey(),ciphertext:i},{cs1:a,cs2:c}=this.split(e.ss);return{messageBuffer:o,cs1:a,cs2:c,h:e.ss.h}}readMessageA(e,t){Xa(t.ne)&&(e.re=t.ne),this.mixHash(e.ss,e.re),this.mixKey(e.ss,this.dh(e.s.privateKey,e.re));const{plaintext:r,valid:i}=this.decryptAndHash(e.ss,t.ns);i&&Xa(r)&&(e.rs=r),this.mixKey(e.ss,this.dh(e.s.privateKey,e.rs));const{plaintext:s,valid:o}=this.decryptAndHash(e.ss,t.ciphertext);return{plaintext:s,valid:i&&o}}readMessageB(e,t){if(Xa(t.ne)&&(e.re=t.ne),this.mixHash(e.ss,e.re),!e.e)throw new Error("Handshake state should contain ephemeral key by now.");this.mixKey(e.ss,this.dh(e.e.privateKey,e.re)),this.mixKey(e.ss,this.dh(e.s.privateKey,e.re));const{plaintext:r,valid:i}=this.decryptAndHash(e.ss,t.ciphertext),{cs1:s,cs2:o}=this.split(e.ss);return{h:e.ss.h,valid:i,plaintext:r,cs1:s,cs2:o}}initializeInitiator(e,t,r,i){const o=this.initializeSymmetric("Noise_IK_25519_ChaChaPoly_SHA256");return this.mixHash(o,e),this.mixHash(o,r),{ss:o,s:t,rs:r,re:new Uint8Array(32),psk:i}}initializeResponder(e,t,r,i){const o=this.initializeSymmetric("Noise_IK_25519_ChaChaPoly_SHA256");return this.mixHash(o,e),this.mixHash(o,t.publicKey),{ss:o,s:t,rs:r,re:new Uint8Array(32),psk:i}}}class HT extends Error{constructor(e,t){super(t),this.initialMsg=e,this.name="FailedIKhandshake"}}class O7{constructor(e,t,r,i,s,o,a,c,m){this.isInitiator=e,this.payload=t,this.prologue=r,this.staticKeypair=s,this.connection=o,c&&(this.remotePeer=c),this.ik=m??new M7(i),this.session=this.ik.initSession(this.isInitiator,this.prologue,this.staticKeypair,a),this.remoteEarlyData=new Uint8Array}stage0(){var e=this;return V(function*(){if(FT(e.session.hs.s),Hv(e.session.hs.rs),e.isInitiator){ln("IK Stage 0 - Initiator sending message...");const t=e.ik.sendMessage(e.session,e.payload);e.connection.writeLP(l2(t)),ln("IK Stage 0 - Initiator sent message."),vf(e.session.hs.e)}else{ln("IK Stage 0 - Responder receiving message...");const t=yield e.connection.readLP();try{const r=bm(t.slice()),{plaintext:i,valid:s}=e.ik.recvMessage(e.session,r);if(!s)throw new Error("ik handshake stage 0 decryption validation fail");ln("IK Stage 0 - Responder got message, going to verify payload.");const o=yf(i);e.remotePeer=e.remotePeer||(yield gf(o)),yield mf(e.session.hs.rs,o,e.remotePeer),e.setRemoteEarlyData(o.data),ln("IK Stage 0 - Responder successfully verified payload!"),Ru(e.session.hs.re)}catch(r){const i=r;throw ln("Responder breaking up with IK handshake in stage 0."),new HT(t.slice(),`Error occurred while verifying initiator's signed payload: ${i.message}`)}}})()}stage1(){var e=this;return V(function*(){if(e.isInitiator){ln("IK Stage 1 - Initiator receiving message...");const t=(yield e.connection.readLP()).slice(),r=wm(t),{plaintext:i,valid:s}=e.ik.recvMessage(e.session,r);ln("IK Stage 1 - Initiator got message, going to verify payload.");try{if(!s)throw new Error("ik stage 1 decryption validation fail");const o=yf(i);e.remotePeer=e.remotePeer||(yield gf(o)),yield mf(r.ns.slice(0,32),o,e.remotePeer),e.setRemoteEarlyData(o.data),ln("IK Stage 1 - Initiator successfully verified payload!"),Ru(e.session.hs.re)}catch(o){const a=o;throw ln("Initiator breaking up with IK handshake in stage 1."),new HT(t,`Error occurred while verifying responder's signed payload: ${a.message}`)}}else{ln("IK Stage 1 - Responder sending message...");const t=e.ik.sendMessage(e.session,e.payload);e.connection.writeLP(u2(t)),ln("IK Stage 1 - Responder sent message..."),vf(e.session.hs.e)}UT(e.session)})()}decrypt(e,t){const r=this.getCS(t,!1);return this.ik.decryptWithAd(r,new Uint8Array(0),e)}encrypt(e,t){const r=this.getCS(t);return this.ik.encryptWithAd(r,new Uint8Array(0),e)}getLocalEphemeralKeys(){if(!this.session.hs.e)throw new Error("Ephemeral keys do not exist.");return this.session.hs.e}getCS(e,t=!0){if(!e.cs1||!e.cs2)throw new Error("Handshake not completed properly, cipher state does not exist.");return this.isInitiator?t?e.cs1:e.cs2:t?e.cs2:e.cs1}setRemoteEarlyData(e){e&&(this.remoteEarlyData=e)}}class np extends Error{constructor(e="Unexpected Peer"){super(e),this.code=np.code}static get code(){return"ERR_UNEXPECTED_PEER"}}class Pu extends Error{constructor(e="Invalid crypto exchange"){super(e),this.code=Pu.code}static get code(){return"ERR_INVALID_CRYPTO_EXCHANGE"}}Error;class L7 extends VT{initializeInitiator(e,t,r,i){const o=this.initializeSymmetric("Noise_XX_25519_ChaChaPoly_SHA256");return this.mixHash(o,e),{ss:o,s:t,rs:r,psk:i,re:new Uint8Array(32)}}initializeResponder(e,t,r,i){const o=this.initializeSymmetric("Noise_XX_25519_ChaChaPoly_SHA256");return this.mixHash(o,e),{ss:o,s:t,rs:r,psk:i,re:new Uint8Array(32)}}writeMessageA(e,t,r){const i=new Uint8Array(0);e.e=void 0!==r?r:this.crypto.generateX25519KeyPair();const s=e.e.publicKey;return this.mixHash(e.ss,s),{ne:s,ns:i,ciphertext:this.encryptAndHash(e.ss,t)}}writeMessageB(e,t){e.e=this.crypto.generateX25519KeyPair();const r=e.e.publicKey;this.mixHash(e.ss,r),this.mixKey(e.ss,this.dh(e.e.privateKey,e.re));const s=this.encryptAndHash(e.ss,e.s.publicKey);return this.mixKey(e.ss,this.dh(e.s.privateKey,e.re)),{ne:r,ns:s,ciphertext:this.encryptAndHash(e.ss,t)}}writeMessageC(e,t){const i=this.encryptAndHash(e.ss,e.s.publicKey);this.mixKey(e.ss,this.dh(e.s.privateKey,e.re));const s=this.encryptAndHash(e.ss,t),a={ne:this.createEmptyKey(),ns:i,ciphertext:s},{cs1:c,cs2:m}=this.split(e.ss);return{h:e.ss.h,messageBuffer:a,cs1:c,cs2:m}}readMessageA(e,t){return Xa(t.ne)&&(e.re=t.ne),this.mixHash(e.ss,e.re),this.decryptAndHash(e.ss,t.ciphertext)}readMessageB(e,t){if(Xa(t.ne)&&(e.re=t.ne),this.mixHash(e.ss,e.re),!e.e)throw new Error("Handshake state `e` param is missing.");this.mixKey(e.ss,this.dh(e.e.privateKey,e.re));const{plaintext:r,valid:i}=this.decryptAndHash(e.ss,t.ns);i&&Xa(r)&&(e.rs=r),this.mixKey(e.ss,this.dh(e.e.privateKey,e.rs));const{plaintext:s,valid:o}=this.decryptAndHash(e.ss,t.ciphertext);return{plaintext:s,valid:i&&o}}readMessageC(e,t){const{plaintext:r,valid:i}=this.decryptAndHash(e.ss,t.ns);if(i&&Xa(r)&&(e.rs=r),!e.e)throw new Error("Handshake state `e` param is missing.");this.mixKey(e.ss,this.dh(e.e.privateKey,e.rs));const{plaintext:s,valid:o}=this.decryptAndHash(e.ss,t.ciphertext),{cs1:a,cs2:c}=this.split(e.ss);return{h:e.ss.h,plaintext:s,valid:i&&o,cs1:a,cs2:c}}initSession(e,t,r){const i=this.createEmptyKey(),s=new Uint8Array(32);let o;return o=e?this.initializeInitiator(t,r,s,i):this.initializeResponder(t,r,s,i),{hs:o,i:e,mc:0}}sendMessage(e,t,r){let i;if(0===e.mc)i=this.writeMessageA(e.hs,t,r);else if(1===e.mc)i=this.writeMessageB(e.hs,t);else if(2===e.mc){const{h:s,messageBuffer:o,cs1:a,cs2:c}=this.writeMessageC(e.hs,t);i=o,e.h=s,e.cs1=a,e.cs2=c}else{if(!(e.mc>2))throw new Error("Session invalid.");if(e.i){if(!e.cs1)throw new Error("CS1 (cipher state) is not defined");i=this.writeMessageRegular(e.cs1,t)}else{if(!e.cs2)throw new Error("CS2 (cipher state) is not defined");i=this.writeMessageRegular(e.cs2,t)}}return e.mc++,i}recvMessage(e,t){let r=new Uint8Array(0),i=!1;if(0===e.mc)({plaintext:r,valid:i}=this.readMessageA(e.hs,t));else if(1===e.mc)({plaintext:r,valid:i}=this.readMessageB(e.hs,t));else if(2===e.mc){const{h:s,plaintext:o,valid:a,cs1:c,cs2:m}=this.readMessageC(e.hs,t);r=o,i=a,e.h=s,e.cs1=c,e.cs2=m}return e.mc++,{plaintext:r,valid:i}}}class jT{constructor(e,t,r,i,s,o,a,c){this.isInitiator=e,this.payload=t,this.prologue=r,this.staticKeypair=s,this.connection=o,a&&(this.remotePeer=a),this.xx=c??new L7(i),this.session=this.xx.initSession(this.isInitiator,this.prologue,this.staticKeypair),this.remoteEarlyData=new Uint8Array(0)}propose(){var e=this;return V(function*(){if(FT(e.session.hs.s),e.isInitiator){ln("Stage 0 - Initiator starting to send first message.");const t=e.xx.sendMessage(e.session,new Uint8Array(0));e.connection.writeLP(u2(t)),ln("Stage 0 - Initiator finished sending first message."),vf(e.session.hs.e)}else{ln("Stage 0 - Responder waiting to receive first message...");const t=wm((yield e.connection.readLP()).subarray()),{valid:r}=e.xx.recvMessage(e.session,t);if(!r)throw new Pu("xx handshake stage 0 validation fail");ln("Stage 0 - Responder received first message."),Ru(e.session.hs.re)}})()}exchange(){var e=this;return V(function*(){if(e.isInitiator){ln("Stage 1 - Initiator waiting to receive first message from responder...");const t=bm((yield e.connection.readLP()).subarray()),{plaintext:r,valid:i}=e.xx.recvMessage(e.session,t);if(!i)throw new Pu("xx handshake stage 1 validation fail");ln("Stage 1 - Initiator received the message."),Ru(e.session.hs.re),Hv(e.session.hs.rs),ln("Initiator going to check remote's signature...");try{const s=yf(r);e.remotePeer=e.remotePeer||(yield gf(s)),yield mf(e.session.hs.rs,s,e.remotePeer),e.setRemoteEarlyData(s.data)}catch(s){throw new np(`Error occurred while verifying signed payload: ${s.message}`)}ln("All good with the signature!")}else{ln("Stage 1 - Responder sending out first message with signed payload and static key.");const t=e.xx.sendMessage(e.session,e.payload);e.connection.writeLP(l2(t)),ln("Stage 1 - Responder sent the second handshake message with signed payload."),vf(e.session.hs.e)}})()}finish(){var e=this;return V(function*(){if(e.isInitiator){ln("Stage 2 - Initiator sending third handshake message.");const t=e.xx.sendMessage(e.session,e.payload);e.connection.writeLP(function z5(n){return or([n.ns,n.ciphertext],n.ns.length+n.ciphertext.length)}(t)),ln("Stage 2 - Initiator sent message with signed payload.")}else{ln("Stage 2 - Responder waiting for third handshake message...");const t=function W5(n){if(n.length<48)throw new Error("Cannot decode stage 2 MessageBuffer: length less than 48 bytes.");return{ne:new Uint8Array(0),ns:n.subarray(0,48),ciphertext:n.subarray(48,n.length)}}((yield e.connection.readLP()).subarray()),{plaintext:r,valid:i}=e.xx.recvMessage(e.session,t);if(!i)throw new Pu("xx handshake stage 2 validation fail");ln("Stage 2 - Responder received the message, finished handshake.");try{const s=yf(r);e.remotePeer=e.remotePeer||(yield gf(s)),yield mf(e.session.hs.rs,s,e.remotePeer),e.setRemoteEarlyData(s.data)}catch(s){throw new np(`Error occurred while verifying signed payload: ${s.message}`)}}UT(e.session)})()}encrypt(e,t){const r=this.getCS(t);return this.xx.encryptWithAd(r,new Uint8Array(0),e)}decrypt(e,t){const r=this.getCS(t,!1);return this.xx.decryptWithAd(r,new Uint8Array(0),e)}getRemoteStaticKey(){return this.session.hs.rs}getCS(e,t=!0){if(!e.cs1||!e.cs2)throw new Pu("Handshake not completed properly, cipher state does not exist.");return this.isInitiator?t?e.cs1:e.cs2:t?e.cs2:e.cs1}setRemoteEarlyData(e){e&&(this.remoteEarlyData=e)}}class k7 extends jT{constructor(e,t,r,i,s,o,a,c,m,T){super(e,t,r,i,s,o,c,T),m&&(this.ephemeralKeys=m),this.initialMsg=a}propose(){var e=this;return V(function*(){if(e.isInitiator)e.xx.sendMessage(e.session,new Uint8Array(0),e.ephemeralKeys),ln("XX Fallback Stage 0 - Initialized state as the first message was sent by initiator."),vf(e.session.hs.e);else{ln("XX Fallback Stage 0 - Responder decoding initial msg from IK.");const t=wm(e.initialMsg),{valid:r}=e.xx.recvMessage(e.session,{ne:t.ne,ns:new Uint8Array(0),ciphertext:new Uint8Array(0)});if(!r)throw new Error("xx fallback stage 0 decryption validation fail");ln("XX Fallback Stage 0 - Responder used received message from IK."),Ru(e.session.hs.re)}})()}exchange(){var e=()=>super.exchange,t=this;return V(function*(){if(t.isInitiator){const r=bm(t.initialMsg),{plaintext:i,valid:s}=t.xx.recvMessage(t.session,r);if(!s)throw new Error("xx fallback stage 1 decryption validation fail");ln("XX Fallback Stage 1 - Initiator used received message from IK."),Ru(t.session.hs.re),Hv(t.session.hs.rs),ln("Initiator going to check remote's signature...");try{const o=yf(i);t.remotePeer=t.remotePeer||(yield gf(o)),yield mf(t.session.hs.rs,o,t.remotePeer),t.setRemoteEarlyData(o.data)}catch(o){throw new Error(`Error occurred while verifying signed payload from responder: ${o.message}`)}ln("All good with the signature!")}else ln("XX Fallback Stage 1 - Responder start"),yield e().call(t),ln("XX Fallback Stage 1 - Responder end")})()}}function rp(n,e){const t={[Symbol.iterator]:()=>t,next:()=>{const r=n.next(),i=r.value;return!0===r.done||null==i?{done:!0,value:void 0}:{done:!1,value:e(i)}}};return t}class $T{constructor(e){if(this.map=new Map,null!=e)for(const[t,r]of e.entries())this.map.set(t.toString(),r)}[Symbol.iterator](){return this.entries()}clear(){this.map.clear()}delete(e){this.map.delete(e.toString())}entries(){return rp(this.map.entries(),e=>[_r(e[0]),e[1]])}forEach(e){this.map.forEach((t,r)=>{e(t,_r(r),this)})}get(e){return this.map.get(e.toString())}has(e){return this.map.has(e.toString())}set(e,t){this.map.set(e.toString(),t)}keys(){return rp(this.map.keys(),e=>_r(e))}values(){return this.map.values()}get size(){return this.map.size}}class B7{constructor(e){if(this.set=new Set,null!=e)for(const t of e)this.set.add(t.toString())}get size(){return this.set.size}[Symbol.iterator](){return this.values()}add(e){this.set.add(e.toString())}clear(){this.set.clear()}delete(e){this.set.delete(e.toString())}entries(){return rp(this.set.entries(),e=>{const t=_r(e[0]);return[t,t]})}forEach(e){this.set.forEach(t=>{const r=_r(t);e(r,r,this)})}has(e){return this.set.has(e.toString())}values(){return rp(this.set.values(),e=>_r(e))}}Symbol;const jv=new class F7{constructor(){this.storage=new $T}store(e,t){this.storage.set(e,t)}load(e){return e?this.storage.get(e)??null:null}resetStorage(){this.storage.clear()}};class GT{constructor(e,t,r=K5){this.protocol="/noise",this.prologue=new Uint8Array(0),this.earlyData=t??new Uint8Array(0),this.useNoisePipes=!1,this.crypto=r,this.staticKeys=e?this.crypto.generateX25519KeyPairFromSeed(e):this.crypto.generateX25519KeyPair()}secureOutbound(e,t,r){var i=this;return V(function*(){const s=r2(t,{lengthEncoder:Rh,lengthDecoder:Ph,maxDataLength:Ql}),o=yield i.performHandshake({connection:s,isInitiator:!0,localPeer:e,remotePeer:r});return{conn:yield i.createSecureConnection(s,o),remoteEarlyData:o.remoteEarlyData,remotePeer:o.remotePeer}})()}secureInbound(e,t,r){var i=this;return V(function*(){const s=r2(t,{lengthEncoder:Rh,lengthDecoder:Ph,maxDataLength:Ql}),o=yield i.performHandshake({connection:s,isInitiator:!1,localPeer:e,remotePeer:r});return{conn:yield i.createSecureConnection(s,o),remoteEarlyData:o.remoteEarlyData,remotePeer:o.remotePeer}})()}performHandshake(e){var t=this;return V(function*(){const r=yield function C7(n,e,t){return Bv.apply(this,arguments)}(e.localPeer,t.staticKeys.publicKey,t.earlyData);let i=t.useNoisePipes;if(e.isInitiator&&null===jv.load(e.remotePeer)&&(i=!1),!i)return yield t.performXXHandshake(e,r);{const{remotePeer:s,connection:o,isInitiator:a}=e,c=new O7(a,r,t.prologue,t.crypto,t.staticKeys,o,jv.load(e.remotePeer)??new Uint8Array(32),s);try{return yield t.performIKHandshake(c)}catch(m){const T=m;let R;return e.isInitiator&&(R=c.getLocalEphemeralKeys()),yield t.performXXFallbackHandshake(e,r,T.initialMsg,R)}}})()}performXXFallbackHandshake(e,t,r,i){var s=this;return V(function*(){const{isInitiator:o,remotePeer:a,connection:c}=e,m=new k7(o,t,s.prologue,s.crypto,s.staticKeys,c,r,a,i);try{yield m.propose(),yield m.exchange(),yield m.finish()}catch(T){const R=T;throw R.message=`Error occurred during XX Fallback handshake: ${R.message}`,ln(R),R}return m})()}performXXHandshake(e,t){var r=this;return V(function*(){const{isInitiator:i,remotePeer:s,connection:o}=e,a=new jT(i,t,r.prologue,r.crypto,r.staticKeys,o,s);try{yield a.propose(),yield a.exchange(),yield a.finish(),r.useNoisePipes&&a.remotePeer&&jv.store(a.remotePeer,a.getRemoteStaticKey())}catch(c){if(c instanceof Error)throw c.message=`Error occurred during XX handshake: ${c.message}`,c}return a})()}performIKHandshake(e){return V(function*(){return yield e.stage0(),yield e.stage1(),e})()}createSecureConnection(e,t){return V(function*(){const[r,i]=function B5(){const n=i2(),e=i2();return[{source:n.source,sink:e.sink},{source:e.source,sink:n.sink}]}(),s=e.unwrap();return yield Ln(r,function j5(n){return function(){var e=un(function*(t){var s,r=!1,i=!1;try{for(var a,o=Tt(t);r=!(a=yield ct(o.next())).done;r=!1){const c=a.value;for(let m=0;mc.length&&(T=c.length),yield n.encrypt(c.subarray(m,T),n.session)}}}catch(c){i=!0,s=c}finally{try{r&&null!=o.return&&(yield ct(o.return()))}finally{if(i)throw s}}});return function(t){return e.apply(this,arguments)}}()}(t),to({lengthEncoder:Rh}),s,Ms({lengthDecoder:Ph}),function $5(n){return function(){var e=un(function*(t){var s,r=!1,i=!1;try{for(var a,o=Tt(t);r=!(a=yield ct(o.next())).done;r=!1){const c=a.value;for(let m=0;mc.length&&(T=c.length);const{plaintext:R,valid:k}=yield ct(n.decrypt(c.subarray(m,T),n.session));if(!k)throw new Error("Failed to validate decrypted chunk");yield R}}}catch(c){i=!0,s=c}finally{try{r&&null!=o.return&&(yield ct(o.return()))}finally{if(i)throw s}}});return function(t){return e.apply(this,arguments)}}()}(t),r),i})()}}function Lo(n){return null!=n&&"function"==typeof n.start&&"function"==typeof n.stop}function hi(n){return null!=n&&"function"==typeof n.init}new GT;class ko{constructor(e={}){this.started=!1,null!=e.peerId&&this.setPeerId(e.peerId),null!=e.addressManager&&this.setAddressManager(e.addressManager),null!=e.peerStore&&this.setPeerStore(e.peerStore),null!=e.upgrader&&this.setUpgrader(e.upgrader),null!=e.metrics&&this.setMetrics(e.metrics),null!=e.registrar&&this.setRegistrar(e.registrar),null!=e.connectionManager&&this.setConnectionManager(e.connectionManager),null!=e.transportManager&&this.setTransportManager(e.transportManager),null!=e.connectionGater&&this.setConnectionGater(e.connectionGater),null!=e.contentRouting&&this.setContentRouting(e.contentRouting),null!=e.peerRouting&&this.setPeerRouting(e.peerRouting),null!=e.datastore&&this.setDatastore(e.datastore),null!=e.connectionProtector&&this.setConnectionProtector(e.connectionProtector),null!=e.dht&&this.setDHT(e.dht),null!=e.pubsub&&this.setPubSub(e.pubsub)}isStarted(){return this.started}beforeStart(){var e=this;return V(function*(){yield Promise.all(Object.values(e).filter(t=>Lo(t)).map(function(){var t=V(function*(r){null!=r.beforeStart&&(yield r.beforeStart())});return function(r){return t.apply(this,arguments)}}()))})()}start(){var e=this;return V(function*(){yield Promise.all(Object.values(e).filter(t=>Lo(t)).map(function(){var t=V(function*(r){yield r.start()});return function(r){return t.apply(this,arguments)}}())),e.started=!0})()}afterStart(){var e=this;return V(function*(){yield Promise.all(Object.values(e).filter(t=>Lo(t)).map(function(){var t=V(function*(r){null!=r.afterStart&&(yield r.afterStart())});return function(r){return t.apply(this,arguments)}}()))})()}beforeStop(){var e=this;return V(function*(){yield Promise.all(Object.values(e).filter(t=>Lo(t)).map(function(){var t=V(function*(r){null!=r.beforeStop&&(yield r.beforeStop())});return function(r){return t.apply(this,arguments)}}()))})()}stop(){var e=this;return V(function*(){yield Promise.all(Object.values(e).filter(t=>Lo(t)).map(function(){var t=V(function*(r){yield r.stop()});return function(r){return t.apply(this,arguments)}}())),e.started=!1})()}afterStop(){var e=this;return V(function*(){yield Promise.all(Object.values(e).filter(t=>Lo(t)).map(function(){var t=V(function*(r){null!=r.afterStop&&(yield r.afterStop())});return function(r){return t.apply(this,arguments)}}()))})()}setPeerId(e){return this.peerId=e,e}getPeerId(){if(null==this.peerId)throw se(new Error("peerId not set"),"ERR_SERVICE_MISSING");return this.peerId}setMetrics(e){return this.metrics=e,hi(e)&&e.init(this),e}getMetrics(){return this.metrics}setAddressManager(e){return this.addressManager=e,hi(e)&&e.init(this),e}getAddressManager(){if(null==this.addressManager)throw se(new Error("addressManager not set"),"ERR_SERVICE_MISSING");return this.addressManager}setPeerStore(e){return this.peerStore=e,hi(e)&&e.init(this),e}getPeerStore(){if(null==this.peerStore)throw se(new Error("peerStore not set"),"ERR_SERVICE_MISSING");return this.peerStore}setUpgrader(e){return this.upgrader=e,hi(e)&&e.init(this),e}getUpgrader(){if(null==this.upgrader)throw se(new Error("upgrader not set"),"ERR_SERVICE_MISSING");return this.upgrader}setRegistrar(e){return this.registrar=e,hi(e)&&e.init(this),e}getRegistrar(){if(null==this.registrar)throw se(new Error("registrar not set"),"ERR_SERVICE_MISSING");return this.registrar}setConnectionManager(e){return this.connectionManager=e,hi(e)&&e.init(this),e}getConnectionManager(){if(null==this.connectionManager)throw se(new Error("connectionManager not set"),"ERR_SERVICE_MISSING");return this.connectionManager}setTransportManager(e){return this.transportManager=e,hi(e)&&e.init(this),e}getTransportManager(){if(null==this.transportManager)throw se(new Error("transportManager not set"),"ERR_SERVICE_MISSING");return this.transportManager}setConnectionGater(e){return this.connectionGater=e,hi(e)&&e.init(this),e}getConnectionGater(){if(null==this.connectionGater)throw se(new Error("connectionGater not set"),"ERR_SERVICE_MISSING");return this.connectionGater}setContentRouting(e){return this.contentRouting=e,hi(e)&&e.init(this),e}getContentRouting(){if(null==this.contentRouting)throw se(new Error("contentRouting not set"),"ERR_SERVICE_MISSING");return this.contentRouting}setPeerRouting(e){return this.peerRouting=e,hi(e)&&e.init(this),e}getPeerRouting(){if(null==this.peerRouting)throw se(new Error("peerRouting not set"),"ERR_SERVICE_MISSING");return this.peerRouting}setDatastore(e){return this.datastore=e,hi(e)&&e.init(this),e}getDatastore(){if(null==this.datastore)throw se(new Error("datastore not set"),"ERR_SERVICE_MISSING");return this.datastore}setConnectionProtector(e){return this.connectionProtector=e,hi(e)&&e.init(this),e}getConnectionProtector(){return this.connectionProtector}setDHT(e){return this.dht=e,hi(e)&&e.init(this),e}getDHT(){if(null==this.dht)throw se(new Error("dht not set"),"ERR_SERVICE_MISSING");return this.dht}setPubSub(e){return this.pubsub=e,hi(e)&&e.init(this),e}getPubSub(){if(null==this.pubsub)throw se(new Error("pubsub not set"),"ERR_SERVICE_MISSING");return this.pubsub}}class zT extends Error{constructor(e,t){super(e??"The operation was aborted"),this.type="aborted",this.code=t??"ABORT_ERR"}}function Fs(n,e,t){const r=t??{},i=function U7(n){if(null!=n){if("function"==typeof n[Symbol.iterator])return n[Symbol.iterator]();if("function"==typeof n[Symbol.asyncIterator])return n[Symbol.asyncIterator]();if("function"==typeof n.next)return n}throw new Error("argument is not an iterator or iterable")}(n);function o(){return(o=un(function*(){let a;const c=()=>{a?.()};for(e.addEventListener("abort",c);;){let m;try{if(e.aborted){const{abortMessage:R,abortCode:k}=r;throw new zT(R,k)}const T=new Promise((R,k)=>{a=()=>{const{abortMessage:U,abortCode:Q}=r;k(new zT(U,Q))}});m=yield ct(Promise.race([T,i.next()])),a=null}catch(T){e.removeEventListener("abort",c);const R="aborted"===T.type&&e.aborted;if(R&&null!=r.onAbort&&(yield ct(r.onAbort(n))),"function"==typeof i.return)try{const k=i.return();k instanceof Promise&&k.catch(U=>{null!=r.onReturnError&&r.onReturnError(U)})}catch(k){null!=r.onReturnError&&r.onReturnError(k)}if(R&&!0===r.returnOnAbort)return;throw T}if(!0===m.done)break;yield m.value}e.removeEventListener("abort",c)})).apply(this,arguments)}return function s(){return o.apply(this,arguments)}()}function V7(n,e,t){return r=>n(Fs(r,e,t))}function ga(n,e,t){return{sink:V7(n.sink,e,{...t,onAbort:void 0}),source:Fs(n.source,e,t)}}var Vn=N(1732);function WT(n){return new Uint8Array(n)}var Jt=(()=>(function(n){n[n.NEW_STREAM=0]="NEW_STREAM",n[n.MESSAGE_RECEIVER=1]="MESSAGE_RECEIVER",n[n.MESSAGE_INITIATOR=2]="MESSAGE_INITIATOR",n[n.CLOSE_RECEIVER=3]="CLOSE_RECEIVER",n[n.CLOSE_INITIATOR=4]="CLOSE_INITIATOR",n[n.RESET_RECEIVER=5]="RESET_RECEIVER",n[n.RESET_INITIATOR=6]="RESET_INITIATOR"}(Jt||(Jt={})),Jt))();const qT=Object.freeze({0:"NEW_STREAM",1:"MESSAGE_RECEIVER",2:"MESSAGE_INITIATOR",3:"CLOSE_RECEIVER",4:"CLOSE_INITIATOR",5:"RESET_RECEIVER",6:"RESET_INITIATOR"}),QT=Object.freeze({NEW_STREAM:Jt.NEW_STREAM,MESSAGE:Jt.MESSAGE_INITIATOR,CLOSE:Jt.CLOSE_INITIATOR,RESET:Jt.RESET_INITIATOR}),H7=Object.freeze({MESSAGE:Jt.MESSAGE_RECEIVER,CLOSE:Jt.CLOSE_RECEIVER,RESET:Jt.RESET_RECEIVER}),YT=new class K7{constructor(){this._pool=WT(10240),this._poolOffset=0}write(e){const t=this._pool;let r=this._poolOffset;Vn.encode(e.id<<3|e.type,t,r),r+=Vn.encode.bytes,Vn.encode(e.type!==Jt.NEW_STREAM&&e.type!==Jt.MESSAGE_INITIATOR&&e.type!==Jt.MESSAGE_RECEIVER||null==e.data?0:e.data.length,t,r),r+=Vn.encode.bytes;const i=t.subarray(this._poolOffset,r);return 10240-r<100?(this._pool=WT(10240),this._poolOffset=0):this._poolOffset=r,e.type!==Jt.NEW_STREAM&&e.type!==Jt.MESSAGE_INITIATOR&&e.type!==Jt.MESSAGE_RECEIVER||null==e.data?[i]:[i,e.data instanceof Uint8Array?e.data:e.data.subarray()]}};function Wv(){return Wv=un(function*(n){var r,e=!1,t=!1;try{for(var s,i=Tt(n);e=!(s=yield ct(i.next())).done;e=!1){const o=s.value;if(Array.isArray(o))for(const a of o)yield*jr(Tt(YT.write(a)),ct);else yield*jr(Tt(YT.write(o)),ct)}}catch(o){t=!0,r=o}finally{try{e&&null!=i.return&&(yield ct(i.return()))}finally{if(t)throw r}}}),Wv.apply(this,arguments)}class $7{constructor(){this._buffer=new $n,this._headerInfo=null}write(e){if(null==e||0===e.length)return[];this._buffer.append(e);const t=[];for(;0!==this._buffer.length;){if(null==this._headerInfo)try{this._headerInfo=this._decodeHeader(this._buffer)}catch{break}const{id:r,type:i,length:s,offset:o}=this._headerInfo;if(this._buffer.length-o>3,type:o,offset:r+s,length:i}}}function XT(n,e=0){let s,t=0,r=0,i=e;const o=n.length;do{if(i>=o||r>49)throw e=0,new RangeError("Could not decode varint");s=n.get(i++),t+=r<28?(127&s)<=128);return{value:t,offset:e=i-e}}function z7(n){return qv.apply(this,arguments)}function qv(){return qv=un(function*(n){const e=new $7;var i,t=!1,r=!1;try{for(var o,s=Tt(n);t=!(o=yield ct(s.next())).done;t=!1){const c=e.write(o.value);c.length>0&&(yield c)}}catch(a){r=!0,i=a}finally{try{t&&null!=s.return&&(yield ct(s.return()))}finally{if(r)throw i}}}),qv.apply(this,arguments)}const JT=1<<20;var ip=N(772);const Us=Gt("libp2p:mplex:stream"),Qv="ERR_STREAM_RESET";class X7 extends Map{constructor(e){super();const{system:t,component:r,metric:i,metrics:s}=e;this.system=t??"libp2p",this.component=r,this.metric=i,this.metrics=s,this.updateComponentMetric()}set(e,t){return super.set(e,t),this.updateComponentMetric(),this}delete(e){const t=super.delete(e);return this.updateComponentMetric(),t}clear(){super.clear(),this.updateComponentMetric()}updateComponentMetric(){this.metrics.updateComponentMetric({system:this.system,component:this.component,metric:this.metric,value:this.size})}}function Ef(n){const{system:e,component:t,metric:r,metrics:i}=n;let s;return s=null!=i?new X7({system:e,component:t,metric:r,metrics:i}):new Map,s}const so=Gt("libp2p:mplex");function eA(n){const e={...n,type:`${qT[n.type]} (${n.type})`};return n.type===Jt.NEW_STREAM&&(e.data=Mt(n.data instanceof Uint8Array?n.data:n.data.subarray())),(n.type===Jt.MESSAGE_INITIATOR||n.type===Jt.MESSAGE_RECEIVER)&&(e.data=Mt(n.data instanceof Uint8Array?n.data:n.data.subarray(),"base16")),e}class n9{constructor(e,t){this.protocol="/mplex/6.7.0",t=t??{},this._streamId=0,this._streams={initiators:Ef({metrics:e.getMetrics(),component:"mplex",metric:"initiatorStreams"}),receivers:Ef({metrics:e.getMetrics(),component:"mplex",metric:"receiverStreams"})},this._init=t,this.sink=this._createSink();const r=this._createSource();this._source=r,this.source=r,this.closeController=new AbortController}init(e){}get streams(){const e=[];return this._streams.initiators.forEach(t=>{e.push(t)}),this._streams.receivers.forEach(t=>{e.push(t)}),e}newStream(e){if(this.closeController.signal.aborted)throw new Error("Muxer already closed");const t=this._streamId++;return e=null==e?t.toString():e.toString(),this._newStream({id:t,name:e,type:"initiator",registry:this._streams.initiators})}close(e){this.closeController.signal.aborted||(this.streams.forEach(null!=e?t=>t.abort(e):t=>t.close()),this.closeController.abort())}_newReceiverStream(e){const{id:t,name:r}=e;return this._newStream({id:t,name:r,type:"receiver",registry:this._streams.receivers})}_newStream(e){const{id:t,name:r,type:i,registry:s}=e;if(so("new %s stream %s %s",i,t,r),"initiator"===i&&this._streams.initiators.size===(this._init.maxOutboundStreams??1024))throw se(new Error("Too many outbound streams open"),"ERR_TOO_MANY_OUTBOUND_STREAMS");if(s.has(t))throw new Error(`${i} stream ${t} already exists!`);const c=function Z7(n){const{id:e,name:t,send:r,onEnd:i,type:s="initiator",maxMsgSize:o=JT}=n,a=new AbortController,c=new AbortController,m=new AbortController,T="initiator"===s?QT:H7,R="initiator"===s?`i${e}`:`r${e}`,k=`${t??e}`;let ae,U=!1,Q=!1,X=!1;const he={open:Date.now()},ue=Le=>{Q||(Q=!0,Us.trace("%s stream %s sink end - err: %o",s,k,Le),null!=Le&&null==ae&&(ae=Le),U&&(he.close=Date.now(),i?.(ae)))},Re={close:()=>{Us.trace("%s stream %s close",s,k),Re.closeRead(),Re.closeWrite()},closeRead:()=>{Us.trace("%s stream %s closeRead",s,k),!U&&Re.source.end()},closeWrite:()=>{if(Us.trace("%s stream %s closeWrite",s,k),!Q){m.abort();try{r({id:e,type:T.CLOSE})}catch(Le){Us.trace("%s stream %s error sending close",s,t,Le)}ue()}},abort:Le=>{Us.trace("%s stream %s abort",s,k,Le),Re.source.end(Le),a.abort(),ue(Le)},reset:()=>{const Le=se(new Error("stream reset"),Qv);c.abort(),Re.source.end(Le),ue(Le)},sink:(Le=V(function*(Fe){if(X)throw se(new Error("sink already called on stream"),"ERR_DOUBLE_SINK");if(X=!0,Q)throw se(new Error("stream closed for writing"),"ERR_SINK_ENDED");Fe=Fs(Fe,(0,ip.anySignal)([a.signal,c.signal,m.signal]));try{"initiator"===s&&r({id:e,type:QT.NEW_STREAM,data:_t(k)});const Rn=new $n;var Zt,wt=!1,mt=!1;try{for(var zr,wn=Tt(Fe);wt=!(zr=yield wn.next()).done;wt=!1)for(Rn.append(zr.value);0!==Rn.length;){if(Rn.length<=o){r({id:e,type:T.MESSAGE,data:Rn.subarray()}),Rn.consume(Rn.length);break}const Ju=Rn.length-o;r({id:e,type:T.MESSAGE,data:Rn.subarray(0,Ju)}),Rn.consume(Ju)}}catch(Yo){mt=!0,Zt=Yo}finally{try{wt&&null!=wn.return&&(yield wn.return())}finally{if(mt)throw Zt}}}catch(Rn){if("aborted"===Rn.type&&"The operation was aborted"===Rn.message){if(m.signal.aborted)return;c.signal.aborted&&(Rn.message="stream reset",Rn.code=Qv),a.signal.aborted&&(Rn.message="stream aborted",Rn.code="ERR_STREAM_ABORT")}if(Rn.code===Qv)Us.trace("%s stream %s reset",s,t);else{Us.trace("%s stream %s error",s,t,Rn);try{r({id:e,type:T.RESET})}catch(Yo){Us.trace("%s stream %s error sending reset",s,t,Yo)}}return Re.source.end(Rn),void ue(Rn)}try{r({id:e,type:T.CLOSE})}catch(Rn){Us.trace("%s stream %s error sending close",s,t,Rn)}ue()}),function(wt){return Le.apply(this,arguments)}),source:lu({onEnd:Le=>{U||(U=!0,Us.trace("%s stream %s source end - err: %o",s,k,Le),null!=Le&&null==ae&&(ae=Le),Q&&(Re.stat.timeline.close=Date.now(),i?.(ae)))}}),stat:{direction:"initiator"===s?"outbound":"inbound",timeline:he},metadata:{},id:R};var Le;return Re}({id:t,name:r,send:m=>{so.enabled&&so.trace("%s stream %s send",i,t,eA(m)),(m.type===Jt.NEW_STREAM||m.type===Jt.MESSAGE_INITIATOR||m.type===Jt.MESSAGE_RECEIVER)&&(m.data=m.data instanceof Uint8Array?m.data:m.data.subarray()),this._source.push(m)},type:i,onEnd:()=>{so("%s stream %s ended",i,t,r),s.delete(t),null!=this._init.onStreamEnd&&this._init.onStreamEnd(c)},maxMsgSize:this._init.maxMsgSize});return s.set(t,c),c}_createSink(){var e=this;return function(){var r=V(function*(i){const s=[e.closeController.signal];null!=e._init.signal&&s.push(e._init.signal),i=Fs(i,ip(s));try{yield Ln(i,z7,function W7(n){const e=n??JT,t=r=>{if((r.type===Jt.NEW_STREAM||r.type===Jt.MESSAGE_INITIATOR||r.type===Jt.MESSAGE_RECEIVER)&&r.data.byteLength>e)throw Object.assign(new Error("message size too large!"),{code:"ERR_MSG_TOO_BIG"})};return r=>{return(i=un(function*(){var c,o=!1,a=!1;try{for(var T,m=Tt(r);o=!(T=yield ct(m.next())).done;o=!1){const R=T.value;Array.isArray(R)?(R.forEach(t),yield*jr(Tt(R),ct)):(t(R),yield R)}}catch(R){a=!0,c=R}finally{try{o&&null!=m.return&&(yield ct(m.return()))}finally{if(a)throw c}}}),function s(){return i.apply(this,arguments)})();var i}}(e._init.maxMsgSize),function(){var o=V(function*(a){var T,c=!1,m=!1;try{for(var k,R=Tt(a);c=!(k=yield R.next()).done;c=!1)e._handleIncoming(k.value)}catch(U){m=!0,T=U}finally{try{c&&null!=R.return&&(yield R.return())}finally{if(m)throw T}}});return function(a){return o.apply(this,arguments)}}()),e._source.end()}catch(o){so("error in sink",o),e._source.end(o)}});return function(s){return r.apply(this,arguments)}}()}_createSource(){const t=function S5(n={}){return t2(t=>{let r;const i=[];for(;!t.isEmpty()&&(r=t.shift(),null!=r);){if(null!=r.error)throw r.error;!1===r.done&&i.push(r.value)}return null==r?{done:!0}:{done:!0===r.done,value:i}},n)}({objectMode:!0,onEnd:r=>{this.close(r)}});return Object.assign(function j7(n){return Wv.apply(this,arguments)}(t),{push:t.push,end:t.end,return:t.return})}_handleIncoming(e){const{id:t,type:r}=e;if(so.enabled&&so.trace("incoming message",eA(e)),e.type===Jt.NEW_STREAM){if(this._streams.receivers.size===(this._init.maxInboundStreams??1024))return so.error("Too many inbound streams open"),void this._source.push({id:t,type:Jt.RESET_RECEIVER});const a=this._newReceiverStream({id:t,name:Mt(e.data instanceof Uint8Array?e.data:e.data.subarray())});return void(null!=this._init.onIncomingStream&&this._init.onIncomingStream(a))}const s=(1==(1&r)?this._streams.initiators:this._streams.receivers).get(t);if(null==s)return void so("missing stream %s",t);const o=this._init.maxStreamBufferSize??4194304;switch(r){case Jt.MESSAGE_INITIATOR:case Jt.MESSAGE_RECEIVER:if(s.source.readableLength>o){this._source.push({id:e.id,type:r===Jt.MESSAGE_INITIATOR?Jt.RESET_RECEIVER:Jt.RESET_INITIATOR});const a=se(new Error("Input buffer full - increase Mplex maxBufferSize to accommodate slow consumers"),"ERR_STREAM_INPUT_BUFFER_FULL");return void s.abort(a)}s.source.push(e.data.subarray());break;case Jt.CLOSE_INITIATOR:case Jt.CLOSE_RECEIVER:s.closeRead();break;case Jt.RESET_INITIATOR:case Jt.RESET_RECEIVER:s.reset();break;default:so("unknown message type %s",r)}}}class r9{constructor(e={}){this.protocol="/mplex/6.7.0",this.components=new ko,this._init=e}init(e){this.components=e}createStreamMuxer(e={}){return new n9(this.components,{...e,...this._init})}}const i9=WebSocket;var s9=N(3676);function tA(n){return n instanceof ArrayBuffer||"ArrayBuffer"===n?.constructor?.name&&"number"==typeof n?.byteLength}const o9=n=>{n.binaryType="arraybuffer";const e=function(){var s=V(function*(){return yield new Promise((o,a)=>{if(r)return o();if(null!=i)return a(i);const c=R=>{n.removeEventListener("open",m),n.removeEventListener("error",T),R()},m=()=>c(o),T=R=>{c(()=>a(R.error??new Error(`connect ECONNREFUSED ${n.url}`)))};n.addEventListener("open",m),n.addEventListener("error",T)})});return function(){return s.apply(this,arguments)}}(),t=un(function*(){const s=new s9.zN(({push:R,stop:k,fail:U})=>{const Q=ae=>{let he=null;"string"==typeof ae.data&&(he=_t(ae.data)),tA(ae.data)&&(he=new Uint8Array(ae.data)),ae.data instanceof Uint8Array&&(he=ae.data),null!=he&&R(he)},X=ae=>U(ae.error??new Error("Socket error"));return n.addEventListener("message",Q),n.addEventListener("error",X),n.addEventListener("close",k),()=>{n.removeEventListener("message",Q),n.removeEventListener("error",X),n.removeEventListener("close",k)}},{highWaterMark:1/0});yield ct(e());var c,o=!1,a=!1;try{for(var T,m=Tt(s);o=!(T=yield ct(m.next())).done;o=!1){const R=T.value;yield tA(R)?new Uint8Array(R):R}}catch(R){a=!0,c=R}finally{try{o&&null!=m.return&&(yield ct(m.return()))}finally{if(a)throw c}}})();let i,r=1===n.readyState;return n.addEventListener("open",()=>{r=!0,i=null}),n.addEventListener("close",()=>{r=!1,i=null}),n.addEventListener("error",s=>{r||(i=s.error??new Error(`connect ECONNREFUSED ${n.url}`))}),Object.assign(t,{connected:e})},a9=n=>{if(n.readyState>=2)throw new Error("socket closed");if(1!==n.readyState)return new Promise((e,t)=>{function r(){n.removeEventListener("open",i),n.removeEventListener("error",s)}function i(){r(),e()}function s(o){r(),t(o.error??new Error(`connect ECONNREFUSED ${n.url}`))}n.addEventListener("open",i),n.addEventListener("error",s)})},c9=(n,e)=>((e=e??{}).closeOnEnd=!1!==e.closeOnEnd,function(){var r=V(function*(i){var a,s=!1,o=!1;try{for(var m,c=Tt(i);s=!(m=yield c.next()).done;s=!1){const T=m.value;try{yield a9(n)}catch(R){if("socket closed"===R.message)break;throw R}n.send(T)}}catch(T){o=!0,a=T}finally{try{s&&null!=c.return&&(yield c.return())}finally{if(o)throw a}}if(null!=e.closeOnEnd&&n.readyState<=1)return yield new Promise((T,R)=>{n.addEventListener("close",k=>{if(k.wasClean||1006===k.code)T();else{const U=Object.assign(new Error("ws error"),{event:k});R(U)}}),setTimeout(()=>n.close())})});return function(s){return r.apply(this,arguments)}}()),u9=(n,e)=>{e=e??{};const t=o9(n);let r=e.remoteAddress,i=e.remotePort;if(null!=n.url)try{const o=new URL(n.url);r=o.hostname,i=parseInt(o.port,10)}catch{}if(null==r||null==i)throw new Error("Remote connection did not have address and/or port");return{sink:c9(n,e),source:t,connected:(o=V(function*(){return yield t.connected()}),function(){return o.apply(this,arguments)}),close:function(){var o=V(function*(){(n.readyState===n.CONNECTING||n.readyState===n.OPEN)&&(yield new Promise(a=>{n.addEventListener("close",()=>{a()}),n.close()}))});return function(){return o.apply(this,arguments)}}(),destroy:()=>{null!=n.terminate?n.terminate():n.close()},remoteAddress:r,remotePort:i,socket:n};var o};var l9=N(8596);const f9={http:"ws",https:"wss"};const nA="[a-fA-F\\d:]",ya=n=>n&&n.includeBoundaries?`(?:(?<=\\s|^)(?=${nA})|(?<=${nA})(?=\\s|$))`:"",Vs="(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}",Pr="[a-fA-F\\d]{1,4}",sp=`\n(?:\n(?:${Pr}:){7}(?:${Pr}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:${Pr}:){6}(?:${Vs}|:${Pr}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4\n(?:${Pr}:){5}(?::${Vs}|(?::${Pr}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4\n(?:${Pr}:){4}(?:(?::${Pr}){0,1}:${Vs}|(?::${Pr}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4\n(?:${Pr}:){3}(?:(?::${Pr}){0,2}:${Vs}|(?::${Pr}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4\n(?:${Pr}:){2}(?:(?::${Pr}){0,3}:${Vs}|(?::${Pr}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:${Pr}:){1}(?:(?::${Pr}){0,4}:${Vs}|(?::${Pr}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::(?:(?::${Pr}){0,5}:${Vs}|(?::${Pr}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1\n`.replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),g9=new RegExp(`(?:^${Vs}$)|(?:^${sp}$)`),y9=new RegExp(`^${Vs}$`),m9=new RegExp(`^${sp}$`),Yv=n=>n&&n.exact?g9:new RegExp(`(?:${ya(n)}${Vs}${ya(n)})|(?:${ya(n)}${sp}${ya(n)})`,"g");Yv.v4=n=>n&&n.exact?y9:new RegExp(`${ya(n)}${Vs}${ya(n)}`,"g"),Yv.v6=n=>n&&n.exact?m9:new RegExp(`${ya(n)}${sp}${ya(n)}`,"g");const Zv=Yv,{toString:w9}=Object.prototype,rA={global:"g",ignoreCase:"i",multiline:"m",dotAll:"s",sticky:"y",unicode:"u"};function Xv(n,e,{}={}){try{return function v9(n){const e=(...t)=>n(...t);return Object.defineProperty(e,"name",{value:`functionTimeout(${n.name||""})`,configurable:!0}),e}(()=>function _9(n,e={}){if(!function b9(n){return"[object RegExp]"===w9.call(n)}(n))throw new TypeError("Expected a RegExp instance");const t=Object.keys(rA).map(i=>("boolean"==typeof e[i]?e[i]:n[i])?rA[i]:"").join(""),r=new RegExp(e.source||n.source,t);return r.lastIndex="number"==typeof e.lastIndex?e.lastIndex:n.lastIndex,r}(n).test(e))()}catch(r){throw r}}const Jv={timeout:400};function eE(n){return Xv(Zv({exact:!0}),n.slice(0,45),Jv)}const aA=function S9(n){return Xv(Zv.v4({exact:!0}),n.slice(0,15),Jv)},I9=function oA(n){return Xv(Zv.v6({exact:!0}),n.slice(0,45),Jv)},cA=function(n){let t,e=0;if(aA(n))t=new Uint8Array(e+4),n.split(/\./g).forEach(r=>{t[e++]=255&parseInt(r,10)});else if(I9(n)){const r=n.split(":",8);let i;for(i=0;i0;i--)s.push("0");r.splice.apply(r,s)}for(t=new Uint8Array(e+16),i=0;i>8&255,t[e++]=255&s}}if(null==t)throw Error("Invalid ip address: "+n);return t},Hs=-1,op={},tE={};function Nr(n){if("number"==typeof n){if(null!=tE[n])return tE[n];throw new Error(`no protocol with code: ${n}`)}if("string"==typeof n){if(null!=op[n])return op[n];throw new Error(`no protocol with name: ${n}`)}throw new Error("invalid protocol id type: "+typeof n)}function uA(n,e){switch(Nr(n).code){case 4:case 41:return function x9(n){const e=function(n,e,t){e=~~e,t=t??n.length-e;const r=[];let i="";const s=new DataView(n.buffer);if(4===t){for(let o=0;o65536)throw new Error("Port number is not in range(1, 65536)");const i=rE(r);return or([t,i],t.length+i.length)}(e);case 445:return function B9(n){const e=n.split(":");if(2!==e.length)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(56!==e[0].length)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion3 address.`);const t=Ro.decode(`b${e[0]}`),r=parseInt(e[1],10);if(r<1||r>65536)throw new Error("Port number is not in range(1, 65536)");const i=rE(r);return or([t,i],t.length+i.length)}(e);case 466:return function M9(n){const e=A9.decode(n),t=Uint8Array.from(Vn.encode(e.length));return or([t,e],t.length+e.length)}(e);default:return _t(e,"base16")}}[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,Hs,"ip6zone"],[53,Hs,"dns",!0],[54,Hs,"dns4",!0],[55,Hs,"dns6",!0],[56,Hs,"dnsaddr",!0],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[280,0,"webrtc"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,Hs,"unix",!1,!0],[421,Hs,"ipfs"],[421,Hs,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,Hs,"garlic64"],[460,0,"quic"],[466,Hs,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,Hs,"memory"]].forEach(n=>{const e=function T9(n,e,t,r,i){return{code:n,size:e,name:t,resolvable:Boolean(r),path:Boolean(i)}}(...n);tE[e.code]=e,op[e.name]=e});const nE=Object.values(Jl).map(n=>n.decoder),A9=function(){let n=nE[0].or(nE[1]);return nE.slice(2).forEach(e=>n=n.or(e)),n}();function rE(n){const e=new ArrayBuffer(2);return new DataView(e).setUint16(0,n),new Uint8Array(e)}function dA(n){return new DataView(n.buffer).getUint16(n.byteOffset)}function pA(n){return n.map(e=>{const t=cp(e);return null!=e[1]?[t.code,uA(t.code,e[1])]:[t.code]})}function gA(n){return sE(or(n.map(e=>{const t=cp(e);let r=Uint8Array.from(Vn.encode(t.code));return e.length>1&&null!=e[1]&&(r=or([r,e[1]])),r})))}function yA(n,e){return n.size>0?n.size/8:0===n.size?0:Vn.decode(e)+Vn.decode.bytes}function ap(n){const e=[];let t=0;for(;tn.length)throw vA("Invalid address Uint8Array: "+Mt(n,"base16"));e.push([r,a])}return e}function iE(n){return function U9(n){const e=[];return n.map(t=>{const r=cp(t);return e.push(r.name),t.length>1&&null!=t[1]&&e.push(t[1]),null}),oE(e.join("/"))}(pA(ap(n)))}function sE(n){const e=function mA(n){try{ap(n)}catch(e){return e}}(n);if(null!=e)throw e;return Uint8Array.from(n)}function oE(n){return"/"+n.trim().split("/").filter(e=>e).join("/")}function vA(n){return new Error("Error parsing address: "+n)}function cp(n){return Nr(n[0])}const j9=Symbol.for("nodejs.util.inspect.custom"),EA=[Nr("dns").code,Nr("dns4").code,Nr("dns6").code,Nr("dnsaddr").code],$9=[Nr("p2p").code,Nr("ipfs").code],wA=new Map,bA=Symbol.for("@multiformats/js-multiaddr/multiaddr");let vn=(()=>{class n{constructor(t){if(null==t&&(t=""),Object.defineProperty(this,bA,{value:!0}),t instanceof Uint8Array)this.bytes=sE(t);else if("string"==typeof t){if(t.length>0&&"/"!==t.charAt(0))throw new Error(`multiaddr "${t}" must start with a "/"`);this.bytes=function K9(n){return function H9(n){const e=function F9(n){const e=[],t=n.split("/").slice(1);if(1===t.length&&""===t[0])return[];for(let r=0;r=t.length)throw vA("invalid address: "+n);if(!0===s.path){e.push([i,oE(t.slice(r).join("/"))]);break}e.push([i,t[r]])}else e.push([i])}return e}(n=oE(n)),t=function V9(n){return n.map(e=>{Array.isArray(e)||(e=[e]);const t=cp(e);return e.length>1?[t.code,lA(t.code,e[1])]:[t.code]})}(e);return gA(t)}(n)}(t)}else{if(!n.isMultiaddr(t))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=sE(t.bytes)}}toString(){return iE(this.bytes)}toJSON(){return this.toString()}toOptions(){const t=this.protoCodes(),r=this.toString().split("/").slice(1);let i,s;if(r.length>2)EA.includes(t[0])&&$9.includes(t[1])?(i=Nr("tcp").name,s=443):(i=Nr(r[2]).name,s=parseInt(r[3]));else{if(!EA.includes(t[0]))throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');i=Nr("tcp").name,s=443}return{family:41===t[0]||55===t[0]?6:4,host:r[1],transport:i,port:s}}protos(){return this.protoCodes().map(t=>Object.assign({},Nr(t)))}protoCodes(){const t=[],r=this.bytes;let i=0;for(;it.name)}tuples(){return ap(this.bytes)}stringTuples(){return pA(ap(this.bytes))}encapsulate(t){return t=new n(t),new n(this.toString()+t.toString())}decapsulate(t){const r=t.toString(),i=this.toString(),s=i.lastIndexOf(r);if(s<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${t.toString()}`);return new n(i.slice(0,s))}decapsulateCode(t){const r=this.tuples();for(let i=r.length-1;i>=0;i--)if(r[i][0]===t)return new n(gA(r.slice(0,i)));return this}getPeerId(){try{const r=this.stringTuples().filter(i=>i[0]===op.ipfs.code).pop();if(null!=r?.[1]){const i=r[1];return Mt("Q"===i[0]||"1"===i[0]?Ci.decode(`z${i}`):Rr.parse(i).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){let t=null;try{t=this.stringTuples().filter(r=>!0===Nr(r[0]).path)[0][1],null==t&&(t=null)}catch{t=null}return t}equals(t){return $r(this.bytes,t.bytes)}resolve(t){var r=this;return V(function*(){const i=r.protos().find(a=>a.resolvable);if(null==i)return[r];const s=wA.get(i.name);if(null==s)throw se(new Error(`no available resolver for ${i.name}`),"ERR_NO_AVAILABLE_RESOLVER");return(yield s(r,t)).map(a=>new n(a))})()}nodeAddress(){const t=this.toOptions();if("tcp"!==t.transport&&"udp"!==t.transport)throw new Error(`multiaddr must have a valid format - no protocol with name: "${t.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:t.family,address:t.host,port:t.port}}isThinWaistAddress(t){const r=(t??this).protos();return!(2!==r.length||4!==r[0].code&&41!==r[0].code||6!==r[1].code&&273!==r[1].code)}static fromNodeAddress(t,r){if(null==t)throw new Error("requires node address object");if(null==r)throw new Error("requires transport protocol");let i;switch(t.family){case 4:i="ip4";break;case 6:i="ip6";break;default:throw Error("Invalid addr family, should be 4 or 6.")}return new n("/"+[i,t.address,r,t.port].join("/"))}static isName(t){return!!n.isMultiaddr(t)&&t.protos().some(r=>r.resolvable)}static isMultiaddr(t){return Boolean(t?.[bA])}[j9](){return""}inspect(){return""}}return n.resolvers=wA,n})();const up=(n,e)=>e,W9={ip4:up,ip6:(n,e,t,r)=>1===r.length&&"ip6"===r[0].protocol?e:`[${e}]`,tcp:(n,e,t,r,i)=>r.some(s=>["http","https","ws","wss"].includes(s.protocol))?`${n}:${e}`:((n,e,t,r)=>{if(null!=r&&!1===r.assumeHttp)return`tcp://${n}:${e}`;let i="tcp",s=`:${e}`;return"tcp"===t[t.length-1].protocol&&(i="443"===e?"https":"http",s="443"===e||"80"===e?"":s),`${i}://${n}${s}`})(n,e,r,i),udp:(n,e)=>`udp://${n}:${e}`,dnsaddr:up,dns4:up,dns6:up,ipfs:(n,e)=>`${n}/ipfs/${e}`,p2p:(n,e)=>`${n}/p2p/${e}`,http:n=>`http://${n}`,https:n=>`https://${n}`,ws:n=>`ws://${n}`,wss:n=>`wss://${n}`,"p2p-websocket-star":n=>`${n}/p2p-websocket-star`,"p2p-webrtc-star":n=>`${n}/p2p-webrtc-star`,"p2p-webrtc-direct":n=>`${n}/p2p-webrtc-direct`};class Nu extends Error{constructor(e="The operation was aborted"){super(e),this.code=Nu.code,this.type=Nu.type}static get code(){return"ABORT_ERR"}static get type(){return"aborted"}}var Q9=N(9456);const aE="object"==typeof window&&"object"==typeof document&&9===document.nodeType,lp=Q9(),fp=aE&&!lp,Y9=lp&&!aE,Z9=lp&&aE,X9=typeof globalThis.process<"u"&&typeof globalThis.process.release<"u"&&"node"===globalThis.process.release.name&&!lp,_A="function"==typeof importScripts&&typeof self<"u"&&typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,J9=(typeof globalThis.process<"u"&&typeof globalThis.process.env<"u"&&globalThis,typeof navigator<"u"&&"ReactNative"===navigator.product);class iH extends Error{constructor(e){super(e),this.name="TimeoutError"}}class sH extends Error{constructor(e){super(),this.name="AbortError",this.message=e}}const IA=n=>void 0===globalThis.DOMException?new sH(n):new DOMException(n),CA=n=>{const e=void 0===n.reason?IA("This operation was aborted."):n.reason;return e instanceof Error?e:IA(e)},TA=Gt("libp2p:websockets:socket");const cH=At("dns4"),uH=At("dns6"),lH=At("dnsaddr"),Ja=pi(At("dns"),lH,cH,uH),dp=pi(At("ip4"),At("ip6")),wf=pi(en(dp,At("tcp")),en(Ja,At("tcp"))),AA=en(dp,At("udp")),fH=en(AA,At("utp")),dH=en(AA,At("quic")),Mu=pi(en(wf,At("ws")),en(Ja,At("ws"))),ec=pi(en(wf,At("wss")),en(Ja,At("wss"))),cE=pi(en(wf,At("http")),en(dp,At("http")),en(Ja,At("http"))),uE=pi(en(wf,At("https")),en(dp,At("https")),en(Ja,At("https"))),xA=pi(en(Mu,At("p2p-webrtc-star"),At("p2p")),en(ec,At("p2p-webrtc-star"),At("p2p")),en(Mu,At("p2p-webrtc-star")),en(ec,At("p2p-webrtc-star"))),RA=(pi(en(Mu,At("p2p-websocket-star"),At("p2p")),en(ec,At("p2p-websocket-star"),At("p2p")),en(Mu,At("p2p-websocket-star")),en(ec,At("p2p-websocket-star"))),pi(en(cE,At("p2p-webrtc-direct"),At("p2p")),en(uE,At("p2p-webrtc-direct"),At("p2p")),en(cE,At("p2p-webrtc-direct")),en(uE,At("p2p-webrtc-direct")))),bf=pi(Mu,ec,cE,uE,xA,RA,wf,fH,dH,Ja),ma=(pi(en(bf,At("p2p-stardust"),At("p2p")),en(bf,At("p2p-stardust"))),pi(en(bf,At("p2p")),xA,RA,At("p2p"))),PA=pi(en(ma,At("p2p-circuit"),ma),en(ma,At("p2p-circuit")),en(At("p2p-circuit"),ma),en(bf,At("p2p-circuit")),en(At("p2p-circuit"),bf),At("p2p-circuit")),NA=()=>pi(en(PA,NA),PA),Ou=NA();function MA(n){return function e(t){let r;try{r=new vn(t)}catch{return!1}const i=n(r.protoNames());return null!==i&&(!0===i||!1===i?i:0===i.length)}}function en(...n){function e(t){if(t.length(r="function"==typeof i?i().partialMatch(t):i.partialMatch(t),Array.isArray(r)&&(t=r),null===r)),r}return{toString:function(){return"{ "+n.join(" ")+" }"},input:n,matches:MA(e),partialMatch:e}}function pi(...n){function e(r){let i=null;return n.some(s=>{const o="function"==typeof s?s().partialMatch(r):s.partialMatch(r);return null!=o&&(i=o,!0)}),i}return{toString:function(){return"{ "+n.join(" ")+" }"},input:n,matches:MA(e),partialMatch:e}}function At(n){const e=n;return{toString:function(){return e},matches:function t(i){let s;try{s=new vn(i)}catch{return!1}const o=s.protoNames();return 1===o.length&&o[0]===e},partialMatch:function r(i){return 0===i.length?null:i[0]===e?i.slice(1):null}}}function OA(n){return n.filter(e=>{if(e.protoCodes().includes(290))return!1;const t=e.decapsulateCode(421);return Mu.matches(t)||ec.matches(t)})}pi(en(Ou,ma,Ou),en(ma,Ou),en(Ou,ma),Ou,ma);const lE=Symbol.for("@libp2p/transport"),va=Gt("libp2p:websockets");class pH{constructor(e){this.init=e}get[Symbol.toStringTag](){return"@libp2p/websockets"}get[lE](){return!0}dial(e,t){var r=this;return V(function*(){va("dialing %s",e),t=t??{};const s=function aH(n,e,t){const r={sink:i=>V(function*(){null!=t?.signal&&(i=Fs(i,t.signal));try{yield n.sink(i)}catch(s){"aborted"!==s.type&&TA.error(s)}})(),source:null!=(t=t??{}).signal?Fs(n.source,t.signal):n.source,remoteAddr:e,timeline:{open:Date.now()},close:()=>V(function*(){const i=Date.now();try{yield function oH(n,e){const{milliseconds:t,fallback:r,message:i,customTimers:s={setTimeout,clearTimeout}}=e;let o;const a=new Promise((c,m)=>{if("number"!=typeof t||1!==Math.sign(t))throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);if(t!==Number.POSITIVE_INFINITY){if(e.signal){const{signal:T}=e;T.aborted&&m(CA(T)),T.addEventListener("abort",()=>{m(CA(T))})}o=s.setTimeout.call(void 0,()=>{if(r){try{c(r())}catch(k){m(k)}return}const R=i instanceof Error?i:new iH("string"==typeof i?i:`Promise timed out after ${t} milliseconds`);"function"==typeof n.cancel&&n.cancel(),m(R)},t),V(function*(){try{c(yield n)}catch(T){m(T)}finally{s.clearTimeout.call(void 0,o)}})()}else c(n)});return a.clear=()=>{s.clearTimeout.call(void 0,o),o=void 0},a}(n.close(),{milliseconds:2e3})}catch{const{host:o,port:a}=r.remoteAddr.toOptions();TA("timeout closing stream to %s:%s after %dms, destroying it manually",o,a,Date.now()-i),n.destroy()}finally{r.timeline.close=Date.now()}})()};return null!=n.socket.once&&n.socket.once("close",()=>{null==r.timeline.close&&(r.timeline.close=Date.now())}),r}(yield r._connect(e,t),e);va("new outbound connection %s",s.remoteAddr);const o=yield t.upgrader.upgradeOutbound(s);return va("outbound connection %s upgraded",s.remoteAddr),o})()}_connect(e,t){var r=this;return V(function*(){if(!0===t?.signal?.aborted)throw new Nu;const i=e.toOptions();va("dialing %s:%s",i.host,i.port);const s=pm(),o=T=>{va.error("connection error:",T),s.reject(T)},a=function p9(n,e){e=e??{};const r=((n,e)=>(0,l9.relative)(n,e,f9,"ws"))(n,(typeof window>"u"?"":window.location).toString()),i=new i9(r,e.websocket);return u9(i,e)}(function q9(n,e){const t=new vn(n),r=n.toString().split("/").slice(1);return t.tuples().map(i=>({protocol:r.shift()??"",content:null!=i[1]?r.shift()??"":""})).reduce((i,s,o,a)=>{const c=W9[s.protocol];if(null==c)throw new Error(`Unsupported protocol ${s.protocol}`);return c(i,s.content,o,a,e)},"")}(e),r.init);if(null!=a.socket.on?a.socket.on("error",o):a.socket.onerror=o,null==t.signal)return yield Promise.race([a.connected(),s.promise]),va("connected %s",e),a;let c;const m=new Promise((T,R)=>{if(c=()=>{R(new Nu),setTimeout(()=>{a.close().catch(k=>{va.error("error closing raw socket",k)})})},!0===t?.signal?.aborted)return c();t?.signal?.addEventListener("abort",c)});try{yield Promise.race([m,s.promise,a.connected()])}finally{null!=c&&t?.signal?.removeEventListener("abort",c)}return va("connected %s",e),a})()}createListener(e){return function eH(){throw new Error("WebSocket Servers can not be created in the browser!")}()}filter(e){return e=Array.isArray(e)?e:[e],null!=this.init?.filter?this.init?.filter(e):fp||_A?function hH(n){return n.filter(e=>{if(e.protoCodes().includes(290))return!1;const t=e.decapsulateCode(421);return ec.matches(t)&&Ja.matches(t.decapsulateCode(6).decapsulateCode(478))})}(e):OA(e)}}var Bo,tc=function(n,e,t,r){if("a"===t&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?n!==e||!r:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===t?r:"a"===t?r.call(n):r?r.value:e.get(n)};class ki extends EventTarget{constructor(){super(...arguments),Bo.set(this,new Map)}listenerCount(e){const t=tc(this,Bo,"f").get(e);return null==t?0:t.length}addEventListener(e,t,r){super.addEventListener(e,t,r);let i=tc(this,Bo,"f").get(e);null==i&&(i=[],tc(this,Bo,"f").set(e,i)),i.push({callback:t,once:(!0!==r&&!1!==r&&r?.once)??!1})}removeEventListener(e,t,r){super.removeEventListener(e.toString(),t??null,r);let i=tc(this,Bo,"f").get(e);null!=i&&(i=i.filter(({callback:s})=>s!==t),tc(this,Bo,"f").set(e,i))}dispatchEvent(e){const t=super.dispatchEvent(e);let r=tc(this,Bo,"f").get(e.type);return null==r||(r=r.filter(({once:i})=>!i),tc(this,Bo,"f").set(e.type,r)),t}}Bo=new WeakMap;class gH extends Event{constructor(e,t){super(e,t),this.detail=t?.detail}}const rn=globalThis.CustomEvent??gH;var Ea=N(5357);const LA=(n,e)=>un(function*(){const t=yield ct(Ea(n));yield*jr(Tt(t.sort(e)),ct)})();var wa=N(7414),Ks=N(6225),kA=N(0);const Fo="/",BA=(new TextEncoder).encode(Fo),hp=BA[0];class Xr{constructor(e,t){if("string"==typeof e)this._buf=_t(e);else{if(!(e instanceof Uint8Array))throw new Error("Invalid key, should be String of Uint8Array");this._buf=e}if(null==t&&(t=!0),t&&this.clean(),0===this._buf.byteLength||this._buf[0]!==hp)throw new Error("Invalid key")}toString(e="utf8"){return Mt(this._buf,e)}uint8Array(){return this._buf}get[Symbol.toStringTag](){return`Key(${this.toString()})`}static withNamespaces(e){return new Xr(e.join(Fo))}static random(){return new Xr(((n=21)=>crypto.getRandomValues(new Uint8Array(n)).reduce((e,t)=>e+((t&=63)<36?t.toString(36):t<62?(t-26).toString(36).toUpperCase():t>62?"-":"_"),""))().replace(/-/g,""))}static asKey(e){return e instanceof Uint8Array||"string"==typeof e?new Xr(e):"function"==typeof e.uint8Array?new Xr(e.uint8Array()):null}clean(){if((null==this._buf||0===this._buf.byteLength)&&(this._buf=BA),this._buf[0]!==hp){const e=new Uint8Array(this._buf.byteLength+1);e.fill(hp,0,1),e.set(this._buf,1),this._buf=e}for(;this._buf.byteLength>1&&this._buf[this._buf.byteLength-1]===hp;)this._buf=this._buf.subarray(0,-1)}less(e){const t=this.list(),r=e.list();for(let i=0;io)return!1}return t.lengtht.namespaces()))])}}function _H(n){return[].concat(...n)}class SH extends class yH{open(){return Promise.reject(new Error(".open is not implemented"))}close(){return Promise.reject(new Error(".close is not implemented"))}put(e,t,r){return Promise.reject(new Error(".put is not implemented"))}get(e,t){return Promise.reject(new Error(".get is not implemented"))}has(e,t){return Promise.reject(new Error(".has is not implemented"))}delete(e,t){return Promise.reject(new Error(".delete is not implemented"))}putMany(e,t={}){var r=this;return un(function*(){var o,i=!1,s=!1;try{for(var c,a=Tt(e);i=!(c=yield ct(a.next())).done;i=!1){const{key:m,value:T}=c.value;yield ct(r.put(m,T,t)),yield{key:m,value:T}}}catch(m){s=!0,o=m}finally{try{i&&null!=a.return&&(yield ct(a.return()))}finally{if(s)throw o}}})()}getMany(e,t={}){var r=this;return un(function*(){var o,i=!1,s=!1;try{for(var c,a=Tt(e);i=!(c=yield ct(a.next())).done;i=!1){const m=c.value;yield r.get(m,t)}}catch(m){s=!0,o=m}finally{try{i&&null!=a.return&&(yield ct(a.return()))}finally{if(s)throw o}}})()}deleteMany(e,t={}){var r=this;return un(function*(){var o,i=!1,s=!1;try{for(var c,a=Tt(e);i=!(c=yield ct(a.next())).done;i=!1){const m=c.value;yield ct(r.delete(m,t)),yield m}}catch(m){s=!0,o=m}finally{try{i&&null!=a.return&&(yield ct(a.return()))}finally{if(s)throw o}}})()}batch(){var e=this;let t=[],r=[];return{put(i,s){t.push({key:i,value:s})},delete(i){r.push(i)},commit:(i=V(function*(s){yield wa(e.putMany(t,s)),t=[],yield wa(e.deleteMany(r,s)),r=[]}),function(o){return i.apply(this,arguments)})};var i}_all(e,t){return un(function*(){throw new Error("._all is not implemented")})()}_allKeys(e,t){return un(function*(){throw new Error("._allKeys is not implemented")})()}query(e,t){let r=this._all(e,t);if(null!=e.prefix&&(r=Ks(r,i=>i.key.toString().startsWith(e.prefix))),Array.isArray(e.filters)&&(r=e.filters.reduce((i,s)=>Ks(i,s),r)),Array.isArray(e.orders)&&(r=e.orders.reduce((i,s)=>LA(i,s),r)),null!=e.offset){let i=0;r=Ks(r,()=>i++>=e.offset)}return null!=e.limit&&(r=kA(r,e.limit)),r}queryKeys(e,t){let r=this._allKeys(e,t);if(null!=e.prefix&&(r=Ks(r,i=>i.toString().startsWith(e.prefix))),Array.isArray(e.filters)&&(r=e.filters.reduce((i,s)=>Ks(i,s),r)),Array.isArray(e.orders)&&(r=e.orders.reduce((i,s)=>LA(i,s),r)),null!=e.offset){let i=0;r=Ks(r,()=>i++>=e.offset)}return null!=e.limit&&(r=kA(r,e.limit)),r}}{constructor(){super(),this.data={}}open(){return Promise.resolve()}close(){return Promise.resolve()}put(e,t){var r=this;return V(function*(){r.data[e.toString()]=t})()}get(e){var t=this;return V(function*(){if(!(yield t.has(e)))throw function DH(n){return n=n||new Error("Not Found"),se(n,"ERR_NOT_FOUND")}();return t.data[e.toString()]})()}has(e){var t=this;return V(function*(){return void 0!==t.data[e.toString()]})()}delete(e){var t=this;return V(function*(){delete t.data[e.toString()]})()}_all(){var e=this;return un(function*(){yield*jr(Tt(Object.entries(e.data).map(([t,r])=>({key:new Xr(t),value:r}))),ct)})()}_allKeys(){var e=this;return un(function*(){yield*jr(Tt(Object.entries(e.data).map(([t])=>new Xr(t))),ct)})()}}var Cn=(()=>(function(n){n.NOT_STARTED_YET="The libp2p node is not started yet",n.DHT_DISABLED="DHT is not available",n.PUBSUB_DISABLED="PubSub is not available",n.CONN_ENCRYPTION_REQUIRED="At least one connection encryption module is required",n.ERR_TRANSPORTS_REQUIRED="At least one transport module is required",n.ERR_PROTECTOR_REQUIRED="Private network is enforced, but no protector was provided",n.NOT_FOUND="Not found"}(Cn||(Cn={})),Cn))(),Ie=(()=>(function(n){n.DHT_DISABLED="ERR_DHT_DISABLED",n.ERR_PUBSUB_DISABLED="ERR_PUBSUB_DISABLED",n.PUBSUB_NOT_STARTED="ERR_PUBSUB_NOT_STARTED",n.DHT_NOT_STARTED="ERR_DHT_NOT_STARTED",n.CONN_ENCRYPTION_REQUIRED="ERR_CONN_ENCRYPTION_REQUIRED",n.ERR_TRANSPORTS_REQUIRED="ERR_TRANSPORTS_REQUIRED",n.ERR_PROTECTOR_REQUIRED="ERR_PROTECTOR_REQUIRED",n.ERR_PEER_DIAL_INTERCEPTED="ERR_PEER_DIAL_INTERCEPTED",n.ERR_CONNECTION_INTERCEPTED="ERR_CONNECTION_INTERCEPTED",n.ERR_INVALID_PROTOCOLS_FOR_STREAM="ERR_INVALID_PROTOCOLS_FOR_STREAM",n.ERR_CONNECTION_ENDED="ERR_CONNECTION_ENDED",n.ERR_CONNECTION_FAILED="ERR_CONNECTION_FAILED",n.ERR_NODE_NOT_STARTED="ERR_NODE_NOT_STARTED",n.ERR_ALREADY_ABORTED="ERR_ALREADY_ABORTED",n.ERR_TOO_MANY_ADDRESSES="ERR_TOO_MANY_ADDRESSES",n.ERR_NO_VALID_ADDRESSES="ERR_NO_VALID_ADDRESSES",n.ERR_RELAYED_DIAL="ERR_RELAYED_DIAL",n.ERR_DIALED_SELF="ERR_DIALED_SELF",n.ERR_DISCOVERED_SELF="ERR_DISCOVERED_SELF",n.ERR_DUPLICATE_TRANSPORT="ERR_DUPLICATE_TRANSPORT",n.ERR_ENCRYPTION_FAILED="ERR_ENCRYPTION_FAILED",n.ERR_HOP_REQUEST_FAILED="ERR_HOP_REQUEST_FAILED",n.ERR_INVALID_KEY="ERR_INVALID_KEY",n.ERR_INVALID_MESSAGE="ERR_INVALID_MESSAGE",n.ERR_INVALID_PARAMETERS="ERR_INVALID_PARAMETERS",n.ERR_INVALID_PEER="ERR_INVALID_PEER",n.ERR_MUXER_UNAVAILABLE="ERR_MUXER_UNAVAILABLE",n.ERR_NOT_FOUND="ERR_NOT_FOUND",n.ERR_TIMEOUT="ERR_TIMEOUT",n.ERR_TRANSPORT_UNAVAILABLE="ERR_TRANSPORT_UNAVAILABLE",n.ERR_TRANSPORT_DIAL_FAILED="ERR_TRANSPORT_DIAL_FAILED",n.ERR_UNSUPPORTED_PROTOCOL="ERR_UNSUPPORTED_PROTOCOL",n.ERR_PROTOCOL_HANDLER_ALREADY_REGISTERED="ERR_PROTOCOL_HANDLER_ALREADY_REGISTERED",n.ERR_INVALID_MULTIADDR="ERR_INVALID_MULTIADDR",n.ERR_SIGNATURE_NOT_VALID="ERR_SIGNATURE_NOT_VALID",n.ERR_FIND_SELF="ERR_FIND_SELF",n.ERR_NO_ROUTERS_AVAILABLE="ERR_NO_ROUTERS_AVAILABLE",n.ERR_CONNECTION_NOT_MULTIPLEXED="ERR_CONNECTION_NOT_MULTIPLEXED",n.ERR_NO_DIAL_TOKENS="ERR_NO_DIAL_TOKENS",n.ERR_KEYCHAIN_REQUIRED="ERR_KEYCHAIN_REQUIRED",n.ERR_INVALID_CMS="ERR_INVALID_CMS",n.ERR_MISSING_KEYS="ERR_MISSING_KEYS",n.ERR_NO_KEY="ERR_NO_KEY",n.ERR_INVALID_KEY_NAME="ERR_INVALID_KEY_NAME",n.ERR_INVALID_KEY_TYPE="ERR_INVALID_KEY_TYPE",n.ERR_KEY_ALREADY_EXISTS="ERR_KEY_ALREADY_EXISTS",n.ERR_INVALID_KEY_SIZE="ERR_INVALID_KEY_SIZE",n.ERR_KEY_NOT_FOUND="ERR_KEY_NOT_FOUND",n.ERR_OLD_KEY_NAME_INVALID="ERR_OLD_KEY_NAME_INVALID",n.ERR_NEW_KEY_NAME_INVALID="ERR_NEW_KEY_NAME_INVALID",n.ERR_PASSWORD_REQUIRED="ERR_PASSWORD_REQUIRED",n.ERR_PEM_REQUIRED="ERR_PEM_REQUIRED",n.ERR_CANNOT_READ_KEY="ERR_CANNOT_READ_KEY",n.ERR_MISSING_PRIVATE_KEY="ERR_MISSING_PRIVATE_KEY",n.ERR_MISSING_PUBLIC_KEY="ERR_MISSING_PUBLIC_KEY",n.ERR_INVALID_OLD_PASS_TYPE="ERR_INVALID_OLD_PASS_TYPE",n.ERR_INVALID_NEW_PASS_TYPE="ERR_INVALID_NEW_PASS_TYPE",n.ERR_INVALID_PASS_LENGTH="ERR_INVALID_PASS_LENGTH",n.ERR_NOT_IMPLEMENTED="ERR_NOT_IMPLEMENTED",n.ERR_WRONG_PING_ACK="ERR_WRONG_PING_ACK",n.ERR_INVALID_RECORD="ERR_INVALID_RECORD",n.ERR_ALREADY_SUCCEEDED="ERR_ALREADY_SUCCEEDED",n.ERR_NO_HANDLER_FOR_PROTOCOL="ERR_NO_HANDLER_FOR_PROTOCOL",n.ERR_TOO_MANY_OUTBOUND_PROTOCOL_STREAMS="ERR_TOO_MANY_OUTBOUND_PROTOCOL_STREAMS",n.ERR_TOO_MANY_INBOUND_PROTOCOL_STREAMS="ERR_TOO_MANY_INBOUND_PROTOCOL_STREAMS"}(Ie||(Ie={})),Ie))(),fE=N(6930);function dE(n,e){return hE.apply(this,arguments)}function hE(){return hE=un(function*(n,e){yield*jr(Tt(fE(n,function(){var t=V(function*(r){return yield e.addressBook.add(r.id,r.multiaddrs),r});return function(r){return t.apply(this,arguments)}}())),ct)}),hE.apply(this,arguments)}function FA(n){const e=new Set;return Ks(n,t=>!e.has(t.id.toString())&&(e.add(t.id.toString()),!0))}function UA(n){return pE.apply(this,arguments)}function pE(){return pE=un(function*(n,e=1){let t=0;var s,r=!1,i=!1;try{for(var a,o=Tt(n);r=!(a=yield ct(o.next())).done;r=!1){const c=a.value;t++,yield c}}catch(c){i=!0,s=c}finally{try{r&&null!=o.return&&(yield ct(o.return()))}finally{if(i)throw s}}if(tun(function*(){try{yield yield ct(s.findPeer(e,t))}catch(o){VA.error(o)}})())),s=>Ks(s,Boolean),s=>dE(s,r.components.getPeerStore()),function(){var s=V(function*(o){return yield nc(o)});return function(o){return s.apply(this,arguments)}}());if(null!=i)return i;throw se(new Error(Cn.NOT_FOUND),Ie.ERR_NOT_FOUND)})()}getClosestPeers(e,t){var r=this;return un(function*(){if(0===r.routers.length)throw se(new Error("No peer routers available"),Ie.ERR_NO_ROUTERS_AVAILABLE);yield*jr(Tt(Ln(xh(...r.routers.map(i=>i.getClosestPeers(e,t))),i=>dE(i,r.components.getPeerStore()),i=>FA(i),i=>UA(i))),ct)})()}}class CH{constructor(e,t){this.routers=t.routers??[],this.started=!1,this.components=e}isStarted(){return this.started}start(){var e=this;return V(function*(){e.started=!0})()}stop(){var e=this;return V(function*(){e.started=!1})()}findProviders(e,t={}){var r=this;return un(function*(){if(0===r.routers.length)throw se(new Error("No content this.routers available"),Ie.ERR_NO_ROUTERS_AVAILABLE);yield*jr(Tt(Ln(xh(...r.routers.map(i=>i.findProviders(e,t))),i=>dE(i,r.components.getPeerStore()),i=>FA(i),i=>UA(i))),ct)})()}provide(e,t={}){var r=this;return V(function*(){if(0===r.routers.length)throw se(new Error("No content routers available"),Ie.ERR_NO_ROUTERS_AVAILABLE);yield Promise.all(r.routers.map(function(){var i=V(function*(s){return yield s.provide(e,t)});return function(s){return i.apply(this,arguments)}}()))})()}put(e,t,r){var i=this;return V(function*(){if(!i.isStarted())throw se(new Error(Cn.NOT_STARTED_YET),Ie.DHT_NOT_STARTED);const s=i.components.getDHT();null!=s&&(yield wa(s.put(e,t,r)))})()}get(e,t){var r=this;return V(function*(){if(!r.isStarted())throw se(new Error(Cn.NOT_STARTED_YET),Ie.DHT_NOT_STARTED);const i=r.components.getDHT();if(null!=i){var a,s=!1,o=!1;try{for(var m,c=Tt(i.get(e,t));s=!(m=yield c.next()).done;s=!1){const T=m.value;if("VALUE"===T.name)return T.value}}catch(T){o=!0,a=T}finally{try{s&&null!=c.return&&(yield c.return())}finally{if(o)throw a}}}throw se(new Error(Cn.NOT_FOUND),Ie.ERR_NOT_FOUND)})()}getMany(e,t,r){var i=this;return un(function*(){if(!i.isStarted())throw se(new Error(Cn.NOT_STARTED_YET),Ie.DHT_NOT_STARTED);if(null==t||0===t)return;let s=0;const o=i.components.getDHT();if(null!=o){var m,a=!1,c=!1;try{for(var R,T=Tt(o.get(e,r));a=!(R=yield ct(T.next())).done;a=!1){const k=R.value;if("VALUE"===k.name&&(yield{from:k.from,val:k.value},s++,s===t))break}}catch(k){c=!0,m=k}finally{try{a&&null!=T.return&&(yield ct(T.return()))}finally{if(c)throw m}}}if(0===s)throw se(new Error(Cn.NOT_FOUND),Ie.ERR_NOT_FOUND)})()}}function _f(n){if(DT(n))return{id:n,multiaddrs:[],protocols:[]};let e;return"string"==typeof n&&(n=new vn(n)),vn.isMultiaddr(n)&&(e=n,n=function TH(n){const e=n.getPeerId();if(null==e)throw se(new Error(`${n.toString()} does not have a valid peer type`),Ie.ERR_INVALID_MULTIADDR);try{return _r(e)}catch{throw se(new Error(`${n.toString()} is not a valid peer type`),Ie.ERR_INVALID_MULTIADDR)}}(n)),{id:n,multiaddrs:null!=e?[e]:[],protocols:[]}}const AH=n=>n;class xH extends ki{constructor(e,t){super();const{listen:r=[],announce:i=[]}=t;this.components=e,this.listen=new Set(r.map(s=>s.toString())),this.announce=new Set(i.map(s=>s.toString())),this.observed=new Set,this.announceFilter=t.announceFilter??AH}getListenAddrs(){return Array.from(this.listen).map(e=>new vn(e))}getAnnounceAddrs(){return Array.from(this.announce).map(e=>new vn(e))}getObservedAddrs(){return Array.from(this.observed).map(e=>new vn(e))}addObservedAddr(e){let t=new vn(e);const r=t.getPeerId();null!=r&&_r(r).equals(this.components.getPeerId())&&(t=t.decapsulate(new vn(`/p2p/${this.components.getPeerId().toString()}`)));const i=t.toString();this.observed.has(i)||(this.observed.add(i),this.dispatchEvent(new rn("change:addresses")))}getAddresses(){let e=this.getAnnounceAddrs().map(r=>r.toString());0===e.length&&(e=this.components.getTransportManager().getAddrs().map(r=>r.toString())),e=e.concat(this.getObservedAddrs().map(r=>r.toString()));const t=new Set(e);return this.announceFilter(Array.from(t).map(r=>new vn(r))).map(r=>r.getPeerId()===this.components.getPeerId().toString()?r:r.encapsulate(`/p2p/${this.components.getPeerId().toString()}`))}}const Df=N(7820),HA=Gt("libp2p:connection-manager:latency-monitor:visibility-change-emitter");class PH extends ki{constructor(){super(),this.hidden="hidden",this.visibilityChange="visibilityChange",null!=globalThis.document&&(this._initializeVisibilityVarNames(),this._addVisibilityChangeListener())}_initializeVisibilityVarNames(){let e="hidden",t="visibilitychange";typeof globalThis.document.hidden<"u"?(e="hidden",t="visibilitychange"):typeof globalThis.document.mozHidden<"u"?(e="mozHidden",t="mozvisibilitychange"):typeof globalThis.document.msHidden<"u"?(e="msHidden",t="msvisibilitychange"):typeof globalThis.document.webkitHidden<"u"&&(e="webkitHidden",t="webkitvisibilitychange"),this.hidden=e,this.visibilityChange=t}_addVisibilityChangeListener(){typeof globalThis.document.addEventListener>"u"||typeof document[this.hidden]>"u"?HA("Checking page visibility requires a browser that supports the Page Visibility API."):globalThis.document.addEventListener(this.visibilityChange,this._handleVisibilityChange.bind(this),!1)}isVisible(){if(void 0!==this.hidden&&void 0!==document[this.hidden])return null==document[this.hidden]}_handleVisibilityChange(){const e=!1===globalThis.document[this.hidden];HA(e?"Page Visible":"Page Hidden"),this.dispatchEvent(new rn("visibilityChange",{detail:e}))}}const Uo=Gt("libp2p:connection-manager:latency-monitor");class NH extends ki{constructor(e={}){super();const{latencyCheckIntervalMs:t,dataEmitIntervalMs:r,asyncTestFn:i,latencyRandomPercentage:s}=e;this.latencyCheckIntervalMs=t??500,this.latencyRandomPercentage=s??10,this.latencyCheckMultiply=this.latencyRandomPercentage/100*2*this.latencyCheckIntervalMs,this.latencyCheckSubtract=this.latencyCheckMultiply/2,this.dataEmitIntervalMs=null===r||0===r?void 0:r??5e3,Uo("latencyCheckIntervalMs: %s dataEmitIntervalMs: %s",this.latencyCheckIntervalMs,this.dataEmitIntervalMs),null!=this.dataEmitIntervalMs?Uo("Expecting ~%s events per summary",this.latencyCheckIntervalMs/this.dataEmitIntervalMs):Uo("Not emitting summaries"),this.asyncTestFn=i,null!=globalThis.process?.hrtime?(Uo("Using process.hrtime for timing"),this.now=globalThis.process.hrtime,this.getDeltaMS=o=>{const a=this.now(o);return 1e3*a[0]+a[1]/1e6}):typeof window<"u"&&null!=window.performance?.now?(Uo("Using performance.now for timing"),this.now=window.performance.now.bind(window.performance),this.getDeltaMS=o=>Math.round(this.now()-o)):(Uo("Using Date.now for timing"),this.now=Date.now,this.getDeltaMS=o=>this.now()-o),this.latencyData=this.initLatencyData()}start(){(function MH(){return typeof globalThis.window<"u"})()&&(this.visibilityChangeEmitter=new PH,this.visibilityChangeEmitter.addEventListener("visibilityChange",e=>{const{detail:t}=e;t?this._startTimers():(this._emitSummary(),this._stopTimers())})),!0===this.visibilityChangeEmitter?.isVisible()&&this._startTimers()}stop(){this._stopTimers()}_startTimers(){null==this.checkLatencyID&&(this.checkLatency(),null!=this.dataEmitIntervalMs&&(this.emitIntervalID=setInterval(()=>this._emitSummary(),this.dataEmitIntervalMs),"function"==typeof this.emitIntervalID.unref&&this.emitIntervalID.unref()))}_stopTimers(){null!=this.checkLatencyID&&(clearTimeout(this.checkLatencyID),this.checkLatencyID=void 0),null!=this.emitIntervalID&&(clearInterval(this.emitIntervalID),this.emitIntervalID=void 0)}_emitSummary(){const e=this.getSummary();e.events>0&&this.dispatchEvent(new rn("data",{detail:e}))}getSummary(){const e={events:this.latencyData.events,minMs:this.latencyData.minMs,maxMs:this.latencyData.maxMs,avgMs:this.latencyData.events>0?this.latencyData.totalMs/this.latencyData.events:Number.POSITIVE_INFINITY,lengthMs:this.getDeltaMS(this.latencyData.startTime)};return this.latencyData=this.initLatencyData(),Uo.trace("Summary: %O",e),e}checkLatency(){const e=Math.random()*this.latencyCheckMultiply-this.latencyCheckSubtract,t={deltaOffset:Math.ceil(this.latencyCheckIntervalMs+e),startTime:this.now()},r=()=>{if(null==this.checkLatencyID)return;const i=this.getDeltaMS(t.startTime)-t.deltaOffset;this.checkLatency(),this.latencyData.events++,this.latencyData.minMs=Math.min(this.latencyData.minMs,i),this.latencyData.maxMs=Math.max(this.latencyData.maxMs,i),this.latencyData.totalMs+=i,Uo.trace("MS: %s Data: %O",i,this.latencyData)};Uo.trace("localData: %O",t),this.checkLatencyID=setTimeout(()=>{null!=this.asyncTestFn?(t.deltaOffset=0,t.startTime=this.now(),this.asyncTestFn(r)):(t.deltaOffset-=1,r())},t.deltaOffset),"function"==typeof this.checkLatencyID.unref&&this.checkLatencyID.unref()}initLatencyData(){return{startTime:this.now(),minMs:Number.POSITIVE_INFINITY,maxMs:Number.NEGATIVE_INFINITY,events:0,totalMs:0}}}var Sf=N(2502);const jA="CLOSING",gE="CLOSED";var OH=N(8614);const $A=Gt("libp2p:dialer:dial-request");class LH{constructor(e){const{addrs:t,dialAction:r,dialer:i}=e;this.addrs=t,this.dialer=i,this.dialAction=r}run(e={}){var t=this;return V(function*(){const r=t.dialer.getTokens(t.addrs.length);if(r.length<1)throw se(new Error("No dial tokens available"),Ie.ERR_NO_DIAL_TOKENS);const i=new OH;for(const c of r)i.push(c).catch(m=>{$A.error(m)});const s=t.addrs.map(()=>{const c=new AbortController;try{(0,Jr.setMaxListeners)?.(1/0,c.signal)}catch{}return c});if(null!=e.signal)try{(0,Jr.setMaxListeners)?.(1/0,e.signal)}catch{}let o=0,a=!1;try{return yield Promise.any(t.addrs.map(function(){var c=V(function*(m,T){const R=yield i.shift();if(a)throw t.dialer.releaseToken(r.splice(r.indexOf(R),1)[0]),se(new Error("dialAction already succeeded"),Ie.ERR_ALREADY_SUCCEEDED);const k=s[T];if(null==k)throw se(new Error("dialAction did not come with an AbortController"),Ie.ERR_INVALID_PARAMETERS);let U;try{const Q=k.signal;U=yield t.dialAction(m,{...e,signal:null!=e.signal?(0,ip.anySignal)([Q,e.signal]):Q}),s[T]=void 0}finally{o++,t.addrs.length-o>=r.length?i.push(R).catch(Q=>{$A.error(Q)}):t.dialer.releaseToken(r.splice(r.indexOf(R),1)[0])}if(null==U)throw se(new Error("dialAction led to empty object"),Ie.ERR_TRANSPORT_DIAL_FAILED);return a=!0,U});return function(m,T){return c.apply(this,arguments)}}()))}finally{s.forEach(c=>{void 0!==c&&c.abort()}),r.forEach(c=>t.dialer.releaseToken(c))}})()}}var GA=N(4108);function zA(n){const{address:e}=n.nodeAddress();return Boolean(GA(e))}function yE(n,e){const t=zA(n.multiaddr),r=zA(e.multiaddr);return t&&!r?1:!t&&r||n.isCertified&&!e.isCertified?-1:!n.isCertified&&e.isCertified?1:0}var mE=N(4297);const js=Gt("libp2p:dialer"),YA="dialler";class HH{constructor(e={}){this.components=new ko,this.started=!1,this.addressSorter=e.addressSorter??yE,this.maxAddrsToDial=e.maxAddrsToDial??25,this.timeout=e.dialTimeout??3e4,this.maxDialsPerPeer=e.maxDialsPerPeer??4,this.tokens=[...new Array(e.maxParallelDials??100)].map((t,r)=>r),this.pendingDials=Ef({component:YA,metric:"pending-dials",metrics:e.metrics}),this.pendingDialTargets=Ef({component:YA,metric:"pending-dial-targets",metrics:e.metrics});for(const[t,r]of Object.entries(e.resolvers??{}))vn.resolvers.set(t,r)}init(e){this.components=e}isStarted(){return this.started}start(){var e=this;return V(function*(){e.started=!0})()}stop(){var e=this;return V(function*(){e.started=!1;for(const t of e.pendingDials.values())try{t.controller.abort()}catch(r){js.error(r)}e.pendingDials.clear();for(const t of e.pendingDialTargets.values())t.reject(new Nu("Dialer was destroyed"));e.pendingDialTargets.clear()})()}dial(e,t={}){var r=this;return V(function*(){const{id:i,multiaddrs:s}=_f(e);if(r.components.getPeerId().equals(i))throw se(new Error("Tried to dial self"),Ie.ERR_DIALED_SELF);if(js("check multiaddrs %p",i),null!=s&&s.length>0&&(js("storing multiaddrs %p",i,s),yield r.components.getPeerStore().addressBook.add(i,s)),yield r.components.getConnectionGater().denyDialPeer(i))throw se(new Error("The dial request is blocked by gater.allowDialPeer"),Ie.ERR_PEER_DIAL_INTERCEPTED);js("creating dial target for %p",i);const o=yield r._createCancellableDialTarget(i,t);if(0===o.addrs.length)throw se(new Error("The dial request has no valid addresses"),Ie.ERR_NO_VALID_ADDRESSES);const a=r.pendingDials.get(o.id)??r._createPendingDial(o,t);try{const c=yield a.promise;return js("dial succeeded to %s",o.id),c}catch(c){throw js("dial failed to %s",o.id,c),a.controller.signal.aborted&&(c.code=Ie.ERR_TIMEOUT),js.error(c),c}finally{a.destroy()}})()}_createCancellableDialTarget(e,t){var r=this;return V(function*(){const i=`${parseInt(String(1e9*Math.random()),10).toString()}${Date.now()}`,s=new Promise((o,a)=>{r.pendingDialTargets.set(i,{resolve:o,reject:a})});try{return yield Promise.race([r._createDialTarget(e,t),s])}finally{r.pendingDialTargets.delete(i)}})()}_createDialTarget(e,t){var r=this;return V(function*(){const i=yield Ln(yield r.components.getPeerStore().addressBook.get(e),a=>Ks(a,function(){var c=V(function*(m){return!(yield r.components.getConnectionGater().denyDialMultiaddr(e,m.multiaddr))});return function(m){return c.apply(this,arguments)}}()),a=>mE(a,r.addressSorter),a=>fE(a,c=>{const m=c.multiaddr;return e.toString()===m.getPeerId()?m:m.encapsulate(`/p2p/${e.toString()}`)}),function(){var a=V(function*(c){return yield Ea(c)});return function(c){return a.apply(this,arguments)}}()),s=[];for(const a of i)(yield r._resolve(a,t)).forEach(m=>s.push(m));const o=s.filter(a=>r.components.getTransportManager().transportForMultiaddr(a));if(o.length>r.maxAddrsToDial)throw yield r.components.getPeerStore().delete(e),se(new Error("dial with more addresses than allowed"),Ie.ERR_TOO_MANY_ADDRESSES);return{id:e.toString(),addrs:o}})()}_createPendingDial(e,t={}){var r=this;const i=function(){var T=V(function*(R,k={}){if(!0===k.signal?.aborted)throw se(new Error("already aborted"),Ie.ERR_ALREADY_ABORTED);return yield r.components.getTransportManager().dial(R,k).catch(U=>{throw js.error("dial to %s failed",R,U),U})});return function(k){return T.apply(this,arguments)}}(),s=new LH({addrs:e.addrs,dialAction:i,dialer:this}),o=new Bi.TimeoutController(this.timeout),a=[o.signal];null!=t.signal&&a.push(t.signal);const c=(0,ip.anySignal)(a);try{(0,Jr.setMaxListeners)?.(1/0,c)}catch{}const m={dialRequest:s,controller:o,promise:s.run({...t,signal:c}),destroy:()=>{o.clear(),this.pendingDials.delete(e.id)}};return this.pendingDials.set(e.id,m),m}getTokens(e){const t=Math.min(e,this.maxDialsPerPeer,this.tokens.length),r=this.tokens.splice(0,t);return js("%d tokens request, returning %d, %d remaining",e,t,this.tokens.length),r}releaseToken(e){this.tokens.includes(e)||(js("token %d released",e),this.tokens.push(e))}_resolve(e,t){var r=this;return V(function*(){if(!e.protoNames().includes("dnsaddr"))return[e];const s=yield r._resolveRecord(e,t);return(yield Promise.all(s.map(function(){var c=V(function*(m){return yield r._resolve(m,t)});return function(m){return c.apply(this,arguments)}}()))).flat().reduce((c,m)=>(null==c.find(T=>T.equals(m))&&c.push(m),c),[])})()}_resolveRecord(e,t){return V(function*(){try{return e=new vn(e.toString()),yield e.resolve(t)}catch(r){return js.error(`multiaddr ${e.toString()} could not be resolved`,r),[]}})()}}const gi=Gt("libp2p:connection-manager"),jH={maxConnections:1/0,minConnections:0,maxData:1/0,maxSentData:1/0,maxReceivedData:1/0,maxEventLoopDelay:1/0,pollInterval:2e3,autoDialInterval:1e4,movingAverageInterval:6e4},vE="libp2p",EE="connection-manager";class GH extends ki{constructor(e){if(super(),this.components=new ko,this.opts=Df.call({ignoreUndefined:!0},jH,e),this.opts.maxConnections{const t={inbound:0,outbound:0};for(const r of this.connections.values())for(const i of r)"inbound"===i.stat.direction?t.inbound++:t.outbound++;return t}}),this.components.getMetrics()?.updateComponentMetric({system:vE,component:EE,metric:"protocol-streams-total",label:"protocol",value:()=>{const t={};for(const r of this.connections.values())for(const i of r)for(const s of i.streams){const o=`${s.stat.direction} ${s.stat.protocol??"unnegotiated"}`;t[o]=(t[o]??0)+1}return t}}),this.components.getMetrics()?.updateComponentMetric({system:vE,component:EE,metric:"protocol-streams-per-connection-90th-percentile",label:"protocol",value:()=>{const t={};for(const i of this.connections.values())for(const s of i){const o={};for(const a of s.streams){const c=`${a.stat.direction} ${a.stat.protocol??"unnegotiated"}`;o[c]=(o[c]??0)+1}for(const[a,c]of Object.entries(o))t[a]=t[a]??[],t[a].push(c)}const r={};for(let[i,s]of Object.entries(t)){s=s.sort((a,c)=>a-c);const o=Math.floor(.9*s.length);r[i]=s[o]}return r}})}isStarted(){return this.started}start(){var e=this;return V(function*(){null!=e.components.getMetrics()&&(e.timer=e.timer??Sf(e._checkMetrics,e.opts.pollInterval)),e.latencyMonitor.start(),e._onLatencyMeasure=e._onLatencyMeasure.bind(e),e.latencyMonitor.addEventListener("data",e._onLatencyMeasure),yield e.dialer.start(),e.started=!0,gi("started")})()}afterStart(){var e=this;return V(function*(){e.components.getUpgrader().addEventListener("connection",e.onConnect),e.components.getUpgrader().addEventListener("connectionEnd",e.onDisconnect),Promise.resolve().then(V(function*(){const t=[];for(const r of yield e.components.getPeerStore().all())(yield e.components.getPeerStore().getTags(r.id)).filter(o=>"keep-alive"===o.name).length>0&&t.push(r.id);e.connectOnStartupController?.clear(),e.connectOnStartupController=new Bi.TimeoutController(e.startupReconnectTimeout);try{(0,Jr.setMaxListeners)?.(1/0,e.connectOnStartupController.signal)}catch{}yield Promise.all(t.map(function(){var r=V(function*(i){yield e.openConnection(i,{signal:e.connectOnStartupController?.signal}).catch(s=>{gi.error(s)})});return function(i){return r.apply(this,arguments)}}()))})).catch(t=>{gi.error(t)}).finally(()=>{e.connectOnStartupController?.clear()})})()}beforeStop(){var e=this;return V(function*(){e.connectOnStartupController?.abort(),e.components.getUpgrader().removeEventListener("connection",e.onConnect),e.components.getUpgrader().removeEventListener("connectionEnd",e.onDisconnect)})()}stop(){var e=this;return V(function*(){e.timer?.clear(),e.latencyMonitor.removeEventListener("data",e._onLatencyMeasure),e.latencyMonitor.stop(),yield e.dialer.stop(),e.started=!1,yield e._close(),gi("stopped")})()}_close(){var e=this;return V(function*(){const t=[];for(const r of e.connections.values())for(const i of r)t.push(V(function*(){try{yield i.close()}catch(s){gi.error(s)}})());gi("closing %d connections",t.length),yield Promise.all(t),e.connections.clear()})()}_checkMetrics(){var e=this;return V(function*(){const t=e.components.getMetrics();if(null!=t)try{const r=t.getGlobal().getMovingAverages(),i=r.dataReceived[e.opts.movingAverageInterval].movingAverage;yield e._checkMaxLimit("maxReceivedData",i);const s=r.dataSent[e.opts.movingAverageInterval].movingAverage;yield e._checkMaxLimit("maxSentData",s);const o=i+s;yield e._checkMaxLimit("maxData",o),gi.trace("metrics update",o)}finally{e.timer=Sf(e._checkMetrics,e.opts.pollInterval)}})()}onConnect(e){this._onConnect(e).catch(t=>{gi.error(t)})}_onConnect(e){var t=this;return V(function*(){const{detail:r}=e;if(!t.started)return void(yield r.close());const i=r.remotePeer,s=i.toString(),o=t.connections.get(s);null!=o?o.push(r):t.connections.set(s,[r]),null!=i.publicKey&&(yield t.components.getPeerStore().keyBook.set(i,i.publicKey));const a=t.getConnections().length,c=a-t.opts.maxConnections;yield t._checkMaxLimit("maxConnections",a,c),t.dispatchEvent(new rn("peer:connect",{detail:r}))})()}onDisconnect(e){const{detail:t}=e;if(!this.started)return;const r=t.remotePeer.toString();let i=this.connections.get(r);null!=i&&i.length>1?(i=i.filter(s=>s.id!==t.id),this.connections.set(r,i)):null!=i&&(this.connections.delete(r),this.dispatchEvent(new rn("peer:disconnect",{detail:t})),this.components.getMetrics()?.onPeerDisconnected(t.remotePeer))}getConnections(e){if(null!=e)return this.connections.get(e.toString())??[];let t=[];for(const r of this.connections.values())t=t.concat(r);return t}openConnection(e,t={}){var r=this;return V(function*(){gi("dial to %p",e);const i=r.getConnections(e);if(i.length>0)return gi("had an existing connection to %p",e),i[0];let s;if(null==t?.signal){s=new Bi.TimeoutController(r.dialTimeout),t.signal=s.signal;try{(0,Jr.setMaxListeners)?.(1/0,s.signal)}catch{}}try{const o=yield r.dialer.dial(e,t);let a=r.connections.get(e.toString());null==a&&(a=[],r.connections.set(e.toString(),a));let c=!1;for(const m of a)m.id===o.id&&(c=!0);return c||a.push(o),o}finally{s?.clear()}})()}closeConnections(e){var t=this;return V(function*(){const r=t.connections.get(e.toString())??[];yield Promise.all(r.map(function(){var i=V(function*(s){return yield s.close()});return function(s){return i.apply(this,arguments)}}()))})()}getAll(e){if(!DT(e))throw se(new Error("peerId must be an instance of peer-id"),Ie.ERR_INVALID_PARAMETERS);const t=e.toString(),r=this.connections.get(t);return null!=r?r.filter(i=>"OPEN"===i.stat.status):[]}_onLatencyMeasure(e){const{detail:t}=e;this._checkMaxLimit("maxEventLoopDelay",t.avgMs,1).catch(r=>{gi.error(r)})}_checkMaxLimit(e,t,r=1){var i=this;return V(function*(){const s=i.opts[e];gi.trace("checking limit of %s. current value: %d of %d",e,t,s),t>s&&(gi("%s: limit exceeded: %p, %d/%d, pruning %d connection(s)",i.components.getPeerId(),e,t,s,r),yield i._maybePruneConnections(r))})()}_maybePruneConnections(e){var t=this;return V(function*(){const r=t.getConnections();if(r.length<=t.opts.minConnections||e<1)return;const i=new $T;for(const a of r){const c=a.remotePeer;if(i.has(c))continue;const m=yield t.components.getPeerStore().getTags(c);i.set(c,m.reduce((T,R)=>T+R.value,0))}const s=r.sort((a,c)=>{const m=i.get(a.remotePeer)??0,T=i.get(c.remotePeer)??0;return m>T?1:m{ba.error("could start autodial",t)}),ba("started")):ba("not enabled")})()}stop(){var e=this;return V(function*(){e.options.enabled?(e.running=!1,null!=e.autoDialTimeout&&e.autoDialTimeout.clear(),ba("stopped")):ba("not enabled")})()}_autoDial(){var e=this;return V(function*(){null!=e.autoDialTimeout&&e.autoDialTimeout.clear();const t=e.options.minConnections;if(e.components.getConnectionManager().getConnections().length>=t)return void(e.autoDialTimeout=Sf(e._autoDial,e.options.autoDialInterval));const r=yield e.components.getPeerStore().all(),i=yield Ln(r.sort(()=>Math.random()>.5?1:-1),s=>Ks(s,o=>!o.id.equals(e.components.getPeerId())),s=>mE(s,(o,a)=>a.protocols.length>o.protocols.length||null!=a.id.publicKey&&null==o.id.publicKey?1:-1),function(){var s=V(function*(o){return yield Ea(o)});return function(o){return s.apply(this,arguments)}}());for(let s=0;e.running&&sNh(t)}(e=n.Status||(n.Status={})),function(a){a.HOP="HOP",a.STOP="STOP",a.STATUS="STATUS",a.CAN_HOP="CAN_HOP"}(r=n.Type||(n.Type={})),function(a){a[a.HOP=1]="HOP",a[a.STOP=2]="STOP",a[a.STATUS=3]="STATUS",a[a.CAN_HOP=4]="CAN_HOP"}(i||(i={})),function(a){a.codec=()=>Nh(i)}(r=n.Type||(n.Type={})),function(a){let c;a.codec=()=>(null==c&&(c=fi((m,T,R={})=>{if(!1!==R.lengthDelimited&&T.fork(),null==m.id)throw new Error('Protocol error: required field "id" was not found in object');if(T.uint32(10),T.bytes(m.id),null==m.addrs)throw new Error('Protocol error: required field "addrs" was not found in object');for(const k of m.addrs)T.uint32(18),T.bytes(k);!1!==R.lengthDelimited&&T.ldelim()},(m,T)=>{const R={},k=null==T?m.len:m.pos+T;for(;m.pos>>3){case 1:R.id=m.bytes();break;case 2:R.addrs=R.addrs??[],R.addrs.push(m.bytes());break;default:m.skipType(7&U)}}if(R.addrs=R.addrs??[],null==R.id)throw new Error('Protocol error: value for required field "id" was not found in protobuf');if(null==R.addrs)throw new Error('Protocol error: value for required field "addrs" was not found in protobuf');return R})),c),a.encode=m=>li(m,a.codec()),a.decode=m=>ui(m,a.codec())}(s=n.Peer||(n.Peer={})),n.codec=()=>(null==o&&(o=fi((a,c,m={})=>{!1!==m.lengthDelimited&&c.fork(),null!=a.type&&(c.uint32(8),n.Type.codec().encode(a.type,c)),null!=a.srcPeer&&(c.uint32(18),n.Peer.codec().encode(a.srcPeer,c)),null!=a.dstPeer&&(c.uint32(26),n.Peer.codec().encode(a.dstPeer,c)),null!=a.code&&(c.uint32(32),n.Status.codec().encode(a.code,c)),!1!==m.lengthDelimited&&c.ldelim()},(a,c)=>{const m={},T=null==c?a.len:a.pos+c;for(;a.pos>>3){case 1:m.type=n.Type.codec().decode(a);break;case 2:m.srcPeer=n.Peer.codec().decode(a,a.uint32());break;case 3:m.dstPeer=n.Peer.codec().decode(a,a.uint32());break;case 4:m.code=n.Status.codec().decode(a);break;default:a.skipType(7&R)}}return m})),o),n.encode=a=>li(a,n.codec()),n.decode=a=>ui(a,n.codec())}(sn||(sn={}));const qH=Gt("libp2p:stream:converter");function ZA(n,e={}){const{stream:t,remoteAddr:r}=n,{sink:i,source:s}=t,o=un(function*(){var k,T=!1,R=!1;try{for(var Q,U=Tt(s);T=!(Q=yield ct(U.next())).done;T=!1){const X=Q.value;yield*jr(Tt(X),ct)}}catch(X){R=!0,k=X}finally{try{T&&null!=U.return&&(yield ct(U.return()))}finally{if(R)throw k}}})(),a={sink:T=>V(function*(){null!=e.signal&&(T=Fs(T,e.signal));try{yield i(T),yield c()}catch(R){"aborted"!==R.type&&qH(R)}})(),source:null!=e.signal?Fs(o,e.signal):o,remoteAddr:r,timeline:{open:Date.now(),close:void 0},close:()=>V(function*(){yield i(un(function*(){yield new Uint8Array(0)})()),yield c()})()};function c(){return m.apply(this,arguments)}function m(){return(m=V(function*(){return null==a.timeline.close&&(a.timeline.close=Date.now()),yield Promise.resolve()})).apply(this,arguments)}return a}const If="/libp2p/circuit/relay/0.1.0";function XA(n,e){n.write({type:sn.Type.STATUS,code:e})}function JA(n,e){try{null!=n.dstPeer?.addrs&&n.dstPeer.addrs.forEach(t=>new vn(t))}catch(t){throw XA(e,n.type===sn.Type.HOP?sn.Status.HOP_DST_MULTIADDR_INVALID:sn.Status.STOP_DST_MULTIADDR_INVALID),t}try{null!=n.srcPeer?.addrs&&n.srcPeer.addrs.forEach(t=>new vn(t))}catch(t){throw XA(e,n.type===sn.Type.HOP?sn.Status.HOP_SRC_MULTIADDR_INVALID:sn.Status.STOP_SRC_MULTIADDR_INVALID),t}}const Cf=Gt("libp2p:circuit:stream-handler");class gp{constructor(e){const{stream:t,maxLength:r=4096}=e;this.stream=t,this.shake=Ch(this.stream),this.decoder=Ms.fromReader(this.shake.reader,{maxDataLength:r})}read(){var e=this;return V(function*(){const t=yield e.decoder.next();if(null!=t.value){const r=sn.decode(t.value);return Cf("read message type",r.type),r}Cf("read received no value, closing stream"),e.close()})()}write(e){Cf("write message type %s",e.type),this.shake.write(to.single(sn.encode(e)))}rest(){return this.shake.rest(),this.shake.stream}end(e){this.write(e),this.close()}close(){Cf("closing the stream"),this.rest().sink([]).catch(e=>{Cf.error(e)})}}const Tf=Gt("libp2p:circuit:stop");function ZH(n){return wE.apply(this,arguments)}function wE(){return wE=V(function*(n){const{connection:e,request:t,signal:r}=n,i=yield e.newStream(If,{signal:r});Tf("starting stop request to %p",e.remotePeer);const s=new gp({stream:i});s.write(t);const o=yield s.read();if(null!=o)return o.code===sn.Status.SUCCESS?(Tf("stop request to %p was successful",e.remotePeer),s.rest()):(Tf("stop request failed with code %d",o.code),void s.close());s.close()}),wE.apply(this,arguments)}const ps=Gt("libp2p:circuit:hop");function bE(){return bE=V(function*(n){const{connection:e,request:t,streamHandler:r,circuit:i,connectionManager:s}=n;if(!i.hopEnabled())return ps("HOP request received but we are not acting as a relay"),r.end({type:sn.Type.STATUS,code:sn.Status.HOP_CANT_SPEAK_RELAY});try{JA(t,r)}catch(R){return void ps.error("invalid hop request via peer %p %o",e.remotePeer,R)}if(null==t.dstPeer)return void ps("HOP request received but we do not receive a dstPeer");const o=pa(t.dstPeer.id),a=s.getConnections(o);if(0===a.length&&!i.hopActive())return ps("HOP request received but we are not connected to the destination peer"),r.end({type:sn.Type.STATUS,code:sn.Status.HOP_NO_CONN_TO_DST});if(0===a.length)return ps("did not have connection to remote peer"),r.end({type:sn.Type.STATUS,code:sn.Status.HOP_NO_CONN_TO_DST});const c={type:sn.Type.STOP,dstPeer:t.dstPeer,srcPeer:t.srcPeer};let m;try{ps("performing STOP request");const R=yield ZH({connection:a[0],request:c});if(null==R)throw new Error("Could not stop");m=R}catch(R){return void ps.error(R)}ps("hop request from %p is valid",e.remotePeer),r.write({type:sn.Type.STATUS,code:sn.Status.SUCCESS});const T=r.rest();return ps("creating related connections"),yield Ln(T,m,T)}),bE.apply(this,arguments)}function _E(){return _E=V(function*(n){const{connection:e,request:t,signal:r}=n,i=yield e.newStream(If,{signal:r}),s=new gp({stream:i});s.write(t);const o=yield s.read();if(null==o)throw se(new Error("HOP request had no response"),Ie.ERR_HOP_REQUEST_FAILED);if(o.code===sn.Status.SUCCESS)return ps("hop request was successful"),s.rest();throw ps("hop request failed with code %d, closing stream",o.code),s.close(),se(new Error(`HOP request failed with code "${o.code??"unknown"}"`),Ie.ERR_HOP_REQUEST_FAILED)}),_E.apply(this,arguments)}function DE(){return DE=V(function*(n){const{connection:e,signal:t}=n,r=yield e.newStream(If,{signal:t}),i=new gp({stream:r});i.write({type:sn.Type.CAN_HOP});const s=yield i.read();return yield i.close(),!(null==s||s.code!==sn.Status.SUCCESS)}),DE.apply(this,arguments)}const gs=Gt("libp2p:circuit");class nK{constructor(e){this.components=new ko,this._init=e}init(e){this.components=e,this.components.getRegistrar().handle(If,t=>{this._onProtocol(t).catch(r=>{gs.error(r)})}).catch(t=>{gs.error(t)})}hopEnabled(){return!0}hopActive(){return!0}get[lE](){return!0}get[Symbol.toStringTag](){return"libp2p/circuit-relay-v1"}_onProtocol(e){var t=this;return V(function*(){const{connection:r,stream:i}=e,s=new Bi.TimeoutController(t._init.hop.timeout);try{(0,Jr.setMaxListeners)?.(1/0,s.signal)}catch{}try{const o=ga(i,s.signal),a=new gp({stream:{...i,...o}}),c=yield a.read();if(null==c)return gs("request was invalid, could not read from stream"),a.write({type:sn.Type.STATUS,code:sn.Status.MALFORMED_MESSAGE}),void a.close();let m;switch(c.type){case sn.Type.CAN_HOP:gs("received CAN_HOP request from %p",r.remotePeer),yield function tK(n){const{connection:e,streamHandler:t,circuit:r}=n,i=r.hopEnabled();ps("can hop (%s) request from %p",i,e.remotePeer),t.end({type:sn.Type.STATUS,code:i?sn.Status.SUCCESS:sn.Status.HOP_CANT_SPEAK_RELAY})}({circuit:t,connection:r,streamHandler:a});break;case sn.Type.HOP:gs("received HOP request from %p",r.remotePeer),yield function XH(n){return bE.apply(this,arguments)}({connection:r,request:c,streamHandler:a,circuit:t,connectionManager:t.components.getConnectionManager()});break;case sn.Type.STOP:gs("received STOP request from %p",r.remotePeer),m=yield function YH(n){const{connection:e,request:t,streamHandler:r}=n;try{JA(t,r)}catch(i){return void Tf.error("invalid stop request via peer %p %o",e.remotePeer,i)}return Tf("stop request is valid"),r.write({type:sn.Type.STATUS,code:sn.Status.SUCCESS}),r.rest()}({connection:r,request:c,streamHandler:a});break;default:return gs("Request of type %s not supported",c.type),a.write({type:sn.Type.STATUS,code:sn.Status.MALFORMED_MESSAGE}),void a.close()}if(null!=m){const k=ZA({stream:m,remoteAddr:r.remoteAddr.encapsulate("/p2p-circuit").encapsulate(new vn(c.dstPeer?.addrs[0])),localAddr:new vn(c.srcPeer?.addrs[0])}),U=c.type===sn.Type.HOP?"relay":"inbound";gs("new %s connection %s",U,k.remoteAddr);const Q=yield t.components.getUpgrader().upgradeInbound(k);gs("%s connection %s upgraded",U,k.remoteAddr),null!=t.handler&&t.handler(Q)}}finally{s.clear()}})()}dial(e,t={}){var r=this;return V(function*(){const i=e.toString().split("/p2p-circuit"),s=new vn(i[0]),o=new vn(i[i.length-1]),a=s.getPeerId(),c=o.getPeerId();if(null==a||null==c){const Q="Circuit relay dial failed as addresses did not have peer id";throw gs.error(Q),se(new Error(Q),Ie.ERR_RELAYED_DIAL)}const m=_r(a),T=_r(c);let R=!1,U=r.components.getConnectionManager().getConnections(m)[0];null==U&&(yield r.components.getPeerStore().addressBook.add(m,[s]),U=yield r.components.getConnectionManager().openConnection(m,t),R=!0);try{const Q=yield function JH(n){return _E.apply(this,arguments)}({...t,connection:U,request:{type:sn.Type.HOP,srcPeer:{id:r.components.getPeerId().toBytes(),addrs:r.components.getAddressManager().getAddresses().map(he=>he.bytes)},dstPeer:{id:T.toBytes(),addrs:[new vn(o).bytes]}}}),X=s.encapsulate(`/p2p-circuit/p2p/${r.components.getPeerId().toString()}`),ae=ZA({stream:Q,remoteAddr:e,localAddr:X});return gs("new outbound connection %s",ae.remoteAddr),yield r.components.getUpgrader().upgradeOutbound(ae)}catch(Q){throw gs.error("Circuit relay dial failed",Q),R&&(yield U.close()),Q}})()}createListener(e){return this.handler=e.handler,function QH(n){const e=new Map;function r(){return(r=V(function*(o){const a=o.toString().split("/p2p-circuit").find(U=>""!==U),c=new vn(a),m=c.getPeerId();if(null==m)throw new Error("Could not determine relay peer from multiaddr");const T=_r(m);yield n.peerStore.addressBook.add(T,[c]);const R=yield n.connectionManager.openConnection(T),k=R.remoteAddr.encapsulate("/p2p-circuit");e.set(R.remotePeer.toString(),k),s.dispatchEvent(new rn("listening"))})).apply(this,arguments)}const s=Object.assign(new ki,{close:(o=V(function*(){return yield Promise.resolve()}),function(){return o.apply(this,arguments)}),listen:function t(o){return r.apply(this,arguments)},getAddrs:function i(){const o=[];for(const a of e.values())o.push(a);return o}});var o;return n.connectionManager.addEventListener("peer:disconnect",o=>{const{detail:a}=o;e.delete(a.remotePeer.toString())&&s.dispatchEvent(new rn("close"))}),s}({connectionManager:this.components.getConnectionManager(),peerStore:this.components.getPeerStore()})}filter(e){return(e=Array.isArray(e)?e:[e]).filter(t=>Ou.matches(t))}}function ex(n){return SE.apply(this,arguments)}function SE(){return SE=V(function*(n){const e=(new TextEncoder).encode(n),t=yield Li.digest(e);return Rr.createV0(t)}),SE.apply(this,arguments)}const nx="hop_relay",ix="/libp2p/relay",Af=Gt("libp2p:auto-relay"),oK=()=>{};class aK{constructor(e,t){this.components=e,this.addressSorter=t.addressSorter??yE,this.maxListeners=t.maxListeners??1,this.listenRelays=new Set,this.onError=t.onError??oK,this._onProtocolChange=this._onProtocolChange.bind(this),this._onPeerDisconnected=this._onPeerDisconnected.bind(this),this.components.getPeerStore().addEventListener("change:protocols",r=>{this._onProtocolChange(r).catch(i=>{Af.error(i)})}),this.components.getConnectionManager().addEventListener("peer:disconnect",this._onPeerDisconnected)}_onProtocolChange(e){var t=this;return V(function*(){const{peerId:r,protocols:i}=e.detail,s=r.toString();if(null!=i.find(a=>a===If)){if(!t.listenRelays.has(s))try{const a=t.components.getConnectionManager().getConnections(r);if(0===a.length)return;const c=a[0];if(c.remoteAddr.protoCodes().includes(290))return void Af(`relayed connection to ${s} will not be used to hop on`);(yield function eK(n){return DE.apply(this,arguments)}({connection:c}))&&(yield t.components.getPeerStore().metadataBook.setValue(r,nx,_t("true")),yield t._addListenRelay(c,s))}catch(a){t.onError(a)}}else t.listenRelays.has(s)&&(yield t._removeListenRelay(s))})()}_onPeerDisconnected(e){const i=e.detail.remotePeer.toString();!this.listenRelays.has(i)||this._removeListenRelay(i).catch(s=>{Af.error(s)})}_addListenRelay(e,t){var r=this;return V(function*(){try{if(r.listenRelays.size>=r.maxListeners)return;const i=yield Ln(yield r.components.getPeerStore().addressBook.get(e.remotePeer),o=>mE(o,r.addressSorter),function(){var o=V(function*(a){return yield Ea(a)});return function(a){return o.apply(this,arguments)}}());(yield Promise.all(i.map(function(){var o=V(function*(a){try{let c=a.multiaddr;return null==c.getPeerId()&&(c=c.encapsulate(`/p2p/${e.remotePeer.toString()}`)),c=c.encapsulate("/p2p-circuit"),yield r.components.getTransportManager().listen([c]),!0}catch(c){Af.error("error listening on circuit address",c),r.onError(c)}return!1});return function(a){return o.apply(this,arguments)}}()))).includes(!0)&&r.listenRelays.add(t)}catch(i){r.onError(i),r.listenRelays.delete(t)}})()}_removeListenRelay(e){var t=this;return V(function*(){t.listenRelays.delete(e)&&(yield t._listenOnAvailableHopRelays([e]))})()}_listenOnAvailableHopRelays(e=[]){var t=this;return V(function*(){if(t.listenRelays.size>=t.maxListeners)return;const r=[],i=yield t.components.getPeerStore().all();for(const{id:T,metadata:R}of i){const k=T.toString();if(t.listenRelays.has(k)||e.includes(k))continue;const U=R.get(nx);if(null==U||"true"!==Mt(U))continue;const Q=t.components.getConnectionManager().getConnections(T);if(0!==Q.length){if(yield t._addListenRelay(Q[0],k),t.listenRelays.size>=t.maxListeners)return}else r.push(T)}for(const T of r)if(yield t._tryToListenOnRelay(T),t.listenRelays.size>=t.maxListeners)return;try{const T=yield ex(ix);var a,s=!1,o=!1;try{for(var m,c=Tt(t.components.getContentRouting().findProviders(T));s=!(m=yield c.next()).done;s=!1){const R=m.value;if(0===R.multiaddrs.length)continue;const k=R.id;if(!k.equals(t.components.getPeerId())&&(yield t.components.getPeerStore().addressBook.add(k,R.multiaddrs),yield t._tryToListenOnRelay(k),t.listenRelays.size>=t.maxListeners))return}}catch(R){o=!0,a=R}finally{try{s&&null!=c.return&&(yield c.return())}finally{if(o)throw a}}}catch(T){t.onError(T)}})()}_tryToListenOnRelay(e){var t=this;return V(function*(){try{const r=yield t.components.getConnectionManager().openConnection(e);yield t._addListenRelay(r,e.toString())}catch(r){Af.error("Could not use %p as relay",e,r),t.onError(r,`could not connect and listen on known hop relay ${e.toString()}`)}})()}}const sx=Gt("libp2p:relay");class cK{constructor(e,t){this.components=e,this.autoRelay=!1!==t.autoRelay?.enabled?new aK(e,{addressSorter:t.addressSorter,...t.autoRelay}):void 0,this.started=!1,this.init=t,this._advertiseService=this._advertiseService.bind(this)}isStarted(){return this.started}start(){var e=this;return V(function*(){!1!==e.init.hop.enabled&&!1!==e.init.advertise.enabled&&(e.timeout=(0,pp.setDelayedInterval)(e._advertiseService,e.init.advertise.ttl,e.init.advertise.bootDelay)),e.started=!0})()}stop(){var e=this;return V(function*(){null!=e.timeout&&(0,pp.clearDelayedInterval)(e.timeout),e.started=!1})()}_advertiseService(){var e=this;return V(function*(){try{const t=yield ex(ix);yield e.components.getContentRouting().provide(t)}catch(t){t.code===Ie.ERR_NO_ROUTERS_AVAILABLE?(sx.error("a content router, such as a DHT, must be provided in order to advertise the relay service",t),yield e.stop()):sx.error(t)}})()}}var uK=N(9014);N(422),N(5911);const ox=Gn.pki;function IE(){return IE=V(function*(n,e){const t=n.map(e);return n[(yield Promise.all(t)).findIndex(s=>s)]}),IE.apply(this,arguments)}const dK=Gt("libp2p:keychain:cms"),CE=new WeakMap;class hK{constructor(e,t){if(null==e)throw se(new Error("keychain is required"),Ie.ERR_KEYCHAIN_REQUIRED);this.keychain=e,CE.set(this,{dek:t})}encrypt(e,t){var r=this;return V(function*(){if(!(t instanceof Uint8Array))throw se(new Error("Plain data must be a Uint8Array"),Ie.ERR_INVALID_PARAMETERS);const i=yield r.keychain.findKeyByName(e),s=yield r.keychain.getPrivateKey(e),o=CE.get(r);if(null==o)throw se(new Error("dek missing"),Ie.ERR_INVALID_PARAMETERS);const c=Gn.pki.decryptRsaPrivateKey(s,o.dek),m=yield((n,e)=>{const t=ox.rsa.setPublicKey(e.n,e.e),r=ox.createCertificate();r.publicKey=t,r.serialNumber="01",r.validity.notBefore=new Date,r.validity.notAfter=new Date,r.validity.notAfter.setFullYear(r.validity.notBefore.getFullYear()+10);const i=[{name:"organizationName",value:"ipfs"},{shortName:"OU",value:"keystore"},{name:"commonName",value:n.id}];return r.setSubject(i),r.setIssuer(i),r.setExtensions([{name:"basicConstraints",cA:!0},{name:"keyUsage",keyCertSign:!0,digitalSignature:!0,nonRepudiation:!0,keyEncipherment:!0,dataEncipherment:!0},{name:"extKeyUsage",serverAuth:!0,clientAuth:!0,codeSigning:!0,emailProtection:!0,timeStamping:!0},{name:"nsCertType",client:!0,server:!0,email:!0,objsign:!0,sslCA:!0,emailCA:!0,objCA:!0}]),r.sign(e),r})(i,c),T=Gn.pkcs7.createEnvelopedData();return T.addRecipient(m),T.content=Gn.util.createBuffer(t),T.encrypt(),_t(Gn.asn1.toDer(T.toAsn1()).getBytes(),"ascii")})()}decrypt(e){var t=this;return V(function*(){if(!(e instanceof Uint8Array))throw se(new Error("CMS data is required"),Ie.ERR_INVALID_PARAMETERS);let r;try{const R=Gn.util.createBuffer(Mt(e,"ascii")),k=Gn.asn1.fromDer(R);r=Gn.pkcs7.messageFromAsn1(k)}catch(R){throw dK.error(R),se(new Error("Invalid CMS"),Ie.ERR_INVALID_CMS)}const i=r.recipients.filter(R=>R.issuer.find(k=>"O"===k.shortName&&"ipfs"===k.value)).filter(R=>R.issuer.find(k=>"CN"===k.shortName)).map(R=>({recipient:R,keyId:R.issuer.find(k=>"CN"===k.shortName).value})),s=yield function fK(n,e){return IE.apply(this,arguments)}(i,function(){var R=V(function*(k){try{if(null!=(yield t.keychain.findKeyById(k.keyId)))return!0}catch{return!1}return!1});return function(k){return R.apply(this,arguments)}}());if(null==s){const R=i.map(k=>k.keyId);throw se(new Error(`Decryption needs one of the key(s): ${R.join(", ")}`),Ie.ERR_MISSING_KEYS,{missingKeys:R})}const o=yield t.keychain.findKeyById(s.keyId);if(null==o)throw se(new Error("No key available to decrypto"),Ie.ERR_NO_KEY);const a=yield t.keychain.getPrivateKey(o.name),c=CE.get(t);if(null==c)throw se(new Error("dek missing"),Ie.ERR_INVALID_PARAMETERS);const T=Gn.pki.decryptRsaPrivateKey(a,c.dek);return r.decrypt(s.recipient,T),_t(r.content.getBytes(),"ascii")})()}}N(1298);var pK=N(7949);const cx={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};function ux(n,e,t,r,i){if("sha1"!==i&&"sha2-256"!==i&&"sha2-512"!==i){const a=Object.keys(cx).join(" / ");throw se(new Error(`Hash '${i}' is unknown or not supported. Must be ${a}`),"ERR_UNSUPPORTED_HASH_TYPE")}const o=pK(n,e,t,r,cx[i]);return wU.encode64(o,null)}const yp=Gt("libp2p:keychain"),_a=new WeakMap,AE={dek:{keyLength:64,iterationCount:1e4,salt:"you should override this value with a crypto secure random number",hash:"sha2-512"}};function Vo(n){return null!=n&&"string"==typeof n&&n===uK(n.trim())&&n.length>0}function Hn(){return xE.apply(this,arguments)}function xE(){return(xE=V(function*(){const t=800*Math.random()+200;yield new Promise(r=>setTimeout(r,t))})).apply(this,arguments)}function oo(n){return new Xr("/pkcs8/"+n)}function Ho(n){return new Xr("/info/"+n)}class fx{constructor(e,t){if(this.components=e,this.init=Df(AE,t),null!=this.init.pass&&this.init.pass?.length<20)throw new Error("pass must be least 20 characters");if(null!=this.init.dek?.keyLength&&this.init.dek.keyLength<14)throw new Error("dek.keyLength must be least 14 bytes");if(null!=this.init.dek?.salt?.length&&this.init.dek.salt.length<16)throw new Error("dek.saltLength must be least 16 bytes");if(null!=this.init.dek?.iterationCount&&this.init.dek.iterationCount<1e3)throw new Error("dek.iterationCount must be least 1000");const r=null!=this.init.pass&&null!=this.init.dek?.salt?ux(this.init.pass,this.init.dek?.salt,this.init.dek?.iterationCount,this.init.dek?.keyLength,this.init.dek?.hash):"";_a.set(this,{dek:r}),this.started=!1}isStarted(){return this.started}start(){var e=this;return V(function*(){const t=Ho("self");(yield e.components.getDatastore().has(t))||(yield e.importPeer("self",e.components.getPeerId())),e.started=!0})()}stop(){this.started=!1}get cms(){const e=_a.get(this);if(null==e)throw se(new Error("dek missing"),Ie.ERR_INVALID_PARAMETERS);return new hK(this,e.dek)}static generateOptions(){const e=Object.assign({},AE),t=3*Math.ceil(16/3);return e.dek.salt=Mt(sf(t),"base64"),e}static get options(){return AE}createKey(e,t,r=2048){var i=this;return V(function*(){if(!Vo(e)||"self"===e)throw yield Hn(),se(new Error("Invalid key name"),Ie.ERR_INVALID_KEY_NAME);if("string"!=typeof t)throw yield Hn(),se(new Error("Invalid key type"),Ie.ERR_INVALID_KEY_TYPE);const s=oo(e);if(yield i.components.getDatastore().has(s))throw yield Hn(),se(new Error("Key name already exists"),Ie.ERR_KEY_ALREADY_EXISTS);if("rsa"===t.toLowerCase()&&(!Number.isSafeInteger(r)||r<2048))throw yield Hn(),se(new Error("Invalid RSA key size"),Ie.ERR_INVALID_KEY_SIZE);let a;try{const c=yield bT(t,r),m=yield c.id(),T=_a.get(i);if(null==T)throw se(new Error("dek missing"),Ie.ERR_INVALID_PARAMETERS);const R=T.dek,k=yield c.export(R);a={name:e,id:m};const U=i.components.getDatastore().batch();U.put(s,_t(k)),U.put(Ho(e),_t(JSON.stringify(a))),yield U.commit()}catch(c){throw yield Hn(),c}return a})()}listKeys(){var e=this;return V(function*(){const t={prefix:"/info/"},r=[];var o,i=!1,s=!1;try{for(var c,a=Tt(e.components.getDatastore().query(t));i=!(c=yield a.next()).done;i=!1)r.push(JSON.parse(Mt(c.value.value)))}catch(m){s=!0,o=m}finally{try{i&&null!=a.return&&(yield a.return())}finally{if(s)throw o}}return r})()}findKeyById(e){var t=this;return V(function*(){try{return(yield t.listKeys()).find(i=>i.id===e)}catch(r){throw yield Hn(),r}})()}findKeyByName(e){var t=this;return V(function*(){if(!Vo(e))throw yield Hn(),se(new Error(`Invalid key name '${e}'`),Ie.ERR_INVALID_KEY_NAME);const r=Ho(e);try{const i=yield t.components.getDatastore().get(r);return JSON.parse(Mt(i))}catch(i){throw yield Hn(),yp.error(i),se(new Error(`Key '${e}' does not exist.`),Ie.ERR_KEY_NOT_FOUND)}})()}removeKey(e){var t=this;return V(function*(){if(!Vo(e)||"self"===e)throw yield Hn(),se(new Error(`Invalid key name '${e}'`),Ie.ERR_INVALID_KEY_NAME);const r=oo(e),i=yield t.findKeyByName(e),s=t.components.getDatastore().batch();return s.delete(r),s.delete(Ho(e)),yield s.commit(),i})()}renameKey(e,t){var r=this;return V(function*(){if(!Vo(e)||"self"===e)throw yield Hn(),se(new Error(`Invalid old key name '${e}'`),Ie.ERR_OLD_KEY_NAME_INVALID);if(!Vo(t)||"self"===t)throw yield Hn(),se(new Error(`Invalid new key name '${t}'`),Ie.ERR_NEW_KEY_NAME_INVALID);const i=oo(e),s=oo(t),o=Ho(e),a=Ho(t);if(yield r.components.getDatastore().has(s))throw yield Hn(),se(new Error(`Key '${t}' already exists`),Ie.ERR_KEY_ALREADY_EXISTS);try{const m=yield r.components.getDatastore().get(i),T=yield r.components.getDatastore().get(o),R=JSON.parse(Mt(T));R.name=t;const k=r.components.getDatastore().batch();return k.put(s,m),k.put(a,_t(JSON.stringify(R))),k.delete(i),k.delete(o),yield k.commit(),R}catch(m){throw yield Hn(),m}})()}exportKey(e,t){var r=this;return V(function*(){if(!Vo(e))throw yield Hn(),se(new Error(`Invalid key name '${e}'`),Ie.ERR_INVALID_KEY_NAME);if(null==t)throw yield Hn(),se(new Error("Password is required"),Ie.ERR_PASSWORD_REQUIRED);const i=oo(e);try{const o=Mt(yield r.components.getDatastore().get(i)),a=_a.get(r);if(null==a)throw se(new Error("dek missing"),Ie.ERR_INVALID_PARAMETERS);const c=a.dek;return yield(yield Rv(o,c)).export(t)}catch(s){throw yield Hn(),s}})()}importKey(e,t,r){var i=this;return V(function*(){if(!Vo(e)||"self"===e)throw yield Hn(),se(new Error(`Invalid key name '${e}'`),Ie.ERR_INVALID_KEY_NAME);if(null==t)throw yield Hn(),se(new Error("PEM encoded key is required"),Ie.ERR_PEM_REQUIRED);const s=oo(e);if(yield i.components.getDatastore().has(s))throw yield Hn(),se(new Error(`Key '${e}' already exists`),Ie.ERR_KEY_ALREADY_EXISTS);let a,c;try{a=yield Rv(t,r)}catch{throw yield Hn(),se(new Error("Cannot read the key, most likely the password is wrong"),Ie.ERR_CANNOT_READ_KEY)}try{c=yield a.id();const R=_a.get(i);if(null==R)throw se(new Error("dek missing"),Ie.ERR_INVALID_PARAMETERS);const k=R.dek;t=yield a.export(k)}catch(R){throw yield Hn(),R}const m={name:e,id:c},T=i.components.getDatastore().batch();return T.put(s,_t(t)),T.put(Ho(e),_t(JSON.stringify(m))),yield T.commit(),m})()}importPeer(e,t){var r=this;return V(function*(){try{if(!Vo(e))throw se(new Error(`Invalid key name '${e}'`),Ie.ERR_INVALID_KEY_NAME);if(null==t)throw se(new Error("PeerId is required"),Ie.ERR_MISSING_PRIVATE_KEY);if(null==t.privateKey)throw se(new Error("PeerId.privKey is required"),Ie.ERR_MISSING_PRIVATE_KEY);const i=yield Au(t.privateKey),s=oo(e);if(yield r.components.getDatastore().has(s))throw yield Hn(),se(new Error(`Key '${e}' already exists`),Ie.ERR_KEY_ALREADY_EXISTS);const a=_a.get(r);if(null==a)throw se(new Error("dek missing"),Ie.ERR_INVALID_PARAMETERS);const c=a.dek,m=yield i.export(c),T={name:e,id:t.toString()},R=r.components.getDatastore().batch();return R.put(s,_t(m)),R.put(Ho(e),_t(JSON.stringify(T))),yield R.commit(),T}catch(i){throw yield Hn(),i}})()}getPrivateKey(e){var t=this;return V(function*(){if(!Vo(e))throw yield Hn(),se(new Error(`Invalid key name '${e}'`),Ie.ERR_INVALID_KEY_NAME);try{const r=oo(e);return Mt(yield t.components.getDatastore().get(r))}catch(r){throw yield Hn(),yp.error(r),se(new Error(`Key '${e}' does not exist.`),Ie.ERR_KEY_NOT_FOUND)}})()}rotateKeychainPass(e,t){var r=this;return V(function*(){if("string"!=typeof e)throw yield Hn(),se(new Error(`Invalid old pass type '${typeof e}'`),Ie.ERR_INVALID_OLD_PASS_TYPE);if("string"!=typeof t)throw yield Hn(),se(new Error(`Invalid new pass type '${typeof t}'`),Ie.ERR_INVALID_NEW_PASS_TYPE);if(t.length<20)throw yield Hn(),se(new Error(`Invalid pass length ${t.length}`),Ie.ERR_INVALID_PASS_LENGTH);yp("recreating keychain");const i=_a.get(r);if(null==i)throw se(new Error("dek missing"),Ie.ERR_INVALID_PARAMETERS);const s=i.dek;r.init.pass=t;const o=null!=t&&null!=r.init.dek?.salt?ux(t,r.init.dek.salt,r.init.dek?.iterationCount,r.init.dek?.keyLength,r.init.dek?.hash):"";_a.set(r,{dek:o});const a=yield r.listKeys();for(const c of a){const T=Mt(yield r.components.getDatastore().get(oo(c.name))),R=yield Rv(T,s),k=o.toString(),U=yield R.export(k),Q=r.components.getDatastore().batch(),X={name:c.name,id:c.id};Q.put(oo(c.name),_t(U)),Q.put(Ho(c.name),_t(JSON.stringify(X))),yield Q.commit()}yp("keychain reconstructed")})()}}var RE=N(1349),yK=N(5550);class mK{constructor(e){if("number"!=typeof e)throw new Error("must provide a timespan to the moving average constructor");if(e<=0)throw new Error("must provide a timespan > 0 to the moving average constructor");this.timespan=e,this.movingAverage=0,this.variance=0,this.deviation=0,this.forecast=0}alpha(e,t){return 1-Math.exp(-(e-t)/this.timespan)}push(e,t){if(null!=this.previousTime){const r=this.alpha(e,this.previousTime),i=t-this.movingAverage,s=r*i;this.movingAverage=r*t+(1-r)*this.movingAverage,this.variance=(1-r)*(this.variance+i*s),this.deviation=Math.sqrt(this.variance),this.forecast=this.movingAverage+r*i}else this.movingAverage=t;this.previousTime=e}}function dx(n){return new mK(n)}class PE extends ki{constructor(e){super(),this.enabled=e.enabled,this.queue=[],this.stats={dataReceived:0n,dataSent:0n},this.frequencyLastTime=Date.now(),this.frequencyAccumulators={},this.movingAverages={dataReceived:[],dataSent:[]},this.computeThrottleMaxQueueSize=e.computeThrottleMaxQueueSize,this.computeThrottleTimeout=e.computeThrottleTimeout,this._update=this._update.bind(this),this.movingAverageIntervals=e.movingAverageIntervals;for(let t=0;t0&&this._resetComputeTimeout()}stop(){null!=this.timeout&&(this.timeout.clear(),this.timeout=null)}getSnapshot(){return Object.assign({},this.stats)}getMovingAverages(){return Object.assign({},this.movingAverages)}push(e,t){this.queue.push([e,t,Date.now()]),this._resetComputeTimeout()}_resetComputeTimeout(){this.timeout=Sf(this._update,this._nextTimeout())}_nextTimeout(){return Math.max(this.computeThrottleTimeout*(1-this.queue.length/this.computeThrottleMaxQueueSize),0)}_update(){if(this.timeout=null,this.queue.length>0){let e=["",0,0];for(e of this.queue)this._applyOp(e);this.queue=[],e.length>2&&""!==e[0]&&this._updateFrequency(e[2]),this.dispatchEvent(new rn("update",{detail:this.stats}))}}_updateFrequency(e){const t=e-this.frequencyLastTime;this._updateFrequencyFor("dataReceived",t,e),this._updateFrequencyFor("dataSent",t,e),this.frequencyLastTime=e}_updateFrequencyFor(e,t,r){const i=this.frequencyAccumulators[e]??0;this.frequencyAccumulators[e]=0;const o=i/(t??1)*1e3;let a=this.movingAverages[e];null==a&&(a=this.movingAverages[e]=[]);const c=this.movingAverageIntervals;for(let m=0;ms:s})}forPeer(e){const t=e.toString();return this.peerStats.get(t)??this.oldPeers.get(t)}getProtocols(){return Array.from(this.protocolStats.keys())}forProtocol(e){return this.protocolStats.get(e)}onPeerDisconnected(e){const t=e.toString(),r=this.peerStats.get(t);null!=r&&(r.stop(),this.peerStats.delete(t),this.oldPeers.set(t,r))}_onMessage(e){if(!this.running)return;const{remotePeer:t,protocol:r,direction:i,dataLength:s}=e,o=EK[i];let a=this.forPeer(t);if(null==a){const c=new PE(this.statsInit);this.peerStats.set(t.toString(),c),a=c}if(a.push(o,s),this.globalStats.push(o,s),null!=r){let c=this.forProtocol(r);if(null==c){const m=new PE(this.statsInit);this.protocolStats.set(r,m),c=m}c.push(o,s)}}updatePlaceholder(e,t){if(!this.running)return;const r=e.toString(),i=this.peerStats.get(r)??this.oldPeers.get(r),s=t.toString(),o=this.peerStats.get(s)??this.oldPeers.get(s);let a=i;null!=o&&(a=function bK(n,e){return n.stop(),e.stop(),n.queue=[...n.queue,...e.queue],n}(o,a),this.oldPeers.remove(s)),this.peerStats.delete(e.toString()),this.peerStats.set(s,a),a.start()}trackStream(e){var t=this;const{stream:r,remotePeer:i,protocol:s}=e;if(!this.running)return;r.source=RE(r.source,c=>this._onMessage({remotePeer:i,protocol:s,direction:"in",dataLength:c.byteLength}));const a=r.sink;r.sink=function(){var c=V(function*(m){return yield Ln(m,T=>RE(T,R=>{t._onMessage({remotePeer:i,protocol:s,direction:"out",dataLength:R.byteLength})}),a)});return function(m){return c.apply(this,arguments)}}()}}function NE(n){return ME.apply(this,arguments)}function ME(){return ME=V(function*(n){try{return{status:"fulfilled",value:yield n,isFulfilled:!0,isRejected:!1}}catch(e){return{status:"rejected",reason:e,isFulfilled:!1,isRejected:!0}}}),ME.apply(this,arguments)}function OE(n,e,t){(function _K(n,e){if(e.has(n))throw new TypeError("Cannot initialize the same private elements twice on an object")})(n,e),e.set(n,t)}function hx(n,e,t){if(!e.has(n))throw new TypeError("attempted to "+t+" private field on non-instance");return e.get(n)}function Ko(n,e,t){return function DK(n,e,t){if(e.set)e.set.call(n,t);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=t}}(n,hx(n,e,"set"),t),t}function Da(n,e){return function SK(n,e){return e.get?e.get.call(n):e.value}(n,hx(n,e,"get"))}function px(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let gx;class IK{constructor(e){px(this,"value",void 0),px(this,"next",void 0),this.value=e}}var Sa=new WeakMap,xf=new WeakMap,ic=new WeakMap;gx=Symbol.iterator;class CK{constructor(){OE(this,Sa,{writable:!0,value:void 0}),OE(this,xf,{writable:!0,value:void 0}),OE(this,ic,{writable:!0,value:void 0}),this.clear()}enqueue(e){var t;const i=new IK(e);Da(this,Sa)?(Da(this,xf).next=i,Ko(this,xf,i)):(Ko(this,Sa,i),Ko(this,xf,i)),Ko(this,ic,(t=Da(this,ic),++t))}dequeue(){var e;const r=Da(this,Sa);if(r)return Ko(this,Sa,Da(this,Sa).next),Ko(this,ic,(e=Da(this,ic),--e)),r.value}clear(){Ko(this,Sa,void 0),Ko(this,xf,void 0),Ko(this,ic,0)}get size(){return Da(this,ic)}*[gx](){let e=Da(this,Sa);for(;e;)yield e.value,e=e.next}}function TK(n){if(!Number.isInteger(n)&&n!==Number.POSITIVE_INFINITY||!(n>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up");const e=new CK;let t=0;const i=function(){var a=V(function*(c,m,T){t++;const R=V(function*(){return c(...T)})();m(R);try{yield R}catch{}t--,e.size>0&&e.dequeue()()});return function(m,T,R){return a.apply(this,arguments)}}(),o=(a,...c)=>new Promise(m=>{((a,c,m)=>{e.enqueue(i.bind(void 0,a,c,m)),V(function*(){yield Promise.resolve(),t0&&e.dequeue()()})()})(a,m,c)});return Object.defineProperties(o,{activeCount:{get:()=>t},pendingCount:{get:()=>e.size},clearQueue:{value:()=>{e.clear()}}}),o}function AK(n){return LE.apply(this,arguments)}function LE(){return LE=V(function*(n,e={}){const{concurrency:t=Number.POSITIVE_INFINITY}=e,r=TK(t);return Promise.all(n.map(i=>NE(i&&"function"==typeof i.then?i:"function"==typeof i?r(()=>i()):Promise.resolve(i))))}),LE.apply(this,arguments)}const sc=Gt("libp2p:transports");class xK extends ki{constructor(e,t={}){super(),this.components=e,this.started=!1,this.transports=new Map,this.listeners=Ef({component:"transport-manager",metric:"listeners",metrics:this.components.getMetrics()}),this.faultTolerance=t.faultTolerance??oc.FATAL_ALL}add(e){const t=e[Symbol.toStringTag];if(null==t)throw se(new Error("Transport must have a valid tag"),Ie.ERR_INVALID_KEY);if(this.transports.has(t))throw se(new Error("There is already a transport with this tag"),Ie.ERR_DUPLICATE_TRANSPORT);sc("adding transport %s",t),this.transports.set(t,e),this.listeners.has(t)||this.listeners.set(t,[])}isStarted(){return this.started}start(){var e=this;return V(function*(){const t=e.components.getAddressManager().getListenAddrs();yield e.listen(t),e.started=!0})()}stop(){var e=this;return V(function*(){const t=[];for(const[r,i]of e.listeners)for(sc("closing listeners for %s",r);i.length>0;){const s=i.pop();null!=s&&t.push(s.close())}yield Promise.all(t),sc("all listeners closed");for(const r of e.listeners.keys())e.listeners.set(r,[]);e.started=!1})()}dial(e,t){var r=this;return V(function*(){const i=r.transportForMultiaddr(e);if(null==i)throw se(new Error(`No transport available for address ${String(e)}`),Ie.ERR_TRANSPORT_UNAVAILABLE);try{return yield i.dial(e,{...t,upgrader:r.components.getUpgrader()})}catch(s){throw null==s.code&&(s.code=Ie.ERR_TRANSPORT_DIAL_FAILED),s}})()}getAddrs(){let e=[];for(const t of this.listeners.values())for(const r of t)e=[...e,...r.getAddrs()];return e}getTransports(){return Array.of(...this.transports.values())}transportForMultiaddr(e){for(const t of this.transports.values())if(t.filter([e]).length>0)return t}listen(e){var t=this;return V(function*(){if(null==e||0===e.length)return void sc("no addresses were provided for listening, this node is dial only");const r=[];for(const[i,s]of t.transports.entries()){const o=s.filter(e),a=[];for(const T of o){sc("creating listener for %s on %s",i,T);const R=s.createListener({upgrader:t.components.getUpgrader()});let k=t.listeners.get(i);null==k&&(k=[],t.listeners.set(i,k)),k.push(R),R.addEventListener("listening",()=>{t.dispatchEvent(new rn("listener:listening",{detail:R}))}),R.addEventListener("close",()=>{t.dispatchEvent(new rn("listener:close",{detail:R}))}),a.push(R.listen(T))}if(0!==a.length){if(null==(yield AK(a)).find(T=>T.isFulfilled)&&t.faultTolerance!==oc.NO_FATAL)throw se(new Error(`Transport (${i}) could not listen on any available address`),Ie.ERR_NO_VALID_ADDRESSES)}else r.push(i)}if(r.length===t.transports.size){const i=`no valid addresses were provided for transports [${r.join(", ")}]`;if(t.faultTolerance===oc.FATAL_ALL)throw se(new Error(i),Ie.ERR_NO_VALID_ADDRESSES);sc(`libp2p in dial mode only: ${i}`)}})()}remove(e){var t=this;return V(function*(){sc("removing %s",e);for(const r of t.listeners.get(e)??[])yield r.close();t.transports.delete(e),t.listeners.delete(e)})()}removeAll(){var e=this;return V(function*(){const t=[];for(const r of e.transports.keys())t.push(e.remove(r));yield Promise.all(t)})()}}var oc=(()=>(function(n){n[n.FATAL_ALL=0]="FATAL_ALL",n[n.NO_FATAL=1]="NO_FATAL"}(oc||(oc={})),oc))();const Lu="/multistream/1.0.0",yx=_t("\n");function kE(n){const e=new $n(n,yx);return to.single(e)}function Rf(n,e,t={}){const r=kE(e);n.push(!0===t.writeBytes?r.subarray():r)}function RK(n,e,t={}){const r=new $n;for(const i of e)r.append(kE(i));n.push(!0===t.writeBytes?r.subarray():r)}function PK(n,e){return BE.apply(this,arguments)}function BE(){return BE=V(function*(n,e){let t=1;const r={[Symbol.asyncIterator]:()=>r,next:(a=V(function*(){return yield n.next(t)}),function(){return a.apply(this,arguments)})};var a;let i=r;null!=e?.signal&&(i=Fs(r,e.signal));const o=yield Ln(i,Ms({onLength:a=>{t=a}}),function(){var a=V(function*(c){return yield nc(c)});return function(c){return a.apply(this,arguments)}}());if(null==o)throw se(new Error("no buffer returned"),"ERR_INVALID_MULTISTREAM_SELECT_MESSAGE");if(o.get(o.byteLength-1)!==yx[0])throw se(new Error("missing newline"),"ERR_INVALID_MULTISTREAM_SELECT_MESSAGE");return o.sublist(0,-1)}),BE.apply(this,arguments)}function mp(n,e){return FE.apply(this,arguments)}function FE(){return FE=V(function*(n,e){return Mt((yield PK(n,e)).subarray())}),FE.apply(this,arguments)}const Pf=Gt("libp2p:mss:select");function UE(n,e){return VE.apply(this,arguments)}function VE(){return VE=V(function*(n,e,t={}){e=Array.isArray(e)?[...e]:[e];const{reader:r,writer:i,rest:s,stream:o}=Ch(n),a=e.shift();if(null==a)throw new Error("At least one protocol must be specified");Pf('select: write ["%s", "%s"]',Lu,a),RK(i,[_t(Lu),_t(a)],t);let T=yield mp(r,t);if(Pf('select: read "%s"',T),T===Lu&&(T=yield mp(r,t),Pf('select: read "%s"',T)),T===a)return s(),{stream:o,protocol:a};for(const R of e){Pf('select: write "%s"',R),Rf(i,_t(R),t);const k=yield mp(r,t);if(Pf('select: read "%s" for "%s"',k,R),k===R)return s(),{stream:o,protocol:R}}throw s(),se(new Error("protocol selection failed"),"ERR_UNSUPPORTED_PROTOCOL")}),VE.apply(this,arguments)}const Nf=Gt("libp2p:mss:handle");function HE(n,e,t){return KE.apply(this,arguments)}function KE(){return KE=V(function*(n,e,t){e=Array.isArray(e)?e:[e];const{writer:r,reader:i,rest:s,stream:o}=Ch(n);for(;;){const a=yield mp(i,t);if(Nf('read "%s"',a),a!==Lu){if(e.includes(a))return Rf(r,_t(a),t),Nf('respond with "%s" for "%s"',a,a),s(),{stream:o,protocol:a};"ls"!==a?(Rf(r,_t("na"),t),Nf('respond with "na" for "%s"',a)):(Rf(r,new $n(...e.map(c=>kE(_t(c)))),t),Nf('respond with "%s" for %s',e,a))}else Nf('respond with "%s" for "%s"',Lu,a),Rf(r,_t(Lu),t)}}),KE.apply(this,arguments)}var mx=N(344);const vx=Symbol.for("@libp2p/connection"),NK=Gt("libp2p:connection");class MK{constructor(e){const{remoteAddr:t,remotePeer:r,newStream:i,close:s,getStreams:o,stat:a}=e;this.id=`${parseInt(String(1e9*Math.random())).toString(36)}${Date.now()}`,this.remoteAddr=t,this.remotePeer=r,this.stat={...a,status:"OPEN"},this._newStream=i,this._close=s,this._getStreams=o,this.tags=[],this._closing=!1}get[Symbol.toStringTag](){return"Connection"}get[vx](){return!0}get streams(){return this._getStreams()}newStream(e,t){var r=this;return V(function*(){if(r.stat.status===jA)throw se(new Error("the connection is being closed"),"ERR_CONNECTION_BEING_CLOSED");if(r.stat.status===gE)throw se(new Error("the connection is closed"),"ERR_CONNECTION_CLOSED");Array.isArray(e)||(e=[e]);const i=yield r._newStream(e,t);return i.stat.direction="outbound",i})()}addStream(e){e.stat.direction="inbound"}removeStream(e){}close(){var e=this;return V(function*(){if(e.stat.status!==gE&&!e._closing){e.stat.status=jA;try{e.streams.forEach(t=>t.close())}catch(t){NK.error(t)}e._closing=!0,yield e._close(),e._closing=!1,e.stat.timeline.close=Date.now(),e.stat.status=gE}})()}}const jE=Symbol.for("@libp2p/topology"),Ex=Gt("libp2p:registrar");class kK{constructor(e){this.topologies=new Map,this.handlers=new Map,this.components=e,this._onDisconnect=this._onDisconnect.bind(this),this._onProtocolChange=this._onProtocolChange.bind(this),this.components.getConnectionManager().addEventListener("peer:disconnect",this._onDisconnect),this.components.getPeerStore().addEventListener("change:protocols",this._onProtocolChange)}getProtocols(){return Array.from(new Set([...this.topologies.keys(),...this.handlers.keys()])).sort()}getHandler(e){const t=this.handlers.get(e);if(null==t)throw se(new Error(`No handler registered for protocol ${e}`),Ie.ERR_NO_HANDLER_FOR_PROTOCOL);return t}getTopologies(e){const t=this.topologies.get(e);return null==t?[]:[...t.values()]}handle(e,t,r){var i=this;return V(function*(){if(i.handlers.has(e))throw se(new Error(`Handler already registered for protocol ${e}`),Ie.ERR_PROTOCOL_HANDLER_ALREADY_REGISTERED);const s=Df.bind({ignoreUndefined:!0})({maxInboundStreams:32,maxOutboundStreams:64},r);i.handlers.set(e,{handler:t,options:s}),yield i.components.getPeerStore().protoBook.add(i.components.getPeerId(),[e])})()}unhandle(e){var t=this;return V(function*(){const r=Array.isArray(e)?e:[e];r.forEach(i=>{t.handlers.delete(i)}),yield t.components.getPeerStore().protoBook.remove(t.components.getPeerId(),r)})()}register(e,t){var r=this;return V(function*(){if(!function LK(n){return null!=n&&Boolean(n[jE])}(t))throw Ex.error("topology must be an instance of interfaces/topology"),se(new Error("topology must be an instance of interfaces/topology"),Ie.ERR_INVALID_PARAMETERS);const i=`${(1e9*Math.random()).toString(36)}${Date.now()}`;let s=r.topologies.get(e);return null==s&&(s=new Map,r.topologies.set(e,s)),s.set(i,t),yield t.setRegistrar(r),i})()}unregister(e){for(const[t,r]of this.topologies.entries())r.has(e)&&(r.delete(e),0===r.size&&this.topologies.delete(t))}_onDisconnect(e){const t=e.detail;this.components.getPeerStore().protoBook.get(t.remotePeer).then(r=>{for(const i of r){const s=this.topologies.get(i);if(null!=s)for(const o of s.values())o.onDisconnect(t.remotePeer)}}).catch(r=>{Ex.error(r)})}_onProtocolChange(e){const{peerId:t,protocols:r,oldProtocols:i}=e.detail,s=i.filter(a=>!r.includes(a)),o=r.filter(a=>!i.includes(a));for(const a of s){const c=this.topologies.get(a);if(null!=c)for(const m of c.values())m.onDisconnect(t)}for(const a of o){const c=this.topologies.get(a);if(null!=c)for(const m of c.values()){const T=this.components.getConnectionManager().getConnections(t)[0];null!=T&&m.onConnect(t,T)}}}}const Zn=Gt("libp2p:upgrader");function _x(n,e,t){let r=0;return t.streams.forEach(i=>{i.stat.direction===e&&i.stat.protocol===n&&r++}),r}class UK extends ki{constructor(e,t){super(),this.components=e,this.connectionEncryption=new Map,t.connectionEncryption.forEach(r=>{this.connectionEncryption.set(r.protocol,r)}),this.muxers=new Map,t.muxers.forEach(r=>{this.muxers.set(r.protocol,r)}),this.inboundUpgradeTimeout=t.inboundUpgradeTimeout}upgradeInbound(e){var t=this;return V(function*(){let r,i,s,o,a,c,m;const T=t.components.getMetrics(),R=new Bi.TimeoutController(t.inboundUpgradeTimeout);try{(0,Jr.setMaxListeners)?.(1/0,R.signal)}catch{}try{const k=ga(e,R.signal);if(e.source=k.source,e.sink=k.sink,yield t.components.getConnectionGater().denyInboundConnection(e))throw se(new Error("The multiaddr connection is blocked by gater.acceptConnection"),Ie.ERR_CONNECTION_INTERCEPTED);if(null!=T){({setTarget:c,proxy:m}=mx());const X=`${(1e9*Math.random()).toString(36)}${Date.now()}`;c({toString:()=>X}),T.trackStream({stream:e,remotePeer:m})}Zn("starting the inbound connection upgrade");let U=e;const Q=t.components.getConnectionProtector();null!=Q&&(Zn("protecting the inbound connection"),U=yield Q.protect(e));try{if(({conn:r,remotePeer:i,protocol:a}=yield t._encryptInbound(U)),yield t.components.getConnectionGater().denyInboundEncryptedConnection(i,{...U,...r}))throw se(new Error("The multiaddr connection is blocked by gater.acceptEncryptedConnection"),Ie.ERR_CONNECTION_INTERCEPTED);if(t.muxers.size>0){const X=yield t._multiplexInbound({...U,...r},t.muxers);o=X.muxerFactory,s=X.stream}else s=r}catch(X){throw Zn.error("Failed to upgrade inbound connection",X),yield e.close(X),X}if(yield t.components.getConnectionGater().denyInboundUpgradedConnection(i,{...U,...r}))throw se(new Error("The multiaddr connection is blocked by gater.acceptEncryptedConnection"),Ie.ERR_CONNECTION_INTERCEPTED);return null!=T&&(T.updatePlaceholder(m,i),c(i)),Zn("Successfully upgraded inbound connection"),t._createConnection({cryptoProtocol:a,direction:"inbound",maConn:e,upgradedConn:s,muxerFactory:o,remotePeer:i})}finally{R.clear()}})()}upgradeOutbound(e){var t=this;return V(function*(){const r=e.remoteAddr.getPeerId();if(null==r)throw se(new Error("outbound connection must have a peer id"),Ie.ERR_INVALID_MULTIADDR);const i=_r(r);if(yield t.components.getConnectionGater().denyOutboundConnection(i,e))throw se(new Error("The multiaddr connection is blocked by connectionGater.denyOutboundConnection"),Ie.ERR_CONNECTION_INTERCEPTED);let s,o,a,c,m,T,R;const k=t.components.getMetrics();if(null!=k){({setTarget:T,proxy:R}=mx());const X=`${(1e9*Math.random()).toString(36)}${Date.now()}`;T({toB58String:()=>X}),k.trackStream({stream:e,remotePeer:R})}Zn("Starting the outbound connection upgrade");let U=e;const Q=t.components.getConnectionProtector();null!=Q&&(U=yield Q.protect(e));try{if(({conn:s,remotePeer:o,protocol:c}=yield t._encryptOutbound(U,i)),yield t.components.getConnectionGater().denyOutboundEncryptedConnection(o,{...U,...s}))throw se(new Error("The multiaddr connection is blocked by gater.acceptEncryptedConnection"),Ie.ERR_CONNECTION_INTERCEPTED);if(t.muxers.size>0){const X=yield t._multiplexOutbound({...U,...s},t.muxers);m=X.muxerFactory,a=X.stream}else a=s}catch(X){throw Zn.error("Failed to upgrade outbound connection",X),yield e.close(X),X}if(yield t.components.getConnectionGater().denyOutboundUpgradedConnection(o,{...U,...s}))throw se(new Error("The multiaddr connection is blocked by gater.acceptEncryptedConnection"),Ie.ERR_CONNECTION_INTERCEPTED);return null!=k&&(k.updatePlaceholder(R,o),T(o)),Zn("Successfully upgraded outbound connection"),t._createConnection({cryptoProtocol:c,direction:"outbound",maConn:e,upgradedConn:a,muxerFactory:m,remotePeer:o})})()}_createConnection(e){var t=this;const{cryptoProtocol:r,direction:i,maConn:s,upgradedConn:o,remotePeer:a,muxerFactory:c}=e;let m,T,R;null!=c&&(m=c.createStreamMuxer({direction:i,onIncomingStream:Q=>{null!=R&&Promise.resolve().then(V(function*(){const X=t.components.getRegistrar().getProtocols(),{stream:ae,protocol:he}=yield HE(Q,X);if(Zn("%s: incoming stream opened on %s",i,he),t.components.getMetrics()?.trackStream({stream:ae,remotePeer:a,protocol:he}),null==R)return;const ue=function BK(n,e){try{const{options:t}=e.getHandler(n);return t.maxInboundStreams}catch(t){if(t.code!==Ie.ERR_NO_HANDLER_FOR_PROTOCOL)throw t}return 32}(he,t.components.getRegistrar());_x(he,"inbound",R)!==ue?(Q.stat.protocol=he,t.components.getPeerStore().protoBook.add(a,[he]).catch(Le=>Zn.error(Le)),R.addStream(Q),t._onStream({connection:R,stream:{...Q,...ae},protocol:he})):Q.abort(se(new Error(`Too many inbound protocol streams for protocol "${he}" - limit ${ue}`),Ie.ERR_TOO_MANY_INBOUND_PROTOCOL_STREAMS))})).catch(X=>{Zn.error(X),null==Q.stat.timeline.close&&Q.close()})},onStreamEnd:Q=>{R?.removeStream(Q.id)}}),hi(m)&&m.init(this.components),T=function(){var Q=V(function*(X,ae={}){if(null==m)throw se(new Error("Stream is not multiplexed"),Ie.ERR_MUXER_UNAVAILABLE);Zn("%s: starting new stream on %s",i,X);const he=m.newStream(),Ae=t.components.getMetrics();let ue;try{if(null==ae.signal){Zn("No abort signal was passed while trying to negotiate protocols %s falling back to default timeout",X),ue=new Bi.TimeoutController(3e4),ae.signal=ue.signal;try{(0,Jr.setMaxListeners)?.(1/0,ue.signal)}catch{}}const{stream:Re,protocol:Le}=yield UE(he,X,ae);Ae?.trackStream({stream:Re,remotePeer:a,protocol:Le});const Fe=function FK(n,e){try{const{options:t}=e.getHandler(n);return t.maxOutboundStreams}catch(t){if(t.code!==Ie.ERR_NO_HANDLER_FOR_PROTOCOL)throw t}return 64}(Le,t.components.getRegistrar());if(_x(Le,"outbound",R)===Fe){const mt=se(new Error(`Too many outbound protocol streams for protocol "${Le}" - limit ${Fe}`),Ie.ERR_TOO_MANY_OUTBOUND_PROTOCOL_STREAMS);throw he.abort(mt),mt}return he.stat.protocol=Le,t.components.getPeerStore().protoBook.add(a,[Le]).catch(mt=>Zn.error(mt)),{...he,...Re,stat:{...he.stat,protocol:Le}}}catch(Re){throw Zn.error("could not create new stream",Re),null==he.stat.timeline.close&&he.close(),null!=Re.code?Re:se(Re,Ie.ERR_UNSUPPORTED_PROTOCOL)}finally{ue?.clear()}});return function(ae){return Q.apply(this,arguments)}}(),Ln(o,m,o).catch(Zn.error));const k=s.timeline;s.timeline=new Proxy(k,{set:(...Q)=>(null!=R&&"close"===Q[1]&&null!=Q[2]&&null==k.close&&V(function*(){try{"OPEN"===R.stat.status&&(yield R.close())}catch(X){Zn.error(X)}finally{t.dispatchEvent(new rn("connectionEnd",{detail:R}))}})().catch(X=>{Zn.error(X)}),Reflect.set(...Q))}),s.timeline.upgraded=Date.now();const U=()=>{throw se(new Error("connection is not multiplexed"),Ie.ERR_CONNECTION_NOT_MULTIPLEXED)};return R=function OK(n){return new MK(n)}({remoteAddr:s.remoteAddr,remotePeer:a,stat:{status:"OPEN",direction:i,timeline:s.timeline,multiplexer:m?.protocol,encryption:r},newStream:T??U,getStreams:()=>null!=m?m.streams:U(),close:(Q=V(function*(){yield s.close(),m?.close()}),function(){return Q.apply(this,arguments)})}),this.dispatchEvent(new rn("connection",{detail:R})),R;var Q}_onStream(e){const{connection:t,stream:r,protocol:i}=e,{handler:s}=this.components.getRegistrar().getHandler(i);s({connection:t,stream:r})}_encryptInbound(e){var t=this;return V(function*(){const r=Array.from(t.connectionEncryption.keys());Zn("handling inbound crypto protocol selection",r);try{const{stream:i,protocol:s}=yield HE(e,r,{writeBytes:!0}),o=t.connectionEncryption.get(s);if(null==o)throw new Error(`no crypto module found for ${s}`);return Zn("encrypting inbound connection..."),{...yield o.secureInbound(t.components.getPeerId(),i),protocol:s}}catch(i){throw se(i,Ie.ERR_ENCRYPTION_FAILED)}})()}_encryptOutbound(e,t){var r=this;return V(function*(){const i=Array.from(r.connectionEncryption.keys());Zn("selecting outbound crypto protocol",i);try{const{stream:s,protocol:o}=yield UE(e,i,{writeBytes:!0}),a=r.connectionEncryption.get(o);if(null==a)throw new Error(`no crypto module found for ${o}`);return Zn("encrypting outbound connection to %p",t),{...yield a.secureOutbound(r.components.getPeerId(),s,t),protocol:o}}catch(s){throw se(s,Ie.ERR_ENCRYPTION_FAILED)}})()}_multiplexOutbound(e,t){return V(function*(){const r=Array.from(t.keys());Zn("outbound selecting muxer %s",r);try{const{stream:i,protocol:s}=yield UE(e,r,{writeBytes:!0});return Zn("%s selected as muxer protocol",s),{stream:i,muxerFactory:t.get(s)}}catch(i){throw Zn.error("error multiplexing outbound stream",i),se(i,Ie.ERR_MUXER_UNAVAILABLE)}})()}_multiplexInbound(e,t){return V(function*(){const r=Array.from(t.keys());Zn("inbound handling muxers %s",r);try{const{stream:i,protocol:s}=yield HE(e,r,{writeBytes:!0});return{stream:i,muxerFactory:t.get(s)}}catch(i){throw Zn.error("error multiplexing inbound stream",i),se(i,Ie.ERR_MUXER_UNAVAILABLE)}})()}}var ac;!function(n){let e;n.codec=()=>(null==e&&(e=fi((t,r,i={})=>{if(!1!==i.lengthDelimited&&r.fork(),null!=t.protocolVersion&&(r.uint32(42),r.string(t.protocolVersion)),null!=t.agentVersion&&(r.uint32(50),r.string(t.agentVersion)),null!=t.publicKey&&(r.uint32(10),r.bytes(t.publicKey)),null==t.listenAddrs)throw new Error('Protocol error: required field "listenAddrs" was not found in object');for(const s of t.listenAddrs)r.uint32(18),r.bytes(s);if(null!=t.observedAddr&&(r.uint32(34),r.bytes(t.observedAddr)),null==t.protocols)throw new Error('Protocol error: required field "protocols" was not found in object');for(const s of t.protocols)r.uint32(26),r.string(s);null!=t.signedPeerRecord&&(r.uint32(66),r.bytes(t.signedPeerRecord)),!1!==i.lengthDelimited&&r.ldelim()},(t,r)=>{const i={},s=null==r?t.len:t.pos+r;for(;t.pos>>3){case 5:i.protocolVersion=t.string();break;case 6:i.agentVersion=t.string();break;case 1:i.publicKey=t.bytes();break;case 2:i.listenAddrs=i.listenAddrs??[],i.listenAddrs.push(t.bytes());break;case 4:i.observedAddr=t.bytes();break;case 3:i.protocols=i.protocols??[],i.protocols.push(t.string());break;case 8:i.signedPeerRecord=t.bytes();break;default:t.skipType(7&o)}}if(i.listenAddrs=i.listenAddrs??[],i.protocols=i.protocols??[],null==i.listenAddrs)throw new Error('Protocol error: value for required field "listenAddrs" was not found in protobuf');if(null==i.protocols)throw new Error('Protocol error: value for required field "protocols" was not found in protobuf');return i})),e),n.encode=t=>li(t,n.codec()),n.decode=t=>ui(t,n.codec())}(ac||(ac={}));var vp;!function(n){let e;n.codec=()=>(null==e&&(e=fi((t,r,i={})=>{if(!1!==i.lengthDelimited&&r.fork(),null==t.publicKey)throw new Error('Protocol error: required field "publicKey" was not found in object');if(r.uint32(10),r.bytes(t.publicKey),null==t.payloadType)throw new Error('Protocol error: required field "payloadType" was not found in object');if(r.uint32(18),r.bytes(t.payloadType),null==t.payload)throw new Error('Protocol error: required field "payload" was not found in object');if(r.uint32(26),r.bytes(t.payload),null==t.signature)throw new Error('Protocol error: required field "signature" was not found in object');r.uint32(42),r.bytes(t.signature),!1!==i.lengthDelimited&&r.ldelim()},(t,r)=>{const i={publicKey:new Uint8Array(0),payloadType:new Uint8Array(0),payload:new Uint8Array(0),signature:new Uint8Array(0)},s=null==r?t.len:t.pos+r;for(;t.pos>>3){case 1:i.publicKey=t.bytes();break;case 2:i.payloadType=t.bytes();break;case 3:i.payload=t.bytes();break;case 5:i.signature=t.bytes();break;default:t.skipType(7&o)}}if(null==i.publicKey)throw new Error('Protocol error: value for required field "publicKey" was not found in protobuf');if(null==i.payloadType)throw new Error('Protocol error: value for required field "payloadType" was not found in protobuf');if(null==i.payload)throw new Error('Protocol error: value for required field "payload" was not found in protobuf');if(null==i.signature)throw new Error('Protocol error: value for required field "signature" was not found in protobuf');return i})),e),n.encode=t=>li(t,n.codec()),n.decode=t=>ui(t,n.codec())}(vp||(vp={}));class Yi{constructor(e){const{peerId:t,payloadType:r,payload:i,signature:s}=e;this.peerId=t,this.payloadType=r,this.payload=i,this.signature=s}marshal(){if(null==this.peerId.publicKey)throw new Error("Missing public key");return null==this.marshaled&&(this.marshaled=vp.encode({publicKey:this.peerId.publicKey,payloadType:this.payloadType,payload:this.payload.subarray(),signature:this.signature})),this.marshaled}equals(e){return $r(this.marshal(),e.marshal())}validate(e){var t=this;return V(function*(){const r=Dx(e,t.payloadType,t.payload);if(null==t.peerId.publicKey)throw new Error("Missing public key");return yield Tu(t.peerId.publicKey).verify(r.subarray(),t.signature)})()}}Yi.createFromProtobuf=function(){var n=V(function*(e){const t=vp.decode(e),r=yield xu(t.publicKey);return new Yi({peerId:r,payloadType:t.payloadType,payload:t.payload,signature:t.signature})});return function(e){return n.apply(this,arguments)}}(),Yi.seal=function(){var n=V(function*(e,t){if(null==t.privateKey)throw new Error("Missing private key");const r=e.domain,i=e.codec,s=e.marshal(),o=Dx(r,i,s),c=yield(yield Au(t.privateKey)).sign(o.subarray());return new Yi({peerId:t,payloadType:i,payload:s,signature:c})});return function(e,t){return n.apply(this,arguments)}}(),Yi.openAndCertify=function(){var n=V(function*(e,t){const r=yield Yi.createFromProtobuf(e);if(!(yield r.validate(t)))throw se(new Error("envelope signature is not valid for the given domain"),"ERR_SIGNATURE_NOT_VALID");return r});return function(e,t){return n.apply(this,arguments)}}();const Dx=(n,e,t)=>{const r=_t(n),i=Qt.encode(r.byteLength),s=Qt.encode(e.length),o=Qt.encode(t.length);return new $n(i,r,s,e,o,t)};var Ep;!function(n){let e,t;!function(r){let i;r.codec=()=>(null==i&&(i=fi((s,o,a={})=>{if(!1!==a.lengthDelimited&&o.fork(),null==s.multiaddr)throw new Error('Protocol error: required field "multiaddr" was not found in object');o.uint32(10),o.bytes(s.multiaddr),!1!==a.lengthDelimited&&o.ldelim()},(s,o)=>{const a={multiaddr:new Uint8Array(0)},c=null==o?s.len:s.pos+o;for(;s.pos>>3==1?a.multiaddr=s.bytes():s.skipType(7&m)}if(null==a.multiaddr)throw new Error('Protocol error: value for required field "multiaddr" was not found in protobuf');return a})),i),r.encode=s=>li(s,r.codec()),r.decode=s=>ui(s,r.codec())}(e=n.AddressInfo||(n.AddressInfo={})),n.codec=()=>(null==t&&(t=fi((r,i,s={})=>{if(!1!==s.lengthDelimited&&i.fork(),null==r.peerId)throw new Error('Protocol error: required field "peerId" was not found in object');if(i.uint32(10),i.bytes(r.peerId),null==r.seq)throw new Error('Protocol error: required field "seq" was not found in object');if(i.uint32(16),i.uint64(r.seq),null==r.addresses)throw new Error('Protocol error: required field "addresses" was not found in object');for(const o of r.addresses)i.uint32(26),n.AddressInfo.codec().encode(o,i);!1!==s.lengthDelimited&&i.ldelim()},(r,i)=>{const s={peerId:new Uint8Array(0),seq:0n,addresses:[]},o=null==i?r.len:r.pos+i;for(;r.pos>>3){case 1:s.peerId=r.bytes();break;case 2:s.seq=r.uint64();break;case 3:s.addresses.push(n.AddressInfo.codec().decode(r,r.uint32()));break;default:r.skipType(7&a)}}if(null==s.peerId)throw new Error('Protocol error: value for required field "peerId" was not found in protobuf');if(null==s.seq)throw new Error('Protocol error: value for required field "seq" was not found in protobuf');return s})),t),n.encode=r=>li(r,n.codec()),n.decode=r=>ui(r,n.codec())}(Ep||(Ep={}));const $K=Uint8Array.from([3,1]);let ku=(()=>{class n{constructor(t){this.domain=n.DOMAIN,this.codec=n.CODEC;const{peerId:r,multiaddrs:i,seqNumber:s}=t;this.peerId=r,this.multiaddrs=i??[],this.seqNumber=s??BigInt(Date.now())}marshal(){return null==this.marshaled&&(this.marshaled=Ep.encode({peerId:this.peerId.toBytes(),seq:BigInt(this.seqNumber),addresses:this.multiaddrs.map(t=>({multiaddr:t.bytes}))})),this.marshaled}equals(t){return!!(t instanceof n&&this.peerId.equals(t.peerId)&&this.seqNumber===t.seqNumber&&function KK(n,e){const t=(r,i)=>r.toString().localeCompare(i.toString());return n.length===e.length&&e.sort(t)&&n.sort(t).every((r,i)=>e[i].equals(r))}(this.multiaddrs,t.multiaddrs))}}return n.createFromProtobuf=e=>{const t=Ep.decode(e),r=pa(t.peerId),i=(t.addresses??[]).map(o=>new vn(o.multiaddr));return new n({peerId:r,multiaddrs:i,seqNumber:t.seq})},n.DOMAIN="libp2p-peer-record",n.CODEC=$K,n})();const Ix="js-libp2p/0.0.0",Wn=Gt("libp2p:identify");class $E{constructor(e,t){this.components=e,this.started=!1,this.init=t,this.identifyProtocolStr=`/${t.protocolPrefix}/id/1.0.0`,this.identifyPushProtocolStr=`/${t.protocolPrefix}/id/push/1.0.0`,this.host={protocolVersion:`${t.protocolPrefix}/0.1.0`,...t.host},this.components.getConnectionManager().addEventListener("peer:connect",r=>{this.identify(r.detail).catch(Wn.error)}),this.components.getPeerStore().addEventListener("change:multiaddrs",r=>{const{peerId:i}=r.detail;this.components.getPeerId().equals(i)&&this.pushToPeerStore().catch(s=>Wn.error(s))}),this.components.getPeerStore().addEventListener("change:protocols",r=>{const{peerId:i}=r.detail;this.components.getPeerId().equals(i)&&this.pushToPeerStore().catch(s=>Wn.error(s))})}isStarted(){return this.started}start(){var e=this;return V(function*(){e.started||(yield e.components.getPeerStore().metadataBook.setValue(e.components.getPeerId(),"AgentVersion",_t(e.host.agentVersion)),yield e.components.getPeerStore().metadataBook.setValue(e.components.getPeerId(),"ProtocolVersion",_t(e.host.protocolVersion)),yield e.components.getRegistrar().handle(e.identifyProtocolStr,t=>{e._handleIdentify(t).catch(r=>{Wn.error(r)})},{maxInboundStreams:e.init.maxInboundStreams,maxOutboundStreams:e.init.maxOutboundStreams}),yield e.components.getRegistrar().handle(e.identifyPushProtocolStr,t=>{e._handlePush(t).catch(r=>{Wn.error(r)})},{maxInboundStreams:e.init.maxPushIncomingStreams,maxOutboundStreams:e.init.maxPushOutgoingStreams}),e.started=!0)})()}stop(){var e=this;return V(function*(){yield e.components.getRegistrar().unhandle(e.identifyProtocolStr),yield e.components.getRegistrar().unhandle(e.identifyPushProtocolStr),e.started=!1})()}push(e){var t=this;return V(function*(){const r=yield t.components.getPeerStore().addressBook.getRawEnvelope(t.components.getPeerId()),i=t.components.getAddressManager().getAddresses().map(a=>a.bytes),s=yield t.components.getPeerStore().protoBook.get(t.components.getPeerId()),o=e.map(function(){var a=V(function*(c){let m;const T=new Bi.TimeoutController(t.init.timeout);try{(0,Jr.setMaxListeners)?.(1/0,T.signal)}catch{}try{m=yield c.newStream([t.identifyPushProtocolStr],{signal:T.signal});const R=ga(m,T.signal);yield Ln([ac.encode({listenAddrs:i,signedPeerRecord:r,protocols:s})],to(),R,wa)}catch(R){Wn.error("could not push identify update to peer",R)}finally{m?.close(),T.clear()}});return function(c){return a.apply(this,arguments)}}());yield Promise.all(o)})()}pushToPeerStore(){var e=this;return V(function*(){if(!e.isStarted())return;const t=[];for(const r of e.components.getConnectionManager().getConnections()){const i=r.remotePeer;!(yield e.components.getPeerStore().get(i)).protocols.includes(e.identifyPushProtocolStr)||t.push(r)}yield e.push(t)})()}_identify(e,t={}){var r=this;return V(function*(){let i,o,s=t.signal;if(null==s){i=new Bi.TimeoutController(r.init.timeout),s=i.signal;try{(0,Jr.setMaxListeners)?.(1/0,i.signal)}catch{}}try{o=yield e.newStream([r.identifyProtocolStr],{signal:s});const a=ga(o,s),c=yield Ln([],a,Ms({maxDataLength:r.init.maxIdentifyMessageSize??8192}),function(){var m=V(function*(T){return yield nc(T)});return function(T){return m.apply(this,arguments)}}());if(null==c)throw se(new Error("No data could be retrieved"),Ie.ERR_CONNECTION_ENDED);try{return ac.decode(c)}catch(m){throw se(m,Ie.ERR_INVALID_MESSAGE)}}finally{i?.clear(),o?.close()}})()}identify(e,t={}){var r=this;return V(function*(){const i=yield r._identify(e,t),{publicKey:s,listenAddrs:o,protocols:a,observedAddr:c,signedPeerRecord:m,agentVersion:T,protocolVersion:R}=i;if(null==s)throw se(new Error("public key was missing from identify message"),Ie.ERR_MISSING_PUBLIC_KEY);const k=yield xu(s);if(!e.remotePeer.equals(k))throw se(new Error("identified peer does not match the expected peer"),Ie.ERR_INVALID_PEER);if(r.components.getPeerId().equals(k))throw se(new Error("identified peer is our own peer id?"),Ie.ERR_INVALID_PEER);const U=$E.getCleanMultiaddr(c);if(null!=m){Wn("received signed peer record from %p",k);try{const Q=yield Yi.openAndCertify(m,ku.DOMAIN);if(!Q.peerId.equals(k))throw se(new Error("identified peer does not match the expected peer"),Ie.ERR_INVALID_PEER);if(yield r.components.getPeerStore().addressBook.consumePeerRecord(Q))return yield r.components.getPeerStore().protoBook.set(k,a),null!=T&&(yield r.components.getPeerStore().metadataBook.setValue(k,"AgentVersion",_t(T))),null!=R&&(yield r.components.getPeerStore().metadataBook.setValue(k,"ProtocolVersion",_t(R))),void Wn("identify completed for peer %p and protocols %o",k,a)}catch(Q){Wn("received invalid envelope, discard it and fallback to listenAddrs is available",Q)}}else Wn("no signed peer record received from %p",k);Wn("falling back to legacy addresses from %p",k);try{yield r.components.getPeerStore().addressBook.set(k,o.map(Q=>new vn(Q)))}catch(Q){Wn.error("received invalid addrs",Q)}yield r.components.getPeerStore().protoBook.set(k,a),null!=T&&(yield r.components.getPeerStore().metadataBook.setValue(k,"AgentVersion",_t(T))),null!=R&&(yield r.components.getPeerStore().metadataBook.setValue(k,"ProtocolVersion",_t(R))),Wn("identify completed for peer %p and protocols %o",k,a),Wn("received observed address of %s",U?.toString())})()}_handleIdentify(e){var t=this;return V(function*(){const{connection:r,stream:i}=e,s=new Bi.TimeoutController(t.init.timeout);try{(0,Jr.setMaxListeners)?.(1/0,s.signal)}catch{}try{const o=t.components.getPeerId().publicKey??new Uint8Array(0),a=yield t.components.getPeerStore().get(t.components.getPeerId()),c=t.components.getAddressManager().getAddresses().map(k=>k.decapsulateCode(Nr("p2p").code));let m=a.peerRecordEnvelope;if(c.length>0&&null==m){const k=new ku({peerId:t.components.getPeerId(),multiaddrs:c}),U=yield Yi.seal(k,t.components.getPeerId());yield t.components.getPeerStore().addressBook.consumePeerRecord(U),m=U.marshal().subarray()}const T=ac.encode({protocolVersion:t.host.protocolVersion,agentVersion:t.host.agentVersion,publicKey:o,listenAddrs:c.map(k=>k.bytes),signedPeerRecord:m,observedAddr:r.remoteAddr.bytes,protocols:a.protocols}),R=ga(i,s.signal);yield Ln([T],to(),R,wa)}catch(o){Wn.error("could not respond to identify request",o)}finally{i.close(),s.clear()}})()}_handlePush(e){var t=this;return V(function*(){const{connection:r,stream:i}=e,s=new Bi.TimeoutController(t.init.timeout);try{(0,Jr.setMaxListeners)?.(1/0,s.signal)}catch{}let o;try{const c=ga(i,s.signal),m=yield Ln([],c,Ms({maxDataLength:t.init.maxIdentifyMessageSize??8192}),function(){var T=V(function*(R){return yield nc(R)});return function(R){return T.apply(this,arguments)}}());null!=m&&(o=ac.decode(m))}catch(c){return Wn.error("received invalid message",c)}finally{i.close(),s.clear()}if(null==o)return Wn.error("received invalid message");const a=r.remotePeer;if(t.components.getPeerId().equals(a))Wn("received push from ourselves?");else{if(Wn("received push from %p",a),null!=o.signedPeerRecord){Wn("received signedPeerRecord in push");try{const c=yield Yi.openAndCertify(o.signedPeerRecord,ku.DOMAIN);if(yield t.components.getPeerStore().addressBook.consumePeerRecord(c))return Wn("consumed signedPeerRecord sent in push"),void(yield t.components.getPeerStore().protoBook.set(a,o.protocols));Wn("failed to consume signedPeerRecord sent in push")}catch(c){Wn("received invalid envelope, discard it and fallback to listenAddrs is available",c)}}else Wn("did not receive signedPeerRecord in push");try{yield t.components.getPeerStore().addressBook.set(a,o.listenAddrs.map(c=>new vn(c)))}catch(c){Wn.error("received invalid addrs",c)}try{yield t.components.getPeerStore().protoBook.set(a,o.protocols)}catch(c){Wn.error("received invalid protocols",c)}Wn("handled push from %p",a)}})()}static getCleanMultiaddr(e){if(null!=e&&e.length>0)try{return new vn(e)}catch{}}}var wp,ao;!function(n){let e;n.codec=()=>(null==e&&(e=fi((t,r,i={})=>{if(!1!==i.lengthDelimited&&r.fork(),null==t.identifier)throw new Error('Protocol error: required field "identifier" was not found in object');r.uint32(10),r.string(t.identifier),!1!==i.lengthDelimited&&r.ldelim()},(t,r)=>{const i={},s=null==r?t.len:t.pos+r;for(;t.pos>>3==1?i.identifier=t.string():t.skipType(7&o)}if(null==i.identifier)throw new Error('Protocol error: value for required field "identifier" was not found in protobuf');return i})),e),n.encode=t=>li(t,n.codec()),n.decode=t=>ui(t,n.codec())}(wp||(wp={})),function(n){let e;var i;let t,r;(i=e=n.StatusCode||(n.StatusCode={})).OK="OK",i.NOT_FOUND="NOT_FOUND",i.ERROR="ERROR",function(i){i[i.OK=0]="OK",i[i.NOT_FOUND=1]="NOT_FOUND",i[i.ERROR=2]="ERROR"}(t||(t={})),function(i){i.codec=()=>Nh(t)}(e=n.StatusCode||(n.StatusCode={})),n.codec=()=>(null==r&&(r=fi((i,s,o={})=>{if(!1!==o.lengthDelimited&&s.fork(),null==i.status)throw new Error('Protocol error: required field "status" was not found in object');if(s.uint32(8),n.StatusCode.codec().encode(i.status,s),null==i.data)throw new Error('Protocol error: required field "data" was not found in object');s.uint32(18),s.bytes(i.data),!1!==o.lengthDelimited&&s.ldelim()},(i,s)=>{const o={},a=null==s?i.len:i.pos+s;for(;i.pos>>3){case 1:o.status=n.StatusCode.codec().decode(i);break;case 2:o.data=i.bytes();break;default:i.skipType(7&c)}}if(null==o.status)throw new Error('Protocol error: value for required field "status" was not found in protobuf');if(null==o.data)throw new Error('Protocol error: value for required field "data" was not found in protobuf');return o})),r),n.encode=i=>li(i,n.codec()),n.decode=i=>ui(i,n.codec())}(ao||(ao={}));const Tx=Gt("libp2p:fetch");class tj{constructor(e,t){this.started=!1,this.components=e,this.protocol=`/${t.protocolPrefix??"libp2p"}/fetch/0.0.1`,this.lookupFunctions=new Map,this.handleMessage=this.handleMessage.bind(this),this.init=t}start(){var e=this;return V(function*(){yield e.components.getRegistrar().handle(e.protocol,t=>{e.handleMessage(t).catch(r=>{Tx.error(r)}).finally(()=>{t.stream.close()})},{maxInboundStreams:e.init.maxInboundStreams,maxOutboundStreams:e.init.maxOutboundStreams}),e.started=!0})()}stop(){var e=this;return V(function*(){yield e.components.getRegistrar().unhandle(e.protocol),e.started=!1})()}isStarted(){return this.started}fetch(e,t,r={}){var i=this;return V(function*(){Tx("dialing %s to %p",i.protocol,e);const s=yield i.components.getConnectionManager().openConnection(e,r);let o,c,a=r.signal;if(null==a){o=new Bi.TimeoutController(i.init.timeout),a=o.signal;try{(0,Jr.setMaxListeners)?.(1/0,o.signal)}catch{}}try{c=yield s.newStream([i.protocol],{signal:a});const m=ga(c,a);return(yield Ln([wp.encode({identifier:t})],to(),m,Ms(),function(){var R=V(function*(k){const U=yield nc(k);if(null==U)throw se(new Error("No data received"),Ie.ERR_INVALID_MESSAGE);const Q=ao.decode(U);switch(Q.status){case ao.StatusCode.OK:return Q.data;case ao.StatusCode.NOT_FOUND:return null;case ao.StatusCode.ERROR:{const X=(new TextDecoder).decode(Q.data);throw se(new Error("Error in fetch protocol response: "+X),Ie.ERR_INVALID_PARAMETERS)}default:throw se(new Error("Unknown response status"),Ie.ERR_INVALID_MESSAGE)}});return function(k){return R.apply(this,arguments)}}()))??null}finally{o?.clear(),c?.close()}})()}handleMessage(e){var t=this;return V(function*(){const{stream:r}=e,i=t;yield Ln(r,Ms(),function(){var s=un(function*(o){const a=yield ct(nc(o));if(null==a)throw se(new Error("No data received"),Ie.ERR_INVALID_MESSAGE);const c=wp.decode(a);let m;const T=i._getLookupFunction(c.identifier);if(null!=T){const R=yield ct(T(c.identifier));m=null!=R?{status:ao.StatusCode.OK,data:R}:{status:ao.StatusCode.NOT_FOUND,data:new Uint8Array(0)}}else{const R=(new TextEncoder).encode("No lookup function registered for key: "+c.identifier);m={status:ao.StatusCode.ERROR,data:R}}yield ao.encode(m)});return function(o){return s.apply(this,arguments)}}(),to(),r)})()}_getLookupFunction(e){for(const t of this.lookupFunctions.keys())if(e.startsWith(t))return this.lookupFunctions.get(t)}registerLookupFunction(e,t){if(this.lookupFunctions.has(e))throw se(new Error("Fetch protocol handler for key prefix '"+e+"' already registered"),Ie.ERR_KEY_ALREADY_EXISTS);this.lookupFunctions.set(e,t)}unregisterLookupFunction(e,t){null!=t&&this.lookupFunctions.get(e)!==t||this.lookupFunctions.delete(e)}}const Ax=Gt("libp2p:ping");class sj{constructor(e,t){this.components=e,this.started=!1,this.protocol=`/${t.protocolPrefix}/ping/1.0.0`,this.init=t}start(){var e=this;return V(function*(){yield e.components.getRegistrar().handle(e.protocol,e.handleMessage,{maxInboundStreams:e.init.maxInboundStreams,maxOutboundStreams:e.init.maxOutboundStreams}),e.started=!0})()}stop(){var e=this;return V(function*(){yield e.components.getRegistrar().unhandle(e.protocol),e.started=!1})()}isStarted(){return this.started}handleMessage(e){const{stream:t}=e;Ln(t,t).catch(r=>{Ax.error(r)})}ping(e,t={}){var r=this;return V(function*(){Ax("dialing %s to %p",r.protocol,e);const i=Date.now(),s=sf(32),o=yield r.components.getConnectionManager().openConnection(e,t);let a,m,c=t.signal;if(null==c){a=new Bi.TimeoutController(r.init.timeout),c=a.signal;try{(0,Jr.setMaxListeners)?.(1/0,a.signal)}catch{}}try{m=yield o.newStream([r.protocol],{signal:c});const T=ga(m,c),R=yield Ln([s],T,function(){var U=V(function*(Q){return yield nc(Q)});return function(Q){return U.apply(this,arguments)}}()),k=Date.now();if(null==R||!$r(s,R.subarray()))throw se(new Error("Received wrong ping ack"),Ie.ERR_WRONG_PING_ACK);return k-i}finally{a?.clear(),m?.close()}})()}}function GE(){return(GE=V(function*(){throw new Error("Not supported in browsers")})).apply(this,arguments)}function cj(n){const{address:e}=n.nodeAddress();return function aj(n){return/^127\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(n)||/^::1$/.test(n)}(e)}const WE=Gt("libp2p:nat");function uj(n=1024,e=65535){return Math.floor(Math.random()*(e-n+1)+n)}class lj{constructor(e,t){if(this.components=e,this.started=!1,this.enabled=t.enabled,this.externalAddress=t.externalAddress,this.localAddress=t.localAddress,this.description=t.description??`libp2p@0.0.0 ${this.components.getPeerId().toString()}`,this.ttl=t.ttl??7200,this.keepAlive=t.keepAlive??!0,this.gateway=t.gateway,this.ttl<7200)throw se(new Error("NatManager ttl should be at least 7200 seconds"),Ie.ERR_INVALID_PARAMETERS)}isStarted(){return this.started}start(){}afterStart(){fp||!this.enabled||this.started||(this.started=!0,this._start().catch(e=>{WE.error(e)}))}_start(){var e=this;return V(function*(){const t=e.components.getTransportManager().getAddrs();for(const r of t){const{family:i,host:s,port:o,transport:a}=r.toOptions();if(!r.isThinWaistAddress()||"tcp"!==a||cj(r)||4!==i)continue;const c=yield e._getClient(),m=e.externalAddress??(yield c.externalIp());if(GA(m))throw new Error(`${m} is private - please set config.nat.externalIp to an externally routable IP or ensure you are not behind a double NAT`);const T=uj();WE(`opening uPnP connection from ${m}:${T} to ${s}:${o}`),yield c.map({publicPort:T,localPort:o,localAddress:e.localAddress,protocol:"TCP"===a.toUpperCase()?"TCP":"UDP"}),e.components.getAddressManager().addObservedAddr(vn.fromNodeAddress({family:4,address:m,port:T},a))}})()}_getClient(){var e=this;return V(function*(){return null!=e.client||(e.client=yield function oj(){return GE.apply(this,arguments)}({description:e.description,ttl:e.ttl,keepAlive:e.keepAlive,gateway:e.gateway})),e.client})()}stop(){var e=this;return V(function*(){if(!fp&&null!=e.client)try{yield e.client.close(),e.client=void 0}catch(t){WE.error(t)}})()}}const fj=Gt("libp2p:peer-record-updater");class dj{constructor(e){this.components=e,this.started=!1,this.update=this.update.bind(this)}isStarted(){return this.started}start(){var e=this;return V(function*(){e.started=!0,e.components.getTransportManager().addEventListener("listener:listening",e.update),e.components.getTransportManager().addEventListener("listener:close",e.update),e.components.getAddressManager().addEventListener("change:addresses",e.update)})()}stop(){var e=this;return V(function*(){e.started=!1,e.components.getTransportManager().removeEventListener("listener:listening",e.update),e.components.getTransportManager().removeEventListener("listener:close",e.update),e.components.getAddressManager().removeEventListener("change:addresses",e.update)})()}update(){var e=this;Promise.resolve().then(V(function*(){const t=new ku({peerId:e.components.getPeerId(),multiaddrs:e.components.getAddressManager().getAddresses().map(i=>i.decapsulateCode(Nr("p2p").code))}),r=yield Yi.seal(t,e.components.getPeerId());yield e.components.getPeerStore().addressBook.consumePeerRecord(r)})).catch(t=>{fj.error("Could not update self peer record: %o",t)})}}class hj{constructor(e){this.dht=e}findPeer(e,t={}){var r=this;return V(function*(){var o,i=!1,s=!1;try{for(var c,a=Tt(r.dht.findPeer(e,t));i=!(c=yield a.next()).done;i=!1){const m=c.value;if("FINAL_PEER"===m.name)return m.peer}}catch(m){s=!0,o=m}finally{try{i&&null!=a.return&&(yield a.return())}finally{if(s)throw o}}throw se(new Error(Cn.NOT_FOUND),Ie.ERR_NOT_FOUND)})()}getClosestPeers(e,t={}){var r=this;return un(function*(){var o,i=!1,s=!1;try{for(var c,a=Tt(r.dht.getClosestPeers(e,t));i=!(c=yield ct(a.next())).done;i=!1){const m=c.value;"PEER_RESPONSE"===m.name&&(yield*jr(Tt(m.closer),ct))}}catch(m){s=!0,o=m}finally{try{i&&null!=a.return&&(yield ct(a.return()))}finally{if(s)throw o}}})()}}const Kn=Gt("libp2p:peer-store:address-book"),bp="change:multiaddrs";function pj(){return QE.apply(this,arguments)}function QE(){return(QE=V(function*(){return!0})).apply(this,arguments)}class gj{constructor(e,t,r){this.dispatchEvent=e,this.store=t,this.addressFilter=r??pj}consumePeerRecord(e){var t=this;return V(function*(){Kn.trace("consumePeerRecord await write lock");const r=yield t.store.lock.writeLock();let i,s,o;Kn.trace("consumePeerRecord got write lock");try{let a;try{a=ku.createFromProtobuf(e.payload)}catch{return Kn.error("invalid peer record received"),!1}i=a.peerId;const c=a.multiaddrs;if(!i.equals(e.peerId))return Kn("signing key does not match PeerId in the PeerRecord"),!1;if(null==c||0===c.length)return!1;if((yield t.store.has(i))&&(s=yield t.store.load(i),null!=s.peerRecordEnvelope)){const T=yield Yi.createFromProtobuf(s.peerRecordEnvelope),R=ku.createFromProtobuf(T.payload);if(R.seqNumber>=a.seqNumber)return Kn("sequence number was lower or equal to existing sequence number - stored: %d received: %d",R.seqNumber,a.seqNumber),!1}const m=yield YE(i,c,t.addressFilter,!0);o=yield t.store.patchOrCreate(i,{addresses:m,peerRecordEnvelope:e.marshal().subarray()}),Kn("stored provided peer record for %p",a.peerId)}finally{Kn.trace("consumePeerRecord release write lock"),r()}return t.dispatchEvent(new rn(bp,{detail:{peerId:i,multiaddrs:o.addresses.map(({multiaddr:a})=>a),oldMultiaddrs:null==s?[]:s.addresses.map(({multiaddr:a})=>a)}})),!0})()}getRawEnvelope(e){var t=this;return V(function*(){Kn.trace("getRawEnvelope await read lock");const r=yield t.store.lock.readLock();Kn.trace("getRawEnvelope got read lock");try{return(yield t.store.load(e)).peerRecordEnvelope}catch(i){if("ERR_NOT_FOUND"!==i.code)throw i}finally{Kn.trace("getRawEnvelope release read lock"),r()}})()}getPeerRecord(e){var t=this;return V(function*(){const r=yield t.getRawEnvelope(e);if(null!=r)return yield Yi.createFromProtobuf(r)})()}get(e){var t=this;return V(function*(){e=Zr(e),Kn.trace("get wait for read lock");const r=yield t.store.lock.readLock();Kn.trace("get got read lock");try{return(yield t.store.load(e)).addresses}catch(i){if("ERR_NOT_FOUND"!==i.code)throw i}finally{Kn.trace("get release read lock"),r()}return[]})()}set(e,t){var r=this;return V(function*(){if(e=Zr(e),!Array.isArray(t))throw Kn.error("multiaddrs must be an array of Multiaddrs"),se(new Error("multiaddrs must be an array of Multiaddrs"),"ERR_INVALID_PARAMETERS");Kn.trace("set await write lock");const i=yield r.store.lock.writeLock();Kn.trace("set got write lock");let o,a,s=!1;try{const c=yield YE(e,t,r.addressFilter);if(0===c.length)return;try{if(o=yield r.store.load(e),s=!0,new Set([...c.map(({multiaddr:m})=>m.toString()),...o.addresses.map(({multiaddr:m})=>m.toString())]).size===o.addresses.length&&c.length===o.addresses.length)return}catch(m){if("ERR_NOT_FOUND"!==m.code)throw m}a=yield r.store.patchOrCreate(e,{addresses:c}),Kn("set multiaddrs for %p",e)}finally{Kn.trace("set multiaddrs for %p",e),Kn("set release write lock"),i()}r.dispatchEvent(new rn(bp,{detail:{peerId:e,multiaddrs:a.addresses.map(c=>c.multiaddr),oldMultiaddrs:null==o?[]:o.addresses.map(({multiaddr:c})=>c)}})),s||r.dispatchEvent(new rn("peer",{detail:{id:e,multiaddrs:a.addresses.map(c=>c.multiaddr),protocols:a.protocols}}))})()}add(e,t){var r=this;return V(function*(){if(e=Zr(e),!Array.isArray(t))throw Kn.error("multiaddrs must be an array of Multiaddrs"),se(new Error("multiaddrs must be an array of Multiaddrs"),"ERR_INVALID_PARAMETERS");Kn.trace("add await write lock");const i=yield r.store.lock.writeLock();let s,o,a;Kn.trace("add got write lock");try{const c=yield YE(e,t,r.addressFilter);if(0===c.length)return;try{if(o=yield r.store.load(e),s=!0,new Set([...c.map(({multiaddr:m})=>m.toString()),...o.addresses.map(({multiaddr:m})=>m.toString())]).size===o.addresses.length)return}catch(m){if("ERR_NOT_FOUND"!==m.code)throw m}a=yield r.store.mergeOrCreate(e,{addresses:c}),Kn("added multiaddrs for %p",e)}finally{Kn.trace("set release write lock"),i()}r.dispatchEvent(new rn(bp,{detail:{peerId:e,multiaddrs:a.addresses.map(c=>c.multiaddr),oldMultiaddrs:null==o?[]:o.addresses.map(({multiaddr:c})=>c)}})),!0===s&&r.dispatchEvent(new rn("peer",{detail:{id:e,multiaddrs:a.addresses.map(c=>c.multiaddr),protocols:a.protocols}}))})()}delete(e){var t=this;return V(function*(){e=Zr(e),Kn.trace("delete await write lock");const r=yield t.store.lock.writeLock();let i;Kn.trace("delete got write lock");try{try{i=yield t.store.load(e)}catch(s){if("ERR_NOT_FOUND"!==s.code)throw s}yield t.store.patchOrCreate(e,{addresses:[]})}finally{Kn.trace("delete release write lock"),r()}null!=i&&t.dispatchEvent(new rn(bp,{detail:{peerId:e,multiaddrs:[],oldMultiaddrs:null==i?[]:i.addresses.map(({multiaddr:s})=>s)}}))})()}}function YE(n,e,t){return ZE.apply(this,arguments)}function ZE(){return ZE=V(function*(n,e,t,r=!1){return yield Ln(e,i=>RE(i,s=>{if(!vn.isMultiaddr(s))throw Kn.error("multiaddr must be an instance of Multiaddr"),se(new Error("multiaddr must be an instance of Multiaddr"),"ERR_INVALID_PARAMETERS")}),i=>Ks(i,function(){var s=V(function*(o){return yield t(n,o)});return function(o){return s.apply(this,arguments)}}()),i=>fE(i,s=>({multiaddr:new vn(s.toString()),isCertified:r})),function(){var i=V(function*(s){return yield Ea(s)});return function(s){return i.apply(this,arguments)}}())}),ZE.apply(this,arguments)}const co=Gt("libp2p:peer-store:key-book"),xx="change:pubkey";class yj{constructor(e,t){this.dispatchEvent=e,this.store=t}set(e,t){var r=this;return V(function*(){if(e=Zr(e),!(t instanceof Uint8Array))throw co.error("publicKey must be an instance of Uint8Array to store data"),se(new Error("publicKey must be an instance of PublicKey"),"ERR_INVALID_PARAMETERS");co.trace("set await write lock");const i=yield r.store.lock.writeLock();co.trace("set got write lock");let o,s=!1;try{try{if(o=yield r.store.load(e),null!=o.pubKey&&$r(o.pubKey,t))return}catch(a){if("ERR_NOT_FOUND"!==a.code)throw a}yield r.store.patchOrCreate(e,{pubKey:t}),s=!0}finally{co.trace("set release write lock"),i()}s&&r.dispatchEvent(new rn(xx,{detail:{peerId:e,publicKey:t,oldPublicKey:o?.pubKey}}))})()}get(e){var t=this;return V(function*(){e=Zr(e),co.trace("get await write lock");const r=yield t.store.lock.readLock();co.trace("get got write lock");try{return(yield t.store.load(e)).pubKey}catch(i){if("ERR_NOT_FOUND"!==i.code)throw i}finally{co("get release write lock"),r()}})()}delete(e){var t=this;return V(function*(){e=Zr(e),co.trace("delete await write lock");const r=yield t.store.lock.writeLock();let i;co.trace("delete got write lock");try{try{i=yield t.store.load(e)}catch(s){if("ERR_NOT_FOUND"!==s.code)throw s}yield t.store.patchOrCreate(e,{pubKey:void 0})}catch(s){if("ERR_NOT_FOUND"!==s.code)throw s}finally{co.trace("delete release write lock"),r()}t.dispatchEvent(new rn(xx,{detail:{peerId:e,publicKey:void 0,oldPublicKey:i?.pubKey}}))})()}}const Mr=Gt("libp2p:peer-store:metadata-book"),_p="change:metadata";class mj{constructor(e,t){this.dispatchEvent=e,this.store=t}get(e){var t=this;return V(function*(){e=Zr(e),Mr.trace("get await read lock");const r=yield t.store.lock.readLock();Mr.trace("get got read lock");try{return(yield t.store.load(e)).metadata}catch(i){if("ERR_NOT_FOUND"!==i.code)throw i}finally{Mr.trace("get release read lock"),r()}return new Map})()}getValue(e,t){var r=this;return V(function*(){e=Zr(e),Mr.trace("getValue await read lock");const i=yield r.store.lock.readLock();Mr.trace("getValue got read lock");try{return(yield r.store.load(e)).metadata.get(t)}catch(s){if("ERR_NOT_FOUND"!==s.code)throw s}finally{Mr.trace("getValue release write lock"),i()}})()}set(e,t){var r=this;return V(function*(){if(e=Zr(e),!(t instanceof Map))throw Mr.error("valid metadata must be provided to store data"),se(new Error("valid metadata must be provided"),"ERR_INVALID_PARAMETERS");Mr.trace("set await write lock");const i=yield r.store.lock.writeLock();let s;Mr.trace("set got write lock");try{try{s=yield r.store.load(e)}catch(o){if("ERR_NOT_FOUND"!==o.code)throw o}yield r.store.mergeOrCreate(e,{metadata:t})}finally{Mr.trace("set release write lock"),i()}r.dispatchEvent(new rn(_p,{detail:{peerId:e,metadata:t,oldMetadata:null==s?new Map:s.metadata}}))})()}setValue(e,t,r){var i=this;return V(function*(){if(e=Zr(e),"string"!=typeof t||!(r instanceof Uint8Array))throw Mr.error("valid key and value must be provided to store data"),se(new Error("valid key and value must be provided"),"ERR_INVALID_PARAMETERS");Mr.trace("setValue await write lock");const s=yield i.store.lock.writeLock();let o,a;Mr.trace("setValue got write lock");try{try{o=yield i.store.load(e);const c=o.metadata.get(t);if(null!=c&&$r(r,c))return}catch(c){if("ERR_NOT_FOUND"!==c.code)throw c}a=yield i.store.mergeOrCreate(e,{metadata:new Map([[t,r]])})}finally{Mr.trace("setValue release write lock"),s()}i.dispatchEvent(new rn(_p,{detail:{peerId:e,metadata:a.metadata,oldMetadata:null==o?new Map:o.metadata}}))})()}delete(e){var t=this;return V(function*(){e=Zr(e),Mr.trace("delete await write lock");const r=yield t.store.lock.writeLock();let i;Mr.trace("delete got write lock");try{try{i=yield t.store.load(e)}catch(s){if("ERR_NOT_FOUND"!==s.code)throw s}null!=i&&(yield t.store.patch(e,{metadata:new Map}))}finally{Mr.trace("delete release write lock"),r()}null!=i&&t.dispatchEvent(new rn(_p,{detail:{peerId:e,metadata:new Map,oldMetadata:i.metadata}}))})()}deleteValue(e,t){var r=this;return V(function*(){e=Zr(e),Mr.trace("deleteValue await write lock");const i=yield r.store.lock.writeLock();let s,o;Mr.trace("deleteValue got write lock");try{o=yield r.store.load(e),s=o.metadata,s.delete(t),yield r.store.patch(e,{metadata:s})}catch(a){if("ERR_NOT_FOUND"!==a.code)throw a}finally{Mr.trace("deleteValue release write lock"),i()}null!=s&&r.dispatchEvent(new rn(_p,{detail:{peerId:e,metadata:s,oldMetadata:null==o?new Map:o.metadata}}))})()}}const Or=Gt("libp2p:peer-store:proto-book"),Dp="change:protocols";class vj{constructor(e,t){this.dispatchEvent=e,this.store=t}get(e){var t=this;return V(function*(){Or.trace("get wait for read lock");const r=yield t.store.lock.readLock();Or.trace("get got read lock");try{return(yield t.store.load(e)).protocols}catch(i){if("ERR_NOT_FOUND"!==i.code)throw i}finally{Or.trace("get release read lock"),r()}return[]})()}set(e,t){var r=this;return V(function*(){if(e=Zr(e),!Array.isArray(t))throw Or.error("protocols must be provided to store data"),se(new Error("protocols must be provided"),"ERR_INVALID_PARAMETERS");Or.trace("set await write lock");const i=yield r.store.lock.writeLock();let s,o;Or.trace("set got write lock");try{try{if(s=yield r.store.load(e),new Set([...t]).size===s.protocols.length)return}catch(a){if("ERR_NOT_FOUND"!==a.code)throw a}o=yield r.store.patchOrCreate(e,{protocols:t}),Or("stored provided protocols for %p",e)}finally{Or.trace("set release write lock"),i()}r.dispatchEvent(new rn(Dp,{detail:{peerId:e,protocols:o.protocols,oldProtocols:null==s?[]:s.protocols}}))})()}add(e,t){var r=this;return V(function*(){if(e=Zr(e),!Array.isArray(t))throw Or.error("protocols must be provided to store data"),se(new Error("protocols must be provided"),"ERR_INVALID_PARAMETERS");Or.trace("add await write lock");const i=yield r.store.lock.writeLock();let s,o;Or.trace("add got write lock");try{try{if(s=yield r.store.load(e),new Set([...s.protocols,...t]).size===s.protocols.length)return}catch(a){if("ERR_NOT_FOUND"!==a.code)throw a}o=yield r.store.mergeOrCreate(e,{protocols:t}),Or("added provided protocols for %p",e)}finally{Or.trace("add release write lock"),i()}r.dispatchEvent(new rn(Dp,{detail:{peerId:e,protocols:o.protocols,oldProtocols:null==s?[]:s.protocols}}))})()}remove(e,t){var r=this;return V(function*(){if(e=Zr(e),!Array.isArray(t))throw Or.error("protocols must be provided to store data"),se(new Error("protocols must be provided"),"ERR_INVALID_PARAMETERS");Or.trace("remove await write lock");const i=yield r.store.lock.writeLock();let s,o;Or.trace("remove got write lock");try{try{s=yield r.store.load(e);const a=new Set(s.protocols);for(const c of t)a.delete(c);if(s.protocols.length===a.size)return;t=Array.from(a)}catch(a){if("ERR_NOT_FOUND"!==a.code)throw a}o=yield r.store.patchOrCreate(e,{protocols:t})}finally{Or.trace("remove release write lock"),i()}r.dispatchEvent(new rn(Dp,{detail:{peerId:e,protocols:o.protocols,oldProtocols:null==s?[]:s.protocols}}))})()}delete(e){var t=this;return V(function*(){e=Zr(e),Or.trace("delete await write lock");const r=yield t.store.lock.writeLock();let i;Or.trace("delete got write lock");try{try{i=yield t.store.load(e)}catch(s){if("ERR_NOT_FOUND"!==s.code)throw s}yield t.store.patchOrCreate(e,{protocols:[]})}finally{Or.trace("delete release write lock"),r()}null!=i&&t.dispatchEvent(new rn(Dp,{detail:{peerId:e,protocols:[],oldProtocols:i.protocols}}))})()}}var Sp,Ip,Cp;!function(n){let e;n.codec=()=>(null==e&&(e=fi((t,r,i={})=>{if(!1!==i.lengthDelimited&&r.fork(),null==t.addresses)throw new Error('Protocol error: required field "addresses" was not found in object');for(const s of t.addresses)r.uint32(10),Ip.codec().encode(s,r);if(null==t.protocols)throw new Error('Protocol error: required field "protocols" was not found in object');for(const s of t.protocols)r.uint32(18),r.string(s);if(null==t.metadata)throw new Error('Protocol error: required field "metadata" was not found in object');for(const s of t.metadata)r.uint32(26),Cp.codec().encode(s,r);null!=t.pubKey&&(r.uint32(34),r.bytes(t.pubKey)),null!=t.peerRecordEnvelope&&(r.uint32(42),r.bytes(t.peerRecordEnvelope)),!1!==i.lengthDelimited&&r.ldelim()},(t,r)=>{const i={addresses:[],protocols:[],metadata:[]},s=null==r?t.len:t.pos+r;for(;t.pos>>3){case 1:i.addresses.push(Ip.codec().decode(t,t.uint32()));break;case 2:i.protocols.push(t.string());break;case 3:i.metadata.push(Cp.codec().decode(t,t.uint32()));break;case 4:i.pubKey=t.bytes();break;case 5:i.peerRecordEnvelope=t.bytes();break;default:t.skipType(7&o)}}return i})),e),n.encode=t=>li(t,n.codec()),n.decode=t=>ui(t,n.codec())}(Sp||(Sp={})),function(n){let e;n.codec=()=>(null==e&&(e=fi((t,r,i={})=>{if(!1!==i.lengthDelimited&&r.fork(),null==t.multiaddr)throw new Error('Protocol error: required field "multiaddr" was not found in object');r.uint32(10),r.bytes(t.multiaddr),null!=t.isCertified&&(r.uint32(16),r.bool(t.isCertified)),!1!==i.lengthDelimited&&r.ldelim()},(t,r)=>{const i={multiaddr:new Uint8Array(0)},s=null==r?t.len:t.pos+r;for(;t.pos>>3){case 1:i.multiaddr=t.bytes();break;case 2:i.isCertified=t.bool();break;default:t.skipType(7&o)}}if(null==i.multiaddr)throw new Error('Protocol error: value for required field "multiaddr" was not found in protobuf');return i})),e),n.encode=t=>li(t,n.codec()),n.decode=t=>ui(t,n.codec())}(Ip||(Ip={})),function(n){let e;n.codec=()=>(null==e&&(e=fi((t,r,i={})=>{if(!1!==i.lengthDelimited&&r.fork(),null==t.key)throw new Error('Protocol error: required field "key" was not found in object');if(r.uint32(10),r.string(t.key),null==t.value)throw new Error('Protocol error: required field "value" was not found in object');r.uint32(18),r.bytes(t.value),!1!==i.lengthDelimited&&r.ldelim()},(t,r)=>{const i={key:"",value:new Uint8Array(0)},s=null==r?t.len:t.pos+r;for(;t.pos>>3){case 1:i.key=t.string();break;case 2:i.value=t.bytes();break;default:t.skipType(7&o)}}if(null==i.key)throw new Error('Protocol error: value for required field "key" was not found in protobuf');if(null==i.value)throw new Error('Protocol error: value for required field "value" was not found in protobuf');return i})),e),n.encode=t=>li(t,n.codec()),n.decode=t=>ui(t,n.codec())}(Cp||(Cp={}));var Ej=N(2005);class Rx extends Error{constructor(e){super(e),this.name="TimeoutError"}}class wj extends Error{constructor(e){super(),this.name="AbortError",this.message=e}}const Px=n=>void 0===globalThis.DOMException?new wj(n):new DOMException(n),Nx=n=>{const e=void 0===n.reason?Px("This operation was aborted."):n.reason;return e instanceof Error?e:Px(e)};function Mx(n,e,t,r){let i;const s=new Promise((o,a)=>{if("number"!=typeof e||1!==Math.sign(e))throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${e}\``);if(e!==Number.POSITIVE_INFINITY){if((r={customTimers:{setTimeout,clearTimeout},...r}).signal){const{signal:c}=r;c.aborted&&a(Nx(c)),c.addEventListener("abort",()=>{a(Nx(c))})}i=r.customTimers.setTimeout.call(void 0,()=>{if("function"==typeof t){try{o(t())}catch(T){a(T)}return}const m=t instanceof Error?t:new Rx("string"==typeof t?t:`Promise timed out after ${e} milliseconds`);"function"==typeof n.cancel&&n.cancel(),a(m)},e),V(function*(){try{o(yield n)}catch(c){a(c)}finally{r.customTimers.clearTimeout.call(void 0,i)}})()}else o(n)});return s.clear=()=>{clearTimeout(i),i=void 0},s}var jo,cc=function(n,e,t,r){if("a"===t&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?n!==e||!r:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===t?r:"a"===t?r.call(n):r?r.value:e.get(n)};class _j{constructor(){jo.set(this,[])}enqueue(e,t){const r={priority:(t={priority:0,...t}).priority,run:e};if(this.size&&cc(this,jo,"f")[this.size-1].priority>=t.priority)return void cc(this,jo,"f").push(r);const i=function bj(n,e,t){let r=0,i=n.length;for(;i>0;){const s=Math.trunc(i/2);let o=r+s;t(n[o],e)<=0?(r=++o,i-=s+1):i=s}return r}(cc(this,jo,"f"),r,(s,o)=>o.priority-s.priority);cc(this,jo,"f").splice(i,0,r)}dequeue(){return cc(this,jo,"f").shift()?.run}filter(e){return cc(this,jo,"f").filter(t=>t.priority===e.priority).map(t=>t.run)}get size(){return cc(this,jo,"f").length}}jo=new WeakMap;var Dr,Mf,Of,Ia,Tp,Lf,Ap,$s,kf,Zi,xp,Xi,Bf,Ca,Rp,Ox,Lx,kx,Bx,Fx,Ux,Pp,XE,JE,Np,Mp,pr=function(n,e,t,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?n!==e||!i:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(n,t):i?i.value=t:e.set(n,t),t},gt=function(n,e,t,r){if("a"===t&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?n!==e||!r:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===t?r:"a"===t?r.call(n):r?r.value:e.get(n)};const Dj=new Rx;class Sj extends Error{}class Vx extends Ej{constructor(e){var t,r,i,s;if(super(),Dr.add(this),Mf.set(this,void 0),Of.set(this,void 0),Ia.set(this,0),Tp.set(this,void 0),Lf.set(this,void 0),Ap.set(this,0),$s.set(this,void 0),kf.set(this,void 0),Zi.set(this,void 0),xp.set(this,void 0),Xi.set(this,0),Bf.set(this,void 0),Ca.set(this,void 0),Rp.set(this,void 0),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),!("number"==typeof(e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:_j,...e}).intervalCap&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${null!==(r=null===(t=e.intervalCap)||void 0===t?void 0:t.toString())&&void 0!==r?r:""}\` (${typeof e.intervalCap})`);if(void 0===e.interval||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${null!==(s=null===(i=e.interval)||void 0===i?void 0:i.toString())&&void 0!==s?s:""}\` (${typeof e.interval})`);pr(this,Mf,e.carryoverConcurrencyCount,"f"),pr(this,Of,e.intervalCap===Number.POSITIVE_INFINITY||0===e.interval,"f"),pr(this,Tp,e.intervalCap,"f"),pr(this,Lf,e.interval,"f"),pr(this,Zi,new e.queueClass,"f"),pr(this,xp,e.queueClass,"f"),this.concurrency=e.concurrency,this.timeout=e.timeout,pr(this,Rp,!0===e.throwOnTimeout,"f"),pr(this,Ca,!1===e.autoStart,"f")}get concurrency(){return gt(this,Bf,"f")}set concurrency(e){if(!("number"==typeof e&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);pr(this,Bf,e,"f"),gt(this,Dr,"m",Np).call(this)}add(e,t={}){var r=this;return V(function*(){return new Promise((i,s)=>{const o=function(){var a=V(function*(){var c,m,T;pr(r,Xi,(m=gt(r,Xi,"f"),++m),"f"),pr(r,Ia,(T=gt(r,Ia,"f"),++T),"f");try{if(null!==(c=t.signal)&&void 0!==c&&c.aborted)return void s(new Sj("The task was aborted."));const k=yield void 0===r.timeout&&void 0===t.timeout?e({signal:t.signal}):Mx(Promise.resolve(e({signal:t.signal})),void 0===t.timeout?r.timeout:t.timeout,()=>{(void 0===t.throwOnTimeout?gt(r,Rp,"f"):t.throwOnTimeout)&&s(Dj)});i(k),r.emit("completed",k)}catch(R){s(R),r.emit("error",R)}gt(r,Dr,"m",kx).call(r)});return function(){return a.apply(this,arguments)}}();gt(r,Zi,"f").enqueue(o,t),gt(r,Dr,"m",Pp).call(r),r.emit("add")})})()}addAll(e,t){var r=this;return V(function*(){return Promise.all(e.map(function(){var i=V(function*(s){return r.add(s,t)});return function(s){return i.apply(this,arguments)}}()))})()}start(){return gt(this,Ca,"f")?(pr(this,Ca,!1,"f"),gt(this,Dr,"m",Np).call(this),this):this}pause(){pr(this,Ca,!0,"f")}clear(){pr(this,Zi,new(gt(this,xp,"f")),"f")}onEmpty(){var e=this;return V(function*(){0!==gt(e,Zi,"f").size&&(yield gt(e,Dr,"m",Mp).call(e,"empty"))})()}onSizeLessThan(e){var t=this;return V(function*(){gt(t,Zi,"f").sizegt(t,Zi,"f").size{gt(this,Dr,"m",Fx).call(this)},t),"f"),!0;pr(this,Ia,gt(this,Mf,"f")?gt(this,Xi,"f"):0,"f")}return!1},Pp=function(){if(0===gt(this,Zi,"f").size)return gt(this,$s,"f")&&clearInterval(gt(this,$s,"f")),pr(this,$s,void 0,"f"),gt(this,Dr,"m",Bx).call(this),!1;if(!gt(this,Ca,"f")){const e=!gt(this,Dr,"a",Ux);if(gt(this,Dr,"a",Ox)&>(this,Dr,"a",Lx)){const t=gt(this,Zi,"f").dequeue();return!!t&&(this.emit("active"),t(),e&>(this,Dr,"m",XE).call(this),!0)}}return!1},XE=function(){gt(this,Of,"f")||void 0!==gt(this,$s,"f")||(pr(this,$s,setInterval(()=>{gt(this,Dr,"m",JE).call(this)},gt(this,Lf,"f")),"f"),pr(this,Ap,Date.now()+gt(this,Lf,"f"),"f"))},JE=function(){0===gt(this,Ia,"f")&&0===gt(this,Xi,"f")&>(this,$s,"f")&&(clearInterval(gt(this,$s,"f")),pr(this,$s,void 0,"f")),pr(this,Ia,gt(this,Mf,"f")?gt(this,Xi,"f"):0,"f"),gt(this,Dr,"m",Np).call(this)},Np=function(){for(;gt(this,Dr,"m",Pp).call(this););},Mp=function(){var n=V(function*(t,r){return new Promise(i=>{const s=()=>{r&&!r()||(this.off(t,s),i())};this.on(t,s)})});return function e(t,r){return n.apply(this,arguments)}}();class Ij extends Error{constructor(e){super(e),this.name="TimeoutError"}}class Cj extends Error{constructor(e){super(),this.name="AbortError",this.message=e}}const Hx=n=>void 0===globalThis.DOMException?new Cj(n):new DOMException(n),Kx=n=>{const e=void 0===n.reason?Hx("This operation was aborted."):n.reason;return e instanceof Error?e:Hx(e)};function Tj(n,e){const{milliseconds:t,fallback:r,message:i,customTimers:s={setTimeout,clearTimeout}}=e;let o;const a=new Promise((c,m)=>{if("number"!=typeof t||1!==Math.sign(t))throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);if(t!==Number.POSITIVE_INFINITY){if(e.signal){const{signal:T}=e;T.aborted&&m(Kx(T)),T.addEventListener("abort",()=>{m(Kx(T))})}o=s.setTimeout.call(void 0,()=>{if(r){try{c(r())}catch(k){m(k)}return}const R=i instanceof Error?i:new Ij("string"==typeof i?i:`Promise timed out after ${t} milliseconds`);"function"==typeof n.cancel&&n.cancel(),m(R)},t),V(function*(){try{c(yield n)}catch(T){m(T)}finally{s.clearTimeout.call(void 0,o)}})()}else c(n)});return a.clear=()=>{s.clearTimeout.call(void 0,o),o=void 0},a}const jx="lock:worker:request-read",$x="lock:worker:release-read",Gx="lock:master:grant-read",zx="lock:worker:request-write",Wx="lock:worker:release-write",qx="lock:master:grant-write",Ta={},Bu=n=>{n.addEventListener("message",e=>{Bu.dispatchEvent("message",n,e)}),null!=n.port&&n.port.addEventListener("message",e=>{Bu.dispatchEvent("message",n,e)})};Bu.addEventListener=(n,e)=>{null==Ta[n]&&(Ta[n]=[]),Ta[n].push(e)},Bu.removeEventListener=(n,e)=>{null!=Ta[n]&&(Ta[n]=Ta[n].filter(t=>t===e))},Bu.dispatchEvent=function(n,e,t){null!=Ta[n]&&Ta[n].forEach(r=>r(e,t))};const Qx=Bu,Yx=(n,e,t,r,i)=>(s,o)=>{if(o.data.type!==t)return;const a={type:o.data.type,name:o.data.name,identifier:o.data.identifier};var c;n.dispatchEvent(new MessageEvent(e,{data:{name:a.name,handler:(c=V(function*(){return s.postMessage({type:i,name:a.name,identifier:a.identifier}),yield new Promise(m=>{const T=R=>{null!=R&&null!=R.data&&R.data.type===r&&R.data.identifier===a.identifier&&(s.removeEventListener("message",T),m())};s.addEventListener("message",T)})}),function(){return c.apply(this,arguments)})}}))},Zx=(n,e,t,r)=>V(function*(){const i=((n=21)=>crypto.getRandomValues(new Uint8Array(n)).reduce((e,t)=>e+((t&=63)<36?t.toString(36):t<62?(t-26).toString(36).toUpperCase():t>62?"-":"_"),""))();return globalThis.postMessage({type:e,identifier:i,name:n}),yield new Promise(s=>{const o=a=>{null!=a&&null!=a.data&&a.data.type===t&&a.data.identifier===i&&(globalThis.removeEventListener("message",o),s(()=>{globalThis.postMessage({type:r,identifier:i,name:n})}))};globalThis.addEventListener("message",o)})}),Pj={singleProcess:!1},uc={};let Aa;function ew(n,e){return tw.apply(this,arguments)}function tw(){return tw=V(function*(n,e){let t;const r=new Promise(i=>{t=i});return n.add(V(function*(){return yield Tj(V(function*(){return yield new Promise(i=>{t(()=>{i()})})})(),{milliseconds:e.timeout})})),yield r}),tw.apply(this,arguments)}const Oj={name:"lock",concurrency:1/0,timeout:846e5,singleProcess:!1};const Xx=Gt("libp2p:peer-store:store"),Jx="/peers/";class kj{constructor(){this.components=new ko,this.lock=function Lj(n){const e=Object.assign({},Oj,n);return null==Aa&&(Aa=(n=>{if(n=Object.assign({},Pj,n),Boolean(globalThis.document)||n.singleProcess){const t=new EventTarget;return Qx.addEventListener("message",Yx(t,"requestReadLock",jx,$x,Gx)),Qx.addEventListener("message",Yx(t,"requestWriteLock",zx,Wx,qx)),t}return{isWorker:!0,readLock:t=>Zx(t,jx,Gx,$x),writeLock:t=>Zx(t,zx,qx,Wx)}})(e),!0!==Aa.isWorker&&(Aa.addEventListener("requestReadLock",t=>{null!=uc[t.data.name]&&uc[t.data.name].readLock().then(function(){var r=V(function*(i){return yield t.data.handler().finally(()=>i())});return function(i){return r.apply(this,arguments)}}())}),Aa.addEventListener("requestWriteLock",function(){var t=V(function*(r){null!=uc[r.data.name]&&uc[r.data.name].writeLock().then(function(){var i=V(function*(s){return yield r.data.handler().finally(()=>s())});return function(s){return i.apply(this,arguments)}}())});return function(r){return t.apply(this,arguments)}}()))),null==uc[e.name]&&(uc[e.name]=((n,e)=>{if(!0===Aa.isWorker)return{readLock:Aa.readLock(n,e),writeLock:Aa.writeLock(n,e)};const t=new Vx({concurrency:1});let r;return{readLock:()=>V(function*(){if(null!=r)return yield ew(r,e);r=new Vx({concurrency:e.concurrency,autoStart:!1});const i=r,s=ew(r,e);return t.add(V(function*(){return i.start(),yield i.onIdle().then(()=>{r===i&&(r=null)})})),yield s})(),writeLock:()=>V(function*(){return r=null,yield ew(t,e)})()}})(e.name,e)),uc[e.name]}({name:"peer-store",singleProcess:!0})}init(e){this.components=e}_peerIdToDatastoreKey(e){if(null==e.type)throw Xx.error("peerId must be an instance of peer-id to store data"),se(new Error("peerId must be an instance of peer-id"),"ERR_INVALID_PARAMETERS");const t=e.toCID().toString();return new Xr(`${Jx}${t}`)}has(e){var t=this;return V(function*(){return yield t.components.getDatastore().has(t._peerIdToDatastoreKey(e))})()}delete(e){var t=this;return V(function*(){yield t.components.getDatastore().delete(t._peerIdToDatastoreKey(e))})()}load(e){var t=this;return V(function*(){const r=yield t.components.getDatastore().get(t._peerIdToDatastoreKey(e)),i=Sp.decode(r),s=new Map;for(const o of i.metadata)s.set(o.key,o.value);return{...i,id:e,addresses:i.addresses.map(({multiaddr:o,isCertified:a})=>({multiaddr:new vn(o),isCertified:a??!1})),metadata:s,pubKey:i.pubKey??void 0,peerRecordEnvelope:i.peerRecordEnvelope??void 0}})()}save(e){var t=this;return V(function*(){if(null!=e.pubKey&&null!=e.id.publicKey&&!$r(e.pubKey,e.id.publicKey))throw Xx.error("peer publicKey bytes do not match peer id publicKey bytes"),se(new Error("publicKey bytes do not match peer id publicKey bytes"),"ERR_INVALID_PARAMETERS");const r=new Set,i=e.addresses.filter(a=>!r.has(a.multiaddr.toString())&&(r.add(a.multiaddr.toString()),!0)).sort((a,c)=>a.multiaddr.toString().localeCompare(c.multiaddr.toString())).map(({multiaddr:a,isCertified:c})=>({multiaddr:a.bytes,isCertified:c})),s=[];[...e.metadata.keys()].sort().forEach(a=>{const c=e.metadata.get(a);null!=c&&s.push({key:a,value:c})});const o=Sp.encode({addresses:i,protocols:e.protocols.sort(),pubKey:e.pubKey,metadata:s,peerRecordEnvelope:e.peerRecordEnvelope});return yield t.components.getDatastore().put(t._peerIdToDatastoreKey(e.id),o.subarray()),yield t.load(e.id)})()}patch(e,t){var r=this;return V(function*(){const i=yield r.load(e);return yield r._patch(e,t,i)})()}patchOrCreate(e,t){var r=this;return V(function*(){let i;try{i=yield r.load(e)}catch(s){if("ERR_NOT_FOUND"!==s.code)throw s;i={id:e,addresses:[],protocols:[],metadata:new Map}}return yield r._patch(e,t,i)})()}_patch(e,t,r){var i=this;return V(function*(){return yield i.save({...r,...t,id:e})})()}merge(e,t){var r=this;return V(function*(){const i=yield r.load(e);return yield r._merge(e,t,i)})()}mergeOrCreate(e,t){var r=this;return V(function*(){let i;try{i=yield r.load(e)}catch(s){if("ERR_NOT_FOUND"!==s.code)throw s;i={id:e,addresses:[],protocols:[],metadata:new Map}}return yield r._merge(e,t,i)})()}_merge(e,t,r){var i=this;return V(function*(){const s=new Map;return r.addresses.forEach(o=>{s.set(o.multiaddr.toString(),o.isCertified)}),(t.addresses??[]).forEach(o=>{const a=o.multiaddr.toString(),m=Boolean(s.get(a))||o.isCertified;s.set(a,m)}),yield i.save({id:e,addresses:Array.from(s.entries()).map(([o,a])=>({multiaddr:new vn(o),isCertified:a})),protocols:Array.from(new Set([...r.protocols??[],...t.protocols??[]])),metadata:new Map([...r.metadata?.entries()??[],...t.metadata?.entries()??[]]),pubKey:t.pubKey??r?.pubKey,peerRecordEnvelope:t.peerRecordEnvelope??r?.peerRecordEnvelope})})()}all(){var e=this;return un(function*(){var i,t=!1,r=!1;try{for(var o,s=Tt(e.components.getDatastore().queryKeys({prefix:Jx}));t=!(o=yield ct(s.next())).done;t=!1){const c=o.value.toString().split("/")[2],m=Ro.decode(c);yield e.load(pa(m))}}catch(a){r=!0,i=a}finally{try{t&&null!=s.return&&(yield ct(s.return()))}finally{if(r)throw i}}})()}}var xa,Op;!function(n){let e;n.codec=()=>(null==e&&(e=fi((t,r,i={})=>{if(!1!==i.lengthDelimited&&r.fork(),null==t.tags)throw new Error('Protocol error: required field "tags" was not found in object');for(const s of t.tags)r.uint32(10),Op.codec().encode(s,r);!1!==i.lengthDelimited&&r.ldelim()},(t,r)=>{const i={tags:[]},s=null==r?t.len:t.pos+r;for(;t.pos>>3==1?i.tags.push(Op.codec().decode(t,t.uint32())):t.skipType(7&o)}return i})),e),n.encode=t=>li(t,n.codec()),n.decode=t=>ui(t,n.codec())}(xa||(xa={})),function(n){let e;n.codec=()=>(null==e&&(e=fi((t,r,i={})=>{if(!1!==i.lengthDelimited&&r.fork(),null==t.name)throw new Error('Protocol error: required field "name" was not found in object');r.uint32(10),r.string(t.name),null!=t.value&&(r.uint32(16),r.uint32(t.value)),null!=t.expiry&&(r.uint32(24),r.uint64(t.expiry)),!1!==i.lengthDelimited&&r.ldelim()},(t,r)=>{const i={name:""},s=null==r?t.len:t.pos+r;for(;t.pos>>3){case 1:i.name=t.string();break;case 2:i.value=t.uint32();break;case 3:i.expiry=t.uint64();break;default:t.skipType(7&o)}}if(null==i.name)throw new Error('Protocol error: value for required field "name" was not found in protobuf');return i})),e),n.encode=t=>li(t,n.codec()),n.decode=t=>ui(t,n.codec())}(Op||(Op={}));const ys=Gt("libp2p:peer-store");class Bj extends ki{constructor(e={}){super(),this.components=new ko,this.store=new kj,this.addressBook=new gj(this.dispatchEvent.bind(this),this.store,e.addressFilter),this.keyBook=new yj(this.dispatchEvent.bind(this),this.store),this.metadataBook=new mj(this.dispatchEvent.bind(this),this.store),this.protoBook=new vj(this.dispatchEvent.bind(this),this.store)}init(e){this.components=e,this.store.init(e)}forEach(e){var t=this;return V(function*(){ys.trace("getPeers await read lock");const r=yield t.store.lock.readLock();ys.trace("getPeers got read lock");try{var o,i=!1,s=!1;try{for(var c,a=Tt(t.store.all());i=!(c=yield a.next()).done;i=!1){const m=c.value;m.id.equals(t.components.getPeerId())||e(m)}}catch(m){s=!0,o=m}finally{try{i&&null!=a.return&&(yield a.return())}finally{if(s)throw o}}}finally{ys.trace("getPeers release read lock"),r()}})()}all(){var e=this;return V(function*(){const t=[];return yield e.forEach(r=>{t.push(r)}),t})()}delete(e){var t=this;return V(function*(){ys.trace("delete await write lock");const r=yield t.store.lock.writeLock();ys.trace("delete got write lock");try{yield t.store.delete(e)}finally{ys.trace("delete release write lock"),r()}})()}get(e){var t=this;return V(function*(){ys.trace("get await read lock");const r=yield t.store.lock.readLock();ys.trace("get got read lock");try{return yield t.store.load(e)}finally{ys.trace("get release read lock"),r()}})()}has(e){var t=this;return V(function*(){ys.trace("has await read lock");const r=yield t.store.lock.readLock();ys.trace("has got read lock");try{return yield t.store.has(e)}finally{ys.trace("has release read lock"),r()}})()}tagPeer(e,t,r={}){var i=this;return V(function*(){const s=r.value??0,o=Math.round(s),a=r.ttl??void 0;if(o!==s||o<0||o>100)throw se(new Error("Tag value must be between 0-100"),"ERR_TAG_VALUE_OUT_OF_BOUNDS");const c=yield i.metadataBook.getValue(e,"tags");let m=[];null!=c&&(m=xa.decode(c).tags);for(const T of m)if(T.name===t)throw se(new Error("Peer already tagged"),"ERR_DUPLICATE_TAG");m.push({name:t,value:o,expiry:null==a?void 0:BigInt(Date.now()+a)}),yield i.metadataBook.setValue(e,"tags",xa.encode({tags:m}).subarray())})()}unTagPeer(e,t){var r=this;return V(function*(){const i=yield r.metadataBook.getValue(e,"tags");let s=[];null!=i&&(s=xa.decode(i).tags),s=s.filter(o=>o.name!==t),yield r.metadataBook.setValue(e,"tags",xa.encode({tags:s}).subarray())})()}getTags(e){var t=this;return V(function*(){const r=yield t.metadataBook.getValue(e,"tags");let i=[];null!=r&&(i=xa.decode(r).tags);const s=BigInt(Date.now()),o=i.filter(a=>null==a.expiry||a.expiry>s);return o.length!==i.length&&(yield t.metadataBook.setValue(e,"tags",xa.encode({tags:o}).subarray())),o.map(a=>({name:a.name,value:a.value??0}))})()}}class Fj{constructor(e){this.dht=e}provide(e){var t=this;return V(function*(){yield wa(t.dht.provide(e))})()}findProviders(e,t={}){var r=this;return un(function*(){var o,i=!1,s=!1;try{for(var c,a=Tt(r.dht.findProviders(e,t));i=!(c=yield ct(a.next())).done;i=!1){const m=c.value;"PROVIDER"===m.name&&(yield*jr(Tt(m.providers),ct))}}catch(m){s=!0,o=m}finally{try{i&&null!=a.return&&(yield ct(a.return()))}finally{if(s)throw o}}})()}put(e,t,r){var i=this;return V(function*(){yield wa(i.dht.put(e,t,r))})()}get(e,t){var r=this;return V(function*(){var o,i=!1,s=!1;try{for(var c,a=Tt(r.dht.get(e,t));i=!(c=yield a.next()).done;i=!1){const m=c.value;if("VALUE"===m.name)return m.value}}catch(m){s=!0,o=m}finally{try{i&&null!=a.return&&(yield a.return())}finally{if(s)throw o}}throw se(new Error("Not found"),"ERR_NOT_FOUND")})()}}const eR=Gt("libp2p:dialer:auto-dialer");class Uj{constructor(e,t){this.components=e,this.enabled=t.enabled,this.minConnections=t.minConnections,this.dialTimeout=t.dialTimeout}handle(e){const{detail:t}=e;if(this.enabled&&0===this.components.getConnectionManager().getConnections(t.id).length&&(this.minConnections??0)>this.components.getConnectionManager().getConnections().length){eR("auto-dialing discovered peer %p with timeout %d",t.id,this.dialTimeout);const o=new Bi.TimeoutController(this.dialTimeout);try{(0,Jr.setMaxListeners)?.(1/0,o.signal)}catch{}this.components.getConnectionManager().openConnection(t.id,{signal:o.signal}).catch(a=>{eR.error("could not connect to discovered peer %p with %o",t.id,a)}).finally(()=>{o.clear()})}}}var tR=N(4033);const Vj=globalThis.fetch,Hj=globalThis.Headers;function nw(n,e,t){return`${n}?name=${e}&type=${t}`}function Kj(n,e){return rw.apply(this,arguments)}function rw(){return rw=V(function*(n,e){return yield(yield Vj(n,{headers:new Hj({accept:"application/dns-json"}),signal:e})).json()}),rw.apply(this,arguments)}function Fu(n,e){return`${e}_${n}`}globalThis,globalThis;const iw=Object.assign(Ur("dns-over-http-resolver"),{error:Ur("dns-over-http-resolver:error")}),$j=class jj{constructor(e={}){this._cache=new tR({max:e?.maxCache??100}),this._TXTcache=new tR({max:e?.maxCache??100}),this._servers=["https://cloudflare-dns.com/dns-query","https://dns.google/resolve"],this._request=e.request??Kj,this._abortControllers=[]}cancel(){this._abortControllers.forEach(e=>e.abort())}getServers(){return this._servers}_getShuffledServers(){const e=[...this._servers];for(let t=e.length-1;t>0;t--){const r=Math.floor(Math.random()*t),i=e[t];e[t]=e[r],e[r]=i}return e}setServers(e){this._servers=e}resolve(e,t="A"){var r=this;return V(function*(){switch(t){case"A":return yield r.resolve4(e);case"AAAA":return yield r.resolve6(e);case"TXT":return yield r.resolveTxt(e);default:throw new Error(`${t} is not supported`)}})()}resolve4(e){var t=this;return V(function*(){const i=t._cache.get(Fu(e,"A"));if(null!=i)return i;let s=!1;for(const o of t._getShuffledServers()){const a=new AbortController;t._abortControllers.push(a);try{const c=yield t._request(nw(o,e,"A"),a.signal),m=c.Answer.map(R=>R.data),T=Math.min(...c.Answer.map(R=>R.TTL));return t._cache.set(Fu(e,"A"),m,{ttl:T}),m}catch{a.signal.aborted&&(s=!0),iw.error(`${o} could not resolve ${e} record A`)}finally{t._abortControllers=t._abortControllers.filter(c=>c!==a)}}throw s?Object.assign(new Error("queryA ECANCELLED"),{code:"ECANCELLED"}):new Error(`Could not resolve ${e} record A`)})()}resolve6(e){var t=this;return V(function*(){const r="AAAA",i=t._cache.get(Fu(e,r));if(null!=i)return i;let s=!1;for(const o of t._getShuffledServers()){const a=new AbortController;t._abortControllers.push(a);try{const c=yield t._request(nw(o,e,r),a.signal),m=c.Answer.map(R=>R.data),T=Math.min(...c.Answer.map(R=>R.TTL));return t._cache.set(Fu(e,r),m,{ttl:T}),m}catch{a.signal.aborted&&(s=!0),iw.error(`${o} could not resolve ${e} record AAAA`)}finally{t._abortControllers=t._abortControllers.filter(c=>c!==a)}}throw s?Object.assign(new Error("queryAaaa ECANCELLED"),{code:"ECANCELLED"}):new Error(`Could not resolve ${e} record AAAA`)})()}resolveTxt(e){var t=this;return V(function*(){const r="TXT",i=t._TXTcache.get(Fu(e,r));if(null!=i)return i;let s=!1;for(const o of t._getShuffledServers()){const a=new AbortController;t._abortControllers.push(a);try{const c=yield t._request(nw(o,e,r),a.signal),m=c.Answer.map(R=>[R.data.replace(/['"]+/g,"")]),T=Math.min(...c.Answer.map(R=>R.TTL));return t._TXTcache.set(Fu(e,r),m,{ttl:T}),m}catch{a.signal.aborted&&(s=!0),iw.error(`${o} could not resolve ${e} record TXT`)}finally{t._abortControllers=t._abortControllers.filter(c=>c!==a)}}throw s?Object.assign(new Error("queryTxt ECANCELLED"),{code:"ECANCELLED"}):new Error(`Could not resolve ${e} record TXT`)})()}clearCache(){this._cache.clear(),this._TXTcache.clear()}},{code:Gj}=Nr("dnsaddr");function sw(){return sw=V(function*(n,e={}){const t=new $j;null!=e.signal&&e.signal.addEventListener("abort",()=>{t.cancel()});const r=n.getPeerId(),[,i]=n.stringTuples().find(([a])=>a===Gj)??[];if(null==i)throw new Error("No hostname found in multiaddr");let o=(yield t.resolveTxt(`_dnsaddr.${i}`)).flat().map(a=>a.split("=")[1]);return null!=r&&(o=o.filter(a=>a.includes(r))),o}),sw.apply(this,arguments)}const Wj={addresses:{listen:[],announce:[],noAnnounce:[],announceFilter:n=>n},connectionManager:{maxConnections:300,minConnections:50,autoDial:!0,autoDialInterval:1e4,maxParallelDials:100,maxDialsPerPeer:4,dialTimeout:3e4,inboundUpgradeTimeout:3e4,resolvers:{dnsaddr:function zj(n){return sw.apply(this,arguments)}},addressSorter:yE},connectionGater:{},transportManager:{faultTolerance:oc.FATAL_ALL},metrics:{enabled:!1,computeThrottleMaxQueueSize:1e3,computeThrottleTimeout:2e3,movingAverageIntervals:[6e4,3e5,9e5],maxOldPeersRetention:50},peerRouting:{refreshManager:{enabled:!0,interval:6e5,bootDelay:1e4}},nat:{enabled:!0,ttl:7200,keepAlive:!0},relay:{enabled:!0,advertise:{bootDelay:9e5,enabled:!1,ttl:18e5},hop:{enabled:!1,active:!1,timeout:3e4},autoRelay:{enabled:!1,maxListeners:2}},identify:{protocolPrefix:"ipfs",host:{agentVersion:Ix},timeout:6e4,maxInboundStreams:1,maxOutboundStreams:1,maxPushIncomingStreams:1,maxPushOutgoingStreams:1},ping:{protocolPrefix:"ipfs",maxInboundStreams:1,maxOutboundStreams:1,timeout:1e4},fetch:{protocolPrefix:"libp2p",maxInboundStreams:1,maxOutboundStreams:1,timeout:1e4}};function qj(n){const e=Df(Wj,n);if(null==e.transports||e.transports.length<1)throw se(new Error(Cn.ERR_TRANSPORTS_REQUIRED),Ie.ERR_TRANSPORTS_REQUIRED);if(null==e.connectionEncryption||0===e.connectionEncryption.length)throw se(new Error(Cn.CONN_ENCRYPTION_REQUIRED),Ie.CONN_ENCRYPTION_REQUIRED);if(null===e.connectionProtector&&null!=globalThis.process?.env?.LIBP2P_FORCE_PNET)throw se(new Error(Cn.ERR_PROTECTOR_REQUIRED),Ie.ERR_PROTECTOR_REQUIRED);return e.identify.host.agentVersion===Ix&&(X9||Y9?e.identify.host.agentVersion+=` UserAgent=${globalThis.process.version}`:(fp||_A||Z9||J9)&&(e.identify.host.agentVersion+=` UserAgent=${globalThis.navigator.userAgent}`)),e}var nR;!function(n){let e;n.codec=()=>(null==e&&(e=fi((t,r,i={})=>{if(!1!==i.lengthDelimited&&r.fork(),null==t.id)throw new Error('Protocol error: required field "id" was not found in object');r.uint32(10),r.bytes(t.id),null!=t.pubKey&&(r.uint32(18),r.bytes(t.pubKey)),null!=t.privKey&&(r.uint32(26),r.bytes(t.privKey)),!1!==i.lengthDelimited&&r.ldelim()},(t,r)=>{const i={id:new Uint8Array(0)},s=null==r?t.len:t.pos+r;for(;t.pos>>3){case 1:i.id=t.bytes();break;case 2:i.pubKey=t.bytes();break;case 3:i.privKey=t.bytes();break;default:t.skipType(7&o)}}if(null==i.id)throw new Error('Protocol error: value for required field "id" was not found in protobuf');return i})),e),n.encode=t=>li(t,n.codec()),n.decode=t=>ui(t,n.codec())}(nR||(nR={}));const Qj=function(){var n=V(function*(){const e=yield bT("Ed25519"),t=yield function rR(n){return aw.apply(this,arguments)}(e);if("Ed25519"===t.type)return t;throw new Error(`Generated unexpected PeerId type "${t.type}"`)});return function(){return n.apply(this,arguments)}}();function aw(){return aw=V(function*(n){return yield xu(BV(n.public),FV(n))}),aw.apply(this,arguments)}const fw=Symbol.for("@libp2p/peer-discovery");class Zj extends ki{get[fw](){return!0}get[Symbol.toStringTag](){return"@libp2p/dummy-dht"}get wan(){throw se(new Error(Cn.DHT_DISABLED),Ie.DHT_DISABLED)}get lan(){throw se(new Error(Cn.DHT_DISABLED),Ie.DHT_DISABLED)}get(){throw se(new Error(Cn.DHT_DISABLED),Ie.DHT_DISABLED)}findProviders(){throw se(new Error(Cn.DHT_DISABLED),Ie.DHT_DISABLED)}findPeer(){throw se(new Error(Cn.DHT_DISABLED),Ie.DHT_DISABLED)}getClosestPeers(){throw se(new Error(Cn.DHT_DISABLED),Ie.DHT_DISABLED)}provide(){throw se(new Error(Cn.DHT_DISABLED),Ie.DHT_DISABLED)}put(){throw se(new Error(Cn.DHT_DISABLED),Ie.DHT_DISABLED)}getMode(){return V(function*(){throw se(new Error(Cn.DHT_DISABLED),Ie.DHT_DISABLED)})()}setMode(){return V(function*(){throw se(new Error(Cn.DHT_DISABLED),Ie.DHT_DISABLED)})()}refreshRoutingTable(){return V(function*(){throw se(new Error(Cn.DHT_DISABLED),Ie.DHT_DISABLED)})()}}class Xj extends ki{isStarted(){return!1}start(){}stop(){}get globalSignaturePolicy(){throw se(new Error(Cn.PUBSUB_DISABLED),Ie.ERR_PUBSUB_DISABLED)}get multicodecs(){throw se(new Error(Cn.PUBSUB_DISABLED),Ie.ERR_PUBSUB_DISABLED)}getPeers(){throw se(new Error(Cn.PUBSUB_DISABLED),Ie.ERR_PUBSUB_DISABLED)}getTopics(){throw se(new Error(Cn.PUBSUB_DISABLED),Ie.ERR_PUBSUB_DISABLED)}subscribe(){throw se(new Error(Cn.PUBSUB_DISABLED),Ie.ERR_PUBSUB_DISABLED)}unsubscribe(){throw se(new Error(Cn.PUBSUB_DISABLED),Ie.ERR_PUBSUB_DISABLED)}getSubscribers(){throw se(new Error(Cn.PUBSUB_DISABLED),Ie.ERR_PUBSUB_DISABLED)}publish(){return V(function*(){throw se(new Error(Cn.PUBSUB_DISABLED),Ie.ERR_PUBSUB_DISABLED)})()}}const $o=Gt("libp2p");class Jj extends ki{constructor(e){var o;super(),this.initializables=[],this.started=!1,this.peerId=e.peerId,this.components=new ko({peerId:e.peerId,datastore:e.datastore??new SH,connectionGater:{denyDialPeer:(o=V(function*(){return yield Promise.resolve(!1)}),function(){return o.apply(this,arguments)}),denyDialMultiaddr:function(){var o=V(function*(){return yield Promise.resolve(!1)});return function(){return o.apply(this,arguments)}}(),denyInboundConnection:function(){var o=V(function*(){return yield Promise.resolve(!1)});return function(){return o.apply(this,arguments)}}(),denyOutboundConnection:function(){var o=V(function*(){return yield Promise.resolve(!1)});return function(){return o.apply(this,arguments)}}(),denyInboundEncryptedConnection:function(){var o=V(function*(){return yield Promise.resolve(!1)});return function(){return o.apply(this,arguments)}}(),denyOutboundEncryptedConnection:function(){var o=V(function*(){return yield Promise.resolve(!1)});return function(){return o.apply(this,arguments)}}(),denyInboundUpgradedConnection:function(){var o=V(function*(){return yield Promise.resolve(!1)});return function(){return o.apply(this,arguments)}}(),denyOutboundUpgradedConnection:function(){var o=V(function*(){return yield Promise.resolve(!1)});return function(){return o.apply(this,arguments)}}(),filterMultiaddrForPeer:function(){var o=V(function*(){return yield Promise.resolve(!0)});return function(){return o.apply(this,arguments)}}(),...e.connectionGater}}),this.components.setPeerStore(new Bj({addressFilter:this.components.getConnectionGater().filterMultiaddrForPeer,...e.peerStore})),this.services=[this.components],e.metrics.enabled&&(this.metrics=this.components.setMetrics(new wK(e.metrics))),this.peerStore=this.components.getPeerStore(),this.peerStore.addEventListener("peer",o=>{const{detail:a}=o;this.dispatchEvent(new rn("peer:discovery",{detail:a}))}),null!=e.connectionProtector&&this.components.setConnectionProtector(e.connectionProtector),this.components.setUpgrader(new UK(this.components,{connectionEncryption:(e.connectionEncryption??[]).map(o=>this.configureComponent(o)),muxers:(e.streamMuxers??[]).map(o=>this.configureComponent(o)),inboundUpgradeTimeout:e.connectionManager.inboundUpgradeTimeout})),this.connectionManager=this.components.setConnectionManager(new GH(e.connectionManager)),this.registrar=this.components.setRegistrar(new kK(this.components)),this.components.setTransportManager(new xK(this.components,e.transportManager)),this.components.setAddressManager(new xH(this.components,e.addresses)),this.configureComponent(new dj(this.components)),this.configureComponent(new WH(this.components,{enabled:e.connectionManager.autoDial,minConnections:e.connectionManager.minConnections,autoDialInterval:e.connectionManager.autoDialInterval}));const t=fx.generateOptions();this.keychain=this.configureComponent(new fx(this.components,{...t,...e.keychain})),this.services.push(new lj(this.components,e.nat)),e.transports.forEach(o=>{this.components.getTransportManager().add(this.configureComponent(o))}),null!=e.streamMuxers&&e.streamMuxers.length>0&&(this.identifyService=new $E(this.components,{...e.identify}),this.configureComponent(this.identifyService)),this.dht=null!=e.dht?this.components.setDHT(e.dht):new Zj,this.pubsub=null!=e.pubsub?this.components.setPubSub(e.pubsub):new Xj;const r=(e.peerRouters??[]).map(o=>this.configureComponent(o));null!=e.dht&&(r.push(this.configureComponent(new hj(this.dht))),this.dht.addEventListener("peer",o=>{this.onDiscoveryPeer(o)})),this.peerRouting=this.components.setPeerRouting(this.configureComponent(new IH(this.components,{...e.peerRouting,routers:r})));const i=(e.contentRouters??[]).map(o=>this.configureComponent(o));null!=e.dht&&i.push(this.configureComponent(new Fj(this.dht))),this.contentRouting=this.components.setContentRouting(this.configureComponent(new CH(this.components,{routers:i}))),e.relay.enabled&&(this.components.getTransportManager().add(this.configureComponent(new nK(e.relay))),this.configureComponent(new cK(this.components,{addressSorter:e.connectionManager.addressSorter,...e.relay}))),this.fetchService=this.configureComponent(new tj(this.components,{...e.fetch})),this.pingService=this.configureComponent(new sj(this.components,{...e.ping}));const s=this.configureComponent(new Uj(this.components,{enabled:!1!==e.connectionManager.autoDial,minConnections:e.connectionManager.minConnections,dialTimeout:e.connectionManager.dialTimeout??3e4}));this.addEventListener("peer:discovery",o=>{!this.isStarted()||s.handle(o)});for(const o of e.peerDiscovery??[])this.configureComponent(o),o.addEventListener("peer",a=>{this.onDiscoveryPeer(a)})}configureComponent(e){return Lo(e)&&this.services.push(e),hi(e)&&this.initializables.push(e),e}start(){var e=this;return V(function*(){if(!e.started){e.started=!0,$o("libp2p is starting");try{e.initializables.forEach(t=>{t.init(e.components)}),yield Promise.all(e.services.map(function(){var t=V(function*(r){null!=r.beforeStart&&(yield r.beforeStart())});return function(r){return t.apply(this,arguments)}}())),yield Promise.all(e.services.map(t=>t.start())),yield Promise.all(e.services.map(function(){var t=V(function*(r){null!=r.afterStart&&(yield r.afterStart())});return function(r){return t.apply(this,arguments)}}())),$o("libp2p has started")}catch(t){throw $o.error("An error occurred starting libp2p",t),yield e.stop(),t}}})()}stop(){var e=this;return V(function*(){!e.started||($o("libp2p is stopping"),e.started=!1,yield Promise.all(e.services.map(function(){var t=V(function*(r){null!=r.beforeStop&&(yield r.beforeStop())});return function(r){return t.apply(this,arguments)}}())),yield Promise.all(e.services.map(t=>t.stop())),yield Promise.all(e.services.map(function(){var t=V(function*(r){null!=r.afterStop&&(yield r.afterStop())});return function(r){return t.apply(this,arguments)}}())),$o("libp2p has stopped"))})()}isStarted(){return this.started}getConnections(e){return this.components.getConnectionManager().getConnections(e)}getPeers(){const e=new B7;for(const t of this.components.getConnectionManager().getConnections())e.add(t.remotePeer);return Array.from(e)}dial(e,t={}){var r=this;return V(function*(){const{id:i,multiaddrs:s}=_f(e);return yield r.components.getPeerStore().addressBook.add(i,s),yield r.components.getConnectionManager().openConnection(i,t)})()}dialProtocol(e,t,r={}){var i=this;return V(function*(){if(null==t)throw se(new Error("no protocols were provided to open a stream"),Ie.ERR_INVALID_PROTOCOLS_FOR_STREAM);if(0===(t=Array.isArray(t)?t:[t]).length)throw se(new Error("no protocols were provided to open a stream"),Ie.ERR_INVALID_PROTOCOLS_FOR_STREAM);return yield(yield i.dial(e,r)).newStream(t,r)})()}getMultiaddrs(){return this.components.getAddressManager().getAddresses()}hangUp(e){var t=this;return V(function*(){const{id:r}=_f(e);yield t.components.getConnectionManager().closeConnections(r)})()}getPublicKey(e,t={}){var r=this;return V(function*(){if($o("getPublicKey %p",e),null!=e.publicKey)return e.publicKey;const i=yield r.peerStore.get(e);if(null!=i.pubKey)return i.pubKey;if(null==r.dht)throw se(new Error("Public key was not in the peer store and the DHT is not enabled"),Ie.ERR_NO_ROUTERS_AVAILABLE);const s=or([_t("/pk/"),e.multihash.digest]);var c,o=!1,a=!1;try{for(var T,m=Tt(r.dht.get(s,t));o=!(T=yield m.next()).done;o=!1){const R=T.value;if("VALUE"===R.name){const k=Tu(R.value);return yield r.peerStore.keyBook.set(e,R.value),k.bytes}}}catch(R){a=!0,c=R}finally{try{o&&null!=m.return&&(yield m.return())}finally{if(a)throw c}}throw se(new Error(`Node not responding with its public key: ${e.toString()}`),Ie.ERR_INVALID_RECORD)})()}fetch(e,t,r={}){var i=this;return V(function*(){const{id:s,multiaddrs:o}=_f(e);return null!=o&&(yield i.components.getPeerStore().addressBook.add(s,o)),yield i.fetchService.fetch(s,t,r)})()}ping(e,t={}){var r=this;return V(function*(){const{id:i,multiaddrs:s}=_f(e);return s.length>0&&(yield r.components.getPeerStore().addressBook.add(i,s)),yield r.pingService.ping(i,t)})()}handle(e,t,r){var i=this;return V(function*(){Array.isArray(e)||(e=[e]),yield Promise.all(e.map(function(){var s=V(function*(o){yield i.components.getRegistrar().handle(o,t,r)});return function(o){return s.apply(this,arguments)}}()))})()}unhandle(e){var t=this;return V(function*(){Array.isArray(e)||(e=[e]),yield Promise.all(e.map(function(){var r=V(function*(i){yield t.components.getRegistrar().unhandle(i)});return function(i){return r.apply(this,arguments)}}()))})()}onDiscoveryPeer(e){const{detail:t}=e;t.id.toString()!==this.peerId.toString()?(t.multiaddrs.length>0&&this.components.getPeerStore().addressBook.add(t.id,t.multiaddrs).catch(r=>$o.error(r)),t.protocols.length>0&&this.components.getPeerStore().protoBook.set(t.id,t.protocols).catch(r=>$o.error(r)),this.dispatchEvent(new rn("peer:discovery",{detail:t}))):$o.error(new Error(Ie.ERR_DISCOVERED_SELF))}}function e$(n){return dw.apply(this,arguments)}function dw(){return dw=V(function*(n){return null==n.peerId&&(n.peerId=yield Qj()),new Jj(qj(n))}),dw.apply(this,arguments)}function t$(n){return hw.apply(this,arguments)}function hw(){return hw=V(function*(n){return yield e$(n)}),hw.apply(this,arguments)}function sR(n,e){return n.length<=e||n.length<=1?n:function r$(n){if(n.length<=1)return n;for(let t=0;t{class n extends ki{constructor(t,r){super(),this.interval=r?.interval??n.DefaultInterval;const i=r?.maxPeers??t?.length,s=t.map(o=>"string"==typeof o?new vn(o):o);this.peers=function n$(n){return n.map(e=>{const t=e.getPeerId();return{id:t?_r(t):null,multiaddrs:[e.decapsulateCode(421)],protocols:[]}}).filter(e=>null!==e.id)}(sR(s,i)),oR("Use provided list of peers (reduced to maxPeers)",this.peers.map(o=>o.toString()))}start(){this._startTimer()}_startTimer(){if(this.peers){if(oR("Starting to emit static peers."),null!=this.timer)return;this.timer=setInterval(()=>this._returnPeers(),this.interval),this._returnPeers()}}_returnPeers(){null!=this.timer&&this.peers.forEach(t=>{this.dispatchEvent(new rn("peer",{detail:t}))})}stop(){null!=this.timer&&clearInterval(this.timer),this.timer=void 0}get[fw](){return!0}get[Symbol.toStringTag](){return"@waku/peer-discovery-static-list"}}return n.DefaultInterval=200,n})();var Uu=(()=>(function(n){n.Prod="prod",n.Test="test"}(Uu||(Uu={})),Uu))();const pw_fleets={"wakuv2.prod":{"waku-websocket":{"node-01.ac-cn-hongkong-c.wakuv2.prod":"/dns4/node-01.ac-cn-hongkong-c.wakuv2.prod.statusim.net/tcp/443/wss/p2p/16Uiu2HAm4v86W3bmT1BiH6oSPzcsSr24iDQpSN5Qa992BCjjwgrD","node-01.do-ams3.wakuv2.prod":"/dns4/node-01.do-ams3.wakuv2.prod.statusim.net/tcp/443/wss/p2p/16Uiu2HAmL5okWopX7NqZWBUKVqW8iUxCEmd5GMHLVPwCgzYzQv3e","node-01.gc-us-central1-a.wakuv2.prod":"/dns4/node-01.gc-us-central1-a.wakuv2.prod.statusim.net/tcp/443/wss/p2p/16Uiu2HAmVkKntsECaYfefR1V2yCR79CegLATuTPE6B9TxgxBiiiA"}},"wakuv2.test":{"waku-websocket":{"node-01.ac-cn-hongkong-c.wakuv2.test":"/dns4/node-01.ac-cn-hongkong-c.wakuv2.test.statusim.net/tcp/443/wss/p2p/16Uiu2HAkvWiyFsgRhuJEb9JfjYxEkoHLgnUQmr1N5mKWnYjxYRVm","node-01.do-ams3.wakuv2.test":"/dns4/node-01.do-ams3.wakuv2.test.statusim.net/tcp/443/wss/p2p/16Uiu2HAmPLe7Mzm8TsYUubgCAW1aJoeFScxrLj8ppHFivPo97bUZ","node-01.gc-us-central1-a.wakuv2.test":"/dns4/node-01.gc-us-central1-a.wakuv2.test.statusim.net/tcp/443/wss/p2p/16Uiu2HAmJb2e28qLXxT5kZxVUUoJt72EMzNGXB47Rxx5hw3q4YjS"}}},aR=Symbol.for("@achingbrain/uint8arraylist");function cR(n,e,t){if(null==e||e<0||e>=t)throw new RangeError("index is out of bounds");let r=0;for(const i of n){const s=r+i.byteLength;if(e0;){if(!(e>=this.bufs[0].byteLength)){this.bufs[0]=this.bufs[0].subarray(e),this.length-=e;break}e-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift()}}slice(e,t){const{bufs:r,length:i}=this._subList(e,t);return or(r,i)}subarray(e,t){const{bufs:r}=this._subList(e,t),i=new Vr;return i.appendAll(r),i}_subList(e,t){if(null==e&&null==t)return{bufs:this.bufs,length:this.length};if((e=e??0)<0&&(e=this.length+e),(t=t??(this.length>0?this.length:0))<0&&(t=this.length+t),e<0||t>this.length)throw new RangeError("index out of bounds");if(e===t)return{bufs:[],length:0};const r=[];let i=0;for(const s of this.bufs){const o=i,a=o+s.byteLength,m=t>o&&t<=a;let R,k;if(i=a,e>=o&&e=a&&(R=0,k=s.byteLength),null!=R&&null!=k&&r.push(s.subarray(R,k)),m)break}return{bufs:r,length:t-e}}getInt8(e){const t=this.slice(e,e+1);return new DataView(t.buffer,t.byteOffset,t.byteLength).getInt8(0)}setInt8(e,t){const r=new Uint8Array(1);new DataView(r.buffer,r.byteOffset,r.byteLength).setInt8(0,t),this.write(r,e)}getInt16(e,t){const r=this.slice(e,e+2);return new DataView(r.buffer,r.byteOffset,r.byteLength).getInt16(0,t)}setInt16(e,t,r){const i=new Uint8Array(2);new DataView(i.buffer,i.byteOffset,i.byteLength).setInt16(0,t,r),this.write(i,e)}getInt32(e,t){const r=this.slice(e,e+4);return new DataView(r.buffer,r.byteOffset,r.byteLength).getInt32(0,t)}setInt32(e,t,r){const i=new Uint8Array(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setInt32(0,t,r),this.write(i,e)}getBigInt64(e,t){const r=this.slice(e,e+8);return new DataView(r.buffer,r.byteOffset,r.byteLength).getBigInt64(0,t)}setBigInt64(e,t,r){const i=new Uint8Array(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setBigInt64(0,t,r),this.write(i,e)}getUint8(e){const t=this.slice(e,e+1);return new DataView(t.buffer,t.byteOffset,t.byteLength).getUint8(0)}setUint8(e,t){const r=new Uint8Array(1);new DataView(r.buffer,r.byteOffset,r.byteLength).setUint8(0,t),this.write(r,e)}getUint16(e,t){const r=this.slice(e,e+2);return new DataView(r.buffer,r.byteOffset,r.byteLength).getUint16(0,t)}setUint16(e,t,r){const i=new Uint8Array(2);new DataView(i.buffer,i.byteOffset,i.byteLength).setUint16(0,t,r),this.write(i,e)}getUint32(e,t){const r=this.slice(e,e+4);return new DataView(r.buffer,r.byteOffset,r.byteLength).getUint32(0,t)}setUint32(e,t,r){const i=new Uint8Array(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setUint32(0,t,r),this.write(i,e)}getBigUint64(e,t){const r=this.slice(e,e+8);return new DataView(r.buffer,r.byteOffset,r.byteLength).getBigUint64(0,t)}setBigUint64(e,t,r){const i=new Uint8Array(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setBigUint64(0,t,r),this.write(i,e)}getFloat32(e,t){const r=this.slice(e,e+4);return new DataView(r.buffer,r.byteOffset,r.byteLength).getFloat32(0,t)}setFloat32(e,t,r){const i=new Uint8Array(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat32(0,t,r),this.write(i,e)}getFloat64(e,t){const r=this.slice(e,e+8);return new DataView(r.buffer,r.byteOffset,r.byteLength).getFloat64(0,t)}setFloat64(e,t,r){const i=new Uint8Array(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat64(0,t,r),this.write(i,e)}}const Lp=(n,e,t)=>{const r=Vn.encode(n,e,t);return Lp.bytes=Vn.encode.bytes,e??Uint8Array.from(r)};function Ff(n){n=n??{};const e=Math.max(n.poolSize??10240,n.minPoolSize??8),t=n.lengthEncoder??Lp;return function(){var i=un(function*(s){let o=new Uint8Array(e),a=0;var T,c=!1,m=!1;try{for(var k,R=Tt(s);c=!(k=yield ct(R.next())).done;c=!1){const U=k.value;t(U.length,o,a);const Q=o.slice(a,a+t.bytes);a+=t.bytes,o.length-a<8&&(o=new Uint8Array(e),a=0),yield or([Q,U.slice()],Q.length+U.length)}}catch(U){m=!0,T=U}finally{try{c&&null!=R.return&&(yield ct(R.return()))}finally{if(m)throw T}}});return function(o){return i.apply(this,arguments)}}()}Lp.bytes=0,Ff.single=(n,e)=>new Vr(((e=e??{}).lengthEncoder??Lp)(n.length),n.slice());const gw=n=>{const e=Vn.decode(n);return gw.bytes=Vn.decode.bytes,e};gw.bytes=0;const l$=new Vr,f$={readLength:(n,e,t,r)=>{const i=r?.lengthDecoder??gw,s=r?.maxLengthLength??8,o=r?.maxDataLength??4194304;let a;e.append(n);try{a=i(e.slice())}catch(c){if(e.length>s)throw se(new Error("message length too long"),"ERR_MSG_LENGTH_TOO_LONG");if(c instanceof RangeError)return{mode:"readLength",buffer:e,chunk:void 0,state:void 0,data:void 0};throw c}if(a>o)throw se(new Error("message data too long"),"ERR_MSG_DATA_TOO_LONG");return n=e.subarray(i.bytes),e=new Vr,null!=r?.onLength&&r.onLength(a),a<=0?{mode:"readLength",chunk:n,buffer:e,data:l$}:{mode:"readData",chunk:n,buffer:e,state:{dataLength:a},data:void 0}},readData:(n,e,t,r)=>{if(e.append(n),null==t)throw new Error("state is required");if(e.lengthi?e.subarray(i):void 0,buffer:e=new Vr,state:void 0,data:s}}};function Vu(n){return function(){var t=un(function*(r){let o,i=new Vr,s="readLength";var m,a=!1,c=!1;try{for(var R,T=Tt(r);a=!(R=yield ct(T.next())).done;a=!1){let U=new Vr(R.value);for(;null!=U;){const Q=f$[s](U,i,o,n);if(s=Q.mode,U=Q.chunk,i=Q.buffer,o=Q.state,null!=Q.data){const X=Q.data.slice();null!=n?.onData&&n.onData(X),yield X}}}}catch(k){c=!0,m=k}finally{try{a&&null!=T.return&&(yield ct(T.return()))}finally{if(c)throw m}}if(i.length>0)throw se(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")});return function(i){return t.apply(this,arguments)}}()}Vu.fromReader=(n,e)=>{let t=1;const r=un(function*(){for(;;)try{const{done:s,value:o}=yield ct(n.next(t));if(!0===s)return;null!=o&&(yield o)}catch(s){if("ERR_UNDER_READ"===s.code)return{done:!0,value:null};throw s}finally{t=1}})();return Vu({...e??{},onLength:s=>{t=s}})(r)};const kp="/waku/2/default-waku/proto";var lc=(()=>(function(n){n.V2Beta3="/vac/waku/store/2.0.0-beta3",n.V2Beta4="/vac/waku/store/2.0.0-beta4"}(lc||(lc={})),lc))();function yw(n){return mw.apply(this,arguments)}function mw(){return mw=V(function*(n){if(0!==n.length)return n[Math.round(Math.random()*(n.length-1))]}),mw.apply(this,arguments)}function vw(n,e){return Ew.apply(this,arguments)}function Ew(){return Ew=V(function*(n,e){const t=[];return yield n.peerStore.forEach(r=>{for(let i=0;is+o.length,0),r=new Uint8Array(t);let i=0;for(const s of n)r.set(s,i),i+=s.length;return r}function Hu(n){return n instanceof Uint8Array?{get:e=>n[e],set(e,t){n[e]=t}}:{get:e=>n.get(e),set(e,t){n.set(e,t)}}}const fR=4294967296;class Fi{constructor(e=0,t=0){this.hi=e,this.lo=t}toBigInt(e){if(e)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31!=0){const t=1+~this.lo>>>0;let r=~this.hi>>>0;return 0===t&&(r=r+1>>>0),-(BigInt(t)+(BigInt(r)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}zzDecode(){const e=-(1&this.lo);return new Fi((this.hi>>>1^e)>>>0,((this.lo>>>1|this.hi<<31)^e)>>>0)}zzEncode(){const e=this.hi>>31;return new Fi(((this.hi<<1|this.lo>>>31)^e)>>>0,(this.lo<<1^e)>>>0)}toBytes(e,t=0){const r=Hu(e);for(;this.hi>0;)r.set(t++,127&this.lo|128),this.lo=(this.lo>>>7|this.hi<<25)>>>0,this.hi>>>=7;for(;this.lo>127;)r.set(t++,127&this.lo|128),this.lo=this.lo>>>7;r.set(t++,this.lo)}static fromBigInt(e){if(0n===e)return new Fi;const t=e<0;t&&(e=-e);let r=0|Number(e>>32n),i=0|Number(e-(BigInt(r)<<32n));return t&&(r=~r>>>0,i=~i>>>0,++i>fR&&(i=0,++r>fR&&(r=0))),new Fi(r,i)}static fromNumber(e){if(0===e)return new Fi;const t=e<0;t&&(e=-e);let r=e>>>0,i=(e-r)/4294967296>>>0;return t&&(i=~i>>>0,r=~r>>>0,++r>4294967295&&(r=0,++i>4294967295&&(i=0))),new Fi(i,r)}static fromBytes(e,t){const r=Hu(e),i=new Fi;let s=0;if(!(e.length-t>4)){for(;s<3;++s){if(t>=e.length)throw RangeError(`index out of range: ${t} > ${e.length}`);if(i.lo=(i.lo|(127&r.get(t))<<7*s)>>>0,r.get(t++)<128)return i}return i.lo=(i.lo|(127&r.get(t++))<<7*s)>>>0,i}for(;s<4;++s)if(i.lo=(i.lo|(127&r.get(t))<<7*s)>>>0,r.get(t++)<128)return i;if(i.lo=(i.lo|(127&r.get(t))<<28)>>>0,i.hi=(i.hi|(127&r.get(t))>>4)>>>0,r.get(t++)<128)return i;if(s=0,e.length-t>4){for(;s<5;++s)if(i.hi=(i.hi|(127&r.get(t))<<7*s+3)>>>0,r.get(t++)<128)return i}else for(;s<5;++s){if(t>=e.length)throw RangeError(`index out of range: ${t} > ${e.length}`);if(i.hi=(i.hi|(127&r.get(t))<<7*s+3)>>>0,r.get(t++)<128)return i}throw Error("invalid varint encoding")}}const v$=Math.pow(2,31),E$=Math.pow(2,7),w$=Math.pow(2,14),b$=Math.pow(2,21),_$=Math.pow(2,28),D$=Math.pow(2,35),S$=Math.pow(2,42),I$=Math.pow(2,49),C$=Math.pow(2,56),T$=Math.pow(2,63),Yt={encodingLength:n=>n=v$;)r.set(t++,255&n|128),n/=128;for(;(-128&n)>0;)r.set(t++,255&n|128),n>>>=7;r.set(t,0|n)},decode(n,e=0){const t=Hu(n);let r=4294967295;if(r=(127&t.get(e))>>>0,t.get(e++)<128||(r=(r|(127&t.get(e))<<7)>>>0,t.get(e++)<128)||(r=(r|(127&t.get(e))<<14)>>>0,t.get(e++)<128)||(r=(r|(127&t.get(e))<<21)>>>0,t.get(e++)<128)||(r=(r|(15&t.get(e))<<28)>>>0,t.get(e++)<128))return r;if((e+=5)>n.length)throw RangeError(`index out of range: ${e} > ${n.length}`);return r}},ww={encodingLength:n=>n<0?10:Yt.encodingLength(n),encode(n,e){if(n<0){let t=0;const r=Hu(e),i=Fi.fromNumber(n);for(;i.hi>0;)r.set(t++,127&i.lo|128),i.lo=(i.lo>>>7|i.hi<<25)>>>0,i.hi>>>=7;for(;i.lo>127;)r.set(t++,127&i.lo|128),i.lo=i.lo>>>7;r.set(t++,i.lo)}else Yt.encode(n,e)},decode:(n,e=0)=>0|Yt.decode(n,e)},bw={encodingLength:n=>Yt.encodingLength(n=(n<<1^n>>31)>>>0),encode:(n,e,t=0)=>Yt.encode(n=(n<<1^n>>31)>>>0,e),decode(n,e=0){const t=Yt.decode(n,e);return t>>>1^-(1&t)|0}};function ar(n,e){const t=new Uint8Array(Yt.encodingLength(n.length));return Yt.encode(n.length,t),e.decode(new Vr(t,n),0)}function cr(n,e){const t=e.encode(n),r=Yt.encodingLength(Yt.decode(t));return t.slice(r)}var Xn=(()=>(function(n){n[n.VARINT=0]="VARINT",n[n.BIT64=1]="BIT64",n[n.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",n[n.START_GROUP=3]="START_GROUP",n[n.END_GROUP=4]="END_GROUP",n[n.BIT32=5]="BIT32"}(Xn||(Xn={})),Xn))();function ei(n,e,t,r,i){return{name:n,type:e,encode:t,decode:r,encodingLength:i}}const hR=ei("bool",Xn.VARINT,function(e){return Uint8Array.from([e?1:0])},function(e,t){return e.get(t)>0},function(){return 1}),fc=ei("bytes",Xn.LENGTH_DELIMITED,function(e){const t=new Uint8Array(Yt.encodingLength(e.byteLength));return Yt.encode(e.byteLength,t),new Vr(t,e)},function(e,t){const r=Yt.decode(e,t);return t+=Yt.encodingLength(r),e.slice(t,t+r)},function(e){const t=e.byteLength;return Yt.encodingLength(t)+t}),Go=ei("double",Xn.BIT64,function(e){const t=new Vr(new Uint8Array(8));return t.setFloat64(0,e,!0),t},function(e,t){return e.getFloat64(t,!0)},function(){return 8});function Bp(n){function e(s){if(null==n[s.toString()])throw new Error("Invalid enum value");return"number"==typeof s?s:n[s]}return ei("enum",Xn.VARINT,function(o){const a=e(o),c=new Uint8Array(Yt.encodingLength(a));return Yt.encode(a,c),c},function(o,a){const m=Yt.decode(o,a).toString();if(null==n[m])throw new Error("Invalid enum value");return n[m]},function(o){return Yt.encodingLength(e(o))})}const yR=(ei("fixed32",Xn.BIT32,function(e){const t=new Vr(new Uint8Array(4));return t.setInt32(0,e,!0),t},function(e,t){return e.getInt32(t,!0)},function(){return 4}),function(e){return 8}),mR=(ei("fixed64",Xn.BIT64,function(e){const t=new Vr(new Uint8Array(8));return t.setBigInt64(0,e,!0),t},function(e,t){return e.getBigInt64(t,!0)},yR),function(){return 4}),vR=(ei("float",Xn.BIT32,function(e){const t=new Vr(new Uint8Array(4));return t.setFloat32(0,e,!0),t},function(e,t){return e.getFloat32(t,!0)},mR),function(e){return ww.encodingLength(e)}),ER=(ei("int32",Xn.VARINT,function(e){const t=new Uint8Array(vR(e));return ww.encode(e,t),t},function(e,t){return ww.decode(e,t)},vR),0x7fn),dc={encodingLength(n){let e=0;for(;n>=0x80n;e++)n>>=7n;return e+1},encode(n,e){const t=Hu(e);let r=0;for(;ER>=7n;t.set(r,Number(n))},decode:(n,e=0)=>Fi.fromBytes(n,e).toBigInt(!0)},_w={encodingLength:n=>n<0n?10:dc.encodingLength(n),encode(n,e,t=0){if(!(n<0n))return dc.encode(n,e);Fi.fromBigInt(n).toBytes(e,t)},decode:(n,e=0)=>Fi.fromBytes(n,e).toBigInt(!1)},Dw={encodingLength:n=>dc.encodingLength(n>=0?2n*n:-2n*n-1n),encode(n,e,t=0){Fi.fromBigInt(n).zzEncode().toBytes(e,t)},decode:(n,e=0)=>Fi.fromBytes(n,e).zzDecode().toBigInt(!1)},wR=function(e){return _w.encodingLength(e)};function ur(n){return ei("message",Xn.LENGTH_DELIMITED,function(s){const o=new Vr;function a(m,T,R){if(null==m){if(!0===R.optional)return;throw new Error(`Non optional field "${R.name}" was ${null===m?"null":"undefined"}`)}const k=T<<3|R.codec.type,U=new Uint8Array(Yt.encodingLength(k));Yt.encode(k,U);const Q=R.codec.encode(m);o.append(U),o.append(Q)}for(const[m,T]of Object.entries(n)){const R=parseInt(m);if(!0===T.repeats){if(!Array.isArray(s[T.name]))throw new Error(`Repeating field "${T.name}" was not an array`);for(const k of s[T.name])a(k,R,T)}else a(s[T.name],R,T)}const c=new Uint8Array(Yt.encodingLength(o.length));return Yt.encode(o.length,c),new Vr(c,o)},function(s,o){const a=Yt.decode(s,o),c=(o+=Yt.encodingLength(a))+a,m={};for(;o>3];let Q=0;if(R===Xn.VARINT)if(null!=U){const X=U.codec.decode(s,o);Q=U.codec.encodingLength(X)}else{const X=Yt.decode(s,o);Q=Yt.encodingLength(X)}else if(R===Xn.BIT64)Q=8;else if(R===Xn.LENGTH_DELIMITED){const X=Yt.decode(s,o);Q=X+Yt.encodingLength(X)}else if(R===Xn.BIT32)Q=4;else{if(R===Xn.START_GROUP)throw new Error("Unsupported wire type START_GROUP");if(R===Xn.END_GROUP)throw new Error("Unsupported wire type END_GROUP")}if(null!=U){const X=U.codec.decode(s,o);!0===U.repeats?(null==m[U.name]&&(m[U.name]=[]),m[U.name].push(X)):m[U.name]=X}o+=Q}for(const T of Object.values(n))!0===T.repeats&&null==m[T.name]&&(m[T.name]=[]);return m},function(s){let o=0;for(const a of Object.values(n))o+=a.codec.encodingLength(s[a.name]);return Yt.encodingLength(o)+o})}ei("int64",Xn.VARINT,function(e){const t=new Uint8Array(wR(e));return _w.encode(e,t),t},function(e,t){return 0n|_w.decode(e,t)},wR);const _R=(ei("sfixed32",Xn.BIT32,function(e){const t=new Vr(new Uint8Array(4));return t.setInt32(0,e,!0),t},function(e,t){return e.getInt32(t,!0)},function(){return 4}),function(){return 8}),DR=(ei("sfixed64",Xn.BIT64,function(e){const t=new Vr(new Uint8Array(8));return t.setBigInt64(0,e,!0),t},function(e,t){return e.getBigInt64(t,!0)},_R),function(e){return bw.encodingLength(e)}),SR=(ei("sint32",Xn.VARINT,function(e){const t=new Uint8Array(DR(e));return bw.encode(e,t),t},function(e,t){return bw.decode(e,t)},DR),function(e){return Dw.encodingLength(e)}),zo=ei("sint64",Xn.VARINT,function(e){const t=new Uint8Array(SR(e));return Dw.encode(e,t),t},function(e,t){return Dw.decode(e,t)},SR),Gr=ei("string",Xn.LENGTH_DELIMITED,function(e){const t=_t(e),r=new Uint8Array(Yt.encodingLength(t.byteLength));return Yt.encode(t.length,r),new Vr(r,t)},function(e,t){const r=Yt.decode(e,t);return t+=Yt.encodingLength(r),Mt(e.slice(t,t+r))},function(e){const t=_t(e).byteLength;return Yt.encodingLength(t)+t}),IR=function(e){return Yt.encodingLength(e)},Uf=ei("uint32",Xn.VARINT,function(e){const t=new Uint8Array(IR(e));return Yt.encode(e,t),t},function(e,t){return Yt.decode(e,t)},IR),CR=ei("uint64",Xn.VARINT,function(e){const t=new Uint8Array(dc.encodingLength(e));return dc.encode(e,t),t},function(e,t){return dc.decode(e,t)},function(e){return dc.encodingLength(e)});var Vf=(()=>(function(n){n.codec=()=>ur({1:{name:"payload",codec:fc,optional:!0},2:{name:"contentTopic",codec:Gr,optional:!0},3:{name:"version",codec:Uf,optional:!0},4:{name:"timestampDeprecated",codec:Go,optional:!0},10:{name:"timestamp",codec:zo,optional:!0}}),n.encode=e=>cr(e,n.codec()),n.decode=e=>ar(e,n.codec())}(Vf||(Vf={})),Vf))(),cG=N(6577),uG=N(4237);const Ku_algorithm={name:"AES-GCM",length:128},Fp={node:cG,web:"object"==typeof self&&"crypto"in self?self.crypto:void 0};function ms(){if(Fp.web)return Fp.web.subtle;if(Fp.node)return Fp.node.webcrypto.subtle;throw new Error("The environment doesn't have Crypto Subtle API (if in the browser, be sure to use to be in a secure context, ie, https)")}const ju=er.randomBytes,Sw=er.sha256;function lG(n,e){return Iw.apply(this,arguments)}function Iw(){return Iw=V(function*(n,e){const[t,r]=yield z2(n,e,{recovered:!0,der:!1});return Ji([t,new Uint8Array([r])],t.length+1)}),Iw.apply(this,arguments)}function Cw(n){return new Uint8Array(uG.keccak256.arrayBuffer(n))}function TR(n,e){let t=1,r=0,i=Promise.resolve(new Uint8Array);for(;r>24,t>>16,t>>8,t]),o=Ji([s,n],s.length+n.length),a=Sw(o);i=i.then(c=>a.then(m=>{const T=new Uint8Array(m);return Ji([c,T],c.length+T.length)})),r+=32,t+=1}return i}function fG(n,e,t){return ms().importKey("raw",e,"AES-CTR",!1,["encrypt"]).then(r=>ms().encrypt({name:"AES-CTR",counter:n,length:128},r,t)).then(r=>new Uint8Array(r))}function dG(n,e,t){return ms().importKey("raw",e,"AES-CTR",!1,["decrypt"]).then(r=>ms().decrypt({name:"AES-CTR",counter:n,length:128},r,t)).then(r=>new Uint8Array(r))}function hG(n,e){const t={name:"HMAC",hash:{name:"SHA-256"}};return ms().importKey("raw",n,t,!1,["sign"]).then(r=>ms().sign(t,r,e)).then(r=>new Uint8Array(r))}function pG(n,e,t){const r={name:"HMAC",hash:{name:"SHA-256"}};return ms().importKey("raw",n,r,!1,["verify"]).then(s=>ms().verify(r,s,t,e))}function AR(n,e){if(32!==n.length)throw new Error(`Bad private key, it should be 32 bytes but it's actually ${n.length} bytes long`);if(65!==e.length)throw new Error(`Bad public key, it should be 65 bytes but it's actually ${e.length} bytes long`);if(4!==e[0])throw new Error("Bad public key, a valid public key would begin with 4");{const t=function MU(n,e,t=!1){if(H2(n))throw new TypeError("getSharedSecret: first arg must be private key");if(!H2(e))throw new TypeError("getSharedSecret: second arg must be public key");const r=Bm(e);return r.assertValidity(),r.multiply(io(n)).toRawBytes(t)}(n,e,!0);return new Uint8Array(Gs(t).slice(1))}}function gG(n,e){return Tw.apply(this,arguments)}function Tw(){return Tw=V(function*(n,e){const t=ju(32),r=yield AR(t,n),i=yield TR(r,32),s=ju(16),o=i.slice(0,16),a=yield fG(s,o,e),c=Ji([s,a],s.length+a.length),m=yield Sw(i.slice(16)),T=yield hG(m,c),R=rf(t,!1);return Ji([R,c,T],R.length+c.length+T.length)}),Tw.apply(this,arguments)}function yG(n,e){return xw.apply(this,arguments)}function xw(){return xw=V(function*(n,e){if(e.length<=113)throw new Error("Invalid Ciphertext. Data is too small. It should ba at least 113 bytes");if(4!==e[0])throw new Error(`Not a valid ciphertext. It should begin with 4 but actually begin with ${e[0]}`);{const t=e.slice(0,65),r=e.length-113,i=e.slice(65,81),s=e.slice(65,81+r),o=s.slice(16),a=e.slice(81+r),c=AR(n,t),m=yield TR(c,32),[T,R]=yield Sw(m.slice(16)).then(k=>[m.slice(0,16),k]);if(!(yield pG(R,s,a)))throw new Error("Incorrect MAC");return dG(i,T,o)}}),xw.apply(this,arguments)}function mG(n,e,t){return Rw.apply(this,arguments)}function Rw(){return Rw=V(function*(n,e,t){return ms().importKey("raw",e,Ku_algorithm,!1,["encrypt"]).then(r=>ms().encrypt({iv:n,...Ku_algorithm},r,t)).then(r=>new Uint8Array(r))}),Rw.apply(this,arguments)}function vG(n,e,t){return Pw.apply(this,arguments)}function Pw(){return Pw=V(function*(n,e,t){return ms().importKey("raw",e,Ku_algorithm,!1,["decrypt"]).then(r=>ms().decrypt({iv:n,...Ku_algorithm},r,t)).then(r=>new Uint8Array(r))}),Pw.apply(this,arguments)}function EG(){return ju(12)}function RR(n,e){return Ow.apply(this,arguments)}function Ow(){return Ow=V(function*(n,e){let t=new Uint8Array([0]);t=AG(t,n),t=Ji([t,n]);let r=1+MR(n)+n.length;e&&(r+=65);const s=256-r%256,o=ju(s);if(!xG(o,s))throw new Error("failed to generate random padding of size "+s);let a;if(t=Ji([t,o]),e){t[0]|=4;const c=Cw(t),m=yield lG(c,e);t=Ji([t,m]),a={signature:m,publicKey:rf(e,!1)}}return{payload:t,sig:a}}),Ow.apply(this,arguments)}function Lw(){return Lw=V(function*(n,e){return gG(Gs(e),n)}),Lw.apply(this,arguments)}function PR(n,e){return kw.apply(this,arguments)}function kw(){return kw=V(function*(n,e){return yG(e,n)}),kw.apply(this,arguments)}function Bw(){return Bw=V(function*(n,e){const t=EG();return Ji([yield mG(t,Gs(e),n),t])}),Bw.apply(this,arguments)}function NR(n,e){return Fw.apply(this,arguments)}function Fw(){return Fw=V(function*(n,e){const t=n.length-12,r=n.slice(0,t);return vG(n.slice(t),Gs(e),r)}),Fw.apply(this,arguments)}function AG(n,e){const t=MR(e);let r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,e.length,!0),r=r.slice(0,t),(n=Ji([n,r]))[0]|=t,n}function MR(n){let e=1;for(let t=n.length;t>=256;t/=256)e++;return e}function xG(n,e){return n.length===e&&(e<=3||-1!==n.findIndex(t=>0!==t))}const Pa=Ur("waku:message"),OR=BigInt(1e6);var Hf=(()=>(function(n){n.Asymmetric="asymmetric",n.Symmetric="symmetric"}(Hf||(Hf={})),Hf))();class uo{constructor(e,t,r){this.proto=e,this._signaturePublicKey=t,this._signature=r}static fromUtf8String(e,t,r){return V(function*(){const i=(n=>_t(n,"utf8"))(e);return uo.fromBytes(i,t,r)})()}static fromBytes(e,t,r){return V(function*(){const{timestamp:i,encPublicKey:s,symKey:o,sigPrivKey:a}=Object.assign({timestamp:new Date},r||{});let T,c=e,m=0;if(s&&o)throw"Pass either `encPublicKey` or `symKey`, not both.";if(s){const R=yield RR(c,a);c=yield function CG(n,e){return Lw.apply(this,arguments)}(R.payload,s),T=R.sig,m=1}else if(o){const R=yield RR(c,a);c=yield function TG(n,e){return Bw.apply(this,arguments)}(R.payload,o),T=R.sig,m=1}return new uo({payload:c,timestampDeprecated:i.valueOf()/1e3,timestamp:BigInt(i.valueOf())*OR,version:m,contentTopic:t},T?.publicKey,T?.signature)})()}static decode(e,t){return V(function*(){const r=Vf.decode(e);return uo.decodeProto(r,t)})()}static decodeProto(e,t){return V(function*(){const r=e.payload;let i,s;if(1===e.version&&r){if(void 0===t)return void Pa("Payload is encrypted but no private keys have been provided.");const o=yield Promise.all(t.map(function(){var R=V(function*({key:k,method:U,contentTopics:Q}){if(!Q||e.contentTopic&&Q.includes(e.contentTopic))switch(U){case Hf.Asymmetric:try{return yield PR(r,k)}catch(X){return void Pa("Failed to decrypt message using asymmetric encryption despite decryption method being specified",X)}case Hf.Symmetric:try{return yield NR(r,k)}catch(X){return void Pa("Failed to decrypt message using asymmetric encryption despite decryption method being specified",X)}default:try{return yield NR(r,k)}catch(X){Pa("Failed to decrypt message using symmetric encryption",X);try{return yield PR(r,k)}catch(ae){return void Pa("Failed to decrypt message using asymmetric encryption",ae)}}}});return function(k){return R.apply(this,arguments)}}())),c=o.filter(R=>!!R);if(0===c.length)return void Pa("Failed to decrypt payload.");const m=c[0],T=yield function _G(n){const e=function DG(n){return 3&new DataView(n.buffer).getUint8(0)}(n);if(0===e)return;const t=function SG(n,e){let t=n.slice(1,1+e);return e<4&&(t=Ji([t,new Uint8Array(4-e)],4)),new DataView(t.buffer).getInt32(0,!0)}(n,e),r=1+e,i=n.slice(r,r+t),s=function IG(n){return 4==(4&new DataView(n.buffer).getUint8(0))}(n);let o;if(s){const a=function RG(n){return n.slice(n.length-65,n.length)}(n),c=function PG(n,e){return Cw(e?n.slice(0,n.length-65):n)}(n,s),m=function NG(n,e){const r=new DataView(e.slice(64).buffer).getUint8(0);return function NU(n,e,t,r=!1){return dn.fromSignature(n,e,t).toRawBytes(r)}(n,Po.fromCompact(e.slice(0,64)),r,!1)}(c,a);o={signature:a,publicKey:m}}return{payload:i,sig:o}}(m);if(!T)return void Pa("Failed to decode payload.");Object.assign(e,{payload:T.payload}),i=T.sig?.publicKey,s=T.sig?.signature}return new uo(e,i,s)})()}encode(){return Vf.encode(this.proto)}get payloadAsUtf8(){if(!this.payload)return"";try{return(n=>Mt(this.payload,"utf8"))()}catch(e){return Pa("Could not decode byte as UTF-8",e),""}}get payload(){if(this.proto.payload)return new Uint8Array(this.proto.payload)}get contentTopic(){return this.proto.contentTopic}get version(){return this.proto.version??0}get timestamp(){try{if(this.proto.timestamp)return new Date(Number(this.proto.timestamp/OR));if(this.proto.timestampDeprecated)return new Date(1e3*this.proto.timestampDeprecated)}catch{return}}get signaturePublicKey(){return this._signaturePublicKey}get signature(){return this._signature}}var Up,OG=new Uint8Array(16);function LG(){if(!Up&&!(Up=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Up(OG)}const kG=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,FG=function BG(n){return"string"==typeof n&&kG.test(n)};for(var ti=[],Uw=0;Uw<256;++Uw)ti.push((Uw+256).toString(16).substr(1));const Vp=function HG(n,e,t){var r=(n=n||{}).random||(n.rng||LG)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){t=t||0;for(var i=0;i<16;++i)e[t+i]=r[i];return e}return function UG(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=(ti[n[e+0]]+ti[n[e+1]]+ti[n[e+2]]+ti[n[e+3]]+"-"+ti[n[e+4]]+ti[n[e+5]]+"-"+ti[n[e+6]]+ti[n[e+7]]+"-"+ti[n[e+8]]+ti[n[e+9]]+"-"+ti[n[e+10]]+ti[n[e+11]]+ti[n[e+12]]+ti[n[e+13]]+ti[n[e+14]]+ti[n[e+15]]).toLowerCase();if(!FG(t))throw TypeError("Stringified UUID is invalid");return t}(r)};var Vw;!function(n){let e;var t;(t=e=n.ContentFilter||(n.ContentFilter={})).codec=()=>ur({1:{name:"contentTopic",codec:Gr,optional:!0}}),t.encode=r=>cr(r,t.codec()),t.decode=r=>ar(r,t.codec()),n.codec=()=>ur({1:{name:"subscribe",codec:hR,optional:!0},2:{name:"topic",codec:Gr,optional:!0},3:{name:"contentFilters",codec:n.ContentFilter.codec(),repeats:!0}}),n.encode=t=>cr(t,n.codec()),n.decode=t=>ar(t,n.codec())}(Vw||(Vw={}));var Hp=(()=>(function(n){n.codec=()=>ur({1:{name:"messages",codec:Kp.codec(),repeats:!0}}),n.encode=e=>cr(e,n.codec()),n.decode=e=>ar(e,n.codec())}(Hp||(Hp={})),Hp))(),Kf=(()=>(function(n){n.codec=()=>ur({1:{name:"requestId",codec:Gr,optional:!0},2:{name:"request",codec:Vw.codec(),optional:!0},3:{name:"push",codec:Hp.codec(),optional:!0}}),n.encode=e=>cr(e,n.codec()),n.decode=e=>ar(e,n.codec())}(Kf||(Kf={})),Kf))(),Kp=(()=>(function(n){n.codec=()=>ur({1:{name:"payload",codec:fc,optional:!0},2:{name:"contentTopic",codec:Gr,optional:!0},3:{name:"version",codec:Uf,optional:!0},4:{name:"timestampDeprecated",codec:Go,optional:!0},10:{name:"timestamp",codec:zo,optional:!0}}),n.encode=e=>cr(e,n.codec()),n.decode=e=>ar(e,n.codec())}(Kp||(Kp={})),Kp))();class $u{constructor(e){this.proto=e}static createRequest(e,t,r,i=!0){return new $u({requestId:r||Vp(),request:{subscribe:i,topic:e,contentFilters:t},push:void 0})}static decode(e){const t=Kf.decode(e);return new $u(t)}encode(){return Kf.encode(this.proto)}get push(){return this.proto.push}get requestId(){return this.proto.requestId}}const jf="/vac/waku/filter/2.0.0-beta1",lo=Ur("waku:filter");class KG{constructor(e,t){this.libp2p=e,this.subscriptions=new Map,this.decryptionKeys=new Map,this.pubSubTopic=t?.pubSubTopic??kp,this.libp2p.handle(jf,this.onRequest.bind(this)).catch(r=>lo("Failed to register filter protocol",r))}subscribe(e,t,r){var i=this;return V(function*(){const s=r?.pubsubTopic??i.pubSubTopic,o=t.map(R=>({contentTopic:R})),a=$u.createRequest(s,o,void 0,!0),c=a.requestId;if(!c)throw new Error("Internal error: createRequest expected to set `requestId`");const m=yield i.getPeer(r?.peerId),T=yield i.newStream(m);try{const R=yield Ln([a.encode()],Ff(),T,Vu(),function(){var k=V(function*(U){return yield Ea(U)});return function(U){return k.apply(this,arguments)}}());lo("response",R)}catch(R){throw lo("Error subscribing to peer ",m.id.toString(),"for content topics",t,": ",R),R}return i.addCallback(c,e),V(function*(){yield i.unsubscribe(s,o,c,m),i.removeCallback(c)})})()}onRequest(e){var t=this;lo("Receiving message push");try{Ln(e.stream,Vu(),function(){var r=V(function*(i){var a,s=!1,o=!1;try{for(var m,c=Tt(i);s=!(m=yield c.next()).done;s=!1){const R=$u.decode(m.value.slice());R.requestId&&R.push?.messages?.length&&(yield t.pushMessages(R.requestId,R.push.messages))}}catch(T){o=!0,a=T}finally{try{s&&null!=c.return&&(yield c.return())}finally{if(o)throw a}}});return function(i){return r.apply(this,arguments)}}()).then(()=>{lo("Receiving pipe closed.")},r=>{lo("Error with receiving pipe",r)})}catch(r){lo("Error decoding message",r)}}pushMessages(e,t){var r=this;return V(function*(){const i=r.subscriptions.get(e);if(!i)return void lo(`No callback registered for request ID ${e}`);const s=Array.from(r.decryptionKeys).map(([o,{method:a,contentTopics:c}])=>({key:o,method:a,contentTopics:c}));for(const o of t){const a=yield uo.decodeProto(o,s);a?i(a):lo("Not able to decode message")}})()}addCallback(e,t){this.subscriptions.set(e,t)}removeCallback(e){this.subscriptions.delete(e)}unsubscribe(e,t,r,i){var s=this;return V(function*(){const o=$u.createRequest(e,t,r,!1),a=yield s.newStream(i);try{yield Ln([o.encode()],Ff(),a.sink)}catch(c){throw lo("Error unsubscribing",c),c}})()}newStream(e){var t=this;return V(function*(){const r=t.libp2p.connectionManager.getConnections(e.id);if(!r)throw new Error("Failed to get a connection to the peer");return r[0].newStream(jf)})()}getPeer(e){var t=this;return V(function*(){let r;if(e){if(r=yield t.libp2p.peerStore.get(e),!r)throw new Error(`Failed to retrieve connection details for provided peer in peer store: ${e.toString()}`)}else if(r=yield t.randomPeer(),!r)throw new Error("Failed to find known peer that registers waku filter protocol");return r})()}addDecryptionKey(e,t){this.decryptionKeys.set(Gs(e),t??{})}deleteDecryptionKey(e){this.decryptionKeys.delete(Gs(e))}peers(){var e=this;return V(function*(){return vw(e.libp2p,[jf])})()}randomPeer(){var e=this;return V(function*(){return yw(yield e.peers())})()}}var jp=(()=>(function(n){n.codec=()=>ur({1:{name:"pubSubTopic",codec:Gr,optional:!0},2:{name:"message",codec:Gp.codec(),optional:!0}}),n.encode=e=>cr(e,n.codec()),n.decode=e=>ar(e,n.codec())}(jp||(jp={})),jp))(),$p=(()=>(function(n){n.codec=()=>ur({1:{name:"isSuccess",codec:hR,optional:!0},2:{name:"info",codec:Gr,optional:!0}}),n.encode=e=>cr(e,n.codec()),n.decode=e=>ar(e,n.codec())}($p||($p={})),$p))(),$f=(()=>(function(n){n.codec=()=>ur({1:{name:"requestId",codec:Gr,optional:!0},2:{name:"request",codec:jp.codec(),optional:!0},3:{name:"response",codec:$p.codec(),optional:!0}}),n.encode=e=>cr(e,n.codec()),n.decode=e=>ar(e,n.codec())}($f||($f={})),$f))(),Gp=(()=>(function(n){n.codec=()=>ur({1:{name:"payload",codec:fc,optional:!0},2:{name:"contentTopic",codec:Gr,optional:!0},3:{name:"version",codec:Uf,optional:!0},4:{name:"timestampDeprecated",codec:Go,optional:!0},10:{name:"timestamp",codec:zo,optional:!0}}),n.encode=e=>cr(e,n.codec()),n.decode=e=>ar(e,n.codec())}(Gp||(Gp={})),Gp))();class Gf{constructor(e){this.proto=e}static createRequest(e,t){return new Gf({requestId:Vp(),request:{message:e.proto,pubSubTopic:t},response:void 0})}static decode(e){const t=$f.decode(e);return new Gf(t)}encode(){return $f.encode(this.proto)}get query(){return this.proto.request}get response(){return this.proto.response}}const zf="/vac/waku/lightpush/2.0.0-beta1";class jG{constructor(e,t){this.libp2p=e,this.pubSubTopic=t?.pubSubTopic??kp}push(e,t){var r=this;return V(function*(){let i;if(t?.peerId){if(i=yield r.libp2p.peerStore.get(t.peerId),!i)throw"Peer is unknown"}else i=yield r.randomPeer();if(!i)throw"No peer available";if(!i.protocols.includes(zf))throw"Peer does not register waku light push protocol";const s=r.libp2p.connectionManager.getConnections(i.id);if(!s)throw"Failed to get a connection to the peer";const o=yield s[0].newStream(zf);try{const c=Gf.createRequest(e,t?.pubSubTopic?t.pubSubTopic:r.pubSubTopic),m=yield Ln([c.encode()],Ff(),o,Vu(),function(){var T=V(function*(R){return yield Ea(R)});return function(R){return T.apply(this,arguments)}}());try{const T=Ji(m);return Gf.decode(T).response||(console.log("No response in PushRPC"),null)}catch(T){console.log("Failed to decode push reply",T)}}catch(a){console.log("Failed to send waku light push request",a)}return null})()}peers(){var e=this;return V(function*(){return vw(e.libp2p,[zf])})()}randomPeer(){var e=this;return V(function*(){return yw(yield e.peers())})()}}const Hw=["/vac/waku/relay/2.0.0-beta2","/vac/waku/relay/2.0.0"];var hc,zp=(()=>(function(n){n.codec=()=>ur({1:{name:"digest",codec:fc,optional:!0},2:{name:"receivedTime",codec:zo,optional:!0},3:{name:"senderTime",codec:zo,optional:!0},4:{name:"pubsubTopic",codec:Gr,optional:!0}}),n.encode=e=>cr(e,n.codec()),n.decode=e=>ar(e,n.codec())}(zp||(zp={})),zp))();!function(n){let e;var r;let t;(r=e=n.Direction||(n.Direction={})).DIRECTION_BACKWARD_UNSPECIFIED="DIRECTION_BACKWARD_UNSPECIFIED",r.DIRECTION_FORWARD="DIRECTION_FORWARD",function(r){r[r.DIRECTION_BACKWARD_UNSPECIFIED=0]="DIRECTION_BACKWARD_UNSPECIFIED",r[r.DIRECTION_FORWARD=1]="DIRECTION_FORWARD"}(t||(t={})),function(r){r.codec=()=>Bp(t)}(e=n.Direction||(n.Direction={})),n.codec=()=>ur({1:{name:"pageSize",codec:CR,optional:!0},2:{name:"cursor",codec:zp.codec(),optional:!0},3:{name:"direction",codec:n.Direction.codec(),optional:!0}}),n.encode=r=>cr(r,n.codec()),n.decode=r=>ar(r,n.codec())}(hc||(hc={}));var Qp,Wp=(()=>(function(n){n.codec=()=>ur({1:{name:"contentTopic",codec:Gr,optional:!0}}),n.encode=e=>cr(e,n.codec()),n.decode=e=>ar(e,n.codec())}(Wp||(Wp={})),Wp))(),qp=(()=>(function(n){n.codec=()=>ur({2:{name:"pubSubTopic",codec:Gr,optional:!0},3:{name:"contentFilters",codec:Wp.codec(),repeats:!0},4:{name:"pagingInfo",codec:hc.codec(),optional:!0},5:{name:"startTime",codec:zo,optional:!0},6:{name:"endTime",codec:zo,optional:!0}}),n.encode=e=>cr(e,n.codec()),n.decode=e=>ar(e,n.codec())}(qp||(qp={})),qp))();!function(n){let e;var r;let t;(r=e=n.Error||(n.Error={})).ERROR_NONE_UNSPECIFIED="ERROR_NONE_UNSPECIFIED",r.ERROR_INVALID_CURSOR="ERROR_INVALID_CURSOR",function(r){r[r.ERROR_NONE_UNSPECIFIED=0]="ERROR_NONE_UNSPECIFIED",r[r.ERROR_INVALID_CURSOR=1]="ERROR_INVALID_CURSOR"}(t||(t={})),function(r){r.codec=()=>Bp(t)}(e=n.Error||(n.Error={})),n.codec=()=>ur({2:{name:"messages",codec:Zp.codec(),repeats:!0},3:{name:"pagingInfo",codec:hc.codec(),optional:!0},4:{name:"error",codec:n.Error.codec(),optional:!0}}),n.encode=r=>cr(r,n.codec()),n.decode=r=>ar(r,n.codec())}(Qp||(Qp={}));var Jp,Yp=(()=>(function(n){n.codec=()=>ur({1:{name:"requestId",codec:Gr,optional:!0},2:{name:"query",codec:qp.codec(),optional:!0},3:{name:"response",codec:Qp.codec(),optional:!0}}),n.encode=e=>cr(e,n.codec()),n.decode=e=>ar(e,n.codec())}(Yp||(Yp={})),Yp))(),Zp=(()=>(function(n){n.codec=()=>ur({1:{name:"payload",codec:fc,optional:!0},2:{name:"contentTopic",codec:Gr,optional:!0},3:{name:"version",codec:Uf,optional:!0},4:{name:"timestampDeprecated",codec:Go,optional:!0},10:{name:"timestamp",codec:zo,optional:!0}}),n.encode=e=>cr(e,n.codec()),n.decode=e=>ar(e,n.codec())}(Zp||(Zp={})),Zp))(),Xp=(()=>(function(n){n.codec=()=>ur({1:{name:"digest",codec:fc,optional:!0},2:{name:"receivedTime",codec:Go,optional:!0},3:{name:"senderTime",codec:Go,optional:!0}}),n.encode=e=>cr(e,n.codec()),n.decode=e=>ar(e,n.codec())}(Xp||(Xp={})),Xp))();!function(n){let e;var r;let t;(r=e=n.Direction||(n.Direction={})).DIRECTION_BACKWARD_UNSPECIFIED="DIRECTION_BACKWARD_UNSPECIFIED",r.DIRECTION_FORWARD="DIRECTION_FORWARD",function(r){r[r.DIRECTION_BACKWARD_UNSPECIFIED=0]="DIRECTION_BACKWARD_UNSPECIFIED",r[r.DIRECTION_FORWARD=1]="DIRECTION_FORWARD"}(t||(t={})),function(r){r.codec=()=>Bp(t)}(e=n.Direction||(n.Direction={})),n.codec=()=>ur({1:{name:"pageSize",codec:CR,optional:!0},2:{name:"cursor",codec:Xp.codec(),optional:!0},3:{name:"direction",codec:n.Direction.codec(),optional:!0}}),n.encode=r=>cr(r,n.codec()),n.decode=r=>ar(r,n.codec())}(Jp||(Jp={}));var Kw,eg=(()=>(function(n){n.codec=()=>ur({1:{name:"contentTopic",codec:Gr,optional:!0}}),n.encode=e=>cr(e,n.codec()),n.decode=e=>ar(e,n.codec())}(eg||(eg={})),eg))(),tg=(()=>(function(n){n.codec=()=>ur({2:{name:"pubSubTopic",codec:Gr,optional:!0},3:{name:"contentFilters",codec:eg.codec(),repeats:!0},4:{name:"pagingInfo",codec:Jp.codec(),optional:!0},5:{name:"startTime",codec:Go,optional:!0},6:{name:"endTime",codec:Go,optional:!0}}),n.encode=e=>cr(e,n.codec()),n.decode=e=>ar(e,n.codec())}(tg||(tg={})),tg))();!function(n){let e;var r;let t;(r=e=n.Error||(n.Error={})).ERROR_NONE_UNSPECIFIED="ERROR_NONE_UNSPECIFIED",r.ERROR_INVALID_CURSOR="ERROR_INVALID_CURSOR",function(r){r[r.ERROR_NONE_UNSPECIFIED=0]="ERROR_NONE_UNSPECIFIED",r[r.ERROR_INVALID_CURSOR=1]="ERROR_INVALID_CURSOR"}(t||(t={})),function(r){r.codec=()=>Bp(t)}(e=n.Error||(n.Error={})),n.codec=()=>ur({2:{name:"messages",codec:rg.codec(),repeats:!0},3:{name:"pagingInfo",codec:Jp.codec(),optional:!0},4:{name:"error",codec:n.Error.codec(),optional:!0}}),n.encode=r=>cr(r,n.codec()),n.decode=r=>ar(r,n.codec())}(Kw||(Kw={}));var ng=(()=>(function(n){n.codec=()=>ur({1:{name:"requestId",codec:Gr,optional:!0},2:{name:"query",codec:tg.codec(),optional:!0},3:{name:"response",codec:Kw.codec(),optional:!0}}),n.encode=e=>cr(e,n.codec()),n.decode=e=>ar(e,n.codec())}(ng||(ng={})),ng))(),rg=(()=>(function(n){n.codec=()=>ur({1:{name:"payload",codec:fc,optional:!0},2:{name:"contentTopic",codec:Gr,optional:!0},3:{name:"version",codec:Uf,optional:!0},4:{name:"timestampDeprecated",codec:Go,optional:!0},10:{name:"timestamp",codec:zo,optional:!0}}),n.encode=e=>cr(e,n.codec()),n.decode=e=>ar(e,n.codec())}(rg||(rg={})),rg))(),Na=(()=>(function(n){n.V2Beta3="/vac/waku/store/2.0.0-beta3",n.V2Beta4="/vac/waku/store/2.0.0-beta4"}(Na||(Na={})),Na))();const LR=BigInt(1e6);var Gu=(()=>(function(n){n.BACKWARD="backward",n.FORWARD="forward"}(Gu||(Gu={})),Gu))();class Wf{constructor(e,t){switch(this.proto=e,this.storeCodec=t,t){case Na.V2Beta3:this.historyRpc=ng;break;case Na.V2Beta4:this.historyRpc=Yp;break;default:throw`Internal Error: Unexpected store codec value received in constructor: ${t}`}}get query(){return this.proto.query}get response(){return this.proto.response}static createQuery(e){const t=e.storeCodec??Na.V2Beta4,r=e.contentTopics.map(s=>({contentTopic:s})),i=function GG(n){switch(n){case Gu.BACKWARD:return hc.Direction.DIRECTION_BACKWARD_UNSPECIFIED;case Gu.FORWARD:return hc.Direction.DIRECTION_FORWARD;default:return hc.Direction.DIRECTION_BACKWARD_UNSPECIFIED}}(e.pageDirection);switch(t){case Na.V2Beta3:return(()=>{const s={pageSize:BigInt(e.pageSize),cursor:e.cursor,direction:i};let o,a;return e.startTime&&(o=e.startTime.valueOf()/1e3),e.endTime&&(a=e.endTime.valueOf()/1e3),new Wf({requestId:Vp(),query:{pubSubTopic:e.pubSubTopic,contentFilters:r,pagingInfo:s,startTime:o,endTime:a},response:void 0},t)})();case Na.V2Beta4:return(()=>{const s={pageSize:BigInt(e.pageSize),cursor:e.cursor,direction:i};let o,a;return e.startTime&&(o=BigInt(e.startTime.valueOf())*LR),e.endTime&&(a=BigInt(e.endTime.valueOf())*LR),new Wf({requestId:Vp(),query:{pubSubTopic:e.pubSubTopic,contentFilters:r,pagingInfo:s,startTime:o,endTime:a},response:void 0},t)})();default:throw`Internal Error: Unexpected store codec value received in createQuery: ${t}`}}decode(e){const t=this.historyRpc.decode(e);return new Wf(t,this.storeCodec)}encode(){return this.historyRpc.encode(this.proto)}}var zG=Qp.Error;const pc=Ur("waku:store");class qG{constructor(e,t){this.libp2p=e,this.pubSubTopic=t?.pubSubTopic??kp,this.decryptionKeys=new Map}queryHistory(e,t){var r=this;return V(function*(){let i,s;t?.timeFilter&&(i=t.timeFilter.startTime,s=t.timeFilter.endTime);const o=Object.assign({pubSubTopic:r.pubSubTopic,pageDirection:Gu.BACKWARD,pageSize:10},t,{contentTopics:e,startTime:i,endTime:s});let a;if(pc("Querying history with the following options",{peerId:t?.peerId?.toString(),...t}),o.peerId){if(a=yield r.libp2p.peerStore.get(o.peerId),!a)throw`Failed to retrieve connection details for provided peer in peer store: ${o.peerId.toString()}`}else if(a=yield r.randomPeer(),!a)throw"Failed to find known peer that registers waku store protocol";let c="";for(const U of Object.values(lc))a.protocols.includes(U)&&(c=U);if(pc(`Use store codec ${c}`),!c)throw`Peer does not register waku store protocol: ${a.id.toString()}`;Object.assign(o,{storeCodec:c});const m=r.libp2p.connectionManager.getConnections(a.id);if(!m||!m.length)throw"Failed to get a connection to the peer";const T=Array.from(r.decryptionKeys).map(([U,{method:Q,contentTopics:X}])=>({key:U,method:Q,contentTopics:X}));o.decryptionKeys&&o.decryptionKeys.forEach(U=>{T.push({key:Gs(U),contentTopics:e.length?e:void 0,method:void 0})});const R=[];let k;for(;;){const U=yield m[0].newStream(c),Q=Object.assign(o,{cursor:k}),X=Wf.createQuery(Q);pc("Querying store peer",m[0].remoteAddr.toString());const ae=yield Ln([X.encode()],Ff(),U,Vu(),function(){var mt=V(function*(Zt){return yield Ea(Zt)});return function(Zt){return mt.apply(this,arguments)}}()),he=Ji(ae),Ae=X.decode(he);if(!Ae.response)return pc("No message returned from store: `response` field missing"),R;const ue=Ae.response;if(ue.error&&ue.error!==zG.ERROR_NONE_UNSPECIFIED)throw"History response contains an Error: "+ue.error;if(!ue.messages||!ue.messages.length)return pc("No message returned from store: `messages` array empty"),R;pc(`${ue.messages.length} messages retrieved for (${o.pubSubTopic})`,e);const Re=[];yield Promise.all(ue.messages.map(function(){var mt=V(function*(Zt){const wn=yield uo.decodeProto(Zt,T);wn&&(R.push(wn),Re.push(wn))});return function(Zt){return mt.apply(this,arguments)}}()));let Le=!1;o.callback&&(Le=Boolean(o.callback(Re)));const Fe=ue.pagingInfo?.pageSize,wt=X.query?.pagingInfo?.pageSize;if(Le||Fe&&wt&&Fe(function(n){n.Relay="relay",n.Store="store",n.LightPush="lightpush",n.Filter="filter"}(es||(es={})),es))();class ZG{constructor(e,t,r,i,s){this.libp2p=t,this.relay=t.pubsub,this.store=r,this.filter=s,this.lightPush=i,this.pingKeepAliveTimers={},this.relayKeepAliveTimers={};const o=e.pingKeepAlive||0,a=e.relayKeepAlive||300;t.connectionManager.addEventListener("peer:connect",c=>{this.startKeepAlive(c.detail.remotePeer,o,a)}),t.connectionManager.addEventListener("peer:disconnect",c=>{this.stopKeepAlive(c.detail.remotePeer)}),e?.decryptionKeys?.forEach(c=>{this.addDecryptionKey(c)})}dial(e,t){var r=this;return V(function*(){const i=t??[es.Relay],s=[];if(i.includes(es.Relay)&&Hw.forEach(o=>s.push(o)),i.includes(es.Store))for(const o of Object.values(lc))s.push(o);return i.includes(es.LightPush)&&s.push(zf),i.includes(es.Filter)&&s.push(jf),r.libp2p.dialProtocol(e,s)})()}addPeerToAddressBook(e,t){let r;r="string"==typeof e?_r(e):e;const i=t.map(s=>"string"==typeof s?function G9(n){return new vn(n)}(s):s);this.libp2p.peerStore.addressBook.set(r,i)}start(){var e=this;return V(function*(){yield e.libp2p.start()})()}stop(){var e=this;return V(function*(){e.stopAllKeepAlives(),yield e.libp2p.stop()})()}isStarted(){return this.libp2p.isStarted()}addDecryptionKey(e,t){this.relay.addDecryptionKey(e,t),this.store.addDecryptionKey(e,t),this.filter.addDecryptionKey(e,t)}deleteDecryptionKey(e){this.relay.deleteDecryptionKey(e),this.store.deleteDecryptionKey(e),this.filter.deleteDecryptionKey(e)}getLocalMultiaddrWithID(){const e=this.libp2p.getMultiaddrs().find(t=>t.toString().match(/127\.0\.0\.1/));if(!e||""===e.toString())throw"Not listening on localhost";return e+"/p2p/"+this.libp2p.peerId.toString()}startKeepAlive(e,t,r){this.stopKeepAlive(e);const i=e.toString();0!==t&&(this.pingKeepAliveTimers[i]=setInterval(()=>{this.libp2p.ping(e).catch(s=>{kR(`Ping failed (${i})`,s)})},1e3*t)),0!==r&&(this.relayKeepAliveTimers[i]=setInterval(()=>{kR("Sending Waku Relay ping message"),uo.fromBytes(new Uint8Array,"/relay-ping/1/ping/null").then(s=>this.relay.send(s))},1e3*r))}stopKeepAlive(e){const t=e.toString();this.pingKeepAliveTimers[t]&&(clearInterval(this.pingKeepAliveTimers[t]),delete this.pingKeepAliveTimers[t]),this.relayKeepAliveTimers[t]&&(clearInterval(this.relayKeepAliveTimers[t]),delete this.relayKeepAliveTimers[t])}stopAllKeepAlives(){for(const e of[...Object.values(this.pingKeepAliveTimers),...Object.values(this.relayKeepAliveTimers)])clearInterval(e);this.pingKeepAliveTimers={},this.relayKeepAliveTimers={}}}const BR=Symbol.for("@achingbrain/uint8arraylist");function FR(n,e,t){if(null==e||e<0||e>=t)throw new RangeError("index is out of bounds");let r=0;for(const i of n){const s=r+i.byteLength;if(e0;){if(!(e>=this.bufs[0].byteLength)){this.bufs[0]=this.bufs[0].subarray(e),this.length-=e;break}e-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift()}}slice(e,t){const{bufs:r,length:i}=this._subList(e,t);return or(r,i)}subarray(e,t){const{bufs:r}=this._subList(e,t),i=new ts;return i.appendAll(r),i}_subList(e,t){if(null==e&&null==t)return{bufs:this.bufs,length:this.length};if((e=e??0)<0&&(e=this.length+e),(t=t??(this.length>0?this.length:0))<0&&(t=this.length+t),e<0||t>this.length)throw new RangeError("index out of bounds");if(e===t)return{bufs:[],length:0};const r=[];let i=0;for(const s of this.bufs){const o=i,a=o+s.byteLength,m=t>o&&t<=a;let R,k;if(i=a,e>=o&&e=a&&(R=0,k=s.byteLength),null!=R&&null!=k&&r.push(s.subarray(R,k)),m)break}return{bufs:r,length:t-e}}getInt8(e){const t=this.slice(e,e+1);return new DataView(t.buffer,t.byteOffset,t.byteLength).getInt8(0)}setInt8(e,t){const r=new Uint8Array(1);new DataView(r.buffer,r.byteOffset,r.byteLength).setInt8(0,t),this.write(r,e)}getInt16(e,t){const r=this.slice(e,e+2);return new DataView(r.buffer,r.byteOffset,r.byteLength).getInt16(0,t)}setInt16(e,t,r){const i=new Uint8Array(2);new DataView(i.buffer,i.byteOffset,i.byteLength).setInt16(0,t,r),this.write(i,e)}getInt32(e,t){const r=this.slice(e,e+4);return new DataView(r.buffer,r.byteOffset,r.byteLength).getInt32(0,t)}setInt32(e,t,r){const i=new Uint8Array(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setInt32(0,t,r),this.write(i,e)}getBigInt64(e,t){const r=this.slice(e,e+8);return new DataView(r.buffer,r.byteOffset,r.byteLength).getBigInt64(0,t)}setBigInt64(e,t,r){const i=new Uint8Array(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setBigInt64(0,t,r),this.write(i,e)}getUint8(e){const t=this.slice(e,e+1);return new DataView(t.buffer,t.byteOffset,t.byteLength).getUint8(0)}setUint8(e,t){const r=new Uint8Array(1);new DataView(r.buffer,r.byteOffset,r.byteLength).setUint8(0,t),this.write(r,e)}getUint16(e,t){const r=this.slice(e,e+2);return new DataView(r.buffer,r.byteOffset,r.byteLength).getUint16(0,t)}setUint16(e,t,r){const i=new Uint8Array(2);new DataView(i.buffer,i.byteOffset,i.byteLength).setUint16(0,t,r),this.write(i,e)}getUint32(e,t){const r=this.slice(e,e+4);return new DataView(r.buffer,r.byteOffset,r.byteLength).getUint32(0,t)}setUint32(e,t,r){const i=new Uint8Array(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setUint32(0,t,r),this.write(i,e)}getBigUint64(e,t){const r=this.slice(e,e+8);return new DataView(r.buffer,r.byteOffset,r.byteLength).getBigUint64(0,t)}setBigUint64(e,t,r){const i=new Uint8Array(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setBigUint64(0,t,r),this.write(i,e)}getFloat32(e,t){const r=this.slice(e,e+4);return new DataView(r.buffer,r.byteOffset,r.byteLength).getFloat32(0,t)}setFloat32(e,t,r){const i=new Uint8Array(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat32(0,t,r),this.write(i,e)}getFloat64(e,t){const r=this.slice(e,e+8);return new DataView(r.buffer,r.byteOffset,r.byteLength).getFloat64(0,t)}setFloat64(e,t,r){const i=new Uint8Array(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat64(0,t,r),this.write(i,e)}}function zu(n){return n instanceof Uint8Array?{get:e=>n[e],set(e,t){n[e]=t}}:{get:e=>n.get(e),set(e,t){n.set(e,t)}}}const VR=4294967296;class Ui{constructor(e=0,t=0){this.hi=e,this.lo=t}toBigInt(e){if(e)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31!=0){const t=1+~this.lo>>>0;let r=~this.hi>>>0;return 0===t&&(r=r+1>>>0),-(BigInt(t)+(BigInt(r)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}zzDecode(){const e=-(1&this.lo);return new Ui((this.hi>>>1^e)>>>0,((this.lo>>>1|this.hi<<31)^e)>>>0)}zzEncode(){const e=this.hi>>31;return new Ui(((this.hi<<1|this.lo>>>31)^e)>>>0,(this.lo<<1^e)>>>0)}toBytes(e,t=0){const r=zu(e);for(;this.hi>0;)r.set(t++,127&this.lo|128),this.lo=(this.lo>>>7|this.hi<<25)>>>0,this.hi>>>=7;for(;this.lo>127;)r.set(t++,127&this.lo|128),this.lo=this.lo>>>7;r.set(t++,this.lo)}static fromBigInt(e){if(0n===e)return new Ui;const t=e<0;t&&(e=-e);let r=0|Number(e>>32n),i=0|Number(e-(BigInt(r)<<32n));return t&&(r=~r>>>0,i=~i>>>0,++i>VR&&(i=0,++r>VR&&(r=0))),new Ui(r,i)}static fromNumber(e){if(0===e)return new Ui;const t=e<0;t&&(e=-e);let r=e>>>0,i=(e-r)/4294967296>>>0;return t&&(i=~i>>>0,r=~r>>>0,++r>4294967295&&(r=0,++i>4294967295&&(i=0))),new Ui(i,r)}static fromBytes(e,t){const r=zu(e),i=new Ui;let s=0;if(!(e.length-t>4)){for(;s<3;++s){if(t>=e.length)throw RangeError(`index out of range: ${t} > ${e.length}`);if(i.lo=(i.lo|(127&r.get(t))<<7*s)>>>0,r.get(t++)<128)return i}return i.lo=(i.lo|(127&r.get(t++))<<7*s)>>>0,i}for(;s<4;++s)if(i.lo=(i.lo|(127&r.get(t))<<7*s)>>>0,r.get(t++)<128)return i;if(i.lo=(i.lo|(127&r.get(t))<<28)>>>0,i.hi=(i.hi|(127&r.get(t))>>4)>>>0,r.get(t++)<128)return i;if(s=0,e.length-t>4){for(;s<5;++s)if(i.hi=(i.hi|(127&r.get(t))<<7*s+3)>>>0,r.get(t++)<128)return i}else for(;s<5;++s){if(t>=e.length)throw RangeError(`index out of range: ${t} > ${e.length}`);if(i.hi=(i.hi|(127&r.get(t))<<7*s+3)>>>0,r.get(t++)<128)return i}throw Error("invalid varint encoding")}}const ez=Math.pow(2,31),tz=Math.pow(2,7),nz=Math.pow(2,14),rz=Math.pow(2,21),iz=Math.pow(2,28),sz=Math.pow(2,35),oz=Math.pow(2,42),az=Math.pow(2,49),cz=Math.pow(2,56),uz=Math.pow(2,63),fn={encodingLength:n=>n=ez;)r.set(t++,255&n|128),n/=128;for(;(-128&n)>0;)r.set(t++,255&n|128),n>>>=7;r.set(t,0|n)},decode(n,e=0){const t=zu(n);let r=4294967295;if(r=(127&t.get(e))>>>0,t.get(e++)<128||(r=(r|(127&t.get(e))<<7)>>>0,t.get(e++)<128)||(r=(r|(127&t.get(e))<<14)>>>0,t.get(e++)<128)||(r=(r|(127&t.get(e))<<21)>>>0,t.get(e++)<128)||(r=(r|(15&t.get(e))<<28)>>>0,t.get(e++)<128))return r;if((e+=5)>n.length)throw RangeError(`index out of range: ${e} > ${n.length}`);return r}},jw={encodingLength:n=>n<0?10:fn.encodingLength(n),encode(n,e){if(n<0){let t=0;const r=zu(e),i=Ui.fromNumber(n);for(;i.hi>0;)r.set(t++,127&i.lo|128),i.lo=(i.lo>>>7|i.hi<<25)>>>0,i.hi>>>=7;for(;i.lo>127;)r.set(t++,127&i.lo|128),i.lo=i.lo>>>7;r.set(t++,i.lo)}else fn.encode(n,e)},decode:(n,e=0)=>0|fn.decode(n,e)},$w={encodingLength:n=>fn.encodingLength(n=(n<<1^n>>31)>>>0),encode:(n,e,t=0)=>fn.encode(n=(n<<1^n>>31)>>>0,e),decode(n,e=0){const t=fn.decode(n,e);return t>>>1^-(1&t)|0}};function Gw(n,e){const t=new Uint8Array(fn.encodingLength(n.length));return fn.encode(n.length,t),e.decode(new ts(t,n),0)}function zw(n,e){const t=e.encode(n),r=fn.encodingLength(fn.decode(t));return t.slice(r)}var nr=(()=>(function(n){n[n.VARINT=0]="VARINT",n[n.BIT64=1]="BIT64",n[n.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",n[n.START_GROUP=3]="START_GROUP",n[n.END_GROUP=4]="END_GROUP",n[n.BIT32=5]="BIT32"}(nr||(nr={})),nr))();function yi(n,e,t,r,i){return{name:n,type:e,encode:t,decode:r,encodingLength:i}}yi("bool",nr.VARINT,function(e){return Uint8Array.from([e?1:0])},function(e,t){return e.get(t)>0},function(){return 1});const Wu=yi("bytes",nr.LENGTH_DELIMITED,function(e){const t=new Uint8Array(fn.encodingLength(e.byteLength));return fn.encode(e.byteLength,t),new ts(t,e)},function(e,t){const r=fn.decode(e,t);return t+=fn.encodingLength(r),e.slice(t,t+r)},function(e){const t=e.byteLength;return fn.encodingLength(t)+t});yi("double",nr.BIT64,function(e){const t=new ts(new Uint8Array(8));return t.setFloat64(0,e,!0),t},function(e,t){return e.getFloat64(t,!0)},function(){return 8});const $R=(yi("fixed32",nr.BIT32,function(e){const t=new ts(new Uint8Array(4));return t.setInt32(0,e,!0),t},function(e,t){return e.getInt32(t,!0)},function(){return 4}),function(e){return 8}),GR=(yi("fixed64",nr.BIT64,function(e){const t=new ts(new Uint8Array(8));return t.setBigInt64(0,e,!0),t},function(e,t){return e.getBigInt64(t,!0)},$R),function(){return 4}),zR=(yi("float",nr.BIT32,function(e){const t=new ts(new Uint8Array(4));return t.setFloat32(0,e,!0),t},function(e,t){return e.getFloat32(t,!0)},GR),function(e){return jw.encodingLength(e)}),WR=(yi("int32",nr.VARINT,function(e){const t=new Uint8Array(zR(e));return jw.encode(e,t),t},function(e,t){return jw.decode(e,t)},zR),0x7fn),gc={encodingLength(n){let e=0;for(;n>=0x80n;e++)n>>=7n;return e+1},encode(n,e){const t=zu(e);let r=0;for(;WR>=7n;t.set(r,Number(n))},decode:(n,e=0)=>Ui.fromBytes(n,e).toBigInt(!0)},Ww={encodingLength:n=>n<0n?10:gc.encodingLength(n),encode(n,e,t=0){if(!(n<0n))return gc.encode(n,e);Ui.fromBigInt(n).toBytes(e,t)},decode:(n,e=0)=>Ui.fromBytes(n,e).toBigInt(!1)},qw={encodingLength:n=>gc.encodingLength(n>=0?2n*n:-2n*n-1n),encode(n,e,t=0){Ui.fromBigInt(n).zzEncode().toBytes(e,t)},decode:(n,e=0)=>Ui.fromBytes(n,e).zzDecode().toBigInt(!1)},qR=function(e){return Ww.encodingLength(e)};function Qw(n){return yi("message",nr.LENGTH_DELIMITED,function(s){const o=new ts;function a(m,T,R){if(null==m){if(!0===R.optional)return;throw new Error(`Non optional field "${R.name}" was ${null===m?"null":"undefined"}`)}const k=T<<3|R.codec.type,U=new Uint8Array(fn.encodingLength(k));fn.encode(k,U);const Q=R.codec.encode(m);o.append(U),o.append(Q)}for(const[m,T]of Object.entries(n)){const R=parseInt(m);if(!0===T.repeats){if(!Array.isArray(s[T.name]))throw new Error(`Repeating field "${T.name}" was not an array`);for(const k of s[T.name])a(k,R,T)}else a(s[T.name],R,T)}const c=new Uint8Array(fn.encodingLength(o.length));return fn.encode(o.length,c),new ts(c,o)},function(s,o){const a=fn.decode(s,o),c=(o+=fn.encodingLength(a))+a,m={};for(;o>3];let Q=0;if(R===nr.VARINT)if(null!=U){const X=U.codec.decode(s,o);Q=U.codec.encodingLength(X)}else{const X=fn.decode(s,o);Q=fn.encodingLength(X)}else if(R===nr.BIT64)Q=8;else if(R===nr.LENGTH_DELIMITED){const X=fn.decode(s,o);Q=X+fn.encodingLength(X)}else if(R===nr.BIT32)Q=4;else{if(R===nr.START_GROUP)throw new Error("Unsupported wire type START_GROUP");if(R===nr.END_GROUP)throw new Error("Unsupported wire type END_GROUP")}if(null!=U){const X=U.codec.decode(s,o);!0===U.repeats?(null==m[U.name]&&(m[U.name]=[]),m[U.name].push(X)):m[U.name]=X}o+=Q}for(const T of Object.values(n))!0===T.repeats&&null==m[T.name]&&(m[T.name]=[]);return m},function(s){let o=0;for(const a of Object.values(n))o+=a.codec.encodingLength(s[a.name]);return fn.encodingLength(o)+o})}yi("int64",nr.VARINT,function(e){const t=new Uint8Array(qR(e));return Ww.encode(e,t),t},function(e,t){return 0n|Ww.decode(e,t)},qR);const YR=(yi("sfixed32",nr.BIT32,function(e){const t=new ts(new Uint8Array(4));return t.setInt32(0,e,!0),t},function(e,t){return e.getInt32(t,!0)},function(){return 4}),function(){return 8}),ZR=(yi("sfixed64",nr.BIT64,function(e){const t=new ts(new Uint8Array(8));return t.setBigInt64(0,e,!0),t},function(e,t){return e.getBigInt64(t,!0)},YR),function(e){return $w.encodingLength(e)}),XR=(yi("sint32",nr.VARINT,function(e){const t=new Uint8Array(ZR(e));return $w.encode(e,t),t},function(e,t){return $w.decode(e,t)},ZR),function(e){return qw.encodingLength(e)}),JR=(yi("sint64",nr.VARINT,function(e){const t=new Uint8Array(XR(e));return qw.encode(e,t),t},function(e,t){return qw.decode(e,t)},XR),yi("string",nr.LENGTH_DELIMITED,function(e){const t=_t(e),r=new Uint8Array(fn.encodingLength(t.byteLength));return fn.encode(t.length,r),new ts(r,t)},function(e,t){const r=fn.decode(e,t);return t+=fn.encodingLength(r),Mt(e.slice(t,t+r))},function(e){const t=_t(e).byteLength;return fn.encodingLength(t)+t}),function(e){return fn.encodingLength(e)}),$z=(yi("uint32",nr.VARINT,function(e){const t=new Uint8Array(JR(e));return fn.encode(e,t),t},function(e,t){return fn.decode(e,t)},JR),yi("uint64",nr.VARINT,function(e){const t=new Uint8Array(gc.encodingLength(e));return gc.encode(e,t),t},function(e,t){return gc.decode(e,t)},function(e){return gc.encodingLength(e)}));var qf=(()=>(function(n){n.codec=()=>Qw({1:{name:"publicKey",codec:Wu},2:{name:"payloadType",codec:Wu},3:{name:"payload",codec:Wu},5:{name:"signature",codec:Wu}}),n.encode=e=>zw(e,n.codec()),n.decode=e=>Gw(e,n.codec())}(qf||(qf={})),qf))();class Ma{constructor(e){const{peerId:t,payloadType:r,payload:i,signature:s}=e;this.peerId=t,this.payloadType=r,this.payload=i,this.signature=s}marshal(){if(null==this.peerId.publicKey)throw new Error("Missing public key");return null==this.marshaled&&(this.marshaled=qf.encode({publicKey:this.peerId.publicKey,payloadType:this.payloadType,payload:this.payload,signature:this.signature})),this.marshaled}equals(e){return $r(this.marshal(),e.marshal())}validate(e){var t=this;return V(function*(){const r=eP(e,t.payloadType,t.payload);if(null==t.peerId.publicKey)throw new Error("Missing public key");return yield Tu(t.peerId.publicKey).verify(r,t.signature)})()}}Ma.createFromProtobuf=function(){var n=V(function*(e){const t=qf.decode(e),r=yield xu(t.publicKey);return new Ma({peerId:r,payloadType:t.payloadType,payload:t.payload,signature:t.signature})});return function(e){return n.apply(this,arguments)}}(),Ma.seal=function(){var n=V(function*(e,t){const r=e.domain,i=e.codec,s=e.marshal(),o=eP(r,i,s);if(null==t.privateKey)throw new Error("Missing private key");const c=yield(yield Au(t.privateKey)).sign(o);return new Ma({peerId:t,payloadType:i,payload:s,signature:c})});return function(e,t){return n.apply(this,arguments)}}(),Ma.openAndCertify=function(){var n=V(function*(e,t){const r=yield Ma.createFromProtobuf(e);if(!(yield r.validate(t)))throw se(new Error("envelope signature is not valid for the given domain"),"ERR_SIGNATURE_NOT_VALID");return r});return function(e,t){return n.apply(this,arguments)}}();const eP=(n,e,t)=>{const r=_t(n),i=Vn.encode(r.byteLength),s=Vn.encode(e.length),o=Vn.encode(t.length);return or([new Uint8Array(i),r,new Uint8Array(s),e,new Uint8Array(o),t])};var tP;!function(n){let e;var t;(t=e=n.AddressInfo||(n.AddressInfo={})).codec=()=>Qw({1:{name:"multiaddr",codec:Wu}}),t.encode=r=>zw(r,t.codec()),t.decode=r=>Gw(r,t.codec()),n.codec=()=>Qw({1:{name:"peerId",codec:Wu},2:{name:"seq",codec:$z},3:{name:"addresses",codec:n.AddressInfo.codec(),repeats:!0}}),n.encode=t=>zw(t,n.codec()),n.decode=t=>Gw(t,n.codec())}(tP||(tP={})),Uint8Array.from([3,1]);const nP=()=>{};class zz{constructor(e){this.min=e.min??0,this.max=e.max??1/0,this.peers=new Set,this.onConnect=e.onConnect??nP,this.onDisconnect=e.onDisconnect??nP}get[Symbol.toStringTag](){return jE.toString()}get[jE](){return!0}setRegistrar(e){var t=this;return V(function*(){t.registrar=e})()}disconnect(e){this.onDisconnect(e)}}class qz{constructor(e,t,r){this.gossip=e,this.msgs=new Map,this.history=[],this.msgIdToStrFn=r;for(let i=0;i{const s=this.msgs.get(i.msgIdStr);if(s&&s.validated&&e.has(i.topic)){let o=t.get(i.topic);o||(o=[],t.set(i.topic,o)),o.push(i.msgId)}});return t}validate(e){const t=this.msgs.get(e);if(!t)return null;const{message:r,originatingPeers:i}=t;return t.validated=!0,t.originatingPeers=new Set,{message:r,originatingPeers:i}}shift(){this.history[this.history.length-1].forEach(t=>{this.msgs.delete(t.msgIdStr)}),this.history.pop(),this.history.unshift([])}remove(e){const t=this.msgs.get(e);return t?(this.msgs.delete(e),t):null}}var Qz=N(8479);const{RPC:ig}=Qz,rP="/floodsub/1.0.0",iP="/meshsub/1.0.0",Zw="/meshsub/1.1.0",Qu=5e3;function Wo(n=[],e){return{subscriptions:[],messages:n,control:e?{graft:e.graft||[],prune:e.prune||[],ihave:e.ihave||[],iwant:e.iwant||[]}:void 0}}function qo(n){if(n.length<=1)return n;for(let t=0;t(function(n){n.StrictSign="StrictSign",n.StrictNoSign="StrictNoSign"}(og||(og={})),og))(),Oa=(()=>(function(n){n[n.Signing=0]="Signing",n[n.Author=1]="Author",n[n.Anonymous=2]="Anonymous"}(Oa||(Oa={})),Oa))(),fo=(()=>(function(n){n.Accept="accept",n.Ignore="ignore",n.Reject="reject"}(fo||(fo={})),fo))(),vs=(()=>(function(n){n.Error="error",n.Ignore="ignore",n.Reject="reject",n.Blacklisted="blacklisted"}(vs||(vs={})),vs))(),Ai=(()=>(function(n){n.InvalidSignature="invalid_signature",n.InvalidSeqno="invalid_seqno",n.InvalidPeerId="invalid_peerid",n.SignaturePresent="signature_present",n.SeqnoPresent="seqno_present",n.FromPresent="from_present",n.TransformFailed="transform_failed"}(Ai||(Ai={})),Ai))(),Es=(()=>(function(n){n.duplicate="duplicate",n.invalid="invalid",n.valid="valid"}(Es||(Es={})),Es))();function oP(n){switch(n){case fo.Ignore:return vs.Ignore;case fo.Reject:return vs.Reject}}function Jw(){return Jw=V(function*(n,e){switch(n){case sg:{if(!e)throw Error("Must provide PeerId");if(null==e.privateKey)throw Error("Cannot sign message, no private key present");if(null==e.publicKey)throw Error("Cannot sign message, no public key present");const t=yield Au(e.privateKey);return{type:Oa.Signing,author:e,key:e.publicKey,privateKey:t}}case Xw:return{type:Oa.Anonymous};default:throw new Error(`Unknown signature policy "${n}"`)}}),Jw.apply(this,arguments)}const qn="ERR_INVALID_PEER_SCORE_PARAMS",AW={topics:{},topicScoreCap:10,appSpecificScore:()=>0,appSpecificWeight:10,IPColocationFactorWeight:-5,IPColocationFactorThreshold:10,IPColocationFactorWhitelist:new Set,behaviourPenaltyWeight:-10,behaviourPenaltyThreshold:0,behaviourPenaltyDecay:.2,decayInterval:1e3,decayToZero:.1,retainScore:36e5},xW={topicWeight:.5,timeInMeshWeight:1,timeInMeshQuantum:1,timeInMeshCap:3600,firstMessageDeliveriesWeight:1,firstMessageDeliveriesDecay:.5,firstMessageDeliveriesCap:2e3,meshMessageDeliveriesWeight:-1,meshMessageDeliveriesDecay:.5,meshMessageDeliveriesCap:100,meshMessageDeliveriesThreshold:20,meshMessageDeliveriesWindow:10,meshMessageDeliveriesActivation:5e3,meshFailurePenaltyWeight:-1,meshFailurePenaltyDecay:.5,invalidMessageDeliveriesWeight:-1,invalidMessageDeliveriesDecay:.3};function RW(n={}){return{...AW,...n,topics:n.topics?Object.entries(n.topics).reduce((e,[t,r])=>(e[t]=function PW(n={}){return{...xW,...n}}(r),e),{}):{}}}function MW(n){if(n.topicWeight<0)throw se(new Error("invalid topic weight; must be >= 0"),qn);if(0===n.timeInMeshQuantum)throw se(new Error("invalid TimeInMeshQuantum; must be non zero"),qn);if(n.timeInMeshWeight<0)throw se(new Error("invalid TimeInMeshWeight; must be positive (or 0 to disable)"),qn);if(0!==n.timeInMeshWeight&&n.timeInMeshQuantum<=0)throw se(new Error("invalid TimeInMeshQuantum; must be positive"),qn);if(0!==n.timeInMeshWeight&&n.timeInMeshCap<=0)throw se(new Error("invalid TimeInMeshCap; must be positive"),qn);if(n.firstMessageDeliveriesWeight<0)throw se(new Error("invallid FirstMessageDeliveriesWeight; must be positive (or 0 to disable)"),qn);if(0!==n.firstMessageDeliveriesWeight&&(n.firstMessageDeliveriesDecay<=0||n.firstMessageDeliveriesDecay>=1))throw se(new Error("invalid FirstMessageDeliveriesDecay; must be between 0 and 1"),qn);if(0!==n.firstMessageDeliveriesWeight&&n.firstMessageDeliveriesCap<=0)throw se(new Error("invalid FirstMessageDeliveriesCap; must be positive"),qn);if(n.meshMessageDeliveriesWeight>0)throw se(new Error("invalid MeshMessageDeliveriesWeight; must be negative (or 0 to disable)"),qn);if(0!==n.meshMessageDeliveriesWeight&&(n.meshMessageDeliveriesDecay<=0||n.meshMessageDeliveriesDecay>=1))throw se(new Error("invalid MeshMessageDeliveriesDecay; must be between 0 and 1"),qn);if(0!==n.meshMessageDeliveriesWeight&&n.meshMessageDeliveriesCap<=0)throw se(new Error("invalid MeshMessageDeliveriesCap; must be positive"),qn);if(0!==n.meshMessageDeliveriesWeight&&n.meshMessageDeliveriesThreshold<=0)throw se(new Error("invalid MeshMessageDeliveriesThreshold; must be positive"),qn);if(n.meshMessageDeliveriesWindow<0)throw se(new Error("invalid MeshMessageDeliveriesWindow; must be non-negative"),qn);if(0!==n.meshMessageDeliveriesWeight&&n.meshMessageDeliveriesActivation<1e3)throw se(new Error("invalid MeshMessageDeliveriesActivation; must be at least 1s"),qn);if(n.meshFailurePenaltyWeight>0)throw se(new Error("invalid MeshFailurePenaltyWeight; must be negative (or 0 to disable)"),qn);if(0!==n.meshFailurePenaltyWeight&&(n.meshFailurePenaltyDecay<=0||n.meshFailurePenaltyDecay>=1))throw se(new Error("invalid MeshFailurePenaltyDecay; must be between 0 and 1"),qn);if(n.invalidMessageDeliveriesWeight>0)throw se(new Error("invalid InvalidMessageDeliveriesWeight; must be negative (or 0 to disable)"),qn);if(n.invalidMessageDeliveriesDecay<=0||n.invalidMessageDeliveriesDecay>=1)throw se(new Error("invalid InvalidMessageDeliveriesDecay; must be between 0 and 1"),qn)}const OW={gossipThreshold:-10,publishThreshold:-50,graylistThreshold:-80,acceptPXThreshold:10,opportunisticGraftThreshold:20};function LW(n={}){return{...OW,...n}}function kW(n,e,t,r){let i=0;if(Object.entries(e.topics).forEach(([o,a])=>{const c=t.topics[o];if(void 0===c)return;let m=0;if(a.inMesh){let U=a.meshTime/c.timeInMeshQuantum;U>c.timeInMeshCap&&(U=c.timeInMeshCap),m+=U*c.timeInMeshWeight}let T=a.firstMessageDeliveries;if(T>c.firstMessageDeliveriesCap&&(T=c.firstMessageDeliveriesCap),m+=T*c.firstMessageDeliveriesWeight,a.meshMessageDeliveriesActive&&a.meshMessageDeliveries0&&i>t.topicScoreCap&&(i=t.topicScoreCap),i+=t.appSpecificScore(n)*t.appSpecificWeight,e.ips.forEach(o=>{if(t.IPColocationFactorWhitelist.has(o))return;const a=r.get(o),c=a?a.size:0;if(c>t.IPColocationFactorThreshold){const m=c-t.IPColocationFactorThreshold;i+=m*m*t.IPColocationFactorWeight}}),e.behaviourPenalty>t.behaviourPenaltyThreshold){const o=e.behaviourPenalty-t.behaviourPenaltyThreshold;i+=o*o*t.behaviourPenaltyWeight}return i}var BW=N(1807),xi=(()=>(function(n){n[n.unknown=0]="unknown",n[n.valid=1]="valid",n[n.invalid=2]="invalid",n[n.ignored=3]="ignored"}(xi||(xi={})),xi))();class FW{constructor(){this.records=new Map,this.queue=new BW}ensureRecord(e){let t=this.records.get(e);if(t)return t;t={status:xi.unknown,firstSeen:Date.now(),validated:0,peers:new Set},this.records.set(e,t);const r={msgId:e,expire:Date.now()+12e4};return this.queue.push(r),t}gc(){const e=Date.now();let t=this.queue.peekFront();for(;t&&t.expire0)throw se(new Error("invalid IPColocationFactorWeight; must be negative (or 0 to disable)"),qn);if(0!==n.IPColocationFactorWeight&&n.IPColocationFactorThreshold<1)throw se(new Error("invalid IPColocationFactorThreshold; must be at least 1"),qn);if(n.behaviourPenaltyWeight>0)throw se(new Error("invalid BehaviourPenaltyWeight; must be negative (or 0 to disable)"),qn);if(0!==n.behaviourPenaltyWeight&&(n.behaviourPenaltyDecay<=0||n.behaviourPenaltyDecay>=1))throw se(new Error("invalid BehaviourPenaltyDecay; must be between 0 and 1"),qn);if(n.decayInterval<1e3)throw se(new Error("invalid DecayInterval; must be at least 1s"),qn);if(n.decayToZero<=0||n.decayToZero>=1)throw se(new Error("invalid DecayToZero; must be between 0 and 1"),qn)}(e),this.scoreCacheValidityMs=r.scoreCacheValidityMs,this.computeScore=r.computeScore??kW}init(e){this.components=e}get size(){return this.peerStats.size}start(){this._backgroundInterval?Yu("Peer score already running"):(this._backgroundInterval=setInterval(()=>this.background(),this.params.decayInterval),Yu("started"))}stop(){this._backgroundInterval?(clearInterval(this._backgroundInterval),delete this._backgroundInterval,this.peerIPs.clear(),this.peerStats.clear(),this.deliveryRecords.clear(),Yu("stopped")):Yu("Peer score already stopped")}background(){this.refreshScores(),this.updateIPs(),this.deliveryRecords.gc()}dumpPeerScoreStats(){return Object.fromEntries(Array.from(this.peerStats.entries()).map(([e,t])=>[e,t]))}refreshScores(){const e=Date.now(),t=this.params.decayToZero;this.peerStats.forEach((r,i)=>{r.connected?(Object.entries(r.topics).forEach(([s,o])=>{const a=this.params.topics[s];void 0!==a&&(o.firstMessageDeliveries*=a.firstMessageDeliveriesDecay,o.firstMessageDeliveriesa.meshMessageDeliveriesActivation&&(o.meshMessageDeliveriesActive=!0)))}),r.behaviourPenalty*=this.params.behaviourPenaltyDecay,r.behaviourPenaltyr.expire&&(this.removeIPs(i,r.ips),this.peerStats.delete(i),this.scoreCache.delete(i))})}score(e){this.metrics?.scoreFnCalls.inc();const t=this.peerStats.get(e);if(!t)return 0;const r=Date.now(),i=this.scoreCache.get(e);if(i&&i.cacheUntil>r)return i.score;this.metrics?.scoreFnRuns.inc();const s=this.computeScore(e,t,this.params,this.peerIPs),o=r+this.scoreCacheValidityMs;return i?(this.metrics?.scoreCachedDelta.observe(Math.abs(s-i.score)),i.score=s,i.cacheUntil=o):this.scoreCache.set(e,{score:s,cacheUntil:o}),s}addPenalty(e,t,r){const i=this.peerStats.get(e);i&&(i.behaviourPenalty+=t,this.metrics?.onScorePenalty(r))}addPeer(e){const t={connected:!0,expire:0,topics:{},ips:[],behaviourPenalty:0};this.peerStats.set(e,t);const r=this.getIPs(e);this.setIPs(e,r,t.ips),t.ips=r}removePeer(e){const t=this.peerStats.get(e);if(t){if(this.score(e)>0)return this.removeIPs(e,t.ips),void this.peerStats.delete(e);Object.entries(t.topics).forEach(([r,i])=>{i.firstMessageDeliveries=0;const s=this.params.topics[r].meshMessageDeliveriesThreshold;if(i.inMesh&&i.meshMessageDeliveriesActive&&i.meshMessageDeliveries{o!==e.toString()&&this.markDuplicateMessageDelivery(o,r)})):Yu("unexpected delivery: message from %s was first seen %s ago and has delivery status %s",e,s-i.firstSeen,xi[i.status])}rejectInvalidMessage(e,t){this.markInvalidMessageDelivery(e,t)}rejectMessage(e,t,r,i){switch(i){case vs.Error:return void this.markInvalidMessageDelivery(e,r);case vs.Blacklisted:return}const s=this.deliveryRecords.ensureRecord(t);if(s.status===xi.unknown)return i===vs.Ignore?(s.status=xi.ignored,void s.peers.clear()):(s.status=xi.invalid,this.markInvalidMessageDelivery(e,r),s.peers.forEach(o=>{this.markInvalidMessageDelivery(o,r)}),void s.peers.clear());Yu("unexpected rejection: message from %s was first seen %s ago and has delivery status %d",e,Date.now()-s.firstSeen,xi[s.status])}duplicateMessage(e,t,r){const i=this.deliveryRecords.ensureRecord(t);if(!i.peers.has(e))switch(i.status){case xi.unknown:i.peers.add(e);break;case xi.valid:i.peers.add(e),this.markDuplicateMessageDelivery(e,r,i.validated);break;case xi.invalid:this.markInvalidMessageDelivery(e,r)}}markInvalidMessageDelivery(e,t){const r=this.peerStats.get(e);if(r){const i=this.getPtopicStats(r,t);i&&(i.invalidMessageDeliveries+=1)}}markFirstMessageDelivery(e,t){const r=this.peerStats.get(e);if(r){const i=this.getPtopicStats(r,t);if(i){let s=this.params.topics[t].firstMessageDeliveriesCap;i.firstMessageDeliveries=Math.min(s,i.firstMessageDeliveries+1),i.inMesh&&(s=this.params.topics[t].meshMessageDeliveriesCap,i.meshMessageDeliveries=Math.min(s,i.meshMessageDeliveries+1))}}}markDuplicateMessageDelivery(e,t,r){const i=this.peerStats.get(e);if(i){const s=void 0!==r?Date.now():0,o=this.getPtopicStats(i,t);if(o&&o.inMesh){const a=this.params.topics[t];if(void 0!==r){const m=s-r,T=m>a.meshMessageDeliveriesWindow;if(this.metrics?.onDuplicateMsgDelivery(t,m,T),T)return}o.meshMessageDeliveries=Math.min(a.meshMessageDeliveriesCap,o.meshMessageDeliveries+1)}}}getIPs(e){return this.components.getConnectionManager().getConnections(_r(e)).map(t=>t.remoteAddr.toOptions().host)}setIPs(e,t,r){e:for(const i of t){for(const o of r)if(i===o)continue e;let s=this.peerIPs.get(i);s||(s=new Set,this.peerIPs.set(i,s)),s.add(e)}e:for(const i of r){for(const o of t)if(i===o)continue e;const s=this.peerIPs.get(i);!s||(s.delete(e),s.size||this.peerIPs.delete(i))}}removeIPs(e,t){t.forEach(r=>{const i=this.peerIPs.get(r);!i||(i.delete(e),i.size||this.peerIPs.delete(r))})}updateIPs(){this.peerStats.forEach((e,t)=>{const r=this.getIPs(t);this.setIPs(t,r,e.ips),e.ips=r})}getPtopicStats(e,t){let r=e.topics[t];return void 0!==r?r:void 0!==this.params.topics[t]?(r={inMesh:!1,graftTime:0,meshTime:0,firstMessageDeliveries:0,meshMessageDeliveries:0,meshMessageDeliveriesActive:!1,meshFailurePenalty:0,invalidMessageDeliveries:0},e.topics[t]=r,r):null}}class VW{constructor(e,t,r){this.gossipsubIWantFollowupMs=e,this.msgIdToStrFn=t,this.metrics=r,this.promises=new Map,this.requestMsByMsg=new Map,this.requestMsByMsgExpire=10*e}get size(){return this.promises.size}get requestMsByMsgSize(){return this.requestMsByMsg.size}addPromise(e,t){const r=Math.floor(Math.random()*t.length),s=this.msgIdToStrFn(t[r]);let o=this.promises.get(s);o||(o=new Map,this.promises.set(s,o));const a=Date.now();o.has(e)||(o.set(e,a+this.gossipsubIWantFollowupMs),this.metrics&&(this.metrics.iwantPromiseStarted.inc(1),this.requestMsByMsg.has(s)||this.requestMsByMsg.set(s,a)))}getBrokenPromises(){const e=Date.now(),t=new Map;let r=0;return this.promises.forEach((i,s)=>{i.forEach((o,a)=>{o=Date.now()?t.value:void 0}clear(){this.entries.clear()}}var Qo=(()=>(function(n){n.Fanout="fanout",n.Random="random",n.Subscribed="subscribed",n.Outbound="outbound",n.NotEnough="not_enough",n.Opportunistic="opportunistic"}(Qo||(Qo={})),Qo))(),yc=(()=>(function(n){n.Dc="disconnected",n.BadScore="bad_score",n.Prune="prune",n.Unsub="unsubscribed",n.Excess="excess"}(yc||(yc={})),yc))(),Zu=(()=>(function(n){n.GraftBackoff="graft_backoff",n.BrokenPromise="broken_promise",n.MessageDeficit="message_deficit",n.IPColocation="IP_colocation"}(Zu||(Zu={})),Zu))(),Xu=(()=>(function(n){n.LowScore="low_score",n.MaxIhave="max_ihave",n.MaxIasked="max_iasked"}(Xu||(Xu={})),Xu))(),mc=(()=>(function(n){n.graylist="graylist",n.publish="publish",n.gossip="gossip",n.mesh="mesh"}(mc||(mc={})),mc))();const aP=_t("libp2p-pubsub:");function tb(){return tb=V(function*(n,e,t){switch(n.type){case Oa.Signing:{const r={from:n.author.toBytes(),data:t,seqno:sf(8),topic:e,signature:void 0,key:void 0},i=or([aP,ig.Message.encode(r).finish()]);return r.signature=yield n.privateKey.sign(i),r.key=n.key,r}case Oa.Author:return{from:n.author.toBytes(),data:t,seqno:sf(8),topic:e,signature:void 0,key:void 0};case Oa.Anonymous:return{from:void 0,data:t,seqno:void 0,topic:e,signature:void 0,key:void 0}}}),tb.apply(this,arguments)}function nb(){return nb=V(function*(n,e){switch(n){case Xw:return null!=e.signature?{valid:!1,error:Ai.SignaturePresent}:null!=e.seqno?{valid:!1,error:Ai.SeqnoPresent}:null!=e.key?{valid:!1,error:Ai.FromPresent}:{valid:!0,fromPeerId:null};case sg:{if(null==e.seqno)return{valid:!1,error:Ai.InvalidSeqno};if(8!==e.seqno.length)return{valid:!1,error:Ai.InvalidSeqno};if(null==e.signature)return{valid:!1,error:Ai.InvalidSignature};if(null==e.from)return{valid:!1,error:Ai.InvalidPeerId};let t,r;try{t=pa(e.from)}catch{return{valid:!1,error:Ai.InvalidPeerId}}if(e.key){if(r=Tu(e.key),void 0!==t.publicKey&&!$r(r.bytes,t.publicKey))return{valid:!1,error:Ai.InvalidPeerId}}else{if(null==t.publicKey)return{valid:!1,error:Ai.InvalidPeerId};r=Tu(t.publicKey)}const s=or([aP,ig.Message.encode({from:e.from,data:e.data,seqno:e.seqno,topic:e.topic,signature:void 0,key:void 0}).finish()]);return(yield r.verify(s,e.signature))?{valid:!0,fromPeerId:t}:{valid:!1,error:Ai.InvalidSignature}}}}),nb.apply(this,arguments)}function WW(n){if(null==n.sequenceNumber)throw Error("missing seqno field");return((n,e)=>{const t=_t(e.toString(16).padStart(16,"0"),"base16"),r=new Uint8Array(n.length+t.length);return r.set(n,0),r.set(t,n.length),r})(n.from.toBytes(),n.sequenceNumber)}function qW(n){return rb.apply(this,arguments)}function rb(){return rb=V(function*(n){return yield Li.encode(n.data)}),rb.apply(this,arguments)}function QW(n,e,t,r,i){let s=0;const o=new Map;if(Object.entries(e.topics).forEach(([k,U])=>{const Q=i.get(k)??"unknown",X=t.topics[k];if(void 0===X)return;let ae=o.get(Q);ae||(ae={p1w:0,p2w:0,p3w:0,p3bw:0,p4w:0},o.set(Q,ae));let he=0,Ae=0,ue=0,Re=0,Le=0;U.inMesh&&(he+=Math.max(U.meshTime/X.timeInMeshQuantum,X.timeInMeshCap)*X.timeInMeshWeight);let Fe=U.firstMessageDeliveries;if(Fe>X.firstMessageDeliveriesCap&&(Fe=X.firstMessageDeliveriesCap),Ae+=Fe*X.firstMessageDeliveriesWeight,U.meshMessageDeliveriesActive&&U.meshMessageDeliveries0&&s>t.topicScoreCap){s=t.topicScoreCap;const k=t.topicScoreCap/s;for(const U of o.values())U.p1w*=k,U.p2w*=k,U.p3w*=k,U.p3bw*=k,U.p4w*=k}let a=0,c=0,m=0;return a+=t.appSpecificScore(n)*t.appSpecificWeight,e.ips.forEach(k=>{if(t.IPColocationFactorWhitelist.has(k))return;const U=r.get(k),Q=U?U.size:0;if(Q>t.IPColocationFactorThreshold){const X=Q-t.IPColocationFactorThreshold;c+=X*X*t.IPColocationFactorWeight}}),m+=e.behaviourPenalty*e.behaviourPenalty*t.behaviourPenaltyWeight,s+=a+c+m,{byTopic:o,p5w:a,p6w:c,p7w:m,score:s}}function ib(n,e,t=(()=>!0)){const r=new Set;if(e<=0)return r;for(const i of n){if(r.size>=e)break;t(i)&&(r.add(i),n.delete(i))}return r}class XW{constructor(e,t){this.rawStream=e,this.pushable=lu(),this.closeController=new AbortController,Ln(Fs(this.pushable,this.closeController.signal,{returnOnAbort:!0}),to(),this.rawStream).catch(t)}get protocol(){return this.rawStream.stat.protocol}push(e){this.pushable.push(e)}close(){this.closeController.abort(),this.pushable.return(),this.rawStream.close()}}class JW{constructor(e){this.rawStream=e,this.closeController=new AbortController,this.source=Fs(Ln(this.rawStream,Ms()),this.closeController.signal,{returnOnAbort:!0})}close(){this.closeController.abort(),this.rawStream.close()}}var Vi=(()=>(function(n){n[n.started=0]="started",n[n.stopped=1]="stopped"}(Vi||(Vi={})),Vi))();class cP extends ki{constructor(e={}){super(),this.multicodecs=[Zw,iP],this.peers=new Set,this.streamsInbound=new Map,this.streamsOutbound=new Map,this.outboundInflightQueue=lu({objectMode:!0}),this.direct=new Set,this.floodsubPeers=new Set,this.acceptFromWhitelist=new Map,this.topics=new Map,this.subscriptions=new Set,this.mesh=new Map,this.fanout=new Map,this.fanoutLastpub=new Map,this.gossip=new Map,this.control=new Map,this.peerhave=new Map,this.iasked=new Map,this.backoff=new Map,this.outbound=new Map,this.topicValidators=new Map,this.heartbeatTicks=0,this.components=new ko,this.directPeerInitial=null,this.status={code:Vi.stopped},this.heartbeatTimer=null,this.runHeartbeat=()=>{const r=this.metrics?.heartbeatDuration.startTimer();this.heartbeat().catch(i=>{this.log("Error running heartbeat",i)}).finally(()=>{if(r?.(),this.status.code===Vi.started){clearTimeout(this.status.heartbeatTimeout);let i=(Date.now()-this.status.hearbeatStartMs)%this.opts.heartbeatInterval;i<.25*this.opts.heartbeatInterval&&(i+=this.opts.heartbeatInterval,this.metrics?.heartbeatSkipped.inc()),this.status.heartbeatTimeout=setTimeout(this.runHeartbeat,i)}})};const t={fallbackToFloodsub:!0,floodPublish:!0,doPX:!1,directPeers:[],D:6,Dlo:4,Dhi:12,Dscore:4,Dout:2,Dlazy:6,heartbeatInterval:1e3,fanoutTTL:6e4,mcacheLength:5,mcacheGossip:3,seenTTL:12e4,gossipsubIWantFollowupMs:3e3,prunePeers:16,pruneBackoff:6e4,graftFloodThreshold:1e4,opportunisticGraftPeers:2,opportunisticGraftTicks:60,directConnectTicks:300,...e,scoreParams:RW(e.scoreParams),scoreThresholds:LW(e.scoreThresholds)};if(this.globalSignaturePolicy=t.globalSignaturePolicy??sg,t.fallbackToFloodsub&&this.multicodecs.push(rP),this.log=Gt(t.debugName??"libp2p:gossipsub"),this.opts=t,this.direct=new Set(t.directPeers.map(r=>r.id.toString())),this.seenCache=new eb({validityMs:t.seenTTL}),this.publishedMessageIds=new eb({validityMs:t.seenTTL}),e.msgIdFn)this.msgIdFn=e.msgIdFn;else switch(this.globalSignaturePolicy){case sg:this.msgIdFn=WW;break;case Xw:this.msgIdFn=qW}if(e.fastMsgIdFn&&(this.fastMsgIdFn=e.fastMsgIdFn,this.fastMsgIdCache=new eb({validityMs:t.seenTTL})),this.msgIdToStrFn=e.msgIdToStrFn??CW,this.mcache=e.messageCache||new qz(t.mcacheGossip,t.mcacheLength,this.msgIdToStrFn),e.dataTransform&&(this.dataTransform=e.dataTransform),e.metricsRegister){if(!e.metricsTopicStrToLabel)throw Error("Must set metricsTopicStrToLabel with metrics");const r=Math.max(...Object.values(t.scoreParams.topics).map(s=>s.meshMessageDeliveriesWindow),1e3),i=function HW(n,e,t){return{protocolsEnabled:n.gauge({name:"gossipsub_protocol",help:"Status of enabled protocols",labelNames:["protocol"]}),topicSubscriptionStatus:n.gauge({name:"gossipsub_topic_subscription_status",help:"Status of our subscription to this topic",labelNames:["topicStr"]}),topicPeersCount:n.gauge({name:"gossipsub_topic_peer_count",help:"Number of peers subscribed to each topic",labelNames:["topicStr"]}),meshPeerCounts:n.gauge({name:"gossipsub_mesh_peer_count",help:"Number of peers in our mesh",labelNames:["topicStr"]}),meshPeerInclusionEvents:n.gauge({name:"gossipsub_mesh_peer_inclusion_events_total",help:"Number of times we include peers in a topic mesh for different reasons",labelNames:["topic","reason"]}),meshPeerChurnEvents:n.gauge({name:"gossipsub_peer_churn_events_total",help:"Number of times we remove peers in a topic mesh for different reasons",labelNames:["topic","reason"]}),peersPerProtocol:n.gauge({name:"gossipsub_peers_per_protocol_count",help:"Peers connected for each topic",labelNames:["protocol"]}),heartbeatDuration:n.histogram({name:"gossipsub_heartbeat_duration_seconds",help:"The time it takes to complete one iteration of the heartbeat",buckets:[.01,.1,1]}),heartbeatSkipped:n.gauge({name:"gossipsub_heartbeat_skipped",help:"Heartbeat run took longer than heartbeat interval so next is skipped"}),asyncValidationResult:n.gauge({name:"gossipsub_async_validation_result_total",help:"Message validation result for each topic",labelNames:["topic","acceptance"]}),asyncValidationMcacheHit:n.gauge({name:"gossipsub_async_validation_mcache_hit_total",help:"Async validation result reported by the user layer",labelNames:["hit"]}),rpcRecvBytes:n.gauge({name:"gossipsub_rpc_recv_bytes_total",help:"RPC recv"}),rpcRecvCount:n.gauge({name:"gossipsub_rpc_recv_count_total",help:"RPC recv"}),rpcRecvSubscription:n.gauge({name:"gossipsub_rpc_recv_subscription_total",help:"RPC recv"}),rpcRecvMessage:n.gauge({name:"gossipsub_rpc_recv_message_total",help:"RPC recv"}),rpcRecvControl:n.gauge({name:"gossipsub_rpc_recv_control_total",help:"RPC recv"}),rpcRecvIHave:n.gauge({name:"gossipsub_rpc_recv_ihave_total",help:"RPC recv"}),rpcRecvIWant:n.gauge({name:"gossipsub_rpc_recv_iwant_total",help:"RPC recv"}),rpcRecvGraft:n.gauge({name:"gossipsub_rpc_recv_graft_total",help:"RPC recv"}),rpcRecvPrune:n.gauge({name:"gossipsub_rpc_recv_prune_total",help:"RPC recv"}),rpcRecvNotAccepted:n.gauge({name:"gossipsub_rpc_rcv_not_accepted_total",help:"Total count of RPC dropped because acceptFrom() == false"}),rpcSentBytes:n.gauge({name:"gossipsub_rpc_sent_bytes_total",help:"RPC sent"}),rpcSentCount:n.gauge({name:"gossipsub_rpc_sent_count_total",help:"RPC sent"}),rpcSentSubscription:n.gauge({name:"gossipsub_rpc_sent_subscription_total",help:"RPC sent"}),rpcSentMessage:n.gauge({name:"gossipsub_rpc_sent_message_total",help:"RPC sent"}),rpcSentControl:n.gauge({name:"gossipsub_rpc_sent_control_total",help:"RPC sent"}),rpcSentIHave:n.gauge({name:"gossipsub_rpc_sent_ihave_total",help:"RPC sent"}),rpcSentIWant:n.gauge({name:"gossipsub_rpc_sent_iwant_total",help:"RPC sent"}),rpcSentGraft:n.gauge({name:"gossipsub_rpc_sent_graft_total",help:"RPC sent"}),rpcSentPrune:n.gauge({name:"gossipsub_rpc_sent_prune_total",help:"RPC sent"}),msgPublishCount:n.gauge({name:"gossipsub_msg_publish_count_total",help:"Total count of msg published by topic",labelNames:["topic"]}),msgPublishPeers:n.gauge({name:"gossipsub_msg_publish_peers_total",help:"Total count of peers that we publish a msg to",labelNames:["topic"]}),msgPublishPeersByGroup:n.gauge({name:"gossipsub_msg_publish_peers_by_group",help:"Total count of peers (by group) that we publish a msg to",labelNames:["topic","peerGroup"]}),msgPublishBytes:n.gauge({name:"gossipsub_msg_publish_bytes_total",help:"Total count of msg publish data.length bytes",labelNames:["topic"]}),msgForwardCount:n.gauge({name:"gossipsub_msg_forward_count_total",help:"Total count of msg forwarded by topic",labelNames:["topic"]}),msgForwardPeers:n.gauge({name:"gossipsub_msg_forward_peers_total",help:"Total count of peers that we forward a msg to",labelNames:["topic"]}),msgReceivedPreValidation:n.gauge({name:"gossipsub_msg_received_prevalidation_total",help:"Total count of recv msgs before any validation",labelNames:["topic"]}),msgReceivedStatus:n.gauge({name:"gossipsub_msg_received_status_total",help:"Tracks distribution of recv msgs by duplicate, invalid, valid",labelNames:["topic","status"]}),msgReceivedInvalid:n.gauge({name:"gossipsub_msg_received_invalid_total",help:"Tracks specific reason of invalid",labelNames:["topic","error"]}),duplicateMsgDeliveryDelay:n.histogram({name:"gossisub_duplicate_msg_delivery_delay_seconds",help:"Time since the 1st duplicated message validated",labelNames:["topic"],buckets:[.25*t.maxMeshMessageDeliveriesWindowSec,.5*t.maxMeshMessageDeliveriesWindowSec,1*t.maxMeshMessageDeliveriesWindowSec,2*t.maxMeshMessageDeliveriesWindowSec,4*t.maxMeshMessageDeliveriesWindowSec]}),duplicateMsgLateDelivery:n.gauge({name:"gossisub_duplicate_msg_late_delivery_total",help:"Total count of late duplicate message delivery by topic, which triggers P3 penalty",labelNames:["topic"]}),scoreFnCalls:n.gauge({name:"gossipsub_score_fn_calls_total",help:"Total times score() is called"}),scoreFnRuns:n.gauge({name:"gossipsub_score_fn_runs_total",help:"Total times score() call actually computed computeScore(), no cache"}),scoreCachedDelta:n.histogram({name:"gossipsub_score_cache_delta",help:"Delta of score between cached values that expired",buckets:[10,100,1e3]}),peersByScoreThreshold:n.gauge({name:"gossipsub_peers_by_score_threshold_count",help:"Current count of peers by score threshold",labelNames:["threshold"]}),score:n.avgMinMax({name:"gossipsub_score",help:"Avg min max of gossip scores",labelNames:["topic","p"]}),scoreWeights:n.avgMinMax({name:"gossipsub_score_weights",help:"Separate score weights",labelNames:["topic","p"]}),scorePerMesh:n.avgMinMax({name:"gossipsub_score_per_mesh",help:"Histogram of the scores for each mesh topic",labelNames:["topic"]}),scoringPenalties:n.gauge({name:"gossipsub_scoring_penalties_total",help:"A counter of the kind of penalties being applied to peers",labelNames:["penalty"]}),behaviourPenalty:n.histogram({name:"gossipsub_peer_stat_behaviour_penalty",help:"Current peer stat behaviour_penalty at each scrape",buckets:[.25*t.behaviourPenaltyThreshold,.5*t.behaviourPenaltyThreshold,1*t.behaviourPenaltyThreshold,2*t.behaviourPenaltyThreshold,4*t.behaviourPenaltyThreshold]}),ihaveRcvIgnored:n.gauge({name:"gossipsub_ihave_rcv_ignored_total",help:"Total received IHAVE messages that we ignore for some reason",labelNames:["reason"]}),ihaveRcvMsgids:n.gauge({name:"gossipsub_ihave_rcv_msgids_total",help:"Total received IHAVE messages by topic",labelNames:["topic"]}),ihaveRcvNotSeenMsgids:n.gauge({name:"gossipsub_ihave_rcv_not_seen_msgids_total",help:"Total messages per topic we do not have, not actual requests",labelNames:["topic"]}),iwantRcvMsgids:n.gauge({name:"gossipsub_iwant_rcv_msgids_total",help:"Total received IWANT messages by topic",labelNames:["topic"]}),iwantRcvDonthaveMsgids:n.gauge({name:"gossipsub_iwant_rcv_dont_have_msgids_total",help:"Total requested messageIDs that we do not have"}),iwantPromiseStarted:n.gauge({name:"gossipsub_iwant_promise_sent_total",help:"Total count of started IWANT promises"}),iwantPromiseResolved:n.gauge({name:"gossipsub_iwant_promise_resolved_total",help:"Total count of resolved IWANT promises"}),iwantPromiseResolvedPeers:n.gauge({name:"gossipsub_iwant_promise_resolved_peers",help:"Total count of peers we have asked IWANT promises that are resolved"}),iwantPromiseBroken:n.gauge({name:"gossipsub_iwant_promise_broken",help:"Total count of broken IWANT promises"}),iwantPromiseDeliveryTime:n.histogram({name:"gossipsub_iwant_promise_delivery_seconds",help:"Histogram of delivery time of resolved IWANT promises",buckets:[.5*t.gossipPromiseExpireSec,1*t.gossipPromiseExpireSec,2*t.gossipPromiseExpireSec,4*t.gossipPromiseExpireSec]}),cacheSize:n.gauge({name:"gossipsub_cache_size",help:"Unbounded cache sizes",labelNames:["cache"]}),mcacheSize:n.gauge({name:"gossipsub_mcache_size",help:"Current mcache msg count"}),topicStrToLabel:e,toTopic(r){return this.topicStrToLabel.get(r)??r},onJoin(r){this.topicSubscriptionStatus.set({topicStr:r},1),this.meshPeerCounts.set({topicStr:r},0)},onLeave(r){this.topicSubscriptionStatus.set({topicStr:r},0),this.meshPeerCounts.set({topicStr:r},0)},onAddToMesh(r,i,s){const o=this.toTopic(r);this.meshPeerInclusionEvents.inc({topic:o,reason:i},s)},onRemoveFromMesh(r,i,s){const o=this.toTopic(r);this.meshPeerChurnEvents.inc({topic:o,reason:i},s)},onReportValidationMcacheHit(r){this.asyncValidationMcacheHit.inc({hit:r?"hit":"miss"})},onReportValidation(r,i){const s=this.toTopic(r);this.asyncValidationResult.inc({topic:s,acceptance:i})},onScorePenalty(r){this.scoringPenalties.inc({penalty:r},1)},onIhaveRcv(r,i,s){const o=this.toTopic(r);this.ihaveRcvMsgids.inc({topic:o},i),this.ihaveRcvNotSeenMsgids.inc({topic:o},s)},onIwantRcv(r,i){for(const[s,o]of r){const a=this.toTopic(s);this.iwantRcvMsgids.inc({topic:a},o)}this.iwantRcvDonthaveMsgids.inc(i)},onForwardMsg(r,i){const s=this.toTopic(r);this.msgForwardCount.inc({topic:s},1),this.msgForwardPeers.inc({topic:s},i)},onPublishMsg(r,i,s,o){const a=this.toTopic(r);this.msgPublishCount.inc({topic:a},1),this.msgPublishBytes.inc({topic:a},s*o),this.msgPublishPeers.inc({topic:a},s),this.msgPublishPeersByGroup.inc({topic:a,peerGroup:"direct"},i.direct),this.msgPublishPeersByGroup.inc({topic:a,peerGroup:"floodsub"},i.floodsub),this.msgPublishPeersByGroup.inc({topic:a,peerGroup:"mesh"},i.mesh),this.msgPublishPeersByGroup.inc({topic:a,peerGroup:"fanout"},i.fanout)},onMsgRecvPreValidation(r){const i=this.toTopic(r);this.msgReceivedPreValidation.inc({topic:i},1)},onMsgRecvResult(r,i){const s=this.toTopic(r);this.msgReceivedStatus.inc({topic:s,status:i})},onMsgRecvInvalid(r,i){const s=this.toTopic(r);this.msgReceivedInvalid.inc({topic:s,error:i.reason===vs.Error?i.error:i.reason},1)},onDuplicateMsgDelivery(r,i,s){if(this.duplicateMsgDeliveryDelay.observe(i/1e3),s){const o=this.toTopic(r);this.duplicateMsgLateDelivery.inc({topic:o},1)}},onRpcRecv(r,i){this.rpcRecvBytes.inc(i),this.rpcRecvCount.inc(1),r.subscriptions&&this.rpcRecvSubscription.inc(r.subscriptions.length),r.messages&&this.rpcRecvMessage.inc(r.messages.length),r.control&&(this.rpcRecvControl.inc(1),r.control.ihave&&this.rpcRecvIHave.inc(r.control.ihave.length),r.control.iwant&&this.rpcRecvIWant.inc(r.control.iwant.length),r.control.graft&&this.rpcRecvGraft.inc(r.control.graft.length),r.control.prune&&this.rpcRecvPrune.inc(r.control.prune.length))},onRpcSent(r,i){if(this.rpcSentBytes.inc(i),this.rpcSentCount.inc(1),r.subscriptions&&this.rpcSentSubscription.inc(r.subscriptions.length),r.messages&&this.rpcSentMessage.inc(r.messages.length),r.control){const s=r.control.ihave?.length??0,o=r.control.iwant?.length??0,a=r.control.graft?.length??0,c=r.control.prune?.length??0;s>0&&this.rpcSentIHave.inc(s),o>0&&this.rpcSentIWant.inc(o),a>0&&this.rpcSentGraft.inc(a),c>0&&this.rpcSentPrune.inc(c),(s>0||o>0||a>0||c>0)&&this.rpcSentControl.inc(1)}},registerScores(r,i){let s=0,o=0,a=0,c=0;for(const m of r)m>=i.graylistThreshold&&s++,m>=i.publishThreshold&&o++,m>=i.gossipThreshold&&a++,m>=0&&c++;this.peersByScoreThreshold.set({threshold:mc.graylist},s),this.peersByScoreThreshold.set({threshold:mc.publish},o),this.peersByScoreThreshold.set({threshold:mc.gossip},a),this.peersByScoreThreshold.set({threshold:mc.mesh},c),this.score.set(r)},registerScoreWeights(r){for(const[i,s]of r.byTopic)this.scoreWeights.set({topic:i,p:"p1"},s.p1w),this.scoreWeights.set({topic:i,p:"p2"},s.p2w),this.scoreWeights.set({topic:i,p:"p3"},s.p3w),this.scoreWeights.set({topic:i,p:"p3b"},s.p3bw),this.scoreWeights.set({topic:i,p:"p4"},s.p4w);this.scoreWeights.set({p:"p5"},r.p5w),this.scoreWeights.set({p:"p6"},r.p6w),this.scoreWeights.set({p:"p7"},r.p7w)},registerScorePerMesh(r,i){const s=new Map;r.forEach((o,a)=>{const c=this.topicStrToLabel.get(a)??"unknown";let m=s.get(c);m||(m=new Set,s.set(c,m)),o.forEach(T=>m?.add(T))});for(const[o,a]of s){const c=[];a.forEach(m=>{c.push(i.get(m)??0)}),this.scorePerMesh.set({topic:o},c)}}}}(e.metricsRegister,e.metricsTopicStrToLabel,{gossipPromiseExpireSec:this.opts.gossipsubIWantFollowupMs/1e3,behaviourPenaltyThreshold:t.scoreParams.behaviourPenaltyThreshold,maxMeshMessageDeliveriesWindowSec:r/1e3});i.mcacheSize.addCollect(()=>this.onScrapeMetrics(i));for(const s of this.multicodecs)i.protocolsEnabled.set({protocol:s},1);this.metrics=i}else this.metrics=null;this.gossipTracer=new VW(this.opts.gossipsubIWantFollowupMs,this.msgIdToStrFn,this.metrics),this.score=new UW(this.opts.scoreParams,this.metrics,{scoreCacheValidityMs:t.heartbeatInterval}),this.maxInboundStreams=e.maxInboundStreams,this.maxOutboundStreams=e.maxOutboundStreams}getPeers(){return[...this.peers.keys()].map(e=>_r(e))}isStarted(){return this.status.code===Vi.started}init(e){var t=this;return V(function*(){t.components=e,t.score.init(e)})()}start(){var e=this;return V(function*(){if(e.isStarted())return;e.log("starting"),e.publishConfig=yield function TW(n,e){return Jw.apply(this,arguments)}(e.globalSignaturePolicy,e.components.getPeerId()),e.outboundInflightQueue=lu({objectMode:!0}),Ln(e.outboundInflightQueue,function(){var o=V(function*(a){var T,c=!1,m=!1;try{for(var k,R=Tt(a);c=!(k=yield R.next()).done;c=!1){const{peerId:U,connection:Q}=k.value;yield e.createOutboundStream(U,Q)}}catch(U){m=!0,T=U}finally{try{c&&null!=R.return&&(yield R.return())}finally{if(m)throw T}}});return function(a){return o.apply(this,arguments)}}()).catch(o=>e.log.error("outbound inflight queue error",o)),yield Promise.all(e.opts.directPeers.map(function(){var o=V(function*(a){yield e.components.getPeerStore().addressBook.add(a.id,a.addrs)});return function(a){return o.apply(this,arguments)}}()));const t=e.components.getRegistrar();yield Promise.all(e.multicodecs.map(o=>t.handle(o,e.onIncomingStream.bind(e),{maxInboundStreams:e.maxInboundStreams,maxOutboundStreams:e.maxOutboundStreams})));const r=function Wz(n){return new zz(n)}({onConnect:e.onPeerConnected.bind(e),onDisconnect:e.onPeerDisconnected.bind(e)}),i=yield Promise.all(e.multicodecs.map(o=>t.register(o,r))),s=setTimeout(e.runHeartbeat,100);e.status={code:Vi.started,registrarTopologyIds:i,heartbeatTimeout:s,hearbeatStartMs:Date.now()+100},e.score.start(),e.directPeerInitial=setTimeout(()=>{Promise.resolve().then(V(function*(){yield Promise.all(Array.from(e.direct).map(function(){var o=V(function*(a){return yield e.connect(a)});return function(a){return o.apply(this,arguments)}}()))})).catch(o=>{e.log(o)})},1e3),e.log("started")})()}stop(){var e=this;return V(function*(){if(e.log("stopping"),e.status.code!==Vi.started)return;const{registrarTopologyIds:t}=e.status;e.status={code:Vi.stopped};const r=e.components.getRegistrar();t.forEach(i=>r.unregister(i)),e.outboundInflightQueue.end();for(const i of e.streamsOutbound.values())i.close();e.streamsOutbound.clear();for(const i of e.streamsInbound.values())i.close();e.streamsInbound.clear(),e.peers.clear(),e.subscriptions.clear(),e.heartbeatTimer&&(e.heartbeatTimer.cancel(),e.heartbeatTimer=null),e.score.stop(),e.mesh.clear(),e.fanout.clear(),e.fanoutLastpub.clear(),e.gossip.clear(),e.control.clear(),e.peerhave.clear(),e.iasked.clear(),e.backoff.clear(),e.outbound.clear(),e.gossipTracer.clear(),e.seenCache.clear(),e.fastMsgIdCache&&e.fastMsgIdCache.clear(),e.directPeerInitial&&clearTimeout(e.directPeerInitial),e.log("stopped")})()}dumpPeerScoreStats(){return this.score.dumpPeerScoreStats()}onIncomingStream({stream:e,connection:t}){if(!this.isStarted())return;const r=t.remotePeer;this.addPeer(r,t.stat.direction),this.createInboundStream(r,e),this.outboundInflightQueue.push({peerId:r,connection:t})}onPeerConnected(e,t){!this.isStarted()||(this.addPeer(e,t.stat.direction),this.outboundInflightQueue.push({peerId:e,connection:t}))}onPeerDisconnected(e){this.log("connection ended %p",e),this.removePeer(e)}createOutboundStream(e,t){var r=this;return V(function*(){if(!r.isStarted())return;const i=e.toString();if(r.peers.has(i)&&!r.streamsOutbound.has(i))try{const s=new XW(yield t.newStream(r.multicodecs),a=>r.log.error("outbound pipe error",a));r.log("create outbound stream %p",e),r.streamsOutbound.set(i,s);const o=s.protocol;o===rP&&r.floodsubPeers.add(i),r.metrics?.peersPerProtocol.inc({protocol:o},1),r.subscriptions.size>0&&(r.log("send subscriptions to",i),r.sendSubscriptions(i,Array.from(r.subscriptions),!0))}catch(s){r.log.error("createOutboundStream error",s)}})()}createInboundStream(e,t){var r=this;return V(function*(){if(!r.isStarted())return;const i=e.toString();if(!r.peers.has(i))return;const s=r.streamsInbound.get(i);void 0!==s&&(r.log("replacing existing inbound steam %s",i),s.close()),r.log("create inbound stream %s",i);const o=new JW(t);r.streamsInbound.set(i,o),r.pipePeerReadStream(e,o.source).catch(a=>r.log(a))})()}addPeer(e,t){const r=e.toString();this.peers.has(r)||(this.log("new peer %p",e),this.peers.add(r),this.score.addPeer(r),this.outbound.has(r)||this.outbound.set(r,"outbound"===t))}removePeer(e){const t=e.toString();if(!this.peers.has(t))return;this.log("delete peer %p",e),this.peers.delete(t);const r=this.streamsOutbound.get(t),i=this.streamsInbound.get(t);r&&this.metrics?.peersPerProtocol.inc({protocol:r.protocol},-1),r?.close(),i?.close(),this.streamsOutbound.delete(t),this.streamsInbound.delete(t);for(const s of this.topics.values())s.delete(t);for(const[s,o]of this.mesh)!0===o.delete(t)&&this.metrics?.onRemoveFromMesh(s,yc.Dc,1);for(const s of this.fanout.values())s.delete(t);this.floodsubPeers.delete(t),this.gossip.delete(t),this.control.delete(t),this.outbound.delete(t),this.score.removePeer(t),this.acceptFromWhitelist.delete(t)}get started(){return this.status.code===Vi.started}getMeshPeers(e){const t=this.mesh.get(e);return t?Array.from(t):[]}getSubscribers(e){const t=this.topics.get(e);return(t?Array.from(t):[]).map(r=>_r(r))}getTopics(){return Array.from(this.subscriptions)}pipePeerReadStream(e,t){var r=this;return V(function*(){try{yield Ln(t,function(){var i=V(function*(s){var c,o=!1,a=!1;try{for(var T,m=Tt(s);o=!(T=yield m.next()).done;o=!1){const R=T.value;try{const k=R.subarray(),U=ig.decode(k);r.metrics?.onRpcRecv(U,k.length),r.opts.awaitRpcHandler?yield r.handleReceivedRpc(e,U):r.handleReceivedRpc(e,U).catch(Q=>r.log(Q))}catch(k){r.log(k)}}}catch(R){a=!0,c=R}finally{try{o&&null!=m.return&&(yield m.return())}finally{if(a)throw c}}});return function(s){return i.apply(this,arguments)}}())}catch(i){r.log.error(i),r.onPeerDisconnected(e)}})()}handleReceivedRpc(e,t){var r=this;return V(function*(){if(!r.acceptFrom(e.toString()))return r.log("received message from unacceptable peer %p",e),void r.metrics?.rpcRecvNotAccepted.inc();if(r.log("rpc from %p",e),t.subscriptions&&t.subscriptions.length>0&&(t.subscriptions.forEach(i=>{r.handleReceivedSubscription(e,i)}),r.dispatchEvent(new rn("subscription-change",{detail:{peerId:e,subscriptions:t.subscriptions.filter(i=>null!==i.topic).map(i=>({topic:i.topic??"",subscribe:Boolean(i.subscribe)}))}}))),t.messages)for(const i of t.messages){const s=r.handleReceivedMessage(e,i).catch(o=>r.log(o));r.opts.awaitRpcMessageHandler&&(yield s)}t.control&&(yield r.handleControlMessage(e.toString(),t.control))})()}handleReceivedSubscription(e,t){if(null==t.topic)return;this.log("subscription update from %p topic %s",e,t.topic);let r=this.topics.get(t.topic);null==r&&(r=new Set,this.topics.set(t.topic,r)),t.subscribe?r.add(e.toString()):r.delete(e.toString())}handleReceivedMessage(e,t){var r=()=>super.dispatchEvent,i=this;return V(function*(){i.metrics?.onMsgRecvPreValidation(t.topic);const s=yield i.validateReceivedMessage(e,t);switch(i.metrics?.onMsgRecvResult(t.topic,s.code),s.code){case Es.duplicate:return i.score.duplicateMessage(e.toString(),s.msgIdStr,t.topic),void i.mcache.observeDuplicate(s.msgIdStr,e.toString());case Es.invalid:if(s.msgIdStr){const o=s.msgIdStr;i.score.rejectMessage(e.toString(),o,t.topic,s.reason),i.gossipTracer.rejectMessage(o,s.reason)}else i.score.rejectInvalidMessage(e.toString(),t.topic);return void i.metrics?.onMsgRecvInvalid(t.topic,s);case Es.valid:i.score.validateMessage(s.messageId.msgIdStr),i.gossipTracer.deliverMessage(s.messageId.msgIdStr),i.mcache.put(s.messageId,t,!i.opts.asyncValidation),i.subscriptions.has(t.topic)&&(!i.components.getPeerId().equals(e)||i.opts.emitSelf)&&(r().call(i,new rn("gossipsub:message",{detail:{propagationSource:e,msgId:s.messageId.msgIdStr,msg:s.msg}})),r().call(i,new rn("message",{detail:s.msg}))),i.opts.asyncValidation||i.forwardMessage(s.messageId.msgIdStr,t,e.toString())}})()}validateReceivedMessage(e,t){var r=this;return V(function*(){const i=r.fastMsgIdFn?.(t),s=i?r.fastMsgIdCache?.get(i):void 0;if(s)return{code:Es.duplicate,msgIdStr:s};const o=yield function jW(n,e){return nb.apply(this,arguments)}(r.globalSignaturePolicy,t);if(!o.valid)return{code:Es.invalid,reason:vs.Error,error:o.error};let a;try{const U=t.data??new Uint8Array(0);a=r.dataTransform?r.dataTransform.inboundTransform(t.topic,U):U}catch(U){return r.log("Invalid message, transform failed",U),{code:Es.invalid,reason:vs.Error,error:Ai.TransformFailed}}const c={from:null==t.from?void 0:pa(t.from),data:a,sequenceNumber:null==t.seqno?void 0:BigInt(`0x${Mt(t.seqno,"base16")}`),topic:t.topic},m=yield r.msgIdFn(c),T=r.msgIdToStrFn(m),R={msgId:m,msgIdStr:T};if(i&&r.fastMsgIdCache?.put(i,T),r.seenCache.has(T))return{code:Es.duplicate,msgIdStr:T};r.seenCache.put(T);const k=r.topicValidators.get(t.topic);if(null!=k){let U;try{U=yield k(c.topic,c,e)}catch(Q){const X=Q.code;"ERR_TOPIC_VALIDATOR_IGNORE"===X&&(U=fo.Ignore),U="ERR_TOPIC_VALIDATOR_REJECT"===X?fo.Reject:fo.Ignore}if(U!==fo.Accept)return{code:Es.invalid,reason:oP(U),msgIdStr:T}}return{code:Es.valid,messageId:R,msg:c}})()}getScore(e){return this.score.score(e)}sendSubscriptions(e,t,r){this.sendRpc(e,{subscriptions:t.map(i=>({topic:i,subscribe:r})),messages:[]})}handleControlMessage(e,t){var r=this;return V(function*(){if(void 0===t)return;const i=t.ihave?r.handleIHave(e,t.ihave):[],s=t.iwant?r.handleIWant(e,t.iwant):[],o=t.graft?yield r.handleGraft(e,t.graft):[];t.prune&&(yield r.handlePrune(e,t.prune)),(i.length||s.length||o.length)&&r.sendRpc(e,Wo(s,{iwant:i,prune:o}))})()}acceptFrom(e){if(this.direct.has(e))return!0;const t=Date.now(),r=this.acceptFromWhitelist.get(e);if(r&&r.messagesAccepted<128&&r.acceptUntil>=t)return r.messagesAccepted+=1,!0;const i=this.score.score(e);return i>=0?this.acceptFromWhitelist.set(e,{messagesAccepted:0,acceptUntil:t+1e3}):this.acceptFromWhitelist.delete(e),i>=this.opts.scoreThresholds.graylistThreshold}handleIHave(e,t){if(!t.length)return[];const r=this.score.score(e);if(r10)return this.log("IHAVE: peer %s has advertised too many times (%d) within this heartbeat interval; ignoring",e,i),this.metrics?.ihaveRcvIgnored.inc({reason:Xu.MaxIhave}),[];const s=this.iasked.get(e)??0;if(s>=Qu)return this.log("IHAVE: peer %s has already advertised too many messages (%d); ignoring",e,s),this.metrics?.ihaveRcvIgnored.inc({reason:Xu.MaxIasked}),[];const o=new Map;if(t.forEach(({topicID:m,messageIDs:T})=>{if(!m||!T||!this.mesh.has(m))return;let R=0;T.forEach(k=>{const U=this.msgIdToStrFn(k);this.seenCache.has(U)||(o.set(U,k),R++)}),this.metrics?.onIhaveRcv(m,T.length,R)}),!o.size)return[];let a=o.size;a+s>Qu&&(a=Qu-s),this.log("IHAVE: Asking for %d out of %d messages from %s",a,o.size,e);let c=Array.from(o.values());return qo(c),c=c.slice(0,a),this.iasked.set(e,s+a),this.gossipTracer.addPromise(e,c),[{messageIDs:c}]}handleIWant(e,t){if(!t.length)return[];const r=this.score.score(e);if(r{a&&a.forEach(c=>{const m=this.msgIdToStrFn(c),T=this.mcache.getWithIWantCount(m,e);null!=T?(s.set(T.msg.topic,1+(s.get(T.msg.topic)??0)),T.count>3?this.log("IWANT: Peer %s has asked for message %s too many times: ignoring request",e,c):i.set(m,T.msg)):o++})}),this.metrics?.onIwantRcv(s,o),i.size?(this.log("IWANT: Sending %d messages to %s",i.size,e),Array.from(i.values())):(this.log("IWANT: Could not provide any wanted messages to %s",e),[])}handleGraft(e,t){var r=this;return V(function*(){const i=[],s=r.score.score(e),o=Date.now();let a=r.opts.doPX;return t.forEach(({topicID:c})=>{if(!c)return;const m=r.mesh.get(c);if(!m)return void(a=!1);if(m.has(e))return;if(r.direct.has(e))return r.log("GRAFT: ignoring request from direct peer %s",e),i.push(c),void(a=!1);const T=r.backoff.get(c)?.get(e);return"number"==typeof T&&o=r.opts.Dhi&&!r.outbound.get(e)?(i.push(c),void r.addBackoff(e,c)):(r.log("GRAFT: Add mesh link from %s in %s",e,c),r.score.graft(e,c),m.add(e),void r.metrics?.onAddToMesh(c,Qo.Subscribed,1))}),i.length?yield Promise.all(i.map(c=>r.makePrune(e,c,a))):[]})()}handlePrune(e,t){var r=this;return V(function*(){const i=r.score.score(e);for(const{topicID:s,backoff:o,peers:a}of t){if(null==s)continue;const c=r.mesh.get(s);if(!c)return;if(r.log("PRUNE: Remove mesh link to %s in %s",e,s),r.score.prune(e,s),c.has(e)&&(c.delete(e),r.metrics?.onRemoveFromMesh(s,yc.Unsub,1)),"number"==typeof o&&o>0?r.doAddBackoff(e,s,1e3*o):r.addBackoff(e,s),a&&a.length){if(i{this.log("peer %s didn't follow up in %d IWANT requests; adding penalty",t,e),this.score.addPenalty(t,e,Zu.BrokenPromise)})}clearBackoff(){if(this.heartbeatTicks%15!=0)return;const e=Date.now();this.backoff.forEach((t,r)=>{t.forEach((i,s)=>{i{e.streamsOutbound.has(r)||t.push(r)}),yield Promise.all(t.map(function(){var r=V(function*(i){return yield e.connect(i)});return function(i){return r.apply(this,arguments)}}()))})()}pxConnect(e){var t=this;return V(function*(){e.length>t.opts.prunePeers&&(qo(e),e=e.slice(0,t.opts.prunePeers));const r=[];yield Promise.all(e.map(function(){var i=V(function*(s){if(!s.peerID)return;const o=pa(s.peerID).toString();if(!t.peers.has(o)){if(!s.signedPeerRecord)return void r.push(o);try{const a=yield Ma.openAndCertify(s.signedPeerRecord,"libp2p-peer-record"),c=a.peerId;if(!a.peerId.equals(o))return void t.log("bogus peer record obtained through px: peer ID %p doesn't match expected peer %p",c,o);if(!(yield t.components.getPeerStore().addressBook.consumePeerRecord(a)))return void t.log("bogus peer record obtained through px: could not add peer record to address book");r.push(o)}catch{t.log("bogus peer record obtained through px: invalid signature or not a peer record")}}});return function(s){return i.apply(this,arguments)}}())),r.length&&(yield Promise.all(r.map(function(){var i=V(function*(s){return yield t.connect(s)});return function(s){return i.apply(this,arguments)}}())))})()}connect(e){var t=this;return V(function*(){t.log("Initiating connection with %s",e);const r=_r(e),i=yield t.components.getConnectionManager().openConnection(r);for(const s of t.multicodecs)for(const o of t.components.getRegistrar().getTopologies(s))o.onConnect(r,i)})()}subscribe(e){if(this.status.code!==Vi.started)throw new Error("Pubsub has not started");if(!this.subscriptions.has(e)){this.subscriptions.add(e);for(const t of this.peers.keys())this.sendSubscriptions(t,[e],!0)}this.join(e)}unsubscribe(e){if(this.status.code!==Vi.started)throw new Error("Pubsub is not started");const t=this.subscriptions.delete(e);if(this.log("unsubscribe from %s - am subscribed %s",e,t),t)for(const r of this.peers.keys())this.sendSubscriptions(r,[e],!1);this.leave(e).catch(r=>{this.log(r)})}join(e){if(this.status.code!==Vi.started)throw new Error("Gossipsub has not started");if(this.mesh.has(e))return;this.log("JOIN %s",e),this.metrics?.onJoin(e);const t=new Set,r=this.fanout.get(e);if(r&&(this.fanout.delete(e),this.fanoutLastpub.delete(e),r.forEach(i=>{!this.direct.has(i)&&this.score.score(i)>=0&&t.add(i)}),this.metrics?.onAddToMesh(e,Qo.Fanout,t.size)),t.size!t.has(o)&&!this.direct.has(o)&&this.score.score(o)>=0).forEach(o=>{t.add(o)}),this.metrics?.onAddToMesh(e,Qo.Random,t.size-i)}this.mesh.set(e,t),t.forEach(i=>{this.log("JOIN: Add mesh link to %s in %s",i,e),this.sendGraft(i,e)})}leave(e){var t=this;return V(function*(){if(t.status.code!==Vi.started)throw new Error("Gossipsub has not started");t.log("LEAVE %s",e),t.metrics?.onLeave(e);const r=t.mesh.get(e);r&&(yield Promise.all(Array.from(r).map(function(){var i=V(function*(s){return t.log("LEAVE: Remove mesh link to %s in %s",s,e),yield t.sendPrune(s,e)});return function(s){return i.apply(this,arguments)}}())),t.mesh.delete(e))})()}selectPeersToForward(e,t,r){const i=new Set,s=this.topics.get(e);s&&(this.direct.forEach(a=>{s.has(a)&&t!==a&&!r?.has(a)&&i.add(a)}),this.floodsubPeers.forEach(a=>{s.has(a)&&t!==a&&!r?.has(a)&&this.score.score(a)>=this.opts.scoreThresholds.publishThreshold&&i.add(a)}));const o=this.mesh.get(e);return o&&o.size>0&&o.forEach(a=>{t!==a&&!r?.has(a)&&i.add(a)}),i}selectPeersToPublish(e){const t=new Set,r={direct:0,floodsub:0,mesh:0,fanout:0},i=this.topics.get(e);if(i)if(this.opts.floodPublish)i.forEach(s=>{this.direct.has(s)?(t.add(s),r.direct++):this.score.score(s)>=this.opts.scoreThresholds.publishThreshold&&(t.add(s),r.floodsub++)});else{this.direct.forEach(o=>{i.has(o)&&(t.add(o),r.direct++)}),this.floodsubPeers.forEach(o=>{i.has(o)&&this.score.score(o)>=this.opts.scoreThresholds.publishThreshold&&(t.add(o),r.floodsub++)});const s=this.mesh.get(e);if(s&&s.size>0)s.forEach(o=>{t.add(o),r.mesh++});else{const o=this.fanout.get(e);if(o&&o.size>0)o.forEach(a=>{t.add(a),r.fanout++});else{const a=this.getRandomGossipPeers(e,this.opts.D,c=>this.score.score(c)>=this.opts.scoreThresholds.publishThreshold);a.size>0&&(this.fanout.set(e,a),a.forEach(c=>{t.add(c),r.fanout++}))}this.fanoutLastpub.set(e,Date.now())}}return{tosend:t,tosendCount:r}}forwardMessage(e,t,r,i){r&&this.score.deliverMessage(r,e,t.topic);const s=this.selectPeersToForward(t.topic,r,i),o=Wo([t]);s.forEach(a=>{this.sendRpc(a,o)}),this.metrics?.onForwardMsg(t.topic,s.size)}publish(e,t){var r=()=>super.dispatchEvent,i=this;return V(function*(){const s=i.dataTransform?i.dataTransform.outboundTransform(e,t):t;if(null==i.publishConfig)throw Error("PublishError.Uninitialized");const o=yield function KW(n,e,t){return tb.apply(this,arguments)}(i.publishConfig,e,s),a={from:o.from?pa(o.from):void 0,data:t,sequenceNumber:null==o.seqno?void 0:BigInt(`0x${Mt(o.seqno,"base16")}`),topic:e,signature:o.signature??void 0,key:o.key??void 0},c=yield i.msgIdFn(a),m=i.msgIdToStrFn(c);if(i.seenCache.has(m))throw Error("PublishError.Duplicate");const{tosend:T,tosendCount:R}=i.selectPeersToPublish(o.topic),k=!0===i.opts.emitSelf&&i.subscriptions.has(e);if(0===T.size&&!i.opts.allowPublishToZeroPeers&&!k)throw Error("PublishError.InsufficientPeers");i.seenCache.put(m),i.mcache.put({msgId:c,msgIdStr:m},o,!0),i.publishedMessageIds.put(m);const U=Wo([o]);for(const Q of T)i.sendRpc(Q,U)||T.delete(Q);return i.metrics?.onPublishMsg(e,R,T.size,null!=o.data?o.data.length:0),k&&(T.add(i.components.getPeerId().toString()),r().call(i,new rn("gossipsub:message",{detail:{propagationSource:i.components.getPeerId(),msgId:m,msg:a}})),r().call(i,new rn("message",{detail:a}))),{recipients:Array.from(T.values()).map(Q=>_r(Q))}})()}reportMessageValidationResult(e,t,r){if(r===fo.Accept){const i=this.mcache.validate(e);if(this.metrics?.onReportValidationMcacheHit(null!==i),null!=i){const{message:s,originatingPeers:o}=i;this.score.deliverMessage(t.toString(),e,s.topic),this.forwardMessage(e,i.message,t.toString(),o),this.metrics?.onReportValidation(s.topic,r)}}else{const i=this.mcache.remove(e);if(this.metrics?.onReportValidationMcacheHit(null!==i),i){const s=oP(r),{message:o,originatingPeers:a}=i;this.score.rejectMessage(t.toString(),e,o.topic,s);for(const c of a)this.score.rejectMessage(c,e,o.topic,s);this.metrics?.onReportValidation(o.topic,r)}}}sendGraft(e,t){const i=Wo([],{graft:[{topicID:t}]});this.sendRpc(e,i)}sendPrune(e,t){var r=this;return V(function*(){const s=Wo([],{prune:[yield r.makePrune(e,t,r.opts.doPX)]});r.sendRpc(e,s)})()}sendRpc(e,t){const r=this.streamsOutbound.get(e);if(!r)return this.log(`Cannot send RPC to ${e} as there is no open stream to it available`),!1;const i=this.control.get(e);i&&(this.piggybackControl(e,t,i),this.control.delete(e));const s=this.gossip.get(e);s&&(this.piggybackGossip(e,t,s),this.gossip.delete(e));const o=ig.encode(t).finish();return r.push(o),this.metrics?.onRpcSent(t,o.length),!0}piggybackControl(e,t,r){const i=(r.graft||[]).filter(({topicID:o})=>(o&&this.mesh.get(o)||new Set).has(e)),s=(r.prune||[]).filter(({topicID:o})=>!(o&&this.mesh.get(o)||new Set).has(e));!i.length&&!s.length||(t.control?(t.control.graft=t.control.graft&&t.control.graft.concat(i),t.control.prune=t.control.prune&&t.control.prune.concat(s)):t.control={graft:i,prune:s,ihave:[],iwant:[]})}piggybackGossip(e,t,r){t.control||(t.control={ihave:[],iwant:[],graft:[],prune:[]}),t.control.ihave=r}sendGraftPrune(e,t,r){var i=this;return V(function*(){const s=i.opts.doPX;for(const[o,a]of e){const c=a.map(k=>({topicID:k}));let m=[];const T=t.get(o);T&&(m=yield Promise.all(T.map(function(){var k=V(function*(U){return yield i.makePrune(o,U,s&&!r.get(o))});return function(U){return k.apply(this,arguments)}}())),t.delete(o));const R=Wo([],{graft:c,prune:m});i.sendRpc(o,R)}for(const[o,a]of t){const c=yield Promise.all(a.map(function(){var T=V(function*(R){return yield i.makePrune(o,R,s&&!r.get(o))});return function(R){return T.apply(this,arguments)}}())),m=Wo([],{prune:c});i.sendRpc(o,m)}})()}emitGossip(e){const t=this.mcache.getGossipIDs(new Set(e.keys()));for(const[r,i]of e)this.doEmitGossip(r,i,t.get(r)??[])}doEmitGossip(e,t,r){if(!r.length||(qo(r),r.length>Qu&&this.log("too many messages for gossip; will truncate IHAVE list (%d messages)",r.length),!t.size))return;let i=this.opts.Dlazy;const s=.25*t.size;let o=t;s>i&&(i=s),i>o.size?i=o.size:o=qo(Array.from(o)).slice(0,i),o.forEach(a=>{let c=r;r.length>Qu&&(c=qo(c.slice()).slice(0,Qu)),this.pushGossip(a,{topicID:e,messageIDs:c})})}flush(){for(const[e,t]of this.gossip.entries())this.gossip.delete(e),this.sendRpc(e,Wo([],{ihave:t}));for(const[e,t]of this.control.entries())this.control.delete(e),this.sendRpc(e,Wo([],{graft:t.graft,prune:t.prune}))}pushGossip(e,t){this.log("Add gossip to %s",e);const r=this.gossip.get(e)||[];this.gossip.set(e,r.concat(t))}makePrune(e,t,r){var i=this;return V(function*(){if(i.score.prune(e,t),i.streamsOutbound.get(e).protocol===iP)return{topicID:t,peers:[]};const s=i.opts.pruneBackoff/1e3;if(!r)return{topicID:t,peers:[],backoff:s};const o=i.getRandomGossipPeers(t,i.opts.prunePeers,c=>c!==e&&i.score.score(c)>=0),a=yield Promise.all(Array.from(o).map(function(){var c=V(function*(m){const T=_r(m);return{peerID:T.toBytes(),signedPeerRecord:yield i.components.getPeerStore().addressBook.getRawEnvelope(T)}});return function(m){return c.apply(this,arguments)}}()));return{topicID:t,peers:a,backoff:s}})()}heartbeat(){var e=this;return V(function*(){const{D:t,Dlo:r,Dhi:i,Dscore:s,Dout:o,fanoutTTL:a}=e.opts;e.heartbeatTicks++;const c=new Map,m=X=>{let ae=c.get(X);return void 0===ae&&(ae=e.score.score(X),c.set(X,ae)),ae},T=new Map,R=new Map,k=new Map;e.clearBackoff(),e.peerhave.clear(),e.metrics?.cacheSize.set({cache:"iasked"},e.iasked.size),e.iasked.clear(),e.applyIwantPenalties(),e.heartbeatTicks%e.opts.directConnectTicks==0&&(yield e.directConnect()),e.fastMsgIdCache?.prune(),e.seenCache.prune(),e.gossipTracer.prune(),e.publishedMessageIds.prune();const U=new Map;e.mesh.forEach((X,ae)=>{const he=e.topics.get(ae),Ae=new Set,ue=new Set;if(U.set(ae,ue),he){const Fe=qo(Array.from(he)),wt=e.backoff.get(ae);for(const mt of Fe){const Zt=e.streamsOutbound.get(mt);if(Zt&&e.multicodecs.includes(Zt.protocol)&&!X.has(mt)&&!e.direct.has(mt)){const wn=m(mt);(!wt||!wt.has(mt))&&wn>=0&&Ae.add(mt),wn>=e.opts.scoreThresholds.gossipThreshold&&ue.add(mt)}}}const Re=(Fe,wt)=>{e.log("HEARTBEAT: Remove mesh link to %s in %s",Fe,ae),e.addBackoff(Fe,ae),X.delete(Fe),m(Fe)>=e.opts.scoreThresholds.gossipThreshold&&ue.add(Fe),e.metrics?.onRemoveFromMesh(ae,wt,1);const mt=R.get(Fe);mt?mt.push(ae):R.set(Fe,[ae])},Le=(Fe,wt)=>{e.log("HEARTBEAT: Add mesh link to %s in %s",Fe,ae),e.score.graft(Fe,ae),X.add(Fe),ue.delete(Fe),e.metrics?.onAddToMesh(ae,wt,1);const mt=T.get(Fe);mt?mt.push(ae):T.set(Fe,[ae])};if(X.forEach(Fe=>{const wt=m(Fe);wt<0&&(e.log("HEARTBEAT: Prune peer %s with negative score: score=%d, topic=%s",Fe,wt,ae),Re(Fe,yc.BadScore),k.set(Fe,!0))}),X.size!0)}(Ae,t-X.size).forEach(mt=>{Le(mt,Qo.NotEnough)}),X.size>i){let Fe=Array.from(X);Fe.sort((mt,Zt)=>m(Zt)-m(mt)),Fe=Fe.slice(0,s).concat(qo(Fe.slice(s)));let wt=0;if(Fe.slice(0,t).forEach(mt=>{e.outbound.get(mt)&&wt++}),wt{const zr=Fe[wn];for(let Rn=wn;Rn>0;Rn--)Fe[Rn]=Fe[Rn-1];Fe[0]=zr};if(wt>0){let wn=wt;for(let zr=1;zr0;zr++)e.outbound.get(Fe[zr])&&(mt(zr),wn--)}let Zt=t-wt;for(let wn=t;wn0;wn++)e.outbound.get(Fe[wn])&&(mt(wn),Zt--)}Fe.slice(t).forEach(mt=>{Re(mt,yc.Excess)})}if(X.size>=r){let Fe=0;X.forEach(wt=>{e.outbound.get(wt)&&Fe++}),Fe!0===e.outbound.get(Zt)).forEach(Zt=>{Le(Zt,Qo.Outbound)})}if(e.heartbeatTicks%e.opts.opportunisticGraftTicks==0&&X.size>1){const Fe=Array.from(X).sort((Zt,wn)=>m(Zt)-m(wn)),wt=Math.floor(X.size/2),mt=m(Fe[wt]);if(mtm(zr)>mt);for(const zr of wn)e.log("HEARTBEAT: Opportunistically graft peer %s on topic %s",zr,ae),Le(zr,Qo.Opportunistic)}}});const Q=Date.now();e.fanoutLastpub.forEach((X,ae)=>{X+a{const he=e.topics.get(ae);X.forEach(Le=>{(!he.has(Le)||m(Le)=e.opts.scoreThresholds.publishThreshold&&ue.push(Fe),mt>=e.opts.scoreThresholds.gossipThreshold&&Re.add(Fe)}}}X.size{X.add(Fe),Re?.delete(Fe)})}),e.emitGossip(U),yield e.sendGraftPrune(T,R,k),e.flush(),e.mcache.shift(),e.dispatchEvent(new rn("gossipsub:heartbeat"))})()}getRandomGossipPeers(e,t,r=(()=>!0)){const i=this.topics.get(e);if(!i)return new Set;let s=[];return i.forEach(o=>{const a=this.streamsOutbound.get(o);!a||this.multicodecs.includes(a.protocol)&&r(o)&&s.push(o)}),s=qo(s),t>0&&s.length>t&&(s=s.slice(0,t)),new Set(s)}onScrapeMetrics(e){e.mcacheSize.set(this.mcache.size),e.cacheSize.set({cache:"direct"},this.direct.size),e.cacheSize.set({cache:"seenCache"},this.seenCache.size),e.cacheSize.set({cache:"fastMsgIdCache"},this.fastMsgIdCache?.size??0),e.cacheSize.set({cache:"publishedMessageIds"},this.publishedMessageIds.size),e.cacheSize.set({cache:"mcache"},this.mcache.size),e.cacheSize.set({cache:"score"},this.score.size),e.cacheSize.set({cache:"gossipTracer.promises"},this.gossipTracer.size),e.cacheSize.set({cache:"gossipTracer.requests"},this.gossipTracer.requestMsByMsgSize),e.cacheSize.set({cache:"topics"},this.topics.size),e.cacheSize.set({cache:"subscriptions"},this.subscriptions.size),e.cacheSize.set({cache:"mesh"},this.mesh.size),e.cacheSize.set({cache:"fanout"},this.fanout.size),e.cacheSize.set({cache:"peers"},this.peers.size),e.cacheSize.set({cache:"streamsOutbound"},this.streamsOutbound.size),e.cacheSize.set({cache:"streamsInbound"},this.streamsInbound.size),e.cacheSize.set({cache:"acceptFromWhitelist"},this.acceptFromWhitelist.size),e.cacheSize.set({cache:"gossip"},this.gossip.size),e.cacheSize.set({cache:"control"},this.control.size),e.cacheSize.set({cache:"peerhave"},this.peerhave.size),e.cacheSize.set({cache:"outbound"},this.outbound.size);let t=0;for(const o of this.backoff.values())t+=o.size;e.cacheSize.set({cache:"backoff"},t);for(const[o,a]of this.topics)e.topicPeersCount.set({topicStr:o},a.size);for(const[o,a]of this.mesh)e.meshPeerCounts.set({topicStr:o},a.size);const r=[],i=new Map;e.behaviourPenalty.reset();for(const o of this.peers.keys()){const a=this.score.score(o);r.push(a),i.set(o,a),e.behaviourPenalty.observe(this.score.peerStats.get(o)?.behaviourPenalty??0)}e.registerScores(r,this.opts.scoreThresholds),e.registerScorePerMesh(this.mesh,i);const s=function YW(n,e,t,r,i){const s={byTopic:new Map,p5w:[],p6w:[],p7w:[],score:[]};for(const o of n){const a=e.get(o);if(a){const c=QW(o,a,t,r,i);for(const[m,T]of c.byTopic){let R=s.byTopic.get(m);R||(R={p1w:[],p2w:[],p3w:[],p3bw:[],p4w:[]},s.byTopic.set(m,R)),R.p1w.push(T.p1w),R.p2w.push(T.p2w),R.p3w.push(T.p3w),R.p3bw.push(T.p3bw),R.p4w.push(T.p4w)}s.p5w.push(c.p5w),s.p6w.push(c.p6w),s.p7w.push(c.p7w),s.score.push(c.score)}else s.p5w.push(0),s.p6w.push(0),s.p7w.push(0),s.score.push(0)}return s}(this.peers.keys(),this.score.peerStats,this.score.params,this.score.peerIPs,e.topicStrToLabel);e.registerScoreWeights(s)}}cP.multicodec=Zw;const sb=Ur("waku:relay");class uP extends cP{constructor(e){super(e=Object.assign(e??{},{globalSignaturePolicy:og.StrictNoSign,fallbackToFloodsub:!1})),this.multicodecs=Hw,this.observers={},this.decryptionKeys=new Map,this.pubSubTopic=e?.pubSubTopic??kp,e?.decryptionKeys?.forEach(t=>{this.addDecryptionKey(t)})}start(){var e=()=>super.start,t=this;return V(function*(){yield e().call(t),t.subscribe(t.pubSubTopic)})()}send(e){var t=this;return V(function*(){const r=e.encode();yield t.publish(t.pubSubTopic,r)})()}addDecryptionKey(e,t){this.decryptionKeys.set(Gs(e),t??{})}deleteDecryptionKey(e){this.decryptionKeys.delete(Gs(e))}addObserver(e,t=[]){0===t.length?(this.observers[""]||(this.observers[""]=new Set),this.observers[""].add(e)):t.forEach(r=>{this.observers[r]||(this.observers[r]=new Set),this.observers[r].add(e)})}deleteObserver(e,t=[]){0===t.length?this.observers[""]&&this.observers[""].delete(e):t.forEach(r=>{this.observers[r]&&this.observers[r].delete(e)})}subscribe(e){this.addEventListener("gossipsub:message",t=>{if(t.detail.msg.topic===e){const r=Array.from(this.decryptionKeys).map(([i,{method:s,contentTopics:o}])=>({key:i,method:s,contentTopics:o}));sb(`Message received on ${e}`),uo.decode(t.detail.msg.data,r).then(i=>{i?(this.observers[""]&&this.observers[""].forEach(s=>{s(i)}),i.contentTopic&&this.observers[i.contentTopic]&&this.observers[i.contentTopic].forEach(s=>{s(i)})):sb("Failed to decode Waku Message")}).catch(i=>{sb("Failed to decode Waku Message",i)})}}),super.subscribe(e)}getMeshPeers(e){return super.getMeshPeers(e??this.pubSubTopic)}}function ob(){return ob=V(function*(n){const e=n?.libp2p??{},t=e.peerDiscovery??[];n?.defaultBootstrap&&(t.push(tq()),Object.assign(e,{peerDiscovery:t}));const r=yield nq(new uP(n),e),i=new qG(r,n),s=new jG(r,n),o=new KG(r,n);return new ZG(n??{},r,i,s,o)}),ob.apply(this,arguments)}function tq(){return new i$(function o$(n=Uu.Prod,e=1){if(e<=0)return[];let t;switch(n){case Uu.Prod:t=pw_fleets["wakuv2.prod"]["waku-websocket"];break;case Uu.Test:t=pw_fleets["wakuv2.test"]["waku-websocket"];break;default:t=pw_fleets["wakuv2.prod"]["waku-websocket"]}return t=Object.values(t),t=t.map(r=>new vn(r)),sR(t,e)}())}function nq(n,e){return ab.apply(this,arguments)}function ab(){return ab=V(function*(n,e){return t$(Object.assign({transports:[new pH({filter:OA})],streamMuxers:[new r9],connectionEncryption:[new GT]},{pubsub:n},e??{}))}),ab.apply(this,arguments)}uP.multicodec=Hw[0];function iq(n,e,t){"function"==typeof t&&(t={filter:t});const r=function rq(n,e,t){let r;const i=new Promise((s,o)=>{if(!((t={rejectionEvents:["error"],multiArgs:!1,resolveImmediately:!1,...t}).count>=0)||t.count!==Number.POSITIVE_INFINITY&&!Number.isInteger(t.count))throw new TypeError("The `count` option should be at least 0 or more");const a=[e].flat(),c=[],{addListener:m,removeListener:T}=(n=>{const e=n.on||n.addListener||n.addEventListener,t=n.off||n.removeListener||n.removeEventListener;if(!e||!t)throw new TypeError("Emitter is not compatible");return{addListener:e.bind(n),removeListener:t.bind(n)}})(n),R=(...U)=>{const Q=t.multiArgs?U:U[0];t.filter&&!t.filter(Q)||(c.push(Q),t.count===c.length&&(r(),s(c)))},k=U=>{r(),o(U)};r=()=>{for(const U of a)T(U,R);for(const U of t.rejectionEvents)T(U,k)};for(const U of a)m(U,R);for(const U of t.rejectionEvents)m(U,k);t.resolveImmediately&&s(c)});if(i.cancel=r,"number"==typeof t.timeout){const s=Mx(i,t.timeout);return s.cancel=r,s}return i}(n,e,t={...t,count:1,resolveImmediately:!1}),i=r.then(s=>s[0]);return i.cancel=r.cancel,i}const fP=Ur("waku:wait-for-remote-peer");function cb(){return cb=V(function*(n,e,t){if(e=e??[es.Relay],!n.isStarted())return Promise.reject("Waku node is not started");const r=[];e.includes(es.Relay)&&r.push(oq(n.relay)),e.includes(es.Store)&&r.push(ub(n.store,Object.values(lc))),e.includes(es.LightPush)&&r.push(ub(n.lightPush,[zf])),e.includes(es.Filter)&&r.push(ub(n.filter,[jf])),t?yield cq(Promise.all(r),t,"Timed out waiting for a remote peer."):yield Promise.all(r)}),cb.apply(this,arguments)}function ub(n,e){return lb.apply(this,arguments)}function lb(){return lb=V(function*(n,e){const t=yield n.peers();t.length?fP(`${e} peer found: `,t[0].id.toString()):yield new Promise(r=>{const i=s=>{for(const o of e)if(s.detail.protocols.includes(o)){fP("Resolving for",o,s.detail.protocols),n.libp2p.peerStore.removeEventListener("change:protocols",i),r();break}};n.libp2p.peerStore.addEventListener("change:protocols",i)})}),lb.apply(this,arguments)}function oq(n){return fb.apply(this,arguments)}function fb(){return fb=V(function*(n){let e=n.getMeshPeers();for(;0==e.length;)yield iq(n,"gossipsub:heartbeat"),e=n.getMeshPeers()}),fb.apply(this,arguments)}const aq=(n,e)=>new Promise((t,r)=>setTimeout(()=>r(e),n));function cq(n,e,t){return db.apply(this,arguments)}function db(){return db=V(function*(n,e,t){yield Promise.race([n,aq(e,t)])}),db.apply(this,arguments)}let dP=(()=>{class n{constructor(){this.wakuSubject=new Sr,this.waku=this.wakuSubject.asObservable(),this.wakuStatusSubject=new _5(""),this.wakuStatus=this.wakuStatusSubject.asObservable()}init(){(function eq(n){return ob.apply(this,arguments)})({defaultBootstrap:!0}).then(t=>{t.start().then(()=>{this.wakuSubject.next(t),this.wakuStatusSubject.next("Connecting..."),function sq(n,e,t){return cb.apply(this,arguments)}(t).then(()=>{this.wakuStatusSubject.next("Connected")})})})}}return n.\u0275fac=function(t){return new(t||n)},n.\u0275prov=Jn({token:n,factory:n.\u0275fac,providedIn:"root"}),n})();function lq(n,e){if(1&n&&(bo(0,"li")(1,"span"),ru(2),_o()()),2&n){const t=e.$implicit;Cl(2),u0("",t.timestamp," ",t.text,"")}}Ur("waku:enr");const vb=new(Dm().Type)("ChatMessage").add(new(Dm().Field)("timestamp",1,"uint32")).add(new(Dm().Field)("text",2,"string"));let fq=(()=>{class n{constructor(t){this.wakuService=t,this.contentTopic="/relay-angular-chat/1/chat/proto",this.messages=[],this.messageCount=0,this.processIncomingMessages=r=>{if(!r.payload)return;const{text:i,timestamp:s}=vb.decode(r.payload),o=new Date;o.setTime(Number(s)),this.messages.push({text:i,timestamp:o})}}ngOnInit(){this.wakuService.wakuStatus.subscribe(t=>{this.wakuStatus=t}),this.wakuService.waku.subscribe(t=>{this.waku=t,this.waku.relay.addObserver(this.processIncomingMessages,[this.contentTopic])}),window.onbeforeunload=()=>this.ngOnDestroy()}ngOnDestroy(){this.waku.relay.deleteObserver(this.processIncomingMessages,[this.contentTopic])}sendMessage(){const t=(new Date).getTime(),r=vb.create({timestamp:t,text:`Here is a message #${this.messageCount}`}),i=vb.encode(r).finish();uo.fromBytes(i,this.contentTopic).then(s=>{this.waku.relay.send(s).then(()=>{console.log(`Message #${this.messageCount} sent`),this.messageCount+=1})})}}return n.\u0275fac=function(t){return new(t||n)(qt(dP))},n.\u0275cmp=td({type:n,selectors:[["app-messages"]],decls:6,vars:2,consts:[[3,"disabled","click"],[1,"messages"],[4,"ngFor","ngForOf"]],template:function(t,r){1&t&&(bo(0,"button",0),s0("click",function(){return r.sendMessage()}),ru(1,"Send Message"),_o(),bo(2,"h2"),ru(3,"Messages"),_o(),bo(4,"ul",1),function AD(n,e,t,r,i,s,o,a){const c=Ve(),m=pn(),T=n+22,R=m.firstCreatePass?function aL(n,e,t,r,i,s,o,a,c){const m=e.consts,T=Gc(e,n,4,o||null,ea(m,a));jy(e,t,T,ea(m,c)),fd(e,T);const R=T.tViews=Ky(2,T,r,i,s,e.directiveRegistry,e.pipeRegistry,null,e.schemas,m);return null!==e.queries&&(e.queries.template(e,T),R.queries=e.queries.embeddedTView(T)),T}(T,m,c,e,t,r,i,s,o):m.data[T];Ws(R,!1);const k=c[11].createComment("");Ld(m,c,k,R),si(k,c),jd(c,c[T]=uD(k,c,k,R)),od(R)&&Vy(m,c,R),null!=o&&Hy(c,R,a)}(5,lq,3,2,"li",2),_o()),2&t&&(qd("disabled","Connected"!==r.wakuStatus),Cl(5),qd("ngForOf",r.messages))},dependencies:[DC]}),n})(),dq=(()=>{class n{constructor(t){this.wakuService=t,this.title="relay-angular-chat"}ngOnInit(){this.wakuService.init(),this.wakuService.wakuStatus.subscribe(t=>{this.wakuStatus=t})}}return n.\u0275fac=function(t){return new(t||n)(qt(dP))},n.\u0275cmp=td({type:n,selectors:[["app-root"]],decls:5,vars:2,template:function(t,r){1&t&&(bo(0,"h1"),ru(1),_o(),bo(2,"p"),ru(3),_o(),e0(4,"app-messages")),2&t&&(Cl(1),c0(r.title),Cl(2),Yd("Waku node's status: ",r.wakuStatus,""))},dependencies:[fq],styles:["h1[_ngcontent-%COMP%]{color:#369;font-family:Arial,Helvetica,sans-serif;font-size:250%}h2[_ngcontent-%COMP%], h3[_ngcontent-%COMP%]{color:#444;font-family:Arial,Helvetica,sans-serif;font-weight:lighter}body[_ngcontent-%COMP%]{margin:2em}body[_ngcontent-%COMP%], input[type=text][_ngcontent-%COMP%], button[_ngcontent-%COMP%]{color:#333;font-family:Cambria,Georgia,serif}*[_ngcontent-%COMP%]{font-family:Arial,Helvetica,sans-serif}"]}),n})(),hq=(()=>{class n{}return n.\u0275fac=function(t){return new(t||n)},n.\u0275mod=nl({type:n,bootstrap:[dq]}),n.\u0275inj=vc({imports:[d5]}),n})();N(8583),function Bk(){tC=!1}(),f5().bootstrapModule(hq).catch(n=>console.error(n))},1280:J=>{"use strict";J.exports=function G(N,h){for(var u=new Array(arguments.length-1),g=0,b=2,w=!0;b{"use strict";var N=G;N.length=function(v){var l=v.length;if(!l)return 0;for(var p=0;--l%4>1&&"="===v.charAt(l);)++p;return Math.ceil(3*v.length)/4-p};for(var h=new Array(64),u=new Array(123),g=0;g<64;)u[h[g]=g<26?g+65:g<52?g+71:g<62?g-4:g-59|43]=g++;N.encode=function(v,l,p){for(var y,d=null,_=[],I=0,E=0;l>2],y=(3&f)<<4,E=1;break;case 1:_[I++]=h[y|f>>4],y=(15&f)<<2,E=2;break;case 2:_[I++]=h[y|f>>6],_[I++]=h[63&f],E=0}I>8191&&((d||(d=[])).push(String.fromCharCode.apply(String,_)),I=0)}return E&&(_[I++]=h[y],_[I++]=61,1===E&&(_[I++]=61)),d?(I&&d.push(String.fromCharCode.apply(String,_.slice(0,I))),d.join("")):String.fromCharCode.apply(String,_.slice(0,I))};var b="invalid encoding";N.decode=function(v,l,p){for(var I,d=p,_=0,E=0;E1)break;if(void 0===(y=u[y]))throw Error(b);switch(_){case 0:I=y,_=1;break;case 1:l[p++]=I<<2|(48&y)>>4,I=y,_=2;break;case 2:l[p++]=(15&I)<<4|(60&y)>>2,I=y,_=3;break;case 3:l[p++]=(3&I)<<6|y,_=0}}if(1===_)throw Error(b);return p-d},N.test=function(v){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(v)}},9749:J=>{"use strict";function G(N,h){"string"==typeof N&&(h=N,N=void 0);var u=[];function g(w){if("string"!=typeof w){var v=b();if(G.verbose&&console.log("codegen: "+v),v="return "+v,w){for(var l=Object.keys(w),p=new Array(l.length+1),d=new Array(l.length),_=0;_{"use strict";function G(){this._listeners={}}J.exports=G,G.prototype.on=function(h,u,g){return(this._listeners[h]||(this._listeners[h]=[])).push({fn:u,ctx:g||this}),this},G.prototype.off=function(h,u){if(void 0===h)this._listeners={};else if(void 0===u)this._listeners[h]=[];else for(var g=this._listeners[h],b=0;b{"use strict";J.exports=b;var h=N(1280),g=N(716)("fs");function b(w,v,l){return"function"==typeof v?(l=v,v={}):v||(v={}),l?!v.xhr&&g&&g.readFile?g.readFile(w,function(d,_){return d&&typeof XMLHttpRequest<"u"?b.xhr(w,v,l):d?l(d):l(null,v.binary?_:_.toString("utf8"))}):b.xhr(w,v,l):h(b,this,w,v)}b.xhr=function(v,l,p){var d=new XMLHttpRequest;d.onreadystatechange=function(){if(4===d.readyState){if(0!==d.status&&200!==d.status)return p(Error("status "+d.status));if(l.binary){var I=d.response;if(!I){I=[];for(var E=0;E{"use strict";function G(b){return typeof Float32Array<"u"?function(){var w=new Float32Array([-0]),v=new Uint8Array(w.buffer),l=128===v[3];function p(E,y,f){w[0]=E,y[f]=v[0],y[f+1]=v[1],y[f+2]=v[2],y[f+3]=v[3]}function d(E,y,f){w[0]=E,y[f]=v[3],y[f+1]=v[2],y[f+2]=v[1],y[f+3]=v[0]}function _(E,y){return v[0]=E[y],v[1]=E[y+1],v[2]=E[y+2],v[3]=E[y+3],w[0]}function I(E,y){return v[3]=E[y],v[2]=E[y+1],v[1]=E[y+2],v[0]=E[y+3],w[0]}b.writeFloatLE=l?p:d,b.writeFloatBE=l?d:p,b.readFloatLE=l?_:I,b.readFloatBE=l?I:_}():function(){function w(l,p,d,_){var I=p<0?1:0;if(I&&(p=-p),0===p)l(1/p>0?0:2147483648,d,_);else if(isNaN(p))l(2143289344,d,_);else if(p>34028234663852886e22)l((I<<31|2139095040)>>>0,d,_);else if(p<11754943508222875e-54)l((I<<31|Math.round(p/1401298464324817e-60))>>>0,d,_);else{var E=Math.floor(Math.log(p)/Math.LN2);l((I<<31|E+127<<23|8388607&Math.round(p*Math.pow(2,-E)*8388608))>>>0,d,_)}}function v(l,p,d){var _=l(p,d),I=2*(_>>31)+1,E=_>>>23&255,y=8388607&_;return 255===E?y?NaN:I*(1/0):0===E?1401298464324817e-60*I*y:I*Math.pow(2,E-150)*(y+8388608)}b.writeFloatLE=w.bind(null,N),b.writeFloatBE=w.bind(null,h),b.readFloatLE=v.bind(null,u),b.readFloatBE=v.bind(null,g)}(),typeof Float64Array<"u"?function(){var w=new Float64Array([-0]),v=new Uint8Array(w.buffer),l=128===v[7];function p(E,y,f){w[0]=E,y[f]=v[0],y[f+1]=v[1],y[f+2]=v[2],y[f+3]=v[3],y[f+4]=v[4],y[f+5]=v[5],y[f+6]=v[6],y[f+7]=v[7]}function d(E,y,f){w[0]=E,y[f]=v[7],y[f+1]=v[6],y[f+2]=v[5],y[f+3]=v[4],y[f+4]=v[3],y[f+5]=v[2],y[f+6]=v[1],y[f+7]=v[0]}function _(E,y){return v[0]=E[y],v[1]=E[y+1],v[2]=E[y+2],v[3]=E[y+3],v[4]=E[y+4],v[5]=E[y+5],v[6]=E[y+6],v[7]=E[y+7],w[0]}function I(E,y){return v[7]=E[y],v[6]=E[y+1],v[5]=E[y+2],v[4]=E[y+3],v[3]=E[y+4],v[2]=E[y+5],v[1]=E[y+6],v[0]=E[y+7],w[0]}b.writeDoubleLE=l?p:d,b.writeDoubleBE=l?d:p,b.readDoubleLE=l?_:I,b.readDoubleBE=l?I:_}():function(){function w(l,p,d,_,I,E){var y=_<0?1:0;if(y&&(_=-_),0===_)l(0,I,E+p),l(1/_>0?0:2147483648,I,E+d);else if(isNaN(_))l(0,I,E+p),l(2146959360,I,E+d);else if(_>17976931348623157e292)l(0,I,E+p),l((y<<31|2146435072)>>>0,I,E+d);else{var f;if(_<22250738585072014e-324)l((f=_/5e-324)>>>0,I,E+p),l((y<<31|f/4294967296)>>>0,I,E+d);else{var C=Math.floor(Math.log(_)/Math.LN2);1024===C&&(C=1023),l(4503599627370496*(f=_*Math.pow(2,-C))>>>0,I,E+p),l((y<<31|C+1023<<20|1048576*f&1048575)>>>0,I,E+d)}}}function v(l,p,d,_,I){var E=l(_,I+p),y=l(_,I+d),f=2*(y>>31)+1,C=y>>>20&2047,A=4294967296*(1048575&y)+E;return 2047===C?A?NaN:f*(1/0):0===C?5e-324*f*A:f*Math.pow(2,C-1075)*(A+4503599627370496)}b.writeDoubleLE=w.bind(null,N,0,4),b.writeDoubleBE=w.bind(null,h,4,0),b.readDoubleLE=v.bind(null,u,0,4),b.readDoubleBE=v.bind(null,g,4,0)}(),b}function N(b,w,v){w[v]=255&b,w[v+1]=b>>>8&255,w[v+2]=b>>>16&255,w[v+3]=b>>>24}function h(b,w,v){w[v]=b>>>24,w[v+1]=b>>>16&255,w[v+2]=b>>>8&255,w[v+3]=255&b}function u(b,w){return(b[w]|b[w+1]<<8|b[w+2]<<16|b[w+3]<<24)>>>0}function g(b,w){return(b[w]<<24|b[w+1]<<16|b[w+2]<<8|b[w+3])>>>0}J.exports=G(G)},716:module=>{"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(J){}return null}module.exports=inquire},1311:(J,G)=>{"use strict";var N=G,h=N.isAbsolute=function(b){return/^(?:\/|\w+:)/.test(b)},u=N.normalize=function(b){var w=(b=b.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),v=h(b),l="";v&&(l=w.shift()+"/");for(var p=0;p0&&".."!==w[p-1]?w.splice(--p,2):v?w.splice(p,1):++p:"."===w[p]?w.splice(p,1):++p;return l+w.join("/")};N.resolve=function(b,w,v){return v||(w=u(w)),h(w)?w:(v||(b=u(b)),(b=b.replace(/(?:\/|^)[^/]+$/,"")).length?u(b+"/"+w):w)}},4479:J=>{"use strict";J.exports=function G(N,h,u){var g=u||8192,b=g>>>1,w=null,v=g;return function(p){if(p<1||p>b)return N(p);v+p>g&&(w=N(g),v=0);var d=h.call(w,v,v+=p);return 7&v&&(v=1+(7|v)),d}}},7768:(J,G)=>{"use strict";var N=G;N.length=function(u){for(var g=0,b=0,w=0;w191&&d<224?l[p++]=(31&d)<<6|63&u[g++]:d>239&&d<365?(d=((7&d)<<18|(63&u[g++])<<12|(63&u[g++])<<6|63&u[g++])-65536,l[p++]=55296+(d>>10),l[p++]=56320+(1023&d)):l[p++]=(15&d)<<12|(63&u[g++])<<6|63&u[g++],p>8191&&((v||(v=[])).push(String.fromCharCode.apply(String,l)),p=0);return v?(p&&v.push(String.fromCharCode.apply(String,l.slice(0,p))),v.join("")):String.fromCharCode.apply(String,l.slice(0,p))},N.write=function(u,g,b){for(var v,l,w=b,p=0;p>6|192,g[b++]=63&v|128):55296==(64512&v)&&56320==(64512&(l=u.charCodeAt(p+1)))?(++p,g[b++]=(v=65536+((1023&v)<<10)+(1023&l))>>18|240,g[b++]=v>>12&63|128,g[b++]=v>>6&63|128,g[b++]=63&v|128):(g[b++]=v>>12|224,g[b++]=v>>6&63|128,g[b++]=63&v|128);return b-w}},4502:(J,G,N)=>{"use strict";Object.defineProperty(G,"__esModule",{value:!0});var h=N(8046);function v(Z,q,ne){return void 0===q&&(q=new Uint8Array(2)),void 0===ne&&(ne=0),q[ne+0]=Z>>>8,q[ne+1]=Z>>>0,q}function l(Z,q,ne){return void 0===q&&(q=new Uint8Array(2)),void 0===ne&&(ne=0),q[ne+0]=Z>>>0,q[ne+1]=Z>>>8,q}function p(Z,q){return void 0===q&&(q=0),Z[q]<<24|Z[q+1]<<16|Z[q+2]<<8|Z[q+3]}function d(Z,q){return void 0===q&&(q=0),(Z[q]<<24|Z[q+1]<<16|Z[q+2]<<8|Z[q+3])>>>0}function _(Z,q){return void 0===q&&(q=0),Z[q+3]<<24|Z[q+2]<<16|Z[q+1]<<8|Z[q]}function I(Z,q){return void 0===q&&(q=0),(Z[q+3]<<24|Z[q+2]<<16|Z[q+1]<<8|Z[q])>>>0}function E(Z,q,ne){return void 0===q&&(q=new Uint8Array(4)),void 0===ne&&(ne=0),q[ne+0]=Z>>>24,q[ne+1]=Z>>>16,q[ne+2]=Z>>>8,q[ne+3]=Z>>>0,q}function y(Z,q,ne){return void 0===q&&(q=new Uint8Array(4)),void 0===ne&&(ne=0),q[ne+0]=Z>>>0,q[ne+1]=Z>>>8,q[ne+2]=Z>>>16,q[ne+3]=Z>>>24,q}function D(Z,q,ne){return void 0===q&&(q=new Uint8Array(8)),void 0===ne&&(ne=0),E(Z/4294967296>>>0,q,ne),E(Z>>>0,q,ne+4),q}function x(Z,q,ne){return void 0===q&&(q=new Uint8Array(8)),void 0===ne&&(ne=0),y(Z>>>0,q,ne),y(Z/4294967296>>>0,q,ne+4),q}G.readInt16BE=function u(Z,q){return void 0===q&&(q=0),(Z[q+0]<<8|Z[q+1])<<16>>16},G.readUint16BE=function g(Z,q){return void 0===q&&(q=0),(Z[q+0]<<8|Z[q+1])>>>0},G.readInt16LE=function b(Z,q){return void 0===q&&(q=0),(Z[q+1]<<8|Z[q])<<16>>16},G.readUint16LE=function w(Z,q){return void 0===q&&(q=0),(Z[q+1]<<8|Z[q])>>>0},G.writeUint16BE=v,G.writeInt16BE=v,G.writeUint16LE=l,G.writeInt16LE=l,G.readInt32BE=p,G.readUint32BE=d,G.readInt32LE=_,G.readUint32LE=I,G.writeUint32BE=E,G.writeInt32BE=E,G.writeUint32LE=y,G.writeInt32LE=y,G.readInt64BE=function f(Z,q){void 0===q&&(q=0);var ne=p(Z,q),oe=p(Z,q+4);return 4294967296*ne+oe-4294967296*(oe>>31)},G.readUint64BE=function C(Z,q){return void 0===q&&(q=0),4294967296*d(Z,q)+d(Z,q+4)},G.readInt64LE=function A(Z,q){void 0===q&&(q=0);var ne=_(Z,q);return 4294967296*_(Z,q+4)+ne-4294967296*(ne>>31)},G.readUint64LE=function P(Z,q){void 0===q&&(q=0);var ne=I(Z,q);return 4294967296*I(Z,q+4)+ne},G.writeUint64BE=D,G.writeInt64BE=D,G.writeUint64LE=x,G.writeInt64LE=x,G.readUintBE=function M(Z,q,ne){if(void 0===ne&&(ne=0),Z%8!=0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(Z/8>q.length-ne)throw new Error("readUintBE: array is too short for the given bitLength");for(var oe=0,de=1,pe=Z/8+ne-1;pe>=ne;pe--)oe+=q[pe]*de,de*=256;return oe},G.readUintLE=function B(Z,q,ne){if(void 0===ne&&(ne=0),Z%8!=0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(Z/8>q.length-ne)throw new Error("readUintLE: array is too short for the given bitLength");for(var oe=0,de=1,pe=ne;pe=oe;pe--)ne[pe]=q/de&255,de*=256;return ne},G.writeUintLE=function z(Z,q,ne,oe){if(void 0===ne&&(ne=new Uint8Array(Z/8)),void 0===oe&&(oe=0),Z%8!=0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!h.isSafeInteger(q))throw new Error("writeUintLE value must be an integer");for(var de=1,pe=oe;pe{"use strict";Object.defineProperty(G,"__esModule",{value:!0});var h=N(4502),u=N(9815);function b(p,d,_){for(var I=1634760805,E=857760878,y=2036477234,f=1797285236,C=_[3]<<24|_[2]<<16|_[1]<<8|_[0],A=_[7]<<24|_[6]<<16|_[5]<<8|_[4],P=_[11]<<24|_[10]<<16|_[9]<<8|_[8],D=_[15]<<24|_[14]<<16|_[13]<<8|_[12],x=_[19]<<24|_[18]<<16|_[17]<<8|_[16],M=_[23]<<24|_[22]<<16|_[21]<<8|_[20],B=_[27]<<24|_[26]<<16|_[25]<<8|_[24],F=_[31]<<24|_[30]<<16|_[29]<<8|_[28],z=d[3]<<24|d[2]<<16|d[1]<<8|d[0],S=d[7]<<24|d[6]<<16|d[5]<<8|d[4],O=d[11]<<24|d[10]<<16|d[9]<<8|d[8],H=d[15]<<24|d[14]<<16|d[13]<<8|d[12],L=I,j=E,re=y,$=f,te=C,Z=A,q=P,ne=D,oe=x,de=M,pe=B,ke=F,Se=z,Pe=S,we=O,$e=H,K=0;K<20;K+=2)te=(te^=oe=oe+(Se=(Se^=L=L+te|0)>>>16|Se<<16)|0)>>>20|te<<12,Z=(Z^=de=de+(Pe=(Pe^=j=j+Z|0)>>>16|Pe<<16)|0)>>>20|Z<<12,q=(q^=pe=pe+(we=(we^=re=re+q|0)>>>16|we<<16)|0)>>>20|q<<12,ne=(ne^=ke=ke+($e=($e^=$=$+ne|0)>>>16|$e<<16)|0)>>>20|ne<<12,q=(q^=pe=pe+(we=(we^=re=re+q|0)>>>24|we<<8)|0)>>>25|q<<7,ne=(ne^=ke=ke+($e=($e^=$=$+ne|0)>>>24|$e<<8)|0)>>>25|ne<<7,Z=(Z^=de=de+(Pe=(Pe^=j=j+Z|0)>>>24|Pe<<8)|0)>>>25|Z<<7,te=(te^=oe=oe+(Se=(Se^=L=L+te|0)>>>24|Se<<8)|0)>>>25|te<<7,Z=(Z^=pe=pe+($e=($e^=L=L+Z|0)>>>16|$e<<16)|0)>>>20|Z<<12,q=(q^=ke=ke+(Se=(Se^=j=j+q|0)>>>16|Se<<16)|0)>>>20|q<<12,ne=(ne^=oe=oe+(Pe=(Pe^=re=re+ne|0)>>>16|Pe<<16)|0)>>>20|ne<<12,te=(te^=de=de+(we=(we^=$=$+te|0)>>>16|we<<16)|0)>>>20|te<<12,ne=(ne^=oe=oe+(Pe=(Pe^=re=re+ne|0)>>>24|Pe<<8)|0)>>>25|ne<<7,te=(te^=de=de+(we=(we^=$=$+te|0)>>>24|we<<8)|0)>>>25|te<<7,q=(q^=ke=ke+(Se=(Se^=j=j+q|0)>>>24|Se<<8)|0)>>>25|q<<7,Z=(Z^=pe=pe+($e=($e^=L=L+Z|0)>>>24|$e<<8)|0)>>>25|Z<<7;h.writeUint32LE(L+I|0,p,0),h.writeUint32LE(j+E|0,p,4),h.writeUint32LE(re+y|0,p,8),h.writeUint32LE($+f|0,p,12),h.writeUint32LE(te+C|0,p,16),h.writeUint32LE(Z+A|0,p,20),h.writeUint32LE(q+P|0,p,24),h.writeUint32LE(ne+D|0,p,28),h.writeUint32LE(oe+x|0,p,32),h.writeUint32LE(de+M|0,p,36),h.writeUint32LE(pe+B|0,p,40),h.writeUint32LE(ke+F|0,p,44),h.writeUint32LE(Se+z|0,p,48),h.writeUint32LE(Pe+S|0,p,52),h.writeUint32LE(we+O|0,p,56),h.writeUint32LE($e+H|0,p,60)}function w(p,d,_,I,E){if(void 0===E&&(E=0),32!==p.length)throw new Error("ChaCha: key size must be 32 bytes");if(I.length<_.length)throw new Error("ChaCha: destination is shorter than source");var y,f;if(0===E){if(8!==d.length&&12!==d.length)throw new Error("ChaCha nonce must be 8 or 12 bytes");(y=new Uint8Array(16)).set(d,f=y.length-d.length)}else{if(16!==d.length)throw new Error("ChaCha nonce with counter must be 16 bytes");y=d,f=E}for(var C=new Uint8Array(64),A=0;A<_.length;A+=64){b(C,y,p);for(var P=A;P>>=8,d++;if(I>0)throw new Error("ChaCha: counter overflow")}G.streamXOR=w,G.stream=function v(p,d,_,I){return void 0===I&&(I=0),u.wipe(_),w(p,d,_,_,I)}},5876:(J,G,N)=>{"use strict";var u=N(4484),g=N(314),b=N(9815),w=N(4502),v=N(9976);G.Cv=32,G.WH=12,G.pg=16;var l=new Uint8Array(16),p=function(){function d(_){if(this.nonceLength=G.WH,this.tagLength=G.pg,_.length!==G.Cv)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(_)}return d.prototype.seal=function(_,I,E,y){if(_.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var f=new Uint8Array(16);f.set(_,f.length-_.length);var C=new Uint8Array(32);u.stream(this._key,f,C,4);var P,A=I.length+this.tagLength;if(y){if(y.length!==A)throw new Error("ChaCha20Poly1305: incorrect destination length");P=y}else P=new Uint8Array(A);return u.streamXOR(this._key,f,I,P,4),this._authenticate(P.subarray(P.length-this.tagLength,P.length),C,P.subarray(0,P.length-this.tagLength),E),b.wipe(f),P},d.prototype.open=function(_,I,E,y){if(_.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(I.length0&&f.update(l.subarray(y.length%16))),f.update(E),E.length%16>0&&f.update(l.subarray(E.length%16));var C=new Uint8Array(8);y&&w.writeUint64LE(y.length,C),f.update(C),w.writeUint64LE(E.length,C),f.update(C);for(var A=f.digest(),P=0;P{"use strict";function u(b,w){if(b.length!==w.length)return 0;for(var v=0,l=0;l>>8}Object.defineProperty(G,"__esModule",{value:!0}),G.select=function N(b,w,v){return~(b-1)&w|b-1&v},G.lessOrEqual=function h(b,w){return(0|b)-(0|w)-1>>>31&1},G.compare=u,G.equal=function g(b,w){return 0!==b.length&&0!==w.length&&0!==u(b,w)}},5571:(J,G)=>{"use strict";Object.defineProperty(G,"__esModule",{value:!0}),G.isSerializableHash=function N(h){return typeof h.saveState<"u"&&typeof h.restoreState<"u"&&typeof h.cleanSavedState<"u"}},5705:(J,G,N)=>{"use strict";var u=N(4193),g=N(9815),b=function(){function w(v,l,p,d){void 0===p&&(p=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=v,this._info=d;var _=u.hmac(this._hash,p,l);this._hmac=new u.HMAC(v,_),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return w.prototype._fillBuffer=function(){this._counter[0]++;var v=this._counter[0];if(0===v)throw new Error("hkdf: cannot expand more");this._hmac.reset(),v>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},w.prototype.expand=function(v){for(var l=new Uint8Array(v),p=0;p{"use strict";Object.defineProperty(G,"__esModule",{value:!0});var h=N(5571),u=N(9976),g=N(9815),b=function(){function v(l,p){this._finished=!1,this._inner=new l,this._outer=new l,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var d=new Uint8Array(this.blockSize);p.length>this.blockSize?this._inner.update(p).finish(d).clean():d.set(p);for(var _=0;_{"use strict";Object.defineProperty(G,"__esModule",{value:!0}),G.mul=Math.imul||function N(v,l){var d=65535&v,I=65535&l;return d*I+((v>>>16&65535)*I+d*(l>>>16&65535)<<16>>>0)|0},G.add=function h(v,l){return v+l|0},G.sub=function u(v,l){return v-l|0},G.rotl=function g(v,l){return v<>>32-l},G.rotr=function b(v,l){return v<<32-l|v>>>l},G.isInteger=Number.isInteger||function w(v){return"number"==typeof v&&isFinite(v)&&Math.floor(v)===v},G.MAX_SAFE_INTEGER=9007199254740991,G.isSafeInteger=function(v){return G.isInteger(v)&&v>=-G.MAX_SAFE_INTEGER&&v<=G.MAX_SAFE_INTEGER}},314:(J,G,N)=>{"use strict";Object.defineProperty(G,"__esModule",{value:!0});var h=N(9976),u=N(9815);G.DIGEST_LENGTH=16;var g=function(){function v(l){this.digestLength=G.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var p=l[0]|l[1]<<8;this._r[0]=8191&p;var d=l[2]|l[3]<<8;this._r[1]=8191&(p>>>13|d<<3);var _=l[4]|l[5]<<8;this._r[2]=7939&(d>>>10|_<<6);var I=l[6]|l[7]<<8;this._r[3]=8191&(_>>>7|I<<9);var E=l[8]|l[9]<<8;this._r[4]=255&(I>>>4|E<<12),this._r[5]=E>>>1&8190;var y=l[10]|l[11]<<8;this._r[6]=8191&(E>>>14|y<<2);var f=l[12]|l[13]<<8;this._r[7]=8065&(y>>>11|f<<5);var C=l[14]|l[15]<<8;this._r[8]=8191&(f>>>8|C<<8),this._r[9]=C>>>5&127,this._pad[0]=l[16]|l[17]<<8,this._pad[1]=l[18]|l[19]<<8,this._pad[2]=l[20]|l[21]<<8,this._pad[3]=l[22]|l[23]<<8,this._pad[4]=l[24]|l[25]<<8,this._pad[5]=l[26]|l[27]<<8,this._pad[6]=l[28]|l[29]<<8,this._pad[7]=l[30]|l[31]<<8}return v.prototype._blocks=function(l,p,d){for(var _=this._fin?0:2048,I=this._h[0],E=this._h[1],y=this._h[2],f=this._h[3],C=this._h[4],A=this._h[5],P=this._h[6],D=this._h[7],x=this._h[8],M=this._h[9],B=this._r[0],F=this._r[1],z=this._r[2],S=this._r[3],O=this._r[4],H=this._r[5],L=this._r[6],j=this._r[7],re=this._r[8],$=this._r[9];d>=16;){var te=l[p+0]|l[p+1]<<8,Z=l[p+2]|l[p+3]<<8,q=l[p+4]|l[p+5]<<8,ne=l[p+6]|l[p+7]<<8,oe=l[p+8]|l[p+9]<<8,de=l[p+10]|l[p+11]<<8,pe=l[p+12]|l[p+13]<<8,ke=l[p+14]|l[p+15]<<8,Se=0,Pe=Se;Pe+=(I+=8191&te)*B,Pe+=(E+=8191&(te>>>13|Z<<3))*(5*$),Pe+=(y+=8191&(Z>>>10|q<<6))*(5*re),Pe+=(f+=8191&(q>>>7|ne<<9))*(5*j),Se=(Pe+=(C+=8191&(ne>>>4|oe<<12))*(5*L))>>>13,Pe&=8191,Pe+=(A+=oe>>>1&8191)*(5*H),Pe+=(P+=8191&(oe>>>14|de<<2))*(5*O),Pe+=(D+=8191&(de>>>11|pe<<5))*(5*S),Pe+=(x+=8191&(pe>>>8|ke<<8))*(5*z);var we=Se+=(Pe+=(M+=ke>>>5|_)*(5*F))>>>13;we+=I*F,we+=E*B,we+=y*(5*$),we+=f*(5*re),Se=(we+=C*(5*j))>>>13,we&=8191,we+=A*(5*L),we+=P*(5*H),we+=D*(5*O),we+=x*(5*S),Se+=(we+=M*(5*z))>>>13,we&=8191;var $e=Se;$e+=I*z,$e+=E*F,$e+=y*B,$e+=f*(5*$),Se=($e+=C*(5*re))>>>13,$e&=8191,$e+=A*(5*j),$e+=P*(5*L),$e+=D*(5*H),$e+=x*(5*O);var K=Se+=($e+=M*(5*S))>>>13;K+=I*S,K+=E*z,K+=y*F,K+=f*B,Se=(K+=C*(5*$))>>>13,K&=8191,K+=A*(5*re),K+=P*(5*j),K+=D*(5*L),K+=x*(5*H);var Ee=Se+=(K+=M*(5*O))>>>13;Ee+=I*O,Ee+=E*S,Ee+=y*z,Ee+=f*F,Se=(Ee+=C*B)>>>13,Ee&=8191,Ee+=A*(5*$),Ee+=P*(5*re),Ee+=D*(5*j),Ee+=x*(5*L);var Ce=Se+=(Ee+=M*(5*H))>>>13;Ce+=I*H,Ce+=E*O,Ce+=y*S,Ce+=f*z,Se=(Ce+=C*F)>>>13,Ce&=8191,Ce+=A*B,Ce+=P*(5*$),Ce+=D*(5*re),Ce+=x*(5*j);var xe=Se+=(Ce+=M*(5*L))>>>13;xe+=I*L,xe+=E*H,xe+=y*O,xe+=f*S,Se=(xe+=C*z)>>>13,xe&=8191,xe+=A*F,xe+=P*B,xe+=D*(5*$),xe+=x*(5*re);var Ke=Se+=(xe+=M*(5*j))>>>13;Ke+=I*j,Ke+=E*L,Ke+=y*H,Ke+=f*O,Se=(Ke+=C*S)>>>13,Ke&=8191,Ke+=A*z,Ke+=P*F,Ke+=D*B,Ke+=x*(5*$);var We=Se+=(Ke+=M*(5*re))>>>13;We+=I*re,We+=E*j,We+=y*L,We+=f*H,Se=(We+=C*O)>>>13,We&=8191,We+=A*S,We+=P*z,We+=D*F,We+=x*B;var Je=Se+=(We+=M*(5*$))>>>13;Je+=I*$,Je+=E*re,Je+=y*j,Je+=f*L,Se=(Je+=C*H)>>>13,Je&=8191,Je+=A*O,Je+=P*S,Je+=D*z,Je+=x*F,I=Pe=8191&(Se=(Se=((Se+=(Je+=M*B)>>>13)<<2)+Se|0)+(Pe&=8191)|0),E=we+=Se>>>=13,y=$e&=8191,f=K&=8191,C=Ee&=8191,A=Ce&=8191,P=xe&=8191,D=Ke&=8191,x=We&=8191,M=Je&=8191,p+=16,d-=16}this._h[0]=I,this._h[1]=E,this._h[2]=y,this._h[3]=f,this._h[4]=C,this._h[5]=A,this._h[6]=P,this._h[7]=D,this._h[8]=x,this._h[9]=M},v.prototype.finish=function(l,p){void 0===p&&(p=0);var _,I,E,y,d=new Uint16Array(10);if(this._leftover){for(y=this._leftover,this._buffer[y++]=1;y<16;y++)this._buffer[y]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(_=this._h[1]>>>13,this._h[1]&=8191,y=2;y<10;y++)this._h[y]+=_,_=this._h[y]>>>13,this._h[y]&=8191;for(this._h[0]+=5*_,_=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=_,_=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=_,d[0]=this._h[0]+5,_=d[0]>>>13,d[0]&=8191,y=1;y<10;y++)d[y]=this._h[y]+_,_=d[y]>>>13,d[y]&=8191;for(d[9]-=8192,I=(1^_)-1,y=0;y<10;y++)d[y]&=I;for(I=~I,y=0;y<10;y++)this._h[y]=this._h[y]&I|d[y];for(this._h[0]=65535&(this._h[0]|this._h[1]<<13),this._h[1]=65535&(this._h[1]>>>3|this._h[2]<<10),this._h[2]=65535&(this._h[2]>>>6|this._h[3]<<7),this._h[3]=65535&(this._h[3]>>>9|this._h[4]<<4),this._h[4]=65535&(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14),this._h[5]=65535&(this._h[6]>>>2|this._h[7]<<11),this._h[6]=65535&(this._h[7]>>>5|this._h[8]<<8),this._h[7]=65535&(this._h[8]>>>8|this._h[9]<<5),this._h[0]=65535&(E=this._h[0]+this._pad[0]),y=1;y<8;y++)this._h[y]=65535&(E=(this._h[y]+this._pad[y]|0)+(E>>>16)|0);return l[p+0]=this._h[0]>>>0,l[p+1]=this._h[0]>>>8,l[p+2]=this._h[1]>>>0,l[p+3]=this._h[1]>>>8,l[p+4]=this._h[2]>>>0,l[p+5]=this._h[2]>>>8,l[p+6]=this._h[3]>>>0,l[p+7]=this._h[3]>>>8,l[p+8]=this._h[4]>>>0,l[p+9]=this._h[4]>>>8,l[p+10]=this._h[5]>>>0,l[p+11]=this._h[5]>>>8,l[p+12]=this._h[6]>>>0,l[p+13]=this._h[6]>>>8,l[p+14]=this._h[7]>>>0,l[p+15]=this._h[7]>>>8,this._finished=!0,this},v.prototype.update=function(l){var _,p=0,d=l.length;if(this._leftover){(_=16-this._leftover)>d&&(_=d);for(var I=0;I<_;I++)this._buffer[this._leftover+I]=l[p+I];if(d-=_,p+=_,this._leftover+=_,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(d>=16&&(this._blocks(l,p,_=d-d%16),p+=_,d-=_),d){for(I=0;I{"use strict";Object.defineProperty(G,"__esModule",{value:!0}),G.randomStringForEntropy=G.randomString=G.randomUint32=G.randomBytes=G.defaultRandomSource=void 0;const h=N(9753),u=N(4502),g=N(9815);function b(d,_=G.defaultRandomSource){return _.randomBytes(d)}G.defaultRandomSource=new h.SystemRandomSource,G.randomBytes=b,G.randomUint32=function w(d=G.defaultRandomSource){const _=b(4,d),I=(0,u.readUint32LE)(_);return(0,g.wipe)(_),I};const v="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function l(d,_=v,I=G.defaultRandomSource){if(_.length<2)throw new Error("randomString charset is too short");if(_.length>256)throw new Error("randomString charset is too long");let E="";const y=_.length,f=256-256%y;for(;d>0;){const C=b(Math.ceil(256*d/f),I);for(let A=0;A0;A++){const P=C[A];P{"use strict";Object.defineProperty(G,"__esModule",{value:!0}),G.BrowserRandomSource=void 0,G.BrowserRandomSource=class h{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const g=typeof self<"u"?self.crypto||self.msCrypto:null;g&&void 0!==g.getRandomValues&&(this._crypto=g,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(g){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const b=new Uint8Array(g);for(let w=0;w{"use strict";Object.defineProperty(G,"__esModule",{value:!0}),G.NodeRandomSource=void 0;const h=N(9815);G.NodeRandomSource=class u{constructor(){this.isAvailable=!1,this.isInstantiated=!1;{const b=N(5883);b&&b.randomBytes&&(this._crypto=b,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(b){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let w=this._crypto.randomBytes(b);if(w.length!==b)throw new Error("NodeRandomSource: got fewer bytes than requested");const v=new Uint8Array(b);for(let l=0;l{"use strict";Object.defineProperty(G,"__esModule",{value:!0}),G.SystemRandomSource=void 0;const h=N(7170),u=N(1382);G.SystemRandomSource=class g{constructor(){return this.isAvailable=!1,this.name="",this._source=new h.BrowserRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Browser")):(this._source=new u.NodeRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Node")):void 0)}randomBytes(w){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(w)}}},893:(J,G,N)=>{"use strict";var u=N(4502),g=N(9815);G.k=32,G.cn=64;var b=function(){function p(){this.digestLength=G.k,this.blockSize=G.cn,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return p.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},p.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},p.prototype.clean=function(){g.wipe(this._buffer),g.wipe(this._temp),this.reset()},p.prototype.update=function(d,_){if(void 0===_&&(_=d.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var I=0;if(this._bytesHashed+=_,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=d[I++],_--;this._bufferLength===this.blockSize&&(v(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(_>=this.blockSize&&(I=v(this._temp,this._state,d,I,_),_%=this.blockSize);_>0;)this._buffer[this._bufferLength++]=d[I++],_--;return this},p.prototype.finish=function(d){if(!this._finished){var _=this._bytesHashed,I=this._bufferLength,E=_/536870912|0,y=_<<3,f=_%64<56?64:128;this._buffer[I]=128;for(var C=I+1;C0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},p.prototype.restoreState=function(d){return this._state.set(d.state),this._bufferLength=d.bufferLength,d.buffer&&this._buffer.set(d.buffer),this._bytesHashed=d.bytesHashed,this._finished=!1,this},p.prototype.cleanSavedState=function(d){g.wipe(d.state),d.buffer&&g.wipe(d.buffer),d.bufferLength=0,d.bytesHashed=0},p}();G.mE=b;var w=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function v(p,d,_,I,E){for(;E>=64;){for(var y=d[0],f=d[1],C=d[2],A=d[3],P=d[4],D=d[5],x=d[6],M=d[7],B=0;B<16;B++)p[B]=u.readUint32BE(_,I+4*B);for(B=16;B<64;B++){var z=p[B-2];p[B]=((S=(z>>>17|z<<15)^(z>>>19|z<<13)^z>>>10)+p[B-7]|0)+((O=((z=p[B-15])>>>7|z<<25)^(z>>>18|z<<14)^z>>>3)+p[B-16]|0)}for(B=0;B<64;B++){var S=(((P>>>6|P<<26)^(P>>>11|P<<21)^(P>>>25|P<<7))+(P&D^~P&x)|0)+(M+(w[B]+p[B]|0)|0)|0,O=((y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10))+(y&f^y&C^f&C)|0;M=x,x=D,D=P,P=A+S|0,A=C,C=f,f=y,y=S+O|0}d[0]+=y,d[1]+=f,d[2]+=C,d[3]+=A,d[4]+=P,d[5]+=D,d[6]+=x,d[7]+=M,I+=64,E-=64}return I}G.vp=function l(p){var d=new b;d.update(p);var _=d.digest();return d.clean(),_}},9815:(J,G)=>{"use strict";Object.defineProperty(G,"__esModule",{value:!0}),G.wipe=function N(h){for(var u=0;u{"use strict";G.gi=G.Au=G._w=G.KS=G.kz=void 0;const u=N(5784),g=N(9815);function b(B){const F=new Float64Array(16);if(B)for(let z=0;z=0;--ne){const oe=z[ne>>>3]>>>(7&ne)&1;p(O,H,oe),p(L,j,oe),I(re,O,L),E(O,O,L),I(L,H,j),E(H,H,j),f(j,re),f($,O),y(O,L,O),y(L,H,re),I(re,O,L),E(O,O,L),f(H,O),E(L,j,$),y(O,L,v),I(O,O,j),y(L,L,O),y(O,j,$),y(j,H,S),f(H,re),p(O,H,oe),p(L,j,oe)}for(let ne=0;ne<16;ne++)S[ne+16]=O[ne],S[ne+32]=L[ne],S[ne+48]=H[ne],S[ne+64]=j[ne];const te=S.subarray(32),Z=S.subarray(16);(function C(B,F){const z=b();for(let S=0;S<16;S++)z[S]=F[S];for(let S=253;S>=0;S--)f(z,z),2!==S&&4!==S&&y(z,z,F);for(let S=0;S<16;S++)B[S]=z[S]})(te,te),y(Z,Z,te);const q=new Uint8Array(32);return function d(B,F){const z=b(),S=b();for(let O=0;O<16;O++)S[O]=F[O];l(S),l(S),l(S);for(let O=0;O<2;O++){z[0]=S[0]-65517;for(let L=1;L<15;L++)z[L]=S[L]-65535-(z[L-1]>>16&1),z[L-1]&=65535;z[15]=S[15]-32767-(z[14]>>16&1);const H=z[15]>>16&1;z[14]&=65535,p(S,z,1-H)}for(let O=0;O<16;O++)B[2*O]=255&S[O],B[2*O+1]=S[O]>>8}(q,Z),q}function P(B){return A(B,w)}function D(B){if(B.length!==G.KS)throw new Error(`x25519: seed must be ${G.KS} bytes`);const F=new Uint8Array(B);return{publicKey:P(F),secretKey:F}}G._w=D,G.Au=function x(B){const F=(0,u.randomBytes)(32,B),z=D(F);return(0,g.wipe)(F),z},G.gi=function M(B,F,z=!1){if(B.length!==G.kz)throw new Error("X25519: incorrect secret key length");if(F.length!==G.kz)throw new Error("X25519: incorrect public key length");const S=A(B,F);if(z){let O=0;for(let H=0;H{function G(N){const h=new globalThis.AbortController;function u(){h.abort();for(const g of N)!g||!g.removeEventListener||g.removeEventListener("abort",u)}for(const g of N)if(g&&g.addEventListener){if(g.aborted){u();break}g.addEventListener("abort",u)}return h.signal}J.exports=G,J.exports.anySignal=G},3210:J=>{var G=1e3,N=60*G,h=60*N,u=24*h;function p(d,_,I,E){var y=_>=1.5*I;return Math.round(d/I)+" "+E+(y?"s":"")}J.exports=function(d,_){_=_||{};var I=typeof d;if("string"===I&&d.length>0)return function w(d){if(!((d=String(d)).length>100)){var _=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(d);if(_){var I=parseFloat(_[1]);switch((_[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*I;case"weeks":case"week":case"w":return 6048e5*I;case"days":case"day":case"d":return I*u;case"hours":case"hour":case"hrs":case"hr":case"h":return I*h;case"minutes":case"minute":case"mins":case"min":case"m":return I*N;case"seconds":case"second":case"secs":case"sec":case"s":return I*G;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return I;default:return}}}}(d);if("number"===I&&isFinite(d))return _.long?function l(d){var _=Math.abs(d);return _>=u?p(d,_,u,"day"):_>=h?p(d,_,h,"hour"):_>=N?p(d,_,N,"minute"):_>=G?p(d,_,G,"second"):d+" ms"}(d):function v(d){var _=Math.abs(d);return _>=u?Math.round(d/u)+"d":_>=h?Math.round(d/h)+"h":_>=N?Math.round(d/N)+"m":_>=G?Math.round(d/G)+"s":d+"ms"}(d);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(d))}},1455:(J,G,N)=>{G.formatArgs=function u(l){if(l[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+l[0]+(this.useColors?"%c ":" ")+"+"+J.exports.humanize(this.diff),!this.useColors)return;const p="color: "+this.color;l.splice(1,0,p,"color: inherit");let d=0,_=0;l[0].replace(/%[a-zA-Z%]/g,I=>{"%%"!==I&&(d++,"%c"===I&&(_=d))}),l.splice(_,0,p)},G.save=function g(l){try{l?G.storage.setItem("debug",l):G.storage.removeItem("debug")}catch{}},G.load=function b(){let l;try{l=G.storage.getItem("debug")}catch{}return!l&&typeof process<"u"&&"env"in process&&(l=process.env.DEBUG),l},G.useColors=function h(){return!(!(typeof window<"u"&&window.process)||"renderer"!==window.process.type&&!window.process.__nwjs)||!(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&(typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},G.storage=function w(){try{return localStorage}catch{}}(),G.destroy=(()=>{let l=!1;return()=>{l||(l=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),G.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],G.log=console.debug||console.log||(()=>{}),J.exports=N(3283)(G);const{formatters:v}=J.exports;v.j=function(l){try{return JSON.stringify(l)}catch(p){return"[UnexpectedJSONParseError]: "+p.message}}},3283:(J,G,N)=>{J.exports=function h(u){function b(E){let y,C,A,f=null;function P(...D){if(!P.enabled)return;const x=P,M=Number(new Date);x.diff=M-(y||M),x.prev=y,x.curr=M,y=M,D[0]=b.coerce(D[0]),"string"!=typeof D[0]&&D.unshift("%O");let F=0;D[0]=D[0].replace(/%([a-zA-Z%])/g,(S,O)=>{if("%%"===S)return"%";F++;const H=b.formatters[O];return"function"==typeof H&&(S=H.call(x,D[F]),D.splice(F,1),F--),S}),b.formatArgs.call(x,D),(x.log||b.log).apply(x,D)}return P.namespace=E,P.useColors=b.useColors(),P.color=b.selectColor(E),P.extend=w,P.destroy=b.destroy,Object.defineProperty(P,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==f?f:(C!==b.namespaces&&(C=b.namespaces,A=b.enabled(E)),A),set:D=>{f=D}}),"function"==typeof b.init&&b.init(P),P}function w(E,y){const f=b(this.namespace+(typeof y>"u"?":":y)+E);return f.log=this.log,f}function d(E){return E.toString().substring(2,E.toString().length-2).replace(/\.\*\?$/,"*")}return b.debug=b,b.default=b,b.coerce=function _(E){return E instanceof Error?E.stack||E.message:E},b.disable=function l(){const E=[...b.names.map(d),...b.skips.map(d).map(y=>"-"+y)].join(",");return b.enable(""),E},b.enable=function v(E){let y;b.save(E),b.namespaces=E,b.names=[],b.skips=[];const f=("string"==typeof E?E:"").split(/[\s,]+/),C=f.length;for(y=0;y{b[E]=u[E]}),b.names=[],b.skips=[],b.formatters={},b.selectColor=function g(E){let y=0;for(let f=0;f{"use strict";function G(N,u){u=u||{},this._head=0,this._tail=0,this._capacity=u.capacity,this._capacityMask=3,this._list=new Array(4),Array.isArray(N)&&this._fromArray(N)}G.prototype.peekAt=function(h){var u=h;if(u===(0|u)){var g=this.size();if(!(u>=g||u<-g))return u<0&&(u+=g),this._list[u=this._head+u&this._capacityMask]}},G.prototype.get=function(h){return this.peekAt(h)},G.prototype.peek=function(){if(this._head!==this._tail)return this._list[this._head]},G.prototype.peekFront=function(){return this.peek()},G.prototype.peekBack=function(){return this.peekAt(-1)},Object.defineProperty(G.prototype,"length",{get:function(){return this.size()}}),G.prototype.size=function(){return this._head===this._tail?0:this._headthis._capacity&&this.pop(),this._head1e4&&this._tail<=this._list.length>>>2&&this._shrinkArray(),u}},G.prototype.push=function(h){if(void 0===h)return this.size();var u=this._tail;return this._list[u]=h,this._tail=u+1&this._capacityMask,this._tail===this._head&&this._growArray(),this._capacity&&this.size()>this._capacity&&this.shift(),this._head1e4&&h<=u>>>2&&this._shrinkArray(),g}},G.prototype.removeOne=function(h){var u=h;if(u===(0|u)&&this._head!==this._tail){var g=this.size(),b=this._list.length;if(!(u>=g||u<-g)){u<0&&(u+=g);var v,w=this._list[u=this._head+u&this._capacityMask];if(h0;v--)this._list[u]=this._list[u=u-1+b&this._capacityMask];this._list[u]=void 0,this._head=this._head+1+b&this._capacityMask}else{for(v=g-1-h;v>0;v--)this._list[u]=this._list[u=u+1+b&this._capacityMask];this._list[u]=void 0,this._tail=this._tail-1+b&this._capacityMask}return w}}},G.prototype.remove=function(h,u){var b,g=h,w=u;if(g===(0|g)&&this._head!==this._tail){var v=this.size(),l=this._list.length;if(!(g>=v||g<-v||u<1)){if(g<0&&(g+=v),1===u||!u)return(b=new Array(1))[0]=this.removeOne(g),b;if(0===g&&g+u>=v)return b=this.toArray(),this.clear(),b;var p;for(g+u>v&&(u=v-g),b=new Array(u),p=0;p0;p--)this._list[g=g+1+l&this._capacityMask]=void 0;return b}if(0===h){for(this._head=this._head+u+l&this._capacityMask,p=u-1;p>0;p--)this._list[g=g+1+l&this._capacityMask]=void 0;return b}if(g0;p--)this.unshift(this._list[g=g-1+l&this._capacityMask]);for(g=this._head-1+l&this._capacityMask;w>0;)this._list[g=g-1+l&this._capacityMask]=void 0,w--;h<0&&(this._tail=g)}else{for(this._tail=g,g=g+u+l&this._capacityMask,p=v-(u+h);p>0;p--)this.push(this._list[g++]);for(g=this._tail;w>0;)this._list[g=g+1+l&this._capacityMask]=void 0,w--}return this._head<2&&this._tail>1e4&&this._tail<=l>>>2&&this._shrinkArray(),b}}},G.prototype.splice=function(h,u){var g=h;if(g===(0|g)){var b=this.size();if(g<0&&(g+=b),!(g>b)){if(arguments.length>2){var w,v,l,p=arguments.length,d=this._list.length,_=2;if(!b||g0&&(this._head=this._head+g+d&this._capacityMask)):(l=this.remove(g,u),this._head=this._head+g+d&this._capacityMask);p>_;)this.unshift(arguments[--p]);for(w=g;w>0;w--)this.unshift(v[w-1])}else{var I=(v=new Array(b-(g+u))).length;for(w=0;wthis._tail){for(w=this._head;w>>=1,this._capacityMask>>>=1},J.exports=G},2535:J=>{"use strict";function G(h,u){for(const g in u)Object.defineProperty(h,g,{value:u[g],enumerable:!0,configurable:!0});return h}J.exports=function N(h,u,g){if(!h||"string"==typeof h)throw new TypeError("Please pass an Error to err-code");g||(g={}),"object"==typeof u&&(g=u,u=""),u&&(g.code=u);try{return G(h,g)}catch{g.message=h.message,g.stack=h.stack;const w=function(){};return w.prototype=Object.create(Object.getPrototypeOf(h)),G(new w,g)}}},3676:(J,G,N)=>{"use strict";const u=N(649);G.zN=u.EventIterator},649:(J,G)=>{"use strict";Object.defineProperty(G,"__esModule",{value:!0});class N{constructor(){this.pullQueue=[],this.pushQueue=[],this.eventHandlers={},this.isPaused=!1,this.isStopped=!1}push(g){if(this.isStopped)return;const b={value:g,done:!1};if(this.pullQueue.length){const w=this.pullQueue.shift();w&&w.resolve(b)}else this.pushQueue.push(Promise.resolve(b)),void 0!==this.highWaterMark&&this.pushQueue.length>=this.highWaterMark&&!this.isPaused&&(this.isPaused=!0,this.eventHandlers.highWater?this.eventHandlers.highWater():console&&console.warn(`EventIterator queue reached ${this.pushQueue.length} items`))}stop(){if(!this.isStopped){this.isStopped=!0,this.remove();for(const g of this.pullQueue)g.resolve({value:void 0,done:!0});this.pullQueue.length=0}}fail(g){if(!this.isStopped)if(this.isStopped=!0,this.remove(),this.pullQueue.length){for(const b of this.pullQueue)b.reject(g);this.pullQueue.length=0}else{const b=Promise.reject(g);b.catch(()=>{}),this.pushQueue.push(b)}}remove(){Promise.resolve().then(()=>{this.removeCallback&&this.removeCallback()})}[Symbol.asyncIterator](){return{next:g=>{const b=this.pushQueue.shift();return b?(void 0!==this.lowWaterMark&&this.pushQueue.length<=this.lowWaterMark&&this.isPaused&&(this.isPaused=!1,this.eventHandlers.lowWater&&this.eventHandlers.lowWater()),b):this.isStopped?Promise.resolve({value:void 0,done:!0}):new Promise((w,v)=>{this.pullQueue.push({resolve:w,reject:v})})},return:()=>(this.isStopped=!0,this.pushQueue.length=0,this.remove(),Promise.resolve({value:void 0,done:!0}))}}}class h{constructor(g,{highWaterMark:b=100,lowWaterMark:w=1}={}){const v=new N;v.highWaterMark=b,v.lowWaterMark=w,v.removeCallback=g({push:l=>v.push(l),stop:()=>v.stop(),fail:l=>v.fail(l),on:(l,p)=>{v.eventHandlers[l]=p}})||(()=>{}),this[Symbol.asyncIterator]=()=>v[Symbol.asyncIterator](),Object.freeze(this)}}G.EventIterator=h,G.default=h},2005:J=>{"use strict";var G=Object.prototype.hasOwnProperty,N="~";function h(){}function u(v,l,p){this.fn=v,this.context=l,this.once=p||!1}function g(v,l,p,d,_){if("function"!=typeof p)throw new TypeError("The listener must be a function");var I=new u(p,d||v,_),E=N?N+l:l;return v._events[E]?v._events[E].fn?v._events[E]=[v._events[E],I]:v._events[E].push(I):(v._events[E]=I,v._eventsCount++),v}function b(v,l){0==--v._eventsCount?v._events=new h:delete v._events[l]}function w(){this._events=new h,this._eventsCount=0}Object.create&&(h.prototype=Object.create(null),(new h).__proto__||(N=!1)),w.prototype.eventNames=function(){var p,d,l=[];if(0===this._eventsCount)return l;for(d in p=this._events)G.call(p,d)&&l.push(N?d.slice(1):d);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(p)):l},w.prototype.listeners=function(l){var d=this._events[N?N+l:l];if(!d)return[];if(d.fn)return[d.fn];for(var _=0,I=d.length,E=new Array(I);_{"use strict";var h,G="object"==typeof Reflect?Reflect:null,N=G&&"function"==typeof G.apply?G.apply:function(M,B,F){return Function.prototype.apply.call(M,B,F)};h=G&&"function"==typeof G.ownKeys?G.ownKeys:Object.getOwnPropertySymbols?function(M){return Object.getOwnPropertyNames(M).concat(Object.getOwnPropertySymbols(M))}:function(M){return Object.getOwnPropertyNames(M)};var g=Number.isNaN||function(M){return M!=M};function b(){b.init.call(this)}J.exports=b,J.exports.once=function A(x,M){return new Promise(function(B,F){function z(O){x.removeListener(M,S),F(O)}function S(){"function"==typeof x.removeListener&&x.removeListener("error",z),B([].slice.call(arguments))}D(x,M,S,{once:!0}),"error"!==M&&function P(x,M,B){"function"==typeof x.on&&D(x,"error",M,B)}(x,z,{once:!0})})},b.EventEmitter=b,b.prototype._events=void 0,b.prototype._eventsCount=0,b.prototype._maxListeners=void 0;var w=10;function v(x){if("function"!=typeof x)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof x)}function l(x){return void 0===x._maxListeners?b.defaultMaxListeners:x._maxListeners}function p(x,M,B,F){var z,S,O;if(v(B),void 0===(S=x._events)?(S=x._events=Object.create(null),x._eventsCount=0):(void 0!==S.newListener&&(x.emit("newListener",M,B.listener?B.listener:B),S=x._events),O=S[M]),void 0===O)O=S[M]=B,++x._eventsCount;else if("function"==typeof O?O=S[M]=F?[B,O]:[O,B]:F?O.unshift(B):O.push(B),(z=l(x))>0&&O.length>z&&!O.warned){O.warned=!0;var H=new Error("Possible EventEmitter memory leak detected. "+O.length+" "+String(M)+" listeners added. Use emitter.setMaxListeners() to increase limit");H.name="MaxListenersExceededWarning",H.emitter=x,H.type=M,H.count=O.length,function u(x){console&&console.warn&&console.warn(x)}(H)}return x}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function _(x,M,B){var F={fired:!1,wrapFn:void 0,target:x,type:M,listener:B},z=d.bind(F);return z.listener=B,F.wrapFn=z,z}function I(x,M,B){var F=x._events;if(void 0===F)return[];var z=F[M];return void 0===z?[]:"function"==typeof z?B?[z.listener||z]:[z]:B?function C(x){for(var M=new Array(x.length),B=0;B0&&(O=B[0]),O instanceof Error)throw O;var H=new Error("Unhandled error."+(O?" ("+O.message+")":""));throw H.context=O,H}var L=S[M];if(void 0===L)return!1;if("function"==typeof L)N(L,this,B);else{var j=L.length,re=y(L,j);for(F=0;F=0;O--)if(F[O]===B||F[O].listener===B){H=F[O].listener,S=O;break}if(S<0)return this;0===S?F.shift():function f(x,M){for(;M+1=0;z--)this.removeListener(M,B[z]);return this},b.prototype.listeners=function(M){return I(this,M,!0)},b.prototype.rawListeners=function(M){return I(this,M,!1)},b.listenerCount=function(x,M){return"function"==typeof x.listenerCount?x.listenerCount(M):E.call(x,M)},b.prototype.listenerCount=E,b.prototype.eventNames=function(){return this._eventsCount>0?h(this._events):[]}},3111:J=>{J.exports=class{constructor(N){if(!(N>0)||0!=(N-1&N))throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(N),this.mask=N-1,this.top=0,this.btm=0,this.next=null}push(N){return void 0===this.buffer[this.top]&&(this.buffer[this.top]=N,this.top=this.top+1&this.mask,!0)}shift(){const N=this.buffer[this.btm];if(void 0!==N)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,N}peek(){return this.buffer[this.btm]}isEmpty(){return void 0===this.buffer[this.btm]}}},1159:(J,G,N)=>{const h=N(3111);J.exports=class{constructor(g){this.hwm=g||16,this.head=new h(this.hwm),this.tail=this.head}push(g){this.head.push(g)||(this.head=this.head.next=new h(2*this.head.buffer.length),this.head.push(g))}shift(){const g=this.tail.shift();if(void 0===g&&this.tail.next){const b=this.tail.next;return this.tail.next=null,this.tail=b,this.tail.shift()}return g}peek(){return this.tail.peek()}isEmpty(){return this.head.isEmpty()}}},5550:J=>{J.exports=function(G){if(!G)throw Error("hashlru must have a max value, of type number, greater than 0");var N=0,h=Object.create(null),u=Object.create(null);function g(b,w){h[b]=w,++N>=G&&(N=0,u=h,h=Object.create(null))}return{has:function(b){return void 0!==h[b]||void 0!==u[b]},remove:function(b){void 0!==h[b]&&(h[b]=void 0),void 0!==u[b]&&(u[b]=void 0)},get:function(b){var w=h[b];return void 0!==w?w:void 0!==(w=u[b])?(g(b,w),w):void 0},set:function(b,w){void 0!==h[b]?h[b]=w:g(b,w)},clear:function(){h=Object.create(null),u=Object.create(null)}}}},4066:J=>{"use strict";const G="[a-fA-F\\d:]",N=p=>p&&p.includeBoundaries?`(?:(?<=\\s|^)(?=${G})|(?<=${G})(?=\\s|$))`:"",h="(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}",u="[a-fA-F\\d]{1,4}",g=`\n(?:\n(?:${u}:){7}(?:${u}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:${u}:){6}(?:${h}|:${u}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4\n(?:${u}:){5}(?::${h}|(?::${u}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4\n(?:${u}:){4}(?:(?::${u}){0,1}:${h}|(?::${u}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4\n(?:${u}:){3}(?:(?::${u}){0,2}:${h}|(?::${u}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4\n(?:${u}:){2}(?:(?::${u}){0,3}:${h}|(?::${u}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:${u}:){1}(?:(?::${u}){0,4}:${h}|(?::${u}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::(?:(?::${u}){0,5}:${h}|(?::${u}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1\n`.replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),b=new RegExp(`(?:^${h}$)|(?:^${g}$)`),w=new RegExp(`^${h}$`),v=new RegExp(`^${g}$`),l=p=>p&&p.exact?b:new RegExp(`(?:${N(p)}${h}${N(p)})|(?:${N(p)}${g}${N(p)})`,"g");l.v4=p=>p&&p.exact?w:new RegExp(`${N(p)}${h}${N(p)}`,"g"),l.v6=p=>p&&p.exact?v:new RegExp(`${N(p)}${g}${N(p)}`,"g"),J.exports=l},1396:function(J){!function(G){"use strict";const N="(0?\\d+|0x[a-f0-9]+)",h={fourOctet:new RegExp(`^${N}\\.${N}\\.${N}\\.${N}$`,"i"),threeOctet:new RegExp(`^${N}\\.${N}\\.${N}$`,"i"),twoOctet:new RegExp(`^${N}\\.${N}$`,"i"),longValue:new RegExp(`^${N}$`,"i")},u=new RegExp("^0[0-7]+$","i"),g=new RegExp("^0x[a-f0-9]+$","i"),b="%[0-9a-z]{1,}",w="(?:[0-9a-f]+::?)+",v={zoneIndex:new RegExp(b,"i"),native:new RegExp(`^(::)?(${w})?([0-9a-f]+)?(::)?(${b})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${N}\\.${N}\\.${N}\\.${N}(${b})?)$`,"i"),transitional:new RegExp(`^((?:${w})|(?:::)(?:${w})?)${N}\\.${N}\\.${N}\\.${N}(${b})?$`,"i")};function l(E,y){if(E.indexOf("::")!==E.lastIndexOf("::"))return null;let P,D,f=0,C=-1,A=(E.match(v.zoneIndex)||[])[0];for(A&&(A=A.substring(1),E=E.replace(/%.+$/,""));(C=E.indexOf(":",C+1))>=0;)f++;if("::"===E.substr(0,2)&&f--,"::"===E.substr(-2,2)&&f--,f>y)return null;for(D=y-f,P=":";D--;)P+="0:";return":"===(E=E.replace("::",P))[0]&&(E=E.slice(1)),":"===E[E.length-1]&&(E=E.slice(0,-1)),{parts:y=function(){const x=E.split(":"),M=[];for(let B=0;B0;){if(P=f-C,P<0&&(P=0),E[A]>>P!=y[A]>>P)return!1;C-=f,A+=1}return!0}function d(E){if(g.test(E))return parseInt(E,16);if("0"===E[0]&&!isNaN(parseInt(E[1],10))){if(u.test(E))return parseInt(E,8);throw new Error(`ipaddr: cannot parse ${E} as octal`)}return parseInt(E,10)}function _(E,y){for(;E.length=0;A-=1){if(P=this.octets[A],!(P in C))return null;if(D=C[P],f&&0!==D)return null;8!==D&&(f=!0),y+=D}return 32-y},E.prototype.range=function(){return I.subnetMatch(this,this.SpecialRanges)},E.prototype.toByteArray=function(){return this.octets.slice(0)},E.prototype.toIPv4MappedAddress=function(){return I.IPv6.parse(`::ffff:${this.toString()}`)},E.prototype.toNormalizedString=function(){return this.toString()},E.prototype.toString=function(){return this.octets.join(".")},E}(),I.IPv4.broadcastAddressFromCIDR=function(E){try{const y=this.parseCIDR(E),f=y[0].toByteArray(),C=this.subnetMaskFromPrefixLength(y[1]).toByteArray(),A=[];let P=0;for(;P<4;)A.push(parseInt(f[P],10)|255^parseInt(C[P],10)),P++;return new this(A)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},I.IPv4.isIPv4=function(E){return null!==this.parser(E)},I.IPv4.isValid=function(E){try{return new this(this.parser(E)),!0}catch{return!1}},I.IPv4.isValidFourPartDecimal=function(E){return!(!I.IPv4.isValid(E)||!E.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},I.IPv4.networkAddressFromCIDR=function(E){let y,f,C,A,P;try{for(y=this.parseCIDR(E),C=y[0].toByteArray(),P=this.subnetMaskFromPrefixLength(y[1]).toByteArray(),A=[],f=0;f<4;)A.push(parseInt(C[f],10)&parseInt(P[f],10)),f++;return new this(A)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},I.IPv4.parse=function(E){const y=this.parser(E);if(null===y)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(y)},I.IPv4.parseCIDR=function(E){let y;if(y=E.match(/^(.+)\/(\d+)$/)){const f=parseInt(y[2]);if(f>=0&&f<=32){const C=[this.parse(y[1]),f];return Object.defineProperty(C,"toString",{value:function(){return this.join("/")}}),C}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},I.IPv4.parser=function(E){let y,f,C;if(y=E.match(h.fourOctet))return function(){const A=y.slice(1,6),P=[];for(let D=0;D4294967295||C<0)throw new Error("ipaddr: address outside defined range");return function(){const A=[];let P;for(P=0;P<=24;P+=8)A.push(C>>P&255);return A}().reverse()}return(y=E.match(h.twoOctet))?function(){const A=y.slice(1,4),P=[];if(C=d(A[1]),C>16777215||C<0)throw new Error("ipaddr: address outside defined range");return P.push(d(A[0])),P.push(C>>16&255),P.push(C>>8&255),P.push(255&C),P}():(y=E.match(h.threeOctet))?function(){const A=y.slice(1,5),P=[];if(C=d(A[2]),C>65535||C<0)throw new Error("ipaddr: address outside defined range");return P.push(d(A[0])),P.push(d(A[1])),P.push(C>>8&255),P.push(255&C),P}():null},I.IPv4.subnetMaskFromPrefixLength=function(E){if((E=parseInt(E))<0||E>32)throw new Error("ipaddr: invalid IPv4 prefix length");const y=[0,0,0,0];let f=0;const C=Math.floor(E/8);for(;f=0;D-=1){if(A=this.parts[D],!(A in C))return null;if(P=C[A],f&&0!==P)return null;16!==P&&(f=!0),y+=P}return 128-y},E.prototype.range=function(){return I.subnetMatch(this,this.SpecialRanges)},E.prototype.toByteArray=function(){let y;const f=[],C=this.parts;for(let A=0;A>8),f.push(255&y);return f},E.prototype.toFixedLengthString=function(){const y=function(){const C=[];for(let A=0;A>8,255&f,C>>8,255&C])},E.prototype.toNormalizedString=function(){const y=function(){const C=[];for(let A=0;AA&&(C=P.index,A=P[0].length);return A<0?f:`${f.substring(0,C)}::${f.substring(C+A)}`},E.prototype.toString=function(){return this.toNormalizedString().replace(/((^|:)(0(:|$))+)/,"::")},E}(),I.IPv6.broadcastAddressFromCIDR=function(E){try{const y=this.parseCIDR(E),f=y[0].toByteArray(),C=this.subnetMaskFromPrefixLength(y[1]).toByteArray(),A=[];let P=0;for(;P<16;)A.push(parseInt(f[P],10)|255^parseInt(C[P],10)),P++;return new this(A)}catch(y){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${y})`)}},I.IPv6.isIPv6=function(E){return null!==this.parser(E)},I.IPv6.isValid=function(E){if("string"==typeof E&&-1===E.indexOf(":"))return!1;try{const y=this.parser(E);return new this(y.parts,y.zoneId),!0}catch{return!1}},I.IPv6.networkAddressFromCIDR=function(E){let y,f,C,A,P;try{for(y=this.parseCIDR(E),C=y[0].toByteArray(),P=this.subnetMaskFromPrefixLength(y[1]).toByteArray(),A=[],f=0;f<16;)A.push(parseInt(C[f],10)&parseInt(P[f],10)),f++;return new this(A)}catch(D){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${D})`)}},I.IPv6.parse=function(E){const y=this.parser(E);if(null===y.parts)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(y.parts,y.zoneId)},I.IPv6.parseCIDR=function(E){let y,f,C;if((f=E.match(/^(.+)\/(\d+)$/))&&(y=parseInt(f[2]),y>=0&&y<=128))return C=[this.parse(f[1]),y],Object.defineProperty(C,"toString",{value:function(){return this.join("/")}}),C;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},I.IPv6.parser=function(E){let y,f,C,A,P,D;if(C=E.match(v.deprecatedTransitional))return this.parser(`::ffff:${C[1]}`);if(v.native.test(E))return l(E,8);if((C=E.match(v.transitional))&&(D=C[6]||"",y=l(C[1].slice(0,-1)+D,6),y.parts)){for(P=[parseInt(C[2]),parseInt(C[3]),parseInt(C[4]),parseInt(C[5])],f=0;f128)throw new Error("ipaddr: invalid IPv6 prefix length");const y=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let f=0;const C=Math.floor(E/8);for(;f{J.exports=function G(){return typeof window<"u"&&"object"==typeof window.process&&"renderer"===window.process.type||typeof process<"u"&&"object"==typeof process.versions&&!!process.versions.electron||"object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent.indexOf("Electron")>=0}},6599:(J,G,N)=>{"use strict";const h=N(4066),u=g=>h({exact:!0}).test(g);u.v4=g=>h.v4({exact:!0}).test(g),u.v6=g=>h.v6({exact:!0}).test(g),u.version=g=>u(g)?u.v4(g)?4:6:void 0,J.exports=u},7494:J=>{"use strict";J.exports=G=>{if("[object Object]"!==Object.prototype.toString.call(G))return!1;const N=Object.getPrototypeOf(G);return null===N||N===Object.prototype}},8596:(J,G,N)=>{"use strict";const{URLWithLegacySupport:h,format:u,URLSearchParams:g,defaultBase:b}=N(5695),w=N(340);J.exports={URL:h,URLSearchParams:g,format:u,relative:w,defaultBase:b}},340:(J,G,N)=>{"use strict";const{URLWithLegacySupport:h,format:u}=N(5695);J.exports=(g,b={},w={},v)=>{let p,l=b.protocol?b.protocol.replace(":",""):"http";l=(w[l]||v||l)+":";try{p=new h(g)}catch{p={}}const d=Object.assign({},b,{protocol:l||p.protocol,host:b.host||p.host});return new h(g,u(d)).toString()}},5695:J=>{"use strict";const G=typeof navigator<"u"&&"ReactNative"===navigator.product,h=self.URL,u=function N(){return G?"http://localhost":self.location?self.location.protocol+"//"+self.location.host:""}();J.exports={URLWithLegacySupport:class g{constructor(v="",l=u){this.super=new h(v,l),this.path=this.pathname+this.search,this.auth=this.username&&this.password?this.username+":"+this.password:null,this.query=this.search&&this.search.startsWith("?")?this.search.slice(1):null}get hash(){return this.super.hash}get host(){return this.super.host}get hostname(){return this.super.hostname}get href(){return this.super.href}get origin(){return this.super.origin}get password(){return this.super.password}get pathname(){return this.super.pathname}get port(){return this.super.port}get protocol(){return this.super.protocol}get search(){return this.super.search}get searchParams(){return this.super.searchParams}get username(){return this.super.username}set hash(v){this.super.hash=v}set host(v){this.super.host=v}set hostname(v){this.super.hostname=v}set href(v){this.super.href=v}set password(v){this.super.password=v}set pathname(v){this.super.pathname=v}set port(v){this.super.port=v}set protocol(v){this.super.protocol=v}set search(v){this.super.search=v}set username(v){this.super.username=v}static createObjectURL(v){return h.createObjectURL(v)}static revokeObjectURL(v){h.revokeObjectURL(v)}toJSON(){return this.super.toJSON()}toString(){return this.super.toString()}format(){return this.toString()}},URLSearchParams:self.URLSearchParams,defaultBase:u,format:function b(w){if("string"==typeof w)return new h(w).toString();if(!(w instanceof h)){const l=w.auth?w.auth+"@":"",p=w.port?":"+w.port:"",I=w.hostname||"",E=w.search||(w.query?"?"+w.query:""),f=w.pathname||"";return`${w.protocol?w.protocol+"//":""}${(w.username&&w.password?`${w.username}:${w.password}@`:"")||l}${w.host||I+p}${w.path||f+E}${w.hash||""}`}}}},5357:(J,G,N)=>{"use strict";var h=N(7156).default,u=N(8237).default;J.exports=function(){var b=h(function*(w){const v=[];var d,l=!1,p=!1;try{for(var I,_=u(w);l=!(I=yield _.next()).done;l=!1)v.push(I.value)}catch(E){p=!0,d=E}finally{try{l&&null!=_.return&&(yield _.return())}finally{if(p)throw d}}return v});return function(v){return b.apply(this,arguments)}}()},7414:(J,G,N)=>{"use strict";var h=N(7156).default,u=N(8237).default;J.exports=function(){var b=h(function*(w){var p,v=!1,l=!1;try{for(var d=u(w);v=!(yield d.next()).done;v=!1);}catch(I){l=!0,p=I}finally{try{v&&null!=d.return&&(yield d.return())}finally{if(l)throw p}}});return function(v){return b.apply(this,arguments)}}()},6225:(J,G,N)=>{"use strict";var h=N(6737).default,u=N(8186).default,g=N(8237).default;J.exports=function(){var w=u(function*(v,l){var _,p=!1,d=!1;try{for(var E,I=g(v);p=!(E=yield h(I.next())).done;p=!1){const y=E.value;(yield h(l(y)))&&(yield y)}}catch(y){d=!0,_=y}finally{try{p&&null!=I.return&&(yield h(I.return()))}finally{if(d)throw _}}});return function(l,p){return w.apply(this,arguments)}}()},4943:(J,G,N)=>{"use strict";var h=N(7156).default,u=N(8237).default;J.exports=function(){var b=h(function*(w){var p,v=!1,l=!1;try{for(var _,d=u(w);v=!(_=yield d.next()).done;v=!1)return _.value}catch(I){l=!0,p=I}finally{try{v&&null!=d.return&&(yield d.return())}finally{if(l)throw p}}});return function(v){return b.apply(this,arguments)}}()},1349:(J,G,N)=>{"use strict";var h=N(6737).default,u=N(8186).default,g=N(8237).default;J.exports=function(){var w=u(function*(v,l){var _,p=!1,d=!1;try{for(var E,I=g(v);p=!(E=yield h(I.next())).done;p=!1){const y=E.value;yield h(l(y)),yield y}}catch(y){d=!0,_=y}finally{try{p&&null!=I.return&&(yield h(I.return()))}finally{if(d)throw _}}});return function(l,p){return w.apply(this,arguments)}}()},6930:(J,G,N)=>{"use strict";var h=N(6737).default,u=N(8186).default,g=N(8237).default;J.exports=function(){var w=u(function*(v,l){var _,p=!1,d=!1;try{for(var E,I=g(v);p=!(E=yield h(I.next())).done;p=!1){const y=E.value;yield l(y)}}catch(y){d=!0,_=y}finally{try{p&&null!=I.return&&(yield h(I.return()))}finally{if(d)throw _}}});return function(l,p){return w.apply(this,arguments)}}()},5061:(J,G,N)=>{"use strict";var h=N(7156).default,u=N(8186).default,g=N(6737).default,b=N(8237).default,w=N(8131).default;const v=N(6343);J.exports=function(){var p=u(function*(...d){const _=v();setTimeout(h(function*(){try{yield Promise.all(d.map(function(){var I=h(function*(E){var C,y=!1,f=!1;try{for(var P,A=b(E);y=!(P=yield A.next()).done;y=!1)_.push(P.value)}catch(D){f=!0,C=D}finally{try{y&&null!=A.return&&(yield A.return())}finally{if(f)throw C}}});return function(E){return I.apply(this,arguments)}}())),_.end()}catch(I){_.end(I)}}),0),yield*w(b(_),g)});return function(){return p.apply(this,arguments)}}()},6343:(J,G,N)=>{const h=N(1159);J.exports=u=>{let g;"function"==typeof(u=u||{})?(g=u,u={}):g=u.onEnd;let w,v,l,b=new h;const d=A=>v?v(A):(b.push(A),w),I=A=>l?w:d({done:!1,value:A}),E=A=>l?w:(l=!0,A?(A=>(b=new h,v?v({error:A}):(b.push({error:A}),w)))(A):d({done:!0}));if(w={[Symbol.asyncIterator](){return this},next:()=>{if(!b.isEmpty()){if(u.writev){let P;const D=[];for(;!b.isEmpty();){if(P=b.shift(),P.error)throw P.error;D.push(P.value)}return{done:P.done,value:D}}const A=b.shift();if(A.error)throw A.error;return A}return l?{done:!0}:new Promise((A,P)=>{v=D=>(v=null,D.error?P(D.error):A(u.writev&&!D.done?{done:D.done,value:[D.value]}:D),w)})},return:()=>(b=new h,E(),{done:!0}),throw:A=>(E(A),{done:!0}),push:I,end:E},!g)return w;const C=w;return w={[Symbol.asyncIterator](){return this},next:()=>C.next(),throw:A=>(C.throw(A),g&&(g(A),g=null),{done:!0}),return:()=>(C.return(),g&&(g(),g=null),{done:!0}),push:I,end:A=>(C.end(A),g&&(g(A),g=null),w)},w}},4297:(J,G,N)=>{"use strict";var h=N(8186).default,u=N(6737).default,g=N(8237).default,b=N(8131).default;const w=N(5357);J.exports=function(){var l=h(function*(p,d){const _=yield u(w(p));yield*b(g(_.sort(d)),u)});return function(d,_){return l.apply(this,arguments)}}()},0:(J,G,N)=>{"use strict";var h=N(6737).default,u=N(8186).default,g=N(8237).default;J.exports=function(){var w=u(function*(v,l){let p=0;if(!(l<1)){var I,d=!1,_=!1;try{for(var y,E=g(v);d=!(y=yield h(E.next())).done;d=!1)if(yield y.value,p++,p===l)return}catch(f){_=!0,I=f}finally{try{d&&null!=E.return&&(yield h(E.return()))}finally{if(_)throw I}}}});return function(l,p){return w.apply(this,arguments)}}()},4237:(J,G,N)=>{var h;!function(){"use strict";var u="input is invalid type",b="object"==typeof window,w=b?window:{};w.JS_SHA3_NO_WINDOW&&(b=!1);var v=!b&&"object"==typeof self;!w.JS_SHA3_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node?w=global:v&&(w=self);var p=!w.JS_SHA3_NO_COMMON_JS&&J.exports,d=N.amdO,_=!w.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",I="0123456789abcdef".split(""),y=[4,1024,262144,67108864],A=[0,8,16,24],P=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],D=[224,256,384,512],x=[128,256],M=["hex","buffer","arrayBuffer","array","digest"],B={128:168,256:136};(w.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(K){return"[object Array]"===Object.prototype.toString.call(K)}),_&&(w.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(K){return"object"==typeof K&&K.buffer&&K.buffer.constructor===ArrayBuffer});for(var F=function(K,Ee,Ce){return function(xe){return new Pe(K,Ee,K).update(xe)[Ce]()}},z=function(K,Ee,Ce){return function(xe,Ke){return new Pe(K,Ee,Ke).update(xe)[Ce]()}},S=function(K,Ee,Ce){return function(xe,Ke,We,Je){return Z["cshake"+K].update(xe,Ke,We,Je)[Ce]()}},O=function(K,Ee,Ce){return function(xe,Ke,We,Je){return Z["kmac"+K].update(xe,Ke,We,Je)[Ce]()}},H=function(K,Ee,Ce,xe){for(var Ke=0;Ke>5,this.byteCount=this.blockCount<<2,this.outputBlocks=Ce>>5,this.extraBytes=(31&Ce)>>3;for(var xe=0;xe<50;++xe)this.s[xe]=0}function we(K,Ee,Ce){Pe.call(this,K,Ee,Ce)}Pe.prototype.update=function(K){if(this.finalized)throw new Error("finalize already called");var Ee,Ce=typeof K;if("string"!==Ce){if("object"!==Ce)throw new Error(u);if(null===K)throw new Error(u);if(_&&K.constructor===ArrayBuffer)K=new Uint8Array(K);else if(!(Array.isArray(K)||_&&ArrayBuffer.isView(K)))throw new Error(u);Ee=!0}for(var pt,Dt,xe=this.blocks,Ke=this.byteCount,We=K.length,Je=this.blockCount,Xe=0,Ot=this.s;Xe>2]|=K[Xe]<>2]|=Dt<>2]|=(192|Dt>>6)<>2]|=(128|63&Dt)<=57344?(xe[pt>>2]|=(224|Dt>>12)<>2]|=(128|Dt>>6&63)<>2]|=(128|63&Dt)<>2]|=(240|Dt>>18)<>2]|=(128|Dt>>12&63)<>2]|=(128|Dt>>6&63)<>2]|=(128|63&Dt)<=Ke){for(this.start=pt-Ke,this.block=xe[Je],pt=0;pt>=8);Ce>0;)Ke.unshift(Ce),Ce=255&(K>>=8),++xe;return Ee?Ke.push(xe):Ke.unshift(xe),this.update(Ke),Ke.length},Pe.prototype.encodeString=function(K){var Ee,Ce=typeof K;if("string"!==Ce){if("object"!==Ce)throw new Error(u);if(null===K)throw new Error(u);if(_&&K.constructor===ArrayBuffer)K=new Uint8Array(K);else if(!(Array.isArray(K)||_&&ArrayBuffer.isView(K)))throw new Error(u);Ee=!0}var xe=0;if(Ee)xe=K.length;else for(var We=0;We=57344?xe+=3:(Je=65536+((1023&Je)<<10|1023&K.charCodeAt(++We)),xe+=4)}return xe+=this.encode(8*xe),this.update(K),xe},Pe.prototype.bytepad=function(K,Ee){for(var Ce=this.encode(Ee),xe=0;xe>2]|=this.padding[3&Ee],this.lastByteIndex===this.byteCount)for(K[0]=K[Ce],Ee=1;Ee>4&15]+I[15&Xe]+I[Xe>>12&15]+I[Xe>>8&15]+I[Xe>>20&15]+I[Xe>>16&15]+I[Xe>>28&15]+I[Xe>>24&15];We%K==0&&($e(Ee),Ke=0)}return xe&&(Je+=I[(Xe=Ee[Ke])>>4&15]+I[15&Xe],xe>1&&(Je+=I[Xe>>12&15]+I[Xe>>8&15]),xe>2&&(Je+=I[Xe>>20&15]+I[Xe>>16&15])),Je},Pe.prototype.buffer=Pe.prototype.arrayBuffer=function(){this.finalize();var Xe,K=this.blockCount,Ee=this.s,Ce=this.outputBlocks,xe=this.extraBytes,Ke=0,We=0,Je=this.outputBits>>3;Xe=xe?new ArrayBuffer(Ce+1<<2):new ArrayBuffer(Je);for(var Ot=new Uint32Array(Xe);We>8&255,Je[Xe+2]=Ot>>16&255,Je[Xe+3]=Ot>>24&255;We%K==0&&$e(Ee)}return xe&&(Je[Xe=We<<2]=255&(Ot=Ee[Ke]),xe>1&&(Je[Xe+1]=Ot>>8&255),xe>2&&(Je[Xe+2]=Ot>>16&255)),Je},(we.prototype=new Pe).finalize=function(){return this.encode(this.outputBits,!0),Pe.prototype.finalize.call(this)};var $e=function(K){var Ee,Ce,xe,Ke,We,Je,Xe,Ot,pt,Dt,Wr,Sr,ni,ie,fe,ye,me,_e,Ne,Ye,qe,st,nt,je,be,ge,De,Ue,Be,dt,Pt,vt,et,Pn,Bt,yn,tn,ft,hn,ot,Kt,bt,lr,Hr,Fn,bn,vr,rr,_n,Ft,ut,ce,ve,yt,St,mn,Ge,Qe,Te,ze,ht,Et,lt;for(xe=0;xe<48;xe+=2)Ke=K[0]^K[10]^K[20]^K[30]^K[40],We=K[1]^K[11]^K[21]^K[31]^K[41],Ot=K[4]^K[14]^K[24]^K[34]^K[44],pt=K[5]^K[15]^K[25]^K[35]^K[45],Dt=K[6]^K[16]^K[26]^K[36]^K[46],Wr=K[7]^K[17]^K[27]^K[37]^K[47],Ce=(ni=K[9]^K[19]^K[29]^K[39]^K[49])^((Xe=K[3]^K[13]^K[23]^K[33]^K[43])<<1|(Je=K[2]^K[12]^K[22]^K[32]^K[42])>>>31),K[0]^=Ee=(Sr=K[8]^K[18]^K[28]^K[38]^K[48])^(Je<<1|Xe>>>31),K[1]^=Ce,K[10]^=Ee,K[11]^=Ce,K[20]^=Ee,K[21]^=Ce,K[30]^=Ee,K[31]^=Ce,K[40]^=Ee,K[41]^=Ce,Ce=We^(pt<<1|Ot>>>31),K[2]^=Ee=Ke^(Ot<<1|pt>>>31),K[3]^=Ce,K[12]^=Ee,K[13]^=Ce,K[22]^=Ee,K[23]^=Ce,K[32]^=Ee,K[33]^=Ce,K[42]^=Ee,K[43]^=Ce,Ce=Xe^(Wr<<1|Dt>>>31),K[4]^=Ee=Je^(Dt<<1|Wr>>>31),K[5]^=Ce,K[14]^=Ee,K[15]^=Ce,K[24]^=Ee,K[25]^=Ce,K[34]^=Ee,K[35]^=Ce,K[44]^=Ee,K[45]^=Ce,Ce=pt^(ni<<1|Sr>>>31),K[6]^=Ee=Ot^(Sr<<1|ni>>>31),K[7]^=Ce,K[16]^=Ee,K[17]^=Ce,K[26]^=Ee,K[27]^=Ce,K[36]^=Ee,K[37]^=Ce,K[46]^=Ee,K[47]^=Ce,Ce=Wr^(We<<1|Ke>>>31),K[8]^=Ee=Dt^(Ke<<1|We>>>31),K[9]^=Ce,K[18]^=Ee,K[19]^=Ce,K[28]^=Ee,K[29]^=Ce,K[38]^=Ee,K[39]^=Ce,K[48]^=Ee,K[49]^=Ce,fe=K[1],bn=K[11]<<4|K[10]>>>28,vr=K[10]<<4|K[11]>>>28,Ue=K[20]<<3|K[21]>>>29,Be=K[21]<<3|K[20]>>>29,ze=K[31]<<9|K[30]>>>23,ht=K[30]<<9|K[31]>>>23,bt=K[40]<<18|K[41]>>>14,lr=K[41]<<18|K[40]>>>14,Pn=K[2]<<1|K[3]>>>31,Bt=K[3]<<1|K[2]>>>31,me=K[12]<<12|K[13]>>>20,rr=K[22]<<10|K[23]>>>22,_n=K[23]<<10|K[22]>>>22,dt=K[33]<<13|K[32]>>>19,Pt=K[32]<<13|K[33]>>>19,Et=K[42]<<2|K[43]>>>30,lt=K[43]<<2|K[42]>>>30,yt=K[5]<<30|K[4]>>>2,St=K[4]<<30|K[5]>>>2,yn=K[14]<<6|K[15]>>>26,tn=K[15]<<6|K[14]>>>26,Ne=K[24]<<11|K[25]>>>21,Ft=K[34]<<15|K[35]>>>17,ut=K[35]<<15|K[34]>>>17,vt=K[45]<<29|K[44]>>>3,et=K[44]<<29|K[45]>>>3,je=K[6]<<28|K[7]>>>4,be=K[7]<<28|K[6]>>>4,mn=K[17]<<23|K[16]>>>9,Ge=K[16]<<23|K[17]>>>9,ft=K[26]<<25|K[27]>>>7,hn=K[27]<<25|K[26]>>>7,Ye=K[36]<<21|K[37]>>>11,qe=K[37]<<21|K[36]>>>11,ce=K[47]<<24|K[46]>>>8,ve=K[46]<<24|K[47]>>>8,Hr=K[8]<<27|K[9]>>>5,Fn=K[9]<<27|K[8]>>>5,ge=K[18]<<20|K[19]>>>12,De=K[19]<<20|K[18]>>>12,Qe=K[29]<<7|K[28]>>>25,Te=K[28]<<7|K[29]>>>25,ot=K[38]<<8|K[39]>>>24,Kt=K[39]<<8|K[38]>>>24,st=K[48]<<14|K[49]>>>18,nt=K[49]<<14|K[48]>>>18,K[0]=(ie=K[0])^~(ye=K[13]<<12|K[12]>>>20)&(_e=K[25]<<11|K[24]>>>21),K[1]=fe^~me&Ne,K[10]=je^~ge&Ue,K[11]=be^~De&Be,K[20]=Pn^~yn&ft,K[21]=Bt^~tn&hn,K[30]=Hr^~bn&rr,K[31]=Fn^~vr&_n,K[40]=yt^~mn&Qe,K[41]=St^~Ge&Te,K[2]=ye^~_e&Ye,K[3]=me^~Ne&qe,K[12]=ge^~Ue&dt,K[13]=De^~Be&Pt,K[22]=yn^~ft&ot,K[23]=tn^~hn&Kt,K[32]=bn^~rr&Ft,K[33]=vr^~_n&ut,K[42]=mn^~Qe&ze,K[43]=Ge^~Te&ht,K[4]=_e^~Ye&st,K[5]=Ne^~qe&nt,K[14]=Ue^~dt&vt,K[15]=Be^~Pt&et,K[24]=ft^~ot&bt,K[25]=hn^~Kt&lr,K[34]=rr^~Ft&ce,K[35]=_n^~ut&ve,K[44]=Qe^~ze&Et,K[45]=Te^~ht<,K[6]=Ye^~st&ie,K[7]=qe^~nt&fe,K[16]=dt^~vt&je,K[17]=Pt^~et&be,K[26]=ot^~bt&Pn,K[27]=Kt^~lr&Bt,K[36]=Ft^~ce&Hr,K[37]=ut^~ve&Fn,K[46]=ze^~Et&yt,K[47]=ht^~lt&St,K[8]=st^~ie&ye,K[9]=nt^~fe&me,K[18]=vt^~je&ge,K[19]=et^~be&De,K[28]=bt^~Pn&yn,K[29]=lr^~Bt&tn,K[38]=ce^~Hr&bn,K[39]=ve^~Fn&vr,K[48]=Et^~yt&mn,K[49]=lt^~St&Ge,K[0]^=P[xe],K[1]^=P[xe+1]};if(p)J.exports=Z;else{for(ne=0;neObject.defineProperty(f,C,{value:A,writable:!0,enumerable:!0,configurable:!0}),w=this,v={concatArrays:!1,ignoreUndefined:!1},l=f=>{const C=[];for(const A in f)u.call(f,A)&&C.push(A);if(Object.getOwnPropertySymbols){const A=Object.getOwnPropertySymbols(f);for(const P of A)g.call(f,P)&&C.push(P)}return C};function p(f){return Array.isArray(f)?function d(f){const C=f.slice(0,0);return l(f).forEach(A=>{b(C,A,p(f[A]))}),C}(f):h(f)?function _(f){const C=null===Object.getPrototypeOf(f)?Object.create(null):{};return l(f).forEach(A=>{b(C,A,p(f[A]))}),C}(f):f}const I=(f,C,A,P)=>(A.forEach(D=>{typeof C[D]>"u"&&P.ignoreUndefined||(D in f&&f[D]!==Object.getPrototypeOf(f)?b(f,D,y(f[D],C[D],P)):b(f,D,p(C[D])))}),f);function y(f,C,A){return A.concatArrays&&Array.isArray(f)&&Array.isArray(C)?((f,C,A)=>{let P=f.slice(0,0),D=0;return[f,C].forEach(x=>{const M=[];for(let B=0;B!M.includes(B)),A)}),P})(f,C,A):h(C)&&h(f)?I(f,C,l(C),A):p(C)}J.exports=function(...f){const C=y(p(v),this!==w&&this||{},v);let A={_:{}};for(const P of f)if(void 0!==P){if(!h(P))throw new TypeError("`"+P+"` is not an Option Object");A=y(A,{_:P},C)}return A._}},4366:J=>{var G=1e3,N=60*G,h=60*N,u=24*h;function p(d,_,I,E){var y=_>=1.5*I;return Math.round(d/I)+" "+E+(y?"s":"")}J.exports=function(d,_){_=_||{};var I=typeof d;if("string"===I&&d.length>0)return function w(d){if(!((d=String(d)).length>100)){var _=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(d);if(_){var I=parseFloat(_[1]);switch((_[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*I;case"weeks":case"week":case"w":return 6048e5*I;case"days":case"day":case"d":return I*u;case"hours":case"hour":case"hrs":case"hr":case"h":return I*h;case"minutes":case"minute":case"mins":case"min":case"m":return I*N;case"seconds":case"second":case"secs":case"sec":case"s":return I*G;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return I;default:return}}}}(d);if("number"===I&&isFinite(d))return _.long?function l(d){var _=Math.abs(d);return _>=u?p(d,_,u,"day"):_>=h?p(d,_,h,"hour"):_>=N?p(d,_,N,"minute"):_>=G?p(d,_,G,"second"):d+" ms"}(d):function v(d){var _=Math.abs(d);return _>=u?Math.round(d/u)+"d":_>=h?Math.round(d/h)+"h":_>=N?Math.round(d/N)+"m":_>=G?Math.round(d/G)+"s":d+"ms"}(d);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(d))}},344:J=>{"use strict";function G(N){if(Array.isArray(N)){for(var h=0,u=Array(N.length);h>>24,(p&255<<16)>>>16,(65280&p)>>>8,255&p].join(".")},v=function(p){var d,I,E,y,f;for(d=[],I=E=0;E<=3&&0!==p.length;I=++E){if(I>0){if("."!==p[0])throw new Error("Invalid IP");p=p.substring(1)}y=(f=h(p))[0],p=p.substring(f[1]),d.push(y)}if(0!==p.length)throw new Error("Invalid IP");switch(d.length){case 1:if(d[0]>4294967295)throw new Error("Invalid IP");return d[0]>>>0;case 2:if(d[0]>255||d[1]>16777215)throw new Error("Invalid IP");return(d[0]<<24|d[1])>>>0;case 3:if(d[0]>255||d[1]>255||d[2]>65535)throw new Error("Invalid IP");return(d[0]<<24|d[1]<<16|d[2])>>>0;case 4:if(d[0]>255||d[1]>255||d[2]>255||d[3]>255)throw new Error("Invalid IP");return(d[0]<<24|d[1]<<16|d[2]<<8|d[3])>>>0;default:throw new Error("Invalid IP")}},g=(u=function(p){return p.charCodeAt(0)})("0"),w=u("a"),b=u("A"),h=function(p){var d,_,I,E,y;for(E=0,d=10,_="9",I=0,p.length>1&&"0"===p[I]&&("x"===p[I+1]||"X"===p[I+1]?(I+=2,d=16):"0"<=p[I+1]&&p[I+1]<="9"&&(I++,d=8,_="7")),y=I;I>>0;else{if(16!==d)break;if("a"<=p[I]&&p[I]<="f")E=E*d+(10+u(p[I])-w)>>>0;else{if(!("A"<=p[I]&&p[I]<="F"))break;E=E*d+(10+u(p[I])-b)>>>0}}if(E>4294967295)throw new Error("too large");I++}if(I===y)throw new Error("empty octet");return[E,I]},N=function(){function p(d,_){var E,y,f;if("string"!=typeof d)throw new Error("Missing `net' parameter");if(_||(f=d.split("/",2),d=f[0],_=f[1]),_||(_=32),"string"==typeof _&&_.indexOf(".")>-1){try{this.maskLong=v(_)}catch(C){throw new Error("Invalid mask: "+_)}for(E=y=32;y>=0;E=--y)if(this.maskLong===4294967295<<32-E>>>0){this.bitmask=E;break}}else{if(!_&&0!==_)throw new Error("Invalid mask: empty");this.bitmask=parseInt(_,10),this.maskLong=0,this.bitmask>0&&(this.maskLong=4294967295<<32-this.bitmask>>>0)}try{this.netLong=(v(d)&this.maskLong)>>>0}catch(C){throw new Error("Invalid net address: "+d)}if(!(this.bitmask<=32))throw new Error("Invalid mask for ip4: "+_);this.size=Math.pow(2,32-this.bitmask),this.base=l(this.netLong),this.mask=l(this.maskLong),this.hostmask=l(~this.maskLong),this.first=this.bitmask<=30?l(this.netLong+1):this.base,this.last=l(this.bitmask<=30?this.netLong+this.size-2:this.netLong+this.size-1),this.broadcast=this.bitmask<=30?l(this.netLong+this.size-1):void 0}return p.prototype.contains=function(d){return"string"==typeof d&&(d.indexOf("/")>0||4!==d.split(".").length)&&(d=new p(d)),d instanceof p?this.contains(d.base)&&this.contains(d.broadcast||d.last):(v(d)&this.maskLong)>>>0==(this.netLong&this.maskLong)>>>0},p.prototype.next=function(d){return null==d&&(d=1),new p(l(this.netLong+this.size*d),this.mask)},p.prototype.forEach=function(d){var _,I,E;for(E=v(this.first),I=v(this.last),_=0;E<=I;)d(l(E),E,_),_++,E++},p.prototype.toString=function(){return this.base+"/"+this.bitmask},p}(),G.ip2long=v,G.long2ip=l,G.Netmask=N}).call(this)},1298:(J,G,N)=>{var h=N(8659);function u(f,C){h.cipher.registerAlgorithm(f,function(){return new h.aes.Algorithm(f,C)})}N(3311),N(3481),N(4747),J.exports=h.aes=h.aes||{},h.aes.startEncrypting=function(f,C,A,P){var D=y({key:f,output:A,decrypt:!1,mode:P});return D.start(C),D},h.aes.createEncryptionCipher=function(f,C){return y({key:f,output:null,decrypt:!1,mode:C})},h.aes.startDecrypting=function(f,C,A,P){var D=y({key:f,output:A,decrypt:!0,mode:P});return D.start(C),D},h.aes.createDecryptionCipher=function(f,C){return y({key:f,output:null,decrypt:!0,mode:C})},h.aes.Algorithm=function(f,C){g||_();var A=this;A.name=f,A.mode=new C({blockSize:16,cipher:{encrypt:function(P,D){return E(A._w,P,D,!1)},decrypt:function(P,D){return E(A._w,P,D,!0)}}}),A._init=!1},h.aes.Algorithm.prototype.initialize=function(f){if(!this._init){var A,C=f.key;if("string"!=typeof C||16!==C.length&&24!==C.length&&32!==C.length){if(h.util.isArray(C)&&(16===C.length||24===C.length||32===C.length)){A=C,C=h.util.createBuffer();for(var P=0;P>>=2,P=0;P>8^255&B^99,v[B]=A,z=(F=f[B])<<24^B<<16^B<<8^B^F,S=((D=f[A])^(x=f[D])^(M=f[x]))<<24^(A^M)<<16^(A^x^M)<<8^A^D^M;for(var O=0;O<4;++O)p[O][A]=z,d[O][B]=S,z=z<<24|z>>>8,S=S<<24|S>>>8;0===A?A=P=1:(A=D^f[f[f[D^M]]],P^=f[f[P]])}}function I(f,C){for(var P,A=f.slice(0),D=1,x=A.length,B=4*(x+6+1),F=x;F>>16&255]<<24^w[P>>>8&255]<<16^w[255&P]<<8^w[P>>>24]^l[D]<<24,D++):x>6&&F%x==4&&(P=w[P>>>24]<<24^w[P>>>16&255]<<16^w[P>>>8&255]<<8^w[255&P]),A[F]=A[F-x]^P;if(C){for(var z,S=d[0],O=d[1],H=d[2],L=d[3],j=A.slice(0),re=(F=0,(B=A.length)-4);F>>24]]^O[w[z>>>16&255]]^H[w[z>>>8&255]]^L[w[255&z]];A=j}return A}function E(f,C,A,P){var x,M,B,F,z,S,O,H,L,j,re,$,D=f.length/4-1;P?(x=d[0],M=d[1],B=d[2],F=d[3],z=v):(x=p[0],M=p[1],B=p[2],F=p[3],z=w),S=C[0]^f[0],O=C[P?3:1]^f[1],H=C[2]^f[2],L=C[P?1:3]^f[3];for(var te=3,Z=1;Z>>24]^M[O>>>16&255]^B[H>>>8&255]^F[255&L]^f[++te],re=x[O>>>24]^M[H>>>16&255]^B[L>>>8&255]^F[255&S]^f[++te],$=x[H>>>24]^M[L>>>16&255]^B[S>>>8&255]^F[255&O]^f[++te],L=x[L>>>24]^M[S>>>16&255]^B[O>>>8&255]^F[255&H]^f[++te],S=j,O=re,H=$;A[0]=z[S>>>24]<<24^z[O>>>16&255]<<16^z[H>>>8&255]<<8^z[255&L]^f[++te],A[P?3:1]=z[O>>>24]<<24^z[H>>>16&255]<<16^z[L>>>8&255]<<8^z[255&S]^f[++te],A[2]=z[H>>>24]<<24^z[L>>>16&255]<<16^z[S>>>8&255]<<8^z[255&O]^f[++te],A[P?1:3]=z[L>>>24]<<24^z[S>>>16&255]<<16^z[O>>>8&255]<<8^z[255&H]^f[++te]}function y(f){var P,A="AES-"+((f=f||{}).mode||"CBC").toUpperCase(),D=(P=f.decrypt?h.cipher.createDecipher(A,f.key):h.cipher.createCipher(A,f.key)).start;return P.start=function(x,M){var B=null;M instanceof h.util.ByteBuffer&&(B=M,M={}),(M=M||{}).output=B,M.iv=x,D.call(P,M)},P}},7791:(J,G,N)=>{var h=N(8659);N(4747),N(6078);var u=J.exports=h.asn1=h.asn1||{};function g(l,p,d){if(d>p){var _=new Error("Too few bytes to parse DER.");throw _.available=l.length(),_.remaining=p,_.requested=d,_}}function w(l,p,d,_){var I;g(l,p,2);var E=l.getByte();p--;var y=192&E,f=31&E;I=l.length();var C=function(l,p){var d=l.getByte();if(p--,128!==d){var _;if(128&d){var E=127&d;g(l,p,E),_=l.getInt(E<<3)}else _=d;if(_<0)throw new Error("Negative length: "+_);return _}}(l,p);if(p-=I-l.length(),void 0!==C&&C>p){if(_.strict){var A=new Error("Too few bytes to read ASN.1 value.");throw A.available=l.length(),A.remaining=p,A.requested=C,A}C=p}var P,D,x=32==(32&E);if(x)if(P=[],void 0===C)for(;;){if(g(l,p,2),l.bytes(2)===String.fromCharCode(0,0)){l.getBytes(2),p-=2;break}I=l.length(),P.push(w(l,p,d+1,_)),p-=I-l.length()}else for(;C>0;)I=l.length(),P.push(w(l,C,d+1,_)),p-=I-l.length(),C-=I-l.length();if(void 0===P&&y===u.Class.UNIVERSAL&&f===u.Type.BITSTRING&&(D=l.bytes(C)),void 0===P&&_.decodeBitStrings&&y===u.Class.UNIVERSAL&&f===u.Type.BITSTRING&&C>1){var M=l.read,B=p,F=0;if(f===u.Type.BITSTRING&&(g(l,p,1),F=l.getByte(),p--),0===F)try{I=l.length();var S=w(l,p,d+1,{strict:!0,decodeBitStrings:!0}),O=I-l.length();p-=O,f==u.Type.BITSTRING&&O++;var H=S.tagClass;O===C&&(H===u.Class.UNIVERSAL||H===u.Class.CONTEXT_SPECIFIC)&&(P=[S])}catch{}void 0===P&&(l.read=M,p=B)}if(void 0===P){if(void 0===C){if(_.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");C=p}if(f===u.Type.BMPSTRING)for(P="";C>0;C-=2)g(l,p,2),P+=String.fromCharCode(l.getInt16()),p-=2;else P=l.getBytes(C),p-=C}return u.create(y,f,x,P,void 0===D?null:{bitStringContents:D})}u.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},u.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},u.create=function(l,p,d,_,I){if(h.util.isArray(_)){for(var E=[],y=0;y<_.length;++y)void 0!==_[y]&&E.push(_[y]);_=E}var f={tagClass:l,type:p,constructed:d,composed:d||h.util.isArray(_),value:_};return I&&"bitStringContents"in I&&(f.bitStringContents=I.bitStringContents,f.original=u.copy(f)),f},u.copy=function(l,p){var d;if(h.util.isArray(l)){d=[];for(var _=0;_1&&(0===l.value.charCodeAt(0)&&0==(128&l.value.charCodeAt(1))||255===l.value.charCodeAt(0)&&128==(128&l.value.charCodeAt(1)))?_.putBytes(l.value.substr(1)):_.putBytes(l.value);if(p.putByte(d),_.length()<=127)p.putByte(127&_.length());else{var y=_.length(),f="";do{f+=String.fromCharCode(255&y),y>>>=8}while(y>0);for(p.putByte(128|f.length),E=f.length-1;E>=0;--E)p.putByte(f.charCodeAt(E))}return p.putBuffer(_),p},u.oidToDer=function(l){var p=l.split("."),d=h.util.createBuffer();d.putByte(40*parseInt(p[0],10)+parseInt(p[1],10));for(var _,I,E,y,f=2;f>>=7,_||(y|=128),I.push(y),_=!1}while(E>0);for(var C=I.length-1;C>=0;--C)d.putByte(I[C])}return d},u.derToOid=function(l){var p;"string"==typeof l&&(l=h.util.createBuffer(l));var d=l.getByte();p=Math.floor(d/40)+"."+d%40;for(var _=0;l.length()>0;)_<<=7,128&(d=l.getByte())?_+=127&d:(p+="."+(_+d),_=0);return p},u.utcTimeToDate=function(l){var p=new Date,d=parseInt(l.substr(0,2),10);d=d>=50?1900+d:2e3+d;var _=parseInt(l.substr(2,2),10)-1,I=parseInt(l.substr(4,2),10),E=parseInt(l.substr(6,2),10),y=parseInt(l.substr(8,2),10),f=0;if(l.length>11){var C=l.charAt(10),A=10;"+"!==C&&"-"!==C&&(f=parseInt(l.substr(10,2),10),A+=2)}if(p.setUTCFullYear(d,_,I),p.setUTCHours(E,y,f,0),A&&("+"===(C=l.charAt(A))||"-"===C)){var x=60*parseInt(l.substr(A+1,2),10)+parseInt(l.substr(A+4,2),10);x*=6e4,p.setTime("+"===C?+p-x:+p+x)}return p},u.generalizedTimeToDate=function(l){var p=new Date,d=parseInt(l.substr(0,4),10),_=parseInt(l.substr(4,2),10)-1,I=parseInt(l.substr(6,2),10),E=parseInt(l.substr(8,2),10),y=parseInt(l.substr(10,2),10),f=parseInt(l.substr(12,2),10),C=0,A=0,P=!1;"Z"===l.charAt(l.length-1)&&(P=!0);var D=l.length-5,x=l.charAt(D);return"+"!==x&&"-"!==x||(A=60*parseInt(l.substr(D+1,2),10)+parseInt(l.substr(D+4,2),10),A*=6e4,"+"===x&&(A*=-1),P=!0),"."===l.charAt(14)&&(C=1e3*parseFloat(l.substr(14),10)),P?(p.setUTCFullYear(d,_,I),p.setUTCHours(E,y,f,C),p.setTime(+p+A)):(p.setFullYear(d,_,I),p.setHours(E,y,f,C)),p},u.dateToUtcTime=function(l){if("string"==typeof l)return l;var p="",d=[];d.push((""+l.getUTCFullYear()).substr(2)),d.push(""+(l.getUTCMonth()+1)),d.push(""+l.getUTCDate()),d.push(""+l.getUTCHours()),d.push(""+l.getUTCMinutes()),d.push(""+l.getUTCSeconds());for(var _=0;_=-128&&l<128)return p.putSignedInt(l,8);if(l>=-32768&&l<32768)return p.putSignedInt(l,16);if(l>=-8388608&&l<8388608)return p.putSignedInt(l,24);if(l>=-2147483648&&l<2147483648)return p.putSignedInt(l,32);var d=new Error("Integer too large; max is 32-bits.");throw d.integer=l,d},u.derToInteger=function(l){"string"==typeof l&&(l=h.util.createBuffer(l));var p=8*l.length();if(p>32)throw new Error("Integer too large; max is 32-bits.");return l.getSignedInt(p)},u.validate=function(l,p,d,_){var I=!1;if((l.tagClass===p.tagClass||typeof p.tagClass>"u")&&(l.type===p.type||typeof p.type>"u"))if(l.constructed===p.constructed||typeof p.constructed>"u"){if(I=!0,p.value&&h.util.isArray(p.value))for(var E=0,y=0;I&&y0&&(_+="\n");for(var I="",E=0;E1?"0x"+h.util.bytesToHex(l.value.slice(1)):"(none)",l.value.length>0){var A=l.value.charCodeAt(0);1==A?_+=" (1 unused bit shown)":A>1&&(_+=" ("+A+" unused bits shown)")}}else if(l.type===u.Type.OCTETSTRING)v.test(l.value)||(_+="("+l.value+") "),_+="0x"+h.util.bytesToHex(l.value);else if(l.type===u.Type.UTF8)try{_+=h.util.decodeUtf8(l.value)}catch(P){if("URI malformed"!==P.message)throw P;_+="0x"+h.util.bytesToHex(l.value)+" (malformed UTF8)"}else l.type===u.Type.PRINTABLESTRING||l.type===u.Type.IA5String?_+=l.value:v.test(l.value)?_+="0x"+h.util.bytesToHex(l.value):_+=0===l.value.length?"[null]":l.value}return _}},2020:J=>{var G={};J.exports=G;var N={};G.encode=function(u,g,b){if("string"!=typeof g)throw new TypeError('"alphabet" must be a string.');if(void 0!==b&&"number"!=typeof b)throw new TypeError('"maxline" must be a number.');var w="";if(u instanceof Uint8Array){var v=0,l=g.length,p=g.charAt(0),d=[0];for(v=0;v0;)d.push(I%l),I=I/l|0}for(v=0;0===u[v]&&v=0;--v)w+=g[d[v]]}else w=function h(u,g){var b=0,w=g.length,v=g.charAt(0),l=[0];for(b=0;b0;)l.push(d%w),d=d/w|0}var _="";for(b=0;0===u.at(b)&&b=0;--b)_+=g[l[b]];return _}(u,g);if(b){var E=new RegExp(".{1,"+b+"}","g");w=w.match(E).join("\r\n")}return w},G.decode=function(u,g){if("string"!=typeof u)throw new TypeError('"input" must be a string.');if("string"!=typeof g)throw new TypeError('"alphabet" must be a string.');var b=N[g];if(!b){b=N[g]=[];for(var w=0;w>=8;for(;I>0;)p.push(255&I),I>>=8}for(var E=0;u[E]===l&&E{var h=N(8659);N(4747),J.exports=h.cipher=h.cipher||{},h.cipher.algorithms=h.cipher.algorithms||{},h.cipher.createCipher=function(g,b){var w=g;if("string"==typeof w&&(w=h.cipher.getAlgorithm(w))&&(w=w()),!w)throw new Error("Unsupported algorithm: "+g);return new h.cipher.BlockCipher({algorithm:w,key:b,decrypt:!1})},h.cipher.createDecipher=function(g,b){var w=g;if("string"==typeof w&&(w=h.cipher.getAlgorithm(w))&&(w=w()),!w)throw new Error("Unsupported algorithm: "+g);return new h.cipher.BlockCipher({algorithm:w,key:b,decrypt:!0})},h.cipher.registerAlgorithm=function(g,b){g=g.toUpperCase(),h.cipher.algorithms[g]=b},h.cipher.getAlgorithm=function(g){return(g=g.toUpperCase())in h.cipher.algorithms?h.cipher.algorithms[g]:null};var u=h.cipher.BlockCipher=function(g){this.algorithm=g.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=g.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=g.decrypt,this.algorithm.initialize(g)};u.prototype.start=function(g){g=g||{};var b={};for(var w in g)b[w]=g[w];b.decrypt=this._decrypt,this._finish=!1,this._input=h.util.createBuffer(),this.output=g.output||h.util.createBuffer(),this.mode.start(b)},u.prototype.update=function(g){for(g&&this._input.putBuffer(g);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},u.prototype.finish=function(g){g&&("ECB"===this.mode.name||"CBC"===this.mode.name)&&(this.mode.pad=function(w){return g(this.blockSize,w,!1)},this.mode.unpad=function(w){return g(this.blockSize,w,!0)});var b={};return b.decrypt=this._decrypt,b.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,b)||(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,b))||this.mode.afterFinish&&!this.mode.afterFinish(this.output,b))}},3481:(J,G,N)=>{var h=N(8659);N(4747),h.cipher=h.cipher||{};var u=J.exports=h.cipher.modes=h.cipher.modes||{};function g(v,l){if("string"==typeof v&&(v=h.util.createBuffer(v)),h.util.isArray(v)&&v.length>4){var p=v;v=h.util.createBuffer();for(var d=0;d0))return!0;for(var d=0;d0))return!0;for(var d=0;d0)return!1;var p=v.length(),d=v.at(p-1);return!(d>this.blockSize<<2||(v.truncate(d),0))},u.cbc=function(v){v=v||{},this.name="CBC",this.cipher=v.cipher,this.blockSize=v.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},u.cbc.prototype.start=function(v){if(null===v.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in v))throw new Error("Invalid IV parameter.");this._iv=g(v.iv,this.blockSize),this._prev=this._iv.slice(0)}},u.cbc.prototype.encrypt=function(v,l,p){if(v.length()0))return!0;for(var d=0;d0))return!0;for(var d=0;d0)return!1;var p=v.length(),d=v.at(p-1);return!(d>this.blockSize<<2||(v.truncate(d),0))},u.cfb=function(v){v=v||{},this.name="CFB",this.cipher=v.cipher,this.blockSize=v.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=h.util.createBuffer(),this._partialBytes=0},u.cfb.prototype.start=function(v){if(!("iv"in v))throw new Error("Invalid IV parameter.");this._iv=g(v.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.cfb.prototype.encrypt=function(v,l,p){var d=v.length();if(0===d)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&d>=this.blockSize)for(var _=0;_0&&(I=this.blockSize-I),this._partialOutput.clear(),_=0;_0)v.read-=this.blockSize;else for(_=0;_0&&this._partialOutput.getBytes(this._partialBytes),I>0&&!p)return l.putBytes(this._partialOutput.getBytes(I-this._partialBytes)),this._partialBytes=I,!0;l.putBytes(this._partialOutput.getBytes(d-this._partialBytes)),this._partialBytes=0}},u.cfb.prototype.decrypt=function(v,l,p){var d=v.length();if(0===d)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&d>=this.blockSize)for(var _=0;_0&&(I=this.blockSize-I),this._partialOutput.clear(),_=0;_0)v.read-=this.blockSize;else for(_=0;_0&&this._partialOutput.getBytes(this._partialBytes),I>0&&!p)return l.putBytes(this._partialOutput.getBytes(I-this._partialBytes)),this._partialBytes=I,!0;l.putBytes(this._partialOutput.getBytes(d-this._partialBytes)),this._partialBytes=0}},u.ofb=function(v){v=v||{},this.name="OFB",this.cipher=v.cipher,this.blockSize=v.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=h.util.createBuffer(),this._partialBytes=0},u.ofb.prototype.start=function(v){if(!("iv"in v))throw new Error("Invalid IV parameter.");this._iv=g(v.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ofb.prototype.encrypt=function(v,l,p){var d=v.length();if(0===v.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&d>=this.blockSize)for(var _=0;_0&&(I=this.blockSize-I),this._partialOutput.clear(),_=0;_0)v.read-=this.blockSize;else for(_=0;_0&&this._partialOutput.getBytes(this._partialBytes),I>0&&!p)return l.putBytes(this._partialOutput.getBytes(I-this._partialBytes)),this._partialBytes=I,!0;l.putBytes(this._partialOutput.getBytes(d-this._partialBytes)),this._partialBytes=0}},u.ofb.prototype.decrypt=u.ofb.prototype.encrypt,u.ctr=function(v){v=v||{},this.name="CTR",this.cipher=v.cipher,this.blockSize=v.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=h.util.createBuffer(),this._partialBytes=0},u.ctr.prototype.start=function(v){if(!("iv"in v))throw new Error("Invalid IV parameter.");this._iv=g(v.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},u.ctr.prototype.encrypt=function(v,l,p){var d=v.length();if(0===d)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&d>=this.blockSize)for(var _=0;_0&&(I=this.blockSize-I),this._partialOutput.clear(),_=0;_0&&(v.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),I>0&&!p)return l.putBytes(this._partialOutput.getBytes(I-this._partialBytes)),this._partialBytes=I,!0;l.putBytes(this._partialOutput.getBytes(d-this._partialBytes)),this._partialBytes=0}b(this._inBlock)},u.ctr.prototype.decrypt=u.ctr.prototype.encrypt,u.gcm=function(v){v=v||{},this.name="GCM",this.cipher=v.cipher,this.blockSize=v.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=h.util.createBuffer(),this._partialBytes=0,this._R=3774873600},u.gcm.prototype.start=function(v){if(!("iv"in v))throw new Error("Invalid IV parameter.");var p,l=h.util.createBuffer(v.iv);if(this._cipherLength=0,p="additionalData"in v?h.util.createBuffer(v.additionalData):h.util.createBuffer(),this._tagLength="tagLength"in v?v.tagLength:128,this._tag=null,v.decrypt&&(this._tag=h.util.createBuffer(v.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var d=l.length();if(12===d)this._j0=[l.getInt32(),l.getInt32(),l.getInt32(),1];else{for(this._j0=[0,0,0,0];l.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[l.getInt32(),l.getInt32(),l.getInt32(),l.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(w(8*d)))}this._inBlock=this._j0.slice(0),b(this._inBlock),this._partialBytes=0,p=h.util.createBuffer(p),this._aDataLength=w(8*p.length());var _=p.length()%this.blockSize;for(_&&p.fillWithByte(0,this.blockSize-_),this._s=[0,0,0,0];p.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[p.getInt32(),p.getInt32(),p.getInt32(),p.getInt32()])},u.gcm.prototype.encrypt=function(v,l,p){var d=v.length();if(0===d)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&d>=this.blockSize){for(var _=0;_0&&(I=this.blockSize-I),this._partialOutput.clear(),_=0;_0&&this._partialOutput.getBytes(this._partialBytes),I>0&&!p)return v.read-=this.blockSize,l.putBytes(this._partialOutput.getBytes(I-this._partialBytes)),this._partialBytes=I,!0;l.putBytes(this._partialOutput.getBytes(d-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),b(this._inBlock)},u.gcm.prototype.decrypt=function(v,l,p){var d=v.length();if(d0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),b(this._inBlock),this._hashBlock[0]=v.getInt32(),this._hashBlock[1]=v.getInt32(),this._hashBlock[2]=v.getInt32(),this._hashBlock[3]=v.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var _=0;_0;--d)l[d]=v[d]>>>1|(1&v[d-1])<<31;l[0]=v[0]>>>1,p&&(l[0]^=this._R)},u.gcm.prototype.tableMultiply=function(v){for(var l=[0,0,0,0],p=0;p<32;++p){var I=this._m[p][v[p/8|0]>>>4*(7-p%8)&15];l[0]^=I[0],l[1]^=I[1],l[2]^=I[2],l[3]^=I[3]}return l},u.gcm.prototype.ghash=function(v,l,p){return l[0]^=p[0],l[1]^=p[1],l[2]^=p[2],l[3]^=p[3],this.tableMultiply(l)},u.gcm.prototype.generateHashTable=function(v,l){for(var p=8/l,d=4*p,_=16*p,I=new Array(_),E=0;E<_;++E){var y=[0,0,0,0];y[E/d|0]=1<>>1,_=new Array(p);_[d]=v.slice(0);for(var I=d>>>1;I>0;)this.pow(_[2*I],_[I]=[]),I>>=1;for(I=2;I{var h=N(8659);function u(f,C){h.cipher.registerAlgorithm(f,function(){return new h.des.Algorithm(f,C)})}N(3311),N(3481),N(4747),J.exports=h.des=h.des||{},h.des.startEncrypting=function(f,C,A,P){var D=y({key:f,output:A,decrypt:!1,mode:P||(null===C?"ECB":"CBC")});return D.start(C),D},h.des.createEncryptionCipher=function(f,C){return y({key:f,output:null,decrypt:!1,mode:C})},h.des.startDecrypting=function(f,C,A,P){var D=y({key:f,output:A,decrypt:!0,mode:P||(null===C?"ECB":"CBC")});return D.start(C),D},h.des.createDecryptionCipher=function(f,C){return y({key:f,output:null,decrypt:!0,mode:C})},h.des.Algorithm=function(f,C){var A=this;A.name=f,A.mode=new C({blockSize:8,cipher:{encrypt:function(P,D){return E(A._keys,P,D,!1)},decrypt:function(P,D){return E(A._keys,P,D,!0)}}}),A._init=!1},h.des.Algorithm.prototype.initialize=function(f){if(!this._init){var C=h.util.createBuffer(f.key);if(0===this.name.indexOf("3DES")&&24!==C.length())throw new Error("Invalid Triple-DES key size: "+8*C.length());this._keys=function I(f){for(var q,C=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],A=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],P=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],D=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],x=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],M=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],B=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],F=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],z=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],S=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],O=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],H=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],L=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],j=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],re=f.length()>8?3:1,$=[],te=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],Z=0,ne=0;ne>>4^de))<<4,oe^=q=65535&((de^=q)>>>-16^oe),oe^=(q=858993459&(oe>>>2^(de^=q<<-16)))<<2,oe^=q=65535&((de^=q)>>>-16^oe),oe^=(q=1431655765&(oe>>>1^(de^=q<<-16)))<<1,oe^=q=16711935&((de^=q)>>>8^oe),q=(oe^=(q=1431655765&(oe>>>1^(de^=q<<8)))<<1)<<8|(de^=q)>>>20&240,oe=de<<24|de<<8&16711680|de>>>8&65280|de>>>24&240,de=q;for(var pe=0;pe>>26,de=de<<2|de>>>26):(oe=oe<<1|oe>>>27,de=de<<1|de>>>27);var ke=C[(oe&=-15)>>>28]|A[oe>>>24&15]|P[oe>>>20&15]|D[oe>>>16&15]|x[oe>>>12&15]|M[oe>>>8&15]|B[oe>>>4&15],Se=F[(de&=-15)>>>28]|z[de>>>24&15]|S[de>>>20&15]|O[de>>>16&15]|H[de>>>12&15]|L[de>>>8&15]|j[de>>>4&15];$[Z++]=ke^(q=65535&(Se>>>16^ke)),$[Z++]=Se^q<<16}}return $}(C),this._init=!0}},u("DES-ECB",h.cipher.modes.ecb),u("DES-CBC",h.cipher.modes.cbc),u("DES-CFB",h.cipher.modes.cfb),u("DES-OFB",h.cipher.modes.ofb),u("DES-CTR",h.cipher.modes.ctr),u("3DES-ECB",h.cipher.modes.ecb),u("3DES-CBC",h.cipher.modes.cbc),u("3DES-CFB",h.cipher.modes.cfb),u("3DES-OFB",h.cipher.modes.ofb),u("3DES-CTR",h.cipher.modes.ctr);var g=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],b=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],w=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],v=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],l=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],p=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],d=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],_=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function E(f,C,A,P){var x,D=32===f.length?3:9;x=3===D?P?[30,-2,-2]:[0,32,2]:P?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var M,B=C[0],F=C[1];B^=(M=252645135&(B>>>4^F))<<4,B^=(M=65535&(B>>>16^(F^=M)))<<16,B^=M=858993459&((F^=M)>>>2^B),B^=M=16711935&((F^=M<<2)>>>8^B),B=(B^=(M=1431655765&(B>>>1^(F^=M<<8)))<<1)<<1|B>>>31,F=(F^=M)<<1|F>>>31;for(var z=0;z>>4|F<<28)^f[H+1];M=B,B=F,F=M^(b[L>>>24&63]|v[L>>>16&63]|p[L>>>8&63]|_[63&L]|g[j>>>24&63]|w[j>>>16&63]|l[j>>>8&63]|d[63&j])}M=B,B=F,F=M}F=F>>>1|F<<31,F^=M=1431655765&((B=B>>>1|B<<31)>>>1^F),F^=(M=16711935&(F>>>8^(B^=M<<1)))<<8,F^=(M=858993459&(F>>>2^(B^=M)))<<2,F^=M=65535&((B^=M)>>>16^F),F^=M=252645135&((B^=M<<16)>>>4^F),A[0]=B^=M<<4,A[1]=F}function y(f){var P,A="DES-"+((f=f||{}).mode||"CBC").toUpperCase(),D=(P=f.decrypt?h.cipher.createDecipher(A,f.key):h.cipher.createCipher(A,f.key)).start;return P.start=function(x,M){var B=null;M instanceof h.util.ByteBuffer&&(B=M,M={}),(M=M||{}).output=B,M.iv=x,D.call(P,M)},P}},8659:J=>{J.exports={options:{usePureJavaScript:!1}}},9032:(J,G,N)=>{var h=N(8659);N(979),N(4747),(J.exports=h.hmac=h.hmac||{}).create=function(){var g=null,b=null,w=null,v=null,l={start:function(p,d){if(null!==p)if("string"==typeof p){if(!((p=p.toLowerCase())in h.md.algorithms))throw new Error('Unknown hash algorithm "'+p+'"');b=h.md.algorithms[p].create()}else b=p;if(null===d)d=g;else{if("string"==typeof d)d=h.util.createBuffer(d);else if(h.util.isArray(d)){var _=d;d=h.util.createBuffer();for(var I=0;I<_.length;++I)d.putByte(_[I])}var E=d.length();for(E>b.blockLength&&(b.start(),b.update(d.bytes()),d=b.digest()),w=h.util.createBuffer(),v=h.util.createBuffer(),E=d.length(),I=0;I{var u,h=N(8659);function w(W,Y,ee){this.data=[],null!=W&&("number"==typeof W?this.fromNumber(W,Y,ee):this.fromString(W,null==Y&&"string"!=typeof W?256:Y))}function v(){return new w(null)}function d(W,Y,ee,le,Oe,He){for(var tt=16383&Y,Ze=Y>>14;--He>=0;){var on=16383&this.data[W],Ir=this.data[W++]>>14,Ri=Ze*on+Ir*tt;Oe=((on=tt*on+((16383&Ri)<<14)+ee.data[le]+Oe)>>28)+(Ri>>14)+Ze*Ir,ee.data[le++]=268435455&on}return Oe}J.exports=h.jsbn=h.jsbn||{},h.jsbn.BigInteger=w,typeof navigator>"u"?(w.prototype.am=d,u=28):"Microsoft Internet Explorer"==navigator.appName?(w.prototype.am=function p(W,Y,ee,le,Oe,He){for(var tt=32767&Y,Ze=Y>>15;--He>=0;){var on=32767&this.data[W],Ir=this.data[W++]>>15,Ri=Ze*on+Ir*tt;Oe=((on=tt*on+((32767&Ri)<<15)+ee.data[le]+(1073741823&Oe))>>>30)+(Ri>>>15)+Ze*Ir+(Oe>>>30),ee.data[le++]=1073741823&on}return Oe},u=30):"Netscape"!=navigator.appName?(w.prototype.am=function l(W,Y,ee,le,Oe,He){for(;--He>=0;){var tt=Y*this.data[W++]+ee.data[le]+Oe;Oe=Math.floor(tt/67108864),ee.data[le++]=67108863&tt}return Oe},u=26):(w.prototype.am=d,u=28),w.prototype.DB=u,w.prototype.DM=(1<>>16)&&(W=ee,Y+=16),0!=(ee=W>>8)&&(W=ee,Y+=8),0!=(ee=W>>4)&&(W=ee,Y+=4),0!=(ee=W>>2)&&(W=ee,Y+=2),0!=(ee=W>>1)&&(W=ee,Y+=1),Y}function pe(W){this.m=W}function Ee(W){this.m=W,this.mp=W.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<>=16,Y+=16),0==(255&W)&&(W>>=8,Y+=8),0==(15&W)&&(W>>=4,Y+=4),0==(3&W)&&(W>>=2,Y+=2),0==(1&W)&&++Y,Y}function tn(W){for(var Y=0;0!=W;)W&=W-1,++Y;return Y}function ve(){}function yt(W){return W}function ze(W){this.r2=v(),this.q3=v(),w.ONE.dlShiftTo(2*W.t,this.r2),this.mu=this.r2.divide(W),this.m=W}pe.prototype.convert=function ke(W){return W.s<0||W.compareTo(this.m)>=0?W.mod(this.m):W},pe.prototype.revert=function Se(W){return W},pe.prototype.reduce=function Pe(W){W.divRemTo(this.m,null,W)},pe.prototype.mulTo=function we(W,Y,ee){W.multiplyTo(Y,ee),this.reduce(ee)},pe.prototype.sqrTo=function $e(W,Y){W.squareTo(Y),this.reduce(Y)},Ee.prototype.convert=function Ce(W){var Y=v();return W.abs().dlShiftTo(this.m.t,Y),Y.divRemTo(this.m,null,Y),W.s<0&&Y.compareTo(w.ZERO)>0&&this.m.subTo(Y,Y),Y},Ee.prototype.revert=function xe(W){var Y=v();return W.copyTo(Y),this.reduce(Y),Y},Ee.prototype.reduce=function Ke(W){for(;W.t<=this.mt2;)W.data[W.t++]=0;for(var Y=0;Y>15)*this.mpl&this.um)<<15)&W.DM;for(W.data[ee=Y+this.m.t]+=this.m.am(0,le,W,Y,0,this.m.t);W.data[ee]>=W.DV;)W.data[ee]-=W.DV,W.data[++ee]++}W.clamp(),W.drShiftTo(this.m.t,W),W.compareTo(this.m)>=0&&W.subTo(this.m,W)},Ee.prototype.mulTo=function Je(W,Y,ee){W.multiplyTo(Y,ee),this.reduce(ee)},Ee.prototype.sqrTo=function We(W,Y){W.squareTo(Y),this.reduce(Y)},w.prototype.copyTo=function P(W){for(var Y=this.t-1;Y>=0;--Y)W.data[Y]=this.data[Y];W.t=this.t,W.s=this.s},w.prototype.fromInt=function D(W){this.t=1,this.s=W<0?-1:0,W>0?this.data[0]=W:W<-1?this.data[0]=W+this.DV:this.t=0},w.prototype.fromString=function M(W,Y){var ee;if(16==Y)ee=4;else if(8==Y)ee=3;else if(256==Y)ee=8;else if(2==Y)ee=1;else if(32==Y)ee=5;else{if(4!=Y)return void this.fromRadix(W,Y);ee=2}this.t=0,this.s=0;for(var le=W.length,Oe=!1,He=0;--le>=0;){var tt=8==ee?255&W[le]:A(W,le);tt<0?"-"==W.charAt(le)&&(Oe=!0):(Oe=!1,0==He?this.data[this.t++]=tt:He+ee>this.DB?(this.data[this.t-1]|=(tt&(1<>this.DB-He):this.data[this.t-1]|=tt<=this.DB&&(He-=this.DB))}8==ee&&0!=(128&W[0])&&(this.s=-1,He>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==W;)--this.t},w.prototype.dlShiftTo=function j(W,Y){var ee;for(ee=this.t-1;ee>=0;--ee)Y.data[ee+W]=this.data[ee];for(ee=W-1;ee>=0;--ee)Y.data[ee]=0;Y.t=this.t+W,Y.s=this.s},w.prototype.drShiftTo=function re(W,Y){for(var ee=W;ee=0;--Ze)Y.data[Ze+He+1]=this.data[Ze]>>le|tt,tt=(this.data[Ze]&Oe)<=0;--Ze)Y.data[Ze]=0;Y.data[He]=tt,Y.t=this.t+He+1,Y.s=this.s,Y.clamp()},w.prototype.rShiftTo=function te(W,Y){Y.s=this.s;var ee=Math.floor(W/this.DB);if(ee>=this.t)Y.t=0;else{var le=W%this.DB,Oe=this.DB-le,He=(1<>le;for(var tt=ee+1;tt>le;le>0&&(Y.data[this.t-ee-1]|=(this.s&He)<>=this.DB;if(W.t>=this.DB;le+=this.s}else{for(le+=this.s;ee>=this.DB;le-=W.s}Y.s=le<0?-1:0,le<-1?Y.data[ee++]=this.DV+le:le>0&&(Y.data[ee++]=le),Y.t=ee,Y.clamp()},w.prototype.multiplyTo=function q(W,Y){var ee=this.abs(),le=W.abs(),Oe=ee.t;for(Y.t=Oe+le.t;--Oe>=0;)Y.data[Oe]=0;for(Oe=0;Oe=0;)W.data[ee]=0;for(ee=0;ee=Y.DV&&(W.data[ee+Y.t]-=Y.DV,W.data[ee+Y.t+1]=1)}W.t>0&&(W.data[W.t-1]+=Y.am(ee,Y.data[ee],W,2*ee,0,1)),W.s=0,W.clamp()},w.prototype.divRemTo=function oe(W,Y,ee){var le=W.abs();if(!(le.t<=0)){var Oe=this.abs();if(Oe.t0?(le.lShiftTo(on,He),Oe.lShiftTo(on,ee)):(le.copyTo(He),Oe.copyTo(ee));var Ir=He.t,Ri=He.data[Ir-1];if(0!=Ri){var mi=Ri*(1<1?He.data[Ir-2]>>this.F2:0),bs=this.FV/mi,Xo=(1<=0&&(ee.data[ee.t++]=1,ee.subTo(ns,ee)),w.ONE.dlShiftTo(Ir,ns),ns.subTo(He,He);He.t=0;){var el=ee.data[--vi]==Ri?this.DM:Math.floor(ee.data[vi]*bs+(ee.data[vi-1]+Xt)*Xo);if((ee.data[vi]+=He.am(0,el,ee,Dn,0,Ir))0&&ee.rShiftTo(on,ee),tt<0&&w.ZERO.subTo(ee,ee)}}},w.prototype.invDigit=function K(){if(this.t<1)return 0;var W=this.data[0];if(0==(1&W))return 0;var Y=3&W;return(Y=(Y=(Y=(Y=Y*(2-(15&W)*Y)&15)*(2-(255&W)*Y)&255)*(2-((65535&W)*Y&65535))&65535)*(2-W*Y%this.DV)%this.DV)>0?this.DV-Y:-Y},w.prototype.isEven=function Xe(){return 0==(this.t>0?1&this.data[0]:this.s)},w.prototype.exp=function Ot(W,Y){if(W>4294967295||W<1)return w.ONE;var ee=v(),le=v(),Oe=Y.convert(this),He=H(W)-1;for(Oe.copyTo(ee);--He>=0;)if(Y.sqrTo(ee,le),(W&1<0)Y.mulTo(le,Oe,ee);else{var tt=ee;ee=le,le=tt}return Y.revert(ee)},w.prototype.toString=function F(W){if(this.s<0)return"-"+this.negate().toString(W);var Y;if(16==W)Y=4;else if(8==W)Y=3;else if(2==W)Y=1;else if(32==W)Y=5;else{if(4!=W)return this.toRadix(W);Y=2}var le,ee=(1<0)for(Ze>Ze)>0&&(Oe=!0,He=C(le));tt>=0;)Ze>(Ze+=this.DB-Y)):(le=this.data[tt]>>(Ze-=Y)&ee,Ze<=0&&(Ze+=this.DB,--tt)),le>0&&(Oe=!0),Oe&&(He+=C(le));return Oe?He:"0"},w.prototype.negate=function z(){var W=v();return w.ZERO.subTo(this,W),W},w.prototype.abs=function S(){return this.s<0?this.negate():this},w.prototype.compareTo=function O(W){var Y=this.s-W.s;if(0!=Y)return Y;var ee=this.t;if(0!=(Y=ee-W.t))return this.s<0?-Y:Y;for(;--ee>=0;)if(0!=(Y=this.data[ee]-W.data[ee]))return Y;return 0},w.prototype.bitLength=function L(){return this.t<=0?0:this.DB*(this.t-1)+H(this.data[this.t-1]^this.s&this.DM)},w.prototype.mod=function de(W){var Y=v();return this.abs().divRemTo(W,null,Y),this.s<0&&Y.compareTo(w.ZERO)>0&&W.subTo(Y,Y),Y},w.prototype.modPowInt=function pt(W,Y){var ee;return ee=W<256||Y.isEven()?new pe(Y):new Ee(Y),this.exp(W,ee)},w.ZERO=x(0),w.ONE=x(1),ve.prototype.convert=yt,ve.prototype.revert=yt,ve.prototype.mulTo=function St(W,Y,ee){W.multiplyTo(Y,ee)},ve.prototype.sqrTo=function mn(W,Y){W.squareTo(Y)},ze.prototype.convert=function ht(W){if(W.s<0||W.t>2*this.m.t)return W.mod(this.m);if(W.compareTo(this.m)<0)return W;var Y=v();return W.copyTo(Y),this.reduce(Y),Y},ze.prototype.revert=function Et(W){return W},ze.prototype.reduce=function lt(W){for(W.drShiftTo(this.m.t-1,this.r2),W.t>this.m.t+1&&(W.t=this.m.t+1,W.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);W.compareTo(this.r2)<0;)W.dAddOffset(1,this.m.t+1);for(W.subTo(this.r2,W);W.compareTo(this.m)>=0;)W.subTo(this.m,W)},ze.prototype.mulTo=function jt(W,Y,ee){W.multiplyTo(Y,ee),this.reduce(ee)},ze.prototype.sqrTo=function It(W,Y){W.squareTo(Y),this.reduce(Y)};var ir=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],La=(1<<26)/ir[ir.length-1];w.prototype.chunkSize=function ie(W){return Math.floor(Math.LN2*this.DB/Math.log(W))},w.prototype.toRadix=function ye(W){if(null==W&&(W=10),0==this.signum()||W<2||W>36)return"0";var Y=this.chunkSize(W),ee=Math.pow(W,Y),le=x(ee),Oe=v(),He=v(),tt="";for(this.divRemTo(le,Oe,He);Oe.signum()>0;)tt=(ee+He.intValue()).toString(W).substr(1)+tt,Oe.divRemTo(le,Oe,He);return He.intValue().toString(W)+tt},w.prototype.fromRadix=function me(W,Y){this.fromInt(0),null==Y&&(Y=10);for(var ee=this.chunkSize(Y),le=Math.pow(Y,ee),Oe=!1,He=0,tt=0,Ze=0;Ze=ee&&(this.dMultiply(le),this.dAddOffset(tt,0),He=0,tt=0))}He>0&&(this.dMultiply(Math.pow(Y,He)),this.dAddOffset(tt,0)),Oe&&w.ZERO.subTo(this,this)},w.prototype.fromNumber=function _e(W,Y,ee){if("number"==typeof Y)if(W<2)this.fromInt(1);else for(this.fromNumber(W,ee),this.testBit(W-1)||this.bitwiseTo(w.ONE.shiftLeft(W-1),ge,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(Y);)this.dAddOffset(2,0),this.bitLength()>W&&this.subTo(w.ONE.shiftLeft(W-1),this);else{var le=new Array,Oe=7&W;le.length=1+(W>>3),Y.nextBytes(le),Oe>0?le[0]&=(1<>=this.DB;if(W.t>=this.DB;le+=this.s}else{for(le+=this.s;ee>=this.DB;le+=W.s}Y.s=le<0?-1:0,le>0?Y.data[ee++]=le:le<-1&&(Y.data[ee++]=this.DV+le),Y.t=ee,Y.clamp()},w.prototype.dMultiply=function ut(W){this.data[this.t]=this.am(0,W-1,this,0,0,this.t),++this.t,this.clamp()},w.prototype.dAddOffset=function ce(W,Y){if(0!=W){for(;this.t<=Y;)this.data[this.t++]=0;for(this.data[Y]+=W;this.data[Y]>=this.DV;)this.data[Y]-=this.DV,++Y>=this.t&&(this.data[this.t++]=0),++this.data[Y]}},w.prototype.multiplyLowerTo=function Qe(W,Y,ee){var Oe,le=Math.min(this.t+W.t,Y);for(ee.s=0,ee.t=le;le>0;)ee.data[--le]=0;for(Oe=ee.t-this.t;le=0;)ee.data[le]=0;for(le=Math.max(Y-this.t,0);le0)if(0==Y)ee=this.data[0]%W;else for(var le=this.t-1;le>=0;--le)ee=(Y*ee+this.data[le])%W;return ee},w.prototype.millerRabin=function Qf(W){var Y=this.subtract(w.ONE),ee=Y.getLowestSetBit();if(ee<=0)return!1;for(var He,le=Y.shiftRight(ee),Oe=function ka(){return{nextBytes:function(W){for(var Y=0;Y=0);var Ze=He.modPow(le,this);if(0!=Ze.compareTo(w.ONE)&&0!=Ze.compareTo(Y)){for(var on=1;on++>24},w.prototype.shortValue=function ni(){return 0==this.t?this.s:this.data[0]<<16>>16},w.prototype.signum=function fe(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1},w.prototype.toByteArray=function Ne(){var W=this.t,Y=new Array;Y[0]=this.s;var le,ee=this.DB-W*this.DB%8,Oe=0;if(W-- >0)for(ee>ee)!=(this.s&this.DM)>>ee&&(Y[Oe++]=le|this.s<=0;)ee<8?(le=(this.data[W]&(1<>(ee+=this.DB-8)):(le=this.data[W]>>(ee-=8)&255,ee<=0&&(ee+=this.DB,--W)),0!=(128&le)&&(le|=-256),0==Oe&&(128&this.s)!=(128&le)&&++Oe,(Oe>0||le!=this.s)&&(Y[Oe++]=le);return Y},w.prototype.equals=function Ye(W){return 0==this.compareTo(W)},w.prototype.min=function qe(W){return this.compareTo(W)<0?this:W},w.prototype.max=function st(W){return this.compareTo(W)>0?this:W},w.prototype.and=function be(W){var Y=v();return this.bitwiseTo(W,je,Y),Y},w.prototype.or=function De(W){var Y=v();return this.bitwiseTo(W,ge,Y),Y},w.prototype.xor=function Be(W){var Y=v();return this.bitwiseTo(W,Ue,Y),Y},w.prototype.andNot=function Pt(W){var Y=v();return this.bitwiseTo(W,dt,Y),Y},w.prototype.not=function vt(){for(var W=v(),Y=0;Y=this.t?0!=this.s:0!=(this.data[Y]&1<1){var Ri=v();for(He.sqrTo(tt[1],Ri);Ze<=Ir;)tt[Ze]=v(),He.mulTo(Ri,tt[Ze-2],tt[Ze]),Ze+=2}var bs,vi,mi=W.t-1,Xo=!0,Xt=v();for(ee=H(W.data[mi])-1;mi>=0;){for(ee>=on?bs=W.data[mi]>>ee-on&Ir:(bs=(W.data[mi]&(1<0&&(bs|=W.data[mi-1]>>this.DB+ee-on)),Ze=le;0==(1&bs);)bs>>=1,--Ze;if((ee-=Ze)<0&&(ee+=this.DB,--mi),Xo)tt[bs].copyTo(Oe),Xo=!1;else{for(;Ze>1;)He.sqrTo(Oe,Xt),He.sqrTo(Xt,Oe),Ze-=2;Ze>0?He.sqrTo(Oe,Xt):(vi=Oe,Oe=Xt,Xt=vi),He.mulTo(Xt,tt[bs],Oe)}for(;mi>=0&&0==(W.data[mi]&1<=0?(ee.subTo(le,ee),Y&&Oe.subTo(tt,Oe),He.subTo(Ze,He)):(le.subTo(ee,le),Y&&tt.subTo(Oe,tt),Ze.subTo(He,Ze))}return 0!=le.compareTo(w.ONE)?w.ZERO:Ze.compareTo(W)>=0?Ze.subtract(W):Ze.signum()<0?(Ze.addTo(W,Ze),Ze.signum()<0?Ze.add(W):Ze):Ze},w.prototype.pow=function Ge(W){return this.exp(W,new ve)},w.prototype.gcd=function Nn(W){var Y=this.s<0?this.negate():this.clone(),ee=W.s<0?W.negate():W.clone();if(Y.compareTo(ee)<0){var le=Y;Y=ee,ee=le}var Oe=Y.getLowestSetBit(),He=ee.getLowestSetBit();if(He<0)return Y;for(Oe0&&(Y.rShiftTo(He,Y),ee.rShiftTo(He,ee));Y.signum()>0;)(Oe=Y.getLowestSetBit())>0&&Y.rShiftTo(Oe,Y),(Oe=ee.getLowestSetBit())>0&&ee.rShiftTo(Oe,ee),Y.compareTo(ee)>=0?(Y.subTo(ee,Y),Y.rShiftTo(1,Y)):(ee.subTo(Y,ee),ee.rShiftTo(1,ee));return He>0&&ee.lShiftTo(He,ee),ee},w.prototype.isProbablePrime=function Zo(W){var Y,ee=this.abs();if(1==ee.t&&ee.data[0]<=ir[ir.length-1]){for(Y=0;Y{var h=N(8659);J.exports=h.md=h.md||{},h.md.algorithms=h.md.algorithms||{}},9386:(J,G,N)=>{var h=N(8659);N(8449),J.exports=h.mgf=h.mgf||{},h.mgf.mgf1=h.mgf1},8449:(J,G,N)=>{var h=N(8659);N(4747),h.mgf=h.mgf||{},(J.exports=h.mgf.mgf1=h.mgf1=h.mgf1||{}).create=function(g){return{generate:function(w,v){for(var l=new h.util.ByteBuffer,p=Math.ceil(v/g.digestLength),d=0;d{var h=N(8659);h.pki=h.pki||{};var u=J.exports=h.pki.oids=h.oids=h.oids||{};function g(w,v){u[w]=v,u[v]=w}function b(w,v){u[w]=v}g("1.2.840.113549.1.1.1","rsaEncryption"),g("1.2.840.113549.1.1.4","md5WithRSAEncryption"),g("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),g("1.2.840.113549.1.1.7","RSAES-OAEP"),g("1.2.840.113549.1.1.8","mgf1"),g("1.2.840.113549.1.1.9","pSpecified"),g("1.2.840.113549.1.1.10","RSASSA-PSS"),g("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),g("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),g("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),g("1.3.101.112","EdDSA25519"),g("1.2.840.10040.4.3","dsa-with-sha1"),g("1.3.14.3.2.7","desCBC"),g("1.3.14.3.2.26","sha1"),g("1.3.14.3.2.29","sha1WithRSASignature"),g("2.16.840.1.101.3.4.2.1","sha256"),g("2.16.840.1.101.3.4.2.2","sha384"),g("2.16.840.1.101.3.4.2.3","sha512"),g("2.16.840.1.101.3.4.2.4","sha224"),g("2.16.840.1.101.3.4.2.5","sha512-224"),g("2.16.840.1.101.3.4.2.6","sha512-256"),g("1.2.840.113549.2.2","md2"),g("1.2.840.113549.2.5","md5"),g("1.2.840.113549.1.7.1","data"),g("1.2.840.113549.1.7.2","signedData"),g("1.2.840.113549.1.7.3","envelopedData"),g("1.2.840.113549.1.7.4","signedAndEnvelopedData"),g("1.2.840.113549.1.7.5","digestedData"),g("1.2.840.113549.1.7.6","encryptedData"),g("1.2.840.113549.1.9.1","emailAddress"),g("1.2.840.113549.1.9.2","unstructuredName"),g("1.2.840.113549.1.9.3","contentType"),g("1.2.840.113549.1.9.4","messageDigest"),g("1.2.840.113549.1.9.5","signingTime"),g("1.2.840.113549.1.9.6","counterSignature"),g("1.2.840.113549.1.9.7","challengePassword"),g("1.2.840.113549.1.9.8","unstructuredAddress"),g("1.2.840.113549.1.9.14","extensionRequest"),g("1.2.840.113549.1.9.20","friendlyName"),g("1.2.840.113549.1.9.21","localKeyId"),g("1.2.840.113549.1.9.22.1","x509Certificate"),g("1.2.840.113549.1.12.10.1.1","keyBag"),g("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),g("1.2.840.113549.1.12.10.1.3","certBag"),g("1.2.840.113549.1.12.10.1.4","crlBag"),g("1.2.840.113549.1.12.10.1.5","secretBag"),g("1.2.840.113549.1.12.10.1.6","safeContentsBag"),g("1.2.840.113549.1.5.13","pkcs5PBES2"),g("1.2.840.113549.1.5.12","pkcs5PBKDF2"),g("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),g("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),g("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),g("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),g("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),g("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),g("1.2.840.113549.2.7","hmacWithSHA1"),g("1.2.840.113549.2.8","hmacWithSHA224"),g("1.2.840.113549.2.9","hmacWithSHA256"),g("1.2.840.113549.2.10","hmacWithSHA384"),g("1.2.840.113549.2.11","hmacWithSHA512"),g("1.2.840.113549.3.7","des-EDE3-CBC"),g("2.16.840.1.101.3.4.1.2","aes128-CBC"),g("2.16.840.1.101.3.4.1.22","aes192-CBC"),g("2.16.840.1.101.3.4.1.42","aes256-CBC"),g("2.5.4.3","commonName"),g("2.5.4.4","surname"),g("2.5.4.5","serialNumber"),g("2.5.4.6","countryName"),g("2.5.4.7","localityName"),g("2.5.4.8","stateOrProvinceName"),g("2.5.4.9","streetAddress"),g("2.5.4.10","organizationName"),g("2.5.4.11","organizationalUnitName"),g("2.5.4.12","title"),g("2.5.4.13","description"),g("2.5.4.15","businessCategory"),g("2.5.4.17","postalCode"),g("2.5.4.42","givenName"),g("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),g("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),g("2.16.840.1.113730.1.1","nsCertType"),g("2.16.840.1.113730.1.13","nsComment"),b("2.5.29.1","authorityKeyIdentifier"),b("2.5.29.2","keyAttributes"),b("2.5.29.3","certificatePolicies"),b("2.5.29.4","keyUsageRestriction"),b("2.5.29.5","policyMapping"),b("2.5.29.6","subtreesConstraint"),b("2.5.29.7","subjectAltName"),b("2.5.29.8","issuerAltName"),b("2.5.29.9","subjectDirectoryAttributes"),b("2.5.29.10","basicConstraints"),b("2.5.29.11","nameConstraints"),b("2.5.29.12","policyConstraints"),b("2.5.29.13","basicConstraints"),g("2.5.29.14","subjectKeyIdentifier"),g("2.5.29.15","keyUsage"),b("2.5.29.16","privateKeyUsagePeriod"),g("2.5.29.17","subjectAltName"),g("2.5.29.18","issuerAltName"),g("2.5.29.19","basicConstraints"),b("2.5.29.20","cRLNumber"),b("2.5.29.21","cRLReason"),b("2.5.29.22","expirationDate"),b("2.5.29.23","instructionCode"),b("2.5.29.24","invalidityDate"),b("2.5.29.25","cRLDistributionPoints"),b("2.5.29.26","issuingDistributionPoint"),b("2.5.29.27","deltaCRLIndicator"),b("2.5.29.28","issuingDistributionPoint"),b("2.5.29.29","certificateIssuer"),b("2.5.29.30","nameConstraints"),g("2.5.29.31","cRLDistributionPoints"),g("2.5.29.32","certificatePolicies"),b("2.5.29.33","policyMappings"),b("2.5.29.34","policyConstraints"),g("2.5.29.35","authorityKeyIdentifier"),b("2.5.29.36","policyConstraints"),g("2.5.29.37","extKeyUsage"),b("2.5.29.46","freshestCRL"),b("2.5.29.54","inhibitAnyPolicy"),g("1.3.6.1.4.1.11129.2.4.2","timestampList"),g("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),g("1.3.6.1.5.5.7.3.1","serverAuth"),g("1.3.6.1.5.5.7.3.2","clientAuth"),g("1.3.6.1.5.5.7.3.3","codeSigning"),g("1.3.6.1.5.5.7.3.4","emailProtection"),g("1.3.6.1.5.5.7.3.8","timeStamping")},2158:(J,G,N)=>{var h=N(8659);if(N(1298),N(7791),N(279),N(979),N(6078),N(7949),N(8604),N(8365),N(209),N(5517),N(4747),typeof u>"u")var u=h.jsbn.BigInteger;var g=h.asn1,b=h.pki=h.pki||{};J.exports=b.pbe=h.pbe=h.pbe||{};var w=b.oids,v={name:"EncryptedPrivateKeyInfo",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:g.Class.UNIVERSAL,type:g.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},l={name:"PBES2Algorithms",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:g.Class.UNIVERSAL,type:g.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:g.Class.UNIVERSAL,type:g.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},p={name:"pkcs-12PbeParams",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:g.Class.UNIVERSAL,type:g.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"iterations"}]};function d(y,f){return y.start().update(f).digest().getBytes()}function _(y){var f;if(y){if(!(f=b.oids[g.derToOid(y)])){var C=new Error("Unsupported PRF OID.");throw C.oid=y,C.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],C}}else f="hmacWithSHA1";return I(f)}function I(y){var f=h.md;switch(y){case"hmacWithSHA224":f=h.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":y=y.substr(8).toLowerCase();break;default:var C=new Error("Unsupported PRF algorithm.");throw C.algorithm=y,C.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],C}if(!f||!(y in f))throw new Error("Unknown hash algorithm: "+y);return f[y].create()}b.encryptPrivateKeyInfo=function(y,f,C){(C=C||{}).saltSize=C.saltSize||8,C.count=C.count||2048,C.algorithm=C.algorithm||"aes128",C.prfAlgorithm=C.prfAlgorithm||"sha1";var x,M,B,A=h.random.getBytesSync(C.saltSize),P=C.count,D=g.integerToDer(P);if(0===C.algorithm.indexOf("aes")||"des"===C.algorithm){var F,z,S;switch(C.algorithm){case"aes128":x=16,F=16,z=w["aes128-CBC"],S=h.aes.createEncryptionCipher;break;case"aes192":x=24,F=16,z=w["aes192-CBC"],S=h.aes.createEncryptionCipher;break;case"aes256":x=32,F=16,z=w["aes256-CBC"],S=h.aes.createEncryptionCipher;break;case"des":x=8,F=8,z=w.desCBC,S=h.des.createEncryptionCipher;break;default:throw(O=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=C.algorithm,O}var H="hmacWith"+C.prfAlgorithm.toUpperCase(),L=I(H),j=h.pkcs5.pbkdf2(f,A,P,x,L),re=h.random.getBytesSync(F);($=S(j)).start(re),$.update(g.toDer(y)),$.finish(),B=$.output.getBytes();var te=function E(y,f,C,A){var P=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OCTETSTRING,!1,y),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,f.getBytes())]);return"hmacWithSHA1"!==A&&P.value.push(g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,h.util.hexToBytes(C.toString(16))),g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(b.oids[A]).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")])),P}(A,D,x,H);M=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(w.pkcs5PBES2).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(w.pkcs5PBKDF2).getBytes()),te]),g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(z).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.OCTETSTRING,!1,re)])])])}else{var O;if("3des"!==C.algorithm)throw(O=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=C.algorithm,O;x=24;var $,Z=new h.util.ByteBuffer(A);j=b.pbe.generatePkcs12Key(f,Z,1,P,x),re=b.pbe.generatePkcs12Key(f,Z,2,P,x),($=h.des.createEncryptionCipher(j)).start(re),$.update(g.toDer(y)),$.finish(),B=$.output.getBytes(),M=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(w["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OCTETSTRING,!1,A),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,D.getBytes())])])}return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[M,g.create(g.Class.UNIVERSAL,g.Type.OCTETSTRING,!1,B)])},b.decryptPrivateKeyInfo=function(y,f){var C=null,A={},P=[];if(!g.validate(y,v,A,P)){var D=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw D.errors=P,D}var x=g.derToOid(A.encryptionOid),M=b.pbe.getCipher(x,A.encryptionParams,f),B=h.util.createBuffer(A.encryptedData);return M.update(B),M.finish()&&(C=g.fromDer(M.output)),C},b.encryptedPrivateKeyToPem=function(y,f){var C={type:"ENCRYPTED PRIVATE KEY",body:g.toDer(y).getBytes()};return h.pem.encode(C,{maxline:f})},b.encryptedPrivateKeyFromPem=function(y){var f=h.pem.decode(y)[0];if("ENCRYPTED PRIVATE KEY"!==f.type){var C=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw C.headerType=f.type,C}if(f.procType&&"ENCRYPTED"===f.procType.type)throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return g.fromDer(f.body)},b.encryptRsaPrivateKey=function(y,f,C){if(!(C=C||{}).legacy){var A=b.wrapRsaPrivateKey(b.privateKeyToAsn1(y));return A=b.encryptPrivateKeyInfo(A,f,C),b.encryptedPrivateKeyToPem(A)}var P,D,x,M;switch(C.algorithm){case"aes128":P="AES-128-CBC",x=16,D=h.random.getBytesSync(16),M=h.aes.createEncryptionCipher;break;case"aes192":P="AES-192-CBC",x=24,D=h.random.getBytesSync(16),M=h.aes.createEncryptionCipher;break;case"aes256":P="AES-256-CBC",x=32,D=h.random.getBytesSync(16),M=h.aes.createEncryptionCipher;break;case"3des":P="DES-EDE3-CBC",x=24,D=h.random.getBytesSync(8),M=h.des.createEncryptionCipher;break;case"des":P="DES-CBC",x=8,D=h.random.getBytesSync(8),M=h.des.createEncryptionCipher;break;default:var B=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+C.algorithm+'".');throw B.algorithm=C.algorithm,B}var z=M(h.pbe.opensslDeriveBytes(f,D.substr(0,8),x));z.start(D),z.update(g.toDer(b.privateKeyToAsn1(y))),z.finish();var S={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:P,parameters:h.util.bytesToHex(D).toUpperCase()},body:z.output.getBytes()};return h.pem.encode(S)},b.decryptRsaPrivateKey=function(y,f){var C=null,A=h.pem.decode(y)[0];if("ENCRYPTED PRIVATE KEY"!==A.type&&"PRIVATE KEY"!==A.type&&"RSA PRIVATE KEY"!==A.type)throw(P=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".')).headerType=P,P;if(A.procType&&"ENCRYPTED"===A.procType.type){var D,x;switch(A.dekInfo.algorithm){case"DES-CBC":D=8,x=h.des.createDecryptionCipher;break;case"DES-EDE3-CBC":D=24,x=h.des.createDecryptionCipher;break;case"AES-128-CBC":D=16,x=h.aes.createDecryptionCipher;break;case"AES-192-CBC":D=24,x=h.aes.createDecryptionCipher;break;case"AES-256-CBC":D=32,x=h.aes.createDecryptionCipher;break;case"RC2-40-CBC":D=5,x=function(S){return h.rc2.createDecryptionCipher(S,40)};break;case"RC2-64-CBC":D=8,x=function(S){return h.rc2.createDecryptionCipher(S,64)};break;case"RC2-128-CBC":D=16,x=function(S){return h.rc2.createDecryptionCipher(S,128)};break;default:var P;throw(P=new Error('Could not decrypt private key; unsupported encryption algorithm "'+A.dekInfo.algorithm+'".')).algorithm=A.dekInfo.algorithm,P}var M=h.util.hexToBytes(A.dekInfo.parameters),F=x(h.pbe.opensslDeriveBytes(f,M.substr(0,8),D));if(F.start(M),F.update(h.util.createBuffer(A.body)),!F.finish())return C;C=F.output.getBytes()}else C=A.body;return null!==(C="ENCRYPTED PRIVATE KEY"===A.type?b.decryptPrivateKeyInfo(g.fromDer(C),f):g.fromDer(C))&&(C=b.privateKeyFromAsn1(C)),C},b.pbe.generatePkcs12Key=function(y,f,C,A,P,D){var x,M;if(typeof D>"u"||null===D){if(!("sha1"in h.md))throw new Error('"sha1" hash algorithm unavailable.');D=h.md.sha1.create()}var B=D.digestLength,F=D.blockLength,z=new h.util.ByteBuffer,S=new h.util.ByteBuffer;if(null!=y){for(M=0;M=0;M--)we>>=8,we+=pe.at(M)+Pe.at(M),Pe.setAt(M,255&we);Se.putBuffer(Pe)}Z=Se,z.putBuffer(oe)}return z.truncate(z.length()-P),z},b.pbe.getCipher=function(y,f,C){switch(y){case b.oids.pkcs5PBES2:return b.pbe.getCipherForPBES2(y,f,C);case b.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case b.oids["pbewithSHAAnd40BitRC2-CBC"]:return b.pbe.getCipherForPKCS12PBE(y,f,C);default:var A=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw A.oid=y,A.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],A}},b.pbe.getCipherForPBES2=function(y,f,C){var D,A={},P=[];if(!g.validate(f,l,A,P))throw(D=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=P,D;if((y=g.derToOid(A.kdfOid))!==b.oids.pkcs5PBKDF2)throw(D=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.")).oid=y,D.supportedOids=["pkcs5PBKDF2"],D;if((y=g.derToOid(A.encOid))!==b.oids["aes128-CBC"]&&y!==b.oids["aes192-CBC"]&&y!==b.oids["aes256-CBC"]&&y!==b.oids["des-EDE3-CBC"]&&y!==b.oids.desCBC)throw(D=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.")).oid=y,D.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],D;var B,F,x=A.kdfSalt,M=h.util.createBuffer(A.kdfIterationCount);switch(M=M.getInt(M.length()<<3),b.oids[y]){case"aes128-CBC":B=16,F=h.aes.createDecryptionCipher;break;case"aes192-CBC":B=24,F=h.aes.createDecryptionCipher;break;case"aes256-CBC":B=32,F=h.aes.createDecryptionCipher;break;case"des-EDE3-CBC":B=24,F=h.des.createDecryptionCipher;break;case"desCBC":B=8,F=h.des.createDecryptionCipher}var z=_(A.prfOid),S=h.pkcs5.pbkdf2(C,x,M,B,z),O=A.encIv,H=F(S);return H.start(O),H},b.pbe.getCipherForPKCS12PBE=function(y,f,C){var A={},P=[];if(!g.validate(f,p,A,P))throw(D=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=P,D;var B,F,z,x=h.util.createBuffer(A.salt),M=h.util.createBuffer(A.iterations);switch(M=M.getInt(M.length()<<3),y){case b.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:B=24,F=8,z=h.des.startDecrypting;break;case b.oids["pbewithSHAAnd40BitRC2-CBC"]:B=5,F=8,z=function(j,re){var $=h.rc2.createDecryptionCipher(j,40);return $.start(re,null),$};break;default:var D;throw(D=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.")).oid=y,D}var S=_(A.prfOid),O=b.pbe.generatePkcs12Key(C,x,1,M,B,S);return S.start(),z(O,b.pbe.generatePkcs12Key(C,x,2,M,F,S))},b.pbe.opensslDeriveBytes=function(y,f,C,A){if(typeof A>"u"||null===A){if(!("md5"in h.md))throw new Error('"md5" hash algorithm unavailable.');A=h.md.md5.create()}null===f&&(f="");for(var P=[d(A,y+f)],D=16,x=1;D{var h=N(8659);N(9032),N(979),N(4747);var g,u=h.pkcs5=h.pkcs5||{};h.util.isNodejs&&!h.options.usePureJavaScript&&(g=N(5819)),J.exports=h.pbkdf2=u.pbkdf2=function(b,w,v,l,p,d){if("function"==typeof p&&(d=p,p=null),h.util.isNodejs&&!h.options.usePureJavaScript&&g.pbkdf2&&(null===p||"object"!=typeof p)&&(g.pbkdf2Sync.length>4||!p||"sha1"===p))return"string"!=typeof p&&(p="sha1"),b=Buffer.from(b,"binary"),w=Buffer.from(w,"binary"),d?4===g.pbkdf2Sync.length?g.pbkdf2(b,w,v,l,function(z,S){if(z)return d(z);d(null,S.toString("binary"))}):g.pbkdf2(b,w,v,l,p,function(z,S){if(z)return d(z);d(null,S.toString("binary"))}):4===g.pbkdf2Sync.length?g.pbkdf2Sync(b,w,v,l).toString("binary"):g.pbkdf2Sync(b,w,v,l,p).toString("binary");if((typeof p>"u"||null===p)&&(p="sha1"),"string"==typeof p){if(!(p in h.md.algorithms))throw new Error("Unknown hash algorithm: "+p);p=h.md[p].create()}var _=p.digestLength;if(l>4294967295*_){var I=new Error("Derived key is too long.");if(d)return d(I);throw I}var E=Math.ceil(l/_),y=l-(E-1)*_,f=h.hmac.create();f.start(p,b);var A,P,D,C="";if(!d){for(var x=1;x<=E;++x){f.start(null,null),f.update(w),f.update(h.util.int32ToBytes(x)),A=D=f.digest().getBytes();for(var M=2;M<=v;++M)f.start(null,null),f.update(D),P=f.digest().getBytes(),A=h.util.xorBytes(A,P,_),D=P;C+=xE)return d(null,C);f.start(null,null),f.update(w),f.update(h.util.int32ToBytes(x)),A=D=f.digest().getBytes(),M=2,F()}function F(){if(M<=v)return f.start(null,null),f.update(D),P=f.digest().getBytes(),A=h.util.xorBytes(A,P,_),D=P,++M,h.util.setImmediate(F);C+=x{var h=N(8659);N(4747);var u=J.exports=h.pem=h.pem||{};function g(w){for(var v=w.name+": ",l=[],p=function(y,f){return" "+f},d=0;d65&&-1!==I){var E=v[I];","===E?(++I,v=v.substr(0,I)+"\r\n "+v.substr(I)):v=v.substr(0,I)+"\r\n"+E+v.substr(I+1),_=d-I-1,I=-1,++d}else(" "===v[d]||"\t"===v[d]||","===v[d])&&(I=d);return v}function b(w){return w.replace(/^\s+/,"")}u.encode=function(w,v){v=v||{};var p,l="-----BEGIN "+w.type+"-----\r\n";if(w.procType&&(l+=g(p={name:"Proc-Type",values:[String(w.procType.version),w.procType.type]})),w.contentDomain&&(l+=g(p={name:"Content-Domain",values:[w.contentDomain]})),w.dekInfo&&(p={name:"DEK-Info",values:[w.dekInfo.algorithm]},w.dekInfo.parameters&&p.values.push(w.dekInfo.parameters),l+=g(p)),w.headers)for(var d=0;d{var h=N(8659);N(4747),N(8365),N(7690);var u=J.exports=h.pkcs1=h.pkcs1||{};function g(b,w,v){v||(v=h.md.sha1.create());for(var l="",p=Math.ceil(w/v.digestLength),d=0;d>24&255,d>>16&255,d>>8&255,255&d);v.start(),v.update(b+_),l+=v.digest().getBytes()}return l.substring(0,w)}u.encode_rsa_oaep=function(b,w,v){var l,p,d,_;"string"==typeof v?(l=v,p=arguments[3]||void 0,d=arguments[4]||void 0):v&&(l=v.label||void 0,p=v.seed||void 0,d=v.md||void 0,v.mgf1&&v.mgf1.md&&(_=v.mgf1.md)),d?d.start():d=h.md.sha1.create(),_||(_=d);var I=Math.ceil(b.n.bitLength()/8),E=I-2*d.digestLength-2;if(w.length>E)throw(y=new Error("RSAES-OAEP input message length is too long.")).length=w.length,y.maxLength=E,y;l||(l=""),d.update(l,"raw");for(var f=d.digest(),C="",A=E-w.length,P=0;P{var h=N(8659);N(1298),N(7791),N(279),N(6078),N(8604),N(4957),N(8365),N(4747),N(5911);var u=h.asn1,g=J.exports=h.pkcs7=h.pkcs7||{};function b(A){var P={},D=[];if(!u.validate(A,g.asn1.recipientInfoValidator,P,D)){var x=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw x.errors=D,x}return{version:P.version.charCodeAt(0),issuer:h.pki.RDNAttributesAsArray(P.issuer),serialNumber:h.util.createBuffer(P.serial).toHex(),encryptedContent:{algorithm:u.derToOid(P.encAlgorithm),parameter:P.encParameter?P.encParameter.value:void 0,content:P.encKey}}}function w(A){return u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[u.create(u.Class.UNIVERSAL,u.Type.INTEGER,!1,u.integerToDer(A.version).getBytes()),u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[h.pki.distinguishedNameToAsn1({attributes:A.issuer}),u.create(u.Class.UNIVERSAL,u.Type.INTEGER,!1,h.util.hexToBytes(A.serialNumber))]),u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[u.create(u.Class.UNIVERSAL,u.Type.OID,!1,u.oidToDer(A.encryptedContent.algorithm).getBytes()),u.create(u.Class.UNIVERSAL,u.Type.NULL,!1,"")]),u.create(u.Class.UNIVERSAL,u.Type.OCTETSTRING,!1,A.encryptedContent.content)])}function l(A){for(var P=[],D=0;D0){for(var D=u.create(u.Class.CONTEXT_SPECIFIC,1,!0,[]),x=0;x=D&&M0&&F.value[0].value.push(u.create(u.Class.CONTEXT_SPECIFIC,0,!0,x)),B.length>0&&F.value[0].value.push(u.create(u.Class.CONTEXT_SPECIFIC,1,!0,B)),F.value[0].value.push(u.create(u.Class.UNIVERSAL,u.Type.SET,!0,A.signerInfos)),u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[u.create(u.Class.UNIVERSAL,u.Type.OID,!1,u.oidToDer(A.type).getBytes()),F])},addSigner:function(x){var M=x.issuer,B=x.serialNumber;if(x.certificate){var F=x.certificate;"string"==typeof F&&(F=h.pki.certificateFromPem(F)),M=F.issuer.attributes,B=F.serialNumber}var z=x.key;if(!z)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"==typeof z&&(z=h.pki.privateKeyFromPem(z));var S=x.digestAlgorithm||h.pki.oids.sha1;switch(S){case h.pki.oids.sha1:case h.pki.oids.sha256:case h.pki.oids.sha384:case h.pki.oids.sha512:case h.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+S)}var O=x.authenticatedAttributes||[];if(O.length>0){for(var H=!1,L=!1,j=0;j{var h=N(8659);N(7791),N(4747);var u=h.asn1,g=J.exports=h.pkcs7asn1=h.pkcs7asn1||{};h.pkcs7=h.pkcs7||{},h.pkcs7.asn1=g;var b={name:"ContentInfo",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:u.Class.UNIVERSAL,type:u.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:u.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};g.contentInfoValidator=b;var w={name:"EncryptedContentInfo",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:u.Class.UNIVERSAL,type:u.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:u.Class.UNIVERSAL,type:u.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:u.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:u.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};g.envelopedDataValidator={name:"EnvelopedData",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:u.Class.UNIVERSAL,type:u.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:u.Class.UNIVERSAL,type:u.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(w)},g.encryptedDataValidator={name:"EncryptedData",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:u.Class.UNIVERSAL,type:u.Type.INTEGER,constructed:!1,capture:"version"}].concat(w)},g.signedDataValidator={name:"SignedData",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:u.Class.UNIVERSAL,type:u.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:u.Class.UNIVERSAL,type:u.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},b,{name:"SignedData.Certificates",tagClass:u.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:u.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:u.Class.UNIVERSAL,type:u.Type.SET,capture:"signerInfos",optional:!0,value:[{name:"SignerInfo",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:u.Class.UNIVERSAL,type:u.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:u.Class.UNIVERSAL,type:u.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:u.Class.UNIVERSAL,type:u.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:u.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:u.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:u.Class.UNIVERSAL,type:u.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:u.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]}]}]},g.recipientInfoValidator={name:"RecipientInfo",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:u.Class.UNIVERSAL,type:u.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:u.Class.UNIVERSAL,type:u.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:u.Class.UNIVERSAL,type:u.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:u.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter",optional:!0}]},{name:"RecipientInfo.encryptedKey",tagClass:u.Class.UNIVERSAL,type:u.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}},9709:(J,G,N)=>{var h=N(8659);N(4747),N(730),N(8365),function(){if(h.prime)J.exports=h.prime;else{var u=J.exports=h.prime=h.prime||{},g=h.jsbn.BigInteger,b=[6,4,2,4,2,4,6,2],w=new g(null);w.fromInt(30);var v=function(y,f){return y|f};u.generateProbablePrime=function(y,f,C){"function"==typeof f&&(C=f,f={});var A=(f=f||{}).algorithm||"PRIMEINC";"string"==typeof A&&(A={name:A}),A.options=A.options||{};var P=f.prng||h.random;if("PRIMEINC"===A.name)return function l(y,f,C,A){return"workers"in C?function _(y,f,C,A){if(typeof Worker>"u")return p(y,f,C,A);var P=I(y,f),D=C.workers,x=C.workLoad||100,M=30*x/8,B=C.workerScript||"forge/prime.worker.js";if(-1===D)return h.util.estimateCores(function(z,S){z&&(S=2),D=S-1,F()});function F(){D=Math.max(1,D);for(var z=[],S=0;Sy&&(P=I(y,f));var te=P.toString(16);j.target.postMessage({hex:te,workLoad:x}),P.dAddOffset(M,0)}}}F()}(y,f,C,A):p(y,f,C,A)}(y,{nextBytes:function(x){for(var M=P.getBytesSync(x.length),B=0;Bf&&(y=I(f,C)),y.isProbablePrime(P))return x(null,y);y.dAddOffset(b[A++%8],0)}while(D<0||+new Date-M{var h=N(8659);N(4747);var u=null;h.util.isNodejs&&!h.options.usePureJavaScript&&!process.versions["node-webkit"]&&(u=N(5819)),(J.exports=h.prng=h.prng||{}).create=function(b){for(var w={plugin:b,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},v=b.md,l=new Array(32),p=0;p<32;++p)l[p]=v.create();function _(){if(w.pools[0].messageLength>=32)return I();w.collect(w.seedFileSync(32-w.pools[0].messageLength<<5)),I()}function I(){w.reseeds=4294967295===w.reseeds?0:w.reseeds+1;var y=w.plugin.md.create();y.update(w.keyBytes);for(var f=1,C=0;C<32;++C)w.reseeds%f==0&&(y.update(w.pools[C].digest().getBytes()),w.pools[C].start()),f<<=1;w.keyBytes=y.digest().getBytes(),y.start(),y.update(w.keyBytes);var A=y.digest().getBytes();w.key=w.plugin.formatKey(w.keyBytes),w.seed=w.plugin.formatSeed(A),w.generated=0}function E(y){var f=null,C=h.util.globalScope,A=C.crypto||C.msCrypto;A&&A.getRandomValues&&(f=function(O){return A.getRandomValues(O)});var P=h.util.createBuffer();if(f)for(;P.length()>16)))<<16,S=4294967295&(F=(2147483647&(F+=B>>15))+(F>>31)),M=0;M<3;++M)z=S>>>(M<<3),z^=Math.floor(256*Math.random()),P.putByte(255&z);return P.getBytes(y)}return w.pools=l,w.pool=0,w.generate=function(y,f){if(!f)return w.generateSync(y);var C=w.plugin.cipher,A=w.plugin.increment,P=w.plugin.formatKey,D=w.plugin.formatSeed,x=h.util.createBuffer();w.key=null,function M(B){if(B)return f(B);if(x.length()>=y)return f(null,x.getBytes(y));if(w.generated>1048575&&(w.key=null),null===w.key)return h.util.nextTick(function(){!function d(y){if(w.pools[0].messageLength>=32)return I(),y();w.seedFile(32-w.pools[0].messageLength<<5,function(C,A){if(C)return y(C);w.collect(A),I(),y()})}(M)});var F=C(w.key,w.seed);w.generated+=F.length,x.putBytes(F),w.key=P(C(w.key,A(w.seed))),w.seed=D(C(w.key,w.seed)),h.util.setImmediate(M)}()},w.generateSync=function(y){var f=w.plugin.cipher,C=w.plugin.increment,A=w.plugin.formatKey,P=w.plugin.formatSeed;w.key=null;for(var D=h.util.createBuffer();D.length()1048575&&(w.key=null),null===w.key&&_();var x=f(w.key,w.seed);w.generated+=x.length,D.putBytes(x),w.key=A(f(w.key,C(w.seed))),w.seed=P(f(w.key,w.seed))}return D.getBytes(y)},u?(w.seedFile=function(y,f){u.randomBytes(y,function(C,A){if(C)return f(C);f(null,A.toString())})},w.seedFileSync=function(y){return u.randomBytes(y).toString()}):(w.seedFile=function(y,f){try{f(null,E(y))}catch(C){f(C)}},w.seedFileSync=E),w.collect=function(y){for(var f=y.length,C=0;C>A&255);w.collect(C)},w.registerWorker=function(y){y===self?w.seedFile=function(C,A){self.addEventListener("message",function P(D){var x=D.data;x.forge&&x.forge.prng&&(self.removeEventListener("message",P),A(x.forge.prng.err,x.forge.prng.bytes))}),self.postMessage({forge:{prng:{needed:C}}})}:y.addEventListener("message",function(C){var A=C.data;A.forge&&A.forge.prng&&w.seedFile(A.forge.prng.needed,function(P,D){y.postMessage({forge:{prng:{err:P,bytes:D}}})})})},w}},7256:(J,G,N)=>{var h=N(8659);N(8365),N(4747),(J.exports=h.pss=h.pss||{}).create=function(g){3===arguments.length&&(g={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var p,b=g.md,w=g.mgf,v=b.digestLength,l=g.salt||null;if("string"==typeof l&&(l=h.util.createBuffer(l)),"saltLength"in g)p=g.saltLength;else{if(null===l)throw new Error("Salt length not specified or specific salt not given.");p=l.length()}if(null!==l&&l.length()!==p)throw new Error("Given salt length does not match length of given salt.");var d=g.prng||h.random,_={encode:function(I,E){var y,P,f=E-1,C=Math.ceil(f/8),A=I.digest().getBytes();if(C>8*C-f&255;return(S=String.fromCharCode(S.charCodeAt(0)&~O)+S.substr(1))+x+String.fromCharCode(188)},verify:function(I,E,y){var f,C=y-1,A=Math.ceil(C/8);if(E=E.substr(-A),A>8*A-C&255;if(0!=(D.charCodeAt(0)&M))throw new Error("Bits beyond keysize not zero as expected.");var B=w.generate(x,P),F="";for(f=0;f{var h=N(8659);N(1298),N(1594),N(4473),N(4747),h.random&&h.random.getBytes?J.exports=h.random:function(u){var g={},b=new Array(4),w=h.util.createBuffer();function v(){var y=h.prng.create(g);return y.getBytes=function(f,C){return y.generate(f,C)},y.getBytesSync=function(f){return y.generate(f)},y}g.formatKey=function(y){var f=h.util.createBuffer(y);return(y=new Array(4))[0]=f.getInt32(),y[1]=f.getInt32(),y[2]=f.getInt32(),y[3]=f.getInt32(),h.aes._expandKey(y,!1)},g.formatSeed=function(y){var f=h.util.createBuffer(y);return(y=new Array(4))[0]=f.getInt32(),y[1]=f.getInt32(),y[2]=f.getInt32(),y[3]=f.getInt32(),y},g.cipher=function(y,f){return h.aes._updateBlock(y,f,b,!1),w.putInt32(b[0]),w.putInt32(b[1]),w.putInt32(b[2]),w.putInt32(b[3]),w.getBytes()},g.increment=function(y){return++y[3],y},g.md=h.md.sha256;var l=v(),p=null,d=h.util.globalScope,_=d.crypto||d.msCrypto;if(_&&_.getRandomValues&&(p=function(y){return _.getRandomValues(y)}),h.options.usePureJavaScript||!h.util.isNodejs&&!p){if(typeof window>"u"||window,l.collectInt(+new Date,32),typeof navigator<"u"){var I="";for(var E in navigator)try{"string"==typeof navigator[E]&&(I+=navigator[E])}catch{}l.collect(I),I=null}u&&(u().mousemove(function(y){l.collectInt(y.clientX,16),l.collectInt(y.clientY,16)}),u().keypress(function(y){l.collectInt(y.charCode,8)}))}if(h.random)for(var E in l)h.random[E]=l[E];else h.random=l;h.random.createInstance=v,J.exports=h.random}(typeof jQuery<"u"?jQuery:null)},209:(J,G,N)=>{var h=N(8659);N(4747);var u=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],g=[1,2,3,5],b=function(l,p){return l<>16-p},w=function(l,p){return(65535&l)>>p|l<<16-p&65535};J.exports=h.rc2=h.rc2||{},h.rc2.expandKey=function(l,p){"string"==typeof l&&(l=h.util.createBuffer(l)),p=p||128;var f,d=l,_=l.length(),I=p,E=Math.ceil(I/8),y=255>>(7&I);for(f=_;f<128;f++)d.putByte(u[d.at(f-1)+d.at(f-_)&255]);for(d.setAt(128-E,u[d.at(128-E)&y]),f=127-E;f>=0;f--)d.setAt(f,u[d.at(f+1)^d.at(f+E)]);return d};var v=function(l,p,d){var f,C,A,P,_=!1,I=null,E=null,y=null,D=[];for(l=h.rc2.expandKey(l,p),A=0;A<64;A++)D.push(l.getInt16Le());d?(f=function(B){for(A=0;A<4;A++)B[A]+=D[P]+(B[(A+3)%4]&B[(A+2)%4])+(~B[(A+3)%4]&B[(A+1)%4]),B[A]=b(B[A],g[A]),P++},C=function(B){for(A=0;A<4;A++)B[A]+=D[63&B[(A+3)%4]]}):(f=function(B){for(A=3;A>=0;A--)B[A]=w(B[A],g[A]),B[A]-=D[P]+(B[(A+3)%4]&B[(A+2)%4])+(~B[(A+3)%4]&B[(A+1)%4]),P--},C=function(B){for(A=3;A>=0;A--)B[A]-=D[63&B[(A+3)%4]]});var x=function(B){var F=[];for(A=0;A<4;A++){var z=I.getInt16Le();null!==y&&(d?z^=y.getInt16Le():y.putInt16Le(z)),F.push(65535&z)}P=d?0:63;for(var S=0;S=8;)x([[5,f],[1,C],[6,f],[1,C],[5,f]])},finish:function(B){var F=!0;if(d)if(B)F=B(8,I,!d);else{var z=8===I.length()?8:8-I.length();I.fillWithByte(z,z)}if(F&&(_=!0,M.update()),!d&&(F=0===I.length()))if(B)F=B(8,E,!d);else{var S=E.length(),O=E.at(S-1);O>S?F=!1:E.truncate(O)}return F}}};h.rc2.startEncrypting=function(l,p,d){var _=h.rc2.createEncryptionCipher(l,128);return _.start(p,d),_},h.rc2.createEncryptionCipher=function(l,p){return v(l,p,!0)},h.rc2.startDecrypting=function(l,p,d){var _=h.rc2.createDecryptionCipher(l,128);return _.start(p,d),_},h.rc2.createDecryptionCipher=function(l,p){return v(l,p,!1)}},5517:(J,G,N)=>{var h=N(8659);if(N(7791),N(730),N(6078),N(7246),N(9709),N(8365),N(4747),typeof u>"u")var u=h.jsbn.BigInteger;var g=h.util.isNodejs?N(5819):null,b=h.asn1,w=h.util;h.pki=h.pki||{},J.exports=h.pki.rsa=h.rsa=h.rsa||{};var v=h.pki,l=[6,4,2,4,2,4,6,2],p={name:"PrivateKeyInfo",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:b.Class.UNIVERSAL,type:b.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:b.Class.UNIVERSAL,type:b.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:b.Class.UNIVERSAL,type:b.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},d={name:"RSAPrivateKey",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:b.Class.UNIVERSAL,type:b.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:b.Class.UNIVERSAL,type:b.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:b.Class.UNIVERSAL,type:b.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:b.Class.UNIVERSAL,type:b.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:b.Class.UNIVERSAL,type:b.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:b.Class.UNIVERSAL,type:b.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:b.Class.UNIVERSAL,type:b.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:b.Class.UNIVERSAL,type:b.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:b.Class.UNIVERSAL,type:b.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},_={name:"RSAPublicKey",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:b.Class.UNIVERSAL,type:b.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:b.Class.UNIVERSAL,type:b.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},I=h.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:b.Class.UNIVERSAL,type:b.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:b.Class.UNIVERSAL,type:b.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},E={name:"DigestInfo",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:b.Class.UNIVERSAL,type:b.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:b.Class.UNIVERSAL,type:b.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:b.Class.UNIVERSAL,type:b.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},y=function(L){if(!(L.algorithm in v.oids)){var re=new Error("Unknown message digest algorithm.");throw re.algorithm=L.algorithm,re}var $=b.oidToDer(v.oids[L.algorithm]).getBytes(),te=b.create(b.Class.UNIVERSAL,b.Type.SEQUENCE,!0,[]),Z=b.create(b.Class.UNIVERSAL,b.Type.SEQUENCE,!0,[]);Z.value.push(b.create(b.Class.UNIVERSAL,b.Type.OID,!1,$)),Z.value.push(b.create(b.Class.UNIVERSAL,b.Type.NULL,!1,""));var q=b.create(b.Class.UNIVERSAL,b.Type.OCTETSTRING,!1,L.digest().getBytes());return te.value.push(Z),te.value.push(q),b.toDer(te).getBytes()},f=function(L,j,re){if(re)return L.modPow(j.e,j.n);if(!j.p||!j.q)return L.modPow(j.d,j.n);var $;j.dP||(j.dP=j.d.mod(j.p.subtract(u.ONE))),j.dQ||(j.dQ=j.d.mod(j.q.subtract(u.ONE))),j.qInv||(j.qInv=j.q.modInverse(j.p));do{$=new u(h.util.bytesToHex(h.random.getBytes(j.n.bitLength()/8)),16)}while($.compareTo(j.n)>=0||!$.gcd(j.n).equals(u.ONE));for(var te=(L=L.multiply($.modPow(j.e,j.n)).mod(j.n)).mod(j.p).modPow(j.dP,j.p),Z=L.mod(j.q).modPow(j.dQ,j.q);te.compareTo(Z)<0;)te=te.add(j.p);var q=te.subtract(Z).multiply(j.qInv).mod(j.p).multiply(j.q).add(Z);return q.multiply($.modInverse(j.n)).mod(j.n)};function C(L,j,re){var $=h.util.createBuffer(),te=Math.ceil(j.n.bitLength()/8);if(L.length>te-11){var Z=new Error("Message is too long for PKCS#1 v1.5 padding.");throw Z.length=L.length,Z.max=te-11,Z}$.putByte(0),$.putByte(re);var ne,q=te-3-L.length;if(0===re||1===re){ne=0===re?0:255;for(var oe=0;oe0;){var de=0,pe=h.random.getBytes(q);for(oe=0;oe"u")throw new Error("Encryption block is invalid.");var oe=0;if(0===ne){oe=te-3-$;for(var de=0;de1;){if(255!==Z.getByte()){--Z.read;break}++oe}else if(2===ne)for(oe=0;Z.length()>1;){if(0===Z.getByte()){--Z.read;break}++oe}if(0!==Z.getByte()||oe!==te-3-Z.length())throw new Error("Encryption block is invalid.");return Z.getBytes()}function P(L,j,re){"function"==typeof j&&(re=j,j={});var $={algorithm:{name:(j=j||{}).algorithm||"PRIMEINC",options:{workers:j.workers||2,workLoad:j.workLoad||100,workerScript:j.workerScript}}};function te(){Z(L.pBits,function(ne,oe){return ne?re(ne):(L.p=oe,null!==L.q?q(ne,L.q):void Z(L.qBits,q))})}function Z(ne,oe){h.prime.generateProbablePrime(ne,$,oe)}function q(ne,oe){if(ne)return re(ne);if(L.q=oe,L.p.compareTo(L.q)<0){var de=L.p;L.p=L.q,L.q=de}if(0!==L.p.subtract(u.ONE).gcd(L.e).compareTo(u.ONE))return L.p=null,void te();if(0!==L.q.subtract(u.ONE).gcd(L.e).compareTo(u.ONE))return L.q=null,void Z(L.qBits,q);if(L.p1=L.p.subtract(u.ONE),L.q1=L.q.subtract(u.ONE),L.phi=L.p1.multiply(L.q1),0!==L.phi.gcd(L.e).compareTo(u.ONE))return L.p=L.q=null,void te();if(L.n=L.p.multiply(L.q),L.n.bitLength()!==L.bits)return L.q=null,void Z(L.qBits,q);var pe=L.e.modInverse(L.phi);L.keys={privateKey:v.rsa.setPrivateKey(L.n,L.e,pe,L.p,L.q,pe.mod(L.p1),pe.mod(L.q1),L.q.modInverse(L.p)),publicKey:v.rsa.setPublicKey(L.n,L.e)},re(null,L.keys)}"prng"in j&&($.prng=j.prng),te()}function D(L){var j=L.toString(16);j[0]>="8"&&(j="00"+j);var re=h.util.hexToBytes(j);return re.length>1&&(0===re.charCodeAt(0)&&0==(128&re.charCodeAt(1))||255===re.charCodeAt(0)&&128==(128&re.charCodeAt(1)))?re.substr(1):re}function x(L){return L<=100?27:L<=150?18:L<=200?15:L<=250?12:L<=300?9:L<=350?8:L<=400?7:L<=500?6:L<=600?5:L<=800?4:L<=1250?3:2}function M(L){return h.util.isNodejs&&"function"==typeof g[L]}function B(L){return typeof w.globalScope<"u"&&"object"==typeof w.globalScope.crypto&&"object"==typeof w.globalScope.crypto.subtle&&"function"==typeof w.globalScope.crypto.subtle[L]}function F(L){return typeof w.globalScope<"u"&&"object"==typeof w.globalScope.msCrypto&&"object"==typeof w.globalScope.msCrypto.subtle&&"function"==typeof w.globalScope.msCrypto.subtle[L]}function z(L){for(var j=h.util.hexToBytes(L.toString(16)),re=new Uint8Array(j.length),$=0;$0;)de.putByte(0),--pe;return de.putBytes(h.util.hexToBytes(oe)),de.getBytes()},v.rsa.decrypt=function(L,j,re,$){var te=Math.ceil(j.n.bitLength()/8);if(L.length!==te){var Z=new Error("Encrypted message length is invalid.");throw Z.length=L.length,Z.expected=te,Z}var q=new u(h.util.createBuffer(L).toHex(),16);if(q.compareTo(j.n)>=0)throw new Error("Encrypted message is invalid.");for(var oe=f(q,j,re).toString(16),de=h.util.createBuffer(),pe=te-Math.ceil(oe.length/2);pe>0;)de.putByte(0),--pe;return de.putBytes(h.util.hexToBytes(oe)),!1!==$?A(de.getBytes(),j,re):de.getBytes()},v.rsa.createKeyPairGenerationState=function(L,j,re){"string"==typeof L&&(L=parseInt(L,10)),L=L||2048;var q,$=(re=re||{}).prng||h.random,te={nextBytes:function(ne){for(var oe=$.getBytesSync(ne.length),de=0;de>1,pBits:L-(L>>1),pqState:0,num:null,keys:null}).e.fromInt(q.eInt),q},v.rsa.stepKeyPairGenerationState=function(L,j){"algorithm"in L||(L.algorithm="PRIMEINC");var re=new u(null);re.fromInt(30);for(var q,$=0,te=function(ke,Se){return ke|Se},Z=+new Date,ne=0;null===L.keys&&(j<=0||neoe?L.pqState=0:L.num.isProbablePrime(x(L.num.bitLength()))?++L.pqState:L.num.dAddOffset(l[$++%8],0):2===L.pqState?L.pqState=0===L.num.subtract(u.ONE).gcd(L.e).compareTo(u.ONE)?3:0:3===L.pqState&&(L.pqState=0,null===L.p?L.p=L.num:L.q=L.num,null!==L.p&&null!==L.q&&++L.state,L.num=null)}else if(1===L.state)L.p.compareTo(L.q)<0&&(L.num=L.p,L.p=L.q,L.q=L.num),++L.state;else if(2===L.state)L.p1=L.p.subtract(u.ONE),L.q1=L.q.subtract(u.ONE),L.phi=L.p1.multiply(L.q1),++L.state;else if(3===L.state)0===L.phi.gcd(L.e).compareTo(u.ONE)?++L.state:(L.p=null,L.q=null,L.state=0);else if(4===L.state)L.n=L.p.multiply(L.q),L.n.bitLength()===L.bits?++L.state:(L.q=null,L.state=0);else if(5===L.state){var pe=L.e.modInverse(L.phi);L.keys={privateKey:v.rsa.setPrivateKey(L.n,L.e,pe,L.p,L.q,pe.mod(L.p1),pe.mod(L.q1),L.q.modInverse(L.p)),publicKey:v.rsa.setPublicKey(L.n,L.e)}}ne+=(q=+new Date)-Z,Z=q}return null!==L.keys},v.rsa.generateKeyPair=function(L,j,re,$){if(1===arguments.length?"object"==typeof L?(re=L,L=void 0):"function"==typeof L&&($=L,L=void 0):2===arguments.length?"number"==typeof L?"function"==typeof j?($=j,j=void 0):"number"!=typeof j&&(re=j,j=void 0):(re=L,$=j,L=void 0,j=void 0):3===arguments.length&&("number"==typeof j?"function"==typeof re&&($=re,re=void 0):($=re,re=j,j=void 0)),re=re||{},void 0===L&&(L=re.bits||2048),void 0===j&&(j=re.e||65537),!h.options.usePureJavaScript&&!re.prng&&L>=256&&L<=16384&&(65537===j||3===j))if($){if(M("generateKeyPair"))return g.generateKeyPair("rsa",{modulusLength:L,publicExponent:j,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(ne,oe,de){if(ne)return $(ne);$(null,{privateKey:v.privateKeyFromPem(de),publicKey:v.publicKeyFromPem(oe)})});if(B("generateKey")&&B("exportKey"))return w.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:L,publicExponent:z(j),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(ne){return w.globalScope.crypto.subtle.exportKey("pkcs8",ne.privateKey)}).then(void 0,function(ne){$(ne)}).then(function(ne){if(ne){var oe=v.privateKeyFromAsn1(b.fromDer(h.util.createBuffer(ne)));$(null,{privateKey:oe,publicKey:v.setRsaPublicKey(oe.n,oe.e)})}});if(F("generateKey")&&F("exportKey")){var te=w.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:L,publicExponent:z(j),hash:{name:"SHA-256"}},!0,["sign","verify"]);return te.oncomplete=function(ne){var de=w.globalScope.msCrypto.subtle.exportKey("pkcs8",ne.target.result.privateKey);de.oncomplete=function(pe){var Se=v.privateKeyFromAsn1(b.fromDer(h.util.createBuffer(pe.target.result)));$(null,{privateKey:Se,publicKey:v.setRsaPublicKey(Se.n,Se.e)})},de.onerror=function(pe){$(pe)}},void(te.onerror=function(ne){$(ne)})}}else if(M("generateKeyPairSync")){var Z=g.generateKeyPairSync("rsa",{modulusLength:L,publicExponent:j,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:v.privateKeyFromPem(Z.privateKey),publicKey:v.publicKeyFromPem(Z.publicKey)}}var q=v.rsa.createKeyPairGenerationState(L,j,re);if(!$)return v.rsa.stepKeyPairGenerationState(q,0),q.keys;P(q,re,$)},v.setRsaPublicKey=v.rsa.setPublicKey=function(L,j){var re={n:L,e:j,encrypt:function($,te,Z){if("string"==typeof te?te=te.toUpperCase():void 0===te&&(te="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===te)te={encode:function(ne,oe,de){return C(ne,oe,2).getBytes()}};else if("RSA-OAEP"===te||"RSAES-OAEP"===te)te={encode:function(ne,oe){return h.pkcs1.encode_rsa_oaep(oe,ne,Z)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(te))te={encode:function(ne){return ne}};else if("string"==typeof te)throw new Error('Unsupported encryption scheme: "'+te+'".');var q=te.encode($,re,!0);return v.rsa.encrypt(q,re,!0)},verify:function($,te,Z,q){"string"==typeof Z?Z=Z.toUpperCase():void 0===Z&&(Z="RSASSA-PKCS1-V1_5"),void 0===q&&(q={_parseAllDigestBytes:!0}),"_parseAllDigestBytes"in q||(q._parseAllDigestBytes=!0),"RSASSA-PKCS1-V1_5"===Z?Z={verify:function(oe,de){de=A(de,re,!0);var pe=b.fromDer(de,{parseAllBytes:q._parseAllDigestBytes}),ke={},Se=[];if(!b.validate(pe,E,ke,Se))throw(Pe=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.")).errors=Se,Pe;var Pe,we=b.derToOid(ke.algorithmIdentifier);if(we!==h.oids.md2&&we!==h.oids.md5&&we!==h.oids.sha1&&we!==h.oids.sha224&&we!==h.oids.sha256&&we!==h.oids.sha384&&we!==h.oids.sha512&&we!==h.oids["sha512-224"]&&we!==h.oids["sha512-256"])throw(Pe=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.")).oid=we,Pe;if((we===h.oids.md2||we===h.oids.md5)&&!("parameters"in ke))throw new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifer NULL parameters.");return oe===ke.digest}}:("NONE"===Z||"NULL"===Z||null===Z)&&(Z={verify:function(oe,de){return oe===A(de,re,!0)}});var ne=v.rsa.decrypt(te,re,!0,!1);return Z.verify($,ne,re.n.bitLength())}};return re},v.setRsaPrivateKey=v.rsa.setPrivateKey=function(L,j,re,$,te,Z,q,ne){var oe={n:L,e:j,d:re,p:$,q:te,dP:Z,dQ:q,qInv:ne,decrypt:function(de,pe,ke){"string"==typeof pe?pe=pe.toUpperCase():void 0===pe&&(pe="RSAES-PKCS1-V1_5");var Se=v.rsa.decrypt(de,oe,!1,!1);if("RSAES-PKCS1-V1_5"===pe)pe={decode:A};else if("RSA-OAEP"===pe||"RSAES-OAEP"===pe)pe={decode:function(Pe,we){return h.pkcs1.decode_rsa_oaep(we,Pe,ke)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(pe))throw new Error('Unsupported encryption scheme: "'+pe+'".');pe={decode:function(Pe){return Pe}}}return pe.decode(Se,oe,!1)},sign:function(de,pe){var ke=!1;"string"==typeof pe&&(pe=pe.toUpperCase()),void 0===pe||"RSASSA-PKCS1-V1_5"===pe?(pe={encode:y},ke=1):("NONE"===pe||"NULL"===pe||null===pe)&&(pe={encode:function(){return de}},ke=1);var Se=pe.encode(de,oe.n.bitLength());return v.rsa.encrypt(Se,oe,ke)}};return oe},v.wrapRsaPrivateKey=function(L){return b.create(b.Class.UNIVERSAL,b.Type.SEQUENCE,!0,[b.create(b.Class.UNIVERSAL,b.Type.INTEGER,!1,b.integerToDer(0).getBytes()),b.create(b.Class.UNIVERSAL,b.Type.SEQUENCE,!0,[b.create(b.Class.UNIVERSAL,b.Type.OID,!1,b.oidToDer(v.oids.rsaEncryption).getBytes()),b.create(b.Class.UNIVERSAL,b.Type.NULL,!1,"")]),b.create(b.Class.UNIVERSAL,b.Type.OCTETSTRING,!1,b.toDer(L).getBytes())])},v.privateKeyFromAsn1=function(L){var te,Z,q,ne,oe,de,pe,ke,j={},re=[];if(b.validate(L,p,j,re)&&(L=b.fromDer(h.util.createBuffer(j.privateKey))),!b.validate(L,d,j={},re=[])){var $=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw $.errors=re,$}return te=h.util.createBuffer(j.privateKeyModulus).toHex(),Z=h.util.createBuffer(j.privateKeyPublicExponent).toHex(),q=h.util.createBuffer(j.privateKeyPrivateExponent).toHex(),ne=h.util.createBuffer(j.privateKeyPrime1).toHex(),oe=h.util.createBuffer(j.privateKeyPrime2).toHex(),de=h.util.createBuffer(j.privateKeyExponent1).toHex(),pe=h.util.createBuffer(j.privateKeyExponent2).toHex(),ke=h.util.createBuffer(j.privateKeyCoefficient).toHex(),v.setRsaPrivateKey(new u(te,16),new u(Z,16),new u(q,16),new u(ne,16),new u(oe,16),new u(de,16),new u(pe,16),new u(ke,16))},v.privateKeyToAsn1=v.privateKeyToRSAPrivateKey=function(L){return b.create(b.Class.UNIVERSAL,b.Type.SEQUENCE,!0,[b.create(b.Class.UNIVERSAL,b.Type.INTEGER,!1,b.integerToDer(0).getBytes()),b.create(b.Class.UNIVERSAL,b.Type.INTEGER,!1,D(L.n)),b.create(b.Class.UNIVERSAL,b.Type.INTEGER,!1,D(L.e)),b.create(b.Class.UNIVERSAL,b.Type.INTEGER,!1,D(L.d)),b.create(b.Class.UNIVERSAL,b.Type.INTEGER,!1,D(L.p)),b.create(b.Class.UNIVERSAL,b.Type.INTEGER,!1,D(L.q)),b.create(b.Class.UNIVERSAL,b.Type.INTEGER,!1,D(L.dP)),b.create(b.Class.UNIVERSAL,b.Type.INTEGER,!1,D(L.dQ)),b.create(b.Class.UNIVERSAL,b.Type.INTEGER,!1,D(L.qInv))])},v.publicKeyFromAsn1=function(L){var j={},re=[];if(b.validate(L,I,j,re)){var te,$=b.derToOid(j.publicKeyOid);if($!==v.oids.rsaEncryption)throw(te=new Error("Cannot read public key. Unknown OID.")).oid=$,te;L=j.rsaPublicKey}if(!b.validate(L,_,j,re=[]))throw(te=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.")).errors=re,te;var Z=h.util.createBuffer(j.publicKeyModulus).toHex(),q=h.util.createBuffer(j.publicKeyExponent).toHex();return v.setRsaPublicKey(new u(Z,16),new u(q,16))},v.publicKeyToAsn1=v.publicKeyToSubjectPublicKeyInfo=function(L){return b.create(b.Class.UNIVERSAL,b.Type.SEQUENCE,!0,[b.create(b.Class.UNIVERSAL,b.Type.SEQUENCE,!0,[b.create(b.Class.UNIVERSAL,b.Type.OID,!1,b.oidToDer(v.oids.rsaEncryption).getBytes()),b.create(b.Class.UNIVERSAL,b.Type.NULL,!1,"")]),b.create(b.Class.UNIVERSAL,b.Type.BITSTRING,!1,[v.publicKeyToRSAPublicKey(L)])])},v.publicKeyToRSAPublicKey=function(L){return b.create(b.Class.UNIVERSAL,b.Type.SEQUENCE,!0,[b.create(b.Class.UNIVERSAL,b.Type.INTEGER,!1,D(L.n)),b.create(b.Class.UNIVERSAL,b.Type.INTEGER,!1,D(L.e))])}},7690:(J,G,N)=>{var h=N(8659);N(979),N(4747);var u=J.exports=h.sha1=h.sha1||{};h.md.sha1=h.md.algorithms.sha1=u,u.create=function(){b||function w(){g=String.fromCharCode(128),g+=h.util.fillString(String.fromCharCode(0),64),b=!0}();var l=null,p=h.util.createBuffer(),d=new Array(80),_={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){_.messageLength=0,_.fullMessageLength=_.messageLength64=[];for(var I=_.messageLengthSize/4,E=0;E>>0,y>>>0];for(var f=_.fullMessageLength.length-1;f>=0;--f)_.fullMessageLength[f]+=y[1],y[1]=y[0]+(_.fullMessageLength[f]/4294967296>>>0),_.fullMessageLength[f]=_.fullMessageLength[f]>>>0,y[0]=y[1]/4294967296>>>0;return p.putBytes(I),v(l,d,p),(p.read>2048||0===p.length())&&p.compact(),_},_.digest=function(){var I=h.util.createBuffer();I.putBytes(p.bytes()),I.putBytes(g.substr(0,_.blockLength-(_.fullMessageLength[_.fullMessageLength.length-1]+_.messageLengthSize&_.blockLength-1)));for(var f,A=8*_.fullMessageLength[0],P=0;P<_.fullMessageLength.length-1;++P)I.putInt32((A+=(f=8*_.fullMessageLength[P+1])/4294967296>>>0)>>>0),A=f>>>0;I.putInt32(A);var D={h0:l.h0,h1:l.h1,h2:l.h2,h3:l.h3,h4:l.h4};v(D,d,I);var x=h.util.createBuffer();return x.putInt32(D.h0),x.putInt32(D.h1),x.putInt32(D.h2),x.putInt32(D.h3),x.putInt32(D.h4),x},_};var g=null,b=!1;function v(l,p,d){for(var _,I,E,y,f,C,P,D=d.length();D>=64;){for(I=l.h0,E=l.h1,y=l.h2,f=l.h3,C=l.h4,P=0;P<16;++P)_=d.getInt32(),p[P]=_,_=(I<<5|I>>>27)+(f^E&(y^f))+C+1518500249+_,C=f,f=y,y=(E<<30|E>>>2)>>>0,E=I,I=_;for(;P<20;++P)p[P]=_=(_=p[P-3]^p[P-8]^p[P-14]^p[P-16])<<1|_>>>31,_=(I<<5|I>>>27)+(f^E&(y^f))+C+1518500249+_,C=f,f=y,y=(E<<30|E>>>2)>>>0,E=I,I=_;for(;P<32;++P)p[P]=_=(_=p[P-3]^p[P-8]^p[P-14]^p[P-16])<<1|_>>>31,_=(I<<5|I>>>27)+(E^y^f)+C+1859775393+_,C=f,f=y,y=(E<<30|E>>>2)>>>0,E=I,I=_;for(;P<40;++P)p[P]=_=(_=p[P-6]^p[P-16]^p[P-28]^p[P-32])<<2|_>>>30,_=(I<<5|I>>>27)+(E^y^f)+C+1859775393+_,C=f,f=y,y=(E<<30|E>>>2)>>>0,E=I,I=_;for(;P<60;++P)p[P]=_=(_=p[P-6]^p[P-16]^p[P-28]^p[P-32])<<2|_>>>30,_=(I<<5|I>>>27)+(E&y|f&(E^y))+C+2400959708+_,C=f,f=y,y=(E<<30|E>>>2)>>>0,E=I,I=_;for(;P<80;++P)p[P]=_=(_=p[P-6]^p[P-16]^p[P-28]^p[P-32])<<2|_>>>30,_=(I<<5|I>>>27)+(E^y^f)+C+3395469782+_,C=f,f=y,y=(E<<30|E>>>2)>>>0,E=I,I=_;l.h0=l.h0+I|0,l.h1=l.h1+E|0,l.h2=l.h2+y|0,l.h3=l.h3+f|0,l.h4=l.h4+C|0,D-=64}}},1594:(J,G,N)=>{var h=N(8659);N(979),N(4747);var u=J.exports=h.sha256=h.sha256||{};h.md.sha256=h.md.algorithms.sha256=u,u.create=function(){b||function v(){g=String.fromCharCode(128),g+=h.util.fillString(String.fromCharCode(0),64),w=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],b=!0}();var p=null,d=h.util.createBuffer(),_=new Array(64),I={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){I.messageLength=0,I.fullMessageLength=I.messageLength64=[];for(var E=I.messageLengthSize/4,y=0;y>>0,f>>>0];for(var C=I.fullMessageLength.length-1;C>=0;--C)I.fullMessageLength[C]+=f[1],f[1]=f[0]+(I.fullMessageLength[C]/4294967296>>>0),I.fullMessageLength[C]=I.fullMessageLength[C]>>>0,f[0]=f[1]/4294967296>>>0;return d.putBytes(E),l(p,_,d),(d.read>2048||0===d.length())&&d.compact(),I},I.digest=function(){var E=h.util.createBuffer();E.putBytes(d.bytes()),E.putBytes(g.substr(0,I.blockLength-(I.fullMessageLength[I.fullMessageLength.length-1]+I.messageLengthSize&I.blockLength-1)));for(var C,P=8*I.fullMessageLength[0],D=0;D>>0)>>>0),P=C>>>0;E.putInt32(P);var x={h0:p.h0,h1:p.h1,h2:p.h2,h3:p.h3,h4:p.h4,h5:p.h5,h6:p.h6,h7:p.h7};l(x,_,E);var M=h.util.createBuffer();return M.putInt32(x.h0),M.putInt32(x.h1),M.putInt32(x.h2),M.putInt32(x.h3),M.putInt32(x.h4),M.putInt32(x.h5),M.putInt32(x.h6),M.putInt32(x.h7),M},I};var g=null,b=!1,w=null;function l(p,d,_){for(var I,E,A,P,D,x,M,B,F,z,S,O,H=_.length();H>=64;){for(P=0;P<16;++P)d[P]=_.getInt32();for(;P<64;++P)d[P]=(I=((I=d[P-2])>>>17|I<<15)^(I>>>19|I<<13)^I>>>10)+d[P-7]+(E=((E=d[P-15])>>>7|E<<25)^(E>>>18|E<<14)^E>>>3)+d[P-16]|0;for(D=p.h0,x=p.h1,M=p.h2,B=p.h3,F=p.h4,z=p.h5,S=p.h6,O=p.h7,P=0;P<64;++P)A=D&x|M&(D^x),I=O+((F>>>6|F<<26)^(F>>>11|F<<21)^(F>>>25|F<<7))+(S^F&(z^S))+w[P]+d[P],O=S,S=z,z=F,F=B+I>>>0,B=M,M=x,x=D,D=I+(E=((D>>>2|D<<30)^(D>>>13|D<<19)^(D>>>22|D<<10))+A)>>>0;p.h0=p.h0+D|0,p.h1=p.h1+x|0,p.h2=p.h2+M|0,p.h3=p.h3+B|0,p.h4=p.h4+F|0,p.h5=p.h5+z|0,p.h6=p.h6+S|0,p.h7=p.h7+O|0,H-=64}}},8985:(J,G,N)=>{var h=N(8659);N(979),N(4747);var u=J.exports=h.sha512=h.sha512||{};h.md.sha512=h.md.algorithms.sha512=u;var g=h.sha384=h.sha512.sha384=h.sha512.sha384||{};g.create=function(){return u.create("SHA-384")},h.md.sha384=h.md.algorithms.sha384=g,h.sha512.sha256=h.sha512.sha256||{create:function(){return u.create("SHA-512/256")}},h.md["sha512/256"]=h.md.algorithms["sha512/256"]=h.sha512.sha256,h.sha512.sha224=h.sha512.sha224||{create:function(){return u.create("SHA-512/224")}},h.md["sha512/224"]=h.md.algorithms["sha512/224"]=h.sha512.sha224,u.create=function(_){if(w||function p(){b=String.fromCharCode(128),b+=h.util.fillString(String.fromCharCode(0),128),v=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,106217008],[3516065817,3606008344],[3600352804,1432725776],[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],[3515267271,566280711],[3940187606,3454069534],[4118630271,4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],(l={})["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],l["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],l["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],l["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],w=!0}(),typeof _>"u"&&(_="SHA-512"),!(_ in l))throw new Error("Invalid SHA-512 algorithm: "+_);for(var I=l[_],E=null,y=h.util.createBuffer(),f=new Array(80),C=0;C<80;++C)f[C]=new Array(2);var A=64;switch(_){case"SHA-384":A=48;break;case"SHA-512/256":A=32;break;case"SHA-512/224":A=28}var P={algorithm:_.replace("-","").toLowerCase(),blockLength:128,digestLength:A,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){P.messageLength=0,P.fullMessageLength=P.messageLength128=[];for(var D=P.messageLengthSize/4,x=0;x>>0,M>>>0];for(var B=P.fullMessageLength.length-1;B>=0;--B)P.fullMessageLength[B]+=M[1],M[1]=M[0]+(P.fullMessageLength[B]/4294967296>>>0),P.fullMessageLength[B]=P.fullMessageLength[B]>>>0,M[0]=M[1]/4294967296>>>0;return y.putBytes(D),d(E,f,y),(y.read>2048||0===y.length())&&y.compact(),P},P.digest=function(){var D=h.util.createBuffer();D.putBytes(y.bytes()),D.putBytes(b.substr(0,P.blockLength-(P.fullMessageLength[P.fullMessageLength.length-1]+P.messageLengthSize&P.blockLength-1)));for(var B,z=8*P.fullMessageLength[0],S=0;S>>0)>>>0),z=B>>>0;D.putInt32(z);var O=new Array(E.length);for(S=0;S=128;){for(we=0;we<16;++we)I[we][0]=E.getInt32()>>>0,I[we][1]=E.getInt32()>>>0;for(;we<80;++we)f=((($e=(Ee=I[we-2])[0])<<13|(K=Ee[1])>>>19)^(K<<3|$e>>>29)^($e<<26|K>>>6))>>>0,I[we][0]=(y=(($e>>>19|K<<13)^(K>>>29|$e<<3)^$e>>>6)>>>0)+(Ce=I[we-7])[0]+(C=((($e=(xe=I[we-15])[0])>>>1|(K=xe[1])<<31)^($e>>>8|K<<24)^$e>>>7)>>>0)+(Ke=I[we-16])[0]+((K=f+Ce[1]+(A=(($e<<31|K>>>1)^($e<<24|K>>>8)^($e<<25|K>>>7))>>>0)+Ke[1])/4294967296>>>0)>>>0,I[we][1]=K>>>0;for(O=_[0][0],H=_[0][1],L=_[1][0],j=_[1][1],re=_[2][0],$=_[2][1],te=_[3][0],Z=_[3][1],q=_[4][0],ne=_[4][1],oe=_[5][0],de=_[5][1],pe=_[6][0],ke=_[6][1],Se=_[7][0],Pe=_[7][1],we=0;we<80;++we)y=Se+(((q>>>14|ne<<18)^(q>>>18|ne<<14)^(ne>>>9|q<<23))>>>0)+((pe^q&(oe^pe))>>>0)+v[we][0]+I[we][0]+((K=Pe+(((q<<18|ne>>>14)^(q<<14|ne>>>18)^(ne<<23|q>>>9))>>>0)+((ke^ne&(de^ke))>>>0)+v[we][1]+I[we][1])/4294967296>>>0)>>>0,f=K>>>0,C=(((O>>>28|H<<4)^(H>>>2|O<<30)^(H>>>7|O<<25))>>>0)+((O&L|re&(O^L))>>>0)+((K=(((O<<4|H>>>28)^(H<<30|O>>>2)^(H<<25|O>>>7))>>>0)+((H&j|$&(H^j))>>>0))/4294967296>>>0)>>>0,A=K>>>0,Se=pe,Pe=ke,pe=oe,ke=de,oe=q,de=ne,q=te+y+((K=Z+f)/4294967296>>>0)>>>0,ne=K>>>0,te=re,Z=$,re=L,$=j,L=O,j=H,O=y+C+((K=f+A)/4294967296>>>0)>>>0,H=K>>>0;_[0][0]=_[0][0]+O+((K=_[0][1]+H)/4294967296>>>0)>>>0,_[0][1]=K>>>0,_[1][0]=_[1][0]+L+((K=_[1][1]+j)/4294967296>>>0)>>>0,_[1][1]=K>>>0,_[2][0]=_[2][0]+re+((K=_[2][1]+$)/4294967296>>>0)>>>0,_[2][1]=K>>>0,_[3][0]=_[3][0]+te+((K=_[3][1]+Z)/4294967296>>>0)>>>0,_[3][1]=K>>>0,_[4][0]=_[4][0]+q+((K=_[4][1]+ne)/4294967296>>>0)>>>0,_[4][1]=K>>>0,_[5][0]=_[5][0]+oe+((K=_[5][1]+de)/4294967296>>>0)>>>0,_[5][1]=K>>>0,_[6][0]=_[6][0]+pe+((K=_[6][1]+ke)/4294967296>>>0)>>>0,_[6][1]=K>>>0,_[7][0]=_[7][0]+Se+((K=_[7][1]+Pe)/4294967296>>>0)>>>0,_[7][1]=K>>>0,We-=128}}},4747:(J,G,N)=>{var h=N(8659),u=N(2020),g=J.exports=h.util=h.util||{};function b(D){if(8!==D&&16!==D&&24!==D&&32!==D)throw new Error("Only 8, 16, 24, or 32 bits supported: "+D)}function w(D){if(this.data="",this.read=0,"string"==typeof D)this.data=D;else if(g.isArrayBuffer(D)||g.isArrayBufferView(D))if(typeof Buffer<"u"&&D instanceof Buffer)this.data=D.toString("binary");else{var x=new Uint8Array(D);try{this.data=String.fromCharCode.apply(null,x)}catch{for(var M=0;M15?(M=Date.now(),z(H)):(x.push(H),1===x.length&&F.setAttribute("a",B=!B))}}g.nextTick=g.setImmediate})(),g.isNodejs=typeof process<"u"&&process.versions&&process.versions.node,g.globalScope=g.isNodejs?global:typeof self>"u"?window:self,g.isArray=Array.isArray||function(D){return"[object Array]"===Object.prototype.toString.call(D)},g.isArrayBuffer=function(D){return typeof ArrayBuffer<"u"&&D instanceof ArrayBuffer},g.isArrayBufferView=function(D){return D&&g.isArrayBuffer(D.buffer)&&void 0!==D.byteLength},g.ByteBuffer=w,g.ByteStringBuffer=w,g.ByteStringBuffer.prototype._optimizeConstructedString=function(D){this._constructedStringLength+=D,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},g.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},g.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},g.ByteStringBuffer.prototype.putByte=function(D){return this.putBytes(String.fromCharCode(D))},g.ByteStringBuffer.prototype.fillWithByte=function(D,x){D=String.fromCharCode(D);for(var M=this.data;x>0;)1&x&&(M+=D),(x>>>=1)>0&&(D+=D);return this.data=M,this._optimizeConstructedString(x),this},g.ByteStringBuffer.prototype.putBytes=function(D){return this.data+=D,this._optimizeConstructedString(D.length),this},g.ByteStringBuffer.prototype.putString=function(D){return this.putBytes(g.encodeUtf8(D))},g.ByteStringBuffer.prototype.putInt16=function(D){return this.putBytes(String.fromCharCode(D>>8&255)+String.fromCharCode(255&D))},g.ByteStringBuffer.prototype.putInt24=function(D){return this.putBytes(String.fromCharCode(D>>16&255)+String.fromCharCode(D>>8&255)+String.fromCharCode(255&D))},g.ByteStringBuffer.prototype.putInt32=function(D){return this.putBytes(String.fromCharCode(D>>24&255)+String.fromCharCode(D>>16&255)+String.fromCharCode(D>>8&255)+String.fromCharCode(255&D))},g.ByteStringBuffer.prototype.putInt16Le=function(D){return this.putBytes(String.fromCharCode(255&D)+String.fromCharCode(D>>8&255))},g.ByteStringBuffer.prototype.putInt24Le=function(D){return this.putBytes(String.fromCharCode(255&D)+String.fromCharCode(D>>8&255)+String.fromCharCode(D>>16&255))},g.ByteStringBuffer.prototype.putInt32Le=function(D){return this.putBytes(String.fromCharCode(255&D)+String.fromCharCode(D>>8&255)+String.fromCharCode(D>>16&255)+String.fromCharCode(D>>24&255))},g.ByteStringBuffer.prototype.putInt=function(D,x){b(x);var M="";do{x-=8,M+=String.fromCharCode(D>>x&255)}while(x>0);return this.putBytes(M)},g.ByteStringBuffer.prototype.putSignedInt=function(D,x){return D<0&&(D+=2<0);return x},g.ByteStringBuffer.prototype.getSignedInt=function(D){var x=this.getInt(D),M=2<=M&&(x-=M<<1),x},g.ByteStringBuffer.prototype.getBytes=function(D){var x;return D?(D=Math.min(this.length(),D),x=this.data.slice(this.read,this.read+D),this.read+=D):0===D?x="":(x=0===this.read?this.data:this.data.slice(this.read),this.clear()),x},g.ByteStringBuffer.prototype.bytes=function(D){return typeof D>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+D)},g.ByteStringBuffer.prototype.at=function(D){return this.data.charCodeAt(this.read+D)},g.ByteStringBuffer.prototype.setAt=function(D,x){return this.data=this.data.substr(0,this.read+D)+String.fromCharCode(x)+this.data.substr(this.read+D+1),this},g.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},g.ByteStringBuffer.prototype.copy=function(){var D=g.createBuffer(this.data);return D.read=this.read,D},g.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},g.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},g.ByteStringBuffer.prototype.truncate=function(D){var x=Math.max(0,this.length()-D);return this.data=this.data.substr(this.read,x),this.read=0,this},g.ByteStringBuffer.prototype.toHex=function(){for(var D="",x=this.read;x=D)return this;x=Math.max(x||this.growSize,D);var M=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),B=new Uint8Array(this.length()+x);return B.set(M),this.data=new DataView(B.buffer),this},g.DataBuffer.prototype.putByte=function(D){return this.accommodate(1),this.data.setUint8(this.write++,D),this},g.DataBuffer.prototype.fillWithByte=function(D,x){this.accommodate(x);for(var M=0;M>8&65535),this.data.setInt8(this.write,D>>16&255),this.write+=3,this},g.DataBuffer.prototype.putInt32=function(D){return this.accommodate(4),this.data.setInt32(this.write,D),this.write+=4,this},g.DataBuffer.prototype.putInt16Le=function(D){return this.accommodate(2),this.data.setInt16(this.write,D,!0),this.write+=2,this},g.DataBuffer.prototype.putInt24Le=function(D){return this.accommodate(3),this.data.setInt8(this.write,D>>16&255),this.data.setInt16(this.write,D>>8&65535,!0),this.write+=3,this},g.DataBuffer.prototype.putInt32Le=function(D){return this.accommodate(4),this.data.setInt32(this.write,D,!0),this.write+=4,this},g.DataBuffer.prototype.putInt=function(D,x){b(x),this.accommodate(x/8);do{x-=8,this.data.setInt8(this.write++,D>>x&255)}while(x>0);return this},g.DataBuffer.prototype.putSignedInt=function(D,x){return b(x),this.accommodate(x/8),D<0&&(D+=2<0);return x},g.DataBuffer.prototype.getSignedInt=function(D){var x=this.getInt(D),M=2<=M&&(x-=M<<1),x},g.DataBuffer.prototype.getBytes=function(D){var x;return D?(D=Math.min(this.length(),D),x=this.data.slice(this.read,this.read+D),this.read+=D):0===D?x="":(x=0===this.read?this.data:this.data.slice(this.read),this.clear()),x},g.DataBuffer.prototype.bytes=function(D){return typeof D>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+D)},g.DataBuffer.prototype.at=function(D){return this.data.getUint8(this.read+D)},g.DataBuffer.prototype.setAt=function(D,x){return this.data.setUint8(D,x),this},g.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},g.DataBuffer.prototype.copy=function(){return new g.DataBuffer(this)},g.DataBuffer.prototype.compact=function(){if(this.read>0){var D=new Uint8Array(this.data.buffer,this.read),x=new Uint8Array(D.byteLength);x.set(D),this.data=new DataView(x),this.write-=this.read,this.read=0}return this},g.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},g.DataBuffer.prototype.truncate=function(D){return this.write=Math.max(0,this.length()-D),this.read=Math.min(this.read,this.write),this},g.DataBuffer.prototype.toHex=function(){for(var D="",x=this.read;x0;)1&x&&(M+=D),(x>>>=1)>0&&(D+=D);return M},g.xorBytes=function(D,x,M){for(var B="",F="",z="",S=0,O=0;M>0;--M,++S)F=D.charCodeAt(S)^x.charCodeAt(S),O>=10&&(B+=z,z="",O=0),z+=String.fromCharCode(F),++O;return B+z},g.hexToBytes=function(D){var x="",M=0;for(!0&D.length&&(M=1,x+=String.fromCharCode(parseInt(D[0],16)));M>24&255)+String.fromCharCode(D>>16&255)+String.fromCharCode(D>>8&255)+String.fromCharCode(255&D)};var p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",d=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],_="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";g.encode64=function(D,x){for(var F,z,S,M="",B="",O=0;O>2),M+=p.charAt((3&F)<<4|z>>4),isNaN(z)?M+="==":(M+=p.charAt((15&z)<<2|S>>6),M+=isNaN(S)?"=":p.charAt(63&S)),x&&M.length>x&&(B+=M.substr(0,x)+"\r\n",M=M.substr(x));return B+M},g.decode64=function(D){D=D.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var M,B,F,z,x="",S=0;S>4),64!==F&&(x+=String.fromCharCode((15&B)<<4|F>>2),64!==z&&(x+=String.fromCharCode((3&F)<<6|z)));return x},g.encodeUtf8=function(D){return unescape(encodeURIComponent(D))},g.decodeUtf8=function(D){return decodeURIComponent(escape(D))},g.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:u.encode,decode:u.decode}},g.binary.raw.encode=function(D){return String.fromCharCode.apply(null,D)},g.binary.raw.decode=function(D,x,M){var B=x;B||(B=new Uint8Array(D.length));for(var F=M=M||0,z=0;z>2),M+=p.charAt((3&F)<<4|z>>4),isNaN(z)?M+="==":(M+=p.charAt((15&z)<<2|S>>6),M+=isNaN(S)?"=":p.charAt(63&S)),x&&M.length>x&&(B+=M.substr(0,x)+"\r\n",M=M.substr(x));return B+M},g.binary.base64.decode=function(D,x,M){var B=x;B||(B=new Uint8Array(3*Math.ceil(D.length/4))),D=D.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var F,z,S,O,H=0,L=M=M||0;H>4,64!==S&&(B[L++]=(15&z)<<4|S>>2,64!==O&&(B[L++]=(3&S)<<6|O));return x?L-M:B.subarray(0,L)},g.binary.base58.encode=function(D,x){return g.binary.baseN.encode(D,_,x)},g.binary.base58.decode=function(D,x){return g.binary.baseN.decode(D,_,x)},g.text={utf8:{},utf16:{}},g.text.utf8.encode=function(D,x,M){D=g.encodeUtf8(D);var B=x;B||(B=new Uint8Array(D.length));for(var F=M=M||0,z=0;z"u"&&(M=["web","flash"]);var F,z=!1,S=null;for(var O in M){F=M[O];try{if("flash"===F||"both"===F){if(null===x[0])throw new Error("Flash local storage not available.");B=D.apply(this,x),z="flash"===F}("web"===F||"both"===F)&&(x[0]=localStorage,B=D.apply(this,x),z=!0)}catch(H){S=H}if(z)break}if(!z)throw S;return B};g.setItem=function(D,x,M,B,F){P(y,arguments,F)},g.getItem=function(D,x,M,B){return P(f,arguments,B)},g.removeItem=function(D,x,M,B){P(C,arguments,B)},g.clearItems=function(D,x,M){P(A,arguments,M)},g.isEmpty=function(D){for(var x in D)if(D.hasOwnProperty(x))return!1;return!0},g.format=function(D){for(var M,B,x=/%./g,F=0,z=[],S=0;M=x.exec(D);){(B=D.substring(S,x.lastIndex-2)).length>0&&z.push(B),S=x.lastIndex;var O=M[0][1];switch(O){case"s":case"o":z.push(F");break;case"%":z.push("%");break;default:z.push("<%"+O+"?>")}}return z.push(D.substring(S)),z.join("")},g.formatNumber=function(D,x,M,B){var F=D,z=isNaN(x=Math.abs(x))?2:x,S=void 0===M?",":M,O=void 0===B?".":B,H=F<0?"-":"",L=parseInt(F=Math.abs(+F||0).toFixed(z),10)+"",j=L.length>3?L.length%3:0;return H+(j?L.substr(0,j)+O:"")+L.substr(j).replace(/(\d{3})(?=\d)/g,"$1"+O)+(z?S+Math.abs(F-L).toFixed(z).slice(2):"")},g.formatSize=function(D){return D>=1073741824?g.formatNumber(D/1073741824,2,".","")+" GiB":D>=1048576?g.formatNumber(D/1048576,2,".","")+" MiB":D>=1024?g.formatNumber(D/1024,0)+" KiB":g.formatNumber(D,0)+" bytes"},g.bytesFromIP=function(D){return-1!==D.indexOf(".")?g.bytesFromIPv4(D):-1!==D.indexOf(":")?g.bytesFromIPv6(D):null},g.bytesFromIPv4=function(D){if(4!==(D=D.split(".")).length)return null;for(var x=g.createBuffer(),M=0;MM[B].end-M[B].start&&(B=M.length-1)):M.push({start:O,end:O})}x.push(z)}if(M.length>0){var H=M[B];H.end-H.start>0&&(x.splice(H.start,H.end-H.start+1,""),0===H.start&&x.unshift(""),7===H.end&&x.push(""))}return x.join(":")},g.estimateCores=function(D,x){if("function"==typeof D&&(x=D,D={}),D=D||{},"cores"in g&&!D.update)return x(null,g.cores);if(typeof navigator<"u"&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return g.cores=navigator.hardwareConcurrency,x(null,g.cores);if(typeof Worker>"u")return g.cores=1,x(null,g.cores);if(typeof Blob>"u")return g.cores=2,x(null,g.cores);var M=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(S){for(var O=Date.now(),H=O+4;Date.now()te.st&&j.stj.st&&te.st{var h=N(8659);N(1298),N(7791),N(279),N(979),N(9386),N(6078),N(8604),N(7256),N(5517),N(4747);var u=h.asn1,g=J.exports=h.pki=h.pki||{},b=g.oids,w={};w.CN=b.commonName,w.commonName="CN",w.C=b.countryName,w.countryName="C",w.L=b.localityName,w.localityName="L",w.ST=b.stateOrProvinceName,w.stateOrProvinceName="ST",w.O=b.organizationName,w.organizationName="O",w.OU=b.organizationalUnitName,w.organizationalUnitName="OU",w.E=b.emailAddress,w.emailAddress="E";var v=h.pki.rsa.publicKeyValidator,l={name:"Certificate",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:u.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:u.Class.UNIVERSAL,type:u.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:u.Class.UNIVERSAL,type:u.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:u.Class.UNIVERSAL,type:u.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:u.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:u.Class.UNIVERSAL,type:u.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:u.Class.UNIVERSAL,type:u.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:u.Class.UNIVERSAL,type:u.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:u.Class.UNIVERSAL,type:u.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},v,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:u.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:u.Class.UNIVERSAL,type:u.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:u.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:u.Class.UNIVERSAL,type:u.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:u.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:u.Class.UNIVERSAL,type:u.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:u.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:u.Class.UNIVERSAL,type:u.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},p={name:"rsapss",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:u.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:u.Class.UNIVERSAL,type:u.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:u.Class.UNIVERSAL,type:u.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:u.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:u.Class.UNIVERSAL,type:u.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:u.Class.UNIVERSAL,type:u.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:u.Class.UNIVERSAL,type:u.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:u.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:u.Class.UNIVERSAL,type:u.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:u.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:u.Class.UNIVERSAL,type:u.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},_={name:"CertificationRequest",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[{name:"CertificationRequestInfo",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:u.Class.UNIVERSAL,type:u.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},v,{name:"CertificationRequestInfo.attributes",tagClass:u.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:u.Class.UNIVERSAL,type:u.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:u.Class.UNIVERSAL,type:u.Type.SET,constructed:!0}]}]}]},{name:"CertificationRequest.signatureAlgorithm",tagClass:u.Class.UNIVERSAL,type:u.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:u.Class.UNIVERSAL,type:u.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:u.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:u.Class.UNIVERSAL,type:u.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};function I(S,O){"string"==typeof O&&(O={shortName:O});for(var L,H=null,j=0;null===H&&j"u"&&(O.type&&O.type in g.oids?O.name=g.oids[O.type]:O.shortName&&O.shortName in w&&(O.name=g.oids[w[O.shortName]])),typeof O.type>"u"){if(!O.name||!(O.name in g.oids))throw(L=new Error("Attribute type not specified.")).attribute=O,L;O.type=g.oids[O.name]}if(typeof O.shortName>"u"&&O.name&&O.name in w&&(O.shortName=w[O.name]),O.type===b.extensionRequest&&(O.valueConstructed=!0,O.valueTagClass=u.Type.SEQUENCE,!O.value&&O.extensions)){O.value=[];for(var j=0;j"u")throw(L=new Error("Attribute value not specified.")).attribute=O,L}}function D(S,O){if(O=O||{},typeof S.name>"u"&&S.id&&S.id in g.oids&&(S.name=g.oids[S.id]),typeof S.id>"u"){if(!S.name||!(S.name in g.oids))throw(H=new Error("Extension ID not specified.")).extension=S,H;S.id=g.oids[S.name]}if(typeof S.value<"u")return S;if("keyUsage"===S.name){var L=0,j=0,re=0;S.digitalSignature&&(j|=128,L=7),S.nonRepudiation&&(j|=64,L=6),S.keyEncipherment&&(j|=32,L=5),S.dataEncipherment&&(j|=16,L=4),S.keyAgreement&&(j|=8,L=3),S.keyCertSign&&(j|=4,L=2),S.cRLSign&&(j|=2,L=1),S.encipherOnly&&(j|=1,L=0),S.decipherOnly&&(re|=128,L=7);var $=String.fromCharCode(L);0!==re?$+=String.fromCharCode(j)+String.fromCharCode(re):0!==j&&($+=String.fromCharCode(j)),S.value=u.create(u.Class.UNIVERSAL,u.Type.BITSTRING,!1,$)}else if("basicConstraints"===S.name)S.value=u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[]),S.cA&&S.value.value.push(u.create(u.Class.UNIVERSAL,u.Type.BOOLEAN,!1,String.fromCharCode(255))),"pathLenConstraint"in S&&S.value.value.push(u.create(u.Class.UNIVERSAL,u.Type.INTEGER,!1,u.integerToDer(S.pathLenConstraint).getBytes()));else if("extKeyUsage"===S.name){S.value=u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[]);var te=S.value.value;for(var Z in S)!0===S[Z]&&(Z in b?te.push(u.create(u.Class.UNIVERSAL,u.Type.OID,!1,u.oidToDer(b[Z]).getBytes())):-1!==Z.indexOf(".")&&te.push(u.create(u.Class.UNIVERSAL,u.Type.OID,!1,u.oidToDer(Z).getBytes())))}else if("nsCertType"===S.name)L=0,j=0,S.client&&(j|=128,L=7),S.server&&(j|=64,L=6),S.email&&(j|=32,L=5),S.objsign&&(j|=16,L=4),S.reserved&&(j|=8,L=3),S.sslCA&&(j|=4,L=2),S.emailCA&&(j|=2,L=1),S.objCA&&(j|=1,L=0),$=String.fromCharCode(L),0!==j&&($+=String.fromCharCode(j)),S.value=u.create(u.Class.UNIVERSAL,u.Type.BITSTRING,!1,$);else if("subjectAltName"===S.name||"issuerAltName"===S.name){S.value=u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[]);for(var ne=0;ne128)throw new Error('Invalid "nsComment" content.');S.value=u.create(u.Class.UNIVERSAL,u.Type.IA5STRING,!1,S.comment)}else if("subjectKeyIdentifier"===S.name&&O.cert){var oe=O.cert.generateSubjectKeyIdentifier();S.subjectKeyIdentifier=oe.toHex(),S.value=u.create(u.Class.UNIVERSAL,u.Type.OCTETSTRING,!1,oe.getBytes())}else if("authorityKeyIdentifier"===S.name&&O.cert){if(S.value=u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[]),te=S.value.value,S.keyIdentifier){var de=!0===S.keyIdentifier?O.cert.generateSubjectKeyIdentifier().getBytes():S.keyIdentifier;te.push(u.create(u.Class.CONTEXT_SPECIFIC,0,!1,de))}if(S.authorityCertIssuer){var pe=[u.create(u.Class.CONTEXT_SPECIFIC,4,!0,[C(!0===S.authorityCertIssuer?O.cert.issuer:S.authorityCertIssuer)])];te.push(u.create(u.Class.CONTEXT_SPECIFIC,1,!0,pe))}if(S.serialNumber){var ke=h.util.hexToBytes(!0===S.serialNumber?O.cert.serialNumber:S.serialNumber);te.push(u.create(u.Class.CONTEXT_SPECIFIC,2,!1,ke))}}else if("cRLDistributionPoints"===S.name){S.value=u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[]),te=S.value.value;var q,Se=u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[]),Pe=u.create(u.Class.CONTEXT_SPECIFIC,0,!0,[]);for(ne=0;ne"u")throw(H=new Error("Extension value not specified.")).extension=S,H;return S}function x(S,O){if(S===b["RSASSA-PSS"]){var H=[];return void 0!==O.hash.algorithmOid&&H.push(u.create(u.Class.CONTEXT_SPECIFIC,0,!0,[u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[u.create(u.Class.UNIVERSAL,u.Type.OID,!1,u.oidToDer(O.hash.algorithmOid).getBytes()),u.create(u.Class.UNIVERSAL,u.Type.NULL,!1,"")])])),void 0!==O.mgf.algorithmOid&&H.push(u.create(u.Class.CONTEXT_SPECIFIC,1,!0,[u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[u.create(u.Class.UNIVERSAL,u.Type.OID,!1,u.oidToDer(O.mgf.algorithmOid).getBytes()),u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[u.create(u.Class.UNIVERSAL,u.Type.OID,!1,u.oidToDer(O.mgf.hash.algorithmOid).getBytes()),u.create(u.Class.UNIVERSAL,u.Type.NULL,!1,"")])])])),void 0!==O.saltLength&&H.push(u.create(u.Class.CONTEXT_SPECIFIC,2,!0,[u.create(u.Class.UNIVERSAL,u.Type.INTEGER,!1,u.integerToDer(O.saltLength).getBytes())])),u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,H)}return u.create(u.Class.UNIVERSAL,u.Type.NULL,!1,"")}function M(S){var O=u.create(u.Class.CONTEXT_SPECIFIC,0,!0,[]);if(0===S.attributes.length)return O;for(var H=S.attributes,L=0;L2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(Z.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if($.validity.notBefore=Z[0],$.validity.notAfter=Z[1],$.tbsCertificate=H.tbsCertificate,O){$.md=y({signatureOid:$.signatureOid,type:"certificate"});var q=u.toDer($.tbsCertificate);$.md.update(q.getBytes())}var ne=h.md.sha1.create(),oe=u.toDer(H.certIssuer);ne.update(oe.getBytes()),$.issuer.getField=function(ke){return I($.issuer,ke)},$.issuer.addField=function(ke){P([ke]),$.issuer.attributes.push(ke)},$.issuer.attributes=g.RDNAttributesAsArray(H.certIssuer),H.certIssuerUniqueId&&($.issuer.uniqueId=H.certIssuerUniqueId),$.issuer.hash=ne.digest().toHex();var de=h.md.sha1.create(),pe=u.toDer(H.certSubject);return de.update(pe.getBytes()),$.subject.getField=function(ke){return I($.subject,ke)},$.subject.addField=function(ke){P([ke]),$.subject.attributes.push(ke)},$.subject.attributes=g.RDNAttributesAsArray(H.certSubject),H.certSubjectUniqueId&&($.subject.uniqueId=H.certSubjectUniqueId),$.subject.hash=de.digest().toHex(),$.extensions=H.certExtensions?g.certificateExtensionsFromAsn1(H.certExtensions):[],$.publicKey=g.publicKeyFromAsn1(H.subjectPublicKeyInfo),$},g.certificateExtensionsFromAsn1=function(S){for(var O=[],H=0;H1&&(L=H.value.charCodeAt(1),j=H.value.length>2?H.value.charCodeAt(2):0),O.digitalSignature=128==(128&L),O.nonRepudiation=64==(64&L),O.keyEncipherment=32==(32&L),O.dataEncipherment=16==(16&L),O.keyAgreement=8==(8&L),O.keyCertSign=4==(4&L),O.cRLSign=2==(2&L),O.encipherOnly=1==(1&L),O.decipherOnly=128==(128&j)}else if("basicConstraints"===O.name){var H=u.fromDer(O.value);O.cA=H.value.length>0&&H.value[0].type===u.Type.BOOLEAN&&0!==H.value[0].value.charCodeAt(0);var re=null;H.value.length>0&&H.value[0].type===u.Type.INTEGER?re=H.value[0].value:H.value.length>1&&(re=H.value[1].value),null!==re&&(O.pathLenConstraint=u.derToInteger(re))}else if("extKeyUsage"===O.name){H=u.fromDer(O.value);for(var $=0;$1&&(L=H.value.charCodeAt(1)),O.client=128==(128&L),O.server=64==(64&L),O.email=32==(32&L),O.objsign=16==(16&L),O.reserved=8==(8&L),O.sslCA=4==(4&L),O.emailCA=2==(2&L),O.objCA=1==(1&L);else if("subjectAltName"===O.name||"issuerAltName"===O.name){O.altNames=[],H=u.fromDer(O.value);for(var Z,q=0;q=B&&S0&&L.value.push(g.certificateExtensionsToAsn1(S.extensions)),L},g.getCertificationRequestInfo=function(S){return u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[u.create(u.Class.UNIVERSAL,u.Type.INTEGER,!1,u.integerToDer(S.version).getBytes()),C(S.subject),g.publicKeyToAsn1(S.publicKey),M(S)])},g.distinguishedNameToAsn1=function(S){return C(S)},g.certificateToAsn1=function(S){var O=S.tbsCertificate||g.getTBSCertificate(S);return u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[O,u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[u.create(u.Class.UNIVERSAL,u.Type.OID,!1,u.oidToDer(S.signatureOid).getBytes()),x(S.signatureOid,S.signatureParameters)]),u.create(u.Class.UNIVERSAL,u.Type.BITSTRING,!1,String.fromCharCode(0)+S.signature)])},g.certificateExtensionsToAsn1=function(S){var O=u.create(u.Class.CONTEXT_SPECIFIC,3,!0,[]),H=u.create(u.Class.UNIVERSAL,u.Type.SEQUENCE,!0,[]);O.value.push(H);for(var L=0;L"u"&&(j=new Date);var re=!0,$=null,te=0;do{var Z=O.shift(),q=null,ne=!1;if(j&&(jZ.validity.notAfter)&&($={message:"Certificate is not valid yet or has expired.",error:g.certificateError.certificate_expired,notBefore:Z.validity.notBefore,notAfter:Z.validity.notAfter,now:j}),null===$){if(null===(q=O[0]||S.getIssuer(Z))&&Z.isIssuer(Z)&&(ne=!0,q=Z),q){var oe=q;h.util.isArray(oe)||(oe=[oe]);for(var de=!1;!de&&oe.length>0;){q=oe.shift();try{de=q.verify(Z)}catch{}}de||($={message:"Certificate signature is invalid.",error:g.certificateError.bad_certificate})}null===$&&(!q||ne)&&!S.hasCertificate(Z)&&($={message:"Certificate is not trusted.",error:g.certificateError.unknown_ca})}if(null===$&&q&&!Z.isIssuer(q)&&($={message:"Certificate issuer is invalid.",error:g.certificateError.bad_certificate}),null===$)for(var pe={keyUsage:!0,basicConstraints:!0},ke=0;null===$&&kePe.pathLenConstraint&&($={message:"Certificate basicConstraints pathLenConstraint violated.",error:g.certificateError.bad_certificate})}var K=null===$||$.error,Ee=H.verify?H.verify(K,te,L):K;if(!0!==Ee)throw!0===K&&($={message:"The application rejected the certificate.",error:g.certificateError.bad_certificate}),(Ee||0===Ee)&&("object"!=typeof Ee||h.util.isArray(Ee)?"string"==typeof Ee&&($.error=Ee):(Ee.message&&($.message=Ee.message),Ee.error&&($.error=Ee.error))),$;$=null,re=!1,++te}while(O.length>0);return!0}},8614:(J,G,N)=>{const h=N(1159),u=N(281);J.exports=class{constructor(){this._buffer=new h,this._waitingConsumers=new h}push(b){const{promise:w,resolve:v}=u();return this._buffer.push({chunk:b,resolve:v}),this._consume(),w}_consume(){for(;!this._waitingConsumers.isEmpty()&&!this._buffer.isEmpty();){const b=this._waitingConsumers.shift(),w=this._buffer.shift();b.resolve(w.chunk),w.resolve()}}shift(){const{promise:b,resolve:w}=u();return this._waitingConsumers.push({resolve:w}),this._consume(),b}isEmpty(){return this._buffer.isEmpty()}}},281:J=>{"use strict";J.exports=()=>{const N={};return N.promise=new Promise((h,u)=>{N.resolve=h,N.reject=u}),N}},4108:(J,G,N)=>{"use strict";J.exports=N(8777).default},8777:function(J,G,N){"use strict";var h=this&&this.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(G,"__esModule",{value:!0});const u=N(7910),g=h(N(4066)),b=h(N(6599)),w=N(1396),l=["0.0.0.0/8","10.0.0.0/8","100.64.0.0/10","127.0.0.0/8","169.254.0.0/16","172.16.0.0/12","192.0.0.0/24","192.0.0.0/29","192.0.0.8/32","192.0.0.9/32","192.0.0.10/32","192.0.0.170/32","192.0.0.171/32","192.0.2.0/24","192.31.196.0/24","192.52.193.0/24","192.88.99.0/24","192.168.0.0/16","192.175.48.0/24","198.18.0.0/15","198.51.100.0/24","203.0.113.0/24","240.0.0.0/4","255.255.255.255/32"].map(_=>new u.Netmask(_));function d(_){return/^::$/.test(_)||/^::1$/.test(_)||/^::f{4}:([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(_)||/^::f{4}:0.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(_)||/^64:ff9b::([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(_)||/^100::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(_)||/^2001::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(_)||/^2001:2[0-9a-fA-F]:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(_)||/^2001:db8:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(_)||/^2002:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(_)||/^f[c-d]([0-9a-fA-F]{2,2}):/i.test(_)||/^fe[8-9a-bA-B][0-9a-fA-F]:/i.test(_)||/^ff([0-9a-fA-F]{2,2}):/i.test(_)}G.default=_=>{if((0,w.isValid)(_)){const I=(0,w.parse)(_);if("ipv4"===I.kind())return function p(_){for(let I of l)if(I.contains(_))return!0;return!1}(I.toNormalizedString());if("ipv6"===I.kind())return d(_)}else if((0,b.default)(_)&&g.default.v6().test(_))return d(_)}},3863:(J,G,N)=>{"use strict";J.exports=N(2540)},4599:J=>{"use strict";J.exports=N;var h,G=/\/|\./;function N(u,g){G.test(u)||(u="google/protobuf/"+u+".proto",g={nested:{google:{nested:{protobuf:{nested:g}}}}}),N[u]=g}N("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}}),N("duration",{Duration:h={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}),N("timestamp",{Timestamp:h}),N("empty",{Empty:{fields:{}}}),N("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}}),N("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}}),N("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}}),N.get=function(g){return N[g]||null}},6533:(J,G,N)=>{"use strict";var h=G,u=N(4269),g=N(8572);function b(v,l,p,d){if(l.resolvedType)if(l.resolvedType instanceof u){v("switch(d%s){",d);for(var _=l.resolvedType.values,I=Object.keys(_),E=0;E>>0",d,d);break;case"int32":case"sint32":case"sfixed32":v("m%s=d%s|0",d,d);break;case"uint64":y=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":v("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",d,d,y)('else if(typeof d%s==="string")',d)("m%s=parseInt(d%s,10)",d,d)('else if(typeof d%s==="number")',d)("m%s=d%s",d,d)('else if(typeof d%s==="object")',d)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",d,d,d,y?"true":"");break;case"bytes":v('if(typeof d%s==="string")',d)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",d,d,d)("else if(d%s.length >= 0)",d)("m%s=d%s",d,d);break;case"string":v("m%s=String(d%s)",d,d);break;case"bool":v("m%s=Boolean(d%s)",d,d)}}return v}function w(v,l,p,d){if(l.resolvedType)l.resolvedType instanceof u?v("d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s",d,p,d,d,p,d,d):v("d%s=types[%i].toObject(m%s,o)",d,p,d);else{var _=!1;switch(l.type){case"double":case"float":v("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",d,d,d,d);break;case"uint64":_=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":v('if(typeof m%s==="number")',d)("d%s=o.longs===String?String(m%s):m%s",d,d,d)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",d,d,d,d,_?"true":"",d);break;case"bytes":v("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",d,d,d,d,d);break;default:v("d%s=m%s",d,d)}}return v}h.fromObject=function(l){var p=l.fieldsArray,d=g.codegen(["d"],l.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!p.length)return d("return new this.ctor");d("var m=new this.ctor");for(var _=0;_{"use strict";J.exports=function w(v){var l=g.codegen(["r","l"],v.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(v.fieldsArray.filter(function(y){return y.map}).length?",k,value":""))("while(r.pos>>3){");for(var p=0;p>>3){")("case 1: k=r.%s(); break",d.keyType)("case 2:"),void 0===u.basic[_]?l("value=types[%i].decode(r,r.uint32())",p):l("value=r.%s()",_),l("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),l(void 0!==u.long[d.keyType]?'%s[typeof k==="object"?util.longToHash(k):k]=value':"%s[k]=value",I)):d.repeated?(l("if(!(%s&&%s.length))",I,I)("%s=[]",I),void 0!==u.packed[_]&&l("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos{"use strict";J.exports=function w(v){for(var d,l=g.codegen(["m","w"],v.name+"$encode")("if(!w)")("w=Writer.create()"),_=v.fieldsArray.slice().sort(g.compareFieldsById),p=0;p<_.length;++p){var I=_[p].resolve(),E=v._fieldsArray.indexOf(I),y=I.resolvedType instanceof h?"int32":I.type,f=u.basic[y];d="m"+g.safeProp(I.name),I.map?(l("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",d,I.name)("for(var ks=Object.keys(%s),i=0;i>>0,8|u.mapKey[I.keyType],I.keyType),void 0===f?l("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",E,d):l(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|f,y,d),l("}")("}")):I.repeated?(l("if(%s!=null&&%s.length){",d,d),I.packed&&void 0!==u.packed[y]?l("w.uint32(%i).fork()",(I.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",d)("w.%s(%s[i])",y,d)("w.ldelim()"):(l("for(var i=0;i<%s.length;++i)",d),void 0===f?b(l,I,E,d+"[i]"):l("w.uint32(%i).%s(%s[i])",(I.id<<3|f)>>>0,y,d)),l("}")):(I.optional&&l("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",d,I.name),void 0===f?b(l,I,E,d):l("w.uint32(%i).%s(%s)",(I.id<<3|f)>>>0,y,d))}return l("return w")};var h=N(4269),u=N(688),g=N(8572);function b(v,l,p,d){return l.resolvedType.group?v("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",p,d,(l.id<<3|3)>>>0,(l.id<<3|4)>>>0):v("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",p,d,(l.id<<3|2)>>>0)}},4269:(J,G,N)=>{"use strict";J.exports=b;var h=N(9487);((b.prototype=Object.create(h.prototype)).constructor=b).className="Enum";var u=N(326),g=N(8572);function b(w,v,l,p,d,_){if(h.call(this,w,l),v&&"object"!=typeof v)throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=p,this.comments=d||{},this.valuesOptions=_,this.reserved=void 0,v)for(var I=Object.keys(v),E=0;E{"use strict";J.exports=l;var h=N(9487);((l.prototype=Object.create(h.prototype)).constructor=l).className="Field";var w,u=N(4269),g=N(688),b=N(8572),v=/^required|optional|repeated$/;function l(p,d,_,I,E,y,f){if(b.isObject(I)?(f=E,y=I,I=E=void 0):b.isObject(E)&&(f=y,y=E,E=void 0),h.call(this,p,y),!b.isInteger(d)||d<0)throw TypeError("id must be a non-negative integer");if(!b.isString(_))throw TypeError("type must be a string");if(void 0!==I&&!v.test(I=I.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(void 0!==E&&!b.isString(E))throw TypeError("extend must be a string");"proto3_optional"===I&&(I="optional"),this.rule=I&&"optional"!==I?I:void 0,this.type=_,this.id=d,this.extend=E||void 0,this.required="required"===I,this.optional=!this.required,this.repeated="repeated"===I,this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=!!b.Long&&void 0!==g.long[_],this.bytes="bytes"===_,this.resolvedType=null,this.extensionField=null,this.declaringField=null,this._packed=null,this.comment=f}l.fromJSON=function(d,_){return new l(d,_.id,_.type,_.rule,_.extend,_.options,_.comment)},Object.defineProperty(l.prototype,"packed",{get:function(){return null===this._packed&&(this._packed=!1!==this.getOption("packed")),this._packed}}),l.prototype.setOption=function(d,_,I){return"packed"===d&&(this._packed=null),h.prototype.setOption.call(this,d,_,I)},l.prototype.toJSON=function(d){var _=!!d&&Boolean(d.keepComments);return b.toObject(["rule","optional"!==this.rule&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",_?this.comment:void 0])},l.prototype.resolve=function(){if(this.resolved)return this;if(void 0===(this.typeDefault=g.defaults[this.type])?(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.typeDefault=this.resolvedType instanceof w?null:this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]):this.options&&this.options.proto3_optional&&(this.typeDefault=null),this.options&&null!=this.options.default&&(this.typeDefault=this.options.default,this.resolvedType instanceof u&&"string"==typeof this.typeDefault&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&((!0===this.options.packed||void 0!==this.options.packed&&this.resolvedType&&!(this.resolvedType instanceof u))&&delete this.options.packed,Object.keys(this.options).length||(this.options=void 0)),this.long)this.typeDefault=b.Long.fromNumber(this.typeDefault,"u"===this.type.charAt(0)),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&"string"==typeof this.typeDefault){var d;b.base64.test(this.typeDefault)?b.base64.decode(this.typeDefault,d=b.newBuffer(b.base64.length(this.typeDefault)),0):b.utf8.write(this.typeDefault,d=b.newBuffer(b.utf8.length(this.typeDefault)),0),this.typeDefault=d}return this.defaultValue=this.map?b.emptyObject:this.repeated?b.emptyArray:this.typeDefault,this.parent instanceof w&&(this.parent.ctor.prototype[this.name]=this.defaultValue),h.prototype.resolve.call(this)},l.d=function(d,_,I,E){return"function"==typeof _?_=b.decorateType(_).name:_&&"object"==typeof _&&(_=b.decorateEnum(_).name),function(f,C){b.decorateType(f.constructor).add(new l(C,d,_,I,{default:E}))}},l._configure=function(d){w=d}},5803:(J,G,N)=>{"use strict";var h=J.exports=N(95);h.build="light",h.load=function u(b,w,v){return"function"==typeof w?(v=w,w=new h.Root):w||(w=new h.Root),w.load(b,v)},h.loadSync=function g(b,w){return w||(w=new h.Root),w.loadSync(b)},h.encoder=N(133),h.decoder=N(225),h.verifier=N(8617),h.converter=N(6533),h.ReflectionObject=N(9487),h.Namespace=N(326),h.Root=N(5257),h.Enum=N(4269),h.Type=N(7845),h.Field=N(2986),h.OneOf=N(7397),h.MapField=N(9455),h.Service=N(9630),h.Method=N(1618),h.Message=N(1413),h.wrappers=N(761),h.types=N(688),h.util=N(8572),h.ReflectionObject._configure(h.Root),h.Namespace._configure(h.Type,h.Service,h.Enum),h.Root._configure(h.Type),h.Field._configure(h.Type)},95:(J,G,N)=>{"use strict";var h=G;function u(){h.util._configure(),h.Writer._configure(h.BufferWriter),h.Reader._configure(h.BufferReader)}h.build="minimal",h.Writer=N(1650),h.BufferWriter=N(813),h.Reader=N(7270),h.BufferReader=N(4354),h.util=N(7211),h.rpc=N(7830),h.roots=N(6671),h.configure=u,u()},2540:(J,G,N)=>{"use strict";var h=J.exports=N(5803);h.build="full",h.tokenize=N(691),h.parse=N(8992),h.common=N(4599),h.Root._configure(h.Type,h.parse,h.common)},9455:(J,G,N)=>{"use strict";J.exports=b;var h=N(2986);((b.prototype=Object.create(h.prototype)).constructor=b).className="MapField";var u=N(688),g=N(8572);function b(w,v,l,p,d,_){if(h.call(this,w,v,p,void 0,void 0,d,_),!g.isString(l))throw TypeError("keyType must be a string");this.keyType=l,this.resolvedKeyType=null,this.map=!0}b.fromJSON=function(v,l){return new b(v,l.id,l.keyType,l.type,l.options,l.comment)},b.prototype.toJSON=function(v){var l=!!v&&Boolean(v.keepComments);return g.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",l?this.comment:void 0])},b.prototype.resolve=function(){if(this.resolved)return this;if(void 0===u.mapKey[this.keyType])throw Error("invalid key type: "+this.keyType);return h.prototype.resolve.call(this)},b.d=function(v,l,p){return"function"==typeof p?p=g.decorateType(p).name:p&&"object"==typeof p&&(p=g.decorateEnum(p).name),function(_,I){g.decorateType(_.constructor).add(new b(I,v,l,p))}}},1413:(J,G,N)=>{"use strict";J.exports=u;var h=N(7211);function u(g){if(g)for(var b=Object.keys(g),w=0;w{"use strict";J.exports=g;var h=N(9487);((g.prototype=Object.create(h.prototype)).constructor=g).className="Method";var u=N(8572);function g(b,w,v,l,p,d,_,I,E){if(u.isObject(p)?(_=p,p=d=void 0):u.isObject(d)&&(_=d,d=void 0),void 0!==w&&!u.isString(w))throw TypeError("type must be a string");if(!u.isString(v))throw TypeError("requestType must be a string");if(!u.isString(l))throw TypeError("responseType must be a string");h.call(this,b,_),this.type=w||"rpc",this.requestType=v,this.requestStream=!!p||void 0,this.responseType=l,this.responseStream=!!d||void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=I,this.parsedOptions=E}g.fromJSON=function(w,v){return new g(w,v.type,v.requestType,v.responseType,v.requestStream,v.responseStream,v.options,v.comment,v.parsedOptions)},g.prototype.toJSON=function(w){var v=!!w&&Boolean(w.keepComments);return u.toObject(["type","rpc"!==this.type&&this.type||void 0,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",v?this.comment:void 0,"parsedOptions",this.parsedOptions])},g.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),h.prototype.resolve.call(this))}},326:(J,G,N)=>{"use strict";J.exports=d;var h=N(9487);((d.prototype=Object.create(h.prototype)).constructor=d).className="Namespace";var w,v,l,u=N(2986),g=N(8572),b=N(7397);function p(I,E){if(I&&I.length){for(var y={},f=0;fy)return!0;return!1},d.isReservedName=function(E,y){if(E)for(var f=0;f0;){var C=E.shift();if(f.nested&&f.nested[C]){if(!((f=f.nested[C])instanceof d))throw Error("path conflicts with non-namespace objects")}else f.add(f=new d(C))}return y&&f.addJSON(y),f},d.prototype.resolveAll=function(){for(var E=this.nestedArray,y=0;y-1)return C}else if(C instanceof d&&(C=C.lookup(E.slice(1),y,!0)))return C}else for(var A=0;A{"use strict";J.exports=g,g.className="ReflectionObject";var u,h=N(8572);function g(b,w){if(!h.isString(b))throw TypeError("name must be a string");if(w&&!h.isObject(w))throw TypeError("options must be an object");this.options=w,this.parsedOptions=null,this.name=b,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(g.prototype,{root:{get:function(){for(var b=this;null!==b.parent;)b=b.parent;return b}},fullName:{get:function(){for(var b=[this.name],w=this.parent;w;)b.unshift(w.name),w=w.parent;return b.join(".")}}}),g.prototype.toJSON=function(){throw Error()},g.prototype.onAdd=function(w){this.parent&&this.parent!==w&&this.parent.remove(this),this.parent=w,this.resolved=!1;var v=w.root;v instanceof u&&v._handleAdd(this)},g.prototype.onRemove=function(w){var v=w.root;v instanceof u&&v._handleRemove(this),this.parent=null,this.resolved=!1},g.prototype.resolve=function(){return this.resolved||this.root instanceof u&&(this.resolved=!0),this},g.prototype.getOption=function(w){if(this.options)return this.options[w]},g.prototype.setOption=function(w,v,l){return(!l||!this.options||void 0===this.options[w])&&((this.options||(this.options={}))[w]=v),this},g.prototype.setParsedOption=function(w,v,l){this.parsedOptions||(this.parsedOptions=[]);var p=this.parsedOptions;if(l){var d=p.find(function(E){return Object.prototype.hasOwnProperty.call(E,w)});d?h.setProperty(d[w],l,v):((d={})[w]=h.setProperty({},l,v),p.push(d))}else{var I={};I[w]=v,p.push(I)}return this},g.prototype.setOptions=function(w,v){if(w)for(var l=Object.keys(w),p=0;p{"use strict";J.exports=b;var h=N(9487);((b.prototype=Object.create(h.prototype)).constructor=b).className="OneOf";var u=N(2986),g=N(8572);function b(v,l,p,d){if(Array.isArray(l)||(p=l,l=void 0),h.call(this,v,p),void 0!==l&&!Array.isArray(l))throw TypeError("fieldNames must be an Array");this.oneof=l||[],this.fieldsArray=[],this.comment=d}function w(v){if(v.parent)for(var l=0;l-1&&this.oneof.splice(p,1),l.partOf=null,this},b.prototype.onAdd=function(l){h.prototype.onAdd.call(this,l);for(var d=0;d{"use strict";J.exports=F,F.filename=null,F.defaults={keepCase:!1};var h=N(691),u=N(5257),g=N(7845),b=N(2986),w=N(9455),v=N(7397),l=N(4269),p=N(9630),d=N(1618),_=N(688),I=N(8572),E=/^[1-9][0-9]*$/,y=/^-?[1-9][0-9]*$/,f=/^0[x][0-9a-fA-F]+$/,C=/^-?0[x][0-9a-fA-F]+$/,A=/^0[0-7]+$/,P=/^-?0[0-7]+$/,D=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,x=/^[a-zA-Z_][a-zA-Z_0-9]*$/,M=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,B=/^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/;function F(z,S,O){S instanceof u||(O=S,S=new u),O||(O=F.defaults);var ne,oe,de,pe,je,H=O.preferTrailingComment||!1,L=h(z,O.alternateCommentMode||!1),j=L.next,re=L.push,$=L.peek,te=L.skip,Z=L.cmnt,q=!0,ke=!1,Se=S,Pe=O.keepCase?function(be){return be}:I.camelCase;function we(be,ge,De){var Ue=F.filename;return De||(F.filename=null),Error("illegal "+(ge||"token")+" '"+be+"' ("+(Ue?Ue+", ":"")+"line "+L.line+")")}function $e(){var ge,be=[];do{if('"'!==(ge=j())&&"'"!==ge)throw we(ge);be.push(j()),te(ge),ge=$()}while('"'===ge||"'"===ge);return be.join("")}function K(be){var ge=j();switch(ge){case"'":case'"':return re(ge),$e();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return function Ce(be,ge){var De=1;switch("-"===be.charAt(0)&&(De=-1,be=be.substring(1)),be){case"inf":case"INF":case"Inf":return De*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(E.test(be))return De*parseInt(be,10);if(f.test(be))return De*parseInt(be,16);if(A.test(be))return De*parseInt(be,8);if(D.test(be))return De*parseFloat(be);throw we(be,"number",ge)}(ge,!0)}catch{if(be&&M.test(ge))return ge;throw we(ge,"value")}}function Ee(be,ge){var De,Ue;do{!ge||'"'!==(De=$())&&"'"!==De?be.push([Ue=xe(j()),te("to",!0)?xe(j()):Ue]):be.push($e())}while(te(",",!0));te(";")}function xe(be,ge){switch(be){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!ge&&"-"===be.charAt(0))throw we(be,"id");if(y.test(be))return parseInt(be,10);if(C.test(be))return parseInt(be,16);if(P.test(be))return parseInt(be,8);throw we(be,"id")}function Ke(){if(void 0!==ne)throw we("package");if(ne=j(),!M.test(ne))throw we(ne,"name");Se=Se.define(ne),te(";")}function We(){var ge,be=$();switch(be){case"weak":ge=de||(de=[]),j();break;case"public":j();default:ge=oe||(oe=[])}be=$e(),te(";"),ge.push(be)}function Je(){if(te("="),pe=$e(),!(ke="proto3"===pe)&&"proto2"!==pe)throw we(pe,"syntax");te(";")}function Xe(be,ge){switch(ge){case"option":return ye(be,ge),te(";"),!0;case"message":return pt(be,ge),!0;case"enum":return ie(be,ge),!0;case"service":return function qe(be,ge){if(!x.test(ge=j()))throw we(ge,"service name");var De=new p(ge);Ot(De,function(Be){if(!Xe(De,Be)){if("rpc"!==Be)throw we(Be);!function st(be,ge){var De=Z(),Ue=ge;if(!x.test(ge=j()))throw we(ge,"name");var dt,Pt,vt,et,Be=ge;if(te("("),te("stream",!0)&&(Pt=!0),!M.test(ge=j())||(dt=ge,te(")"),te("returns"),te("("),te("stream",!0)&&(et=!0),!M.test(ge=j())))throw we(ge);vt=ge,te(")");var Pn=new d(Be,Ue,dt,vt,Pt,et);Pn.comment=De,Ot(Pn,function(yn){if("option"!==yn)throw we(yn);ye(Pn,yn),te(";")}),be.add(Pn)}(De,Be)}}),be.add(De)}(be,ge),!0;case"extend":return function nt(be,ge){if(!M.test(ge=j()))throw we(ge,"reference");var De=ge;Ot(null,function(Be){switch(Be){case"required":case"repeated":Dt(be,Be,De);break;case"optional":Dt(be,ke?"proto3_optional":"optional",De);break;default:if(!ke||!M.test(Be))throw we(Be);re(Be),Dt(be,"optional",De)}})}(be,ge),!0}return!1}function Ot(be,ge,De){var Ue=L.line;if(be&&("string"!=typeof be.comment&&(be.comment=Z()),be.filename=F.filename),te("{",!0)){for(var Be;"}"!==(Be=j());)ge(Be);te(";",!0)}else De&&De(),te(";"),be&&("string"!=typeof be.comment||H)&&(be.comment=Z(Ue)||be.comment)}function pt(be,ge){if(!x.test(ge=j()))throw we(ge,"type name");var De=new g(ge);Ot(De,function(Be){if(!Xe(De,Be))switch(Be){case"map":!function Sr(be){te("<");var ge=j();if(void 0===_.mapKey[ge])throw we(ge,"type");te(",");var De=j();if(!M.test(De))throw we(De,"type");te(">");var Ue=j();if(!x.test(Ue))throw we(Ue,"name");te("=");var Be=new w(Pe(Ue),xe(j()),ge,De);Ot(Be,function(Pt){if("option"!==Pt)throw we(Pt);ye(Be,Pt),te(";")},function(){Ye(Be)}),be.add(Be)}(De);break;case"required":case"repeated":Dt(De,Be);break;case"optional":Dt(De,ke?"proto3_optional":"optional");break;case"oneof":!function ni(be,ge){if(!x.test(ge=j()))throw we(ge,"name");var De=new v(Pe(ge));Ot(De,function(Be){"option"===Be?(ye(De,Be),te(";")):(re(Be),Dt(De,"optional"))}),be.add(De)}(De,Be);break;case"extensions":Ee(De.extensions||(De.extensions=[]));break;case"reserved":Ee(De.reserved||(De.reserved=[]),!0);break;default:if(!ke||!M.test(Be))throw we(Be);re(Be),Dt(De,"optional")}}),be.add(De)}function Dt(be,ge,De){var Ue=j();if("group"!==Ue){if(!M.test(Ue))throw we(Ue,"type");var Be=j();if(!x.test(Be))throw we(Be,"name");Be=Pe(Be),te("=");var dt=new b(Be,xe(j()),Ue,ge,De);if(Ot(dt,function(et){if("option"!==et)throw we(et);ye(dt,et),te(";")},function(){Ye(dt)}),"proto3_optional"===ge){var Pt=new v("_"+Be);dt.setOption("proto3_optional",!0),Pt.add(dt),be.add(Pt)}else be.add(dt);!ke&&dt.repeated&&(void 0!==_.packed[Ue]||void 0===_.basic[Ue])&&dt.setOption("packed",!1,!0)}else!function Wr(be,ge){var De=j();if(!x.test(De))throw we(De,"name");var Ue=I.lcFirst(De);De===Ue&&(De=I.ucFirst(De)),te("=");var Be=xe(j()),dt=new g(De);dt.group=!0;var Pt=new b(Ue,Be,De,ge);Pt.filename=F.filename,Ot(dt,function(et){switch(et){case"option":ye(dt,et),te(";");break;case"required":case"repeated":Dt(dt,et);break;case"optional":Dt(dt,ke?"proto3_optional":"optional");break;case"message":pt(dt,et);break;case"enum":ie(dt,et);break;default:throw we(et)}}),be.add(dt).add(Pt)}(be,ge)}function ie(be,ge){if(!x.test(ge=j()))throw we(ge,"name");var De=new l(ge);Ot(De,function(Be){switch(Be){case"option":ye(De,Be),te(";");break;case"reserved":Ee(De.reserved||(De.reserved=[]),!0);break;default:!function fe(be,ge){if(!x.test(ge))throw we(ge,"name");te("=");var De=xe(j(),!0),Ue={options:void 0,setOption:function(Be,dt){void 0===this.options&&(this.options={}),this.options[Be]=dt}};Ot(Ue,function(dt){if("option"!==dt)throw we(dt);ye(Ue,dt),te(";")},function(){Ye(Ue)}),be.add(ge,De,Ue.comment,Ue.options)}(De,Be)}}),be.add(De)}function ye(be,ge){var De=te("(",!0);if(!M.test(ge=j()))throw we(ge,"name");var dt,Ue=ge,Be=Ue;De&&(te(")"),Be=Ue="("+Ue+")",ge=$(),B.test(ge)&&(dt=ge.slice(1),Ue+=ge,j())),te("="),function Ne(be,ge,De,Ue){be.setParsedOption&&be.setParsedOption(ge,De,Ue)}(be,Be,me(be,Ue),dt)}function me(be,ge){if(te("{",!0)){for(var De={};!te("}",!0);){if(!x.test(je=j()))throw we(je,"name");var Ue,Be=je;if(te(":",!0),"{"===$())Ue=me(be,ge+"."+je);else if("["===$()){var dt;if(Ue=[],te("[",!0)){do{dt=K(!0),Ue.push(dt)}while(te(",",!0));te("]"),typeof dt<"u"&&_e(be,ge+"."+je,dt)}}else Ue=K(!0),_e(be,ge+"."+je,Ue);var Pt=De[Be];Pt&&(Ue=[].concat(Pt).concat(Ue)),De[Be]=Ue,te(",",!0),te(";",!0)}return De}var vt=K(!0);return _e(be,ge,vt),vt}function _e(be,ge,De){be.setOption&&be.setOption(ge,De)}function Ye(be){if(te("[",!0)){do{ye(be,"option")}while(te(",",!0));te("]")}return be}for(;null!==(je=j());)switch(je){case"package":if(!q)throw we(je);Ke();break;case"import":if(!q)throw we(je);We();break;case"syntax":if(!q)throw we(je);Je();break;case"option":ye(Se,je),te(";");break;default:if(Xe(Se,je)){q=!1;continue}throw we(je)}return F.filename=null,{package:ne,imports:oe,weakImports:de,syntax:pe,root:S}}},7270:(J,G,N)=>{"use strict";J.exports=v;var u,h=N(7211),g=h.LongBits,b=h.utf8;function w(E,y){return RangeError("index out of range: "+E.pos+" + "+(y||1)+" > "+E.len)}function v(E){this.buf=E,this.pos=0,this.len=E.length}var y,l=typeof Uint8Array<"u"?function(y){if(y instanceof Uint8Array||Array.isArray(y))return new v(y);throw Error("illegal buffer")}:function(y){if(Array.isArray(y))return new v(y);throw Error("illegal buffer")},p=function(){return h.Buffer?function(f){return(v.create=function(A){return h.Buffer.isBuffer(A)?new u(A):l(A)})(f)}:l};function d(){var E=new g(0,0),y=0;if(!(this.len-this.pos>4)){for(;y<3;++y){if(this.pos>=this.len)throw w(this);if(E.lo=(E.lo|(127&this.buf[this.pos])<<7*y)>>>0,this.buf[this.pos++]<128)return E}return E.lo=(E.lo|(127&this.buf[this.pos++])<<7*y)>>>0,E}for(;y<4;++y)if(E.lo=(E.lo|(127&this.buf[this.pos])<<7*y)>>>0,this.buf[this.pos++]<128)return E;if(E.lo=(E.lo|(127&this.buf[this.pos])<<28)>>>0,E.hi=(E.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return E;if(y=0,this.len-this.pos>4){for(;y<5;++y)if(E.hi=(E.hi|(127&this.buf[this.pos])<<7*y+3)>>>0,this.buf[this.pos++]<128)return E}else for(;y<5;++y){if(this.pos>=this.len)throw w(this);if(E.hi=(E.hi|(127&this.buf[this.pos])<<7*y+3)>>>0,this.buf[this.pos++]<128)return E}throw Error("invalid varint encoding")}function _(E,y){return(E[y-4]|E[y-3]<<8|E[y-2]<<16|E[y-1]<<24)>>>0}function I(){if(this.pos+8>this.len)throw w(this,8);return new g(_(this.buf,this.pos+=4),_(this.buf,this.pos+=4))}v.create=p(),v.prototype._slice=h.Array.prototype.subarray||h.Array.prototype.slice,v.prototype.uint32=(y=4294967295,function(){if(y=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128||(y=(y|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)||(y=(y|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)||(y=(y|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)||(y=(y|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128))return y;if((this.pos+=5)>this.len)throw this.pos=this.len,w(this,10);return y}),v.prototype.int32=function(){return 0|this.uint32()},v.prototype.sint32=function(){var y=this.uint32();return y>>>1^-(1&y)|0},v.prototype.bool=function(){return 0!==this.uint32()},v.prototype.fixed32=function(){if(this.pos+4>this.len)throw w(this,4);return _(this.buf,this.pos+=4)},v.prototype.sfixed32=function(){if(this.pos+4>this.len)throw w(this,4);return 0|_(this.buf,this.pos+=4)},v.prototype.float=function(){if(this.pos+4>this.len)throw w(this,4);var y=h.float.readFloatLE(this.buf,this.pos);return this.pos+=4,y},v.prototype.double=function(){if(this.pos+8>this.len)throw w(this,4);var y=h.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,y},v.prototype.bytes=function(){var y=this.uint32(),f=this.pos,C=this.pos+y;if(C>this.len)throw w(this,y);return this.pos+=y,Array.isArray(this.buf)?this.buf.slice(f,C):f===C?new this.buf.constructor(0):this._slice.call(this.buf,f,C)},v.prototype.string=function(){var y=this.bytes();return b.read(y,0,y.length)},v.prototype.skip=function(y){if("number"==typeof y){if(this.pos+y>this.len)throw w(this,y);this.pos+=y}else do{if(this.pos>=this.len)throw w(this)}while(128&this.buf[this.pos++]);return this},v.prototype.skipType=function(E){switch(E){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(E=7&this.uint32());)this.skipType(E);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+E+" at offset "+this.pos)}return this},v._configure=function(E){u=E,v.create=p(),u._configure();var y=h.Long?"toLong":"toNumber";h.merge(v.prototype,{int64:function(){return d.call(this)[y](!1)},uint64:function(){return d.call(this)[y](!0)},sint64:function(){return d.call(this).zzDecode()[y](!1)},fixed64:function(){return I.call(this)[y](!0)},sfixed64:function(){return I.call(this)[y](!1)}})}},4354:(J,G,N)=>{"use strict";J.exports=g;var h=N(7270);(g.prototype=Object.create(h.prototype)).constructor=g;var u=N(7211);function g(b){h.call(this,b)}g._configure=function(){u.Buffer&&(g.prototype._slice=u.Buffer.prototype.slice)},g.prototype.string=function(){var w=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+w,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+w,this.len))},g._configure()},5257:(J,G,N)=>{"use strict";J.exports=d;var h=N(326);((d.prototype=Object.create(h.prototype)).constructor=d).className="Root";var v,l,p,u=N(2986),g=N(4269),b=N(7397),w=N(8572);function d(y){h.call(this,"",y),this.deferred=[],this.files=[]}function _(){}d.fromJSON=function(f,C){return C||(C=new d),f.options&&C.setOptions(f.options),C.addJSON(f.nested)},d.prototype.resolvePath=w.path.resolve,d.prototype.fetch=w.fetch,d.prototype.load=function y(f,C,A){"function"==typeof C&&(A=C,C=void 0);var P=this;if(!A)return w.asPromise(y,P,f,C);var D=A===_;function x(H,L){if(A){var j=A;if(A=null,D)throw H;j(H,L)}}function M(H){var L=H.lastIndexOf("google/protobuf/");if(L>-1){var j=H.substring(L);if(j in p)return j}return null}function B(H,L){try{if(w.isString(L)&&"{"===L.charAt(0)&&(L=JSON.parse(L)),w.isString(L)){l.filename=H;var re,j=l(L,P,C),$=0;if(j.imports)for(;$-1)){if(P.files.push(H),H in p)return void(D?B(H,p[H]):(++z,setTimeout(function(){--z,B(H,p[H])})));if(D){var j;try{j=w.fs.readFileSync(H).toString("utf8")}catch(re){return void(L||x(re))}B(H,j)}else++z,P.fetch(H,function(re,$){if(--z,A){if(re)return void(L?z||x(null,P):x(re));B(H,$)}})}}var z=0;w.isString(f)&&(f=[f]);for(var O,S=0;S-1&&this.deferred.splice(C,1)}}else if(f instanceof g)I.test(f.name)&&delete f.parent[f.name];else if(f instanceof h){for(var A=0;A{"use strict";J.exports={}},7830:(J,G,N)=>{"use strict";G.Service=N(6346)},6346:(J,G,N)=>{"use strict";J.exports=u;var h=N(7211);function u(g,b,w){if("function"!=typeof g)throw TypeError("rpcImpl must be a function");h.EventEmitter.call(this),this.rpcImpl=g,this.requestDelimited=Boolean(b),this.responseDelimited=Boolean(w)}(u.prototype=Object.create(h.EventEmitter.prototype)).constructor=u,u.prototype.rpcCall=function g(b,w,v,l,p){if(!l)throw TypeError("request must be specified");var d=this;if(!p)return h.asPromise(g,d,b,w,v,l);if(d.rpcImpl)try{return d.rpcImpl(b,w[d.requestDelimited?"encodeDelimited":"encode"](l).finish(),function(I,E){if(I)return d.emit("error",I,b),p(I);if(null!==E){if(!(E instanceof v))try{E=v[d.responseDelimited?"decodeDelimited":"decode"](E)}catch(y){return d.emit("error",y,b),p(y)}return d.emit("data",E,b),p(null,E)}d.end(!0)})}catch(_){return d.emit("error",_,b),void setTimeout(function(){p(_)},0)}else setTimeout(function(){p(Error("already ended"))},0)},u.prototype.end=function(b){return this.rpcImpl&&(b||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},9630:(J,G,N)=>{"use strict";J.exports=w;var h=N(326);((w.prototype=Object.create(h.prototype)).constructor=w).className="Service";var u=N(1618),g=N(8572),b=N(7830);function w(l,p){h.call(this,l,p),this.methods={},this._methodsArray=null}function v(l){return l._methodsArray=null,l}w.fromJSON=function(p,d){var _=new w(p,d.options);if(d.methods)for(var I=Object.keys(d.methods),E=0;E{"use strict";J.exports=d;var G=/[\s{}=;:[\],'"()<>]/g,N=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,h=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,u=/^ *[*/]+ */,g=/^\s*\*?\/*/,b=/\n/g,w=/\s/,v=/\\(.?)/g,l={0:"\0",r:"\r",n:"\n",t:"\t"};function p(_){return _.replace(v,function(I,E){switch(E){case"\\":case"":return E;default:return l[E]||""}})}function d(_,I){_=_.toString();var E=0,y=_.length,f=1,C=0,A={},P=[],D=null;function x($){return Error("illegal "+$+" (line "+f+")")}function B($){return _.charAt($)}function F($,te,Z){var de,q={type:_.charAt($++),lineEmpty:!1,leading:Z},oe=$-(I?2:3);do{if(--oe<0||"\n"===(de=_.charAt(oe))){q.lineEmpty=!0;break}}while(" "===de||"\t"===de);for(var pe=_.substring($,te).split(b),ke=0;ke0)return P.shift();if(D)return function M(){var $="'"===D?h:N;$.lastIndex=E-1;var te=$.exec(_);if(!te)throw x("string");return E=$.lastIndex,H(D),D=null,p(te[1])}();var $,te,Z,q,ne,oe=0===E;do{if(E===y)return null;for($=!1;w.test(Z=B(E));)if("\n"===Z&&(oe=!0,++f),++E===y)return null;if("/"===B(E)){if(++E===y)throw x("comment");if("/"===B(E))if(I){if(q=E,ne=!1,z(E)){ne=!0;do{if((E=S(E))===y||(E++,!oe))break}while(z(E))}else E=Math.min(y,S(E)+1);ne&&(F(q,E,oe),oe=!0),f++,$=!0}else{for(ne="/"===B(q=E+1);"\n"!==B(++E);)if(E===y)return null;++E,ne&&(F(q,E-1,oe),oe=!0),++f,$=!0}else{if("*"!==(Z=B(E)))return"/";q=E+1,ne=I||"*"===B(q);do{if("\n"===Z&&++f,++E===y)throw x("comment");te=Z,Z=B(E)}while("*"!==te||"/"!==Z);++E,ne&&(F(q,E-2,oe),oe=!0),$=!0}}}while($);var de=E;if(G.lastIndex=0,!G.test(B(de++)))for(;de{"use strict";J.exports=A;var h=N(326);((A.prototype=Object.create(h.prototype)).constructor=A).className="Type";var u=N(4269),g=N(7397),b=N(2986),w=N(9455),v=N(9630),l=N(1413),p=N(7270),d=N(1650),_=N(8572),I=N(133),E=N(225),y=N(8617),f=N(6533),C=N(761);function A(D,x){h.call(this,D,x),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}function P(D){return D._fieldsById=D._fieldsArray=D._oneofsArray=null,delete D.encode,delete D.decode,delete D.verify,D}Object.defineProperties(A.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var D=Object.keys(this.fields),x=0;x{"use strict";var h=G,u=N(8572),g=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function b(w,v){var l=0,p={};for(v|=0;l{"use strict";var g,b,h=J.exports=N(7211),u=N(6671);h.codegen=N(9749),h.fetch=N(8832),h.path=N(1311),h.fs=h.inquire("fs"),h.toArray=function(_){if(_){for(var I=Object.keys(_),E=new Array(I.length),y=0;y0)f[P]=y(f[P]||{},C,A);else{var D=f[P];D&&(A=[].concat(D).concat(A)),f[P]=A}return f}(_,I=I.split("."),E)},Object.defineProperty(h,"decorateRoot",{get:function(){return u.decorated||(u.decorated=new(N(5257)))}})},942:(J,G,N)=>{"use strict";J.exports=u;var h=N(7211);function u(v,l){this.lo=v>>>0,this.hi=l>>>0}var g=u.zero=new u(0,0);g.toNumber=function(){return 0},g.zzEncode=g.zzDecode=function(){return this},g.length=function(){return 1};var b=u.zeroHash="\0\0\0\0\0\0\0\0";u.fromNumber=function(l){if(0===l)return g;var p=l<0;p&&(l=-l);var d=l>>>0,_=(l-d)/4294967296>>>0;return p&&(_=~_>>>0,d=~d>>>0,++d>4294967295&&(d=0,++_>4294967295&&(_=0))),new u(d,_)},u.from=function(l){if("number"==typeof l)return u.fromNumber(l);if(h.isString(l)){if(!h.Long)return u.fromNumber(parseInt(l,10));l=h.Long.fromString(l)}return l.low||l.high?new u(l.low>>>0,l.high>>>0):g},u.prototype.toNumber=function(l){if(!l&&this.hi>>>31){var p=1+~this.lo>>>0,d=~this.hi>>>0;return p||(d=d+1>>>0),-(p+4294967296*d)}return this.lo+4294967296*this.hi},u.prototype.toLong=function(l){return h.Long?new h.Long(0|this.lo,0|this.hi,Boolean(l)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(l)}};var w=String.prototype.charCodeAt;u.fromHash=function(l){return l===b?g:new u((w.call(l,0)|w.call(l,1)<<8|w.call(l,2)<<16|w.call(l,3)<<24)>>>0,(w.call(l,4)|w.call(l,5)<<8|w.call(l,6)<<16|w.call(l,7)<<24)>>>0)},u.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},u.prototype.zzEncode=function(){var l=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^l)>>>0,this.lo=(this.lo<<1^l)>>>0,this},u.prototype.zzDecode=function(){var l=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^l)>>>0,this.hi=(this.hi>>>1^l)>>>0,this},u.prototype.length=function(){var l=this.lo,p=(this.lo>>>28|this.hi<<4)>>>0,d=this.hi>>>24;return 0===d?0===p?l<16384?l<128?1:2:l<2097152?3:4:p<16384?p<128?5:6:p<2097152?7:8:d<128?9:10}},7211:function(J,G,N){"use strict";var h=G;function u(b,w,v){for(var l=Object.keys(w),p=0;pb,set:void 0,enumerable:!1,configurable:!0},toString:{value(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),w}h.asPromise=N(1280),h.base64=N(9039),h.EventEmitter=N(9889),h.float=N(530),h.inquire=N(716),h.utf8=N(7768),h.pool=N(4479),h.LongBits=N(942),h.isNode=Boolean(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node),h.global=h.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||this,h.emptyArray=Object.freeze?Object.freeze([]):[],h.emptyObject=Object.freeze?Object.freeze({}):{},h.isInteger=Number.isInteger||function(w){return"number"==typeof w&&isFinite(w)&&Math.floor(w)===w},h.isString=function(w){return"string"==typeof w||w instanceof String},h.isObject=function(w){return w&&"object"==typeof w},h.isset=h.isSet=function(w,v){var l=w[v];return!(null==l||!w.hasOwnProperty(v))&&("object"!=typeof l||(Array.isArray(l)?l.length:Object.keys(l).length)>0)},h.Buffer=function(){try{var b=h.inquire("buffer").Buffer;return b.prototype.utf8Write?b:null}catch{return null}}(),h._Buffer_from=null,h._Buffer_allocUnsafe=null,h.newBuffer=function(w){return"number"==typeof w?h.Buffer?h._Buffer_allocUnsafe(w):new h.Array(w):h.Buffer?h._Buffer_from(w):typeof Uint8Array>"u"?w:new Uint8Array(w)},h.Array=typeof Uint8Array<"u"?Uint8Array:Array,h.Long=h.global.dcodeIO&&h.global.dcodeIO.Long||h.global.Long||h.inquire("long"),h.key2Re=/^true|false|0|1$/,h.key32Re=/^-?(?:0|[1-9][0-9]*)$/,h.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,h.longToHash=function(w){return w?h.LongBits.from(w).toHash():h.LongBits.zeroHash},h.longFromHash=function(w,v){var l=h.LongBits.fromHash(w);return h.Long?h.Long.fromBits(l.lo,l.hi,v):l.toNumber(Boolean(v))},h.merge=u,h.lcFirst=function(w){return w.charAt(0).toLowerCase()+w.substring(1)},h.newError=g,h.ProtocolError=g("ProtocolError"),h.oneOfGetter=function(w){for(var v={},l=0;l-1;--d)if(1===v[p[d]]&&null!=this[p[d]])return p[d]}},h.oneOfSetter=function(w){return function(v){for(var l=0;l{"use strict";J.exports=function v(l){var p=u.codegen(["m"],l.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),_={};l.oneofsArray.length&&p("var p={}");for(var I=0;I{"use strict";var h=G,u=N(1413);h[".google.protobuf.Any"]={fromObject:function(g){if(g&&g["@type"]){var b=g["@type"].substring(g["@type"].lastIndexOf("/")+1),w=this.lookup(b);if(w){var v="."===g["@type"].charAt(0)?g["@type"].slice(1):g["@type"];return-1===v.indexOf("/")&&(v="/"+v),this.create({type_url:v,value:w.encode(w.fromObject(g)).finish()})}}return this.fromObject(g)},toObject:function(g,b){var v="",l="";if(b&&b.json&&g.type_url&&g.value){l=g.type_url.substring(g.type_url.lastIndexOf("/")+1),v=g.type_url.substring(0,g.type_url.lastIndexOf("/")+1);var p=this.lookup(l);p&&(g=p.decode(g.value))}if(!(g instanceof this.ctor)&&g instanceof u){var d=g.$type.toObject(g,b),_="."===g.$type.fullName[0]?g.$type.fullName.slice(1):g.$type.fullName;return""===v&&(v="type.googleapis.com/"),d["@type"]=l=v+_,d}return this.toObject(g,b)}}},1650:(J,G,N)=>{"use strict";J.exports=d;var u,h=N(7211),g=h.LongBits,b=h.base64,w=h.utf8;function v(P,D,x){this.fn=P,this.len=D,this.next=void 0,this.val=x}function l(){}function p(P){this.head=P.head,this.tail=P.tail,this.len=P.len,this.next=P.states}function d(){this.len=0,this.head=new v(l,0,0),this.tail=this.head,this.states=null}var _=function(){return h.Buffer?function(){return(d.create=function(){return new u})()}:function(){return new d}};function I(P,D,x){D[x]=255&P}function y(P,D){this.len=P,this.next=void 0,this.val=D}function f(P,D,x){for(;P.hi;)D[x++]=127&P.lo|128,P.lo=(P.lo>>>7|P.hi<<25)>>>0,P.hi>>>=7;for(;P.lo>127;)D[x++]=127&P.lo|128,P.lo=P.lo>>>7;D[x++]=P.lo}function C(P,D,x){D[x]=255&P,D[x+1]=P>>>8&255,D[x+2]=P>>>16&255,D[x+3]=P>>>24}d.create=_(),d.alloc=function(D){return new h.Array(D)},h.Array!==Array&&(d.alloc=h.pool(d.alloc,h.Array.prototype.subarray)),d.prototype._push=function(D,x,M){return this.tail=this.tail.next=new v(D,x,M),this.len+=x,this},(y.prototype=Object.create(v.prototype)).fn=function E(P,D,x){for(;P>127;)D[x++]=127&P|128,P>>>=7;D[x]=P},d.prototype.uint32=function(D){return this.len+=(this.tail=this.tail.next=new y((D>>>=0)<128?1:D<16384?2:D<2097152?3:D<268435456?4:5,D)).len,this},d.prototype.int32=function(D){return D<0?this._push(f,10,g.fromNumber(D)):this.uint32(D)},d.prototype.sint32=function(D){return this.uint32((D<<1^D>>31)>>>0)},d.prototype.int64=d.prototype.uint64=function(D){var x=g.from(D);return this._push(f,x.length(),x)},d.prototype.sint64=function(D){var x=g.from(D).zzEncode();return this._push(f,x.length(),x)},d.prototype.bool=function(D){return this._push(I,1,D?1:0)},d.prototype.sfixed32=d.prototype.fixed32=function(D){return this._push(C,4,D>>>0)},d.prototype.sfixed64=d.prototype.fixed64=function(D){var x=g.from(D);return this._push(C,4,x.lo)._push(C,4,x.hi)},d.prototype.float=function(D){return this._push(h.float.writeFloatLE,4,D)},d.prototype.double=function(D){return this._push(h.float.writeDoubleLE,8,D)};var A=h.Array.prototype.set?function(D,x,M){x.set(D,M)}:function(D,x,M){for(var B=0;B>>0;if(!x)return this._push(I,1,0);if(h.isString(D)){var M=d.alloc(x=b.length(D));b.decode(D,M,0),D=M}return this.uint32(x)._push(A,x,D)},d.prototype.string=function(D){var x=w.length(D);return x?this.uint32(x)._push(w.write,x,D):this._push(I,1,0)},d.prototype.fork=function(){return this.states=new p(this),this.head=this.tail=new v(l,0,0),this.len=0,this},d.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new v(l,0,0),this.len=0),this},d.prototype.ldelim=function(){var D=this.head,x=this.tail,M=this.len;return this.reset().uint32(M),M&&(this.tail.next=D.next,this.tail=x,this.len+=M),this},d.prototype.finish=function(){for(var D=this.head.next,x=this.constructor.alloc(this.len),M=0;D;)D.fn(D.val,x,M),M+=D.len,D=D.next;return x},d._configure=function(P){u=P,d.create=_(),u._configure()}},813:(J,G,N)=>{"use strict";J.exports=g;var h=N(1650);(g.prototype=Object.create(h.prototype)).constructor=g;var u=N(7211);function g(){h.call(this)}function b(w,v,l){w.length<40?u.utf8.write(w,v,l):v.utf8Write?v.utf8Write(w,l):v.write(w,l)}g._configure=function(){g.alloc=u._Buffer_allocUnsafe,g.writeBytesBuffer=u.Buffer&&u.Buffer.prototype instanceof Uint8Array&&"set"===u.Buffer.prototype.set.name?function(v,l,p){l.set(v,p)}:function(v,l,p){if(v.copy)v.copy(l,p,0,v.length);else for(var d=0;d>>0;return this.uint32(l),l&&this._push(g.writeBytesBuffer,l,v),this},g.prototype.string=function(v){var l=u.Buffer.byteLength(v);return this.uint32(l),l&&this._push(b,l,v),this},g._configure()},4033:(J,G,N)=>{"use strict";J.exports=w;var h=N(4366),u=w.prototype,g=new Date%1e9;function w(v){this.id=(v=v||{}).id||function b(){return(1e9*Math.random()>>>0)+g++}(),this.max=v.max||1/0,this.items=v.items||[],this._lookup={},this.size=this.items.length,this.lastModified=new Date(v.lastModified||new Date);for(var l,p,d=this.items.length;d--;)l=this.items[d],p=new Date(l.expires)-new Date,this._lookup[l.key]=l,p>0?this.expire(l.key,p):p<=0&&this.delete(l.key)}u.has=function(v){return v in this._lookup},u.get=function(v){if(!this.has(v))return null;var l=this._lookup[v];return l.refresh&&this.expire(v,l.refresh),this.items.splice(this.items.indexOf(l),1),this.items.push(l),l.value},u.meta=function(v){if(!this.has(v))return null;var l=this._lookup[v];return"meta"in l?l.meta:null},u.set=function(v,l,p){var d=this._lookup[v],_=this._lookup[v]={key:v,value:l};return this.lastModified=new Date,d?(clearTimeout(d.timeout),this.items.splice(this.items.indexOf(d),1,_)):(this.size>=this.max&&this.delete(this.items[0].key),this.items.push(_),this.size++),p&&("ttl"in p&&this.expire(v,p.ttl),"meta"in p&&(_.meta=p.meta),p.refresh&&(_.refresh=p.ttl)),this},u.delete=function(v){var l=this._lookup[v];return!!l&&(this.lastModified=new Date,this.items.splice(this.items.indexOf(l),1),clearTimeout(l.timeout),delete this._lookup[v],this.size--,this)},u.expire=function(v,l){var p=l||0,d=this._lookup[v];if(!d)return this;if("string"==typeof p&&(p=h(l)),"number"!=typeof p)throw new TypeError("Expiration time must be a string or number.");return clearTimeout(d.timeout),d.timeout=setTimeout(this.delete.bind(this,d.key),p),d.expires=Number(new Date)+p,this},u.clear=function(){for(var v=this.items.length;v--;)this.delete(this.items[v].key);return this},u.toJSON=function(){for(var l,v=new Array(this.items.length),p=v.length;p--;)v[p]={key:(l=this.items[p]).key,meta:l.meta,value:l.value,expires:l.expires,refresh:l.refresh};return{id:this.id,max:isFinite(this.max)?this.max:void 0,lastModified:this.lastModified,items:v}}},2502:(J,G,N)=>{"use strict";const h=N(7806);class u{constructor(w,v,l){const p=this;this._started=h(),this._rescheduled=0,this._scheduled=v,this._args=l,this._triggered=!1,this._timerWrapper=()=>{p._rescheduled>0?(p._scheduled=p._rescheduled-(h()-p._started),p._schedule(p._scheduled)):(p._triggered=!0,w.apply(null,p._args))},this._timer=setTimeout(this._timerWrapper,v)}reschedule(w){w||(w=this._scheduled);const v=h();v+w-(this._started+this._scheduled)<0?(clearTimeout(this._timer),this._schedule(w)):this._triggered?this._schedule(w):(this._started=v,this._rescheduled=w)}_schedule(w){this._triggered=!1,this._started=h(),this._rescheduled=0,this._scheduled=w,this._timer=setTimeout(this._timerWrapper,w)}clear(){clearTimeout(this._timer)}}J.exports=function g(){if("function"!=typeof arguments[0])throw new Error("callback needed");if("number"!=typeof arguments[1])throw new Error("timeout needed");let b;if(arguments.length>0){b=new Array(arguments.length-2);for(var w=0;w{"use strict";J.exports=function(){return Date.now()}},9014:(J,G,N)=>{"use strict";var h=N(9942),u=/[\/\?<>\\:\*\|"]/g,g=/[\x00-\x1f\x80-\x9f]/g,b=/^\.+$/,w=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i,v=/[\. ]+$/;function l(p,d){if("string"!=typeof p)throw new Error("Input must be string");var _=p.replace(u,d).replace(g,d).replace(b,d).replace(w,d).replace(v,d);return h(_,255)}J.exports=function(p,d){var _=d&&d.replacement||"",I=l(p,_);return""===_?I:l(I,"")}},1466:(J,G,N)=>{"use strict";var h=N(7156).default;const u=new Map;function w(){return(w=h(function*(p,d,_){for(;u.get(_);){try{yield p()}catch(I){setTimeout(()=>{throw I},1);break}if(!u.get(_))break;yield new Promise(I=>{const E=setTimeout(I,d);u.set(_,E)})}})).apply(this,arguments)}J.exports={setDelayedInterval:function v(p,d,_){_=_||d;const I=`${Date.now()}:${Math.floor(1e6*Math.random())}`,E=setTimeout(()=>{!function b(p,d,_){w.apply(this,arguments)}(p,d,I)},_);return u.set(I,E),I},clearDelayedInterval:function l(p){const d=u.get(p);d&&(clearTimeout(d),u.delete(p))}}},1420:(J,G,N)=>{"use strict";const{AbortController:h}=globalThis,u=N(2502);class g extends h{constructor(w){super(),this._ms=w,this._timer=u(()=>this.abort(),w),Object.setPrototypeOf(this,g.prototype)}abort(){return this._timer.clear(),super.abort()}clear(){this._timer.clear()}reset(){this._timer.clear(),this._timer=u(()=>this.abort(),this._ms)}}J.exports={TimeoutController:g}},9942:(J,G,N)=>{"use strict";var h=N(8831),u=N(8871);J.exports=h.bind(null,u)},8831:J=>{"use strict";function N(h){return h>=56320&&h<=57343}J.exports=function(u,g,b){if("string"!=typeof g)throw new Error("Input must be string");for(var l,p,w=g.length,v=0,d=0;d=55296&&h<=56319&&N(g.charCodeAt(d+1))&&(p+=g[d+=1]),(v+=u(p))===b)return g.slice(0,d+1);if(v>b)return g.slice(0,d-p.length+1)}var h;return g}},8871:J=>{"use strict";function G(h){return h>=55296&&h<=56319}J.exports=function(u){if("string"!=typeof u)throw new Error("Input must be string");for(var g=u.length,b=0,w=null,v=null,l=0;l=56320&&h<=57343?null!=v&&G(v)?b+=1:b+=3:w<=127?b+=1:w>=128&&w<=2047?b+=2:w>=2048&&w<=65535&&(b+=3),v=w;var h;return b}},3004:J=>{J.exports=function h(u,w){var p,b=0,v=0,l=w=w||0,d=u.length;do{if(l>=d||v>49)throw h.bytes=0,new RangeError("Could not decode varint");p=u[l++],b+=v<28?(127&p)<=128);return h.bytes=l-w,b}},5723:J=>{J.exports=function g(b,w,v){if(Number.MAX_SAFE_INTEGER&&b>Number.MAX_SAFE_INTEGER)throw g.bytes=0,new RangeError("Could not encode varint");w=w||[];for(var l=v=v||0;b>=u;)w[v++]=255&b|128,b/=128;for(;-128&b;)w[v++]=255&b|128,b>>>=7;return w[v]=0|b,g.bytes=v-l+1,w};var u=Math.pow(2,31)},1732:(J,G,N)=>{J.exports={encode:N(5723),decode:N(3004),encodingLength:N(4036)}},4036:J=>{var G=Math.pow(2,7),N=Math.pow(2,14),h=Math.pow(2,21),u=Math.pow(2,28),g=Math.pow(2,35),b=Math.pow(2,42),w=Math.pow(2,49),v=Math.pow(2,56),l=Math.pow(2,63);J.exports=function(p){return p{"use strict";!function(ie){const fe=ie.performance;function ye(Ft){fe&&fe.mark&&fe.mark(Ft)}function me(Ft,ut){fe&&fe.measure&&fe.measure(Ft,ut)}ye("Zone");const _e=ie.__Zone_symbol_prefix||"__zone_symbol__";function Ne(Ft){return _e+Ft}const Ye=!0===ie[Ne("forceDuplicateZoneCheck")];if(ie.Zone){if(Ye||"function"!=typeof ie.Zone.__symbol__)throw new Error("Zone already loaded.");return ie.Zone}let qe=(()=>{class Ft{constructor(ce,ve){this._parent=ce,this._name=ve?ve.name||"unnamed":"",this._properties=ve&&ve.properties||{},this._zoneDelegate=new nt(this,this._parent&&this._parent._zoneDelegate,ve)}static assertZonePatched(){if(ie.Promise!==Hr.ZoneAwarePromise)throw new Error("Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten.\nMost likely cause is that a Promise polyfill has been loaded after Zone.js (Polyfilling Promise api is not necessary when zone.js is loaded. If you must load one, do so before loading zone.js.)")}static get root(){let ce=Ft.current;for(;ce.parent;)ce=ce.parent;return ce}static get current(){return bn.zone}static get currentTask(){return vr}static __load_patch(ce,ve,yt=!1){if(Hr.hasOwnProperty(ce)){if(!yt&&Ye)throw Error("Already loaded patch: "+ce)}else if(!ie["__Zone_disable_"+ce]){const St="Zone:"+ce;ye(St),Hr[ce]=ve(ie,Ft,Fn),me(St,St)}}get parent(){return this._parent}get name(){return this._name}get(ce){const ve=this.getZoneWith(ce);if(ve)return ve._properties[ce]}getZoneWith(ce){let ve=this;for(;ve;){if(ve._properties.hasOwnProperty(ce))return ve;ve=ve._parent}return null}fork(ce){if(!ce)throw new Error("ZoneSpec required!");return this._zoneDelegate.fork(this,ce)}wrap(ce,ve){if("function"!=typeof ce)throw new Error("Expecting function got: "+ce);const yt=this._zoneDelegate.intercept(this,ce,ve),St=this;return function(){return St.runGuarded(yt,this,arguments,ve)}}run(ce,ve,yt,St){bn={parent:bn,zone:this};try{return this._zoneDelegate.invoke(this,ce,ve,yt,St)}finally{bn=bn.parent}}runGuarded(ce,ve=null,yt,St){bn={parent:bn,zone:this};try{try{return this._zoneDelegate.invoke(this,ce,ve,yt,St)}catch(mn){if(this._zoneDelegate.handleError(this,mn))throw mn}}finally{bn=bn.parent}}runTask(ce,ve,yt){if(ce.zone!=this)throw new Error("A task can only be run in the zone of creation! (Creation: "+(ce.zone||Pn).name+"; Execution: "+this.name+")");if(ce.state===Bt&&(ce.type===lr||ce.type===bt))return;const St=ce.state!=ft;St&&ce._transitionTo(ft,tn),ce.runCount++;const mn=vr;vr=ce,bn={parent:bn,zone:this};try{ce.type==bt&&ce.data&&!ce.data.isPeriodic&&(ce.cancelFn=void 0);try{return this._zoneDelegate.invokeTask(this,ce,ve,yt)}catch(Ge){if(this._zoneDelegate.handleError(this,Ge))throw Ge}}finally{ce.state!==Bt&&ce.state!==ot&&(ce.type==lr||ce.data&&ce.data.isPeriodic?St&&ce._transitionTo(tn,ft):(ce.runCount=0,this._updateTaskCount(ce,-1),St&&ce._transitionTo(Bt,ft,Bt))),bn=bn.parent,vr=mn}}scheduleTask(ce){if(ce.zone&&ce.zone!==this){let yt=this;for(;yt;){if(yt===ce.zone)throw Error(`can not reschedule task to ${this.name} which is descendants of the original zone ${ce.zone.name}`);yt=yt.parent}}ce._transitionTo(yn,Bt);const ve=[];ce._zoneDelegates=ve,ce._zone=this;try{ce=this._zoneDelegate.scheduleTask(this,ce)}catch(yt){throw ce._transitionTo(ot,yn,Bt),this._zoneDelegate.handleError(this,yt),yt}return ce._zoneDelegates===ve&&this._updateTaskCount(ce,1),ce.state==yn&&ce._transitionTo(tn,yn),ce}scheduleMicroTask(ce,ve,yt,St){return this.scheduleTask(new je(Kt,ce,ve,yt,St,void 0))}scheduleMacroTask(ce,ve,yt,St,mn){return this.scheduleTask(new je(bt,ce,ve,yt,St,mn))}scheduleEventTask(ce,ve,yt,St,mn){return this.scheduleTask(new je(lr,ce,ve,yt,St,mn))}cancelTask(ce){if(ce.zone!=this)throw new Error("A task can only be cancelled in the zone of creation! (Creation: "+(ce.zone||Pn).name+"; Execution: "+this.name+")");ce._transitionTo(hn,tn,ft);try{this._zoneDelegate.cancelTask(this,ce)}catch(ve){throw ce._transitionTo(ot,hn),this._zoneDelegate.handleError(this,ve),ve}return this._updateTaskCount(ce,-1),ce._transitionTo(Bt,hn),ce.runCount=0,ce}_updateTaskCount(ce,ve){const yt=ce._zoneDelegates;-1==ve&&(ce._zoneDelegates=null);for(let St=0;StFt.hasTask(ce,ve),onScheduleTask:(Ft,ut,ce,ve)=>Ft.scheduleTask(ce,ve),onInvokeTask:(Ft,ut,ce,ve,yt,St)=>Ft.invokeTask(ce,ve,yt,St),onCancelTask:(Ft,ut,ce,ve)=>Ft.cancelTask(ce,ve)};class nt{constructor(ut,ce,ve){this._taskCounts={microTask:0,macroTask:0,eventTask:0},this.zone=ut,this._parentDelegate=ce,this._forkZS=ve&&(ve&&ve.onFork?ve:ce._forkZS),this._forkDlgt=ve&&(ve.onFork?ce:ce._forkDlgt),this._forkCurrZone=ve&&(ve.onFork?this.zone:ce._forkCurrZone),this._interceptZS=ve&&(ve.onIntercept?ve:ce._interceptZS),this._interceptDlgt=ve&&(ve.onIntercept?ce:ce._interceptDlgt),this._interceptCurrZone=ve&&(ve.onIntercept?this.zone:ce._interceptCurrZone),this._invokeZS=ve&&(ve.onInvoke?ve:ce._invokeZS),this._invokeDlgt=ve&&(ve.onInvoke?ce:ce._invokeDlgt),this._invokeCurrZone=ve&&(ve.onInvoke?this.zone:ce._invokeCurrZone),this._handleErrorZS=ve&&(ve.onHandleError?ve:ce._handleErrorZS),this._handleErrorDlgt=ve&&(ve.onHandleError?ce:ce._handleErrorDlgt),this._handleErrorCurrZone=ve&&(ve.onHandleError?this.zone:ce._handleErrorCurrZone),this._scheduleTaskZS=ve&&(ve.onScheduleTask?ve:ce._scheduleTaskZS),this._scheduleTaskDlgt=ve&&(ve.onScheduleTask?ce:ce._scheduleTaskDlgt),this._scheduleTaskCurrZone=ve&&(ve.onScheduleTask?this.zone:ce._scheduleTaskCurrZone),this._invokeTaskZS=ve&&(ve.onInvokeTask?ve:ce._invokeTaskZS),this._invokeTaskDlgt=ve&&(ve.onInvokeTask?ce:ce._invokeTaskDlgt),this._invokeTaskCurrZone=ve&&(ve.onInvokeTask?this.zone:ce._invokeTaskCurrZone),this._cancelTaskZS=ve&&(ve.onCancelTask?ve:ce._cancelTaskZS),this._cancelTaskDlgt=ve&&(ve.onCancelTask?ce:ce._cancelTaskDlgt),this._cancelTaskCurrZone=ve&&(ve.onCancelTask?this.zone:ce._cancelTaskCurrZone),this._hasTaskZS=null,this._hasTaskDlgt=null,this._hasTaskDlgtOwner=null,this._hasTaskCurrZone=null;const yt=ve&&ve.onHasTask;(yt||ce&&ce._hasTaskZS)&&(this._hasTaskZS=yt?ve:st,this._hasTaskDlgt=ce,this._hasTaskDlgtOwner=this,this._hasTaskCurrZone=ut,ve.onScheduleTask||(this._scheduleTaskZS=st,this._scheduleTaskDlgt=ce,this._scheduleTaskCurrZone=this.zone),ve.onInvokeTask||(this._invokeTaskZS=st,this._invokeTaskDlgt=ce,this._invokeTaskCurrZone=this.zone),ve.onCancelTask||(this._cancelTaskZS=st,this._cancelTaskDlgt=ce,this._cancelTaskCurrZone=this.zone))}fork(ut,ce){return this._forkZS?this._forkZS.onFork(this._forkDlgt,this.zone,ut,ce):new qe(ut,ce)}intercept(ut,ce,ve){return this._interceptZS?this._interceptZS.onIntercept(this._interceptDlgt,this._interceptCurrZone,ut,ce,ve):ce}invoke(ut,ce,ve,yt,St){return this._invokeZS?this._invokeZS.onInvoke(this._invokeDlgt,this._invokeCurrZone,ut,ce,ve,yt,St):ce.apply(ve,yt)}handleError(ut,ce){return!this._handleErrorZS||this._handleErrorZS.onHandleError(this._handleErrorDlgt,this._handleErrorCurrZone,ut,ce)}scheduleTask(ut,ce){let ve=ce;if(this._scheduleTaskZS)this._hasTaskZS&&ve._zoneDelegates.push(this._hasTaskDlgtOwner),ve=this._scheduleTaskZS.onScheduleTask(this._scheduleTaskDlgt,this._scheduleTaskCurrZone,ut,ce),ve||(ve=ce);else if(ce.scheduleFn)ce.scheduleFn(ce);else{if(ce.type!=Kt)throw new Error("Task is missing scheduleFn.");vt(ce)}return ve}invokeTask(ut,ce,ve,yt){return this._invokeTaskZS?this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt,this._invokeTaskCurrZone,ut,ce,ve,yt):ce.callback.apply(ve,yt)}cancelTask(ut,ce){let ve;if(this._cancelTaskZS)ve=this._cancelTaskZS.onCancelTask(this._cancelTaskDlgt,this._cancelTaskCurrZone,ut,ce);else{if(!ce.cancelFn)throw Error("Task is not cancelable");ve=ce.cancelFn(ce)}return ve}hasTask(ut,ce){try{this._hasTaskZS&&this._hasTaskZS.onHasTask(this._hasTaskDlgt,this._hasTaskCurrZone,ut,ce)}catch(ve){this.handleError(ut,ve)}}_updateTaskCount(ut,ce){const ve=this._taskCounts,yt=ve[ut],St=ve[ut]=yt+ce;if(St<0)throw new Error("More tasks executed then were scheduled.");0!=yt&&0!=St||this.hasTask(this.zone,{microTask:ve.microTask>0,macroTask:ve.macroTask>0,eventTask:ve.eventTask>0,change:ut})}}class je{constructor(ut,ce,ve,yt,St,mn){if(this._zone=null,this.runCount=0,this._zoneDelegates=null,this._state="notScheduled",this.type=ut,this.source=ce,this.data=yt,this.scheduleFn=St,this.cancelFn=mn,!ve)throw new Error("callback is not defined");this.callback=ve;const Ge=this;this.invoke=ut===lr&&yt&&yt.useG?je.invokeTask:function(){return je.invokeTask.call(ie,Ge,this,arguments)}}static invokeTask(ut,ce,ve){ut||(ut=this),rr++;try{return ut.runCount++,ut.zone.runTask(ut,ce,ve)}finally{1==rr&&et(),rr--}}get zone(){return this._zone}get state(){return this._state}cancelScheduleRequest(){this._transitionTo(Bt,yn)}_transitionTo(ut,ce,ve){if(this._state!==ce&&this._state!==ve)throw new Error(`${this.type} '${this.source}': can not transition to '${ut}', expecting state '${ce}'${ve?" or '"+ve+"'":""}, was '${this._state}'.`);this._state=ut,ut==Bt&&(this._zoneDelegates=null)}toString(){return this.data&&typeof this.data.handleId<"u"?this.data.handleId.toString():Object.prototype.toString.call(this)}toJSON(){return{type:this.type,state:this.state,source:this.source,zone:this.zone.name,runCount:this.runCount}}}const be=Ne("setTimeout"),ge=Ne("Promise"),De=Ne("then");let dt,Ue=[],Be=!1;function Pt(Ft){if(dt||ie[ge]&&(dt=ie[ge].resolve(0)),dt){let ut=dt[De];ut||(ut=dt.then),ut.call(dt,Ft)}else ie[be](Ft,0)}function vt(Ft){0===rr&&0===Ue.length&&Pt(et),Ft&&Ue.push(Ft)}function et(){if(!Be){for(Be=!0;Ue.length;){const Ft=Ue;Ue=[];for(let ut=0;utbn,onUnhandledError:_n,microtaskDrainDone:_n,scheduleMicroTask:vt,showUncaughtError:()=>!qe[Ne("ignoreConsoleErrorUncaughtError")],patchEventTarget:()=>[],patchOnProperties:_n,patchMethod:()=>_n,bindArguments:()=>[],patchThen:()=>_n,patchMacroTask:()=>_n,patchEventPrototype:()=>_n,isIEOrEdge:()=>!1,getGlobalObjects:()=>{},ObjectDefineProperty:()=>_n,ObjectGetOwnPropertyDescriptor:()=>{},ObjectCreate:()=>{},ArraySlice:()=>[],patchClass:()=>_n,wrapWithCurrentZone:()=>_n,filterProperties:()=>[],attachOriginToPatched:()=>_n,_redefineProperty:()=>_n,patchCallbacks:()=>_n,nativeScheduleMicroTask:Pt};let bn={parent:null,zone:new qe(null,null)},vr=null,rr=0;function _n(){}me("Zone","Zone"),ie.Zone=qe}(typeof window<"u"&&window||typeof self<"u"&&self||global);const J=Object.getOwnPropertyDescriptor,G=Object.defineProperty,N=Object.getPrototypeOf,h=Object.create,u=Array.prototype.slice,g="addEventListener",b="removeEventListener",w=Zone.__symbol__(g),v=Zone.__symbol__(b),l="true",p="false",d=Zone.__symbol__("");function _(ie,fe){return Zone.current.wrap(ie,fe)}function I(ie,fe,ye,me,_e){return Zone.current.scheduleMacroTask(ie,fe,ye,me,_e)}const E=Zone.__symbol__,y=typeof window<"u",f=y?window:void 0,C=y&&f||"object"==typeof self&&self||global;function P(ie,fe){for(let ye=ie.length-1;ye>=0;ye--)"function"==typeof ie[ye]&&(ie[ye]=_(ie[ye],fe+"_"+ye));return ie}function x(ie){return!ie||!1!==ie.writable&&!("function"==typeof ie.get&&typeof ie.set>"u")}const M=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,B=!("nw"in C)&&typeof C.process<"u"&&"[object process]"==={}.toString.call(C.process),F=!B&&!M&&!(!y||!f.HTMLElement),z=typeof C.process<"u"&&"[object process]"==={}.toString.call(C.process)&&!M&&!(!y||!f.HTMLElement),S={},O=function(ie){if(!(ie=ie||C.event))return;let fe=S[ie.type];fe||(fe=S[ie.type]=E("ON_PROPERTY"+ie.type));const ye=this||ie.target||C,me=ye[fe];let _e;if(F&&ye===f&&"error"===ie.type){const Ne=ie;_e=me&&me.call(this,Ne.message,Ne.filename,Ne.lineno,Ne.colno,Ne.error),!0===_e&&ie.preventDefault()}else _e=me&&me.apply(this,arguments),null!=_e&&!_e&&ie.preventDefault();return _e};function H(ie,fe,ye){let me=J(ie,fe);if(!me&&ye&&J(ye,fe)&&(me={enumerable:!0,configurable:!0}),!me||!me.configurable)return;const _e=E("on"+fe+"patched");if(ie.hasOwnProperty(_e)&&ie[_e])return;delete me.writable,delete me.value;const Ne=me.get,Ye=me.set,qe=fe.slice(2);let st=S[qe];st||(st=S[qe]=E("ON_PROPERTY"+qe)),me.set=function(nt){let je=this;!je&&ie===C&&(je=C),je&&("function"==typeof je[st]&&je.removeEventListener(qe,O),Ye&&Ye.call(je,null),je[st]=nt,"function"==typeof nt&&je.addEventListener(qe,O,!1))},me.get=function(){let nt=this;if(!nt&&ie===C&&(nt=C),!nt)return null;const je=nt[st];if(je)return je;if(Ne){let be=Ne.call(this);if(be)return me.set.call(this,be),"function"==typeof nt.removeAttribute&&nt.removeAttribute(fe),be}return null},G(ie,fe,me),ie[_e]=!0}function L(ie,fe,ye){if(fe)for(let me=0;mefunction(Ye,qe){const st=ye(Ye,qe);return st.cbIdx>=0&&"function"==typeof qe[st.cbIdx]?I(st.name,qe[st.cbIdx],st,_e):Ne.apply(Ye,qe)})}function Z(ie,fe){ie[E("OriginalDelegate")]=fe}let q=!1,ne=!1;function de(){if(q)return ne;q=!0;try{const ie=f.navigator.userAgent;(-1!==ie.indexOf("MSIE ")||-1!==ie.indexOf("Trident/")||-1!==ie.indexOf("Edge/"))&&(ne=!0)}catch{}return ne}Zone.__load_patch("ZoneAwarePromise",(ie,fe,ye)=>{const me=Object.getOwnPropertyDescriptor,_e=Object.defineProperty,Ye=ye.symbol,qe=[],st=!0===ie[Ye("DISABLE_WRAPPING_UNCAUGHT_PROMISE_REJECTION")],nt=Ye("Promise"),je=Ye("then");ye.onUnhandledError=Ge=>{if(ye.showUncaughtError()){const Qe=Ge&&Ge.rejection;Qe?console.error("Unhandled Promise rejection:",Qe instanceof Error?Qe.message:Qe,"; Zone:",Ge.zone.name,"; Task:",Ge.task&&Ge.task.source,"; Value:",Qe,Qe instanceof Error?Qe.stack:void 0):console.error(Ge)}},ye.microtaskDrainDone=()=>{for(;qe.length;){const Ge=qe.shift();try{Ge.zone.runGuarded(()=>{throw Ge.throwOriginal?Ge.rejection:Ge})}catch(Qe){De(Qe)}}};const ge=Ye("unhandledPromiseRejectionHandler");function De(Ge){ye.onUnhandledError(Ge);try{const Qe=fe[ge];"function"==typeof Qe&&Qe.call(this,Ge)}catch{}}function Ue(Ge){return Ge&&Ge.then}function Be(Ge){return Ge}function dt(Ge){return ce.reject(Ge)}const Pt=Ye("state"),vt=Ye("value"),et=Ye("finally"),Pn=Ye("parentPromiseValue"),Bt=Ye("parentPromiseState"),tn=null,hn=!1;function Kt(Ge,Qe){return Te=>{try{Fn(Ge,Qe,Te)}catch(ze){Fn(Ge,!1,ze)}}}const bt=function(){let Ge=!1;return function(Te){return function(){Ge||(Ge=!0,Te.apply(null,arguments))}}},Hr=Ye("currentTaskTrace");function Fn(Ge,Qe,Te){const ze=bt();if(Ge===Te)throw new TypeError("Promise resolved with itself");if(Ge[Pt]===tn){let ht=null;try{("object"==typeof Te||"function"==typeof Te)&&(ht=Te&&Te.then)}catch(Et){return ze(()=>{Fn(Ge,!1,Et)})(),Ge}if(Qe!==hn&&Te instanceof ce&&Te.hasOwnProperty(Pt)&&Te.hasOwnProperty(vt)&&Te[Pt]!==tn)vr(Te),Fn(Ge,Te[Pt],Te[vt]);else if(Qe!==hn&&"function"==typeof ht)try{ht.call(Te,ze(Kt(Ge,Qe)),ze(Kt(Ge,!1)))}catch(Et){ze(()=>{Fn(Ge,!1,Et)})()}else{Ge[Pt]=Qe;const Et=Ge[vt];if(Ge[vt]=Te,Ge[et]===et&&!0===Qe&&(Ge[Pt]=Ge[Bt],Ge[vt]=Ge[Pn]),Qe===hn&&Te instanceof Error){const lt=fe.currentTask&&fe.currentTask.data&&fe.currentTask.data.__creationTrace__;lt&&_e(Te,Hr,{configurable:!0,enumerable:!1,writable:!0,value:lt})}for(let lt=0;lt{try{const It=Ge[vt],jt=!!Te&&et===Te[et];jt&&(Te[Pn]=It,Te[Bt]=Et);const Ut=Qe.run(lt,void 0,jt&<!==dt&<!==Be?[]:[It]);Fn(Te,!0,Ut)}catch(It){Fn(Te,!1,It)}},Te)}const Ft=function(){},ut=ie.AggregateError;class ce{static toString(){return"function ZoneAwarePromise() { [native code] }"}static resolve(Qe){return Fn(new this(null),!0,Qe)}static reject(Qe){return Fn(new this(null),hn,Qe)}static any(Qe){if(!Qe||"function"!=typeof Qe[Symbol.iterator])return Promise.reject(new ut([],"All promises were rejected"));const Te=[];let ze=0;try{for(let lt of Qe)ze++,Te.push(ce.resolve(lt))}catch{return Promise.reject(new ut([],"All promises were rejected"))}if(0===ze)return Promise.reject(new ut([],"All promises were rejected"));let ht=!1;const Et=[];return new ce((lt,It)=>{for(let jt=0;jt{ht||(ht=!0,lt(Ut))},Ut=>{Et.push(Ut),ze--,0===ze&&(ht=!0,It(new ut(Et,"All promises were rejected")))})})}static race(Qe){let Te,ze,ht=new this((It,jt)=>{Te=It,ze=jt});function Et(It){Te(It)}function lt(It){ze(It)}for(let It of Qe)Ue(It)||(It=this.resolve(It)),It.then(Et,lt);return ht}static all(Qe){return ce.allWithCallback(Qe)}static allSettled(Qe){return(this&&this.prototype instanceof ce?this:ce).allWithCallback(Qe,{thenCallback:ze=>({status:"fulfilled",value:ze}),errorCallback:ze=>({status:"rejected",reason:ze})})}static allWithCallback(Qe,Te){let ze,ht,Et=new this((Ut,Nn)=>{ze=Ut,ht=Nn}),lt=2,It=0;const jt=[];for(let Ut of Qe){Ue(Ut)||(Ut=this.resolve(Ut));const Nn=It;try{Ut.then(Tn=>{jt[Nn]=Te?Te.thenCallback(Tn):Tn,lt--,0===lt&&ze(jt)},Tn=>{Te?(jt[Nn]=Te.errorCallback(Tn),lt--,0===lt&&ze(jt)):ht(Tn)})}catch(Tn){ht(Tn)}lt++,It++}return lt-=2,0===lt&&ze(jt),Et}constructor(Qe){const Te=this;if(!(Te instanceof ce))throw new Error("Must be an instanceof Promise.");Te[Pt]=tn,Te[vt]=[];try{const ze=bt();Qe&&Qe(ze(Kt(Te,!0)),ze(Kt(Te,hn)))}catch(ze){Fn(Te,!1,ze)}}get[Symbol.toStringTag](){return"Promise"}get[Symbol.species](){return ce}then(Qe,Te){var ze;let ht=null===(ze=this.constructor)||void 0===ze?void 0:ze[Symbol.species];(!ht||"function"!=typeof ht)&&(ht=this.constructor||ce);const Et=new ht(Ft),lt=fe.current;return this[Pt]==tn?this[vt].push(lt,Et,Qe,Te):rr(this,lt,Et,Qe,Te),Et}catch(Qe){return this.then(null,Qe)}finally(Qe){var Te;let ze=null===(Te=this.constructor)||void 0===Te?void 0:Te[Symbol.species];(!ze||"function"!=typeof ze)&&(ze=ce);const ht=new ze(Ft);ht[et]=et;const Et=fe.current;return this[Pt]==tn?this[vt].push(Et,ht,Qe,Qe):rr(this,Et,ht,Qe,Qe),ht}}ce.resolve=ce.resolve,ce.reject=ce.reject,ce.race=ce.race,ce.all=ce.all;const ve=ie[nt]=ie.Promise;ie.Promise=ce;const yt=Ye("thenPatched");function St(Ge){const Qe=Ge.prototype,Te=me(Qe,"then");if(Te&&(!1===Te.writable||!Te.configurable))return;const ze=Qe.then;Qe[je]=ze,Ge.prototype.then=function(ht,Et){return new ce((It,jt)=>{ze.call(this,It,jt)}).then(ht,Et)},Ge[yt]=!0}return ye.patchThen=St,ve&&(St(ve),$(ie,"fetch",Ge=>function mn(Ge){return function(Qe,Te){let ze=Ge.apply(Qe,Te);if(ze instanceof ce)return ze;let ht=ze.constructor;return ht[yt]||St(ht),ze}}(Ge))),Promise[fe.__symbol__("uncaughtPromiseErrors")]=qe,ce}),Zone.__load_patch("toString",ie=>{const fe=Function.prototype.toString,ye=E("OriginalDelegate"),me=E("Promise"),_e=E("Error"),Ne=function(){if("function"==typeof this){const nt=this[ye];if(nt)return"function"==typeof nt?fe.call(nt):Object.prototype.toString.call(nt);if(this===Promise){const je=ie[me];if(je)return fe.call(je)}if(this===Error){const je=ie[_e];if(je)return fe.call(je)}}return fe.call(this)};Ne[ye]=fe,Function.prototype.toString=Ne;const Ye=Object.prototype.toString;Object.prototype.toString=function(){return"function"==typeof Promise&&this instanceof Promise?"[object Promise]":Ye.call(this)}});let pe=!1;if(typeof window<"u")try{const ie=Object.defineProperty({},"passive",{get:function(){pe=!0}});window.addEventListener("test",ie,ie),window.removeEventListener("test",ie,ie)}catch{pe=!1}const ke={useG:!0},Se={},Pe={},we=new RegExp("^"+d+"(\\w+)(true|false)$"),$e=E("propagationStopped");function K(ie,fe){const ye=(fe?fe(ie):ie)+p,me=(fe?fe(ie):ie)+l,_e=d+ye,Ne=d+me;Se[ie]={},Se[ie][p]=_e,Se[ie][l]=Ne}function Ee(ie,fe,ye,me){const _e=me&&me.add||g,Ne=me&&me.rm||b,Ye=me&&me.listeners||"eventListeners",qe=me&&me.rmAll||"removeAllListeners",st=E(_e),nt="."+_e+":",ge=function(vt,et,Pn){if(vt.isRemoved)return;const Bt=vt.callback;let yn;"object"==typeof Bt&&Bt.handleEvent&&(vt.callback=ft=>Bt.handleEvent(ft),vt.originalDelegate=Bt);try{vt.invoke(vt,et,[Pn])}catch(ft){yn=ft}const tn=vt.options;return tn&&"object"==typeof tn&&tn.once&&et[Ne].call(et,Pn.type,vt.originalDelegate?vt.originalDelegate:vt.callback,tn),yn};function De(vt,et,Pn){if(!(et=et||ie.event))return;const Bt=vt||et.target||ie,yn=Bt[Se[et.type][Pn?l:p]];if(yn){const tn=[];if(1===yn.length){const ft=ge(yn[0],Bt,et);ft&&tn.push(ft)}else{const ft=yn.slice();for(let hn=0;hn{throw hn})}}}const Ue=function(vt){return De(this,vt,!1)},Be=function(vt){return De(this,vt,!0)};function dt(vt,et){if(!vt)return!1;let Pn=!0;et&&void 0!==et.useG&&(Pn=et.useG);const Bt=et&&et.vh;let yn=!0;et&&void 0!==et.chkDup&&(yn=et.chkDup);let tn=!1;et&&void 0!==et.rt&&(tn=et.rt);let ft=vt;for(;ft&&!ft.hasOwnProperty(_e);)ft=N(ft);if(!ft&&vt[_e]&&(ft=vt),!ft||ft[st])return!1;const hn=et&&et.eventNameToString,ot={},Kt=ft[st]=ft[_e],bt=ft[E(Ne)]=ft[Ne],lr=ft[E(Ye)]=ft[Ye],Hr=ft[E(qe)]=ft[qe];let Fn;function bn(Te,ze){return!pe&&"object"==typeof Te&&Te?!!Te.capture:pe&&ze?"boolean"==typeof Te?{capture:Te,passive:!0}:Te?"object"==typeof Te&&!1!==Te.passive?Object.assign(Object.assign({},Te),{passive:!0}):Te:{passive:!0}:Te}et&&et.prepend&&(Fn=ft[E(et.prepend)]=ft[et.prepend]);const ce=Pn?function(Te){if(!ot.isExisting)return Kt.call(ot.target,ot.eventName,ot.capture?Be:Ue,ot.options)}:function(Te){return Kt.call(ot.target,ot.eventName,Te.invoke,ot.options)},ve=Pn?function(Te){if(!Te.isRemoved){const ze=Se[Te.eventName];let ht;ze&&(ht=ze[Te.capture?l:p]);const Et=ht&&Te.target[ht];if(Et)for(let lt=0;ltfunction(_e,Ne){_e[$e]=!0,me&&me.apply(_e,Ne)})}function Ke(ie,fe,ye,me,_e){const Ne=Zone.__symbol__(me);if(fe[Ne])return;const Ye=fe[Ne]=fe[me];fe[me]=function(qe,st,nt){return st&&st.prototype&&_e.forEach(function(je){const be=`${ye}.${me}::`+je,ge=st.prototype;try{if(ge.hasOwnProperty(je)){const De=ie.ObjectGetOwnPropertyDescriptor(ge,je);De&&De.value?(De.value=ie.wrapWithCurrentZone(De.value,be),ie._redefineProperty(st.prototype,je,De)):ge[je]&&(ge[je]=ie.wrapWithCurrentZone(ge[je],be))}else ge[je]&&(ge[je]=ie.wrapWithCurrentZone(ge[je],be))}catch{}}),Ye.call(fe,qe,st,nt)},ie.attachOriginToPatched(fe[me],Ye)}function We(ie,fe,ye){if(!ye||0===ye.length)return fe;const me=ye.filter(Ne=>Ne.target===ie);if(!me||0===me.length)return fe;const _e=me[0].ignoreProperties;return fe.filter(Ne=>-1===_e.indexOf(Ne))}function Je(ie,fe,ye,me){ie&&L(ie,We(ie,fe,ye),me)}function Xe(ie){return Object.getOwnPropertyNames(ie).filter(fe=>fe.startsWith("on")&&fe.length>2).map(fe=>fe.substring(2))}Zone.__load_patch("util",(ie,fe,ye)=>{const me=Xe(ie);ye.patchOnProperties=L,ye.patchMethod=$,ye.bindArguments=P,ye.patchMacroTask=te;const _e=fe.__symbol__("BLACK_LISTED_EVENTS"),Ne=fe.__symbol__("UNPATCHED_EVENTS");ie[Ne]&&(ie[_e]=ie[Ne]),ie[_e]&&(fe[_e]=fe[Ne]=ie[_e]),ye.patchEventPrototype=xe,ye.patchEventTarget=Ee,ye.isIEOrEdge=de,ye.ObjectDefineProperty=G,ye.ObjectGetOwnPropertyDescriptor=J,ye.ObjectCreate=h,ye.ArraySlice=u,ye.patchClass=re,ye.wrapWithCurrentZone=_,ye.filterProperties=We,ye.attachOriginToPatched=Z,ye._redefineProperty=Object.defineProperty,ye.patchCallbacks=Ke,ye.getGlobalObjects=()=>({globalSources:Pe,zoneSymbolEventNames:Se,eventNames:me,isBrowser:F,isMix:z,isNode:B,TRUE_STR:l,FALSE_STR:p,ZONE_SYMBOL_PREFIX:d,ADD_EVENT_LISTENER_STR:g,REMOVE_EVENT_LISTENER_STR:b})});const pt=E("zoneTask");function Dt(ie,fe,ye,me){let _e=null,Ne=null;ye+=me;const Ye={};function qe(nt){const je=nt.data;return je.args[0]=function(){return nt.invoke.apply(this,arguments)},je.handleId=_e.apply(ie,je.args),nt}function st(nt){return Ne.call(ie,nt.data.handleId)}_e=$(ie,fe+=me,nt=>function(je,be){if("function"==typeof be[0]){const ge={isPeriodic:"Interval"===me,delay:"Timeout"===me||"Interval"===me?be[1]||0:void 0,args:be},De=be[0];be[0]=function(){try{return De.apply(this,arguments)}finally{ge.isPeriodic||("number"==typeof ge.handleId?delete Ye[ge.handleId]:ge.handleId&&(ge.handleId[pt]=null))}};const Ue=I(fe,be[0],ge,qe,st);if(!Ue)return Ue;const Be=Ue.data.handleId;return"number"==typeof Be?Ye[Be]=Ue:Be&&(Be[pt]=Ue),Be&&Be.ref&&Be.unref&&"function"==typeof Be.ref&&"function"==typeof Be.unref&&(Ue.ref=Be.ref.bind(Be),Ue.unref=Be.unref.bind(Be)),"number"==typeof Be||Be?Be:Ue}return nt.apply(ie,be)}),Ne=$(ie,ye,nt=>function(je,be){const ge=be[0];let De;"number"==typeof ge?De=Ye[ge]:(De=ge&&ge[pt],De||(De=ge)),De&&"string"==typeof De.type?"notScheduled"!==De.state&&(De.cancelFn&&De.data.isPeriodic||0===De.runCount)&&("number"==typeof ge?delete Ye[ge]:ge&&(ge[pt]=null),De.zone.cancelTask(De)):nt.apply(ie,be)})}Zone.__load_patch("legacy",ie=>{const fe=ie[Zone.__symbol__("legacyPatch")];fe&&fe()}),Zone.__load_patch("queueMicrotask",(ie,fe,ye)=>{ye.patchMethod(ie,"queueMicrotask",me=>function(_e,Ne){fe.current.scheduleMicroTask("queueMicrotask",Ne[0])})}),Zone.__load_patch("timers",ie=>{const ye="clear";Dt(ie,"set",ye,"Timeout"),Dt(ie,"set",ye,"Interval"),Dt(ie,"set",ye,"Immediate")}),Zone.__load_patch("requestAnimationFrame",ie=>{Dt(ie,"request","cancel","AnimationFrame"),Dt(ie,"mozRequest","mozCancel","AnimationFrame"),Dt(ie,"webkitRequest","webkitCancel","AnimationFrame")}),Zone.__load_patch("blocking",(ie,fe)=>{const ye=["alert","prompt","confirm"];for(let me=0;mefunction(st,nt){return fe.current.run(Ne,ie,nt,qe)})}),Zone.__load_patch("EventTarget",(ie,fe,ye)=>{(function ni(ie,fe){fe.patchEventPrototype(ie,fe)})(ie,ye),function Sr(ie,fe){if(Zone[fe.symbol("patchEventTarget")])return;const{eventNames:ye,zoneSymbolEventNames:me,TRUE_STR:_e,FALSE_STR:Ne,ZONE_SYMBOL_PREFIX:Ye}=fe.getGlobalObjects();for(let st=0;st{re("MutationObserver"),re("WebKitMutationObserver")}),Zone.__load_patch("IntersectionObserver",(ie,fe,ye)=>{re("IntersectionObserver")}),Zone.__load_patch("FileReader",(ie,fe,ye)=>{re("FileReader")}),Zone.__load_patch("on_property",(ie,fe,ye)=>{!function Ot(ie,fe){if(B&&!z||Zone[ie.symbol("patchEvents")])return;const ye=fe.__Zone_ignore_on_properties;let me=[];if(F){const _e=window;me=me.concat(["Document","SVGElement","Element","HTMLElement","HTMLBodyElement","HTMLMediaElement","HTMLFrameSetElement","HTMLFrameElement","HTMLIFrameElement","HTMLMarqueeElement","Worker"]);const Ne=function oe(){try{const ie=f.navigator.userAgent;if(-1!==ie.indexOf("MSIE ")||-1!==ie.indexOf("Trident/"))return!0}catch{}return!1}()?[{target:_e,ignoreProperties:["error"]}]:[];Je(_e,Xe(_e),ye&&ye.concat(Ne),N(_e))}me=me.concat(["XMLHttpRequest","XMLHttpRequestEventTarget","IDBIndex","IDBRequest","IDBOpenDBRequest","IDBDatabase","IDBTransaction","IDBCursor","WebSocket"]);for(let _e=0;_e{!function Wr(ie,fe){const{isBrowser:ye,isMix:me}=fe.getGlobalObjects();(ye||me)&&ie.customElements&&"customElements"in ie&&fe.patchCallbacks(fe,ie.customElements,"customElements","define",["connectedCallback","disconnectedCallback","adoptedCallback","attributeChangedCallback"])}(ie,ye)}),Zone.__load_patch("XHR",(ie,fe)=>{!function st(nt){const je=nt.XMLHttpRequest;if(!je)return;const be=je.prototype;let De=be[w],Ue=be[v];if(!De){const ot=nt.XMLHttpRequestEventTarget;if(ot){const Kt=ot.prototype;De=Kt[w],Ue=Kt[v]}}const Be="readystatechange",dt="scheduled";function Pt(ot){const Kt=ot.data,bt=Kt.target;bt[Ne]=!1,bt[qe]=!1;const lr=bt[_e];De||(De=bt[w],Ue=bt[v]),lr&&Ue.call(bt,Be,lr);const Hr=bt[_e]=()=>{if(bt.readyState===bt.DONE)if(!Kt.aborted&&bt[Ne]&&ot.state===dt){const bn=bt[fe.__symbol__("loadfalse")];if(0!==bt.status&&bn&&bn.length>0){const vr=ot.invoke;ot.invoke=function(){const rr=bt[fe.__symbol__("loadfalse")];for(let _n=0;_nfunction(ot,Kt){return ot[me]=0==Kt[2],ot[Ye]=Kt[1],Pn.apply(ot,Kt)}),yn=E("fetchTaskAborting"),tn=E("fetchTaskScheduling"),ft=$(be,"send",()=>function(ot,Kt){if(!0===fe.current[tn]||ot[me])return ft.apply(ot,Kt);{const bt={target:ot,url:ot[Ye],isPeriodic:!1,args:Kt,aborted:!1},lr=I("XMLHttpRequest.send",vt,bt,Pt,et);ot&&!0===ot[qe]&&!bt.aborted&&lr.state===dt&&lr.invoke()}}),hn=$(be,"abort",()=>function(ot,Kt){const bt=function ge(ot){return ot[ye]}(ot);if(bt&&"string"==typeof bt.type){if(null==bt.cancelFn||bt.data&&bt.data.aborted)return;bt.zone.cancelTask(bt)}else if(!0===fe.current[yn])return hn.apply(ot,Kt)})}(ie);const ye=E("xhrTask"),me=E("xhrSync"),_e=E("xhrListener"),Ne=E("xhrScheduled"),Ye=E("xhrURL"),qe=E("xhrErrorBeforeScheduled")}),Zone.__load_patch("geolocation",ie=>{ie.navigator&&ie.navigator.geolocation&&function D(ie,fe){const ye=ie.constructor.name;for(let me=0;me{const st=function(){return qe.apply(this,P(arguments,ye+"."+_e))};return Z(st,qe),st})(Ne)}}}(ie.navigator.geolocation,["getCurrentPosition","watchPosition"])}),Zone.__load_patch("PromiseRejectionEvent",(ie,fe)=>{function ye(me){return function(_e){Ce(ie,me).forEach(Ye=>{const qe=ie.PromiseRejectionEvent;if(qe){const st=new qe(me,{promise:_e.promise,reason:_e.rejection});Ye.invoke(st)}})}}ie.PromiseRejectionEvent&&(fe[E("unhandledPromiseRejectionHandler")]=ye("unhandledrejection"),fe[E("rejectionHandledHandler")]=ye("rejectionhandled"))})},7420:()=>{},5856:()=>{},5883:()=>{},6577:()=>{},5819:()=>{},8479:function(J,G,N){"use strict";var u,g;u=[N(1873)],void 0!==(g=function(b){var w=b.Reader,v=b.Writer,l=b.util,p=b.roots.default||(b.roots.default={});return p.RPC=function(){function d(I){if(this.subscriptions=[],this.messages=[],I)for(var E=Object.keys(I),y=0;y>>3){case 1:C.subscriptions&&C.subscriptions.length||(C.subscriptions=[]),C.subscriptions.push(p.RPC.SubOpts.decode(E,E.uint32()));break;case 2:C.messages&&C.messages.length||(C.messages=[]),C.messages.push(p.RPC.Message.decode(E,E.uint32()));break;case 3:C.control=p.RPC.ControlMessage.decode(E,E.uint32());break;default:E.skipType(7&A)}}return C},d.fromObject=function(E){if(E instanceof p.RPC)return E;var y=new p.RPC;if(E.subscriptions){if(!Array.isArray(E.subscriptions))throw TypeError(".RPC.subscriptions: array expected");y.subscriptions=[];for(var f=0;f>>3){case 1:P.subscribe=f.bool();break;case 2:P.topic=f.string();break;default:f.skipType(7&D)}}return P},I.fromObject=function(f){if(f instanceof p.RPC.SubOpts)return f;var C=new p.RPC.SubOpts;return null!=f.subscribe&&(C.subscribe=Boolean(f.subscribe)),null!=f.topic&&(C.topic=String(f.topic)),C},I.toObject=function(f,C){C||(C={});var A={};return null!=f.subscribe&&f.hasOwnProperty("subscribe")&&(A.subscribe=f.subscribe,C.oneofs&&(A._subscribe="subscribe")),null!=f.topic&&f.hasOwnProperty("topic")&&(A.topic=f.topic,C.oneofs&&(A._topic="topic")),A},I.prototype.toJSON=function(){return this.constructor.toObject(this,b.util.toJSONOptions)},I}(),d.Message=function(){function I(y){if(y)for(var f=Object.keys(y),C=0;C>>3){case 1:P.from=f.bytes();break;case 2:P.data=f.bytes();break;case 3:P.seqno=f.bytes();break;case 4:P.topic=f.string();break;case 5:P.signature=f.bytes();break;case 6:P.key=f.bytes();break;default:f.skipType(7&D)}}if(!P.hasOwnProperty("topic"))throw l.ProtocolError("missing required 'topic'",{instance:P});return P},I.fromObject=function(f){if(f instanceof p.RPC.Message)return f;var C=new p.RPC.Message;return null!=f.from&&("string"==typeof f.from?l.base64.decode(f.from,C.from=l.newBuffer(l.base64.length(f.from)),0):f.from.length&&(C.from=f.from)),null!=f.data&&("string"==typeof f.data?l.base64.decode(f.data,C.data=l.newBuffer(l.base64.length(f.data)),0):f.data.length&&(C.data=f.data)),null!=f.seqno&&("string"==typeof f.seqno?l.base64.decode(f.seqno,C.seqno=l.newBuffer(l.base64.length(f.seqno)),0):f.seqno.length&&(C.seqno=f.seqno)),null!=f.topic&&(C.topic=String(f.topic)),null!=f.signature&&("string"==typeof f.signature?l.base64.decode(f.signature,C.signature=l.newBuffer(l.base64.length(f.signature)),0):f.signature.length&&(C.signature=f.signature)),null!=f.key&&("string"==typeof f.key?l.base64.decode(f.key,C.key=l.newBuffer(l.base64.length(f.key)),0):f.key.length&&(C.key=f.key)),C},I.toObject=function(f,C){C||(C={});var A={};return C.defaults&&(A.topic=""),null!=f.from&&f.hasOwnProperty("from")&&(A.from=C.bytes===String?l.base64.encode(f.from,0,f.from.length):C.bytes===Array?Array.prototype.slice.call(f.from):f.from,C.oneofs&&(A._from="from")),null!=f.data&&f.hasOwnProperty("data")&&(A.data=C.bytes===String?l.base64.encode(f.data,0,f.data.length):C.bytes===Array?Array.prototype.slice.call(f.data):f.data,C.oneofs&&(A._data="data")),null!=f.seqno&&f.hasOwnProperty("seqno")&&(A.seqno=C.bytes===String?l.base64.encode(f.seqno,0,f.seqno.length):C.bytes===Array?Array.prototype.slice.call(f.seqno):f.seqno,C.oneofs&&(A._seqno="seqno")),null!=f.topic&&f.hasOwnProperty("topic")&&(A.topic=f.topic),null!=f.signature&&f.hasOwnProperty("signature")&&(A.signature=C.bytes===String?l.base64.encode(f.signature,0,f.signature.length):C.bytes===Array?Array.prototype.slice.call(f.signature):f.signature,C.oneofs&&(A._signature="signature")),null!=f.key&&f.hasOwnProperty("key")&&(A.key=C.bytes===String?l.base64.encode(f.key,0,f.key.length):C.bytes===Array?Array.prototype.slice.call(f.key):f.key,C.oneofs&&(A._key="key")),A},I.prototype.toJSON=function(){return this.constructor.toObject(this,b.util.toJSONOptions)},I}(),d.ControlMessage=function(){function I(E){if(this.ihave=[],this.iwant=[],this.graft=[],this.prune=[],E)for(var y=Object.keys(E),f=0;f>>3){case 1:A.ihave&&A.ihave.length||(A.ihave=[]),A.ihave.push(p.RPC.ControlIHave.decode(y,y.uint32()));break;case 2:A.iwant&&A.iwant.length||(A.iwant=[]),A.iwant.push(p.RPC.ControlIWant.decode(y,y.uint32()));break;case 3:A.graft&&A.graft.length||(A.graft=[]),A.graft.push(p.RPC.ControlGraft.decode(y,y.uint32()));break;case 4:A.prune&&A.prune.length||(A.prune=[]),A.prune.push(p.RPC.ControlPrune.decode(y,y.uint32()));break;default:y.skipType(7&P)}}return A},I.fromObject=function(y){if(y instanceof p.RPC.ControlMessage)return y;var f=new p.RPC.ControlMessage;if(y.ihave){if(!Array.isArray(y.ihave))throw TypeError(".RPC.ControlMessage.ihave: array expected");f.ihave=[];for(var C=0;C>>3){case 1:P.topicID=f.string();break;case 2:P.messageIDs&&P.messageIDs.length||(P.messageIDs=[]),P.messageIDs.push(f.bytes());break;default:f.skipType(7&D)}}return P},I.fromObject=function(f){if(f instanceof p.RPC.ControlIHave)return f;var C=new p.RPC.ControlIHave;if(null!=f.topicID&&(C.topicID=String(f.topicID)),f.messageIDs){if(!Array.isArray(f.messageIDs))throw TypeError(".RPC.ControlIHave.messageIDs: array expected");C.messageIDs=[];for(var A=0;A>>3==1?(A.messageIDs&&A.messageIDs.length||(A.messageIDs=[]),A.messageIDs.push(y.bytes())):y.skipType(7&P)}return A},I.fromObject=function(y){if(y instanceof p.RPC.ControlIWant)return y;var f=new p.RPC.ControlIWant;if(y.messageIDs){if(!Array.isArray(y.messageIDs))throw TypeError(".RPC.ControlIWant.messageIDs: array expected");f.messageIDs=[];for(var C=0;C>>3==1?P.topicID=f.string():f.skipType(7&D)}return P},I.fromObject=function(f){if(f instanceof p.RPC.ControlGraft)return f;var C=new p.RPC.ControlGraft;return null!=f.topicID&&(C.topicID=String(f.topicID)),C},I.toObject=function(f,C){C||(C={});var A={};return null!=f.topicID&&f.hasOwnProperty("topicID")&&(A.topicID=f.topicID,C.oneofs&&(A._topicID="topicID")),A},I.prototype.toJSON=function(){return this.constructor.toObject(this,b.util.toJSONOptions)},I}(),d.ControlPrune=function(){function I(y){if(this.peers=[],y)for(var f=Object.keys(y),C=0;C>>3){case 1:P.topicID=f.string();break;case 2:P.peers&&P.peers.length||(P.peers=[]),P.peers.push(p.RPC.PeerInfo.decode(f,f.uint32()));break;case 3:P.backoff=f.uint64();break;default:f.skipType(7&D)}}return P},I.fromObject=function(f){if(f instanceof p.RPC.ControlPrune)return f;var C=new p.RPC.ControlPrune;if(null!=f.topicID&&(C.topicID=String(f.topicID)),f.peers){if(!Array.isArray(f.peers))throw TypeError(".RPC.ControlPrune.peers: array expected");C.peers=[];for(var A=0;A>>0,f.backoff.high>>>0).toNumber(!0))),C},I.toObject=function(f,C){C||(C={});var A={};if((C.arrays||C.defaults)&&(A.peers=[]),null!=f.topicID&&f.hasOwnProperty("topicID")&&(A.topicID=f.topicID,C.oneofs&&(A._topicID="topicID")),f.peers&&f.peers.length){A.peers=[];for(var P=0;P>>0,f.backoff.high>>>0).toNumber(!0):f.backoff,C.oneofs&&(A._backoff="backoff")),A},I.prototype.toJSON=function(){return this.constructor.toObject(this,b.util.toJSONOptions)},I}(),d.PeerInfo=function(){function I(y){if(y)for(var f=Object.keys(y),C=0;C>>3){case 1:P.peerID=f.bytes();break;case 2:P.signedPeerRecord=f.bytes();break;default:f.skipType(7&D)}}return P},I.fromObject=function(f){if(f instanceof p.RPC.PeerInfo)return f;var C=new p.RPC.PeerInfo;return null!=f.peerID&&("string"==typeof f.peerID?l.base64.decode(f.peerID,C.peerID=l.newBuffer(l.base64.length(f.peerID)),0):f.peerID.length&&(C.peerID=f.peerID)),null!=f.signedPeerRecord&&("string"==typeof f.signedPeerRecord?l.base64.decode(f.signedPeerRecord,C.signedPeerRecord=l.newBuffer(l.base64.length(f.signedPeerRecord)),0):f.signedPeerRecord.length&&(C.signedPeerRecord=f.signedPeerRecord)),C},I.toObject=function(f,C){C||(C={});var A={};return null!=f.peerID&&f.hasOwnProperty("peerID")&&(A.peerID=C.bytes===String?l.base64.encode(f.peerID,0,f.peerID.length):C.bytes===Array?Array.prototype.slice.call(f.peerID):f.peerID,C.oneofs&&(A._peerID="peerID")),null!=f.signedPeerRecord&&f.hasOwnProperty("signedPeerRecord")&&(A.signedPeerRecord=C.bytes===String?l.base64.encode(f.signedPeerRecord,0,f.signedPeerRecord.length):C.bytes===Array?Array.prototype.slice.call(f.signedPeerRecord):f.signedPeerRecord,C.oneofs&&(A._signedPeerRecord="signedPeerRecord")),A},I.prototype.toJSON=function(){return this.constructor.toObject(this,b.util.toJSONOptions)},I}(),d}(),p}.apply(G,u))&&(J.exports=g)},4642:(J,G,N)=>{var h=N(9805);function u(g){var b,w;function l(d,_){try{var I=g[d](_),E=I.value,y=E instanceof h;Promise.resolve(y?E.wrapped:E).then(function(f){y?l("return"===d?"return":"next",f):p(I.done?"return":"normal",f)},function(f){l("throw",f)})}catch(f){p("throw",f)}}function p(d,_){switch(d){case"return":b.resolve({value:_,done:!0});break;case"throw":b.reject(_);break;default:b.resolve({value:_,done:!1})}(b=b.next)?l(b.key,b.arg):w=null}this._invoke=function v(d,_){return new Promise(function(I,E){var y={key:d,arg:_,resolve:I,reject:E,next:null};w?w=w.next=y:(b=w=y,l(d,_))})},"function"!=typeof g.return&&(this.return=void 0)}u.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},u.prototype.next=function(g){return this._invoke("next",g)},u.prototype.throw=function(g){return this._invoke("throw",g)},u.prototype.return=function(g){return this._invoke("return",g)},J.exports=u,J.exports.__esModule=!0,J.exports.default=J.exports},9805:J=>{J.exports=function G(N){this.wrapped=N},J.exports.__esModule=!0,J.exports.default=J.exports},8131:J=>{J.exports=function G(N,h){var u={},g=!1;function b(w,v){return g=!0,v=new Promise(function(l){l(N[w](v))}),{done:!1,value:h(v)}}return u[typeof Symbol<"u"&&Symbol.iterator||"@@iterator"]=function(){return this},u.next=function(w){return g?(g=!1,w):b("next",w)},"function"==typeof N.throw&&(u.throw=function(w){if(g)throw g=!1,w;return b("throw",w)}),"function"==typeof N.return&&(u.return=function(w){return g?(g=!1,w):b("return",w)}),u},J.exports.__esModule=!0,J.exports.default=J.exports},8237:J=>{function N(h){function u(g){if(Object(g)!==g)return Promise.reject(new TypeError(g+" is not an object."));var b=g.done;return Promise.resolve(g.value).then(function(w){return{value:w,done:b}})}return(N=function(b){this.s=b,this.n=b.next}).prototype={s:null,n:null,next:function(){return u(this.n.apply(this.s,arguments))},return:function(b){var w=this.s.return;return void 0===w?Promise.resolve({value:b,done:!0}):u(w.apply(this.s,arguments))},throw:function(b){var w=this.s.return;return void 0===w?Promise.reject(b):u(w.apply(this.s,arguments))}},new N(h)}J.exports=function G(h){var u,g,b,w=2;for(typeof Symbol<"u"&&(g=Symbol.asyncIterator,b=Symbol.iterator);w--;){if(g&&null!=(u=h[g]))return u.call(h);if(b&&null!=(u=h[b]))return new N(u.call(h));g="@@asyncIterator",b="@@iterator"}throw new TypeError("Object is not async iterable")},J.exports.__esModule=!0,J.exports.default=J.exports},7156:J=>{function G(h,u,g,b,w,v,l){try{var p=h[v](l),d=p.value}catch(_){return void g(_)}p.done?u(d):Promise.resolve(d).then(b,w)}J.exports=function N(h){return function(){var u=this,g=arguments;return new Promise(function(b,w){var v=h.apply(u,g);function l(d){G(v,b,w,l,p,"next",d)}function p(d){G(v,b,w,l,p,"throw",d)}l(void 0)})}},J.exports.__esModule=!0,J.exports.default=J.exports},6737:(J,G,N)=>{var h=N(9805);J.exports=function u(g){return new h(g)},J.exports.__esModule=!0,J.exports.default=J.exports},8186:(J,G,N)=>{var h=N(4642);J.exports=function u(g){return function(){return new h(g.apply(this,arguments))}},J.exports.__esModule=!0,J.exports.default=J.exports}},J=>{J(J.s=623)}]); \ No newline at end of file diff --git a/relay-angular-chat/runtime.85abfe8aa64fdd33.js b/relay-angular-chat/runtime.85abfe8aa64fdd33.js new file mode 100644 index 0000000..a7d90cf --- /dev/null +++ b/relay-angular-chat/runtime.85abfe8aa64fdd33.js @@ -0,0 +1 @@ +(()=>{"use strict";var e,u={},b={};function t(e){var f=b[e];if(void 0!==f)return f.exports;var r=b[e]={exports:{}};return u[e].call(r.exports,r,r.exports,t),r.exports}t.m=u,t.amdO={},e=[],t.O=(f,r,o,a)=>{if(!r){var l=1/0;for(n=0;n=a)&&Object.keys(t.O).every(h=>t.O[h](r[c]))?r.splice(c--,1):(i=!1,a0&&e[n-1][2]>a;n--)e[n]=e[n-1];e[n]=[r,o,a]},t.n=e=>{var f=e&&e.__esModule?()=>e.default:()=>e;return t.d(f,{a:f}),f},(()=>{var f,e=Object.getPrototypeOf?r=>Object.getPrototypeOf(r):r=>r.__proto__;t.t=function(r,o){if(1&o&&(r=this(r)),8&o||"object"==typeof r&&r&&(4&o&&r.__esModule||16&o&&"function"==typeof r.then))return r;var a=Object.create(null);t.r(a);var n={};f=f||[null,e({}),e([]),e(e)];for(var l=2&o&&r;"object"==typeof l&&!~f.indexOf(l);l=e(l))Object.getOwnPropertyNames(l).forEach(i=>n[i]=()=>r[i]);return n.default=()=>r,t.d(a,n),a}})(),t.d=(e,f)=>{for(var r in f)t.o(f,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:f[r]})},t.o=(e,f)=>Object.prototype.hasOwnProperty.call(e,f),t.r=e=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e={666:0};t.O.j=o=>0===e[o];var f=(o,a)=>{var c,_,[n,l,i]=a,s=0;if(n.some(d=>0!==e[d])){for(c in l)t.o(l,c)&&(t.m[c]=l[c]);if(i)var p=i(t)}for(o&&o(a);s + + + + + + JS-Waku Chat + + + + +

Waku Node Status

+
+ + + + +

Messages

+
+ + + + + + diff --git a/relay-reactjs-chat/asset-manifest.json b/relay-reactjs-chat/asset-manifest.json new file mode 100644 index 0000000..e5db531 --- /dev/null +++ b/relay-reactjs-chat/asset-manifest.json @@ -0,0 +1,13 @@ +{ + "files": { + "main.css": "/relay-reactjs-chat/static/css/main.e6c13ad2.css", + "main.js": "/relay-reactjs-chat/static/js/main.d422f314.js", + "index.html": "/relay-reactjs-chat/index.html", + "main.e6c13ad2.css.map": "/relay-reactjs-chat/static/css/main.e6c13ad2.css.map", + "main.d422f314.js.map": "/relay-reactjs-chat/static/js/main.d422f314.js.map" + }, + "entrypoints": [ + "static/css/main.e6c13ad2.css", + "static/js/main.d422f314.js" + ] +} \ No newline at end of file diff --git a/relay-reactjs-chat/favicon.ico b/relay-reactjs-chat/favicon.ico new file mode 100644 index 0000000..a11777c Binary files /dev/null and b/relay-reactjs-chat/favicon.ico differ diff --git a/relay-reactjs-chat/index.html b/relay-reactjs-chat/index.html new file mode 100644 index 0000000..4d2ba14 --- /dev/null +++ b/relay-reactjs-chat/index.html @@ -0,0 +1 @@ +React App
\ No newline at end of file diff --git a/relay-reactjs-chat/logo192.png b/relay-reactjs-chat/logo192.png new file mode 100644 index 0000000..fc44b0a Binary files /dev/null and b/relay-reactjs-chat/logo192.png differ diff --git a/relay-reactjs-chat/logo512.png b/relay-reactjs-chat/logo512.png new file mode 100644 index 0000000..a4e47a6 Binary files /dev/null and b/relay-reactjs-chat/logo512.png differ diff --git a/relay-reactjs-chat/manifest.json b/relay-reactjs-chat/manifest.json new file mode 100644 index 0000000..080d6c7 --- /dev/null +++ b/relay-reactjs-chat/manifest.json @@ -0,0 +1,25 @@ +{ + "short_name": "React App", + "name": "Create React App Sample", + "icons": [ + { + "src": "favicon.ico", + "sizes": "64x64 32x32 24x24 16x16", + "type": "image/x-icon" + }, + { + "src": "logo192.png", + "type": "image/png", + "sizes": "192x192" + }, + { + "src": "logo512.png", + "type": "image/png", + "sizes": "512x512" + } + ], + "start_url": ".", + "display": "standalone", + "theme_color": "#000000", + "background_color": "#ffffff" +} diff --git a/relay-reactjs-chat/robots.txt b/relay-reactjs-chat/robots.txt new file mode 100644 index 0000000..e9e57dc --- /dev/null +++ b/relay-reactjs-chat/robots.txt @@ -0,0 +1,3 @@ +# https://www.robotstxt.org/robotstxt.html +User-agent: * +Disallow: diff --git a/relay-reactjs-chat/static/css/main.e6c13ad2.css b/relay-reactjs-chat/static/css/main.e6c13ad2.css new file mode 100644 index 0000000..50410fa --- /dev/null +++ b/relay-reactjs-chat/static/css/main.e6c13ad2.css @@ -0,0 +1,2 @@ +body{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;margin:0}code{font-family:source-code-pro,Menlo,Monaco,Consolas,Courier New,monospace} +/*# sourceMappingURL=main.e6c13ad2.css.map*/ \ No newline at end of file diff --git a/relay-reactjs-chat/static/css/main.e6c13ad2.css.map b/relay-reactjs-chat/static/css/main.e6c13ad2.css.map new file mode 100644 index 0000000..5c4dfb9 --- /dev/null +++ b/relay-reactjs-chat/static/css/main.e6c13ad2.css.map @@ -0,0 +1 @@ +{"version":3,"file":"static/css/main.e6c13ad2.css","mappings":"AAAA,KAKE,kCAAmC,CACnC,iCAAkC,CAJlC,mIAEY,CAHZ,QAMF,CAEA,KACE,uEAEF","sources":["index.css"],"sourcesContent":["body {\n margin: 0;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',\n 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',\n sans-serif;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\ncode {\n font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',\n monospace;\n}\n"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/relay-reactjs-chat/static/js/main.d422f314.js b/relay-reactjs-chat/static/js/main.d422f314.js new file mode 100644 index 0000000..b5cd041 --- /dev/null +++ b/relay-reactjs-chat/static/js/main.d422f314.js @@ -0,0 +1,3 @@ +/*! For license information please see main.d422f314.js.LICENSE.txt */ +(()=>{var __webpack_modules__={2001:(e,t,r)=>{"use strict";e.exports=r(6181)},6181:(e,t,r)=>{"use strict";var n=t;function i(){n.util._configure(),n.Writer._configure(n.BufferWriter),n.Reader._configure(n.BufferReader)}n.build="minimal",n.Writer=r(9800),n.BufferWriter=r(6489),n.Reader=r(5684),n.BufferReader=r(1229),n.util=r(9584),n.rpc=r(1872),n.roots=r(9358),n.configure=i,i()},5684:(e,t,r)=>{"use strict";e.exports=c;var n,i=r(9584),s=i.LongBits,o=i.utf8;function a(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function c(e){this.buf=e,this.pos=0,this.len=e.length}var l="undefined"!==typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new c(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new c(e);throw Error("illegal buffer")},u=function(){return i.Buffer?function(e){return(c.create=function(e){return i.Buffer.isBuffer(e)?new n(e):l(e)})(e)}:l};function h(){var e=new s(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function d(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function f(){if(this.pos+8>this.len)throw a(this,8);return new s(d(this.buf,this.pos+=4),d(this.buf,this.pos+=4))}c.create=u(),c.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,c.prototype.uint32=function(){var e=4294967295;return function(){if(e=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return e;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return e}}(),c.prototype.int32=function(){return 0|this.uint32()},c.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},c.prototype.bool=function(){return 0!==this.uint32()},c.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return d(this.buf,this.pos+=4)},c.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return 0|d(this.buf,this.pos+=4)},c.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var e=i.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},c.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var e=i.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},c.prototype.bytes=function(){var e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,r):t===r?new this.buf.constructor(0):this._slice.call(this.buf,t,r)},c.prototype.string=function(){var e=this.bytes();return o.read(e,0,e.length)},c.prototype.skip=function(e){if("number"===typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},c.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!==(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},c._configure=function(e){n=e,c.create=u(),n._configure();var t=i.Long?"toLong":"toNumber";i.merge(c.prototype,{int64:function(){return h.call(this)[t](!1)},uint64:function(){return h.call(this)[t](!0)},sint64:function(){return h.call(this).zzDecode()[t](!1)},fixed64:function(){return f.call(this)[t](!0)},sfixed64:function(){return f.call(this)[t](!1)}})}},1229:(e,t,r)=>{"use strict";e.exports=s;var n=r(5684);(s.prototype=Object.create(n.prototype)).constructor=s;var i=r(9584);function s(e){n.call(this,e)}s._configure=function(){i.Buffer&&(s.prototype._slice=i.Buffer.prototype.slice)},s.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},s._configure()},9358:e=>{"use strict";e.exports={}},1872:(e,t,r)=>{"use strict";t.Service=r(4648)},4648:(e,t,r)=>{"use strict";e.exports=i;var n=r(9584);function i(e,t,r){if("function"!==typeof e)throw TypeError("rpcImpl must be a function");n.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(r)}(i.prototype=Object.create(n.EventEmitter.prototype)).constructor=i,i.prototype.rpcCall=function e(t,r,i,s,o){if(!s)throw TypeError("request must be specified");var a=this;if(!o)return n.asPromise(e,a,t,r,i,s);if(a.rpcImpl)try{return a.rpcImpl(t,r[a.requestDelimited?"encodeDelimited":"encode"](s).finish(),(function(e,r){if(e)return a.emit("error",e,t),o(e);if(null!==r){if(!(r instanceof i))try{r=i[a.responseDelimited?"decodeDelimited":"decode"](r)}catch(e){return a.emit("error",e,t),o(e)}return a.emit("data",r,t),o(null,r)}a.end(!0)}))}catch(c){return a.emit("error",c,t),void setTimeout((function(){o(c)}),0)}else setTimeout((function(){o(Error("already ended"))}),0)},i.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},6880:(e,t,r)=>{"use strict";e.exports=i;var n=r(9584);function i(e,t){this.lo=e>>>0,this.hi=t>>>0}var s=i.zero=new i(0,0);s.toNumber=function(){return 0},s.zzEncode=s.zzDecode=function(){return this},s.length=function(){return 1};var o=i.zeroHash="\0\0\0\0\0\0\0\0";i.fromNumber=function(e){if(0===e)return s;var t=e<0;t&&(e=-e);var r=e>>>0,n=(e-r)/4294967296>>>0;return t&&(n=~n>>>0,r=~r>>>0,++r>4294967295&&(r=0,++n>4294967295&&(n=0))),new i(r,n)},i.from=function(e){if("number"===typeof e)return i.fromNumber(e);if(n.isString(e)){if(!n.Long)return i.fromNumber(parseInt(e,10));e=n.Long.fromString(e)}return e.low||e.high?new i(e.low>>>0,e.high>>>0):s},i.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+4294967296*r)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(e){return n.Long?new n.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var a=String.prototype.charCodeAt;i.fromHash=function(e){return e===o?s:new i((a.call(e,0)|a.call(e,1)<<8|a.call(e,2)<<16|a.call(e,3)<<24)>>>0,(a.call(e,4)|a.call(e,5)<<8|a.call(e,6)<<16|a.call(e,7)<<24)>>>0)},i.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},i.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},i.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},i.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}},9584:function(e,t,r){"use strict";var n=t;function i(e,t,r){for(var n=Object.keys(t),i=0;i0)},n.Buffer=function(){try{var e=n.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(t){return null}}(),n._Buffer_from=null,n._Buffer_allocUnsafe=null,n.newBuffer=function(e){return"number"===typeof e?n.Buffer?n._Buffer_allocUnsafe(e):new n.Array(e):n.Buffer?n._Buffer_from(e):"undefined"===typeof Uint8Array?e:new Uint8Array(e)},n.Array="undefined"!==typeof Uint8Array?Uint8Array:Array,n.Long=n.global.dcodeIO&&n.global.dcodeIO.Long||n.global.Long||n.inquire("long"),n.key2Re=/^true|false|0|1$/,n.key32Re=/^-?(?:0|[1-9][0-9]*)$/,n.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,n.longToHash=function(e){return e?n.LongBits.from(e).toHash():n.LongBits.zeroHash},n.longFromHash=function(e,t){var r=n.LongBits.fromHash(e);return n.Long?n.Long.fromBits(r.lo,r.hi,t):r.toNumber(Boolean(t))},n.merge=i,n.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},n.newError=s,n.ProtocolError=s("ProtocolError"),n.oneOfGetter=function(e){for(var t={},r=0;r-1;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}},n.oneOfSetter=function(e){return function(t){for(var r=0;r{"use strict";e.exports=h;var n,i=r(9584),s=i.LongBits,o=i.base64,a=i.utf8;function c(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function l(){}function u(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function h(){this.len=0,this.head=new c(l,0,0),this.tail=this.head,this.states=null}var d=function(){return i.Buffer?function(){return(h.create=function(){return new n})()}:function(){return new h}};function f(e,t,r){t[r]=255&e}function p(e,t){this.len=e,this.next=void 0,this.val=t}function g(e,t,r){for(;e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function y(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}h.create=d(),h.alloc=function(e){return new i.Array(e)},i.Array!==Array&&(h.alloc=i.pool(h.alloc,i.Array.prototype.subarray)),h.prototype._push=function(e,t,r){return this.tail=this.tail.next=new c(e,t,r),this.len+=t,this},p.prototype=Object.create(c.prototype),p.prototype.fn=function(e,t,r){for(;e>127;)t[r++]=127&e|128,e>>>=7;t[r]=e},h.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new p((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},h.prototype.int32=function(e){return e<0?this._push(g,10,s.fromNumber(e)):this.uint32(e)},h.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},h.prototype.uint64=function(e){var t=s.from(e);return this._push(g,t.length(),t)},h.prototype.int64=h.prototype.uint64,h.prototype.sint64=function(e){var t=s.from(e).zzEncode();return this._push(g,t.length(),t)},h.prototype.bool=function(e){return this._push(f,1,e?1:0)},h.prototype.fixed32=function(e){return this._push(y,4,e>>>0)},h.prototype.sfixed32=h.prototype.fixed32,h.prototype.fixed64=function(e){var t=s.from(e);return this._push(y,4,t.lo)._push(y,4,t.hi)},h.prototype.sfixed64=h.prototype.fixed64,h.prototype.float=function(e){return this._push(i.float.writeFloatLE,4,e)},h.prototype.double=function(e){return this._push(i.float.writeDoubleLE,8,e)};var m=i.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n>>0;if(!t)return this._push(f,1,0);if(i.isString(e)){var r=h.alloc(t=o.length(e));o.decode(e,r,0),e=r}return this.uint32(t)._push(m,t,e)},h.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(f,1,0)},h.prototype.fork=function(){return this.states=new u(this),this.head=this.tail=new c(l,0,0),this.len=0,this},h.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new c(l,0,0),this.len=0),this},h.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},h.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},h._configure=function(e){n=e,h.create=d(),n._configure()}},6489:(e,t,r)=>{"use strict";e.exports=s;var n=r(9800);(s.prototype=Object.create(n.prototype)).constructor=s;var i=r(9584);function s(){n.call(this)}function o(e,t,r){e.length<40?i.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}s._configure=function(){s.alloc=i._Buffer_allocUnsafe,s.writeBytesBuffer=i.Buffer&&i.Buffer.prototype instanceof Uint8Array&&"set"===i.Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var n=0;n>>0;return this.uint32(t),t&&this._push(s.writeBytesBuffer,t,e),this},s.prototype.string=function(e){var t=i.Buffer.byteLength(e);return this.uint32(t),t&&this._push(o,t,e),this},s._configure()},7206:e=>{"use strict";e.exports=function(e,t){var r=new Array(arguments.length-1),n=0,i=2,s=!0;for(;i{"use strict";var r=t;r.length=function(e){var t=e.length;if(!t)return 0;for(var r=0;--t%4>1&&"="===e.charAt(t);)++r;return Math.ceil(3*e.length)/4-r};for(var n=new Array(64),i=new Array(123),s=0;s<64;)i[n[s]=s<26?s+65:s<52?s+71:s<62?s-4:s-59|43]=s++;r.encode=function(e,t,r){for(var i,s=null,o=[],a=0,c=0;t>2],i=(3&l)<<4,c=1;break;case 1:o[a++]=n[i|l>>4],i=(15&l)<<2,c=2;break;case 2:o[a++]=n[i|l>>6],o[a++]=n[63&l],c=0}a>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,o)),a=0)}return c&&(o[a++]=n[i],o[a++]=61,1===c&&(o[a++]=61)),s?(a&&s.push(String.fromCharCode.apply(String,o.slice(0,a))),s.join("")):String.fromCharCode.apply(String,o.slice(0,a))};var o="invalid encoding";r.decode=function(e,t,r){for(var n,s=r,a=0,c=0;c1)break;if(void 0===(l=i[l]))throw Error(o);switch(a){case 0:n=l,a=1;break;case 1:t[r++]=n<<2|(48&l)>>4,n=l,a=2;break;case 2:t[r++]=(15&n)<<4|(60&l)>>2,n=l,a=3;break;case 3:t[r++]=(3&n)<<6|l,a=0}}if(1===a)throw Error(o);return r-s},r.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},3297:e=>{"use strict";function t(e,r){"string"===typeof e&&(r=e,e=void 0);var n=[];function i(e){if("string"!==typeof e){var r=s();if(t.verbose&&console.log("codegen: "+r),r="return "+r,e){for(var o=Object.keys(e),a=new Array(o.length+1),c=new Array(o.length),l=0;l{"use strict";function t(){this._listeners={}}e.exports=t,t.prototype.on=function(e,t,r){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:r||this}),this},t.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var r=this._listeners[e],n=0;n{"use strict";e.exports=s;var n=r(7206),i=r(7172)("fs");function s(e,t,r){return"function"===typeof t?(r=t,t={}):t||(t={}),r?!t.xhr&&i&&i.readFile?i.readFile(e,(function(n,i){return n&&"undefined"!==typeof XMLHttpRequest?s.xhr(e,t,r):n?r(n):r(null,t.binary?i:i.toString("utf8"))})):s.xhr(e,t,r):n(s,this,e,t)}s.xhr=function(e,t,r){var n=new XMLHttpRequest;n.onreadystatechange=function(){if(4===n.readyState){if(0!==n.status&&200!==n.status)return r(Error("status "+n.status));if(t.binary){var e=n.response;if(!e){e=[];for(var i=0;i{"use strict";function t(e){return"undefined"!==typeof Float32Array?function(){var t=new Float32Array([-0]),r=new Uint8Array(t.buffer),n=128===r[3];function i(e,n,i){t[0]=e,n[i]=r[0],n[i+1]=r[1],n[i+2]=r[2],n[i+3]=r[3]}function s(e,n,i){t[0]=e,n[i]=r[3],n[i+1]=r[2],n[i+2]=r[1],n[i+3]=r[0]}function o(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],t[0]}function a(e,n){return r[3]=e[n],r[2]=e[n+1],r[1]=e[n+2],r[0]=e[n+3],t[0]}e.writeFloatLE=n?i:s,e.writeFloatBE=n?s:i,e.readFloatLE=n?o:a,e.readFloatBE=n?a:o}():function(){function t(e,t,r,n){var i=t<0?1:0;if(i&&(t=-t),0===t)e(1/t>0?0:2147483648,r,n);else if(isNaN(t))e(2143289344,r,n);else if(t>34028234663852886e22)e((i<<31|2139095040)>>>0,r,n);else if(t<11754943508222875e-54)e((i<<31|Math.round(t/1401298464324817e-60))>>>0,r,n);else{var s=Math.floor(Math.log(t)/Math.LN2);e((i<<31|s+127<<23|8388607&Math.round(t*Math.pow(2,-s)*8388608))>>>0,r,n)}}function o(e,t,r){var n=e(t,r),i=2*(n>>31)+1,s=n>>>23&255,o=8388607&n;return 255===s?o?NaN:i*(1/0):0===s?1401298464324817e-60*i*o:i*Math.pow(2,s-150)*(o+8388608)}e.writeFloatLE=t.bind(null,r),e.writeFloatBE=t.bind(null,n),e.readFloatLE=o.bind(null,i),e.readFloatBE=o.bind(null,s)}(),"undefined"!==typeof Float64Array?function(){var t=new Float64Array([-0]),r=new Uint8Array(t.buffer),n=128===r[7];function i(e,n,i){t[0]=e,n[i]=r[0],n[i+1]=r[1],n[i+2]=r[2],n[i+3]=r[3],n[i+4]=r[4],n[i+5]=r[5],n[i+6]=r[6],n[i+7]=r[7]}function s(e,n,i){t[0]=e,n[i]=r[7],n[i+1]=r[6],n[i+2]=r[5],n[i+3]=r[4],n[i+4]=r[3],n[i+5]=r[2],n[i+6]=r[1],n[i+7]=r[0]}function o(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],r[4]=e[n+4],r[5]=e[n+5],r[6]=e[n+6],r[7]=e[n+7],t[0]}function a(e,n){return r[7]=e[n],r[6]=e[n+1],r[5]=e[n+2],r[4]=e[n+3],r[3]=e[n+4],r[2]=e[n+5],r[1]=e[n+6],r[0]=e[n+7],t[0]}e.writeDoubleLE=n?i:s,e.writeDoubleBE=n?s:i,e.readDoubleLE=n?o:a,e.readDoubleBE=n?a:o}():function(){function t(e,t,r,n,i,s){var o=n<0?1:0;if(o&&(n=-n),0===n)e(0,i,s+t),e(1/n>0?0:2147483648,i,s+r);else if(isNaN(n))e(0,i,s+t),e(2146959360,i,s+r);else if(n>17976931348623157e292)e(0,i,s+t),e((o<<31|2146435072)>>>0,i,s+r);else{var a;if(n<22250738585072014e-324)e((a=n/5e-324)>>>0,i,s+t),e((o<<31|a/4294967296)>>>0,i,s+r);else{var c=Math.floor(Math.log(n)/Math.LN2);1024===c&&(c=1023),e(4503599627370496*(a=n*Math.pow(2,-c))>>>0,i,s+t),e((o<<31|c+1023<<20|1048576*a&1048575)>>>0,i,s+r)}}}function o(e,t,r,n,i){var s=e(n,i+t),o=e(n,i+r),a=2*(o>>31)+1,c=o>>>20&2047,l=4294967296*(1048575&o)+s;return 2047===c?l?NaN:a*(1/0):0===c?5e-324*a*l:a*Math.pow(2,c-1075)*(l+4503599627370496)}e.writeDoubleLE=t.bind(null,r,0,4),e.writeDoubleBE=t.bind(null,n,4,0),e.readDoubleLE=o.bind(null,i,0,4),e.readDoubleBE=o.bind(null,s,4,0)}(),e}function r(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}function n(e,t,r){t[r]=e>>>24,t[r+1]=e>>>16&255,t[r+2]=e>>>8&255,t[r+3]=255&e}function i(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function s(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}e.exports=t(t)},7172:module=>{"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}module.exports=inquire},7468:(e,t)=>{"use strict";var r=t,n=r.isAbsolute=function(e){return/^(?:\/|\w+:)/.test(e)},i=r.normalize=function(e){var t=(e=e.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),r=n(e),i="";r&&(i=t.shift()+"/");for(var s=0;s0&&".."!==t[s-1]?t.splice(--s,2):r?t.splice(s,1):++s:"."===t[s]?t.splice(s,1):++s;return i+t.join("/")};r.resolve=function(e,t,r){return r||(t=i(t)),n(t)?t:(r||(e=i(e)),(e=e.replace(/(?:\/|^)[^/]+$/,"")).length?i(e+"/"+t):t)}},8236:e=>{"use strict";e.exports=function(e,t,r){var n=r||8192,i=n>>>1,s=null,o=n;return function(r){if(r<1||r>i)return e(r);o+r>n&&(s=e(n),o=0);var a=t.call(s,o,o+=r);return 7&o&&(o=1+(7|o)),a}}},3861:(e,t)=>{"use strict";var r=t;r.length=function(e){for(var t=0,r=0,n=0;n191&&n<224?s[o++]=(31&n)<<6|63&e[t++]:n>239&&n<365?(n=((7&n)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,s[o++]=55296+(n>>10),s[o++]=56320+(1023&n)):s[o++]=(15&n)<<12|(63&e[t++])<<6|63&e[t++],o>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),o=0);return i?(o&&i.push(String.fromCharCode.apply(String,s.slice(0,o))),i.join("")):String.fromCharCode.apply(String,s.slice(0,o))},r.write=function(e,t,r){for(var n,i,s=r,o=0;o>6|192,t[r++]=63&n|128):55296===(64512&n)&&56320===(64512&(i=e.charCodeAt(o+1)))?(n=65536+((1023&n)<<10)+(1023&i),++o,t[r++]=n>>18|240,t[r++]=n>>12&63|128,t[r++]=n>>6&63|128,t[r++]=63&n|128):(t[r++]=n>>12|224,t[r++]=n>>6&63|128,t[r++]=63&n|128);return r-s}},6232:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(5073);function i(e,t,r){return void 0===t&&(t=new Uint8Array(2)),void 0===r&&(r=0),t[r+0]=e>>>8,t[r+1]=e>>>0,t}function s(e,t,r){return void 0===t&&(t=new Uint8Array(2)),void 0===r&&(r=0),t[r+0]=e>>>0,t[r+1]=e>>>8,t}function o(e,t){return void 0===t&&(t=0),e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function a(e,t){return void 0===t&&(t=0),(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function c(e,t){return void 0===t&&(t=0),e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]}function l(e,t){return void 0===t&&(t=0),(e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t])>>>0}function u(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),t[r+0]=e>>>24,t[r+1]=e>>>16,t[r+2]=e>>>8,t[r+3]=e>>>0,t}function h(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),t[r+0]=e>>>0,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24,t}function d(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),u(e/4294967296>>>0,t,r),u(e>>>0,t,r+4),t}function f(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),h(e>>>0,t,r),h(e/4294967296>>>0,t,r+4),t}t.readInt16BE=function(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])<<16>>16},t.readUint16BE=function(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])>>>0},t.readInt16LE=function(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])<<16>>16},t.readUint16LE=function(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])>>>0},t.writeUint16BE=i,t.writeInt16BE=i,t.writeUint16LE=s,t.writeInt16LE=s,t.readInt32BE=o,t.readUint32BE=a,t.readInt32LE=c,t.readUint32LE=l,t.writeUint32BE=u,t.writeInt32BE=u,t.writeUint32LE=h,t.writeInt32LE=h,t.readInt64BE=function(e,t){void 0===t&&(t=0);var r=o(e,t),n=o(e,t+4);return 4294967296*r+n-4294967296*(n>>31)},t.readUint64BE=function(e,t){return void 0===t&&(t=0),4294967296*a(e,t)+a(e,t+4)},t.readInt64LE=function(e,t){void 0===t&&(t=0);var r=c(e,t);return 4294967296*c(e,t+4)+r-4294967296*(r>>31)},t.readUint64LE=function(e,t){void 0===t&&(t=0);var r=l(e,t);return 4294967296*l(e,t+4)+r},t.writeUint64BE=d,t.writeInt64BE=d,t.writeUint64LE=f,t.writeInt64LE=f,t.readUintBE=function(e,t,r){if(void 0===r&&(r=0),e%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(e/8>t.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=e/8+r-1;s>=r;s--)n+=t[s]*i,i*=256;return n},t.readUintLE=function(e,t,r){if(void 0===r&&(r=0),e%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(e/8>t.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s=i;o--)r[o]=t/s&255,s*=256;return r},t.writeUintLE=function(e,t,r,i){if(void 0===r&&(r=new Uint8Array(e/8)),void 0===i&&(i=0),e%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!n.isSafeInteger(t))throw new Error("writeUintLE value must be an integer");for(var s=1,o=i;o{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(6232),i=r(9116);function s(e,t,r){for(var i=1634760805,s=857760878,o=2036477234,a=1797285236,c=r[3]<<24|r[2]<<16|r[1]<<8|r[0],l=r[7]<<24|r[6]<<16|r[5]<<8|r[4],u=r[11]<<24|r[10]<<16|r[9]<<8|r[8],h=r[15]<<24|r[14]<<16|r[13]<<8|r[12],d=r[19]<<24|r[18]<<16|r[17]<<8|r[16],f=r[23]<<24|r[22]<<16|r[21]<<8|r[20],p=r[27]<<24|r[26]<<16|r[25]<<8|r[24],g=r[31]<<24|r[30]<<16|r[29]<<8|r[28],y=t[3]<<24|t[2]<<16|t[1]<<8|t[0],m=t[7]<<24|t[6]<<16|t[5]<<8|t[4],v=t[11]<<24|t[10]<<16|t[9]<<8|t[8],w=t[15]<<24|t[14]<<16|t[13]<<8|t[12],b=i,E=s,S=o,_=a,I=c,A=l,C=u,T=h,R=d,k=f,P=p,D=g,N=y,O=m,L=v,B=w,x=0;x<20;x+=2)I=(I^=R=R+(N=(N^=b=b+I|0)>>>16|N<<16)|0)>>>20|I<<12,A=(A^=k=k+(O=(O^=E=E+A|0)>>>16|O<<16)|0)>>>20|A<<12,C=(C^=P=P+(L=(L^=S=S+C|0)>>>16|L<<16)|0)>>>20|C<<12,T=(T^=D=D+(B=(B^=_=_+T|0)>>>16|B<<16)|0)>>>20|T<<12,C=(C^=P=P+(L=(L^=S=S+C|0)>>>24|L<<8)|0)>>>25|C<<7,T=(T^=D=D+(B=(B^=_=_+T|0)>>>24|B<<8)|0)>>>25|T<<7,A=(A^=k=k+(O=(O^=E=E+A|0)>>>24|O<<8)|0)>>>25|A<<7,I=(I^=R=R+(N=(N^=b=b+I|0)>>>24|N<<8)|0)>>>25|I<<7,A=(A^=P=P+(B=(B^=b=b+A|0)>>>16|B<<16)|0)>>>20|A<<12,C=(C^=D=D+(N=(N^=E=E+C|0)>>>16|N<<16)|0)>>>20|C<<12,T=(T^=R=R+(O=(O^=S=S+T|0)>>>16|O<<16)|0)>>>20|T<<12,I=(I^=k=k+(L=(L^=_=_+I|0)>>>16|L<<16)|0)>>>20|I<<12,T=(T^=R=R+(O=(O^=S=S+T|0)>>>24|O<<8)|0)>>>25|T<<7,I=(I^=k=k+(L=(L^=_=_+I|0)>>>24|L<<8)|0)>>>25|I<<7,C=(C^=D=D+(N=(N^=E=E+C|0)>>>24|N<<8)|0)>>>25|C<<7,A=(A^=P=P+(B=(B^=b=b+A|0)>>>24|B<<8)|0)>>>25|A<<7;n.writeUint32LE(b+i|0,e,0),n.writeUint32LE(E+s|0,e,4),n.writeUint32LE(S+o|0,e,8),n.writeUint32LE(_+a|0,e,12),n.writeUint32LE(I+c|0,e,16),n.writeUint32LE(A+l|0,e,20),n.writeUint32LE(C+u|0,e,24),n.writeUint32LE(T+h|0,e,28),n.writeUint32LE(R+d|0,e,32),n.writeUint32LE(k+f|0,e,36),n.writeUint32LE(P+p|0,e,40),n.writeUint32LE(D+g|0,e,44),n.writeUint32LE(N+y|0,e,48),n.writeUint32LE(O+m|0,e,52),n.writeUint32LE(L+v|0,e,56),n.writeUint32LE(B+w|0,e,60)}function o(e,t,r,n,o){if(void 0===o&&(o=0),32!==e.length)throw new Error("ChaCha: key size must be 32 bytes");if(n.length>>=8,t++;if(n>0)throw new Error("ChaCha: counter overflow")}t.streamXOR=o,t.stream=function(e,t,r,n){return void 0===n&&(n=0),i.wipe(r),o(e,t,r,r,n)}},3642:(e,t,r)=>{"use strict";var n=r(8284),i=r(5629),s=r(9116),o=r(6232),a=r(8770);t.Cv=32,t.WH=12,t.pg=16;var c=new Uint8Array(16),l=function(){function e(e){if(this.nonceLength=t.WH,this.tagLength=t.pg,e.length!==t.Cv)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(e)}return e.prototype.seal=function(e,t,r,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var o=new Uint8Array(16);o.set(e,o.length-e.length);var a=new Uint8Array(32);n.stream(this._key,o,a,4);var c,l=t.length+this.tagLength;if(i){if(i.length!==l)throw new Error("ChaCha20Poly1305: incorrect destination length");c=i}else c=new Uint8Array(l);return n.streamXOR(this._key,o,t,c,4),this._authenticate(c.subarray(c.length-this.tagLength,c.length),a,c.subarray(0,c.length-this.tagLength),r),s.wipe(o),c},e.prototype.open=function(e,t,r,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(t.length0&&a.update(c.subarray(n.length%16))),a.update(r),r.length%16>0&&a.update(c.subarray(r.length%16));var l=new Uint8Array(8);n&&o.writeUint64LE(n.length,l),a.update(l),o.writeUint64LE(r.length,l),a.update(l);for(var u=a.digest(),h=0;h{"use strict";function r(e,t){if(e.length!==t.length)return 0;for(var r=0,n=0;n>>8}Object.defineProperty(t,"__esModule",{value:!0}),t.select=function(e,t,r){return~(e-1)&t|e-1&r},t.lessOrEqual=function(e,t){return(0|e)-(0|t)-1>>>31&1},t.compare=r,t.equal=function(e,t){return 0!==e.length&&0!==t.length&&0!==r(e,t)}},1412:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isSerializableHash=function(e){return"undefined"!==typeof e.saveState&&"undefined"!==typeof e.restoreState&&"undefined"!==typeof e.cleanSavedState}},2497:(e,t,r)=>{"use strict";var n=r(5499),i=r(9116),s=function(){function e(e,t,r,i){void 0===r&&(r=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=i;var s=n.hmac(this._hash,r,t);this._hmac=new n.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return e.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(0===e)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},e.prototype.expand=function(e){for(var t=new Uint8Array(e),r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1412),i=r(8770),s=r(9116),o=function(){function e(e,t){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var r=new Uint8Array(this.blockSize);t.length>this.blockSize?this._inner.update(t).finish(r).clean():r.set(t);for(var i=0;i{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mul=Math.imul||function(e,t){var r=65535&e,n=65535&t;return r*n+((e>>>16&65535)*n+r*(t>>>16&65535)<<16>>>0)|0},t.add=function(e,t){return e+t|0},t.sub=function(e,t){return e-t|0},t.rotl=function(e,t){return e<>>32-t},t.rotr=function(e,t){return e<<32-t|e>>>t},t.isInteger=Number.isInteger||function(e){return"number"===typeof e&&isFinite(e)&&Math.floor(e)===e},t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(e){return t.isInteger(e)&&e>=-t.MAX_SAFE_INTEGER&&e<=t.MAX_SAFE_INTEGER}},5629:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(8770),i=r(9116);t.DIGEST_LENGTH=16;var s=function(){function e(e){this.digestLength=t.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var r=e[0]|e[1]<<8;this._r[0]=8191&r;var n=e[2]|e[3]<<8;this._r[1]=8191&(r>>>13|n<<3);var i=e[4]|e[5]<<8;this._r[2]=7939&(n>>>10|i<<6);var s=e[6]|e[7]<<8;this._r[3]=8191&(i>>>7|s<<9);var o=e[8]|e[9]<<8;this._r[4]=255&(s>>>4|o<<12),this._r[5]=o>>>1&8190;var a=e[10]|e[11]<<8;this._r[6]=8191&(o>>>14|a<<2);var c=e[12]|e[13]<<8;this._r[7]=8065&(a>>>11|c<<5);var l=e[14]|e[15]<<8;this._r[8]=8191&(c>>>8|l<<8),this._r[9]=l>>>5&127,this._pad[0]=e[16]|e[17]<<8,this._pad[1]=e[18]|e[19]<<8,this._pad[2]=e[20]|e[21]<<8,this._pad[3]=e[22]|e[23]<<8,this._pad[4]=e[24]|e[25]<<8,this._pad[5]=e[26]|e[27]<<8,this._pad[6]=e[28]|e[29]<<8,this._pad[7]=e[30]|e[31]<<8}return e.prototype._blocks=function(e,t,r){for(var n=this._fin?0:2048,i=this._h[0],s=this._h[1],o=this._h[2],a=this._h[3],c=this._h[4],l=this._h[5],u=this._h[6],h=this._h[7],d=this._h[8],f=this._h[9],p=this._r[0],g=this._r[1],y=this._r[2],m=this._r[3],v=this._r[4],w=this._r[5],b=this._r[6],E=this._r[7],S=this._r[8],_=this._r[9];r>=16;){var I=e[t+0]|e[t+1]<<8;i+=8191&I;var A=e[t+2]|e[t+3]<<8;s+=8191&(I>>>13|A<<3);var C=e[t+4]|e[t+5]<<8;o+=8191&(A>>>10|C<<6);var T=e[t+6]|e[t+7]<<8;a+=8191&(C>>>7|T<<9);var R=e[t+8]|e[t+9]<<8;c+=8191&(T>>>4|R<<12),l+=R>>>1&8191;var k=e[t+10]|e[t+11]<<8;u+=8191&(R>>>14|k<<2);var P=e[t+12]|e[t+13]<<8;h+=8191&(k>>>11|P<<5);var D=e[t+14]|e[t+15]<<8,N=0,O=N;O+=i*p,O+=s*(5*_),O+=o*(5*S),O+=a*(5*E),N=(O+=c*(5*b))>>>13,O&=8191,O+=l*(5*w),O+=u*(5*v),O+=h*(5*m),O+=(d+=8191&(P>>>8|D<<8))*(5*y);var L=N+=(O+=(f+=D>>>5|n)*(5*g))>>>13;L+=i*g,L+=s*p,L+=o*(5*_),L+=a*(5*S),N=(L+=c*(5*E))>>>13,L&=8191,L+=l*(5*b),L+=u*(5*w),L+=h*(5*v),L+=d*(5*m),N+=(L+=f*(5*y))>>>13,L&=8191;var B=N;B+=i*y,B+=s*g,B+=o*p,B+=a*(5*_),N=(B+=c*(5*S))>>>13,B&=8191,B+=l*(5*E),B+=u*(5*b),B+=h*(5*w),B+=d*(5*v);var x=N+=(B+=f*(5*m))>>>13;x+=i*m,x+=s*y,x+=o*g,x+=a*p,N=(x+=c*(5*_))>>>13,x&=8191,x+=l*(5*S),x+=u*(5*E),x+=h*(5*b),x+=d*(5*w);var M=N+=(x+=f*(5*v))>>>13;M+=i*v,M+=s*m,M+=o*y,M+=a*g,N=(M+=c*p)>>>13,M&=8191,M+=l*(5*_),M+=u*(5*S),M+=h*(5*E),M+=d*(5*b);var U=N+=(M+=f*(5*w))>>>13;U+=i*w,U+=s*v,U+=o*m,U+=a*y,N=(U+=c*g)>>>13,U&=8191,U+=l*p,U+=u*(5*_),U+=h*(5*S),U+=d*(5*E);var F=N+=(U+=f*(5*b))>>>13;F+=i*b,F+=s*w,F+=o*v,F+=a*m,N=(F+=c*y)>>>13,F&=8191,F+=l*g,F+=u*p,F+=h*(5*_),F+=d*(5*S);var V=N+=(F+=f*(5*E))>>>13;V+=i*E,V+=s*b,V+=o*w,V+=a*v,N=(V+=c*m)>>>13,V&=8191,V+=l*y,V+=u*g,V+=h*p,V+=d*(5*_);var K=N+=(V+=f*(5*S))>>>13;K+=i*S,K+=s*E,K+=o*b,K+=a*w,N=(K+=c*v)>>>13,K&=8191,K+=l*m,K+=u*y,K+=h*g,K+=d*p;var j=N+=(K+=f*(5*_))>>>13;j+=i*_,j+=s*S,j+=o*E,j+=a*b,N=(j+=c*w)>>>13,j&=8191,j+=l*v,j+=u*m,j+=h*y,j+=d*g,i=O=8191&(N=(N=((N+=(j+=f*p)>>>13)<<2)+N|0)+(O&=8191)|0),s=L+=N>>>=13,o=B&=8191,a=x&=8191,c=M&=8191,l=U&=8191,u=F&=8191,h=V&=8191,d=K&=8191,f=j&=8191,t+=16,r-=16}this._h[0]=i,this._h[1]=s,this._h[2]=o,this._h[3]=a,this._h[4]=c,this._h[5]=l,this._h[6]=u,this._h[7]=h,this._h[8]=d,this._h[9]=f},e.prototype.finish=function(e,t){void 0===t&&(t=0);var r,n,i,s,o=new Uint16Array(10);if(this._leftover){for(s=this._leftover,this._buffer[s++]=1;s<16;s++)this._buffer[s]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(r=this._h[1]>>>13,this._h[1]&=8191,s=2;s<10;s++)this._h[s]+=r,r=this._h[s]>>>13,this._h[s]&=8191;for(this._h[0]+=5*r,r=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=r,r=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=r,o[0]=this._h[0]+5,r=o[0]>>>13,o[0]&=8191,s=1;s<10;s++)o[s]=this._h[s]+r,r=o[s]>>>13,o[s]&=8191;for(o[9]-=8192,n=(1^r)-1,s=0;s<10;s++)o[s]&=n;for(n=~n,s=0;s<10;s++)this._h[s]=this._h[s]&n|o[s];for(this._h[0]=65535&(this._h[0]|this._h[1]<<13),this._h[1]=65535&(this._h[1]>>>3|this._h[2]<<10),this._h[2]=65535&(this._h[2]>>>6|this._h[3]<<7),this._h[3]=65535&(this._h[3]>>>9|this._h[4]<<4),this._h[4]=65535&(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14),this._h[5]=65535&(this._h[6]>>>2|this._h[7]<<11),this._h[6]=65535&(this._h[7]>>>5|this._h[8]<<8),this._h[7]=65535&(this._h[8]>>>8|this._h[9]<<5),i=this._h[0]+this._pad[0],this._h[0]=65535&i,s=1;s<8;s++)i=(this._h[s]+this._pad[s]|0)+(i>>>16)|0,this._h[s]=65535&i;return e[t+0]=this._h[0]>>>0,e[t+1]=this._h[0]>>>8,e[t+2]=this._h[1]>>>0,e[t+3]=this._h[1]>>>8,e[t+4]=this._h[2]>>>0,e[t+5]=this._h[2]>>>8,e[t+6]=this._h[3]>>>0,e[t+7]=this._h[3]>>>8,e[t+8]=this._h[4]>>>0,e[t+9]=this._h[4]>>>8,e[t+10]=this._h[5]>>>0,e[t+11]=this._h[5]>>>8,e[t+12]=this._h[6]>>>0,e[t+13]=this._h[6]>>>8,e[t+14]=this._h[7]>>>0,e[t+15]=this._h[7]>>>8,this._finished=!0,this},e.prototype.update=function(e){var t,r=0,n=e.length;if(this._leftover){(t=16-this._leftover)>n&&(t=n);for(var i=0;i=16&&(t=n-n%16,this._blocks(e,r,t),r+=t,n-=t),n){for(i=0;i{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.randomStringForEntropy=t.randomString=t.randomUint32=t.randomBytes=t.defaultRandomSource=void 0;const n=r(933),i=r(6232),s=r(9116);function o(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.defaultRandomSource;return r.randomBytes(e)}t.defaultRandomSource=new n.SystemRandomSource,t.randomBytes=o,t.randomUint32=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.defaultRandomSource;const r=o(4,e),n=(0,i.readUint32LE)(r);return(0,s.wipe)(r),n};const a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function c(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.defaultRandomSource;if(r.length<2)throw new Error("randomString charset is too short");if(r.length>256)throw new Error("randomString charset is too long");let i="";const c=r.length,l=256-256%c;for(;e>0;){const t=o(Math.ceil(256*e/l),n);for(let n=0;n0;n++){const s=t[n];s1&&void 0!==arguments[1]?arguments[1]:a,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.defaultRandomSource;const i=Math.ceil(e/(Math.log(r.length)/Math.LN2));return c(i,r,n)}},8136:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BrowserRandomSource=void 0;t.BrowserRandomSource=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e="undefined"!==typeof self?self.crypto||self.msCrypto:null;e&&void 0!==e.getRandomValues&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const t=new Uint8Array(e);for(let r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeRandomSource=void 0;const n=r(9116);t.NodeRandomSource=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;{const e=r(5883);e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let t=this._crypto.randomBytes(e);if(t.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");const r=new Uint8Array(e);for(let n=0;n{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SystemRandomSource=void 0;const n=r(8136),i=r(8188);t.SystemRandomSource=class{constructor(){return this.isAvailable=!1,this.name="",this._source=new n.BrowserRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Browser")):(this._source=new i.NodeRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Node")):void 0)}randomBytes(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)}}},4888:(e,t,r)=>{"use strict";var n=r(6232),i=r(9116);t.k=32,t.cn=64;var s=function(){function e(){this.digestLength=t.k,this.blockSize=t.cn,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return e.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},e.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},e.prototype.clean=function(){i.wipe(this._buffer),i.wipe(this._temp),this.reset()},e.prototype.update=function(e,t){if(void 0===t&&(t=e.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var r=0;if(this._bytesHashed+=t,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[r++],t--;this._bufferLength===this.blockSize&&(a(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(t>=this.blockSize&&(r=a(this._temp,this._state,e,r,t),t%=this.blockSize);t>0;)this._buffer[this._bufferLength++]=e[r++],t--;return this},e.prototype.finish=function(e){if(!this._finished){var t=this._bytesHashed,r=this._bufferLength,i=t/536870912|0,s=t<<3,o=t%64<56?64:128;this._buffer[r]=128;for(var c=r+1;c0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},e.prototype.restoreState=function(e){return this._state.set(e.state),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},e.prototype.cleanSavedState=function(e){i.wipe(e.state),e.buffer&&i.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},e}();t.mE=s;var o=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function a(e,t,r,i,s){for(;s>=64;){for(var a=t[0],c=t[1],l=t[2],u=t[3],h=t[4],d=t[5],f=t[6],p=t[7],g=0;g<16;g++){var y=i+4*g;e[g]=n.readUint32BE(r,y)}for(g=16;g<64;g++){var m=e[g-2],v=(m>>>17|m<<15)^(m>>>19|m<<13)^m>>>10,w=((m=e[g-15])>>>7|m<<25)^(m>>>18|m<<14)^m>>>3;e[g]=(v+e[g-7]|0)+(w+e[g-16]|0)}for(g=0;g<64;g++){v=(((h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7))+(h&d^~h&f)|0)+(p+(o[g]+e[g]|0)|0)|0,w=((a>>>2|a<<30)^(a>>>13|a<<19)^(a>>>22|a<<10))+(a&c^a&l^c&l)|0;p=f,f=d,d=h,h=u+v|0,u=l,l=c,c=a,a=v+w|0}t[0]+=a,t[1]+=c,t[2]+=l,t[3]+=u,t[4]+=h,t[5]+=d,t[6]+=f,t[7]+=p,i+=64,s-=64}return i}t.vp=function(e){var t=new s;t.update(e);var r=t.digest();return t.clean(),r}},9116:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.wipe=function(e){for(var t=0;t{"use strict";t.gi=t.Au=t._w=t.KS=t.kz=void 0;const n=r(6271),i=r(9116);function s(e){const t=new Float64Array(16);if(e)for(let r=0;r=0;--s){const e=r[s>>>3]>>>(7&s)&1;l(i,o,e),l(p,g,e),u(y,i,p),h(i,i,p),u(p,o,g),h(o,o,g),f(g,y),f(m,i),d(i,p,i),d(p,o,y),u(y,i,p),h(i,i,p),f(o,i),h(p,g,m),d(i,p,a),u(i,i,g),d(p,p,i),d(i,g,m),d(g,o,n),f(o,y),l(i,o,e),l(p,g,e)}for(let s=0;s<16;s++)n[s+16]=i[s],n[s+32]=p[s],n[s+48]=o[s],n[s+64]=g[s];const v=n.subarray(32),w=n.subarray(16);!function(e,t){const r=s();for(let n=0;n<16;n++)r[n]=t[n];for(let n=253;n>=0;n--)f(r,r),2!==n&&4!==n&&d(r,r,t);for(let n=0;n<16;n++)e[n]=r[n]}(v,v),d(w,w,v);const b=new Uint8Array(32);return function(e,t){const r=s(),n=s();for(let i=0;i<16;i++)n[i]=t[i];c(n),c(n),c(n);for(let i=0;i<2;i++){r[0]=n[0]-65517;for(let t=1;t<15;t++)r[t]=n[t]-65535-(r[t-1]>>16&1),r[t-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);const e=r[15]>>16&1;r[14]&=65535,l(n,r,1-e)}for(let i=0;i<16;i++)e[2*i]=255&n[i],e[2*i+1]=n[i]>>8}(b,w),b}function g(e){return p(e,o)}function y(e){if(e.length!==t.KS)throw new Error("x25519: seed must be ".concat(t.KS," bytes"));const r=new Uint8Array(e);return{publicKey:g(r),secretKey:r}}t._w=y,t.Au=function(e){const t=(0,n.randomBytes)(32,e),r=y(t);return(0,i.wipe)(t),r},t.gi=function(e,r){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e.length!==t.kz)throw new Error("X25519: incorrect secret key length");if(r.length!==t.kz)throw new Error("X25519: incorrect public key length");const i=p(e,r);if(n){let e=0;for(let t=0;t{function t(e){const t=new globalThis.AbortController;function r(){t.abort();for(const t of e)t&&t.removeEventListener&&t.removeEventListener("abort",r)}for(const n of e)if(n&&n.addEventListener){if(n.aborted){r();break}n.addEventListener("abort",r)}return t.signal}e.exports=t,e.exports.anySignal=t},312:e=>{var t=1e3,r=60*t,n=60*r,i=24*n,s=7*i,o=365.25*i;function a(e,t,r,n){var i=t>=1.5*r;return Math.round(e/r)+" "+n+(i?"s":"")}e.exports=function(e,c){c=c||{};var l=typeof e;if("string"===l&&e.length>0)return function(e){if((e=String(e)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!a)return;var c=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*s;case"days":case"day":case"d":return c*i;case"hours":case"hour":case"hrs":case"hr":case"h":return c*n;case"minutes":case"minute":case"mins":case"min":case"m":return c*r;case"seconds":case"second":case"secs":case"sec":case"s":return c*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(e);if("number"===l&&isFinite(e))return c.long?function(e){var s=Math.abs(e);if(s>=i)return a(e,s,i,"day");if(s>=n)return a(e,s,n,"hour");if(s>=r)return a(e,s,r,"minute");if(s>=t)return a(e,s,t,"second");return e+" ms"}(e):function(e){var s=Math.abs(e);if(s>=i)return Math.round(e/i)+"d";if(s>=n)return Math.round(e/n)+"h";if(s>=r)return Math.round(e/r)+"m";if(s>=t)return Math.round(e/t)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},8392:(e,t,r)=>{t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,i=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(n++,"%c"===e&&(i=n))})),t.splice(i,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(r){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(r){}!e&&"undefined"!==typeof process&&"env"in process&&(e={NODE_ENV:"production",PUBLIC_URL:"/relay-reactjs-chat",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0}.DEBUG);return e},t.useColors=function(){if("undefined"!==typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!==typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!==typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!==typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!==typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!==typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=r(8472)(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}},8472:(e,t,r)=>{e.exports=function(e){function t(e){let r,i,s,o=null;function a(){for(var e=arguments.length,n=new Array(e),i=0;i{if("%%"===e)return"%";l++;const i=t.formatters[r];if("function"===typeof i){const t=n[l];e=i.call(s,t),n.splice(l,1),l--}return e})),t.formatArgs.call(s,n);const u=s.log||t.log;u.apply(s,n)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=n,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(i!==t.namespaces&&(i=t.namespaces,s=t.enabled(e)),s),set:e=>{o=e}}),"function"===typeof t.init&&t.init(a),a}function n(e,r){const n=t(this.namespace+("undefined"===typeof r?":":r)+e);return n.log=this.log,n}function i(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(i),...t.skips.map(i).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"===typeof e?e:"").split(/[\s,]+/),i=n.length;for(r=0;r{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t{"use strict";function t(e,t){t=t||{};this._head=0,this._tail=0,this._capacity=t.capacity,this._capacityMask=3,this._list=new Array(4),Array.isArray(e)&&this._fromArray(e)}t.prototype.peekAt=function(e){var t=e;if(t===(0|t)){var r=this.size();if(!(t>=r||t<-r))return t<0&&(t+=r),t=this._head+t&this._capacityMask,this._list[t]}},t.prototype.get=function(e){return this.peekAt(e)},t.prototype.peek=function(){if(this._head!==this._tail)return this._list[this._head]},t.prototype.peekFront=function(){return this.peek()},t.prototype.peekBack=function(){return this.peekAt(-1)},Object.defineProperty(t.prototype,"length",{get:function(){return this.size()}}),t.prototype.size=function(){return this._head===this._tail?0:this._headthis._capacity&&this.pop(),this._head1e4&&this._tail<=this._list.length>>>2&&this._shrinkArray(),t}},t.prototype.push=function(e){if(void 0===e)return this.size();var t=this._tail;return this._list[t]=e,this._tail=t+1&this._capacityMask,this._tail===this._head&&this._growArray(),this._capacity&&this.size()>this._capacity&&this.shift(),this._head1e4&&e<=t>>>2&&this._shrinkArray(),r}},t.prototype.removeOne=function(e){var t=e;if(t===(0|t)&&this._head!==this._tail){var r=this.size(),n=this._list.length;if(!(t>=r||t<-r)){t<0&&(t+=r),t=this._head+t&this._capacityMask;var i,s=this._list[t];if(e0;i--)this._list[t]=this._list[t=t-1+n&this._capacityMask];this._list[t]=void 0,this._head=this._head+1+n&this._capacityMask}else{for(i=r-1-e;i>0;i--)this._list[t]=this._list[t=t+1+n&this._capacityMask];this._list[t]=void 0,this._tail=this._tail-1+n&this._capacityMask}return s}}},t.prototype.remove=function(e,t){var r,n=e,i=t;if(n===(0|n)&&this._head!==this._tail){var s=this.size(),o=this._list.length;if(!(n>=s||n<-s||t<1)){if(n<0&&(n+=s),1===t||!t)return(r=new Array(1))[0]=this.removeOne(n),r;if(0===n&&n+t>=s)return r=this.toArray(),this.clear(),r;var a;for(n+t>s&&(t=s-n),r=new Array(t),a=0;a0;a--)this._list[n=n+1+o&this._capacityMask]=void 0;return r}if(0===e){for(this._head=this._head+t+o&this._capacityMask,a=t-1;a>0;a--)this._list[n=n+1+o&this._capacityMask]=void 0;return r}if(n0;a--)this.unshift(this._list[n=n-1+o&this._capacityMask]);for(n=this._head-1+o&this._capacityMask;i>0;)this._list[n=n-1+o&this._capacityMask]=void 0,i--;e<0&&(this._tail=n)}else{for(this._tail=n,n=n+t+o&this._capacityMask,a=s-(t+e);a>0;a--)this.push(this._list[n++]);for(n=this._tail;i>0;)this._list[n=n+1+o&this._capacityMask]=void 0,i--}return this._head<2&&this._tail>1e4&&this._tail<=o>>>2&&this._shrinkArray(),r}}},t.prototype.splice=function(e,t){var r=e;if(r===(0|r)){var n=this.size();if(r<0&&(r+=n),!(r>n)){if(arguments.length>2){var i,s,o,a=arguments.length,c=this._list.length,l=2;if(!n||r0&&(this._head=this._head+r+c&this._capacityMask)):(o=this.remove(r,t),this._head=this._head+r+c&this._capacityMask);a>l;)this.unshift(arguments[--a]);for(i=r;i>0;i--)this.unshift(s[i-1])}else{var u=(s=new Array(n-(r+t))).length;for(i=0;ithis._tail){for(t=this._head;t>>=1,this._capacityMask>>>=1},e.exports=t},7963:e=>{"use strict";function t(e,t){for(const r in t)Object.defineProperty(e,r,{value:t[r],enumerable:!0,configurable:!0});return e}e.exports=function(e,r,n){if(!e||"string"===typeof e)throw new TypeError("Please pass an Error to err-code");n||(n={}),"object"===typeof r&&(n=r,r=""),r&&(n.code=r);try{return t(e,n)}catch(i){n.message=e.message,n.stack=e.stack;const r=function(){};r.prototype=Object.create(Object.getPrototypeOf(e));return t(new r,n)}}},3634:(e,t,r)=>{"use strict";const n=r(5413);t.zN=n.EventIterator,n.EventIterator},5413:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class r{constructor(){this.pullQueue=[],this.pushQueue=[],this.eventHandlers={},this.isPaused=!1,this.isStopped=!1}push(e){if(this.isStopped)return;const t={value:e,done:!1};if(this.pullQueue.length){const e=this.pullQueue.shift();e&&e.resolve(t)}else this.pushQueue.push(Promise.resolve(t)),void 0!==this.highWaterMark&&this.pushQueue.length>=this.highWaterMark&&!this.isPaused&&(this.isPaused=!0,this.eventHandlers.highWater?this.eventHandlers.highWater():console&&console.warn("EventIterator queue reached ".concat(this.pushQueue.length," items")))}stop(){if(!this.isStopped){this.isStopped=!0,this.remove();for(const e of this.pullQueue)e.resolve({value:void 0,done:!0});this.pullQueue.length=0}}fail(e){if(!this.isStopped)if(this.isStopped=!0,this.remove(),this.pullQueue.length){for(const t of this.pullQueue)t.reject(e);this.pullQueue.length=0}else{const t=Promise.reject(e);t.catch((()=>{})),this.pushQueue.push(t)}}remove(){Promise.resolve().then((()=>{this.removeCallback&&this.removeCallback()}))}[Symbol.asyncIterator](){return{next:e=>{const t=this.pushQueue.shift();return t?(void 0!==this.lowWaterMark&&this.pushQueue.length<=this.lowWaterMark&&this.isPaused&&(this.isPaused=!1,this.eventHandlers.lowWater&&this.eventHandlers.lowWater()),t):this.isStopped?Promise.resolve({value:void 0,done:!0}):new Promise(((e,t)=>{this.pullQueue.push({resolve:e,reject:t})}))},return:()=>(this.isStopped=!0,this.pushQueue.length=0,this.remove(),Promise.resolve({value:void 0,done:!0}))}}}class n{constructor(e){let{highWaterMark:t=100,lowWaterMark:n=1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=new r;i.highWaterMark=t,i.lowWaterMark=n,i.removeCallback=e({push:e=>i.push(e),stop:()=>i.stop(),fail:e=>i.fail(e),on:(e,t)=>{i.eventHandlers[e]=t}})||(()=>{}),this[Symbol.asyncIterator]=()=>i[Symbol.asyncIterator](),Object.freeze(this)}}t.EventIterator=n,t.default=n},7143:e=>{"use strict";var t=Object.prototype.hasOwnProperty,r="~";function n(){}function i(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function s(e,t,n,s,o){if("function"!==typeof n)throw new TypeError("The listener must be a function");var a=new i(n,s||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],a]:e._events[c].push(a):(e._events[c]=a,e._eventsCount++),e}function o(e,t){0===--e._eventsCount?e._events=new n:delete e._events[t]}function a(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),a.prototype.eventNames=function(){var e,n,i=[];if(0===this._eventsCount)return i;for(n in e=this._events)t.call(e,n)&&i.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},a.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,s=n.length,o=new Array(s);i{"use strict";var t,r="object"===typeof Reflect?Reflect:null,n=r&&"function"===typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"===typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var i=Number.isNaN||function(e){return e!==e};function s(){s.init.call(this)}e.exports=s,e.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,s),n(r)}function s(){"function"===typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}g(e,t,s,{once:!0}),"error"!==t&&function(e,t,r){"function"===typeof e.on&&g(e,"error",t,r)}(e,i,{once:!0})}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var o=10;function a(e){if("function"!==typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function l(e,t,r,n){var i,s,o,l;if(a(r),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),s=e._events),o=s[t]),void 0===o)o=s[t]=r,++e._eventsCount;else if("function"===typeof o?o=s[t]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),(i=c(e))>0&&o.length>i&&!o.warned){o.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=o.length,l=u,console&&console.warn&&console.warn(l)}return e}function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=u.bind(n);return i.listener=r,n.wrapFn=i,i}function d(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"===typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=s[e];if(void 0===c)return!1;if("function"===typeof c)n(c,this,t);else{var l=c.length,u=p(c,l);for(r=0;r=0;s--)if(r[s]===t||r[s].listener===t){o=r[s].listener,i=s;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1=0;n--)this.removeListener(e,t[n]);return this},s.prototype.listeners=function(e){return d(this,e,!0)},s.prototype.rawListeners=function(e){return d(this,e,!1)},s.listenerCount=function(e,t){return"function"===typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},s.prototype.listenerCount=f,s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},1167:e=>{e.exports=class{constructor(e){if(!(e>0)||0!==(e-1&e))throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(e),this.mask=e-1,this.top=0,this.btm=0,this.next=null}push(e){return void 0===this.buffer[this.top]&&(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){const e=this.buffer[this.btm];if(void 0!==e)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}peek(){return this.buffer[this.btm]}isEmpty(){return void 0===this.buffer[this.btm]}}},5125:(e,t,r)=>{const n=r(1167);e.exports=class{constructor(e){this.hwm=e||16,this.head=new n(this.hwm),this.tail=this.head}push(e){if(!this.head.push(e)){const t=this.head;this.head=t.next=new n(2*this.head.buffer.length),this.head.push(e)}}shift(){const e=this.tail.shift();if(void 0===e&&this.tail.next){const e=this.tail.next;return this.tail.next=null,this.tail=e,this.tail.shift()}return e}peek(){return this.tail.peek()}isEmpty(){return this.head.isEmpty()}}},4737:e=>{e.exports=function(e){if(!e)throw Error("hashlru must have a max value, of type number, greater than 0");var t=0,r=Object.create(null),n=Object.create(null);function i(i,s){r[i]=s,++t>=e&&(t=0,n=r,r=Object.create(null))}return{has:function(e){return void 0!==r[e]||void 0!==n[e]},remove:function(e){void 0!==r[e]&&(r[e]=void 0),void 0!==n[e]&&(n[e]=void 0)},get:function(e){var t=r[e];return void 0!==t?t:void 0!==(t=n[e])?(i(e,t),t):void 0},set:function(e,t){void 0!==r[e]?r[e]=t:i(e,t)},clear:function(){r=Object.create(null),n=Object.create(null)}}}},8974:e=>{"use strict";const t="[a-fA-F\\d:]",r=e=>e&&e.includeBoundaries?"(?:(?<=\\s|^)(?=".concat(t,")|(?<=").concat(t,")(?=\\s|$))"):"",n="(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}",i="[a-fA-F\\d]{1,4}",s="\n(?:\n(?:".concat(i,":){7}(?:").concat(i,"|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:").concat(i,":){6}(?:").concat(n,"|:").concat(i,"|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4\n(?:").concat(i,":){5}(?::").concat(n,"|(?::").concat(i,"){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4\n(?:").concat(i,":){4}(?:(?::").concat(i,"){0,1}:").concat(n,"|(?::").concat(i,"){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4\n(?:").concat(i,":){3}(?:(?::").concat(i,"){0,2}:").concat(n,"|(?::").concat(i,"){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4\n(?:").concat(i,":){2}(?:(?::").concat(i,"){0,3}:").concat(n,"|(?::").concat(i,"){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:").concat(i,":){1}(?:(?::").concat(i,"){0,4}:").concat(n,"|(?::").concat(i,"){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::(?:(?::").concat(i,"){0,5}:").concat(n,"|(?::").concat(i,"){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1\n").replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),o=new RegExp("(?:^".concat(n,"$)|(?:^").concat(s,"$)")),a=new RegExp("^".concat(n,"$")),c=new RegExp("^".concat(s,"$")),l=e=>e&&e.exact?o:new RegExp("(?:".concat(r(e)).concat(n).concat(r(e),")|(?:").concat(r(e)).concat(s).concat(r(e),")"),"g");l.v4=e=>e&&e.exact?a:new RegExp("".concat(r(e)).concat(n).concat(r(e)),"g"),l.v6=e=>e&&e.exact?c:new RegExp("".concat(r(e)).concat(s).concat(r(e)),"g"),e.exports=l},7201:function(e){!function(t){"use strict";const r="(0?\\d+|0x[a-f0-9]+)",n={fourOctet:new RegExp("^".concat(r,"\\.").concat(r,"\\.").concat(r,"\\.").concat(r,"$"),"i"),threeOctet:new RegExp("^".concat(r,"\\.").concat(r,"\\.").concat(r,"$"),"i"),twoOctet:new RegExp("^".concat(r,"\\.").concat(r,"$"),"i"),longValue:new RegExp("^".concat(r,"$"),"i")},i=new RegExp("^0[0-7]+$","i"),s=new RegExp("^0x[a-f0-9]+$","i"),o="%[0-9a-z]{1,}",a="(?:[0-9a-f]+::?)+",c={zoneIndex:new RegExp(o,"i"),native:new RegExp("^(::)?(".concat(a,")?([0-9a-f]+)?(::)?(").concat(o,")?$"),"i"),deprecatedTransitional:new RegExp("^(?:::)(".concat(r,"\\.").concat(r,"\\.").concat(r,"\\.").concat(r,"(").concat(o,")?)$"),"i"),transitional:new RegExp("^((?:".concat(a,")|(?:::)(?:").concat(a,")?)").concat(r,"\\.").concat(r,"\\.").concat(r,"\\.").concat(r,"(").concat(o,")?$"),"i")};function l(e,t){if(e.indexOf("::")!==e.lastIndexOf("::"))return null;let r,n,i=0,s=-1,o=(e.match(c.zoneIndex)||[])[0];for(o&&(o=o.substring(1),e=e.replace(/%.+$/,""));(s=e.indexOf(":",s+1))>=0;)i++;if("::"===e.substr(0,2)&&i--,"::"===e.substr(-2,2)&&i--,i>t)return null;for(n=t-i,r=":";n--;)r+="0:";return":"===(e=e.replace("::",r))[0]&&(e=e.slice(1)),":"===e[e.length-1]&&(e=e.slice(0,-1)),{parts:t=function(){const t=e.split(":"),r=[];for(let e=0;e0;){if(i=r-n,i<0&&(i=0),e[s]>>i!==t[s]>>i)return!1;n-=r,s+=1}return!0}function h(e){if(s.test(e))return parseInt(e,16);if("0"===e[0]&&!isNaN(parseInt(e[1],10))){if(i.test(e))return parseInt(e,8);throw new Error("ipaddr: cannot parse ".concat(e," as octal"))}return parseInt(e,10)}function d(e,t){for(;e.length=0;n-=1){if(i=this.octets[n],!(i in r))return null;if(s=r[i],t&&0!==s)return null;8!==s&&(t=!0),e+=s}return 32-e},e.prototype.range=function(){return f.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){return this.octets.slice(0)},e.prototype.toIPv4MappedAddress=function(){return f.IPv6.parse("::ffff:".concat(this.toString()))},e.prototype.toNormalizedString=function(){return this.toString()},e.prototype.toString=function(){return this.octets.join(".")},e}(),f.IPv4.broadcastAddressFromCIDR=function(e){try{const t=this.parseCIDR(e),r=t[0].toByteArray(),n=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[];let s=0;for(;s<4;)i.push(parseInt(r[s],10)|255^parseInt(n[s],10)),s++;return new this(i)}catch(t){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},f.IPv4.isIPv4=function(e){return null!==this.parser(e)},f.IPv4.isValid=function(e){try{return new this(this.parser(e)),!0}catch(t){return!1}},f.IPv4.isValidFourPartDecimal=function(e){return!(!f.IPv4.isValid(e)||!e.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},f.IPv4.networkAddressFromCIDR=function(e){let t,r,n,i,s;try{for(t=this.parseCIDR(e),n=t[0].toByteArray(),s=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],r=0;r<4;)i.push(parseInt(n[r],10)&parseInt(s[r],10)),r++;return new this(i)}catch(o){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},f.IPv4.parse=function(e){const t=this.parser(e);if(null===t)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(t)},f.IPv4.parseCIDR=function(e){let t;if(t=e.match(/^(.+)\/(\d+)$/)){const e=parseInt(t[2]);if(e>=0&&e<=32){const r=[this.parse(t[1]),e];return Object.defineProperty(r,"toString",{value:function(){return this.join("/")}}),r}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},f.IPv4.parser=function(e){let t,r,i;if(t=e.match(n.fourOctet))return function(){const e=t.slice(1,6),n=[];for(let t=0;t4294967295||i<0)throw new Error("ipaddr: address outside defined range");return function(){const e=[];let t;for(t=0;t<=24;t+=8)e.push(i>>t&255);return e}().reverse()}return(t=e.match(n.twoOctet))?function(){const e=t.slice(1,4),r=[];if(i=h(e[1]),i>16777215||i<0)throw new Error("ipaddr: address outside defined range");return r.push(h(e[0])),r.push(i>>16&255),r.push(i>>8&255),r.push(255&i),r}():(t=e.match(n.threeOctet))?function(){const e=t.slice(1,5),r=[];if(i=h(e[2]),i>65535||i<0)throw new Error("ipaddr: address outside defined range");return r.push(h(e[0])),r.push(h(e[1])),r.push(i>>8&255),r.push(255&i),r}():null},f.IPv4.subnetMaskFromPrefixLength=function(e){if((e=parseInt(e))<0||e>32)throw new Error("ipaddr: invalid IPv4 prefix length");const t=[0,0,0,0];let r=0;const n=Math.floor(e/8);for(;r=0;s-=1){if(n=this.parts[s],!(n in r))return null;if(i=r[n],t&&0!==i)return null;16!==i&&(t=!0),e+=i}return 128-e},e.prototype.range=function(){return f.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){let e;const t=[],r=this.parts;for(let n=0;n>8),t.push(255&e);return t},e.prototype.toFixedLengthString=function(){const e=function(){const e=[];for(let t=0;t>8,255&t,r>>8,255&r])},e.prototype.toNormalizedString=function(){const e=function(){const e=[];for(let t=0;ti&&(n=r.index,i=r[0].length);return i<0?t:"".concat(t.substring(0,n),"::").concat(t.substring(n+i))},e.prototype.toString=function(){return this.toNormalizedString().replace(/((^|:)(0(:|$))+)/,"::")},e}(),f.IPv6.broadcastAddressFromCIDR=function(e){try{const t=this.parseCIDR(e),r=t[0].toByteArray(),n=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[];let s=0;for(;s<16;)i.push(parseInt(r[s],10)|255^parseInt(n[s],10)),s++;return new this(i)}catch(t){throw new Error("ipaddr: the address does not have IPv6 CIDR format (".concat(t,")"))}},f.IPv6.isIPv6=function(e){return null!==this.parser(e)},f.IPv6.isValid=function(e){if("string"===typeof e&&-1===e.indexOf(":"))return!1;try{const t=this.parser(e);return new this(t.parts,t.zoneId),!0}catch(t){return!1}},f.IPv6.networkAddressFromCIDR=function(e){let t,r,n,i,s;try{for(t=this.parseCIDR(e),n=t[0].toByteArray(),s=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],r=0;r<16;)i.push(parseInt(n[r],10)&parseInt(s[r],10)),r++;return new this(i)}catch(o){throw new Error("ipaddr: the address does not have IPv6 CIDR format (".concat(o,")"))}},f.IPv6.parse=function(e){const t=this.parser(e);if(null===t.parts)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(t.parts,t.zoneId)},f.IPv6.parseCIDR=function(e){let t,r,n;if((r=e.match(/^(.+)\/(\d+)$/))&&(t=parseInt(r[2]),t>=0&&t<=128))return n=[this.parse(r[1]),t],Object.defineProperty(n,"toString",{value:function(){return this.join("/")}}),n;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},f.IPv6.parser=function(e){let t,r,n,i,s,o;if(n=e.match(c.deprecatedTransitional))return this.parser("::ffff:".concat(n[1]));if(c.native.test(e))return l(e,8);if((n=e.match(c.transitional))&&(o=n[6]||"",t=l(n[1].slice(0,-1)+o,6),t.parts)){for(s=[parseInt(n[2]),parseInt(n[3]),parseInt(n[4]),parseInt(n[5])],r=0;r128)throw new Error("ipaddr: invalid IPv6 prefix length");const t=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let r=0;const n=Math.floor(e/8);for(;r{e.exports=function(){return"undefined"!==typeof window&&"object"===typeof window.process&&"renderer"===window.process.type||(!("undefined"===typeof process||"object"!==typeof process.versions||!process.versions.electron)||"object"===typeof navigator&&"string"===typeof navigator.userAgent&&navigator.userAgent.indexOf("Electron")>=0)}},2795:(e,t,r)=>{"use strict";const n=r(8974),i=e=>n({exact:!0}).test(e);i.v4=e=>n.v4({exact:!0}).test(e),i.v6=e=>n.v6({exact:!0}).test(e),i.version=e=>i(e)?i.v4(e)?4:6:void 0,e.exports=i},887:e=>{"use strict";e.exports=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}},6791:(e,t,r)=>{"use strict";const{URLWithLegacySupport:n,format:i,URLSearchParams:s,defaultBase:o}=r(5732),a=r(9640);e.exports={URL:n,URLSearchParams:s,format:i,relative:a,defaultBase:o}},9640:(e,t,r)=>{"use strict";const{URLWithLegacySupport:n,format:i}=r(5732);e.exports=function(e){let t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3?arguments[3]:void 0,a=r.protocol?r.protocol.replace(":",""):"http";a=(s[a]||o||a)+":";try{t=new n(e)}catch(l){t={}}const c=Object.assign({},r,{protocol:a||t.protocol,host:r.host||t.host});return new n(e,i(c)).toString()}},5732:e=>{"use strict";const t="undefined"!==typeof navigator&&"ReactNative"===navigator.product;const r=self.URL,n=t?"http://localhost":self.location?self.location.protocol+"//"+self.location.host:"";e.exports={URLWithLegacySupport:class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;this.super=new r(e,t),this.path=this.pathname+this.search,this.auth=this.username&&this.password?this.username+":"+this.password:null,this.query=this.search&&this.search.startsWith("?")?this.search.slice(1):null}get hash(){return this.super.hash}get host(){return this.super.host}get hostname(){return this.super.hostname}get href(){return this.super.href}get origin(){return this.super.origin}get password(){return this.super.password}get pathname(){return this.super.pathname}get port(){return this.super.port}get protocol(){return this.super.protocol}get search(){return this.super.search}get searchParams(){return this.super.searchParams}get username(){return this.super.username}set hash(e){this.super.hash=e}set host(e){this.super.host=e}set hostname(e){this.super.hostname=e}set href(e){this.super.href=e}set password(e){this.super.password=e}set pathname(e){this.super.pathname=e}set port(e){this.super.port=e}set protocol(e){this.super.protocol=e}set search(e){this.super.search=e}set username(e){this.super.username=e}static createObjectURL(e){return r.createObjectURL(e)}static revokeObjectURL(e){r.revokeObjectURL(e)}toJSON(){return this.super.toJSON()}toString(){return this.super.toString()}format(){return this.toString()}},URLSearchParams:self.URLSearchParams,defaultBase:n,format:function(e){if("string"===typeof e){return new r(e).toString()}if(!(e instanceof r)){const t=e.username&&e.password?"".concat(e.username,":").concat(e.password,"@"):"",r=e.auth?e.auth+"@":"",n=e.port?":"+e.port:"",i=e.protocol?e.protocol+"//":"",s=e.host||"",o=e.hostname||"",a=e.search||(e.query?"?"+e.query:""),c=e.hash||"",l=e.pathname||"",u=e.path||l+a;return"".concat(i).concat(t||r).concat(s||o+n).concat(u).concat(c)}}}},464:e=>{"use strict";e.exports=async e=>{const t=[];for await(const r of e)t.push(r);return t}},9272:e=>{"use strict";e.exports=async e=>{for await(const t of e);}},2393:e=>{"use strict";e.exports=async function*(e,t){for await(const r of e)await t(r)&&(yield r)}},4744:e=>{"use strict";e.exports=async e=>{for await(const t of e)return t}},1309:e=>{"use strict";e.exports=async function*(e,t){for await(const r of e)await t(r),yield r}},7889:e=>{"use strict";e.exports=async function*(e,t){for await(const r of e)yield t(r)}},6155:(e,t,r)=>{"use strict";const n=r(9202);e.exports=async function*(){for(var e=arguments.length,t=new Array(e),r=0;r{try{await Promise.all(t.map((async e=>{for await(const t of e)i.push(t)}))),i.end()}catch(e){i.end(e)}}),0),yield*i}},9202:(e,t,r)=>{const n=r(5125);e.exports=e=>{let t;"function"===typeof(e=e||{})?(t=e,e={}):t=e.onEnd;let r,i,s,o=new n;const a=e=>i?i(e):(o.push(e),r),c=e=>s?r:a({done:!1,value:e}),l=e=>s?r:(s=!0,e?(e=>(o=new n,i?i({error:e}):(o.push({error:e}),r)))(e):a({done:!0}));if(r={[Symbol.asyncIterator](){return this},next:()=>{if(!o.isEmpty()){if(e.writev){let e;const t=[];for(;!o.isEmpty();){if(e=o.shift(),e.error)throw e.error;t.push(e.value)}return{done:e.done,value:t}}const t=o.shift();if(t.error)throw t.error;return t}return s?{done:!0}:new Promise(((t,n)=>{i=s=>(i=null,s.error?n(s.error):e.writev&&!s.done?t({done:s.done,value:[s.value]}):t(s),r)}))},return:()=>(o=new n,l(),{done:!0}),throw:e=>(l(e),{done:!0}),push:c,end:l},!t)return r;const u=r;return r={[Symbol.asyncIterator](){return this},next:()=>u.next(),throw:e=>(u.throw(e),t&&(t(e),t=null),{done:!0}),return:()=>(u.return(),t&&(t(),t=null),{done:!0}),push:c,end:e=>(u.end(e),t&&(t(e),t=null),r)},r}},2035:(e,t,r)=>{"use strict";const n=r(464);e.exports=async function*(e,t){const r=await n(e);yield*r.sort(t)}},5959:e=>{"use strict";e.exports=async function*(e,t){let r=0;if(!(t<1))for await(const n of e)if(yield n,r++,r===t)return}},7898:(e,t,r)=>{var n;!function(){"use strict";var i="input is invalid type",s="object"===typeof window,o=s?window:{};o.JS_SHA3_NO_WINDOW&&(s=!1);var a=!s&&"object"===typeof self;!o.JS_SHA3_NO_NODE_JS&&"object"===typeof process&&process.versions&&process.versions.node?o=r.g:a&&(o=self);var c=!o.JS_SHA3_NO_COMMON_JS&&e.exports,l=r.amdO,u=!o.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!==typeof ArrayBuffer,h="0123456789abcdef".split(""),d=[4,1024,262144,67108864],f=[0,8,16,24],p=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],g=[224,256,384,512],y=[128,256],m=["hex","buffer","arrayBuffer","array","digest"],v={128:168,256:136};!o.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!u||!o.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"===typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var w=function(e,t,r){return function(n){return new L(e,t,e).update(n)[r]()}},b=function(e,t,r){return function(n,i){return new L(e,t,i).update(n)[r]()}},E=function(e,t,r){return function(t,n,i,s){return C["cshake"+e].update(t,n,i,s)[r]()}},S=function(e,t,r){return function(t,n,i,s){return C["kmac"+e].update(t,n,i,s)[r]()}},_=function(e,t,r,n){for(var i=0;i>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function B(e,t,r){L.call(this,e,t,r)}L.prototype.update=function(e){if(this.finalized)throw new Error("finalize already called");var t,r=typeof e;if("string"!==r){if("object"!==r)throw new Error(i);if(null===e)throw new Error(i);if(u&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!Array.isArray(e)&&(!u||!ArrayBuffer.isView(e)))throw new Error(i);t=!0}for(var n,s,o=this.blocks,a=this.byteCount,c=e.length,l=this.blockCount,h=0,d=this.s;h>2]|=e[h]<>2]|=s<>2]|=(192|s>>6)<>2]|=(128|63&s)<=57344?(o[n>>2]|=(224|s>>12)<>2]|=(128|s>>6&63)<>2]|=(128|63&s)<>2]|=(240|s>>18)<>2]|=(128|s>>12&63)<>2]|=(128|s>>6&63)<>2]|=(128|63&s)<=a){for(this.start=n-a,this.block=o[l],n=0;n>=8);r>0;)i.unshift(r),r=255&(e>>=8),++n;return t?i.push(n):i.unshift(n),this.update(i),i.length},L.prototype.encodeString=function(e){var t,r=typeof e;if("string"!==r){if("object"!==r)throw new Error(i);if(null===e)throw new Error(i);if(u&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!Array.isArray(e)&&(!u||!ArrayBuffer.isView(e)))throw new Error(i);t=!0}var n=0,s=e.length;if(t)n=s;else for(var o=0;o=57344?n+=3:(a=65536+((1023&a)<<10|1023&e.charCodeAt(++o)),n+=4)}return n+=this.encode(8*n),this.update(e),n},L.prototype.bytepad=function(e,t){for(var r=this.encode(t),n=0;n>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t>4&15]+h[15&e]+h[e>>12&15]+h[e>>8&15]+h[e>>20&15]+h[e>>16&15]+h[e>>28&15]+h[e>>24&15];o%t===0&&(x(r),s=0)}return i&&(e=r[s],a+=h[e>>4&15]+h[15&e],i>1&&(a+=h[e>>12&15]+h[e>>8&15]),i>2&&(a+=h[e>>20&15]+h[e>>16&15])),a},L.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,s=0,o=0,a=this.outputBits>>3;e=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(a);for(var c=new Uint32Array(e);o>8&255,c[e+2]=t>>16&255,c[e+3]=t>>24&255;a%r===0&&x(n)}return s&&(e=a<<2,t=n[o],c[e]=255&t,s>1&&(c[e+1]=t>>8&255),s>2&&(c[e+2]=t>>16&255)),c},B.prototype=new L,B.prototype.finalize=function(){return this.encode(this.outputBits,!0),L.prototype.finalize.call(this)};var x=function(e){var t,r,n,i,s,o,a,c,l,u,h,d,f,g,y,m,v,w,b,E,S,_,I,A,C,T,R,k,P,D,N,O,L,B,x,M,U,F,V,K,j,z,q,H,G,W,Q,Y,$,X,J,Z,ee,te,re,ne,ie,se,oe,ae,ce,le,ue;for(n=0;n<48;n+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],s=e[1]^e[11]^e[21]^e[31]^e[41],o=e[2]^e[12]^e[22]^e[32]^e[42],a=e[3]^e[13]^e[23]^e[33]^e[43],c=e[4]^e[14]^e[24]^e[34]^e[44],l=e[5]^e[15]^e[25]^e[35]^e[45],u=e[6]^e[16]^e[26]^e[36]^e[46],h=e[7]^e[17]^e[27]^e[37]^e[47],t=(d=e[8]^e[18]^e[28]^e[38]^e[48])^(o<<1|a>>>31),r=(f=e[9]^e[19]^e[29]^e[39]^e[49])^(a<<1|o>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=i^(c<<1|l>>>31),r=s^(l<<1|c>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=o^(u<<1|h>>>31),r=a^(h<<1|u>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=c^(d<<1|f>>>31),r=l^(f<<1|d>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=u^(i<<1|s>>>31),r=h^(s<<1|i>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,g=e[0],y=e[1],W=e[11]<<4|e[10]>>>28,Q=e[10]<<4|e[11]>>>28,k=e[20]<<3|e[21]>>>29,P=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,ce=e[30]<<9|e[31]>>>23,z=e[40]<<18|e[41]>>>14,q=e[41]<<18|e[40]>>>14,B=e[2]<<1|e[3]>>>31,x=e[3]<<1|e[2]>>>31,m=e[13]<<12|e[12]>>>20,v=e[12]<<12|e[13]>>>20,Y=e[22]<<10|e[23]>>>22,$=e[23]<<10|e[22]>>>22,D=e[33]<<13|e[32]>>>19,N=e[32]<<13|e[33]>>>19,le=e[42]<<2|e[43]>>>30,ue=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,re=e[4]<<30|e[5]>>>2,M=e[14]<<6|e[15]>>>26,U=e[15]<<6|e[14]>>>26,w=e[25]<<11|e[24]>>>21,b=e[24]<<11|e[25]>>>21,X=e[34]<<15|e[35]>>>17,J=e[35]<<15|e[34]>>>17,O=e[45]<<29|e[44]>>>3,L=e[44]<<29|e[45]>>>3,A=e[6]<<28|e[7]>>>4,C=e[7]<<28|e[6]>>>4,ne=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,F=e[26]<<25|e[27]>>>7,V=e[27]<<25|e[26]>>>7,E=e[36]<<21|e[37]>>>11,S=e[37]<<21|e[36]>>>11,Z=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,H=e[8]<<27|e[9]>>>5,G=e[9]<<27|e[8]>>>5,T=e[18]<<20|e[19]>>>12,R=e[19]<<20|e[18]>>>12,se=e[29]<<7|e[28]>>>25,oe=e[28]<<7|e[29]>>>25,K=e[38]<<8|e[39]>>>24,j=e[39]<<8|e[38]>>>24,_=e[48]<<14|e[49]>>>18,I=e[49]<<14|e[48]>>>18,e[0]=g^~m&w,e[1]=y^~v&b,e[10]=A^~T&k,e[11]=C^~R&P,e[20]=B^~M&F,e[21]=x^~U&V,e[30]=H^~W&Y,e[31]=G^~Q&$,e[40]=te^~ne&se,e[41]=re^~ie&oe,e[2]=m^~w&E,e[3]=v^~b&S,e[12]=T^~k&D,e[13]=R^~P&N,e[22]=M^~F&K,e[23]=U^~V&j,e[32]=W^~Y&X,e[33]=Q^~$&J,e[42]=ne^~se&ae,e[43]=ie^~oe&ce,e[4]=w^~E&_,e[5]=b^~S&I,e[14]=k^~D&O,e[15]=P^~N&L,e[24]=F^~K&z,e[25]=V^~j&q,e[34]=Y^~X&Z,e[35]=$^~J&ee,e[44]=se^~ae&le,e[45]=oe^~ce&ue,e[6]=E^~_&g,e[7]=S^~I&y,e[16]=D^~O&A,e[17]=N^~L&C,e[26]=K^~z&B,e[27]=j^~q&x,e[36]=X^~Z&H,e[37]=J^~ee&G,e[46]=ae^~le&te,e[47]=ce^~ue&re,e[8]=_^~g&m,e[9]=I^~y&v,e[18]=O^~A&T,e[19]=L^~C&R,e[28]=z^~B&M,e[29]=q^~x&U,e[38]=Z^~H&W,e[39]=ee^~G&Q,e[48]=le^~te&ne,e[49]=ue^~re&ie,e[0]^=p[n],e[1]^=p[n+1]};if(c)e.exports=C;else{for(R=0;RObject.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0}),a=this,c={concatArrays:!1,ignoreUndefined:!1},l=e=>{const t=[];for(const r in e)i.call(e,r)&&t.push(r);if(Object.getOwnPropertySymbols){const r=Object.getOwnPropertySymbols(e);for(const n of r)s.call(e,n)&&t.push(n)}return t};function u(e){return Array.isArray(e)?function(e){const t=e.slice(0,0);return l(e).forEach((r=>{o(t,r,u(e[r]))})),t}(e):n(e)?function(e){const t=null===Object.getPrototypeOf(e)?Object.create(null):{};return l(e).forEach((r=>{o(t,r,u(e[r]))})),t}(e):e}const h=(e,t,r,n)=>(r.forEach((r=>{"undefined"===typeof t[r]&&n.ignoreUndefined||(r in e&&e[r]!==Object.getPrototypeOf(e)?o(e,r,d(e[r],t[r],n)):o(e,r,u(t[r])))})),e);function d(e,t,r){return r.concatArrays&&Array.isArray(e)&&Array.isArray(t)?((e,t,r)=>{let n=e.slice(0,0),s=0;return[e,t].forEach((t=>{const a=[];for(let r=0;r!a.includes(e))),r)})),n})(e,t,r):n(t)&&n(e)?h(e,t,l(t),r):u(t)}e.exports=function(){const e=d(u(c),this!==a&&this||{},c);let t={_:{}};for(var r=arguments.length,i=new Array(r),s=0;s{var t=1e3,r=60*t,n=60*r,i=24*n,s=7*i,o=365.25*i;function a(e,t,r,n){var i=t>=1.5*r;return Math.round(e/r)+" "+n+(i?"s":"")}e.exports=function(e,c){c=c||{};var l=typeof e;if("string"===l&&e.length>0)return function(e){if((e=String(e)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!a)return;var c=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*s;case"days":case"day":case"d":return c*i;case"hours":case"hour":case"hrs":case"hr":case"h":return c*n;case"minutes":case"minute":case"mins":case"min":case"m":return c*r;case"seconds":case"second":case"secs":case"sec":case"s":return c*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(e);if("number"===l&&isFinite(e))return c.long?function(e){var s=Math.abs(e);if(s>=i)return a(e,s,i,"day");if(s>=n)return a(e,s,n,"hour");if(s>=r)return a(e,s,r,"minute");if(s>=t)return a(e,s,t,"second");return e+" ms"}(e):function(e){var s=Math.abs(e);if(s>=i)return Math.round(e/i)+"d";if(s>=n)return Math.round(e/n)+"h";if(s>=r)return Math.round(e/r)+"m";if(s>=t)return Math.round(e/t)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},486:e=>{"use strict";function t(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t>>24,(e&255<<16)>>>16,(65280&e)>>>8,255&e].join(".")},a=function(e){var t,n,i,s,o,a;for(t=[],i=s=0;s<=3&&0!==e.length;i=++s){if(i>0){if("."!==e[0])throw new Error("Invalid IP");e=e.substring(1)}o=(a=r(e))[0],n=a[1],e=e.substring(n),t.push(o)}if(0!==e.length)throw new Error("Invalid IP");switch(t.length){case 1:if(t[0]>4294967295)throw new Error("Invalid IP");return t[0]>>>0;case 2:if(t[0]>255||t[1]>16777215)throw new Error("Invalid IP");return(t[0]<<24|t[1])>>>0;case 3:if(t[0]>255||t[1]>255||t[2]>65535)throw new Error("Invalid IP");return(t[0]<<24|t[1]<<16|t[2])>>>0;case 4:if(t[0]>255||t[1]>255||t[2]>255||t[3]>255)throw new Error("Invalid IP");return(t[0]<<24|t[1]<<16|t[2]<<8|t[3])>>>0;default:throw new Error("Invalid IP")}},i=(n=function(e){return e.charCodeAt(0)})("0"),o=n("a"),s=n("A"),r=function(e){var t,r,a,c,l;for(c=0,t=10,r="9",a=0,e.length>1&&"0"===e[a]&&("x"===e[a+1]||"X"===e[a+1]?(a+=2,t=16):"0"<=e[a+1]&&e[a+1]<="9"&&(a++,t=8,r="7")),l=a;a>>0;else{if(16!==t)break;if("a"<=e[a]&&e[a]<="f")c=c*t+(10+n(e[a])-o)>>>0;else{if(!("A"<=e[a]&&e[a]<="F"))break;c=c*t+(10+n(e[a])-s)>>>0}}if(c>4294967295)throw new Error("too large");a++}if(a===l)throw new Error("empty octet");return[c,a]},e=function(){function e(e,t){var r,n,i;if("string"!==typeof e)throw new Error("Missing `net' parameter");if(t||(i=e.split("/",2),e=i[0],t=i[1]),t||(t=32),"string"===typeof t&&t.indexOf(".")>-1){try{this.maskLong=a(t)}catch(s){throw s,new Error("Invalid mask: "+t)}for(r=n=32;n>=0;r=--n)if(this.maskLong===4294967295<<32-r>>>0){this.bitmask=r;break}}else{if(!t&&0!==t)throw new Error("Invalid mask: empty");this.bitmask=parseInt(t,10),this.maskLong=0,this.bitmask>0&&(this.maskLong=4294967295<<32-this.bitmask>>>0)}try{this.netLong=(a(e)&this.maskLong)>>>0}catch(s){throw s,new Error("Invalid net address: "+e)}if(!(this.bitmask<=32))throw new Error("Invalid mask for ip4: "+t);this.size=Math.pow(2,32-this.bitmask),this.base=c(this.netLong),this.mask=c(this.maskLong),this.hostmask=c(~this.maskLong),this.first=this.bitmask<=30?c(this.netLong+1):this.base,this.last=this.bitmask<=30?c(this.netLong+this.size-2):c(this.netLong+this.size-1),this.broadcast=this.bitmask<=30?c(this.netLong+this.size-1):void 0}return e.prototype.contains=function(t){return"string"===typeof t&&(t.indexOf("/")>0||4!==t.split(".").length)&&(t=new e(t)),t instanceof e?this.contains(t.base)&&this.contains(t.broadcast||t.last):(a(t)&this.maskLong)>>>0===(this.netLong&this.maskLong)>>>0},e.prototype.next=function(t){return null==t&&(t=1),new e(c(this.netLong+this.size*t),this.mask)},e.prototype.forEach=function(e){var t,r,n;for(n=a(this.first),r=a(this.last),t=0;n<=r;)e(c(n),n,t),t++,n++},e.prototype.toString=function(){return this.base+"/"+this.bitmask},e}(),t.ip2long=a,t.long2ip=c,t.Netmask=e}).call(this)},8605:(e,t,r)=>{var n=r(392);function i(e,t){n.cipher.registerAlgorithm(e,(function(){return new n.aes.Algorithm(e,t)}))}r(3397),r(4533),r(3877),e.exports=n.aes=n.aes||{},n.aes.startEncrypting=function(e,t,r,n){var i=p({key:e,output:r,decrypt:!1,mode:n});return i.start(t),i},n.aes.createEncryptionCipher=function(e,t){return p({key:e,output:null,decrypt:!1,mode:t})},n.aes.startDecrypting=function(e,t,r,n){var i=p({key:e,output:r,decrypt:!0,mode:n});return i.start(t),i},n.aes.createDecryptionCipher=function(e,t){return p({key:e,output:null,decrypt:!0,mode:t})},n.aes.Algorithm=function(e,t){u||h();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return f(r._w,e,t,!1)},decrypt:function(e,t){return f(r._w,e,t,!0)}}}),r._init=!1},n.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t,r=e.key;if("string"!==typeof r||16!==r.length&&24!==r.length&&32!==r.length){if(n.util.isArray(r)&&(16===r.length||24===r.length||32===r.length)){t=r,r=n.util.createBuffer();for(var i=0;i>>=2;for(i=0;i>8^255&h^99,s[g]=h,o[h]=g,f=(d=e[h])<<24^h<<16^h<<8^h^d,p=((r=e[g])^(n=e[r])^(i=e[n]))<<24^(g^i)<<16^(g^n^i)<<8^g^r^i;for(var m=0;m<4;++m)c[m][g]=f,l[m][h]=p,f=f<<24|f>>>8,p=p<<24|p>>>8;0===g?g=y=1:(g=r^e[e[e[r^i]]],y^=e[e[y]])}}function d(e,t){for(var r,n=e.slice(0),i=1,o=n.length,c=4*(o+6+1),u=o;u>>16&255]<<24^s[r>>>8&255]<<16^s[255&r]<<8^s[r>>>24]^a[i]<<24,i++):o>6&&u%o===4&&(r=s[r>>>24]<<24^s[r>>>16&255]<<16^s[r>>>8&255]<<8^s[255&r]),n[u]=n[u-o]^r;if(t){for(var h,d=l[0],f=l[1],p=l[2],g=l[3],y=n.slice(0),m=(u=0,(c=n.length)-4);u>>24]]^f[s[h>>>16&255]]^p[s[h>>>8&255]]^g[s[255&h]];n=y}return n}function f(e,t,r,n){var i,a,u,h,d,f,p,g,y,m,v,w,b=e.length/4-1;n?(i=l[0],a=l[1],u=l[2],h=l[3],d=o):(i=c[0],a=c[1],u=c[2],h=c[3],d=s),f=t[0]^e[0],p=t[n?3:1]^e[1],g=t[2]^e[2],y=t[n?1:3]^e[3];for(var E=3,S=1;S>>24]^a[p>>>16&255]^u[g>>>8&255]^h[255&y]^e[++E],v=i[p>>>24]^a[g>>>16&255]^u[y>>>8&255]^h[255&f]^e[++E],w=i[g>>>24]^a[y>>>16&255]^u[f>>>8&255]^h[255&p]^e[++E],y=i[y>>>24]^a[f>>>16&255]^u[p>>>8&255]^h[255&g]^e[++E],f=m,p=v,g=w;r[0]=d[f>>>24]<<24^d[p>>>16&255]<<16^d[g>>>8&255]<<8^d[255&y]^e[++E],r[n?3:1]=d[p>>>24]<<24^d[g>>>16&255]<<16^d[y>>>8&255]<<8^d[255&f]^e[++E],r[2]=d[g>>>24]<<24^d[y>>>16&255]<<16^d[f>>>8&255]<<8^d[255&p]^e[++E],r[n?1:3]=d[y>>>24]<<24^d[f>>>16&255]<<16^d[p>>>8&255]<<8^d[255&g]^e[++E]}function p(e){var t,r="AES-"+((e=e||{}).mode||"CBC").toUpperCase(),i=(t=e.decrypt?n.cipher.createDecipher(r,e.key):n.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var s=null;r instanceof n.util.ByteBuffer&&(s=r,r={}),(r=r||{}).output=s,r.iv=e,i.call(t,r)},t}},5049:(e,t,r)=>{var n=r(392);r(3877),r(2886);var i=e.exports=n.asn1=n.asn1||{};function s(e,t,r){if(r>t){var n=new Error("Too few bytes to parse DER.");throw n.available=e.length(),n.remaining=t,n.requested=r,n}}i.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},i.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},i.create=function(e,t,r,s,o){if(n.util.isArray(s)){for(var a=[],c=0;ct){if(n.strict){var p=new Error("Too few bytes to read ASN.1 value.");throw p.available=e.length(),p.remaining=t,p.requested=f,p}f=t}var g=32===(32&c);if(g)if(h=[],void 0===f)for(;;){if(s(e,t,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),t-=2;break}a=e.length(),h.push(o(e,t,r+1,n)),t-=a-e.length()}else for(;f>0;)a=e.length(),h.push(o(e,f,r+1,n)),t-=a-e.length(),f-=a-e.length();if(void 0===h&&l===i.Class.UNIVERSAL&&u===i.Type.BITSTRING&&(d=e.bytes(f)),void 0===h&&n.decodeBitStrings&&l===i.Class.UNIVERSAL&&u===i.Type.BITSTRING&&f>1){var y=e.read,m=t,v=0;if(u===i.Type.BITSTRING&&(s(e,t,1),v=e.getByte(),t--),0===v)try{a=e.length();var w=o(e,t,r+1,{strict:!0,decodeBitStrings:!0}),b=a-e.length();t-=b,u==i.Type.BITSTRING&&b++;var E=w.tagClass;b!==f||E!==i.Class.UNIVERSAL&&E!==i.Class.CONTEXT_SPECIFIC||(h=[w])}catch(_){}void 0===h&&(e.read=y,t=m)}if(void 0===h){if(void 0===f){if(n.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");f=t}if(u===i.Type.BMPSTRING)for(h="";f>0;f-=2)s(e,t,2),h+=String.fromCharCode(e.getInt16()),t-=2;else h=e.getBytes(f),t-=f}var S=void 0===d?null:{bitStringContents:d};return i.create(l,u,g,h,S)}i.fromDer=function(e,t){void 0===t&&(t={strict:!0,parseAllBytes:!0,decodeBitStrings:!0}),"boolean"===typeof t&&(t={strict:t,parseAllBytes:!0,decodeBitStrings:!0}),"strict"in t||(t.strict=!0),"parseAllBytes"in t||(t.parseAllBytes=!0),"decodeBitStrings"in t||(t.decodeBitStrings=!0),"string"===typeof e&&(e=n.util.createBuffer(e));var r=e.length(),i=o(e,e.length(),0,t);if(t.parseAllBytes&&0!==e.length()){var s=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw s.byteCount=r,s.remaining=e.length(),s}return i},i.toDer=function(e){var t=n.util.createBuffer(),r=e.tagClass|e.type,s=n.util.createBuffer(),o=!1;if("bitStringContents"in e&&(o=!0,e.original&&(o=i.equals(e,e.original))),o)s.putBytes(e.bitStringContents);else if(e.composed){e.constructed?r|=32:s.putByte(0);for(var a=0;a1&&(0===e.value.charCodeAt(0)&&0===(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128===(128&e.value.charCodeAt(1)))?s.putBytes(e.value.substr(1)):s.putBytes(e.value);if(t.putByte(r),s.length()<=127)t.putByte(127&s.length());else{var c=s.length(),l="";do{l+=String.fromCharCode(255&c),c>>>=8}while(c>0);t.putByte(128|l.length);for(a=l.length-1;a>=0;--a)t.putByte(l.charCodeAt(a))}return t.putBuffer(s),t},i.oidToDer=function(e){var t,r,i,s,o=e.split("."),a=n.util.createBuffer();a.putByte(40*parseInt(o[0],10)+parseInt(o[1],10));for(var c=2;c>>=7,t||(s|=128),r.push(s),t=!1}while(i>0);for(var l=r.length-1;l>=0;--l)a.putByte(r[l])}return a},i.derToOid=function(e){var t;"string"===typeof e&&(e=n.util.createBuffer(e));var r=e.getByte();t=Math.floor(r/40)+"."+r%40;for(var i=0;e.length()>0;)i<<=7,128&(r=e.getByte())?i+=127&r:(t+="."+(i+r),i=0);return t},i.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(e.substr(2,2),10)-1,i=parseInt(e.substr(4,2),10),s=parseInt(e.substr(6,2),10),o=parseInt(e.substr(8,2),10),a=0;if(e.length>11){var c=e.charAt(10),l=10;"+"!==c&&"-"!==c&&(a=parseInt(e.substr(10,2),10),l+=2)}if(t.setUTCFullYear(r,n,i),t.setUTCHours(s,o,a,0),l&&("+"===(c=e.charAt(l))||"-"===c)){var u=60*parseInt(e.substr(l+1,2),10)+parseInt(e.substr(l+4,2),10);u*=6e4,"+"===c?t.setTime(+t-u):t.setTime(+t+u)}return t},i.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),n=parseInt(e.substr(4,2),10)-1,i=parseInt(e.substr(6,2),10),s=parseInt(e.substr(8,2),10),o=parseInt(e.substr(10,2),10),a=parseInt(e.substr(12,2),10),c=0,l=0,u=!1;"Z"===e.charAt(e.length-1)&&(u=!0);var h=e.length-5,d=e.charAt(h);"+"!==d&&"-"!==d||(l=60*parseInt(e.substr(h+1,2),10)+parseInt(e.substr(h+4,2),10),l*=6e4,"+"===d&&(l*=-1),u=!0);return"."===e.charAt(14)&&(c=1e3*parseFloat(e.substr(14),10)),u?(t.setUTCFullYear(r,n,i),t.setUTCHours(s,o,a,c),t.setTime(+t+l)):(t.setFullYear(r,n,i),t.setHours(s,o,a,c)),t},i.dateToUtcTime=function(e){if("string"===typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=e,r},i.derToInteger=function(e){"string"===typeof e&&(e=n.util.createBuffer(e));var t=8*e.length();if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},i.validate=function(e,t,r,s){var o=!1;if(e.tagClass!==t.tagClass&&"undefined"!==typeof t.tagClass||e.type!==t.type&&"undefined"!==typeof t.type)s&&(e.tagClass!==t.tagClass&&s.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&s.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));else if(e.constructed===t.constructed||"undefined"===typeof t.constructed){if(o=!0,t.value&&n.util.isArray(t.value))for(var a=0,c=0;o&&c0&&(s+="\n");for(var o="",c=0;c1?s+="0x"+n.util.bytesToHex(e.value.slice(1)):s+="(none)",e.value.length>0){var d=e.value.charCodeAt(0);1==d?s+=" (1 unused bit shown)":d>1&&(s+=" ("+d+" unused bits shown)")}}else if(e.type===i.Type.OCTETSTRING)a.test(e.value)||(s+="("+e.value+") "),s+="0x"+n.util.bytesToHex(e.value);else if(e.type===i.Type.UTF8)try{s+=n.util.decodeUtf8(e.value)}catch(p){if("URI malformed"!==p.message)throw p;s+="0x"+n.util.bytesToHex(e.value)+" (malformed UTF8)"}else e.type===i.Type.PRINTABLESTRING||e.type===i.Type.IA5String?s+=e.value:a.test(e.value)?s+="0x"+n.util.bytesToHex(e.value):0===e.value.length?s+="[null]":s+=e.value}return s}},5754:e=>{var t={};e.exports=t;var r={};t.encode=function(e,t,r){if("string"!==typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==r&&"number"!==typeof r)throw new TypeError('"maxline" must be a number.');var n="";if(e instanceof Uint8Array){var i=0,s=t.length,o=t.charAt(0),a=[0];for(i=0;i0;)a.push(l%s),l=l/s|0}for(i=0;0===e[i]&&i=0;--i)n+=t[a[i]]}else n=function(e,t){var r=0,n=t.length,i=t.charAt(0),s=[0];for(r=0;r0;)s.push(a%n),a=a/n|0}var c="";for(r=0;0===e.at(r)&&r=0;--r)c+=t[s[r]];return c}(e,t);if(r){var u=new RegExp(".{1,"+r+"}","g");n=n.match(u).join("\r\n")}return n},t.decode=function(e,t){if("string"!==typeof e)throw new TypeError('"input" must be a string.');if("string"!==typeof t)throw new TypeError('"alphabet" must be a string.');var n=r[t];if(!n){n=r[t]=[];for(var i=0;i>=8;for(;u>0;)a.push(255&u),u>>=8}for(var h=0;e[h]===o&&h{var n=r(392);r(3877),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"===typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"===typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return(e=e.toUpperCase())in n.cipher.algorithms?n.cipher.algorithms[e]:null};var i=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};i.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},i.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},i.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},4533:(e,t,r)=>{var n=r(392);r(3877),n.cipher=n.cipher||{};var i=e.exports=n.cipher.modes=n.cipher.modes||{};function s(e,t){if("string"===typeof e&&(e=n.util.createBuffer(e)),n.util.isArray(e)&&e.length>4){var r=e;e=n.util.createBuffer();for(var i=0;i0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},i.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},i.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=s(e.iv,this.blockSize),this._prev=this._iv.slice(0)}},i.cbc.prototype.encrypt=function(e,t,r){if(e.length()0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},i.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=s(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(s=this.blockSize-s),this._partialOutput.clear();for(i=0;i0)e.read-=this.blockSize;else for(i=0;i0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(s=this.blockSize-s),this._partialOutput.clear();for(i=0;i0)e.read-=this.blockSize;else for(i=0;i0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=s(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(s=this.blockSize-s),this._partialOutput.clear();for(i=0;i0)e.read-=this.blockSize;else for(i=0;i0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.ofb.prototype.decrypt=i.ofb.prototype.encrypt,i.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=s(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(s=this.blockSize-s),this._partialOutput.clear();for(i=0;i0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}o(this._inBlock)},i.ctr.prototype.decrypt=i.ctr.prototype.encrypt,i.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0,this._R=3774873600},i.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t,r=n.util.createBuffer(e.iv);if(this._cipherLength=0,t="additionalData"in e?n.util.createBuffer(e.additionalData):n.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=n.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var i=r.length();if(12===i)this._j0=[r.getInt32(),r.getInt32(),r.getInt32(),1];else{for(this._j0=[0,0,0,0];r.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(a(8*i)))}this._inBlock=this._j0.slice(0),o(this._inBlock),this._partialBytes=0,t=n.util.createBuffer(t),this._aDataLength=a(8*t.length());var s=t.length()%this.blockSize;for(s&&t.fillWithByte(0,this.blockSize-s),this._s=[0,0,0,0];t.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()])},i.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i0&&(s=this.blockSize-s),this._partialOutput.clear();for(i=0;i0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),o(this._inBlock)},i.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),o(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},i.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=e[r/8|0]>>>4*(7-r%8)&15,i=this._m[r][n];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[3]}return t},i.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},i.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,i=16*r,s=new Array(i),o=0;o>>1,i=new Array(r);i[n]=e.slice(0);for(var s=n>>>1;s>0;)this.pow(i[2*s],i[s]=[]),s>>=1;for(s=2;s{var n=r(392);function i(e,t){n.cipher.registerAlgorithm(e,(function(){return new n.des.Algorithm(e,t)}))}r(3397),r(4533),r(3877),e.exports=n.des=n.des||{},n.des.startEncrypting=function(e,t,r,n){var i=p({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return i.start(t),i},n.des.createEncryptionCipher=function(e,t){return p({key:e,output:null,decrypt:!1,mode:t})},n.des.startDecrypting=function(e,t,r,n){var i=p({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return i.start(t),i},n.des.createDecryptionCipher=function(e,t){return p({key:e,output:null,decrypt:!0,mode:t})},n.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return f(r._keys,e,t,!1)},decrypt:function(e,t){return f(r._keys,e,t,!0)}}}),r._init=!1},n.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=n.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=function(e){for(var t,r=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],n=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],i=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],s=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],o=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],a=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],c=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],l=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],u=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],h=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],d=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],f=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],p=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],g=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],y=e.length()>8?3:1,m=[],v=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],w=0,b=0;b>>4^S))<<4,E^=t=65535&((S^=t)>>>-16^E),E^=(t=858993459&(E>>>2^(S^=t<<-16)))<<2,E^=t=65535&((S^=t)>>>-16^E),E^=(t=1431655765&(E>>>1^(S^=t<<-16)))<<1,E^=t=16711935&((S^=t)>>>8^E),t=(E^=(t=1431655765&(E>>>1^(S^=t<<8)))<<1)<<8|(S^=t)>>>20&240,E=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=t;for(var _=0;_>>26,S=S<<2|S>>>26):(E=E<<1|E>>>27,S=S<<1|S>>>27),S&=-15;var I=r[(E&=-15)>>>28]|n[E>>>24&15]|i[E>>>20&15]|s[E>>>16&15]|o[E>>>12&15]|a[E>>>8&15]|c[E>>>4&15],A=l[S>>>28]|u[S>>>24&15]|h[S>>>20&15]|d[S>>>16&15]|f[S>>>12&15]|p[S>>>8&15]|g[S>>>4&15];t=65535&(A>>>16^I),m[w++]=I^t,m[w++]=A^t<<16}}return m}(t),this._init=!0}},i("DES-ECB",n.cipher.modes.ecb),i("DES-CBC",n.cipher.modes.cbc),i("DES-CFB",n.cipher.modes.cfb),i("DES-OFB",n.cipher.modes.ofb),i("DES-CTR",n.cipher.modes.ctr),i("3DES-ECB",n.cipher.modes.ecb),i("3DES-CBC",n.cipher.modes.cbc),i("3DES-CFB",n.cipher.modes.cfb),i("3DES-OFB",n.cipher.modes.ofb),i("3DES-CTR",n.cipher.modes.ctr);var s=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],o=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],a=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],c=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],l=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],u=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],h=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],d=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function f(e,t,r,n){var i,f,p=32===e.length?3:9;i=3===p?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var g=t[0],y=t[1];g^=(f=252645135&(g>>>4^y))<<4,g^=(f=65535&(g>>>16^(y^=f)))<<16,g^=f=858993459&((y^=f)>>>2^g),g^=f=16711935&((y^=f<<2)>>>8^g),g=(g^=(f=1431655765&(g>>>1^(y^=f<<8)))<<1)<<1|g>>>31,y=(y^=f)<<1|y>>>31;for(var m=0;m>>4|y<<28)^e[b+1];f=g,g=y,y=f^(o[E>>>24&63]|c[E>>>16&63]|u[E>>>8&63]|d[63&E]|s[S>>>24&63]|a[S>>>16&63]|l[S>>>8&63]|h[63&S])}f=g,g=y,y=f}y=y>>>1|y<<31,y^=f=1431655765&((g=g>>>1|g<<31)>>>1^y),y^=(f=16711935&(y>>>8^(g^=f<<1)))<<8,y^=(f=858993459&(y>>>2^(g^=f)))<<2,y^=f=65535&((g^=f)>>>16^y),y^=f=252645135&((g^=f<<16)>>>4^y),g^=f<<4,r[0]=g,r[1]=y}function p(e){var t,r="DES-"+((e=e||{}).mode||"CBC").toUpperCase(),i=(t=e.decrypt?n.cipher.createDecipher(r,e.key):n.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var s=null;r instanceof n.util.ByteBuffer&&(s=r,r={}),(r=r||{}).output=s,r.iv=e,i.call(t,r)},t}},392:e=>{e.exports={options:{usePureJavaScript:!1}}},878:(e,t,r)=>{var n=r(392);r(29),r(3877),(e.exports=n.hmac=n.hmac||{}).create=function(){var e=null,t=null,r=null,i=null,s={start:function(s,o){if(null!==s)if("string"===typeof s){if(!((s=s.toLowerCase())in n.md.algorithms))throw new Error('Unknown hash algorithm "'+s+'"');t=n.md.algorithms[s].create()}else t=s;if(null===o)o=e;else{if("string"===typeof o)o=n.util.createBuffer(o);else if(n.util.isArray(o)){var a=o;o=n.util.createBuffer();for(var c=0;ct.blockLength&&(t.start(),t.update(o.bytes()),o=t.digest()),r=n.util.createBuffer(),i=n.util.createBuffer(),l=o.length();for(c=0;c{var n,i=r(392);e.exports=i.jsbn=i.jsbn||{};function s(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function o(){return new s(null)}function a(e,t,r,n,i,s){for(var o=16383&t,a=t>>14;--s>=0;){var c=16383&this.data[e],l=this.data[e++]>>14,u=a*c+l*o;i=((c=o*c+((16383&u)<<14)+r.data[n]+i)>>28)+(u>>14)+a*l,r.data[n++]=268435455&c}return i}i.jsbn.BigInteger=s,"undefined"===typeof navigator?(s.prototype.am=a,n=28):"Microsoft Internet Explorer"==navigator.appName?(s.prototype.am=function(e,t,r,n,i,s){for(var o=32767&t,a=t>>15;--s>=0;){var c=32767&this.data[e],l=this.data[e++]>>15,u=a*c+l*o;i=((c=o*c+((32767&u)<<15)+r.data[n]+(1073741823&i))>>>30)+(u>>>15)+a*l+(i>>>30),r.data[n++]=1073741823&c}return i},n=30):"Netscape"!=navigator.appName?(s.prototype.am=function(e,t,r,n,i,s){for(;--s>=0;){var o=t*this.data[e++]+r.data[n]+i;i=Math.floor(o/67108864),r.data[n++]=67108863&o}return i},n=26):(s.prototype.am=a,n=28),s.prototype.DB=n,s.prototype.DM=(1<>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function g(e){this.m=e}function y(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function S(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function _(){}function I(e){return e}function A(e){this.r2=o(),this.q3=o(),s.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}g.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},g.prototype.revert=function(e){return e},g.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},g.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},g.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},y.prototype.convert=function(e){var t=o();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(s.ZERO)>0&&this.m.subTo(t,t),t},y.prototype.revert=function(e){var t=o();return e.copyTo(t),this.reduce(t),t},y.prototype.reduce=function(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e.data[r]+=this.m.am(0,n,e,t,0,this.m.t);e.data[r]>=e.DV;)e.data[r]-=e.DV,e.data[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},y.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},y.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},s.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s},s.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0},s.prototype.fromString=function(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var n=e.length,i=!1,o=0;--n>=0;){var a=8==r?255&e[n]:d(e,n);a<0?"-"==e.charAt(n)&&(i=!0):(i=!1,0==o?this.data[this.t++]=a:o+r>this.DB?(this.data[this.t-1]|=(a&(1<>this.DB-o):this.data[this.t-1]|=a<=this.DB&&(o-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==e;)--this.t},s.prototype.dlShiftTo=function(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s},s.prototype.drShiftTo=function(e,t){for(var r=e;r=0;--r)t.data[r+o+1]=this.data[r]>>i|a,a=(this.data[r]&s)<=0;--r)t.data[r]=0;t.data[o]=a,t.t=this.t+o+1,t.s=this.s,t.clamp()},s.prototype.rShiftTo=function(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var n=e%this.DB,i=this.DB-n,s=(1<>n;for(var o=r+1;o>n;n>0&&(t.data[this.t-r-1]|=(this.s&s)<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()},s.prototype.multiplyTo=function(e,t){var r=this.abs(),n=e.abs(),i=r.t;for(t.t=i+n.t;--i>=0;)t.data[i]=0;for(i=0;i=0;)e.data[r]=0;for(r=0;r=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()},s.prototype.divRemTo=function(e,t,r){var n=e.abs();if(!(n.t<=0)){var i=this.abs();if(i.t0?(n.lShiftTo(u,a),i.lShiftTo(u,r)):(n.copyTo(a),i.copyTo(r));var h=a.t,d=a.data[h-1];if(0!=d){var f=d*(1<1?a.data[h-2]>>this.F2:0),g=this.FV/f,y=(1<=0&&(r.data[r.t++]=1,r.subTo(b,r)),s.ONE.dlShiftTo(h,b),b.subTo(a,a);a.t=0;){var E=r.data[--v]==d?this.DM:Math.floor(r.data[v]*g+(r.data[v-1]+m)*y);if((r.data[v]+=a.am(0,E,r,w,0,h))0&&r.rShiftTo(u,r),c<0&&s.ZERO.subTo(r,r)}}},s.prototype.invDigit=function(){if(this.t<1)return 0;var e=this.data[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},s.prototype.isEven=function(){return 0==(this.t>0?1&this.data[0]:this.s)},s.prototype.exp=function(e,t){if(e>4294967295||e<1)return s.ONE;var r=o(),n=o(),i=t.convert(this),a=p(e)-1;for(i.copyTo(r);--a>=0;)if(t.sqrTo(r,n),(e&1<0)t.mulTo(n,i,r);else{var c=r;r=n,n=c}return t.revert(r)},s.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<0)for(a>a)>0&&(i=!0,s=h(r));o>=0;)a>(a+=this.DB-t)):(r=this.data[o]>>(a-=t)&n,a<=0&&(a+=this.DB,--o)),r>0&&(i=!0),i&&(s+=h(r));return i?s:"0"},s.prototype.negate=function(){var e=o();return s.ZERO.subTo(this,e),e},s.prototype.abs=function(){return this.s<0?this.negate():this},s.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0},s.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+p(this.data[this.t-1]^this.s&this.DM)},s.prototype.mod=function(e){var t=o();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(s.ZERO)>0&&e.subTo(t,t),t},s.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new g(t):new y(t),this.exp(e,r)},s.ZERO=f(0),s.ONE=f(1),_.prototype.convert=I,_.prototype.revert=I,_.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},_.prototype.sqrTo=function(e,t){e.squareTo(t)},A.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=o();return e.copyTo(t),this.reduce(t),t},A.prototype.revert=function(e){return e},A.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},A.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},A.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var C=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],T=(1<<26)/C[C.length-1];s.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},s.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=f(r),i=o(),s=o(),a="";for(this.divRemTo(n,i,s);i.signum()>0;)a=(r+s.intValue()).toString(e).substr(1)+a,i.divRemTo(n,i,s);return s.intValue().toString(e)+a},s.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),n=Math.pow(t,r),i=!1,o=0,a=0,c=0;c=r&&(this.dMultiply(n),this.dAddOffset(a,0),o=0,a=0))}o>0&&(this.dMultiply(Math.pow(t,o)),this.dAddOffset(a,0)),i&&s.ZERO.subTo(this,this)},s.prototype.fromNumber=function(e,t,r){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(s.ONE.shiftLeft(e-1),v,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(s.ONE.shiftLeft(e-1),this);else{var n=new Array,i=7&e;n.length=1+(e>>3),t.nextBytes(n),i>0?n[0]&=(1<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t.data[r++]=n:n<-1&&(t.data[r++]=this.DV+n),t.t=r,t.clamp()},s.prototype.dMultiply=function(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},s.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}},s.prototype.multiplyLowerTo=function(e,t,r){var n,i=Math.min(this.t+e.t,t);for(r.s=0,r.t=i;i>0;)r.data[--i]=0;for(n=r.t-this.t;i=0;)r.data[n]=0;for(n=Math.max(t-this.t,0);n0)if(0==t)r=this.data[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this.data[n])%e;return r},s.prototype.millerRabin=function(e){var t=this.subtract(s.ONE),r=t.getLowestSetBit();if(r<=0)return!1;for(var n,i=t.shiftRight(r),o={nextBytes:function(e){for(var t=0;t=0);var c=n.modPow(i,this);if(0!=c.compareTo(s.ONE)&&0!=c.compareTo(t)){for(var l=1;l++>24},s.prototype.shortValue=function(){return 0==this.t?this.s:this.data[0]<<16>>16},s.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1},s.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var r,n=this.DB-e*this.DB%8,i=0;if(e-- >0)for(n>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<=0;)n<8?(r=(this.data[e]&(1<>(n+=this.DB-8)):(r=this.data[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(t[i++]=r);return t},s.prototype.equals=function(e){return 0==this.compareTo(e)},s.prototype.min=function(e){return this.compareTo(e)<0?this:e},s.prototype.max=function(e){return this.compareTo(e)>0?this:e},s.prototype.and=function(e){var t=o();return this.bitwiseTo(e,m,t),t},s.prototype.or=function(e){var t=o();return this.bitwiseTo(e,v,t),t},s.prototype.xor=function(e){var t=o();return this.bitwiseTo(e,w,t),t},s.prototype.andNot=function(e){var t=o();return this.bitwiseTo(e,b,t),t},s.prototype.not=function(){for(var e=o(),t=0;t=this.t?0!=this.s:0!=(this.data[t]&1<1){var h=o();for(n.sqrTo(a[1],h);c<=u;)a[c]=o(),n.mulTo(h,a[c-2],a[c]),c+=2}var d,m,v=e.t-1,w=!0,b=o();for(i=p(e.data[v])-1;v>=0;){for(i>=l?d=e.data[v]>>i-l&u:(d=(e.data[v]&(1<0&&(d|=e.data[v-1]>>this.DB+i-l)),c=r;0==(1&d);)d>>=1,--c;if((i-=c)<0&&(i+=this.DB,--v),w)a[d].copyTo(s),w=!1;else{for(;c>1;)n.sqrTo(s,b),n.sqrTo(b,s),c-=2;c>0?n.sqrTo(s,b):(m=s,s=b,b=m),n.mulTo(b,a[d],s)}for(;v>=0&&0==(e.data[v]&1<=0?(r.subTo(n,r),t&&i.subTo(a,i),o.subTo(c,o)):(n.subTo(r,n),t&&a.subTo(i,a),c.subTo(o,c))}return 0!=n.compareTo(s.ONE)?s.ZERO:c.compareTo(e)>=0?c.subtract(e):c.signum()<0?(c.addTo(e,c),c.signum()<0?c.add(e):c):c},s.prototype.pow=function(e){return this.exp(e,new _)},s.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var i=t.getLowestSetBit(),s=r.getLowestSetBit();if(s<0)return t;for(i0&&(t.rShiftTo(s,t),r.rShiftTo(s,r));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return s>0&&r.lShiftTo(s,r),r},s.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r.data[0]<=C[C.length-1]){for(t=0;t{var n=r(392);e.exports=n.md=n.md||{},n.md.algorithms=n.md.algorithms||{}},1746:(e,t,r)=>{var n=r(392);r(7263),e.exports=n.mgf=n.mgf||{},n.mgf.mgf1=n.mgf1},7263:(e,t,r)=>{var n=r(392);r(3877),n.mgf=n.mgf||{},(e.exports=n.mgf.mgf1=n.mgf1=n.mgf1||{}).create=function(e){return{generate:function(t,r){for(var i=new n.util.ByteBuffer,s=Math.ceil(r/e.digestLength),o=0;o{var n=r(392);n.pki=n.pki||{};var i=e.exports=n.pki.oids=n.oids=n.oids||{};function s(e,t){i[e]=t,i[t]=e}function o(e,t){i[e]=t}s("1.2.840.113549.1.1.1","rsaEncryption"),s("1.2.840.113549.1.1.4","md5WithRSAEncryption"),s("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),s("1.2.840.113549.1.1.7","RSAES-OAEP"),s("1.2.840.113549.1.1.8","mgf1"),s("1.2.840.113549.1.1.9","pSpecified"),s("1.2.840.113549.1.1.10","RSASSA-PSS"),s("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),s("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),s("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),s("1.3.101.112","EdDSA25519"),s("1.2.840.10040.4.3","dsa-with-sha1"),s("1.3.14.3.2.7","desCBC"),s("1.3.14.3.2.26","sha1"),s("1.3.14.3.2.29","sha1WithRSASignature"),s("2.16.840.1.101.3.4.2.1","sha256"),s("2.16.840.1.101.3.4.2.2","sha384"),s("2.16.840.1.101.3.4.2.3","sha512"),s("2.16.840.1.101.3.4.2.4","sha224"),s("2.16.840.1.101.3.4.2.5","sha512-224"),s("2.16.840.1.101.3.4.2.6","sha512-256"),s("1.2.840.113549.2.2","md2"),s("1.2.840.113549.2.5","md5"),s("1.2.840.113549.1.7.1","data"),s("1.2.840.113549.1.7.2","signedData"),s("1.2.840.113549.1.7.3","envelopedData"),s("1.2.840.113549.1.7.4","signedAndEnvelopedData"),s("1.2.840.113549.1.7.5","digestedData"),s("1.2.840.113549.1.7.6","encryptedData"),s("1.2.840.113549.1.9.1","emailAddress"),s("1.2.840.113549.1.9.2","unstructuredName"),s("1.2.840.113549.1.9.3","contentType"),s("1.2.840.113549.1.9.4","messageDigest"),s("1.2.840.113549.1.9.5","signingTime"),s("1.2.840.113549.1.9.6","counterSignature"),s("1.2.840.113549.1.9.7","challengePassword"),s("1.2.840.113549.1.9.8","unstructuredAddress"),s("1.2.840.113549.1.9.14","extensionRequest"),s("1.2.840.113549.1.9.20","friendlyName"),s("1.2.840.113549.1.9.21","localKeyId"),s("1.2.840.113549.1.9.22.1","x509Certificate"),s("1.2.840.113549.1.12.10.1.1","keyBag"),s("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),s("1.2.840.113549.1.12.10.1.3","certBag"),s("1.2.840.113549.1.12.10.1.4","crlBag"),s("1.2.840.113549.1.12.10.1.5","secretBag"),s("1.2.840.113549.1.12.10.1.6","safeContentsBag"),s("1.2.840.113549.1.5.13","pkcs5PBES2"),s("1.2.840.113549.1.5.12","pkcs5PBKDF2"),s("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),s("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),s("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),s("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),s("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),s("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),s("1.2.840.113549.2.7","hmacWithSHA1"),s("1.2.840.113549.2.8","hmacWithSHA224"),s("1.2.840.113549.2.9","hmacWithSHA256"),s("1.2.840.113549.2.10","hmacWithSHA384"),s("1.2.840.113549.2.11","hmacWithSHA512"),s("1.2.840.113549.3.7","des-EDE3-CBC"),s("2.16.840.1.101.3.4.1.2","aes128-CBC"),s("2.16.840.1.101.3.4.1.22","aes192-CBC"),s("2.16.840.1.101.3.4.1.42","aes256-CBC"),s("2.5.4.3","commonName"),s("2.5.4.4","surname"),s("2.5.4.5","serialNumber"),s("2.5.4.6","countryName"),s("2.5.4.7","localityName"),s("2.5.4.8","stateOrProvinceName"),s("2.5.4.9","streetAddress"),s("2.5.4.10","organizationName"),s("2.5.4.11","organizationalUnitName"),s("2.5.4.12","title"),s("2.5.4.13","description"),s("2.5.4.15","businessCategory"),s("2.5.4.17","postalCode"),s("2.5.4.42","givenName"),s("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),s("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),s("2.16.840.1.113730.1.1","nsCertType"),s("2.16.840.1.113730.1.13","nsComment"),o("2.5.29.1","authorityKeyIdentifier"),o("2.5.29.2","keyAttributes"),o("2.5.29.3","certificatePolicies"),o("2.5.29.4","keyUsageRestriction"),o("2.5.29.5","policyMapping"),o("2.5.29.6","subtreesConstraint"),o("2.5.29.7","subjectAltName"),o("2.5.29.8","issuerAltName"),o("2.5.29.9","subjectDirectoryAttributes"),o("2.5.29.10","basicConstraints"),o("2.5.29.11","nameConstraints"),o("2.5.29.12","policyConstraints"),o("2.5.29.13","basicConstraints"),s("2.5.29.14","subjectKeyIdentifier"),s("2.5.29.15","keyUsage"),o("2.5.29.16","privateKeyUsagePeriod"),s("2.5.29.17","subjectAltName"),s("2.5.29.18","issuerAltName"),s("2.5.29.19","basicConstraints"),o("2.5.29.20","cRLNumber"),o("2.5.29.21","cRLReason"),o("2.5.29.22","expirationDate"),o("2.5.29.23","instructionCode"),o("2.5.29.24","invalidityDate"),o("2.5.29.25","cRLDistributionPoints"),o("2.5.29.26","issuingDistributionPoint"),o("2.5.29.27","deltaCRLIndicator"),o("2.5.29.28","issuingDistributionPoint"),o("2.5.29.29","certificateIssuer"),o("2.5.29.30","nameConstraints"),s("2.5.29.31","cRLDistributionPoints"),s("2.5.29.32","certificatePolicies"),o("2.5.29.33","policyMappings"),o("2.5.29.34","policyConstraints"),s("2.5.29.35","authorityKeyIdentifier"),o("2.5.29.36","policyConstraints"),s("2.5.29.37","extKeyUsage"),o("2.5.29.46","freshestCRL"),o("2.5.29.54","inhibitAnyPolicy"),s("1.3.6.1.4.1.11129.2.4.2","timestampList"),s("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),s("1.3.6.1.5.5.7.3.1","serverAuth"),s("1.3.6.1.5.5.7.3.2","clientAuth"),s("1.3.6.1.5.5.7.3.3","codeSigning"),s("1.3.6.1.5.5.7.3.4","emailProtection"),s("1.3.6.1.5.5.7.3.8","timeStamping")},9835:(e,t,r)=>{var n=r(392);if(r(8605),r(5049),r(1400),r(29),r(2886),r(6019),r(6193),r(3860),r(654),r(5493),r(3877),"undefined"===typeof i)var i=n.jsbn.BigInteger;var s=n.asn1,o=n.pki=n.pki||{};e.exports=o.pbe=n.pbe=n.pbe||{};var a=o.oids,c={name:"EncryptedPrivateKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},l={name:"PBES2Algorithms",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},u={name:"pkcs-12PbeParams",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"iterations"}]};function h(e,t){return e.start().update(t).digest().getBytes()}function d(e){var t;if(e){if(!(t=o.oids[s.derToOid(e)])){var r=new Error("Unsupported PRF OID.");throw r.oid=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}}else t="hmacWithSHA1";return f(t)}function f(e){var t=n.md;switch(e){case"hmacWithSHA224":t=n.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":e=e.substr(8).toLowerCase();break;default:var r=new Error("Unsupported PRF algorithm.");throw r.algorithm=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}if(!t||!(e in t))throw new Error("Unknown hash algorithm: "+e);return t[e].create()}o.encryptPrivateKeyInfo=function(e,t,r){(r=r||{}).saltSize=r.saltSize||8,r.count=r.count||2048,r.algorithm=r.algorithm||"aes128",r.prfAlgorithm=r.prfAlgorithm||"sha1";var i,c,l,u=n.random.getBytesSync(r.saltSize),h=r.count,d=s.integerToDer(h);if(0===r.algorithm.indexOf("aes")||"des"===r.algorithm){var p,g,y;switch(r.algorithm){case"aes128":i=16,p=16,g=a["aes128-CBC"],y=n.aes.createEncryptionCipher;break;case"aes192":i=24,p=16,g=a["aes192-CBC"],y=n.aes.createEncryptionCipher;break;case"aes256":i=32,p=16,g=a["aes256-CBC"],y=n.aes.createEncryptionCipher;break;case"des":i=8,p=8,g=a.desCBC,y=n.des.createEncryptionCipher;break;default:throw(S=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=r.algorithm,S}var m="hmacWith"+r.prfAlgorithm.toUpperCase(),v=f(m),w=n.pkcs5.pbkdf2(t,u,h,i,v),b=n.random.getBytesSync(p);(_=y(w)).start(b),_.update(s.toDer(e)),_.finish(),l=_.output.getBytes();var E=function(e,t,r,i){var a=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,e),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,t.getBytes())]);"hmacWithSHA1"!==i&&a.value.push(s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,n.util.hexToBytes(r.toString(16))),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(o.oids[i]).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,"")]));return a}(u,d,i,m);c=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(a.pkcs5PBES2).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(a.pkcs5PBKDF2).getBytes()),E]),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(g).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,b)])])])}else{var S;if("3des"!==r.algorithm)throw(S=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=r.algorithm,S;i=24;var _,I=new n.util.ByteBuffer(u);w=o.pbe.generatePkcs12Key(t,I,1,h,i),b=o.pbe.generatePkcs12Key(t,I,2,h,i);(_=n.des.createEncryptionCipher(w)).start(b),_.update(s.toDer(e)),_.finish(),l=_.output.getBytes(),c=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(a["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,u),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,d.getBytes())])])}return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[c,s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,l)])},o.decryptPrivateKeyInfo=function(e,t){var r=null,i={},a=[];if(!s.validate(e,c,i,a)){var l=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw l.errors=a,l}var u=s.derToOid(i.encryptionOid),h=o.pbe.getCipher(u,i.encryptionParams,t),d=n.util.createBuffer(i.encryptedData);return h.update(d),h.finish()&&(r=s.fromDer(h.output)),r},o.encryptedPrivateKeyToPem=function(e,t){var r={type:"ENCRYPTED PRIVATE KEY",body:s.toDer(e).getBytes()};return n.pem.encode(r,{maxline:t})},o.encryptedPrivateKeyFromPem=function(e){var t=n.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==t.type){var r=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return s.fromDer(t.body)},o.encryptRsaPrivateKey=function(e,t,r){if(!(r=r||{}).legacy){var i=o.wrapRsaPrivateKey(o.privateKeyToAsn1(e));return i=o.encryptPrivateKeyInfo(i,t,r),o.encryptedPrivateKeyToPem(i)}var a,c,l,u;switch(r.algorithm){case"aes128":a="AES-128-CBC",l=16,c=n.random.getBytesSync(16),u=n.aes.createEncryptionCipher;break;case"aes192":a="AES-192-CBC",l=24,c=n.random.getBytesSync(16),u=n.aes.createEncryptionCipher;break;case"aes256":a="AES-256-CBC",l=32,c=n.random.getBytesSync(16),u=n.aes.createEncryptionCipher;break;case"3des":a="DES-EDE3-CBC",l=24,c=n.random.getBytesSync(8),u=n.des.createEncryptionCipher;break;case"des":a="DES-CBC",l=8,c=n.random.getBytesSync(8),u=n.des.createEncryptionCipher;break;default:var h=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+r.algorithm+'".');throw h.algorithm=r.algorithm,h}var d=u(n.pbe.opensslDeriveBytes(t,c.substr(0,8),l));d.start(c),d.update(s.toDer(o.privateKeyToAsn1(e))),d.finish();var f={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:a,parameters:n.util.bytesToHex(c).toUpperCase()},body:d.output.getBytes()};return n.pem.encode(f)},o.decryptRsaPrivateKey=function(e,t){var r=null,i=n.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==i.type&&"PRIVATE KEY"!==i.type&&"RSA PRIVATE KEY"!==i.type)throw(l=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".')).headerType=l,l;if(i.procType&&"ENCRYPTED"===i.procType.type){var a,c;switch(i.dekInfo.algorithm){case"DES-CBC":a=8,c=n.des.createDecryptionCipher;break;case"DES-EDE3-CBC":a=24,c=n.des.createDecryptionCipher;break;case"AES-128-CBC":a=16,c=n.aes.createDecryptionCipher;break;case"AES-192-CBC":a=24,c=n.aes.createDecryptionCipher;break;case"AES-256-CBC":a=32,c=n.aes.createDecryptionCipher;break;case"RC2-40-CBC":a=5,c=function(e){return n.rc2.createDecryptionCipher(e,40)};break;case"RC2-64-CBC":a=8,c=function(e){return n.rc2.createDecryptionCipher(e,64)};break;case"RC2-128-CBC":a=16,c=function(e){return n.rc2.createDecryptionCipher(e,128)};break;default:var l;throw(l=new Error('Could not decrypt private key; unsupported encryption algorithm "'+i.dekInfo.algorithm+'".')).algorithm=i.dekInfo.algorithm,l}var u=n.util.hexToBytes(i.dekInfo.parameters),h=c(n.pbe.opensslDeriveBytes(t,u.substr(0,8),a));if(h.start(u),h.update(n.util.createBuffer(i.body)),!h.finish())return r;r=h.output.getBytes()}else r=i.body;return null!==(r="ENCRYPTED PRIVATE KEY"===i.type?o.decryptPrivateKeyInfo(s.fromDer(r),t):s.fromDer(r))&&(r=o.privateKeyFromAsn1(r)),r},o.pbe.generatePkcs12Key=function(e,t,r,i,s,o){var a,c;if("undefined"===typeof o||null===o){if(!("sha1"in n.md))throw new Error('"sha1" hash algorithm unavailable.');o=n.md.sha1.create()}var l=o.digestLength,u=o.blockLength,h=new n.util.ByteBuffer,d=new n.util.ByteBuffer;if(null!==e&&void 0!==e){for(c=0;c=0;c--)k>>=8,k+=A.at(c)+R.at(c),R.setAt(c,255&k);T.putBuffer(R)}b=T,h.putBuffer(_)}return h.truncate(h.length()-s),h},o.pbe.getCipher=function(e,t,r){switch(e){case o.oids.pkcs5PBES2:return o.pbe.getCipherForPBES2(e,t,r);case o.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case o.oids["pbewithSHAAnd40BitRC2-CBC"]:return o.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},o.pbe.getCipherForPBES2=function(e,t,r){var i,a={},c=[];if(!s.validate(t,l,a,c))throw(i=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=c,i;if((e=s.derToOid(a.kdfOid))!==o.oids.pkcs5PBKDF2)throw(i=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.")).oid=e,i.supportedOids=["pkcs5PBKDF2"],i;if((e=s.derToOid(a.encOid))!==o.oids["aes128-CBC"]&&e!==o.oids["aes192-CBC"]&&e!==o.oids["aes256-CBC"]&&e!==o.oids["des-EDE3-CBC"]&&e!==o.oids.desCBC)throw(i=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.")).oid=e,i.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],i;var u,h,f=a.kdfSalt,p=n.util.createBuffer(a.kdfIterationCount);switch(p=p.getInt(p.length()<<3),o.oids[e]){case"aes128-CBC":u=16,h=n.aes.createDecryptionCipher;break;case"aes192-CBC":u=24,h=n.aes.createDecryptionCipher;break;case"aes256-CBC":u=32,h=n.aes.createDecryptionCipher;break;case"des-EDE3-CBC":u=24,h=n.des.createDecryptionCipher;break;case"desCBC":u=8,h=n.des.createDecryptionCipher}var g=d(a.prfOid),y=n.pkcs5.pbkdf2(r,f,p,u,g),m=a.encIv,v=h(y);return v.start(m),v},o.pbe.getCipherForPKCS12PBE=function(e,t,r){var i={},a=[];if(!s.validate(t,u,i,a))throw(g=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=a,g;var c,l,h,f=n.util.createBuffer(i.salt),p=n.util.createBuffer(i.iterations);switch(p=p.getInt(p.length()<<3),e){case o.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:c=24,l=8,h=n.des.startDecrypting;break;case o.oids["pbewithSHAAnd40BitRC2-CBC"]:c=5,l=8,h=function(e,t){var r=n.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var g;throw(g=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.")).oid=e,g}var y=d(i.prfOid),m=o.pbe.generatePkcs12Key(r,f,1,p,c,y);return y.start(),h(m,o.pbe.generatePkcs12Key(r,f,2,p,l,y))},o.pbe.opensslDeriveBytes=function(e,t,r,i){if("undefined"===typeof i||null===i){if(!("md5"in n.md))throw new Error('"md5" hash algorithm unavailable.');i=n.md.md5.create()}null===t&&(t="");for(var s=[h(i,e+t)],o=16,a=1;o{var n=r(392);r(878),r(29),r(3877);var i,s=n.pkcs5=n.pkcs5||{};n.util.isNodejs&&!n.options.usePureJavaScript&&(i=r(5819)),e.exports=n.pbkdf2=s.pbkdf2=function(e,t,r,s,o,a){if("function"===typeof o&&(a=o,o=null),n.util.isNodejs&&!n.options.usePureJavaScript&&i.pbkdf2&&(null===o||"object"!==typeof o)&&(i.pbkdf2Sync.length>4||!o||"sha1"===o))return"string"!==typeof o&&(o="sha1"),e=Buffer.from(e,"binary"),t=Buffer.from(t,"binary"),a?4===i.pbkdf2Sync.length?i.pbkdf2(e,t,r,s,(function(e,t){if(e)return a(e);a(null,t.toString("binary"))})):i.pbkdf2(e,t,r,s,o,(function(e,t){if(e)return a(e);a(null,t.toString("binary"))})):4===i.pbkdf2Sync.length?i.pbkdf2Sync(e,t,r,s).toString("binary"):i.pbkdf2Sync(e,t,r,s,o).toString("binary");if("undefined"!==typeof o&&null!==o||(o="sha1"),"string"===typeof o){if(!(o in n.md.algorithms))throw new Error("Unknown hash algorithm: "+o);o=n.md[o].create()}var c=o.digestLength;if(s>4294967295*c){var l=new Error("Derived key is too long.");if(a)return a(l);throw l}var u=Math.ceil(s/c),h=s-(u-1)*c,d=n.hmac.create();d.start(o,e);var f,p,g,y="";if(!a){for(var m=1;m<=u;++m){d.start(null,null),d.update(t),d.update(n.util.int32ToBytes(m)),f=g=d.digest().getBytes();for(var v=2;v<=r;++v)d.start(null,null),d.update(g),p=d.digest().getBytes(),f=n.util.xorBytes(f,p,c),g=p;y+=mu)return a(null,y);d.start(null,null),d.update(t),d.update(n.util.int32ToBytes(m)),f=g=d.digest().getBytes(),v=2,b()}function b(){if(v<=r)return d.start(null,null),d.update(g),p=d.digest().getBytes(),f=n.util.xorBytes(f,p,c),g=p,++v,n.util.setImmediate(b);y+=m{var n=r(392);r(3877);var i=e.exports=n.pem=n.pem||{};function s(e){for(var t=e.name+": ",r=[],n=function(e,t){return" "+t},i=0;i65&&-1!==o){var a=t[o];","===a?(++o,t=t.substr(0,o)+"\r\n "+t.substr(o)):t=t.substr(0,o)+"\r\n"+a+t.substr(o+1),s=i-o-1,o=-1,++i}else" "!==t[i]&&"\t"!==t[i]&&","!==t[i]||(o=i);return t}function o(e){return e.replace(/^\s+/,"")}i.encode=function(e,t){t=t||{};var r,i="-----BEGIN "+e.type+"-----\r\n";if(e.procType&&(i+=s(r={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]})),e.contentDomain&&(i+=s(r={name:"Content-Domain",values:[e.contentDomain]})),e.dekInfo&&(r={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&r.values.push(e.dekInfo.parameters),i+=s(r)),e.headers)for(var o=0;o{var n=r(392);r(3877),r(3860),r(928);var i=e.exports=n.pkcs1=n.pkcs1||{};function s(e,t,r){r||(r=n.md.sha1.create());for(var i="",s=Math.ceil(t/r.digestLength),o=0;o>24&255,o>>16&255,o>>8&255,255&o);r.start(),r.update(e+a),i+=r.digest().getBytes()}return i.substring(0,t)}i.encode_rsa_oaep=function(e,t,r){var i,o,a,c;"string"===typeof r?(i=r,o=arguments[3]||void 0,a=arguments[4]||void 0):r&&(i=r.label||void 0,o=r.seed||void 0,a=r.md||void 0,r.mgf1&&r.mgf1.md&&(c=r.mgf1.md)),a?a.start():a=n.md.sha1.create(),c||(c=a);var l=Math.ceil(e.n.bitLength()/8),u=l-2*a.digestLength-2;if(t.length>u)throw(y=new Error("RSAES-OAEP input message length is too long.")).length=t.length,y.maxLength=u,y;i||(i=""),a.update(i,"raw");for(var h=a.digest(),d="",f=u-t.length,p=0;p{var n=r(392);r(8605),r(5049),r(1400),r(2886),r(6193),r(4922),r(3860),r(3877),r(3391);var i=n.asn1,s=e.exports=n.pkcs7=n.pkcs7||{};function o(e){var t={},r=[];if(!i.validate(e,s.asn1.recipientInfoValidator,t,r)){var o=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw o.errors=r,o}return{version:t.version.charCodeAt(0),issuer:n.pki.RDNAttributesAsArray(t.issuer),serialNumber:n.util.createBuffer(t.serial).toHex(),encryptedContent:{algorithm:i.derToOid(t.encAlgorithm),parameter:t.encParameter?t.encParameter.value:void 0,content:t.encKey}}}function a(e){for(var t,r=[],s=0;s0){for(var r=i.create(i.Class.CONTEXT_SPECIFIC,1,!0,[]),s=0;s=r&&o0&&o.value[0].value.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,t)),s.length>0&&o.value[0].value.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,s)),o.value[0].value.push(i.create(i.Class.UNIVERSAL,i.Type.SET,!0,e.signerInfos)),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.type).getBytes()),o])},addSigner:function(t){var r=t.issuer,i=t.serialNumber;if(t.certificate){var s=t.certificate;"string"===typeof s&&(s=n.pki.certificateFromPem(s)),r=s.issuer.attributes,i=s.serialNumber}var o=t.key;if(!o)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"===typeof o&&(o=n.pki.privateKeyFromPem(o));var a=t.digestAlgorithm||n.pki.oids.sha1;switch(a){case n.pki.oids.sha1:case n.pki.oids.sha256:case n.pki.oids.sha384:case n.pki.oids.sha512:case n.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+a)}var c=t.authenticatedAttributes||[];if(c.length>0){for(var l=!1,u=!1,h=0;h{var n=r(392);r(5049),r(3877);var i=n.asn1,s=e.exports=n.pkcs7asn1=n.pkcs7asn1||{};n.pkcs7=n.pkcs7||{},n.pkcs7.asn1=s;var o={name:"ContentInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};s.contentInfoValidator=o;var a={name:"EncryptedContentInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};s.envelopedDataValidator={name:"EnvelopedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(a)},s.encryptedDataValidator={name:"EncryptedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"}].concat(a)};var c={name:"SignerInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};s.signedDataValidator={name:"SignedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},o,{name:"SignedData.Certificates",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,capture:"signerInfos",optional:!0,value:[c]}]},s.recipientInfoValidator={name:"RecipientInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter",optional:!0}]},{name:"RecipientInfo.encryptedKey",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}},5132:(e,t,r)=>{var n=r(392);r(3877),r(3055),r(3860),function(){if(n.prime)e.exports=n.prime;else{var t=e.exports=n.prime=n.prime||{},r=n.jsbn.BigInteger,i=[6,4,2,4,2,4,6,2],s=new r(null);s.fromInt(30);var o=function(e,t){return e|t};t.generateProbablePrime=function(e,t,i){"function"===typeof t&&(i=t,t={});var s=(t=t||{}).algorithm||"PRIMEINC";"string"===typeof s&&(s={name:s}),s.options=s.options||{};var o=t.prng||n.random,c={nextBytes:function(e){for(var t=o.getBytesSync(e.length),r=0;re&&(o=l(e,t));var f=o.toString(16);i.target.postMessage({hex:f,workLoad:u}),o.dAddOffset(h,0)}}}f()}(e,t,i,s);return a(e,t,i,s)}(e,c,s.options,i);throw new Error("Invalid prime generation algorithm: "+s.name)}}function a(e,t,r,n){var i=l(e,t),s=function(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}(i.bitLength());"millerRabinTests"in r&&(s=r.millerRabinTests);var o=10;"maxBlockTime"in r&&(o=r.maxBlockTime),c(i,e,t,0,s,o,n)}function c(e,t,r,s,o,a,u){var h=+new Date;do{if(e.bitLength()>t&&(e=l(t,r)),e.isProbablePrime(o))return u(null,e);e.dAddOffset(i[s++%8],0)}while(a<0||+new Date-h{var n=r(392);r(3877);var i=null;!n.util.isNodejs||n.options.usePureJavaScript||process.versions["node-webkit"]||(i=r(5819)),(e.exports=n.prng=n.prng||{}).create=function(e){for(var t={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},r=e.md,s=new Array(32),o=0;o<32;++o)s[o]=r.create();function a(){if(t.pools[0].messageLength>=32)return c();var e=32-t.pools[0].messageLength<<5;t.collect(t.seedFileSync(e)),c()}function c(){t.reseeds=4294967295===t.reseeds?0:t.reseeds+1;var e=t.plugin.md.create();e.update(t.keyBytes);for(var r=1,n=0;n<32;++n)t.reseeds%r===0&&(e.update(t.pools[n].digest().getBytes()),t.pools[n].start()),r<<=1;t.keyBytes=e.digest().getBytes(),e.start(),e.update(t.keyBytes);var i=e.digest().getBytes();t.key=t.plugin.formatKey(t.keyBytes),t.seed=t.plugin.formatSeed(i),t.generated=0}function l(e){var t=null,r=n.util.globalScope,i=r.crypto||r.msCrypto;i&&i.getRandomValues&&(t=function(e){return i.getRandomValues(e)});var s=n.util.createBuffer();if(t)for(;s.length()>16)))<<16,d=4294967295&(u=(2147483647&(u+=l>>15))+(u>>31));for(c=0;c<3;++c)h=d>>>(c<<3),h^=Math.floor(256*Math.random()),s.putByte(255&h)}return s.getBytes(e)}return t.pools=s,t.pool=0,t.generate=function(e,r){if(!r)return t.generateSync(e);var i=t.plugin.cipher,s=t.plugin.increment,o=t.plugin.formatKey,a=t.plugin.formatSeed,l=n.util.createBuffer();t.key=null,function u(h){if(h)return r(h);if(l.length()>=e)return r(null,l.getBytes(e));t.generated>1048575&&(t.key=null);if(null===t.key)return n.util.nextTick((function(){!function(e){if(t.pools[0].messageLength>=32)return c(),e();var r=32-t.pools[0].messageLength<<5;t.seedFile(r,(function(r,n){if(r)return e(r);t.collect(n),c(),e()}))}(u)}));var d=i(t.key,t.seed);t.generated+=d.length,l.putBytes(d),t.key=o(i(t.key,s(t.seed))),t.seed=a(i(t.key,t.seed)),n.util.setImmediate(u)}()},t.generateSync=function(e){var r=t.plugin.cipher,i=t.plugin.increment,s=t.plugin.formatKey,o=t.plugin.formatSeed;t.key=null;for(var c=n.util.createBuffer();c.length()1048575&&(t.key=null),null===t.key&&a();var l=r(t.key,t.seed);t.generated+=l.length,c.putBytes(l),t.key=s(r(t.key,i(t.seed))),t.seed=o(r(t.key,t.seed))}return c.getBytes(e)},i?(t.seedFile=function(e,t){i.randomBytes(e,(function(e,r){if(e)return t(e);t(null,r.toString())}))},t.seedFileSync=function(e){return i.randomBytes(e).toString()}):(t.seedFile=function(e,t){try{t(null,l(e))}catch(r){t(r)}},t.seedFileSync=l),t.collect=function(e){for(var r=e.length,n=0;n>i&255);t.collect(n)},t.registerWorker=function(e){if(e===self)t.seedFile=function(e,t){self.addEventListener("message",(function e(r){var n=r.data;n.forge&&n.forge.prng&&(self.removeEventListener("message",e),t(n.forge.prng.err,n.forge.prng.bytes))})),self.postMessage({forge:{prng:{needed:e}}})};else{e.addEventListener("message",(function(r){var n=r.data;n.forge&&n.forge.prng&&t.seedFile(n.forge.prng.needed,(function(t,r){e.postMessage({forge:{prng:{err:t,bytes:r}}})}))}))}},t}},325:(e,t,r)=>{var n=r(392);r(3860),r(3877),(e.exports=n.pss=n.pss||{}).create=function(e){3===arguments.length&&(e={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var t,r=e.md,i=e.mgf,s=r.digestLength,o=e.salt||null;if("string"===typeof o&&(o=n.util.createBuffer(o)),"saltLength"in e)t=e.saltLength;else{if(null===o)throw new Error("Salt length not specified or specific salt not given.");t=o.length()}if(null!==o&&o.length()!==t)throw new Error("Given salt length does not match length of given salt.");var a=e.prng||n.random,c={encode:function(e,c){var l,u,h=c-1,d=Math.ceil(h/8),f=e.digest().getBytes();if(d>8*d-h&255;return(b=String.fromCharCode(b.charCodeAt(0)&~E)+b.substr(1))+g+String.fromCharCode(188)},verify:function(e,o,a){var c,l=a-1,u=Math.ceil(l/8);if(o=o.substr(-u),u>8*u-l&255;if(0!==(d.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var g=i.generate(f,h),y="";for(c=0;c{var n=r(392);r(8605),r(7404),r(6140),r(3877),n.random&&n.random.getBytes?e.exports=n.random:function(t){var r={},i=new Array(4),s=n.util.createBuffer();function o(){var e=n.prng.create(r);return e.getBytes=function(t,r){return e.generate(t,r)},e.getBytesSync=function(t){return e.generate(t)},e}r.formatKey=function(e){var t=n.util.createBuffer(e);return(e=new Array(4))[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),n.aes._expandKey(e,!1)},r.formatSeed=function(e){var t=n.util.createBuffer(e);return(e=new Array(4))[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),e},r.cipher=function(e,t){return n.aes._updateBlock(e,t,i,!1),s.putInt32(i[0]),s.putInt32(i[1]),s.putInt32(i[2]),s.putInt32(i[3]),s.getBytes()},r.increment=function(e){return++e[3],e},r.md=n.md.sha256;var a=o(),c=null,l=n.util.globalScope,u=l.crypto||l.msCrypto;if(u&&u.getRandomValues&&(c=function(e){return u.getRandomValues(e)}),n.options.usePureJavaScript||!n.util.isNodejs&&!c){if("undefined"===typeof window||window.document,a.collectInt(+new Date,32),"undefined"!==typeof navigator){var h="";for(var d in navigator)try{"string"==typeof navigator[d]&&(h+=navigator[d])}catch(f){}a.collect(h),h=null}t&&(t().mousemove((function(e){a.collectInt(e.clientX,16),a.collectInt(e.clientY,16)})),t().keypress((function(e){a.collectInt(e.charCode,8)})))}if(n.random)for(var d in a)n.random[d]=a[d];else n.random=a;n.random.createInstance=o,e.exports=n.random}("undefined"!==typeof jQuery?jQuery:null)},654:(e,t,r)=>{var n=r(392);r(3877);var i=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],s=[1,2,3,5],o=function(e,t){return e<>16-t},a=function(e,t){return(65535&e)>>t|e<<16-t&65535};e.exports=n.rc2=n.rc2||{},n.rc2.expandKey=function(e,t){"string"===typeof e&&(e=n.util.createBuffer(e)),t=t||128;var r,s=e,o=e.length(),a=t,c=Math.ceil(a/8),l=255>>(7&a);for(r=o;r<128;r++)s.putByte(i[s.at(r-1)+s.at(r-o)&255]);for(s.setAt(128-c,i[s.at(128-c)&l]),r=127-c;r>=0;r--)s.setAt(r,i[s.at(r+1)^s.at(r+c)]);return s};var c=function(e,t,r){var i,c,l,u,h=!1,d=null,f=null,p=null,g=[];for(e=n.rc2.expandKey(e,t),l=0;l<64;l++)g.push(e.getInt16Le());r?(i=function(e){for(l=0;l<4;l++)e[l]+=g[u]+(e[(l+3)%4]&e[(l+2)%4])+(~e[(l+3)%4]&e[(l+1)%4]),e[l]=o(e[l],s[l]),u++},c=function(e){for(l=0;l<4;l++)e[l]+=g[63&e[(l+3)%4]]}):(i=function(e){for(l=3;l>=0;l--)e[l]=a(e[l],s[l]),e[l]-=g[u]+(e[(l+3)%4]&e[(l+2)%4])+(~e[(l+3)%4]&e[(l+1)%4]),u--},c=function(e){for(l=3;l>=0;l--)e[l]-=g[63&e[(l+3)%4]]});var y=function(e){var t=[];for(l=0;l<4;l++){var n=d.getInt16Le();null!==p&&(r?n^=p.getInt16Le():p.putInt16Le(n)),t.push(65535&n)}u=r?0:63;for(var i=0;i=8;)y([[5,i],[1,c],[6,i],[1,c],[5,i]])},finish:function(e){var t=!0;if(r)if(e)t=e(8,d,!r);else{var n=8===d.length()?8:8-d.length();d.fillWithByte(n,n)}if(t&&(h=!0,m.update()),!r&&(t=0===d.length()))if(e)t=e(8,f,!r);else{var i=f.length(),s=f.at(i-1);s>i?t=!1:f.truncate(s)}return t}}};n.rc2.startEncrypting=function(e,t,r){var i=n.rc2.createEncryptionCipher(e,128);return i.start(t,r),i},n.rc2.createEncryptionCipher=function(e,t){return c(e,t,!0)},n.rc2.startDecrypting=function(e,t,r){var i=n.rc2.createDecryptionCipher(e,128);return i.start(t,r),i},n.rc2.createDecryptionCipher=function(e,t){return c(e,t,!1)}},5493:(e,t,r)=>{var n=r(392);if(r(5049),r(3055),r(2886),r(2627),r(5132),r(3860),r(3877),"undefined"===typeof i)var i=n.jsbn.BigInteger;var s=n.util.isNodejs?r(5819):null,o=n.asn1,a=n.util;n.pki=n.pki||{},e.exports=n.pki.rsa=n.rsa=n.rsa||{};var c=n.pki,l=[6,4,2,4,2,4,6,2],u={name:"PrivateKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},h={name:"RSAPrivateKey",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},d={name:"RSAPublicKey",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},f=n.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:o.Class.UNIVERSAL,type:o.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},p={name:"DigestInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:o.Class.UNIVERSAL,type:o.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},g=function(e){var t;if(!(e.algorithm in c.oids)){var r=new Error("Unknown message digest algorithm.");throw r.algorithm=e.algorithm,r}t=c.oids[e.algorithm];var n=o.oidToDer(t).getBytes(),i=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[]),s=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[]);s.value.push(o.create(o.Class.UNIVERSAL,o.Type.OID,!1,n)),s.value.push(o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,""));var a=o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,e.digest().getBytes());return i.value.push(s),i.value.push(a),o.toDer(i).getBytes()},y=function(e,t,r){if(r)return e.modPow(t.e,t.n);if(!t.p||!t.q)return e.modPow(t.d,t.n);var s;t.dP||(t.dP=t.d.mod(t.p.subtract(i.ONE))),t.dQ||(t.dQ=t.d.mod(t.q.subtract(i.ONE))),t.qInv||(t.qInv=t.q.modInverse(t.p));do{s=new i(n.util.bytesToHex(n.random.getBytes(t.n.bitLength()/8)),16)}while(s.compareTo(t.n)>=0||!s.gcd(t.n).equals(i.ONE));for(var o=(e=e.multiply(s.modPow(t.e,t.n)).mod(t.n)).mod(t.p).modPow(t.dP,t.p),a=e.mod(t.q).modPow(t.dQ,t.q);o.compareTo(a)<0;)o=o.add(t.p);var c=o.subtract(a).multiply(t.qInv).mod(t.p).multiply(t.q).add(a);return c=c.multiply(s.modInverse(t.n)).mod(t.n)};function m(e,t,r){var i=n.util.createBuffer(),s=Math.ceil(t.n.bitLength()/8);if(e.length>s-11){var o=new Error("Message is too long for PKCS#1 v1.5 padding.");throw o.length=e.length,o.max=s-11,o}i.putByte(0),i.putByte(r);var a,c=s-3-e.length;if(0===r||1===r){a=0===r?0:255;for(var l=0;l0;){var u=0,h=n.random.getBytes(c);for(l=0;l1;){if(255!==o.getByte()){--o.read;break}++l}else if(2===c)for(l=0;o.length()>1;){if(0===o.getByte()){--o.read;break}++l}if(0!==o.getByte()||l!==s-3-o.length())throw new Error("Encryption block is invalid.");return o.getBytes()}function w(e,t,r){"function"===typeof t&&(r=t,t={});var s={algorithm:{name:(t=t||{}).algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};function o(){a(e.pBits,(function(t,n){return t?r(t):(e.p=n,null!==e.q?l(t,e.q):void a(e.qBits,l))}))}function a(e,t){n.prime.generateProbablePrime(e,s,t)}function l(t,n){if(t)return r(t);if(e.q=n,e.p.compareTo(e.q)<0){var s=e.p;e.p=e.q,e.q=s}if(0!==e.p.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.p=null,void o();if(0!==e.q.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.q=null,void a(e.qBits,l);if(e.p1=e.p.subtract(i.ONE),e.q1=e.q.subtract(i.ONE),e.phi=e.p1.multiply(e.q1),0!==e.phi.gcd(e.e).compareTo(i.ONE))return e.p=e.q=null,void o();if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits)return e.q=null,void a(e.qBits,l);var u=e.e.modInverse(e.phi);e.keys={privateKey:c.rsa.setPrivateKey(e.n,e.e,u,e.p,e.q,u.mod(e.p1),u.mod(e.q1),e.q.modInverse(e.p)),publicKey:c.rsa.setPublicKey(e.n,e.e)},r(null,e.keys)}"prng"in t&&(s.prng=t.prng),o()}function b(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var r=n.util.hexToBytes(t);return r.length>1&&(0===r.charCodeAt(0)&&0===(128&r.charCodeAt(1))||255===r.charCodeAt(0)&&128===(128&r.charCodeAt(1)))?r.substr(1):r}function E(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function S(e){return n.util.isNodejs&&"function"===typeof s[e]}function _(e){return"undefined"!==typeof a.globalScope&&"object"===typeof a.globalScope.crypto&&"object"===typeof a.globalScope.crypto.subtle&&"function"===typeof a.globalScope.crypto.subtle[e]}function I(e){return"undefined"!==typeof a.globalScope&&"object"===typeof a.globalScope.msCrypto&&"object"===typeof a.globalScope.msCrypto.subtle&&"function"===typeof a.globalScope.msCrypto.subtle[e]}function A(e){for(var t=n.util.hexToBytes(e.toString(16)),r=new Uint8Array(t.length),i=0;i0;)u.putByte(0),--h;return u.putBytes(n.util.hexToBytes(l)),u.getBytes()},c.rsa.decrypt=function(e,t,r,s){var o=Math.ceil(t.n.bitLength()/8);if(e.length!==o){var a=new Error("Encrypted message length is invalid.");throw a.length=e.length,a.expected=o,a}var c=new i(n.util.createBuffer(e).toHex(),16);if(c.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var l=y(c,t,r).toString(16),u=n.util.createBuffer(),h=o-Math.ceil(l.length/2);h>0;)u.putByte(0),--h;return u.putBytes(n.util.hexToBytes(l)),!1!==s?v(u.getBytes(),t,r):u.getBytes()},c.rsa.createKeyPairGenerationState=function(e,t,r){"string"===typeof e&&(e=parseInt(e,10)),e=e||2048;var s,o=(r=r||{}).prng||n.random,a={nextBytes:function(e){for(var t=o.getBytesSync(e.length),r=0;r>1,pBits:e-(e>>1),pqState:0,num:null,keys:null}).e.fromInt(s.eInt),s},c.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var r=new i(null);r.fromInt(30);for(var n,s=0,o=function(e,t){return e|t},a=+new Date,u=0;null===e.keys&&(t<=0||uh?e.pqState=0:e.num.isProbablePrime(E(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(l[s++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(i.ONE).gcd(e.e).compareTo(i.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(i.ONE),e.q1=e.q.subtract(i.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(i.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var f=e.e.modInverse(e.phi);e.keys={privateKey:c.rsa.setPrivateKey(e.n,e.e,f,e.p,e.q,f.mod(e.p1),f.mod(e.q1),e.q.modInverse(e.p)),publicKey:c.rsa.setPublicKey(e.n,e.e)}}u+=(n=+new Date)-a,a=n}return null!==e.keys},c.rsa.generateKeyPair=function(e,t,r,i){if(1===arguments.length?"object"===typeof e?(r=e,e=void 0):"function"===typeof e&&(i=e,e=void 0):2===arguments.length?"number"===typeof e?"function"===typeof t?(i=t,t=void 0):"number"!==typeof t&&(r=t,t=void 0):(r=e,i=t,e=void 0,t=void 0):3===arguments.length&&("number"===typeof t?"function"===typeof r&&(i=r,r=void 0):(i=r,r=t,t=void 0)),r=r||{},void 0===e&&(e=r.bits||2048),void 0===t&&(t=r.e||65537),!n.options.usePureJavaScript&&!r.prng&&e>=256&&e<=16384&&(65537===t||3===t))if(i){if(S("generateKeyPair"))return s.generateKeyPair("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},(function(e,t,r){if(e)return i(e);i(null,{privateKey:c.privateKeyFromPem(r),publicKey:c.publicKeyFromPem(t)})}));if(_("generateKey")&&_("exportKey"))return a.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:A(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then((function(e){return a.globalScope.crypto.subtle.exportKey("pkcs8",e.privateKey)})).then(void 0,(function(e){i(e)})).then((function(e){if(e){var t=c.privateKeyFromAsn1(o.fromDer(n.util.createBuffer(e)));i(null,{privateKey:t,publicKey:c.setRsaPublicKey(t.n,t.e)})}}));if(I("generateKey")&&I("exportKey")){var l=a.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:A(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);return l.oncomplete=function(e){var t=e.target.result,r=a.globalScope.msCrypto.subtle.exportKey("pkcs8",t.privateKey);r.oncomplete=function(e){var t=e.target.result,r=c.privateKeyFromAsn1(o.fromDer(n.util.createBuffer(t)));i(null,{privateKey:r,publicKey:c.setRsaPublicKey(r.n,r.e)})},r.onerror=function(e){i(e)}},void(l.onerror=function(e){i(e)})}}else if(S("generateKeyPairSync")){var u=s.generateKeyPairSync("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:c.privateKeyFromPem(u.privateKey),publicKey:c.publicKeyFromPem(u.publicKey)}}var h=c.rsa.createKeyPairGenerationState(e,t,r);if(!i)return c.rsa.stepKeyPairGenerationState(h,0),h.keys;w(h,r,i)},c.setRsaPublicKey=c.rsa.setPublicKey=function(e,t){var r={n:e,e:t,encrypt:function(e,t,i){if("string"===typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===t)t={encode:function(e,t,r){return m(e,t,2).getBytes()}};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={encode:function(e,t){return n.pkcs1.encode_rsa_oaep(t,e,i)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(t))t={encode:function(e){return e}};else if("string"===typeof t)throw new Error('Unsupported encryption scheme: "'+t+'".');var s=t.encode(e,r,!0);return c.rsa.encrypt(s,r,!0)},verify:function(e,t,i,s){"string"===typeof i?i=i.toUpperCase():void 0===i&&(i="RSASSA-PKCS1-V1_5"),void 0===s&&(s={_parseAllDigestBytes:!0}),"_parseAllDigestBytes"in s||(s._parseAllDigestBytes=!0),"RSASSA-PKCS1-V1_5"===i?i={verify:function(e,t){t=v(t,r,!0);var i=o.fromDer(t,{parseAllBytes:s._parseAllDigestBytes}),a={},c=[];if(!o.validate(i,p,a,c))throw(l=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.")).errors=c,l;var l,u=o.derToOid(a.algorithmIdentifier);if(u!==n.oids.md2&&u!==n.oids.md5&&u!==n.oids.sha1&&u!==n.oids.sha224&&u!==n.oids.sha256&&u!==n.oids.sha384&&u!==n.oids.sha512&&u!==n.oids["sha512-224"]&&u!==n.oids["sha512-256"])throw(l=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.")).oid=u,l;if((u===n.oids.md2||u===n.oids.md5)&&!("parameters"in a))throw new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifer NULL parameters.");return e===a.digest}}:"NONE"!==i&&"NULL"!==i&&null!==i||(i={verify:function(e,t){return e===(t=v(t,r,!0))}});var a=c.rsa.decrypt(t,r,!0,!1);return i.verify(e,a,r.n.bitLength())}};return r},c.setRsaPrivateKey=c.rsa.setPrivateKey=function(e,t,r,i,s,o,a,l){var u={n:e,e:t,d:r,p:i,q:s,dP:o,dQ:a,qInv:l,decrypt:function(e,t,r){"string"===typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5");var i=c.rsa.decrypt(e,u,!1,!1);if("RSAES-PKCS1-V1_5"===t)t={decode:v};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={decode:function(e,t){return n.pkcs1.decode_rsa_oaep(t,e,r)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(t))throw new Error('Unsupported encryption scheme: "'+t+'".');t={decode:function(e){return e}}}return t.decode(i,u,!1)},sign:function(e,t){var r=!1;"string"===typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:g},r=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},r=1);var n=t.encode(e,u.n.bitLength());return c.rsa.encrypt(n,u,r)}};return u},c.wrapRsaPrivateKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,o.integerToDer(0).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(c.oids.rsaEncryption).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")]),o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,o.toDer(e).getBytes())])},c.privateKeyFromAsn1=function(e){var t,r,s,a,l,d,f,p,g={},y=[];if(o.validate(e,u,g,y)&&(e=o.fromDer(n.util.createBuffer(g.privateKey))),g={},y=[],!o.validate(e,h,g,y)){var m=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw m.errors=y,m}return t=n.util.createBuffer(g.privateKeyModulus).toHex(),r=n.util.createBuffer(g.privateKeyPublicExponent).toHex(),s=n.util.createBuffer(g.privateKeyPrivateExponent).toHex(),a=n.util.createBuffer(g.privateKeyPrime1).toHex(),l=n.util.createBuffer(g.privateKeyPrime2).toHex(),d=n.util.createBuffer(g.privateKeyExponent1).toHex(),f=n.util.createBuffer(g.privateKeyExponent2).toHex(),p=n.util.createBuffer(g.privateKeyCoefficient).toHex(),c.setRsaPrivateKey(new i(t,16),new i(r,16),new i(s,16),new i(a,16),new i(l,16),new i(d,16),new i(f,16),new i(p,16))},c.privateKeyToAsn1=c.privateKeyToRSAPrivateKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,o.integerToDer(0).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(e.n)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(e.e)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(e.d)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(e.p)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(e.q)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(e.dP)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(e.dQ)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(e.qInv))])},c.publicKeyFromAsn1=function(e){var t={},r=[];if(o.validate(e,f,t,r)){var s,a=o.derToOid(t.publicKeyOid);if(a!==c.oids.rsaEncryption)throw(s=new Error("Cannot read public key. Unknown OID.")).oid=a,s;e=t.rsaPublicKey}if(r=[],!o.validate(e,d,t,r))throw(s=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.")).errors=r,s;var l=n.util.createBuffer(t.publicKeyModulus).toHex(),u=n.util.createBuffer(t.publicKeyExponent).toHex();return c.setRsaPublicKey(new i(l,16),new i(u,16))},c.publicKeyToAsn1=c.publicKeyToSubjectPublicKeyInfo=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(c.oids.rsaEncryption).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")]),o.create(o.Class.UNIVERSAL,o.Type.BITSTRING,!1,[c.publicKeyToRSAPublicKey(e)])])},c.publicKeyToRSAPublicKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(e.n)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(e.e))])}},928:(e,t,r)=>{var n=r(392);r(29),r(3877);var i=e.exports=n.sha1=n.sha1||{};n.md.sha1=n.md.algorithms.sha1=i,i.create=function(){o||(s=String.fromCharCode(128),s+=n.util.fillString(String.fromCharCode(0),64),o=!0);var e=null,t=n.util.createBuffer(),r=new Array(80),i={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var r=i.messageLengthSize/4,s=0;s>>0,c>>>0];for(var l=i.fullMessageLength.length-1;l>=0;--l)i.fullMessageLength[l]+=c[1],c[1]=c[0]+(i.fullMessageLength[l]/4294967296>>>0),i.fullMessageLength[l]=i.fullMessageLength[l]>>>0,c[0]=c[1]/4294967296>>>0;return t.putBytes(s),a(e,r,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var o=n.util.createBuffer();o.putBytes(t.bytes());var c,l=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;o.putBytes(s.substr(0,i.blockLength-l));for(var u=8*i.fullMessageLength[0],h=0;h>>0,o.putInt32(u>>>0),u=c>>>0;o.putInt32(u);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};a(d,r,o);var f=n.util.createBuffer();return f.putInt32(d.h0),f.putInt32(d.h1),f.putInt32(d.h2),f.putInt32(d.h3),f.putInt32(d.h4),f},i};var s=null,o=!1;function a(e,t,r){for(var n,i,s,o,a,c,l,u=r.length();u>=64;){for(i=e.h0,s=e.h1,o=e.h2,a=e.h3,c=e.h4,l=0;l<16;++l)n=r.getInt32(),t[l]=n,n=(i<<5|i>>>27)+(a^s&(o^a))+c+1518500249+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;l<20;++l)n=(n=t[l-3]^t[l-8]^t[l-14]^t[l-16])<<1|n>>>31,t[l]=n,n=(i<<5|i>>>27)+(a^s&(o^a))+c+1518500249+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;l<32;++l)n=(n=t[l-3]^t[l-8]^t[l-14]^t[l-16])<<1|n>>>31,t[l]=n,n=(i<<5|i>>>27)+(s^o^a)+c+1859775393+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;l<40;++l)n=(n=t[l-6]^t[l-16]^t[l-28]^t[l-32])<<2|n>>>30,t[l]=n,n=(i<<5|i>>>27)+(s^o^a)+c+1859775393+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;l<60;++l)n=(n=t[l-6]^t[l-16]^t[l-28]^t[l-32])<<2|n>>>30,t[l]=n,n=(i<<5|i>>>27)+(s&o|a&(s^o))+c+2400959708+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;l<80;++l)n=(n=t[l-6]^t[l-16]^t[l-28]^t[l-32])<<2|n>>>30,t[l]=n,n=(i<<5|i>>>27)+(s^o^a)+c+3395469782+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;e.h0=e.h0+i|0,e.h1=e.h1+s|0,e.h2=e.h2+o|0,e.h3=e.h3+a|0,e.h4=e.h4+c|0,u-=64}}},7404:(e,t,r)=>{var n=r(392);r(29),r(3877);var i=e.exports=n.sha256=n.sha256||{};n.md.sha256=n.md.algorithms.sha256=i,i.create=function(){o||(s=String.fromCharCode(128),s+=n.util.fillString(String.fromCharCode(0),64),a=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],o=!0);var e=null,t=n.util.createBuffer(),r=new Array(64),i={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var r=i.messageLengthSize/4,s=0;s>>0,a>>>0];for(var l=i.fullMessageLength.length-1;l>=0;--l)i.fullMessageLength[l]+=a[1],a[1]=a[0]+(i.fullMessageLength[l]/4294967296>>>0),i.fullMessageLength[l]=i.fullMessageLength[l]>>>0,a[0]=a[1]/4294967296>>>0;return t.putBytes(s),c(e,r,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var o=n.util.createBuffer();o.putBytes(t.bytes());var a,l=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;o.putBytes(s.substr(0,i.blockLength-l));for(var u=8*i.fullMessageLength[0],h=0;h>>0,o.putInt32(u>>>0),u=a>>>0;o.putInt32(u);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};c(d,r,o);var f=n.util.createBuffer();return f.putInt32(d.h0),f.putInt32(d.h1),f.putInt32(d.h2),f.putInt32(d.h3),f.putInt32(d.h4),f.putInt32(d.h5),f.putInt32(d.h6),f.putInt32(d.h7),f},i};var s=null,o=!1,a=null;function c(e,t,r){for(var n,i,s,o,c,l,u,h,d,f,p,g,y,m=r.length();m>=64;){for(c=0;c<16;++c)t[c]=r.getInt32();for(;c<64;++c)n=((n=t[c-2])>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,i=((i=t[c-15])>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,t[c]=n+t[c-7]+i+t[c-16]|0;for(l=e.h0,u=e.h1,h=e.h2,d=e.h3,f=e.h4,p=e.h5,g=e.h6,y=e.h7,c=0;c<64;++c)s=(l>>>2|l<<30)^(l>>>13|l<<19)^(l>>>22|l<<10),o=l&u|h&(l^u),n=y+((f>>>6|f<<26)^(f>>>11|f<<21)^(f>>>25|f<<7))+(g^f&(p^g))+a[c]+t[c],y=g,g=p,p=f,f=d+n>>>0,d=h,h=u,u=l,l=n+(i=s+o)>>>0;e.h0=e.h0+l|0,e.h1=e.h1+u|0,e.h2=e.h2+h|0,e.h3=e.h3+d|0,e.h4=e.h4+f|0,e.h5=e.h5+p|0,e.h6=e.h6+g|0,e.h7=e.h7+y|0,m-=64}}},4770:(e,t,r)=>{var n=r(392);r(29),r(3877);var i=e.exports=n.sha512=n.sha512||{};n.md.sha512=n.md.algorithms.sha512=i;var s=n.sha384=n.sha512.sha384=n.sha512.sha384||{};s.create=function(){return i.create("SHA-384")},n.md.sha384=n.md.algorithms.sha384=s,n.sha512.sha256=n.sha512.sha256||{create:function(){return i.create("SHA-512/256")}},n.md["sha512/256"]=n.md.algorithms["sha512/256"]=n.sha512.sha256,n.sha512.sha224=n.sha512.sha224||{create:function(){return i.create("SHA-512/224")}},n.md["sha512/224"]=n.md.algorithms["sha512/224"]=n.sha512.sha224,i.create=function(e){if(a||(o=String.fromCharCode(128),o+=n.util.fillString(String.fromCharCode(0),128),c=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,106217008],[3516065817,3606008344],[3600352804,1432725776],[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],[3515267271,566280711],[3940187606,3454069534],[4118630271,4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],(l={})["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],l["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],l["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],l["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],a=!0),"undefined"===typeof e&&(e="SHA-512"),!(e in l))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=l[e],r=null,i=n.util.createBuffer(),s=new Array(80),h=0;h<80;++h)s[h]=new Array(2);var d=64;switch(e){case"SHA-384":d=48;break;case"SHA-512/256":d=32;break;case"SHA-512/224":d=28}var f={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:d,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){f.messageLength=0,f.fullMessageLength=f.messageLength128=[];for(var e=f.messageLengthSize/4,s=0;s>>0,o>>>0];for(var a=f.fullMessageLength.length-1;a>=0;--a)f.fullMessageLength[a]+=o[1],o[1]=o[0]+(f.fullMessageLength[a]/4294967296>>>0),f.fullMessageLength[a]=f.fullMessageLength[a]>>>0,o[0]=o[1]/4294967296>>>0;return i.putBytes(e),u(r,s,i),(i.read>2048||0===i.length())&&i.compact(),f},f.digest=function(){var t=n.util.createBuffer();t.putBytes(i.bytes());var a,c=f.fullMessageLength[f.fullMessageLength.length-1]+f.messageLengthSize&f.blockLength-1;t.putBytes(o.substr(0,f.blockLength-c));for(var l=8*f.fullMessageLength[0],h=0;h>>0,t.putInt32(l>>>0),l=a>>>0;t.putInt32(l);var d=new Array(r.length);for(h=0;h=128;){for(P=0;P<16;++P)t[P][0]=r.getInt32()>>>0,t[P][1]=r.getInt32()>>>0;for(;P<80;++P)n=(((D=(O=t[P-2])[0])>>>19|(N=O[1])<<13)^(N>>>29|D<<3)^D>>>6)>>>0,i=((D<<13|N>>>19)^(N<<3|D>>>29)^(D<<26|N>>>6))>>>0,s=(((D=(B=t[P-15])[0])>>>1|(N=B[1])<<31)^(D>>>8|N<<24)^D>>>7)>>>0,o=((D<<31|N>>>1)^(D<<24|N>>>8)^(D<<25|N>>>7))>>>0,L=t[P-7],x=t[P-16],N=i+L[1]+o+x[1],t[P][0]=n+L[0]+s+x[0]+(N/4294967296>>>0)>>>0,t[P][1]=N>>>0;for(p=e[0][0],g=e[0][1],y=e[1][0],m=e[1][1],v=e[2][0],w=e[2][1],b=e[3][0],E=e[3][1],S=e[4][0],_=e[4][1],I=e[5][0],A=e[5][1],C=e[6][0],T=e[6][1],R=e[7][0],k=e[7][1],P=0;P<80;++P)u=((S>>>14|_<<18)^(S>>>18|_<<14)^(_>>>9|S<<23))>>>0,h=(C^S&(I^C))>>>0,a=((p>>>28|g<<4)^(g>>>2|p<<30)^(g>>>7|p<<25))>>>0,l=((p<<4|g>>>28)^(g<<30|p>>>2)^(g<<25|p>>>7))>>>0,d=(p&y|v&(p^y))>>>0,f=(g&m|w&(g^m))>>>0,N=k+(((S<<18|_>>>14)^(S<<14|_>>>18)^(_<<23|S>>>9))>>>0)+((T^_&(A^T))>>>0)+c[P][1]+t[P][1],n=R+u+h+c[P][0]+t[P][0]+(N/4294967296>>>0)>>>0,i=N>>>0,s=a+d+((N=l+f)/4294967296>>>0)>>>0,o=N>>>0,R=C,k=T,C=I,T=A,I=S,A=_,S=b+n+((N=E+i)/4294967296>>>0)>>>0,_=N>>>0,b=v,E=w,v=y,w=m,y=p,m=g,p=n+s+((N=i+o)/4294967296>>>0)>>>0,g=N>>>0;N=e[0][1]+g,e[0][0]=e[0][0]+p+(N/4294967296>>>0)>>>0,e[0][1]=N>>>0,N=e[1][1]+m,e[1][0]=e[1][0]+y+(N/4294967296>>>0)>>>0,e[1][1]=N>>>0,N=e[2][1]+w,e[2][0]=e[2][0]+v+(N/4294967296>>>0)>>>0,e[2][1]=N>>>0,N=e[3][1]+E,e[3][0]=e[3][0]+b+(N/4294967296>>>0)>>>0,e[3][1]=N>>>0,N=e[4][1]+_,e[4][0]=e[4][0]+S+(N/4294967296>>>0)>>>0,e[4][1]=N>>>0,N=e[5][1]+A,e[5][0]=e[5][0]+I+(N/4294967296>>>0)>>>0,e[5][1]=N>>>0,N=e[6][1]+T,e[6][0]=e[6][0]+C+(N/4294967296>>>0)>>>0,e[6][1]=N>>>0,N=e[7][1]+k,e[7][0]=e[7][0]+R+(N/4294967296>>>0)>>>0,e[7][1]=N>>>0,M-=128}}},3877:(e,t,r)=>{var n=r(392),i=r(5754),s=e.exports=n.util=n.util||{};function o(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function a(e){if(this.data="",this.read=0,"string"===typeof e)this.data=e;else if(s.isArrayBuffer(e)||s.isArrayBufferView(e))if("undefined"!==typeof Buffer&&e instanceof Buffer)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(n){for(var r=0;r15?(r=Date.now(),o(e)):(t.push(e),1===t.length&&i.setAttribute("a",n=!n))}}s.nextTick=s.setImmediate}(),s.isNodejs="undefined"!==typeof process&&process.versions&&process.versions.node,s.globalScope=s.isNodejs?r.g:"undefined"===typeof self?window:self,s.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},s.isArrayBuffer=function(e){return"undefined"!==typeof ArrayBuffer&&e instanceof ArrayBuffer},s.isArrayBufferView=function(e){return e&&s.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},s.ByteBuffer=a,s.ByteStringBuffer=a;s.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},s.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},s.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},s.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},s.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},s.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},s.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(s.encodeUtf8(e))},s.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},s.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},s.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},s.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},s.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},s.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},s.ByteStringBuffer.prototype.putInt=function(e,t){o(t);var r="";do{t-=8,r+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(r)},s.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<0);return t},s.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},s.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},s.ByteStringBuffer.prototype.bytes=function(e){return"undefined"===typeof e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},s.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},s.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},s.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},s.ByteStringBuffer.prototype.copy=function(){var e=s.createBuffer(this.data);return e.read=this.read,e},s.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},s.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},s.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},s.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t=e)return this;t=Math.max(t||this.growSize,e);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+t);return n.set(r),this.data=new DataView(n.buffer),this},s.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},s.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},s.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},s.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},s.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},s.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},s.DataBuffer.prototype.putInt=function(e,t){o(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},s.DataBuffer.prototype.putSignedInt=function(e,t){return o(t),this.accommodate(t/8),e<0&&(e+=2<0);return t},s.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},s.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},s.DataBuffer.prototype.bytes=function(e){return"undefined"===typeof e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},s.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},s.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},s.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},s.DataBuffer.prototype.copy=function(){return new s.DataBuffer(this)},s.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},s.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},s.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},s.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return r},s.xorBytes=function(e,t,r){for(var n="",i="",s="",o=0,a=0;r>0;--r,++o)i=e.charCodeAt(o)^t.charCodeAt(o),a>=10&&(n+=s,s="",a=0),s+=String.fromCharCode(i),++a;return n+=s},s.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",l=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],u="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";s.encode64=function(e,t){for(var r,n,i,s="",o="",a=0;a>2),s+=c.charAt((3&r)<<4|n>>4),isNaN(n)?s+="==":(s+=c.charAt((15&n)<<2|i>>6),s+=isNaN(i)?"=":c.charAt(63&i)),t&&s.length>t&&(o+=s.substr(0,t)+"\r\n",s=s.substr(t));return o+=s},s.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,n,i,s="",o=0;o>4),64!==n&&(s+=String.fromCharCode((15&r)<<4|n>>2),64!==i&&(s+=String.fromCharCode((3&n)<<6|i)));return s},s.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},s.decodeUtf8=function(e){return decodeURIComponent(escape(e))},s.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:i.encode,decode:i.decode}},s.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},s.binary.raw.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(e.length));for(var i=r=r||0,s=0;s>2),s+=c.charAt((3&r)<<4|n>>4),isNaN(n)?s+="==":(s+=c.charAt((15&n)<<2|i>>6),s+=isNaN(i)?"=":c.charAt(63&i)),t&&s.length>t&&(o+=s.substr(0,t)+"\r\n",s=s.substr(t));return o+=s},s.binary.base64.decode=function(e,t,r){var n,i,s,o,a=t;a||(a=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var c=0,u=r=r||0;c>4,64!==s&&(a[u++]=(15&i)<<4|s>>2,64!==o&&(a[u++]=(3&s)<<6|o));return t?u-r:a.subarray(0,u)},s.binary.base58.encode=function(e,t){return s.binary.baseN.encode(e,u,t)},s.binary.base58.decode=function(e,t){return s.binary.baseN.decode(e,u,t)},s.text={utf8:{},utf16:{}},s.text.utf8.encode=function(e,t,r){e=s.encodeUtf8(e);var n=t;n||(n=new Uint8Array(e.length));for(var i=r=r||0,o=0;o0&&s.push(r),o=n.lastIndex;var a=t[0][1];switch(a){case"s":case"o":i");break;case"%":s.push("%");break;default:s.push("<%"+a+"?>")}}return s.push(e.substring(o)),s.join("")},s.formatNumber=function(e,t,r,n){var i=e,s=isNaN(t=Math.abs(t))?2:t,o=void 0===r?",":r,a=void 0===n?".":n,c=i<0?"-":"",l=parseInt(i=Math.abs(+i||0).toFixed(s),10)+"",u=l.length>3?l.length%3:0;return c+(u?l.substr(0,u)+a:"")+l.substr(u).replace(/(\d{3})(?=\d)/g,"$1"+a)+(s?o+Math.abs(i-l).toFixed(s).slice(2):"")},s.formatSize=function(e){return e=e>=1073741824?s.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?s.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?s.formatNumber(e/1024,0)+" KiB":s.formatNumber(e,0)+" bytes"},s.bytesFromIP=function(e){return-1!==e.indexOf(".")?s.bytesFromIPv4(e):-1!==e.indexOf(":")?s.bytesFromIPv6(e):null},s.bytesFromIPv4=function(e){if(4!==(e=e.split(".")).length)return null;for(var t=s.createBuffer(),r=0;rr[n].end-r[n].start&&(n=r.length-1)):r.push({start:c,end:c})}t.push(o)}if(r.length>0){var l=r[n];l.end-l.start>0&&(t.splice(l.start,l.end-l.start+1,""),0===l.start&&t.unshift(""),7===l.end&&t.push(""))}return t.join(":")},s.estimateCores=function(e,t){if("function"===typeof e&&(t=e,e={}),e=e||{},"cores"in s&&!e.update)return t(null,s.cores);if("undefined"!==typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return s.cores=navigator.hardwareConcurrency,t(null,s.cores);if("undefined"===typeof Worker)return s.cores=1,t(null,s.cores);if("undefined"===typeof Blob)return s.cores=2,t(null,s.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",(function(e){for(var t=Date.now(),r=t+4;Date.now()a.st&&i.sti.st&&a.st{var n=r(392);r(8605),r(5049),r(1400),r(29),r(1746),r(2886),r(6193),r(325),r(5493),r(3877);var i=n.asn1,s=e.exports=n.pki=n.pki||{},o=s.oids,a={};a.CN=o.commonName,a.commonName="CN",a.C=o.countryName,a.countryName="C",a.L=o.localityName,a.localityName="L",a.ST=o.stateOrProvinceName,a.stateOrProvinceName="ST",a.O=o.organizationName,a.organizationName="O",a.OU=o.organizationalUnitName,a.organizationalUnitName="OU",a.E=o.emailAddress,a.emailAddress="E";var c=n.pki.rsa.publicKeyValidator,l={name:"Certificate",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:i.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:i.Class.UNIVERSAL,type:i.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:i.Class.UNIVERSAL,type:i.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:i.Class.UNIVERSAL,type:i.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:i.Class.UNIVERSAL,type:i.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},c,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:i.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:i.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:i.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},u={name:"rsapss",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:i.Class.UNIVERSAL,type:i.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:i.Class.UNIVERSAL,type:i.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:i.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:i.Class.UNIVERSAL,type:i.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:i.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:i.Class.UNIVERSAL,type:i.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},h={name:"CertificationRequestInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},c,{name:"CertificationRequestInfo.attributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0}]}]}]},d={name:"CertificationRequest",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[h,{name:"CertificationRequest.signatureAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:i.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};function f(e,t){"string"===typeof t&&(t={shortName:t});for(var r,n=null,i=0;null===n&&i128)throw new Error('Invalid "nsComment" content.');e.value=i.create(i.Class.UNIVERSAL,i.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&t.cert){var f=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=f.toHex(),e.value=i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,f.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);u=e.value.value;if(e.keyIdentifier){var p=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;u.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!1,p))}if(e.authorityCertIssuer){var g=[i.create(i.Class.CONTEXT_SPECIFIC,4,!0,[m(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];u.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,g))}if(e.serialNumber){var y=n.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);u.push(i.create(i.Class.CONTEXT_SPECIFIC,2,!1,y))}}else if("cRLDistributionPoints"===e.name){e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);u=e.value.value;var v,w=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),b=i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[]);for(d=0;d2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(h.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(c.validity.notBefore=h[0],c.validity.notAfter=h[1],c.tbsCertificate=r.tbsCertificate,t){c.md=g({signatureOid:c.signatureOid,type:"certificate"});var d=i.toDer(c.tbsCertificate);c.md.update(d.getBytes())}var y=n.md.sha1.create(),m=i.toDer(r.certIssuer);y.update(m.getBytes()),c.issuer.getField=function(e){return f(c.issuer,e)},c.issuer.addField=function(e){v([e]),c.issuer.attributes.push(e)},c.issuer.attributes=s.RDNAttributesAsArray(r.certIssuer),r.certIssuerUniqueId&&(c.issuer.uniqueId=r.certIssuerUniqueId),c.issuer.hash=y.digest().toHex();var w=n.md.sha1.create(),b=i.toDer(r.certSubject);return w.update(b.getBytes()),c.subject.getField=function(e){return f(c.subject,e)},c.subject.addField=function(e){v([e]),c.subject.attributes.push(e)},c.subject.attributes=s.RDNAttributesAsArray(r.certSubject),r.certSubjectUniqueId&&(c.subject.uniqueId=r.certSubjectUniqueId),c.subject.hash=w.digest().toHex(),r.certExtensions?c.extensions=s.certificateExtensionsFromAsn1(r.certExtensions):c.extensions=[],c.publicKey=s.publicKeyFromAsn1(r.subjectPublicKeyInfo),c},s.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r1&&(r=c.value.charCodeAt(1),s=c.value.length>2?c.value.charCodeAt(2):0),t.digitalSignature=128===(128&r),t.nonRepudiation=64===(64&r),t.keyEncipherment=32===(32&r),t.dataEncipherment=16===(16&r),t.keyAgreement=8===(8&r),t.keyCertSign=4===(4&r),t.cRLSign=2===(2&r),t.encipherOnly=1===(1&r),t.decipherOnly=128===(128&s)}else if("basicConstraints"===t.name){(c=i.fromDer(t.value)).value.length>0&&c.value[0].type===i.Type.BOOLEAN?t.cA=0!==c.value[0].value.charCodeAt(0):t.cA=!1;var a=null;c.value.length>0&&c.value[0].type===i.Type.INTEGER?a=c.value[0].value:c.value.length>1&&(a=c.value[1].value),null!==a&&(t.pathLenConstraint=i.derToInteger(a))}else if("extKeyUsage"===t.name)for(var c=i.fromDer(t.value),l=0;l1&&(r=c.value.charCodeAt(1)),t.client=128===(128&r),t.server=64===(64&r),t.email=32===(32&r),t.objsign=16===(16&r),t.reserved=8===(8&r),t.sslCA=4===(4&r),t.emailCA=2===(2&r),t.objCA=1===(1&r)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){var h;t.altNames=[];c=i.fromDer(t.value);for(var d=0;d=S&&e<_?i.create(i.Class.UNIVERSAL,i.Type.UTCTIME,!1,i.dateToUtcTime(e)):i.create(i.Class.UNIVERSAL,i.Type.GENERALIZEDTIME,!1,i.dateToGeneralizedTime(e))}s.getTBSCertificate=function(e){var t=I(e.validity.notBefore),r=I(e.validity.notAfter),o=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes())]),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,n.util.hexToBytes(e.serialNumber)),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.siginfo.algorithmOid).getBytes()),b(e.siginfo.algorithmOid,e.siginfo.parameters)]),m(e.issuer),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[t,r]),m(e.subject),s.publicKeyToAsn1(e.publicKey)]);return e.issuer.uniqueId&&o.value.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,[i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.issuer.uniqueId)])),e.subject.uniqueId&&o.value.push(i.create(i.Class.CONTEXT_SPECIFIC,2,!0,[i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.subject.uniqueId)])),e.extensions.length>0&&o.value.push(s.certificateExtensionsToAsn1(e.extensions)),o},s.getCertificationRequestInfo=function(e){return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes()),m(e.subject),s.publicKeyToAsn1(e.publicKey),E(e)])},s.distinguishedNameToAsn1=function(e){return m(e)},s.certificateToAsn1=function(e){var t=e.tbsCertificate||s.getTBSCertificate(e);return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[t,i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.signatureOid).getBytes()),b(e.signatureOid,e.signatureParameters)]),i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},s.certificateExtensionsToAsn1=function(e){var t=i.create(i.Class.CONTEXT_SPECIFIC,3,!0,[]),r=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;nu.validity.notAfter)&&(c={message:"Certificate is not valid yet or has expired.",error:s.certificateError.certificate_expired,notBefore:u.validity.notBefore,notAfter:u.validity.notAfter,now:o}),null===c){if(null===(h=t[0]||e.getIssuer(u))&&u.isIssuer(u)&&(d=!0,h=u),h){var f=h;n.util.isArray(f)||(f=[f]);for(var p=!1;!p&&f.length>0;){h=f.shift();try{p=h.verify(u)}catch(S){}}p||(c={message:"Certificate signature is invalid.",error:s.certificateError.bad_certificate})}null!==c||h&&!d||e.hasCertificate(u)||(c={message:"Certificate is not trusted.",error:s.certificateError.unknown_ca})}if(null===c&&h&&!u.isIssuer(h)&&(c={message:"Certificate issuer is invalid.",error:s.certificateError.bad_certificate}),null===c)for(var g={keyUsage:!0,basicConstraints:!0},y=0;null===c&&yv.pathLenConstraint&&(c={message:"Certificate basicConstraints pathLenConstraint violated.",error:s.certificateError.bad_certificate})}var b=null===c||c.error,E=r.verify?r.verify(b,l,i):b;if(!0!==E)throw!0===b&&(c={message:"The application rejected the certificate.",error:s.certificateError.bad_certificate}),(E||0===E)&&("object"!==typeof E||n.util.isArray(E)?"string"===typeof E&&(c.error=E):(E.message&&(c.message=E.message),E.error&&(c.error=E.error))),c;c=null,a=!1,++l}while(t.length>0);return!0}},9879:(e,t,r)=>{const n=r(5125),i=r(2673);e.exports=class{constructor(){this._buffer=new n,this._waitingConsumers=new n}push(e){const{promise:t,resolve:r}=i();return this._buffer.push({chunk:e,resolve:r}),this._consume(),t}_consume(){for(;!this._waitingConsumers.isEmpty()&&!this._buffer.isEmpty();){const e=this._waitingConsumers.shift(),t=this._buffer.shift();e.resolve(t.chunk),t.resolve()}}shift(){const{promise:e,resolve:t}=i();return this._waitingConsumers.push({resolve:t}),this._consume(),e}isEmpty(){return this._buffer.isEmpty()}}},2673:e=>{"use strict";e.exports=()=>{const e={};return e.promise=new Promise(((t,r)=>{e.resolve=t,e.reject=r})),e}},3931:(e,t,r)=>{"use strict";e.exports=r(3794).default},3794:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=r(7922),s=n(r(8974)),o=n(r(2795)),a=r(7201),c=["0.0.0.0/8","10.0.0.0/8","100.64.0.0/10","127.0.0.0/8","169.254.0.0/16","172.16.0.0/12","192.0.0.0/24","192.0.0.0/29","192.0.0.8/32","192.0.0.9/32","192.0.0.10/32","192.0.0.170/32","192.0.0.171/32","192.0.2.0/24","192.31.196.0/24","192.52.193.0/24","192.88.99.0/24","192.168.0.0/16","192.175.48.0/24","198.18.0.0/15","198.51.100.0/24","203.0.113.0/24","240.0.0.0/4","255.255.255.255/32"].map((e=>new i.Netmask(e)));function l(e){return/^::$/.test(e)||/^::1$/.test(e)||/^::f{4}:([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(e)||/^::f{4}:0.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(e)||/^64:ff9b::([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(e)||/^100::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(e)||/^2001::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(e)||/^2001:2[0-9a-fA-F]:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(e)||/^2001:db8:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(e)||/^2002:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(e)||/^f[c-d]([0-9a-fA-F]{2,2}):/i.test(e)||/^fe[8-9a-bA-B][0-9a-fA-F]:/i.test(e)||/^ff([0-9a-fA-F]{2,2}):/i.test(e)}t.default=e=>{if((0,a.isValid)(e)){const t=(0,a.parse)(e);if("ipv4"===t.kind())return function(e){for(let t of c)if(t.contains(e))return!0;return!1}(t.toNormalizedString());if("ipv6"===t.kind())return l(e)}else if((0,o.default)(e)&&s.default.v6().test(e))return l(e)}},5368:(e,t,r)=>{"use strict";e.exports=r(8154)},1427:e=>{"use strict";e.exports=n;var t,r=/\/|\./;function n(e,t){r.test(e)||(e="google/protobuf/"+e+".proto",t={nested:{google:{nested:{protobuf:{nested:t}}}}}),n[e]=t}n("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}}),n("duration",{Duration:t={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}),n("timestamp",{Timestamp:t}),n("empty",{Empty:{fields:{}}}),n("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}}),n("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}}),n("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}}),n.get=function(e){return n[e]||null}},7276:(e,t,r)=>{"use strict";var n=t,i=r(222),s=r(2440);function o(e,t,r,n){if(t.resolvedType)if(t.resolvedType instanceof i){e("switch(d%s){",n);for(var s=t.resolvedType.values,o=Object.keys(s),a=0;a>>0",n,n);break;case"int32":case"sint32":case"sfixed32":e("m%s=d%s|0",n,n);break;case"uint64":c=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",n,n,c)('else if(typeof d%s==="string")',n)("m%s=parseInt(d%s,10)",n,n)('else if(typeof d%s==="number")',n)("m%s=d%s",n,n)('else if(typeof d%s==="object")',n)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",n,n,n,c?"true":"");break;case"bytes":e('if(typeof d%s==="string")',n)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",n,n,n)("else if(d%s.length >= 0)",n)("m%s=d%s",n,n);break;case"string":e("m%s=String(d%s)",n,n);break;case"bool":e("m%s=Boolean(d%s)",n,n)}}return e}function a(e,t,r,n){if(t.resolvedType)t.resolvedType instanceof i?e("d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s",n,r,n,n,r,n,n):e("d%s=types[%i].toObject(m%s,o)",n,r,n);else{var s=!1;switch(t.type){case"double":case"float":e("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",n,n,n,n);break;case"uint64":s=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e('if(typeof m%s==="number")',n)("d%s=o.longs===String?String(m%s):m%s",n,n,n)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",n,n,n,n,s?"true":"",n);break;case"bytes":e("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",n,n,n,n,n);break;default:e("d%s=m%s",n,n)}}return e}n.fromObject=function(e){var t=e.fieldsArray,r=s.codegen(["d"],e.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!t.length)return r("return new this.ctor");r("var m=new this.ctor");for(var n=0;n{"use strict";e.exports=function(e){var t=s.codegen(["r","l"],e.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(e.fieldsArray.filter((function(e){return e.map})).length?",k,value":""))("while(r.pos>>3){");for(var r=0;r>>3){")("case 1: k=r.%s(); break",a.keyType)("case 2:"),void 0===i.basic[c]?t("value=types[%i].decode(r,r.uint32())",r):t("value=r.%s()",c),t("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),void 0!==i.long[a.keyType]?t('%s[typeof k==="object"?util.longToHash(k):k]=value',l):t("%s[k]=value",l)):a.repeated?(t("if(!(%s&&%s.length))",l,l)("%s=[]",l),void 0!==i.packed[c]&&t("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos{"use strict";e.exports=function(e){for(var t,r=s.codegen(["m","w"],e.name+"$encode")("if(!w)")("w=Writer.create()"),a=e.fieldsArray.slice().sort(s.compareFieldsById),c=0;c>>0,8|i.mapKey[l.keyType],l.keyType),void 0===d?r("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",u,t):r(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|d,h,t),r("}")("}")):l.repeated?(r("if(%s!=null&&%s.length){",t,t),l.packed&&void 0!==i.packed[h]?r("w.uint32(%i).fork()",(l.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",t)("w.%s(%s[i])",h,t)("w.ldelim()"):(r("for(var i=0;i<%s.length;++i)",t),void 0===d?o(r,l,u,t+"[i]"):r("w.uint32(%i).%s(%s[i])",(l.id<<3|d)>>>0,h,t)),r("}")):(l.optional&&r("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",t,l.name),void 0===d?o(r,l,u,t):r("w.uint32(%i).%s(%s)",(l.id<<3|d)>>>0,h,t))}return r("return w")};var n=r(222),i=r(8517),s=r(2440);function o(e,t,r,n){return t.resolvedType.group?e("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",r,n,(t.id<<3|3)>>>0,(t.id<<3|4)>>>0):e("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",r,n,(t.id<<3|2)>>>0)}},222:(e,t,r)=>{"use strict";e.exports=o;var n=r(5154);((o.prototype=Object.create(n.prototype)).constructor=o).className="Enum";var i=r(3452),s=r(2440);function o(e,t,r,i,s,o){if(n.call(this,e,r),t&&"object"!==typeof t)throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=i,this.comments=s||{},this.valuesOptions=o,this.reserved=void 0,t)for(var a=Object.keys(t),c=0;c{"use strict";e.exports=l;var n=r(5154);((l.prototype=Object.create(n.prototype)).constructor=l).className="Field";var i,s=r(222),o=r(8517),a=r(2440),c=/^required|optional|repeated$/;function l(e,t,r,i,s,l,u){if(a.isObject(i)?(u=s,l=i,i=s=void 0):a.isObject(s)&&(u=l,l=s,s=void 0),n.call(this,e,l),!a.isInteger(t)||t<0)throw TypeError("id must be a non-negative integer");if(!a.isString(r))throw TypeError("type must be a string");if(void 0!==i&&!c.test(i=i.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(void 0!==s&&!a.isString(s))throw TypeError("extend must be a string");"proto3_optional"===i&&(i="optional"),this.rule=i&&"optional"!==i?i:void 0,this.type=r,this.id=t,this.extend=s||void 0,this.required="required"===i,this.optional=!this.required,this.repeated="repeated"===i,this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=!!a.Long&&void 0!==o.long[r],this.bytes="bytes"===r,this.resolvedType=null,this.extensionField=null,this.declaringField=null,this._packed=null,this.comment=u}l.fromJSON=function(e,t){return new l(e,t.id,t.type,t.rule,t.extend,t.options,t.comment)},Object.defineProperty(l.prototype,"packed",{get:function(){return null===this._packed&&(this._packed=!1!==this.getOption("packed")),this._packed}}),l.prototype.setOption=function(e,t,r){return"packed"===e&&(this._packed=null),n.prototype.setOption.call(this,e,t,r)},l.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return a.toObject(["rule","optional"!==this.rule&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},l.prototype.resolve=function(){if(this.resolved)return this;if(void 0===(this.typeDefault=o.defaults[this.type])?(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof i?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]):this.options&&this.options.proto3_optional&&(this.typeDefault=null),this.options&&null!=this.options.default&&(this.typeDefault=this.options.default,this.resolvedType instanceof s&&"string"===typeof this.typeDefault&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(!0!==this.options.packed&&(void 0===this.options.packed||!this.resolvedType||this.resolvedType instanceof s)||delete this.options.packed,Object.keys(this.options).length||(this.options=void 0)),this.long)this.typeDefault=a.Long.fromNumber(this.typeDefault,"u"===this.type.charAt(0)),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&"string"===typeof this.typeDefault){var e;a.base64.test(this.typeDefault)?a.base64.decode(this.typeDefault,e=a.newBuffer(a.base64.length(this.typeDefault)),0):a.utf8.write(this.typeDefault,e=a.newBuffer(a.utf8.length(this.typeDefault)),0),this.typeDefault=e}return this.map?this.defaultValue=a.emptyObject:this.repeated?this.defaultValue=a.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof i&&(this.parent.ctor.prototype[this.name]=this.defaultValue),n.prototype.resolve.call(this)},l.d=function(e,t,r,n){return"function"===typeof t?t=a.decorateType(t).name:t&&"object"===typeof t&&(t=a.decorateEnum(t).name),function(i,s){a.decorateType(i.constructor).add(new l(s,e,t,r,{default:n}))}},l._configure=function(e){i=e}},4582:(e,t,r)=>{"use strict";var n=e.exports=r(4722);n.build="light",n.load=function(e,t,r){return"function"===typeof t?(r=t,t=new n.Root):t||(t=new n.Root),t.load(e,r)},n.loadSync=function(e,t){return t||(t=new n.Root),t.loadSync(e)},n.encoder=r(6886),n.decoder=r(2715),n.verifier=r(709),n.converter=r(7276),n.ReflectionObject=r(5154),n.Namespace=r(3452),n.Root=r(8622),n.Enum=r(222),n.Type=r(8716),n.Field=r(6734),n.OneOf=r(9794),n.MapField=r(4479),n.Service=r(4173),n.Method=r(4865),n.Message=r(4486),n.wrappers=r(9025),n.types=r(8517),n.util=r(2440),n.ReflectionObject._configure(n.Root),n.Namespace._configure(n.Type,n.Service,n.Enum),n.Root._configure(n.Type),n.Field._configure(n.Type)},4722:(e,t,r)=>{"use strict";var n=t;function i(){n.util._configure(),n.Writer._configure(n.BufferWriter),n.Reader._configure(n.BufferReader)}n.build="minimal",n.Writer=r(7063),n.BufferWriter=r(2815),n.Reader=r(6216),n.BufferReader=r(3557),n.util=r(3097),n.rpc=r(9994),n.roots=r(7907),n.configure=i,i()},8154:(e,t,r)=>{"use strict";var n=e.exports=r(4582);n.build="full",n.tokenize=r(3077),n.parse=r(7781),n.common=r(1427),n.Root._configure(n.Type,n.parse,n.common)},4479:(e,t,r)=>{"use strict";e.exports=o;var n=r(6734);((o.prototype=Object.create(n.prototype)).constructor=o).className="MapField";var i=r(8517),s=r(2440);function o(e,t,r,i,o,a){if(n.call(this,e,t,i,void 0,void 0,o,a),!s.isString(r))throw TypeError("keyType must be a string");this.keyType=r,this.resolvedKeyType=null,this.map=!0}o.fromJSON=function(e,t){return new o(e,t.id,t.keyType,t.type,t.options,t.comment)},o.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return s.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},o.prototype.resolve=function(){if(this.resolved)return this;if(void 0===i.mapKey[this.keyType])throw Error("invalid key type: "+this.keyType);return n.prototype.resolve.call(this)},o.d=function(e,t,r){return"function"===typeof r?r=s.decorateType(r).name:r&&"object"===typeof r&&(r=s.decorateEnum(r).name),function(n,i){s.decorateType(n.constructor).add(new o(i,e,t,r))}}},4486:(e,t,r)=>{"use strict";e.exports=i;var n=r(3097);function i(e){if(e)for(var t=Object.keys(e),r=0;r{"use strict";e.exports=s;var n=r(5154);((s.prototype=Object.create(n.prototype)).constructor=s).className="Method";var i=r(2440);function s(e,t,r,s,o,a,c,l,u){if(i.isObject(o)?(c=o,o=a=void 0):i.isObject(a)&&(c=a,a=void 0),void 0!==t&&!i.isString(t))throw TypeError("type must be a string");if(!i.isString(r))throw TypeError("requestType must be a string");if(!i.isString(s))throw TypeError("responseType must be a string");n.call(this,e,c),this.type=t||"rpc",this.requestType=r,this.requestStream=!!o||void 0,this.responseType=s,this.responseStream=!!a||void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=l,this.parsedOptions=u}s.fromJSON=function(e,t){return new s(e,t.type,t.requestType,t.responseType,t.requestStream,t.responseStream,t.options,t.comment,t.parsedOptions)},s.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return i.toObject(["type","rpc"!==this.type&&this.type||void 0,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",t?this.comment:void 0,"parsedOptions",this.parsedOptions])},s.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),n.prototype.resolve.call(this))}},3452:(e,t,r)=>{"use strict";e.exports=h;var n=r(5154);((h.prototype=Object.create(n.prototype)).constructor=h).className="Namespace";var i,s,o,a=r(6734),c=r(2440),l=r(9794);function u(e,t){if(e&&e.length){for(var r={},n=0;nt)return!0;return!1},h.isReservedName=function(e,t){if(e)for(var r=0;r0;){var n=e.shift();if(r.nested&&r.nested[n]){if(!((r=r.nested[n])instanceof h))throw Error("path conflicts with non-namespace objects")}else r.add(r=new h(n))}return t&&r.addJSON(t),r},h.prototype.resolveAll=function(){for(var e=this.nestedArray,t=0;t-1)return n}else if(n instanceof h&&(n=n.lookup(e.slice(1),t,!0)))return n}else for(var i=0;i{"use strict";e.exports=s,s.className="ReflectionObject";var n,i=r(2440);function s(e,t){if(!i.isString(e))throw TypeError("name must be a string");if(t&&!i.isObject(t))throw TypeError("options must be an object");this.options=t,this.parsedOptions=null,this.name=e,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(s.prototype,{root:{get:function(){for(var e=this;null!==e.parent;)e=e.parent;return e}},fullName:{get:function(){for(var e=[this.name],t=this.parent;t;)e.unshift(t.name),t=t.parent;return e.join(".")}}}),s.prototype.toJSON=function(){throw Error()},s.prototype.onAdd=function(e){this.parent&&this.parent!==e&&this.parent.remove(this),this.parent=e,this.resolved=!1;var t=e.root;t instanceof n&&t._handleAdd(this)},s.prototype.onRemove=function(e){var t=e.root;t instanceof n&&t._handleRemove(this),this.parent=null,this.resolved=!1},s.prototype.resolve=function(){return this.resolved||this.root instanceof n&&(this.resolved=!0),this},s.prototype.getOption=function(e){if(this.options)return this.options[e]},s.prototype.setOption=function(e,t,r){return r&&this.options&&void 0!==this.options[e]||((this.options||(this.options={}))[e]=t),this},s.prototype.setParsedOption=function(e,t,r){this.parsedOptions||(this.parsedOptions=[]);var n=this.parsedOptions;if(r){var s=n.find((function(t){return Object.prototype.hasOwnProperty.call(t,e)}));if(s){var o=s[e];i.setProperty(o,r,t)}else(s={})[e]=i.setProperty({},r,t),n.push(s)}else{var a={};a[e]=t,n.push(a)}return this},s.prototype.setOptions=function(e,t){if(e)for(var r=Object.keys(e),n=0;n{"use strict";e.exports=o;var n=r(5154);((o.prototype=Object.create(n.prototype)).constructor=o).className="OneOf";var i=r(6734),s=r(2440);function o(e,t,r,i){if(Array.isArray(t)||(r=t,t=void 0),n.call(this,e,r),void 0!==t&&!Array.isArray(t))throw TypeError("fieldNames must be an Array");this.oneof=t||[],this.fieldsArray=[],this.comment=i}function a(e){if(e.parent)for(var t=0;t-1&&this.oneof.splice(t,1),e.partOf=null,this},o.prototype.onAdd=function(e){n.prototype.onAdd.call(this,e);for(var t=0;t{"use strict";e.exports=I,I.filename=null,I.defaults={keepCase:!1};var n=r(3077),i=r(8622),s=r(8716),o=r(6734),a=r(4479),c=r(9794),l=r(222),u=r(4173),h=r(4865),d=r(8517),f=r(2440),p=/^[1-9][0-9]*$/,g=/^-?[1-9][0-9]*$/,y=/^0[x][0-9a-fA-F]+$/,m=/^-?0[x][0-9a-fA-F]+$/,v=/^0[0-7]+$/,w=/^-?0[0-7]+$/,b=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,E=/^[a-zA-Z_][a-zA-Z_0-9]*$/,S=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,_=/^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/;function I(e,t,r){t instanceof i||(r=t,t=new i),r||(r=I.defaults);var A,C,T,R,k,P=r.preferTrailingComment||!1,D=n(e,r.alternateCommentMode||!1),N=D.next,O=D.push,L=D.peek,B=D.skip,x=D.cmnt,M=!0,U=!1,F=t,V=r.keepCase?function(e){return e}:f.camelCase;function K(e,t,r){var n=I.filename;return r||(I.filename=null),Error("illegal "+(t||"token")+" '"+e+"' ("+(n?n+", ":"")+"line "+D.line+")")}function j(){var e,t=[];do{if('"'!==(e=N())&&"'"!==e)throw K(e);t.push(N()),B(e),e=L()}while('"'===e||"'"===e);return t.join("")}function z(e){var t=N();switch(t){case"'":case'"':return O(t),j();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return function(e,t){var r=1;"-"===e.charAt(0)&&(r=-1,e=e.substring(1));switch(e){case"inf":case"INF":case"Inf":return r*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(p.test(e))return r*parseInt(e,10);if(y.test(e))return r*parseInt(e,16);if(v.test(e))return r*parseInt(e,8);if(b.test(e))return r*parseFloat(e);throw K(e,"number",t)}(t,!0)}catch(r){if(e&&S.test(t))return t;throw K(t,"value")}}function q(e,t){var r,n;do{!t||'"'!==(r=L())&&"'"!==r?e.push([n=H(N()),B("to",!0)?H(N()):n]):e.push(j())}while(B(",",!0));B(";")}function H(e,t){switch(e){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!t&&"-"===e.charAt(0))throw K(e,"id");if(g.test(e))return parseInt(e,10);if(m.test(e))return parseInt(e,16);if(w.test(e))return parseInt(e,8);throw K(e,"id")}function G(){if(void 0!==A)throw K("package");if(A=N(),!S.test(A))throw K(A,"name");F=F.define(A),B(";")}function W(){var e,t=L();switch(t){case"weak":e=T||(T=[]),N();break;case"public":N();default:e=C||(C=[])}t=j(),B(";"),e.push(t)}function Q(){if(B("="),R=j(),!(U="proto3"===R)&&"proto2"!==R)throw K(R,"syntax");B(";")}function Y(e,t){switch(t){case"option":return ee(e,t),B(";"),!0;case"message":return X(e,t),!0;case"enum":return Z(e,t),!0;case"service":return function(e,t){if(!E.test(t=N()))throw K(t,"service name");var r=new u(t);$(r,(function(e){if(!Y(r,e)){if("rpc"!==e)throw K(e);!function(e,t){var r=x(),n=t;if(!E.test(t=N()))throw K(t,"name");var i,s,o,a,c=t;B("("),B("stream",!0)&&(s=!0);if(!S.test(t=N()))throw K(t);i=t,B(")"),B("returns"),B("("),B("stream",!0)&&(a=!0);if(!S.test(t=N()))throw K(t);o=t,B(")");var l=new h(c,n,i,o,s,a);l.comment=r,$(l,(function(e){if("option"!==e)throw K(e);ee(l,e),B(";")})),e.add(l)}(r,e)}})),e.add(r)}(e,t),!0;case"extend":return function(e,t){if(!S.test(t=N()))throw K(t,"reference");var r=t;$(null,(function(t){switch(t){case"required":case"repeated":J(e,t,r);break;case"optional":J(e,U?"proto3_optional":"optional",r);break;default:if(!U||!S.test(t))throw K(t);O(t),J(e,"optional",r)}}))}(e,t),!0}return!1}function $(e,t,r){var n=D.line;if(e&&("string"!==typeof e.comment&&(e.comment=x()),e.filename=I.filename),B("{",!0)){for(var i;"}"!==(i=N());)t(i);B(";",!0)}else r&&r(),B(";"),e&&("string"!==typeof e.comment||P)&&(e.comment=x(n)||e.comment)}function X(e,t){if(!E.test(t=N()))throw K(t,"type name");var r=new s(t);$(r,(function(e){if(!Y(r,e))switch(e){case"map":!function(e){B("<");var t=N();if(void 0===d.mapKey[t])throw K(t,"type");B(",");var r=N();if(!S.test(r))throw K(r,"type");B(">");var n=N();if(!E.test(n))throw K(n,"name");B("=");var i=new a(V(n),H(N()),t,r);$(i,(function(e){if("option"!==e)throw K(e);ee(i,e),B(";")}),(function(){ne(i)})),e.add(i)}(r);break;case"required":case"repeated":J(r,e);break;case"optional":J(r,U?"proto3_optional":"optional");break;case"oneof":!function(e,t){if(!E.test(t=N()))throw K(t,"name");var r=new c(V(t));$(r,(function(e){"option"===e?(ee(r,e),B(";")):(O(e),J(r,"optional"))})),e.add(r)}(r,e);break;case"extensions":q(r.extensions||(r.extensions=[]));break;case"reserved":q(r.reserved||(r.reserved=[]),!0);break;default:if(!U||!S.test(e))throw K(e);O(e),J(r,"optional")}})),e.add(r)}function J(e,t,r){var n=N();if("group"!==n){if(!S.test(n))throw K(n,"type");var i=N();if(!E.test(i))throw K(i,"name");i=V(i),B("=");var a=new o(i,H(N()),n,t,r);if($(a,(function(e){if("option"!==e)throw K(e);ee(a,e),B(";")}),(function(){ne(a)})),"proto3_optional"===t){var l=new c("_"+i);a.setOption("proto3_optional",!0),l.add(a),e.add(l)}else e.add(a);U||!a.repeated||void 0===d.packed[n]&&void 0!==d.basic[n]||a.setOption("packed",!1,!0)}else!function(e,t){var r=N();if(!E.test(r))throw K(r,"name");var n=f.lcFirst(r);r===n&&(r=f.ucFirst(r));B("=");var i=H(N()),a=new s(r);a.group=!0;var c=new o(n,i,r,t);c.filename=I.filename,$(a,(function(e){switch(e){case"option":ee(a,e),B(";");break;case"required":case"repeated":J(a,e);break;case"optional":J(a,U?"proto3_optional":"optional");break;case"message":X(a,e);break;case"enum":Z(a,e);break;default:throw K(e)}})),e.add(a).add(c)}(e,t)}function Z(e,t){if(!E.test(t=N()))throw K(t,"name");var r=new l(t);$(r,(function(e){switch(e){case"option":ee(r,e),B(";");break;case"reserved":q(r.reserved||(r.reserved=[]),!0);break;default:!function(e,t){if(!E.test(t))throw K(t,"name");B("=");var r=H(N(),!0),n={options:void 0,setOption:function(e,t){void 0===this.options&&(this.options={}),this.options[e]=t}};$(n,(function(e){if("option"!==e)throw K(e);ee(n,e),B(";")}),(function(){ne(n)})),e.add(t,r,n.comment,n.options)}(r,e)}})),e.add(r)}function ee(e,t){var r=B("(",!0);if(!S.test(t=N()))throw K(t,"name");var n,i=t,s=i;r&&(B(")"),s=i="("+i+")",t=L(),_.test(t)&&(n=t.slice(1),i+=t,N())),B("="),function(e,t,r,n){e.setParsedOption&&e.setParsedOption(t,r,n)}(e,s,te(e,i),n)}function te(e,t){if(B("{",!0)){for(var r={};!B("}",!0);){if(!E.test(k=N()))throw K(k,"name");var n,i=k;if(B(":",!0),"{"===L())n=te(e,t+"."+k);else if("["===L()){var s;if(n=[],B("[",!0)){do{s=z(!0),n.push(s)}while(B(",",!0));B("]"),"undefined"!==typeof s&&re(e,t+"."+k,s)}}else n=z(!0),re(e,t+"."+k,n);var o=r[i];o&&(n=[].concat(o).concat(n)),r[i]=n,B(",",!0),B(";",!0)}return r}var a=z(!0);return re(e,t,a),a}function re(e,t,r){e.setOption&&e.setOption(t,r)}function ne(e){if(B("[",!0)){do{ee(e,"option")}while(B(",",!0));B("]")}return e}for(;null!==(k=N());)switch(k){case"package":if(!M)throw K(k);G();break;case"import":if(!M)throw K(k);W();break;case"syntax":if(!M)throw K(k);Q();break;case"option":ee(F,k),B(";");break;default:if(Y(F,k)){M=!1;continue}throw K(k)}return I.filename=null,{package:A,imports:C,weakImports:T,syntax:R,root:t}}},6216:(e,t,r)=>{"use strict";e.exports=c;var n,i=r(3097),s=i.LongBits,o=i.utf8;function a(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function c(e){this.buf=e,this.pos=0,this.len=e.length}var l="undefined"!==typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new c(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new c(e);throw Error("illegal buffer")},u=function(){return i.Buffer?function(e){return(c.create=function(e){return i.Buffer.isBuffer(e)?new n(e):l(e)})(e)}:l};function h(){var e=new s(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function d(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function f(){if(this.pos+8>this.len)throw a(this,8);return new s(d(this.buf,this.pos+=4),d(this.buf,this.pos+=4))}c.create=u(),c.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,c.prototype.uint32=function(){var e=4294967295;return function(){if(e=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return e;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return e}}(),c.prototype.int32=function(){return 0|this.uint32()},c.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},c.prototype.bool=function(){return 0!==this.uint32()},c.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return d(this.buf,this.pos+=4)},c.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return 0|d(this.buf,this.pos+=4)},c.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var e=i.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},c.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var e=i.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},c.prototype.bytes=function(){var e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,r):t===r?new this.buf.constructor(0):this._slice.call(this.buf,t,r)},c.prototype.string=function(){var e=this.bytes();return o.read(e,0,e.length)},c.prototype.skip=function(e){if("number"===typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},c.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!==(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},c._configure=function(e){n=e,c.create=u(),n._configure();var t=i.Long?"toLong":"toNumber";i.merge(c.prototype,{int64:function(){return h.call(this)[t](!1)},uint64:function(){return h.call(this)[t](!0)},sint64:function(){return h.call(this).zzDecode()[t](!1)},fixed64:function(){return f.call(this)[t](!0)},sfixed64:function(){return f.call(this)[t](!1)}})}},3557:(e,t,r)=>{"use strict";e.exports=s;var n=r(6216);(s.prototype=Object.create(n.prototype)).constructor=s;var i=r(3097);function s(e){n.call(this,e)}s._configure=function(){i.Buffer&&(s.prototype._slice=i.Buffer.prototype.slice)},s.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},s._configure()},8622:(e,t,r)=>{"use strict";e.exports=h;var n=r(3452);((h.prototype=Object.create(n.prototype)).constructor=h).className="Root";var i,s,o,a=r(6734),c=r(222),l=r(9794),u=r(2440);function h(e){n.call(this,"",e),this.deferred=[],this.files=[]}function d(){}h.fromJSON=function(e,t){return t||(t=new h),e.options&&t.setOptions(e.options),t.addJSON(e.nested)},h.prototype.resolvePath=u.path.resolve,h.prototype.fetch=u.fetch,h.prototype.load=function e(t,r,n){"function"===typeof r&&(n=r,r=void 0);var i=this;if(!n)return u.asPromise(e,i,t,r);var a=n===d;function c(e,t){if(n){var r=n;if(n=null,a)throw e;r(e,t)}}function l(e){var t=e.lastIndexOf("google/protobuf/");if(t>-1){var r=e.substring(t);if(r in o)return r}return null}function h(e,t){try{if(u.isString(t)&&"{"===t.charAt(0)&&(t=JSON.parse(t)),u.isString(t)){s.filename=e;var n,o=s(t,i,r),h=0;if(o.imports)for(;h-1))if(i.files.push(e),e in o)a?h(e,o[e]):(++p,setTimeout((function(){--p,h(e,o[e])})));else if(a){var r;try{r=u.fs.readFileSync(e).toString("utf8")}catch(s){return void(t||c(s))}h(e,r)}else++p,i.fetch(e,(function(r,s){--p,n&&(r?t?p||c(null,i):c(r):h(e,s))}))}var p=0;u.isString(t)&&(t=[t]);for(var g,y=0;y-1&&this.deferred.splice(t,1)}}else if(e instanceof c)f.test(e.name)&&delete e.parent[e.name];else if(e instanceof n){for(var r=0;r{"use strict";e.exports={}},9994:(e,t,r)=>{"use strict";t.Service=r(4281)},4281:(e,t,r)=>{"use strict";e.exports=i;var n=r(3097);function i(e,t,r){if("function"!==typeof e)throw TypeError("rpcImpl must be a function");n.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(r)}(i.prototype=Object.create(n.EventEmitter.prototype)).constructor=i,i.prototype.rpcCall=function e(t,r,i,s,o){if(!s)throw TypeError("request must be specified");var a=this;if(!o)return n.asPromise(e,a,t,r,i,s);if(a.rpcImpl)try{return a.rpcImpl(t,r[a.requestDelimited?"encodeDelimited":"encode"](s).finish(),(function(e,r){if(e)return a.emit("error",e,t),o(e);if(null!==r){if(!(r instanceof i))try{r=i[a.responseDelimited?"decodeDelimited":"decode"](r)}catch(e){return a.emit("error",e,t),o(e)}return a.emit("data",r,t),o(null,r)}a.end(!0)}))}catch(c){return a.emit("error",c,t),void setTimeout((function(){o(c)}),0)}else setTimeout((function(){o(Error("already ended"))}),0)},i.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},4173:(e,t,r)=>{"use strict";e.exports=a;var n=r(3452);((a.prototype=Object.create(n.prototype)).constructor=a).className="Service";var i=r(4865),s=r(2440),o=r(9994);function a(e,t){n.call(this,e,t),this.methods={},this._methodsArray=null}function c(e){return e._methodsArray=null,e}a.fromJSON=function(e,t){var r=new a(e,t.options);if(t.methods)for(var n=Object.keys(t.methods),s=0;s{"use strict";e.exports=h;var t=/[\s{}=;:[\],'"()<>]/g,r=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,n=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,i=/^ *[*/]+ */,s=/^\s*\*?\/*/,o=/\n/g,a=/\s/,c=/\\(.?)/g,l={0:"\0",r:"\r",n:"\n",t:"\t"};function u(e){return e.replace(c,(function(e,t){switch(t){case"\\":case"":return t;default:return l[t]||""}}))}function h(e,c){e=e.toString();var l=0,h=e.length,d=1,f=0,p={},g=[],y=null;function m(e){return Error("illegal "+e+" (line "+d+")")}function v(t){return e.charAt(t)}function w(t,r,n){var a,l={type:e.charAt(t++),lineEmpty:!1,leading:n},u=t-(c?2:3);do{if(--u<0||"\n"===(a=e.charAt(u))){l.lineEmpty=!0;break}}while(" "===a||"\t"===a);for(var h=e.substring(t,r).split(o),g=0;g0)return g.shift();if(y)return function(){var t="'"===y?n:r;t.lastIndex=l-1;var i=t.exec(e);if(!i)throw m("string");return l=t.lastIndex,_(y),y=null,u(i[1])}();var i,s,o,f,p,S=0===l;do{if(l===h)return null;for(i=!1;a.test(o=v(l));)if("\n"===o&&(S=!0,++d),++l===h)return null;if("/"===v(l)){if(++l===h)throw m("comment");if("/"===v(l))if(c){if(f=l,p=!1,b(l)){p=!0;do{if((l=E(l))===h)break;if(l++,!S)break}while(b(l))}else l=Math.min(h,E(l)+1);p&&(w(f,l,S),S=!0),d++,i=!0}else{for(p="/"===v(f=l+1);"\n"!==v(++l);)if(l===h)return null;++l,p&&(w(f,l-1,S),S=!0),++d,i=!0}else{if("*"!==(o=v(l)))return"/";f=l+1,p=c||"*"===v(f);do{if("\n"===o&&++d,++l===h)throw m("comment");s=o,o=v(l)}while("*"!==s||"/"!==o);++l,p&&(w(f,l-2,S),S=!0),i=!0}}}while(i);var I=l;if(t.lastIndex=0,!t.test(v(I++)))for(;I{"use strict";e.exports=v;var n=r(3452);((v.prototype=Object.create(n.prototype)).constructor=v).className="Type";var i=r(222),s=r(9794),o=r(6734),a=r(4479),c=r(4173),l=r(4486),u=r(6216),h=r(7063),d=r(2440),f=r(6886),p=r(2715),g=r(709),y=r(7276),m=r(9025);function v(e,t){n.call(this,e,t),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}function w(e){return e._fieldsById=e._fieldsArray=e._oneofsArray=null,delete e.encode,delete e.decode,delete e.verify,e}Object.defineProperties(v.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var e=Object.keys(this.fields),t=0;t{"use strict";var n=t,i=r(2440),s=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function o(e,t){var r=0,n={};for(t|=0;r{"use strict";var n,i,s=e.exports=r(3097),o=r(7907);s.codegen=r(3297),s.fetch=r(7635),s.path=r(7468),s.fs=s.inquire("fs"),s.toArray=function(e){if(e){for(var t=Object.keys(e),r=new Array(t.length),n=0;n0)t[i]=e(t[i]||{},r,n);else{var s=t[i];s&&(n=[].concat(s).concat(n)),t[i]=n}return t}(e,t=t.split("."),r)},Object.defineProperty(s,"decorateRoot",{get:function(){return o.decorated||(o.decorated=new(r(8622)))}})},9351:(e,t,r)=>{"use strict";e.exports=i;var n=r(3097);function i(e,t){this.lo=e>>>0,this.hi=t>>>0}var s=i.zero=new i(0,0);s.toNumber=function(){return 0},s.zzEncode=s.zzDecode=function(){return this},s.length=function(){return 1};var o=i.zeroHash="\0\0\0\0\0\0\0\0";i.fromNumber=function(e){if(0===e)return s;var t=e<0;t&&(e=-e);var r=e>>>0,n=(e-r)/4294967296>>>0;return t&&(n=~n>>>0,r=~r>>>0,++r>4294967295&&(r=0,++n>4294967295&&(n=0))),new i(r,n)},i.from=function(e){if("number"===typeof e)return i.fromNumber(e);if(n.isString(e)){if(!n.Long)return i.fromNumber(parseInt(e,10));e=n.Long.fromString(e)}return e.low||e.high?new i(e.low>>>0,e.high>>>0):s},i.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+4294967296*r)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(e){return n.Long?new n.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var a=String.prototype.charCodeAt;i.fromHash=function(e){return e===o?s:new i((a.call(e,0)|a.call(e,1)<<8|a.call(e,2)<<16|a.call(e,3)<<24)>>>0,(a.call(e,4)|a.call(e,5)<<8|a.call(e,6)<<16|a.call(e,7)<<24)>>>0)},i.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},i.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},i.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},i.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}},3097:function(e,t,r){"use strict";var n=t;function i(e,t,r){for(var n=Object.keys(t),i=0;ie,set:void 0,enumerable:!1,configurable:!0},toString:{value(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}n.asPromise=r(7206),n.base64=r(1),n.EventEmitter=r(7111),n.float=r(802),n.inquire=r(7172),n.utf8=r(3861),n.pool=r(8236),n.LongBits=r(9351),n.isNode=Boolean("undefined"!==typeof r.g&&r.g&&r.g.process&&r.g.process.versions&&r.g.process.versions.node),n.global=n.isNode&&r.g||"undefined"!==typeof window&&window||"undefined"!==typeof self&&self||this,n.emptyArray=Object.freeze?Object.freeze([]):[],n.emptyObject=Object.freeze?Object.freeze({}):{},n.isInteger=Number.isInteger||function(e){return"number"===typeof e&&isFinite(e)&&Math.floor(e)===e},n.isString=function(e){return"string"===typeof e||e instanceof String},n.isObject=function(e){return e&&"object"===typeof e},n.isset=n.isSet=function(e,t){var r=e[t];return!(null==r||!e.hasOwnProperty(t))&&("object"!==typeof r||(Array.isArray(r)?r.length:Object.keys(r).length)>0)},n.Buffer=function(){try{var e=n.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(t){return null}}(),n._Buffer_from=null,n._Buffer_allocUnsafe=null,n.newBuffer=function(e){return"number"===typeof e?n.Buffer?n._Buffer_allocUnsafe(e):new n.Array(e):n.Buffer?n._Buffer_from(e):"undefined"===typeof Uint8Array?e:new Uint8Array(e)},n.Array="undefined"!==typeof Uint8Array?Uint8Array:Array,n.Long=n.global.dcodeIO&&n.global.dcodeIO.Long||n.global.Long||n.inquire("long"),n.key2Re=/^true|false|0|1$/,n.key32Re=/^-?(?:0|[1-9][0-9]*)$/,n.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,n.longToHash=function(e){return e?n.LongBits.from(e).toHash():n.LongBits.zeroHash},n.longFromHash=function(e,t){var r=n.LongBits.fromHash(e);return n.Long?n.Long.fromBits(r.lo,r.hi,t):r.toNumber(Boolean(t))},n.merge=i,n.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},n.newError=s,n.ProtocolError=s("ProtocolError"),n.oneOfGetter=function(e){for(var t={},r=0;r-1;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}},n.oneOfSetter=function(e){return function(t){for(var r=0;r{"use strict";e.exports=function(e){var t=i.codegen(["m"],e.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),r=e.oneofsArray,n={};r.length&&t("var p={}");for(var c=0;c{"use strict";var n=t,i=r(4486);n[".google.protobuf.Any"]={fromObject:function(e){if(e&&e["@type"]){var t=e["@type"].substring(e["@type"].lastIndexOf("/")+1),r=this.lookup(t);if(r){var n="."===e["@type"].charAt(0)?e["@type"].slice(1):e["@type"];return-1===n.indexOf("/")&&(n="/"+n),this.create({type_url:n,value:r.encode(r.fromObject(e)).finish()})}}return this.fromObject(e)},toObject:function(e,t){var r="",n="";if(t&&t.json&&e.type_url&&e.value){n=e.type_url.substring(e.type_url.lastIndexOf("/")+1),r=e.type_url.substring(0,e.type_url.lastIndexOf("/")+1);var s=this.lookup(n);s&&(e=s.decode(e.value))}if(!(e instanceof this.ctor)&&e instanceof i){var o=e.$type.toObject(e,t);return""===r&&(r="type.googleapis.com/"),n=r+("."===e.$type.fullName[0]?e.$type.fullName.slice(1):e.$type.fullName),o["@type"]=n,o}return this.toObject(e,t)}}},7063:(e,t,r)=>{"use strict";e.exports=h;var n,i=r(3097),s=i.LongBits,o=i.base64,a=i.utf8;function c(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function l(){}function u(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function h(){this.len=0,this.head=new c(l,0,0),this.tail=this.head,this.states=null}var d=function(){return i.Buffer?function(){return(h.create=function(){return new n})()}:function(){return new h}};function f(e,t,r){t[r]=255&e}function p(e,t){this.len=e,this.next=void 0,this.val=t}function g(e,t,r){for(;e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function y(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}h.create=d(),h.alloc=function(e){return new i.Array(e)},i.Array!==Array&&(h.alloc=i.pool(h.alloc,i.Array.prototype.subarray)),h.prototype._push=function(e,t,r){return this.tail=this.tail.next=new c(e,t,r),this.len+=t,this},p.prototype=Object.create(c.prototype),p.prototype.fn=function(e,t,r){for(;e>127;)t[r++]=127&e|128,e>>>=7;t[r]=e},h.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new p((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},h.prototype.int32=function(e){return e<0?this._push(g,10,s.fromNumber(e)):this.uint32(e)},h.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},h.prototype.uint64=function(e){var t=s.from(e);return this._push(g,t.length(),t)},h.prototype.int64=h.prototype.uint64,h.prototype.sint64=function(e){var t=s.from(e).zzEncode();return this._push(g,t.length(),t)},h.prototype.bool=function(e){return this._push(f,1,e?1:0)},h.prototype.fixed32=function(e){return this._push(y,4,e>>>0)},h.prototype.sfixed32=h.prototype.fixed32,h.prototype.fixed64=function(e){var t=s.from(e);return this._push(y,4,t.lo)._push(y,4,t.hi)},h.prototype.sfixed64=h.prototype.fixed64,h.prototype.float=function(e){return this._push(i.float.writeFloatLE,4,e)},h.prototype.double=function(e){return this._push(i.float.writeDoubleLE,8,e)};var m=i.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n>>0;if(!t)return this._push(f,1,0);if(i.isString(e)){var r=h.alloc(t=o.length(e));o.decode(e,r,0),e=r}return this.uint32(t)._push(m,t,e)},h.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(f,1,0)},h.prototype.fork=function(){return this.states=new u(this),this.head=this.tail=new c(l,0,0),this.len=0,this},h.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new c(l,0,0),this.len=0),this},h.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},h.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},h._configure=function(e){n=e,h.create=d(),n._configure()}},2815:(e,t,r)=>{"use strict";e.exports=s;var n=r(7063);(s.prototype=Object.create(n.prototype)).constructor=s;var i=r(3097);function s(){n.call(this)}function o(e,t,r){e.length<40?i.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}s._configure=function(){s.alloc=i._Buffer_allocUnsafe,s.writeBytesBuffer=i.Buffer&&i.Buffer.prototype instanceof Uint8Array&&"set"===i.Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var n=0;n>>0;return this.uint32(t),t&&this._push(s.writeBytesBuffer,t,e),this},s.prototype.string=function(e){var t=i.Buffer.byteLength(e);return this.uint32(t),t&&this._push(o,t,e),this},s._configure()},4463:(e,t,r)=>{"use strict";var n=r(2791),i=r(5296);function s(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r