diff --git a/spaces/1368565466ki/Satdia/text/__init__.py b/spaces/1368565466ki/Satdia/text/__init__.py deleted file mode 100644 index 663c4b6416affb53c9dc56dddbc8b2b65d4bf518..0000000000000000000000000000000000000000 --- a/spaces/1368565466ki/Satdia/text/__init__.py +++ /dev/null @@ -1,57 +0,0 @@ -""" from https://github.com/keithito/tacotron """ -from text import cleaners -from text.symbols import symbols - - -# Mappings from symbol to numeric ID and vice versa: -_symbol_to_id = {s: i for i, s in enumerate(symbols)} -_id_to_symbol = {i: s for i, s in enumerate(symbols)} - - -def text_to_sequence(text, symbols, cleaner_names): - '''Converts a string of text to a sequence of IDs corresponding to the symbols in the text. - Args: - text: string to convert to a sequence - cleaner_names: names of the cleaner functions to run the text through - Returns: - List of integers corresponding to the symbols in the text - ''' - _symbol_to_id = {s: i for i, s in enumerate(symbols)} - sequence = [] - - clean_text = _clean_text(text, cleaner_names) - for symbol in clean_text: - if symbol not in _symbol_to_id.keys(): - continue - symbol_id = _symbol_to_id[symbol] - sequence += [symbol_id] - return sequence, clean_text - - -def cleaned_text_to_sequence(cleaned_text): - '''Converts a string of text to a sequence of IDs corresponding to the symbols in the text. - Args: - text: string to convert to a sequence - Returns: - List of integers corresponding to the symbols in the text - ''' - sequence = [_symbol_to_id[symbol] for symbol in cleaned_text if symbol in _symbol_to_id.keys()] - return sequence - - -def sequence_to_text(sequence): - '''Converts a sequence of IDs back to a string''' - result = '' - for symbol_id in sequence: - s = _id_to_symbol[symbol_id] - result += s - return result - - -def _clean_text(text, cleaner_names): - for name in cleaner_names: - cleaner = getattr(cleaners, name) - if not cleaner: - raise Exception('Unknown cleaner: %s' % name) - text = cleaner(text) - return text diff --git a/spaces/1acneusushi/gradio-2dmoleculeeditor/Alice Madness Returns Xpadder Game Profile.md b/spaces/1acneusushi/gradio-2dmoleculeeditor/Alice Madness Returns Xpadder Game Profile.md deleted file mode 100644 index d8242584c4296f934b81bc5d223729c4fc20bce5..0000000000000000000000000000000000000000 --- a/spaces/1acneusushi/gradio-2dmoleculeeditor/Alice Madness Returns Xpadder Game Profile.md +++ /dev/null @@ -1,102 +0,0 @@ -## Alice Madness Returns Xpadder Game Profile - - - - - - - - - -**Download ✅ [https://jinyurl.com/2tzZY1](https://jinyurl.com/2tzZY1)** - - - - - - - - - - - - - -# How to Play Alice: Madness Returns with a Gamepad on PC - - - -Alice: Madness Returns is a dark and twisted sequel to the classic Alice in Wonderland game. It was released in 2011 for PC, Xbox 360 and PlayStation 3. However, many PC players have reported issues with the game's controller support, especially when using Xpadder, a software that allows you to map keyboard and mouse inputs to a gamepad. - - - -In this article, we will show you how to play Alice: Madness Returns with a gamepad on PC using Xpadder. We will also provide you with a link to download a ready-made Xpadder game profile for Alice: Madness Returns that includes the first Alice game redone for gamepad too. - - - -## What is Xpadder? - - - -Xpadder is a software that allows you to use a gamepad with any PC game that does not have native controller support. You can create your own custom profiles for different games and assign keyboard and mouse inputs to your gamepad buttons, triggers, sticks and d-pad. You can also use Xpadder to emulate mouse movements, adjust sensitivity, add turbo functions, create macros and more. - - - -Xpadder is compatible with most gamepads, including Xbox 360, PlayStation 3, PlayStation 4, Steam Controller and more. You can download Xpadder from its official website for $9.99 or find a free version online. - - - -## How to Play Alice: Madness Returns with a Gamepad on PC using Xpadder - - - -To play Alice: Madness Returns with a gamepad on PC using Xpadder, you will need to follow these steps: - - - -1. Download and install Xpadder on your PC. - -2. Connect your gamepad to your PC and launch Xpadder. - -3. Select your gamepad from the list of detected devices and choose an image for it. - -4. Click on each button, trigger, stick and d-pad on your gamepad and assign a keyboard or mouse input to it. You can use the default settings or customize them according to your preferences. - -5. Save your profile by clicking on the floppy disk icon at the top right corner of the Xpadder window. - -6. Download the Alice: Madness Returns Xpadder game profile from [here](https://xpadder.com/forum4/viewtopic.php?t=4116). This profile was created by user Primal Fear from the Xpadder Forum and it includes the first Alice game redone for gamepad too. - -7. Extract the zip file and copy the .xpadderprofile file to your Xpadder folder. - -8. Launch Alice: Madness Returns on your PC and go to the options menu. Disable mouse smoothing and set the keyboard layout to QWERTY. - -9. Alt-tab to Xpadder and load the Alice: Madness Returns profile by clicking on the folder icon at the top right corner of the Xpadder window. - -10. Enjoy playing Alice: Madness Returns with a gamepad on PC! - - - -## Tips and Tricks - - - -- You can switch between the first Alice game and Alice: Madness Returns by pressing the Back button on your gamepad. - -- You can access the in-game menu by pressing the Start button on your gamepad. - -- You can lock onto enemies by pressing the Right Trigger on your gamepad. - -- You can use different weapons by pressing the Left Bumper or Right Bumper on your gamepad. - -- You can shrink or grow by pressing the Left Trigger on your gamepad. - -- You can dodge by pressing the A button on your gamepad. - - - - 145887f19f - - - - - diff --git a/spaces/1acneusushi/gradio-2dmoleculeeditor/data/Autodesk 3ds Max 2009 Activation Code Download Tips and Tricks for Successful Installation.md b/spaces/1acneusushi/gradio-2dmoleculeeditor/data/Autodesk 3ds Max 2009 Activation Code Download Tips and Tricks for Successful Installation.md deleted file mode 100644 index ce4ff1213235a0cec6f089e0856c5adca37145f4..0000000000000000000000000000000000000000 --- a/spaces/1acneusushi/gradio-2dmoleculeeditor/data/Autodesk 3ds Max 2009 Activation Code Download Tips and Tricks for Successful Installation.md +++ /dev/null @@ -1,140 +0,0 @@ - -

Autodesk 3ds Max 2009 Activation Code Download: A Complete Guide

-

If you are looking for a powerful and versatile software for creating 3D animations, models, games, and graphics, you might want to consider Autodesk 3ds Max 2009. This software is one of the most popular and widely used tools for professional and amateur artists, designers, and developers. But how can you download and activate this software on your computer? In this article, we will show you a complete guide on how to do that. Read on to find out more.

-

autodesk 3ds max 2009 activation code download


Downloadhttps://byltly.com/2uKvCr



-

What is Autodesk 3ds Max 2009?

-

Autodesk 3ds Max 2009 is a software application that allows you to create and edit 3D content. It was released in April 2008 by Autodesk, a leading company in the field of design and engineering software. Autodesk 3ds Max 2009 is the ninth version of the software, which was formerly known as 3D Studio Max. It is compatible with Windows XP, Vista, and 7 operating systems.

-

Features and benefits of Autodesk 3ds Max 2009

-

Autodesk 3ds Max 2009 offers a range of features and benefits that make it a powerful and versatile software for creating 3D content. Some of these features and benefits are:

- -

System requirements for Autodesk 3ds Max 2009

-

To run Autodesk 3ds Max 2009 smoothly on your computer, you need to meet the following minimum system requirements:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ComponentRequirement
Operating systemWindows XP (SP2 or higher), Vista (SP1 or higher), or Windows7 (32-bit or64-bit)
ProcessorIntel Pentium IV or higher; AMD Athlon XP or higher
Memory1 GB RAM (2 GB recommended)
Hard disk space1 GB free disk space for installation; additional space required for working files
Graphics cardDirectX®-compatible graphics card with at least128 MB RAM; OpenGL-compatible graphics card recommended for advanced features
Display resolution1024 x768 pixels or higher; true color (32-bit) recommended
Internet connectionRequired for online activation; broadband connection recommended for downloading updates and accessing online resources
DVD-ROM driveRequired for installation from DVD media; not required for installation from electronic download
-

How to download Autodesk 3ds Max 2009?

-

To download Autodesk 3ds Max 2009 on your computer, you need to follow these steps:

-

autodesk 3ds max 2009 crack download
-autodesk 3ds max 2009 serial number download
-autodesk 3ds max 2009 keygen download
-autodesk 3ds max 2009 license download
-autodesk 3ds max 2009 product key download
-autodesk 3ds max 2009 full version download
-autodesk 3ds max 2009 free download with crack
-autodesk 3ds max 2009 free download with keygen
-autodesk 3ds max 2009 free download with serial number
-autodesk 3ds max 2009 free download with license
-autodesk 3ds max 2009 free download with product key
-autodesk 3ds max 2009 free download with activation code
-how to activate autodesk 3ds max 2009
-how to crack autodesk 3ds max 2009
-how to install autodesk 3ds max 2009
-how to use autodesk 3ds max 2009
-how to download autodesk 3ds max 2009
-how to get autodesk 3ds max 2009 for free
-how to get autodesk 3ds max 2009 activation code
-how to get autodesk 3ds max 2009 serial number
-how to get autodesk 3ds max 2009 license
-how to get autodesk 3ds max 2009 product key
-how to get autodesk 3ds max 2009 keygen
-how to get autodesk 3ds max 2009 crack
-where to download autodesk 3ds max 2009
-where to find autodesk 3ds max 2009 activation code
-where to find autodesk 3ds max 2009 serial number
-where to find autodesk 3ds max 2009 license
-where to find autodesk 3ds max 2009 product key
-where to find autodesk 3ds max 2009 keygen
-where to find autodesk 3ds max 2009 crack
-best site to download autodesk 3ds max 2009
-best site to get autodesk 3ds max 2009 activation code
-best site to get autodesk 3ds max 2009 serial number
-best site to get autodesk 3ds max 2009 license
-best site to get autodesk 3ds max 2009 product key
-best site to get autodesk 3ds max

-

Step1: Visit the official website of Autodesk

-

The first step is to visit the official website of Autodesk at https://www.autodesk.com/. This is where you can find all the products and services offered by Autodesk. You can also access various resources, such as tutorials, forums, blogs, support, and more.

-

Step2: Create an account or sign in

-

The next step is to create an account or sign in to your existing account on the website. You need an account to access the download page of Autodesk products. To create an account, click on the "Sign In" button at the top right corner of the website. Then click on "Create Account" and fill in your details. To sign in to your account, enter your email address and password.

-

Step3: Select the product and version

-

Step 4: Choose the language and operating system

-

The fourth step is to choose the language and operating system that you want to download. To do this, click on the "Download" button next to the product name. You will see a pop-up window that shows you the available options. Select the language and operating system that match your computer. Then click on "Next".

-

Step 5: Download the installer file

-

The fifth and final step is to download the installer file on your computer. To do this, click on the "Browser Download" button. You will see a dialog box that asks you to save the file. Choose a location where you want to save the file and click on "Save". The download will start automatically. Depending on your internet speed and file size, it may take some time to complete. Once the download is finished, you will have the installer file on your computer.

-

How to activate Autodesk 3ds Max 2009?

-

To activate Autodesk 3ds Max 2009 on your computer, you need to follow these steps:

-

Step 1: Run the installer file and follow the instructions

-

The first step is to run the installer file that you downloaded on your computer. To do this, double-click on the file or right-click and select "Open". You will see a welcome screen that asks you to accept the terms and conditions of the software. Click on "I Accept" and then click on "Next". You will see a screen that asks you to choose the type of installation. You can choose between "Typical", "Custom", or "Complete". We recommend choosing "Typical" for most users. Then click on "Next". You will see a screen that shows you the installation progress. Wait until the installation is completed.

-

Step 2: Enter the serial number and product key

-

The second step is to enter the serial number and product key that you received when you purchased or subscribed to Autodesk 3ds Max 2009. To do this, open the software by clicking on its icon on your desktop or start menu. You will see a screen that asks you to activate your product. Click on "Activate" and then click on "Next". You will see a screen that asks you to enter your serial number and product key. You can find these numbers in your email confirmation, invoice, or online account. Enter them in the corresponding fields and click on "Next".

-

Step 3: Request an activation code online or by phone

-

The third step is to request an activation code online or by phone. To do this, you will see a screen that shows you two options: "Activate Online" or "Activate by Phone". If you have an internet connection, we recommend choosing "Activate Online". This is the fastest and easiest way to activate your product. To do this, click on "Activate Online" and then click on "Next". You will see a screen that shows you your request code. Copy this code and paste it in a text document or write it down somewhere. Then click on "Next". You will be redirected to a web page where you need to sign in to your Autodesk account or create one if you don't have one already. Then follow the instructions on the web page to get your activation code.

-

If you don't have an internet connection or prefer to activate by phone, you can choose "Activate by Phone". This is an alternative way to activate your product. To do this, click on "Activate by Phone" and then click on "Next". You will see a screen that shows you your request code and a phone number for your region. Call this number and follow the voice prompts to get your activation code.

-

Step 4: Enter the activation code and complete the process

-

The fourth and final step is to enter the activation code and complete the process. To do this, go back to the software activation screen and enter the activation code that you received online or by phone in the corresponding field. Then click on "Next". You will see a screen that confirms that your product has been activated successfully. Click on "Finish" to close the screen. Congratulations! You have successfully downloaded and activated Autodesk 3ds Max 2009 on your computer.

-

Conclusion

-

In this article, we have shown you how to download and activate Autodesk 3ds Max 2009 on your computer. We hope that this guide has been helpful and informative for you. Autodesk 3ds Max 2009 is a powerful and versatile software for creating 3D content. It offers a range of features and benefits that make it a great tool for professional and amateur artists, designers, and developers. If you want to learn more about Autodesk 3ds Max 2009, you can visit its official website at https://www.autodesk.com/products/3ds-max/overview. There you can find more resources, such as tutorials, forums, blogs, support, and more.

-

FAQs

-

Here are some frequently asked questions about Autodesk 3ds Max 2009:

-
    -
  1. What is the difference between Autodesk 3ds Max 2009 and Autodesk Maya?
  2. -

    Autodesk 3ds Max 2009 and Autodesk Maya are both software applications for creating 3D content. They are both products of Autodesk, but they have different features, strengths, and workflows. Generally speaking, Autodesk 3ds Max 2009 is more focused on modeling, animation, rendering, and game development, while Autodesk Maya is more focused on visual effects, simulation, rigging, scripting, and compositing.

    -
  3. How much does Autodesk 3ds Max 2009 cost?
  4. -

    Autodesk 3ds Max 2009 is no longer available for purchase or subscription from Autodesk. The latest version of Autodesk 3ds Max is Autodesk 3ds Max2022, which costs $1,620 per year or $205 per month for a subscription plan.

    -
  5. Can I use Autodesk 3ds Max 2009 for free?
  6. -

    No, you cannot use Autodesk 3ds Max 2009 for free legally. However, if you are a student or educator, you can get access to Autodesk products for free for educational purposes through https://www.autodesk.com/education/home. There you can find more information about how to apply for a free license.

    -
  7. Can I use Autodesk 3ds Max 2009 on Mac?
  8. -

    No, you cannot use Autodesk 3ds Max 2009 on Mac natively. Autodesk 3ds Max only supports Windows operating systems. However, if you have a Mac with an Intel processor, you can use Boot Camp or Parallels Desktop software to run Windows applications on your Mac.

    -
  9. Where can I find tutorials for Autodesk 3ds Max 2009?
  10. -

    You can find tutorials for Autodesk 3ds Max 2009 on various websites and platforms online. Some of them are:

    - -
-

0a6ba089eb
-
-
\ No newline at end of file diff --git a/spaces/1acneusushi/gradio-2dmoleculeeditor/data/Faronics.Deep.free __LINK__ze.Standard.v6 62 020 3058 Incl Key Crack.md b/spaces/1acneusushi/gradio-2dmoleculeeditor/data/Faronics.Deep.free __LINK__ze.Standard.v6 62 020 3058 Incl Key Crack.md deleted file mode 100644 index d863da2ad4a5abc0fc4f485a753b2e66efe71f7e..0000000000000000000000000000000000000000 --- a/spaces/1acneusushi/gradio-2dmoleculeeditor/data/Faronics.Deep.free __LINK__ze.Standard.v6 62 020 3058 Incl Key Crack.md +++ /dev/null @@ -1,135 +0,0 @@ -
-

Faronics Deep Freeze Standard v6 62 020 3058 Incl Key Crack: A Review

-

If you are looking for a way to protect your computer from unwanted changes, malware, and system errors, you might have come across Faronics Deep Freeze Standard. This is a software that can freeze your system configuration and restore it to its original state with a simple reboot. But what if you don't want to pay for the software and instead use a crack to activate it? Is it worth the risk? In this article, we will review Faronics Deep Freeze Standard, explain what a crack is and why people use it, and show you how to get the software legally and safely.

-

Faronics.Deep.Freeze.Standard.v6 62 020 3058 Incl Key crack


DOWNLOAD » https://byltly.com/2uKvXu



-

What is Faronics Deep Freeze Standard?

-

Faronics Deep Freeze Standard is a patented reboot-to-restore software that can make your computer indestructible. It works by redirecting any changes made to your hard drive to a virtual partition, leaving the original data intact. This way, you can provide unrestricted access to your computer without worrying about permanent configuration changes, malware infections, or system errors. Any unwanted changes can be reversed with a simple reboot, restoring your computer to its desired state.

-

Features and benefits of Faronics Deep Freeze Standard

-

Some of the features and benefits of Faronics Deep Freeze Standard are:

- -

How to install and use Faronics Deep Freeze Standard

-

To install and use Faronics Deep Freeze Standard, you need to follow these steps:

-
    -
  1. Download the software from the official website or from a trusted source.
  2. -
  3. Run the installer and follow the instructions on the screen.
  4. -
  5. Select the drives or partitions that you want to freeze and configure the settings according to your preferences.
  6. -
  7. Enter the license key that you received after purchasing the software or request a free trial.
  8. -
  9. Restart your computer to activate the software.
  10. -
  11. To make any changes to your frozen system, you need to enter the password that you set during installation and select thawed mode. This will allow you to make temporary changes that will be discarded after rebooting.
  12. -
  13. To make permanent changes to your frozen system, you need to enter the password that you set during installation and select maintenance mode. This will allow you to make persistent changes that will be retained after rebooting.
  14. -
-

What is a crack and why do people use it?

-

A crack is a program or a file that can modify or bypass the security features of another software. People use cracks to activate or unlock software that they have not paid for or that they have obtained illegally. For example, some people might use a crack to activate Faronics Deep Freeze Standard without buying a license key or requesting a free trial.

-

The risks and disadvantages of using a crack

-

Using a crack might seem like an easy way to get software for free, but it comes with many risks and disadvantages. Some of them are:

- -

The legal and ethical implications of using a crack

-

Besides the technical risks and disadvantages, using a crack also has legal and ethical implications. Some of them are:

-

How to install Faronics Deep Freeze Standard v6.62 on Windows 10
-Faronics Deep Freeze Standard v6.62 review and features
-Faronics Deep Freeze Standard v6.62 license key generator
-Faronics Deep Freeze Standard v6.62 vs Enterprise edition
-Faronics Deep Freeze Standard v6.62 download link and crack
-How to uninstall Faronics Deep Freeze Standard v6.62 from your PC
-How to use Faronics Deep Freeze Standard v6.62 for PC restore and protection
-Faronics Deep Freeze Standard v6.62 release notes and updates
-How to activate Faronics Deep Freeze Standard v6.62 with key
-How to bypass Faronics Deep Freeze Standard v6.62 password
-How to configure Faronics Deep Freeze Standard v6.62 settings and options
-How to create virtual partitions with Faronics Deep Freeze Standard v6.62
-How to fix common issues with Faronics Deep Freeze Standard v6.62
-How to get support for Faronics Deep Freeze Standard v6.62
-How to integrate Faronics Deep Freeze Standard v6.62 with other Faronics products
-How to manage multiple computers with Faronics Deep Freeze Standard v6.62
-How to protect your Master Boot Record with Faronics Deep Freeze Standard v6.62
-How to recover data from frozen computers with Faronics Deep Freeze Standard v6.62
-How to revert changes with a simple reboot using Faronics Deep Freeze Standard v6.62
-How to secure your POS computers from malware with Faronics Deep Freeze Standard v6.62
-How to update Faronics Deep Freeze Standard v6.62 to the latest version
-Is Faronics Deep Freeze Standard v6.62 compatible with Windows 11
-Pros and cons of using Faronics Deep Freeze Standard v6.62
-The best alternatives to Faronics Deep Freeze Standard v6.62
-The difference between Reboot-to-Restore and Reboot-to-Repair technologies
-The history and evolution of Faronics Deep Freeze Standard
-The impact of Faronics Deep Freeze Standard v6.62 on system performance and resources
-The most common use cases for Faronics Deep Freeze Standard v6.62
-The non-restrictive Reboot-to-Restore concept of Faronics Deep Freeze Standard v6.62
-The patented technology behind Faronics Deep Freeze Standard v6.62
-Tips and tricks for using Faronics Deep Freeze Standard v6.62 effectively
-What are the benefits of using Faronics Deep Freeze Standard v6.62 for education, government, healthcare, and retail sectors
-What are the drawbacks of using Faronics Deep Freeze Standard v6.62
-What are the minimum system requirements for installing and running Faronics Deep Freeze Standard v6.62
-What are the pricing and licensing options for Faronics Deep Freeze Standard v6.62
-What are the security features of Faronics Deep Freeze Standard v6.62
-What is the difference between freezing and thawing your computer with Faronics Deep Freeze Standard v6.62
-What is the difference between standard mode and stealth mode in Faronics Deep Freeze Standard v6.62
-What is the difference between workstation installer and seed installer in Faronics Deep Freeze Standard v6.62

- -

How to get Faronics Deep Freeze Standard legally and safely

-

The best way to get Faronics Deep Freeze Standard legally and safely is to buy a licensed version of the software from the official website or from an authorized reseller. This way, you can enjoy all the features and benefits of the software without risking your computer, security, privacy, or reputation.

-

The advantages of buying a licensed version of Faronics Deep Freeze Standard

-

Some of the advantages of buying a licensed version of Faronics Deep Freeze Standard are:

- -

The steps to purchase and activate Faronics Deep Freeze Standard

-

To purchase and activate Faronics Deep Freeze Standard legally and safely, you need to follow these steps:

-
    -
  1. Visit the official website of Faronics Deep Freeze Standard or contact an authorized reseller near you.
  2. -
  3. Select the number of licenses that you need based on how many computers you want to install the software on. You can also request a quote for volume discounts if you need more than 10 licenses.
  4. -
  5. Fill out your personal information such as name, email address, phone number, country, etc. You can also opt-in for newsletters or special offers if you wish.
  6. -
  7. Select your preferred payment method such as credit card, PayPal, wire transfer, etc. You can also apply a coupon code if you have one.
  8. -
  9. Complete your payment process by following the instructions on the screen. You will receive an email confirmation with your order details and invoice.
  10. -
  11. Download the software from the download page using the link provided in your email confirmation. You will also receive your license key in your email confirmation.
  12. -
  13. Install and activate the software using the user guide. You will need to enter your license key during installation or activation.
  14. -

    Conclusion

    -

    Faronics Deep Freeze Standard is a powerful reboot-to-restore software that can protect your computer from unwanted changes, malware, and system errors. However, using a crack to activate it is not only risky but also illegal and unethical. Therefore, we recommend that you buy a licensed version of the from the official website or from an authorized reseller. This way, you can enjoy all the benefits and features of the software without compromising your computer, security, privacy, or reputation.

    -

    Summary of the main points

    -

    In this article, we have reviewed Faronics Deep Freeze Standard, a reboot-to-restore software that can make your computer indestructible. We have also explained what a crack is and why people use it to activate software illegally. We have shown you the risks and disadvantages of using a crack, as well as the legal and ethical implications of doing so. Finally, we have shown you how to get Faronics Deep Freeze Standard legally and safely by buying a licensed version of the software from the official website or from an authorized reseller.

    -

    Call to action

    -

    If you are interested in Faronics Deep Freeze Standard and want to protect your computer from unwanted changes, malware, and system errors, don't hesitate to buy a licensed version of the software today. You can visit the official website of Faronics Deep Freeze Standard or contact an authorized reseller near you to place your order. You can also request a free trial if you want to test the software before buying it. Don't risk your computer, security, privacy, or reputation by using a crack. Get Faronics Deep Freeze Standard legally and safely and enjoy its features and benefits with confidence and peace of mind.

    -

    FAQs

    -

    Here are some frequently asked questions about Faronics Deep Freeze Standard and cracks:

    - -

    0a6ba089eb
    -
    -
    \ No newline at end of file diff --git a/spaces/1acneusushi/gradio-2dmoleculeeditor/data/Foxit Reader Pro Full Download How to Create Edit and Share PDFs Like a Pro.md b/spaces/1acneusushi/gradio-2dmoleculeeditor/data/Foxit Reader Pro Full Download How to Create Edit and Share PDFs Like a Pro.md deleted file mode 100644 index 079b095632d138e107330e7f1ff530609e40d202..0000000000000000000000000000000000000000 --- a/spaces/1acneusushi/gradio-2dmoleculeeditor/data/Foxit Reader Pro Full Download How to Create Edit and Share PDFs Like a Pro.md +++ /dev/null @@ -1,33 +0,0 @@ - -

    Download Foxit Reader Pro Full: How to Get the Best PDF Reader and Editor for Windows

    -

    If you are looking for a free and powerful PDF reader and editor for Windows, you may want to consider Foxit Reader Pro. Foxit Reader Pro is a premium version of Foxit Reader, a popular PDF editor that offers a range of features and tools to help you view, annotate, fill out, sign, and protect your PDF documents. In this article, we will show you how to get the full version of Foxit Reader Pro and what benefits it can bring to your work.

    -

    download foxit reader pro full + crack


    DOWNLOADhttps://byltly.com/2uKweU



    -

    What is Foxit Reader Pro?

    -

    Foxit Reader Pro is a PDF reader and editor that works like a word processor, allowing you to manage text, paragraphs, images, and other elements in your PDF documents. You can also create new PDF files from scratch or from various sources, such as scanners, web pages, or other applications. Foxit Reader Pro supports Optical Character Recognition (OCR), which means it can recognize text from scanned or image-based PDFs and let you edit them as you wish.

    -

    One of the main advantages of Foxit Reader Pro is its collaboration features. You can connect to online cloud storage and Content Management Systems (CMS) to access and share your PDF files with your team members. You can also add comments, annotations, stamps, and signatures to your PDFs and track the changes made by others. Foxit Reader Pro also lets you protect your PDFs with passwords, encryption, certificates, redaction, and digital rights management (DRM).

    -

    Foxit Reader Pro also offers some exclusive features that are not available in the free version of Foxit Reader. These include:

    -

    - -

    How to get Foxit Reader Pro full download?

    -

    To get the full version of Foxit Reader Pro, you need to purchase a subscription from the official website of Foxit Software. There are two subscription levels you can choose from: the standard PDF reader and the pro PDF reader. The standard PDF reader provides all the essential features for viewing and annotating PDFs, while the pro PDF reader adds advanced editing and security tools.

    -

    The subscription prices vary depending on the duration and the number of users. You can choose between monthly or yearly plans and between single-user or multi-user licenses. You can also get a free trial for 14 days to test the features of Foxit Reader Pro before buying it.

    -

    Once you purchase a subscription, you will receive an email with a download link and a license key. You need to download the offline installer file from the link and run it on your computer. Then, you need to enter the license key when prompted to activate your subscription. After that, you can start using Foxit Reader Pro offline on your PC.

    -

    Conclusion

    -

    Foxit Reader Pro is a comprehensive PDF reader and editor that can help you view, edit, share, sign, and protect your PDF documents with ease. It offers a range of features and tools that go beyond basic viewing and annotating. You can also collaborate with your team members online and access your PDF files from various cloud storage and CMS platforms.

    -

    To get the full version of Foxit Reader Pro, you need to purchase a subscription from the official website of Foxit Software. You can choose between two subscription levels: the standard PDF reader and the pro PDF reader. You can also get a free trial for 14 days to try out the features of Foxit Reader Pro.

    -

    If you are looking for a reliable and versatile PDF reader and editor for Windows, Foxit Reader Pro is a great option to consider.

    ddb901b051
    -
    -
    \ No newline at end of file diff --git a/spaces/1gistliPinn/ChatGPT4/Examples/American Sniper Full FREE Movie In Hindi Download Kickass.md b/spaces/1gistliPinn/ChatGPT4/Examples/American Sniper Full FREE Movie In Hindi Download Kickass.md deleted file mode 100644 index 68027433785aee3e808089c844e7b55e8322bfe4..0000000000000000000000000000000000000000 --- a/spaces/1gistliPinn/ChatGPT4/Examples/American Sniper Full FREE Movie In Hindi Download Kickass.md +++ /dev/null @@ -1,11 +0,0 @@ - -

    download hd mp4 720p 480p chad michael collins,danay garcia,billy zane,tom berenger,joe lando,pedro jos pallares,jaime correa,lucho velasco, 3 october 2017dvdrip mp4mobilemovies hon3yhd 3gpmobilemovies 02cinema downloadhub

    -

    american sniper full movie in hindi download kickass


    Download ⚹⚹⚹ https://imgfil.com/2uxXyv



    -

    download hd pc mp4 720p 480p chad michael collins,danay garcia,billy zane,tom berenger,joe lando,pedro jos pallares,jaime correa,lucho velasco, 3 october 2017dvdrip mp4mobilemovies hon3yhd 3gpmobilemovies 02cinema downloadhub

    -

    download hd pc mp4 720p 480p chad michael collins,danay garcia,billy zane,tom berenger,joe lando,pedro jos pallares,jaime correa,lucho velasco, 3 october 2017dvdrip mp4mobilemovies hon3yhd 3gpmobilemovies 02cinema downloadhub

    -

    10 oct 2017 download full movie in hindi language torrent hd [bbc documentary. download full movie in hindi language torrent hd [bbc documentary. https://coub.com/stories/3215817-i-am-full-movie-in-hindi-dubbed-hd-1080p-best. .com/stories/3155095-tajpuri-movie-download-kickass-hd-5-3gp-torrent-free.

    -

    https://coub.com/stories/3215817-i-am-full-movie-in-hindi-dubbed-hd-1080p-best. story(3).. https://coub.com/stories/3215913-to-and-from-full-movie-in-hindi-dubbed-hd-720p-torrent-free. .com/stories/3070224-jai-movie-full-movie-in-hindi-dubbed-1080p-torrent-free.com/stories/3068299-karachi-movie-full-movie-in-hindi-dubbed-hd-1080p-torrent-free.com/stories/3048499-fool-n-final-movie-full-movie-in-hindi-dubbed-1080p-wetwonn.

    -

    -

    https://coub.com/stories/3215817-i-am-full-movie-in-hindi-dubbed-hd-1080p-best. https://coub.com/stories/3215913-to-and-from-full-movie-in-hindi-dubbed-hd-720p-torrent-free.com/stories/3148388-paint-full-movie-in-hindi-dubbed-torrent-hd.com/stories/3070224-jai-movie-full-movie-in-hindi-dubbed-1080p-torrent-free.com/stories/3068299-karachi-movie-full-movie-in-hindi-dubbed-hd-1080p-torrent-free.com/stories/3048499-fool-n-final-movie-full-movie-in-hindi-dubbed-1080p-wetwonn.

    899543212b
    -
    -
    \ No newline at end of file diff --git a/spaces/1gistliPinn/ChatGPT4/Examples/Creative Sound Blaster X Fi Mb [REPACK] Cracked.22.md b/spaces/1gistliPinn/ChatGPT4/Examples/Creative Sound Blaster X Fi Mb [REPACK] Cracked.22.md deleted file mode 100644 index 50be71bf080cae3e4df093f4d83626cf8d1b334b..0000000000000000000000000000000000000000 --- a/spaces/1gistliPinn/ChatGPT4/Examples/Creative Sound Blaster X Fi Mb [REPACK] Cracked.22.md +++ /dev/null @@ -1,42 +0,0 @@ - -

    How to Install Creative Sound Blaster X-Fi MB on Realtek HD Audio for Free

    -

    If you want to enhance your audio quality and experience on your PC, you might be interested in installing Creative Sound Blaster X-Fi MB software. This software provides premium audio effects and features for PC systems equipped with only basic onboard audio. However, this software is not free and requires a license key to activate.

    -

    Fortunately, there is a way to install Creative Sound Blaster X-Fi MB on Realtek HD audio for free, without paying for a license key. This method involves downloading a cracked version of the software and modifying some registry files. In this article, we will show you how to do it step by step.

    -

    Creative Sound Blaster X Fi Mb Cracked.22


    Download File ☆☆☆ https://imgfil.com/2uxYAs



    -

    Disclaimer

    -

    Before we proceed, we want to make it clear that this method is not legal and may violate the terms and conditions of Creative Technology Ltd. We do not condone or encourage piracy or illegal use of software. This article is for educational and informational purposes only. Use this method at your own risk.

    -

    Requirements

    -

    To install Creative Sound Blaster X-Fi MB on Realtek HD audio for free, you will need the following:

    - -

    Steps

    -

    Follow these steps to install Creative Sound Blaster X-Fi MB on Realtek HD audio for free:

    -
      -
    1. Download the cracked version of Creative Sound Blaster X-Fi MB software from the link above and extract it to a folder on your desktop.
    2. -
    3. Open the folder and run the setup.exe file as administrator. Follow the instructions to install the software.
    4. -
    5. After the installation is complete, do not run the software yet. Instead, go to the folder where you extracted the zip file and open the "Instructions" folder.
    6. -
    7. Open the "Take Ownership.reg" file and click "Yes" to add it to your registry. This will allow you to modify some system files later.
    8. -
    9. Open the "Realtek HD Audio Driver" folder and copy all the files inside it.
    10. -
    11. Paste the files into the following location: C:\Windows\System32\drivers\
    12. -
    13. If prompted to replace any existing files, click "Yes".
    14. -
    15. Open the "Creative Sound Blaster X-Fi MB" folder and copy all the files inside it.
    16. -
    17. Paste the files into the following location: C:\Program Files (x86)\Creative\Sound Blaster X-Fi MB\
    18. -
    19. If prompted to replace any existing files, click "Yes".
    20. -
    21. Open the "Registry" folder and double-click on the "SBXFIMB5.reg" file. Click "Yes" to add it to your registry.
    22. -
    23. Restart your PC.
    24. -
    25. After your PC restarts, run the Creative Sound Blaster X-Fi MB software from your desktop or start menu. You should see a message saying that your software is activated.
    26. -
    27. Enjoy your enhanced audio quality and experience!
    28. -
    -

    Troubleshooting

    -

    If you encounter any problems while installing or running Creative Sound Blaster X-Fi MB on Realtek HD audio for free, you can try these troubleshooting tips:

    -

    197e85843d
    -
    -
    \ No newline at end of file diff --git a/spaces/1phancelerku/anime-remove-background/Anime Go APK An Easy and Reliable App for Anime Streaming.md b/spaces/1phancelerku/anime-remove-background/Anime Go APK An Easy and Reliable App for Anime Streaming.md deleted file mode 100644 index 198ab3a16c95c1083fc07ee99182ebf6b8c4b830..0000000000000000000000000000000000000000 --- a/spaces/1phancelerku/anime-remove-background/Anime Go APK An Easy and Reliable App for Anime Streaming.md +++ /dev/null @@ -1,210 +0,0 @@ - -

    How to Download APK Anime Go

    -

    If you are an anime fan who loves to watch your favorite shows and movies online, you might have heard of APK Anime Go. This is a popular app that allows you to stream and download thousands of anime titles on your device. But how do you download APK Anime Go? And what are its features and benefits? In this article, we will answer these questions and more. We will show you how to download APK Anime Go for Android devices and other devices using emulators. We will also guide you on how to use the app and enjoy its amazing functions. So let's get started!

    -

    What is APK Anime Go?

    -

    APK Anime Go is an app that lets you watch online anime videos, episodes, movies, and more. It has a huge collection of anime from various genres, categories, years, and sources. You can find anime from popular series like Naruto, One Piece, Dragon Ball, One Punch Man, etc. as well as anime from lesser-known or niche titles. You can also discover new anime based on your preferences and recommendations.

    -

    download apk anime go


    Download File 🗹 https://jinyurl.com/2uNQAm



    -

    APK Anime Go has a simple and user-friendly interface that makes it easy to navigate and use. You can search for anime by name, genre, category, tag, or filter. You can also browse through the latest releases, trending titles, top-rated shows, etc. You can watch anime in high-quality resolution with subtitles in different languages. You can also download anime for offline viewing or save them to your favorites list.

    -

    APK Anime Go is a free app that does not require any registration or subscription. You can watch unlimited anime without any ads or interruptions. You can also update the app regularly to get new features and bug fixes.

    -

    Why Download APK Anime Go?

    -

    You might be wondering why you should download APK Anime Go when there are so many other anime streaming services and platforms available. Well, here are some reasons why APK Anime Go is better than most of them:

    - -

    As you can see, APK Anime Go is a great app for anime lovers who want to watch and download anime on their devices. It has many advantages and benefits over other anime streaming services and platforms. So why not give it a try and see for yourself?

    -

    How to Download APK Anime Go for Android Devices

    -

    If you have an Android device, such as a smartphone or tablet, you can easily download APK Anime Go on your device. Here are the steps you need to follow:

    -

    Requirements for Downloading APK Anime Go

    -

    Before you download APK Anime Go on your Android device, you need to make sure that your device meets the following requirements:

    -

    download anime go app apk
    -anime go apk free download for android
    -anime go streaming app apk download
    -download anime go latest version apk
    -anime go apk download 2023
    -how to download anime go apk
    -anime go mod apk download
    -anime go pro apk download
    -download anime go apk for pc
    -anime go apk download no ads
    -anime go premium apk download
    -anime go apk download uptodown
    -anime go apk download apkpure
    -anime go plus apk download
    -anime go hd apk download
    -anime go 5.0 apk download
    -anime go 4k apk download
    -anime go offline apk download
    -anime go english sub apk download
    -anime go english dub apk download
    -best anime go apk download
    -new anime go apk download
    -old anime go apk download
    -original anime go apk download
    -safe anime go apk download
    -secure anime go apk download
    -trusted anime go apk download
    -verified anime go apk download
    -working anime go apk download
    -updated anime go apk download
    -fast anime go apk download
    -easy anime go apk download
    -simple anime go apk download
    -quick anime go apk download
    -direct anime go apk download
    -unlimited anime go apk download
    -full anime go apk download
    -cracked anime go apk download
    -hacked anime go apk download
    -unlocked anime go apk download
    -ad-free anime go apk download
    -virus-free anime go apk download
    -malware-free anime go apk download
    -bug-free anime go apk download
    -error-free anime go apk download
    -high-quality anime go apk download
    -low-size anime go apk download
    -smooth anime go apk download
    -stable anime go apk download

    - -

    Sources for Downloading APK Anime Go

    -

    There are many sources where you can download APK Anime Go on your Android device. However, not all of them are safe and reliable. Some of them may contain viruses, malware, or spyware that can harm your device or steal your personal information. Therefore, you need to be careful and choose a trusted source for downloading the app. Here is a table of the best and safest sources for downloading APK Anime Go, with ratings, reviews, and URLs:

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    Steps for Downloading APK Anime Go

    -

    Once you have chosen a source for downloading APK Anime Go, you can follow these steps to download and install the app on your Android device:

    -
      -
    1. Open the source website on your device's browser and search for APK Anime Go.
    2. -
    3. Click on the download button and wait for the APK file to be downloaded on your device.
    4. -
    5. Locate the downloaded APK file on your device's file manager and tap on it to open it.
    6. -
    7. Click on the install button and wait for the app to be installed on your device.
    8. -
    9. Once the installation is complete, you can launch the app from your device's app drawer or home screen.
    10. -
    -

    Congratulations! You have successfully downloaded APK Anime Go on your Android device. You can now enjoy watching and downloading anime on your device.

    -

    How to Download APK Anime Go for Other Devices

    -

    If you don't have an Android device, don't worry. You can still download APK Anime Go on other devices, such as Windows PC, Mac, iOS, Firestick, etc. However, you will need to use an emulator to run the app on these devices. An emulator is a software that simulates an Android environment on your device and allows you to run Android apps and games on it.

    -

    Emulators for Downloading APK Anime Go

    -

    There are many emulators available for different devices and platforms. However, not all of them are compatible and efficient for running APK Anime Go. Here is a list of the best and most compatible emulators for downloading APK Anime Go, with features, pros, and cons:

    -
    SourceRatingReviewURL
    APKPure4.8/5This is one of the most popular and reputable sources for downloading APK files. It has a large database of apps and games, including APK Anime Go. It also has a fast and secure download process, with no ads or pop-ups.https://apkpure.com/apk-anime-go/com.apkanimego
    APKMirror4.6/5This is another well-known and trusted source for downloading APK files. It has a wide range of apps and games, including APK Anime Go. It also has a simple and user-friendly interface, with no registration or subscription required.https://www.apkmirror.com/apk/apk-anime-go
    Uptodown4.4/5This is a reliable and safe source for downloading APK files. It has a huge collection of apps and games, including APK Anime Go. It also has a fast and easy download process, with no malware or viruses.https://apk-anime-go.en.uptodown.com/android
    APKMonk4.2/5This is a decent source for downloading APK files. It has a good selection of apps and games, including APK Anime Go. It also has a smooth and secure download process, with no spam or fraud.https://www.apkmonk.com/app/com.apkanimego
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    EmulatorDevice/PlatformFeaturesProsCons
    BlueStacksWindows PC, Mac- The most popular and widely used emulator for Android apps and games
    - Supports high-performance gaming and streaming
    - Has a user-friendly interface and customizable settings
    - Has a built-in Google Play Store and App Center
    - Has a multi-instance feature that allows you to run multiple apps at once
    - Easy to download and install
    - Compatible with most Android apps and games
    - Offers a smooth and fast experience
    - Has a large and active community of users and developers
    - Requires a lot of RAM and CPU power
    - May cause some compatibility issues with some apps or games
    - May show some ads or pop-ups
    NoxPlayerWindows PC, Mac- A powerful and stable emulator for Android apps and games
    - Supports high-resolution gaming and streaming
    - Has a simple and elegant interface and flexible settings
    - Has a built-in Google Play Store and File Manager
    - Has a keyboard and mouse mapping feature that allows you to control the app with ease
    - Easy to download and install
    - Compatible with most Android apps and games
    - Offers a smooth and fast experience
    - Has a low system requirement and consumes less RAM and CPU power
    - May cause some lagging or crashing issues with some apps or games
    - May show some ads or pop-ups
    MEmu PlayWindows PC- A powerful and reliable emulator for Android apps and games
    - Supports high-performance gaming and streaming
    - Has a user-friendly interface and customizable settings
    - Has a built-in Google Play Store and File Manager
    - Has a multi-instance feature that allows you to run multiple apps at once
    - Easy to download and install
    - Compatible with most Android apps and games
    - Offers a smooth and fast experience
    - Has a low system requirement and consumes less RAM and CPU power
    - Only available for Windows PC
    - May cause some compatibility issues with some apps or games
    - May show some ads or pop-ups
    iOS EmulatoriOS- A simple and lightweight emulator for Android apps and games
    - Supports basic gaming and streaming
    - Has a minimal and easy-to-use interface and settings
    - Has a built-in Google Play Store and File Manager
    - Easy to download and install
    - Compatible with some Android apps and games
    - Offers a decent and smooth experience
    - Does not require a lot of RAM and CPU power
    - Only available for iOS devices
    - Does not support high-resolution gaming and streaming
    - May cause some lagging or crashing issues with some apps or games
    - May show some ads or pop-ups
    Firestick EmulatorFirestick- A dedicated and optimized emulator for Android apps and games on Firestick devices
    - Supports high-quality gaming and streaming on TV screens
    - Has a user-friendly interface and customizable settings
    - Has a built-in Google Play Store and File Manager
    - Has a remote control feature that allows you to control the app with your Firestick remote
    - Easy to download and install
    - Compatible with most Android apps and games
    - Offers a smooth and fast experience
    - Does not require a lot of RAM and CPU power
    - Only available for Firestick devices
    - May cause some compatibility issues with some apps or games
    - May show some ads or pop-ups
    -

    Steps for Downloading APK Anime Go Using Emulators

    -

    Once you have chosen an emulator for downloading APK Anime Go, you can follow these steps to download and install the app on your device using the emulator:

    -
      -
    1. Download and install the emulator on your device from its official website or app store.
    2. -
    3. Launch the emulator on your device and sign in with your Google account.
    4. -
    5. Open the Google Play Store or any other source website on the emulator's browser and search for APK Anime Go.
    6. -
    7. Click on the download button and wait for the APK file to be downloaded on the emulator.
    8. -
    9. Locate the downloaded APK file on the emulator's file manager and tap on it to open it.
    10. -
    11. Click on the install button and wait for the app to be installed on the emulator.
    12. -
    13. Once the installation is complete, you can launch the app from the emulator's app drawer or home screen.
    14. -
    -

    Congratulations! You have successfully downloaded APK Anime Go on your device using an emulator. You can now enjoy watching and downloading anime on your device.

    -

    How to Use APK Anime Go

    -

    Now that you have downloaded APK Anime Go on your device, you might be wondering how to use it. Don't worry, it's very easy and fun. Here are some tips on how to use the app, its interface, functions, settings, and features:

    -

    How to Search for Anime

    -

    If you want to find anime of your choice, you can use the search bar at the top of the app's home screen. You can type in the name of the anime or any keyword related to it. You can also use filters, categories, genres, and tags to narrow down your search results. For example, you can filter by year, season, status, type, etc. You can also browse by category, such as action, adventure, comedy, drama, etc. You can also browse by tag, such as romance, school, fantasy, horror, etc. You can also browse by source, such as Crunchyroll, Funimation, Netflix, etc.

    -

    How to Watch Anime

    -

    If you want to watch anime online, you can simply tap on the anime title that you want to watch. You will see a list of episodes or movies available for that anime. You can tap on the episode or movie that you want to watch. You will see a video player that will start playing the anime. You can also use various options and settings while watching anime. For example, you can play, pause, resume, skip, rewind, fast forward, adjust volume, brightness, subtitles, etc. You can also switch between different video quality options, such as 360p, 480p, 720p, 1080p etc.

    -

    How to Download Anime

    -

    If you want to download anime for offline viewing, you can follow these steps:

    -
      -
    1. Tap on the anime title that you want to download.
    2. -
    3. Tap on the episode or movie that you want to download.
    4. -
    5. Tap on the download icon at the bottom right corner of the video player.
    6. -
    7. Select the video quality option that you want to download.
    8. -
    9. Wait for the download to finish. You can see the progress and status of your downloads on the app's download manager.
    10. -
    11. Once the download is complete, you can access your downloaded anime on the app's offline library. You can watch them anytime and anywhere without an internet connection.
    12. -
    -

    That's how you can download anime for offline viewing using APK Anime Go. You can also choose the storage location and manage your downloads easily on the app.

    -

    Conclusion

    -

    In this article, we have shown you how to download APK Anime Go on your device. We have also explained what APK Anime Go is, why you should download it, and how to use it. APK Anime Go is a great app for anime lovers who want to watch and download anime on their devices. It has a huge collection of anime from various genres, categories, years, and sources. It has a simple and user-friendly interface that makes it easy to navigate and use. It has a fast and smooth streaming experience that lets you watch anime without any buffering, lagging, or crashing issues. It has a flexible and convenient downloading feature that lets you download anime in different formats, resolutions, and sizes. It has an interactive and engaging community that lets you rate, review, comment, and share your opinions on anime with other users.

    -

    If you are an anime fan who loves to watch your favorite shows and movies online, you should definitely download APK Anime Go on your device. It is a free app that does not require any registration or subscription. You can watch unlimited anime without any ads or interruptions. You can also update the app regularly to get new features and bug fixes.

    -

    So what are you waiting for? Download APK Anime Go now and enjoy watching and downloading anime on your device. You will not regret it!

    -

    Thank you for reading this article. We hope you found it helpful and informative. If you have any questions or feedback, please feel free to leave them in the comments section below. We would love to hear from you!

    -

    FAQs

    -

    Here are some frequently asked questions about APK Anime Go:

    -

    401be4b1e0
    -
    -
    \ No newline at end of file diff --git a/spaces/2023Liu2023/bingo/src/components/learn-more.tsx b/spaces/2023Liu2023/bingo/src/components/learn-more.tsx deleted file mode 100644 index a64459ee7900a612292e117a6bda96ee9260990f..0000000000000000000000000000000000000000 --- a/spaces/2023Liu2023/bingo/src/components/learn-more.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import React from 'react' -import { SourceAttribution } from '@/lib/bots/bing/types' - -export interface LearnMoreProps { - sourceAttributions?: SourceAttribution[] -} - -export function LearnMore({ sourceAttributions }: LearnMoreProps) { - if (!sourceAttributions?.length) { - return null - } - - return ( -
    -
    了解详细信息:
    -
    -
    - {sourceAttributions.map((attribution, index) => { - const { providerDisplayName, seeMoreUrl } = attribution - const { host } = new URL(seeMoreUrl) - return ( - - {index + 1}. {host} - - ) - })} -
    -
    -
    - ) -} diff --git a/spaces/2ndelement/voicevox/voicevox_engine/preset/PresetError.py b/spaces/2ndelement/voicevox/voicevox_engine/preset/PresetError.py deleted file mode 100644 index 6f5f802f57b03ebcc07f1173f47b9cb384e0fbd1..0000000000000000000000000000000000000000 --- a/spaces/2ndelement/voicevox/voicevox_engine/preset/PresetError.py +++ /dev/null @@ -1,2 +0,0 @@ -class PresetError(Exception): - pass diff --git a/spaces/A00001/bingothoo/src/lib/bots/bing/types.ts b/spaces/A00001/bingothoo/src/lib/bots/bing/types.ts deleted file mode 100644 index 02cd5e8b01e3529642d28dc1539bf958f4ac420b..0000000000000000000000000000000000000000 --- a/spaces/A00001/bingothoo/src/lib/bots/bing/types.ts +++ /dev/null @@ -1,259 +0,0 @@ -export type Author = 'user' | 'system' | 'bot' - -export type BotId = 'bing' - -export enum BingConversationStyle { - Creative = 'Creative', - Balanced = 'Balanced', - Precise = 'Precise' -} - -export enum ErrorCode { - CONVERSATION_LIMIT = 'CONVERSATION_LIMIT', - BING_UNAUTHORIZED = 'BING_UNAUTHORIZED', - BING_FORBIDDEN = 'BING_FORBIDDEN', - BING_CAPTCHA = 'BING_CAPTCHA', - THROTTLE_LIMIT = 'THROTTLE_LIMIT', - NOTFOUND_ERROR = 'NOT_FOUND_ERROR', - UNKOWN_ERROR = 'UNKOWN_ERROR', - NETWORK_ERROR = 'NETWORK_ERROR', -} - -export class ChatError extends Error { - code: ErrorCode - constructor(message: string, code: ErrorCode) { - super(message) - this.code = code - } -} - -export type ChatMessageModel = { - id: string - author: Author - text: string - error?: ChatError - throttling?: Throttling - sourceAttributions?: SourceAttribution[] - suggestedResponses?: SuggestedResponse[] -} - -export interface ConversationModel { - messages: ChatMessageModel[] -} - -export type Event = - | { - type: 'UPDATE_ANSWER' - data: { - text: string - spokenText?: string - sourceAttributions?: SourceAttribution[] - suggestedResponses?: SuggestedResponse[] - throttling?: Throttling - } - } - | { - type: 'DONE' - } - | { - type: 'ERROR' - error: ChatError - } - -export interface SendMessageParams { - prompt: string - imageUrl?: string - options: T - onEvent: (event: Event) => void - signal?: AbortSignal -} - -export interface ConversationResponse { - conversationId: string - clientId: string - conversationSignature: string - result: { - value: string - message?: string - } -} - -export interface Telemetry { - metrics?: null - startTime: string -} - -export interface ChatUpdateArgument { - messages?: ChatResponseMessage[] - throttling?: Throttling - requestId: string - result: null -} - -export type ChatUpdateCompleteResponse = { - type: 2 - invocationId: string - item: ChatResponseItem -} | { - type: 1 - target: string - arguments: ChatUpdateArgument[] -} | { - type: 3 - invocationId: string -} | { - type: 6 | 7 -} - -export interface ChatRequestResult { - value: string - serviceVersion: string - error?: string -} - -export interface ChatResponseItem { - messages: ChatResponseMessage[] - firstNewMessageIndex: number - suggestedResponses: null - conversationId: string - requestId: string - conversationExpiryTime: string - telemetry: Telemetry - result: ChatRequestResult - throttling: Throttling -} -export enum InvocationEventType { - Invocation = 1, - StreamItem = 2, - Completion = 3, - StreamInvocation = 4, - CancelInvocation = 5, - Ping = 6, - Close = 7, -} - -// https://github.com/bytemate/bingchat-api/blob/main/src/lib.ts - -export interface ConversationInfo { - conversationId: string - clientId: string - conversationSignature: string - invocationId: number - conversationStyle: BingConversationStyle - prompt: string - imageUrl?: string -} - -export interface BingChatResponse { - conversationSignature: string - conversationId: string - clientId: string - invocationId: number - conversationExpiryTime: Date - response: string - details: ChatResponseMessage -} - -export interface Throttling { - maxNumLongDocSummaryUserMessagesInConversation: number - maxNumUserMessagesInConversation: number - numLongDocSummaryUserMessagesInConversation: number - numUserMessagesInConversation: number -} - -export interface ChatResponseMessage { - text: string - spokenText?: string - author: string - createdAt: Date - timestamp: Date - messageId: string - requestId: string - offense: string - adaptiveCards: AdaptiveCard[] - sourceAttributions: SourceAttribution[] - feedback: Feedback - contentOrigin: string - messageType?: string - contentType?: string - privacy: null - suggestedResponses: SuggestedResponse[] -} - -export interface AdaptiveCard { - type: string - version: string - body: Body[] -} - -export interface Body { - type: string - text: string - wrap: boolean - size?: string -} - -export interface Feedback { - tag: null - updatedOn: null - type: string -} - -export interface SourceAttribution { - providerDisplayName: string - seeMoreUrl: string - searchQuery: string -} - -export interface SuggestedResponse { - text: string - author?: Author - createdAt?: Date - timestamp?: Date - messageId?: string - messageType?: string - offense?: string - feedback?: Feedback - contentOrigin?: string - privacy?: null -} - -export interface KBlobRequest { - knowledgeRequest: KnowledgeRequestContext - imageBase64?: string -} - -export interface KBlobResponse { - blobId: string - processedBlobId?: string -} - -export interface KnowledgeRequestContext { - imageInfo: ImageInfo; - knowledgeRequest: KnowledgeRequest; -} - -export interface ImageInfo { - url?: string; -} - -export interface KnowledgeRequest { - invokedSkills: string[]; - subscriptionId: string; - invokedSkillsRequestData: InvokedSkillsRequestData; - convoData: ConvoData; -} - -export interface ConvoData { - convoid: string; - convotone: BingConversationStyle; -} - -export interface InvokedSkillsRequestData { - enableFaceBlur: boolean; -} - -export interface FileItem { - url: string; - status?: 'loading' | 'error' | 'loaded' -} diff --git a/spaces/AIGC-Audio/AudioGPT/text_to_speech/modules/vocoder/parallel_wavegan/layers/residual_block.py b/spaces/AIGC-Audio/AudioGPT/text_to_speech/modules/vocoder/parallel_wavegan/layers/residual_block.py deleted file mode 100644 index 7a267a86c1fa521c2824addf9dda304c43f1ff1f..0000000000000000000000000000000000000000 --- a/spaces/AIGC-Audio/AudioGPT/text_to_speech/modules/vocoder/parallel_wavegan/layers/residual_block.py +++ /dev/null @@ -1,129 +0,0 @@ -# -*- coding: utf-8 -*- - -"""Residual block module in WaveNet. - -This code is modified from https://github.com/r9y9/wavenet_vocoder. - -""" - -import math - -import torch -import torch.nn.functional as F - - -class Conv1d(torch.nn.Conv1d): - """Conv1d module with customized initialization.""" - - def __init__(self, *args, **kwargs): - """Initialize Conv1d module.""" - super(Conv1d, self).__init__(*args, **kwargs) - - def reset_parameters(self): - """Reset parameters.""" - torch.nn.init.kaiming_normal_(self.weight, nonlinearity="relu") - if self.bias is not None: - torch.nn.init.constant_(self.bias, 0.0) - - -class Conv1d1x1(Conv1d): - """1x1 Conv1d with customized initialization.""" - - def __init__(self, in_channels, out_channels, bias): - """Initialize 1x1 Conv1d module.""" - super(Conv1d1x1, self).__init__(in_channels, out_channels, - kernel_size=1, padding=0, - dilation=1, bias=bias) - - -class ResidualBlock(torch.nn.Module): - """Residual block module in WaveNet.""" - - def __init__(self, - kernel_size=3, - residual_channels=64, - gate_channels=128, - skip_channels=64, - aux_channels=80, - dropout=0.0, - dilation=1, - bias=True, - use_causal_conv=False - ): - """Initialize ResidualBlock module. - - Args: - kernel_size (int): Kernel size of dilation convolution layer. - residual_channels (int): Number of channels for residual connection. - skip_channels (int): Number of channels for skip connection. - aux_channels (int): Local conditioning channels i.e. auxiliary input dimension. - dropout (float): Dropout probability. - dilation (int): Dilation factor. - bias (bool): Whether to add bias parameter in convolution layers. - use_causal_conv (bool): Whether to use use_causal_conv or non-use_causal_conv convolution. - - """ - super(ResidualBlock, self).__init__() - self.dropout = dropout - # no future time stamps available - if use_causal_conv: - padding = (kernel_size - 1) * dilation - else: - assert (kernel_size - 1) % 2 == 0, "Not support even number kernel size." - padding = (kernel_size - 1) // 2 * dilation - self.use_causal_conv = use_causal_conv - - # dilation conv - self.conv = Conv1d(residual_channels, gate_channels, kernel_size, - padding=padding, dilation=dilation, bias=bias) - - # local conditioning - if aux_channels > 0: - self.conv1x1_aux = Conv1d1x1(aux_channels, gate_channels, bias=False) - else: - self.conv1x1_aux = None - - # conv output is split into two groups - gate_out_channels = gate_channels // 2 - self.conv1x1_out = Conv1d1x1(gate_out_channels, residual_channels, bias=bias) - self.conv1x1_skip = Conv1d1x1(gate_out_channels, skip_channels, bias=bias) - - def forward(self, x, c): - """Calculate forward propagation. - - Args: - x (Tensor): Input tensor (B, residual_channels, T). - c (Tensor): Local conditioning auxiliary tensor (B, aux_channels, T). - - Returns: - Tensor: Output tensor for residual connection (B, residual_channels, T). - Tensor: Output tensor for skip connection (B, skip_channels, T). - - """ - residual = x - x = F.dropout(x, p=self.dropout, training=self.training) - x = self.conv(x) - - # remove future time steps if use_causal_conv conv - x = x[:, :, :residual.size(-1)] if self.use_causal_conv else x - - # split into two part for gated activation - splitdim = 1 - xa, xb = x.split(x.size(splitdim) // 2, dim=splitdim) - - # local conditioning - if c is not None: - assert self.conv1x1_aux is not None - c = self.conv1x1_aux(c) - ca, cb = c.split(c.size(splitdim) // 2, dim=splitdim) - xa, xb = xa + ca, xb + cb - - x = torch.tanh(xa) * torch.sigmoid(xb) - - # for skip connection - s = self.conv1x1_skip(x) - - # for residual connection - x = (self.conv1x1_out(x) + residual) * math.sqrt(0.5) - - return x, s diff --git a/spaces/AIGC-Audio/Make_An_Audio/ldm/models/diffusion/plms.py b/spaces/AIGC-Audio/Make_An_Audio/ldm/models/diffusion/plms.py deleted file mode 100644 index 78eeb1003aa45d27bdbfc6b4a1d7ccbff57cd2e3..0000000000000000000000000000000000000000 --- a/spaces/AIGC-Audio/Make_An_Audio/ldm/models/diffusion/plms.py +++ /dev/null @@ -1,236 +0,0 @@ -"""SAMPLING ONLY.""" - -import torch -import numpy as np -from tqdm import tqdm -from functools import partial - -from ldm.modules.diffusionmodules.util import make_ddim_sampling_parameters, make_ddim_timesteps, noise_like - - -class PLMSSampler(object): - def __init__(self, model, schedule="linear", **kwargs): - super().__init__() - self.model = model - self.ddpm_num_timesteps = model.num_timesteps - self.schedule = schedule - - def register_buffer(self, name, attr): - if type(attr) == torch.Tensor: - if attr.device != torch.device("cuda"): - attr = attr.to(torch.device("cuda")) - setattr(self, name, attr) - - def make_schedule(self, ddim_num_steps, ddim_discretize="uniform", ddim_eta=0., verbose=True): - if ddim_eta != 0: - raise ValueError('ddim_eta must be 0 for PLMS') - self.ddim_timesteps = make_ddim_timesteps(ddim_discr_method=ddim_discretize, num_ddim_timesteps=ddim_num_steps, - num_ddpm_timesteps=self.ddpm_num_timesteps,verbose=verbose) - alphas_cumprod = self.model.alphas_cumprod - assert alphas_cumprod.shape[0] == self.ddpm_num_timesteps, 'alphas have to be defined for each timestep' - to_torch = lambda x: x.clone().detach().to(torch.float32).to(self.model.device) - - self.register_buffer('betas', to_torch(self.model.betas)) - self.register_buffer('alphas_cumprod', to_torch(alphas_cumprod)) - self.register_buffer('alphas_cumprod_prev', to_torch(self.model.alphas_cumprod_prev)) - - # calculations for diffusion q(x_t | x_{t-1}) and others - self.register_buffer('sqrt_alphas_cumprod', to_torch(np.sqrt(alphas_cumprod.cpu()))) - self.register_buffer('sqrt_one_minus_alphas_cumprod', to_torch(np.sqrt(1. - alphas_cumprod.cpu()))) - self.register_buffer('log_one_minus_alphas_cumprod', to_torch(np.log(1. - alphas_cumprod.cpu()))) - self.register_buffer('sqrt_recip_alphas_cumprod', to_torch(np.sqrt(1. / alphas_cumprod.cpu()))) - self.register_buffer('sqrt_recipm1_alphas_cumprod', to_torch(np.sqrt(1. / alphas_cumprod.cpu() - 1))) - - # ddim sampling parameters - ddim_sigmas, ddim_alphas, ddim_alphas_prev = make_ddim_sampling_parameters(alphacums=alphas_cumprod.cpu(), - ddim_timesteps=self.ddim_timesteps, - eta=ddim_eta,verbose=verbose) - self.register_buffer('ddim_sigmas', ddim_sigmas) - self.register_buffer('ddim_alphas', ddim_alphas) - self.register_buffer('ddim_alphas_prev', ddim_alphas_prev) - self.register_buffer('ddim_sqrt_one_minus_alphas', np.sqrt(1. - ddim_alphas)) - sigmas_for_original_sampling_steps = ddim_eta * torch.sqrt( - (1 - self.alphas_cumprod_prev) / (1 - self.alphas_cumprod) * ( - 1 - self.alphas_cumprod / self.alphas_cumprod_prev)) - self.register_buffer('ddim_sigmas_for_original_num_steps', sigmas_for_original_sampling_steps) - - @torch.no_grad() - def sample(self, - S, - batch_size, - shape, - conditioning=None, - callback=None, - normals_sequence=None, - img_callback=None, - quantize_x0=False, - eta=0., - mask=None, - x0=None, - temperature=1., - noise_dropout=0., - score_corrector=None, - corrector_kwargs=None, - verbose=True, - x_T=None, - log_every_t=100, - unconditional_guidance_scale=1., - unconditional_conditioning=None, - # this has to come in the same format as the conditioning, # e.g. as encoded tokens, ... - **kwargs - ): - if conditioning is not None: - if isinstance(conditioning, dict): - cbs = conditioning[list(conditioning.keys())[0]].shape[0] - if cbs != batch_size: - print(f"Warning: Got {cbs} conditionings but batch-size is {batch_size}") - else: - if conditioning.shape[0] != batch_size: - print(f"Warning: Got {conditioning.shape[0]} conditionings but batch-size is {batch_size}") - - self.make_schedule(ddim_num_steps=S, ddim_eta=eta, verbose=verbose) - # sampling - C, H, W = shape - size = (batch_size, C, H, W) - print(f'Data shape for PLMS sampling is {size}') - - samples, intermediates = self.plms_sampling(conditioning, size, - callback=callback, - img_callback=img_callback, - quantize_denoised=quantize_x0, - mask=mask, x0=x0, - ddim_use_original_steps=False, - noise_dropout=noise_dropout, - temperature=temperature, - score_corrector=score_corrector, - corrector_kwargs=corrector_kwargs, - x_T=x_T, - log_every_t=log_every_t, - unconditional_guidance_scale=unconditional_guidance_scale, - unconditional_conditioning=unconditional_conditioning, - ) - return samples, intermediates - - @torch.no_grad() - def plms_sampling(self, cond, shape, - x_T=None, ddim_use_original_steps=False, - callback=None, timesteps=None, quantize_denoised=False, - mask=None, x0=None, img_callback=None, log_every_t=100, - temperature=1., noise_dropout=0., score_corrector=None, corrector_kwargs=None, - unconditional_guidance_scale=1., unconditional_conditioning=None,): - device = self.model.betas.device - b = shape[0] - if x_T is None: - img = torch.randn(shape, device=device) - else: - img = x_T - - if timesteps is None: - timesteps = self.ddpm_num_timesteps if ddim_use_original_steps else self.ddim_timesteps - elif timesteps is not None and not ddim_use_original_steps: - subset_end = int(min(timesteps / self.ddim_timesteps.shape[0], 1) * self.ddim_timesteps.shape[0]) - 1 - timesteps = self.ddim_timesteps[:subset_end] - - intermediates = {'x_inter': [img], 'pred_x0': [img]} - time_range = list(reversed(range(0,timesteps))) if ddim_use_original_steps else np.flip(timesteps) - total_steps = timesteps if ddim_use_original_steps else timesteps.shape[0] - print(f"Running PLMS Sampling with {total_steps} timesteps") - - iterator = tqdm(time_range, desc='PLMS Sampler', total=total_steps) - old_eps = [] - - for i, step in enumerate(iterator): - index = total_steps - i - 1 - ts = torch.full((b,), step, device=device, dtype=torch.long) - ts_next = torch.full((b,), time_range[min(i + 1, len(time_range) - 1)], device=device, dtype=torch.long) - - if mask is not None: - assert x0 is not None - img_orig = self.model.q_sample(x0, ts) # TODO: deterministic forward pass? - img = img_orig * mask + (1. - mask) * img - - outs = self.p_sample_plms(img, cond, ts, index=index, use_original_steps=ddim_use_original_steps, - quantize_denoised=quantize_denoised, temperature=temperature, - noise_dropout=noise_dropout, score_corrector=score_corrector, - corrector_kwargs=corrector_kwargs, - unconditional_guidance_scale=unconditional_guidance_scale, - unconditional_conditioning=unconditional_conditioning, - old_eps=old_eps, t_next=ts_next) - img, pred_x0, e_t = outs - old_eps.append(e_t) - if len(old_eps) >= 4: - old_eps.pop(0) - if callback: callback(i) - if img_callback: img_callback(pred_x0, i) - - if index % log_every_t == 0 or index == total_steps - 1: - intermediates['x_inter'].append(img) - intermediates['pred_x0'].append(pred_x0) - - return img, intermediates - - @torch.no_grad() - def p_sample_plms(self, x, c, t, index, repeat_noise=False, use_original_steps=False, quantize_denoised=False, - temperature=1., noise_dropout=0., score_corrector=None, corrector_kwargs=None, - unconditional_guidance_scale=1., unconditional_conditioning=None, old_eps=None, t_next=None): - b, *_, device = *x.shape, x.device - - def get_model_output(x, t): - if unconditional_conditioning is None or unconditional_guidance_scale == 1.: - e_t = self.model.apply_model(x, t, c) - else: - x_in = torch.cat([x] * 2) - t_in = torch.cat([t] * 2) - c_in = torch.cat([unconditional_conditioning, c]) - e_t_uncond, e_t = self.model.apply_model(x_in, t_in, c_in).chunk(2) - e_t = e_t_uncond + unconditional_guidance_scale * (e_t - e_t_uncond) - - if score_corrector is not None: - assert self.model.parameterization == "eps" - e_t = score_corrector.modify_score(self.model, e_t, x, t, c, **corrector_kwargs) - - return e_t - - alphas = self.model.alphas_cumprod if use_original_steps else self.ddim_alphas - alphas_prev = self.model.alphas_cumprod_prev if use_original_steps else self.ddim_alphas_prev - sqrt_one_minus_alphas = self.model.sqrt_one_minus_alphas_cumprod if use_original_steps else self.ddim_sqrt_one_minus_alphas - sigmas = self.model.ddim_sigmas_for_original_num_steps if use_original_steps else self.ddim_sigmas - - def get_x_prev_and_pred_x0(e_t, index): - # select parameters corresponding to the currently considered timestep - a_t = torch.full((b, 1, 1, 1), alphas[index], device=device) - a_prev = torch.full((b, 1, 1, 1), alphas_prev[index], device=device) - sigma_t = torch.full((b, 1, 1, 1), sigmas[index], device=device) - sqrt_one_minus_at = torch.full((b, 1, 1, 1), sqrt_one_minus_alphas[index],device=device) - - # current prediction for x_0 - pred_x0 = (x - sqrt_one_minus_at * e_t) / a_t.sqrt() - if quantize_denoised: - pred_x0, _, *_ = self.model.first_stage_model.quantize(pred_x0) - # direction pointing to x_t - dir_xt = (1. - a_prev - sigma_t**2).sqrt() * e_t - noise = sigma_t * noise_like(x.shape, device, repeat_noise) * temperature - if noise_dropout > 0.: - noise = torch.nn.functional.dropout(noise, p=noise_dropout) - x_prev = a_prev.sqrt() * pred_x0 + dir_xt + noise - return x_prev, pred_x0 - - e_t = get_model_output(x, t) - if len(old_eps) == 0: - # Pseudo Improved Euler (2nd order) - x_prev, pred_x0 = get_x_prev_and_pred_x0(e_t, index) - e_t_next = get_model_output(x_prev, t_next) - e_t_prime = (e_t + e_t_next) / 2 - elif len(old_eps) == 1: - # 2nd order Pseudo Linear Multistep (Adams-Bashforth) - e_t_prime = (3 * e_t - old_eps[-1]) / 2 - elif len(old_eps) == 2: - # 3nd order Pseudo Linear Multistep (Adams-Bashforth) - e_t_prime = (23 * e_t - 16 * old_eps[-1] + 5 * old_eps[-2]) / 12 - elif len(old_eps) >= 3: - # 4nd order Pseudo Linear Multistep (Adams-Bashforth) - e_t_prime = (55 * e_t - 59 * old_eps[-1] + 37 * old_eps[-2] - 9 * old_eps[-3]) / 24 - - x_prev, pred_x0 = get_x_prev_and_pred_x0(e_t_prime, index) - - return x_prev, pred_x0, e_t diff --git a/spaces/AISuperheroes/10SL-RealTimeDSDashboard-Live-AIUIUX/app.py b/spaces/AISuperheroes/10SL-RealTimeDSDashboard-Live-AIUIUX/app.py deleted file mode 100644 index 71fee5595536d14ea9a0d98a9d6930d516d5c4eb..0000000000000000000000000000000000000000 --- a/spaces/AISuperheroes/10SL-RealTimeDSDashboard-Live-AIUIUX/app.py +++ /dev/null @@ -1,92 +0,0 @@ -import time # to simulate a real time data, time loop - -import numpy as np # np mean, np random -import pandas as pd # read csv, df manipulation -import plotly.express as px # interactive charts -import streamlit as st # 🎈 data web app development - -st.set_page_config( - page_title="Real-Time Data Science Dashboard", - page_icon="✅", - layout="wide", -) - -# read csv from a github repo -dataset_url = "https://raw.githubusercontent.com/Lexie88rus/bank-marketing-analysis/master/bank.csv" - -# read csv from a URL -@st.experimental_memo -def get_data() -> pd.DataFrame: - return pd.read_csv(dataset_url) - -df = get_data() - -# dashboard title -st.title("Real-Time / Live Data Science Dashboard") - -# top-level filters -job_filter = st.selectbox("Select the Job", pd.unique(df["job"])) - -# creating a single-element container -placeholder = st.empty() - -# dataframe filter -df = df[df["job"] == job_filter] - -# near real-time / live feed simulation -for seconds in range(200): - - df["age_new"] = df["age"] * np.random.choice(range(1, 5)) - df["balance_new"] = df["balance"] * np.random.choice(range(1, 5)) - - # creating KPIs - avg_age = np.mean(df["age_new"]) - - count_married = int( - df[(df["marital"] == "married")]["marital"].count() - + np.random.choice(range(1, 30)) - ) - - balance = np.mean(df["balance_new"]) - - with placeholder.container(): - - # create three columns - kpi1, kpi2, kpi3 = st.columns(3) - - # fill in those three columns with respective metrics or KPIs - kpi1.metric( - label="Age ⏳", - value=round(avg_age), - delta=round(avg_age) - 10, - ) - - kpi2.metric( - label="Married Count 💍", - value=int(count_married), - delta=-10 + count_married, - ) - - kpi3.metric( - label="A/C Balance $", - value=f"$ {round(balance,2)} ", - delta=-round(balance / count_married) * 100, - ) - - # create two columns for charts - fig_col1, fig_col2 = st.columns(2) - with fig_col1: - st.markdown("### First Chart") - fig = px.density_heatmap( - data_frame=df, y="age_new", x="marital" - ) - st.write(fig) - - with fig_col2: - st.markdown("### Second Chart") - fig2 = px.histogram(data_frame=df, x="age_new") - st.write(fig2) - - st.markdown("### Detailed Data View") - st.dataframe(df) - time.sleep(1) \ No newline at end of file diff --git a/spaces/Adapter/CoAdapter/ldm/modules/extra_condition/utils.py b/spaces/Adapter/CoAdapter/ldm/modules/extra_condition/utils.py deleted file mode 100644 index af6bcb9e1116a431a39579f4bbdde3a9e868e0b4..0000000000000000000000000000000000000000 --- a/spaces/Adapter/CoAdapter/ldm/modules/extra_condition/utils.py +++ /dev/null @@ -1,72 +0,0 @@ -# -*- coding: utf-8 -*- -import cv2 -import numpy as np - -skeleton = [[15, 13], [13, 11], [16, 14], [14, 12], [11, 12], [5, 11], [6, 12], [5, 6], [5, 7], [6, 8], [7, 9], [8, 10], - [1, 2], [0, 1], [0, 2], [1, 3], [2, 4], [3, 5], [4, 6]] - -pose_kpt_color = [[51, 153, 255], [51, 153, 255], [51, 153, 255], [51, 153, 255], [51, 153, 255], [0, 255, 0], - [255, 128, 0], [0, 255, 0], [255, 128, 0], [0, 255, 0], [255, 128, 0], [0, 255, 0], [255, 128, 0], - [0, 255, 0], [255, 128, 0], [0, 255, 0], [255, 128, 0]] - -pose_link_color = [[0, 255, 0], [0, 255, 0], [255, 128, 0], [255, 128, 0], - [51, 153, 255], [51, 153, 255], [51, 153, 255], [51, 153, 255], [0, 255, 0], [255, 128, 0], - [0, 255, 0], [255, 128, 0], [51, 153, 255], [51, 153, 255], [51, 153, 255], [51, 153, 255], - [51, 153, 255], [51, 153, 255], [51, 153, 255]] - - -def imshow_keypoints(img, - pose_result, - kpt_score_thr=0.1, - radius=2, - thickness=2): - """Draw keypoints and links on an image. - - Args: - img (ndarry): The image to draw poses on. - pose_result (list[kpts]): The poses to draw. Each element kpts is - a set of K keypoints as an Kx3 numpy.ndarray, where each - keypoint is represented as x, y, score. - kpt_score_thr (float, optional): Minimum score of keypoints - to be shown. Default: 0.3. - thickness (int): Thickness of lines. - """ - - img_h, img_w, _ = img.shape - img = np.zeros(img.shape) - - for idx, kpts in enumerate(pose_result): - if idx > 1: - continue - kpts = kpts['keypoints'] - # print(kpts) - kpts = np.array(kpts, copy=False) - - # draw each point on image - assert len(pose_kpt_color) == len(kpts) - - for kid, kpt in enumerate(kpts): - x_coord, y_coord, kpt_score = int(kpt[0]), int(kpt[1]), kpt[2] - - if kpt_score < kpt_score_thr or pose_kpt_color[kid] is None: - # skip the point that should not be drawn - continue - - color = tuple(int(c) for c in pose_kpt_color[kid]) - cv2.circle(img, (int(x_coord), int(y_coord)), radius, color, -1) - - # draw links - - for sk_id, sk in enumerate(skeleton): - pos1 = (int(kpts[sk[0], 0]), int(kpts[sk[0], 1])) - pos2 = (int(kpts[sk[1], 0]), int(kpts[sk[1], 1])) - - if (pos1[0] <= 0 or pos1[0] >= img_w or pos1[1] <= 0 or pos1[1] >= img_h or pos2[0] <= 0 - or pos2[0] >= img_w or pos2[1] <= 0 or pos2[1] >= img_h or kpts[sk[0], 2] < kpt_score_thr - or kpts[sk[1], 2] < kpt_score_thr or pose_link_color[sk_id] is None): - # skip the link that should not be drawn - continue - color = tuple(int(c) for c in pose_link_color[sk_id]) - cv2.line(img, pos1, pos2, color, thickness=thickness) - - return img diff --git a/spaces/Aloento/9Nine-PITS/mel_processing.py b/spaces/Aloento/9Nine-PITS/mel_processing.py deleted file mode 100644 index e6117d459edf8e3aa0e92540043d7bd8e72797bf..0000000000000000000000000000000000000000 --- a/spaces/Aloento/9Nine-PITS/mel_processing.py +++ /dev/null @@ -1,123 +0,0 @@ -# from https://github.com/jaywalnut310/vits -import torch -import torch.utils.data -from librosa.filters import mel as librosa_mel_fn -from torch.cuda.amp import autocast - - -def dynamic_range_compression_torch(x, C=1, clip_val=1e-5): - """ - PARAMS - ------ - C: compression factor - """ - return torch.log(torch.clamp(x, min=clip_val) * C) - - -def dynamic_range_decompression_torch(x, C=1): - """ - PARAMS - ------ - C: compression factor used to compress - """ - return torch.exp(x) / C - - -def spectral_normalize_torch(magnitudes): - output = dynamic_range_compression_torch(magnitudes) - return output - - -def spectral_de_normalize_torch(magnitudes): - output = dynamic_range_decompression_torch(magnitudes) - return output - - -mel_basis = {} -hann_window = {} - - -def spectrogram_torch(y, n_fft, sampling_rate, hop_size, win_size, center=False): - if torch.min(y) < -1.: - print('min value is ', torch.min(y)) - if torch.max(y) > 1.: - print('max value is ', torch.max(y)) - - global hann_window - dtype_device = str(y.dtype) + '_' + str(y.device) - wnsize_dtype_device = str(win_size) + '_' + dtype_device - if wnsize_dtype_device not in hann_window: - hann_window[wnsize_dtype_device] = torch.hann_window(win_size).to(dtype=y.dtype, device=y.device) - - y = torch.nn.functional.pad(y.unsqueeze(1), ( - int((n_fft - hop_size) / 2), int((n_fft - hop_size) / 2)), mode='reflect') - y = y.squeeze(1) - with autocast(enabled=False): - y = y.float() - spec = torch.stft( - y, - n_fft, - hop_length=hop_size, - win_length=win_size, - window=hann_window[wnsize_dtype_device], - center=center, - pad_mode='reflect', - normalized=False, - onesided=True - ) - - spec = torch.sqrt(spec.pow(2).sum(-1) + 1e-6) - return spec - - -def spec_to_mel_torch(spec, n_fft, num_mels, sampling_rate, fmin, fmax): - global mel_basis - dtype_device = str(spec.dtype) + '_' + str(spec.device) - fmax_dtype_device = str(fmax) + '_' + dtype_device - if fmax_dtype_device not in mel_basis: - mel = librosa_mel_fn(sr=sampling_rate, n_fft=n_fft, n_mels=num_mels, fmin=fmin, fmax=fmax) - mel_basis[fmax_dtype_device] = torch.from_numpy(mel).to(dtype=spec.dtype, device=spec.device) - spec = torch.matmul(mel_basis[fmax_dtype_device], spec) - spec = spectral_normalize_torch(spec) - return spec - - -def mel_spectrogram_torch(y, n_fft, num_mels, sampling_rate, hop_size, win_size, fmin, fmax, center=False): - if torch.min(y) < -1.: - print('min value is ', torch.min(y)) - if torch.max(y) > 1.: - print('max value is ', torch.max(y)) - - global mel_basis, hann_window - dtype_device = str(y.dtype) + '_' + str(y.device) - fmax_dtype_device = str(fmax) + '_' + dtype_device - wnsize_dtype_device = str(win_size) + '_' + dtype_device - if fmax_dtype_device not in mel_basis: - mel = librosa_mel_fn(sr=sampling_rate, n_fft=n_fft, n_mels=num_mels, fmin=fmin, fmax=fmax) - mel_basis[fmax_dtype_device] = torch.from_numpy(mel).to(dtype=y.dtype, device=y.device) - if wnsize_dtype_device not in hann_window: - hann_window[wnsize_dtype_device] = torch.hann_window(win_size).to(dtype=y.dtype, device=y.device) - - y = torch.nn.functional.pad(y.unsqueeze(1), ( - int((n_fft - hop_size) / 2), int((n_fft - hop_size) / 2)), mode='reflect') - y = y.squeeze(1) - with autocast(enabled=False): - y = y.float() - spec = torch.stft( - y, - n_fft, - hop_length=hop_size, - win_length=win_size, - window=hann_window[wnsize_dtype_device], - center=center, - pad_mode='reflect', - normalized=False, - onesided=True - ) - - spec = torch.sqrt(spec.pow(2).sum(-1) + 1e-6) - - spec = torch.matmul(mel_basis[fmax_dtype_device], spec) - spec = spectral_normalize_torch(spec) - - return spec diff --git a/spaces/Amrrs/DragGan-Inversion/PTI/models/StyleCLIP/global_directions/Inference.py b/spaces/Amrrs/DragGan-Inversion/PTI/models/StyleCLIP/global_directions/Inference.py deleted file mode 100644 index a292787c88a370b15b4f0d633ac27bb5bed2b510..0000000000000000000000000000000000000000 --- a/spaces/Amrrs/DragGan-Inversion/PTI/models/StyleCLIP/global_directions/Inference.py +++ /dev/null @@ -1,106 +0,0 @@ - - -from manipulate import Manipulator -import tensorflow as tf -import numpy as np -import torch -import clip -from MapTS import GetBoundary,GetDt - -class StyleCLIP(): - - def __init__(self,dataset_name='ffhq'): - print('load clip') - device = "cuda" if torch.cuda.is_available() else "cpu" - self.model, preprocess = clip.load("ViT-B/32", device=device) - self.LoadData(dataset_name) - - def LoadData(self, dataset_name): - tf.keras.backend.clear_session() - M=Manipulator(dataset_name=dataset_name) - np.set_printoptions(suppress=True) - fs3=np.load('./npy/'+dataset_name+'/fs3.npy') - - self.M=M - self.fs3=fs3 - - w_plus=np.load('./data/'+dataset_name+'/w_plus.npy') - self.M.dlatents=M.W2S(w_plus) - - if dataset_name=='ffhq': - self.c_threshold=20 - else: - self.c_threshold=100 - self.SetInitP() - - def SetInitP(self): - self.M.alpha=[3] - self.M.num_images=1 - - self.target='' - self.neutral='' - self.GetDt2() - img_index=0 - self.M.dlatent_tmp=[tmp[img_index:(img_index+1)] for tmp in self.M.dlatents] - - - def GetDt2(self): - classnames=[self.target,self.neutral] - dt=GetDt(classnames,self.model) - - self.dt=dt - num_cs=[] - betas=np.arange(0.1,0.3,0.01) - for i in range(len(betas)): - boundary_tmp2,num_c=GetBoundary(self.fs3,self.dt,self.M,threshold=betas[i]) - print(betas[i]) - num_cs.append(num_c) - - num_cs=np.array(num_cs) - select=num_cs>self.c_threshold - - if sum(select)==0: - self.beta=0.1 - else: - self.beta=betas[select][-1] - - - def GetCode(self): - boundary_tmp2,num_c=GetBoundary(self.fs3,self.dt,self.M,threshold=self.beta) - codes=self.M.MSCode(self.M.dlatent_tmp,boundary_tmp2) - return codes - - def GetImg(self): - - codes=self.GetCode() - out=self.M.GenerateImg(codes) - img=out[0,0] - return img - - - - -#%% -if __name__ == "__main__": - style_clip=StyleCLIP() - self=style_clip - - - - - - - - - - - - - - - - - - - - diff --git a/spaces/Amrrs/DragGan-Inversion/PTI/models/StyleCLIP/global_directions/dnnlib/tflib/tfutil.py b/spaces/Amrrs/DragGan-Inversion/PTI/models/StyleCLIP/global_directions/dnnlib/tflib/tfutil.py deleted file mode 100644 index fe21100299251492ee6d49a7fab566ffb8283702..0000000000000000000000000000000000000000 --- a/spaces/Amrrs/DragGan-Inversion/PTI/models/StyleCLIP/global_directions/dnnlib/tflib/tfutil.py +++ /dev/null @@ -1,262 +0,0 @@ -# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. -# -# NVIDIA CORPORATION and its licensors retain all intellectual property -# and proprietary rights in and to this software, related documentation -# and any modifications thereto. Any use, reproduction, disclosure or -# distribution of this software and related documentation without an express -# license agreement from NVIDIA CORPORATION is strictly prohibited. - -"""Miscellaneous helper utils for Tensorflow.""" - -import os -import numpy as np -import tensorflow as tf - -# Silence deprecation warnings from TensorFlow 1.13 onwards -import logging -logging.getLogger('tensorflow').setLevel(logging.ERROR) -import tensorflow.contrib # requires TensorFlow 1.x! -tf.contrib = tensorflow.contrib - -from typing import Any, Iterable, List, Union - -TfExpression = Union[tf.Tensor, tf.Variable, tf.Operation] -"""A type that represents a valid Tensorflow expression.""" - -TfExpressionEx = Union[TfExpression, int, float, np.ndarray] -"""A type that can be converted to a valid Tensorflow expression.""" - - -def run(*args, **kwargs) -> Any: - """Run the specified ops in the default session.""" - assert_tf_initialized() - return tf.get_default_session().run(*args, **kwargs) - - -def is_tf_expression(x: Any) -> bool: - """Check whether the input is a valid Tensorflow expression, i.e., Tensorflow Tensor, Variable, or Operation.""" - return isinstance(x, (tf.Tensor, tf.Variable, tf.Operation)) - - -def shape_to_list(shape: Iterable[tf.Dimension]) -> List[Union[int, None]]: - """Convert a Tensorflow shape to a list of ints. Retained for backwards compatibility -- use TensorShape.as_list() in new code.""" - return [dim.value for dim in shape] - - -def flatten(x: TfExpressionEx) -> TfExpression: - """Shortcut function for flattening a tensor.""" - with tf.name_scope("Flatten"): - return tf.reshape(x, [-1]) - - -def log2(x: TfExpressionEx) -> TfExpression: - """Logarithm in base 2.""" - with tf.name_scope("Log2"): - return tf.log(x) * np.float32(1.0 / np.log(2.0)) - - -def exp2(x: TfExpressionEx) -> TfExpression: - """Exponent in base 2.""" - with tf.name_scope("Exp2"): - return tf.exp(x * np.float32(np.log(2.0))) - - -def erfinv(y: TfExpressionEx) -> TfExpression: - """Inverse of the error function.""" - # pylint: disable=no-name-in-module - from tensorflow.python.ops.distributions import special_math - return special_math.erfinv(y) - - -def lerp(a: TfExpressionEx, b: TfExpressionEx, t: TfExpressionEx) -> TfExpressionEx: - """Linear interpolation.""" - with tf.name_scope("Lerp"): - return a + (b - a) * t - - -def lerp_clip(a: TfExpressionEx, b: TfExpressionEx, t: TfExpressionEx) -> TfExpression: - """Linear interpolation with clip.""" - with tf.name_scope("LerpClip"): - return a + (b - a) * tf.clip_by_value(t, 0.0, 1.0) - - -def absolute_name_scope(scope: str) -> tf.name_scope: - """Forcefully enter the specified name scope, ignoring any surrounding scopes.""" - return tf.name_scope(scope + "/") - - -def absolute_variable_scope(scope: str, **kwargs) -> tf.variable_scope: - """Forcefully enter the specified variable scope, ignoring any surrounding scopes.""" - return tf.variable_scope(tf.VariableScope(name=scope, **kwargs), auxiliary_name_scope=False) - - -def _sanitize_tf_config(config_dict: dict = None) -> dict: - # Defaults. - cfg = dict() - cfg["rnd.np_random_seed"] = None # Random seed for NumPy. None = keep as is. - cfg["rnd.tf_random_seed"] = "auto" # Random seed for TensorFlow. 'auto' = derive from NumPy random state. None = keep as is. - cfg["env.TF_CPP_MIN_LOG_LEVEL"] = "1" # 0 = Print all available debug info from TensorFlow. 1 = Print warnings and errors, but disable debug info. - cfg["env.HDF5_USE_FILE_LOCKING"] = "FALSE" # Disable HDF5 file locking to avoid concurrency issues with network shares. - cfg["graph_options.place_pruned_graph"] = True # False = Check that all ops are available on the designated device. True = Skip the check for ops that are not used. - cfg["gpu_options.allow_growth"] = True # False = Allocate all GPU memory at the beginning. True = Allocate only as much GPU memory as needed. - - # Remove defaults for environment variables that are already set. - for key in list(cfg): - fields = key.split(".") - if fields[0] == "env": - assert len(fields) == 2 - if fields[1] in os.environ: - del cfg[key] - - # User overrides. - if config_dict is not None: - cfg.update(config_dict) - return cfg - - -def init_tf(config_dict: dict = None) -> None: - """Initialize TensorFlow session using good default settings.""" - # Skip if already initialized. - if tf.get_default_session() is not None: - return - - # Setup config dict and random seeds. - cfg = _sanitize_tf_config(config_dict) - np_random_seed = cfg["rnd.np_random_seed"] - if np_random_seed is not None: - np.random.seed(np_random_seed) - tf_random_seed = cfg["rnd.tf_random_seed"] - if tf_random_seed == "auto": - tf_random_seed = np.random.randint(1 << 31) - if tf_random_seed is not None: - tf.set_random_seed(tf_random_seed) - - # Setup environment variables. - for key, value in cfg.items(): - fields = key.split(".") - if fields[0] == "env": - assert len(fields) == 2 - os.environ[fields[1]] = str(value) - - # Create default TensorFlow session. - create_session(cfg, force_as_default=True) - - -def assert_tf_initialized(): - """Check that TensorFlow session has been initialized.""" - if tf.get_default_session() is None: - raise RuntimeError("No default TensorFlow session found. Please call dnnlib.tflib.init_tf().") - - -def create_session(config_dict: dict = None, force_as_default: bool = False) -> tf.Session: - """Create tf.Session based on config dict.""" - # Setup TensorFlow config proto. - cfg = _sanitize_tf_config(config_dict) - config_proto = tf.ConfigProto() - for key, value in cfg.items(): - fields = key.split(".") - if fields[0] not in ["rnd", "env"]: - obj = config_proto - for field in fields[:-1]: - obj = getattr(obj, field) - setattr(obj, fields[-1], value) - - # Create session. - session = tf.Session(config=config_proto) - if force_as_default: - # pylint: disable=protected-access - session._default_session = session.as_default() - session._default_session.enforce_nesting = False - session._default_session.__enter__() - return session - - -def init_uninitialized_vars(target_vars: List[tf.Variable] = None) -> None: - """Initialize all tf.Variables that have not already been initialized. - - Equivalent to the following, but more efficient and does not bloat the tf graph: - tf.variables_initializer(tf.report_uninitialized_variables()).run() - """ - assert_tf_initialized() - if target_vars is None: - target_vars = tf.global_variables() - - test_vars = [] - test_ops = [] - - with tf.control_dependencies(None): # ignore surrounding control_dependencies - for var in target_vars: - assert is_tf_expression(var) - - try: - tf.get_default_graph().get_tensor_by_name(var.name.replace(":0", "/IsVariableInitialized:0")) - except KeyError: - # Op does not exist => variable may be uninitialized. - test_vars.append(var) - - with absolute_name_scope(var.name.split(":")[0]): - test_ops.append(tf.is_variable_initialized(var)) - - init_vars = [var for var, inited in zip(test_vars, run(test_ops)) if not inited] - run([var.initializer for var in init_vars]) - - -def set_vars(var_to_value_dict: dict) -> None: - """Set the values of given tf.Variables. - - Equivalent to the following, but more efficient and does not bloat the tf graph: - tflib.run([tf.assign(var, value) for var, value in var_to_value_dict.items()] - """ - assert_tf_initialized() - ops = [] - feed_dict = {} - - for var, value in var_to_value_dict.items(): - assert is_tf_expression(var) - - try: - setter = tf.get_default_graph().get_tensor_by_name(var.name.replace(":0", "/setter:0")) # look for existing op - except KeyError: - with absolute_name_scope(var.name.split(":")[0]): - with tf.control_dependencies(None): # ignore surrounding control_dependencies - setter = tf.assign(var, tf.placeholder(var.dtype, var.shape, "new_value"), name="setter") # create new setter - - ops.append(setter) - feed_dict[setter.op.inputs[1]] = value - - run(ops, feed_dict) - - -def create_var_with_large_initial_value(initial_value: np.ndarray, *args, **kwargs): - """Create tf.Variable with large initial value without bloating the tf graph.""" - assert_tf_initialized() - assert isinstance(initial_value, np.ndarray) - zeros = tf.zeros(initial_value.shape, initial_value.dtype) - var = tf.Variable(zeros, *args, **kwargs) - set_vars({var: initial_value}) - return var - - -def convert_images_from_uint8(images, drange=[-1,1], nhwc_to_nchw=False): - """Convert a minibatch of images from uint8 to float32 with configurable dynamic range. - Can be used as an input transformation for Network.run(). - """ - images = tf.cast(images, tf.float32) - if nhwc_to_nchw: - images = tf.transpose(images, [0, 3, 1, 2]) - return images * ((drange[1] - drange[0]) / 255) + drange[0] - - -def convert_images_to_uint8(images, drange=[-1,1], nchw_to_nhwc=False, shrink=1): - """Convert a minibatch of images from float32 to uint8 with configurable dynamic range. - Can be used as an output transformation for Network.run(). - """ - images = tf.cast(images, tf.float32) - if shrink > 1: - ksize = [1, 1, shrink, shrink] - images = tf.nn.avg_pool(images, ksize=ksize, strides=ksize, padding="VALID", data_format="NCHW") - if nchw_to_nhwc: - images = tf.transpose(images, [0, 2, 3, 1]) - scale = 255 / (drange[1] - drange[0]) - images = images * scale + (0.5 - drange[0] * scale) - return tf.saturate_cast(images, tf.uint8) diff --git a/spaces/Amrrs/DragGan-Inversion/PTI/models/StyleCLIP/mapper/styleclip_mapper.py b/spaces/Amrrs/DragGan-Inversion/PTI/models/StyleCLIP/mapper/styleclip_mapper.py deleted file mode 100644 index 86c04bee5744a551f4c0d31359e0de1f5492ff7e..0000000000000000000000000000000000000000 --- a/spaces/Amrrs/DragGan-Inversion/PTI/models/StyleCLIP/mapper/styleclip_mapper.py +++ /dev/null @@ -1,76 +0,0 @@ -import torch -from torch import nn -from models.StyleCLIP.mapper import latent_mappers -from models.StyleCLIP.models.stylegan2.model import Generator - - -def get_keys(d, name): - if 'state_dict' in d: - d = d['state_dict'] - d_filt = {k[len(name) + 1:]: v for k, v in d.items() if k[:len(name)] == name} - return d_filt - - -class StyleCLIPMapper(nn.Module): - - def __init__(self, opts, run_id): - super(StyleCLIPMapper, self).__init__() - self.opts = opts - # Define architecture - self.mapper = self.set_mapper() - self.run_id = run_id - - self.face_pool = torch.nn.AdaptiveAvgPool2d((256, 256)) - # Load weights if needed - self.load_weights() - - def set_mapper(self): - if self.opts.mapper_type == 'SingleMapper': - mapper = latent_mappers.SingleMapper(self.opts) - elif self.opts.mapper_type == 'LevelsMapper': - mapper = latent_mappers.LevelsMapper(self.opts) - else: - raise Exception('{} is not a valid mapper'.format(self.opts.mapper_type)) - return mapper - - def load_weights(self): - if self.opts.checkpoint_path is not None: - print('Loading from checkpoint: {}'.format(self.opts.checkpoint_path)) - ckpt = torch.load(self.opts.checkpoint_path, map_location='cpu') - self.mapper.load_state_dict(get_keys(ckpt, 'mapper'), strict=True) - - def set_G(self, new_G): - self.decoder = new_G - - def forward(self, x, resize=True, latent_mask=None, input_code=False, randomize_noise=True, - inject_latent=None, return_latents=False, alpha=None): - if input_code: - codes = x - else: - codes = self.mapper(x) - - if latent_mask is not None: - for i in latent_mask: - if inject_latent is not None: - if alpha is not None: - codes[:, i] = alpha * inject_latent[:, i] + (1 - alpha) * codes[:, i] - else: - codes[:, i] = inject_latent[:, i] - else: - codes[:, i] = 0 - - input_is_latent = not input_code - images = self.decoder.synthesis(codes, noise_mode='const') - result_latent = None - # images, result_latent = self.decoder([codes], - # input_is_latent=input_is_latent, - # randomize_noise=randomize_noise, - # return_latents=return_latents) - - if resize: - images = self.face_pool(images) - - if return_latents: - return images, result_latent - else: - return images diff --git a/spaces/AndrewMetaBlock/emilyalsentzer-Bio_ClinicalBERT/app.py b/spaces/AndrewMetaBlock/emilyalsentzer-Bio_ClinicalBERT/app.py deleted file mode 100644 index 5ea46fad6ec318329cfeb7bedb2cdacabd124b6b..0000000000000000000000000000000000000000 --- a/spaces/AndrewMetaBlock/emilyalsentzer-Bio_ClinicalBERT/app.py +++ /dev/null @@ -1,3 +0,0 @@ -import gradio as gr - -gr.Interface.load("models/emilyalsentzer/Bio_ClinicalBERT").launch() \ No newline at end of file diff --git a/spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_diffedit.py b/spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_diffedit.py deleted file mode 100644 index 485c11989bf0ae0fc8aac3157a3dd906f04d9b85..0000000000000000000000000000000000000000 --- a/spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_diffedit.py +++ /dev/null @@ -1,1510 +0,0 @@ -# Copyright 2023 DiffEdit Authors and Pix2Pix Zero Authors and The HuggingFace Team. All rights reserved. -# -# 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. - -import inspect -import warnings -from dataclasses import dataclass -from typing import Any, Callable, Dict, List, Optional, Union - -import numpy as np -import PIL -import torch -from packaging import version -from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer - -from ...configuration_utils import FrozenDict -from ...image_processor import VaeImageProcessor -from ...loaders import LoraLoaderMixin, TextualInversionLoaderMixin -from ...models import AutoencoderKL, UNet2DConditionModel -from ...schedulers import DDIMInverseScheduler, KarrasDiffusionSchedulers -from ...utils import ( - PIL_INTERPOLATION, - BaseOutput, - deprecate, - is_accelerate_available, - is_accelerate_version, - logging, - randn_tensor, - replace_example_docstring, -) -from ..pipeline_utils import DiffusionPipeline -from . import StableDiffusionPipelineOutput -from .safety_checker import StableDiffusionSafetyChecker - - -logger = logging.get_logger(__name__) # pylint: disable=invalid-name - - -@dataclass -class DiffEditInversionPipelineOutput(BaseOutput): - """ - Output class for Stable Diffusion pipelines. - - Args: - latents (`torch.FloatTensor`) - inverted latents tensor - images (`List[PIL.Image.Image]` or `np.ndarray`) - List of denoised PIL images of length `num_timesteps * batch_size` or numpy array of shape `(num_timesteps, - batch_size, height, width, num_channels)`. PIL images or numpy array present the denoised images of the - diffusion pipeline. - """ - - latents: torch.FloatTensor - images: Union[List[PIL.Image.Image], np.ndarray] - - -EXAMPLE_DOC_STRING = """ - - ```py - >>> import PIL - >>> import requests - >>> import torch - >>> from io import BytesIO - - >>> from diffusers import StableDiffusionDiffEditPipeline - - - >>> def download_image(url): - ... response = requests.get(url) - ... return PIL.Image.open(BytesIO(response.content)).convert("RGB") - - - >>> img_url = "https://github.com/Xiang-cd/DiffEdit-stable-diffusion/raw/main/assets/origin.png" - - >>> init_image = download_image(img_url).resize((768, 768)) - - >>> pipe = StableDiffusionDiffEditPipeline.from_pretrained( - ... "stabilityai/stable-diffusion-2-1", torch_dtype=torch.float16 - ... ) - >>> pipe = pipe.to("cuda") - - >>> pipeline.scheduler = DDIMScheduler.from_config(pipeline.scheduler.config) - >>> pipeline.inverse_scheduler = DDIMInverseScheduler.from_config(pipeline.scheduler.config) - >>> pipeline.enable_model_cpu_offload() - - >>> mask_prompt = "A bowl of fruits" - >>> prompt = "A bowl of pears" - - >>> mask_image = pipe.generate_mask(image=init_image, source_prompt=prompt, target_prompt=mask_prompt) - >>> image_latents = pipe.invert(image=init_image, prompt=mask_prompt).latents - >>> image = pipe(prompt=prompt, mask_image=mask_image, image_latents=image_latents).images[0] - ``` -""" - -EXAMPLE_INVERT_DOC_STRING = """ - ```py - >>> import PIL - >>> import requests - >>> import torch - >>> from io import BytesIO - - >>> from diffusers import StableDiffusionDiffEditPipeline - - - >>> def download_image(url): - ... response = requests.get(url) - ... return PIL.Image.open(BytesIO(response.content)).convert("RGB") - - - >>> img_url = "https://github.com/Xiang-cd/DiffEdit-stable-diffusion/raw/main/assets/origin.png" - - >>> init_image = download_image(img_url).resize((768, 768)) - - >>> pipe = StableDiffusionDiffEditPipeline.from_pretrained( - ... "stabilityai/stable-diffusion-2-1", torch_dtype=torch.float16 - ... ) - >>> pipe = pipe.to("cuda") - - >>> pipeline.scheduler = DDIMScheduler.from_config(pipeline.scheduler.config) - >>> pipeline.inverse_scheduler = DDIMInverseScheduler.from_config(pipeline.scheduler.config) - >>> pipeline.enable_model_cpu_offload() - - >>> prompt = "A bowl of fruits" - - >>> inverted_latents = pipe.invert(image=init_image, prompt=prompt).latents - ``` -""" - - -def auto_corr_loss(hidden_states, generator=None): - reg_loss = 0.0 - for i in range(hidden_states.shape[0]): - for j in range(hidden_states.shape[1]): - noise = hidden_states[i : i + 1, j : j + 1, :, :] - while True: - roll_amount = torch.randint(noise.shape[2] // 2, (1,), generator=generator).item() - reg_loss += (noise * torch.roll(noise, shifts=roll_amount, dims=2)).mean() ** 2 - reg_loss += (noise * torch.roll(noise, shifts=roll_amount, dims=3)).mean() ** 2 - - if noise.shape[2] <= 8: - break - noise = torch.nn.functional.avg_pool2d(noise, kernel_size=2) - return reg_loss - - -def kl_divergence(hidden_states): - return hidden_states.var() + hidden_states.mean() ** 2 - 1 - torch.log(hidden_states.var() + 1e-7) - - -# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_img2img.preprocess -def preprocess(image): - warnings.warn( - "The preprocess method is deprecated and will be removed in a future version. Please" - " use VaeImageProcessor.preprocess instead", - FutureWarning, - ) - if isinstance(image, torch.Tensor): - return image - elif isinstance(image, PIL.Image.Image): - image = [image] - - if isinstance(image[0], PIL.Image.Image): - w, h = image[0].size - w, h = (x - x % 8 for x in (w, h)) # resize to integer multiple of 8 - - image = [np.array(i.resize((w, h), resample=PIL_INTERPOLATION["lanczos"]))[None, :] for i in image] - image = np.concatenate(image, axis=0) - image = np.array(image).astype(np.float32) / 255.0 - image = image.transpose(0, 3, 1, 2) - image = 2.0 * image - 1.0 - image = torch.from_numpy(image) - elif isinstance(image[0], torch.Tensor): - image = torch.cat(image, dim=0) - return image - - -def preprocess_mask(mask, batch_size: int = 1): - if not isinstance(mask, torch.Tensor): - # preprocess mask - if isinstance(mask, PIL.Image.Image) or isinstance(mask, np.ndarray): - mask = [mask] - - if isinstance(mask, list): - if isinstance(mask[0], PIL.Image.Image): - mask = [np.array(m.convert("L")).astype(np.float32) / 255.0 for m in mask] - if isinstance(mask[0], np.ndarray): - mask = np.stack(mask, axis=0) if mask[0].ndim < 3 else np.concatenate(mask, axis=0) - mask = torch.from_numpy(mask) - elif isinstance(mask[0], torch.Tensor): - mask = torch.stack(mask, dim=0) if mask[0].ndim < 3 else torch.cat(mask, dim=0) - - # Batch and add channel dim for single mask - if mask.ndim == 2: - mask = mask.unsqueeze(0).unsqueeze(0) - - # Batch single mask or add channel dim - if mask.ndim == 3: - # Single batched mask, no channel dim or single mask not batched but channel dim - if mask.shape[0] == 1: - mask = mask.unsqueeze(0) - - # Batched masks no channel dim - else: - mask = mask.unsqueeze(1) - - # Check mask shape - if batch_size > 1: - if mask.shape[0] == 1: - mask = torch.cat([mask] * batch_size) - elif mask.shape[0] > 1 and mask.shape[0] != batch_size: - raise ValueError( - f"`mask_image` with batch size {mask.shape[0]} cannot be broadcasted to batch size {batch_size} " - f"inferred by prompt inputs" - ) - - if mask.shape[1] != 1: - raise ValueError(f"`mask_image` must have 1 channel, but has {mask.shape[1]} channels") - - # Check mask is in [0, 1] - if mask.min() < 0 or mask.max() > 1: - raise ValueError("`mask_image` should be in [0, 1] range") - - # Binarize mask - mask[mask < 0.5] = 0 - mask[mask >= 0.5] = 1 - - return mask - - -class StableDiffusionDiffEditPipeline(DiffusionPipeline, TextualInversionLoaderMixin, LoraLoaderMixin): - r""" - - - This is an experimental feature! - - - - Pipeline for text-guided image inpainting using Stable Diffusion and DiffEdit. - - This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic methods - implemented for all pipelines (downloading, saving, running on a particular device, etc.). - - In addition the pipeline inherits the following loading methods: - - *Textual-Inversion*: [`loaders.TextualInversionLoaderMixin.load_textual_inversion`] - - *LoRA*: [`loaders.LoraLoaderMixin.load_lora_weights`] - - as well as the following saving methods: - - *LoRA*: [`loaders.LoraLoaderMixin.save_lora_weights`] - - Args: - vae ([`AutoencoderKL`]): - Variational Auto-Encoder (VAE) model to encode and decode images to and from latent representations. - text_encoder ([`CLIPTextModel`]): - Frozen text-encoder ([clip-vit-large-patch14](https://huggingface.co/openai/clip-vit-large-patch14)). - tokenizer (`CLIPTokenizer`): - A [`~transformers.CLIPTokenizer`] to tokenize text. - unet ([`UNet2DConditionModel`]): - A [`UNet2DConditionModel`] to denoise the encoded image latents. - scheduler ([`SchedulerMixin`]): - A scheduler to be used in combination with `unet` to denoise the encoded image latents. - inverse_scheduler (`[DDIMInverseScheduler]`): - A scheduler to be used in combination with `unet` to fill in the unmasked part of the input latents. - safety_checker ([`StableDiffusionSafetyChecker`]): - Classification module that estimates whether generated images could be considered offensive or harmful. - Please refer to the [model card](https://huggingface.co/runwayml/stable-diffusion-v1-5) for more details - about a model's potential harms. - feature_extractor ([`CLIPImageProcessor`]): - A [`CLIPImageProcessor`] to extract features from generated images; used as inputs to the `safety_checker`. - """ - _optional_components = ["safety_checker", "feature_extractor", "inverse_scheduler"] - - def __init__( - self, - vae: AutoencoderKL, - text_encoder: CLIPTextModel, - tokenizer: CLIPTokenizer, - unet: UNet2DConditionModel, - scheduler: KarrasDiffusionSchedulers, - safety_checker: StableDiffusionSafetyChecker, - feature_extractor: CLIPImageProcessor, - inverse_scheduler: DDIMInverseScheduler, - requires_safety_checker: bool = True, - ): - super().__init__() - - if hasattr(scheduler.config, "steps_offset") and scheduler.config.steps_offset != 1: - deprecation_message = ( - f"The configuration file of this scheduler: {scheduler} is outdated. `steps_offset`" - f" should be set to 1 instead of {scheduler.config.steps_offset}. Please make sure " - "to update the config accordingly as leaving `steps_offset` might led to incorrect results" - " in future versions. If you have downloaded this checkpoint from the Hugging Face Hub," - " it would be very nice if you could open a Pull request for the `scheduler/scheduler_config.json`" - " file" - ) - deprecate("steps_offset!=1", "1.0.0", deprecation_message, standard_warn=False) - new_config = dict(scheduler.config) - new_config["steps_offset"] = 1 - scheduler._internal_dict = FrozenDict(new_config) - - if hasattr(scheduler.config, "skip_prk_steps") and scheduler.config.skip_prk_steps is False: - deprecation_message = ( - f"The configuration file of this scheduler: {scheduler} has not set the configuration" - " `skip_prk_steps`. `skip_prk_steps` should be set to True in the configuration file. Please make" - " sure to update the config accordingly as not setting `skip_prk_steps` in the config might lead to" - " incorrect results in future versions. If you have downloaded this checkpoint from the Hugging Face" - " Hub, it would be very nice if you could open a Pull request for the" - " `scheduler/scheduler_config.json` file" - ) - deprecate("skip_prk_steps not set", "1.0.0", deprecation_message, standard_warn=False) - new_config = dict(scheduler.config) - new_config["skip_prk_steps"] = True - scheduler._internal_dict = FrozenDict(new_config) - - if safety_checker is None and requires_safety_checker: - logger.warning( - f"You have disabled the safety checker for {self.__class__} by passing `safety_checker=None`. Ensure" - " that you abide to the conditions of the Stable Diffusion license and do not expose unfiltered" - " results in services or applications open to the public. Both the diffusers team and Hugging Face" - " strongly recommend to keep the safety filter enabled in all public facing circumstances, disabling" - " it only for use-cases that involve analyzing network behavior or auditing its results. For more" - " information, please have a look at https://github.com/huggingface/diffusers/pull/254 ." - ) - - if safety_checker is not None and feature_extractor is None: - raise ValueError( - "Make sure to define a feature extractor when loading {self.__class__} if you want to use the safety" - " checker. If you do not want to use the safety checker, you can pass `'safety_checker=None'` instead." - ) - - is_unet_version_less_0_9_0 = hasattr(unet.config, "_diffusers_version") and version.parse( - version.parse(unet.config._diffusers_version).base_version - ) < version.parse("0.9.0.dev0") - is_unet_sample_size_less_64 = hasattr(unet.config, "sample_size") and unet.config.sample_size < 64 - if is_unet_version_less_0_9_0 and is_unet_sample_size_less_64: - deprecation_message = ( - "The configuration file of the unet has set the default `sample_size` to smaller than" - " 64 which seems highly unlikely .If you're checkpoint is a fine-tuned version of any of the" - " following: \n- CompVis/stable-diffusion-v1-4 \n- CompVis/stable-diffusion-v1-3 \n-" - " CompVis/stable-diffusion-v1-2 \n- CompVis/stable-diffusion-v1-1 \n- runwayml/stable-diffusion-v1-5" - " \n- runwayml/stable-diffusion-inpainting \n you should change 'sample_size' to 64 in the" - " configuration file. Please make sure to update the config accordingly as leaving `sample_size=32`" - " in the config might lead to incorrect results in future versions. If you have downloaded this" - " checkpoint from the Hugging Face Hub, it would be very nice if you could open a Pull request for" - " the `unet/config.json` file" - ) - deprecate("sample_size<64", "1.0.0", deprecation_message, standard_warn=False) - new_config = dict(unet.config) - new_config["sample_size"] = 64 - unet._internal_dict = FrozenDict(new_config) - - self.register_modules( - vae=vae, - text_encoder=text_encoder, - tokenizer=tokenizer, - unet=unet, - scheduler=scheduler, - safety_checker=safety_checker, - feature_extractor=feature_extractor, - inverse_scheduler=inverse_scheduler, - ) - self.vae_scale_factor = 2 ** (len(self.vae.config.block_out_channels) - 1) - self.image_processor = VaeImageProcessor(vae_scale_factor=self.vae_scale_factor) - self.register_to_config(requires_safety_checker=requires_safety_checker) - - # Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.enable_vae_slicing - def enable_vae_slicing(self): - r""" - Enable sliced VAE decoding. When this option is enabled, the VAE will split the input tensor in slices to - compute decoding in several steps. This is useful to save some memory and allow larger batch sizes. - """ - self.vae.enable_slicing() - - # Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.disable_vae_slicing - def disable_vae_slicing(self): - r""" - Disable sliced VAE decoding. If `enable_vae_slicing` was previously enabled, this method will go back to - computing decoding in one step. - """ - self.vae.disable_slicing() - - # Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.enable_vae_tiling - def enable_vae_tiling(self): - r""" - Enable tiled VAE decoding. When this option is enabled, the VAE will split the input tensor into tiles to - compute decoding and encoding in several steps. This is useful for saving a large amount of memory and to allow - processing larger images. - """ - self.vae.enable_tiling() - - # Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.disable_vae_tiling - def disable_vae_tiling(self): - r""" - Disable tiled VAE decoding. If `enable_vae_tiling` was previously enabled, this method will go back to - computing decoding in one step. - """ - self.vae.disable_tiling() - - # Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.enable_model_cpu_offload - def enable_model_cpu_offload(self, gpu_id=0): - r""" - Offload all models to CPU to reduce memory usage with a low impact on performance. Moves one whole model at a - time to the GPU when its `forward` method is called, and the model remains in GPU until the next model runs. - Memory savings are lower than using `enable_sequential_cpu_offload`, but performance is much better due to the - iterative execution of the `unet`. - """ - if is_accelerate_available() and is_accelerate_version(">=", "0.17.0.dev0"): - from accelerate import cpu_offload_with_hook - else: - raise ImportError("`enable_model_cpu_offload` requires `accelerate v0.17.0` or higher.") - - device = torch.device(f"cuda:{gpu_id}") - - if self.device.type != "cpu": - self.to("cpu", silence_dtype_warnings=True) - torch.cuda.empty_cache() # otherwise we don't see the memory savings (but they probably exist) - - hook = None - for cpu_offloaded_model in [self.text_encoder, self.unet, self.vae]: - _, hook = cpu_offload_with_hook(cpu_offloaded_model, device, prev_module_hook=hook) - - if self.safety_checker is not None: - _, hook = cpu_offload_with_hook(self.safety_checker, device, prev_module_hook=hook) - - # We'll offload the last model manually. - self.final_offload_hook = hook - - # Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline._encode_prompt - def _encode_prompt( - self, - prompt, - device, - num_images_per_prompt, - do_classifier_free_guidance, - negative_prompt=None, - prompt_embeds: Optional[torch.FloatTensor] = None, - negative_prompt_embeds: Optional[torch.FloatTensor] = None, - lora_scale: Optional[float] = None, - ): - r""" - Encodes the prompt into text encoder hidden states. - - Args: - prompt (`str` or `List[str]`, *optional*): - prompt to be encoded - device: (`torch.device`): - torch device - num_images_per_prompt (`int`): - number of images that should be generated per prompt - do_classifier_free_guidance (`bool`): - whether to use classifier free guidance or not - negative_prompt (`str` or `List[str]`, *optional*): - The prompt or prompts not to guide the image generation. If not defined, one has to pass - `negative_prompt_embeds` instead. Ignored when not using guidance (i.e., ignored if `guidance_scale` is - less than `1`). - prompt_embeds (`torch.FloatTensor`, *optional*): - Pre-generated text embeddings. Can be used to easily tweak text inputs, *e.g.* prompt weighting. If not - provided, text embeddings will be generated from `prompt` input argument. - negative_prompt_embeds (`torch.FloatTensor`, *optional*): - Pre-generated negative text embeddings. Can be used to easily tweak text inputs, *e.g.* prompt - weighting. If not provided, negative_prompt_embeds will be generated from `negative_prompt` input - argument. - lora_scale (`float`, *optional*): - A lora scale that will be applied to all LoRA layers of the text encoder if LoRA layers are loaded. - """ - # set lora scale so that monkey patched LoRA - # function of text encoder can correctly access it - if lora_scale is not None and isinstance(self, LoraLoaderMixin): - self._lora_scale = lora_scale - - if prompt is not None and isinstance(prompt, str): - batch_size = 1 - elif prompt is not None and isinstance(prompt, list): - batch_size = len(prompt) - else: - batch_size = prompt_embeds.shape[0] - - if prompt_embeds is None: - # textual inversion: procecss multi-vector tokens if necessary - if isinstance(self, TextualInversionLoaderMixin): - prompt = self.maybe_convert_prompt(prompt, self.tokenizer) - - text_inputs = self.tokenizer( - prompt, - padding="max_length", - max_length=self.tokenizer.model_max_length, - truncation=True, - return_tensors="pt", - ) - text_input_ids = text_inputs.input_ids - untruncated_ids = self.tokenizer(prompt, padding="longest", return_tensors="pt").input_ids - - if untruncated_ids.shape[-1] >= text_input_ids.shape[-1] and not torch.equal( - text_input_ids, untruncated_ids - ): - removed_text = self.tokenizer.batch_decode( - untruncated_ids[:, self.tokenizer.model_max_length - 1 : -1] - ) - logger.warning( - "The following part of your input was truncated because CLIP can only handle sequences up to" - f" {self.tokenizer.model_max_length} tokens: {removed_text}" - ) - - if hasattr(self.text_encoder.config, "use_attention_mask") and self.text_encoder.config.use_attention_mask: - attention_mask = text_inputs.attention_mask.to(device) - else: - attention_mask = None - - prompt_embeds = self.text_encoder( - text_input_ids.to(device), - attention_mask=attention_mask, - ) - prompt_embeds = prompt_embeds[0] - - prompt_embeds = prompt_embeds.to(dtype=self.text_encoder.dtype, device=device) - - bs_embed, seq_len, _ = prompt_embeds.shape - # duplicate text embeddings for each generation per prompt, using mps friendly method - prompt_embeds = prompt_embeds.repeat(1, num_images_per_prompt, 1) - prompt_embeds = prompt_embeds.view(bs_embed * num_images_per_prompt, seq_len, -1) - - # get unconditional embeddings for classifier free guidance - if do_classifier_free_guidance and negative_prompt_embeds is None: - uncond_tokens: List[str] - if negative_prompt is None: - uncond_tokens = [""] * batch_size - elif prompt is not None and type(prompt) is not type(negative_prompt): - raise TypeError( - f"`negative_prompt` should be the same type to `prompt`, but got {type(negative_prompt)} !=" - f" {type(prompt)}." - ) - elif isinstance(negative_prompt, str): - uncond_tokens = [negative_prompt] - elif batch_size != len(negative_prompt): - raise ValueError( - f"`negative_prompt`: {negative_prompt} has batch size {len(negative_prompt)}, but `prompt`:" - f" {prompt} has batch size {batch_size}. Please make sure that passed `negative_prompt` matches" - " the batch size of `prompt`." - ) - else: - uncond_tokens = negative_prompt - - # textual inversion: procecss multi-vector tokens if necessary - if isinstance(self, TextualInversionLoaderMixin): - uncond_tokens = self.maybe_convert_prompt(uncond_tokens, self.tokenizer) - - max_length = prompt_embeds.shape[1] - uncond_input = self.tokenizer( - uncond_tokens, - padding="max_length", - max_length=max_length, - truncation=True, - return_tensors="pt", - ) - - if hasattr(self.text_encoder.config, "use_attention_mask") and self.text_encoder.config.use_attention_mask: - attention_mask = uncond_input.attention_mask.to(device) - else: - attention_mask = None - - negative_prompt_embeds = self.text_encoder( - uncond_input.input_ids.to(device), - attention_mask=attention_mask, - ) - negative_prompt_embeds = negative_prompt_embeds[0] - - if do_classifier_free_guidance: - # duplicate unconditional embeddings for each generation per prompt, using mps friendly method - seq_len = negative_prompt_embeds.shape[1] - - negative_prompt_embeds = negative_prompt_embeds.to(dtype=self.text_encoder.dtype, device=device) - - negative_prompt_embeds = negative_prompt_embeds.repeat(1, num_images_per_prompt, 1) - negative_prompt_embeds = negative_prompt_embeds.view(batch_size * num_images_per_prompt, seq_len, -1) - - # For classifier free guidance, we need to do two forward passes. - # Here we concatenate the unconditional and text embeddings into a single batch - # to avoid doing two forward passes - prompt_embeds = torch.cat([negative_prompt_embeds, prompt_embeds]) - - return prompt_embeds - - # Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.run_safety_checker - def run_safety_checker(self, image, device, dtype): - if self.safety_checker is None: - has_nsfw_concept = None - else: - if torch.is_tensor(image): - feature_extractor_input = self.image_processor.postprocess(image, output_type="pil") - else: - feature_extractor_input = self.image_processor.numpy_to_pil(image) - safety_checker_input = self.feature_extractor(feature_extractor_input, return_tensors="pt").to(device) - image, has_nsfw_concept = self.safety_checker( - images=image, clip_input=safety_checker_input.pixel_values.to(dtype) - ) - return image, has_nsfw_concept - - # Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.prepare_extra_step_kwargs - def prepare_extra_step_kwargs(self, generator, eta): - # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature - # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers. - # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502 - # and should be between [0, 1] - - accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys()) - extra_step_kwargs = {} - if accepts_eta: - extra_step_kwargs["eta"] = eta - - # check if the scheduler accepts generator - accepts_generator = "generator" in set(inspect.signature(self.scheduler.step).parameters.keys()) - if accepts_generator: - extra_step_kwargs["generator"] = generator - return extra_step_kwargs - - # Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.decode_latents - def decode_latents(self, latents): - warnings.warn( - "The decode_latents method is deprecated and will be removed in a future version. Please" - " use VaeImageProcessor instead", - FutureWarning, - ) - latents = 1 / self.vae.config.scaling_factor * latents - image = self.vae.decode(latents, return_dict=False)[0] - image = (image / 2 + 0.5).clamp(0, 1) - # we always cast to float32 as this does not cause significant overhead and is compatible with bfloat16 - image = image.cpu().permute(0, 2, 3, 1).float().numpy() - return image - - def check_inputs( - self, - prompt, - strength, - callback_steps, - negative_prompt=None, - prompt_embeds=None, - negative_prompt_embeds=None, - ): - if (strength is None) or (strength is not None and (strength < 0 or strength > 1)): - raise ValueError( - f"The value of `strength` should in [0.0, 1.0] but is, but is {strength} of type {type(strength)}." - ) - - if (callback_steps is None) or ( - callback_steps is not None and (not isinstance(callback_steps, int) or callback_steps <= 0) - ): - raise ValueError( - f"`callback_steps` has to be a positive integer but is {callback_steps} of type" - f" {type(callback_steps)}." - ) - - if prompt is not None and prompt_embeds is not None: - raise ValueError( - f"Cannot forward both `prompt`: {prompt} and `prompt_embeds`: {prompt_embeds}. Please make sure to" - " only forward one of the two." - ) - elif prompt is None and prompt_embeds is None: - raise ValueError( - "Provide either `prompt` or `prompt_embeds`. Cannot leave both `prompt` and `prompt_embeds` undefined." - ) - elif prompt is not None and (not isinstance(prompt, str) and not isinstance(prompt, list)): - raise ValueError(f"`prompt` has to be of type `str` or `list` but is {type(prompt)}") - - if negative_prompt is not None and negative_prompt_embeds is not None: - raise ValueError( - f"Cannot forward both `negative_prompt`: {negative_prompt} and `negative_prompt_embeds`:" - f" {negative_prompt_embeds}. Please make sure to only forward one of the two." - ) - - if prompt_embeds is not None and negative_prompt_embeds is not None: - if prompt_embeds.shape != negative_prompt_embeds.shape: - raise ValueError( - "`prompt_embeds` and `negative_prompt_embeds` must have the same shape when passed directly, but" - f" got: `prompt_embeds` {prompt_embeds.shape} != `negative_prompt_embeds`" - f" {negative_prompt_embeds.shape}." - ) - - def check_source_inputs( - self, - source_prompt=None, - source_negative_prompt=None, - source_prompt_embeds=None, - source_negative_prompt_embeds=None, - ): - if source_prompt is not None and source_prompt_embeds is not None: - raise ValueError( - f"Cannot forward both `source_prompt`: {source_prompt} and `source_prompt_embeds`: {source_prompt_embeds}." - " Please make sure to only forward one of the two." - ) - elif source_prompt is None and source_prompt_embeds is None: - raise ValueError( - "Provide either `source_image` or `source_prompt_embeds`. Cannot leave all both of the arguments undefined." - ) - elif source_prompt is not None and ( - not isinstance(source_prompt, str) and not isinstance(source_prompt, list) - ): - raise ValueError(f"`source_prompt` has to be of type `str` or `list` but is {type(source_prompt)}") - - if source_negative_prompt is not None and source_negative_prompt_embeds is not None: - raise ValueError( - f"Cannot forward both `source_negative_prompt`: {source_negative_prompt} and `source_negative_prompt_embeds`:" - f" {source_negative_prompt_embeds}. Please make sure to only forward one of the two." - ) - - if source_prompt_embeds is not None and source_negative_prompt_embeds is not None: - if source_prompt_embeds.shape != source_negative_prompt_embeds.shape: - raise ValueError( - "`source_prompt_embeds` and `source_negative_prompt_embeds` must have the same shape when passed" - f" directly, but got: `source_prompt_embeds` {source_prompt_embeds.shape} !=" - f" `source_negative_prompt_embeds` {source_negative_prompt_embeds.shape}." - ) - - # Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_img2img.StableDiffusionImg2ImgPipeline.get_timesteps - def get_timesteps(self, num_inference_steps, strength, device): - # get the original timestep using init_timestep - init_timestep = min(int(num_inference_steps * strength), num_inference_steps) - - t_start = max(num_inference_steps - init_timestep, 0) - timesteps = self.scheduler.timesteps[t_start * self.scheduler.order :] - - return timesteps, num_inference_steps - t_start - - def get_inverse_timesteps(self, num_inference_steps, strength, device): - # get the original timestep using init_timestep - init_timestep = min(int(num_inference_steps * strength), num_inference_steps) - - t_start = max(num_inference_steps - init_timestep, 0) - - # safety for t_start overflow to prevent empty timsteps slice - if t_start == 0: - return self.inverse_scheduler.timesteps, num_inference_steps - timesteps = self.inverse_scheduler.timesteps[:-t_start] - - return timesteps, num_inference_steps - t_start - - # Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.prepare_latents - def prepare_latents(self, batch_size, num_channels_latents, height, width, dtype, device, generator, latents=None): - shape = (batch_size, num_channels_latents, height // self.vae_scale_factor, width // self.vae_scale_factor) - if isinstance(generator, list) and len(generator) != batch_size: - raise ValueError( - f"You have passed a list of generators of length {len(generator)}, but requested an effective batch" - f" size of {batch_size}. Make sure the batch size matches the length of the generators." - ) - - if latents is None: - latents = randn_tensor(shape, generator=generator, device=device, dtype=dtype) - else: - latents = latents.to(device) - - # scale the initial noise by the standard deviation required by the scheduler - latents = latents * self.scheduler.init_noise_sigma - return latents - - # Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_pix2pix_zero.StableDiffusionPix2PixZeroPipeline.prepare_image_latents - def prepare_image_latents(self, image, batch_size, dtype, device, generator=None): - if not isinstance(image, (torch.Tensor, PIL.Image.Image, list)): - raise ValueError( - f"`image` has to be of type `torch.Tensor`, `PIL.Image.Image` or list but is {type(image)}" - ) - - image = image.to(device=device, dtype=dtype) - - if image.shape[1] == 4: - latents = image - - else: - if isinstance(generator, list) and len(generator) != batch_size: - raise ValueError( - f"You have passed a list of generators of length {len(generator)}, but requested an effective batch" - f" size of {batch_size}. Make sure the batch size matches the length of the generators." - ) - - if isinstance(generator, list): - latents = [ - self.vae.encode(image[i : i + 1]).latent_dist.sample(generator[i]) for i in range(batch_size) - ] - latents = torch.cat(latents, dim=0) - else: - latents = self.vae.encode(image).latent_dist.sample(generator) - - latents = self.vae.config.scaling_factor * latents - - if batch_size != latents.shape[0]: - if batch_size % latents.shape[0] == 0: - # expand image_latents for batch_size - deprecation_message = ( - f"You have passed {batch_size} text prompts (`prompt`), but only {latents.shape[0]} initial" - " images (`image`). Initial images are now duplicating to match the number of text prompts. Note" - " that this behavior is deprecated and will be removed in a version 1.0.0. Please make sure to update" - " your script to pass as many initial images as text prompts to suppress this warning." - ) - deprecate("len(prompt) != len(image)", "1.0.0", deprecation_message, standard_warn=False) - additional_latents_per_image = batch_size // latents.shape[0] - latents = torch.cat([latents] * additional_latents_per_image, dim=0) - else: - raise ValueError( - f"Cannot duplicate `image` of batch size {latents.shape[0]} to {batch_size} text prompts." - ) - else: - latents = torch.cat([latents], dim=0) - - return latents - - def get_epsilon(self, model_output: torch.Tensor, sample: torch.Tensor, timestep: int): - pred_type = self.inverse_scheduler.config.prediction_type - alpha_prod_t = self.inverse_scheduler.alphas_cumprod[timestep] - - beta_prod_t = 1 - alpha_prod_t - - if pred_type == "epsilon": - return model_output - elif pred_type == "sample": - return (sample - alpha_prod_t ** (0.5) * model_output) / beta_prod_t ** (0.5) - elif pred_type == "v_prediction": - return (alpha_prod_t**0.5) * model_output + (beta_prod_t**0.5) * sample - else: - raise ValueError( - f"prediction_type given as {pred_type} must be one of `epsilon`, `sample`, or `v_prediction`" - ) - - @torch.no_grad() - @replace_example_docstring(EXAMPLE_DOC_STRING) - def generate_mask( - self, - image: Union[torch.FloatTensor, PIL.Image.Image] = None, - target_prompt: Optional[Union[str, List[str]]] = None, - target_negative_prompt: Optional[Union[str, List[str]]] = None, - target_prompt_embeds: Optional[torch.FloatTensor] = None, - target_negative_prompt_embeds: Optional[torch.FloatTensor] = None, - source_prompt: Optional[Union[str, List[str]]] = None, - source_negative_prompt: Optional[Union[str, List[str]]] = None, - source_prompt_embeds: Optional[torch.FloatTensor] = None, - source_negative_prompt_embeds: Optional[torch.FloatTensor] = None, - num_maps_per_mask: Optional[int] = 10, - mask_encode_strength: Optional[float] = 0.5, - mask_thresholding_ratio: Optional[float] = 3.0, - num_inference_steps: int = 50, - guidance_scale: float = 7.5, - generator: Optional[Union[torch.Generator, List[torch.Generator]]] = None, - output_type: Optional[str] = "np", - cross_attention_kwargs: Optional[Dict[str, Any]] = None, - ): - r""" - Generate a latent mask given a mask prompt, a target prompt, and an image. - - Args: - image (`PIL.Image.Image`): - `Image` or tensor representing an image batch to be used for computing the mask. - target_prompt (`str` or `List[str]`, *optional*): - The prompt or prompts to guide semantic mask generation. If not defined, you need to pass - `prompt_embeds`. - target_negative_prompt (`str` or `List[str]`, *optional*): - The prompt or prompts to guide what to not include in image generation. If not defined, you need to - pass `negative_prompt_embeds` instead. Ignored when not using guidance (`guidance_scale < 1`). - target_prompt_embeds (`torch.FloatTensor`, *optional*): - Pre-generated text embeddings. Can be used to easily tweak text inputs (prompt weighting). If not - provided, text embeddings are generated from the `prompt` input argument. - target_negative_prompt_embeds (`torch.FloatTensor`, *optional*): - Pre-generated negative text embeddings. Can be used to easily tweak text inputs (prompt weighting). If - not provided, `negative_prompt_embeds` are generated from the `negative_prompt` input argument. - source_prompt (`str` or `List[str]`, *optional*): - The prompt or prompts to guide semantic mask generation using DiffEdit. If not defined, you need to - pass `source_prompt_embeds` or `source_image` instead. - source_negative_prompt (`str` or `List[str]`, *optional*): - The prompt or prompts to guide semantic mask generation away from using DiffEdit. If not defined, you - need to pass `source_negative_prompt_embeds` or `source_image` instead. - source_prompt_embeds (`torch.FloatTensor`, *optional*): - Pre-generated text embeddings to guide the semantic mask generation. Can be used to easily tweak text - inputs (prompt weighting). If not provided, text embeddings are generated from `source_prompt` input - argument. - source_negative_prompt_embeds (`torch.FloatTensor`, *optional*): - Pre-generated text embeddings to negatively guide the semantic mask generation. Can be used to easily - tweak text inputs (prompt weighting). If not provided, text embeddings are generated from - `source_negative_prompt` input argument. - num_maps_per_mask (`int`, *optional*, defaults to 10): - The number of noise maps sampled to generate the semantic mask using DiffEdit. - mask_encode_strength (`float`, *optional*, defaults to 0.5): - The strength of the noise maps sampled to generate the semantic mask using DiffEdit. Must be between 0 - and 1. - mask_thresholding_ratio (`float`, *optional*, defaults to 3.0): - The maximum multiple of the mean absolute difference used to clamp the semantic guidance map before - mask binarization. - num_inference_steps (`int`, *optional*, defaults to 50): - The number of denoising steps. More denoising steps usually lead to a higher quality image at the - expense of slower inference. - guidance_scale (`float`, *optional*, defaults to 7.5): - A higher guidance scale value encourages the model to generate images closely linked to the text - `prompt` at the expense of lower image quality. Guidance scale is enabled when `guidance_scale > 1`. - generator (`torch.Generator` or `List[torch.Generator]`, *optional*): - A [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make - generation deterministic. - output_type (`str`, *optional*, defaults to `"pil"`): - The output format of the generated image. Choose between `PIL.Image` or `np.array`. - cross_attention_kwargs (`dict`, *optional*): - A kwargs dictionary that if specified is passed along to the [`AttentionProcessor`] as defined in - [`self.processor`](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/cross_attention.py). - - Examples: - - Returns: - `List[PIL.Image.Image]` or `np.array`: - When returning a `List[PIL.Image.Image]`, the list consists of a batch of single-channel binary images - with dimensions `(height // self.vae_scale_factor, width // self.vae_scale_factor)`. If it's - `np.array`, the shape is `(batch_size, height // self.vae_scale_factor, width // - self.vae_scale_factor)`. - """ - - # 1. Check inputs (Provide dummy argument for callback_steps) - self.check_inputs( - target_prompt, - mask_encode_strength, - 1, - target_negative_prompt, - target_prompt_embeds, - target_negative_prompt_embeds, - ) - - self.check_source_inputs( - source_prompt, - source_negative_prompt, - source_prompt_embeds, - source_negative_prompt_embeds, - ) - - if (num_maps_per_mask is None) or ( - num_maps_per_mask is not None and (not isinstance(num_maps_per_mask, int) or num_maps_per_mask <= 0) - ): - raise ValueError( - f"`num_maps_per_mask` has to be a positive integer but is {num_maps_per_mask} of type" - f" {type(num_maps_per_mask)}." - ) - - if mask_thresholding_ratio is None or mask_thresholding_ratio <= 0: - raise ValueError( - f"`mask_thresholding_ratio` has to be positive but is {mask_thresholding_ratio} of type" - f" {type(mask_thresholding_ratio)}." - ) - - # 2. Define call parameters - if target_prompt is not None and isinstance(target_prompt, str): - batch_size = 1 - elif target_prompt is not None and isinstance(target_prompt, list): - batch_size = len(target_prompt) - else: - batch_size = target_prompt_embeds.shape[0] - if cross_attention_kwargs is None: - cross_attention_kwargs = {} - - device = self._execution_device - # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2) - # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1` - # corresponds to doing no classifier free guidance. - do_classifier_free_guidance = guidance_scale > 1.0 - - # 3. Encode input prompts - (cross_attention_kwargs.get("scale", None) if cross_attention_kwargs is not None else None) - target_prompt_embeds = self._encode_prompt( - target_prompt, - device, - num_maps_per_mask, - do_classifier_free_guidance, - target_negative_prompt, - prompt_embeds=target_prompt_embeds, - negative_prompt_embeds=target_negative_prompt_embeds, - ) - - source_prompt_embeds = self._encode_prompt( - source_prompt, - device, - num_maps_per_mask, - do_classifier_free_guidance, - source_negative_prompt, - prompt_embeds=source_prompt_embeds, - negative_prompt_embeds=source_negative_prompt_embeds, - ) - - # 4. Preprocess image - image = self.image_processor.preprocess(image).repeat_interleave(num_maps_per_mask, dim=0) - - # 5. Set timesteps - self.scheduler.set_timesteps(num_inference_steps, device=device) - timesteps, _ = self.get_timesteps(num_inference_steps, mask_encode_strength, device) - encode_timestep = timesteps[0] - - # 6. Prepare image latents and add noise with specified strength - image_latents = self.prepare_image_latents( - image, batch_size * num_maps_per_mask, self.vae.dtype, device, generator - ) - noise = randn_tensor(image_latents.shape, generator=generator, device=device, dtype=self.vae.dtype) - image_latents = self.scheduler.add_noise(image_latents, noise, encode_timestep) - - latent_model_input = torch.cat([image_latents] * (4 if do_classifier_free_guidance else 2)) - latent_model_input = self.scheduler.scale_model_input(latent_model_input, encode_timestep) - - # 7. Predict the noise residual - prompt_embeds = torch.cat([source_prompt_embeds, target_prompt_embeds]) - noise_pred = self.unet( - latent_model_input, - encode_timestep, - encoder_hidden_states=prompt_embeds, - cross_attention_kwargs=cross_attention_kwargs, - ).sample - - if do_classifier_free_guidance: - noise_pred_neg_src, noise_pred_source, noise_pred_uncond, noise_pred_target = noise_pred.chunk(4) - noise_pred_source = noise_pred_neg_src + guidance_scale * (noise_pred_source - noise_pred_neg_src) - noise_pred_target = noise_pred_uncond + guidance_scale * (noise_pred_target - noise_pred_uncond) - else: - noise_pred_source, noise_pred_target = noise_pred.chunk(2) - - # 8. Compute the mask from the absolute difference of predicted noise residuals - # TODO: Consider smoothing mask guidance map - mask_guidance_map = ( - torch.abs(noise_pred_target - noise_pred_source) - .reshape(batch_size, num_maps_per_mask, *noise_pred_target.shape[-3:]) - .mean([1, 2]) - ) - clamp_magnitude = mask_guidance_map.mean() * mask_thresholding_ratio - semantic_mask_image = mask_guidance_map.clamp(0, clamp_magnitude) / clamp_magnitude - semantic_mask_image = torch.where(semantic_mask_image <= 0.5, 0, 1) - mask_image = semantic_mask_image.cpu().numpy() - - # 9. Convert to Numpy array or PIL. - if output_type == "pil": - mask_image = self.image_processor.numpy_to_pil(mask_image) - - # Offload last model to CPU - if hasattr(self, "final_offload_hook") and self.final_offload_hook is not None: - self.final_offload_hook.offload() - - return mask_image - - @torch.no_grad() - @replace_example_docstring(EXAMPLE_INVERT_DOC_STRING) - def invert( - self, - prompt: Optional[Union[str, List[str]]] = None, - image: Union[torch.FloatTensor, PIL.Image.Image] = None, - num_inference_steps: int = 50, - inpaint_strength: float = 0.8, - guidance_scale: float = 7.5, - negative_prompt: Optional[Union[str, List[str]]] = None, - generator: Optional[Union[torch.Generator, List[torch.Generator]]] = None, - prompt_embeds: Optional[torch.FloatTensor] = None, - negative_prompt_embeds: Optional[torch.FloatTensor] = None, - decode_latents: bool = False, - output_type: Optional[str] = "pil", - return_dict: bool = True, - callback: Optional[Callable[[int, int, torch.FloatTensor], None]] = None, - callback_steps: Optional[int] = 1, - cross_attention_kwargs: Optional[Dict[str, Any]] = None, - lambda_auto_corr: float = 20.0, - lambda_kl: float = 20.0, - num_reg_steps: int = 0, - num_auto_corr_rolls: int = 5, - ): - r""" - Generate inverted latents given a prompt and image. - - Args: - prompt (`str` or `List[str]`, *optional*): - The prompt or prompts to guide image generation. If not defined, you need to pass `prompt_embeds`. - image (`PIL.Image.Image`): - `Image` or tensor representing an image batch to produce the inverted latents guided by `prompt`. - inpaint_strength (`float`, *optional*, defaults to 0.8): - Indicates extent of the noising process to run latent inversion. Must be between 0 and 1. When - `strength` is 1, the inversion process iss ru for the full number of iterations specified in - `num_inference_steps`. `image` is used as a reference for the inversion process, adding more noise the - larger the `strength`. If `strength` is 0, no inpainting occurs. - num_inference_steps (`int`, *optional*, defaults to 50): - The number of denoising steps. More denoising steps usually lead to a higher quality image at the - expense of slower inference. - guidance_scale (`float`, *optional*, defaults to 7.5): - A higher guidance scale value encourages the model to generate images closely linked to the text - `prompt` at the expense of lower image quality. Guidance scale is enabled when `guidance_scale > 1`. - negative_prompt (`str` or `List[str]`, *optional*): - The prompt or prompts to guide what to not include in image generation. If not defined, you need to - pass `negative_prompt_embeds` instead. Ignored when not using guidance (`guidance_scale < 1`). - generator (`torch.Generator`, *optional*): - A [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make - generation deterministic. - prompt_embeds (`torch.FloatTensor`, *optional*): - Pre-generated text embeddings. Can be used to easily tweak text inputs (prompt weighting). If not - provided, text embeddings are generated from the `prompt` input argument. - negative_prompt_embeds (`torch.FloatTensor`, *optional*): - Pre-generated negative text embeddings. Can be used to easily tweak text inputs (prompt weighting). If - not provided, `negative_prompt_embeds` are generated from the `negative_prompt` input argument. - decode_latents (`bool`, *optional*, defaults to `False`): - Whether or not to decode the inverted latents into a generated image. Setting this argument to `True` - decodes all inverted latents for each timestep into a list of generated images. - output_type (`str`, *optional*, defaults to `"pil"`): - The output format of the generated image. Choose between `PIL.Image` or `np.array`. - return_dict (`bool`, *optional*, defaults to `True`): - Whether or not to return a [`~pipelines.stable_diffusion.DiffEditInversionPipelineOutput`] instead of a - plain tuple. - callback (`Callable`, *optional*): - A function that calls every `callback_steps` steps during inference. The function is called with the - following arguments: `callback(step: int, timestep: int, latents: torch.FloatTensor)`. - callback_steps (`int`, *optional*, defaults to 1): - The frequency at which the `callback` function is called. If not specified, the callback is called at - every step. - cross_attention_kwargs (`dict`, *optional*): - A kwargs dictionary that if specified is passed along to the [`AttentionProcessor`] as defined in - [`self.processor`](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/cross_attention.py). - lambda_auto_corr (`float`, *optional*, defaults to 20.0): - Lambda parameter to control auto correction. - lambda_kl (`float`, *optional*, defaults to 20.0): - Lambda parameter to control Kullback–Leibler divergence output. - num_reg_steps (`int`, *optional*, defaults to 0): - Number of regularization loss steps. - num_auto_corr_rolls (`int`, *optional*, defaults to 5): - Number of auto correction roll steps. - - Examples: - - Returns: - [`~pipelines.stable_diffusion.pipeline_stable_diffusion_diffedit.DiffEditInversionPipelineOutput`] or - `tuple`: - If `return_dict` is `True`, - [`~pipelines.stable_diffusion.pipeline_stable_diffusion_diffedit.DiffEditInversionPipelineOutput`] is - returned, otherwise a `tuple` is returned where the first element is the inverted latents tensors - ordered by increasing noise, and the second is the corresponding decoded images if `decode_latents` is - `True`, otherwise `None`. - """ - - # 1. Check inputs - self.check_inputs( - prompt, - inpaint_strength, - callback_steps, - negative_prompt, - prompt_embeds, - negative_prompt_embeds, - ) - - if image is None: - raise ValueError("`image` input cannot be undefined.") - - # 2. Define call parameters - if prompt is not None and isinstance(prompt, str): - batch_size = 1 - elif prompt is not None and isinstance(prompt, list): - batch_size = len(prompt) - else: - batch_size = prompt_embeds.shape[0] - if cross_attention_kwargs is None: - cross_attention_kwargs = {} - - device = self._execution_device - # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2) - # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1` - # corresponds to doing no classifier free guidance. - do_classifier_free_guidance = guidance_scale > 1.0 - - # 3. Preprocess image - image = self.image_processor.preprocess(image) - - # 4. Prepare latent variables - num_images_per_prompt = 1 - latents = self.prepare_image_latents( - image, batch_size * num_images_per_prompt, self.vae.dtype, device, generator - ) - - # 5. Encode input prompt - prompt_embeds = self._encode_prompt( - prompt, - device, - num_images_per_prompt, - do_classifier_free_guidance, - negative_prompt, - prompt_embeds=prompt_embeds, - negative_prompt_embeds=negative_prompt_embeds, - ) - - # 6. Prepare timesteps - self.inverse_scheduler.set_timesteps(num_inference_steps, device=device) - timesteps, num_inference_steps = self.get_inverse_timesteps(num_inference_steps, inpaint_strength, device) - - # 7. Noising loop where we obtain the intermediate noised latent image for each timestep. - num_warmup_steps = len(timesteps) - num_inference_steps * self.inverse_scheduler.order - inverted_latents = [] - with self.progress_bar(total=num_inference_steps) as progress_bar: - for i, t in enumerate(timesteps): - # expand the latents if we are doing classifier free guidance - latent_model_input = torch.cat([latents] * 2) if do_classifier_free_guidance else latents - latent_model_input = self.inverse_scheduler.scale_model_input(latent_model_input, t) - - # predict the noise residual - noise_pred = self.unet( - latent_model_input, - t, - encoder_hidden_states=prompt_embeds, - cross_attention_kwargs=cross_attention_kwargs, - ).sample - - # perform guidance - if do_classifier_free_guidance: - noise_pred_uncond, noise_pred_text = noise_pred.chunk(2) - noise_pred = noise_pred_uncond + guidance_scale * (noise_pred_text - noise_pred_uncond) - - # regularization of the noise prediction (not in original code or paper but borrowed from Pix2PixZero) - if num_reg_steps > 0: - with torch.enable_grad(): - for _ in range(num_reg_steps): - if lambda_auto_corr > 0: - for _ in range(num_auto_corr_rolls): - var = torch.autograd.Variable(noise_pred.detach().clone(), requires_grad=True) - - # Derive epsilon from model output before regularizing to IID standard normal - var_epsilon = self.get_epsilon(var, latent_model_input.detach(), t) - - l_ac = auto_corr_loss(var_epsilon, generator=generator) - l_ac.backward() - - grad = var.grad.detach() / num_auto_corr_rolls - noise_pred = noise_pred - lambda_auto_corr * grad - - if lambda_kl > 0: - var = torch.autograd.Variable(noise_pred.detach().clone(), requires_grad=True) - - # Derive epsilon from model output before regularizing to IID standard normal - var_epsilon = self.get_epsilon(var, latent_model_input.detach(), t) - - l_kld = kl_divergence(var_epsilon) - l_kld.backward() - - grad = var.grad.detach() - noise_pred = noise_pred - lambda_kl * grad - - noise_pred = noise_pred.detach() - - # compute the previous noisy sample x_t -> x_t-1 - latents = self.inverse_scheduler.step(noise_pred, t, latents).prev_sample - inverted_latents.append(latents.detach().clone()) - - # call the callback, if provided - if i == len(timesteps) - 1 or ( - (i + 1) > num_warmup_steps and (i + 1) % self.inverse_scheduler.order == 0 - ): - progress_bar.update() - if callback is not None and i % callback_steps == 0: - callback(i, t, latents) - - assert len(inverted_latents) == len(timesteps) - latents = torch.stack(list(reversed(inverted_latents)), 1) - - # 8. Post-processing - image = None - if decode_latents: - image = self.decode_latents(latents.flatten(0, 1)) - - # 9. Convert to PIL. - if decode_latents and output_type == "pil": - image = self.image_processor.numpy_to_pil(image) - - # Offload last model to CPU - if hasattr(self, "final_offload_hook") and self.final_offload_hook is not None: - self.final_offload_hook.offload() - - if not return_dict: - return (latents, image) - - return DiffEditInversionPipelineOutput(latents=latents, images=image) - - @torch.no_grad() - @replace_example_docstring(EXAMPLE_DOC_STRING) - def __call__( - self, - prompt: Optional[Union[str, List[str]]] = None, - mask_image: Union[torch.FloatTensor, PIL.Image.Image] = None, - image_latents: Union[torch.FloatTensor, PIL.Image.Image] = None, - inpaint_strength: Optional[float] = 0.8, - num_inference_steps: int = 50, - guidance_scale: float = 7.5, - negative_prompt: Optional[Union[str, List[str]]] = None, - num_images_per_prompt: Optional[int] = 1, - eta: float = 0.0, - generator: Optional[Union[torch.Generator, List[torch.Generator]]] = None, - latents: Optional[torch.FloatTensor] = None, - prompt_embeds: Optional[torch.FloatTensor] = None, - negative_prompt_embeds: Optional[torch.FloatTensor] = None, - output_type: Optional[str] = "pil", - return_dict: bool = True, - callback: Optional[Callable[[int, int, torch.FloatTensor], None]] = None, - callback_steps: int = 1, - cross_attention_kwargs: Optional[Dict[str, Any]] = None, - ): - r""" - The call function to the pipeline for generation. - - Args: - prompt (`str` or `List[str]`, *optional*): - The prompt or prompts to guide image generation. If not defined, you need to pass `prompt_embeds`. - mask_image (`PIL.Image.Image`): - `Image` or tensor representing an image batch to mask the generated image. White pixels in the mask are - repainted, while black pixels are preserved. If `mask_image` is a PIL image, it is converted to a - single channel (luminance) before use. If it's a tensor, it should contain one color channel (L) - instead of 3, so the expected shape would be `(B, 1, H, W)`. - image_latents (`PIL.Image.Image` or `torch.FloatTensor`): - Partially noised image latents from the inversion process to be used as inputs for image generation. - inpaint_strength (`float`, *optional*, defaults to 0.8): - Indicates extent to inpaint the masked area. Must be between 0 and 1. When `strength` is 1, the - denoising process is run on the masked area for the full number of iterations specified in - `num_inference_steps`. `image_latents` is used as a reference for the masked area, adding more noise to - that region the larger the `strength`. If `strength` is 0, no inpainting occurs. - num_inference_steps (`int`, *optional*, defaults to 50): - The number of denoising steps. More denoising steps usually lead to a higher quality image at the - expense of slower inference. - guidance_scale (`float`, *optional*, defaults to 7.5): - A higher guidance scale value encourages the model to generate images closely linked to the text - `prompt` at the expense of lower image quality. Guidance scale is enabled when `guidance_scale > 1`. - negative_prompt (`str` or `List[str]`, *optional*): - The prompt or prompts to guide what to not include in image generation. If not defined, you need to - pass `negative_prompt_embeds` instead. Ignored when not using guidance (`guidance_scale < 1`). - num_images_per_prompt (`int`, *optional*, defaults to 1): - The number of images to generate per prompt. - eta (`float`, *optional*, defaults to 0.0): - Corresponds to parameter eta (η) from the [DDIM](https://arxiv.org/abs/2010.02502) paper. Only applies - to the [`~schedulers.DDIMScheduler`], and is ignored in other schedulers. - generator (`torch.Generator`, *optional*): - A [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html) to make - generation deterministic. - latents (`torch.FloatTensor`, *optional*): - Pre-generated noisy latents sampled from a Gaussian distribution, to be used as inputs for image - generation. Can be used to tweak the same generation with different prompts. If not provided, a latents - tensor is generated by sampling using the supplied random `generator`. - prompt_embeds (`torch.FloatTensor`, *optional*): - Pre-generated text embeddings. Can be used to easily tweak text inputs (prompt weighting). If not - provided, text embeddings are generated from the `prompt` input argument. - negative_prompt_embeds (`torch.FloatTensor`, *optional*): - Pre-generated negative text embeddings. Can be used to easily tweak text inputs (prompt weighting). If - not provided, `negative_prompt_embeds` are generated from the `negative_prompt` input argument. - output_type (`str`, *optional*, defaults to `"pil"`): - The output format of the generated image. Choose between `PIL.Image` or `np.array`. - return_dict (`bool`, *optional*, defaults to `True`): - Whether or not to return a [`~pipelines.stable_diffusion.StableDiffusionPipelineOutput`] instead of a - plain tuple. - callback (`Callable`, *optional*): - A function that calls every `callback_steps` steps during inference. The function is called with the - following arguments: `callback(step: int, timestep: int, latents: torch.FloatTensor)`. - callback_steps (`int`, *optional*, defaults to 1): - The frequency at which the `callback` function is called. If not specified, the callback is called at - every step. - cross_attention_kwargs (`dict`, *optional*): - A kwargs dictionary that if specified is passed along to the [`AttentionProcessor`] as defined in - [`self.processor`](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/cross_attention.py). - - Examples: - - Returns: - [`~pipelines.stable_diffusion.StableDiffusionPipelineOutput`] or `tuple`: - If `return_dict` is `True`, [`~pipelines.stable_diffusion.StableDiffusionPipelineOutput`] is returned, - otherwise a `tuple` is returned where the first element is a list with the generated images and the - second element is a list of `bool`s indicating whether the corresponding generated image contains - "not-safe-for-work" (nsfw) content. - """ - - # 1. Check inputs - self.check_inputs( - prompt, - inpaint_strength, - callback_steps, - negative_prompt, - prompt_embeds, - negative_prompt_embeds, - ) - - if mask_image is None: - raise ValueError( - "`mask_image` input cannot be undefined. Use `generate_mask()` to compute `mask_image` from text prompts." - ) - if image_latents is None: - raise ValueError( - "`image_latents` input cannot be undefined. Use `invert()` to compute `image_latents` from input images." - ) - - # 2. Define call parameters - if prompt is not None and isinstance(prompt, str): - batch_size = 1 - elif prompt is not None and isinstance(prompt, list): - batch_size = len(prompt) - else: - batch_size = prompt_embeds.shape[0] - if cross_attention_kwargs is None: - cross_attention_kwargs = {} - - device = self._execution_device - # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2) - # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1` - # corresponds to doing no classifier free guidance. - do_classifier_free_guidance = guidance_scale > 1.0 - - # 3. Encode input prompt - text_encoder_lora_scale = ( - cross_attention_kwargs.get("scale", None) if cross_attention_kwargs is not None else None - ) - prompt_embeds = self._encode_prompt( - prompt, - device, - num_images_per_prompt, - do_classifier_free_guidance, - negative_prompt, - prompt_embeds=prompt_embeds, - negative_prompt_embeds=negative_prompt_embeds, - lora_scale=text_encoder_lora_scale, - ) - - # 4. Preprocess mask - mask_image = preprocess_mask(mask_image, batch_size) - latent_height, latent_width = mask_image.shape[-2:] - mask_image = torch.cat([mask_image] * num_images_per_prompt) - mask_image = mask_image.to(device=device, dtype=prompt_embeds.dtype) - - # 5. Set timesteps - self.scheduler.set_timesteps(num_inference_steps, device=device) - timesteps, num_inference_steps = self.get_timesteps(num_inference_steps, inpaint_strength, device) - - # 6. Preprocess image latents - if isinstance(image_latents, list) and any(isinstance(l, torch.Tensor) and l.ndim == 5 for l in image_latents): - image_latents = torch.cat(image_latents).detach() - elif isinstance(image_latents, torch.Tensor) and image_latents.ndim == 5: - image_latents = image_latents.detach() - else: - image_latents = self.image_processor.preprocess(image_latents).detach() - - latent_shape = (self.vae.config.latent_channels, latent_height, latent_width) - if image_latents.shape[-3:] != latent_shape: - raise ValueError( - f"Each latent image in `image_latents` must have shape {latent_shape}, " - f"but has shape {image_latents.shape[-3:]}" - ) - if image_latents.ndim == 4: - image_latents = image_latents.reshape(batch_size, len(timesteps), *latent_shape) - if image_latents.shape[:2] != (batch_size, len(timesteps)): - raise ValueError( - f"`image_latents` must have batch size {batch_size} with latent images from {len(timesteps)}" - f" timesteps, but has batch size {image_latents.shape[0]} with latent images from" - f" {image_latents.shape[1]} timesteps." - ) - image_latents = image_latents.transpose(0, 1).repeat_interleave(num_images_per_prompt, dim=1) - image_latents = image_latents.to(device=device, dtype=prompt_embeds.dtype) - - # 7. Prepare extra step kwargs. TODO: Logic should ideally just be moved out of the pipeline - extra_step_kwargs = self.prepare_extra_step_kwargs(generator, eta) - - # 8. Denoising loop - latents = image_latents[0].clone() - num_warmup_steps = len(timesteps) - num_inference_steps * self.scheduler.order - with self.progress_bar(total=num_inference_steps) as progress_bar: - for i, t in enumerate(timesteps): - # expand the latents if we are doing classifier free guidance - latent_model_input = torch.cat([latents] * 2) if do_classifier_free_guidance else latents - latent_model_input = self.scheduler.scale_model_input(latent_model_input, t) - - # predict the noise residual - noise_pred = self.unet( - latent_model_input, - t, - encoder_hidden_states=prompt_embeds, - cross_attention_kwargs=cross_attention_kwargs, - ).sample - - # perform guidance - if do_classifier_free_guidance: - noise_pred_uncond, noise_pred_text = noise_pred.chunk(2) - noise_pred = noise_pred_uncond + guidance_scale * (noise_pred_text - noise_pred_uncond) - - # compute the previous noisy sample x_t -> x_t-1 - latents = self.scheduler.step(noise_pred, t, latents, **extra_step_kwargs).prev_sample - - # mask with inverted latents from appropriate timestep - use original image latent for last step - latents = latents * mask_image + image_latents[i] * (1 - mask_image) - - # call the callback, if provided - if i == len(timesteps) - 1 or ((i + 1) > num_warmup_steps and (i + 1) % self.scheduler.order == 0): - progress_bar.update() - if callback is not None and i % callback_steps == 0: - callback(i, t, latents) - - if not output_type == "latent": - image = self.vae.decode(latents / self.vae.config.scaling_factor, return_dict=False)[0] - image, has_nsfw_concept = self.run_safety_checker(image, device, prompt_embeds.dtype) - else: - image = latents - has_nsfw_concept = None - - if has_nsfw_concept is None: - do_denormalize = [True] * image.shape[0] - else: - do_denormalize = [not has_nsfw for has_nsfw in has_nsfw_concept] - - image = self.image_processor.postprocess(image, output_type=output_type, do_denormalize=do_denormalize) - - # Offload last model to CPU - if hasattr(self, "final_offload_hook") and self.final_offload_hook is not None: - self.final_offload_hook.offload() - - if not return_dict: - return (image, has_nsfw_concept) - - return StableDiffusionPipelineOutput(images=image, nsfw_content_detected=has_nsfw_concept) diff --git a/spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/tests/schedulers/test_scheduler_flax.py b/spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/tests/schedulers/test_scheduler_flax.py deleted file mode 100644 index 8f7ad59d285eb50a42ab5809ce60dd0bf26e026c..0000000000000000000000000000000000000000 --- a/spaces/Androidonnxfork/CivitAi-to-Diffusers/diffusers/tests/schedulers/test_scheduler_flax.py +++ /dev/null @@ -1,919 +0,0 @@ -# coding=utf-8 -# Copyright 2023 HuggingFace Inc. -# -# 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. -import inspect -import tempfile -import unittest -from typing import Dict, List, Tuple - -from diffusers import FlaxDDIMScheduler, FlaxDDPMScheduler, FlaxPNDMScheduler -from diffusers.utils import is_flax_available -from diffusers.utils.testing_utils import require_flax - - -if is_flax_available(): - import jax - import jax.numpy as jnp - from jax import random - - jax_device = jax.default_backend() - - -@require_flax -class FlaxSchedulerCommonTest(unittest.TestCase): - scheduler_classes = () - forward_default_kwargs = () - - @property - def dummy_sample(self): - batch_size = 4 - num_channels = 3 - height = 8 - width = 8 - - key1, key2 = random.split(random.PRNGKey(0)) - sample = random.uniform(key1, (batch_size, num_channels, height, width)) - - return sample, key2 - - @property - def dummy_sample_deter(self): - batch_size = 4 - num_channels = 3 - height = 8 - width = 8 - - num_elems = batch_size * num_channels * height * width - sample = jnp.arange(num_elems) - sample = sample.reshape(num_channels, height, width, batch_size) - sample = sample / num_elems - return jnp.transpose(sample, (3, 0, 1, 2)) - - def get_scheduler_config(self): - raise NotImplementedError - - def dummy_model(self): - def model(sample, t, *args): - return sample * t / (t + 1) - - return model - - def check_over_configs(self, time_step=0, **config): - kwargs = dict(self.forward_default_kwargs) - - num_inference_steps = kwargs.pop("num_inference_steps", None) - - for scheduler_class in self.scheduler_classes: - sample, key = self.dummy_sample - residual = 0.1 * sample - - scheduler_config = self.get_scheduler_config(**config) - scheduler = scheduler_class(**scheduler_config) - state = scheduler.create_state() - - with tempfile.TemporaryDirectory() as tmpdirname: - scheduler.save_config(tmpdirname) - new_scheduler, new_state = scheduler_class.from_pretrained(tmpdirname) - - if num_inference_steps is not None and hasattr(scheduler, "set_timesteps"): - state = scheduler.set_timesteps(state, num_inference_steps) - new_state = new_scheduler.set_timesteps(new_state, num_inference_steps) - elif num_inference_steps is not None and not hasattr(scheduler, "set_timesteps"): - kwargs["num_inference_steps"] = num_inference_steps - - output = scheduler.step(state, residual, time_step, sample, key, **kwargs).prev_sample - new_output = new_scheduler.step(new_state, residual, time_step, sample, key, **kwargs).prev_sample - - assert jnp.sum(jnp.abs(output - new_output)) < 1e-5, "Scheduler outputs are not identical" - - def check_over_forward(self, time_step=0, **forward_kwargs): - kwargs = dict(self.forward_default_kwargs) - kwargs.update(forward_kwargs) - - num_inference_steps = kwargs.pop("num_inference_steps", None) - - for scheduler_class in self.scheduler_classes: - sample, key = self.dummy_sample - residual = 0.1 * sample - - scheduler_config = self.get_scheduler_config() - scheduler = scheduler_class(**scheduler_config) - state = scheduler.create_state() - - with tempfile.TemporaryDirectory() as tmpdirname: - scheduler.save_config(tmpdirname) - new_scheduler, new_state = scheduler_class.from_pretrained(tmpdirname) - - if num_inference_steps is not None and hasattr(scheduler, "set_timesteps"): - state = scheduler.set_timesteps(state, num_inference_steps) - new_state = new_scheduler.set_timesteps(new_state, num_inference_steps) - elif num_inference_steps is not None and not hasattr(scheduler, "set_timesteps"): - kwargs["num_inference_steps"] = num_inference_steps - - output = scheduler.step(state, residual, time_step, sample, key, **kwargs).prev_sample - new_output = new_scheduler.step(new_state, residual, time_step, sample, key, **kwargs).prev_sample - - assert jnp.sum(jnp.abs(output - new_output)) < 1e-5, "Scheduler outputs are not identical" - - def test_from_save_pretrained(self): - kwargs = dict(self.forward_default_kwargs) - - num_inference_steps = kwargs.pop("num_inference_steps", None) - - for scheduler_class in self.scheduler_classes: - sample, key = self.dummy_sample - residual = 0.1 * sample - - scheduler_config = self.get_scheduler_config() - scheduler = scheduler_class(**scheduler_config) - state = scheduler.create_state() - - with tempfile.TemporaryDirectory() as tmpdirname: - scheduler.save_config(tmpdirname) - new_scheduler, new_state = scheduler_class.from_pretrained(tmpdirname) - - if num_inference_steps is not None and hasattr(scheduler, "set_timesteps"): - state = scheduler.set_timesteps(state, num_inference_steps) - new_state = new_scheduler.set_timesteps(new_state, num_inference_steps) - elif num_inference_steps is not None and not hasattr(scheduler, "set_timesteps"): - kwargs["num_inference_steps"] = num_inference_steps - - output = scheduler.step(state, residual, 1, sample, key, **kwargs).prev_sample - new_output = new_scheduler.step(new_state, residual, 1, sample, key, **kwargs).prev_sample - - assert jnp.sum(jnp.abs(output - new_output)) < 1e-5, "Scheduler outputs are not identical" - - def test_step_shape(self): - kwargs = dict(self.forward_default_kwargs) - - num_inference_steps = kwargs.pop("num_inference_steps", None) - - for scheduler_class in self.scheduler_classes: - scheduler_config = self.get_scheduler_config() - scheduler = scheduler_class(**scheduler_config) - state = scheduler.create_state() - - sample, key = self.dummy_sample - residual = 0.1 * sample - - if num_inference_steps is not None and hasattr(scheduler, "set_timesteps"): - state = scheduler.set_timesteps(state, num_inference_steps) - elif num_inference_steps is not None and not hasattr(scheduler, "set_timesteps"): - kwargs["num_inference_steps"] = num_inference_steps - - output_0 = scheduler.step(state, residual, 0, sample, key, **kwargs).prev_sample - output_1 = scheduler.step(state, residual, 1, sample, key, **kwargs).prev_sample - - self.assertEqual(output_0.shape, sample.shape) - self.assertEqual(output_0.shape, output_1.shape) - - def test_scheduler_outputs_equivalence(self): - def set_nan_tensor_to_zero(t): - return t.at[t != t].set(0) - - def recursive_check(tuple_object, dict_object): - if isinstance(tuple_object, (List, Tuple)): - for tuple_iterable_value, dict_iterable_value in zip(tuple_object, dict_object.values()): - recursive_check(tuple_iterable_value, dict_iterable_value) - elif isinstance(tuple_object, Dict): - for tuple_iterable_value, dict_iterable_value in zip(tuple_object.values(), dict_object.values()): - recursive_check(tuple_iterable_value, dict_iterable_value) - elif tuple_object is None: - return - else: - self.assertTrue( - jnp.allclose(set_nan_tensor_to_zero(tuple_object), set_nan_tensor_to_zero(dict_object), atol=1e-5), - msg=( - "Tuple and dict output are not equal. Difference:" - f" {jnp.max(jnp.abs(tuple_object - dict_object))}. Tuple has `nan`:" - f" {jnp.isnan(tuple_object).any()} and `inf`: {jnp.isinf(tuple_object)}. Dict has" - f" `nan`: {jnp.isnan(dict_object).any()} and `inf`: {jnp.isinf(dict_object)}." - ), - ) - - kwargs = dict(self.forward_default_kwargs) - num_inference_steps = kwargs.pop("num_inference_steps", None) - - for scheduler_class in self.scheduler_classes: - scheduler_config = self.get_scheduler_config() - scheduler = scheduler_class(**scheduler_config) - state = scheduler.create_state() - - sample, key = self.dummy_sample - residual = 0.1 * sample - - if num_inference_steps is not None and hasattr(scheduler, "set_timesteps"): - state = scheduler.set_timesteps(state, num_inference_steps) - elif num_inference_steps is not None and not hasattr(scheduler, "set_timesteps"): - kwargs["num_inference_steps"] = num_inference_steps - - outputs_dict = scheduler.step(state, residual, 0, sample, key, **kwargs) - - if num_inference_steps is not None and hasattr(scheduler, "set_timesteps"): - state = scheduler.set_timesteps(state, num_inference_steps) - elif num_inference_steps is not None and not hasattr(scheduler, "set_timesteps"): - kwargs["num_inference_steps"] = num_inference_steps - - outputs_tuple = scheduler.step(state, residual, 0, sample, key, return_dict=False, **kwargs) - - recursive_check(outputs_tuple[0], outputs_dict.prev_sample) - - def test_deprecated_kwargs(self): - for scheduler_class in self.scheduler_classes: - has_kwarg_in_model_class = "kwargs" in inspect.signature(scheduler_class.__init__).parameters - has_deprecated_kwarg = len(scheduler_class._deprecated_kwargs) > 0 - - if has_kwarg_in_model_class and not has_deprecated_kwarg: - raise ValueError( - f"{scheduler_class} has `**kwargs` in its __init__ method but has not defined any deprecated" - " kwargs under the `_deprecated_kwargs` class attribute. Make sure to either remove `**kwargs` if" - " there are no deprecated arguments or add the deprecated argument with `_deprecated_kwargs =" - " []`" - ) - - if not has_kwarg_in_model_class and has_deprecated_kwarg: - raise ValueError( - f"{scheduler_class} doesn't have `**kwargs` in its __init__ method but has defined deprecated" - " kwargs under the `_deprecated_kwargs` class attribute. Make sure to either add the `**kwargs`" - f" argument to {self.model_class}.__init__ if there are deprecated arguments or remove the" - " deprecated argument from `_deprecated_kwargs = []`" - ) - - -@require_flax -class FlaxDDPMSchedulerTest(FlaxSchedulerCommonTest): - scheduler_classes = (FlaxDDPMScheduler,) - - def get_scheduler_config(self, **kwargs): - config = { - "num_train_timesteps": 1000, - "beta_start": 0.0001, - "beta_end": 0.02, - "beta_schedule": "linear", - "variance_type": "fixed_small", - "clip_sample": True, - } - - config.update(**kwargs) - return config - - def test_timesteps(self): - for timesteps in [1, 5, 100, 1000]: - self.check_over_configs(num_train_timesteps=timesteps) - - def test_betas(self): - for beta_start, beta_end in zip([0.0001, 0.001, 0.01, 0.1], [0.002, 0.02, 0.2, 2]): - self.check_over_configs(beta_start=beta_start, beta_end=beta_end) - - def test_schedules(self): - for schedule in ["linear", "squaredcos_cap_v2"]: - self.check_over_configs(beta_schedule=schedule) - - def test_variance_type(self): - for variance in ["fixed_small", "fixed_large", "other"]: - self.check_over_configs(variance_type=variance) - - def test_clip_sample(self): - for clip_sample in [True, False]: - self.check_over_configs(clip_sample=clip_sample) - - def test_time_indices(self): - for t in [0, 500, 999]: - self.check_over_forward(time_step=t) - - def test_variance(self): - scheduler_class = self.scheduler_classes[0] - scheduler_config = self.get_scheduler_config() - scheduler = scheduler_class(**scheduler_config) - state = scheduler.create_state() - - assert jnp.sum(jnp.abs(scheduler._get_variance(state, 0) - 0.0)) < 1e-5 - assert jnp.sum(jnp.abs(scheduler._get_variance(state, 487) - 0.00979)) < 1e-5 - assert jnp.sum(jnp.abs(scheduler._get_variance(state, 999) - 0.02)) < 1e-5 - - def test_full_loop_no_noise(self): - scheduler_class = self.scheduler_classes[0] - scheduler_config = self.get_scheduler_config() - scheduler = scheduler_class(**scheduler_config) - state = scheduler.create_state() - - num_trained_timesteps = len(scheduler) - - model = self.dummy_model() - sample = self.dummy_sample_deter - key1, key2 = random.split(random.PRNGKey(0)) - - for t in reversed(range(num_trained_timesteps)): - # 1. predict noise residual - residual = model(sample, t) - - # 2. predict previous mean of sample x_t-1 - output = scheduler.step(state, residual, t, sample, key1) - pred_prev_sample = output.prev_sample - state = output.state - key1, key2 = random.split(key2) - - # if t > 0: - # noise = self.dummy_sample_deter - # variance = scheduler.get_variance(t) ** (0.5) * noise - # - # sample = pred_prev_sample + variance - sample = pred_prev_sample - - result_sum = jnp.sum(jnp.abs(sample)) - result_mean = jnp.mean(jnp.abs(sample)) - - if jax_device == "tpu": - assert abs(result_sum - 255.0714) < 1e-2 - assert abs(result_mean - 0.332124) < 1e-3 - else: - assert abs(result_sum - 255.1113) < 1e-2 - assert abs(result_mean - 0.332176) < 1e-3 - - -@require_flax -class FlaxDDIMSchedulerTest(FlaxSchedulerCommonTest): - scheduler_classes = (FlaxDDIMScheduler,) - forward_default_kwargs = (("num_inference_steps", 50),) - - def get_scheduler_config(self, **kwargs): - config = { - "num_train_timesteps": 1000, - "beta_start": 0.0001, - "beta_end": 0.02, - "beta_schedule": "linear", - } - - config.update(**kwargs) - return config - - def full_loop(self, **config): - scheduler_class = self.scheduler_classes[0] - scheduler_config = self.get_scheduler_config(**config) - scheduler = scheduler_class(**scheduler_config) - state = scheduler.create_state() - key1, key2 = random.split(random.PRNGKey(0)) - - num_inference_steps = 10 - - model = self.dummy_model() - sample = self.dummy_sample_deter - - state = scheduler.set_timesteps(state, num_inference_steps) - - for t in state.timesteps: - residual = model(sample, t) - output = scheduler.step(state, residual, t, sample) - sample = output.prev_sample - state = output.state - key1, key2 = random.split(key2) - - return sample - - def check_over_configs(self, time_step=0, **config): - kwargs = dict(self.forward_default_kwargs) - - num_inference_steps = kwargs.pop("num_inference_steps", None) - - for scheduler_class in self.scheduler_classes: - sample, _ = self.dummy_sample - residual = 0.1 * sample - - scheduler_config = self.get_scheduler_config(**config) - scheduler = scheduler_class(**scheduler_config) - state = scheduler.create_state() - - with tempfile.TemporaryDirectory() as tmpdirname: - scheduler.save_config(tmpdirname) - new_scheduler, new_state = scheduler_class.from_pretrained(tmpdirname) - - if num_inference_steps is not None and hasattr(scheduler, "set_timesteps"): - state = scheduler.set_timesteps(state, num_inference_steps) - new_state = new_scheduler.set_timesteps(new_state, num_inference_steps) - elif num_inference_steps is not None and not hasattr(scheduler, "set_timesteps"): - kwargs["num_inference_steps"] = num_inference_steps - - output = scheduler.step(state, residual, time_step, sample, **kwargs).prev_sample - new_output = new_scheduler.step(new_state, residual, time_step, sample, **kwargs).prev_sample - - assert jnp.sum(jnp.abs(output - new_output)) < 1e-5, "Scheduler outputs are not identical" - - def test_from_save_pretrained(self): - kwargs = dict(self.forward_default_kwargs) - - num_inference_steps = kwargs.pop("num_inference_steps", None) - - for scheduler_class in self.scheduler_classes: - sample, _ = self.dummy_sample - residual = 0.1 * sample - - scheduler_config = self.get_scheduler_config() - scheduler = scheduler_class(**scheduler_config) - state = scheduler.create_state() - - with tempfile.TemporaryDirectory() as tmpdirname: - scheduler.save_config(tmpdirname) - new_scheduler, new_state = scheduler_class.from_pretrained(tmpdirname) - - if num_inference_steps is not None and hasattr(scheduler, "set_timesteps"): - state = scheduler.set_timesteps(state, num_inference_steps) - new_state = new_scheduler.set_timesteps(new_state, num_inference_steps) - elif num_inference_steps is not None and not hasattr(scheduler, "set_timesteps"): - kwargs["num_inference_steps"] = num_inference_steps - - output = scheduler.step(state, residual, 1, sample, **kwargs).prev_sample - new_output = new_scheduler.step(new_state, residual, 1, sample, **kwargs).prev_sample - - assert jnp.sum(jnp.abs(output - new_output)) < 1e-5, "Scheduler outputs are not identical" - - def check_over_forward(self, time_step=0, **forward_kwargs): - kwargs = dict(self.forward_default_kwargs) - kwargs.update(forward_kwargs) - - num_inference_steps = kwargs.pop("num_inference_steps", None) - - for scheduler_class in self.scheduler_classes: - sample, _ = self.dummy_sample - residual = 0.1 * sample - - scheduler_config = self.get_scheduler_config() - scheduler = scheduler_class(**scheduler_config) - state = scheduler.create_state() - - with tempfile.TemporaryDirectory() as tmpdirname: - scheduler.save_config(tmpdirname) - new_scheduler, new_state = scheduler_class.from_pretrained(tmpdirname) - - if num_inference_steps is not None and hasattr(scheduler, "set_timesteps"): - state = scheduler.set_timesteps(state, num_inference_steps) - new_state = new_scheduler.set_timesteps(new_state, num_inference_steps) - elif num_inference_steps is not None and not hasattr(scheduler, "set_timesteps"): - kwargs["num_inference_steps"] = num_inference_steps - - output = scheduler.step(state, residual, time_step, sample, **kwargs).prev_sample - new_output = new_scheduler.step(new_state, residual, time_step, sample, **kwargs).prev_sample - - assert jnp.sum(jnp.abs(output - new_output)) < 1e-5, "Scheduler outputs are not identical" - - def test_scheduler_outputs_equivalence(self): - def set_nan_tensor_to_zero(t): - return t.at[t != t].set(0) - - def recursive_check(tuple_object, dict_object): - if isinstance(tuple_object, (List, Tuple)): - for tuple_iterable_value, dict_iterable_value in zip(tuple_object, dict_object.values()): - recursive_check(tuple_iterable_value, dict_iterable_value) - elif isinstance(tuple_object, Dict): - for tuple_iterable_value, dict_iterable_value in zip(tuple_object.values(), dict_object.values()): - recursive_check(tuple_iterable_value, dict_iterable_value) - elif tuple_object is None: - return - else: - self.assertTrue( - jnp.allclose(set_nan_tensor_to_zero(tuple_object), set_nan_tensor_to_zero(dict_object), atol=1e-5), - msg=( - "Tuple and dict output are not equal. Difference:" - f" {jnp.max(jnp.abs(tuple_object - dict_object))}. Tuple has `nan`:" - f" {jnp.isnan(tuple_object).any()} and `inf`: {jnp.isinf(tuple_object)}. Dict has" - f" `nan`: {jnp.isnan(dict_object).any()} and `inf`: {jnp.isinf(dict_object)}." - ), - ) - - kwargs = dict(self.forward_default_kwargs) - num_inference_steps = kwargs.pop("num_inference_steps", None) - - for scheduler_class in self.scheduler_classes: - scheduler_config = self.get_scheduler_config() - scheduler = scheduler_class(**scheduler_config) - state = scheduler.create_state() - - sample, _ = self.dummy_sample - residual = 0.1 * sample - - if num_inference_steps is not None and hasattr(scheduler, "set_timesteps"): - state = scheduler.set_timesteps(state, num_inference_steps) - elif num_inference_steps is not None and not hasattr(scheduler, "set_timesteps"): - kwargs["num_inference_steps"] = num_inference_steps - - outputs_dict = scheduler.step(state, residual, 0, sample, **kwargs) - - if num_inference_steps is not None and hasattr(scheduler, "set_timesteps"): - state = scheduler.set_timesteps(state, num_inference_steps) - elif num_inference_steps is not None and not hasattr(scheduler, "set_timesteps"): - kwargs["num_inference_steps"] = num_inference_steps - - outputs_tuple = scheduler.step(state, residual, 0, sample, return_dict=False, **kwargs) - - recursive_check(outputs_tuple[0], outputs_dict.prev_sample) - - def test_step_shape(self): - kwargs = dict(self.forward_default_kwargs) - - num_inference_steps = kwargs.pop("num_inference_steps", None) - - for scheduler_class in self.scheduler_classes: - scheduler_config = self.get_scheduler_config() - scheduler = scheduler_class(**scheduler_config) - state = scheduler.create_state() - - sample, _ = self.dummy_sample - residual = 0.1 * sample - - if num_inference_steps is not None and hasattr(scheduler, "set_timesteps"): - state = scheduler.set_timesteps(state, num_inference_steps) - elif num_inference_steps is not None and not hasattr(scheduler, "set_timesteps"): - kwargs["num_inference_steps"] = num_inference_steps - - output_0 = scheduler.step(state, residual, 0, sample, **kwargs).prev_sample - output_1 = scheduler.step(state, residual, 1, sample, **kwargs).prev_sample - - self.assertEqual(output_0.shape, sample.shape) - self.assertEqual(output_0.shape, output_1.shape) - - def test_timesteps(self): - for timesteps in [100, 500, 1000]: - self.check_over_configs(num_train_timesteps=timesteps) - - def test_steps_offset(self): - for steps_offset in [0, 1]: - self.check_over_configs(steps_offset=steps_offset) - - scheduler_class = self.scheduler_classes[0] - scheduler_config = self.get_scheduler_config(steps_offset=1) - scheduler = scheduler_class(**scheduler_config) - state = scheduler.create_state() - state = scheduler.set_timesteps(state, 5) - assert jnp.equal(state.timesteps, jnp.array([801, 601, 401, 201, 1])).all() - - def test_betas(self): - for beta_start, beta_end in zip([0.0001, 0.001, 0.01, 0.1], [0.002, 0.02, 0.2, 2]): - self.check_over_configs(beta_start=beta_start, beta_end=beta_end) - - def test_schedules(self): - for schedule in ["linear", "squaredcos_cap_v2"]: - self.check_over_configs(beta_schedule=schedule) - - def test_time_indices(self): - for t in [1, 10, 49]: - self.check_over_forward(time_step=t) - - def test_inference_steps(self): - for t, num_inference_steps in zip([1, 10, 50], [10, 50, 500]): - self.check_over_forward(time_step=t, num_inference_steps=num_inference_steps) - - def test_variance(self): - scheduler_class = self.scheduler_classes[0] - scheduler_config = self.get_scheduler_config() - scheduler = scheduler_class(**scheduler_config) - state = scheduler.create_state() - - assert jnp.sum(jnp.abs(scheduler._get_variance(state, 0, 0) - 0.0)) < 1e-5 - assert jnp.sum(jnp.abs(scheduler._get_variance(state, 420, 400) - 0.14771)) < 1e-5 - assert jnp.sum(jnp.abs(scheduler._get_variance(state, 980, 960) - 0.32460)) < 1e-5 - assert jnp.sum(jnp.abs(scheduler._get_variance(state, 0, 0) - 0.0)) < 1e-5 - assert jnp.sum(jnp.abs(scheduler._get_variance(state, 487, 486) - 0.00979)) < 1e-5 - assert jnp.sum(jnp.abs(scheduler._get_variance(state, 999, 998) - 0.02)) < 1e-5 - - def test_full_loop_no_noise(self): - sample = self.full_loop() - - result_sum = jnp.sum(jnp.abs(sample)) - result_mean = jnp.mean(jnp.abs(sample)) - - assert abs(result_sum - 172.0067) < 1e-2 - assert abs(result_mean - 0.223967) < 1e-3 - - def test_full_loop_with_set_alpha_to_one(self): - # We specify different beta, so that the first alpha is 0.99 - sample = self.full_loop(set_alpha_to_one=True, beta_start=0.01) - result_sum = jnp.sum(jnp.abs(sample)) - result_mean = jnp.mean(jnp.abs(sample)) - - if jax_device == "tpu": - assert abs(result_sum - 149.8409) < 1e-2 - assert abs(result_mean - 0.1951) < 1e-3 - else: - assert abs(result_sum - 149.8295) < 1e-2 - assert abs(result_mean - 0.1951) < 1e-3 - - def test_full_loop_with_no_set_alpha_to_one(self): - # We specify different beta, so that the first alpha is 0.99 - sample = self.full_loop(set_alpha_to_one=False, beta_start=0.01) - result_sum = jnp.sum(jnp.abs(sample)) - result_mean = jnp.mean(jnp.abs(sample)) - - if jax_device == "tpu": - pass - # FIXME: both result_sum and result_mean are nan on TPU - # assert jnp.isnan(result_sum) - # assert jnp.isnan(result_mean) - else: - assert abs(result_sum - 149.0784) < 1e-2 - assert abs(result_mean - 0.1941) < 1e-3 - - def test_prediction_type(self): - for prediction_type in ["epsilon", "sample", "v_prediction"]: - self.check_over_configs(prediction_type=prediction_type) - - -@require_flax -class FlaxPNDMSchedulerTest(FlaxSchedulerCommonTest): - scheduler_classes = (FlaxPNDMScheduler,) - forward_default_kwargs = (("num_inference_steps", 50),) - - def get_scheduler_config(self, **kwargs): - config = { - "num_train_timesteps": 1000, - "beta_start": 0.0001, - "beta_end": 0.02, - "beta_schedule": "linear", - } - - config.update(**kwargs) - return config - - def check_over_configs(self, time_step=0, **config): - kwargs = dict(self.forward_default_kwargs) - num_inference_steps = kwargs.pop("num_inference_steps", None) - sample, _ = self.dummy_sample - residual = 0.1 * sample - dummy_past_residuals = jnp.array([residual + 0.2, residual + 0.15, residual + 0.1, residual + 0.05]) - - for scheduler_class in self.scheduler_classes: - scheduler_config = self.get_scheduler_config(**config) - scheduler = scheduler_class(**scheduler_config) - state = scheduler.create_state() - state = scheduler.set_timesteps(state, num_inference_steps, shape=sample.shape) - # copy over dummy past residuals - state = state.replace(ets=dummy_past_residuals[:]) - - with tempfile.TemporaryDirectory() as tmpdirname: - scheduler.save_config(tmpdirname) - new_scheduler, new_state = scheduler_class.from_pretrained(tmpdirname) - new_state = new_scheduler.set_timesteps(new_state, num_inference_steps, shape=sample.shape) - # copy over dummy past residuals - new_state = new_state.replace(ets=dummy_past_residuals[:]) - - (prev_sample, state) = scheduler.step_prk(state, residual, time_step, sample, **kwargs) - (new_prev_sample, new_state) = new_scheduler.step_prk(new_state, residual, time_step, sample, **kwargs) - - assert jnp.sum(jnp.abs(prev_sample - new_prev_sample)) < 1e-5, "Scheduler outputs are not identical" - - output, _ = scheduler.step_plms(state, residual, time_step, sample, **kwargs) - new_output, _ = new_scheduler.step_plms(new_state, residual, time_step, sample, **kwargs) - - assert jnp.sum(jnp.abs(output - new_output)) < 1e-5, "Scheduler outputs are not identical" - - def test_from_save_pretrained(self): - pass - - def test_scheduler_outputs_equivalence(self): - def set_nan_tensor_to_zero(t): - return t.at[t != t].set(0) - - def recursive_check(tuple_object, dict_object): - if isinstance(tuple_object, (List, Tuple)): - for tuple_iterable_value, dict_iterable_value in zip(tuple_object, dict_object.values()): - recursive_check(tuple_iterable_value, dict_iterable_value) - elif isinstance(tuple_object, Dict): - for tuple_iterable_value, dict_iterable_value in zip(tuple_object.values(), dict_object.values()): - recursive_check(tuple_iterable_value, dict_iterable_value) - elif tuple_object is None: - return - else: - self.assertTrue( - jnp.allclose(set_nan_tensor_to_zero(tuple_object), set_nan_tensor_to_zero(dict_object), atol=1e-5), - msg=( - "Tuple and dict output are not equal. Difference:" - f" {jnp.max(jnp.abs(tuple_object - dict_object))}. Tuple has `nan`:" - f" {jnp.isnan(tuple_object).any()} and `inf`: {jnp.isinf(tuple_object)}. Dict has" - f" `nan`: {jnp.isnan(dict_object).any()} and `inf`: {jnp.isinf(dict_object)}." - ), - ) - - kwargs = dict(self.forward_default_kwargs) - num_inference_steps = kwargs.pop("num_inference_steps", None) - - for scheduler_class in self.scheduler_classes: - scheduler_config = self.get_scheduler_config() - scheduler = scheduler_class(**scheduler_config) - state = scheduler.create_state() - - sample, _ = self.dummy_sample - residual = 0.1 * sample - - if num_inference_steps is not None and hasattr(scheduler, "set_timesteps"): - state = scheduler.set_timesteps(state, num_inference_steps, shape=sample.shape) - elif num_inference_steps is not None and not hasattr(scheduler, "set_timesteps"): - kwargs["num_inference_steps"] = num_inference_steps - - outputs_dict = scheduler.step(state, residual, 0, sample, **kwargs) - - if num_inference_steps is not None and hasattr(scheduler, "set_timesteps"): - state = scheduler.set_timesteps(state, num_inference_steps, shape=sample.shape) - elif num_inference_steps is not None and not hasattr(scheduler, "set_timesteps"): - kwargs["num_inference_steps"] = num_inference_steps - - outputs_tuple = scheduler.step(state, residual, 0, sample, return_dict=False, **kwargs) - - recursive_check(outputs_tuple[0], outputs_dict.prev_sample) - - def check_over_forward(self, time_step=0, **forward_kwargs): - kwargs = dict(self.forward_default_kwargs) - num_inference_steps = kwargs.pop("num_inference_steps", None) - sample, _ = self.dummy_sample - residual = 0.1 * sample - dummy_past_residuals = jnp.array([residual + 0.2, residual + 0.15, residual + 0.1, residual + 0.05]) - - for scheduler_class in self.scheduler_classes: - scheduler_config = self.get_scheduler_config() - scheduler = scheduler_class(**scheduler_config) - state = scheduler.create_state() - state = scheduler.set_timesteps(state, num_inference_steps, shape=sample.shape) - - # copy over dummy past residuals (must be after setting timesteps) - scheduler.ets = dummy_past_residuals[:] - - with tempfile.TemporaryDirectory() as tmpdirname: - scheduler.save_config(tmpdirname) - new_scheduler, new_state = scheduler_class.from_pretrained(tmpdirname) - # copy over dummy past residuals - new_state = new_scheduler.set_timesteps(new_state, num_inference_steps, shape=sample.shape) - - # copy over dummy past residual (must be after setting timesteps) - new_state.replace(ets=dummy_past_residuals[:]) - - output, state = scheduler.step_prk(state, residual, time_step, sample, **kwargs) - new_output, new_state = new_scheduler.step_prk(new_state, residual, time_step, sample, **kwargs) - - assert jnp.sum(jnp.abs(output - new_output)) < 1e-5, "Scheduler outputs are not identical" - - output, _ = scheduler.step_plms(state, residual, time_step, sample, **kwargs) - new_output, _ = new_scheduler.step_plms(new_state, residual, time_step, sample, **kwargs) - - assert jnp.sum(jnp.abs(output - new_output)) < 1e-5, "Scheduler outputs are not identical" - - def full_loop(self, **config): - scheduler_class = self.scheduler_classes[0] - scheduler_config = self.get_scheduler_config(**config) - scheduler = scheduler_class(**scheduler_config) - state = scheduler.create_state() - - num_inference_steps = 10 - model = self.dummy_model() - sample = self.dummy_sample_deter - state = scheduler.set_timesteps(state, num_inference_steps, shape=sample.shape) - - for i, t in enumerate(state.prk_timesteps): - residual = model(sample, t) - sample, state = scheduler.step_prk(state, residual, t, sample) - - for i, t in enumerate(state.plms_timesteps): - residual = model(sample, t) - sample, state = scheduler.step_plms(state, residual, t, sample) - - return sample - - def test_step_shape(self): - kwargs = dict(self.forward_default_kwargs) - - num_inference_steps = kwargs.pop("num_inference_steps", None) - - for scheduler_class in self.scheduler_classes: - scheduler_config = self.get_scheduler_config() - scheduler = scheduler_class(**scheduler_config) - state = scheduler.create_state() - - sample, _ = self.dummy_sample - residual = 0.1 * sample - - if num_inference_steps is not None and hasattr(scheduler, "set_timesteps"): - state = scheduler.set_timesteps(state, num_inference_steps, shape=sample.shape) - elif num_inference_steps is not None and not hasattr(scheduler, "set_timesteps"): - kwargs["num_inference_steps"] = num_inference_steps - - # copy over dummy past residuals (must be done after set_timesteps) - dummy_past_residuals = jnp.array([residual + 0.2, residual + 0.15, residual + 0.1, residual + 0.05]) - state = state.replace(ets=dummy_past_residuals[:]) - - output_0, state = scheduler.step_prk(state, residual, 0, sample, **kwargs) - output_1, state = scheduler.step_prk(state, residual, 1, sample, **kwargs) - - self.assertEqual(output_0.shape, sample.shape) - self.assertEqual(output_0.shape, output_1.shape) - - output_0, state = scheduler.step_plms(state, residual, 0, sample, **kwargs) - output_1, state = scheduler.step_plms(state, residual, 1, sample, **kwargs) - - self.assertEqual(output_0.shape, sample.shape) - self.assertEqual(output_0.shape, output_1.shape) - - def test_timesteps(self): - for timesteps in [100, 1000]: - self.check_over_configs(num_train_timesteps=timesteps) - - def test_steps_offset(self): - for steps_offset in [0, 1]: - self.check_over_configs(steps_offset=steps_offset) - - scheduler_class = self.scheduler_classes[0] - scheduler_config = self.get_scheduler_config(steps_offset=1) - scheduler = scheduler_class(**scheduler_config) - state = scheduler.create_state() - state = scheduler.set_timesteps(state, 10, shape=()) - assert jnp.equal( - state.timesteps, - jnp.array([901, 851, 851, 801, 801, 751, 751, 701, 701, 651, 651, 601, 601, 501, 401, 301, 201, 101, 1]), - ).all() - - def test_betas(self): - for beta_start, beta_end in zip([0.0001, 0.001], [0.002, 0.02]): - self.check_over_configs(beta_start=beta_start, beta_end=beta_end) - - def test_schedules(self): - for schedule in ["linear", "squaredcos_cap_v2"]: - self.check_over_configs(beta_schedule=schedule) - - def test_time_indices(self): - for t in [1, 5, 10]: - self.check_over_forward(time_step=t) - - def test_inference_steps(self): - for t, num_inference_steps in zip([1, 5, 10], [10, 50, 100]): - self.check_over_forward(num_inference_steps=num_inference_steps) - - def test_pow_of_3_inference_steps(self): - # earlier version of set_timesteps() caused an error indexing alpha's with inference steps as power of 3 - num_inference_steps = 27 - - for scheduler_class in self.scheduler_classes: - sample, _ = self.dummy_sample - residual = 0.1 * sample - - scheduler_config = self.get_scheduler_config() - scheduler = scheduler_class(**scheduler_config) - state = scheduler.create_state() - - state = scheduler.set_timesteps(state, num_inference_steps, shape=sample.shape) - - # before power of 3 fix, would error on first step, so we only need to do two - for i, t in enumerate(state.prk_timesteps[:2]): - sample, state = scheduler.step_prk(state, residual, t, sample) - - def test_inference_plms_no_past_residuals(self): - with self.assertRaises(ValueError): - scheduler_class = self.scheduler_classes[0] - scheduler_config = self.get_scheduler_config() - scheduler = scheduler_class(**scheduler_config) - state = scheduler.create_state() - - scheduler.step_plms(state, self.dummy_sample, 1, self.dummy_sample).prev_sample - - def test_full_loop_no_noise(self): - sample = self.full_loop() - result_sum = jnp.sum(jnp.abs(sample)) - result_mean = jnp.mean(jnp.abs(sample)) - - if jax_device == "tpu": - assert abs(result_sum - 198.1275) < 1e-2 - assert abs(result_mean - 0.2580) < 1e-3 - else: - assert abs(result_sum - 198.1318) < 1e-2 - assert abs(result_mean - 0.2580) < 1e-3 - - def test_full_loop_with_set_alpha_to_one(self): - # We specify different beta, so that the first alpha is 0.99 - sample = self.full_loop(set_alpha_to_one=True, beta_start=0.01) - result_sum = jnp.sum(jnp.abs(sample)) - result_mean = jnp.mean(jnp.abs(sample)) - - if jax_device == "tpu": - assert abs(result_sum - 186.83226) < 1e-2 - assert abs(result_mean - 0.24327) < 1e-3 - else: - assert abs(result_sum - 186.9466) < 1e-2 - assert abs(result_mean - 0.24342) < 1e-3 - - def test_full_loop_with_no_set_alpha_to_one(self): - # We specify different beta, so that the first alpha is 0.99 - sample = self.full_loop(set_alpha_to_one=False, beta_start=0.01) - result_sum = jnp.sum(jnp.abs(sample)) - result_mean = jnp.mean(jnp.abs(sample)) - - if jax_device == "tpu": - assert abs(result_sum - 186.83226) < 1e-2 - assert abs(result_mean - 0.24327) < 1e-3 - else: - assert abs(result_sum - 186.9482) < 1e-2 - assert abs(result_mean - 0.2434) < 1e-3 diff --git a/spaces/Andy1621/uniformer_image_detection/mmdet/core/bbox/coder/delta_xywh_bbox_coder.py b/spaces/Andy1621/uniformer_image_detection/mmdet/core/bbox/coder/delta_xywh_bbox_coder.py deleted file mode 100644 index da317184a6eb6f87b0b658e9ff8be289794a0cb2..0000000000000000000000000000000000000000 --- a/spaces/Andy1621/uniformer_image_detection/mmdet/core/bbox/coder/delta_xywh_bbox_coder.py +++ /dev/null @@ -1,237 +0,0 @@ -import mmcv -import numpy as np -import torch - -from ..builder import BBOX_CODERS -from .base_bbox_coder import BaseBBoxCoder - - -@BBOX_CODERS.register_module() -class DeltaXYWHBBoxCoder(BaseBBoxCoder): - """Delta XYWH BBox coder. - - Following the practice in `R-CNN `_, - this coder encodes bbox (x1, y1, x2, y2) into delta (dx, dy, dw, dh) and - decodes delta (dx, dy, dw, dh) back to original bbox (x1, y1, x2, y2). - - Args: - target_means (Sequence[float]): Denormalizing means of target for - delta coordinates - target_stds (Sequence[float]): Denormalizing standard deviation of - target for delta coordinates - clip_border (bool, optional): Whether clip the objects outside the - border of the image. Defaults to True. - """ - - def __init__(self, - target_means=(0., 0., 0., 0.), - target_stds=(1., 1., 1., 1.), - clip_border=True): - super(BaseBBoxCoder, self).__init__() - self.means = target_means - self.stds = target_stds - self.clip_border = clip_border - - def encode(self, bboxes, gt_bboxes): - """Get box regression transformation deltas that can be used to - transform the ``bboxes`` into the ``gt_bboxes``. - - Args: - bboxes (torch.Tensor): Source boxes, e.g., object proposals. - gt_bboxes (torch.Tensor): Target of the transformation, e.g., - ground-truth boxes. - - Returns: - torch.Tensor: Box transformation deltas - """ - - assert bboxes.size(0) == gt_bboxes.size(0) - assert bboxes.size(-1) == gt_bboxes.size(-1) == 4 - encoded_bboxes = bbox2delta(bboxes, gt_bboxes, self.means, self.stds) - return encoded_bboxes - - def decode(self, - bboxes, - pred_bboxes, - max_shape=None, - wh_ratio_clip=16 / 1000): - """Apply transformation `pred_bboxes` to `boxes`. - - Args: - bboxes (torch.Tensor): Basic boxes. Shape (B, N, 4) or (N, 4) - pred_bboxes (Tensor): Encoded offsets with respect to each roi. - Has shape (B, N, num_classes * 4) or (B, N, 4) or - (N, num_classes * 4) or (N, 4). Note N = num_anchors * W * H - when rois is a grid of anchors.Offset encoding follows [1]_. - max_shape (Sequence[int] or torch.Tensor or Sequence[ - Sequence[int]],optional): Maximum bounds for boxes, specifies - (H, W, C) or (H, W). If bboxes shape is (B, N, 4), then - the max_shape should be a Sequence[Sequence[int]] - and the length of max_shape should also be B. - wh_ratio_clip (float, optional): The allowed ratio between - width and height. - - Returns: - torch.Tensor: Decoded boxes. - """ - - assert pred_bboxes.size(0) == bboxes.size(0) - if pred_bboxes.ndim == 3: - assert pred_bboxes.size(1) == bboxes.size(1) - decoded_bboxes = delta2bbox(bboxes, pred_bboxes, self.means, self.stds, - max_shape, wh_ratio_clip, self.clip_border) - - return decoded_bboxes - - -@mmcv.jit(coderize=True) -def bbox2delta(proposals, gt, means=(0., 0., 0., 0.), stds=(1., 1., 1., 1.)): - """Compute deltas of proposals w.r.t. gt. - - We usually compute the deltas of x, y, w, h of proposals w.r.t ground - truth bboxes to get regression target. - This is the inverse function of :func:`delta2bbox`. - - Args: - proposals (Tensor): Boxes to be transformed, shape (N, ..., 4) - gt (Tensor): Gt bboxes to be used as base, shape (N, ..., 4) - means (Sequence[float]): Denormalizing means for delta coordinates - stds (Sequence[float]): Denormalizing standard deviation for delta - coordinates - - Returns: - Tensor: deltas with shape (N, 4), where columns represent dx, dy, - dw, dh. - """ - assert proposals.size() == gt.size() - - proposals = proposals.float() - gt = gt.float() - px = (proposals[..., 0] + proposals[..., 2]) * 0.5 - py = (proposals[..., 1] + proposals[..., 3]) * 0.5 - pw = proposals[..., 2] - proposals[..., 0] - ph = proposals[..., 3] - proposals[..., 1] - - gx = (gt[..., 0] + gt[..., 2]) * 0.5 - gy = (gt[..., 1] + gt[..., 3]) * 0.5 - gw = gt[..., 2] - gt[..., 0] - gh = gt[..., 3] - gt[..., 1] - - dx = (gx - px) / pw - dy = (gy - py) / ph - dw = torch.log(gw / pw) - dh = torch.log(gh / ph) - deltas = torch.stack([dx, dy, dw, dh], dim=-1) - - means = deltas.new_tensor(means).unsqueeze(0) - stds = deltas.new_tensor(stds).unsqueeze(0) - deltas = deltas.sub_(means).div_(stds) - - return deltas - - -@mmcv.jit(coderize=True) -def delta2bbox(rois, - deltas, - means=(0., 0., 0., 0.), - stds=(1., 1., 1., 1.), - max_shape=None, - wh_ratio_clip=16 / 1000, - clip_border=True): - """Apply deltas to shift/scale base boxes. - - Typically the rois are anchor or proposed bounding boxes and the deltas are - network outputs used to shift/scale those boxes. - This is the inverse function of :func:`bbox2delta`. - - Args: - rois (Tensor): Boxes to be transformed. Has shape (N, 4) or (B, N, 4) - deltas (Tensor): Encoded offsets with respect to each roi. - Has shape (B, N, num_classes * 4) or (B, N, 4) or - (N, num_classes * 4) or (N, 4). Note N = num_anchors * W * H - when rois is a grid of anchors.Offset encoding follows [1]_. - means (Sequence[float]): Denormalizing means for delta coordinates - stds (Sequence[float]): Denormalizing standard deviation for delta - coordinates - max_shape (Sequence[int] or torch.Tensor or Sequence[ - Sequence[int]],optional): Maximum bounds for boxes, specifies - (H, W, C) or (H, W). If rois shape is (B, N, 4), then - the max_shape should be a Sequence[Sequence[int]] - and the length of max_shape should also be B. - wh_ratio_clip (float): Maximum aspect ratio for boxes. - clip_border (bool, optional): Whether clip the objects outside the - border of the image. Defaults to True. - - Returns: - Tensor: Boxes with shape (B, N, num_classes * 4) or (B, N, 4) or - (N, num_classes * 4) or (N, 4), where 4 represent - tl_x, tl_y, br_x, br_y. - - References: - .. [1] https://arxiv.org/abs/1311.2524 - - Example: - >>> rois = torch.Tensor([[ 0., 0., 1., 1.], - >>> [ 0., 0., 1., 1.], - >>> [ 0., 0., 1., 1.], - >>> [ 5., 5., 5., 5.]]) - >>> deltas = torch.Tensor([[ 0., 0., 0., 0.], - >>> [ 1., 1., 1., 1.], - >>> [ 0., 0., 2., -1.], - >>> [ 0.7, -1.9, -0.5, 0.3]]) - >>> delta2bbox(rois, deltas, max_shape=(32, 32, 3)) - tensor([[0.0000, 0.0000, 1.0000, 1.0000], - [0.1409, 0.1409, 2.8591, 2.8591], - [0.0000, 0.3161, 4.1945, 0.6839], - [5.0000, 5.0000, 5.0000, 5.0000]]) - """ - means = deltas.new_tensor(means).view(1, - -1).repeat(1, - deltas.size(-1) // 4) - stds = deltas.new_tensor(stds).view(1, -1).repeat(1, deltas.size(-1) // 4) - denorm_deltas = deltas * stds + means - dx = denorm_deltas[..., 0::4] - dy = denorm_deltas[..., 1::4] - dw = denorm_deltas[..., 2::4] - dh = denorm_deltas[..., 3::4] - max_ratio = np.abs(np.log(wh_ratio_clip)) - dw = dw.clamp(min=-max_ratio, max=max_ratio) - dh = dh.clamp(min=-max_ratio, max=max_ratio) - x1, y1 = rois[..., 0], rois[..., 1] - x2, y2 = rois[..., 2], rois[..., 3] - # Compute center of each roi - px = ((x1 + x2) * 0.5).unsqueeze(-1).expand_as(dx) - py = ((y1 + y2) * 0.5).unsqueeze(-1).expand_as(dy) - # Compute width/height of each roi - pw = (x2 - x1).unsqueeze(-1).expand_as(dw) - ph = (y2 - y1).unsqueeze(-1).expand_as(dh) - # Use exp(network energy) to enlarge/shrink each roi - gw = pw * dw.exp() - gh = ph * dh.exp() - # Use network energy to shift the center of each roi - gx = px + pw * dx - gy = py + ph * dy - # Convert center-xy/width/height to top-left, bottom-right - x1 = gx - gw * 0.5 - y1 = gy - gh * 0.5 - x2 = gx + gw * 0.5 - y2 = gy + gh * 0.5 - - bboxes = torch.stack([x1, y1, x2, y2], dim=-1).view(deltas.size()) - - if clip_border and max_shape is not None: - if not isinstance(max_shape, torch.Tensor): - max_shape = x1.new_tensor(max_shape) - max_shape = max_shape[..., :2].type_as(x1) - if max_shape.ndim == 2: - assert bboxes.ndim == 3 - assert max_shape.size(0) == bboxes.size(0) - - min_xy = x1.new_tensor(0) - max_xy = torch.cat( - [max_shape] * (deltas.size(-1) // 2), - dim=-1).flip(-1).unsqueeze(-2) - bboxes = torch.where(bboxes < min_xy, min_xy, bboxes) - bboxes = torch.where(bboxes > max_xy, max_xy, bboxes) - - return bboxes diff --git a/spaces/Andy1621/uniformer_image_segmentation/configs/resnest/pspnet_s101-d8_512x1024_80k_cityscapes.py b/spaces/Andy1621/uniformer_image_segmentation/configs/resnest/pspnet_s101-d8_512x1024_80k_cityscapes.py deleted file mode 100644 index 9737849cbd7470b03ef3fcb3b1225283370eb503..0000000000000000000000000000000000000000 --- a/spaces/Andy1621/uniformer_image_segmentation/configs/resnest/pspnet_s101-d8_512x1024_80k_cityscapes.py +++ /dev/null @@ -1,9 +0,0 @@ -_base_ = '../pspnet/pspnet_r101-d8_512x1024_80k_cityscapes.py' -model = dict( - pretrained='open-mmlab://resnest101', - backbone=dict( - type='ResNeSt', - stem_channels=128, - radix=2, - reduction_factor=4, - avg_down_stride=True)) diff --git a/spaces/Anonymous-sub/Rerender/ControlNet/annotator/uniformer/mmcv/utils/progressbar.py b/spaces/Anonymous-sub/Rerender/ControlNet/annotator/uniformer/mmcv/utils/progressbar.py deleted file mode 100644 index 0062f670dd94fa9da559ab26ef85517dcf5211c7..0000000000000000000000000000000000000000 --- a/spaces/Anonymous-sub/Rerender/ControlNet/annotator/uniformer/mmcv/utils/progressbar.py +++ /dev/null @@ -1,208 +0,0 @@ -# Copyright (c) OpenMMLab. All rights reserved. -import sys -from collections.abc import Iterable -from multiprocessing import Pool -from shutil import get_terminal_size - -from .timer import Timer - - -class ProgressBar: - """A progress bar which can print the progress.""" - - def __init__(self, task_num=0, bar_width=50, start=True, file=sys.stdout): - self.task_num = task_num - self.bar_width = bar_width - self.completed = 0 - self.file = file - if start: - self.start() - - @property - def terminal_width(self): - width, _ = get_terminal_size() - return width - - def start(self): - if self.task_num > 0: - self.file.write(f'[{" " * self.bar_width}] 0/{self.task_num}, ' - 'elapsed: 0s, ETA:') - else: - self.file.write('completed: 0, elapsed: 0s') - self.file.flush() - self.timer = Timer() - - def update(self, num_tasks=1): - assert num_tasks > 0 - self.completed += num_tasks - elapsed = self.timer.since_start() - if elapsed > 0: - fps = self.completed / elapsed - else: - fps = float('inf') - if self.task_num > 0: - percentage = self.completed / float(self.task_num) - eta = int(elapsed * (1 - percentage) / percentage + 0.5) - msg = f'\r[{{}}] {self.completed}/{self.task_num}, ' \ - f'{fps:.1f} task/s, elapsed: {int(elapsed + 0.5)}s, ' \ - f'ETA: {eta:5}s' - - bar_width = min(self.bar_width, - int(self.terminal_width - len(msg)) + 2, - int(self.terminal_width * 0.6)) - bar_width = max(2, bar_width) - mark_width = int(bar_width * percentage) - bar_chars = '>' * mark_width + ' ' * (bar_width - mark_width) - self.file.write(msg.format(bar_chars)) - else: - self.file.write( - f'completed: {self.completed}, elapsed: {int(elapsed + 0.5)}s,' - f' {fps:.1f} tasks/s') - self.file.flush() - - -def track_progress(func, tasks, bar_width=50, file=sys.stdout, **kwargs): - """Track the progress of tasks execution with a progress bar. - - Tasks are done with a simple for-loop. - - Args: - func (callable): The function to be applied to each task. - tasks (list or tuple[Iterable, int]): A list of tasks or - (tasks, total num). - bar_width (int): Width of progress bar. - - Returns: - list: The task results. - """ - if isinstance(tasks, tuple): - assert len(tasks) == 2 - assert isinstance(tasks[0], Iterable) - assert isinstance(tasks[1], int) - task_num = tasks[1] - tasks = tasks[0] - elif isinstance(tasks, Iterable): - task_num = len(tasks) - else: - raise TypeError( - '"tasks" must be an iterable object or a (iterator, int) tuple') - prog_bar = ProgressBar(task_num, bar_width, file=file) - results = [] - for task in tasks: - results.append(func(task, **kwargs)) - prog_bar.update() - prog_bar.file.write('\n') - return results - - -def init_pool(process_num, initializer=None, initargs=None): - if initializer is None: - return Pool(process_num) - elif initargs is None: - return Pool(process_num, initializer) - else: - if not isinstance(initargs, tuple): - raise TypeError('"initargs" must be a tuple') - return Pool(process_num, initializer, initargs) - - -def track_parallel_progress(func, - tasks, - nproc, - initializer=None, - initargs=None, - bar_width=50, - chunksize=1, - skip_first=False, - keep_order=True, - file=sys.stdout): - """Track the progress of parallel task execution with a progress bar. - - The built-in :mod:`multiprocessing` module is used for process pools and - tasks are done with :func:`Pool.map` or :func:`Pool.imap_unordered`. - - Args: - func (callable): The function to be applied to each task. - tasks (list or tuple[Iterable, int]): A list of tasks or - (tasks, total num). - nproc (int): Process (worker) number. - initializer (None or callable): Refer to :class:`multiprocessing.Pool` - for details. - initargs (None or tuple): Refer to :class:`multiprocessing.Pool` for - details. - chunksize (int): Refer to :class:`multiprocessing.Pool` for details. - bar_width (int): Width of progress bar. - skip_first (bool): Whether to skip the first sample for each worker - when estimating fps, since the initialization step may takes - longer. - keep_order (bool): If True, :func:`Pool.imap` is used, otherwise - :func:`Pool.imap_unordered` is used. - - Returns: - list: The task results. - """ - if isinstance(tasks, tuple): - assert len(tasks) == 2 - assert isinstance(tasks[0], Iterable) - assert isinstance(tasks[1], int) - task_num = tasks[1] - tasks = tasks[0] - elif isinstance(tasks, Iterable): - task_num = len(tasks) - else: - raise TypeError( - '"tasks" must be an iterable object or a (iterator, int) tuple') - pool = init_pool(nproc, initializer, initargs) - start = not skip_first - task_num -= nproc * chunksize * int(skip_first) - prog_bar = ProgressBar(task_num, bar_width, start, file=file) - results = [] - if keep_order: - gen = pool.imap(func, tasks, chunksize) - else: - gen = pool.imap_unordered(func, tasks, chunksize) - for result in gen: - results.append(result) - if skip_first: - if len(results) < nproc * chunksize: - continue - elif len(results) == nproc * chunksize: - prog_bar.start() - continue - prog_bar.update() - prog_bar.file.write('\n') - pool.close() - pool.join() - return results - - -def track_iter_progress(tasks, bar_width=50, file=sys.stdout): - """Track the progress of tasks iteration or enumeration with a progress - bar. - - Tasks are yielded with a simple for-loop. - - Args: - tasks (list or tuple[Iterable, int]): A list of tasks or - (tasks, total num). - bar_width (int): Width of progress bar. - - Yields: - list: The task results. - """ - if isinstance(tasks, tuple): - assert len(tasks) == 2 - assert isinstance(tasks[0], Iterable) - assert isinstance(tasks[1], int) - task_num = tasks[1] - tasks = tasks[0] - elif isinstance(tasks, Iterable): - task_num = len(tasks) - else: - raise TypeError( - '"tasks" must be an iterable object or a (iterator, int) tuple') - prog_bar = ProgressBar(task_num, bar_width, file=file) - for task in tasks: - yield task - prog_bar.update() - prog_bar.file.write('\n') diff --git a/spaces/ArkanDash/rvc-models/infer_pack/transforms.py b/spaces/ArkanDash/rvc-models/infer_pack/transforms.py deleted file mode 100644 index a11f799e023864ff7082c1f49c0cc18351a13b47..0000000000000000000000000000000000000000 --- a/spaces/ArkanDash/rvc-models/infer_pack/transforms.py +++ /dev/null @@ -1,209 +0,0 @@ -import torch -from torch.nn import functional as F - -import numpy as np - - -DEFAULT_MIN_BIN_WIDTH = 1e-3 -DEFAULT_MIN_BIN_HEIGHT = 1e-3 -DEFAULT_MIN_DERIVATIVE = 1e-3 - - -def piecewise_rational_quadratic_transform( - inputs, - unnormalized_widths, - unnormalized_heights, - unnormalized_derivatives, - inverse=False, - tails=None, - tail_bound=1.0, - min_bin_width=DEFAULT_MIN_BIN_WIDTH, - min_bin_height=DEFAULT_MIN_BIN_HEIGHT, - min_derivative=DEFAULT_MIN_DERIVATIVE, -): - if tails is None: - spline_fn = rational_quadratic_spline - spline_kwargs = {} - else: - spline_fn = unconstrained_rational_quadratic_spline - spline_kwargs = {"tails": tails, "tail_bound": tail_bound} - - outputs, logabsdet = spline_fn( - inputs=inputs, - unnormalized_widths=unnormalized_widths, - unnormalized_heights=unnormalized_heights, - unnormalized_derivatives=unnormalized_derivatives, - inverse=inverse, - min_bin_width=min_bin_width, - min_bin_height=min_bin_height, - min_derivative=min_derivative, - **spline_kwargs - ) - return outputs, logabsdet - - -def searchsorted(bin_locations, inputs, eps=1e-6): - bin_locations[..., -1] += eps - return torch.sum(inputs[..., None] >= bin_locations, dim=-1) - 1 - - -def unconstrained_rational_quadratic_spline( - inputs, - unnormalized_widths, - unnormalized_heights, - unnormalized_derivatives, - inverse=False, - tails="linear", - tail_bound=1.0, - min_bin_width=DEFAULT_MIN_BIN_WIDTH, - min_bin_height=DEFAULT_MIN_BIN_HEIGHT, - min_derivative=DEFAULT_MIN_DERIVATIVE, -): - inside_interval_mask = (inputs >= -tail_bound) & (inputs <= tail_bound) - outside_interval_mask = ~inside_interval_mask - - outputs = torch.zeros_like(inputs) - logabsdet = torch.zeros_like(inputs) - - if tails == "linear": - unnormalized_derivatives = F.pad(unnormalized_derivatives, pad=(1, 1)) - constant = np.log(np.exp(1 - min_derivative) - 1) - unnormalized_derivatives[..., 0] = constant - unnormalized_derivatives[..., -1] = constant - - outputs[outside_interval_mask] = inputs[outside_interval_mask] - logabsdet[outside_interval_mask] = 0 - else: - raise RuntimeError("{} tails are not implemented.".format(tails)) - - ( - outputs[inside_interval_mask], - logabsdet[inside_interval_mask], - ) = rational_quadratic_spline( - inputs=inputs[inside_interval_mask], - unnormalized_widths=unnormalized_widths[inside_interval_mask, :], - unnormalized_heights=unnormalized_heights[inside_interval_mask, :], - unnormalized_derivatives=unnormalized_derivatives[inside_interval_mask, :], - inverse=inverse, - left=-tail_bound, - right=tail_bound, - bottom=-tail_bound, - top=tail_bound, - min_bin_width=min_bin_width, - min_bin_height=min_bin_height, - min_derivative=min_derivative, - ) - - return outputs, logabsdet - - -def rational_quadratic_spline( - inputs, - unnormalized_widths, - unnormalized_heights, - unnormalized_derivatives, - inverse=False, - left=0.0, - right=1.0, - bottom=0.0, - top=1.0, - min_bin_width=DEFAULT_MIN_BIN_WIDTH, - min_bin_height=DEFAULT_MIN_BIN_HEIGHT, - min_derivative=DEFAULT_MIN_DERIVATIVE, -): - if torch.min(inputs) < left or torch.max(inputs) > right: - raise ValueError("Input to a transform is not within its domain") - - num_bins = unnormalized_widths.shape[-1] - - if min_bin_width * num_bins > 1.0: - raise ValueError("Minimal bin width too large for the number of bins") - if min_bin_height * num_bins > 1.0: - raise ValueError("Minimal bin height too large for the number of bins") - - widths = F.softmax(unnormalized_widths, dim=-1) - widths = min_bin_width + (1 - min_bin_width * num_bins) * widths - cumwidths = torch.cumsum(widths, dim=-1) - cumwidths = F.pad(cumwidths, pad=(1, 0), mode="constant", value=0.0) - cumwidths = (right - left) * cumwidths + left - cumwidths[..., 0] = left - cumwidths[..., -1] = right - widths = cumwidths[..., 1:] - cumwidths[..., :-1] - - derivatives = min_derivative + F.softplus(unnormalized_derivatives) - - heights = F.softmax(unnormalized_heights, dim=-1) - heights = min_bin_height + (1 - min_bin_height * num_bins) * heights - cumheights = torch.cumsum(heights, dim=-1) - cumheights = F.pad(cumheights, pad=(1, 0), mode="constant", value=0.0) - cumheights = (top - bottom) * cumheights + bottom - cumheights[..., 0] = bottom - cumheights[..., -1] = top - heights = cumheights[..., 1:] - cumheights[..., :-1] - - if inverse: - bin_idx = searchsorted(cumheights, inputs)[..., None] - else: - bin_idx = searchsorted(cumwidths, inputs)[..., None] - - input_cumwidths = cumwidths.gather(-1, bin_idx)[..., 0] - input_bin_widths = widths.gather(-1, bin_idx)[..., 0] - - input_cumheights = cumheights.gather(-1, bin_idx)[..., 0] - delta = heights / widths - input_delta = delta.gather(-1, bin_idx)[..., 0] - - input_derivatives = derivatives.gather(-1, bin_idx)[..., 0] - input_derivatives_plus_one = derivatives[..., 1:].gather(-1, bin_idx)[..., 0] - - input_heights = heights.gather(-1, bin_idx)[..., 0] - - if inverse: - a = (inputs - input_cumheights) * ( - input_derivatives + input_derivatives_plus_one - 2 * input_delta - ) + input_heights * (input_delta - input_derivatives) - b = input_heights * input_derivatives - (inputs - input_cumheights) * ( - input_derivatives + input_derivatives_plus_one - 2 * input_delta - ) - c = -input_delta * (inputs - input_cumheights) - - discriminant = b.pow(2) - 4 * a * c - assert (discriminant >= 0).all() - - root = (2 * c) / (-b - torch.sqrt(discriminant)) - outputs = root * input_bin_widths + input_cumwidths - - theta_one_minus_theta = root * (1 - root) - denominator = input_delta + ( - (input_derivatives + input_derivatives_plus_one - 2 * input_delta) - * theta_one_minus_theta - ) - derivative_numerator = input_delta.pow(2) * ( - input_derivatives_plus_one * root.pow(2) - + 2 * input_delta * theta_one_minus_theta - + input_derivatives * (1 - root).pow(2) - ) - logabsdet = torch.log(derivative_numerator) - 2 * torch.log(denominator) - - return outputs, -logabsdet - else: - theta = (inputs - input_cumwidths) / input_bin_widths - theta_one_minus_theta = theta * (1 - theta) - - numerator = input_heights * ( - input_delta * theta.pow(2) + input_derivatives * theta_one_minus_theta - ) - denominator = input_delta + ( - (input_derivatives + input_derivatives_plus_one - 2 * input_delta) - * theta_one_minus_theta - ) - outputs = input_cumheights + numerator / denominator - - derivative_numerator = input_delta.pow(2) * ( - input_derivatives_plus_one * theta.pow(2) - + 2 * input_delta * theta_one_minus_theta - + input_derivatives * (1 - theta).pow(2) - ) - logabsdet = torch.log(derivative_numerator) - 2 * torch.log(denominator) - - return outputs, logabsdet diff --git a/spaces/Armandoliv/gpt2-tweets-generation-app/README.md b/spaces/Armandoliv/gpt2-tweets-generation-app/README.md deleted file mode 100644 index 9c5db524d52af540a838d18c2aded3d0a1fe53a9..0000000000000000000000000000000000000000 --- a/spaces/Armandoliv/gpt2-tweets-generation-app/README.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: Tweets Generation App -emoji: 👁 -colorFrom: yellow -colorTo: indigo -sdk: gradio -sdk_version: 3.3.1 -app_file: app.py -pinned: false ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/Artples/Named-Entity-Recognition/app.py b/spaces/Artples/Named-Entity-Recognition/app.py deleted file mode 100644 index 22e7e60cfd0a443a44c7f521ccbf22cb46b5cfc7..0000000000000000000000000000000000000000 --- a/spaces/Artples/Named-Entity-Recognition/app.py +++ /dev/null @@ -1,3 +0,0 @@ -import gradio as gr - -gr.Interface.load("models/Davlan/distilbert-base-multilingual-cased-ner-hrl").launch() \ No newline at end of file diff --git a/spaces/Arulkumar03/GroundingDINO_SOTA_Zero_Shot_Model/groundingdino/__init__.py b/spaces/Arulkumar03/GroundingDINO_SOTA_Zero_Shot_Model/groundingdino/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pip/_vendor/requests/auth.py b/spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pip/_vendor/requests/auth.py deleted file mode 100644 index 9733686ddb36b826ead4f4666d42311397fa6fec..0000000000000000000000000000000000000000 --- a/spaces/Ataturk-Chatbot/HuggingFaceChat/venv/lib/python3.11/site-packages/pip/_vendor/requests/auth.py +++ /dev/null @@ -1,315 +0,0 @@ -""" -requests.auth -~~~~~~~~~~~~~ - -This module contains the authentication handlers for Requests. -""" - -import hashlib -import os -import re -import threading -import time -import warnings -from base64 import b64encode - -from ._internal_utils import to_native_string -from .compat import basestring, str, urlparse -from .cookies import extract_cookies_to_jar -from .utils import parse_dict_header - -CONTENT_TYPE_FORM_URLENCODED = "application/x-www-form-urlencoded" -CONTENT_TYPE_MULTI_PART = "multipart/form-data" - - -def _basic_auth_str(username, password): - """Returns a Basic Auth string.""" - - # "I want us to put a big-ol' comment on top of it that - # says that this behaviour is dumb but we need to preserve - # it because people are relying on it." - # - Lukasa - # - # These are here solely to maintain backwards compatibility - # for things like ints. This will be removed in 3.0.0. - if not isinstance(username, basestring): - warnings.warn( - "Non-string usernames will no longer be supported in Requests " - "3.0.0. Please convert the object you've passed in ({!r}) to " - "a string or bytes object in the near future to avoid " - "problems.".format(username), - category=DeprecationWarning, - ) - username = str(username) - - if not isinstance(password, basestring): - warnings.warn( - "Non-string passwords will no longer be supported in Requests " - "3.0.0. Please convert the object you've passed in ({!r}) to " - "a string or bytes object in the near future to avoid " - "problems.".format(type(password)), - category=DeprecationWarning, - ) - password = str(password) - # -- End Removal -- - - if isinstance(username, str): - username = username.encode("latin1") - - if isinstance(password, str): - password = password.encode("latin1") - - authstr = "Basic " + to_native_string( - b64encode(b":".join((username, password))).strip() - ) - - return authstr - - -class AuthBase: - """Base class that all auth implementations derive from""" - - def __call__(self, r): - raise NotImplementedError("Auth hooks must be callable.") - - -class HTTPBasicAuth(AuthBase): - """Attaches HTTP Basic Authentication to the given Request object.""" - - def __init__(self, username, password): - self.username = username - self.password = password - - def __eq__(self, other): - return all( - [ - self.username == getattr(other, "username", None), - self.password == getattr(other, "password", None), - ] - ) - - def __ne__(self, other): - return not self == other - - def __call__(self, r): - r.headers["Authorization"] = _basic_auth_str(self.username, self.password) - return r - - -class HTTPProxyAuth(HTTPBasicAuth): - """Attaches HTTP Proxy Authentication to a given Request object.""" - - def __call__(self, r): - r.headers["Proxy-Authorization"] = _basic_auth_str(self.username, self.password) - return r - - -class HTTPDigestAuth(AuthBase): - """Attaches HTTP Digest Authentication to the given Request object.""" - - def __init__(self, username, password): - self.username = username - self.password = password - # Keep state in per-thread local storage - self._thread_local = threading.local() - - def init_per_thread_state(self): - # Ensure state is initialized just once per-thread - if not hasattr(self._thread_local, "init"): - self._thread_local.init = True - self._thread_local.last_nonce = "" - self._thread_local.nonce_count = 0 - self._thread_local.chal = {} - self._thread_local.pos = None - self._thread_local.num_401_calls = None - - def build_digest_header(self, method, url): - """ - :rtype: str - """ - - realm = self._thread_local.chal["realm"] - nonce = self._thread_local.chal["nonce"] - qop = self._thread_local.chal.get("qop") - algorithm = self._thread_local.chal.get("algorithm") - opaque = self._thread_local.chal.get("opaque") - hash_utf8 = None - - if algorithm is None: - _algorithm = "MD5" - else: - _algorithm = algorithm.upper() - # lambdas assume digest modules are imported at the top level - if _algorithm == "MD5" or _algorithm == "MD5-SESS": - - def md5_utf8(x): - if isinstance(x, str): - x = x.encode("utf-8") - return hashlib.md5(x).hexdigest() - - hash_utf8 = md5_utf8 - elif _algorithm == "SHA": - - def sha_utf8(x): - if isinstance(x, str): - x = x.encode("utf-8") - return hashlib.sha1(x).hexdigest() - - hash_utf8 = sha_utf8 - elif _algorithm == "SHA-256": - - def sha256_utf8(x): - if isinstance(x, str): - x = x.encode("utf-8") - return hashlib.sha256(x).hexdigest() - - hash_utf8 = sha256_utf8 - elif _algorithm == "SHA-512": - - def sha512_utf8(x): - if isinstance(x, str): - x = x.encode("utf-8") - return hashlib.sha512(x).hexdigest() - - hash_utf8 = sha512_utf8 - - KD = lambda s, d: hash_utf8(f"{s}:{d}") # noqa:E731 - - if hash_utf8 is None: - return None - - # XXX not implemented yet - entdig = None - p_parsed = urlparse(url) - #: path is request-uri defined in RFC 2616 which should not be empty - path = p_parsed.path or "/" - if p_parsed.query: - path += f"?{p_parsed.query}" - - A1 = f"{self.username}:{realm}:{self.password}" - A2 = f"{method}:{path}" - - HA1 = hash_utf8(A1) - HA2 = hash_utf8(A2) - - if nonce == self._thread_local.last_nonce: - self._thread_local.nonce_count += 1 - else: - self._thread_local.nonce_count = 1 - ncvalue = f"{self._thread_local.nonce_count:08x}" - s = str(self._thread_local.nonce_count).encode("utf-8") - s += nonce.encode("utf-8") - s += time.ctime().encode("utf-8") - s += os.urandom(8) - - cnonce = hashlib.sha1(s).hexdigest()[:16] - if _algorithm == "MD5-SESS": - HA1 = hash_utf8(f"{HA1}:{nonce}:{cnonce}") - - if not qop: - respdig = KD(HA1, f"{nonce}:{HA2}") - elif qop == "auth" or "auth" in qop.split(","): - noncebit = f"{nonce}:{ncvalue}:{cnonce}:auth:{HA2}" - respdig = KD(HA1, noncebit) - else: - # XXX handle auth-int. - return None - - self._thread_local.last_nonce = nonce - - # XXX should the partial digests be encoded too? - base = ( - f'username="{self.username}", realm="{realm}", nonce="{nonce}", ' - f'uri="{path}", response="{respdig}"' - ) - if opaque: - base += f', opaque="{opaque}"' - if algorithm: - base += f', algorithm="{algorithm}"' - if entdig: - base += f', digest="{entdig}"' - if qop: - base += f', qop="auth", nc={ncvalue}, cnonce="{cnonce}"' - - return f"Digest {base}" - - def handle_redirect(self, r, **kwargs): - """Reset num_401_calls counter on redirects.""" - if r.is_redirect: - self._thread_local.num_401_calls = 1 - - def handle_401(self, r, **kwargs): - """ - Takes the given response and tries digest-auth, if needed. - - :rtype: requests.Response - """ - - # If response is not 4xx, do not auth - # See https://github.com/psf/requests/issues/3772 - if not 400 <= r.status_code < 500: - self._thread_local.num_401_calls = 1 - return r - - if self._thread_local.pos is not None: - # Rewind the file position indicator of the body to where - # it was to resend the request. - r.request.body.seek(self._thread_local.pos) - s_auth = r.headers.get("www-authenticate", "") - - if "digest" in s_auth.lower() and self._thread_local.num_401_calls < 2: - - self._thread_local.num_401_calls += 1 - pat = re.compile(r"digest ", flags=re.IGNORECASE) - self._thread_local.chal = parse_dict_header(pat.sub("", s_auth, count=1)) - - # Consume content and release the original connection - # to allow our new request to reuse the same one. - r.content - r.close() - prep = r.request.copy() - extract_cookies_to_jar(prep._cookies, r.request, r.raw) - prep.prepare_cookies(prep._cookies) - - prep.headers["Authorization"] = self.build_digest_header( - prep.method, prep.url - ) - _r = r.connection.send(prep, **kwargs) - _r.history.append(r) - _r.request = prep - - return _r - - self._thread_local.num_401_calls = 1 - return r - - def __call__(self, r): - # Initialize per-thread state, if needed - self.init_per_thread_state() - # If we have a saved nonce, skip the 401 - if self._thread_local.last_nonce: - r.headers["Authorization"] = self.build_digest_header(r.method, r.url) - try: - self._thread_local.pos = r.body.tell() - except AttributeError: - # In the case of HTTPDigestAuth being reused and the body of - # the previous request was a file-like object, pos has the - # file position of the previous body. Ensure it's set to - # None. - self._thread_local.pos = None - r.register_hook("response", self.handle_401) - r.register_hook("response", self.handle_redirect) - self._thread_local.num_401_calls = 1 - - return r - - def __eq__(self, other): - return all( - [ - self.username == getattr(other, "username", None), - self.password == getattr(other, "password", None), - ] - ) - - def __ne__(self, other): - return not self == other diff --git a/spaces/Bart92/RVC_HF/train/process_ckpt.py b/spaces/Bart92/RVC_HF/train/process_ckpt.py deleted file mode 100644 index e3c3dba6df4b4f71a4d0865cdc96241d17da8781..0000000000000000000000000000000000000000 --- a/spaces/Bart92/RVC_HF/train/process_ckpt.py +++ /dev/null @@ -1,259 +0,0 @@ -import torch, traceback, os, pdb, sys - -now_dir = os.getcwd() -sys.path.append(now_dir) -from collections import OrderedDict -from i18n import I18nAuto - -i18n = I18nAuto() - - -def savee(ckpt, sr, if_f0, name, epoch, version, hps): - try: - opt = OrderedDict() - opt["weight"] = {} - for key in ckpt.keys(): - if "enc_q" in key: - continue - opt["weight"][key] = ckpt[key].half() - opt["config"] = [ - hps.data.filter_length // 2 + 1, - 32, - hps.model.inter_channels, - hps.model.hidden_channels, - hps.model.filter_channels, - hps.model.n_heads, - hps.model.n_layers, - hps.model.kernel_size, - hps.model.p_dropout, - hps.model.resblock, - hps.model.resblock_kernel_sizes, - hps.model.resblock_dilation_sizes, - hps.model.upsample_rates, - hps.model.upsample_initial_channel, - hps.model.upsample_kernel_sizes, - hps.model.spk_embed_dim, - hps.model.gin_channels, - hps.data.sampling_rate, - ] - opt["info"] = "%sepoch" % epoch - opt["sr"] = sr - opt["f0"] = if_f0 - opt["version"] = version - torch.save(opt, "weights/%s.pth" % name) - return "Success." - except: - return traceback.format_exc() - - -def show_info(path): - try: - a = torch.load(path, map_location="cpu") - return "Epochs: %s\nSample rate: %s\nPitch guidance: %s\nRVC Version: %s" % ( - a.get("info", "None"), - a.get("sr", "None"), - a.get("f0", "None"), - a.get("version", "None"), - ) - except: - return traceback.format_exc() - - -def extract_small_model(path, name, sr, if_f0, info, version): - try: - ckpt = torch.load(path, map_location="cpu") - if "model" in ckpt: - ckpt = ckpt["model"] - opt = OrderedDict() - opt["weight"] = {} - for key in ckpt.keys(): - if "enc_q" in key: - continue - opt["weight"][key] = ckpt[key].half() - if sr == "40k": - opt["config"] = [ - 1025, - 32, - 192, - 192, - 768, - 2, - 6, - 3, - 0, - "1", - [3, 7, 11], - [[1, 3, 5], [1, 3, 5], [1, 3, 5]], - [10, 10, 2, 2], - 512, - [16, 16, 4, 4], - 109, - 256, - 40000, - ] - elif sr == "48k": - if version == "v1": - opt["config"] = [ - 1025, - 32, - 192, - 192, - 768, - 2, - 6, - 3, - 0, - "1", - [3, 7, 11], - [[1, 3, 5], [1, 3, 5], [1, 3, 5]], - [10, 6, 2, 2, 2], - 512, - [16, 16, 4, 4, 4], - 109, - 256, - 48000, - ] - else: - opt["config"] = [ - 1025, - 32, - 192, - 192, - 768, - 2, - 6, - 3, - 0, - "1", - [3, 7, 11], - [[1, 3, 5], [1, 3, 5], [1, 3, 5]], - [12, 10, 2, 2], - 512, - [24, 20, 4, 4], - 109, - 256, - 48000, - ] - elif sr == "32k": - if version == "v1": - opt["config"] = [ - 513, - 32, - 192, - 192, - 768, - 2, - 6, - 3, - 0, - "1", - [3, 7, 11], - [[1, 3, 5], [1, 3, 5], [1, 3, 5]], - [10, 4, 2, 2, 2], - 512, - [16, 16, 4, 4, 4], - 109, - 256, - 32000, - ] - else: - opt["config"] = [ - 513, - 32, - 192, - 192, - 768, - 2, - 6, - 3, - 0, - "1", - [3, 7, 11], - [[1, 3, 5], [1, 3, 5], [1, 3, 5]], - [10, 8, 2, 2], - 512, - [20, 16, 4, 4], - 109, - 256, - 32000, - ] - if info == "": - info = "Extracted model." - opt["info"] = info - opt["version"] = version - opt["sr"] = sr - opt["f0"] = int(if_f0) - torch.save(opt, "weights/%s.pth" % name) - return "Success." - except: - return traceback.format_exc() - - -def change_info(path, info, name): - try: - ckpt = torch.load(path, map_location="cpu") - ckpt["info"] = info - if name == "": - name = os.path.basename(path) - torch.save(ckpt, "weights/%s" % name) - return "Success." - except: - return traceback.format_exc() - - -def merge(path1, path2, alpha1, sr, f0, info, name, version): - try: - - def extract(ckpt): - a = ckpt["model"] - opt = OrderedDict() - opt["weight"] = {} - for key in a.keys(): - if "enc_q" in key: - continue - opt["weight"][key] = a[key] - return opt - - ckpt1 = torch.load(path1, map_location="cpu") - ckpt2 = torch.load(path2, map_location="cpu") - cfg = ckpt1["config"] - if "model" in ckpt1: - ckpt1 = extract(ckpt1) - else: - ckpt1 = ckpt1["weight"] - if "model" in ckpt2: - ckpt2 = extract(ckpt2) - else: - ckpt2 = ckpt2["weight"] - if sorted(list(ckpt1.keys())) != sorted(list(ckpt2.keys())): - return "Fail to merge the models. The model architectures are not the same." - opt = OrderedDict() - opt["weight"] = {} - for key in ckpt1.keys(): - # try: - if key == "emb_g.weight" and ckpt1[key].shape != ckpt2[key].shape: - min_shape0 = min(ckpt1[key].shape[0], ckpt2[key].shape[0]) - opt["weight"][key] = ( - alpha1 * (ckpt1[key][:min_shape0].float()) - + (1 - alpha1) * (ckpt2[key][:min_shape0].float()) - ).half() - else: - opt["weight"][key] = ( - alpha1 * (ckpt1[key].float()) + (1 - alpha1) * (ckpt2[key].float()) - ).half() - # except: - # pdb.set_trace() - opt["config"] = cfg - """ - if(sr=="40k"):opt["config"] = [1025, 32, 192, 192, 768, 2, 6, 3, 0, "1", [3, 7, 11], [[1, 3, 5], [1, 3, 5], [1, 3, 5]], [10, 10, 2, 2], 512, [16, 16, 4, 4,4], 109, 256, 40000] - elif(sr=="48k"):opt["config"] = [1025, 32, 192, 192, 768, 2, 6, 3, 0, "1", [3, 7, 11], [[1, 3, 5], [1, 3, 5], [1, 3, 5]], [10,6,2,2,2], 512, [16, 16, 4, 4], 109, 256, 48000] - elif(sr=="32k"):opt["config"] = [513, 32, 192, 192, 768, 2, 6, 3, 0, "1", [3, 7, 11], [[1, 3, 5], [1, 3, 5], [1, 3, 5]], [10, 4, 2, 2, 2], 512, [16, 16, 4, 4,4], 109, 256, 32000] - """ - opt["sr"] = sr - opt["f0"] = 1 if f0 else 0 - opt["version"] = version - opt["info"] = info - torch.save(opt, "weights/%s.pth" % name) - return "Success." - except: - return traceback.format_exc() diff --git a/spaces/Benson/text-generation/Examples/Apkadmin Fuego Libre Mx Diamante Hack.md b/spaces/Benson/text-generation/Examples/Apkadmin Fuego Libre Mx Diamante Hack.md deleted file mode 100644 index 56c0482e810e5835c98babdd57dd9d7c832bddde..0000000000000000000000000000000000000000 --- a/spaces/Benson/text-generation/Examples/Apkadmin Fuego Libre Mx Diamante Hack.md +++ /dev/null @@ -1,39 +0,0 @@ - -

    Apkadmin Free Fire Max Diamond Hack: Lo que usted necesita saber

    -

    Free Fire Max es un popular juego battle royale que ofrece una experiencia de juego premium con gráficos HD, efectos especiales mejorados y un rendimiento más suave. El juego tiene una variedad de emocionantes modos de juego, personajes, trajes, armas, pieles de vehículos y mucho más. Sin embargo, para disfrutar de estas características, los jugadores necesitan diamantes, que son la moneda premium en el juego. Los diamantes se pueden utilizar para comprar artículos de la tienda o canjearlos de las misiones de pase élite.

    -

    apkadmin fuego libre máx diamante hack


    Download Zip »»» https://bltlly.com/2v6LgP



    -

    Sin embargo, los diamantes no son fáciles de conseguir, ya que requieren dinero real para comprarlos. Muchos jugadores buscan formas de obtener diamantes gratis sin gastar un centavo. Uno de los métodos que algunos jugadores intentan usar es mod APKs como Apkadmin, que afirman hackear diamantes y dar cantidades ilimitadas de ellos. Pero, ¿este método es seguro y legal? ¿Y hay otras maneras de obtener diamantes gratis en Free Fire Max? En este artículo, responderemos estas preguntas y más.

    -

    ¿Qué es Apkadmin y cómo se afirma que cortar diamantes?

    -

    Apkadmin es un sitio web que ofrece mod APKs para varios juegos, incluyendo Free Fire Max. Un mod APK es una versión modificada del juego original que tiene algunos cambios o adiciones que no están autorizadas por los desarrolladores. Por ejemplo, Apkadmin afirma proporcionar un mod APK para Free Fire Max que puede dar a los jugadores diamantes ilimitados, dinero, desbloquear todos los personajes, y proporcionar otros beneficios.

    -

    Para usar Apkadmin, los jugadores necesitan descargar el archivo mod APK desde el sitio web e instalarlo en sus dispositivos. Luego, necesitan lanzar el juego e introducir su nombre de usuario y la cantidad de diamantes que quieren. El sitio web afirma que los diamantes se añadirán a su cuenta en cuestión de minutos.

    -

    ¿Apkadmin es seguro y legal de usar?

    - -

    Por lo tanto, le recomendamos encarecidamente que no utilice Apkadmin o cualquier otro mod APKs para Free Fire Max o cualquier otro juego. No valen el riesgo y pueden causar más daño que bien.

    -

    ¿Cómo obtener diamantes gratis en Free Fire Max de forma legal y segura?

    -

    Si quieres obtener diamantes gratis en Free Fire Max sin romper ninguna regla o arriesgar tu dispositivo, hay algunas formas legítimas que puedes probar. Estos son algunos de ellos:

    -

    Membresía semanal o mensual

    -

    En lugar de comprar diamantes directamente desde la sección de recarga, puedes comprar una membresía semanal o mensual que te dará diamantes a un precio más barato. La membresía semanal cuesta 159, mientras que la membresía mensual cuesta 599. Estas membresías le darán 60 diamantes diarios (420 diamantes en total) por una semana y 2000 diamantes en total por un mes. Esta es una gran oferta si desea ahorrar algo de dinero y obtener más diamantes.

    -

    -

    Encuestas online

    -

    Otra forma de obtener diamantes gratis en Free Fire Max es completar encuestas en línea que te recompensan con tarjetas de crédito o regalo de Google Play. Puedes usar estos créditos o tarjetas de regalo para comprar diamantes del juego. Algunas de las aplicaciones o sitios web que ofrecen encuestas en línea son Google opinión Rewards, Swagbucks, Survey Junkie, etc. Sin embargo, tenga cuidado de no compartir ninguna información personal o confidencial con estas aplicaciones o sitios web y solo usar los confiables.

    -

    Descargar nuevas aplicaciones

    -

    Similar a las encuestas en línea, también puede obtener diamantes gratis en Free Fire Max mediante la descarga de nuevas aplicaciones que ofrecen recompensas por probarlos. Algunas de las aplicaciones que ofrecen este servicio son AppNana, AppKarma, FeaturePoints, etc. Puedes ganar puntos descargando y usando estas aplicaciones y luego canjearlas por tarjetas de crédito o regalo de Google Play. Una vez más, tenga cuidado de no descargar aplicaciones maliciosas o dañinas y solo utilice las de confianza.

    -

    Eventos en el juego

    - -

    Crédito gratuito de Google Play

    -

    A veces, Google Play ofrece crédito gratuito a sus usuarios como una oferta promocional o una recompensa por ser clientes leales. Puedes consultar tu cuenta de Google Play para ver si tienes algún crédito gratuito disponible y usarlo para comprar diamantes en Free Fire Max. También puedes consultar tu correo electrónico o las notificaciones de cualquier oferta de Google Play que pueda darte crédito gratuito.

    -

    Conclusión

    -

    En conclusión, Free Fire Max es un juego divertido e inmersivo que requiere diamantes para disfrutar de todo su potencial. Sin embargo, los diamantes no son fáciles de conseguir y muchos jugadores buscan atajos como Apkadmin u otros APK mod que pretenden hackear diamantes. Sin embargo, estos métodos no son seguros ni legales y pueden resultar en que su cuenta sea prohibida o que su dispositivo esté infectado con malware. Por lo tanto, le recomendamos que evite el uso de Apkadmin o cualquier otro mod APKs y en su lugar utilice las formas legítimas que hemos mencionado anteriormente para obtener diamantes gratis en Free Fire Max de forma legal y segura.

    -

    Preguntas frecuentes

    -

    Q1: ¿Cuál es la diferencia entre Free Fire y Free Fire Max?

    -

    A1: Free Fire Max es una versión mejorada de Free Fire que ofrece mejores gráficos, efectos de sonido, animaciones y rendimiento. También tiene algunas características exclusivas como el lobby de 360 grados, el modo craftland, etc. Sin embargo, ambos juegos comparten el mismo servidor y juego, para que pueda jugar con sus amigos que están usando Free Fire.

    -

    Q2: ¿Cuántos diamantes puedo obtener de Apkadmin?

    -

    A2: Apkadmin afirma dar diamantes ilimitados a sus usuarios, pero esto no es cierto. De hecho, Apkadmin no funciona en absoluto y es una estafa que puede dañar su dispositivo o cuenta.

    -

    Q3: ¿Cuáles son los beneficios de los diamantes en Free Fire Max?

    - -

    Q4: ¿Cómo puedo comprobar mi balance de diamantes en Free Fire Max?

    -

    A4: Puede comprobar su balance de diamantes en Free Fire Max tocando el icono de diamante en la esquina superior derecha de la pantalla. También puedes ver tu balance de diamantes cuando visites la tienda o la sección de pases élite.

    -

    Q5: ¿Cómo puedo contactar al servicio al cliente si tengo algún problema con Free Fire Max?

    -

    A5: Puede ponerse en contacto con el servicio al cliente si tiene algún problema con Free Fire Max tocando el icono de configuración en la esquina superior derecha de la pantalla y luego seleccionando el servicio al cliente. También puede visitar el sitio web oficial de Free Fire Max y enviar un boleto allí.

    64aa2da5cf
    -
    -
    \ No newline at end of file diff --git a/spaces/Benson/text-generation/Examples/Descargar Gratis Brawl Estrellas Para Pc.md b/spaces/Benson/text-generation/Examples/Descargar Gratis Brawl Estrellas Para Pc.md deleted file mode 100644 index c9bd064711abf503d277844f824807e941d20f3c..0000000000000000000000000000000000000000 --- a/spaces/Benson/text-generation/Examples/Descargar Gratis Brawl Estrellas Para Pc.md +++ /dev/null @@ -1,105 +0,0 @@ - -

    Cómo descargar gratis Brawl estrellas para PC

    -

    Brawl Stars es un popular juego móvil que te permite formar equipo con tus amigos y competir en varios modos de juego. Pero ¿sabías que también se puede jugar en su PC de forma gratuita? En este artículo, le mostraremos cómo descargar e instalar Brawl Stars en su computadora usando un emulador de Android. Pero primero, echemos un vistazo a lo que es Brawl Stars y por qué es posible que desee jugar en PC.

    -

    descargar gratis brawl estrellas para pc


    Download ✓✓✓ https://bltlly.com/2v6Jau



    -

    ¿Qué es Brawl Stars?

    -

    Brawl Stars es un juego multijugador de ritmo rápido desarrollado por Supercell, los creadores de Clash of Clans y Clash Royale. Fue lanzado en 2018 y desde entonces ha ganado millones de fans en todo el mundo. En Brawl Stars, puedes elegir entre docenas de personajes únicos llamados Brawlers, cada uno con sus propias habilidades y habilidades. Puedes desbloquearlos y actualizarlos mientras juegas y coleccionas skins para personalizar su apariencia.

    -

    Características de Brawl Stars

    -

    Algunas de las características que hacen que Brawl Stars sea divertido y adictivo son:

    -
      -
    • Una variedad de modos de juego, como Gem Grab, Showdown, Brawl Ball, Bounty, Heist y más.
    • -
    • Un juego en constante evolución con nuevos eventos, desafíos, mapas y Brawlers.
    • -
    • Una escena competitiva con tablas de clasificación, clubes, torneos y esports.
    • -
    • Una red social integrada donde puedes chatear, compartir consejos y jugar con tus amigos.
    • -
    • Un sistema de divisas en el juego donde puedes ganar gemas, monedas, fichas y cajas para desbloquear recompensas.
    • -
    -

    Modos de juego de Brawl Stars

    -

    Brawl Stars ofrece una variedad de modos de juego para diferentes gustos y preferencias. Estos son algunos de ellos:

    -
      -
    • Gem Grab: Un modo 3v3 donde tienes que recoger y mantener 10 gemas para ganar. Pero ten cuidado, si te derrotan, se te caerán las gemas.
    • -
    • Showdown: Un modo solo o dúo en el que tienes que sobrevivir contra otros jugadores en un mapa cada vez más pequeño. Recoge power-ups para aumentar su fuerza y ser el último en pie.
    • - -
    • Bounty: Un modo 3v3 donde tienes que eliminar oponentes para ganar estrellas. El equipo con más estrellas al final gana.
    • -
    • Robo: Un modo 3v3 donde tienes que proteger tu caja fuerte y tratar de entrar en la caja fuerte del enemigo. Usa tus armas y aparatos para abrirte paso.
    • -
    -

    ¿Por qué jugar Brawl estrellas en el PC?

    -

    Brawl Stars está diseñado para dispositivos móviles, pero eso no significa que no puedas disfrutarlo en tu PC. Hay algunas ventajas y desventajas de jugar Brawl Stars en el PC que debe considerar antes de descargarlo.

    -

    -

    Ventajas de jugar en PC

    -

    Algunos de los beneficios de jugar Brawl Stars en PC son:

    -
      -
    • Una pantalla más grande que le da una mejor vista de la acción.
    • -
    • Un ratón y un teclado que te dan controles más precisos y cómodos.
    • -
    • Una conexión a Internet más rápida y estable que reduce el retraso y desconecta.
    • -
    • Una mayor duración de la batería que le permite jugar durante horas sin preocuparse por cargar el teléfono.
    • -
    -

    Desventajas de jugar en PC

    -

    Algunos de los inconvenientes de jugar Brawl Stars en PC son:

      -
    • Una posible violación de los términos de servicio del juego que puede resultar en una prohibición o suspensión de su cuenta.
    • -
    • Un riesgo potencial de malware o virus que pueden dañar su PC o comprometer sus datos.
    • -
    • Falta de soporte oficial o actualizaciones de los desarrolladores de juegos que pueden afectar tu experiencia de juego.
    • -
    -

    ¿Cómo se juega Brawl Stars en PC con un emulador de Android?

    -

    Si decides jugar Brawl Stars en PC, necesitarás un emulador de Android. Un emulador de Android es un software que simula el sistema operativo Android en su PC, lo que le permite ejecutar aplicaciones y juegos de Android en su computadora. Hay muchos emuladores de Android disponibles en línea, pero no todos son compatibles con Brawl Stars. Estos son algunos de los mejores que recomendamos.

    -

    ¿Qué es un emulador de Android?

    - -

    Los mejores emuladores de Android para PC

    - - -Nombre -Características -Pros -Contras - - -

    BlueStacks

    -- El emulador de Android más popular y ampliamente utilizado para PC.
    - Soporta juegos de alto rendimiento con gráficos y controles avanzados.
    - Ofrece una tienda de aplicaciones dedicada con juegos y ofertas exclusivas.
    - Compatible con Windows y Mac OS. -- Fácil de instalar y usar.
    - Soporta múltiples cuentas e instancias.
    - Proporciona actualizaciones y mejoras regulares.
    - Tiene una comunidad grande y activa. -- Puede consumir muchos recursos de CPU y RAM.
    - Puede mostrar anuncios y promociones.
    - Puede tener problemas de compatibilidad con algunas aplicaciones y juegos. - - -

    NoxPlayer

    -- Un emulador de Android potente y ligero para PC.
    - Soporta juegos suaves con alta resolución y FPS.
    - Ofrece una interfaz y configuración personalizable.
    - Compatible con Windows y Mac OS. -- Rendimiento rápido y estable.
    - Soporta controles de teclado, ratón y gamepad.
    - Soporta acceso root y transferencia de archivos.
    - Tiene un grabador de pantalla incorporado y un grabador de macros. -- Puede tener riesgos de seguridad y preocupaciones de privacidad.
    - Puede tener errores y problemas técnicos.
    - No puede soportar las últimas versiones de Android. - - -

    MEmu

    -- Un emulador de Android flexible y versátil para PC.
    - Soporta múltiples géneros de juegos y plataformas.
    - Ofrece una función de asignación de claves inteligentes y una herramienta de asistente de juego.
    - Compatible con Windows OS. -- Juego rápido y sin problemas.
    - Soporta múltiples idiomas y regiones.
    - Soporta instalación de arrastrar y soltar y archivos APK.
    - Tiene un bajo requisito del sistema. -- Puede tener anuncios y ventanas emergentes.
    - Puede tener problemas de compatibilidad con algunas aplicaciones y juegos.
    - No puede ser compatible con Mac OS. - -
    -

    Pasos para instalar y ejecutar Brawl Stars en PC con un emulador

    - -
      -
    1. Descargar e instalar el emulador desde su sitio web oficial o una fuente de confianza.
    2. -
    3. Inicie el emulador e inicie sesión con su cuenta de Google o cree uno nuevo.
    4. -
    5. Abra la aplicación Google Play Store en el emulador y busque Brawl Stars.
    6. -
    7. Haga clic en el botón Instalar y espere a que el juego se descargue.
    8. -
    9. Haz clic en el botón Abrir o encuentra el icono del juego en la pantalla de inicio del emulador.
    10. -
    11. Disfruta jugando Brawl Stars en tu PC con tu ratón y teclado o tu controlador preferido.
    12. -
    -

    Conclusión

    -

    Brawl Stars es un juego divertido y emocionante que puedes jugar en tu dispositivo móvil o tu PC. Jugar en PC tiene sus ventajas y desventajas, pero puede ser una gran manera de disfrutar del juego en una pantalla más grande con mejores controles. Para jugar Brawl Stars en PC, necesitará un emulador de Android que pueda ejecutar el juego sin problemas y de forma segura. Hemos enumerado algunos de los mejores que puedes probar, pero también puedes explorar otras opciones que te pueden ir mejor. Solo asegúrate de seguir los pasos cuidadosamente y respetar los términos de servicio del juego. ¡Diviértete peleando!

    -

    Preguntas frecuentes

    -
      -
    • P: ¿Es Brawl Stars libre para jugar? -
    • Q: ¿Puedo jugar Brawl Stars con mis amigos en el PC?
    • -R: Sí, puedes jugar Brawl Stars con tus amigos en el PC, siempre y cuando también estén usando un emulador de Android o un dispositivo móvil. Puede unirse o crear un club para chatear y jugar con sus amigos, o invitarlos a un partido amistoso o un código de equipo. También puedes usar chat de voz o de texto para comunicarte con tus compañeros de equipo durante el juego. -
    • Q: ¿Cómo puedo actualizar Brawl Stars en PC?
    • - -
    • Q: ¿Es seguro jugar Brawl Stars en PC?
    • -R: Jugar Brawl Stars en PC generalmente es seguro, siempre y cuando use un emulador de Android confiable y seguro que no contenga malware o virus. Sin embargo, también debes tener cuidado con la seguridad y privacidad de tu cuenta, y evitar el uso de hacks o trucos que puedan violar los términos de servicio del juego. Si encuentras algún problema o problema mientras juegas Brawl Stars en PC, puedes contactar al equipo de soporte del juego o al servicio al cliente del emulador para obtener ayuda. -
    • Q: ¿Cuáles son algunos consejos y trucos para jugar Brawl Stars en PC?
    • -R: Algunos de los consejos y trucos que pueden ayudarte a mejorar tus habilidades y disfrutar jugando Brawl Stars en PC son:

      -
        -
      • Elige un Brawler que se adapte a tu estilo de juego y al modo de juego. Experimenta con diferentes Brawlers y aprende sus fortalezas y debilidades.
      • -
      • Personaliza tus controles y ajustes para optimizar tu rendimiento y comodidad. Puede ajustar la sensibilidad, la resolución, el sonido, la asignación de claves y otras opciones según sus preferencias.
      • -
      • Usa el entorno y los obstáculos a tu favor. Escóndete detrás de muros, arbustos y barriles para emboscar a tus enemigos o escapar del peligro.
      • -
      • Trabaja con tus compañeros de equipo y coordina tus estrategias. Usa tus habilidades y gadgets para apoyarse mutuamente y crear combos.
      • -
      • Diviértete y no te frustres. Brawl Stars es un juego que requiere práctica y paciencia, pero también pretende ser divertido y entretenido. No deje que las pérdidas o errores arruinen su estado de ánimo o motivación.
      • -
      -

    64aa2da5cf
    -
    -
    \ No newline at end of file diff --git a/spaces/Big-Web/MMSD/env/Lib/site-packages/pip/_vendor/distlib/index.py b/spaces/Big-Web/MMSD/env/Lib/site-packages/pip/_vendor/distlib/index.py deleted file mode 100644 index 9b6d129ed690361770738bec73f44ba7e10a21c5..0000000000000000000000000000000000000000 --- a/spaces/Big-Web/MMSD/env/Lib/site-packages/pip/_vendor/distlib/index.py +++ /dev/null @@ -1,508 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (C) 2013 Vinay Sajip. -# Licensed to the Python Software Foundation under a contributor agreement. -# See LICENSE.txt and CONTRIBUTORS.txt. -# -import hashlib -import logging -import os -import shutil -import subprocess -import tempfile -try: - from threading import Thread -except ImportError: # pragma: no cover - from dummy_threading import Thread - -from . import DistlibException -from .compat import (HTTPBasicAuthHandler, Request, HTTPPasswordMgr, - urlparse, build_opener, string_types) -from .util import zip_dir, ServerProxy - -logger = logging.getLogger(__name__) - -DEFAULT_INDEX = 'https://pypi.org/pypi' -DEFAULT_REALM = 'pypi' - -class PackageIndex(object): - """ - This class represents a package index compatible with PyPI, the Python - Package Index. - """ - - boundary = b'----------ThIs_Is_tHe_distlib_index_bouNdaRY_$' - - def __init__(self, url=None): - """ - Initialise an instance. - - :param url: The URL of the index. If not specified, the URL for PyPI is - used. - """ - self.url = url or DEFAULT_INDEX - self.read_configuration() - scheme, netloc, path, params, query, frag = urlparse(self.url) - if params or query or frag or scheme not in ('http', 'https'): - raise DistlibException('invalid repository: %s' % self.url) - self.password_handler = None - self.ssl_verifier = None - self.gpg = None - self.gpg_home = None - with open(os.devnull, 'w') as sink: - # Use gpg by default rather than gpg2, as gpg2 insists on - # prompting for passwords - for s in ('gpg', 'gpg2'): - try: - rc = subprocess.check_call([s, '--version'], stdout=sink, - stderr=sink) - if rc == 0: - self.gpg = s - break - except OSError: - pass - - def _get_pypirc_command(self): - """ - Get the distutils command for interacting with PyPI configurations. - :return: the command. - """ - from .util import _get_pypirc_command as cmd - return cmd() - - def read_configuration(self): - """ - Read the PyPI access configuration as supported by distutils. This populates - ``username``, ``password``, ``realm`` and ``url`` attributes from the - configuration. - """ - from .util import _load_pypirc - cfg = _load_pypirc(self) - self.username = cfg.get('username') - self.password = cfg.get('password') - self.realm = cfg.get('realm', 'pypi') - self.url = cfg.get('repository', self.url) - - def save_configuration(self): - """ - Save the PyPI access configuration. You must have set ``username`` and - ``password`` attributes before calling this method. - """ - self.check_credentials() - from .util import _store_pypirc - _store_pypirc(self) - - def check_credentials(self): - """ - Check that ``username`` and ``password`` have been set, and raise an - exception if not. - """ - if self.username is None or self.password is None: - raise DistlibException('username and password must be set') - pm = HTTPPasswordMgr() - _, netloc, _, _, _, _ = urlparse(self.url) - pm.add_password(self.realm, netloc, self.username, self.password) - self.password_handler = HTTPBasicAuthHandler(pm) - - def register(self, metadata): # pragma: no cover - """ - Register a distribution on PyPI, using the provided metadata. - - :param metadata: A :class:`Metadata` instance defining at least a name - and version number for the distribution to be - registered. - :return: The HTTP response received from PyPI upon submission of the - request. - """ - self.check_credentials() - metadata.validate() - d = metadata.todict() - d[':action'] = 'verify' - request = self.encode_request(d.items(), []) - response = self.send_request(request) - d[':action'] = 'submit' - request = self.encode_request(d.items(), []) - return self.send_request(request) - - def _reader(self, name, stream, outbuf): - """ - Thread runner for reading lines of from a subprocess into a buffer. - - :param name: The logical name of the stream (used for logging only). - :param stream: The stream to read from. This will typically a pipe - connected to the output stream of a subprocess. - :param outbuf: The list to append the read lines to. - """ - while True: - s = stream.readline() - if not s: - break - s = s.decode('utf-8').rstrip() - outbuf.append(s) - logger.debug('%s: %s' % (name, s)) - stream.close() - - def get_sign_command(self, filename, signer, sign_password, keystore=None): # pragma: no cover - """ - Return a suitable command for signing a file. - - :param filename: The pathname to the file to be signed. - :param signer: The identifier of the signer of the file. - :param sign_password: The passphrase for the signer's - private key used for signing. - :param keystore: The path to a directory which contains the keys - used in verification. If not specified, the - instance's ``gpg_home`` attribute is used instead. - :return: The signing command as a list suitable to be - passed to :class:`subprocess.Popen`. - """ - cmd = [self.gpg, '--status-fd', '2', '--no-tty'] - if keystore is None: - keystore = self.gpg_home - if keystore: - cmd.extend(['--homedir', keystore]) - if sign_password is not None: - cmd.extend(['--batch', '--passphrase-fd', '0']) - td = tempfile.mkdtemp() - sf = os.path.join(td, os.path.basename(filename) + '.asc') - cmd.extend(['--detach-sign', '--armor', '--local-user', - signer, '--output', sf, filename]) - logger.debug('invoking: %s', ' '.join(cmd)) - return cmd, sf - - def run_command(self, cmd, input_data=None): - """ - Run a command in a child process , passing it any input data specified. - - :param cmd: The command to run. - :param input_data: If specified, this must be a byte string containing - data to be sent to the child process. - :return: A tuple consisting of the subprocess' exit code, a list of - lines read from the subprocess' ``stdout``, and a list of - lines read from the subprocess' ``stderr``. - """ - kwargs = { - 'stdout': subprocess.PIPE, - 'stderr': subprocess.PIPE, - } - if input_data is not None: - kwargs['stdin'] = subprocess.PIPE - stdout = [] - stderr = [] - p = subprocess.Popen(cmd, **kwargs) - # We don't use communicate() here because we may need to - # get clever with interacting with the command - t1 = Thread(target=self._reader, args=('stdout', p.stdout, stdout)) - t1.start() - t2 = Thread(target=self._reader, args=('stderr', p.stderr, stderr)) - t2.start() - if input_data is not None: - p.stdin.write(input_data) - p.stdin.close() - - p.wait() - t1.join() - t2.join() - return p.returncode, stdout, stderr - - def sign_file(self, filename, signer, sign_password, keystore=None): # pragma: no cover - """ - Sign a file. - - :param filename: The pathname to the file to be signed. - :param signer: The identifier of the signer of the file. - :param sign_password: The passphrase for the signer's - private key used for signing. - :param keystore: The path to a directory which contains the keys - used in signing. If not specified, the instance's - ``gpg_home`` attribute is used instead. - :return: The absolute pathname of the file where the signature is - stored. - """ - cmd, sig_file = self.get_sign_command(filename, signer, sign_password, - keystore) - rc, stdout, stderr = self.run_command(cmd, - sign_password.encode('utf-8')) - if rc != 0: - raise DistlibException('sign command failed with error ' - 'code %s' % rc) - return sig_file - - def upload_file(self, metadata, filename, signer=None, sign_password=None, - filetype='sdist', pyversion='source', keystore=None): - """ - Upload a release file to the index. - - :param metadata: A :class:`Metadata` instance defining at least a name - and version number for the file to be uploaded. - :param filename: The pathname of the file to be uploaded. - :param signer: The identifier of the signer of the file. - :param sign_password: The passphrase for the signer's - private key used for signing. - :param filetype: The type of the file being uploaded. This is the - distutils command which produced that file, e.g. - ``sdist`` or ``bdist_wheel``. - :param pyversion: The version of Python which the release relates - to. For code compatible with any Python, this would - be ``source``, otherwise it would be e.g. ``3.2``. - :param keystore: The path to a directory which contains the keys - used in signing. If not specified, the instance's - ``gpg_home`` attribute is used instead. - :return: The HTTP response received from PyPI upon submission of the - request. - """ - self.check_credentials() - if not os.path.exists(filename): - raise DistlibException('not found: %s' % filename) - metadata.validate() - d = metadata.todict() - sig_file = None - if signer: - if not self.gpg: - logger.warning('no signing program available - not signed') - else: - sig_file = self.sign_file(filename, signer, sign_password, - keystore) - with open(filename, 'rb') as f: - file_data = f.read() - md5_digest = hashlib.md5(file_data).hexdigest() - sha256_digest = hashlib.sha256(file_data).hexdigest() - d.update({ - ':action': 'file_upload', - 'protocol_version': '1', - 'filetype': filetype, - 'pyversion': pyversion, - 'md5_digest': md5_digest, - 'sha256_digest': sha256_digest, - }) - files = [('content', os.path.basename(filename), file_data)] - if sig_file: - with open(sig_file, 'rb') as f: - sig_data = f.read() - files.append(('gpg_signature', os.path.basename(sig_file), - sig_data)) - shutil.rmtree(os.path.dirname(sig_file)) - request = self.encode_request(d.items(), files) - return self.send_request(request) - - def upload_documentation(self, metadata, doc_dir): # pragma: no cover - """ - Upload documentation to the index. - - :param metadata: A :class:`Metadata` instance defining at least a name - and version number for the documentation to be - uploaded. - :param doc_dir: The pathname of the directory which contains the - documentation. This should be the directory that - contains the ``index.html`` for the documentation. - :return: The HTTP response received from PyPI upon submission of the - request. - """ - self.check_credentials() - if not os.path.isdir(doc_dir): - raise DistlibException('not a directory: %r' % doc_dir) - fn = os.path.join(doc_dir, 'index.html') - if not os.path.exists(fn): - raise DistlibException('not found: %r' % fn) - metadata.validate() - name, version = metadata.name, metadata.version - zip_data = zip_dir(doc_dir).getvalue() - fields = [(':action', 'doc_upload'), - ('name', name), ('version', version)] - files = [('content', name, zip_data)] - request = self.encode_request(fields, files) - return self.send_request(request) - - def get_verify_command(self, signature_filename, data_filename, - keystore=None): - """ - Return a suitable command for verifying a file. - - :param signature_filename: The pathname to the file containing the - signature. - :param data_filename: The pathname to the file containing the - signed data. - :param keystore: The path to a directory which contains the keys - used in verification. If not specified, the - instance's ``gpg_home`` attribute is used instead. - :return: The verifying command as a list suitable to be - passed to :class:`subprocess.Popen`. - """ - cmd = [self.gpg, '--status-fd', '2', '--no-tty'] - if keystore is None: - keystore = self.gpg_home - if keystore: - cmd.extend(['--homedir', keystore]) - cmd.extend(['--verify', signature_filename, data_filename]) - logger.debug('invoking: %s', ' '.join(cmd)) - return cmd - - def verify_signature(self, signature_filename, data_filename, - keystore=None): - """ - Verify a signature for a file. - - :param signature_filename: The pathname to the file containing the - signature. - :param data_filename: The pathname to the file containing the - signed data. - :param keystore: The path to a directory which contains the keys - used in verification. If not specified, the - instance's ``gpg_home`` attribute is used instead. - :return: True if the signature was verified, else False. - """ - if not self.gpg: - raise DistlibException('verification unavailable because gpg ' - 'unavailable') - cmd = self.get_verify_command(signature_filename, data_filename, - keystore) - rc, stdout, stderr = self.run_command(cmd) - if rc not in (0, 1): - raise DistlibException('verify command failed with error ' - 'code %s' % rc) - return rc == 0 - - def download_file(self, url, destfile, digest=None, reporthook=None): - """ - This is a convenience method for downloading a file from an URL. - Normally, this will be a file from the index, though currently - no check is made for this (i.e. a file can be downloaded from - anywhere). - - The method is just like the :func:`urlretrieve` function in the - standard library, except that it allows digest computation to be - done during download and checking that the downloaded data - matched any expected value. - - :param url: The URL of the file to be downloaded (assumed to be - available via an HTTP GET request). - :param destfile: The pathname where the downloaded file is to be - saved. - :param digest: If specified, this must be a (hasher, value) - tuple, where hasher is the algorithm used (e.g. - ``'md5'``) and ``value`` is the expected value. - :param reporthook: The same as for :func:`urlretrieve` in the - standard library. - """ - if digest is None: - digester = None - logger.debug('No digest specified') - else: - if isinstance(digest, (list, tuple)): - hasher, digest = digest - else: - hasher = 'md5' - digester = getattr(hashlib, hasher)() - logger.debug('Digest specified: %s' % digest) - # The following code is equivalent to urlretrieve. - # We need to do it this way so that we can compute the - # digest of the file as we go. - with open(destfile, 'wb') as dfp: - # addinfourl is not a context manager on 2.x - # so we have to use try/finally - sfp = self.send_request(Request(url)) - try: - headers = sfp.info() - blocksize = 8192 - size = -1 - read = 0 - blocknum = 0 - if "content-length" in headers: - size = int(headers["Content-Length"]) - if reporthook: - reporthook(blocknum, blocksize, size) - while True: - block = sfp.read(blocksize) - if not block: - break - read += len(block) - dfp.write(block) - if digester: - digester.update(block) - blocknum += 1 - if reporthook: - reporthook(blocknum, blocksize, size) - finally: - sfp.close() - - # check that we got the whole file, if we can - if size >= 0 and read < size: - raise DistlibException( - 'retrieval incomplete: got only %d out of %d bytes' - % (read, size)) - # if we have a digest, it must match. - if digester: - actual = digester.hexdigest() - if digest != actual: - raise DistlibException('%s digest mismatch for %s: expected ' - '%s, got %s' % (hasher, destfile, - digest, actual)) - logger.debug('Digest verified: %s', digest) - - def send_request(self, req): - """ - Send a standard library :class:`Request` to PyPI and return its - response. - - :param req: The request to send. - :return: The HTTP response from PyPI (a standard library HTTPResponse). - """ - handlers = [] - if self.password_handler: - handlers.append(self.password_handler) - if self.ssl_verifier: - handlers.append(self.ssl_verifier) - opener = build_opener(*handlers) - return opener.open(req) - - def encode_request(self, fields, files): - """ - Encode fields and files for posting to an HTTP server. - - :param fields: The fields to send as a list of (fieldname, value) - tuples. - :param files: The files to send as a list of (fieldname, filename, - file_bytes) tuple. - """ - # Adapted from packaging, which in turn was adapted from - # http://code.activestate.com/recipes/146306 - - parts = [] - boundary = self.boundary - for k, values in fields: - if not isinstance(values, (list, tuple)): - values = [values] - - for v in values: - parts.extend(( - b'--' + boundary, - ('Content-Disposition: form-data; name="%s"' % - k).encode('utf-8'), - b'', - v.encode('utf-8'))) - for key, filename, value in files: - parts.extend(( - b'--' + boundary, - ('Content-Disposition: form-data; name="%s"; filename="%s"' % - (key, filename)).encode('utf-8'), - b'', - value)) - - parts.extend((b'--' + boundary + b'--', b'')) - - body = b'\r\n'.join(parts) - ct = b'multipart/form-data; boundary=' + boundary - headers = { - 'Content-type': ct, - 'Content-length': str(len(body)) - } - return Request(self.url, body, headers) - - def search(self, terms, operator=None): # pragma: no cover - if isinstance(terms, string_types): - terms = {'name': terms} - rpc_proxy = ServerProxy(self.url, timeout=3.0) - try: - return rpc_proxy.search(terms, operator or 'and') - finally: - rpc_proxy('close')() diff --git a/spaces/Big-Web/MMSD/env/Lib/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py b/spaces/Big-Web/MMSD/env/Lib/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py deleted file mode 100644 index ee511ff20d73bb245fe7ae0c1fc31a41c33e7d29..0000000000000000000000000000000000000000 --- a/spaces/Big-Web/MMSD/env/Lib/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py +++ /dev/null @@ -1,353 +0,0 @@ -"""This is invoked in a subprocess to call the build backend hooks. - -It expects: -- Command line args: hook_name, control_dir -- Environment variables: - PEP517_BUILD_BACKEND=entry.point:spec - PEP517_BACKEND_PATH=paths (separated with os.pathsep) -- control_dir/input.json: - - {"kwargs": {...}} - -Results: -- control_dir/output.json - - {"return_val": ...} -""" -import json -import os -import os.path -import re -import shutil -import sys -import traceback -from glob import glob -from importlib import import_module -from os.path import join as pjoin - -# This file is run as a script, and `import wrappers` is not zip-safe, so we -# include write_json() and read_json() from wrappers.py. - - -def write_json(obj, path, **kwargs): - with open(path, 'w', encoding='utf-8') as f: - json.dump(obj, f, **kwargs) - - -def read_json(path): - with open(path, encoding='utf-8') as f: - return json.load(f) - - -class BackendUnavailable(Exception): - """Raised if we cannot import the backend""" - def __init__(self, traceback): - self.traceback = traceback - - -class BackendInvalid(Exception): - """Raised if the backend is invalid""" - def __init__(self, message): - self.message = message - - -class HookMissing(Exception): - """Raised if a hook is missing and we are not executing the fallback""" - def __init__(self, hook_name=None): - super().__init__(hook_name) - self.hook_name = hook_name - - -def contained_in(filename, directory): - """Test if a file is located within the given directory.""" - filename = os.path.normcase(os.path.abspath(filename)) - directory = os.path.normcase(os.path.abspath(directory)) - return os.path.commonprefix([filename, directory]) == directory - - -def _build_backend(): - """Find and load the build backend""" - # Add in-tree backend directories to the front of sys.path. - backend_path = os.environ.get('PEP517_BACKEND_PATH') - if backend_path: - extra_pathitems = backend_path.split(os.pathsep) - sys.path[:0] = extra_pathitems - - ep = os.environ['PEP517_BUILD_BACKEND'] - mod_path, _, obj_path = ep.partition(':') - try: - obj = import_module(mod_path) - except ImportError: - raise BackendUnavailable(traceback.format_exc()) - - if backend_path: - if not any( - contained_in(obj.__file__, path) - for path in extra_pathitems - ): - raise BackendInvalid("Backend was not loaded from backend-path") - - if obj_path: - for path_part in obj_path.split('.'): - obj = getattr(obj, path_part) - return obj - - -def _supported_features(): - """Return the list of options features supported by the backend. - - Returns a list of strings. - The only possible value is 'build_editable'. - """ - backend = _build_backend() - features = [] - if hasattr(backend, "build_editable"): - features.append("build_editable") - return features - - -def get_requires_for_build_wheel(config_settings): - """Invoke the optional get_requires_for_build_wheel hook - - Returns [] if the hook is not defined. - """ - backend = _build_backend() - try: - hook = backend.get_requires_for_build_wheel - except AttributeError: - return [] - else: - return hook(config_settings) - - -def get_requires_for_build_editable(config_settings): - """Invoke the optional get_requires_for_build_editable hook - - Returns [] if the hook is not defined. - """ - backend = _build_backend() - try: - hook = backend.get_requires_for_build_editable - except AttributeError: - return [] - else: - return hook(config_settings) - - -def prepare_metadata_for_build_wheel( - metadata_directory, config_settings, _allow_fallback): - """Invoke optional prepare_metadata_for_build_wheel - - Implements a fallback by building a wheel if the hook isn't defined, - unless _allow_fallback is False in which case HookMissing is raised. - """ - backend = _build_backend() - try: - hook = backend.prepare_metadata_for_build_wheel - except AttributeError: - if not _allow_fallback: - raise HookMissing() - else: - return hook(metadata_directory, config_settings) - # fallback to build_wheel outside the try block to avoid exception chaining - # which can be confusing to users and is not relevant - whl_basename = backend.build_wheel(metadata_directory, config_settings) - return _get_wheel_metadata_from_wheel(whl_basename, metadata_directory, - config_settings) - - -def prepare_metadata_for_build_editable( - metadata_directory, config_settings, _allow_fallback): - """Invoke optional prepare_metadata_for_build_editable - - Implements a fallback by building an editable wheel if the hook isn't - defined, unless _allow_fallback is False in which case HookMissing is - raised. - """ - backend = _build_backend() - try: - hook = backend.prepare_metadata_for_build_editable - except AttributeError: - if not _allow_fallback: - raise HookMissing() - try: - build_hook = backend.build_editable - except AttributeError: - raise HookMissing(hook_name='build_editable') - else: - whl_basename = build_hook(metadata_directory, config_settings) - return _get_wheel_metadata_from_wheel(whl_basename, - metadata_directory, - config_settings) - else: - return hook(metadata_directory, config_settings) - - -WHEEL_BUILT_MARKER = 'PEP517_ALREADY_BUILT_WHEEL' - - -def _dist_info_files(whl_zip): - """Identify the .dist-info folder inside a wheel ZipFile.""" - res = [] - for path in whl_zip.namelist(): - m = re.match(r'[^/\\]+-[^/\\]+\.dist-info/', path) - if m: - res.append(path) - if res: - return res - raise Exception("No .dist-info folder found in wheel") - - -def _get_wheel_metadata_from_wheel( - whl_basename, metadata_directory, config_settings): - """Extract the metadata from a wheel. - - Fallback for when the build backend does not - define the 'get_wheel_metadata' hook. - """ - from zipfile import ZipFile - with open(os.path.join(metadata_directory, WHEEL_BUILT_MARKER), 'wb'): - pass # Touch marker file - - whl_file = os.path.join(metadata_directory, whl_basename) - with ZipFile(whl_file) as zipf: - dist_info = _dist_info_files(zipf) - zipf.extractall(path=metadata_directory, members=dist_info) - return dist_info[0].split('/')[0] - - -def _find_already_built_wheel(metadata_directory): - """Check for a wheel already built during the get_wheel_metadata hook. - """ - if not metadata_directory: - return None - metadata_parent = os.path.dirname(metadata_directory) - if not os.path.isfile(pjoin(metadata_parent, WHEEL_BUILT_MARKER)): - return None - - whl_files = glob(os.path.join(metadata_parent, '*.whl')) - if not whl_files: - print('Found wheel built marker, but no .whl files') - return None - if len(whl_files) > 1: - print('Found multiple .whl files; unspecified behaviour. ' - 'Will call build_wheel.') - return None - - # Exactly one .whl file - return whl_files[0] - - -def build_wheel(wheel_directory, config_settings, metadata_directory=None): - """Invoke the mandatory build_wheel hook. - - If a wheel was already built in the - prepare_metadata_for_build_wheel fallback, this - will copy it rather than rebuilding the wheel. - """ - prebuilt_whl = _find_already_built_wheel(metadata_directory) - if prebuilt_whl: - shutil.copy2(prebuilt_whl, wheel_directory) - return os.path.basename(prebuilt_whl) - - return _build_backend().build_wheel(wheel_directory, config_settings, - metadata_directory) - - -def build_editable(wheel_directory, config_settings, metadata_directory=None): - """Invoke the optional build_editable hook. - - If a wheel was already built in the - prepare_metadata_for_build_editable fallback, this - will copy it rather than rebuilding the wheel. - """ - backend = _build_backend() - try: - hook = backend.build_editable - except AttributeError: - raise HookMissing() - else: - prebuilt_whl = _find_already_built_wheel(metadata_directory) - if prebuilt_whl: - shutil.copy2(prebuilt_whl, wheel_directory) - return os.path.basename(prebuilt_whl) - - return hook(wheel_directory, config_settings, metadata_directory) - - -def get_requires_for_build_sdist(config_settings): - """Invoke the optional get_requires_for_build_wheel hook - - Returns [] if the hook is not defined. - """ - backend = _build_backend() - try: - hook = backend.get_requires_for_build_sdist - except AttributeError: - return [] - else: - return hook(config_settings) - - -class _DummyException(Exception): - """Nothing should ever raise this exception""" - - -class GotUnsupportedOperation(Exception): - """For internal use when backend raises UnsupportedOperation""" - def __init__(self, traceback): - self.traceback = traceback - - -def build_sdist(sdist_directory, config_settings): - """Invoke the mandatory build_sdist hook.""" - backend = _build_backend() - try: - return backend.build_sdist(sdist_directory, config_settings) - except getattr(backend, 'UnsupportedOperation', _DummyException): - raise GotUnsupportedOperation(traceback.format_exc()) - - -HOOK_NAMES = { - 'get_requires_for_build_wheel', - 'prepare_metadata_for_build_wheel', - 'build_wheel', - 'get_requires_for_build_editable', - 'prepare_metadata_for_build_editable', - 'build_editable', - 'get_requires_for_build_sdist', - 'build_sdist', - '_supported_features', -} - - -def main(): - if len(sys.argv) < 3: - sys.exit("Needs args: hook_name, control_dir") - hook_name = sys.argv[1] - control_dir = sys.argv[2] - if hook_name not in HOOK_NAMES: - sys.exit("Unknown hook: %s" % hook_name) - hook = globals()[hook_name] - - hook_input = read_json(pjoin(control_dir, 'input.json')) - - json_out = {'unsupported': False, 'return_val': None} - try: - json_out['return_val'] = hook(**hook_input['kwargs']) - except BackendUnavailable as e: - json_out['no_backend'] = True - json_out['traceback'] = e.traceback - except BackendInvalid as e: - json_out['backend_invalid'] = True - json_out['backend_error'] = e.message - except GotUnsupportedOperation as e: - json_out['unsupported'] = True - json_out['traceback'] = e.traceback - except HookMissing as e: - json_out['hook_missing'] = True - json_out['missing_hook_name'] = e.hook_name or hook_name - - write_json(json_out, pjoin(control_dir, 'output.json'), indent=2) - - -if __name__ == '__main__': - main() diff --git a/spaces/CVPR/Dual-Key_Backdoor_Attacks/datagen/detectron2/detectron2/layers/csrc/ROIAlign/ROIAlign.h b/spaces/CVPR/Dual-Key_Backdoor_Attacks/datagen/detectron2/detectron2/layers/csrc/ROIAlign/ROIAlign.h deleted file mode 100644 index 7ec4e23076334f643f4a6bd69df66ba549f15f2e..0000000000000000000000000000000000000000 --- a/spaces/CVPR/Dual-Key_Backdoor_Attacks/datagen/detectron2/detectron2/layers/csrc/ROIAlign/ROIAlign.h +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved -#pragma once -#include - -namespace detectron2 { - -at::Tensor ROIAlign_forward_cpu( - const at::Tensor& input, - const at::Tensor& rois, - const float spatial_scale, - const int pooled_height, - const int pooled_width, - const int sampling_ratio, - bool aligned); - -at::Tensor ROIAlign_backward_cpu( - const at::Tensor& grad, - const at::Tensor& rois, - const float spatial_scale, - const int pooled_height, - const int pooled_width, - const int batch_size, - const int channels, - const int height, - const int width, - const int sampling_ratio, - bool aligned); - -#ifdef WITH_CUDA -at::Tensor ROIAlign_forward_cuda( - const at::Tensor& input, - const at::Tensor& rois, - const float spatial_scale, - const int pooled_height, - const int pooled_width, - const int sampling_ratio, - bool aligned); - -at::Tensor ROIAlign_backward_cuda( - const at::Tensor& grad, - const at::Tensor& rois, - const float spatial_scale, - const int pooled_height, - const int pooled_width, - const int batch_size, - const int channels, - const int height, - const int width, - const int sampling_ratio, - bool aligned); -#endif - -// Interface for Python -inline at::Tensor ROIAlign_forward( - const at::Tensor& input, - const at::Tensor& rois, - const float spatial_scale, - const int pooled_height, - const int pooled_width, - const int sampling_ratio, - bool aligned) { - if (input.type().is_cuda()) { -#ifdef WITH_CUDA - return ROIAlign_forward_cuda( - input, - rois, - spatial_scale, - pooled_height, - pooled_width, - sampling_ratio, - aligned); -#else - AT_ERROR("Not compiled with GPU support"); -#endif - } - return ROIAlign_forward_cpu( - input, - rois, - spatial_scale, - pooled_height, - pooled_width, - sampling_ratio, - aligned); -} - -inline at::Tensor ROIAlign_backward( - const at::Tensor& grad, - const at::Tensor& rois, - const float spatial_scale, - const int pooled_height, - const int pooled_width, - const int batch_size, - const int channels, - const int height, - const int width, - const int sampling_ratio, - bool aligned) { - if (grad.type().is_cuda()) { -#ifdef WITH_CUDA - return ROIAlign_backward_cuda( - grad, - rois, - spatial_scale, - pooled_height, - pooled_width, - batch_size, - channels, - height, - width, - sampling_ratio, - aligned); -#else - AT_ERROR("Not compiled with GPU support"); -#endif - } - return ROIAlign_backward_cpu( - grad, - rois, - spatial_scale, - pooled_height, - pooled_width, - batch_size, - channels, - height, - width, - sampling_ratio, - aligned); -} - -} // namespace detectron2 diff --git a/spaces/CVPR/LIVE/thrust/thrust/system/detail/sequential/scan.h b/spaces/CVPR/LIVE/thrust/thrust/system/detail/sequential/scan.h deleted file mode 100644 index 3bffc93d79d3c19d59364d9c986017d635b489e2..0000000000000000000000000000000000000000 --- a/spaces/CVPR/LIVE/thrust/thrust/system/detail/sequential/scan.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright 2008-2013 NVIDIA Corporation - * - * 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. - */ - - -/*! \file scan.h - * \brief Sequential implementations of scan functions. - */ - -#pragma once - -#include -#include -#include -#include -#include -#include -#include - -namespace thrust -{ -namespace system -{ -namespace detail -{ -namespace sequential -{ - - -__thrust_exec_check_disable__ -template -__host__ __device__ - OutputIterator inclusive_scan(sequential::execution_policy &, - InputIterator first, - InputIterator last, - OutputIterator result, - BinaryFunction binary_op) -{ - using namespace thrust::detail; - - // Use the input iterator's value type per https://wg21.link/P0571 - using ValueType = typename thrust::iterator_value::type; - - // wrap binary_op - thrust::detail::wrapped_function< - BinaryFunction, - ValueType - > wrapped_binary_op(binary_op); - - if(first != last) - { - ValueType sum = *first; - - *result = *first; - - for(++first, ++result; first != last; ++first, ++result) - *result = sum = wrapped_binary_op(sum,*first); - } - - return result; -} - - -__thrust_exec_check_disable__ -template -__host__ __device__ - OutputIterator exclusive_scan(sequential::execution_policy &, - InputIterator first, - InputIterator last, - OutputIterator result, - InitialValueType init, - BinaryFunction binary_op) -{ - using namespace thrust::detail; - - // Use the initial value type per https://wg21.link/P0571 - using ValueType = InitialValueType; - - if(first != last) - { - ValueType tmp = *first; // temporary value allows in-situ scan - ValueType sum = init; - - *result = sum; - sum = binary_op(sum, tmp); - - for(++first, ++result; first != last; ++first, ++result) - { - tmp = *first; - *result = sum; - sum = binary_op(sum, tmp); - } - } - - return result; -} - - -} // end namespace sequential -} // end namespace detail -} // end namespace system -} // end namespace thrust - diff --git a/spaces/Candeloro/anime-remove-background/README.md b/spaces/Candeloro/anime-remove-background/README.md deleted file mode 100644 index 1ba3cb5ea0e994e246d57b7d62b8aa5a6331901c..0000000000000000000000000000000000000000 --- a/spaces/Candeloro/anime-remove-background/README.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -title: Anime Remove Background -emoji: 🪄🖼️ -colorFrom: indigo -colorTo: pink -sdk: gradio -sdk_version: 3.1.4 -app_file: app.py -pinned: false -license: apache-2.0 -duplicated_from: skytnt/anime-remove-background ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/CikeyQI/meme-api/meme_generator/memes/hammer/__init__.py b/spaces/CikeyQI/meme-api/meme_generator/memes/hammer/__init__.py deleted file mode 100644 index 9a5b31a955e8d12ceee501a3dca30a48bcba0817..0000000000000000000000000000000000000000 --- a/spaces/CikeyQI/meme-api/meme_generator/memes/hammer/__init__.py +++ /dev/null @@ -1,30 +0,0 @@ -from pathlib import Path -from typing import List - -from PIL.Image import Image as IMG -from pil_utils import BuildImage - -from meme_generator import add_meme -from meme_generator.utils import save_gif - -img_dir = Path(__file__).parent / "images" - - -def hammer(images: List[BuildImage], texts, args): - img = images[0].convert("RGBA").square() - # fmt: off - locs = [ - (62, 143, 158, 113), (52, 177, 173, 105), (42, 192, 192, 92), (46, 182, 184, 100), - (54, 169, 174, 110), (69, 128, 144, 135), (65, 130, 152, 124), - ] - # fmt: on - frames: List[IMG] = [] - for i in range(7): - frame = BuildImage.open(img_dir / f"{i}.png") - x, y, w, h = locs[i] - frame.paste(img.resize((w, h)), (x, y), below=True) - frames.append(frame.image) - return save_gif(frames, 0.07) - - -add_meme("hammer", hammer, min_images=1, max_images=1, keywords=["锤"]) diff --git a/spaces/Cpp4App/Cpp4App/CDM/detect_text/ocr.py b/spaces/Cpp4App/Cpp4App/CDM/detect_text/ocr.py deleted file mode 100644 index adf08f4c14b1a8c0e124335a09b763efde5866b1..0000000000000000000000000000000000000000 --- a/spaces/Cpp4App/Cpp4App/CDM/detect_text/ocr.py +++ /dev/null @@ -1,43 +0,0 @@ -import cv2 -import os -import requests -import json -from base64 import b64encode -import time - - -def Google_OCR_makeImageData(imgpath): - with open(imgpath, 'rb') as f: - ctxt = b64encode(f.read()).decode() - img_req = { - 'image': { - 'content': ctxt - }, - 'features': [{ - 'type': 'DOCUMENT_TEXT_DETECTION', - # 'type': 'TEXT_DETECTION', - 'maxResults': 1 - }] - } - return json.dumps({"requests": img_req}).encode() - - -def ocr_detection_google(imgpath): - # start = time.clock() - url = 'https://vision.googleapis.com/v1/images:annotate' - # api_key = 'AIzaSyDUc4iOUASJQYkVwSomIArTKhE2C6bHK8U' # *** Replace with your own Key *** - api_key = os.environ.get('google_ocr') - - imgdata = Google_OCR_makeImageData(imgpath) - response = requests.post(url, - data=imgdata, - params={'key': api_key}, - headers={'Content_Type': 'application/json'}) - # print('*** Text Detection Time Taken:%.3fs ***' % (time.clock() - start)) - print("*** Please replace the Google OCR key at detect_text/ocr.py line 28 with your own (apply in https://cloud.google.com/vision) ***") - print('response.json(): ', response.json()) - if response.json()['responses'] == [{}]: - # No Text - return None - else: - return response.json()['responses'][0]['textAnnotations'][1:] diff --git a/spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/charset_normalizer/cd.py b/spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/charset_normalizer/cd.py deleted file mode 100644 index 6e56fe84a9e0e63b918141bc27d708b2d915563f..0000000000000000000000000000000000000000 --- a/spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/charset_normalizer/cd.py +++ /dev/null @@ -1,390 +0,0 @@ -import importlib -from codecs import IncrementalDecoder -from collections import Counter -from functools import lru_cache -from typing import Counter as TypeCounter, Dict, List, Optional, Tuple - -from .assets import FREQUENCIES -from .constant import KO_NAMES, LANGUAGE_SUPPORTED_COUNT, TOO_SMALL_SEQUENCE, ZH_NAMES -from .md import is_suspiciously_successive_range -from .models import CoherenceMatches -from .utils import ( - is_accentuated, - is_latin, - is_multi_byte_encoding, - is_unicode_range_secondary, - unicode_range, -) - - -def encoding_unicode_range(iana_name: str) -> List[str]: - """ - Return associated unicode ranges in a single byte code page. - """ - if is_multi_byte_encoding(iana_name): - raise IOError("Function not supported on multi-byte code page") - - decoder = importlib.import_module( - "encodings.{}".format(iana_name) - ).IncrementalDecoder - - p: IncrementalDecoder = decoder(errors="ignore") - seen_ranges: Dict[str, int] = {} - character_count: int = 0 - - for i in range(0x40, 0xFF): - chunk: str = p.decode(bytes([i])) - - if chunk: - character_range: Optional[str] = unicode_range(chunk) - - if character_range is None: - continue - - if is_unicode_range_secondary(character_range) is False: - if character_range not in seen_ranges: - seen_ranges[character_range] = 0 - seen_ranges[character_range] += 1 - character_count += 1 - - return sorted( - [ - character_range - for character_range in seen_ranges - if seen_ranges[character_range] / character_count >= 0.15 - ] - ) - - -def unicode_range_languages(primary_range: str) -> List[str]: - """ - Return inferred languages used with a unicode range. - """ - languages: List[str] = [] - - for language, characters in FREQUENCIES.items(): - for character in characters: - if unicode_range(character) == primary_range: - languages.append(language) - break - - return languages - - -@lru_cache() -def encoding_languages(iana_name: str) -> List[str]: - """ - Single-byte encoding language association. Some code page are heavily linked to particular language(s). - This function does the correspondence. - """ - unicode_ranges: List[str] = encoding_unicode_range(iana_name) - primary_range: Optional[str] = None - - for specified_range in unicode_ranges: - if "Latin" not in specified_range: - primary_range = specified_range - break - - if primary_range is None: - return ["Latin Based"] - - return unicode_range_languages(primary_range) - - -@lru_cache() -def mb_encoding_languages(iana_name: str) -> List[str]: - """ - Multi-byte encoding language association. Some code page are heavily linked to particular language(s). - This function does the correspondence. - """ - if ( - iana_name.startswith("shift_") - or iana_name.startswith("iso2022_jp") - or iana_name.startswith("euc_j") - or iana_name == "cp932" - ): - return ["Japanese"] - if iana_name.startswith("gb") or iana_name in ZH_NAMES: - return ["Chinese"] - if iana_name.startswith("iso2022_kr") or iana_name in KO_NAMES: - return ["Korean"] - - return [] - - -@lru_cache(maxsize=LANGUAGE_SUPPORTED_COUNT) -def get_target_features(language: str) -> Tuple[bool, bool]: - """ - Determine main aspects from a supported language if it contains accents and if is pure Latin. - """ - target_have_accents: bool = False - target_pure_latin: bool = True - - for character in FREQUENCIES[language]: - if not target_have_accents and is_accentuated(character): - target_have_accents = True - if target_pure_latin and is_latin(character) is False: - target_pure_latin = False - - return target_have_accents, target_pure_latin - - -def alphabet_languages( - characters: List[str], ignore_non_latin: bool = False -) -> List[str]: - """ - Return associated languages associated to given characters. - """ - languages: List[Tuple[str, float]] = [] - - source_have_accents = any(is_accentuated(character) for character in characters) - - for language, language_characters in FREQUENCIES.items(): - target_have_accents, target_pure_latin = get_target_features(language) - - if ignore_non_latin and target_pure_latin is False: - continue - - if target_have_accents is False and source_have_accents: - continue - - character_count: int = len(language_characters) - - character_match_count: int = len( - [c for c in language_characters if c in characters] - ) - - ratio: float = character_match_count / character_count - - if ratio >= 0.2: - languages.append((language, ratio)) - - languages = sorted(languages, key=lambda x: x[1], reverse=True) - - return [compatible_language[0] for compatible_language in languages] - - -def characters_popularity_compare( - language: str, ordered_characters: List[str] -) -> float: - """ - Determine if a ordered characters list (by occurrence from most appearance to rarest) match a particular language. - The result is a ratio between 0. (absolutely no correspondence) and 1. (near perfect fit). - Beware that is function is not strict on the match in order to ease the detection. (Meaning close match is 1.) - """ - if language not in FREQUENCIES: - raise ValueError("{} not available".format(language)) - - character_approved_count: int = 0 - FREQUENCIES_language_set = set(FREQUENCIES[language]) - - ordered_characters_count: int = len(ordered_characters) - target_language_characters_count: int = len(FREQUENCIES[language]) - - large_alphabet: bool = target_language_characters_count > 26 - - for character, character_rank in zip( - ordered_characters, range(0, ordered_characters_count) - ): - if character not in FREQUENCIES_language_set: - continue - - character_rank_in_language: int = FREQUENCIES[language].index(character) - expected_projection_ratio: float = ( - target_language_characters_count / ordered_characters_count - ) - character_rank_projection: int = int(character_rank * expected_projection_ratio) - - if ( - large_alphabet is False - and abs(character_rank_projection - character_rank_in_language) > 4 - ): - continue - - if ( - large_alphabet is True - and abs(character_rank_projection - character_rank_in_language) - < target_language_characters_count / 3 - ): - character_approved_count += 1 - continue - - characters_before_source: List[str] = FREQUENCIES[language][ - 0:character_rank_in_language - ] - characters_after_source: List[str] = FREQUENCIES[language][ - character_rank_in_language: - ] - characters_before: List[str] = ordered_characters[0:character_rank] - characters_after: List[str] = ordered_characters[character_rank:] - - before_match_count: int = len( - set(characters_before) & set(characters_before_source) - ) - - after_match_count: int = len( - set(characters_after) & set(characters_after_source) - ) - - if len(characters_before_source) == 0 and before_match_count <= 4: - character_approved_count += 1 - continue - - if len(characters_after_source) == 0 and after_match_count <= 4: - character_approved_count += 1 - continue - - if ( - before_match_count / len(characters_before_source) >= 0.4 - or after_match_count / len(characters_after_source) >= 0.4 - ): - character_approved_count += 1 - continue - - return character_approved_count / len(ordered_characters) - - -def alpha_unicode_split(decoded_sequence: str) -> List[str]: - """ - Given a decoded text sequence, return a list of str. Unicode range / alphabet separation. - Ex. a text containing English/Latin with a bit a Hebrew will return two items in the resulting list; - One containing the latin letters and the other hebrew. - """ - layers: Dict[str, str] = {} - - for character in decoded_sequence: - if character.isalpha() is False: - continue - - character_range: Optional[str] = unicode_range(character) - - if character_range is None: - continue - - layer_target_range: Optional[str] = None - - for discovered_range in layers: - if ( - is_suspiciously_successive_range(discovered_range, character_range) - is False - ): - layer_target_range = discovered_range - break - - if layer_target_range is None: - layer_target_range = character_range - - if layer_target_range not in layers: - layers[layer_target_range] = character.lower() - continue - - layers[layer_target_range] += character.lower() - - return list(layers.values()) - - -def merge_coherence_ratios(results: List[CoherenceMatches]) -> CoherenceMatches: - """ - This function merge results previously given by the function coherence_ratio. - The return type is the same as coherence_ratio. - """ - per_language_ratios: Dict[str, List[float]] = {} - for result in results: - for sub_result in result: - language, ratio = sub_result - if language not in per_language_ratios: - per_language_ratios[language] = [ratio] - continue - per_language_ratios[language].append(ratio) - - merge = [ - ( - language, - round( - sum(per_language_ratios[language]) / len(per_language_ratios[language]), - 4, - ), - ) - for language in per_language_ratios - ] - - return sorted(merge, key=lambda x: x[1], reverse=True) - - -def filter_alt_coherence_matches(results: CoherenceMatches) -> CoherenceMatches: - """ - We shall NOT return "English—" in CoherenceMatches because it is an alternative - of "English". This function only keeps the best match and remove the em-dash in it. - """ - index_results: Dict[str, List[float]] = dict() - - for result in results: - language, ratio = result - no_em_name: str = language.replace("—", "") - - if no_em_name not in index_results: - index_results[no_em_name] = [] - - index_results[no_em_name].append(ratio) - - if any(len(index_results[e]) > 1 for e in index_results): - filtered_results: CoherenceMatches = [] - - for language in index_results: - filtered_results.append((language, max(index_results[language]))) - - return filtered_results - - return results - - -@lru_cache(maxsize=2048) -def coherence_ratio( - decoded_sequence: str, threshold: float = 0.1, lg_inclusion: Optional[str] = None -) -> CoherenceMatches: - """ - Detect ANY language that can be identified in given sequence. The sequence will be analysed by layers. - A layer = Character extraction by alphabets/ranges. - """ - - results: List[Tuple[str, float]] = [] - ignore_non_latin: bool = False - - sufficient_match_count: int = 0 - - lg_inclusion_list = lg_inclusion.split(",") if lg_inclusion is not None else [] - if "Latin Based" in lg_inclusion_list: - ignore_non_latin = True - lg_inclusion_list.remove("Latin Based") - - for layer in alpha_unicode_split(decoded_sequence): - sequence_frequencies: TypeCounter[str] = Counter(layer) - most_common = sequence_frequencies.most_common() - - character_count: int = sum(o for c, o in most_common) - - if character_count <= TOO_SMALL_SEQUENCE: - continue - - popular_character_ordered: List[str] = [c for c, o in most_common] - - for language in lg_inclusion_list or alphabet_languages( - popular_character_ordered, ignore_non_latin - ): - ratio: float = characters_popularity_compare( - language, popular_character_ordered - ) - - if ratio < threshold: - continue - elif ratio >= 0.8: - sufficient_match_count += 1 - - results.append((language, round(ratio, 4))) - - if sufficient_match_count >= 3: - break - - return sorted( - filter_alt_coherence_matches(results), key=lambda x: x[1], reverse=True - ) diff --git a/spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/fontTools/ttLib/tables/_a_n_k_r.py b/spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/fontTools/ttLib/tables/_a_n_k_r.py deleted file mode 100644 index d1062ecc7bf75e3a9a346a68c2a17ae7d00a5c3f..0000000000000000000000000000000000000000 --- a/spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/fontTools/ttLib/tables/_a_n_k_r.py +++ /dev/null @@ -1,14 +0,0 @@ -from .otBase import BaseTTXConverter - - -class table__a_n_k_r(BaseTTXConverter): - """ - The anchor point table provides a way to define anchor points. - These are points within the coordinate space of a given glyph, - independent of the control points used to render the glyph. - Anchor points are used in conjunction with the 'kerx' table. - - See also https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6ankr.html - """ - - pass diff --git a/spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/gradio/templates/frontend/assets/index-1cf9680f.js b/spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/gradio/templates/frontend/assets/index-1cf9680f.js deleted file mode 100644 index 01988b9a87e47c3d01f59e4d6893b378ddea0ed3..0000000000000000000000000000000000000000 --- a/spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/gradio/templates/frontend/assets/index-1cf9680f.js +++ /dev/null @@ -1,3727 +0,0 @@ -import{S as qv,e as Hv,s as Gv,J as Hp,K as ga,p as ah,M as Nh,n as Nu,A as oh,al as jo,g as Wv,N as L0,B as zW,ai as wI,h as GT,j as NW,k as Wd,o as Yd,t as BW,z as Jf,v as Kf,x as Xd,F as PA,m as jW,u as UW,y as $W,am as VW,av as l4,T as Z9,O as IA,P as qW,R as HW,E as GW,ae as WW,q as YW,r as XW}from"./index-3370be2a.js";import{B as ZW}from"./Button-89624748.js";import{g as JW}from"./color-baaf9df5.js";import{a as fv,n as KW,b as QW,c as yw,t as D0,f as FA,p as eY,d as tY,e as nY,g as AI,h as rY,i as iY,j as Qo,k as r1,l as kI,x as aY,y as oY,m as sY,_ as TI,o as ad,R as vw,r as MI,q as WT,s as YT,C as XT,u as J9,v as K9,w as xw,z as i0,A as RA,B as ql,D as Yv,E as lY,F as uY,G as cY,H as fY,I as hY,J as dY,K as pY,L as gY,M as mY,N as bw,O as yY,P as Q9,Q as i1,S as ZT,T as _w,U as e7,V as Rd,W as ww,X as vY,Y as bp,Z as xY,$ as zA,a0 as bY,a1 as I2,a2 as _Y}from"./linear-58a44b5e.js";import{d as wY}from"./dsv-576afacd.js";import{E as AY}from"./Empty-585389a4.js";import{B as kY}from"./BlockLabel-56db415e.js";import"./Blocks-f0129fcd.js";function TY(e){let n,t,o,f,r,a,l;return{c(){n=Hp("svg"),t=Hp("circle"),o=Hp("circle"),f=Hp("circle"),r=Hp("circle"),a=Hp("circle"),l=Hp("path"),ga(t,"cx","20"),ga(t,"cy","4"),ga(t,"r","2"),ga(t,"fill","currentColor"),ga(o,"cx","8"),ga(o,"cy","16"),ga(o,"r","2"),ga(o,"fill","currentColor"),ga(f,"cx","28"),ga(f,"cy","12"),ga(f,"r","2"),ga(f,"fill","currentColor"),ga(r,"cx","11"),ga(r,"cy","7"),ga(r,"r","2"),ga(r,"fill","currentColor"),ga(a,"cx","16"),ga(a,"cy","24"),ga(a,"r","2"),ga(a,"fill","currentColor"),ga(l,"fill","currentColor"),ga(l,"d","M30 3.413L28.586 2L4 26.585V2H2v26a2 2 0 0 0 2 2h26v-2H5.413Z"),ga(n,"xmlns","http://www.w3.org/2000/svg"),ga(n,"xmlns:xlink","http://www.w3.org/1999/xlink"),ga(n,"aria-hidden","true"),ga(n,"role","img"),ga(n,"class","iconify iconify--carbon"),ga(n,"width","100%"),ga(n,"height","100%"),ga(n,"preserveAspectRatio","xMidYMid meet"),ga(n,"viewBox","0 0 32 32")},m(c,i){ah(c,n,i),Nh(n,t),Nh(n,o),Nh(n,f),Nh(n,r),Nh(n,a),Nh(n,l)},p:Nu,i:Nu,o:Nu,d(c){c&&oh(n)}}}let EI=class extends qv{constructor(n){super(),Hv(this,n,null,TY,Gv,{})}};function wb(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var SI={exports:{}};(function(e,n){(function(t){e.exports=t()})(function(){return function t(o,f,r){function a(i,s){if(!f[i]){if(!o[i]){var u=typeof wb=="function"&&wb;if(!s&&u)return u(i,!0);if(l)return l(i,!0);var h=new Error("Cannot find module '"+i+"'");throw h.code="MODULE_NOT_FOUND",h}var d=f[i]={exports:{}};o[i][0].call(d.exports,function(m){return a(o[i][1][m]||m)},d,d.exports,t,o,f,r)}return f[i].exports}for(var l=typeof wb=="function"&&wb,c=0;c:not(.watermark)":"opacity:0;-webkit-transition:opacity .3s ease 0s;-moz-transition:opacity .3s ease 0s;-ms-transition:opacity .3s ease 0s;-o-transition:opacity .3s ease 0s;transition:opacity .3s ease 0s;","X:hover .modebar--hover .modebar-group":"opacity:1;","X .modebar-group":"float:left;display:inline-block;box-sizing:border-box;padding-left:8px;position:relative;vertical-align:middle;white-space:nowrap;","X .modebar-btn":"position:relative;font-size:16px;padding:3px 4px;height:22px;cursor:pointer;line-height:normal;box-sizing:border-box;","X .modebar-btn svg":"position:relative;top:2px;","X .modebar.vertical":"display:flex;flex-direction:column;flex-wrap:wrap;align-content:flex-end;max-height:100%;","X .modebar.vertical svg":"top:-1px;","X .modebar.vertical .modebar-group":"display:block;float:none;padding-left:0px;padding-bottom:8px;","X .modebar.vertical .modebar-group .modebar-btn":"display:block;text-align:center;","X [data-title]:before,X [data-title]:after":"position:absolute;-webkit-transform:translate3d(0, 0, 0);-moz-transform:translate3d(0, 0, 0);-ms-transform:translate3d(0, 0, 0);-o-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0);display:none;opacity:0;z-index:1001;pointer-events:none;top:110%;right:50%;","X [data-title]:hover:before,X [data-title]:hover:after":"display:block;opacity:1;","X [data-title]:before":'content:"";position:absolute;background:transparent;border:6px solid transparent;z-index:1002;margin-top:-12px;border-bottom-color:#69738a;margin-right:-6px;',"X [data-title]:after":"content:attr(data-title);background:#69738a;color:#fff;padding:8px 10px;font-size:12px;line-height:12px;white-space:nowrap;margin-right:-18px;border-radius:2px;","X .vertical [data-title]:before,X .vertical [data-title]:after":"top:0%;right:200%;","X .vertical [data-title]:before":"border:6px solid transparent;border-left-color:#69738a;margin-top:8px;margin-right:-30px;","X .select-outline":"fill:none;stroke-width:1;shape-rendering:crispEdges;","X .select-outline-1":"stroke:#fff;","X .select-outline-2":"stroke:#000;stroke-dasharray:2px 2px;",Y:'font-family:"Open Sans",verdana,arial,sans-serif;position:fixed;top:50px;right:20px;z-index:10000;font-size:10pt;max-width:180px;',"Y p":"margin:0;","Y .notifier-note":"min-width:180px;max-width:250px;border:1px solid #fff;z-index:3000;margin:0;background-color:#8c97af;background-color:rgba(140,151,175,.9);color:#fff;padding:10px;overflow-wrap:break-word;word-wrap:break-word;-ms-hyphens:auto;-webkit-hyphens:auto;hyphens:auto;","Y .notifier-close":"color:#fff;opacity:.8;float:right;padding:0 5px;background:none;border:none;font-size:20px;font-weight:bold;line-height:20px;","Y .notifier-close:hover":"color:#444;text-decoration:none;cursor:pointer;"};for(var l in a){var c=l.replace(/^,/," ,").replace(/X/g,".js-plotly-plot .plotly").replace(/Y/g,".plotly-notifier");r.addStyleRule(c,a[l])}},{"../src/lib":503}],2:[function(t,o,f){o.exports=t("../src/transforms/aggregate")},{"../src/transforms/aggregate":1118}],3:[function(t,o,f){o.exports=t("../src/traces/bar")},{"../src/traces/bar":656}],4:[function(t,o,f){o.exports=t("../src/traces/barpolar")},{"../src/traces/barpolar":669}],5:[function(t,o,f){o.exports=t("../src/traces/box")},{"../src/traces/box":679}],6:[function(t,o,f){o.exports=t("../src/components/calendars")},{"../src/components/calendars":364}],7:[function(t,o,f){o.exports=t("../src/traces/candlestick")},{"../src/traces/candlestick":688}],8:[function(t,o,f){o.exports=t("../src/traces/carpet")},{"../src/traces/carpet":707}],9:[function(t,o,f){o.exports=t("../src/traces/choropleth")},{"../src/traces/choropleth":721}],10:[function(t,o,f){o.exports=t("../src/traces/choroplethmapbox")},{"../src/traces/choroplethmapbox":728}],11:[function(t,o,f){o.exports=t("../src/traces/cone")},{"../src/traces/cone":734}],12:[function(t,o,f){o.exports=t("../src/traces/contour")},{"../src/traces/contour":749}],13:[function(t,o,f){o.exports=t("../src/traces/contourcarpet")},{"../src/traces/contourcarpet":760}],14:[function(t,o,f){o.exports=t("../src/core")},{"../src/core":481}],15:[function(t,o,f){o.exports=t("../src/traces/densitymapbox")},{"../src/traces/densitymapbox":768}],16:[function(t,o,f){o.exports=t("../src/transforms/filter")},{"../src/transforms/filter":1119}],17:[function(t,o,f){o.exports=t("../src/traces/funnel")},{"../src/traces/funnel":778}],18:[function(t,o,f){o.exports=t("../src/traces/funnelarea")},{"../src/traces/funnelarea":787}],19:[function(t,o,f){o.exports=t("../src/transforms/groupby")},{"../src/transforms/groupby":1120}],20:[function(t,o,f){o.exports=t("../src/traces/heatmap")},{"../src/traces/heatmap":800}],21:[function(t,o,f){o.exports=t("../src/traces/heatmapgl")},{"../src/traces/heatmapgl":811}],22:[function(t,o,f){o.exports=t("../src/traces/histogram")},{"../src/traces/histogram":823}],23:[function(t,o,f){o.exports=t("../src/traces/histogram2d")},{"../src/traces/histogram2d":829}],24:[function(t,o,f){o.exports=t("../src/traces/histogram2dcontour")},{"../src/traces/histogram2dcontour":833}],25:[function(t,o,f){o.exports=t("../src/traces/icicle")},{"../src/traces/icicle":839}],26:[function(t,o,f){o.exports=t("../src/traces/image")},{"../src/traces/image":852}],27:[function(t,o,f){var r=t("./core");r.register([t("./bar"),t("./box"),t("./heatmap"),t("./histogram"),t("./histogram2d"),t("./histogram2dcontour"),t("./contour"),t("./scatterternary"),t("./violin"),t("./funnel"),t("./waterfall"),t("./image"),t("./pie"),t("./sunburst"),t("./treemap"),t("./icicle"),t("./funnelarea"),t("./scatter3d"),t("./surface"),t("./isosurface"),t("./volume"),t("./mesh3d"),t("./cone"),t("./streamtube"),t("./scattergeo"),t("./choropleth"),t("./scattergl"),t("./splom"),t("./pointcloud"),t("./heatmapgl"),t("./parcoords"),t("./parcats"),t("./scattermapbox"),t("./choroplethmapbox"),t("./densitymapbox"),t("./sankey"),t("./indicator"),t("./table"),t("./carpet"),t("./scattercarpet"),t("./contourcarpet"),t("./ohlc"),t("./candlestick"),t("./scatterpolar"),t("./scatterpolargl"),t("./barpolar"),t("./scattersmith"),t("./aggregate"),t("./filter"),t("./groupby"),t("./sort"),t("./calendars")]),o.exports=r},{"./aggregate":2,"./bar":3,"./barpolar":4,"./box":5,"./calendars":6,"./candlestick":7,"./carpet":8,"./choropleth":9,"./choroplethmapbox":10,"./cone":11,"./contour":12,"./contourcarpet":13,"./core":14,"./densitymapbox":15,"./filter":16,"./funnel":17,"./funnelarea":18,"./groupby":19,"./heatmap":20,"./heatmapgl":21,"./histogram":22,"./histogram2d":23,"./histogram2dcontour":24,"./icicle":25,"./image":26,"./indicator":28,"./isosurface":29,"./mesh3d":30,"./ohlc":31,"./parcats":32,"./parcoords":33,"./pie":34,"./pointcloud":35,"./sankey":36,"./scatter3d":37,"./scattercarpet":38,"./scattergeo":39,"./scattergl":40,"./scattermapbox":41,"./scatterpolar":42,"./scatterpolargl":43,"./scattersmith":44,"./scatterternary":45,"./sort":46,"./splom":47,"./streamtube":48,"./sunburst":49,"./surface":50,"./table":51,"./treemap":52,"./violin":53,"./volume":54,"./waterfall":55}],28:[function(t,o,f){o.exports=t("../src/traces/indicator")},{"../src/traces/indicator":860}],29:[function(t,o,f){o.exports=t("../src/traces/isosurface")},{"../src/traces/isosurface":866}],30:[function(t,o,f){o.exports=t("../src/traces/mesh3d")},{"../src/traces/mesh3d":871}],31:[function(t,o,f){o.exports=t("../src/traces/ohlc")},{"../src/traces/ohlc":876}],32:[function(t,o,f){o.exports=t("../src/traces/parcats")},{"../src/traces/parcats":885}],33:[function(t,o,f){o.exports=t("../src/traces/parcoords")},{"../src/traces/parcoords":896}],34:[function(t,o,f){o.exports=t("../src/traces/pie")},{"../src/traces/pie":907}],35:[function(t,o,f){o.exports=t("../src/traces/pointcloud")},{"../src/traces/pointcloud":916}],36:[function(t,o,f){o.exports=t("../src/traces/sankey")},{"../src/traces/sankey":922}],37:[function(t,o,f){o.exports=t("../src/traces/scatter3d")},{"../src/traces/scatter3d":960}],38:[function(t,o,f){o.exports=t("../src/traces/scattercarpet")},{"../src/traces/scattercarpet":967}],39:[function(t,o,f){o.exports=t("../src/traces/scattergeo")},{"../src/traces/scattergeo":975}],40:[function(t,o,f){o.exports=t("../src/traces/scattergl")},{"../src/traces/scattergl":989}],41:[function(t,o,f){o.exports=t("../src/traces/scattermapbox")},{"../src/traces/scattermapbox":999}],42:[function(t,o,f){o.exports=t("../src/traces/scatterpolar")},{"../src/traces/scatterpolar":1007}],43:[function(t,o,f){o.exports=t("../src/traces/scatterpolargl")},{"../src/traces/scatterpolargl":1015}],44:[function(t,o,f){o.exports=t("../src/traces/scattersmith")},{"../src/traces/scattersmith":1022}],45:[function(t,o,f){o.exports=t("../src/traces/scatterternary")},{"../src/traces/scatterternary":1030}],46:[function(t,o,f){o.exports=t("../src/transforms/sort")},{"../src/transforms/sort":1122}],47:[function(t,o,f){o.exports=t("../src/traces/splom")},{"../src/traces/splom":1040}],48:[function(t,o,f){o.exports=t("../src/traces/streamtube")},{"../src/traces/streamtube":1048}],49:[function(t,o,f){o.exports=t("../src/traces/sunburst")},{"../src/traces/sunburst":1056}],50:[function(t,o,f){o.exports=t("../src/traces/surface")},{"../src/traces/surface":1065}],51:[function(t,o,f){o.exports=t("../src/traces/table")},{"../src/traces/table":1073}],52:[function(t,o,f){o.exports=t("../src/traces/treemap")},{"../src/traces/treemap":1084}],53:[function(t,o,f){o.exports=t("../src/traces/violin")},{"../src/traces/violin":1097}],54:[function(t,o,f){o.exports=t("../src/traces/volume")},{"../src/traces/volume":1105}],55:[function(t,o,f){o.exports=t("../src/traces/waterfall")},{"../src/traces/waterfall":1113}],56:[function(t,o,f){(function(r,a){typeof f=="object"&&o!==void 0?a(f,t("d3-array"),t("d3-collection"),t("d3-shape"),t("elementary-circuits-directed-graph")):a(r.d3=r.d3||{},r.d3,r.d3,r.d3,null)})(this,function(r,a,l,c,i){function s(ie){return ie.target.depth}function u(ie,ae){return ie.sourceLinks.length?ie.depth:ae-1}function h(ie){return function(){return ie}}i=i&&i.hasOwnProperty("default")?i.default:i;var d=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(ie){return typeof ie}:function(ie){return ie&&typeof Symbol=="function"&&ie.constructor===Symbol&&ie!==Symbol.prototype?"symbol":typeof ie};function m(ie,ae){return g(ie.source,ae.source)||ie.index-ae.index}function p(ie,ae){return g(ie.target,ae.target)||ie.index-ae.index}function g(ie,ae){return ie.partOfCycle===ae.partOfCycle?ie.y0-ae.y0:ie.circularLinkType==="top"||ae.circularLinkType==="bottom"?-1:1}function y(ie){return ie.value}function v(ie){return(ie.y0+ie.y1)/2}function x(ie){return v(ie.source)}function _(ie){return v(ie.target)}function A(ie){return ie.index}function b(ie){return ie.nodes}function k(ie){return ie.links}function w(ie,ae){var ue=ie.get(ae);if(!ue)throw new Error("missing: "+ae);return ue}function M(ie,ae){return ae(ie)}function T(ie,ae,ue){var le=0;if(ue===null){for(var ge=[],fe=0;fe1||ge>1)}function R(ie,ae,ue){return ie.sort(D),ie.forEach(function(le,ge){var fe,me,_e=0;if(Q(le,ue)&&L(le))le.circularPathData.verticalBuffer=_e+le.width/2;else{for(var Ae=0;Aeme.source.column)){var ke=ie[Ae].circularPathData.verticalBuffer+ie[Ae].width/2+ae;_e=ke>_e?ke:_e}le.circularPathData.verticalBuffer=_e+le.width/2}}),ie}function F(ie,ae,ue,le){var ge=a.min(ie.links,function(fe){return fe.source.y0});ie.links.forEach(function(fe){fe.circular&&(fe.circularPathData={})}),R(ie.links.filter(function(fe){return fe.circularLinkType=="top"}),ae,le),R(ie.links.filter(function(fe){return fe.circularLinkType=="bottom"}),ae,le),ie.links.forEach(function(fe){if(fe.circular){if(fe.circularPathData.arcRadius=fe.width+10,fe.circularPathData.leftNodeBuffer=5,fe.circularPathData.rightNodeBuffer=5,fe.circularPathData.sourceWidth=fe.source.x1-fe.source.x0,fe.circularPathData.sourceX=fe.source.x0+fe.circularPathData.sourceWidth,fe.circularPathData.targetX=fe.target.x0,fe.circularPathData.sourceY=fe.y0,fe.circularPathData.targetY=fe.y1,Q(fe,le)&&L(fe))fe.circularPathData.leftSmallArcRadius=10+fe.width/2,fe.circularPathData.leftLargeArcRadius=10+fe.width/2,fe.circularPathData.rightSmallArcRadius=10+fe.width/2,fe.circularPathData.rightLargeArcRadius=10+fe.width/2,fe.circularLinkType=="bottom"?(fe.circularPathData.verticalFullExtent=fe.source.y1+25+fe.circularPathData.verticalBuffer,fe.circularPathData.verticalLeftInnerExtent=fe.circularPathData.verticalFullExtent-fe.circularPathData.leftLargeArcRadius,fe.circularPathData.verticalRightInnerExtent=fe.circularPathData.verticalFullExtent-fe.circularPathData.rightLargeArcRadius):(fe.circularPathData.verticalFullExtent=fe.source.y0-25-fe.circularPathData.verticalBuffer,fe.circularPathData.verticalLeftInnerExtent=fe.circularPathData.verticalFullExtent+fe.circularPathData.leftLargeArcRadius,fe.circularPathData.verticalRightInnerExtent=fe.circularPathData.verticalFullExtent+fe.circularPathData.rightLargeArcRadius);else{var me=fe.source.column,_e=fe.circularLinkType,Ae=ie.links.filter(function(de){return de.source.column==me&&de.circularLinkType==_e});fe.circularLinkType=="bottom"?Ae.sort(N):Ae.sort(O);var ke=0;Ae.forEach(function(de,ve){de.circularLinkID==fe.circularLinkID&&(fe.circularPathData.leftSmallArcRadius=10+fe.width/2+ke,fe.circularPathData.leftLargeArcRadius=10+fe.width/2+ve*ae+ke),ke+=de.width}),me=fe.target.column,Ae=ie.links.filter(function(de){return de.target.column==me&&de.circularLinkType==_e}),fe.circularLinkType=="bottom"?Ae.sort(W):Ae.sort(B),ke=0,Ae.forEach(function(de,ve){de.circularLinkID==fe.circularLinkID&&(fe.circularPathData.rightSmallArcRadius=10+fe.width/2+ke,fe.circularPathData.rightLargeArcRadius=10+fe.width/2+ve*ae+ke),ke+=de.width}),fe.circularLinkType=="bottom"?(fe.circularPathData.verticalFullExtent=Math.max(ue,fe.source.y1,fe.target.y1)+25+fe.circularPathData.verticalBuffer,fe.circularPathData.verticalLeftInnerExtent=fe.circularPathData.verticalFullExtent-fe.circularPathData.leftLargeArcRadius,fe.circularPathData.verticalRightInnerExtent=fe.circularPathData.verticalFullExtent-fe.circularPathData.rightLargeArcRadius):(fe.circularPathData.verticalFullExtent=ge-25-fe.circularPathData.verticalBuffer,fe.circularPathData.verticalLeftInnerExtent=fe.circularPathData.verticalFullExtent+fe.circularPathData.leftLargeArcRadius,fe.circularPathData.verticalRightInnerExtent=fe.circularPathData.verticalFullExtent+fe.circularPathData.rightLargeArcRadius)}fe.circularPathData.leftInnerExtent=fe.circularPathData.sourceX+fe.circularPathData.leftNodeBuffer,fe.circularPathData.rightInnerExtent=fe.circularPathData.targetX-fe.circularPathData.rightNodeBuffer,fe.circularPathData.leftFullExtent=fe.circularPathData.sourceX+fe.circularPathData.leftLargeArcRadius+fe.circularPathData.leftNodeBuffer,fe.circularPathData.rightFullExtent=fe.circularPathData.targetX-fe.circularPathData.rightLargeArcRadius-fe.circularPathData.rightNodeBuffer}if(fe.circular)fe.path=function(de){var ve="";return ve=de.circularLinkType=="top"?"M"+de.circularPathData.sourceX+" "+de.circularPathData.sourceY+" L"+de.circularPathData.leftInnerExtent+" "+de.circularPathData.sourceY+" A"+de.circularPathData.leftLargeArcRadius+" "+de.circularPathData.leftSmallArcRadius+" 0 0 0 "+de.circularPathData.leftFullExtent+" "+(de.circularPathData.sourceY-de.circularPathData.leftSmallArcRadius)+" L"+de.circularPathData.leftFullExtent+" "+de.circularPathData.verticalLeftInnerExtent+" A"+de.circularPathData.leftLargeArcRadius+" "+de.circularPathData.leftLargeArcRadius+" 0 0 0 "+de.circularPathData.leftInnerExtent+" "+de.circularPathData.verticalFullExtent+" L"+de.circularPathData.rightInnerExtent+" "+de.circularPathData.verticalFullExtent+" A"+de.circularPathData.rightLargeArcRadius+" "+de.circularPathData.rightLargeArcRadius+" 0 0 0 "+de.circularPathData.rightFullExtent+" "+de.circularPathData.verticalRightInnerExtent+" L"+de.circularPathData.rightFullExtent+" "+(de.circularPathData.targetY-de.circularPathData.rightSmallArcRadius)+" A"+de.circularPathData.rightLargeArcRadius+" "+de.circularPathData.rightSmallArcRadius+" 0 0 0 "+de.circularPathData.rightInnerExtent+" "+de.circularPathData.targetY+" L"+de.circularPathData.targetX+" "+de.circularPathData.targetY:"M"+de.circularPathData.sourceX+" "+de.circularPathData.sourceY+" L"+de.circularPathData.leftInnerExtent+" "+de.circularPathData.sourceY+" A"+de.circularPathData.leftLargeArcRadius+" "+de.circularPathData.leftSmallArcRadius+" 0 0 1 "+de.circularPathData.leftFullExtent+" "+(de.circularPathData.sourceY+de.circularPathData.leftSmallArcRadius)+" L"+de.circularPathData.leftFullExtent+" "+de.circularPathData.verticalLeftInnerExtent+" A"+de.circularPathData.leftLargeArcRadius+" "+de.circularPathData.leftLargeArcRadius+" 0 0 1 "+de.circularPathData.leftInnerExtent+" "+de.circularPathData.verticalFullExtent+" L"+de.circularPathData.rightInnerExtent+" "+de.circularPathData.verticalFullExtent+" A"+de.circularPathData.rightLargeArcRadius+" "+de.circularPathData.rightLargeArcRadius+" 0 0 1 "+de.circularPathData.rightFullExtent+" "+de.circularPathData.verticalRightInnerExtent+" L"+de.circularPathData.rightFullExtent+" "+(de.circularPathData.targetY+de.circularPathData.rightSmallArcRadius)+" A"+de.circularPathData.rightLargeArcRadius+" "+de.circularPathData.rightSmallArcRadius+" 0 0 1 "+de.circularPathData.rightInnerExtent+" "+de.circularPathData.targetY+" L"+de.circularPathData.targetX+" "+de.circularPathData.targetY,ve}(fe);else{var Le=c.linkHorizontal().source(function(de){return[de.source.x0+(de.source.x1-de.source.x0),de.y0]}).target(function(de){return[de.target.x0,de.y1]});fe.path=Le(fe)}})}function D(ie,ae){return G(ie)==G(ae)?ie.circularLinkType=="bottom"?N(ie,ae):O(ie,ae):G(ae)-G(ie)}function O(ie,ae){return ie.y0-ae.y0}function N(ie,ae){return ae.y0-ie.y0}function B(ie,ae){return ie.y1-ae.y1}function W(ie,ae){return ae.y1-ie.y1}function G(ie){return ie.target.column-ie.source.column}function K(ie){return ie.target.x0-ie.source.x1}function te(ie,ae){var ue=S(ie),le=K(ae)/Math.tan(ue);return q(ie)=="up"?ie.y1+le:ie.y1-le}function Y(ie,ae){var ue=S(ie),le=K(ae)/Math.tan(ue);return q(ie)=="up"?ie.y1-le:ie.y1+le}function J(ie,ae,ue,le){ie.links.forEach(function(ge){if(!ge.circular&&ge.target.column-ge.source.column>1){var fe=ge.source.column+1,me=ge.target.column-1,_e=1,Ae=me-fe+1;for(_e=1;fe<=me;fe++,_e++)ie.nodes.forEach(function(ke){if(ke.column==fe){var Le,de=_e/(Ae+1),ve=Math.pow(1-de,3),Me=3*de*Math.pow(1-de,2),we=3*Math.pow(de,2)*(1-de),Ce=Math.pow(de,3),Fe=ve*ge.y0+Me*ge.y0+we*ge.y1+Ce*ge.y1,ze=Fe-ge.width/2,$e=Fe+ge.width/2;ze>ke.y0&&zeke.y0&&$eke.y1)&&(Le=$e-ke.y0+10,ke=U(ke,Le,ae,ue),ie.nodes.forEach(function(Ke){M(Ke,le)!=M(ke,le)&&Ke.column==ke.column&&Ke.y0ke.y1&&U(Ke,Le,ae,ue)}))}})}})}function re(ie,ae){return ie.y0>ae.y0&&ie.y0ae.y0&&ie.y1ae.y1}function U(ie,ae,ue,le){return ie.y0+ae>=ue&&ie.y1+ae<=le&&(ie.y0=ie.y0+ae,ie.y1=ie.y1+ae,ie.targetLinks.forEach(function(ge){ge.y1=ge.y1+ae}),ie.sourceLinks.forEach(function(ge){ge.y0=ge.y0+ae})),ie}function V(ie,ae,ue,le){ie.nodes.forEach(function(ge){le&&ge.y+(ge.y1-ge.y0)>ae&&(ge.y=ge.y-(ge.y+(ge.y1-ge.y0)-ae));var fe=ie.links.filter(function(Ae){return M(Ae.source,ue)==M(ge,ue)}),me=fe.length;me>1&&fe.sort(function(Ae,ke){if(!Ae.circular&&!ke.circular){if(Ae.target.column==ke.target.column||!ne(Ae,ke))return Ae.y1-ke.y1;if(Ae.target.column>ke.target.column){var Le=Y(ke,Ae);return Ae.y1-Le}if(ke.target.column>Ae.target.column)return Y(Ae,ke)-ke.y1}return Ae.circular&&!ke.circular?Ae.circularLinkType=="top"?-1:1:ke.circular&&!Ae.circular?ke.circularLinkType=="top"?1:-1:Ae.circular&&ke.circular?Ae.circularLinkType===ke.circularLinkType&&Ae.circularLinkType=="top"?Ae.target.column===ke.target.column?Ae.target.y1-ke.target.y1:ke.target.column-Ae.target.column:Ae.circularLinkType===ke.circularLinkType&&Ae.circularLinkType=="bottom"?Ae.target.column===ke.target.column?ke.target.y1-Ae.target.y1:Ae.target.column-ke.target.column:Ae.circularLinkType=="top"?-1:1:void 0});var _e=ge.y0;fe.forEach(function(Ae){Ae.y0=_e+Ae.width/2,_e+=Ae.width}),fe.forEach(function(Ae,ke){if(Ae.circularLinkType=="bottom"){for(var Le=ke+1,de=0;Le1&&ge.sort(function(_e,Ae){if(!_e.circular&&!Ae.circular){if(_e.source.column==Ae.source.column||!ne(_e,Ae))return _e.y0-Ae.y0;if(Ae.source.column<_e.source.column){var ke=te(Ae,_e);return _e.y0-ke}if(_e.source.column0?"up":"down"}function Q(ie,ae){return M(ie.source,ae)==M(ie.target,ae)}function ee(ie,ae,ue){var le=ie.nodes,ge=ie.links,fe=!1,me=!1;if(ge.forEach(function(ke){ke.circularLinkType=="top"?fe=!0:ke.circularLinkType=="bottom"&&(me=!0)}),fe==0||me==0){var _e=a.min(le,function(ke){return ke.y0}),Ae=(ue-ae)/(a.max(le,function(ke){return ke.y1})-_e);le.forEach(function(ke){var Le=(ke.y1-ke.y0)*Ae;ke.y0=(ke.y0-_e)*Ae,ke.y1=ke.y0+Le}),ge.forEach(function(ke){ke.y0=(ke.y0-_e)*Ae,ke.y1=(ke.y1-_e)*Ae,ke.width=ke.width*Ae})}}r.sankeyCircular=function(){var ie,ae,ue=0,le=0,ge=1,fe=1,me=24,_e=A,Ae=u,ke=b,Le=k,de=32,ve=2,Me=null;function we(){var Re={nodes:ke.apply(null,arguments),links:Le.apply(null,arguments)};Ce(Re),T(Re,_e,Me),Fe(Re),ze(Re),E(Re,_e),$e(Re,de,_e),Ke(Re);for(var Ve=4,We=0;We0?Be+25+10:Be,bottom:Ge=Ge>0?Ge+25+10:Ge,left:dt=dt>0?dt+25+10:dt,right:kt=kt>0?kt+25+10:kt}}(Re),Wt=function(Jt,Be){var Ge=a.max(Jt.nodes,function(Te){return Te.column}),kt=ge-ue,dt=fe-le,Oe=kt/(kt+Be.right+Be.left),Ie=dt/(dt+Be.top+Be.bottom);return ue=ue*Oe+Be.left,ge=Be.right==0?ge:ge*Oe,le=le*Ie+Be.top,fe*=Ie,Jt.nodes.forEach(function(Te){Te.x0=ue+Te.column*((ge-ue-me)/Ge),Te.x1=Te.x0+me}),Ie}(Re,Lt);et*=Wt,Re.links.forEach(function(Jt){Jt.width=Jt.value*et}),Ye.forEach(function(Jt){var Be=Jt.length;Jt.forEach(function(Ge,kt){Ge.depth==Ye.length-1&&Be==1||Ge.depth==0&&Be==1?(Ge.y0=fe/2-Ge.value*et,Ge.y1=Ge.y0+Ge.value*et):Ge.partOfCycle?P(Ge,Tt)==0?(Ge.y0=fe/2+kt,Ge.y1=Ge.y0+Ge.value*et):Ge.circularLinkType=="top"?(Ge.y0=le+kt,Ge.y1=Ge.y0+Ge.value*et):(Ge.y0=fe-Ge.value*et-kt,Ge.y1=Ge.y0+Ge.value*et):Lt.top==0||Lt.bottom==0?(Ge.y0=(fe-le)/Be*kt,Ge.y1=Ge.y0+Ge.value*et):(Ge.y0=(fe-le)/2-Be/2+kt,Ge.y1=Ge.y0+Ge.value*et)})})})(We),Ot();for(var nt=1,ft=Ve;ft>0;--ft)yt(nt*=.99,We),Ot();function yt(Tt,at){var et=Ye.length;Ye.forEach(function(Lt){var Wt=Lt.length,Jt=Lt[0].depth;Lt.forEach(function(Be){var Ge;if((Be.sourceLinks.length||Be.targetLinks.length)&&!(Be.partOfCycle&&P(Be,at)>0))if(Jt==0&&Wt==1)Ge=Be.y1-Be.y0,Be.y0=fe/2-Ge/2,Be.y1=fe/2+Ge/2;else if(Jt==et-1&&Wt==1)Ge=Be.y1-Be.y0,Be.y0=fe/2-Ge/2,Be.y1=fe/2+Ge/2;else{var kt=a.mean(Be.sourceLinks,_),dt=a.mean(Be.targetLinks,x),Oe=((kt&&dt?(kt+dt)/2:kt||dt)-v(Be))*Tt;Be.y0+=Oe,Be.y1+=Oe}})})}function Ot(){Ye.forEach(function(Tt){var at,et,Lt,Wt=le,Jt=Tt.length;for(Tt.sort(g),Lt=0;Lt0&&(at.y0+=et,at.y1+=et),Wt=at.y1+ie;if((et=Wt-ie-fe)>0)for(Wt=at.y0-=et,at.y1-=et,Lt=Jt-2;Lt>=0;--Lt)(et=(at=Tt[Lt]).y1+ie-Wt)>0&&(at.y0-=et,at.y1-=et),Wt=at.y0})}}function Ke(Re){Re.nodes.forEach(function(Ve){Ve.sourceLinks.sort(p),Ve.targetLinks.sort(m)}),Re.nodes.forEach(function(Ve){var We=Ve.y0,Ye=We,nt=Ve.y1,ft=nt;Ve.sourceLinks.forEach(function(yt){yt.circular?(yt.y0=nt-yt.width/2,nt-=yt.width):(yt.y0=We+yt.width/2,We+=yt.width)}),Ve.targetLinks.forEach(function(yt){yt.circular?(yt.y1=ft-yt.width/2,ft-=yt.width):(yt.y1=Ye+yt.width/2,Ye+=yt.width)})})}return we.nodeId=function(Re){return arguments.length?(_e=typeof Re=="function"?Re:h(Re),we):_e},we.nodeAlign=function(Re){return arguments.length?(Ae=typeof Re=="function"?Re:h(Re),we):Ae},we.nodeWidth=function(Re){return arguments.length?(me=+Re,we):me},we.nodePadding=function(Re){return arguments.length?(ie=+Re,we):ie},we.nodes=function(Re){return arguments.length?(ke=typeof Re=="function"?Re:h(Re),we):ke},we.links=function(Re){return arguments.length?(Le=typeof Re=="function"?Re:h(Re),we):Le},we.size=function(Re){return arguments.length?(ue=le=0,ge=+Re[0],fe=+Re[1],we):[ge-ue,fe-le]},we.extent=function(Re){return arguments.length?(ue=+Re[0][0],ge=+Re[1][0],le=+Re[0][1],fe=+Re[1][1],we):[[ue,le],[ge,fe]]},we.iterations=function(Re){return arguments.length?(de=+Re,we):de},we.circularLinkGap=function(Re){return arguments.length?(ve=+Re,we):ve},we.nodePaddingRatio=function(Re){return arguments.length?(ae=+Re,we):ae},we.sortNodes=function(Re){return arguments.length?(Me=Re,we):Me},we.update=function(Re){return E(Re,_e),Ke(Re),Re.links.forEach(function(Ve){Ve.circular&&(Ve.circularLinkType=Ve.y0+Ve.y1ee&&(L=ee);var ie=a.min(re,function(ae){return(S-T-(ae.length-1)*L)/a.sum(ae,p)});re.forEach(function(ae){ae.forEach(function(ue,le){ue.y1=(ue.y0=le)+ue.value*ie})}),J.links.forEach(function(ae){ae.width=ae.value*ie})})(),q();for(var U=1,V=N;V>0;--V)ne(U*=.99),q(),H(U),q();function H(Q){re.forEach(function(ee){ee.forEach(function(ie){if(ie.targetLinks.length){var ae=(a.sum(ie.targetLinks,y)/a.sum(ie.targetLinks,p)-g(ie))*Q;ie.y0+=ae,ie.y1+=ae}})})}function ne(Q){re.slice().reverse().forEach(function(ee){ee.forEach(function(ie){if(ie.sourceLinks.length){var ae=(a.sum(ie.sourceLinks,v)/a.sum(ie.sourceLinks,p)-g(ie))*Q;ie.y0+=ae,ie.y1+=ae}})})}function q(){re.forEach(function(Q){var ee,ie,ae,ue=T,le=Q.length;for(Q.sort(m),ae=0;ae0&&(ee.y0+=ie,ee.y1+=ie),ue=ee.y1+L;if((ie=ue-L-S)>0)for(ue=ee.y0-=ie,ee.y1-=ie,ae=le-2;ae>=0;--ae)(ie=(ee=Q[ae]).y1+L-ue)>0&&(ee.y0-=ie,ee.y1-=ie),ue=ee.y0})}}function Y(J){J.nodes.forEach(function(re){re.sourceLinks.sort(d),re.targetLinks.sort(h)}),J.nodes.forEach(function(re){var U=re.y0,V=U;re.sourceLinks.forEach(function(H){H.y0=U+H.width/2,U+=H.width}),re.targetLinks.forEach(function(H){H.y1=V+H.width/2,V+=H.width})})}return B.update=function(J){return Y(J),J},B.nodeId=function(J){return arguments.length?(R=typeof J=="function"?J:u(J),B):R},B.nodeAlign=function(J){return arguments.length?(F=typeof J=="function"?J:u(J),B):F},B.nodeWidth=function(J){return arguments.length?(P=+J,B):P},B.nodePadding=function(J){return arguments.length?(L=+J,B):L},B.nodes=function(J){return arguments.length?(D=typeof J=="function"?J:u(J),B):D},B.links=function(J){return arguments.length?(O=typeof J=="function"?J:u(J),B):O},B.size=function(J){return arguments.length?(M=T=0,E=+J[0],S=+J[1],B):[E-M,S-T]},B.extent=function(J){return arguments.length?(M=+J[0][0],E=+J[1][0],T=+J[0][1],S=+J[1][1],B):[[M,T],[E,S]]},B.iterations=function(J){return arguments.length?(N=+J,B):N},B},r.sankeyCenter=function(M){return M.targetLinks.length?M.depth:M.sourceLinks.length?a.min(M.sourceLinks,i)-1:0},r.sankeyLeft=function(M){return M.depth},r.sankeyRight=function(M,T){return T-1-M.height},r.sankeyJustify=s,r.sankeyLinkHorizontal=function(){return c.linkHorizontal().source(k).target(w)},Object.defineProperty(r,"__esModule",{value:!0})})},{"d3-array":107,"d3-collection":108,"d3-shape":119}],58:[function(t,o,f){(function(){var r={version:"3.8.0"},a=[].slice,l=function(ce){return a.call(ce)},c=self.document;function i(ce){return ce&&(ce.ownerDocument||ce.document||ce).documentElement}function s(ce){return ce&&(ce.ownerDocument&&ce.ownerDocument.defaultView||ce.document&&ce||ce.defaultView)}if(c)try{l(c.documentElement.childNodes)[0].nodeType}catch{l=function(I){for(var j=I.length,$=new Array(j);j--;)$[j]=I[j];return $}}if(Date.now||(Date.now=function(){return+new Date}),c)try{c.createElement("DIV").style.setProperty("opacity",0,"")}catch{var u=this.Element.prototype,h=u.setAttribute,d=u.setAttributeNS,m=this.CSSStyleDeclaration.prototype,p=m.setProperty;u.setAttribute=function(I,j){h.call(this,I,j+"")},u.setAttributeNS=function(I,j,$){d.call(this,I,j,$+"")},m.setProperty=function(I,j,$){p.call(this,I,j+"",$)}}function g(ce,I){return ceI?1:ce>=I?0:NaN}function y(ce){return ce===null?NaN:+ce}function v(ce){return!isNaN(ce)}function x(ce){return{left:function(I,j,$,X){for(arguments.length<3&&($=0),arguments.length<4&&(X=I.length);$>>1;ce(I[se],j)<0?$=se+1:X=se}return $},right:function(I,j,$,X){for(arguments.length<3&&($=0),arguments.length<4&&(X=I.length);$>>1;ce(I[se],j)>0?X=se:$=se+1}return $}}}r.ascending=g,r.descending=function(ce,I){return Ice?1:I>=ce?0:NaN},r.min=function(ce,I){var j,$,X=-1,se=ce.length;if(arguments.length===1){for(;++X=$){j=$;break}for(;++X$&&(j=$)}else{for(;++X=$){j=$;break}for(;++X$&&(j=$)}return j},r.max=function(ce,I){var j,$,X=-1,se=ce.length;if(arguments.length===1){for(;++X=$){j=$;break}for(;++Xj&&(j=$)}else{for(;++X=$){j=$;break}for(;++Xj&&(j=$)}return j},r.extent=function(ce,I){var j,$,X,se=-1,he=ce.length;if(arguments.length===1){for(;++se=$){j=X=$;break}for(;++se$&&(j=$),X<$&&(X=$))}else{for(;++se=$){j=X=$;break}for(;++se$&&(j=$),X<$&&(X=$))}return[j,X]},r.sum=function(ce,I){var j,$=0,X=ce.length,se=-1;if(arguments.length===1)for(;++se1)return he/(be-1)},r.deviation=function(){var ce=r.variance.apply(this,arguments);return ce&&Math.sqrt(ce)};var _=x(g);function A(ce){return ce.length}r.bisectLeft=_.left,r.bisect=r.bisectRight=_.right,r.bisector=function(ce){return x(ce.length===1?function(I,j){return g(ce(I),j)}:ce)},r.shuffle=function(ce,I,j){(se=arguments.length)<3&&(j=ce.length,se<2&&(I=0));for(var $,X,se=j-I;se;)X=Math.random()*se--|0,$=ce[se+I],ce[se+I]=ce[X+I],ce[X+I]=$;return ce},r.permute=function(ce,I){for(var j=I.length,$=new Array(j);j--;)$[j]=ce[I[j]];return $},r.pairs=function(ce){for(var I=0,j=ce.length-1,$=ce[0],X=new Array(j<0?0:j);I=0;)for(I=($=ce[X]).length;--I>=0;)j[--he]=$[I];return j};var b=Math.abs;function k(ce){for(var I=1;ce*I%1;)I*=10;return I}function w(ce,I){for(var j in I)Object.defineProperty(ce.prototype,j,{value:I[j],enumerable:!1})}function M(){this._=Object.create(null)}r.range=function(ce,I,j){if(arguments.length<3&&(j=1,arguments.length<2&&(I=ce,ce=0)),(I-ce)/j==1/0)throw new Error("infinite range");var $,X=[],se=k(b(j)),he=-1;if(ce*=se,I*=se,(j*=se)<0)for(;($=ce+j*++he)>I;)X.push($/se);else for(;($=ce+j*++he)=$.length)return I?I.call(j,ye):ce?ye.sort(ce):ye;for(var Ee,Ue,Xe,it,xt=-1,Dt=ye.length,_t=$[be++],Mt=new M;++xt=$.length)return be;var Ue=[],Xe=X[Ee++];return be.forEach(function(it,xt){Ue.push({key:it,values:ye(xt,Ee)})}),Xe?Ue.sort(function(it,xt){return Xe(it.key,xt.key)}):Ue}(se(r.map,he,0),0)},j.key=function(he){return $.push(he),j},j.sortKeys=function(he){return X[$.length-1]=he,j},j.sortValues=function(he){return ce=he,j},j.rollup=function(he){return I=he,j},j},r.set=function(ce){var I=new D;if(ce)for(var j=0,$=ce.length;j<$;++j)I.add(ce[j]);return I},w(D,{has:S,add:function(ce){return this._[T(ce+="")]=!0,ce},remove:P,values:L,size:R,empty:F,forEach:function(ce){for(var I in this._)ce.call(this,E(I))}}),r.behavior={},r.rebind=function(ce,I){for(var j,$=1,X=arguments.length;++$=0&&($=ce.slice(j+1),ce=ce.slice(0,j)),ce)return arguments.length<2?this[ce].on($):this[ce].on($,I);if(arguments.length===2){if(I==null)for(ce in this)this.hasOwnProperty(ce)&&this[ce].on($,null);return this}},r.event=null,r.requote=function(ce){return ce.replace(U,"\\$&")};var U=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,V={}.__proto__?function(ce,I){ce.__proto__=I}:function(ce,I){for(var j in I)ce[j]=I[j]};function H(ce){return V(ce,ee),ce}var ne=function(ce,I){return I.querySelector(ce)},q=function(ce,I){return I.querySelectorAll(ce)},Q=function(ce,I){var j=ce.matches||ce[B(ce,"matchesSelector")];return(Q=function($,X){return j.call($,X)})(ce,I)};typeof Sizzle=="function"&&(ne=function(ce,I){return Sizzle(ce,I)[0]||null},q=Sizzle,Q=Sizzle.matchesSelector),r.selection=function(){return r.select(c.documentElement)};var ee=r.selection.prototype=[];function ie(ce){return typeof ce=="function"?ce:function(){return ne(ce,this)}}function ae(ce){return typeof ce=="function"?ce:function(){return q(ce,this)}}ee.select=function(ce){var I,j,$,X,se=[];ce=ie(ce);for(var he=-1,ye=this.length;++he=0&&(j=ce.slice(0,I))!=="xmlns"&&(ce=ce.slice(I+1)),le.hasOwnProperty(j)?{space:le[j],local:ce}:ce}},ee.attr=function(ce,I){if(arguments.length<2){if(typeof ce=="string"){var j=this.node();return(ce=r.ns.qualify(ce)).local?j.getAttributeNS(ce.space,ce.local):j.getAttribute(ce)}for(I in ce)this.each(ge(I,ce[I]));return this}return this.each(ge(ce,I))},ee.classed=function(ce,I){if(arguments.length<2){if(typeof ce=="string"){var j=this.node(),$=(ce=_e(ce)).length,X=-1;if(I=j.classList){for(;++X<$;)if(!I.contains(ce[X]))return!1}else for(I=j.getAttribute("class");++X<$;)if(!me(ce[X]).test(I))return!1;return!0}for(I in ce)this.each(Ae(I,ce[I]));return this}return this.each(Ae(ce,I))},ee.style=function(ce,I,j){var $=arguments.length;if($<3){if(typeof ce!="string"){for(j in $<2&&(I=""),ce)this.each(Le(j,ce[j],I));return this}if($<2){var X=this.node();return s(X).getComputedStyle(X,null).getPropertyValue(ce)}j=""}return this.each(Le(ce,I,j))},ee.property=function(ce,I){if(arguments.length<2){if(typeof ce=="string")return this.node()[ce];for(I in ce)this.each(de(I,ce[I]));return this}return this.each(de(ce,I))},ee.text=function(ce){return arguments.length?this.each(typeof ce=="function"?function(){var I=ce.apply(this,arguments);this.textContent=I??""}:ce==null?function(){this.textContent=""}:function(){this.textContent=ce}):this.node().textContent},ee.html=function(ce){return arguments.length?this.each(typeof ce=="function"?function(){var I=ce.apply(this,arguments);this.innerHTML=I??""}:ce==null?function(){this.innerHTML=""}:function(){this.innerHTML=ce}):this.node().innerHTML},ee.append=function(ce){return ce=ve(ce),this.select(function(){return this.appendChild(ce.apply(this,arguments))})},ee.insert=function(ce,I){return ce=ve(ce),I=ie(I),this.select(function(){return this.insertBefore(ce.apply(this,arguments),I.apply(this,arguments)||null)})},ee.remove=function(){return this.each(Me)},ee.data=function(ce,I){var j,$,X=-1,se=this.length;if(!arguments.length){for(ce=new Array(se=(j=this[0]).length);++X=0;)(j=$[X])&&(se&&se!==j.nextSibling&&se.parentNode.insertBefore(j,se),se=j);return this},ee.sort=function(ce){ce=Fe.apply(this,arguments);for(var I=-1,j=this.length;++I=I&&(I=X+1);!(he=ye[I])&&++I0&&(ce=ce.slice(0,X));var he=We.get(ce);function ye(){var be=this[$];be&&(this.removeEventListener(ce,be,be.$),delete this[$])}return he&&(ce=he,se=nt),X?I?function(){var be=se(I,l(arguments));ye.call(this),this.addEventListener(ce,this[$]=be,be.$=j),be._=I}:ye:I?G:function(){var be,Ee=new RegExp("^__on([^.]+)"+r.requote(ce)+"$");for(var Ue in this)if(be=Ue.match(Ee)){var Xe=this[Ue];this.removeEventListener(be[1],Xe,Xe.$),delete this[Ue]}}}r.selection.enter=$e,r.selection.enter.prototype=Ke,Ke.append=ee.append,Ke.empty=ee.empty,Ke.node=ee.node,Ke.call=ee.call,Ke.size=ee.size,Ke.select=function(ce){for(var I,j,$,X,se,he=[],ye=-1,be=this.length;++ye1?Ge:ce<-1?-Ge:Math.asin(ce)}function Ie(ce){return((ce=Math.exp(ce))+1/ce)/2}var Te=Math.SQRT2;r.interpolateZoom=function(ce,I){var j,$,X=ce[0],se=ce[1],he=ce[2],ye=I[0],be=I[1],Ee=I[2],Ue=ye-X,Xe=be-se,it=Ue*Ue+Xe*Xe;if(it<1e-12)$=Math.log(Ee/he)/Te,j=function(Nt){return[X+Nt*Ue,se+Nt*Xe,he*Math.exp(Te*Nt*$)]};else{var xt=Math.sqrt(it),Dt=(Ee*Ee-he*he+4*it)/(2*he*2*xt),_t=(Ee*Ee-he*he-4*it)/(2*Ee*2*xt),Mt=Math.log(Math.sqrt(Dt*Dt+1)-Dt),vt=Math.log(Math.sqrt(_t*_t+1)-_t);$=(vt-Mt)/Te,j=function(Nt){var Rt,Vt=Nt*$,rn=Ie(Mt),dn=he/(2*xt)*(rn*(Rt=Te*Vt+Mt,((Rt=Math.exp(2*Rt))-1)/(Rt+1))-function(En){return((En=Math.exp(En))-1/En)/2}(Mt));return[X+dn*Ue,se+dn*Xe,he*rn/Ie(Te*Vt+Mt)]}}return j.duration=1e3*$,j},r.behavior.zoom=function(){var ce,I,j,$,X,se,he,ye,be,Ee={x:0,y:0,k:1},Ue=[960,500],Xe=rt,it=250,xt=0,Dt="mousedown.zoom",_t="mousemove.zoom",Mt="mouseup.zoom",vt="touchstart.zoom",Nt=re(Rt,"zoomstart","zoom","zoomend");function Rt(Gn){Gn.on(Dt,cr).on(qe+".zoom",oi).on("dblclick.zoom",Ai).on(vt,Xr)}function Vt(Gn){return[(Gn[0]-Ee.x)/Ee.k,(Gn[1]-Ee.y)/Ee.k]}function rn(Gn){Ee.k=Math.max(Xe[0],Math.min(Xe[1],Gn))}function dn(Gn,Mr){Mr=function(si){return[si[0]*Ee.k+Ee.x,si[1]*Ee.k+Ee.y]}(Mr),Ee.x+=Gn[0]-Mr[0],Ee.y+=Gn[1]-Mr[1]}function En(Gn,Mr,si,Qr){Gn.__chart__={x:Ee.x,y:Ee.y,k:Ee.k},rn(Math.pow(2,Qr)),dn(I=Mr,si),Gn=r.select(Gn),it>0&&(Gn=Gn.transition().duration(it)),Gn.call(Rt.event)}function Tn(){he&&he.domain(se.range().map(function(Gn){return(Gn-Ee.x)/Ee.k}).map(se.invert)),be&&be.domain(ye.range().map(function(Gn){return(Gn-Ee.y)/Ee.k}).map(ye.invert))}function tr(Gn){xt++||Gn({type:"zoomstart"})}function er(Gn){Tn(),Gn({type:"zoom",scale:Ee.k,translate:[Ee.x,Ee.y]})}function gr(Gn){--xt||(Gn({type:"zoomend"}),I=null)}function cr(){var Gn=this,Mr=Nt.of(Gn,arguments),si=0,Qr=r.select(s(Gn)).on(_t,Zi).on(Mt,fi),mi=Vt(r.mouse(Gn)),Mi=Ot(Gn);function Zi(){si=1,dn(r.mouse(Gn),mi),er(Mr)}function fi(){Qr.on(_t,null).on(Mt,null),Mi(si),gr(Mr)}jc.call(Gn),tr(Mr)}function Xr(){var Gn,Mr=this,si=Nt.of(Mr,arguments),Qr={},mi=0,Mi=".zoom-"+r.event.changedTouches[0].identifier,Zi="touchmove"+Mi,fi="touchend"+Mi,zi=[],Oi=r.select(Mr),ta=Ot(Mr);function Ni(){var ko=r.touches(Mr);return Gn=Ee.k,ko.forEach(function(To){To.identifier in Qr&&(Qr[To.identifier]=Vt(To))}),ko}function na(){var ko=r.event.target;r.select(ko).on(Zi,pa).on(fi,Ga),zi.push(ko);for(var To=r.event.changedTouches,Ha=0,po=To.length;Ha1){Ho=ro[0];var nl=ro[1],xc=Ho[0]-nl[0],Ff=Ho[1]-nl[1];mi=xc*xc+Ff*Ff}}function pa(){var ko,To,Ha,po,ro=r.touches(Mr);jc.call(Mr);for(var Ls=0,Ho=ro.length;Ls360?ye-=360:ye<0&&(ye+=360),ye<60?$+(X-$)*ye/60:ye<180?X:ye<240?$+(X-$)*(240-ye)/60:$}(he))}return ce=isNaN(ce)?0:(ce%=360)<0?ce+360:ce,I=isNaN(I)||I<0?0:I>1?1:I,$=2*(j=j<0?0:j>1?1:j)-(X=j<=.5?j*(1+I):j+I-j*I),new It(se(ce+120),se(ce),se(ce-120))}function $t(ce,I,j){return this instanceof $t?(this.h=+ce,this.c=+I,void(this.l=+j)):arguments.length<2?ce instanceof $t?new $t(ce.h,ce.c,ce.l):De(ce instanceof bt?ce.l:(ce=tn((ce=r.rgb(ce)).r,ce.g,ce.b)).l,ce.a,ce.b):new $t(ce,I,j)}At.brighter=function(ce){return ce=Math.pow(.7,arguments.length?ce:1),new ot(this.h,this.s,this.l/ce)},At.darker=function(ce){return ce=Math.pow(.7,arguments.length?ce:1),new ot(this.h,this.s,ce*this.l)},At.rgb=function(){return wt(this.h,this.s,this.l)},r.hcl=$t;var Ut=$t.prototype=new lt;function tt(ce,I,j){return isNaN(ce)&&(ce=0),isNaN(I)&&(I=0),new bt(j,Math.cos(ce*=kt)*I,Math.sin(ce)*I)}function bt(ce,I,j){return this instanceof bt?(this.l=+ce,this.a=+I,void(this.b=+j)):arguments.length<2?ce instanceof bt?new bt(ce.l,ce.a,ce.b):ce instanceof $t?tt(ce.h,ce.c,ce.l):tn((ce=It(ce)).r,ce.g,ce.b):new bt(ce,I,j)}Ut.brighter=function(ce){return new $t(this.h,this.c,Math.min(100,this.l+Ft*(arguments.length?ce:1)))},Ut.darker=function(ce){return new $t(this.h,this.c,Math.max(0,this.l-Ft*(arguments.length?ce:1)))},Ut.rgb=function(){return tt(this.h,this.c,this.l).rgb()},r.lab=bt;var Ft=18,Et=bt.prototype=new lt;function Pt(ce,I,j){var $=(ce+16)/116,X=$+I/500,se=$-j/200;return new It(St(3.2404542*(X=.95047*Je(X))-1.5371385*($=1*Je($))-.4985314*(se=1.08883*Je(se))),St(-.969266*X+1.8760108*$+.041556*se),St(.0556434*X-.2040259*$+1.0572252*se))}function De(ce,I,j){return ce>0?new $t(Math.atan2(j,I)*dt,Math.sqrt(I*I+j*j),ce):new $t(NaN,NaN,ce)}function Je(ce){return ce>.206893034?ce*ce*ce:(ce-4/29)/7.787037}function st(ce){return ce>.008856?Math.pow(ce,1/3):7.787037*ce+4/29}function St(ce){return Math.round(255*(ce<=.00304?12.92*ce:1.055*Math.pow(ce,1/2.4)-.055))}function It(ce,I,j){return this instanceof It?(this.r=~~ce,this.g=~~I,void(this.b=~~j)):arguments.length<2?ce instanceof It?new It(ce.r,ce.g,ce.b):Fn(""+ce,It,wt):new It(ce,I,j)}function Zt(ce){return new It(ce>>16,ce>>8&255,255&ce)}function Kt(ce){return Zt(ce)+""}Et.brighter=function(ce){return new bt(Math.min(100,this.l+Ft*(arguments.length?ce:1)),this.a,this.b)},Et.darker=function(ce){return new bt(Math.max(0,this.l-Ft*(arguments.length?ce:1)),this.a,this.b)},Et.rgb=function(){return Pt(this.l,this.a,this.b)},r.rgb=It;var qt=It.prototype=new lt;function mn(ce){return ce<16?"0"+Math.max(0,ce).toString(16):Math.min(255,ce).toString(16)}function Fn(ce,I,j){var $,X,se,he=0,ye=0,be=0;if($=/([a-z]+)\((.*)\)/.exec(ce=ce.toLowerCase()))switch(X=$[2].split(","),$[1]){case"hsl":return j(parseFloat(X[0]),parseFloat(X[1])/100,parseFloat(X[2])/100);case"rgb":return I(sn(X[0]),sn(X[1]),sn(X[2]))}return(se=gn.get(ce))?I(se.r,se.g,se.b):(ce==null||ce.charAt(0)!=="#"||isNaN(se=parseInt(ce.slice(1),16))||(ce.length===4?(he=(3840&se)>>4,he|=he>>4,ye=240&se,ye|=ye>>4,be=15&se,be|=be<<4):ce.length===7&&(he=(16711680&se)>>16,ye=(65280&se)>>8,be=255&se)),I(he,ye,be))}function pn(ce,I,j){var $,X,se=Math.min(ce/=255,I/=255,j/=255),he=Math.max(ce,I,j),ye=he-se,be=(he+se)/2;return ye?(X=be<.5?ye/(he+se):ye/(2-he-se),$=ce==he?(I-j)/ye+(I0&&be<1?0:$),new ot($,X,be)}function tn(ce,I,j){var $=st((.4124564*(ce=nn(ce))+.3575761*(I=nn(I))+.1804375*(j=nn(j)))/.95047),X=st((.2126729*ce+.7151522*I+.072175*j)/1);return bt(116*X-16,500*($-X),200*(X-st((.0193339*ce+.119192*I+.9503041*j)/1.08883)))}function nn(ce){return(ce/=255)<=.04045?ce/12.92:Math.pow((ce+.055)/1.055,2.4)}function sn(ce){var I=parseFloat(ce);return ce.charAt(ce.length-1)==="%"?Math.round(2.55*I):I}qt.brighter=function(ce){ce=Math.pow(.7,arguments.length?ce:1);var I=this.r,j=this.g,$=this.b,X=30;return I||j||$?(I&&I=200&&Xe<300||Xe===304){try{Ue=j.call(X,ye)}catch(it){return void se.error.call(X,it)}se.load.call(X,Ue)}else se.error.call(X,ye)}return self.XDomainRequest&&!("withCredentials"in ye)&&/^(http(s)?:)?\/\//.test(ce)&&(ye=new XDomainRequest),"onload"in ye?ye.onload=ye.onerror=Ee:ye.onreadystatechange=function(){ye.readyState>3&&Ee()},ye.onprogress=function(Ue){var Xe=r.event;r.event=Ue;try{se.progress.call(X,ye)}finally{r.event=Xe}},X.header=function(Ue,Xe){return Ue=(Ue+"").toLowerCase(),arguments.length<2?he[Ue]:(Xe==null?delete he[Ue]:he[Ue]=Xe+"",X)},X.mimeType=function(Ue){return arguments.length?(I=Ue==null?null:Ue+"",X):I},X.responseType=function(Ue){return arguments.length?(be=Ue,X):be},X.response=function(Ue){return j=Ue,X},["get","post"].forEach(function(Ue){X[Ue]=function(){return X.send.apply(X,[Ue].concat(l(arguments)))}}),X.send=function(Ue,Xe,it){if(arguments.length===2&&typeof Xe=="function"&&(it=Xe,Xe=null),ye.open(Ue,ce,!0),I==null||"accept"in he||(he.accept=I+",*/*"),ye.setRequestHeader)for(var xt in he)ye.setRequestHeader(xt,he[xt]);return I!=null&&ye.overrideMimeType&&ye.overrideMimeType(I),be!=null&&(ye.responseType=be),it!=null&&X.on("error",it).on("load",function(Dt){it(null,Dt)}),se.beforesend.call(X,ye),ye.send(Xe??null),X},X.abort=function(){return ye.abort(),X},r.rebind(X,se,"on"),$==null?X:X.get(function(Ue){return Ue.length===1?function(Xe,it){Ue(Xe==null?it:null)}:Ue}($))}gn.forEach(function(ce,I){gn.set(ce,Zt(I))}),r.functor=bn,r.xhr=In(O),r.dsv=function(ce,I){var j=new RegExp('["'+ce+` -]`),$=ce.charCodeAt(0);function X(Ee,Ue,Xe){arguments.length<3&&(Xe=Ue,Ue=null);var it=qn(Ee,I,Ue==null?se:he(Ue),Xe);return it.row=function(xt){return arguments.length?it.response((Ue=xt)==null?se:he(xt)):Ue},it}function se(Ee){return X.parse(Ee.responseText)}function he(Ee){return function(Ue){return X.parse(Ue.responseText,Ee)}}function ye(Ee){return Ee.map(be).join(ce)}function be(Ee){return j.test(Ee)?'"'+Ee.replace(/\"/g,'""')+'"':Ee}return X.parse=function(Ee,Ue){var Xe;return X.parseRows(Ee,function(it,xt){if(Xe)return Xe(it,xt-1);var Dt=function(_t){for(var Mt={},vt=it.length,Nt=0;Nt=Mt)return Dt;if(it)return it=!1,xt;var rn=vt;if(Ee.charCodeAt(rn)===34){for(var dn=rn;dn++24?(isFinite(I)&&(clearTimeout(yr),yr=setTimeout(Dn,I)),Dr=0):(Dr=1,Sr(Dn))}function lr(){for(var ce=Date.now(),I=Wn;I;)ce>=I.t&&I.c(ce-I.t)&&(I.c=null),I=I.n;return ce}function Yr(){for(var ce,I=Wn,j=1/0;I;)I.c?(I.t1&&(I=ce[se[he-2]],j=ce[se[he-1]],$=ce[ye],(j[0]-I[0])*($[1]-I[1])-(j[1]-I[1])*($[0]-I[0])<=0);)--he;se[he++]=ye}return se.slice(0,he)}function Bn(ce,I){return ce[0]-I[0]||ce[1]-I[1]}r.timer=function(){Kn.apply(this,arguments)},r.timer.flush=function(){lr(),Yr()},r.round=function(ce,I){return I?Math.round(ce*(I=Math.pow(10,I)))/I:Math.round(ce)},r.geom={},r.geom.hull=function(ce){var I=Mn,j=rr;if(arguments.length)return $(ce);function $(X){if(X.length<3)return[];var se,he=bn(I),ye=bn(j),be=X.length,Ee=[],Ue=[];for(se=0;se=0;--se)_t.push(X[Ee[Xe[se]][2]]);for(se=+xt;seLt)ye=ye.L;else{if(!((X=se-Pn(ye,he))>Lt)){$>-Lt?(I=ye.P,j=ye):X>-Lt?(I=ye,j=ye.N):I=j=ye;break}if(!ye.R){I=ye;break}ye=ye.R}var be=Nn(ce);if(jn.insert(I,be),I||j){if(I===j)return xr(I),j=Nn(I.site),jn.insert(be,j),be.edge=j.edge=Ir(I.site,be.site),or(I),void or(j);if(j){xr(I),xr(j);var Ee=I.site,Ue=Ee.x,Xe=Ee.y,it=ce.x-Ue,xt=ce.y-Xe,Dt=j.site,_t=Dt.x-Ue,Mt=Dt.y-Xe,vt=2*(it*Mt-xt*_t),Nt=it*it+xt*xt,Rt=_t*_t+Mt*Mt,Vt={x:(Mt*Nt-xt*Rt)/vt+Ue,y:(it*Rt-_t*Nt)/vt+Xe};ai(j.edge,Ee,Dt,Vt),be.edge=Ir(Ee,ce,null,Vt),j.edge=Ir(ce,Dt,null,Vt),or(I),or(j)}else be.edge=Ir(I.site,be.site)}}function kn(ce,I){var j=ce.site,$=j.x,X=j.y,se=X-I;if(!se)return $;var he=ce.P;if(!he)return-1/0;var ye=(j=he.site).x,be=j.y,Ee=be-I;if(!Ee)return ye;var Ue=ye-$,Xe=1/se-1/Ee,it=Ue/Ee;return Xe?(-it+Math.sqrt(it*it-2*Xe*(Ue*Ue/(-2*Ee)-be+Ee/2+X-se/2)))/Xe+$:($+ye)/2}function Pn(ce,I){var j=ce.N;if(j)return kn(j,I);var $=ce.site;return $.y===I?$.x:1/0}function Zn(ce){this.site=ce,this.edges=[]}function Yn(ce,I){return I.angle-ce.angle}function ir(){Er(this),this.x=this.y=this.arc=this.site=this.cy=null}function or(ce){var I=ce.P,j=ce.N;if(I&&j){var $=I.site,X=ce.site,se=j.site;if($!==se){var he=X.x,ye=X.y,be=$.x-he,Ee=$.y-ye,Ue=se.x-he,Xe=2*(be*(Mt=se.y-ye)-Ee*Ue);if(!(Xe>=-1e-12)){var it=be*be+Ee*Ee,xt=Ue*Ue+Mt*Mt,Dt=(Mt*it-Ee*xt)/Xe,_t=(be*xt-Ue*it)/Xe,Mt=_t+ye,vt=Hn.pop()||new ir;vt.arc=ce,vt.site=X,vt.x=Dt+he,vt.y=Mt+Math.sqrt(Dt*Dt+_t*_t),vt.cy=Mt,ce.circle=vt;for(var Nt=null,Rt=fn._;Rt;)if(vt.y=ye)return;if(it>Dt){if(se){if(se.y>=Ee)return}else se={x:Mt,y:be};j={x:Mt,y:Ee}}else{if(se){if(se.y1)if(it>Dt){if(se){if(se.y>=Ee)return}else se={x:(be-X)/$,y:be};j={x:(Ee-X)/$,y:Ee}}else{if(se){if(se.y=ye)return}else se={x:he,y:$*he+X};j={x:ye,y:$*ye+X}}else{if(se){if(se.x0)){if(vt/=Tn,Tn<0){if(vt0){if(vt>En)return;vt>dn&&(dn=vt)}if(vt=Xe-Vt,Tn||!(vt<0)){if(vt/=Tn,Tn<0){if(vt>En)return;vt>dn&&(dn=vt)}else if(Tn>0){if(vt0)){if(vt/=tr,tr<0){if(vt0){if(vt>En)return;vt>dn&&(dn=vt)}if(vt=it-rn,tr||!(vt<0)){if(vt/=tr,tr<0){if(vt>En)return;vt>dn&&(dn=vt)}else if(tr>0){if(vt0&&(Mt.a={x:Vt+dn*Tn,y:rn+dn*tr}),En<1&&(Mt.b={x:Vt+En*Tn,y:rn+En*tr}),Mt}}}}}),_t=xt.length;_t--;)(!wr(be=xt[_t],ye)||!Dt(be)||b(be.a.x-be.b.x)Lt||b(Xe-Ee)>Lt)&&(Dt.splice(xt,0,new Vi(Br(it.site,vt,b(Ue-Nt)Lt?{x:Nt,y:b(be-Nt)Lt?{x:b(Ee-rn)Lt?{x:Rt,y:b(be-Rt)Lt?{x:b(Ee-Vt)=Ue&&vt.x<=it&&vt.y>=Xe&&vt.y<=xt?[[Ue,xt],[it,xt],[it,Xe],[Ue,Xe]]:[]).point=be[_t]}),Ee}function ye(be){return be.map(function(Ee,Ue){return{x:Math.round($(Ee,Ue)/Lt)*Lt,y:Math.round(X(Ee,Ue)/Lt)*Lt,i:Ue}})}return he.links=function(be){return eo(ye(be)).edges.filter(function(Ee){return Ee.l&&Ee.r}).map(function(Ee){return{source:be[Ee.l.i],target:be[Ee.r.i]}})},he.triangles=function(be){var Ee=[];return eo(ye(be)).cells.forEach(function(Ue,Xe){for(var it,xt,Dt,_t,Mt=Ue.site,vt=Ue.edges.sort(Yn),Nt=-1,Rt=vt.length,Vt=vt[Rt-1].edge,rn=Vt.l===Mt?Vt.r:Vt.l;++Ntse||it>he||xt<$||Dt=dn)<<1|I>=rn,Tn=En+4;Ense&&(X=I.slice(se,X),ye[he]?ye[he]+=X:ye[++he]=X),(j=j[0])===($=$[0])?ye[he]?ye[he]+=$:ye[++he]=$:(ye[++he]=null,be.push({i:he,x:co(j,$)})),se=Ns.lastIndex;return sevt&&(vt=Ue.x),Ue.y>Nt&&(Nt=Ue.y),Xe.push(Ue.x),it.push(Ue.y);else for(xt=0;xtvt&&(vt=rn),dn>Nt&&(Nt=dn),Xe.push(rn),it.push(dn)}var En=vt-_t,Tn=Nt-Mt;function tr(cr,Xr,oi,Ai,Gn,Mr,si,Qr){if(!isNaN(oi)&&!isNaN(Ai))if(cr.leaf){var mi=cr.x,Mi=cr.y;if(mi!=null)if(b(mi-oi)+b(Mi-Ai)<.01)er(cr,Xr,oi,Ai,Gn,Mr,si,Qr);else{var Zi=cr.point;cr.x=cr.y=cr.point=null,er(cr,Zi,mi,Mi,Gn,Mr,si,Qr),er(cr,Xr,oi,Ai,Gn,Mr,si,Qr)}else cr.x=oi,cr.y=Ai,cr.point=Xr}else er(cr,Xr,oi,Ai,Gn,Mr,si,Qr)}function er(cr,Xr,oi,Ai,Gn,Mr,si,Qr){var mi=.5*(Gn+si),Mi=.5*(Mr+Qr),Zi=oi>=mi,fi=Ai>=Mi,zi=fi<<1|Zi;cr.leaf=!1,Zi?Gn=mi:si=mi,fi?Mr=Mi:Qr=Mi,tr(cr=cr.nodes[zi]||(cr.nodes[zi]={leaf:!0,nodes:[],point:null,x:null,y:null}),Xr,oi,Ai,Gn,Mr,si,Qr)}En>Tn?Nt=Mt+En:vt=_t+Tn;var gr={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(cr){tr(gr,cr,+Rt(cr,++xt),+Vt(cr,xt),_t,Mt,vt,Nt)},visit:function(cr){ns(cr,gr,_t,Mt,vt,Nt)},find:function(cr){return ua(gr,cr[0],cr[1],_t,Mt,vt,Nt)}};if(xt=-1,I==null){for(;++xt=0&&!(j=r.interpolators[$](ce,I)););return j}function to(ce,I){var j,$=[],X=[],se=ce.length,he=I.length,ye=Math.min(ce.length,I.length);for(j=0;j=1?1:ce(I)}}function Zu(ce){return function(I){return 1-ce(1-I)}}function Kl(ce){return function(I){return .5*(I<.5?ce(2*I):2-ce(2-2*I))}}function zc(ce){return ce*ce}function Nc(ce){return ce*ce*ce}function yc(ce){if(ce<=0)return 0;if(ce>=1)return 1;var I=ce*ce,j=I*ce;return 4*(ce<.5?j:3*(ce-I)+j-.75)}function Bc(ce){return 1-Math.cos(ce*Ge)}function Vs(ce){return Math.pow(2,10*(ce-1))}function qs(ce){return 1-Math.sqrt(1-ce*ce)}function xl(ce){return ce<1/2.75?7.5625*ce*ce:ce<2/2.75?7.5625*(ce-=1.5/2.75)*ce+.75:ce<2.5/2.75?7.5625*(ce-=2.25/2.75)*ce+.9375:7.5625*(ce-=2.625/2.75)*ce+.984375}function bl(ce,I){return I-=ce,function(j){return Math.round(ce+I*j)}}function _l(ce){var I,j,$,X=[ce.a,ce.b],se=[ce.c,ce.d],he=Es(X),ye=Ql(X,se),be=Es(((I=se)[0]+=($=-ye)*(j=X)[0],I[1]+=$*j[1],I))||0;X[0]*se[1]=0?ce.slice(0,I):ce,$=I>=0?ce.slice(I+1):"in";return j=mc.get(j)||Zo,wa(($=Rc.get($)||O)(j.apply(null,a.call(arguments,1))))},r.interpolateHcl=function(ce,I){ce=r.hcl(ce),I=r.hcl(I);var j=ce.h,$=ce.c,X=ce.l,se=I.h-j,he=I.c-$,ye=I.l-X;return isNaN(he)&&(he=0,$=isNaN($)?I.c:$),isNaN(se)?(se=0,j=isNaN(j)?I.h:j):se>180?se-=360:se<-180&&(se+=360),function(be){return tt(j+se*be,$+he*be,X+ye*be)+""}},r.interpolateHsl=function(ce,I){ce=r.hsl(ce),I=r.hsl(I);var j=ce.h,$=ce.s,X=ce.l,se=I.h-j,he=I.s-$,ye=I.l-X;return isNaN(he)&&(he=0,$=isNaN($)?I.s:$),isNaN(se)?(se=0,j=isNaN(j)?I.h:j):se>180?se-=360:se<-180&&(se+=360),function(be){return wt(j+se*be,$+he*be,X+ye*be)+""}},r.interpolateLab=function(ce,I){ce=r.lab(ce),I=r.lab(I);var j=ce.l,$=ce.a,X=ce.b,se=I.l-j,he=I.a-$,ye=I.b-X;return function(be){return Pt(j+se*be,$+he*be,X+ye*be)+""}},r.interpolateRound=bl,r.transform=function(ce){var I=c.createElementNS(r.ns.prefix.svg,"g");return(r.transform=function(j){if(j!=null){I.setAttribute("transform",j);var $=I.transform.baseVal.consolidate()}return new _l($?$.matrix:Ju)})(ce)},_l.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var Ju={a:1,b:0,c:0,d:1,e:0,f:0};function vs(ce){return ce.length?ce.pop()+",":""}function wl(ce,I){var j=[],$=[];return ce=r.transform(ce),I=r.transform(I),function(X,se,he,ye){if(X[0]!==se[0]||X[1]!==se[1]){var be=he.push("translate(",null,",",null,")");ye.push({i:be-4,x:co(X[0],se[0])},{i:be-2,x:co(X[1],se[1])})}else(se[0]||se[1])&&he.push("translate("+se+")")}(ce.translate,I.translate,j,$),function(X,se,he,ye){X!==se?(X-se>180?se+=360:se-X>180&&(X+=360),ye.push({i:he.push(vs(he)+"rotate(",null,")")-2,x:co(X,se)})):se&&he.push(vs(he)+"rotate("+se+")")}(ce.rotate,I.rotate,j,$),function(X,se,he,ye){X!==se?ye.push({i:he.push(vs(he)+"skewX(",null,")")-2,x:co(X,se)}):se&&he.push(vs(he)+"skewX("+se+")")}(ce.skew,I.skew,j,$),function(X,se,he,ye){if(X[0]!==se[0]||X[1]!==se[1]){var be=he.push(vs(he)+"scale(",null,",",null,")");ye.push({i:be-4,x:co(X[0],se[0])},{i:be-2,x:co(X[1],se[1])})}else se[0]===1&&se[1]===1||he.push(vs(he)+"scale("+se+")")}(ce.scale,I.scale,j,$),ce=I=null,function(X){for(var se,he=-1,ye=$.length;++he0?j=Vt:(ce.c=null,ce.t=NaN,ce=null,ye.end({type:"end",alpha:j=0})):Vt>0&&(ye.start({type:"start",alpha:j=Vt}),ce=Kn(he.tick)),he):j},he.start=function(){var Vt,rn,dn,En=Mt.length,Tn=vt.length,tr=be[0],er=be[1];for(Vt=0;Vt=0;)j.push(X[$])}function an(ce,I){for(var j=[ce],$=[];(ce=j.pop())!=null;)if($.push(ce),(se=ce.children)&&(X=se.length))for(var X,se,he=-1;++he=0;)he.push(Ue=Ee[be]),Ue.parent=se,Ue.depth=se.depth+1;j&&(se.value=0),se.children=Ee}else j&&(se.value=+j.call($,se,se.depth)||0),delete se.children;return an(X,function(Xe){var it,xt;ce&&(it=Xe.children)&&it.sort(ce),j&&(xt=Xe.parent)&&(xt.value+=Xe.value)}),ye}return $.sort=function(X){return arguments.length?(ce=X,$):ce},$.children=function(X){return arguments.length?(I=X,$):I},$.value=function(X){return arguments.length?(j=X,$):j},$.revalue=function(X){return j&&(Yt(X,function(se){se.children&&(se.value=0)}),an(X,function(se){var he;se.children||(se.value=+j.call($,se,se.depth)||0),(he=se.parent)&&(he.value+=se.value)})),X},$},r.layout.partition=function(){var ce=r.layout.hierarchy(),I=[1,1];function j($,X){var se=ce.call(this,$,X);return function he(ye,be,Ee,Ue){var Xe=ye.children;if(ye.x=be,ye.y=ye.depth*Ue,ye.dx=Ee,ye.dy=Ue,Xe&&(it=Xe.length)){var it,xt,Dt,_t=-1;for(Ee=ye.value?Ee/ye.value:0;++_tye&&(ye=$),he.push($)}for(j=0;jX&&($=j,X=I);return $}function ca(ce){return ce.reduce(da,0)}function da(ce,I){return ce+I[1]}function fo(ce,I){return so(ce,Math.ceil(Math.log(I.length)/Math.LN2+1))}function so(ce,I){for(var j=-1,$=+ce[0],X=(ce[1]-$)/I,se=[];++j<=I;)se[j]=X*j+$;return se}function za(ce){return[r.min(ce),r.max(ce)]}function Na(ce,I){return ce.value-I.value}function lo(ce,I){var j=ce._pack_next;ce._pack_next=I,I._pack_prev=ce,I._pack_next=j,j._pack_prev=I}function Fo(ce,I){ce._pack_next=I,I._pack_prev=ce}function is(ce,I){var j=I.x-ce.x,$=I.y-ce.y,X=ce.r+I.r;return .999*X*X>j*j+$*$}function as(ce){if((I=ce.children)&&(be=I.length)){var I,j,$,X,se,he,ye,be,Ee=1/0,Ue=-1/0,Xe=1/0,it=-1/0;if(I.forEach(os),(j=I[0]).x=-j.r,j.y=0,Rt(j),be>1&&(($=I[1]).x=$.r,$.y=0,Rt($),be>2))for(ia(j,$,X=I[2]),Rt(X),lo(j,X),j._pack_prev=X,lo(X,$),$=j._pack_next,se=3;se0)for(he=-1;++he=Xe[0]&&be<=Xe[1]&&((ye=Ee[r.bisect(it,be,1,Dt)-1]).y+=_t,ye.push(se[he]));return Ee}return X.value=function(se){return arguments.length?(I=se,X):I},X.range=function(se){return arguments.length?(j=bn(se),X):j},X.bins=function(se){return arguments.length?($=typeof se=="number"?function(he){return so(he,se)}:bn(se),X):$},X.frequency=function(se){return arguments.length?(ce=!!se,X):ce},X},r.layout.pack=function(){var ce,I=r.layout.hierarchy().sort(Na),j=0,$=[1,1];function X(se,he){var ye=I.call(this,se,he),be=ye[0],Ee=$[0],Ue=$[1],Xe=ce==null?Math.sqrt:typeof ce=="function"?ce:function(){return ce};if(be.x=be.y=0,an(be,function(xt){xt.r=+Xe(xt.value)}),an(be,as),j){var it=j*(ce?1:Math.max(2*be.r/Ee,2*be.r/Ue))/2;an(be,function(xt){xt.r+=it}),an(be,as),an(be,function(xt){xt.r-=it})}return function xt(Dt,_t,Mt,vt){var Nt=Dt.children;if(Dt.x=_t+=vt*Dt.x,Dt.y=Mt+=vt*Dt.y,Dt.r*=vt,Nt)for(var Rt=-1,Vt=Nt.length;++RtDt.x&&(Dt=Rt),Rt.depth>_t.depth&&(_t=Rt)});var Mt=I(xt,Dt)/2-xt.x,vt=j[0]/(Dt.x+I(Dt,xt)/2+Mt),Nt=j[1]/(_t.depth||1);Yt(Xe,function(Rt){Rt.x=(Rt.x+Mt)*vt,Rt.y=Rt.depth*Nt})}return Ue}function se(be){var Ee=be.children,Ue=be.parent.children,Xe=be.i?Ue[be.i-1]:null;if(Ee.length){(function(xt){for(var Dt,_t=0,Mt=0,vt=xt.children,Nt=vt.length;--Nt>=0;)(Dt=vt[Nt]).z+=_t,Dt.m+=_t,_t+=Dt.s+(Mt+=Dt.c)})(be);var it=(Ee[0].z+Ee[Ee.length-1].z)/2;Xe?(be.z=Xe.z+I(be._,Xe._),be.m=be.z-it):be.z=it}else Xe&&(be.z=Xe.z+I(be._,Xe._));be.parent.A=function(xt,Dt,_t){if(Dt){for(var Mt,vt=xt,Nt=xt,Rt=Dt,Vt=vt.parent.children[0],rn=vt.m,dn=Nt.m,En=Rt.m,Tn=Vt.m;Rt=ln(Rt),vt=zt(vt),Rt&&vt;)Vt=zt(Vt),(Nt=ln(Nt)).a=xt,(Mt=Rt.z+En-vt.z-rn+I(Rt._,vt._))>0&&(Ht(un(Rt,xt,_t),xt,Mt),rn+=Mt,dn+=Mt),En+=Rt.m,rn+=vt.m,Tn+=Vt.m,dn+=Nt.m;Rt&&!ln(Nt)&&(Nt.t=Rt,Nt.m+=En-dn),vt&&!zt(Vt)&&(Vt.t=vt,Vt.m+=rn-Tn,_t=xt)}return _t}(be,Xe,be.parent.A||Ue[0])}function he(be){be._.x=be.z+be.parent.m,be.m+=be.parent.m}function ye(be){be.x*=j[0],be.y=be.depth*j[1]}return X.separation=function(be){return arguments.length?(I=be,X):I},X.size=function(be){return arguments.length?($=(j=be)==null?ye:null,X):$?null:j},X.nodeSize=function(be){return arguments.length?($=(j=be)==null?null:ye,X):$?j:null},en(X,ce)},r.layout.cluster=function(){var ce=r.layout.hierarchy().sort(null).value(null),I=ht,j=[1,1],$=!1;function X(se,he){var ye,be=ce.call(this,se,he),Ee=be[0],Ue=0;an(Ee,function(_t){var Mt=_t.children;Mt&&Mt.length?(_t.x=function(vt){return vt.reduce(function(Nt,Rt){return Nt+Rt.x},0)/vt.length}(Mt),_t.y=function(vt){return 1+r.max(vt,function(Nt){return Nt.y})}(Mt)):(_t.x=ye?Ue+=I(_t,ye):0,_t.y=0,ye=_t)});var Xe=function _t(Mt){var vt=Mt.children;return vt&&vt.length?_t(vt[0]):Mt}(Ee),it=function _t(Mt){var vt,Nt=Mt.children;return Nt&&(vt=Nt.length)?_t(Nt[vt-1]):Mt}(Ee),xt=Xe.x-I(Xe,it)/2,Dt=it.x+I(it,Xe)/2;return an(Ee,$?function(_t){_t.x=(_t.x-Ee.x)*j[0],_t.y=(Ee.y-_t.y)*j[1]}:function(_t){_t.x=(_t.x-xt)/(Dt-xt)*j[0],_t.y=(1-(Ee.y?_t.y/Ee.y:1))*j[1]}),be}return X.separation=function(se){return arguments.length?(I=se,X):I},X.size=function(se){return arguments.length?($=(j=se)==null,X):$?null:j},X.nodeSize=function(se){return arguments.length?($=(j=se)!=null,X):$?j:null},en(X,ce)},r.layout.treemap=function(){var ce,I=r.layout.hierarchy(),j=Math.round,$=[1,1],X=null,se=Ln,he=!1,ye="squarify",be=.5*(1+Math.sqrt(5));function Ee(_t,Mt){for(var vt,Nt,Rt=-1,Vt=_t.length;++Rt0;)rn.push(vt=dn[Rt-1]),rn.area+=vt.area,ye!=="squarify"||(Nt=it(rn,Tn))<=En?(dn.pop(),En=Nt):(rn.area-=rn.pop().area,xt(rn,Tn,Vt,!1),Tn=Math.min(Vt.dx,Vt.dy),rn.length=rn.area=0,En=1/0);rn.length&&(xt(rn,Tn,Vt,!0),rn.length=rn.area=0),Mt.forEach(Ue)}}function Xe(_t){var Mt=_t.children;if(Mt&&Mt.length){var vt,Nt=se(_t),Rt=Mt.slice(),Vt=[];for(Ee(Rt,Nt.dx*Nt.dy/_t.value),Vt.area=0;vt=Rt.pop();)Vt.push(vt),Vt.area+=vt.area,vt.z!=null&&(xt(Vt,vt.z?Nt.dx:Nt.dy,Nt,!Rt.length),Vt.length=Vt.area=0);Mt.forEach(Xe)}}function it(_t,Mt){for(var vt,Nt=_t.area,Rt=0,Vt=1/0,rn=-1,dn=_t.length;++rnRt&&(Rt=vt));return Mt*=Mt,(Nt*=Nt)?Math.max(Mt*Rt*be/Nt,Nt/(Mt*Vt*be)):1/0}function xt(_t,Mt,vt,Nt){var Rt,Vt=-1,rn=_t.length,dn=vt.x,En=vt.y,Tn=Mt?j(_t.area/Mt):0;if(Mt==vt.dx){for((Nt||Tn>vt.dy)&&(Tn=vt.dy);++Vtvt.dx)&&(Tn=vt.dx);++Vt1);return ce+I*$*Math.sqrt(-2*Math.log(se)/se)}},logNormal:function(){var ce=r.random.normal.apply(r,arguments);return function(){return Math.exp(ce())}},bates:function(ce){var I=r.random.irwinHall(ce);return function(){return I()/ce}},irwinHall:function(ce){return function(){for(var I=0,j=0;j2?Tr:ur,Ue=X?Hs:Ku;return se=Ee(I,j,Ue,$),he=Ee(j,I,Ue,Io),be}function be(Ee){return se(Ee)}return be.invert=function(Ee){return he(Ee)},be.domain=function(Ee){return arguments.length?(I=Ee.map(Number),ye()):I},be.range=function(Ee){return arguments.length?(j=Ee,ye()):j},be.rangeRound=function(Ee){return be.range(Ee).interpolate(bl)},be.clamp=function(Ee){return arguments.length?(X=Ee,ye()):X},be.interpolate=function(Ee){return arguments.length?($=Ee,ye()):$},be.ticks=function(Ee){return Qn(I,Ee)},be.tickFormat=function(Ee,Ue){return d3_scale_linearTickFormat(I,Ee,Ue)},be.nice=function(Ee){return Jr(I,Ee),ye()},be.copy=function(){return ce(I,j,$,X)},ye()}([0,1],[0,1],Io,!1)},r.scale.log=function(){return function ce(I,j,$,X){function se(be){return($?Math.log(be<0?0:be):-Math.log(be>0?0:-be))/Math.log(j)}function he(be){return $?Math.pow(j,be):-Math.pow(j,-be)}function ye(be){return I(se(be))}return ye.invert=function(be){return he(I.invert(be))},ye.domain=function(be){return arguments.length?($=be[0]>=0,I.domain((X=be.map(Number)).map(se)),ye):X},ye.base=function(be){return arguments.length?(j=+be,I.domain(X.map(se)),ye):j},ye.nice=function(){var be=vr(X.map(se),$?Math:pi);return I.domain(be),X=be.map(he),ye},ye.ticks=function(){var be=Jn(X),Ee=[],Ue=be[0],Xe=be[1],it=Math.floor(se(Ue)),xt=Math.ceil(se(Xe)),Dt=j%1?2:j;if(isFinite(xt-it)){if($){for(;it0;_t--)Ee.push(he(it)*_t);for(it=0;Ee[it]Xe;xt--);Ee=Ee.slice(it,xt)}return Ee},ye.copy=function(){return ce(I.copy(),j,$,X)},$r(ye,I)}(r.scale.linear().domain([0,1]),10,!0,[1,10])};var pi={floor:function(ce){return-Math.ceil(-ce)},ceil:function(ce){return-Math.floor(-ce)}};function Rr(ce){return function(I){return I<0?-Math.pow(-I,ce):Math.pow(I,ce)}}r.scale.pow=function(){return function ce(I,j,$){var X=Rr(j),se=Rr(1/j);function he(ye){return I(X(ye))}return he.invert=function(ye){return se(I.invert(ye))},he.domain=function(ye){return arguments.length?(I.domain(($=ye.map(Number)).map(X)),he):$},he.ticks=function(ye){return Qn($,ye)},he.tickFormat=function(ye,be){return d3_scale_linearTickFormat($,ye,be)},he.nice=function(ye){return he.domain(Jr($,ye))},he.exponent=function(ye){return arguments.length?(X=Rr(j=ye),se=Rr(1/j),I.domain($.map(X)),he):j},he.copy=function(){return ce(I.copy(),j,$)},$r(he,I)}(r.scale.linear(),1,[0,1])},r.scale.sqrt=function(){return r.scale.pow().exponent(.5)},r.scale.ordinal=function(){return function ce(I,j){var $,X,se;function he(be){return X[(($.get(be)||(j.t==="range"?$.set(be,I.push(be)):NaN))-1)%X.length]}function ye(be,Ee){return r.range(I.length).map(function(Ue){return be+Ee*Ue})}return he.domain=function(be){if(!arguments.length)return I;I=[],$=new M;for(var Ee,Ue=-1,Xe=be.length;++Ue0?$[he-1]:I[0],he<$.length?$[he]:I[I.length-1]]},se.copy=function(){return ce(I,j)},X()}([],[])},r.scale.quantize=function(){return function ce(I,j,$){var X,se;function he(be){return $[Math.max(0,Math.min(se,Math.floor(X*(be-I))))]}function ye(){return X=$.length/(j-I),se=$.length-1,he}return he.domain=function(be){return arguments.length?(I=+be[0],j=+be[be.length-1],ye()):[I,j]},he.range=function(be){return arguments.length?($=be,ye()):$},he.invertExtent=function(be){return[be=(be=$.indexOf(be))<0?NaN:be/X+I,be+1/X]},he.copy=function(){return ce(I,j,$)},ye()}(0,1,[0,1])},r.scale.threshold=function(){return function ce(I,j){function $(X){if(X<=X)return j[r.bisect(I,X)]}return $.domain=function(X){return arguments.length?(I=X,$):I},$.range=function(X){return arguments.length?(j=X,$):j},$.invertExtent=function(X){return X=j.indexOf(X),[I[X-1],I[X]]},$.copy=function(){return ce(I,j)},$}([.5],[0,1])},r.scale.identity=function(){return function ce(I){function j($){return+$}return j.invert=j,j.domain=j.range=function($){return arguments.length?(I=$.map(j),j):I},j.ticks=function($){return Qn(I,$)},j.tickFormat=function($,X){return d3_scale_linearTickFormat(I,$,X)},j.copy=function(){return ce(I)},j}([0,1])},r.svg={},r.svg.arc=function(){var ce=Qi,I=Ci,j=Or,$=aa,X=oa,se=Xi,he=Da;function ye(){var Ee=Math.max(0,+ce.apply(this,arguments)),Ue=Math.max(0,+I.apply(this,arguments)),Xe=X.apply(this,arguments)-Ge,it=se.apply(this,arguments)-Ge,xt=Math.abs(it-Xe),Dt=Xe>it?0:1;if(Ue=Be)return be(Ue,Dt)+(Ee?be(Ee,1-Dt):"")+"Z";var _t,Mt,vt,Nt,Rt,Vt,rn,dn,En,Tn,tr,er,gr=0,cr=0,Xr=[];if((Nt=(+he.apply(this,arguments)||0)/2)&&(vt=$===aa?Math.sqrt(Ee*Ee+Ue*Ue):+$.apply(this,arguments),Dt||(cr*=-1),Ue&&(cr=Oe(vt/Ue*Math.sin(Nt))),Ee&&(gr=Oe(vt/Ee*Math.sin(Nt)))),Ue){Rt=Ue*Math.cos(Xe+cr),Vt=Ue*Math.sin(Xe+cr),rn=Ue*Math.cos(it-cr),dn=Ue*Math.sin(it-cr);var oi=Math.abs(it-Xe-2*cr)<=Wt?0:1;if(cr&&gi(Rt,Vt,rn,dn)===Dt^oi){var Ai=(Xe+it)/2;Rt=Ue*Math.cos(Ai),Vt=Ue*Math.sin(Ai),rn=dn=null}}else Rt=Vt=0;if(Ee){En=Ee*Math.cos(it-gr),Tn=Ee*Math.sin(it-gr),tr=Ee*Math.cos(Xe+gr),er=Ee*Math.sin(Xe+gr);var Gn=Math.abs(Xe-it+2*gr)<=Wt?0:1;if(gr&&gi(En,Tn,tr,er)===1-Dt^Gn){var Mr=(Xe+it)/2;En=Ee*Math.cos(Mr),Tn=Ee*Math.sin(Mr),tr=er=null}}else En=Tn=0;if(xt>Lt&&(_t=Math.min(Math.abs(Ue-Ee)/2,+j.apply(this,arguments)))>.001){Mt=Ee0?0:1}function Aa(ce,I,j,$,X){var se=ce[0]-I[0],he=ce[1]-I[1],ye=(X?$:-$)/Math.sqrt(se*se+he*he),be=ye*he,Ee=-ye*se,Ue=ce[0]+be,Xe=ce[1]+Ee,it=I[0]+be,xt=I[1]+Ee,Dt=(Ue+it)/2,_t=(Xe+xt)/2,Mt=it-Ue,vt=xt-Xe,Nt=Mt*Mt+vt*vt,Rt=j-$,Vt=Ue*xt-it*Xe,rn=(vt<0?-1:1)*Math.sqrt(Math.max(0,Rt*Rt*Nt-Vt*Vt)),dn=(Vt*vt-Mt*rn)/Nt,En=(-Vt*Mt-vt*rn)/Nt,Tn=(Vt*vt+Mt*rn)/Nt,tr=(-Vt*Mt+vt*rn)/Nt,er=dn-Dt,gr=En-_t,cr=Tn-Dt,Xr=tr-_t;return er*er+gr*gr>cr*cr+Xr*Xr&&(dn=Tn,En=tr),[[dn-be,En-Ee],[dn*j/Rt,En*j/Rt]]}function Ro(){return!0}function Il(ce){var I=Mn,j=rr,$=Ro,X=Ss,se=X.key,he=.7;function ye(be){var Ee,Ue=[],Xe=[],it=-1,xt=be.length,Dt=bn(I),_t=bn(j);function Mt(){Ue.push("M",X(ce(Xe),he))}for(;++it1&&X.push("H",$[0]),X.join("")},"step-before":no,"step-after":Cs,basis:qo,"basis-open":function(ce){if(ce.length<4)return Ss(ce);for(var I,j=[],$=-1,X=ce.length,se=[0],he=[0];++$<3;)I=ce[$],se.push(I[0]),he.push(I[1]);for(j.push(Pa(ls,se)+","+Pa(ls,he)),--$;++$9&&(se=3*j/Math.sqrt(se),ye[be]=se*$,ye[be+1]=se*X));for(be=-1;++be<=Ee;)se=(I[Math.min(Ee,be+1)][0]-I[Math.max(0,be-1)][0])/(6*(1+ye[be]*ye[be])),he.push([se||0,ye[be]*se||0]);return he}(ce))}});function Ss(ce){return ce.length>1?ce.join("L"):ce+"Z"}function Pi(ce){return ce.join("L")+"Z"}function no(ce){for(var I=0,j=ce.length,$=ce[0],X=[$[0],",",$[1]];++I1){ye=I[1],se=ce[be],be++,$+="C"+(X[0]+he[0])+","+(X[1]+he[1])+","+(se[0]-ye[0])+","+(se[1]-ye[1])+","+se[0]+","+se[1];for(var Ee=2;EeWt)+",1 "+Ue}function be(Ee,Ue,Xe,it){return"Q 0,0 "+it}return se.radius=function(Ee){return arguments.length?(j=bn(Ee),se):j},se.source=function(Ee){return arguments.length?(ce=bn(Ee),se):ce},se.target=function(Ee){return arguments.length?(I=bn(Ee),se):I},se.startAngle=function(Ee){return arguments.length?($=bn(Ee),se):$},se.endAngle=function(Ee){return arguments.length?(X=bn(Ee),se):X},se},r.svg.diagonal=function(){var ce=Of,I=Do,j=wi;function $(X,se){var he=ce.call(this,X,se),ye=I.call(this,X,se),be=(he.y+ye.y)/2,Ee=[he,{x:he.x,y:be},{x:ye.x,y:be},ye];return"M"+(Ee=Ee.map(j))[0]+"C"+Ee[1]+" "+Ee[2]+" "+Ee[3]}return $.source=function(X){return arguments.length?(ce=bn(X),$):ce},$.target=function(X){return arguments.length?(I=bn(X),$):I},$.projection=function(X){return arguments.length?(j=X,$):j},$},r.svg.diagonal.radial=function(){var ce=r.svg.diagonal(),I=wi,j=ce.projection;return ce.projection=function($){return arguments.length?j(Ii(I=$)):I},ce},r.svg.symbol=function(){var ce=If,I=Pf;function j($,X){return(Gs.get(ce.call(this,$,X))||nu)(I.call(this,$,X))}return j.type=function($){return arguments.length?(ce=bn($),j):ce},j.size=function($){return arguments.length?(I=bn($),j):I},j};var Gs=r.map({circle:nu,cross:function(ce){var I=Math.sqrt(ce/5)/2;return"M"+-3*I+","+-I+"H"+-I+"V"+-3*I+"H"+I+"V"+-I+"H"+3*I+"V"+I+"H"+I+"V"+3*I+"H"+-I+"V"+I+"H"+-3*I+"Z"},diamond:function(ce){var I=Math.sqrt(ce/(2*vd)),j=I*vd;return"M0,"+-I+"L"+j+",0 0,"+I+" "+-j+",0Z"},square:function(ce){var I=Math.sqrt(ce)/2;return"M"+-I+","+-I+"L"+I+","+-I+" "+I+","+I+" "+-I+","+I+"Z"},"triangle-down":function(ce){var I=Math.sqrt(ce/Al),j=I*Al/2;return"M0,"+j+"L"+I+","+-j+" "+-I+","+-j+"Z"},"triangle-up":function(ce){var I=Math.sqrt(ce/Al),j=I*Al/2;return"M0,"+-j+"L"+I+","+j+" "+-I+","+j+"Z"}});r.svg.symbolTypes=Gs.keys();var Al=Math.sqrt(3),vd=Math.tan(30*kt);ee.transition=function(ce){for(var I,j,$=Qu||++ec,X=$c(ce),se=[],he=Eu||{time:Date.now(),ease:yc,delay:0,duration:250},ye=-1,be=this.length;++ye0;)Ee[--vt].call(ce,Mt);if(_t>=1)return Xe.event&&Xe.event.end.call(ce,ce.__data__,I),--Ue.count?delete Ue[$]:delete ce[j],1}Xe||(se=X.time,he=Kn(function(Dt){var _t=Xe.delay;if(he.t=_t+se,_t<=Dt)return it(Dt-_t);he.c=it},0,se),Xe=Ue[$]={tween:new M,time:se,timer:he,delay:X.delay,duration:X.duration,ease:X.ease,index:I},X=null,++Ue.count)}Ao.call=ee.call,Ao.empty=ee.empty,Ao.node=ee.node,Ao.size=ee.size,r.transition=function(ce,I){return ce&&ce.transition?Qu?ce.transition(I):ce:r.selection().transition(ce)},r.transition.prototype=Ao,Ao.select=function(ce){var I,j,$,X=this.id,se=this.namespace,he=[];ce=ie(ce);for(var ye=-1,be=this.length;++yerect,.s>rect").attr("width",se[1]-se[0])}function xt(_t){_t.select(".extent").attr("y",he[0]),_t.selectAll(".extent,.e>rect,.w>rect").attr("height",he[1]-he[0])}function Dt(){var _t,Mt,vt=this,Nt=r.select(r.event.target),Rt=j.of(vt,arguments),Vt=r.select(vt),rn=Nt.datum(),dn=!/^(n|s)$/.test(rn)&&$,En=!/^(e|w)$/.test(rn)&&X,Tn=Nt.classed("extent"),tr=Ot(vt),er=r.mouse(vt),gr=r.select(s(vt)).on("keydown.brush",oi).on("keyup.brush",Ai);if(r.event.changedTouches?gr.on("touchmove.brush",Gn).on("touchend.brush",si):gr.on("mousemove.brush",Gn).on("mouseup.brush",si),Vt.interrupt().selectAll("*").interrupt(),Tn)er[0]=se[0]-er[0],er[1]=he[0]-er[1];else if(rn){var cr=+/w$/.test(rn),Xr=+/^n/.test(rn);Mt=[se[1-cr]-er[0],he[1-Xr]-er[1]],er[0]=se[cr],er[1]=he[Xr]}else r.event.altKey&&(_t=er.slice());function oi(){r.event.keyCode==32&&(Tn||(_t=null,er[0]-=se[1],er[1]-=he[1],Tn=2),Y())}function Ai(){r.event.keyCode==32&&Tn==2&&(er[0]+=se[1],er[1]+=he[1],Tn=0,Y())}function Gn(){var Qr=r.mouse(vt),mi=!1;Mt&&(Qr[0]+=Mt[0],Qr[1]+=Mt[1]),Tn||(r.event.altKey?(_t||(_t=[(se[0]+se[1])/2,(he[0]+he[1])/2]),er[0]=se[+(Qr[0]<_t[0])],er[1]=he[+(Qr[1]<_t[1])]):_t=null),dn&&Mr(Qr,$,0)&&(it(Vt),mi=!0),En&&Mr(Qr,X,1)&&(xt(Vt),mi=!0),mi&&(Xe(Vt),Rt({type:"brush",mode:Tn?"move":"resize"}))}function Mr(Qr,mi,Mi){var Zi,fi,zi=fr(mi),Oi=zi[0],ta=zi[1],Ni=er[Mi],na=Mi?he:se,pa=na[1]-na[0];if(Tn&&(Oi-=Ni,ta-=pa+Ni),Zi=(Mi?be:ye)?Math.max(Oi,Math.min(ta,Qr[Mi])):Qr[Mi],Tn?fi=(Zi+=Ni)+pa:(_t&&(Ni=Math.max(Oi,Math.min(ta,2*_t[Mi]-Zi))),Ni>>1;y.dtype||(y.dtype="array"),typeof y.dtype=="string"?_=new(d(y.dtype))(b):y.dtype&&(_=y.dtype,Array.isArray(_)&&(_.length=b));for(var k=0;kv||J>1073741824){for(var ne=0;nefe+_e||q>me+_e||Q=ie||ke===Le)){var de=w[Ae];Le===void 0&&(Le=de.length);for(var ve=ke;ve=J&&we<=U&&Ce>=re&&Ce<=V&&ue.push(Me)}var Fe=M[Ae],ze=Fe[4*ke+0],$e=Fe[4*ke+1],Ke=Fe[4*ke+2],Re=Fe[4*ke+3],Ve=ge(Fe,ke+1),We=.5*_e,Ye=Ae+1;le(fe,me,We,Ye,ze,$e||Ke||Re||Ve),le(fe,me+We,We,Ye,$e,Ke||Re||Ve),le(fe+We,me,We,Ye,Ke,Re||Ve),le(fe+We,me+We,We,Ye,Re,Ve)}}function ge(fe,me){for(var _e=null,Ae=0;_e===null;)if(_e=fe[4*me+Ae],++Ae>fe.length)return null;return _e}return le(0,0,1,0,0,1),ue},_;function O(B,W,G,K,te){for(var Y=[],J=0;J0){s+=Math.abs(l(i[0]));for(var u=1;u2){for(p=0;p=0))throw new Error("precision must be a positive number");var x=Math.pow(10,v||0);return Math.round(y*x)/x},f.radiansToLength=d,f.lengthToRadians=m,f.lengthToDegrees=function(y,v){return p(m(y,v))},f.bearingToAzimuth=function(y){var v=y%360;return v<0&&(v+=360),v},f.radiansToDegrees=p,f.degreesToRadians=function(y){return y%360*Math.PI/180},f.convertLength=function(y,v,x){if(v===void 0&&(v="kilometers"),x===void 0&&(x="kilometers"),!(y>=0))throw new Error("length must be a positive number");return d(m(y,v),x)},f.convertArea=function(y,v,x){if(v===void 0&&(v="meters"),x===void 0&&(x="kilometers"),!(y>=0))throw new Error("area must be a positive number");var _=f.areaFactors[v];if(!_)throw new Error("invalid original units");var A=f.areaFactors[x];if(!A)throw new Error("invalid final units");return y/_*A},f.isNumber=g,f.isObject=function(y){return!!y&&y.constructor===Object},f.validateBBox=function(y){if(!y)throw new Error("bbox is required");if(!Array.isArray(y))throw new Error("bbox must be an Array");if(y.length!==4&&y.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");y.forEach(function(v){if(!g(v))throw new Error("bbox must only contain numbers")})},f.validateId=function(y){if(!y)throw new Error("id is required");if(["string","number"].indexOf(typeof y)===-1)throw new Error("id must be a number or a string")}},{}],63:[function(t,o,f){Object.defineProperty(f,"__esModule",{value:!0});var r=t("@turf/helpers");function a(d,m,p){if(d!==null)for(var g,y,v,x,_,A,b,k,w=0,M=0,T=d.type,E=T==="FeatureCollection",S=T==="Feature",P=E?d.features.length:1,L=0;LA||E>b||S>k)return _=w,A=g,b=E,k=S,void(v=0);var P=r.lineString([_,w],p.properties);if(m(P,g,y,S,v)===!1)return!1;v++,_=w})!==!1&&void 0}}})}function h(d,m){if(!d)throw new Error("geojson is required");s(d,function(p,g,y){if(p.geometry!==null){var v=p.geometry.type,x=p.geometry.coordinates;switch(v){case"LineString":if(m(p,g,y,0,0)===!1)return!1;break;case"Polygon":for(var _=0;_i[0]&&(c[0]=i[0]),c[1]>i[1]&&(c[1]=i[1]),c[2]=0))throw new Error("precision must be a positive number");var x=Math.pow(10,v||0);return Math.round(y*x)/x},f.radiansToLength=d,f.lengthToRadians=m,f.lengthToDegrees=function(y,v){return p(m(y,v))},f.bearingToAzimuth=function(y){var v=y%360;return v<0&&(v+=360),v},f.radiansToDegrees=p,f.degreesToRadians=function(y){return y%360*Math.PI/180},f.convertLength=function(y,v,x){if(v===void 0&&(v="kilometers"),x===void 0&&(x="kilometers"),!(y>=0))throw new Error("length must be a positive number");return d(m(y,v),x)},f.convertArea=function(y,v,x){if(v===void 0&&(v="meters"),x===void 0&&(x="kilometers"),!(y>=0))throw new Error("area must be a positive number");var _=f.areaFactors[v];if(!_)throw new Error("invalid original units");var A=f.areaFactors[x];if(!A)throw new Error("invalid final units");return y/_*A},f.isNumber=g,f.isObject=function(y){return!!y&&y.constructor===Object},f.validateBBox=function(y){if(!y)throw new Error("bbox is required");if(!Array.isArray(y))throw new Error("bbox must be an Array");if(y.length!==4&&y.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");y.forEach(function(v){if(!g(v))throw new Error("bbox must only contain numbers")})},f.validateId=function(y){if(!y)throw new Error("id is required");if(["string","number"].indexOf(typeof y)===-1)throw new Error("id must be a number or a string")},f.radians2degrees=function(){throw new Error("method has been renamed to `radiansToDegrees`")},f.degrees2radians=function(){throw new Error("method has been renamed to `degreesToRadians`")},f.distanceToDegrees=function(){throw new Error("method has been renamed to `lengthToDegrees`")},f.distanceToRadians=function(){throw new Error("method has been renamed to `lengthToRadians`")},f.radiansToDistance=function(){throw new Error("method has been renamed to `radiansToLength`")},f.bearingToAngle=function(){throw new Error("method has been renamed to `bearingToAzimuth`")},f.convertDistance=function(){throw new Error("method has been renamed to `convertLength`")}},{}],69:[function(t,o,f){Object.defineProperty(f,"__esModule",{value:!0});var r=t("@turf/helpers");function a(d,m,p){if(d!==null)for(var g,y,v,x,_,A,b,k,w=0,M=0,T=d.type,E=T==="FeatureCollection",S=T==="Feature",P=E?d.features.length:1,L=0;LA||E>b||S>k)return _=w,A=g,b=E,k=S,void(v=0);var P=r.lineString([_,w],p.properties);if(m(P,g,y,S,v)===!1)return!1;v++,_=w})!==!1&&void 0}}})}function h(d,m){if(!d)throw new Error("geojson is required");s(d,function(p,g,y){if(p.geometry!==null){var v=p.geometry.type,x=p.geometry.coordinates;switch(v){case"LineString":if(m(p,g,y,0,0)===!1)return!1;break;case"Polygon":for(var _=0;_i&&(i=r[u]),r[u] - * @license MIT - */function l(E,S){if(E===S)return 0;for(var P=E.length,L=S.length,R=0,F=Math.min(P,L);R=0;K--)if(te[K]!==Y[K])return!1;for(K=te.length-1;K>=0;K--)if(G=te[K],!b(F[G],D[G],O,N))return!1;return!0}(E,S,P,L))}return P?E===S:E==S}function k(E){return Object.prototype.toString.call(E)=="[object Arguments]"}function w(E,S){if(!E||!S)return!1;if(Object.prototype.toString.call(S)=="[object RegExp]")return S.test(E);try{if(E instanceof S)return!0}catch{}return!Error.isPrototypeOf(S)&&S.call({},E)===!0}function M(E,S,P,L){var R;if(typeof S!="function")throw new TypeError('"block" argument must be a function');typeof P=="string"&&(L=P,P=null),R=function(O){var N;try{O()}catch(B){N=B}return N}(S),L=(P&&P.name?" ("+P.name+").":".")+(L?" "+L:"."),E&&!R&&_(R,P,"Missing expected exception"+L);var F=typeof L=="string",D=!E&&R&&!P;if((!E&&i.isError(R)&&F&&w(R,P)||D)&&_(R,P,"Got unwanted exception"+L),E&&R&&P&&!w(R,P)||!E&&R)throw R}p.AssertionError=function(E){this.name="AssertionError",this.actual=E.actual,this.expected=E.expected,this.operator=E.operator,E.message?(this.message=E.message,this.generatedMessage=!1):(this.message=function(O){return v(x(O.actual),128)+" "+O.operator+" "+v(x(O.expected),128)}(this),this.generatedMessage=!0);var S=E.stackStartFunction||_;if(Error.captureStackTrace)Error.captureStackTrace(this,S);else{var P=new Error;if(P.stack){var L=P.stack,R=y(S),F=L.indexOf(` -`+R);if(F>=0){var D=L.indexOf(` -`,F+1);L=L.substring(D+1)}this.stack=L}}},i.inherits(p.AssertionError,Error),p.fail=_,p.ok=A,p.equal=function(E,S,P){E!=S&&_(E,S,P,"==",p.equal)},p.notEqual=function(E,S,P){E==S&&_(E,S,P,"!=",p.notEqual)},p.deepEqual=function(E,S,P){b(E,S,!1)||_(E,S,P,"deepEqual",p.deepEqual)},p.deepStrictEqual=function(E,S,P){b(E,S,!0)||_(E,S,P,"deepStrictEqual",p.deepStrictEqual)},p.notDeepEqual=function(E,S,P){b(E,S,!1)&&_(E,S,P,"notDeepEqual",p.notDeepEqual)},p.notDeepStrictEqual=function E(S,P,L){b(S,P,!0)&&_(S,P,L,"notDeepStrictEqual",E)},p.strictEqual=function(E,S,P){E!==S&&_(E,S,P,"===",p.strictEqual)},p.notStrictEqual=function(E,S,P){E===S&&_(E,S,P,"!==",p.notStrictEqual)},p.throws=function(E,S,P){M(!0,E,S,P)},p.doesNotThrow=function(E,S,P){M(!1,E,S,P)},p.ifError=function(E){if(E)throw E},p.strict=a(function E(S,P){S||_(S,!0,P,"==",E)},p,{equal:p.strictEqual,deepEqual:p.deepStrictEqual,notEqual:p.notStrictEqual,notDeepEqual:p.notDeepStrictEqual}),p.strict.strict=p.strict;var T=Object.keys||function(E){var S=[];for(var P in E)s.call(E,P)&&S.push(P);return S}}).call(this)}).call(this,typeof jo<"u"?jo:typeof self<"u"?self:typeof window<"u"?window:{})},{"object-assign":247,"util/":78}],76:[function(t,o,f){typeof Object.create=="function"?o.exports=function(r,a){r.super_=a,r.prototype=Object.create(a.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}})}:o.exports=function(r,a){r.super_=a;var l=function(){};l.prototype=a.prototype,r.prototype=new l,r.prototype.constructor=r}},{}],77:[function(t,o,f){o.exports=function(r){return r&&typeof r=="object"&&typeof r.copy=="function"&&typeof r.fill=="function"&&typeof r.readUInt8=="function"}},{}],78:[function(t,o,f){(function(r,a){(function(){var l=/%[sdj%]/g;f.format=function(F){if(!_(F)){for(var D=[],O=0;O=B)return K;switch(K){case"%s":return String(N[O++]);case"%d":return Number(N[O++]);case"%j":try{return JSON.stringify(N[O++])}catch{return"[Circular]"}default:return K}}),G=N[O];O=3&&(O.depth=arguments[2]),arguments.length>=4&&(O.colors=arguments[3]),y(D)?O.showHidden=D:D&&f._extend(O,D),A(O.showHidden)&&(O.showHidden=!1),A(O.depth)&&(O.depth=2),A(O.colors)&&(O.colors=!1),A(O.customInspect)&&(O.customInspect=!0),O.colors&&(O.stylize=u),d(O,F,O.depth)}function u(F,D){var O=s.styles[D];return O?"\x1B["+s.colors[O][0]+"m"+F+"\x1B["+s.colors[O][1]+"m":F}function h(F,D){return F}function d(F,D,O){if(F.customInspect&&D&&T(D.inspect)&&D.inspect!==f.inspect&&(!D.constructor||D.constructor.prototype!==D)){var N=D.inspect(O,F);return _(N)||(N=d(F,N,O)),N}var B=function(U,V){if(A(V))return U.stylize("undefined","undefined");if(_(V)){var H="'"+JSON.stringify(V).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return U.stylize(H,"string")}if(x(V))return U.stylize(""+V,"number");if(y(V))return U.stylize(""+V,"boolean");if(v(V))return U.stylize("null","null")}(F,D);if(B)return B;var W=Object.keys(D),G=function(U){var V={};return U.forEach(function(H,ne){V[H]=!0}),V}(W);if(F.showHidden&&(W=Object.getOwnPropertyNames(D)),M(D)&&(W.indexOf("message")>=0||W.indexOf("description")>=0))return m(D);if(W.length===0){if(T(D)){var K=D.name?": "+D.name:"";return F.stylize("[Function"+K+"]","special")}if(b(D))return F.stylize(RegExp.prototype.toString.call(D),"regexp");if(w(D))return F.stylize(Date.prototype.toString.call(D),"date");if(M(D))return m(D)}var te,Y="",J=!1,re=["{","}"];return g(D)&&(J=!0,re=["[","]"]),T(D)&&(Y=" [Function"+(D.name?": "+D.name:"")+"]"),b(D)&&(Y=" "+RegExp.prototype.toString.call(D)),w(D)&&(Y=" "+Date.prototype.toUTCString.call(D)),M(D)&&(Y=" "+m(D)),W.length!==0||J&&D.length!=0?O<0?b(D)?F.stylize(RegExp.prototype.toString.call(D),"regexp"):F.stylize("[Object]","special"):(F.seen.push(D),te=J?function(U,V,H,ne,q){for(var Q=[],ee=0,ie=V.length;ee=0,ne+q.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?H[0]+(V===""?"":V+` - `)+" "+U.join(`, - `)+" "+H[1]:H[0]+V+" "+U.join(", ")+" "+H[1]}(te,Y,re)):re[0]+Y+re[1]}function m(F){return"["+Error.prototype.toString.call(F)+"]"}function p(F,D,O,N,B,W){var G,K,te;if((te=Object.getOwnPropertyDescriptor(D,B)||{value:D[B]}).get?K=te.set?F.stylize("[Getter/Setter]","special"):F.stylize("[Getter]","special"):te.set&&(K=F.stylize("[Setter]","special")),R(N,B)||(G="["+B+"]"),K||(F.seen.indexOf(te.value)<0?(K=v(O)?d(F,te.value,null):d(F,te.value,O-1)).indexOf(` -`)>-1&&(K=W?K.split(` -`).map(function(Y){return" "+Y}).join(` -`).substr(2):` -`+K.split(` -`).map(function(Y){return" "+Y}).join(` -`)):K=F.stylize("[Circular]","special")),A(G)){if(W&&B.match(/^\d+$/))return K;(G=JSON.stringify(""+B)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(G=G.substr(1,G.length-2),G=F.stylize(G,"name")):(G=G.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),G=F.stylize(G,"string"))}return G+": "+K}function g(F){return Array.isArray(F)}function y(F){return typeof F=="boolean"}function v(F){return F===null}function x(F){return typeof F=="number"}function _(F){return typeof F=="string"}function A(F){return F===void 0}function b(F){return k(F)&&E(F)==="[object RegExp]"}function k(F){return typeof F=="object"&&F!==null}function w(F){return k(F)&&E(F)==="[object Date]"}function M(F){return k(F)&&(E(F)==="[object Error]"||F instanceof Error)}function T(F){return typeof F=="function"}function E(F){return Object.prototype.toString.call(F)}function S(F){return F<10?"0"+F.toString(10):F.toString(10)}f.debuglog=function(F){if(A(c)&&(c=r.env.NODE_DEBUG||""),F=F.toUpperCase(),!i[F])if(new RegExp("\\b"+F+"\\b","i").test(c)){var D=r.pid;i[F]=function(){var O=f.format.apply(f,arguments);console.error("%s %d: %s",F,D,O)}}else i[F]=function(){};return i[F]},f.inspect=s,s.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},s.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},f.isArray=g,f.isBoolean=y,f.isNull=v,f.isNullOrUndefined=function(F){return F==null},f.isNumber=x,f.isString=_,f.isSymbol=function(F){return typeof F=="symbol"},f.isUndefined=A,f.isRegExp=b,f.isObject=k,f.isDate=w,f.isError=M,f.isFunction=T,f.isPrimitive=function(F){return F===null||typeof F=="boolean"||typeof F=="number"||typeof F=="string"||typeof F=="symbol"||F===void 0},f.isBuffer=t("./support/isBuffer");var P=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function L(){var F=new Date,D=[S(F.getHours()),S(F.getMinutes()),S(F.getSeconds())].join(":");return[F.getDate(),P[F.getMonth()],D].join(" ")}function R(F,D){return Object.prototype.hasOwnProperty.call(F,D)}f.log=function(){console.log("%s - %s",L(),f.format.apply(f,arguments))},f.inherits=t("inherits"),f._extend=function(F,D){if(!D||!k(D))return F;for(var O=Object.keys(D),N=O.length;N--;)F[O[N]]=D[O[N]];return F}}).call(this)}).call(this,t("_process"),typeof jo<"u"?jo:typeof self<"u"?self:typeof window<"u"?window:{})},{"./support/isBuffer":77,_process:277,inherits:76}],79:[function(t,o,f){f.byteLength=function(d){var m=u(d),p=m[0],g=m[1];return 3*(p+g)/4-g},f.toByteArray=function(d){var m,p,g=u(d),y=g[0],v=g[1],x=new l(function(b,k,w){return 3*(k+w)/4-w}(0,y,v)),_=0,A=v>0?y-4:y;for(p=0;p>16&255,x[_++]=m>>8&255,x[_++]=255&m;return v===2&&(m=a[d.charCodeAt(p)]<<2|a[d.charCodeAt(p+1)]>>4,x[_++]=255&m),v===1&&(m=a[d.charCodeAt(p)]<<10|a[d.charCodeAt(p+1)]<<4|a[d.charCodeAt(p+2)]>>2,x[_++]=m>>8&255,x[_++]=255&m),x},f.fromByteArray=function(d){for(var m,p=d.length,g=p%3,y=[],v=0,x=p-g;vx?x:v+16383));return g===1?(m=d[p-1],y.push(r[m>>2]+r[m<<4&63]+"==")):g===2&&(m=(d[p-2]<<8)+d[p-1],y.push(r[m>>10]+r[m>>4&63]+r[m<<2&63]+"=")),y.join("")};for(var r=[],a=[],l=typeof Uint8Array<"u"?Uint8Array:Array,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,s=c.length;i0)throw new Error("Invalid string. Length must be a multiple of 4");var p=d.indexOf("=");return p===-1&&(p=m),[p,p===m?0:4-p%4]}function h(d,m,p){for(var g,y,v=[],x=m;x>18&63]+r[y>>12&63]+r[y>>6&63]+r[63&y]);return v.join("")}a["-".charCodeAt(0)]=62,a["_".charCodeAt(0)]=63},{}],80:[function(t,o,f){function r(u,h,d,m,p){for(var g=p+1;m<=p;){var y=m+p>>>1,v=u[y];(d!==void 0?d(v,h):v-h)>=0?(g=y,p=y-1):m=y+1}return g}function a(u,h,d,m,p){for(var g=p+1;m<=p;){var y=m+p>>>1,v=u[y];(d!==void 0?d(v,h):v-h)>0?(g=y,p=y-1):m=y+1}return g}function l(u,h,d,m,p){for(var g=m-1;m<=p;){var y=m+p>>>1,v=u[y];(d!==void 0?d(v,h):v-h)<0?(g=y,m=y+1):p=y-1}return g}function c(u,h,d,m,p){for(var g=m-1;m<=p;){var y=m+p>>>1,v=u[y];(d!==void 0?d(v,h):v-h)<=0?(g=y,m=y+1):p=y-1}return g}function i(u,h,d,m,p){for(;m<=p;){var g=m+p>>>1,y=u[g],v=d!==void 0?d(y,h):y-h;if(v===0)return g;v<=0?m=g+1:p=g-1}return-1}function s(u,h,d,m,p,g){return typeof d=="function"?g(u,h,d,m===void 0?0:0|m,p===void 0?u.length-1:0|p):g(u,h,void 0,d===void 0?0:0|d,m===void 0?u.length-1:0|m)}o.exports={ge:function(u,h,d,m,p){return s(u,h,d,m,p,r)},gt:function(u,h,d,m,p){return s(u,h,d,m,p,a)},lt:function(u,h,d,m,p){return s(u,h,d,m,p,l)},le:function(u,h,d,m,p){return s(u,h,d,m,p,c)},eq:function(u,h,d,m,p){return s(u,h,d,m,p,i)}}},{}],81:[function(t,o,f){function r(l){var c=32;return(l&=-l)&&c--,65535&l&&(c-=16),16711935&l&&(c-=8),252645135&l&&(c-=4),858993459&l&&(c-=2),1431655765&l&&(c-=1),c}f.INT_BITS=32,f.INT_MAX=2147483647,f.INT_MIN=-1<<31,f.sign=function(l){return(l>0)-(l<0)},f.abs=function(l){var c=l>>31;return(l^c)-c},f.min=function(l,c){return c^(l^c)&-(l65535)<<4,c|=i=((l>>>=c)>255)<<3,c|=i=((l>>>=i)>15)<<2,(c|=i=((l>>>=i)>3)<<1)|(l>>>=i)>>1},f.log10=function(l){return l>=1e9?9:l>=1e8?8:l>=1e7?7:l>=1e6?6:l>=1e5?5:l>=1e4?4:l>=1e3?3:l>=100?2:l>=10?1:0},f.popCount=function(l){return 16843009*((l=(858993459&(l-=l>>>1&1431655765))+(l>>>2&858993459))+(l>>>4)&252645135)>>>24},f.countTrailingZeros=r,f.nextPow2=function(l){return l+=l===0,--l,l|=l>>>1,l|=l>>>2,l|=l>>>4,l|=l>>>8,(l|=l>>>16)+1},f.prevPow2=function(l){return l|=l>>>1,l|=l>>>2,l|=l>>>4,l|=l>>>8,(l|=l>>>16)-(l>>>1)},f.parity=function(l){return l^=l>>>16,l^=l>>>8,l^=l>>>4,27030>>>(l&=15)&1};var a=new Array(256);(function(l){for(var c=0;c<256;++c){var i=c,s=c,u=7;for(i>>>=1;i;i>>>=1)s<<=1,s|=1&i,--u;l[c]=s<>>8&255]<<16|a[l>>>16&255]<<8|a[l>>>24&255]},f.interleave2=function(l,c){return(l=1431655765&((l=858993459&((l=252645135&((l=16711935&((l&=65535)|l<<8))|l<<4))|l<<2))|l<<1))|(c=1431655765&((c=858993459&((c=252645135&((c=16711935&((c&=65535)|c<<8))|c<<4))|c<<2))|c<<1))<<1},f.deinterleave2=function(l,c){return(l=65535&((l=16711935&((l=252645135&((l=858993459&((l=l>>>c&1431655765)|l>>>1))|l>>>2))|l>>>4))|l>>>16))<<16>>16},f.interleave3=function(l,c,i){return l=1227133513&((l=3272356035&((l=251719695&((l=4278190335&((l&=1023)|l<<16))|l<<8))|l<<4))|l<<2),(l|=(c=1227133513&((c=3272356035&((c=251719695&((c=4278190335&((c&=1023)|c<<16))|c<<8))|c<<4))|c<<2))<<1)|(i=1227133513&((i=3272356035&((i=251719695&((i=4278190335&((i&=1023)|i<<16))|i<<8))|i<<4))|i<<2))<<2},f.deinterleave3=function(l,c){return(l=1023&((l=4278190335&((l=251719695&((l=3272356035&((l=l>>>c&1227133513)|l>>>2))|l>>>4))|l>>>8))|l>>>16))<<22>>22},f.nextCombination=function(l){var c=l|l-1;return c+1|(~c&-~c)-1>>>r(l)+1}},{}],82:[function(t,o,f){var r=t("clamp");o.exports=function(i,s){s||(s={});var u,h,d,m,p,g,y,v,x,_,A,b=s.cutoff==null?.25:s.cutoff,k=s.radius==null?8:s.radius,w=s.channel||0;if(ArrayBuffer.isView(i)||Array.isArray(i)){if(!s.width||!s.height)throw Error("For raw data width and height should be provided by options");u=s.width,h=s.height,m=i,g=s.stride?s.stride:Math.floor(i.length/u/h)}else window.HTMLCanvasElement&&i instanceof window.HTMLCanvasElement?(y=(v=i).getContext("2d"),u=v.width,h=v.height,x=y.getImageData(0,0,u,h),m=x.data,g=4):window.CanvasRenderingContext2D&&i instanceof window.CanvasRenderingContext2D?(v=i.canvas,y=i,u=v.width,h=v.height,x=y.getImageData(0,0,u,h),m=x.data,g=4):window.ImageData&&i instanceof window.ImageData&&(x=i,u=i.width,h=i.height,m=x.data,g=4);if(d=Math.max(u,h),window.Uint8ClampedArray&&m instanceof window.Uint8ClampedArray||window.Uint8Array&&m instanceof window.Uint8Array)for(p=m,m=Array(u*h),_=0,A=p.length;_0&&M.length>k&&!M.warned){M.warned=!0;var E=new Error("Possible EventEmitter memory leak detected. "+M.length+" "+String(_)+" listeners added. Use emitter.setMaxListeners() to increase limit");E.name="MaxListenersExceededWarning",E.emitter=x,E.type=_,E.count=M.length,T=E,console&&console.warn&&console.warn(T)}return x}function m(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(x,_,A){var b={fired:!1,wrapFn:void 0,target:x,type:_,listener:A},k=m.bind(b);return k.listener=A,b.wrapFn=k,k}function g(x,_,A){var b=x._events;if(b===void 0)return[];var k=b[_];return k===void 0?[]:typeof k=="function"?A?[k.listener||k]:[k]:A?function(w){for(var M=new Array(w.length),T=0;T0&&(w=_[0]),w instanceof Error)throw w;var M=new Error("Unhandled error."+(w?" ("+w.message+")":""));throw M.context=w,M}var T=k[x];if(T===void 0)return!1;if(typeof T=="function")l(T,this,_);else{var E=T.length,S=v(T,E);for(A=0;A=0;w--)if(A[w]===_||A[w].listener===_){M=A[w].listener,k=w;break}if(k<0)return this;k===0?A.shift():function(T,E){for(;E+1=0;b--)this.removeListener(x,_[b]);return this},i.prototype.listeners=function(x){return g(this,x,!0)},i.prototype.rawListeners=function(x){return g(this,x,!1)},i.listenerCount=function(x,_){return typeof x.listenerCount=="function"?x.listenerCount(_):y.call(x,_)},i.prototype.listenerCount=y,i.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},{}],85:[function(t,o,f){(function(r){(function(){var a=t("base64-js"),l=t("ieee754");f.Buffer=i,f.SlowBuffer=function(U){return+U!=U&&(U=0),i.alloc(+U)},f.INSPECT_MAX_BYTES=50;function c(U){if(U>2147483647)throw new RangeError('The value "'+U+'" is invalid for option "size"');var V=new Uint8Array(U);return V.__proto__=i.prototype,V}function i(U,V,H){if(typeof U=="number"){if(typeof V=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return h(U)}return s(U,V,H)}function s(U,V,H){if(typeof U=="string")return function(Q,ee){if(typeof ee=="string"&&ee!==""||(ee="utf8"),!i.isEncoding(ee))throw new TypeError("Unknown encoding: "+ee);var ie=0|p(Q,ee),ae=c(ie),ue=ae.write(Q,ee);return ue!==ie&&(ae=ae.slice(0,ue)),ae}(U,V);if(ArrayBuffer.isView(U))return d(U);if(U==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof U);if(J(U,ArrayBuffer)||U&&J(U.buffer,ArrayBuffer))return function(Q,ee,ie){if(ee<0||Q.byteLength=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647 .toString(16)+" bytes");return 0|U}function p(U,V){if(i.isBuffer(U))return U.length;if(ArrayBuffer.isView(U)||J(U,ArrayBuffer))return U.byteLength;if(typeof U!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof U);var H=U.length,ne=arguments.length>2&&arguments[2]===!0;if(!ne&&H===0)return 0;for(var q=!1;;)switch(V){case"ascii":case"latin1":case"binary":return H;case"utf8":case"utf-8":return K(U).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*H;case"hex":return H>>>1;case"base64":return te(U).length;default:if(q)return ne?-1:K(U).length;V=(""+V).toLowerCase(),q=!0}}function g(U,V,H){var ne=!1;if((V===void 0||V<0)&&(V=0),V>this.length||((H===void 0||H>this.length)&&(H=this.length),H<=0)||(H>>>=0)<=(V>>>=0))return"";for(U||(U="utf8");;)switch(U){case"hex":return L(this,V,H);case"utf8":case"utf-8":return E(this,V,H);case"ascii":return S(this,V,H);case"latin1":case"binary":return P(this,V,H);case"base64":return T(this,V,H);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,V,H);default:if(ne)throw new TypeError("Unknown encoding: "+U);U=(U+"").toLowerCase(),ne=!0}}function y(U,V,H){var ne=U[V];U[V]=U[H],U[H]=ne}function v(U,V,H,ne,q){if(U.length===0)return-1;if(typeof H=="string"?(ne=H,H=0):H>2147483647?H=2147483647:H<-2147483648&&(H=-2147483648),re(H=+H)&&(H=q?0:U.length-1),H<0&&(H=U.length+H),H>=U.length){if(q)return-1;H=U.length-1}else if(H<0){if(!q)return-1;H=0}if(typeof V=="string"&&(V=i.from(V,ne)),i.isBuffer(V))return V.length===0?-1:x(U,V,H,ne,q);if(typeof V=="number")return V&=255,typeof Uint8Array.prototype.indexOf=="function"?q?Uint8Array.prototype.indexOf.call(U,V,H):Uint8Array.prototype.lastIndexOf.call(U,V,H):x(U,[V],H,ne,q);throw new TypeError("val must be string, number or Buffer")}function x(U,V,H,ne,q){var Q,ee=1,ie=U.length,ae=V.length;if(ne!==void 0&&((ne=String(ne).toLowerCase())==="ucs2"||ne==="ucs-2"||ne==="utf16le"||ne==="utf-16le")){if(U.length<2||V.length<2)return-1;ee=2,ie/=2,ae/=2,H/=2}function ue(me,_e){return ee===1?me[_e]:me.readUInt16BE(_e*ee)}if(q){var le=-1;for(Q=H;Qie&&(H=ie-ae),Q=H;Q>=0;Q--){for(var ge=!0,fe=0;feq&&(ne=q):ne=q;var Q=V.length;ne>Q/2&&(ne=Q/2);for(var ee=0;ee>8,ae=ee%256,ue.push(ae),ue.push(ie);return ue}(V,U.length-H),U,H,ne)}function T(U,V,H){return V===0&&H===U.length?a.fromByteArray(U):a.fromByteArray(U.slice(V,H))}function E(U,V,H){H=Math.min(U.length,H);for(var ne=[],q=V;q239?4:ue>223?3:ue>191?2:1;if(q+ge<=H)switch(ge){case 1:ue<128&&(le=ue);break;case 2:(192&(Q=U[q+1]))==128&&(ae=(31&ue)<<6|63&Q)>127&&(le=ae);break;case 3:Q=U[q+1],ee=U[q+2],(192&Q)==128&&(192&ee)==128&&(ae=(15&ue)<<12|(63&Q)<<6|63&ee)>2047&&(ae<55296||ae>57343)&&(le=ae);break;case 4:Q=U[q+1],ee=U[q+2],ie=U[q+3],(192&Q)==128&&(192&ee)==128&&(192&ie)==128&&(ae=(15&ue)<<18|(63&Q)<<12|(63&ee)<<6|63&ie)>65535&&ae<1114112&&(le=ae)}le===null?(le=65533,ge=1):le>65535&&(le-=65536,ne.push(le>>>10&1023|55296),le=56320|1023&le),ne.push(le),q+=ge}return function(fe){var me=fe.length;if(me<=4096)return String.fromCharCode.apply(String,fe);for(var _e="",Ae=0;Ae"u"||typeof console.error!="function"||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(i.prototype,"parent",{enumerable:!0,get:function(){if(i.isBuffer(this))return this.buffer}}),Object.defineProperty(i.prototype,"offset",{enumerable:!0,get:function(){if(i.isBuffer(this))return this.byteOffset}}),typeof Symbol<"u"&&Symbol.species!=null&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),i.poolSize=8192,i.from=function(U,V,H){return s(U,V,H)},i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,i.alloc=function(U,V,H){return function(ne,q,Q){return u(ne),ne<=0?c(ne):q!==void 0?typeof Q=="string"?c(ne).fill(q,Q):c(ne).fill(q):c(ne)}(U,V,H)},i.allocUnsafe=function(U){return h(U)},i.allocUnsafeSlow=function(U){return h(U)},i.isBuffer=function(U){return U!=null&&U._isBuffer===!0&&U!==i.prototype},i.compare=function(U,V){if(J(U,Uint8Array)&&(U=i.from(U,U.offset,U.byteLength)),J(V,Uint8Array)&&(V=i.from(V,V.offset,V.byteLength)),!i.isBuffer(U)||!i.isBuffer(V))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(U===V)return 0;for(var H=U.length,ne=V.length,q=0,Q=Math.min(H,ne);qV&&(U+=" ... "),""},i.prototype.compare=function(U,V,H,ne,q){if(J(U,Uint8Array)&&(U=i.from(U,U.offset,U.byteLength)),!i.isBuffer(U))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof U);if(V===void 0&&(V=0),H===void 0&&(H=U?U.length:0),ne===void 0&&(ne=0),q===void 0&&(q=this.length),V<0||H>U.length||ne<0||q>this.length)throw new RangeError("out of range index");if(ne>=q&&V>=H)return 0;if(ne>=q)return-1;if(V>=H)return 1;if(this===U)return 0;for(var Q=(q>>>=0)-(ne>>>=0),ee=(H>>>=0)-(V>>>=0),ie=Math.min(Q,ee),ae=this.slice(ne,q),ue=U.slice(V,H),le=0;le>>=0,isFinite(H)?(H>>>=0,ne===void 0&&(ne="utf8")):(ne=H,H=void 0)}var q=this.length-V;if((H===void 0||H>q)&&(H=q),U.length>0&&(H<0||V<0)||V>this.length)throw new RangeError("Attempt to write outside buffer bounds");ne||(ne="utf8");for(var Q=!1;;)switch(ne){case"hex":return _(this,U,V,H);case"utf8":case"utf-8":return A(this,U,V,H);case"ascii":return b(this,U,V,H);case"latin1":case"binary":return k(this,U,V,H);case"base64":return w(this,U,V,H);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,U,V,H);default:if(Q)throw new TypeError("Unknown encoding: "+ne);ne=(""+ne).toLowerCase(),Q=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function S(U,V,H){var ne="";H=Math.min(U.length,H);for(var q=V;qne)&&(H=ne);for(var q="",Q=V;QH)throw new RangeError("Trying to access beyond buffer length")}function D(U,V,H,ne,q,Q){if(!i.isBuffer(U))throw new TypeError('"buffer" argument must be a Buffer instance');if(V>q||VU.length)throw new RangeError("Index out of range")}function O(U,V,H,ne,q,Q){if(H+ne>U.length)throw new RangeError("Index out of range");if(H<0)throw new RangeError("Index out of range")}function N(U,V,H,ne,q){return V=+V,H>>>=0,q||O(U,0,H,4),l.write(U,V,H,ne,23,4),H+4}function B(U,V,H,ne,q){return V=+V,H>>>=0,q||O(U,0,H,8),l.write(U,V,H,ne,52,8),H+8}i.prototype.slice=function(U,V){var H=this.length;(U=~~U)<0?(U+=H)<0&&(U=0):U>H&&(U=H),(V=V===void 0?H:~~V)<0?(V+=H)<0&&(V=0):V>H&&(V=H),V>>=0,V>>>=0,H||F(U,V,this.length);for(var ne=this[U],q=1,Q=0;++Q>>=0,V>>>=0,H||F(U,V,this.length);for(var ne=this[U+--V],q=1;V>0&&(q*=256);)ne+=this[U+--V]*q;return ne},i.prototype.readUInt8=function(U,V){return U>>>=0,V||F(U,1,this.length),this[U]},i.prototype.readUInt16LE=function(U,V){return U>>>=0,V||F(U,2,this.length),this[U]|this[U+1]<<8},i.prototype.readUInt16BE=function(U,V){return U>>>=0,V||F(U,2,this.length),this[U]<<8|this[U+1]},i.prototype.readUInt32LE=function(U,V){return U>>>=0,V||F(U,4,this.length),(this[U]|this[U+1]<<8|this[U+2]<<16)+16777216*this[U+3]},i.prototype.readUInt32BE=function(U,V){return U>>>=0,V||F(U,4,this.length),16777216*this[U]+(this[U+1]<<16|this[U+2]<<8|this[U+3])},i.prototype.readIntLE=function(U,V,H){U>>>=0,V>>>=0,H||F(U,V,this.length);for(var ne=this[U],q=1,Q=0;++Q=(q*=128)&&(ne-=Math.pow(2,8*V)),ne},i.prototype.readIntBE=function(U,V,H){U>>>=0,V>>>=0,H||F(U,V,this.length);for(var ne=V,q=1,Q=this[U+--ne];ne>0&&(q*=256);)Q+=this[U+--ne]*q;return Q>=(q*=128)&&(Q-=Math.pow(2,8*V)),Q},i.prototype.readInt8=function(U,V){return U>>>=0,V||F(U,1,this.length),128&this[U]?-1*(255-this[U]+1):this[U]},i.prototype.readInt16LE=function(U,V){U>>>=0,V||F(U,2,this.length);var H=this[U]|this[U+1]<<8;return 32768&H?4294901760|H:H},i.prototype.readInt16BE=function(U,V){U>>>=0,V||F(U,2,this.length);var H=this[U+1]|this[U]<<8;return 32768&H?4294901760|H:H},i.prototype.readInt32LE=function(U,V){return U>>>=0,V||F(U,4,this.length),this[U]|this[U+1]<<8|this[U+2]<<16|this[U+3]<<24},i.prototype.readInt32BE=function(U,V){return U>>>=0,V||F(U,4,this.length),this[U]<<24|this[U+1]<<16|this[U+2]<<8|this[U+3]},i.prototype.readFloatLE=function(U,V){return U>>>=0,V||F(U,4,this.length),l.read(this,U,!0,23,4)},i.prototype.readFloatBE=function(U,V){return U>>>=0,V||F(U,4,this.length),l.read(this,U,!1,23,4)},i.prototype.readDoubleLE=function(U,V){return U>>>=0,V||F(U,8,this.length),l.read(this,U,!0,52,8)},i.prototype.readDoubleBE=function(U,V){return U>>>=0,V||F(U,8,this.length),l.read(this,U,!1,52,8)},i.prototype.writeUIntLE=function(U,V,H,ne){U=+U,V>>>=0,H>>>=0,ne||D(this,U,V,H,Math.pow(2,8*H)-1,0);var q=1,Q=0;for(this[V]=255&U;++Q>>=0,H>>>=0,ne||D(this,U,V,H,Math.pow(2,8*H)-1,0);var q=H-1,Q=1;for(this[V+q]=255&U;--q>=0&&(Q*=256);)this[V+q]=U/Q&255;return V+H},i.prototype.writeUInt8=function(U,V,H){return U=+U,V>>>=0,H||D(this,U,V,1,255,0),this[V]=255&U,V+1},i.prototype.writeUInt16LE=function(U,V,H){return U=+U,V>>>=0,H||D(this,U,V,2,65535,0),this[V]=255&U,this[V+1]=U>>>8,V+2},i.prototype.writeUInt16BE=function(U,V,H){return U=+U,V>>>=0,H||D(this,U,V,2,65535,0),this[V]=U>>>8,this[V+1]=255&U,V+2},i.prototype.writeUInt32LE=function(U,V,H){return U=+U,V>>>=0,H||D(this,U,V,4,4294967295,0),this[V+3]=U>>>24,this[V+2]=U>>>16,this[V+1]=U>>>8,this[V]=255&U,V+4},i.prototype.writeUInt32BE=function(U,V,H){return U=+U,V>>>=0,H||D(this,U,V,4,4294967295,0),this[V]=U>>>24,this[V+1]=U>>>16,this[V+2]=U>>>8,this[V+3]=255&U,V+4},i.prototype.writeIntLE=function(U,V,H,ne){if(U=+U,V>>>=0,!ne){var q=Math.pow(2,8*H-1);D(this,U,V,H,q-1,-q)}var Q=0,ee=1,ie=0;for(this[V]=255&U;++Q>0)-ie&255;return V+H},i.prototype.writeIntBE=function(U,V,H,ne){if(U=+U,V>>>=0,!ne){var q=Math.pow(2,8*H-1);D(this,U,V,H,q-1,-q)}var Q=H-1,ee=1,ie=0;for(this[V+Q]=255&U;--Q>=0&&(ee*=256);)U<0&&ie===0&&this[V+Q+1]!==0&&(ie=1),this[V+Q]=(U/ee>>0)-ie&255;return V+H},i.prototype.writeInt8=function(U,V,H){return U=+U,V>>>=0,H||D(this,U,V,1,127,-128),U<0&&(U=255+U+1),this[V]=255&U,V+1},i.prototype.writeInt16LE=function(U,V,H){return U=+U,V>>>=0,H||D(this,U,V,2,32767,-32768),this[V]=255&U,this[V+1]=U>>>8,V+2},i.prototype.writeInt16BE=function(U,V,H){return U=+U,V>>>=0,H||D(this,U,V,2,32767,-32768),this[V]=U>>>8,this[V+1]=255&U,V+2},i.prototype.writeInt32LE=function(U,V,H){return U=+U,V>>>=0,H||D(this,U,V,4,2147483647,-2147483648),this[V]=255&U,this[V+1]=U>>>8,this[V+2]=U>>>16,this[V+3]=U>>>24,V+4},i.prototype.writeInt32BE=function(U,V,H){return U=+U,V>>>=0,H||D(this,U,V,4,2147483647,-2147483648),U<0&&(U=4294967295+U+1),this[V]=U>>>24,this[V+1]=U>>>16,this[V+2]=U>>>8,this[V+3]=255&U,V+4},i.prototype.writeFloatLE=function(U,V,H){return N(this,U,V,!0,H)},i.prototype.writeFloatBE=function(U,V,H){return N(this,U,V,!1,H)},i.prototype.writeDoubleLE=function(U,V,H){return B(this,U,V,!0,H)},i.prototype.writeDoubleBE=function(U,V,H){return B(this,U,V,!1,H)},i.prototype.copy=function(U,V,H,ne){if(!i.isBuffer(U))throw new TypeError("argument should be a Buffer");if(H||(H=0),ne||ne===0||(ne=this.length),V>=U.length&&(V=U.length),V||(V=0),ne>0&&ne=this.length)throw new RangeError("Index out of range");if(ne<0)throw new RangeError("sourceEnd out of bounds");ne>this.length&&(ne=this.length),U.length-V=0;--Q)U[Q+V]=this[Q+H];else Uint8Array.prototype.set.call(U,this.subarray(H,ne),V);return q},i.prototype.fill=function(U,V,H,ne){if(typeof U=="string"){if(typeof V=="string"?(ne=V,V=0,H=this.length):typeof H=="string"&&(ne=H,H=this.length),ne!==void 0&&typeof ne!="string")throw new TypeError("encoding must be a string");if(typeof ne=="string"&&!i.isEncoding(ne))throw new TypeError("Unknown encoding: "+ne);if(U.length===1){var q=U.charCodeAt(0);(ne==="utf8"&&q<128||ne==="latin1")&&(U=q)}}else typeof U=="number"&&(U&=255);if(V<0||this.length>>=0,H=H===void 0?this.length:H>>>0,U||(U=0),typeof U=="number")for(Q=V;Q55295&&H<57344){if(!q){if(H>56319){(V-=3)>-1&&Q.push(239,191,189);continue}if(ee+1===ne){(V-=3)>-1&&Q.push(239,191,189);continue}q=H;continue}if(H<56320){(V-=3)>-1&&Q.push(239,191,189),q=H;continue}H=65536+(q-55296<<10|H-56320)}else q&&(V-=3)>-1&&Q.push(239,191,189);if(q=null,H<128){if((V-=1)<0)break;Q.push(H)}else if(H<2048){if((V-=2)<0)break;Q.push(H>>6|192,63&H|128)}else if(H<65536){if((V-=3)<0)break;Q.push(H>>12|224,H>>6&63|128,63&H|128)}else{if(!(H<1114112))throw new Error("Invalid code point");if((V-=4)<0)break;Q.push(H>>18|240,H>>12&63|128,H>>6&63|128,63&H|128)}}return Q}function te(U){return a.toByteArray(function(V){if((V=(V=V.split("=")[0]).trim().replace(W,"")).length<2)return"";for(;V.length%4!=0;)V+="=";return V}(U))}function Y(U,V,H,ne){for(var q=0;q=V.length||q>=U.length);++q)V[q+H]=U[q];return q}function J(U,V){return U instanceof V||U!=null&&U.constructor!=null&&U.constructor.name!=null&&U.constructor.name===V.name}function re(U){return U!=U}}).call(this)}).call(this,t("buffer").Buffer)},{"base64-js":79,buffer:85,ieee754:230}],86:[function(t,o,f){o.exports=function(r,a,l){return al?l:r:ra?a:r}},{}],87:[function(t,o,f){var r=t("clamp");function a(l,c){c==null&&(c=!0);var i=l[0],s=l[1],u=l[2],h=l[3];return h==null&&(h=c?1:255),c&&(i*=255,s*=255,u*=255,h*=255),16777216*(i=255&r(i,0,255))+((s=255&r(s,0,255))<<16)+((u=255&r(u,0,255))<<8)+(h=255&r(h,0,255))}o.exports=a,o.exports.to=a,o.exports.from=function(l,c){var i=(l=+l)>>>24,s=(16711680&l)>>>16,u=(65280&l)>>>8,h=255&l;return c===!1?[i,s,u,h]:[i/255,s/255,u/255,h/255]}},{clamp:86}],88:[function(t,o,f){o.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},{}],89:[function(t,o,f){var r=t("color-rgba"),a=t("clamp"),l=t("dtype");o.exports=function(c,i){i!=="float"&&i||(i="array"),i==="uint"&&(i="uint8"),i==="uint_clamped"&&(i="uint8_clamped");var s=new(l(i))(4),u=i!=="uint8"&&i!=="uint8_clamped";return c.length&&typeof c!="string"||((c=r(c))[0]/=255,c[1]/=255,c[2]/=255),function(h){return h instanceof Uint8Array||h instanceof Uint8ClampedArray||!!(Array.isArray(h)&&(h[0]>1||h[0]===0)&&(h[1]>1||h[1]===0)&&(h[2]>1||h[2]===0)&&(!h[3]||h[3]>1))}(c)?(s[0]=c[0],s[1]=c[1],s[2]=c[2],s[3]=c[3]!=null?c[3]:255,u&&(s[0]/=255,s[1]/=255,s[2]/=255,s[3]/=255),s):(u?(s[0]=c[0],s[1]=c[1],s[2]=c[2],s[3]=c[3]!=null?c[3]:1):(s[0]=a(Math.floor(255*c[0]),0,255),s[1]=a(Math.floor(255*c[1]),0,255),s[2]=a(Math.floor(255*c[2]),0,255),s[3]=c[3]==null?255:a(Math.floor(255*c[3]),0,255)),s)}},{clamp:86,"color-rgba":91,dtype:127}],90:[function(t,o,f){(function(r){(function(){var a=t("color-name"),l=t("is-plain-obj"),c=t("defined");o.exports=function(s){var u,h,d=[],m=1;if(typeof s=="string")if(a[s])d=a[s].slice(),h="rgb";else if(s==="transparent")m=0,h="rgb",d=[0,0,0];else if(/^#[A-Fa-f0-9]+$/.test(s)){var p=(v=s.slice(1)).length;m=1,p<=4?(d=[parseInt(v[0]+v[0],16),parseInt(v[1]+v[1],16),parseInt(v[2]+v[2],16)],p===4&&(m=parseInt(v[3]+v[3],16)/255)):(d=[parseInt(v[0]+v[1],16),parseInt(v[2]+v[3],16),parseInt(v[4]+v[5],16)],p===8&&(m=parseInt(v[6]+v[7],16)/255)),d[0]||(d[0]=0),d[1]||(d[1]=0),d[2]||(d[2]=0),h="rgb"}else if(u=/^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\s*\(([^\)]*)\)/.exec(s)){var g=u[1],y=g==="rgb",v=g.replace(/a$/,"");h=v,p=v==="cmyk"?4:v==="gray"?1:3,d=u[2].trim().split(/\s*,\s*/).map(function(_,A){if(/%$/.test(_))return A===p?parseFloat(_)/100:v==="rgb"?255*parseFloat(_)/100:parseFloat(_);if(v[A]==="h"){if(/deg$/.test(_))return parseFloat(_);if(i[_]!==void 0)return i[_]}return parseFloat(_)}),g===v&&d.push(1),m=y||d[p]===void 0?1:d[p],d=d.slice(0,p)}else s.length>10&&/[0-9](?:\s|\/)/.test(s)&&(d=s.match(/([0-9]+)/g).map(function(_){return parseFloat(_)}),h=s.match(/([a-z])/gi).join("").toLowerCase());else if(isNaN(s))if(l(s)){var x=c(s.r,s.red,s.R,null);x!==null?(h="rgb",d=[x,c(s.g,s.green,s.G),c(s.b,s.blue,s.B)]):(h="hsl",d=[c(s.h,s.hue,s.H),c(s.s,s.saturation,s.S),c(s.l,s.lightness,s.L,s.b,s.brightness)]),m=c(s.a,s.alpha,s.opacity,1),s.opacity!=null&&(m/=100)}else(Array.isArray(s)||r.ArrayBuffer&&ArrayBuffer.isView&&ArrayBuffer.isView(s))&&(d=[s[0],s[1],s[2]],h="rgb",m=s.length===4?s[3]:1);else h="rgb",d=[s>>>16,(65280&s)>>>8,255&s];return{space:h,values:d,alpha:m}};var i={red:0,orange:60,yellow:120,green:180,blue:240,purple:300}}).call(this)}).call(this,typeof jo<"u"?jo:typeof self<"u"?self:typeof window<"u"?window:{})},{"color-name":88,defined:124,"is-plain-obj":236}],91:[function(t,o,f){var r=t("color-parse"),a=t("color-space/hsl"),l=t("clamp");o.exports=function(c){var i,s=r(c);return s.space?((i=Array(3))[0]=l(s.values[0],0,255),i[1]=l(s.values[1],0,255),i[2]=l(s.values[2],0,255),s.space[0]==="h"&&(i=a.rgb(i)),i.push(l(s.alpha,0,1)),i):[]}},{clamp:86,"color-parse":90,"color-space/hsl":92}],92:[function(t,o,f){var r=t("./rgb");o.exports={name:"hsl",min:[0,0,0],max:[360,100,100],channel:["hue","saturation","lightness"],alias:["HSL"],rgb:function(a){var l,c,i,s,u,h=a[0]/360,d=a[1]/100,m=a[2]/100;if(d===0)return[u=255*m,u,u];l=2*m-(c=m<.5?m*(1+d):m+d-m*d),s=[0,0,0];for(var p=0;p<3;p++)(i=h+1/3*-(p-1))<0?i++:i>1&&i--,u=6*i<1?l+6*(c-l)*i:2*i<1?c:3*i<2?l+(c-l)*(2/3-i)*6:l,s[p]=255*u;return s}},r.hsl=function(a){var l,c,i=a[0]/255,s=a[1]/255,u=a[2]/255,h=Math.min(i,s,u),d=Math.max(i,s,u),m=d-h;return d===h?l=0:i===d?l=(s-u)/m:s===d?l=2+(u-i)/m:u===d&&(l=4+(i-s)/m),(l=Math.min(60*l,360))<0&&(l+=360),c=(h+d)/2,[l,100*(d===h?0:c<=.5?m/(d+h):m/(2-d-h)),100*c]}},{"./rgb":93}],93:[function(t,o,f){o.exports={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]}},{}],94:[function(t,o,f){o.exports={AFG:"afghan",ALA:"\\b\\wland",ALB:"albania",DZA:"algeria",ASM:"^(?=.*americ).*samoa",AND:"andorra",AGO:"angola",AIA:"anguill?a",ATA:"antarctica",ATG:"antigua",ARG:"argentin",ARM:"armenia",ABW:"^(?!.*bonaire).*\\baruba",AUS:"australia",AUT:"^(?!.*hungary).*austria|\\baustri.*\\bemp",AZE:"azerbaijan",BHS:"bahamas",BHR:"bahrain",BGD:"bangladesh|^(?=.*east).*paki?stan",BRB:"barbados",BLR:"belarus|byelo",BEL:"^(?!.*luxem).*belgium",BLZ:"belize|^(?=.*british).*honduras",BEN:"benin|dahome",BMU:"bermuda",BTN:"bhutan",BOL:"bolivia",BES:"^(?=.*bonaire).*eustatius|^(?=.*carib).*netherlands|\\bbes.?islands",BIH:"herzegovina|bosnia",BWA:"botswana|bechuana",BVT:"bouvet",BRA:"brazil",IOT:"british.?indian.?ocean",BRN:"brunei",BGR:"bulgaria",BFA:"burkina|\\bfaso|upper.?volta",BDI:"burundi",CPV:"verde",KHM:"cambodia|kampuchea|khmer",CMR:"cameroon",CAN:"canada",CYM:"cayman",CAF:"\\bcentral.african.republic",TCD:"\\bchad",CHL:"\\bchile",CHN:"^(?!.*\\bmac)(?!.*\\bhong)(?!.*\\btai)(?!.*\\brep).*china|^(?=.*peo)(?=.*rep).*china",CXR:"christmas",CCK:"\\bcocos|keeling",COL:"colombia",COM:"comoro",COG:"^(?!.*\\bdem)(?!.*\\bd[\\.]?r)(?!.*kinshasa)(?!.*zaire)(?!.*belg)(?!.*l.opoldville)(?!.*free).*\\bcongo",COK:"\\bcook",CRI:"costa.?rica",CIV:"ivoire|ivory",HRV:"croatia",CUB:"\\bcuba",CUW:"^(?!.*bonaire).*\\bcura(c|ç)ao",CYP:"cyprus",CSK:"czechoslovakia",CZE:"^(?=.*rep).*czech|czechia|bohemia",COD:"\\bdem.*congo|congo.*\\bdem|congo.*\\bd[\\.]?r|\\bd[\\.]?r.*congo|belgian.?congo|congo.?free.?state|kinshasa|zaire|l.opoldville|drc|droc|rdc",DNK:"denmark",DJI:"djibouti",DMA:"dominica(?!n)",DOM:"dominican.rep",ECU:"ecuador",EGY:"egypt",SLV:"el.?salvador",GNQ:"guine.*eq|eq.*guine|^(?=.*span).*guinea",ERI:"eritrea",EST:"estonia",ETH:"ethiopia|abyssinia",FLK:"falkland|malvinas",FRO:"faroe|faeroe",FJI:"fiji",FIN:"finland",FRA:"^(?!.*\\bdep)(?!.*martinique).*france|french.?republic|\\bgaul",GUF:"^(?=.*french).*guiana",PYF:"french.?polynesia|tahiti",ATF:"french.?southern",GAB:"gabon",GMB:"gambia",GEO:"^(?!.*south).*georgia",DDR:"german.?democratic.?republic|democratic.?republic.*germany|east.germany",DEU:"^(?!.*east).*germany|^(?=.*\\bfed.*\\brep).*german",GHA:"ghana|gold.?coast",GIB:"gibraltar",GRC:"greece|hellenic|hellas",GRL:"greenland",GRD:"grenada",GLP:"guadeloupe",GUM:"\\bguam",GTM:"guatemala",GGY:"guernsey",GIN:"^(?!.*eq)(?!.*span)(?!.*bissau)(?!.*portu)(?!.*new).*guinea",GNB:"bissau|^(?=.*portu).*guinea",GUY:"guyana|british.?guiana",HTI:"haiti",HMD:"heard.*mcdonald",VAT:"holy.?see|vatican|papal.?st",HND:"^(?!.*brit).*honduras",HKG:"hong.?kong",HUN:"^(?!.*austr).*hungary",ISL:"iceland",IND:"india(?!.*ocea)",IDN:"indonesia",IRN:"\\biran|persia",IRQ:"\\biraq|mesopotamia",IRL:"(^ireland)|(^republic.*ireland)",IMN:"^(?=.*isle).*\\bman",ISR:"israel",ITA:"italy",JAM:"jamaica",JPN:"japan",JEY:"jersey",JOR:"jordan",KAZ:"kazak",KEN:"kenya|british.?east.?africa|east.?africa.?prot",KIR:"kiribati",PRK:"^(?=.*democrat|people|north|d.*p.*.r).*\\bkorea|dprk|korea.*(d.*p.*r)",KWT:"kuwait",KGZ:"kyrgyz|kirghiz",LAO:"\\blaos?\\b",LVA:"latvia",LBN:"lebanon",LSO:"lesotho|basuto",LBR:"liberia",LBY:"libya",LIE:"liechtenstein",LTU:"lithuania",LUX:"^(?!.*belg).*luxem",MAC:"maca(o|u)",MDG:"madagascar|malagasy",MWI:"malawi|nyasa",MYS:"malaysia",MDV:"maldive",MLI:"\\bmali\\b",MLT:"\\bmalta",MHL:"marshall",MTQ:"martinique",MRT:"mauritania",MUS:"mauritius",MYT:"\\bmayotte",MEX:"\\bmexic",FSM:"fed.*micronesia|micronesia.*fed",MCO:"monaco",MNG:"mongolia",MNE:"^(?!.*serbia).*montenegro",MSR:"montserrat",MAR:"morocco|\\bmaroc",MOZ:"mozambique",MMR:"myanmar|burma",NAM:"namibia",NRU:"nauru",NPL:"nepal",NLD:"^(?!.*\\bant)(?!.*\\bcarib).*netherlands",ANT:"^(?=.*\\bant).*(nether|dutch)",NCL:"new.?caledonia",NZL:"new.?zealand",NIC:"nicaragua",NER:"\\bniger(?!ia)",NGA:"nigeria",NIU:"niue",NFK:"norfolk",MNP:"mariana",NOR:"norway",OMN:"\\boman|trucial",PAK:"^(?!.*east).*paki?stan",PLW:"palau",PSE:"palestin|\\bgaza|west.?bank",PAN:"panama",PNG:"papua|new.?guinea",PRY:"paraguay",PER:"peru",PHL:"philippines",PCN:"pitcairn",POL:"poland",PRT:"portugal",PRI:"puerto.?rico",QAT:"qatar",KOR:"^(?!.*d.*p.*r)(?!.*democrat)(?!.*people)(?!.*north).*\\bkorea(?!.*d.*p.*r)",MDA:"moldov|b(a|e)ssarabia",REU:"r(e|é)union",ROU:"r(o|u|ou)mania",RUS:"\\brussia|soviet.?union|u\\.?s\\.?s\\.?r|socialist.?republics",RWA:"rwanda",BLM:"barth(e|é)lemy",SHN:"helena",KNA:"kitts|\\bnevis",LCA:"\\blucia",MAF:"^(?=.*collectivity).*martin|^(?=.*france).*martin(?!ique)|^(?=.*french).*martin(?!ique)",SPM:"miquelon",VCT:"vincent",WSM:"^(?!.*amer).*samoa",SMR:"san.?marino",STP:"\\bs(a|ã)o.?tom(e|é)",SAU:"\\bsa\\w*.?arabia",SEN:"senegal",SRB:"^(?!.*monte).*serbia",SYC:"seychell",SLE:"sierra",SGP:"singapore",SXM:"^(?!.*martin)(?!.*saba).*maarten",SVK:"^(?!.*cze).*slovak",SVN:"slovenia",SLB:"solomon",SOM:"somali",ZAF:"south.africa|s\\\\..?africa",SGS:"south.?georgia|sandwich",SSD:"\\bs\\w*.?sudan",ESP:"spain",LKA:"sri.?lanka|ceylon",SDN:"^(?!.*\\bs(?!u)).*sudan",SUR:"surinam|dutch.?guiana",SJM:"svalbard",SWZ:"swaziland",SWE:"sweden",CHE:"switz|swiss",SYR:"syria",TWN:"taiwan|taipei|formosa|^(?!.*peo)(?=.*rep).*china",TJK:"tajik",THA:"thailand|\\bsiam",MKD:"macedonia|fyrom",TLS:"^(?=.*leste).*timor|^(?=.*east).*timor",TGO:"togo",TKL:"tokelau",TON:"tonga",TTO:"trinidad|tobago",TUN:"tunisia",TUR:"turkey",TKM:"turkmen",TCA:"turks",TUV:"tuvalu",UGA:"uganda",UKR:"ukrain",ARE:"emirates|^u\\.?a\\.?e\\.?$|united.?arab.?em",GBR:"united.?kingdom|britain|^u\\.?k\\.?$",TZA:"tanzania",USA:"united.?states\\b(?!.*islands)|\\bu\\.?s\\.?a\\.?\\b|^\\s*u\\.?s\\.?\\b(?!.*islands)",UMI:"minor.?outlying.?is",URY:"uruguay",UZB:"uzbek",VUT:"vanuatu|new.?hebrides",VEN:"venezuela",VNM:"^(?!.*republic).*viet.?nam|^(?=.*socialist).*viet.?nam",VGB:"^(?=.*\\bu\\.?\\s?k).*virgin|^(?=.*brit).*virgin|^(?=.*kingdom).*virgin",VIR:"^(?=.*\\bu\\.?\\s?s).*virgin|^(?=.*states).*virgin",WLF:"futuna|wallis",ESH:"western.sahara",YEM:"^(?!.*arab)(?!.*north)(?!.*sana)(?!.*peo)(?!.*dem)(?!.*south)(?!.*aden)(?!.*\\bp\\.?d\\.?r).*yemen",YMD:"^(?=.*peo).*yemen|^(?!.*rep)(?=.*dem).*yemen|^(?=.*south).*yemen|^(?=.*aden).*yemen|^(?=.*\\bp\\.?d\\.?r).*yemen",YUG:"yugoslavia",ZMB:"zambia|northern.?rhodesia",EAZ:"zanzibar",ZWE:"zimbabwe|^(?!.*northern).*rhodesia"}},{}],95:[function(t,o,f){o.exports=["xx-small","x-small","small","medium","large","x-large","xx-large","larger","smaller"]},{}],96:[function(t,o,f){o.exports=["normal","condensed","semi-condensed","extra-condensed","ultra-condensed","expanded","semi-expanded","extra-expanded","ultra-expanded"]},{}],97:[function(t,o,f){o.exports=["normal","italic","oblique"]},{}],98:[function(t,o,f){o.exports=["normal","bold","bolder","lighter","100","200","300","400","500","600","700","800","900"]},{}],99:[function(t,o,f){o.exports={parse:t("./parse"),stringify:t("./stringify")}},{"./parse":101,"./stringify":102}],100:[function(t,o,f){var r=t("css-font-size-keywords");o.exports={isSize:function(a){return/^[\d\.]/.test(a)||a.indexOf("/")!==-1||r.indexOf(a)!==-1}}},{"css-font-size-keywords":95}],101:[function(t,o,f){var r=t("unquote"),a=t("css-global-keywords"),l=t("css-system-font-keywords"),c=t("css-font-weight-keywords"),i=t("css-font-style-keywords"),s=t("css-font-stretch-keywords"),u=t("string-split-by"),h=t("./lib/util").isSize;o.exports=m;var d=m.cache={};function m(g){if(typeof g!="string")throw new Error("Font argument must be a string.");if(d[g])return d[g];if(g==="")throw new Error("Cannot parse an empty string.");if(l.indexOf(g)!==-1)return d[g]={system:g};for(var y,v={style:"normal",variant:"normal",weight:"normal",stretch:"normal",lineHeight:"normal",size:"1rem",family:["serif"]},x=u(g,/\s+/);y=x.shift();){if(a.indexOf(y)!==-1)return["style","variant","weight","stretch"].forEach(function(A){v[A]=y}),d[g]=v;if(i.indexOf(y)===-1)if(y!=="normal"&&y!=="small-caps")if(s.indexOf(y)===-1){if(c.indexOf(y)===-1){if(h(y)){var _=u(y,"/");if(v.size=_[0],_[1]!=null?v.lineHeight=p(_[1]):x[0]==="/"&&(x.shift(),v.lineHeight=p(x.shift())),!x.length)throw new Error("Missing required font-family.");return v.family=u(x.join(" "),/\s*,\s*/).map(r),d[g]=v}throw new Error("Unknown or unsupported font token: "+y)}v.weight=y}else v.stretch=y;else v.variant=y;else v.style=y}throw new Error("Missing required font-size.")}function p(g){var y=parseFloat(g);return y.toString()===g?y:g}},{"./lib/util":100,"css-font-stretch-keywords":96,"css-font-style-keywords":97,"css-font-weight-keywords":98,"css-global-keywords":103,"css-system-font-keywords":104,"string-split-by":305,unquote:328}],102:[function(t,o,f){var r=t("pick-by-alias"),a=t("./lib/util").isSize,l=y(t("css-global-keywords")),c=y(t("css-system-font-keywords")),i=y(t("css-font-weight-keywords")),s=y(t("css-font-style-keywords")),u=y(t("css-font-stretch-keywords")),h={normal:1,"small-caps":1},d={serif:1,"sans-serif":1,monospace:1,cursive:1,fantasy:1,"system-ui":1},m="1rem",p="serif";function g(v,x){if(v&&!x[v]&&!l[v])throw Error("Unknown keyword `"+v+"`");return v}function y(v){for(var x={},_=0;_D?1:F>=D?0:NaN}function l(F){var D;return F.length===1&&(D=F,F=function(O,N){return a(D(O),N)}),{left:function(O,N,B,W){for(B==null&&(B=0),W==null&&(W=O.length);B>>1;F(O[G],N)<0?B=G+1:W=G}return B},right:function(O,N,B,W){for(B==null&&(B=0),W==null&&(W=O.length);B>>1;F(O[G],N)>0?W=G:B=G+1}return B}}}var c=l(a),i=c.right,s=c.left;function u(F,D){return[F,D]}function h(F){return F===null?NaN:+F}function d(F,D){var O,N,B=F.length,W=0,G=-1,K=0,te=0;if(D==null)for(;++G1)return te/(W-1)}function m(F,D){var O=d(F,D);return O&&Math.sqrt(O)}function p(F,D){var O,N,B,W=F.length,G=-1;if(D==null){for(;++G=O)for(N=B=O;++GO&&(N=O),B=O)for(N=B=O;++GO&&(N=O),B=0?(W>=b?10:W>=k?5:W>=w?2:1)*Math.pow(10,B):-Math.pow(10,-B)/(W>=b?10:W>=k?5:W>=w?2:1)}function T(F,D,O){var N=Math.abs(D-F)/Math.max(0,O),B=Math.pow(10,Math.floor(Math.log(N)/Math.LN10)),W=N/B;return W>=b?B*=10:W>=k?B*=5:W>=w&&(B*=2),D=1)return+O(F[N-1],N-1,F);var N,B=(N-1)*D,W=Math.floor(B),G=+O(F[W],W,F);return G+(+O(F[W+1],W+1,F)-G)*(B-W)}}function P(F,D){var O,N,B=F.length,W=-1;if(D==null){for(;++W=O)for(N=O;++WO&&(N=O)}else for(;++W=O)for(N=O;++WO&&(N=O);return N}function L(F){if(!(B=F.length))return[];for(var D=-1,O=P(F,R),N=new Array(O);++DF?1:D>=F?0:NaN},r.deviation=m,r.extent=p,r.histogram=function(){var F=_,D=p,O=E;function N(B){var W,G,K=B.length,te=new Array(K);for(W=0;Wre;)U.pop(),--V;var H,ne=new Array(V+1);for(W=0;W<=V;++W)(H=ne[W]=[]).x0=W>0?U[W-1]:J,H.x1=W=O)for(N=O;++WN&&(N=O)}else for(;++W=O)for(N=O;++WN&&(N=O);return N},r.mean=function(F,D){var O,N=F.length,B=N,W=-1,G=0;if(D==null)for(;++W=0;)for(D=(N=F[B]).length;--D>=0;)O[--G]=N[D];return O},r.min=P,r.pairs=function(F,D){D==null&&(D=u);for(var O=0,N=F.length-1,B=F[0],W=new Array(N<0?0:N);O0)return[F];if((N=D0)for(F=Math.ceil(F/G),D=Math.floor(D/G),W=new Array(B=Math.ceil(D-F+1));++K=v.length)return p!=null&&A.sort(p),g!=null?g(A):A;for(var M,T,E,S=-1,P=A.length,L=v[b++],R=l(),F=k();++Sv.length)return k;var M,T=x[w-1];return g!=null&&w>=v.length?M=k.entries():(M=[],k.each(function(E,S){M.push({key:S,values:b(E,w)})})),T!=null?M.sort(function(E,S){return T(E.key,S.key)}):M}(_(A,0,s,u),0)},key:function(A){return v.push(A),y},sortKeys:function(A){return x[v.length-1]=A,y},sortValues:function(A){return p=A,y},rollup:function(A){return g=A,y}}},r.set=m,r.map=l,r.keys=function(p){var g=[];for(var y in p)g.push(y);return g},r.values=function(p){var g=[];for(var y in p)g.push(p[y]);return g},r.entries=function(p){var g=[];for(var y in p)g.push({key:y,value:p[y]});return g},Object.defineProperty(r,"__esModule",{value:!0})})},{}],109:[function(t,o,f){(function(r,a){a(typeof f=="object"&&o!==void 0?f:(r=r||self).d3=r.d3||{})})(this,function(r){function a(de,ve,Me){de.prototype=ve.prototype=Me,Me.constructor=de}function l(de,ve){var Me=Object.create(de.prototype);for(var we in ve)Me[we]=ve[we];return Me}function c(){}var i="\\s*([+-]?\\d+)\\s*",s="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",u="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",h=/^#([0-9a-f]{3,8})$/,d=new RegExp("^rgb\\("+[i,i,i]+"\\)$"),m=new RegExp("^rgb\\("+[u,u,u]+"\\)$"),p=new RegExp("^rgba\\("+[i,i,i,s]+"\\)$"),g=new RegExp("^rgba\\("+[u,u,u,s]+"\\)$"),y=new RegExp("^hsl\\("+[s,u,u]+"\\)$"),v=new RegExp("^hsla\\("+[s,u,u,s]+"\\)$"),x={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function _(){return this.rgb().formatHex()}function A(){return this.rgb().formatRgb()}function b(de){var ve,Me;return de=(de+"").trim().toLowerCase(),(ve=h.exec(de))?(Me=ve[1].length,ve=parseInt(ve[1],16),Me===6?k(ve):Me===3?new E(ve>>8&15|ve>>4&240,ve>>4&15|240&ve,(15&ve)<<4|15&ve,1):Me===8?w(ve>>24&255,ve>>16&255,ve>>8&255,(255&ve)/255):Me===4?w(ve>>12&15|ve>>8&240,ve>>8&15|ve>>4&240,ve>>4&15|240&ve,((15&ve)<<4|15&ve)/255):null):(ve=d.exec(de))?new E(ve[1],ve[2],ve[3],1):(ve=m.exec(de))?new E(255*ve[1]/100,255*ve[2]/100,255*ve[3]/100,1):(ve=p.exec(de))?w(ve[1],ve[2],ve[3],ve[4]):(ve=g.exec(de))?w(255*ve[1]/100,255*ve[2]/100,255*ve[3]/100,ve[4]):(ve=y.exec(de))?R(ve[1],ve[2]/100,ve[3]/100,1):(ve=v.exec(de))?R(ve[1],ve[2]/100,ve[3]/100,ve[4]):x.hasOwnProperty(de)?k(x[de]):de==="transparent"?new E(NaN,NaN,NaN,0):null}function k(de){return new E(de>>16&255,de>>8&255,255&de,1)}function w(de,ve,Me,we){return we<=0&&(de=ve=Me=NaN),new E(de,ve,Me,we)}function M(de){return de instanceof c||(de=b(de)),de?new E((de=de.rgb()).r,de.g,de.b,de.opacity):new E}function T(de,ve,Me,we){return arguments.length===1?M(de):new E(de,ve,Me,we??1)}function E(de,ve,Me,we){this.r=+de,this.g=+ve,this.b=+Me,this.opacity=+we}function S(){return"#"+L(this.r)+L(this.g)+L(this.b)}function P(){var de=this.opacity;return((de=isNaN(de)?1:Math.max(0,Math.min(1,de)))===1?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(de===1?")":", "+de+")")}function L(de){return((de=Math.max(0,Math.min(255,Math.round(de)||0)))<16?"0":"")+de.toString(16)}function R(de,ve,Me,we){return we<=0?de=ve=Me=NaN:Me<=0||Me>=1?de=ve=NaN:ve<=0&&(de=NaN),new O(de,ve,Me,we)}function F(de){if(de instanceof O)return new O(de.h,de.s,de.l,de.opacity);if(de instanceof c||(de=b(de)),!de)return new O;if(de instanceof O)return de;var ve=(de=de.rgb()).r/255,Me=de.g/255,we=de.b/255,Ce=Math.min(ve,Me,we),Fe=Math.max(ve,Me,we),ze=NaN,$e=Fe-Ce,Ke=(Fe+Ce)/2;return $e?(ze=ve===Fe?(Me-we)/$e+6*(Me0&&Ke<1?0:ze,new O(ze,$e,Ke,de.opacity)}function D(de,ve,Me,we){return arguments.length===1?F(de):new O(de,ve,Me,we??1)}function O(de,ve,Me,we){this.h=+de,this.s=+ve,this.l=+Me,this.opacity=+we}function N(de,ve,Me){return 255*(de<60?ve+(Me-ve)*de/60:de<180?Me:de<240?ve+(Me-ve)*(240-de)/60:ve)}a(c,b,{copy:function(de){return Object.assign(new this.constructor,this,de)},displayable:function(){return this.rgb().displayable()},hex:_,formatHex:_,formatHsl:function(){return F(this).formatHsl()},formatRgb:A,toString:A}),a(E,T,l(c,{brighter:function(de){return de=de==null?1/.7:Math.pow(1/.7,de),new E(this.r*de,this.g*de,this.b*de,this.opacity)},darker:function(de){return de=de==null?.7:Math.pow(.7,de),new E(this.r*de,this.g*de,this.b*de,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:S,formatHex:S,formatRgb:P,toString:P})),a(O,D,l(c,{brighter:function(de){return de=de==null?1/.7:Math.pow(1/.7,de),new O(this.h,this.s,this.l*de,this.opacity)},darker:function(de){return de=de==null?.7:Math.pow(.7,de),new O(this.h,this.s,this.l*de,this.opacity)},rgb:function(){var de=this.h%360+360*(this.h<0),ve=isNaN(de)||isNaN(this.s)?0:this.s,Me=this.l,we=Me+(Me<.5?Me:1-Me)*ve,Ce=2*Me-we;return new E(N(de>=240?de-240:de+120,Ce,we),N(de,Ce,we),N(de<120?de+240:de-120,Ce,we),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var de=this.opacity;return((de=isNaN(de)?1:Math.max(0,Math.min(1,de)))===1?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(de===1?")":", "+de+")")}}));var B=Math.PI/180,W=180/Math.PI,G=6/29,K=3*G*G;function te(de){if(de instanceof J)return new J(de.l,de.a,de.b,de.opacity);if(de instanceof Q)return ee(de);de instanceof E||(de=M(de));var ve,Me,we=H(de.r),Ce=H(de.g),Fe=H(de.b),ze=re((.2225045*we+.7168786*Ce+.0606169*Fe)/1);return we===Ce&&Ce===Fe?ve=Me=ze:(ve=re((.4360747*we+.3850649*Ce+.1430804*Fe)/.96422),Me=re((.0139322*we+.0971045*Ce+.7141733*Fe)/.82521)),new J(116*ze-16,500*(ve-ze),200*(ze-Me),de.opacity)}function Y(de,ve,Me,we){return arguments.length===1?te(de):new J(de,ve,Me,we??1)}function J(de,ve,Me,we){this.l=+de,this.a=+ve,this.b=+Me,this.opacity=+we}function re(de){return de>.008856451679035631?Math.pow(de,1/3):de/K+4/29}function U(de){return de>G?de*de*de:K*(de-4/29)}function V(de){return 255*(de<=.0031308?12.92*de:1.055*Math.pow(de,1/2.4)-.055)}function H(de){return(de/=255)<=.04045?de/12.92:Math.pow((de+.055)/1.055,2.4)}function ne(de){if(de instanceof Q)return new Q(de.h,de.c,de.l,de.opacity);if(de instanceof J||(de=te(de)),de.a===0&&de.b===0)return new Q(NaN,0=0&&(p=m.slice(g+1),m=m.slice(0,g)),m&&!d.hasOwnProperty(m))throw new Error("unknown type: "+m);return{type:m,name:p}})}function s(h,d){for(var m,p=0,g=h.length;p0)for(var m,p,g=new Array(m),y=0;yL+U||teR+U||YP.index){var V=L-J.x-J.vx,H=R-J.y-J.vy,ne=V*V+H*H;neE.r&&(E.r=E[S].r)}function T(){if(_){var E,S,P=_.length;for(A=new Array(P),E=0;E=M)){(R.data!==_||R.next)&&(N===0&&(G+=(N=u())*N),B===0&&(G+=(B=u())*B),G1?(O==null?T.remove(D):T.set(D,F(O)),_):T.get(D)},find:function(D,O,N){var B,W,G,K,te,Y=0,J=x.length;for(N==null?N=1/0:N*=N,Y=0;Y1?(S.on(D,O),_):S.on(D)}}},r.forceX=function(x){var _,A,b,k=s(.1);function w(T){for(var E,S=0,P=_.length;S1?k[0]+k.slice(2):k,+_.slice(b+1)]}function l(_){return(_=a(Math.abs(_)))?_[1]:NaN}var c,i=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function s(_){if(!(A=i.exec(_)))throw new Error("invalid format: "+_);var A;return new u({fill:A[1],align:A[2],sign:A[3],symbol:A[4],zero:A[5],width:A[6],comma:A[7],precision:A[8]&&A[8].slice(1),trim:A[9],type:A[10]})}function u(_){this.fill=_.fill===void 0?" ":_.fill+"",this.align=_.align===void 0?">":_.align+"",this.sign=_.sign===void 0?"-":_.sign+"",this.symbol=_.symbol===void 0?"":_.symbol+"",this.zero=!!_.zero,this.width=_.width===void 0?void 0:+_.width,this.comma=!!_.comma,this.precision=_.precision===void 0?void 0:+_.precision,this.trim=!!_.trim,this.type=_.type===void 0?"":_.type+""}function h(_,A){var b=a(_,A);if(!b)return _+"";var k=b[0],w=b[1];return w<0?"0."+new Array(-w).join("0")+k:k.length>w+1?k.slice(0,w+1)+"."+k.slice(w+1):k+new Array(w-k.length+2).join("0")}s.prototype=u.prototype,u.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,0|this.width))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var d={"%":function(_,A){return(100*_).toFixed(A)},b:function(_){return Math.round(_).toString(2)},c:function(_){return _+""},d:function(_){return Math.abs(_=Math.round(_))>=1e21?_.toLocaleString("en").replace(/,/g,""):_.toString(10)},e:function(_,A){return _.toExponential(A)},f:function(_,A){return _.toFixed(A)},g:function(_,A){return _.toPrecision(A)},o:function(_){return Math.round(_).toString(8)},p:function(_,A){return h(100*_,A)},r:h,s:function(_,A){var b=a(_,A);if(!b)return _+"";var k=b[0],w=b[1],M=w-(c=3*Math.max(-8,Math.min(8,Math.floor(w/3))))+1,T=k.length;return M===T?k:M>T?k+new Array(M-T+1).join("0"):M>0?k.slice(0,M)+"."+k.slice(M):"0."+new Array(1-M).join("0")+a(_,Math.max(0,A+M-1))[0]},X:function(_){return Math.round(_).toString(16).toUpperCase()},x:function(_){return Math.round(_).toString(16)}};function m(_){return _}var p,g=Array.prototype.map,y=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function v(_){var A,b,k=_.grouping===void 0||_.thousands===void 0?m:(A=g.call(_.grouping,Number),b=_.thousands+"",function(F,D){for(var O=F.length,N=[],B=0,W=A[0],G=0;O>0&&W>0&&(G+W+1>D&&(W=Math.max(1,D-G)),N.push(F.substring(O-=W,O+W)),!((G+=W+1)>D));)W=A[B=(B+1)%A.length];return N.reverse().join(b)}),w=_.currency===void 0?"":_.currency[0]+"",M=_.currency===void 0?"":_.currency[1]+"",T=_.decimal===void 0?".":_.decimal+"",E=_.numerals===void 0?m:function(F){return function(D){return D.replace(/[0-9]/g,function(O){return F[+O]})}}(g.call(_.numerals,String)),S=_.percent===void 0?"%":_.percent+"",P=_.minus===void 0?"-":_.minus+"",L=_.nan===void 0?"NaN":_.nan+"";function R(F){var D=(F=s(F)).fill,O=F.align,N=F.sign,B=F.symbol,W=F.zero,G=F.width,K=F.comma,te=F.precision,Y=F.trim,J=F.type;J==="n"?(K=!0,J="g"):d[J]||(te===void 0&&(te=12),Y=!0,J="g"),(W||D==="0"&&O==="=")&&(W=!0,D="0",O="=");var re=B==="$"?w:B==="#"&&/[boxX]/.test(J)?"0"+J.toLowerCase():"",U=B==="$"?M:/[%p]/.test(J)?S:"",V=d[J],H=/[defgprs%]/.test(J);function ne(q){var Q,ee,ie,ae=re,ue=U;if(J==="c")ue=V(q)+ue,q="";else{var le=(q=+q)<0||1/q<0;if(q=isNaN(q)?L:V(Math.abs(q),te),Y&&(q=function(me){e:for(var _e,Ae=me.length,ke=1,Le=-1;ke0&&(Le=0)}return Le>0?me.slice(0,Le)+me.slice(_e+1):me}(q)),le&&+q==0&&N!=="+"&&(le=!1),ae=(le?N==="("?N:P:N==="-"||N==="("?"":N)+ae,ue=(J==="s"?y[8+c/3]:"")+ue+(le&&N==="("?")":""),H){for(Q=-1,ee=q.length;++Q(ie=q.charCodeAt(Q))||ie>57){ue=(ie===46?T+q.slice(Q+1):q.slice(Q))+ue,q=q.slice(0,Q);break}}}K&&!W&&(q=k(q,1/0));var ge=ae.length+q.length+ue.length,fe=ge>1)+ae+q+ue+fe.slice(ge);break;default:q=fe+ae+q+ue}return E(q)}return te=te===void 0?6:/[gprs]/.test(J)?Math.max(1,Math.min(21,te)):Math.max(0,Math.min(20,te)),ne.toString=function(){return F+""},ne}return{format:R,formatPrefix:function(F,D){var O=R(((F=s(F)).type="f",F)),N=3*Math.max(-8,Math.min(8,Math.floor(l(D)/3))),B=Math.pow(10,-N),W=y[8+N/3];return function(G){return O(B*G)+W}}}}function x(_){return p=v(_),r.format=p.format,r.formatPrefix=p.formatPrefix,p}x({decimal:".",thousands:",",grouping:[3],currency:["$",""],minus:"-"}),r.FormatSpecifier=u,r.formatDefaultLocale=x,r.formatLocale=v,r.formatSpecifier=s,r.precisionFixed=function(_){return Math.max(0,-l(Math.abs(_)))},r.precisionPrefix=function(_,A){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(l(A)/3)))-l(Math.abs(_)))},r.precisionRound=function(_,A){return _=Math.abs(_),A=Math.abs(A)-_,Math.max(0,l(A)-l(_))+1},Object.defineProperty(r,"__esModule",{value:!0})})},{}],113:[function(t,o,f){(function(r,a){typeof f=="object"&&o!==void 0?a(f,t("d3-geo"),t("d3-array")):a(r.d3=r.d3||{},r.d3,r.d3)})(this,function(r,a,l){var c=Math.abs,i=Math.atan,s=Math.atan2,u=Math.cos,h=Math.exp,d=Math.floor,m=Math.log,p=Math.max,g=Math.min,y=Math.pow,v=Math.round,x=Math.sign||function(je){return je>0?1:je<0?-1:0},_=Math.sin,A=Math.tan,b=1e-6,k=Math.PI,w=k/2,M=k/4,T=Math.SQRT1_2,E=O(2),S=O(k),P=2*k,L=180/k,R=k/180;function F(je){return je>1?w:je<-1?-w:Math.asin(je)}function D(je){return je>1?0:je<-1?k:Math.acos(je)}function O(je){return je>0?Math.sqrt(je):0}function N(je){return(h(je)-h(-je))/2}function B(je){return(h(je)+h(-je))/2}function W(je){var He=A(je/2),Qe=2*m(u(je/2))/(He*He);function ut(mt,pt){var Ct=u(mt),Qt=u(pt),en=_(pt),Yt=Qt*Ct,an=-((1-Yt?m((1+Yt)/2)/(1-Yt):-.5)+Qe/(1+Yt));return[an*Qt*_(mt),an*en]}return ut.invert=function(mt,pt){var Ct,Qt=O(mt*mt+pt*pt),en=-je/2,Yt=50;if(!Qt)return[0,0];do{var an=en/2,hn=u(an),xn=_(an),_n=xn/hn,On=-m(c(hn));en-=Ct=(2/_n*On-Qe*_n-Qt)/(-On/(xn*xn)+1-Qe/(2*hn*hn))*(hn<0?.7:1)}while(c(Ct)>b&&--Yt>0);var sr=_(en);return[s(mt*sr,Qt*u(en)),F(pt*sr/Qt)]},ut}function G(je,He){var Qe=u(He),ut=function(mt){return mt?mt/Math.sin(mt):1}(D(Qe*u(je/=2)));return[2*Qe*_(je)*ut,_(He)*ut]}function K(je){var He=_(je),Qe=u(je),ut=je>=0?1:-1,mt=A(ut*je),pt=(1+He-Qe)/2;function Ct(Qt,en){var Yt=u(en),an=u(Qt/=2);return[(1+Yt)*_(Qt),(ut*en>-s(an,mt)-.001?0:10*-ut)+pt+_(en)*Qe-(1+Yt)*He*an]}return Ct.invert=function(Qt,en){var Yt=0,an=0,hn=50;do{var xn=u(Yt),_n=_(Yt),On=u(an),sr=_(an),mr=1+On,Fr=mr*_n-Qt,jr=pt+sr*Qe-mr*He*xn-en,Kr=mr*xn/2,Ur=-_n*sr,Di=He*mr*_n/2,qi=Qe*On+He*xn*sr,ha=Ur*Di-qi*Kr,ca=(jr*Ur-Fr*qi)/ha/2,da=(Fr*Di-jr*Kr)/ha;c(da)>2&&(da/=2),Yt-=ca,an-=da}while((c(ca)>b||c(da)>b)&&--hn>0);return ut*an>-s(u(Yt),mt)-.001?[2*Yt,an]:null},Ct}function te(je,He){var Qe=A(He/2),ut=O(1-Qe*Qe),mt=1+ut*u(je/=2),pt=_(je)*ut/mt,Ct=Qe/mt,Qt=pt*pt,en=Ct*Ct;return[4/3*pt*(3+Qt-3*en),4/3*Ct*(3+3*Qt-en)]}G.invert=function(je,He){if(!(je*je+4*He*He>k*k+b)){var Qe=je,ut=He,mt=25;do{var pt,Ct=_(Qe),Qt=_(Qe/2),en=u(Qe/2),Yt=_(ut),an=u(ut),hn=_(2*ut),xn=Yt*Yt,_n=an*an,On=Qt*Qt,sr=1-_n*en*en,mr=sr?D(an*en)*O(pt=1/sr):pt=0,Fr=2*mr*an*Qt-je,jr=mr*Yt-He,Kr=pt*(_n*On+mr*an*en*xn),Ur=pt*(.5*Ct*hn-2*mr*Yt*Qt),Di=.25*pt*(hn*Qt-mr*Yt*_n*Ct),qi=pt*(xn*en+mr*On*an),ha=Ur*Di-qi*Kr;if(!ha)break;var ca=(jr*Ur-Fr*qi)/ha,da=(Fr*Di-jr*Kr)/ha;Qe-=ca,ut-=da}while((c(ca)>b||c(da)>b)&&--mt>0);return[Qe,ut]}},te.invert=function(je,He){if(He*=3/8,!(je*=3/8)&&c(He)>1)return null;var Qe=1+je*je+He*He,ut=O((Qe-O(Qe*Qe-4*He*He))/2),mt=F(ut)/3,pt=ut?function(Yt){return m(Yt+O(Yt*Yt-1))}(c(He/ut))/3:function(Yt){return m(Yt+O(Yt*Yt+1))}(c(je))/3,Ct=u(mt),Qt=B(pt),en=Qt*Qt-Ct*Ct;return[2*x(je)*s(N(pt)*Ct,.25-en),2*x(He)*s(Qt*_(mt),.25+en)]};var Y=O(8),J=m(1+E);function re(je,He){var Qe=c(He);return Qew){var Ct=s(pt[1],pt[0]),Qt=O(pt[0]*pt[0]+pt[1]*pt[1]),en=He*v((Ct-w)/He)+w,Yt=s(_(Ct-=en),2-u(Ct));Ct=en+F(k/Qt*_(Yt))-Yt,pt[0]=Qt*u(Ct),pt[1]=Qt*_(Ct)}return pt}return Qe.invert=function(ut,mt){var pt=O(ut*ut+mt*mt);if(pt>w){var Ct=s(mt,ut),Qt=He*v((Ct-w)/He)+w,en=Ct>Qt?-1:1,Yt=pt*u(Qt-Ct),an=1/A(en*D((Yt-k)/O(k*(k-2*Yt)+pt*pt)));Ct=Qt+2*i((an+en*O(an*an-3))/3),ut=pt*u(Ct),mt=pt*_(Ct)}return a.geoAzimuthalEquidistantRaw.invert(ut,mt)},Qe}function V(je,He){if(arguments.length<2&&(He=je),He===1)return a.geoAzimuthalEqualAreaRaw;if(He===1/0)return H;function Qe(ut,mt){var pt=a.geoAzimuthalEqualAreaRaw(ut/He,mt);return pt[0]*=je,pt}return Qe.invert=function(ut,mt){var pt=a.geoAzimuthalEqualAreaRaw.invert(ut/je,mt);return pt[0]*=He,pt},Qe}function H(je,He){return[je*u(He)/u(He/=2),2*_(He)]}function ne(je,He,Qe){var ut,mt,pt,Ct=100;Qe=Qe===void 0?0:+Qe,He=+He;do(mt=je(Qe))===(pt=je(Qe+b))&&(pt=mt+b),Qe-=ut=-1*b*(mt-He)/(mt-pt);while(Ct-- >0&&c(ut)>b);return Ct<0?NaN:Qe}function q(je,He,Qe){return He===void 0&&(He=40),Qe===void 0&&(Qe=1e-12),function(ut,mt,pt,Ct){var Qt,en,Yt;pt=pt===void 0?0:+pt,Ct=Ct===void 0?0:+Ct;for(var an=0;anQt)pt-=en/=2,Ct-=Yt/=2;else{Qt=On;var sr=(pt>0?-1:1)*Qe,mr=(Ct>0?-1:1)*Qe,Fr=je(pt+sr,Ct),jr=je(pt,Ct+mr),Kr=(Fr[0]-hn[0])/sr,Ur=(Fr[1]-hn[1])/sr,Di=(jr[0]-hn[0])/mr,qi=(jr[1]-hn[1])/mr,ha=qi*Kr-Ur*Di,ca=(c(ha)<.5?.5:1)/ha;if(pt+=en=(_n*Di-xn*qi)*ca,Ct+=Yt=(xn*Ur-_n*Kr)*ca,c(en)0&&(pt[1]*=1+Ct/1.5*pt[0]*pt[0]),pt}return He.invert=q(He),He}function ee(je,He){var Qe,ut=je*_(He),mt=30;do He-=Qe=(He+_(He)-ut)/(1+u(He));while(c(Qe)>b&&--mt>0);return He/2}function ie(je,He,Qe){function ut(mt,pt){return[je*mt*u(pt=ee(Qe,pt)),He*_(pt)]}return ut.invert=function(mt,pt){return pt=F(pt/He),[mt/(je*u(pt)),F((2*pt+_(2*pt))/Qe)]},ut}re.invert=function(je,He){if((ut=c(He))1e-12&&--pt>0);return[je/(u(mt)*(Y-1/_(mt))),x(He)*mt]},H.invert=function(je,He){var Qe=2*F(He/2);return[je*u(Qe/2)/u(Qe),Qe]};var ae=ie(E/w,E,k),ue=2.00276,le=1.11072;function ge(je,He){var Qe=ee(k,He);return[ue*je/(1/u(He)+le/u(Qe)),(He+E*_(Qe))/ue]}function fe(je){var He=0,Qe=a.geoProjectionMutator(je),ut=Qe(He);return ut.parallel=function(mt){return arguments.length?Qe(He=mt*R):He*L},ut}function me(je,He){return[je*u(He),He]}function _e(je){if(!je)return me;var He=1/A(je);function Qe(ut,mt){var pt=He+je-mt,Ct=pt&&ut*u(mt)/pt;return[pt*_(Ct),He-pt*u(Ct)]}return Qe.invert=function(ut,mt){var pt=O(ut*ut+(mt=He-mt)*mt),Ct=He+je-pt;return[pt/u(Ct)*s(ut,mt),Ct]},Qe}function Ae(je){function He(Qe,ut){var mt=w-ut,pt=mt&&Qe*je*_(mt)/mt;return[mt*_(pt)/je,w-mt*u(pt)]}return He.invert=function(Qe,ut){var mt=Qe*je,pt=w-ut,Ct=O(mt*mt+pt*pt),Qt=s(mt,pt);return[(Ct?Ct/_(Ct):1)*Qt/je,w-Ct]},He}ge.invert=function(je,He){var Qe,ut,mt=ue*He,pt=He<0?-M:M,Ct=25;do ut=mt-E*_(pt),pt-=Qe=(_(2*pt)+2*pt-k*_(ut))/(2*u(2*pt)+2+k*u(ut)*E*u(pt));while(c(Qe)>b&&--Ct>0);return ut=mt-E*_(pt),[je*(1/u(ut)+le/u(pt))/ue,ut]},me.invert=function(je,He){return[je/u(He),He]};var ke=ie(1,4/k,k);function Le(je,He,Qe,ut,mt,pt){var Ct,Qt=u(pt);if(c(je)>1||c(pt)>1)Ct=D(Qe*mt+He*ut*Qt);else{var en=_(je/2),Yt=_(pt/2);Ct=2*F(O(en*en+He*ut*Yt*Yt))}return c(Ct)>b?[Ct,s(ut*_(pt),He*mt-Qe*ut*Qt)]:[0,0]}function de(je,He,Qe){return D((je*je+He*He-Qe*Qe)/(2*je*He))}function ve(je){return je-2*k*d((je+k)/(2*k))}function Me(je,He,Qe){for(var ut,mt=[[je[0],je[1],_(je[1]),u(je[1])],[He[0],He[1],_(He[1]),u(He[1])],[Qe[0],Qe[1],_(Qe[1]),u(Qe[1])]],pt=mt[2],Ct=0;Ct<3;++Ct,pt=ut)ut=mt[Ct],pt.v=Le(ut[1]-pt[1],pt[3],pt[2],ut[3],ut[2],ut[0]-pt[0]),pt.point=[0,0];var Qt=de(mt[0].v[0],mt[2].v[0],mt[1].v[0]),en=de(mt[0].v[0],mt[1].v[0],mt[2].v[0]),Yt=k-Qt;mt[2].point[1]=0,mt[0].point[0]=-(mt[1].point[0]=mt[0].v[0]/2);var an=[mt[2].point[0]=mt[0].point[0]+mt[2].v[0]*u(Qt),2*(mt[0].point[1]=mt[1].point[1]=mt[2].v[0]*_(Qt))];return function(hn,xn){var _n,On=_(xn),sr=u(xn),mr=new Array(3);for(_n=0;_n<3;++_n){var Fr=mt[_n];if(mr[_n]=Le(xn-Fr[1],Fr[3],Fr[2],sr,On,hn-Fr[0]),!mr[_n][0])return Fr.point;mr[_n][1]=ve(mr[_n][1]-Fr.v[1])}var jr=an.slice();for(_n=0;_n<3;++_n){var Kr=_n==2?0:_n+1,Ur=de(mt[_n].v[0],mr[_n][0],mr[Kr][0]);mr[_n][1]<0&&(Ur=-Ur),_n?_n==1?(Ur=en-Ur,jr[0]-=mr[_n][0]*u(Ur),jr[1]-=mr[_n][0]*_(Ur)):(Ur=Yt-Ur,jr[0]+=mr[_n][0]*u(Ur),jr[1]+=mr[_n][0]*_(Ur)):(jr[0]+=mr[_n][0]*u(Ur),jr[1]-=mr[_n][0]*_(Ur))}return jr[0]/=3,jr[1]/=3,jr}}function we(je){return je[0]*=R,je[1]*=R,je}function Ce(je,He,Qe){var ut=a.geoCentroid({type:"MultiPoint",coordinates:[je,He,Qe]}),mt=[-ut[0],-ut[1]],pt=a.geoRotation(mt),Ct=Me(we(pt(je)),we(pt(He)),we(pt(Qe)));Ct.invert=q(Ct);var Qt=a.geoProjection(Ct).rotate(mt),en=Qt.center;return delete Qt.rotate,Qt.center=function(Yt){return arguments.length?en(pt(Yt)):pt.invert(en())},Qt.clipAngle(90)}function Fe(je,He){var Qe=O(1-_(He));return[2/S*je*Qe,S*(1-Qe)]}function ze(je){var He=A(je);function Qe(ut,mt){return[ut,(ut?ut/_(ut):1)*(_(mt)*u(ut)-He*u(mt))]}return Qe.invert=He?function(ut,mt){ut&&(mt*=_(ut)/ut);var pt=u(ut);return[ut,2*s(O(pt*pt+He*He-mt*mt)-pt,He-mt)]}:function(ut,mt){return[ut,F(ut?mt*A(ut)/ut:mt)]},Qe}Fe.invert=function(je,He){var Qe=(Qe=He/S-1)*Qe;return[Qe>0?je*O(k/Qe)/2:0,F(1-Qe)]};var $e=O(3);function Ke(je,He){return[$e*je*(2*u(2*He/3)-1)/S,$e*S*_(He/3)]}function Re(je){var He=u(je);function Qe(ut,mt){return[ut*He,_(mt)/He]}return Qe.invert=function(ut,mt){return[ut/He,F(mt*He)]},Qe}function Ve(je){var He=u(je);function Qe(ut,mt){return[ut*He,(1+He)*A(mt/2)]}return Qe.invert=function(ut,mt){return[ut/He,2*i(mt/(1+He))]},Qe}function We(je,He){var Qe=O(8/(3*k));return[Qe*je*(1-c(He)/k),Qe*He]}function Ye(je,He){var Qe=O(4-3*_(c(He)));return[2/O(6*k)*je*Qe,x(He)*O(2*k/3)*(2-Qe)]}function nt(je,He){var Qe=O(k*(4+k));return[2/Qe*je*(1+O(1-4*He*He/(k*k))),4/Qe*He]}function ft(je,He){var Qe=(2+w)*_(He);He/=2;for(var ut=0,mt=1/0;ut<10&&c(mt)>b;ut++){var pt=u(He);He-=mt=(He+_(He)*(pt+2)-Qe)/(2*pt*(1+pt))}return[2/O(k*(4+k))*je*(1+u(He)),2*O(k/(4+k))*_(He)]}function yt(je,He){return[je*(1+u(He))/O(2+k),2*He/O(2+k)]}function Ot(je,He){for(var Qe=(1+w)*_(He),ut=0,mt=1/0;ut<10&&c(mt)>b;ut++)He-=mt=(He+_(He)-Qe)/(1+u(He));return Qe=O(2+k),[je*(1+u(He))/Qe,2*He/Qe]}Ke.invert=function(je,He){var Qe=3*F(He/($e*S));return[S*je/($e*(2*u(2*Qe/3)-1)),Qe]},We.invert=function(je,He){var Qe=O(8/(3*k)),ut=He/Qe;return[je/(Qe*(1-c(ut)/k)),ut]},Ye.invert=function(je,He){var Qe=2-c(He)/O(2*k/3);return[je*O(6*k)/(2*Qe),x(He)*F((4-Qe*Qe)/3)]},nt.invert=function(je,He){var Qe=O(k*(4+k))/2;return[je*Qe/(1+O(1-He*He*(4+k)/(4*k))),He*Qe/2]},ft.invert=function(je,He){var Qe=He*O((4+k)/k)/2,ut=F(Qe),mt=u(ut);return[je/(2/O(k*(4+k))*(1+mt)),F((ut+Qe*(mt+2))/(2+w))]},yt.invert=function(je,He){var Qe=O(2+k),ut=He*Qe/2;return[Qe*je/(1+u(ut)),ut]},Ot.invert=function(je,He){var Qe=1+w,ut=O(Qe/2);return[2*je*ut/(1+u(He*=ut)),F((He+_(He))/Qe)]};var Tt=3+2*E;function at(je,He){var Qe=_(je/=2),ut=u(je),mt=O(u(He)),pt=u(He/=2),Ct=_(He)/(pt+E*ut*mt),Qt=O(2/(1+Ct*Ct)),en=O((E*pt+(ut+Qe)*mt)/(E*pt+(ut-Qe)*mt));return[Tt*(Qt*(en-1/en)-2*m(en)),Tt*(Qt*Ct*(en+1/en)-2*i(Ct))]}at.invert=function(je,He){if(!(Qe=te.invert(je/1.2,1.065*He)))return null;var Qe,ut=Qe[0],mt=Qe[1],pt=20;je/=Tt,He/=Tt;do{var Ct=ut/2,Qt=mt/2,en=_(Ct),Yt=u(Ct),an=_(Qt),hn=u(Qt),xn=u(mt),_n=O(xn),On=an/(hn+E*Yt*_n),sr=On*On,mr=O(2/(1+sr)),Fr=(E*hn+(Yt+en)*_n)/(E*hn+(Yt-en)*_n),jr=O(Fr),Kr=jr-1/jr,Ur=jr+1/jr,Di=mr*Kr-2*m(jr)-je,qi=mr*On*Ur-2*i(On)-He,ha=an&&T*_n*en*sr/an,ca=(E*Yt*hn+_n)/(2*(hn+E*Yt*_n)*(hn+E*Yt*_n)*_n),da=-.5*On*mr*mr*mr,fo=da*ha,so=da*ca,za=(za=2*hn+E*_n*(Yt-en))*za*jr,Na=(E*Yt*hn*_n+xn)/za,lo=-E*en*an/(_n*za),Fo=Kr*fo-2*Na/jr+mr*(Na+Na/Fr),is=Kr*so-2*lo/jr+mr*(lo+lo/Fr),as=On*Ur*fo-2*ha/(1+sr)+mr*Ur*ha+mr*On*(Na-Na/Fr),os=On*Ur*so-2*ca/(1+sr)+mr*Ur*ca+mr*On*(lo-lo/Fr),ss=is*as-os*Fo;if(!ss)break;var ia=(qi*is-Di*os)/ss,ht=(Di*as-qi*Fo)/ss;ut-=ia,mt=p(-w,g(w,mt-ht))}while((c(ia)>b||c(ht)>b)&&--pt>0);return c(c(mt)-w)ut){var hn=O(an),xn=s(Yt,en),_n=Qe*v(xn/Qe),On=xn-_n,sr=je*u(On),mr=(je*_(On)-On*_(sr))/(w-sr),Fr=dt(On,mr),jr=(k-je)/Oe(Fr,sr,k);en=hn;var Kr,Ur=50;do en-=Kr=(je+Oe(Fr,sr,en)*jr-hn)/(Fr(en)*jr);while(c(Kr)>b&&--Ur>0);Yt=On*_(en),enut){var en=O(Qt),Yt=s(Ct,pt),an=Qe*v(Yt/Qe),hn=Yt-an;pt=en*u(hn),Ct=en*_(hn);for(var xn=pt-w,_n=_(pt),On=Ct/_n,sr=ptb||c(xn)>b)&&--sr>0);return[_n,On]},en}Lt.invert=function(je,He){var Qe=He/(1+et);return[je&&je/(et*O(1-Qe*Qe)),2*i(Qe)]},Wt.invert=function(je,He){var Qe=i(He/S),ut=u(Qe),mt=2*Qe;return[je*S/2/(u(mt)*ut*ut),mt]};var Te=Ie(2.8284,-1.6988,.75432,-.18071,1.76003,-.38914,.042555),Pe=Ie(2.583819,-.835827,.170354,-.038094,1.543313,-.411435,.082742),qe=Ie(5/6*k,-.62636,-.0344,0,1.3493,-.05524,0,.045);function rt(je,He){var Qe=je*je,ut=He*He;return[je*(1-.162388*ut)*(.87-952426e-9*Qe*Qe),He*(1+ut/12)]}rt.invert=function(je,He){var Qe,ut=je,mt=He,pt=50;do{var Ct=mt*mt;mt-=Qe=(mt*(1+Ct/12)-He)/(1+Ct/4)}while(c(Qe)>b&&--pt>0);pt=50,je/=1-.162388*Ct;do{var Qt=(Qt=ut*ut)*Qt;ut-=Qe=(ut*(.87-952426e-9*Qt)-je)/(.87-.00476213*Qt)}while(c(Qe)>b&&--pt>0);return[ut,mt]};var lt=Ie(2.6516,-.76534,.19123,-.047094,1.36289,-.13965,.031762);function ot(je){var He=je(w,0)[0]-je(-w,0)[0];function Qe(ut,mt){var pt=ut>0?-.5:.5,Ct=je(ut+pt*k,mt);return Ct[0]-=pt*He,Ct}return je.invert&&(Qe.invert=function(ut,mt){var pt=ut>0?-.5:.5,Ct=je.invert(ut+pt*He,mt),Qt=Ct[0]-pt*k;return Qt<-k?Qt+=2*k:Qt>k&&(Qt-=2*k),Ct[0]=Qt,Ct}),Qe}function At(je,He){var Qe=x(je),ut=x(He),mt=u(He),pt=u(je)*mt,Ct=_(je)*mt,Qt=_(ut*He);je=c(s(Ct,Qt)),He=F(pt),c(je-w)>b&&(je%=w);var en=function(Yt,an){if(an===w)return[0,0];var hn,xn,_n=_(an),On=_n*_n,sr=On*On,mr=1+sr,Fr=1+3*sr,jr=1-sr,Kr=F(1/O(mr)),Ur=jr+On*mr*Kr,Di=(1-_n)/Ur,qi=O(Di),ha=Di*mr,ca=O(ha),da=qi*jr;if(Yt===0)return[0,-(da+On*ca)];var fo,so=u(an),za=1/so,Na=2*_n*so,lo=(-Ur*so-(-3*On+Kr*Fr)*Na*(1-_n))/(Ur*Ur),Fo=-za*Na,is=-za*(On*mr*lo+Di*Fr*Na),as=-2*za*(jr*(.5*lo/qi)-2*On*qi*Na),os=4*Yt/k;if(Yt>.222*k||an.175*k){if(hn=(da+On*O(ha*(1+sr)-da*da))/(1+sr),Yt>k/4)return[hn,hn];var ss=hn,ia=.5*hn;hn=.5*(ia+ss),xn=50;do{var ht=O(ha-hn*hn),zt=hn*(as+Fo*ht)+is*F(hn/ca)-os;if(!zt)break;zt<0?ia=hn:ss=hn,hn=.5*(ia+ss)}while(c(ss-ia)>b&&--xn>0)}else{hn=b,xn=25;do{var ln=hn*hn,Ht=O(ha-ln),un=as+Fo*Ht,Ln=hn*un+is*F(hn/ca)-os,zn=un+(is-Fo*ln)/Ht;hn-=fo=Ht?Ln/zn:0}while(c(fo)>b&&--xn>0)}return[hn,-da-On*O(ha-hn*hn)]}(je>k/4?w-je:je,He);return je>k/4&&(Qt=en[0],en[0]=-en[1],en[1]=-Qt),en[0]*=Qe,en[1]*=-ut,en}function wt(je,He){var Qe,ut,mt,pt,Ct,Qt;if(He=1-b)return Qe=(1-He)/4,mt=1/(ut=B(je)),[(pt=((Qt=h(2*(Qt=je)))-1)/(Qt+1))+Qe*((Ct=ut*N(je))-je)/(ut*ut),mt-Qe*pt*mt*(Ct-je),mt+Qe*pt*mt*(Ct+je),2*i(h(je))-w+Qe*(Ct-je)/ut];var en=[1,0,0,0,0,0,0,0,0],Yt=[O(He),0,0,0,0,0,0,0,0],an=0;for(ut=O(1-He),Ct=1;c(Yt[an]/en[an])>b&&an<8;)Qe=en[an++],Yt[an]=(Qe-ut)/2,en[an]=(Qe+ut)/2,ut=O(Qe*ut),Ct*=2;mt=Ct*en[an]*je;do mt=(F(pt=Yt[an]*_(ut=mt)/en[an])+mt)/2;while(--an);return[_(mt),pt=u(mt),pt/u(mt-ut),mt]}function $t(je,He){if(!He)return je;if(He===1)return m(A(je/2+M));for(var Qe=1,ut=O(1-He),mt=O(He),pt=0;c(mt)>b;pt++){if(je%k){var Ct=i(ut*A(je)/Qe);Ct<0&&(Ct+=k),je+=Ct+~~(je/k)*k}else je+=je;mt=(Qe+ut)/2,ut=O(Qe*ut),mt=((Qe=mt)-ut)/2}return je/(y(2,pt)*Qe)}function Ut(je,He){var Qe=(E-1)/(E+1),ut=O(1-Qe*Qe),mt=$t(w,ut*ut),pt=m(A(k/4+c(He)/2)),Ct=h(-1*pt)/O(Qe),Qt=function(Yt,an){var hn=Yt*Yt,xn=an+1,_n=1-hn-an*an;return[.5*((Yt>=0?w:-w)-s(_n,2*Yt)),-.25*m(_n*_n+4*hn)+.5*m(xn*xn+hn)]}(Ct*u(-1*je),Ct*_(-1*je)),en=function(Yt,an,hn){var xn=c(Yt),_n=N(c(an));if(xn){var On=1/_(xn),sr=1/(A(xn)*A(xn)),mr=-(sr+hn*(_n*_n*On*On)-1+hn),Fr=(-mr+O(mr*mr-4*((hn-1)*sr)))/2;return[$t(i(1/O(Fr)),hn)*x(Yt),$t(i(O((Fr/sr-1)/hn)),1-hn)*x(an)]}return[0,$t(i(_n),1-hn)*x(an)]}(Qt[0],Qt[1],ut*ut);return[-en[1],(He>=0?1:-1)*(.5*mt-en[0])]}function tt(je){var He=_(je),Qe=u(je),ut=bt(je);function mt(pt,Ct){var Qt=ut(pt,Ct);pt=Qt[0],Ct=Qt[1];var en=_(Ct),Yt=u(Ct),an=u(pt),hn=D(He*en+Qe*Yt*an),xn=_(hn),_n=c(xn)>b?hn/xn:1;return[_n*Qe*_(pt),(c(pt)>w?_n:-_n)*(He*Yt-Qe*en*an)]}return ut.invert=bt(-je),mt.invert=function(pt,Ct){var Qt=O(pt*pt+Ct*Ct),en=-_(Qt),Yt=u(Qt),an=Qt*Yt,hn=-Ct*en,xn=Qt*He,_n=O(an*an+hn*hn-xn*xn),On=s(an*xn+hn*_n,hn*xn-an*_n),sr=(Qt>w?-1:1)*s(pt*en,Qt*u(On)*Yt+Ct*_(On)*en);return ut.invert(sr,On)},mt}function bt(je){var He=_(je),Qe=u(je);return function(ut,mt){var pt=u(mt),Ct=u(ut)*pt,Qt=_(ut)*pt,en=_(mt);return[s(Qt,Ct*Qe-en*He),F(en*Qe+Ct*He)]}}At.invert=function(je,He){c(je)>1&&(je=2*x(je)-je),c(He)>1&&(He=2*x(He)-He);var Qe=x(je),ut=x(He),mt=-Qe*je,pt=-ut*He,Ct=pt/mt<1,Qt=function(hn,xn){for(var _n=0,On=1,sr=.5,mr=50;;){var Fr=sr*sr,jr=O(sr),Kr=F(1/O(1+Fr)),Ur=1-Fr+sr*(1+Fr)*Kr,Di=(1-jr)/Ur,qi=O(Di),ha=Di*(1+Fr),ca=qi*(1-Fr),da=O(ha-hn*hn),fo=xn+ca+sr*da;if(c(On-_n)<1e-12||--mr==0||fo===0)break;fo>0?_n=sr:On=sr,sr=.5*(_n+On)}if(!mr)return null;var so=F(jr),za=u(so),Na=1/za,lo=2*jr*za,Fo=(-Ur*za-(-3*sr+Kr*(1+3*Fr))*lo*(1-jr))/(Ur*Ur);return[k/4*(hn*(-2*Na*(.5*Fo/qi*(1-Fr)-2*sr*qi*lo)+-Na*lo*da)+-Na*(sr*(1+Fr)*Fo+Di*(1+3*Fr)*lo)*F(hn/O(ha))),so]}(Ct?pt:mt,Ct?mt:pt),en=Qt[0],Yt=Qt[1],an=u(Yt);return Ct&&(en=-w-en),[Qe*(s(_(en)*an,-_(Yt))+k),ut*F(u(en)*an)]},Ut.invert=function(je,He){var Qe,ut,mt,pt,Ct,Qt,en=(E-1)/(E+1),Yt=O(1-en*en),an=$t(w,Yt*Yt),hn=(ut=-je,mt=Yt*Yt,(Qe=.5*an-He)?(pt=wt(Qe,mt),ut?(Qt=(Ct=wt(ut,1-mt))[1]*Ct[1]+mt*pt[0]*pt[0]*Ct[0]*Ct[0],[[pt[0]*Ct[2]/Qt,pt[1]*pt[2]*Ct[0]*Ct[1]/Qt],[pt[1]*Ct[1]/Qt,-pt[0]*pt[2]*Ct[0]*Ct[2]/Qt],[pt[2]*Ct[1]*Ct[2]/Qt,-mt*pt[0]*pt[1]*Ct[0]/Qt]]):[[pt[0],0],[pt[1],0],[pt[2],0]]):[[0,(Ct=wt(ut,1-mt))[0]/Ct[1]],[1/Ct[1],0],[Ct[2]/Ct[1],0]]),xn=function(_n,On){var sr=On[0]*On[0]+On[1]*On[1];return[(_n[0]*On[0]+_n[1]*On[1])/sr,(_n[1]*On[0]-_n[0]*On[1])/sr]}(hn[0],hn[1]);return[s(xn[1],xn[0])/-1,2*i(h(-.5*m(en*xn[0]*xn[0]+en*xn[1]*xn[1])))-w]};var Ft=F(1-1/3)*L,Et=Re(0);function Pt(je){var He=Ft*R,Qe=Fe(k,He)[0]-Fe(-k,He)[0],ut=Et(0,He)[1],mt=Fe(0,He)[1],pt=S-mt,Ct=P/je,Qt=4/P,en=ut+pt*pt*4/P;function Yt(an,hn){var xn,_n=c(hn);if(_n>He){var On=g(je-1,p(0,d((an+k)/Ct)));(xn=Fe(an+=k*(je-1)/je-On*Ct,_n))[0]=xn[0]*P/Qe-P*(je-1)/(2*je)+On*P/je,xn[1]=ut+4*(xn[1]-mt)*pt/P,hn<0&&(xn[1]=-xn[1])}else xn=Et(an,hn);return xn[0]*=Qt,xn[1]/=en,xn}return Yt.invert=function(an,hn){an/=Qt;var xn=c(hn*=en);if(xn>ut){var _n=g(je-1,p(0,d((an+k)/Ct)));an=(an+k*(je-1)/je-_n*Ct)*Qe/P;var On=Fe.invert(an,.25*(xn-ut)*P/pt+mt);return On[0]-=k*(je-1)/je-_n*Ct,hn<0&&(On[1]=-On[1]),On}return Et.invert(an,hn)},Yt}function De(je,He){return[je,1&He?90-b:Ft]}function Je(je,He){return[je,1&He?-90+b:-Ft]}function st(je){return[je[0]*(1-b),je[1]]}function St(je){var He,Qe=1+je,ut=F(_(1/Qe)),mt=2*O(k/(He=k+4*ut*Qe)),pt=.5*mt*(Qe+O(je*(2+je))),Ct=je*je,Qt=Qe*Qe;function en(Yt,an){var hn,xn,_n=1-_(an);if(_n&&_n<2){var On,sr=w-an,mr=25;do{var Fr=_(sr),jr=u(sr),Kr=ut+s(Fr,Qe-jr),Ur=1+Qt-2*Qe*jr;sr-=On=(sr-Ct*ut-Qe*Fr+Ur*Kr-.5*_n*He)/(2*Qe*Fr*Kr)}while(c(On)>1e-12&&--mr>0);hn=mt*O(Ur),xn=Yt*Kr/k}else hn=mt*(je+_n),xn=Yt*ut/k;return[hn*_(xn),pt-hn*u(xn)]}return en.invert=function(Yt,an){var hn=Yt*Yt+(an-=pt)*an,xn=(1+Qt-hn/(mt*mt))/(2*Qe),_n=D(xn),On=_(_n),sr=ut+s(On,Qe-xn);return[F(Yt/O(hn))*k/sr,F(1-2*(_n-Ct*ut-Qe*On+(1+Qt-2*Qe*xn)*sr)/He)]},en}function It(je,He){return He>-.7109889596207567?((je=ae(je,He))[1]+=.0528035274542,je):me(je,He)}function Zt(je,He){return c(He)>.7109889596207567?((je=ae(je,He))[1]-=He>0?.0528035274542:-.0528035274542,je):me(je,He)}function Kt(je,He,Qe,ut){var mt=O(4*k/(2*Qe+(1+je-He/2)*_(2*Qe)+(je+He)/2*_(4*Qe)+He/2*_(6*Qe))),pt=O(ut*_(Qe)*O((1+je*u(2*Qe)+He*u(4*Qe))/(1+je+He))),Ct=Qe*en(1);function Qt(hn){return O(1+je*u(2*hn)+He*u(4*hn))}function en(hn){var xn=hn*Qe;return(2*xn+(1+je-He/2)*_(2*xn)+(je+He)/2*_(4*xn)+He/2*_(6*xn))/Qe}function Yt(hn){return Qt(hn)*_(hn)}var an=function(hn,xn){var _n=Qe*ne(en,Ct*_(xn)/Qe,xn/k);isNaN(_n)&&(_n=Qe*x(xn));var On=mt*Qt(_n);return[On*pt*hn/k*u(_n),On/pt*_(_n)]};return an.invert=function(hn,xn){var _n=ne(Yt,xn*pt/mt);return[hn*k/(u(_n)*mt*pt*Qt(_n)),F(Qe*en(_n/Qe)/Ct)]},Qe===0&&(mt=O(ut/k),(an=function(hn,xn){return[hn*mt,_(xn)/mt]}).invert=function(hn,xn){return[hn/mt,F(xn*mt)]}),an}function qt(je,He,Qe,ut,mt){ut===void 0&&(ut=1e-8),mt===void 0&&(mt=20);var pt=je(He),Ct=je(.5*(He+Qe)),Qt=je(Qe);return function en(Yt,an,hn,xn,_n,On,sr,mr,Fr,jr,Kr){if(Kr.nanEncountered)return NaN;var Ur,Di,qi,ha,ca,da,fo,so,za,Na;if(Di=Yt(an+.25*(Ur=hn-an)),qi=Yt(hn-.25*Ur),isNaN(Di))Kr.nanEncountered=!0;else{if(!isNaN(qi))return Na=((da=(ha=Ur*(xn+4*Di+_n)/12)+(ca=Ur*(_n+4*qi+On)/12))-sr)/15,jr>Fr?(Kr.maxDepthCount++,da+Na):Math.abs(Na)_n?sr=mr:On=mr,mr=On+sr>>1;while(mr>On);var Fr=en[mr+1]-en[mr];return Fr&&(Fr=(_n-en[mr+1])/Fr),(mr+1+Fr)/Ct}var hn=2*an(1)/k*pt/Qe,xn=function(_n,On){var sr=an(c(_(On))),mr=ut(sr)*_n;return sr/=hn,[mr,On>=0?sr:-sr]};return xn.invert=function(_n,On){var sr;return c(On*=hn)<1&&(sr=x(On)*F(mt(c(On))*pt)),[_n/ut(c(On)),sr]},xn}function Fn(je,He){return c(je[0]-He[0])=0;--Qt)Qe=(He=je[1][Qt])[0][0],ut=He[0][1],mt=He[1][1],pt=He[2][0],Ct=He[2][1],en.push(pn([[pt-b,Ct-b],[pt-b,mt+b],[Qe+b,mt+b],[Qe+b,ut-b]],30));return{type:"Polygon",coordinates:[l.merge(en)]}}function nn(je,He,Qe){var ut,mt;function pt(en,Yt){for(var an=Yt<0?-1:1,hn=He[+(Yt<0)],xn=0,_n=hn.length-1;xn<_n&&en>hn[xn][2][0];++xn);var On=je(en-hn[xn][1][0],Yt);return On[0]+=je(hn[xn][1][0],an*Yt>an*hn[xn][0][1]?hn[xn][0][1]:Yt)[0],On}Qe?pt.invert=Qe(pt):je.invert&&(pt.invert=function(en,Yt){for(var an=mt[+(Yt<0)],hn=He[+(Yt<0)],xn=0,_n=an.length;xn<_n;++xn){var On=an[xn];if(On[0][0]<=en&&ensr&&(hn=On,On=sr,sr=hn),[[xn,On],[_n,sr]]})}),Ct):He.map(function(Yt){return Yt.map(function(an){return[[an[0][0]*L,an[0][1]*L],[an[1][0]*L,an[1][1]*L],[an[2][0]*L,an[2][1]*L]]})})},He!=null&&Ct.lobes(He),Ct}It.invert=function(je,He){return He>-.7109889596207567?ae.invert(je,He-.0528035274542):me.invert(je,He)},Zt.invert=function(je,He){return c(He)>.7109889596207567?ae.invert(je,He+(He>0?.0528035274542:-.0528035274542)):me.invert(je,He)};var sn=[[[[-180,0],[-100,90],[-40,0]],[[-40,0],[30,90],[180,0]]],[[[-180,0],[-160,-90],[-100,0]],[[-100,0],[-60,-90],[-20,0]],[[-20,0],[20,-90],[80,0]],[[80,0],[140,-90],[180,0]]]],gn=[[[[-180,0],[-100,90],[-40,0]],[[-40,0],[30,90],[180,0]]],[[[-180,0],[-160,-90],[-100,0]],[[-100,0],[-60,-90],[-20,0]],[[-20,0],[20,-90],[80,0]],[[80,0],[140,-90],[180,0]]]],bn=[[[[-180,0],[-100,90],[-40,0]],[[-40,0],[30,90],[180,0]]],[[[-180,0],[-160,-90],[-100,0]],[[-100,0],[-60,-90],[-20,0]],[[-20,0],[20,-90],[80,0]],[[80,0],[140,-90],[180,0]]]],In=[[[[-180,0],[-90,90],[0,0]],[[0,0],[90,90],[180,0]]],[[[-180,0],[-90,-90],[0,0]],[[0,0],[90,-90],[180,0]]]],qn=[[[[-180,35],[-30,90],[0,35]],[[0,35],[30,90],[180,35]]],[[[-180,-10],[-102,-90],[-65,-10]],[[-65,-10],[5,-90],[77,-10]],[[77,-10],[103,-90],[180,-10]]]],Wn=[[[[-180,0],[-110,90],[-40,0]],[[-40,0],[0,90],[40,0]],[[40,0],[110,90],[180,0]]],[[[-180,0],[-110,-90],[-40,0]],[[-40,0],[0,-90],[40,0]],[[40,0],[110,-90],[180,0]]]];function ar(je,He){return[3/P*je*O(k*k/3-He*He),He]}function Dr(je){function He(Qe,ut){if(c(c(ut)-w)2)return null;var pt=(Qe/=2)*Qe,Ct=(ut/=2)*ut,Qt=2*ut/(1+pt+Ct);return Qt=y((1+Qt)/(1-Qt),1/je),[s(2*Qe,1-pt-Ct)/je,F((Qt-1)/(Qt+1))]},He}ar.invert=function(je,He){return[P/3*je/O(k*k/3-He*He),He]};var yr=k/E;function Sr(je,He){return[je*(1+O(u(He)))/2,He/(u(He/2)*u(je/6))]}function Kn(je,He){var Qe=je*je,ut=He*He;return[je*(.975534+ut*(-.0143059*Qe-.119161+-.0547009*ut)),He*(1.00384+Qe*(.0802894+-.02855*ut+199025e-9*Qe)+ut*(.0998909+-.0491032*ut))]}function Dn(je,He){return[_(je)/u(He),A(He)*u(je)]}function lr(je){var He=u(je),Qe=A(M+je/2);function ut(mt,pt){var Ct=pt-je,Qt=c(Ct)=0;)xn=(hn=je[an])[0]+en*(pt=xn)-Yt*_n,_n=hn[1]+en*_n+Yt*pt;return[xn=en*(pt=xn)-Yt*_n,_n=en*_n+Yt*pt]}return Qe.invert=function(ut,mt){var pt=20,Ct=ut,Qt=mt;do{for(var en,Yt=He,an=je[Yt],hn=an[0],xn=an[1],_n=0,On=0;--Yt>=0;)_n=hn+Ct*(en=_n)-Qt*On,On=xn+Ct*On+Qt*en,hn=(an=je[Yt])[0]+Ct*(en=hn)-Qt*xn,xn=an[1]+Ct*xn+Qt*en;var sr,mr,Fr=(_n=hn+Ct*(en=_n)-Qt*On)*_n+(On=xn+Ct*On+Qt*en)*On;Ct-=sr=((hn=Ct*(en=hn)-Qt*xn-ut)*_n+(xn=Ct*xn+Qt*en-mt)*On)/Fr,Qt-=mr=(xn*_n-hn*On)/Fr}while(c(sr)+c(mr)>1e-12&&--pt>0);if(pt){var jr=O(Ct*Ct+Qt*Qt),Kr=2*i(.5*jr),Ur=_(Kr);return[s(Ct*Ur,jr*u(Kr)),jr?F(Qt*Ur/jr):0]}},Qe}Sr.invert=function(je,He){var Qe=c(je),ut=c(He),mt=b,pt=w;utb||c(mr)>b)&&--mt>0);return mt&&[Qe,ut]},Dn.invert=function(je,He){var Qe=je*je,ut=He*He+1,mt=Qe+ut,pt=je?T*O((mt-O(mt*mt-4*Qe))/Qe):1/O(ut);return[F(je*pt),x(He)*D(pt)]},Yr.invert=function(je,He){return[je,2.5*i(h(.8*He))-.625*k]};var rr=[[.9972523,0],[.0052513,-.0041175],[.0074606,.0048125],[-.0153783,-.1968253],[.0636871,-.1408027],[.3660976,-.2937382]],nr=[[.98879,0],[0,0],[-.050909,0],[0,0],[.075528,0]],Bn=[[.984299,0],[.0211642,.0037608],[-.1036018,-.0575102],[-.0329095,-.0320119],[.0499471,.1223335],[.026046,.0899805],[7388e-7,-.1435792],[.0075848,-.1334108],[-.0216473,.0776645],[-.0225161,.0853673]],Nr=[[.9245,0],[0,0],[.01943,0]],Gr=[[.721316,0],[0,0],[-.00881625,-.00617325]];function pr(je,He){var Qe=a.geoProjection(Mn(je)).rotate(He).clipAngle(90),ut=a.geoRotation(He),mt=Qe.center;return delete Qe.rotate,Qe.center=function(pt){return arguments.length?mt(ut(pt)):ut.invert(mt())},Qe}var qr=O(6),_i=O(7);function cn(je,He){var Qe=F(7*_(He)/(3*qr));return[qr*je*(2*u(2*Qe/3)-1)/_i,9*_(Qe/3)/_i]}function jn(je,He){for(var Qe,ut=(1+T)*_(He),mt=He,pt=0;pt<25&&(mt-=Qe=(_(mt/2)+_(mt)-ut)/(.5*u(mt/2)+u(mt)),!(c(Qe)1e-12&&--Qt>0);return[je/(.84719-.13063*(ut=Ct*Ct)+(pt=ut*(mt=ut*ut))*pt*(.05494*ut-.04515-.02326*mt+.00331*pt)),Ct]},vn.invert=function(je,He){for(var Qe=He/2,ut=0,mt=1/0;ut<10&&c(mt)>b;++ut){var pt=u(He/2);He-=mt=(He-A(He/2)-Qe)/(1-.5/(pt*pt))}return[2*je/(1+u(He)),He]};var Hn=[[[[-180,0],[-90,90],[0,0]],[[0,0],[90,90],[180,0]]],[[[-180,0],[-90,-90],[0,0]],[[0,0],[90,-90],[180,0]]]];function Un(je,He){var Qe=_(He),ut=u(He),mt=x(je);if(je===0||c(He)===w)return[0,He];if(He===0)return[je,0];if(c(je)===w)return[je*ut,w*Qe];var pt=k/(2*je)-2*je/k,Ct=2*He/k,Qt=(1-Ct*Ct)/(Qe-Ct),en=pt*pt,Yt=Qt*Qt,an=1+en/Yt,hn=1+Yt/en,xn=(pt*Qe/Qt-pt/2)/an,_n=(Yt*Qe/en+Qt/2)/hn,On=_n*_n-(Yt*Qe*Qe/en+Qt*Qe-1)/hn;return[w*(xn+O(xn*xn+ut*ut/an)*mt),w*(_n+O(On<0?0:On)*x(-He*pt)*mt)]}Un.invert=function(je,He){var Qe=(je/=w)*je,ut=Qe+(He/=w)*He,mt=k*k;return[je?(ut-1+O((1-ut)*(1-ut)+4*Qe))/(2*je)*w:0,ne(function(pt){return ut*(k*_(pt)-2*pt)*k+4*pt*pt*(He-_(pt))+2*k*pt-mt*He},0)]};function Nn(je,He){var Qe=He*He;return[je,He*(1.0148+Qe*Qe*(.23185+Qe*(.02406*Qe-.14499)))]}function Rn(je,He){if(c(He)=0;)if(Fr=sr[Di],mr[0]===Fr[0]&&mr[1]===Fr[1]){if(Kr)return[Kr,mr];Kr=mr}}}(Qt.face,en.face),an=wn(Yt.map(en.project),Yt.map(Qt.project));Qt.transform=en.transform?An(en.transform,an):an;for(var hn=en.edges,xn=0,_n=hn.length;xn<_n;++xn)Yn(Yt[0],hn[xn][1])&&Yn(Yt[1],hn[xn][0])&&(hn[xn]=Qt),Yn(Yt[0],hn[xn][0])&&Yn(Yt[1],hn[xn][1])&&(hn[xn]=Qt);for(hn=Qt.edges,xn=0,_n=hn.length;xn<_n;++xn)Yn(Yt[0],hn[xn][0])&&Yn(Yt[1],hn[xn][1])&&(hn[xn]=en),Yn(Yt[0],hn[xn][1])&&Yn(Yt[1],hn[xn][0])&&(hn[xn]=en)}else Qt.transform=en.transform;return Qt.children&&Qt.children.forEach(function(On){Ct(On,Qt)}),Qt})(je,{transform:null}),ir(je)&&(ut.invert=function(Ct,Qt){var en=function Yt(an,hn){var xn=an.project.invert,_n=an.transform,On=hn;if(_n&&(_n=function(Kr){var Ur=1/(Kr[0]*Kr[4]-Kr[1]*Kr[3]);return[Ur*Kr[4],-Ur*Kr[1],Ur*(Kr[1]*Kr[5]-Kr[2]*Kr[4]),-Ur*Kr[3],Ur*Kr[0],Ur*(Kr[2]*Kr[3]-Kr[0]*Kr[5])]}(_n),On=[_n[0]*On[0]+_n[1]*On[1]+_n[2],_n[3]*On[0]+_n[4]*On[1]+_n[5]]),xn&&an===function(Kr){return He(Kr[0]*R,Kr[1]*R)}(sr=xn(On)))return sr;for(var sr,mr=an.children,Fr=0,jr=mr&&mr.length;Fr1.790857183?He=1.790857183:He<-1.790857183&&(He=-1.790857183);var Qe,ut=He;do{var mt=ut*ut;ut-=Qe=(ut*(1.0148+mt*mt*(.23185+mt*(.02406*mt-.14499)))-He)/(1.0148+mt*mt*(5*.23185+mt*(.21654*mt-1.01493)))}while(c(Qe)>b);return[je,ut]},Rn.invert=function(je,He){if(c(He)b&&--pt>0);return Ct=A(mt),[(c(He)en^jr>en&&Qt<(Fr-On)*(en-sr)/(jr-sr)+On&&(Yt=!Yt)}return Yt}(mt[0],ut))return mt.push(Qe),!0})||je.push([Qe])}),ra=[],je.length?je.length>1?{type:"MultiPolygon",coordinates:je}:{type:"Polygon",coordinates:je[0]}:null}};function ba(je){var He=je(w,0)[0]-je(-w,0)[0];function Qe(ut,mt){var pt=c(ut)0?ut-k:ut+k,mt),Qt=(Ct[0]-Ct[1])*T,en=(Ct[0]+Ct[1])*T;if(pt)return[Qt,en];var Yt=He*T,an=Qt>0^en>0?-1:1;return[an*Qt-x(en)*Yt,an*en-x(Qt)*Yt]}return je.invert&&(Qe.invert=function(ut,mt){var pt=(ut+mt)*T,Ct=(mt-ut)*T,Qt=c(pt)<.5*He&&c(Ct)<.5*He;if(!Qt){var en=He*T,Yt=pt>0^Ct>0?-1:1,an=-Yt*ut+(Ct>0?1:-1)*en,hn=-Yt*mt+(pt>0?1:-1)*en;pt=(-an-hn)*T,Ct=(an-hn)*T}var xn=je.invert(pt,Ct);return Qt||(xn[0]+=pt>0?k:-k),xn}),a.geoProjection(Qe).rotate([-90,-90,45]).clipAngle(179.999)}function _a(){return ba(Ut).scale(111.48)}function ns(je){var He=_(je);function Qe(ut,mt){var pt=He?A(ut*He/2)/He:ut/2;if(!mt)return[2*pt,-je];var Ct=2*i(pt*_(mt)),Qt=1/A(mt);return[_(Ct)*Qt,mt+(1-u(Ct))*Qt-je]}return Qe.invert=function(ut,mt){if(c(mt+=je)b&&--en>0);var xn=ut*(Yt=A(Qt)),_n=A(c(mt)0?w:-w)*(Yt+pt*(hn-Qt)/2+pt*pt*(hn-2*Yt+Qt)/2)]}function Ts(je,He){var Qe=function(Ct){function Qt(en,Yt){var an=u(Yt),hn=(Ct-1)/(Ct-an*u(en));return[hn*an*_(en),hn*_(Yt)]}return Qt.invert=function(en,Yt){var an=en*en+Yt*Yt,hn=O(an),xn=(Ct-O(1-an*(Ct+1)/(Ct-1)))/((Ct-1)/hn+hn/(Ct-1));return[s(en*xn,hn*O(1-xn*xn)),hn?F(Yt*xn/hn):0]},Qt}(je);if(!He)return Qe;var ut=u(He),mt=_(He);function pt(Ct,Qt){var en=Qe(Ct,Qt),Yt=en[1],an=Yt*mt/(je-1)+ut;return[en[0]*ut/an,Yt/an]}return pt.invert=function(Ct,Qt){var en=(je-1)/(je-1-Qt*mt);return Qe.invert(en*Ct,en*Qt*ut)},pt}ua.forEach(function(je){je[1]*=1.0144}),ys.invert=function(je,He){var Qe=He/w,ut=90*Qe,mt=g(18,c(ut/5)),pt=p(0,d(mt));do{var Ct=ua[pt][1],Qt=ua[pt+1][1],en=ua[g(19,pt+2)][1],Yt=en-Ct,an=en-2*Qt+Ct,hn=2*(c(Qe)-Qt)/Yt,xn=an/Yt,_n=hn*(1-xn*hn*(1-2*xn*hn));if(_n>=0||pt===1){ut=(He>=0?5:-5)*(_n+mt);var On,sr=50;do _n=(mt=g(18,c(ut)/5))-(pt=d(mt)),Ct=ua[pt][1],Qt=ua[pt+1][1],en=ua[g(19,pt+2)][1],ut-=(On=(He>=0?w:-w)*(Qt+_n*(en-Ct)/2+_n*_n*(en-2*Qt+Ct)/2)-He)*L;while(c(On)>1e-12&&--sr>0);break}}while(--pt>=0);var mr=ua[pt][0],Fr=ua[pt+1][0],jr=ua[g(19,pt+2)][0];return[je/(Fr+_n*(jr-mr)/2+_n*_n*(jr-2*Fr+mr)/2),ut*R]};var co=-179.9999,rs=179.9999,Ms=-89.9999;function Ns(je){return je.length>0}function Io(je){return je===-90||je===90?[0,je]:[-180,(He=je,Math.floor(1e4*He)/1e4)];var He}function to(je){var He=je[0],Qe=je[1],ut=!1;return He<=co?(He=-180,ut=!0):He>=rs&&(He=180,ut=!0),Qe<=Ms?(Qe=-90,ut=!0):Qe>=89.9999&&(Qe=90,ut=!0),ut?[He,Qe]:je}function Zo(je){return je.map(to)}function mc(je,He,Qe){for(var ut=0,mt=je.length;ut=rs||an<=Ms||an>=89.9999){pt[Ct]=to(en);for(var hn=Ct+1;hnco&&_nMs&&On<89.9999)break}if(hn===Ct+1)continue;if(Ct){var sr={index:-1,polygon:He,ring:pt.slice(0,Ct+1)};sr.ring[sr.ring.length-1]=Io(an),Qe[Qe.length-1]=sr}else Qe.pop();if(hn>=Qt)break;Qe.push({index:-1,polygon:He,ring:pt=pt.slice(hn-1)}),pt[0]=Io(pt[0][1]),Ct=-1,Qt=pt.length}}}}function Rc(je){var He,Qe,ut,mt,pt,Ct,Qt=je.length,en={},Yt={};for(He=0;He0?k-Qt:Qt)*L],Yt=a.geoProjection(je(Ct)).rotate(en),an=a.geoRotation(en),hn=Yt.center;return delete Yt.rotate,Yt.center=function(xn){return arguments.length?hn(an(xn)):an.invert(hn())},Yt.clipAngle(90)}function Nc(je){var He=u(je);function Qe(ut,mt){var pt=a.geoGnomonicRaw(ut,mt);return pt[0]*=He,pt}return Qe.invert=function(ut,mt){return a.geoGnomonicRaw.invert(ut/He,mt)},Qe}function yc(je,He){return zc(Nc,je,He)}function Bc(je){if(!(je*=2))return a.geoAzimuthalEquidistantRaw;var He=-je/2,Qe=-He,ut=je*je,mt=A(Qe),pt=.5/_(Qe);function Ct(Qt,en){var Yt=D(u(en)*u(Qt-He)),an=D(u(en)*u(Qt-Qe));return[((Yt*=Yt)-(an*=an))/(2*je),(en<0?-1:1)*O(4*ut*an-(ut-Yt+an)*(ut-Yt+an))/(2*je)]}return Ct.invert=function(Qt,en){var Yt,an,hn=en*en,xn=u(O(hn+(Yt=Qt+He)*Yt)),_n=u(O(hn+(Yt=Qt+Qe)*Yt));return[s(an=xn-_n,Yt=(xn+_n)*mt),(en<0?-1:1)*D(O(Yt*Yt+an*an)*pt)]},Ct}function Vs(je,He){return zc(Bc,je,He)}function qs(je,He){if(c(He)b&&--Qt>0);return[x(je)*(O(mt*mt+4)+mt)*k/4,w*Ct]};var Ju=4*k+3*O(3),vs=2*O(2*k*O(3)/Ju),wl=ie(vs*O(3)/k,vs,Ju/6);function Ku(je,He){return[je*O(1-3*He*He/(k*k)),He]}function Hs(je,He){var Qe=u(He),ut=u(je)*Qe,mt=1-ut,pt=u(je=s(_(je)*Qe,-_(He))),Ct=_(je);return[Ct*(Qe=O(1-ut*ut))-pt*mt,-pt*Qe-Ct*mt]}function ya(je,He){var Qe=G(je,He);return[(Qe[0]+je/w)/2,(Qe[1]+He)/2]}Ku.invert=function(je,He){return[je/O(1-3*He*He/(k*k)),He]},Hs.invert=function(je,He){var Qe=(je*je+He*He)/-2,ut=O(-Qe*(2+Qe)),mt=He*Qe+je*ut,pt=je*Qe-He*ut,Ct=O(pt*pt+mt*mt);return[s(ut*mt,Ct*(1+Qe)),Ct?-F(ut*pt/Ct):0]},ya.invert=function(je,He){var Qe=je,ut=He,mt=25;do{var pt,Ct=u(ut),Qt=_(ut),en=_(2*ut),Yt=Qt*Qt,an=Ct*Ct,hn=_(Qe),xn=u(Qe/2),_n=_(Qe/2),On=_n*_n,sr=1-an*xn*xn,mr=sr?D(Ct*xn)*O(pt=1/sr):pt=0,Fr=.5*(2*mr*Ct*_n+Qe/w)-je,jr=.5*(mr*Qt+ut)-He,Kr=.5*pt*(an*On+mr*Ct*xn*Yt)+.5/w,Ur=pt*(hn*en/4-mr*Qt*_n),Di=.125*pt*(en*_n-mr*Qt*an*hn),qi=.5*pt*(Yt*xn+mr*On*Ct)+.5,ha=Ur*Di-qi*Kr,ca=(jr*Ur-Fr*qi)/ha,da=(Fr*Di-jr*Kr)/ha;Qe-=ca,ut-=da}while((c(ca)>b||c(da)>b)&&--mt>0);return[Qe,ut]},r.geoNaturalEarth=a.geoNaturalEarth1,r.geoNaturalEarthRaw=a.geoNaturalEarth1Raw,r.geoAiry=function(){var je=w,He=a.geoProjectionMutator(W),Qe=He(je);return Qe.radius=function(ut){return arguments.length?He(je=ut*R):je*L},Qe.scale(179.976).clipAngle(147)},r.geoAiryRaw=W,r.geoAitoff=function(){return a.geoProjection(G).scale(152.63)},r.geoAitoffRaw=G,r.geoArmadillo=function(){var je=20*R,He=je>=0?1:-1,Qe=A(He*je),ut=a.geoProjectionMutator(K),mt=ut(je),pt=mt.stream;return mt.parallel=function(Ct){return arguments.length?(Qe=A((He=(je=Ct*R)>=0?1:-1)*je),ut(je)):je*L},mt.stream=function(Ct){var Qt=mt.rotate(),en=pt(Ct),Yt=(mt.rotate([0,0]),pt(Ct)),an=mt.precision();return mt.rotate(Qt),en.sphere=function(){Yt.polygonStart(),Yt.lineStart();for(var hn=-180*He;He*hn<180;hn+=90*He)Yt.point(hn,90*He);if(je)for(;He*(hn-=3*He*an)>=-180;)Yt.point(hn,He*-s(u(hn*R/2),Qe)*L);Yt.lineEnd(),Yt.polygonEnd()},en},mt.scale(218.695).center([0,28.0974])},r.geoArmadilloRaw=K,r.geoAugust=function(){return a.geoProjection(te).scale(66.1603)},r.geoAugustRaw=te,r.geoBaker=function(){return a.geoProjection(re).scale(112.314)},r.geoBakerRaw=re,r.geoBerghaus=function(){var je=5,He=a.geoProjectionMutator(U),Qe=He(je),ut=Qe.stream,mt=-u(.01*R),pt=_(.01*R);return Qe.lobes=function(Ct){return arguments.length?He(je=+Ct):je},Qe.stream=function(Ct){var Qt=Qe.rotate(),en=ut(Ct),Yt=(Qe.rotate([0,0]),ut(Ct));return Qe.rotate(Qt),en.sphere=function(){Yt.polygonStart(),Yt.lineStart();for(var an=0,hn=360/je,xn=2*k/je,_n=90-180/je,On=w;an=0;)Ct.point((Qt=en[an])[0],Qt[1]);Ct.lineEnd(),Ct.polygonEnd()},Ct},Qe.scale(79.4187).parallel(45).clipAngle(179.999)},r.geoHammerRetroazimuthalRaw=tt,r.geoHealpix=function(){var je=4,He=a.geoProjectionMutator(Pt),Qe=He(je),ut=Qe.stream;return Qe.lobes=function(mt){return arguments.length?He(je=+mt):je},Qe.stream=function(mt){var pt=Qe.rotate(),Ct=ut(mt),Qt=(Qe.rotate([0,0]),ut(mt));return Qe.rotate(pt),Ct.sphere=function(){var en,Yt;a.geoStream((en=180/je,Yt=[].concat(l.range(-180,180+en/2,en).map(De),l.range(180,-180-en/2,-en).map(Je)),{type:"Polygon",coordinates:[en===180?Yt.map(st):Yt]}),Qt)},Ct},Qe.scale(239.75)},r.geoHealpixRaw=Pt,r.geoHill=function(){var je=1,He=a.geoProjectionMutator(St),Qe=He(je);return Qe.ratio=function(ut){return arguments.length?He(je=+ut):je},Qe.scale(167.774).center([0,18.67])},r.geoHillRaw=St,r.geoHomolosine=function(){return a.geoProjection(Zt).scale(152.63)},r.geoHomolosineRaw=Zt,r.geoHufnagel=function(){var je=1,He=0,Qe=45*R,ut=2,mt=a.geoProjectionMutator(Kt),pt=mt(je,He,Qe,ut);return pt.a=function(Ct){return arguments.length?mt(je=+Ct,He,Qe,ut):je},pt.b=function(Ct){return arguments.length?mt(je,He=+Ct,Qe,ut):He},pt.psiMax=function(Ct){return arguments.length?mt(je,He,Qe=+Ct*R,ut):Qe*L},pt.ratio=function(Ct){return arguments.length?mt(je,He,Qe,ut=+Ct):ut},pt.scale(180.739)},r.geoHufnagelRaw=Kt,r.geoHyperelliptical=function(){var je=0,He=2.5,Qe=1.183136,ut=a.geoProjectionMutator(mn),mt=ut(je,He,Qe);return mt.alpha=function(pt){return arguments.length?ut(je=+pt,He,Qe):je},mt.k=function(pt){return arguments.length?ut(je,He=+pt,Qe):He},mt.gamma=function(pt){return arguments.length?ut(je,He,Qe=+pt):Qe},mt.scale(152.63)},r.geoHyperellipticalRaw=mn,r.geoInterrupt=nn,r.geoInterruptedBoggs=function(){return nn(ge,sn).scale(160.857)},r.geoInterruptedHomolosine=function(){return nn(Zt,gn).scale(152.63)},r.geoInterruptedMollweide=function(){return nn(ae,bn).scale(169.529)},r.geoInterruptedMollweideHemispheres=function(){return nn(ae,In).scale(169.529).rotate([20,0])},r.geoInterruptedSinuMollweide=function(){return nn(It,qn,q).rotate([-20,-55]).scale(164.263).center([0,-5.4036])},r.geoInterruptedSinusoidal=function(){return nn(me,Wn).scale(152.63).rotate([-20,0])},r.geoKavrayskiy7=function(){return a.geoProjection(ar).scale(158.837)},r.geoKavrayskiy7Raw=ar,r.geoLagrange=function(){var je=.5,He=a.geoProjectionMutator(Dr),Qe=He(je);return Qe.spacing=function(ut){return arguments.length?He(je=+ut):je},Qe.scale(124.75)},r.geoLagrangeRaw=Dr,r.geoLarrivee=function(){return a.geoProjection(Sr).scale(97.2672)},r.geoLarriveeRaw=Sr,r.geoLaskowski=function(){return a.geoProjection(Kn).scale(139.98)},r.geoLaskowskiRaw=Kn,r.geoLittrow=function(){return a.geoProjection(Dn).scale(144.049).clipAngle(89.999)},r.geoLittrowRaw=Dn,r.geoLoximuthal=function(){return fe(lr).parallel(40).scale(158.837)},r.geoLoximuthalRaw=lr,r.geoMiller=function(){return a.geoProjection(Yr).scale(108.318)},r.geoMillerRaw=Yr,r.geoModifiedStereographic=pr,r.geoModifiedStereographicRaw=Mn,r.geoModifiedStereographicAlaska=function(){return pr(rr,[152,-64]).scale(1400).center([-160.908,62.4864]).clipAngle(30).angle(7.8)},r.geoModifiedStereographicGs48=function(){return pr(nr,[95,-38]).scale(1e3).clipAngle(55).center([-96.5563,38.8675])},r.geoModifiedStereographicGs50=function(){return pr(Bn,[120,-45]).scale(359.513).clipAngle(55).center([-117.474,53.0628])},r.geoModifiedStereographicMiller=function(){return pr(Nr,[-20,-18]).scale(209.091).center([20,16.7214]).clipAngle(82)},r.geoModifiedStereographicLee=function(){return pr(Gr,[165,10]).scale(250).clipAngle(130).center([-165,-10])},r.geoMollweide=function(){return a.geoProjection(ae).scale(169.529)},r.geoMollweideRaw=ae,r.geoMtFlatPolarParabolic=function(){return a.geoProjection(cn).scale(164.859)},r.geoMtFlatPolarParabolicRaw=cn,r.geoMtFlatPolarQuartic=function(){return a.geoProjection(jn).scale(188.209)},r.geoMtFlatPolarQuarticRaw=jn,r.geoMtFlatPolarSinusoidal=function(){return a.geoProjection(jt).scale(166.518)},r.geoMtFlatPolarSinusoidalRaw=jt,r.geoNaturalEarth2=function(){return a.geoProjection(fn).scale(175.295)},r.geoNaturalEarth2Raw=fn,r.geoNellHammer=function(){return a.geoProjection(vn).scale(152.63)},r.geoNellHammerRaw=vn,r.geoInterruptedQuarticAuthalic=function(){return nn(V(1/0),Hn).rotate([20,0]).scale(152.63)},r.geoNicolosi=function(){return a.geoProjection(Un).scale(127.267)},r.geoNicolosiRaw=Un,r.geoPatterson=function(){return a.geoProjection(Nn).scale(139.319)},r.geoPattersonRaw=Nn,r.geoPolyconic=function(){return a.geoProjection(Rn).scale(103.74)},r.geoPolyconicRaw=Rn,r.geoPolyhedral=Zn,r.geoPolyhedralButterfly=function(je){je=je||function(Qe){var ut=a.geoCentroid({type:"MultiPoint",coordinates:Qe});return a.geoGnomonic().scale(1).translate([0,0]).rotate([-ut[0],-ut[1]])};var He=xr.map(function(Qe){return{face:Qe,project:je(Qe)}});return[-1,0,0,1,0,1,4,5].forEach(function(Qe,ut){var mt=He[Qe];mt&&(mt.children||(mt.children=[])).push(He[ut])}),Zn(He[0],function(Qe,ut){return He[Qe<-k/2?ut<0?6:4:Qe<0?ut<0?2:0:Qe0?[-ut[0],0]:[180-ut[0],180])};var He=xr.map(function(Qe){return{face:Qe,project:je(Qe)}});return[-1,0,0,1,0,1,4,5].forEach(function(Qe,ut){var mt=He[Qe];mt&&(mt.children||(mt.children=[])).push(He[ut])}),Zn(He[0],function(Qe,ut){return He[Qe<-k/2?ut<0?6:4:Qe<0?ut<0?2:0:Qe2||_n[0]!=an[0]||_n[1]!=an[1])&&(hn.push(_n),an=_n)}return hn.length===1&&Yt.length>1&&hn.push(Qe(Yt[Yt.length-1])),hn}function pt(Yt){return Yt.map(mt)}function Ct(Yt){if(Yt==null)return Yt;var an;switch(Yt.type){case"GeometryCollection":an={type:"GeometryCollection",geometries:Yt.geometries.map(Ct)};break;case"Point":an={type:"Point",coordinates:Qe(Yt.coordinates)};break;case"MultiPoint":an={type:Yt.type,coordinates:ut(Yt.coordinates)};break;case"LineString":an={type:Yt.type,coordinates:mt(Yt.coordinates)};break;case"MultiLineString":case"Polygon":an={type:Yt.type,coordinates:pt(Yt.coordinates)};break;case"MultiPolygon":an={type:"MultiPolygon",coordinates:Yt.coordinates.map(pt)};break;default:return Yt}return Yt.bbox!=null&&(an.bbox=Yt.bbox),an}function Qt(Yt){var an={type:"Feature",properties:Yt.properties,geometry:Ct(Yt.geometry)};return Yt.id!=null&&(an.id=Yt.id),Yt.bbox!=null&&(an.bbox=Yt.bbox),an}if(je!=null)switch(je.type){case"Feature":return Qt(je);case"FeatureCollection":var en={type:"FeatureCollection",features:je.features.map(Qt)};return je.bbox!=null&&(en.bbox=je.bbox),en;default:return Ct(je)}return je},r.geoQuincuncial=ba,r.geoRectangularPolyconic=function(){return fe(ns).scale(131.215)},r.geoRectangularPolyconicRaw=ns,r.geoRobinson=function(){return a.geoProjection(ys).scale(152.63)},r.geoRobinsonRaw=ys,r.geoSatellite=function(){var je=2,He=0,Qe=a.geoProjectionMutator(Ts),ut=Qe(je,He);return ut.distance=function(mt){return arguments.length?Qe(je=+mt,He):je},ut.tilt=function(mt){return arguments.length?Qe(je,He=mt*R):He*L},ut.scale(432.147).clipAngle(D(1/je)*L-1e-6)},r.geoSatelliteRaw=Ts,r.geoSinuMollweide=function(){return a.geoProjection(It).rotate([-20,-55]).scale(164.263).center([0,-5.4036])},r.geoSinuMollweideRaw=It,r.geoSinusoidal=function(){return a.geoProjection(me).scale(152.63)},r.geoSinusoidalRaw=me,r.geoStitch=function(je){if(je==null)return je;switch(je.type){case"Feature":return wa(je);case"FeatureCollection":var He={type:"FeatureCollection",features:je.features.map(wa)};return je.bbox!=null&&(He.bbox=je.bbox),He;default:return Zu(je)}},r.geoTimes=function(){return a.geoProjection(Kl).scale(146.153)},r.geoTimesRaw=Kl,r.geoTwoPointAzimuthal=yc,r.geoTwoPointAzimuthalRaw=Nc,r.geoTwoPointAzimuthalUsa=function(){return yc([-158,21.5],[-77,39]).clipAngle(60).scale(400)},r.geoTwoPointEquidistant=Vs,r.geoTwoPointEquidistantRaw=Bc,r.geoTwoPointEquidistantUsa=function(){return Vs([-158,21.5],[-77,39]).clipAngle(130).scale(122.571)},r.geoVanDerGrinten=function(){return a.geoProjection(qs).scale(79.4183)},r.geoVanDerGrintenRaw=qs,r.geoVanDerGrinten2=function(){return a.geoProjection(xl).scale(79.4183)},r.geoVanDerGrinten2Raw=xl,r.geoVanDerGrinten3=function(){return a.geoProjection(bl).scale(79.4183)},r.geoVanDerGrinten3Raw=bl,r.geoVanDerGrinten4=function(){return a.geoProjection(_l).scale(127.16)},r.geoVanDerGrinten4Raw=_l,r.geoWagner=Es,r.geoWagner7=function(){return Es().poleline(65).parallels(60).inflation(0).ratio(200).scale(172.633)},r.geoWagnerRaw=Ql,r.geoWagner4=function(){return a.geoProjection(wl).scale(176.84)},r.geoWagner4Raw=wl,r.geoWagner6=function(){return a.geoProjection(Ku).scale(152.63)},r.geoWagner6Raw=Ku,r.geoWiechel=function(){return a.geoProjection(Hs).rotate([0,-90,45]).scale(124.75).clipAngle(179.999)},r.geoWiechelRaw=Hs,r.geoWinkel3=function(){return a.geoProjection(ya).scale(158.837)},r.geoWinkel3Raw=ya,Object.defineProperty(r,"__esModule",{value:!0})})},{"d3-array":107,"d3-geo":114}],114:[function(t,o,f){(function(r,a){typeof f=="object"&&o!==void 0?a(f,t("d3-array")):a((r=r||self).d3=r.d3||{},r.d3)})(this,function(r,a){function l(){return new c}function c(){this.reset()}c.prototype={constructor:c,reset:function(){this.s=this.t=0},add:function(ht){s(i,ht,this.t),s(this,i.s,this.s),this.s?this.t+=i.t:this.s=i.t},valueOf:function(){return this.s}};var i=new c;function s(ht,zt,ln){var Ht=ht.s=zt+ln,un=Ht-zt,Ln=Ht-un;ht.t=zt-Ln+(ln-un)}var u=1e-6,h=Math.PI,d=h/2,m=h/4,p=2*h,g=180/h,y=h/180,v=Math.abs,x=Math.atan,_=Math.atan2,A=Math.cos,b=Math.ceil,k=Math.exp,w=Math.log,M=Math.pow,T=Math.sin,E=Math.sign||function(ht){return ht>0?1:ht<0?-1:0},S=Math.sqrt,P=Math.tan;function L(ht){return ht>1?0:ht<-1?h:Math.acos(ht)}function R(ht){return ht>1?d:ht<-1?-d:Math.asin(ht)}function F(ht){return(ht=T(ht/2))*ht}function D(){}function O(ht,zt){ht&&B.hasOwnProperty(ht.type)&&B[ht.type](ht,zt)}var N={Feature:function(ht,zt){O(ht.geometry,zt)},FeatureCollection:function(ht,zt){for(var ln=ht.features,Ht=-1,un=ln.length;++Ht=0?1:-1,un=Ht*ln,Ln=A(zt=(zt*=y)/2+m),zn=T(zt),Jn=U*zn,fr=re*Ln+Jn*A(un),ur=Jn*Ht*T(un);V.add(_(ur,fr)),J=ht,re=Ln,U=zn}function ae(ht){return[_(ht[1],ht[0]),R(ht[2])]}function ue(ht){var zt=ht[0],ln=ht[1],Ht=A(ln);return[Ht*A(zt),Ht*T(zt),T(ln)]}function le(ht,zt){return ht[0]*zt[0]+ht[1]*zt[1]+ht[2]*zt[2]}function ge(ht,zt){return[ht[1]*zt[2]-ht[2]*zt[1],ht[2]*zt[0]-ht[0]*zt[2],ht[0]*zt[1]-ht[1]*zt[0]]}function fe(ht,zt){ht[0]+=zt[0],ht[1]+=zt[1],ht[2]+=zt[2]}function me(ht,zt){return[ht[0]*zt,ht[1]*zt,ht[2]*zt]}function _e(ht){var zt=S(ht[0]*ht[0]+ht[1]*ht[1]+ht[2]*ht[2]);ht[0]/=zt,ht[1]/=zt,ht[2]/=zt}var Ae,ke,Le,de,ve,Me,we,Ce,Fe,ze,$e,Ke,Re,Ve,We,Ye,nt,ft,yt,Ot,Tt,at,et,Lt,Wt,Jt,Be=l(),Ge={point:kt,lineStart:Oe,lineEnd:Ie,polygonStart:function(){Ge.point=Te,Ge.lineStart=Pe,Ge.lineEnd=qe,Be.reset(),ne.polygonStart()},polygonEnd:function(){ne.polygonEnd(),Ge.point=kt,Ge.lineStart=Oe,Ge.lineEnd=Ie,V<0?(Ae=-(Le=180),ke=-(de=90)):Be>u?de=90:Be<-u&&(ke=-90),ze[0]=Ae,ze[1]=Le},sphere:function(){Ae=-(Le=180),ke=-(de=90)}};function kt(ht,zt){Fe.push(ze=[Ae=ht,Le=ht]),ztde&&(de=zt)}function dt(ht,zt){var ln=ue([ht*y,zt*y]);if(Ce){var Ht=ge(Ce,ln),un=ge([Ht[1],-Ht[0],0],Ht);_e(un),un=ae(un);var Ln,zn=ht-ve,Jn=zn>0?1:-1,fr=un[0]*g*Jn,ur=v(zn)>180;ur^(Jn*vede&&(de=Ln):ur^(Jn*ve<(fr=(fr+360)%360-180)&&frde&&(de=zt)),ur?htrt(Ae,Le)&&(Le=ht):rt(ht,Le)>rt(Ae,Le)&&(Ae=ht):Le>=Ae?(htLe&&(Le=ht)):ht>ve?rt(Ae,ht)>rt(Ae,Le)&&(Le=ht):rt(ht,Le)>rt(Ae,Le)&&(Ae=ht)}else Fe.push(ze=[Ae=ht,Le=ht]);ztde&&(de=zt),Ce=ln,ve=ht}function Oe(){Ge.point=dt}function Ie(){ze[0]=Ae,ze[1]=Le,Ge.point=kt,Ce=null}function Te(ht,zt){if(Ce){var ln=ht-ve;Be.add(v(ln)>180?ln+(ln>0?360:-360):ln)}else Me=ht,we=zt;ne.point(ht,zt),dt(ht,zt)}function Pe(){ne.lineStart()}function qe(){Te(Me,we),ne.lineEnd(),v(Be)>u&&(Ae=-(Le=180)),ze[0]=Ae,ze[1]=Le,Ce=null}function rt(ht,zt){return(zt-=ht)<0?zt+360:zt}function lt(ht,zt){return ht[0]-zt[0]}function ot(ht,zt){return ht[0]<=ht[1]?ht[0]<=zt&&zt<=ht[1]:zth?ht+Math.round(-ht/p)*p:ht,zt]}function Zt(ht,zt,ln){return(ht%=p)?zt||ln?St(qt(ht),mn(zt,ln)):qt(ht):zt||ln?mn(zt,ln):It}function Kt(ht){return function(zt,ln){return[(zt+=ht)>h?zt-p:zt<-h?zt+p:zt,ln]}}function qt(ht){var zt=Kt(ht);return zt.invert=Kt(-ht),zt}function mn(ht,zt){var ln=A(ht),Ht=T(ht),un=A(zt),Ln=T(zt);function zn(Jn,fr){var ur=A(fr),vr=A(Jn)*ur,kr=T(Jn)*ur,hr=T(fr),Tr=hr*ln+vr*Ht;return[_(kr*un-Tr*Ln,vr*ln-hr*Ht),R(Tr*un+kr*Ln)]}return zn.invert=function(Jn,fr){var ur=A(fr),vr=A(Jn)*ur,kr=T(Jn)*ur,hr=T(fr),Tr=hr*un-kr*Ln;return[_(kr*un+hr*Ln,vr*ln+Tr*Ht),R(Tr*ln-vr*Ht)]},zn}function Fn(ht){function zt(ln){return(ln=ht(ln[0]*y,ln[1]*y))[0]*=g,ln[1]*=g,ln}return ht=Zt(ht[0]*y,ht[1]*y,ht.length>2?ht[2]*y:0),zt.invert=function(ln){return(ln=ht.invert(ln[0]*y,ln[1]*y))[0]*=g,ln[1]*=g,ln},zt}function pn(ht,zt,ln,Ht,un,Ln){if(ln){var zn=A(zt),Jn=T(zt),fr=Ht*ln;un==null?(un=zt+Ht*p,Ln=zt-fr/2):(un=tn(zn,un),Ln=tn(zn,Ln),(Ht>0?unLn)&&(un+=Ht*p));for(var ur,vr=un;Ht>0?vr>Ln:vr1&&zt.push(zt.pop().concat(zt.shift()))},result:function(){var ln=zt;return zt=[],ht=null,ln}}}function sn(ht,zt){return v(ht[0]-zt[0])=0;--Ln)un.point((vr=ur[Ln])[0],vr[1]);else Ht(hr.x,hr.p.x,-1,un);hr=hr.p}ur=(hr=hr.o).z,Tr=!Tr}while(!hr.v);un.lineEnd()}}}function In(ht){if(zt=ht.length){for(var zt,ln,Ht=0,un=ht[0];++Ht=0?1:-1,aa=Or*ea,Qi=aa>h,Ci=Jr*di;if(qn.add(_(Ci*Or*T(aa),yi*Ui+Ci*A(aa))),zn+=Qi?ea+Or*p:ea,Qi^Tr>=ln^Rr>=ln){var oa=ge(ue(hr),ue(pi));_e(oa);var Xi=ge(Ln,oa);_e(Xi);var Da=(Qi^ea>=0?-1:1)*R(Xi[2]);(Ht>Da||Ht===Da&&(oa[0]||oa[1]))&&(Jn+=Qi^ea>=0?1:-1)}}return(zn<-u||zn0){for(kr||(un.polygonStart(),kr=!0),un.lineStart(),Wr=0;Wr1&&2&Or&&aa.push(aa.pop().concat(aa.shift())),zn.push(aa.filter(yr))}return hr}}function yr(ht){return ht.length>1}function Sr(ht,zt){return((ht=ht.x)[0]<0?ht[1]-d-u:d-ht[1])-((zt=zt.x)[0]<0?zt[1]-d-u:d-zt[1])}var Kn=Dr(function(){return!0},function(ht){var zt,ln=NaN,Ht=NaN,un=NaN;return{lineStart:function(){ht.lineStart(),zt=1},point:function(Ln,zn){var Jn=Ln>0?h:-h,fr=v(Ln-ln);v(fr-h)0?d:-d),ht.point(un,Ht),ht.lineEnd(),ht.lineStart(),ht.point(Jn,Ht),ht.point(Ln,Ht),zt=0):un!==Jn&&fr>=h&&(v(ln-un)u?x((T(vr)*($r=A(hr))*T(kr)-T(hr)*(Tr=A(vr))*T(ur))/(Tr*$r*Jr)):(vr+hr)/2}(ln,Ht,Ln,zn),ht.point(un,Ht),ht.lineEnd(),ht.lineStart(),ht.point(Jn,Ht),zt=0),ht.point(ln=Ln,Ht=zn),un=Jn},lineEnd:function(){ht.lineEnd(),ln=Ht=NaN},clean:function(){return 2-zt}}},function(ht,zt,ln,Ht){var un;if(ht==null)un=ln*d,Ht.point(-h,un),Ht.point(0,un),Ht.point(h,un),Ht.point(h,0),Ht.point(h,-un),Ht.point(0,-un),Ht.point(-h,-un),Ht.point(-h,0),Ht.point(-h,un);else if(v(ht[0]-zt[0])>u){var Ln=ht[0]0,un=v(zt)>u;function Ln(fr,ur){return A(fr)*A(ur)>zt}function zn(fr,ur,vr){var kr=[1,0,0],hr=ge(ue(fr),ue(ur)),Tr=le(hr,hr),$r=hr[0],Jr=Tr-$r*$r;if(!Jr)return!vr&&fr;var yi=zt*Tr/Jr,Qn=-zt*$r/Jr,pi=ge(kr,hr),Rr=me(kr,yi);fe(Rr,me(hr,Qn));var Wr=pi,di=le(Rr,Wr),Ui=le(Wr,Wr),ea=di*di-Ui*(le(Rr,Rr)-1);if(!(ea<0)){var Or=S(ea),aa=me(Wr,(-di-Or)/Ui);if(fe(aa,Rr),aa=ae(aa),!vr)return aa;var Qi,Ci=fr[0],oa=ur[0],Xi=fr[1],Da=ur[1];oa0^aa[1]<(v(aa[0]-Ci)h^(Ci<=aa[0]&&aa[0]<=oa)){var Ro=me(Wr,(-di+Or)/Ui);return fe(Ro,Rr),[aa,ae(Ro)]}}}function Jn(fr,ur){var vr=Ht?ht:h-ht,kr=0;return fr<-vr?kr|=1:fr>vr&&(kr|=2),ur<-vr?kr|=4:ur>vr&&(kr|=8),kr}return Dr(Ln,function(fr){var ur,vr,kr,hr,Tr;return{lineStart:function(){hr=kr=!1,Tr=1},point:function($r,Jr){var yi,Qn=[$r,Jr],pi=Ln($r,Jr),Rr=Ht?pi?0:Jn($r,Jr):pi?Jn($r+($r<0?h:-h),Jr):0;if(!ur&&(hr=kr=pi)&&fr.lineStart(),pi!==kr&&(!(yi=zn(ur,Qn))||sn(ur,yi)||sn(Qn,yi))&&(Qn[2]=1),pi!==kr)Tr=0,pi?(fr.lineStart(),yi=zn(Qn,ur),fr.point(yi[0],yi[1])):(yi=zn(ur,Qn),fr.point(yi[0],yi[1],2),fr.lineEnd()),ur=yi;else if(un&&ur&&Ht^pi){var Wr;Rr&vr||!(Wr=zn(Qn,ur,!0))||(Tr=0,Ht?(fr.lineStart(),fr.point(Wr[0][0],Wr[0][1]),fr.point(Wr[1][0],Wr[1][1]),fr.lineEnd()):(fr.point(Wr[1][0],Wr[1][1]),fr.lineEnd(),fr.lineStart(),fr.point(Wr[0][0],Wr[0][1],3)))}!pi||ur&&sn(ur,Qn)||fr.point(Qn[0],Qn[1]),ur=Qn,kr=pi,vr=Rr},lineEnd:function(){kr&&fr.lineEnd(),ur=null},clean:function(){return Tr|(hr&&kr)<<1}}},function(fr,ur,vr,kr){pn(kr,ht,ln,vr,fr,ur)},Ht?[0,-ht]:[-h,ht-h])}function lr(ht,zt,ln,Ht){function un(ur,vr){return ht<=ur&&ur<=ln&&zt<=vr&&vr<=Ht}function Ln(ur,vr,kr,hr){var Tr=0,$r=0;if(ur==null||(Tr=zn(ur,kr))!==($r=zn(vr,kr))||fr(ur,vr)<0^kr>0)do hr.point(Tr===0||Tr===3?ht:ln,Tr>1?Ht:zt);while((Tr=(Tr+kr+4)%4)!==$r);else hr.point(vr[0],vr[1])}function zn(ur,vr){return v(ur[0]-ht)0?0:3:v(ur[0]-ln)0?2:1:v(ur[1]-zt)0?1:0:vr>0?3:2}function Jn(ur,vr){return fr(ur.x,vr.x)}function fr(ur,vr){var kr=zn(ur,1),hr=zn(vr,1);return kr!==hr?kr-hr:kr===0?vr[1]-ur[1]:kr===1?ur[0]-vr[0]:kr===2?ur[1]-vr[1]:vr[0]-ur[0]}return function(ur){var vr,kr,hr,Tr,$r,Jr,yi,Qn,pi,Rr,Wr,di=ur,Ui=nn(),ea={point:Or,lineStart:function(){ea.point=aa,kr&&kr.push(hr=[]),Rr=!0,pi=!1,yi=Qn=NaN},lineEnd:function(){vr&&(aa(Tr,$r),Jr&&pi&&Ui.rejoin(),vr.push(Ui.result())),ea.point=Or,pi&&di.lineEnd()},polygonStart:function(){di=Ui,vr=[],kr=[],Wr=!0},polygonEnd:function(){var Qi=function(){for(var Xi=0,Da=0,gi=kr.length;DaHt&&(no-Aa)*(Ht-Ro)>(Cs-Ro)*(ht-Aa)&&++Xi:Cs<=Ht&&(no-Aa)*(Ht-Ro)<(Cs-Ro)*(ht-Aa)&&--Xi;return Xi}(),Ci=Wr&&Qi,oa=(vr=a.merge(vr)).length;(Ci||oa)&&(ur.polygonStart(),Ci&&(ur.lineStart(),Ln(null,null,1,ur),ur.lineEnd()),oa&&bn(vr,Jn,Qi,Ln,ur),ur.polygonEnd()),di=ur,vr=kr=hr=null}};function Or(Qi,Ci){un(Qi,Ci)&&di.point(Qi,Ci)}function aa(Qi,Ci){var oa=un(Qi,Ci);if(kr&&hr.push([Qi,Ci]),Rr)Tr=Qi,$r=Ci,Jr=oa,Rr=!1,oa&&(di.lineStart(),di.point(Qi,Ci));else if(oa&&pi)di.point(Qi,Ci);else{var Xi=[yi=Math.max(-1e9,Math.min(1e9,yi)),Qn=Math.max(-1e9,Math.min(1e9,Qn))],Da=[Qi=Math.max(-1e9,Math.min(1e9,Qi)),Ci=Math.max(-1e9,Math.min(1e9,Ci))];(function(gi,Aa,Ro,Il,tl,Ss){var Pi,no=gi[0],Cs=gi[1],ka=0,ho=1,qo=Aa[0]-no,Pa=Aa[1]-Cs;if(Pi=Ro-no,qo||!(Pi>0)){if(Pi/=qo,qo<0){if(Pi0){if(Pi>ho)return;Pi>ka&&(ka=Pi)}if(Pi=tl-no,qo||!(Pi<0)){if(Pi/=qo,qo<0){if(Pi>ho)return;Pi>ka&&(ka=Pi)}else if(qo>0){if(Pi0)){if(Pi/=Pa,Pa<0){if(Pi0){if(Pi>ho)return;Pi>ka&&(ka=Pi)}if(Pi=Ss-Cs,Pa||!(Pi<0)){if(Pi/=Pa,Pa<0){if(Pi>ho)return;Pi>ka&&(ka=Pi)}else if(Pa>0){if(Pi0&&(gi[0]=no+ka*qo,gi[1]=Cs+ka*Pa),ho<1&&(Aa[0]=no+ho*qo,Aa[1]=Cs+ho*Pa),!0}}}}})(Xi,Da,ht,zt,ln,Ht)?(pi||(di.lineStart(),di.point(Xi[0],Xi[1])),di.point(Da[0],Da[1]),oa||di.lineEnd(),Wr=!1):oa&&(di.lineStart(),di.point(Qi,Ci),Wr=!1)}yi=Qi,Qn=Ci,pi=oa}return ea}}var Yr,Mn,rr,nr=l(),Bn={sphere:D,point:D,lineStart:function(){Bn.point=Gr,Bn.lineEnd=Nr},lineEnd:D,polygonStart:D,polygonEnd:D};function Nr(){Bn.point=Bn.lineEnd=D}function Gr(ht,zt){Yr=ht*=y,Mn=T(zt*=y),rr=A(zt),Bn.point=pr}function pr(ht,zt){ht*=y;var ln=T(zt*=y),Ht=A(zt),un=v(ht-Yr),Ln=A(un),zn=Ht*T(un),Jn=rr*ln-Mn*Ht*Ln,fr=Mn*ln+rr*Ht*Ln;nr.add(_(S(zn*zn+Jn*Jn),fr)),Yr=ht,Mn=ln,rr=Ht}function qr(ht){return nr.reset(),K(ht,Bn),+nr}var _i=[null,null],cn={type:"LineString",coordinates:_i};function jn(ht,zt){return _i[0]=ht,_i[1]=zt,qr(cn)}var jt={Feature:function(ht,zt){return vn(ht.geometry,zt)},FeatureCollection:function(ht,zt){for(var ln=ht.features,Ht=-1,un=ln.length;++Ht0&&(un=jn(ht[Ln],ht[Ln-1]))>0&&ln<=un&&Ht<=un&&(ln+Ht-un)*(1-Math.pow((ln-Ht)/un,2))<1e-12*un)return!0;ln=Ht}return!1}function Nn(ht,zt){return!!ar(ht.map(Rn),wn(zt))}function Rn(ht){return(ht=ht.map(wn)).pop(),ht}function wn(ht){return[ht[0]*y,ht[1]*y]}function An(ht,zt,ln){var Ht=a.range(ht,zt-u,ln).concat(zt);return function(un){return Ht.map(function(Ln){return[un,Ln]})}}function kn(ht,zt,ln){var Ht=a.range(ht,zt-u,ln).concat(zt);return function(un){return Ht.map(function(Ln){return[Ln,un]})}}function Pn(){var ht,zt,ln,Ht,un,Ln,zn,Jn,fr,ur,vr,kr,hr=10,Tr=hr,$r=90,Jr=360,yi=2.5;function Qn(){return{type:"MultiLineString",coordinates:pi()}}function pi(){return a.range(b(Ht/$r)*$r,ln,$r).map(vr).concat(a.range(b(Jn/Jr)*Jr,zn,Jr).map(kr)).concat(a.range(b(zt/hr)*hr,ht,hr).filter(function(Rr){return v(Rr%$r)>u}).map(fr)).concat(a.range(b(Ln/Tr)*Tr,un,Tr).filter(function(Rr){return v(Rr%Jr)>u}).map(ur))}return Qn.lines=function(){return pi().map(function(Rr){return{type:"LineString",coordinates:Rr}})},Qn.outline=function(){return{type:"Polygon",coordinates:[vr(Ht).concat(kr(zn).slice(1),vr(ln).reverse().slice(1),kr(Jn).reverse().slice(1))]}},Qn.extent=function(Rr){return arguments.length?Qn.extentMajor(Rr).extentMinor(Rr):Qn.extentMinor()},Qn.extentMajor=function(Rr){return arguments.length?(Ht=+Rr[0][0],ln=+Rr[1][0],Jn=+Rr[0][1],zn=+Rr[1][1],Ht>ln&&(Rr=Ht,Ht=ln,ln=Rr),Jn>zn&&(Rr=Jn,Jn=zn,zn=Rr),Qn.precision(yi)):[[Ht,Jn],[ln,zn]]},Qn.extentMinor=function(Rr){return arguments.length?(zt=+Rr[0][0],ht=+Rr[1][0],Ln=+Rr[0][1],un=+Rr[1][1],zt>ht&&(Rr=zt,zt=ht,ht=Rr),Ln>un&&(Rr=Ln,Ln=un,un=Rr),Qn.precision(yi)):[[zt,Ln],[ht,un]]},Qn.step=function(Rr){return arguments.length?Qn.stepMajor(Rr).stepMinor(Rr):Qn.stepMinor()},Qn.stepMajor=function(Rr){return arguments.length?($r=+Rr[0],Jr=+Rr[1],Qn):[$r,Jr]},Qn.stepMinor=function(Rr){return arguments.length?(hr=+Rr[0],Tr=+Rr[1],Qn):[hr,Tr]},Qn.precision=function(Rr){return arguments.length?(yi=+Rr,fr=An(Ln,un,90),ur=kn(zt,ht,yi),vr=An(Jn,zn,90),kr=kn(Ht,ln,yi),Qn):yi},Qn.extentMajor([[-180,-90+u],[180,90-u]]).extentMinor([[-180,-80-u],[180,80+u]])}function Zn(ht){return ht}var Yn,ir,or,xr,wr=l(),Ar=l(),Ir={point:D,lineStart:D,lineEnd:D,polygonStart:function(){Ir.lineStart=Br,Ir.lineEnd=$i},polygonEnd:function(){Ir.lineStart=Ir.lineEnd=Ir.point=D,wr.add(v(Ar)),Ar.reset()},result:function(){var ht=wr/2;return wr.reset(),ht}};function Br(){Ir.point=ai}function ai(ht,zt){Ir.point=Vi,Yn=or=ht,ir=xr=zt}function Vi(ht,zt){Ar.add(xr*ht-or*zt),or=ht,xr=zt}function $i(){Vi(Yn,ir)}var Er=1/0,ci=Er,li=-Er,ra=li,eo={point:function(ht,zt){htli&&(li=ht),ztra&&(ra=zt)},lineStart:D,lineEnd:D,polygonStart:D,polygonEnd:D,result:function(){var ht=[[Er,ci],[li,ra]];return li=ra=-(ci=Er=1/0),ht}},Co,ms,ba,_a,ns=0,ua=0,ys=0,Ts=0,co=0,rs=0,Ms=0,Ns=0,Io=0,to={point:Zo,lineStart:mc,lineEnd:Zu,polygonStart:function(){to.lineStart=Kl,to.lineEnd=zc},polygonEnd:function(){to.point=Zo,to.lineStart=mc,to.lineEnd=Zu},result:function(){var ht=Io?[Ms/Io,Ns/Io]:rs?[Ts/rs,co/rs]:ys?[ns/ys,ua/ys]:[NaN,NaN];return ns=ua=ys=Ts=co=rs=Ms=Ns=Io=0,ht}};function Zo(ht,zt){ns+=ht,ua+=zt,++ys}function mc(){to.point=Rc}function Rc(ht,zt){to.point=wa,Zo(ba=ht,_a=zt)}function wa(ht,zt){var ln=ht-ba,Ht=zt-_a,un=S(ln*ln+Ht*Ht);Ts+=un*(ba+ht)/2,co+=un*(_a+zt)/2,rs+=un,Zo(ba=ht,_a=zt)}function Zu(){to.point=Zo}function Kl(){to.point=Nc}function zc(){yc(Co,ms)}function Nc(ht,zt){to.point=yc,Zo(Co=ba=ht,ms=_a=zt)}function yc(ht,zt){var ln=ht-ba,Ht=zt-_a,un=S(ln*ln+Ht*Ht);Ts+=un*(ba+ht)/2,co+=un*(_a+zt)/2,rs+=un,Ms+=(un=_a*ht-ba*zt)*(ba+ht),Ns+=un*(_a+zt),Io+=3*un,Zo(ba=ht,_a=zt)}function Bc(ht){this._context=ht}Bc.prototype={_radius:4.5,pointRadius:function(ht){return this._radius=ht,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(ht,zt){switch(this._point){case 0:this._context.moveTo(ht,zt),this._point=1;break;case 1:this._context.lineTo(ht,zt);break;default:this._context.moveTo(ht+this._radius,zt),this._context.arc(ht,zt,this._radius,0,p)}},result:D};var Vs,qs,xl,bl,_l,Ql=l(),Es={point:D,lineStart:function(){Es.point=Ju},lineEnd:function(){Vs&&vs(qs,xl),Es.point=D},polygonStart:function(){Vs=!0},polygonEnd:function(){Vs=null},result:function(){var ht=+Ql;return Ql.reset(),ht}};function Ju(ht,zt){Es.point=vs,qs=bl=ht,xl=_l=zt}function vs(ht,zt){bl-=ht,_l-=zt,Ql.add(S(bl*bl+_l*_l)),bl=ht,_l=zt}function wl(){this._string=[]}function Ku(ht){return"m0,"+ht+"a"+ht+","+ht+" 0 1,1 0,"+-2*ht+"a"+ht+","+ht+" 0 1,1 0,"+2*ht+"z"}function Hs(ht){return function(zt){var ln=new ya;for(var Ht in ht)ln[Ht]=ht[Ht];return ln.stream=zt,ln}}function ya(){}function je(ht,zt,ln){var Ht=ht.clipExtent&&ht.clipExtent();return ht.scale(150).translate([0,0]),Ht!=null&&ht.clipExtent(null),K(ln,ht.stream(eo)),zt(eo.result()),Ht!=null&&ht.clipExtent(Ht),ht}function He(ht,zt,ln){return je(ht,function(Ht){var un=zt[1][0]-zt[0][0],Ln=zt[1][1]-zt[0][1],zn=Math.min(un/(Ht[1][0]-Ht[0][0]),Ln/(Ht[1][1]-Ht[0][1])),Jn=+zt[0][0]+(un-zn*(Ht[1][0]+Ht[0][0]))/2,fr=+zt[0][1]+(Ln-zn*(Ht[1][1]+Ht[0][1]))/2;ht.scale(150*zn).translate([Jn,fr])},ln)}function Qe(ht,zt,ln){return He(ht,[[0,0],zt],ln)}function ut(ht,zt,ln){return je(ht,function(Ht){var un=+zt,Ln=un/(Ht[1][0]-Ht[0][0]),zn=(un-Ln*(Ht[1][0]+Ht[0][0]))/2,Jn=-Ln*Ht[0][1];ht.scale(150*Ln).translate([zn,Jn])},ln)}function mt(ht,zt,ln){return je(ht,function(Ht){var un=+zt,Ln=un/(Ht[1][1]-Ht[0][1]),zn=-Ln*Ht[0][0],Jn=(un-Ln*(Ht[1][1]+Ht[0][1]))/2;ht.scale(150*Ln).translate([zn,Jn])},ln)}wl.prototype={_radius:4.5,_circle:Ku(4.5),pointRadius:function(ht){return(ht=+ht)!==this._radius&&(this._radius=ht,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._string.push("Z"),this._point=NaN},point:function(ht,zt){switch(this._point){case 0:this._string.push("M",ht,",",zt),this._point=1;break;case 1:this._string.push("L",ht,",",zt);break;default:this._circle==null&&(this._circle=Ku(this._radius)),this._string.push("M",ht,",",zt,this._circle)}},result:function(){if(this._string.length){var ht=this._string.join("");return this._string=[],ht}return null}},ya.prototype={constructor:ya,point:function(ht,zt){this.stream.point(ht,zt)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var pt=A(30*y);function Ct(ht,zt){return+zt?function(ln,Ht){function un(Ln,zn,Jn,fr,ur,vr,kr,hr,Tr,$r,Jr,yi,Qn,pi){var Rr=kr-Ln,Wr=hr-zn,di=Rr*Rr+Wr*Wr;if(di>4*Ht&&Qn--){var Ui=fr+$r,ea=ur+Jr,Or=vr+yi,aa=S(Ui*Ui+ea*ea+Or*Or),Qi=R(Or/=aa),Ci=v(v(Or)-1)Ht||v((Rr*gi+Wr*Aa)/di-.5)>.3||fr*$r+ur*Jr+vr*yi2?gi[2]%360*y:0,Xi()):[yi*g,Qn*g,pi*g]},Ci.angle=function(gi){return arguments.length?(Rr=gi%360*y,Xi()):Rr*g},Ci.reflectX=function(gi){return arguments.length?(Wr=gi?-1:1,Xi()):Wr<0},Ci.reflectY=function(gi){return arguments.length?(di=gi?-1:1,Xi()):di<0},Ci.precision=function(gi){return arguments.length?(zn=Ct(Jn,Qi=gi*gi),Da()):S(Qi)},Ci.fitExtent=function(gi,Aa){return He(Ci,gi,Aa)},Ci.fitSize=function(gi,Aa){return Qe(Ci,gi,Aa)},Ci.fitWidth=function(gi,Aa){return ut(Ci,gi,Aa)},Ci.fitHeight=function(gi,Aa){return mt(Ci,gi,Aa)},function(){return zt=ht.apply(this,arguments),Ci.invert=zt.invert&&oa,Xi()}}function xn(ht){var zt=0,ln=h/3,Ht=hn(ht),un=Ht(zt,ln);return un.parallels=function(Ln){return arguments.length?Ht(zt=Ln[0]*y,ln=Ln[1]*y):[zt*g,ln*g]},un}function _n(ht,zt){var ln=T(ht),Ht=(ln+T(zt))/2;if(v(Ht)0?Jn<-d+u&&(Jn=-d+u):Jn>d-u&&(Jn=d-u);var fr=un/M(qi(Jn),Ht);return[fr*T(Ht*zn),un-fr*A(Ht*zn)]}return Ln.invert=function(zn,Jn){var fr=un-Jn,ur=E(Ht)*S(zn*zn+fr*fr),vr=_(zn,v(fr))*E(fr);return fr*Ht<0&&(vr-=h*E(zn)*E(fr)),[vr/Ht,2*x(M(un/ur,1/Ht))-d]},Ln}function ca(ht,zt){return[ht,zt]}function da(ht,zt){var ln=A(ht),Ht=ht===zt?T(ht):(ln-A(zt))/(zt-ht),un=ln/Ht+ht;if(v(Ht)u&&--un>0);return[ht/(.8707+(Ln=Ht*Ht)*(Ln*(Ln*Ln*Ln*(.003971-.001529*Ln)-.013791)-.131979)),Ht]},os.invert=Fr(R),ss.invert=Fr(function(ht){return 2*x(ht)}),ia.invert=function(ht,zt){return[-zt,2*x(k(ht))-d]},r.geoAlbers=sr,r.geoAlbersUsa=function(){var ht,zt,ln,Ht,un,Ln,zn=sr(),Jn=On().rotate([154,0]).center([-2,58.5]).parallels([55,65]),fr=On().rotate([157,0]).center([-3,19.9]).parallels([8,18]),ur={point:function(hr,Tr){Ln=[hr,Tr]}};function vr(hr){var Tr=hr[0],$r=hr[1];return Ln=null,ln.point(Tr,$r),Ln||(Ht.point(Tr,$r),Ln)||(un.point(Tr,$r),Ln)}function kr(){return ht=zt=null,vr}return vr.invert=function(hr){var Tr=zn.scale(),$r=zn.translate(),Jr=(hr[0]-$r[0])/Tr,yi=(hr[1]-$r[1])/Tr;return(yi>=.12&&yi<.234&&Jr>=-.425&&Jr<-.214?Jn:yi>=.166&&yi<.234&&Jr>=-.214&&Jr<-.115?fr:zn).invert(hr)},vr.stream=function(hr){return ht&&zt===hr?ht:(Tr=[zn.stream(zt=hr),Jn.stream(hr),fr.stream(hr)],$r=Tr.length,ht={point:function(Jr,yi){for(var Qn=-1;++Qn<$r;)Tr[Qn].point(Jr,yi)},sphere:function(){for(var Jr=-1;++Jr<$r;)Tr[Jr].sphere()},lineStart:function(){for(var Jr=-1;++Jr<$r;)Tr[Jr].lineStart()},lineEnd:function(){for(var Jr=-1;++Jr<$r;)Tr[Jr].lineEnd()},polygonStart:function(){for(var Jr=-1;++Jr<$r;)Tr[Jr].polygonStart()},polygonEnd:function(){for(var Jr=-1;++Jr<$r;)Tr[Jr].polygonEnd()}});var Tr,$r},vr.precision=function(hr){return arguments.length?(zn.precision(hr),Jn.precision(hr),fr.precision(hr),kr()):zn.precision()},vr.scale=function(hr){return arguments.length?(zn.scale(hr),Jn.scale(.35*hr),fr.scale(hr),vr.translate(zn.translate())):zn.scale()},vr.translate=function(hr){if(!arguments.length)return zn.translate();var Tr=zn.scale(),$r=+hr[0],Jr=+hr[1];return ln=zn.translate(hr).clipExtent([[$r-.455*Tr,Jr-.238*Tr],[$r+.455*Tr,Jr+.238*Tr]]).stream(ur),Ht=Jn.translate([$r-.307*Tr,Jr+.201*Tr]).clipExtent([[$r-.425*Tr+u,Jr+.12*Tr+u],[$r-.214*Tr-u,Jr+.234*Tr-u]]).stream(ur),un=fr.translate([$r-.205*Tr,Jr+.212*Tr]).clipExtent([[$r-.214*Tr+u,Jr+.166*Tr+u],[$r-.115*Tr-u,Jr+.234*Tr-u]]).stream(ur),kr()},vr.fitExtent=function(hr,Tr){return He(vr,hr,Tr)},vr.fitSize=function(hr,Tr){return Qe(vr,hr,Tr)},vr.fitWidth=function(hr,Tr){return ut(vr,hr,Tr)},vr.fitHeight=function(hr,Tr){return mt(vr,hr,Tr)},vr.scale(1070)},r.geoArea=function(ht){return H.reset(),K(ht,ne),2*H},r.geoAzimuthalEqualArea=function(){return an(jr).scale(124.75).clipAngle(179.999)},r.geoAzimuthalEqualAreaRaw=jr,r.geoAzimuthalEquidistant=function(){return an(Kr).scale(79.4188).clipAngle(179.999)},r.geoAzimuthalEquidistantRaw=Kr,r.geoBounds=function(ht){var zt,ln,Ht,un,Ln,zn,Jn;if(de=Le=-(Ae=ke=1/0),Fe=[],K(ht,Ge),ln=Fe.length){for(Fe.sort(lt),zt=1,Ln=[Ht=Fe[0]];ztrt(Ht[0],Ht[1])&&(Ht[1]=un[1]),rt(un[0],Ht[1])>rt(Ht[0],Ht[1])&&(Ht[0]=un[0])):Ln.push(Ht=un);for(zn=-1/0,zt=0,Ht=Ln[ln=Ln.length-1];zt<=ln;Ht=un,++zt)un=Ln[zt],(Jn=rt(Ht[1],un[0]))>zn&&(zn=Jn,Ae=un[0],Le=Ht[1])}return Fe=ze=null,Ae===1/0||ke===1/0?[[NaN,NaN],[NaN,NaN]]:[[Ae,ke],[Le,de]]},r.geoCentroid=function(ht){$e=Ke=Re=Ve=We=Ye=nt=ft=yt=Ot=Tt=0,K(ht,At);var zt=yt,ln=Ot,Ht=Tt,un=zt*zt+ln*ln+Ht*Ht;return un<1e-12&&(zt=Ye,ln=nt,Ht=ft,Ke2?Ht[2]+90:90]):[(Ht=ln())[0],Ht[1],Ht[2]-90]},ln([0,0,90]).scale(159.155)},r.geoTransverseMercatorRaw=ia,Object.defineProperty(r,"__esModule",{value:!0})})},{"d3-array":107}],115:[function(t,o,f){(function(r,a){a(typeof f=="object"&&o!==void 0?f:(r=r||self).d3=r.d3||{})})(this,function(r){function a(le,ge){return le.parent===ge.parent?1:2}function l(le,ge){return le+ge.x}function c(le,ge){return Math.max(le,ge.y)}function i(le){var ge=0,fe=le.children,me=fe&&fe.length;if(me)for(;--me>=0;)ge+=fe[me].value;else ge=1;le.value=ge}function s(le,ge){var fe,me,_e,Ae,ke,Le=new m(le),de=+le.value&&(Le.value=le.value),ve=[Le];for(ge==null&&(ge=u);fe=ve.pop();)if(de&&(fe.value=+fe.data.value),(_e=ge(fe.data))&&(ke=_e.length))for(fe.children=new Array(ke),Ae=ke-1;Ae>=0;--Ae)ve.push(me=fe.children[Ae]=new m(_e[Ae])),me.parent=fe,me.depth=fe.depth+1;return Le.eachBefore(d)}function u(le){return le.children}function h(le){le.data=le.data.data}function d(le){var ge=0;do le.height=ge;while((le=le.parent)&&le.height<++ge)}function m(le){this.data=le,this.depth=this.height=0,this.parent=null}m.prototype=s.prototype={constructor:m,count:function(){return this.eachAfter(i)},each:function(le){var ge,fe,me,_e,Ae=this,ke=[Ae];do for(ge=ke.reverse(),ke=[];Ae=ge.pop();)if(le(Ae),fe=Ae.children)for(me=0,_e=fe.length;me<_e;++me)ke.push(fe[me]);while(ke.length);return this},eachAfter:function(le){for(var ge,fe,me,_e=this,Ae=[_e],ke=[];_e=Ae.pop();)if(ke.push(_e),ge=_e.children)for(fe=0,me=ge.length;fe=0;--fe)_e.push(ge[fe]);return this},sum:function(le){return this.eachAfter(function(ge){for(var fe=+le(ge.data)||0,me=ge.children,_e=me&&me.length;--_e>=0;)fe+=me[_e].value;ge.value=fe})},sort:function(le){return this.eachBefore(function(ge){ge.children&&ge.children.sort(le)})},path:function(le){for(var ge=this,fe=function(Ae,ke){if(Ae===ke)return Ae;var Le=Ae.ancestors(),de=ke.ancestors(),ve=null;for(Ae=Le.pop(),ke=de.pop();Ae===ke;)ve=Ae,Ae=Le.pop(),ke=de.pop();return ve}(ge,le),me=[ge];ge!==fe;)ge=ge.parent,me.push(ge);for(var _e=me.length;le!==fe;)me.splice(_e,0,le),le=le.parent;return me},ancestors:function(){for(var le=this,ge=[le];le=le.parent;)ge.push(le);return ge},descendants:function(){var le=[];return this.each(function(ge){le.push(ge)}),le},leaves:function(){var le=[];return this.eachBefore(function(ge){ge.children||le.push(ge)}),le},links:function(){var le=this,ge=[];return le.each(function(fe){fe!==le&&ge.push({source:fe.parent,target:fe})}),ge},copy:function(){return s(this).eachBefore(h)}};var p=Array.prototype.slice;function g(le){for(var ge,fe,me=0,_e=(le=function(ke){for(var Le,de,ve=ke.length;ve;)de=Math.random()*ve--|0,Le=ke[ve],ke[ve]=ke[de],ke[de]=Le;return ke}(p.call(le))).length,Ae=[];me<_e;)ge=le[me],fe&&x(fe,ge)?++me:(fe=A(Ae=y(Ae,ge)),me=0);return fe}function y(le,ge){var fe,me;if(_(ge,le))return[ge];for(fe=0;fe0&&fe*fe>me*me+_e*_e}function _(le,ge){for(var fe=0;fe(ke*=ke)?(me=(ve+ke-_e)/(2*ve),Ae=Math.sqrt(Math.max(0,ke/ve-me*me)),fe.x=le.x-me*Le-Ae*de,fe.y=le.y-me*de+Ae*Le):(me=(ve+_e-ke)/(2*ve),Ae=Math.sqrt(Math.max(0,_e/ve-me*me)),fe.x=ge.x+me*Le-Ae*de,fe.y=ge.y+me*de+Ae*Le)):(fe.x=ge.x+fe.r,fe.y=ge.y)}function M(le,ge){var fe=le.r+ge.r-1e-6,me=ge.x-le.x,_e=ge.y-le.y;return fe>0&&fe*fe>me*me+_e*_e}function T(le){var ge=le._,fe=le.next._,me=ge.r+fe.r,_e=(ge.x*fe.r+fe.x*ge.r)/me,Ae=(ge.y*fe.r+fe.y*ge.r)/me;return _e*_e+Ae*Ae}function E(le){this._=le,this.next=null,this.previous=null}function S(le){if(!(_e=le.length))return 0;var ge,fe,me,_e,Ae,ke,Le,de,ve,Me,we;if((ge=le[0]).x=0,ge.y=0,!(_e>1))return ge.r;if(fe=le[1],ge.x=-fe.r,fe.x=ge.r,fe.y=0,!(_e>2))return ge.r+fe.r;w(fe,ge,me=le[2]),ge=new E(ge),fe=new E(fe),me=new E(me),ge.next=me.previous=fe,fe.next=ge.previous=me,me.next=fe.previous=ge;e:for(Le=3;Le<_e;++Le){w(ge._,fe._,me=le[Le]),me=new E(me),de=fe.next,ve=ge.previous,Me=fe._.r,we=ge._.r;do if(Me<=we){if(M(de._,me._)){fe=de,ge.next=fe,fe.previous=ge,--Le;continue e}Me+=de._.r,de=de.next}else{if(M(ve._,me._)){(ge=ve).next=fe,fe.previous=ge,--Le;continue e}we+=ve._.r,ve=ve.previous}while(de!==ve.next);for(me.previous=ge,me.next=fe,ge.next=fe.previous=fe=me,Ae=T(ge);(me=me.next)!==fe;)(ke=T(me))Ce&&(Ce=Le),Ke=Me*Me*$e,(Fe=Math.max(Ce/Ke,Ke/we))>ze){Me-=Le;break}ze=Fe}Re.push(ke={value:Me,dice:de1?me:1)},fe}(ee),ue=function le(ge){function fe(me,_e,Ae,ke,Le){if((de=me._squarify)&&de.ratio===ge)for(var de,ve,Me,we,Ce,Fe=-1,ze=de.length,$e=me.value;++Fe1?me:1)},fe}(ee);r.cluster=function(){var le=a,ge=1,fe=1,me=!1;function _e(Ae){var ke,Le=0;Ae.eachAfter(function(Ce){var Fe=Ce.children;Fe?(Ce.x=function(ze){return ze.reduce(l,0)/ze.length}(Fe),Ce.y=function(ze){return 1+ze.reduce(c,0)}(Fe)):(Ce.x=ke?Le+=le(Ce,ke):0,Ce.y=0,ke=Ce)});var de=function(Ce){for(var Fe;Fe=Ce.children;)Ce=Fe[0];return Ce}(Ae),ve=function(Ce){for(var Fe;Fe=Ce.children;)Ce=Fe[Fe.length-1];return Ce}(Ae),Me=de.x-le(de,ve)/2,we=ve.x+le(ve,de)/2;return Ae.eachAfter(me?function(Ce){Ce.x=(Ce.x-Ae.x)*ge,Ce.y=(Ae.y-Ce.y)*fe}:function(Ce){Ce.x=(Ce.x-Me)/(we-Me)*ge,Ce.y=(1-(Ae.y?Ce.y/Ae.y:1))*fe})}return _e.separation=function(Ae){return arguments.length?(le=Ae,_e):le},_e.size=function(Ae){return arguments.length?(me=!1,ge=+Ae[0],fe=+Ae[1],_e):me?null:[ge,fe]},_e.nodeSize=function(Ae){return arguments.length?(me=!0,ge=+Ae[0],fe=+Ae[1],_e):me?[ge,fe]:null},_e},r.hierarchy=s,r.pack=function(){var le=null,ge=1,fe=1,me=R;function _e(Ae){return Ae.x=ge/2,Ae.y=fe/2,le?Ae.eachBefore(O(le)).eachAfter(N(me,.5)).eachBefore(B(1)):Ae.eachBefore(O(D)).eachAfter(N(R,1)).eachAfter(N(me,Ae.r/Math.min(ge,fe))).eachBefore(B(Math.min(ge,fe)/(2*Ae.r))),Ae}return _e.radius=function(Ae){return arguments.length?(le=P(Ae),_e):le},_e.size=function(Ae){return arguments.length?(ge=+Ae[0],fe=+Ae[1],_e):[ge,fe]},_e.padding=function(Ae){return arguments.length?(me=typeof Ae=="function"?Ae:F(+Ae),_e):me},_e},r.packEnclose=g,r.packSiblings=function(le){return S(le),le},r.partition=function(){var le=1,ge=1,fe=0,me=!1;function _e(Ae){var ke=Ae.height+1;return Ae.x0=Ae.y0=fe,Ae.x1=le,Ae.y1=ge/ke,Ae.eachBefore(function(Le,de){return function(ve){ve.children&&G(ve,ve.x0,Le*(ve.depth+1)/de,ve.x1,Le*(ve.depth+2)/de);var Me=ve.x0,we=ve.y0,Ce=ve.x1-fe,Fe=ve.y1-fe;Ce0)throw new Error("cycle");return ke}return fe.id=function(me){return arguments.length?(le=L(me),fe):le},fe.parentId=function(me){return arguments.length?(ge=L(me),fe):ge},fe},r.tree=function(){var le=re,ge=1,fe=1,me=null;function _e(de){var ve=function(Re){for(var Ve,We,Ye,nt,ft,yt=new q(Re,0),Ot=[yt];Ve=Ot.pop();)if(Ye=Ve._.children)for(Ve.children=new Array(ft=Ye.length),nt=ft-1;nt>=0;--nt)Ot.push(We=Ve.children[nt]=new q(Ye[nt],nt)),We.parent=Ve;return(yt.parent=new q(null,0)).children=[yt],yt}(de);if(ve.eachAfter(Ae),ve.parent.m=-ve.z,ve.eachBefore(ke),me)de.eachBefore(Le);else{var Me=de,we=de,Ce=de;de.eachBefore(function(Re){Re.xwe.x&&(we=Re),Re.depth>Ce.depth&&(Ce=Re)});var Fe=Me===we?1:le(Me,we)/2,ze=Fe-Me.x,$e=ge/(we.x+Fe+ze),Ke=fe/(Ce.depth||1);de.eachBefore(function(Re){Re.x=(Re.x+ze)*$e,Re.y=Re.depth*Ke})}return de}function Ae(de){var ve=de.children,Me=de.parent.children,we=de.i?Me[de.i-1]:null;if(ve){(function(Fe){for(var ze,$e=0,Ke=0,Re=Fe.children,Ve=Re.length;--Ve>=0;)(ze=Re[Ve]).z+=$e,ze.m+=$e,$e+=ze.s+(Ke+=ze.c)})(de);var Ce=(ve[0].z+ve[ve.length-1].z)/2;we?(de.z=we.z+le(de._,we._),de.m=de.z-Ce):de.z=Ce}else we&&(de.z=we.z+le(de._,we._));de.parent.A=function(Fe,ze,$e){if(ze){for(var Ke,Re=Fe,Ve=Fe,We=ze,Ye=Re.parent.children[0],nt=Re.m,ft=Ve.m,yt=We.m,Ot=Ye.m;We=V(We),Re=U(Re),We&ℜ)Ye=U(Ye),(Ve=V(Ve)).a=Fe,(Ke=We.z+yt-Re.z-nt+le(We._,Re._))>0&&(H(ne(We,Fe,$e),Fe,Ke),nt+=Ke,ft+=Ke),yt+=We.m,nt+=Re.m,Ot+=Ye.m,ft+=Ve.m;We&&!V(Ve)&&(Ve.t=We,Ve.m+=yt-ft),Re&&!U(Ye)&&(Ye.t=Re,Ye.m+=nt-Ot,$e=Fe)}return $e}(de,we,de.parent.A||Me[0])}function ke(de){de._.x=de.z+de.parent.m,de.m+=de.parent.m}function Le(de){de.x*=ge,de.y=de.depth*fe}return _e.separation=function(de){return arguments.length?(le=de,_e):le},_e.size=function(de){return arguments.length?(me=!1,ge=+de[0],fe=+de[1],_e):me?null:[ge,fe]},_e.nodeSize=function(de){return arguments.length?(me=!0,ge=+de[0],fe=+de[1],_e):me?[ge,fe]:null},_e},r.treemap=function(){var le=ae,ge=!1,fe=1,me=1,_e=[0],Ae=R,ke=R,Le=R,de=R,ve=R;function Me(Ce){return Ce.x0=Ce.y0=0,Ce.x1=fe,Ce.y1=me,Ce.eachBefore(we),_e=[0],ge&&Ce.eachBefore(W),Ce}function we(Ce){var Fe=_e[Ce.depth],ze=Ce.x0+Fe,$e=Ce.y0+Fe,Ke=Ce.x1-Fe,Re=Ce.y1-Fe;Ke=Ce-1){var Ve=Le[we];return Ve.x0=ze,Ve.y0=$e,Ve.x1=Ke,void(Ve.y1=Re)}for(var We=ve[we],Ye=Fe/2+We,nt=we+1,ft=Ce-1;nt>>1;ve[yt]Re-$e){var at=(ze*Tt+Ke*Ot)/Fe;Me(we,nt,Ot,ze,$e,at,Re),Me(nt,Ce,Tt,at,$e,Ke,Re)}else{var et=($e*Tt+Re*Ot)/Fe;Me(we,nt,Ot,ze,$e,Ke,et),Me(nt,Ce,Tt,ze,et,Ke,Re)}})(0,de,le.value,ge,fe,me,_e)},r.treemapDice=G,r.treemapResquarify=ue,r.treemapSlice=Q,r.treemapSliceDice=function(le,ge,fe,me,_e){(1&le.depth?Q:G)(le,ge,fe,me,_e)},r.treemapSquarify=ae,Object.defineProperty(r,"__esModule",{value:!0})})},{}],116:[function(t,o,f){(function(r,a){typeof f=="object"&&o!==void 0?a(f,t("d3-color")):a((r=r||self).d3=r.d3||{},r.d3)})(this,function(r,a){function l(ee,ie,ae,ue,le){var ge=ee*ee,fe=ge*ee;return((1-3*ee+3*ge-fe)*ie+(4-6*ge+3*fe)*ae+(1+3*ee+3*ge-3*fe)*ue+fe*le)/6}function c(ee){var ie=ee.length-1;return function(ae){var ue=ae<=0?ae=0:ae>=1?(ae=1,ie-1):Math.floor(ae*ie),le=ee[ue],ge=ee[ue+1],fe=ue>0?ee[ue-1]:2*le-ge,me=ue180||ae<-180?ae-360*Math.round(ae/360):ae):s(isNaN(ee)?ie:ee)}function d(ee){return(ee=+ee)==1?m:function(ie,ae){return ae-ie?function(ue,le,ge){return ue=Math.pow(ue,ge),le=Math.pow(le,ge)-ue,ge=1/ge,function(fe){return Math.pow(ue+fe*le,ge)}}(ie,ae,ee):s(isNaN(ie)?ae:ie)}}function m(ee,ie){var ae=ie-ee;return ae?u(ee,ae):s(isNaN(ee)?ie:ee)}var p=function ee(ie){var ae=d(ie);function ue(le,ge){var fe=ae((le=a.rgb(le)).r,(ge=a.rgb(ge)).r),me=ae(le.g,ge.g),_e=ae(le.b,ge.b),Ae=m(le.opacity,ge.opacity);return function(ke){return le.r=fe(ke),le.g=me(ke),le.b=_e(ke),le.opacity=Ae(ke),le+""}}return ue.gamma=ee,ue}(1);function g(ee){return function(ie){var ae,ue,le=ie.length,ge=new Array(le),fe=new Array(le),me=new Array(le);for(ae=0;aege&&(le=ie.slice(ge,le),me[fe]?me[fe]+=le:me[++fe]=le),(ae=ae[0])===(ue=ue[0])?me[fe]?me[fe]+=ue:me[++fe]=ue:(me[++fe]=null,_e.push({i:fe,x:k(ae,ue)})),ge=T.lastIndex;return ge180?ke+=360:ke-Ae>180&&(Ae+=360),de.push({i:Le.push(le(Le)+"rotate(",null,ue)-2,x:k(Ae,ke)})):ke&&Le.push(le(Le)+"rotate("+ke+ue)}(ge.rotate,fe.rotate,me,_e),function(Ae,ke,Le,de){Ae!==ke?de.push({i:Le.push(le(Le)+"skewX(",null,ue)-2,x:k(Ae,ke)}):ke&&Le.push(le(Le)+"skewX("+ke+ue)}(ge.skewX,fe.skewX,me,_e),function(Ae,ke,Le,de,ve,Me){if(Ae!==Le||ke!==de){var we=ve.push(le(ve)+"scale(",null,",",null,")");Me.push({i:we-4,x:k(Ae,Le)},{i:we-2,x:k(ke,de)})}else Le===1&&de===1||ve.push(le(ve)+"scale("+Le+","+de+")")}(ge.scaleX,ge.scaleY,fe.scaleX,fe.scaleY,me,_e),ge=fe=null,function(Ae){for(var ke,Le=-1,de=_e.length;++Le1e-6)if(Math.abs(A*v-x*_)>1e-6&&p){var k=d-g,w=m-y,M=v*v+x*x,T=k*k+w*w,E=Math.sqrt(M),S=Math.sqrt(b),P=p*Math.tan((a-Math.acos((M+b-T)/(2*E*S)))/2),L=P/S,R=P/E;Math.abs(L-1)>1e-6&&(this._+="L"+(u+L*_)+","+(h+L*A)),this._+="A"+p+","+p+",0,0,"+ +(A*k>_*w)+","+(this._x1=u+R*v)+","+(this._y1=h+R*x)}else this._+="L"+(this._x1=u)+","+(this._y1=h)},arc:function(u,h,d,m,p,g){u=+u,h=+h,g=!!g;var y=(d=+d)*Math.cos(m),v=d*Math.sin(m),x=u+y,_=h+v,A=1^g,b=g?m-p:p-m;if(d<0)throw new Error("negative radius: "+d);this._x1===null?this._+="M"+x+","+_:(Math.abs(this._x1-x)>1e-6||Math.abs(this._y1-_)>1e-6)&&(this._+="L"+x+","+_),d&&(b<0&&(b=b%l+l),b>c?this._+="A"+d+","+d+",0,1,"+A+","+(u-y)+","+(h-v)+"A"+d+","+d+",0,1,"+A+","+(this._x1=x)+","+(this._y1=_):b>1e-6&&(this._+="A"+d+","+d+",0,"+ +(b>=a)+","+A+","+(this._x1=u+d*Math.cos(p))+","+(this._y1=h+d*Math.sin(p))))},rect:function(u,h,d,m){this._+="M"+(this._x0=this._x1=+u)+","+(this._y0=this._y1=+h)+"h"+ +d+"v"+ +m+"h"+-d+"Z"},toString:function(){return this._}},r.path=s,Object.defineProperty(r,"__esModule",{value:!0})})},{}],118:[function(t,o,f){(function(r,a){a(typeof f=="object"&&o!==void 0?f:(r=r||self).d3=r.d3||{})})(this,function(r){function a(m,p,g,y){if(isNaN(p)||isNaN(g))return m;var v,x,_,A,b,k,w,M,T,E=m._root,S={data:y},P=m._x0,L=m._y0,R=m._x1,F=m._y1;if(!E)return m._root=S,m;for(;E.length;)if((k=p>=(x=(P+R)/2))?P=x:R=x,(w=g>=(_=(L+F)/2))?L=_:F=_,v=E,!(E=E[M=w<<1|k]))return v[M]=S,m;if(A=+m._x.call(null,E.data),b=+m._y.call(null,E.data),p===A&&g===b)return S.next=E,v?v[M]=S:m._root=S,m;do v=v?v[M]=new Array(4):m._root=new Array(4),(k=p>=(x=(P+R)/2))?P=x:R=x,(w=g>=(_=(L+F)/2))?L=_:F=_;while((M=w<<1|k)==(T=(b>=_)<<1|A>=x));return v[T]=E,v[M]=S,m}function l(m,p,g,y,v){this.node=m,this.x0=p,this.y0=g,this.x1=y,this.y1=v}function c(m){return m[0]}function i(m){return m[1]}function s(m,p,g){var y=new u(p??c,g??i,NaN,NaN,NaN,NaN);return m==null?y:y.addAll(m)}function u(m,p,g,y,v,x){this._x=m,this._y=p,this._x0=g,this._y0=y,this._x1=v,this._y1=x,this._root=void 0}function h(m){for(var p={data:m.data},g=p;m=m.next;)g=g.next={data:m.data};return p}var d=s.prototype=u.prototype;d.copy=function(){var m,p,g=new u(this._x,this._y,this._x0,this._y0,this._x1,this._y1),y=this._root;if(!y)return g;if(!y.length)return g._root=h(y),g;for(m=[{source:y,target:g._root=new Array(4)}];y=m.pop();)for(var v=0;v<4;++v)(p=y.source[v])&&(p.length?m.push({source:p,target:y.target[v]=new Array(4)}):y.target[v]=h(p));return g},d.add=function(m){var p=+this._x.call(null,m),g=+this._y.call(null,m);return a(this.cover(p,g),p,g,m)},d.addAll=function(m){var p,g,y,v,x=m.length,_=new Array(x),A=new Array(x),b=1/0,k=1/0,w=-1/0,M=-1/0;for(g=0;gw&&(w=y),vM&&(M=v));if(b>w||k>M)return this;for(this.cover(b,k).cover(w,M),g=0;gm||m>=v||y>p||p>=x;)switch(A=(pT||(x=b.y0)>E||(_=b.x1)=R)<<1|m>=L)&&(b=S[S.length-1],S[S.length-1]=S[S.length-1-k],S[S.length-1-k]=b)}else{var F=m-+this._x.call(null,P.data),D=p-+this._y.call(null,P.data),O=F*F+D*D;if(O=(A=(S+L)/2))?S=A:L=A,(w=_>=(b=(P+R)/2))?P=b:R=b,p=E,!(E=E[M=w<<1|k]))return this;if(!E.length)break;(p[M+1&3]||p[M+2&3]||p[M+3&3])&&(g=p,T=M)}for(;E.data!==m;)if(y=E,!(E=E.next))return this;return(v=E.next)&&delete E.next,y?(v?y.next=v:delete y.next,this):p?(v?p[M]=v:delete p[M],(E=p[0]||p[1]||p[2]||p[3])&&E===(p[3]||p[2]||p[1]||p[0])&&!E.length&&(g?g[T]=E:this._root=E),this):(this._root=v,this)},d.removeAll=function(m){for(var p=0,g=m.length;p1?0:De<-1?p:Math.acos(De)}function x(De){return De>=1?g:De<=-1?-g:Math.asin(De)}function _(De){return De.innerRadius}function A(De){return De.outerRadius}function b(De){return De.startAngle}function k(De){return De.endAngle}function w(De){return De&&De.padAngle}function M(De,Je,st,St,It,Zt,Kt,qt){var mn=st-De,Fn=St-Je,pn=Kt-It,tn=qt-Zt,nn=tn*mn-pn*Fn;if(!(nn*nn<1e-12))return[De+(nn=(pn*(Je-Zt)-tn*(De-It))/nn)*mn,Je+nn*Fn]}function T(De,Je,st,St,It,Zt,Kt){var qt=De-st,mn=Je-St,Fn=(Kt?Zt:-Zt)/m(qt*qt+mn*mn),pn=Fn*mn,tn=-Fn*qt,nn=De+pn,sn=Je+tn,gn=st+pn,bn=St+tn,In=(nn+gn)/2,qn=(sn+bn)/2,Wn=gn-nn,ar=bn-sn,Dr=Wn*Wn+ar*ar,yr=It-Zt,Sr=nn*bn-gn*sn,Kn=(ar<0?-1:1)*m(u(0,yr*yr*Dr-Sr*Sr)),Dn=(Sr*ar-Wn*Kn)/Dr,lr=(-Sr*Wn-ar*Kn)/Dr,Yr=(Sr*ar+Wn*Kn)/Dr,Mn=(-Sr*Wn+ar*Kn)/Dr,rr=Dn-In,nr=lr-qn,Bn=Yr-In,Nr=Mn-qn;return rr*rr+nr*nr>Bn*Bn+Nr*Nr&&(Dn=Yr,lr=Mn),{cx:Dn,cy:lr,x01:-pn,y01:-tn,x11:Dn*(It/yr-1),y11:lr*(It/yr-1)}}function E(De){this._context=De}function S(De){return new E(De)}function P(De){return De[0]}function L(De){return De[1]}function R(){var De=P,Je=L,st=l(!0),St=null,It=S,Zt=null;function Kt(qt){var mn,Fn,pn,tn=qt.length,nn=!1;for(St==null&&(Zt=It(pn=a.path())),mn=0;mn<=tn;++mn)!(mn=nn;--sn)qt.point(Wn[sn],ar[sn]);qt.lineEnd(),qt.areaEnd()}qn&&(Wn[tn]=+De(gn,tn,pn),ar[tn]=+st(gn,tn,pn),qt.point(Je?+Je(gn,tn,pn):Wn[tn],St?+St(gn,tn,pn):ar[tn]))}if(bn)return qt=null,bn+""||null}function Fn(){return R().defined(It).curve(Kt).context(Zt)}return mn.x=function(pn){return arguments.length?(De=typeof pn=="function"?pn:l(+pn),Je=null,mn):De},mn.x0=function(pn){return arguments.length?(De=typeof pn=="function"?pn:l(+pn),mn):De},mn.x1=function(pn){return arguments.length?(Je=pn==null?null:typeof pn=="function"?pn:l(+pn),mn):Je},mn.y=function(pn){return arguments.length?(st=typeof pn=="function"?pn:l(+pn),St=null,mn):st},mn.y0=function(pn){return arguments.length?(st=typeof pn=="function"?pn:l(+pn),mn):st},mn.y1=function(pn){return arguments.length?(St=pn==null?null:typeof pn=="function"?pn:l(+pn),mn):St},mn.lineX0=mn.lineY0=function(){return Fn().x(De).y(st)},mn.lineY1=function(){return Fn().x(De).y(St)},mn.lineX1=function(){return Fn().x(Je).y(st)},mn.defined=function(pn){return arguments.length?(It=typeof pn=="function"?pn:l(!!pn),mn):It},mn.curve=function(pn){return arguments.length?(Kt=pn,Zt!=null&&(qt=Kt(Zt)),mn):Kt},mn.context=function(pn){return arguments.length?(pn==null?Zt=qt=null:qt=Kt(Zt=pn),mn):Zt},mn}function D(De,Je){return JeDe?1:Je>=De?0:NaN}function O(De){return De}E.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(De,Je){switch(De=+De,Je=+Je,this._point){case 0:this._point=1,this._line?this._context.lineTo(De,Je):this._context.moveTo(De,Je);break;case 1:this._point=2;default:this._context.lineTo(De,Je)}}};var N=W(S);function B(De){this._curve=De}function W(De){function Je(st){return new B(De(st))}return Je._curve=De,Je}function G(De){var Je=De.curve;return De.angle=De.x,delete De.x,De.radius=De.y,delete De.y,De.curve=function(st){return arguments.length?Je(W(st)):Je()._curve},De}function K(){return G(R().curve(N))}function te(){var De=F().curve(N),Je=De.curve,st=De.lineX0,St=De.lineX1,It=De.lineY0,Zt=De.lineY1;return De.angle=De.x,delete De.x,De.startAngle=De.x0,delete De.x0,De.endAngle=De.x1,delete De.x1,De.radius=De.y,delete De.y,De.innerRadius=De.y0,delete De.y0,De.outerRadius=De.y1,delete De.y1,De.lineStartAngle=function(){return G(st())},delete De.lineX0,De.lineEndAngle=function(){return G(St())},delete De.lineX1,De.lineInnerRadius=function(){return G(It())},delete De.lineY0,De.lineOuterRadius=function(){return G(Zt())},delete De.lineY1,De.curve=function(Kt){return arguments.length?Je(W(Kt)):Je()._curve},De}function Y(De,Je){return[(Je=+Je)*Math.cos(De-=Math.PI/2),Je*Math.sin(De)]}B.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(De,Je){this._curve.point(Je*Math.sin(De),Je*-Math.cos(De))}};var J=Array.prototype.slice;function re(De){return De.source}function U(De){return De.target}function V(De){var Je=re,st=U,St=P,It=L,Zt=null;function Kt(){var qt,mn=J.call(arguments),Fn=Je.apply(this,mn),pn=st.apply(this,mn);if(Zt||(Zt=qt=a.path()),De(Zt,+St.apply(this,(mn[0]=Fn,mn)),+It.apply(this,mn),+St.apply(this,(mn[0]=pn,mn)),+It.apply(this,mn)),qt)return Zt=null,qt+""||null}return Kt.source=function(qt){return arguments.length?(Je=qt,Kt):Je},Kt.target=function(qt){return arguments.length?(st=qt,Kt):st},Kt.x=function(qt){return arguments.length?(St=typeof qt=="function"?qt:l(+qt),Kt):St},Kt.y=function(qt){return arguments.length?(It=typeof qt=="function"?qt:l(+qt),Kt):It},Kt.context=function(qt){return arguments.length?(Zt=qt??null,Kt):Zt},Kt}function H(De,Je,st,St,It){De.moveTo(Je,st),De.bezierCurveTo(Je=(Je+St)/2,st,Je,It,St,It)}function ne(De,Je,st,St,It){De.moveTo(Je,st),De.bezierCurveTo(Je,st=(st+It)/2,St,st,St,It)}function q(De,Je,st,St,It){var Zt=Y(Je,st),Kt=Y(Je,st=(st+It)/2),qt=Y(St,st),mn=Y(St,It);De.moveTo(Zt[0],Zt[1]),De.bezierCurveTo(Kt[0],Kt[1],qt[0],qt[1],mn[0],mn[1])}var Q={draw:function(De,Je){var st=Math.sqrt(Je/p);De.moveTo(st,0),De.arc(0,0,st,0,y)}},ee={draw:function(De,Je){var st=Math.sqrt(Je/5)/2;De.moveTo(-3*st,-st),De.lineTo(-st,-st),De.lineTo(-st,-3*st),De.lineTo(st,-3*st),De.lineTo(st,-st),De.lineTo(3*st,-st),De.lineTo(3*st,st),De.lineTo(st,st),De.lineTo(st,3*st),De.lineTo(-st,3*st),De.lineTo(-st,st),De.lineTo(-3*st,st),De.closePath()}},ie=Math.sqrt(1/3),ae=2*ie,ue={draw:function(De,Je){var st=Math.sqrt(Je/ae),St=st*ie;De.moveTo(0,-st),De.lineTo(St,0),De.lineTo(0,st),De.lineTo(-St,0),De.closePath()}},le=Math.sin(p/10)/Math.sin(7*p/10),ge=Math.sin(y/10)*le,fe=-Math.cos(y/10)*le,me={draw:function(De,Je){var st=Math.sqrt(.8908130915292852*Je),St=ge*st,It=fe*st;De.moveTo(0,-st),De.lineTo(St,It);for(var Zt=1;Zt<5;++Zt){var Kt=y*Zt/5,qt=Math.cos(Kt),mn=Math.sin(Kt);De.lineTo(mn*st,-qt*st),De.lineTo(qt*St-mn*It,mn*St+qt*It)}De.closePath()}},_e={draw:function(De,Je){var st=Math.sqrt(Je),St=-st/2;De.rect(St,St,st,st)}},Ae=Math.sqrt(3),ke={draw:function(De,Je){var st=-Math.sqrt(Je/(3*Ae));De.moveTo(0,2*st),De.lineTo(-Ae*st,-st),De.lineTo(Ae*st,-st),De.closePath()}},Le=-.5,de=Math.sqrt(3)/2,ve=1/Math.sqrt(12),Me=3*(ve/2+1),we={draw:function(De,Je){var st=Math.sqrt(Je/Me),St=st/2,It=st*ve,Zt=St,Kt=st*ve+st,qt=-Zt,mn=Kt;De.moveTo(St,It),De.lineTo(Zt,Kt),De.lineTo(qt,mn),De.lineTo(Le*St-de*It,de*St+Le*It),De.lineTo(Le*Zt-de*Kt,de*Zt+Le*Kt),De.lineTo(Le*qt-de*mn,de*qt+Le*mn),De.lineTo(Le*St+de*It,Le*It-de*St),De.lineTo(Le*Zt+de*Kt,Le*Kt-de*Zt),De.lineTo(Le*qt+de*mn,Le*mn-de*qt),De.closePath()}},Ce=[Q,ee,ue,_e,me,ke,we];function Fe(){}function ze(De,Je,st){De._context.bezierCurveTo((2*De._x0+De._x1)/3,(2*De._y0+De._y1)/3,(De._x0+2*De._x1)/3,(De._y0+2*De._y1)/3,(De._x0+4*De._x1+Je)/6,(De._y0+4*De._y1+st)/6)}function $e(De){this._context=De}function Ke(De){this._context=De}function Re(De){this._context=De}function Ve(De,Je){this._basis=new $e(De),this._beta=Je}$e.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:ze(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(De,Je){switch(De=+De,Je=+Je,this._point){case 0:this._point=1,this._line?this._context.lineTo(De,Je):this._context.moveTo(De,Je);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:ze(this,De,Je)}this._x0=this._x1,this._x1=De,this._y0=this._y1,this._y1=Je}},Ke.prototype={areaStart:Fe,areaEnd:Fe,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(De,Je){switch(De=+De,Je=+Je,this._point){case 0:this._point=1,this._x2=De,this._y2=Je;break;case 1:this._point=2,this._x3=De,this._y3=Je;break;case 2:this._point=3,this._x4=De,this._y4=Je,this._context.moveTo((this._x0+4*this._x1+De)/6,(this._y0+4*this._y1+Je)/6);break;default:ze(this,De,Je)}this._x0=this._x1,this._x1=De,this._y0=this._y1,this._y1=Je}},Re.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(De,Je){switch(De=+De,Je=+Je,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var st=(this._x0+4*this._x1+De)/6,St=(this._y0+4*this._y1+Je)/6;this._line?this._context.lineTo(st,St):this._context.moveTo(st,St);break;case 3:this._point=4;default:ze(this,De,Je)}this._x0=this._x1,this._x1=De,this._y0=this._y1,this._y1=Je}},Ve.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var De=this._x,Je=this._y,st=De.length-1;if(st>0)for(var St,It=De[0],Zt=Je[0],Kt=De[st]-It,qt=Je[st]-Zt,mn=-1;++mn<=st;)St=mn/st,this._basis.point(this._beta*De[mn]+(1-this._beta)*(It+St*Kt),this._beta*Je[mn]+(1-this._beta)*(Zt+St*qt));this._x=this._y=null,this._basis.lineEnd()},point:function(De,Je){this._x.push(+De),this._y.push(+Je)}};var We=function De(Je){function st(St){return Je===1?new $e(St):new Ve(St,Je)}return st.beta=function(St){return De(+St)},st}(.85);function Ye(De,Je,st){De._context.bezierCurveTo(De._x1+De._k*(De._x2-De._x0),De._y1+De._k*(De._y2-De._y0),De._x2+De._k*(De._x1-Je),De._y2+De._k*(De._y1-st),De._x2,De._y2)}function nt(De,Je){this._context=De,this._k=(1-Je)/6}nt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Ye(this,this._x1,this._y1)}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(De,Je){switch(De=+De,Je=+Je,this._point){case 0:this._point=1,this._line?this._context.lineTo(De,Je):this._context.moveTo(De,Je);break;case 1:this._point=2,this._x1=De,this._y1=Je;break;case 2:this._point=3;default:Ye(this,De,Je)}this._x0=this._x1,this._x1=this._x2,this._x2=De,this._y0=this._y1,this._y1=this._y2,this._y2=Je}};var ft=function De(Je){function st(St){return new nt(St,Je)}return st.tension=function(St){return De(+St)},st}(0);function yt(De,Je){this._context=De,this._k=(1-Je)/6}yt.prototype={areaStart:Fe,areaEnd:Fe,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(De,Je){switch(De=+De,Je=+Je,this._point){case 0:this._point=1,this._x3=De,this._y3=Je;break;case 1:this._point=2,this._context.moveTo(this._x4=De,this._y4=Je);break;case 2:this._point=3,this._x5=De,this._y5=Je;break;default:Ye(this,De,Je)}this._x0=this._x1,this._x1=this._x2,this._x2=De,this._y0=this._y1,this._y1=this._y2,this._y2=Je}};var Ot=function De(Je){function st(St){return new yt(St,Je)}return st.tension=function(St){return De(+St)},st}(0);function Tt(De,Je){this._context=De,this._k=(1-Je)/6}Tt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(De,Je){switch(De=+De,Je=+Je,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Ye(this,De,Je)}this._x0=this._x1,this._x1=this._x2,this._x2=De,this._y0=this._y1,this._y1=this._y2,this._y2=Je}};var at=function De(Je){function st(St){return new Tt(St,Je)}return st.tension=function(St){return De(+St)},st}(0);function et(De,Je,st){var St=De._x1,It=De._y1,Zt=De._x2,Kt=De._y2;if(De._l01_a>1e-12){var qt=2*De._l01_2a+3*De._l01_a*De._l12_a+De._l12_2a,mn=3*De._l01_a*(De._l01_a+De._l12_a);St=(St*qt-De._x0*De._l12_2a+De._x2*De._l01_2a)/mn,It=(It*qt-De._y0*De._l12_2a+De._y2*De._l01_2a)/mn}if(De._l23_a>1e-12){var Fn=2*De._l23_2a+3*De._l23_a*De._l12_a+De._l12_2a,pn=3*De._l23_a*(De._l23_a+De._l12_a);Zt=(Zt*Fn+De._x1*De._l23_2a-Je*De._l12_2a)/pn,Kt=(Kt*Fn+De._y1*De._l23_2a-st*De._l12_2a)/pn}De._context.bezierCurveTo(St,It,Zt,Kt,De._x2,De._y2)}function Lt(De,Je){this._context=De,this._alpha=Je}Lt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(De,Je){if(De=+De,Je=+Je,this._point){var st=this._x2-De,St=this._y2-Je;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(st*st+St*St,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(De,Je):this._context.moveTo(De,Je);break;case 1:this._point=2;break;case 2:this._point=3;default:et(this,De,Je)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=De,this._y0=this._y1,this._y1=this._y2,this._y2=Je}};var Wt=function De(Je){function st(St){return Je?new Lt(St,Je):new nt(St,0)}return st.alpha=function(St){return De(+St)},st}(.5);function Jt(De,Je){this._context=De,this._alpha=Je}Jt.prototype={areaStart:Fe,areaEnd:Fe,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(De,Je){if(De=+De,Je=+Je,this._point){var st=this._x2-De,St=this._y2-Je;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(st*st+St*St,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=De,this._y3=Je;break;case 1:this._point=2,this._context.moveTo(this._x4=De,this._y4=Je);break;case 2:this._point=3,this._x5=De,this._y5=Je;break;default:et(this,De,Je)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=De,this._y0=this._y1,this._y1=this._y2,this._y2=Je}};var Be=function De(Je){function st(St){return Je?new Jt(St,Je):new yt(St,0)}return st.alpha=function(St){return De(+St)},st}(.5);function Ge(De,Je){this._context=De,this._alpha=Je}Ge.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(De,Je){if(De=+De,Je=+Je,this._point){var st=this._x2-De,St=this._y2-Je;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(st*st+St*St,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:et(this,De,Je)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=De,this._y0=this._y1,this._y1=this._y2,this._y2=Je}};var kt=function De(Je){function st(St){return Je?new Ge(St,Je):new Tt(St,0)}return st.alpha=function(St){return De(+St)},st}(.5);function dt(De){this._context=De}function Oe(De){return De<0?-1:1}function Ie(De,Je,st){var St=De._x1-De._x0,It=Je-De._x1,Zt=(De._y1-De._y0)/(St||It<0&&-0),Kt=(st-De._y1)/(It||St<0&&-0),qt=(Zt*It+Kt*St)/(St+It);return(Oe(Zt)+Oe(Kt))*Math.min(Math.abs(Zt),Math.abs(Kt),.5*Math.abs(qt))||0}function Te(De,Je){var st=De._x1-De._x0;return st?(3*(De._y1-De._y0)/st-Je)/2:Je}function Pe(De,Je,st){var St=De._x0,It=De._y0,Zt=De._x1,Kt=De._y1,qt=(Zt-St)/3;De._context.bezierCurveTo(St+qt,It+qt*Je,Zt-qt,Kt-qt*st,Zt,Kt)}function qe(De){this._context=De}function rt(De){this._context=new lt(De)}function lt(De){this._context=De}function ot(De){this._context=De}function At(De){var Je,st,St=De.length-1,It=new Array(St),Zt=new Array(St),Kt=new Array(St);for(It[0]=0,Zt[0]=2,Kt[0]=De[0]+2*De[1],Je=1;Je=0;--Je)It[Je]=(Kt[Je]-It[Je+1])/Zt[Je];for(Zt[St-1]=(De[St]+It[St-1])/2,Je=0;Je1)for(var st,St,It,Zt=1,Kt=De[Je[0]],qt=Kt.length;Zt=0;)st[Je]=Je;return st}function tt(De,Je){return De[Je]}function bt(De){var Je=De.map(Ft);return Ut(De).sort(function(st,St){return Je[st]-Je[St]})}function Ft(De){for(var Je,st=-1,St=0,It=De.length,Zt=-1/0;++stZt&&(Zt=Je,St=st);return St}function Et(De){var Je=De.map(Pt);return Ut(De).sort(function(st,St){return Je[st]-Je[St]})}function Pt(De){for(var Je,st=0,St=-1,It=De.length;++St=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(De,Je){switch(De=+De,Je=+Je,this._point){case 0:this._point=1,this._line?this._context.lineTo(De,Je):this._context.moveTo(De,Je);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,Je),this._context.lineTo(De,Je);else{var st=this._x*(1-this._t)+De*this._t;this._context.lineTo(st,this._y),this._context.lineTo(st,Je)}}this._x=De,this._y=Je}},r.arc=function(){var De=_,Je=A,st=l(0),St=null,It=b,Zt=k,Kt=w,qt=null;function mn(){var Fn,pn,tn=+De.apply(this,arguments),nn=+Je.apply(this,arguments),sn=It.apply(this,arguments)-g,gn=Zt.apply(this,arguments)-g,bn=c(gn-sn),In=gn>sn;if(qt||(qt=Fn=a.path()),nn1e-12)if(bn>y-1e-12)qt.moveTo(nn*s(sn),nn*d(sn)),qt.arc(0,0,nn,sn,gn,!In),tn>1e-12&&(qt.moveTo(tn*s(gn),tn*d(gn)),qt.arc(0,0,tn,gn,sn,In));else{var qn,Wn,ar=sn,Dr=gn,yr=sn,Sr=gn,Kn=bn,Dn=bn,lr=Kt.apply(this,arguments)/2,Yr=lr>1e-12&&(St?+St.apply(this,arguments):m(tn*tn+nn*nn)),Mn=h(c(nn-tn)/2,+st.apply(this,arguments)),rr=Mn,nr=Mn;if(Yr>1e-12){var Bn=x(Yr/tn*d(lr)),Nr=x(Yr/nn*d(lr));(Kn-=2*Bn)>1e-12?(yr+=Bn*=In?1:-1,Sr-=Bn):(Kn=0,yr=Sr=(sn+gn)/2),(Dn-=2*Nr)>1e-12?(ar+=Nr*=In?1:-1,Dr-=Nr):(Dn=0,ar=Dr=(sn+gn)/2)}var Gr=nn*s(ar),pr=nn*d(ar),qr=tn*s(Sr),_i=tn*d(Sr);if(Mn>1e-12){var cn,jn=nn*s(Dr),jt=nn*d(Dr),fn=tn*s(yr),vn=tn*d(yr);if(bn1e-12?nr>1e-12?(qn=T(fn,vn,Gr,pr,nn,nr,In),Wn=T(jn,jt,qr,_i,nn,nr,In),qt.moveTo(qn.cx+qn.x01,qn.cy+qn.y01),nr1e-12&&Kn>1e-12?rr>1e-12?(qn=T(qr,_i,jn,jt,tn,-rr,In),Wn=T(Gr,pr,fn,vn,tn,-rr,In),qt.lineTo(qn.cx+qn.x01,qn.cy+qn.y01),rr0&&(gn+=nn);for(Je!=null?bn.sort(function(yr,Sr){return Je(In[yr],In[Sr])}):st!=null&&bn.sort(function(yr,Sr){return st(qt[yr],qt[Sr])}),mn=0,pn=gn?(Wn-sn*Dr)/gn:0;mn0?nn*pn:0)+Dr,In[Fn]={data:qt[Fn],index:mn,value:nn,startAngle:qn,endAngle:tn,padAngle:ar};return In}return Kt.value=function(qt){return arguments.length?(De=typeof qt=="function"?qt:l(+qt),Kt):De},Kt.sortValues=function(qt){return arguments.length?(Je=qt,st=null,Kt):Je},Kt.sort=function(qt){return arguments.length?(st=qt,Je=null,Kt):st},Kt.startAngle=function(qt){return arguments.length?(St=typeof qt=="function"?qt:l(+qt),Kt):St},Kt.endAngle=function(qt){return arguments.length?(It=typeof qt=="function"?qt:l(+qt),Kt):It},Kt.padAngle=function(qt){return arguments.length?(Zt=typeof qt=="function"?qt:l(+qt),Kt):Zt},Kt},r.pointRadial=Y,r.radialArea=te,r.radialLine=K,r.stack=function(){var De=l([]),Je=Ut,st=$t,St=tt;function It(Zt){var Kt,qt,mn=De.apply(this,arguments),Fn=Zt.length,pn=mn.length,tn=new Array(pn);for(Kt=0;Kt0)for(var st,St,It,Zt,Kt,qt,mn=0,Fn=De[Je[0]].length;mn0?(St[0]=Zt,St[1]=Zt+=It):It<0?(St[1]=Kt,St[0]=Kt+=It):(St[0]=0,St[1]=It)},r.stackOffsetExpand=function(De,Je){if((St=De.length)>0){for(var st,St,It,Zt=0,Kt=De[0].length;Zt0){for(var st,St=0,It=De[Je[0]],Zt=It.length;St0&&(St=(st=De[Je[0]]).length)>0){for(var st,St,It,Zt=0,Kt=1;Kt=12)]},q:function(Pt){return 1+~~(Pt.getMonth()/3)},Q:nt,s:ft,S:q,u:Q,U:ee,V:ie,w:ae,W:ue,x:null,X:null,y:le,Y:ge,Z:fe,"%":Ye},Ut={a:function(Pt){return Ge[Pt.getUTCDay()]},A:function(Pt){return Be[Pt.getUTCDay()]},b:function(Pt){return dt[Pt.getUTCMonth()]},B:function(Pt){return kt[Pt.getUTCMonth()]},c:null,d:me,e:me,f:de,H:_e,I:Ae,j:ke,L:Le,m:ve,M:Me,p:function(Pt){return Jt[+(Pt.getUTCHours()>=12)]},q:function(Pt){return 1+~~(Pt.getUTCMonth()/3)},Q:nt,s:ft,S:we,u:Ce,U:Fe,V:ze,w:$e,W:Ke,x:null,X:null,y:Re,Y:Ve,Z:We,"%":Ye},tt={a:function(Pt,De,Je){var st=qe.exec(De.slice(Je));return st?(Pt.w=rt[st[0].toLowerCase()],Je+st[0].length):-1},A:function(Pt,De,Je){var st=Te.exec(De.slice(Je));return st?(Pt.w=Pe[st[0].toLowerCase()],Je+st[0].length):-1},b:function(Pt,De,Je){var st=At.exec(De.slice(Je));return st?(Pt.m=wt[st[0].toLowerCase()],Je+st[0].length):-1},B:function(Pt,De,Je){var st=lt.exec(De.slice(Je));return st?(Pt.m=ot[st[0].toLowerCase()],Je+st[0].length):-1},c:function(Pt,De,Je){return Et(Pt,et,De,Je)},d:L,e:L,f:B,H:F,I:F,j:R,L:N,m:P,M:D,p:function(Pt,De,Je){var st=Oe.exec(De.slice(Je));return st?(Pt.p=Ie[st[0].toLowerCase()],Je+st[0].length):-1},q:S,Q:G,s:K,S:O,u:A,U:b,V:k,w:_,W:w,x:function(Pt,De,Je){return Et(Pt,Lt,De,Je)},X:function(Pt,De,Je){return Et(Pt,Wt,De,Je)},y:T,Y:M,Z:E,"%":W};function bt(Pt,De){return function(Je){var st,St,It,Zt=[],Kt=-1,qt=0,mn=Pt.length;for(Je instanceof Date||(Je=new Date(+Je));++Kt53)return null;"w"in It||(It.w=1),"Z"in It?(St=(st=c(i(It.y,0,1))).getUTCDay(),st=St>4||St===0?a.utcMonday.ceil(st):a.utcMonday(st),st=a.utcDay.offset(st,7*(It.V-1)),It.y=st.getUTCFullYear(),It.m=st.getUTCMonth(),It.d=st.getUTCDate()+(It.w+6)%7):(St=(st=l(i(It.y,0,1))).getDay(),st=St>4||St===0?a.timeMonday.ceil(st):a.timeMonday(st),st=a.timeDay.offset(st,7*(It.V-1)),It.y=st.getFullYear(),It.m=st.getMonth(),It.d=st.getDate()+(It.w+6)%7)}else("W"in It||"U"in It)&&("w"in It||(It.w="u"in It?It.u%7:"W"in It?1:0),St="Z"in It?c(i(It.y,0,1)).getUTCDay():l(i(It.y,0,1)).getDay(),It.m=0,It.d="W"in It?(It.w+6)%7+7*It.W-(St+5)%7:It.w+7*It.U-(St+6)%7);return"Z"in It?(It.H+=It.Z/100|0,It.M+=It.Z%100,c(It)):l(It)}}function Et(Pt,De,Je,st){for(var St,It,Zt=0,Kt=De.length,qt=Je.length;Zt=qt)return-1;if((St=De.charCodeAt(Zt++))===37){if(St=De.charAt(Zt++),!(It=tt[St in h?De.charAt(Zt++):St])||(st=It(Pt,Je,st))<0)return-1}else if(St!=Je.charCodeAt(st++))return-1}return st}return $t.x=bt(Lt,$t),$t.X=bt(Wt,$t),$t.c=bt(et,$t),Ut.x=bt(Lt,Ut),Ut.X=bt(Wt,Ut),Ut.c=bt(et,Ut),{format:function(Pt){var De=bt(Pt+="",$t);return De.toString=function(){return Pt},De},parse:function(Pt){var De=Ft(Pt+="",!1);return De.toString=function(){return Pt},De},utcFormat:function(Pt){var De=bt(Pt+="",Ut);return De.toString=function(){return Pt},De},utcParse:function(Pt){var De=Ft(Pt+="",!0);return De.toString=function(){return Pt},De}}}var u,h={"-":"",_:" ",0:"0"},d=/^\s*\d+/,m=/^%/,p=/[\\^$*+?|[\]().{}]/g;function g(at,et,Lt){var Wt=at<0?"-":"",Jt=(Wt?-at:at)+"",Be=Jt.length;return Wt+(Be68?1900:2e3),Lt+Wt[0].length):-1}function E(at,et,Lt){var Wt=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(et.slice(Lt,Lt+6));return Wt?(at.Z=Wt[1]?0:-(Wt[2]+(Wt[3]||"00")),Lt+Wt[0].length):-1}function S(at,et,Lt){var Wt=d.exec(et.slice(Lt,Lt+1));return Wt?(at.q=3*Wt[0]-3,Lt+Wt[0].length):-1}function P(at,et,Lt){var Wt=d.exec(et.slice(Lt,Lt+2));return Wt?(at.m=Wt[0]-1,Lt+Wt[0].length):-1}function L(at,et,Lt){var Wt=d.exec(et.slice(Lt,Lt+2));return Wt?(at.d=+Wt[0],Lt+Wt[0].length):-1}function R(at,et,Lt){var Wt=d.exec(et.slice(Lt,Lt+3));return Wt?(at.m=0,at.d=+Wt[0],Lt+Wt[0].length):-1}function F(at,et,Lt){var Wt=d.exec(et.slice(Lt,Lt+2));return Wt?(at.H=+Wt[0],Lt+Wt[0].length):-1}function D(at,et,Lt){var Wt=d.exec(et.slice(Lt,Lt+2));return Wt?(at.M=+Wt[0],Lt+Wt[0].length):-1}function O(at,et,Lt){var Wt=d.exec(et.slice(Lt,Lt+2));return Wt?(at.S=+Wt[0],Lt+Wt[0].length):-1}function N(at,et,Lt){var Wt=d.exec(et.slice(Lt,Lt+3));return Wt?(at.L=+Wt[0],Lt+Wt[0].length):-1}function B(at,et,Lt){var Wt=d.exec(et.slice(Lt,Lt+6));return Wt?(at.L=Math.floor(Wt[0]/1e3),Lt+Wt[0].length):-1}function W(at,et,Lt){var Wt=m.exec(et.slice(Lt,Lt+1));return Wt?Lt+Wt[0].length:-1}function G(at,et,Lt){var Wt=d.exec(et.slice(Lt));return Wt?(at.Q=+Wt[0],Lt+Wt[0].length):-1}function K(at,et,Lt){var Wt=d.exec(et.slice(Lt));return Wt?(at.s=+Wt[0],Lt+Wt[0].length):-1}function te(at,et){return g(at.getDate(),et,2)}function Y(at,et){return g(at.getHours(),et,2)}function J(at,et){return g(at.getHours()%12||12,et,2)}function re(at,et){return g(1+a.timeDay.count(a.timeYear(at),at),et,3)}function U(at,et){return g(at.getMilliseconds(),et,3)}function V(at,et){return U(at,et)+"000"}function H(at,et){return g(at.getMonth()+1,et,2)}function ne(at,et){return g(at.getMinutes(),et,2)}function q(at,et){return g(at.getSeconds(),et,2)}function Q(at){var et=at.getDay();return et===0?7:et}function ee(at,et){return g(a.timeSunday.count(a.timeYear(at)-1,at),et,2)}function ie(at,et){var Lt=at.getDay();return at=Lt>=4||Lt===0?a.timeThursday(at):a.timeThursday.ceil(at),g(a.timeThursday.count(a.timeYear(at),at)+(a.timeYear(at).getDay()===4),et,2)}function ae(at){return at.getDay()}function ue(at,et){return g(a.timeMonday.count(a.timeYear(at)-1,at),et,2)}function le(at,et){return g(at.getFullYear()%100,et,2)}function ge(at,et){return g(at.getFullYear()%1e4,et,4)}function fe(at){var et=at.getTimezoneOffset();return(et>0?"-":(et*=-1,"+"))+g(et/60|0,"0",2)+g(et%60,"0",2)}function me(at,et){return g(at.getUTCDate(),et,2)}function _e(at,et){return g(at.getUTCHours(),et,2)}function Ae(at,et){return g(at.getUTCHours()%12||12,et,2)}function ke(at,et){return g(1+a.utcDay.count(a.utcYear(at),at),et,3)}function Le(at,et){return g(at.getUTCMilliseconds(),et,3)}function de(at,et){return Le(at,et)+"000"}function ve(at,et){return g(at.getUTCMonth()+1,et,2)}function Me(at,et){return g(at.getUTCMinutes(),et,2)}function we(at,et){return g(at.getUTCSeconds(),et,2)}function Ce(at){var et=at.getUTCDay();return et===0?7:et}function Fe(at,et){return g(a.utcSunday.count(a.utcYear(at)-1,at),et,2)}function ze(at,et){var Lt=at.getUTCDay();return at=Lt>=4||Lt===0?a.utcThursday(at):a.utcThursday.ceil(at),g(a.utcThursday.count(a.utcYear(at),at)+(a.utcYear(at).getUTCDay()===4),et,2)}function $e(at){return at.getUTCDay()}function Ke(at,et){return g(a.utcMonday.count(a.utcYear(at)-1,at),et,2)}function Re(at,et){return g(at.getUTCFullYear()%100,et,2)}function Ve(at,et){return g(at.getUTCFullYear()%1e4,et,4)}function We(){return"+0000"}function Ye(){return"%"}function nt(at){return+at}function ft(at){return Math.floor(+at/1e3)}function yt(at){return u=s(at),r.timeFormat=u.format,r.timeParse=u.parse,r.utcFormat=u.utcFormat,r.utcParse=u.utcParse,u}yt({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});var Ot=Date.prototype.toISOString?function(at){return at.toISOString()}:r.utcFormat("%Y-%m-%dT%H:%M:%S.%LZ"),Tt=+new Date("2000-01-01T00:00:00.000Z")?function(at){var et=new Date(at);return isNaN(et)?null:et}:r.utcParse("%Y-%m-%dT%H:%M:%S.%LZ");r.isoFormat=Ot,r.isoParse=Tt,r.timeFormatDefaultLocale=yt,r.timeFormatLocale=s,Object.defineProperty(r,"__esModule",{value:!0})})},{"d3-time":121}],121:[function(t,o,f){(function(r,a){a(typeof f=="object"&&o!==void 0?f:(r=r||self).d3=r.d3||{})})(this,function(r){var a=new Date,l=new Date;function c(ve,Me,we,Ce){function Fe(ze){return ve(ze=arguments.length===0?new Date:new Date(+ze)),ze}return Fe.floor=function(ze){return ve(ze=new Date(+ze)),ze},Fe.ceil=function(ze){return ve(ze=new Date(ze-1)),Me(ze,1),ve(ze),ze},Fe.round=function(ze){var $e=Fe(ze),Ke=Fe.ceil(ze);return ze-$e0))return Ve;do Ve.push(Re=new Date(+ze)),Me(ze,Ke),ve(ze);while(Re=$e)for(;ve($e),!ze($e);)$e.setTime($e-1)},function($e,Ke){if($e>=$e)if(Ke<0)for(;++Ke<=0;)for(;Me($e,-1),!ze($e););else for(;--Ke>=0;)for(;Me($e,1),!ze($e););})},we&&(Fe.count=function(ze,$e){return a.setTime(+ze),l.setTime(+$e),ve(a),ve(l),Math.floor(we(a,l))},Fe.every=function(ze){return ze=Math.floor(ze),isFinite(ze)&&ze>0?ze>1?Fe.filter(Ce?function($e){return Ce($e)%ze==0}:function($e){return Fe.count(0,$e)%ze==0}):Fe:null}),Fe}var i=c(function(){},function(ve,Me){ve.setTime(+ve+Me)},function(ve,Me){return Me-ve});i.every=function(ve){return ve=Math.floor(ve),isFinite(ve)&&ve>0?ve>1?c(function(Me){Me.setTime(Math.floor(Me/ve)*ve)},function(Me,we){Me.setTime(+Me+we*ve)},function(Me,we){return(we-Me)/ve}):i:null};var s=i.range,u=c(function(ve){ve.setTime(ve-ve.getMilliseconds())},function(ve,Me){ve.setTime(+ve+1e3*Me)},function(ve,Me){return(Me-ve)/1e3},function(ve){return ve.getUTCSeconds()}),h=u.range,d=c(function(ve){ve.setTime(ve-ve.getMilliseconds()-1e3*ve.getSeconds())},function(ve,Me){ve.setTime(+ve+6e4*Me)},function(ve,Me){return(Me-ve)/6e4},function(ve){return ve.getMinutes()}),m=d.range,p=c(function(ve){ve.setTime(ve-ve.getMilliseconds()-1e3*ve.getSeconds()-6e4*ve.getMinutes())},function(ve,Me){ve.setTime(+ve+36e5*Me)},function(ve,Me){return(Me-ve)/36e5},function(ve){return ve.getHours()}),g=p.range,y=c(function(ve){ve.setHours(0,0,0,0)},function(ve,Me){ve.setDate(ve.getDate()+Me)},function(ve,Me){return(Me-ve-6e4*(Me.getTimezoneOffset()-ve.getTimezoneOffset()))/864e5},function(ve){return ve.getDate()-1}),v=y.range;function x(ve){return c(function(Me){Me.setDate(Me.getDate()-(Me.getDay()+7-ve)%7),Me.setHours(0,0,0,0)},function(Me,we){Me.setDate(Me.getDate()+7*we)},function(Me,we){return(we-Me-6e4*(we.getTimezoneOffset()-Me.getTimezoneOffset()))/6048e5})}var _=x(0),A=x(1),b=x(2),k=x(3),w=x(4),M=x(5),T=x(6),E=_.range,S=A.range,P=b.range,L=k.range,R=w.range,F=M.range,D=T.range,O=c(function(ve){ve.setDate(1),ve.setHours(0,0,0,0)},function(ve,Me){ve.setMonth(ve.getMonth()+Me)},function(ve,Me){return Me.getMonth()-ve.getMonth()+12*(Me.getFullYear()-ve.getFullYear())},function(ve){return ve.getMonth()}),N=O.range,B=c(function(ve){ve.setMonth(0,1),ve.setHours(0,0,0,0)},function(ve,Me){ve.setFullYear(ve.getFullYear()+Me)},function(ve,Me){return Me.getFullYear()-ve.getFullYear()},function(ve){return ve.getFullYear()});B.every=function(ve){return isFinite(ve=Math.floor(ve))&&ve>0?c(function(Me){Me.setFullYear(Math.floor(Me.getFullYear()/ve)*ve),Me.setMonth(0,1),Me.setHours(0,0,0,0)},function(Me,we){Me.setFullYear(Me.getFullYear()+we*ve)}):null};var W=B.range,G=c(function(ve){ve.setUTCSeconds(0,0)},function(ve,Me){ve.setTime(+ve+6e4*Me)},function(ve,Me){return(Me-ve)/6e4},function(ve){return ve.getUTCMinutes()}),K=G.range,te=c(function(ve){ve.setUTCMinutes(0,0,0)},function(ve,Me){ve.setTime(+ve+36e5*Me)},function(ve,Me){return(Me-ve)/36e5},function(ve){return ve.getUTCHours()}),Y=te.range,J=c(function(ve){ve.setUTCHours(0,0,0,0)},function(ve,Me){ve.setUTCDate(ve.getUTCDate()+Me)},function(ve,Me){return(Me-ve)/864e5},function(ve){return ve.getUTCDate()-1}),re=J.range;function U(ve){return c(function(Me){Me.setUTCDate(Me.getUTCDate()-(Me.getUTCDay()+7-ve)%7),Me.setUTCHours(0,0,0,0)},function(Me,we){Me.setUTCDate(Me.getUTCDate()+7*we)},function(Me,we){return(we-Me)/6048e5})}var V=U(0),H=U(1),ne=U(2),q=U(3),Q=U(4),ee=U(5),ie=U(6),ae=V.range,ue=H.range,le=ne.range,ge=q.range,fe=Q.range,me=ee.range,_e=ie.range,Ae=c(function(ve){ve.setUTCDate(1),ve.setUTCHours(0,0,0,0)},function(ve,Me){ve.setUTCMonth(ve.getUTCMonth()+Me)},function(ve,Me){return Me.getUTCMonth()-ve.getUTCMonth()+12*(Me.getUTCFullYear()-ve.getUTCFullYear())},function(ve){return ve.getUTCMonth()}),ke=Ae.range,Le=c(function(ve){ve.setUTCMonth(0,1),ve.setUTCHours(0,0,0,0)},function(ve,Me){ve.setUTCFullYear(ve.getUTCFullYear()+Me)},function(ve,Me){return Me.getUTCFullYear()-ve.getUTCFullYear()},function(ve){return ve.getUTCFullYear()});Le.every=function(ve){return isFinite(ve=Math.floor(ve))&&ve>0?c(function(Me){Me.setUTCFullYear(Math.floor(Me.getUTCFullYear()/ve)*ve),Me.setUTCMonth(0,1),Me.setUTCHours(0,0,0,0)},function(Me,we){Me.setUTCFullYear(Me.getUTCFullYear()+we*ve)}):null};var de=Le.range;r.timeDay=y,r.timeDays=v,r.timeFriday=M,r.timeFridays=F,r.timeHour=p,r.timeHours=g,r.timeInterval=c,r.timeMillisecond=i,r.timeMilliseconds=s,r.timeMinute=d,r.timeMinutes=m,r.timeMonday=A,r.timeMondays=S,r.timeMonth=O,r.timeMonths=N,r.timeSaturday=T,r.timeSaturdays=D,r.timeSecond=u,r.timeSeconds=h,r.timeSunday=_,r.timeSundays=E,r.timeThursday=w,r.timeThursdays=R,r.timeTuesday=b,r.timeTuesdays=P,r.timeWednesday=k,r.timeWednesdays=L,r.timeWeek=_,r.timeWeeks=E,r.timeYear=B,r.timeYears=W,r.utcDay=J,r.utcDays=re,r.utcFriday=ee,r.utcFridays=me,r.utcHour=te,r.utcHours=Y,r.utcMillisecond=i,r.utcMilliseconds=s,r.utcMinute=G,r.utcMinutes=K,r.utcMonday=H,r.utcMondays=ue,r.utcMonth=Ae,r.utcMonths=ke,r.utcSaturday=ie,r.utcSaturdays=_e,r.utcSecond=u,r.utcSeconds=h,r.utcSunday=V,r.utcSundays=ae,r.utcThursday=Q,r.utcThursdays=fe,r.utcTuesday=ne,r.utcTuesdays=le,r.utcWednesday=q,r.utcWednesdays=ge,r.utcWeek=V,r.utcWeeks=ae,r.utcYear=Le,r.utcYears=de,Object.defineProperty(r,"__esModule",{value:!0})})},{}],122:[function(t,o,f){arguments[4][121][0].apply(f,arguments)},{dup:121}],123:[function(t,o,f){(function(r,a){a(typeof f=="object"&&o!==void 0?f:(r=r||self).d3=r.d3||{})})(this,function(r){var a,l,c=0,i=0,s=0,u=0,h=0,d=0,m=typeof performance=="object"&&performance.now?performance:Date,p=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(w){setTimeout(w,17)};function g(){return h||(p(y),h=m.now()+d)}function y(){h=0}function v(){this._call=this._time=this._next=null}function x(w,M,T){var E=new v;return E.restart(w,M,T),E}function _(){g(),++c;for(var w,M=a;M;)(w=h-M._time)>=0&&M._call.call(null,w),M=M._next;--c}function A(){h=(u=m.now())+d,c=i=0;try{_()}finally{c=0,function(){for(var w,M,T=a,E=1/0;T;)T._call?(E>T._time&&(E=T._time),w=T,T=T._next):(M=T._next,T._next=null,T=w?w._next=M:a=M);l=w,k(E)}(),h=0}}function b(){var w=m.now(),M=w-u;M>1e3&&(d-=M,u=w)}function k(w){c||(i&&(i=clearTimeout(i)),w-h>24?(w<1/0&&(i=setTimeout(A,w-m.now()-d)),s&&(s=clearInterval(s))):(s||(u=m.now(),s=setInterval(b,1e3)),c=1,p(A)))}v.prototype=x.prototype={constructor:v,restart:function(w,M,T){if(typeof w!="function")throw new TypeError("callback is not a function");T=(T==null?g():+T)+(M==null?0:+M),this._next||l===this||(l?l._next=this:a=this,l=this),this._call=w,this._time=T,k()},stop:function(){this._call&&(this._call=null,this._time=1/0,k())}},r.interval=function(w,M,T){var E=new v,S=M;return M==null?(E.restart(w,M,T),E):(M=+M,T=T==null?g():+T,E.restart(function P(L){L+=S,E.restart(P,S+=M,T),w(L)},M,T),E)},r.now=g,r.timeout=function(w,M,T){var E=new v;return M=M==null?0:+M,E.restart(function(S){E.stop(),w(S+M)},M,T),E},r.timer=x,r.timerFlush=_,Object.defineProperty(r,"__esModule",{value:!0})})},{}],124:[function(t,o,f){o.exports=function(){for(var r=0;rd*m){var x=(v-y)/d;h[g]=1e3*x}}return h}function c(i){for(var s=[],u=i[0];u<=i[1];u++)for(var h=String.fromCharCode(u),d=i[0];d0)return function(l,c){var i,s;for(i=new Array(l),s=0;s80*D){O=B=R[0],N=W=R[1];for(var V=D;VB&&(B=G),K>W&&(W=K);te=(te=Math.max(B-O,W-N))!==0?1/te:0}return c(re,U,D,O,N,te),U}function a(R,F,D,O,N){var B,W;if(N===L(R,F,D,O)>0)for(B=F;B=F;B-=O)W=E(B,R[B],R[B+1],W);return W&&A(W,W.next)&&(S(W),W=W.next),W}function l(R,F){if(!R)return R;F||(F=R);var D,O=R;do if(D=!1,O.steiner||!A(O,O.next)&&_(O.prev,O,O.next)!==0)O=O.next;else{if(S(O),(O=F=O.prev)===O.next)break;D=!0}while(D||O!==F);return F}function c(R,F,D,O,N,B,W){if(R){!W&&B&&function(Y,J,re,U){var V=Y;do V.z===null&&(V.z=g(V.x,V.y,J,re,U)),V.prevZ=V.prev,V.nextZ=V.next,V=V.next;while(V!==Y);V.prevZ.nextZ=null,V.prevZ=null,function(H){var ne,q,Q,ee,ie,ae,ue,le,ge=1;do{for(q=H,H=null,ie=null,ae=0;q;){for(ae++,Q=q,ue=0,ne=0;ne0||le>0&&Q;)ue!==0&&(le===0||!Q||q.z<=Q.z)?(ee=q,q=q.nextZ,ue--):(ee=Q,Q=Q.nextZ,le--),ie?ie.nextZ=ee:H=ee,ee.prevZ=ie,ie=ee;q=Q}ie.nextZ=null,ge*=2}while(ae>1)}(V)}(R,O,N,B);for(var G,K,te=R;R.prev!==R.next;)if(G=R.prev,K=R.next,B?s(R,O,N,B):i(R))F.push(G.i/D),F.push(R.i/D),F.push(K.i/D),S(R),R=K.next,te=K.next;else if((R=K)===te){W?W===1?c(R=u(l(R),F,D),F,D,O,N,B,2):W===2&&h(R,F,D,O,N,B):c(l(R),F,D,O,N,B,1);break}}}function i(R){var F=R.prev,D=R,O=R.next;if(_(F,D,O)>=0)return!1;for(var N=R.next.next;N!==R.prev;){if(v(F.x,F.y,D.x,D.y,O.x,O.y,N.x,N.y)&&_(N.prev,N,N.next)>=0)return!1;N=N.next}return!0}function s(R,F,D,O){var N=R.prev,B=R,W=R.next;if(_(N,B,W)>=0)return!1;for(var G=N.xB.x?N.x>W.x?N.x:W.x:B.x>W.x?B.x:W.x,Y=N.y>B.y?N.y>W.y?N.y:W.y:B.y>W.y?B.y:W.y,J=g(G,K,F,D,O),re=g(te,Y,F,D,O),U=R.prevZ,V=R.nextZ;U&&U.z>=J&&V&&V.z<=re;){if(U!==R.prev&&U!==R.next&&v(N.x,N.y,B.x,B.y,W.x,W.y,U.x,U.y)&&_(U.prev,U,U.next)>=0||(U=U.prevZ,V!==R.prev&&V!==R.next&&v(N.x,N.y,B.x,B.y,W.x,W.y,V.x,V.y)&&_(V.prev,V,V.next)>=0))return!1;V=V.nextZ}for(;U&&U.z>=J;){if(U!==R.prev&&U!==R.next&&v(N.x,N.y,B.x,B.y,W.x,W.y,U.x,U.y)&&_(U.prev,U,U.next)>=0)return!1;U=U.prevZ}for(;V&&V.z<=re;){if(V!==R.prev&&V!==R.next&&v(N.x,N.y,B.x,B.y,W.x,W.y,V.x,V.y)&&_(V.prev,V,V.next)>=0)return!1;V=V.nextZ}return!0}function u(R,F,D){var O=R;do{var N=O.prev,B=O.next.next;!A(N,B)&&b(N,O,O.next,B)&&M(N,B)&&M(B,N)&&(F.push(N.i/D),F.push(O.i/D),F.push(B.i/D),S(O),S(O.next),O=R=B),O=O.next}while(O!==R);return l(O)}function h(R,F,D,O,N,B){var W=R;do{for(var G=W.next.next;G!==W.prev;){if(W.i!==G.i&&x(W,G)){var K=T(W,G);return W=l(W,W.next),K=l(K,K.next),c(W,F,D,O,N,B),void c(K,F,D,O,N,B)}G=G.next}W=W.next}while(W!==R)}function d(R,F){return R.x-F.x}function m(R,F){if(F=function(O,N){var B,W=N,G=O.x,K=O.y,te=-1/0;do{if(K<=W.y&&K>=W.next.y&&W.next.y!==W.y){var Y=W.x+(K-W.y)*(W.next.x-W.x)/(W.next.y-W.y);if(Y<=G&&Y>te){if(te=Y,Y===G){if(K===W.y)return W;if(K===W.next.y)return W.next}B=W.x=W.x&&W.x>=U&&G!==W.x&&v(KB.x||W.x===B.x&&p(B,W)))&&(B=W,H=J)),W=W.next;while(W!==re);return B}(R,F)){var D=T(F,R);l(F,F.next),l(D,D.next)}}function p(R,F){return _(R.prev,R,F.prev)<0&&_(F.next,R,R.next)<0}function g(R,F,D,O,N){return(R=1431655765&((R=858993459&((R=252645135&((R=16711935&((R=32767*(R-D)*N)|R<<8))|R<<4))|R<<2))|R<<1))|(F=1431655765&((F=858993459&((F=252645135&((F=16711935&((F=32767*(F-O)*N)|F<<8))|F<<4))|F<<2))|F<<1))<<1}function y(R){var F=R,D=R;do(F.x=0&&(R-W)*(O-G)-(D-W)*(F-G)>=0&&(D-W)*(B-G)-(N-W)*(O-G)>=0}function x(R,F){return R.next.i!==F.i&&R.prev.i!==F.i&&!function(D,O){var N=D;do{if(N.i!==D.i&&N.next.i!==D.i&&N.i!==O.i&&N.next.i!==O.i&&b(N,N.next,D,O))return!0;N=N.next}while(N!==D);return!1}(R,F)&&(M(R,F)&&M(F,R)&&function(D,O){var N=D,B=!1,W=(D.x+O.x)/2,G=(D.y+O.y)/2;do N.y>G!=N.next.y>G&&N.next.y!==N.y&&W<(N.next.x-N.x)*(G-N.y)/(N.next.y-N.y)+N.x&&(B=!B),N=N.next;while(N!==D);return B}(R,F)&&(_(R.prev,R,F.prev)||_(R,F.prev,F))||A(R,F)&&_(R.prev,R,R.next)>0&&_(F.prev,F,F.next)>0)}function _(R,F,D){return(F.y-R.y)*(D.x-F.x)-(F.x-R.x)*(D.y-F.y)}function A(R,F){return R.x===F.x&&R.y===F.y}function b(R,F,D,O){var N=w(_(R,F,D)),B=w(_(R,F,O)),W=w(_(D,O,R)),G=w(_(D,O,F));return N!==B&&W!==G||!(N!==0||!k(R,D,F))||!(B!==0||!k(R,O,F))||!(W!==0||!k(D,R,O))||!(G!==0||!k(D,F,O))}function k(R,F,D){return F.x<=Math.max(R.x,D.x)&&F.x>=Math.min(R.x,D.x)&&F.y<=Math.max(R.y,D.y)&&F.y>=Math.min(R.y,D.y)}function w(R){return R>0?1:R<0?-1:0}function M(R,F){return _(R.prev,R,R.next)<0?_(R,F,R.next)>=0&&_(R,R.prev,F)>=0:_(R,F,R.prev)<0||_(R,R.next,F)<0}function T(R,F){var D=new P(R.i,R.x,R.y),O=new P(F.i,F.x,F.y),N=R.next,B=F.prev;return R.next=F,F.prev=R,D.next=N,N.prev=D,O.next=D,D.prev=O,B.next=O,O.prev=B,O}function E(R,F,D,O){var N=new P(R,F,D);return O?(N.next=O.next,N.prev=O,O.next.prev=N,O.next=N):(N.prev=N,N.next=N),N}function S(R){R.next.prev=R.prev,R.prev.next=R.next,R.prevZ&&(R.prevZ.nextZ=R.nextZ),R.nextZ&&(R.nextZ.prevZ=R.prevZ)}function P(R,F,D){this.i=R,this.x=F,this.y=D,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function L(R,F,D,O){for(var N=0,B=F,W=D-O;B0&&(O+=R[N-1].length,D.holes.push(O))}return D}},{}],130:[function(t,o,f){var r=t("strongly-connected-components");o.exports=function(a,l){var c,i=[],s=[],u=[],h={},d=[];function m(b){var k,w,M=!1;for(s.push(b),u[b]=!0,k=0;k=P})})(b);for(var k,w=r(a).components.filter(function(P){return P.length>1}),M=1/0,T=0;T=55296&&k<=56319&&(E+=y[++x]),E=S?m.call(S,P,E,_):E,v?(p.value=E,g(A,_,p)):A[_]=E,++_;b=_}}if(b===void 0)for(b=c(y.length),v&&(A=new v(b)),x=0;x0?1:-1}},{}],141:[function(t,o,f){var r=t("../math/sign"),a=Math.abs,l=Math.floor;o.exports=function(c){return isNaN(c)?0:(c=Number(c))!==0&&isFinite(c)?r(c)*l(a(c)):c}},{"../math/sign":138}],142:[function(t,o,f){var r=t("./to-integer"),a=Math.max;o.exports=function(l){return a(0,r(l))}},{"./to-integer":141}],143:[function(t,o,f){var r=t("./valid-callable"),a=t("./valid-value"),l=Function.prototype.bind,c=Function.prototype.call,i=Object.keys,s=Object.prototype.propertyIsEnumerable;o.exports=function(u,h){return function(d,m){var p,g=arguments[2],y=arguments[3];return d=Object(a(d)),r(m),p=i(d),y&&p.sort(typeof y=="function"?l.call(y,d):void 0),typeof u!="function"&&(u=p[u]),c.call(u,p,function(v,x){return s.call(d,v)?c.call(m,g,d[v],v,d,x):h})}}},{"./valid-callable":160,"./valid-value":162}],144:[function(t,o,f){o.exports=t("./is-implemented")()?Object.assign:t("./shim")},{"./is-implemented":145,"./shim":146}],145:[function(t,o,f){o.exports=function(){var r,a=Object.assign;return typeof a=="function"&&(a(r={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),r.foo+r.bar+r.trzy==="razdwatrzy")}},{}],146:[function(t,o,f){var r=t("../keys"),a=t("../valid-value"),l=Math.max;o.exports=function(c,i){var s,u,h,d=l(arguments.length,2);for(c=Object(a(c)),h=function(m){try{c[m]=i[m]}catch(p){s||(s=p)}},u=1;u-1}},{}],166:[function(t,o,f){var r=Object.prototype.toString,a=r.call("");o.exports=function(l){return typeof l=="string"||l&&typeof l=="object"&&(l instanceof String||r.call(l)===a)||!1}},{}],167:[function(t,o,f){var r=Object.create(null),a=Math.random;o.exports=function(){var l;do l=a().toString(36).slice(2);while(r[l]);return l}},{}],168:[function(t,o,f){var r,a=t("es5-ext/object/set-prototype-of"),l=t("es5-ext/string/#/contains"),c=t("d"),i=t("es6-symbol"),s=t("./"),u=Object.defineProperty;r=o.exports=function(h,d){if(!(this instanceof r))throw new TypeError("Constructor requires 'new'");s.call(this,h),d=d?l.call(d,"key+value")?"key+value":l.call(d,"key")?"key":"value":"value",u(this,"__kind__",c("",d))},a&&a(r,s),delete r.prototype.constructor,r.prototype=Object.create(s.prototype,{_resolve:c(function(h){return this.__kind__==="value"?this.__list__[h]:this.__kind__==="key+value"?[h,this.__list__[h]]:h})}),u(r.prototype,i.toStringTag,c("c","Array Iterator"))},{"./":171,d:106,"es5-ext/object/set-prototype-of":157,"es5-ext/string/#/contains":163,"es6-symbol":175}],169:[function(t,o,f){var r=t("es5-ext/function/is-arguments"),a=t("es5-ext/object/valid-callable"),l=t("es5-ext/string/is-string"),c=t("./get"),i=Array.isArray,s=Function.prototype.call,u=Array.prototype.some;o.exports=function(h,d){var m,p,g,y,v,x,_,A,b=arguments[2];if(i(h)||r(h)?m="array":l(h)?m="string":h=c(h),a(d),g=function(){y=!0},m!=="array")if(m!=="string")for(p=h.next();!p.done;){if(s.call(d,b,p.value,g),y)return;p=h.next()}else for(x=h.length,v=0;v=55296&&A<=56319&&(_+=h[++v]),s.call(d,b,_,g),!y);++v);else u.call(h,function(k){return s.call(d,b,k,g),y})}},{"./get":170,"es5-ext/function/is-arguments":135,"es5-ext/object/valid-callable":160,"es5-ext/string/is-string":166}],170:[function(t,o,f){var r=t("es5-ext/function/is-arguments"),a=t("es5-ext/string/is-string"),l=t("./array"),c=t("./string"),i=t("./valid-iterable"),s=t("es6-symbol").iterator;o.exports=function(u){return typeof i(u)[s]=="function"?u[s]():r(u)?new l(u):a(u)?new c(u):new l(u)}},{"./array":168,"./string":173,"./valid-iterable":174,"es5-ext/function/is-arguments":135,"es5-ext/string/is-string":166,"es6-symbol":175}],171:[function(t,o,f){var r,a=t("es5-ext/array/#/clear"),l=t("es5-ext/object/assign"),c=t("es5-ext/object/valid-callable"),i=t("es5-ext/object/valid-value"),s=t("d"),u=t("d/auto-bind"),h=t("es6-symbol"),d=Object.defineProperty,m=Object.defineProperties;o.exports=r=function(p,g){if(!(this instanceof r))throw new TypeError("Constructor requires 'new'");m(this,{__list__:s("w",i(p)),__context__:s("w",g),__nextIndex__:s("w",0)}),g&&(c(g.on),g.on("_add",this._onAdd),g.on("_delete",this._onDelete),g.on("_clear",this._onClear))},delete r.prototype.constructor,m(r.prototype,l({_next:s(function(){var p;if(this.__list__)return this.__redo__&&(p=this.__redo__.shift())!==void 0?p:this.__nextIndex__=this.__nextIndex__||(++this.__nextIndex__,this.__redo__?(this.__redo__.forEach(function(g,y){g>=p&&(this.__redo__[y]=++g)},this),this.__redo__.push(p)):d(this,"__redo__",s("c",[p])))}),_onDelete:s(function(p){var g;p>=this.__nextIndex__||(--this.__nextIndex__,this.__redo__&&((g=this.__redo__.indexOf(p))!==-1&&this.__redo__.splice(g,1),this.__redo__.forEach(function(y,v){y>p&&(this.__redo__[v]=--y)},this)))}),_onClear:s(function(){this.__redo__&&a.call(this.__redo__),this.__nextIndex__=0})}))),d(r.prototype,h.iterator,s(function(){return this}))},{d:106,"d/auto-bind":105,"es5-ext/array/#/clear":131,"es5-ext/object/assign":144,"es5-ext/object/valid-callable":160,"es5-ext/object/valid-value":162,"es6-symbol":175}],172:[function(t,o,f){var r=t("es5-ext/function/is-arguments"),a=t("es5-ext/object/is-value"),l=t("es5-ext/string/is-string"),c=t("es6-symbol").iterator,i=Array.isArray;o.exports=function(s){return!!a(s)&&(!!i(s)||!!l(s)||!!r(s)||typeof s[c]=="function")}},{"es5-ext/function/is-arguments":135,"es5-ext/object/is-value":151,"es5-ext/string/is-string":166,"es6-symbol":175}],173:[function(t,o,f){var r,a=t("es5-ext/object/set-prototype-of"),l=t("d"),c=t("es6-symbol"),i=t("./"),s=Object.defineProperty;r=o.exports=function(u){if(!(this instanceof r))throw new TypeError("Constructor requires 'new'");u=String(u),i.call(this,u),s(this,"__length__",l("",u.length))},a&&a(r,i),delete r.prototype.constructor,r.prototype=Object.create(i.prototype,{_next:l(function(){if(this.__list__)return this.__nextIndex__=55296&&h<=56319?d+this.__list__[this.__nextIndex__++]:d})}),s(r.prototype,c.toStringTag,l("c","String Iterator"))},{"./":171,d:106,"es5-ext/object/set-prototype-of":157,"es6-symbol":175}],174:[function(t,o,f){var r=t("./is-iterable");o.exports=function(a){if(!r(a))throw new TypeError(a+" is not iterable");return a}},{"./is-iterable":172}],175:[function(t,o,f){o.exports=t("./is-implemented")()?t("ext/global-this").Symbol:t("./polyfill")},{"./is-implemented":176,"./polyfill":181,"ext/global-this":188}],176:[function(t,o,f){var r=t("ext/global-this"),a={object:!0,symbol:!0};o.exports=function(){var l,c=r.Symbol;if(typeof c!="function")return!1;l=c("test symbol");try{String(l)}catch{return!1}return!!a[typeof c.iterator]&&!!a[typeof c.toPrimitive]&&!!a[typeof c.toStringTag]}},{"ext/global-this":188}],177:[function(t,o,f){o.exports=function(r){return!!r&&(typeof r=="symbol"||!!r.constructor&&r.constructor.name==="Symbol"&&r[r.constructor.toStringTag]==="Symbol")}},{}],178:[function(t,o,f){var r=t("d"),a=Object.create,l=Object.defineProperty,c=Object.prototype,i=a(null);o.exports=function(s){for(var u,h,d=0;i[s+(d||"")];)++d;return i[s+=d||""]=!0,l(c,u="@@"+s,r.gs(null,function(m){h||(h=!0,l(this,u,r(m)),h=!1)})),u}},{d:106}],179:[function(t,o,f){var r=t("d"),a=t("ext/global-this").Symbol;o.exports=function(l){return Object.defineProperties(l,{hasInstance:r("",a&&a.hasInstance||l("hasInstance")),isConcatSpreadable:r("",a&&a.isConcatSpreadable||l("isConcatSpreadable")),iterator:r("",a&&a.iterator||l("iterator")),match:r("",a&&a.match||l("match")),replace:r("",a&&a.replace||l("replace")),search:r("",a&&a.search||l("search")),species:r("",a&&a.species||l("species")),split:r("",a&&a.split||l("split")),toPrimitive:r("",a&&a.toPrimitive||l("toPrimitive")),toStringTag:r("",a&&a.toStringTag||l("toStringTag")),unscopables:r("",a&&a.unscopables||l("unscopables"))})}},{d:106,"ext/global-this":188}],180:[function(t,o,f){var r=t("d"),a=t("../../../validate-symbol"),l=Object.create(null);o.exports=function(c){return Object.defineProperties(c,{for:r(function(i){return l[i]?l[i]:l[i]=c(String(i))}),keyFor:r(function(i){var s;for(s in a(i),l)if(l[s]===i)return s})})}},{"../../../validate-symbol":182,d:106}],181:[function(t,o,f){var r,a,l,c=t("d"),i=t("./validate-symbol"),s=t("ext/global-this").Symbol,u=t("./lib/private/generate-name"),h=t("./lib/private/setup/standard-symbols"),d=t("./lib/private/setup/symbol-registry"),m=Object.create,p=Object.defineProperties,g=Object.defineProperty;if(typeof s=="function")try{String(s()),l=!0}catch{}else s=null;a=function(y){if(this instanceof a)throw new TypeError("Symbol is not a constructor");return r(y)},o.exports=r=function y(v){var x;if(this instanceof y)throw new TypeError("Symbol is not a constructor");return l?s(v):(x=m(a.prototype),v=v===void 0?"":String(v),p(x,{__description__:c("",v),__name__:c("",u(v))}))},h(r),d(r),p(a.prototype,{constructor:c(r),toString:c("",function(){return this.__name__})}),p(r.prototype,{toString:c(function(){return"Symbol ("+i(this).__description__+")"}),valueOf:c(function(){return i(this)})}),g(r.prototype,r.toPrimitive,c("",function(){var y=i(this);return typeof y=="symbol"?y:y.toString()})),g(r.prototype,r.toStringTag,c("c","Symbol")),g(a.prototype,r.toStringTag,c("c",r.prototype[r.toStringTag])),g(a.prototype,r.toPrimitive,c("c",r.prototype[r.toPrimitive]))},{"./lib/private/generate-name":178,"./lib/private/setup/standard-symbols":179,"./lib/private/setup/symbol-registry":180,"./validate-symbol":182,d:106,"ext/global-this":188}],182:[function(t,o,f){var r=t("./is-symbol");o.exports=function(a){if(!r(a))throw new TypeError(a+" is not a symbol");return a}},{"./is-symbol":177}],183:[function(t,o,f){o.exports=t("./is-implemented")()?WeakMap:t("./polyfill")},{"./is-implemented":184,"./polyfill":186}],184:[function(t,o,f){o.exports=function(){var r,a;if(typeof WeakMap!="function")return!1;try{r=new WeakMap([[a={},"one"],[{},"two"],[{},"three"]])}catch{return!1}return String(r)==="[object WeakMap]"&&typeof r.set=="function"&&r.set({},1)===r&&typeof r.delete=="function"&&typeof r.has=="function"&&r.get(a)==="one"}},{}],185:[function(t,o,f){o.exports=typeof WeakMap=="function"&&Object.prototype.toString.call(new WeakMap)==="[object WeakMap]"},{}],186:[function(t,o,f){var r,a=t("es5-ext/object/is-value"),l=t("es5-ext/object/set-prototype-of"),c=t("es5-ext/object/valid-object"),i=t("es5-ext/object/valid-value"),s=t("es5-ext/string/random-uniq"),u=t("d"),h=t("es6-iterator/get"),d=t("es6-iterator/for-of"),m=t("es6-symbol").toStringTag,p=t("./is-native-implemented"),g=Array.isArray,y=Object.defineProperty,v=Object.prototype.hasOwnProperty,x=Object.getPrototypeOf;o.exports=r=function(){var _,A=arguments[0];if(!(this instanceof r))throw new TypeError("Constructor requires 'new'");return _=p&&l&&WeakMap!==r?l(new WeakMap,x(this)):this,a(A)&&(g(A)||(A=h(A))),y(_,"__weakMapData__",u("c","$weakMap$"+s())),A&&d(A,function(b){i(b),_.set(b[0],b[1])}),_},p&&(l&&l(r,WeakMap),r.prototype=Object.create(WeakMap.prototype,{constructor:u(r)})),Object.defineProperties(r.prototype,{delete:u(function(_){return!!v.call(c(_),this.__weakMapData__)&&(delete _[this.__weakMapData__],!0)}),get:u(function(_){if(v.call(c(_),this.__weakMapData__))return _[this.__weakMapData__]}),has:u(function(_){return v.call(c(_),this.__weakMapData__)}),set:u(function(_,A){return y(c(_),this.__weakMapData__,u("c",A)),this}),toString:u(function(){return"[object WeakMap]"})}),y(r.prototype,m,u("c","WeakMap"))},{"./is-native-implemented":185,d:106,"es5-ext/object/is-value":151,"es5-ext/object/set-prototype-of":157,"es5-ext/object/valid-object":161,"es5-ext/object/valid-value":162,"es5-ext/string/random-uniq":167,"es6-iterator/for-of":169,"es6-iterator/get":170,"es6-symbol":175}],187:[function(t,o,f){var r=function(){if(typeof self=="object"&&self)return self;if(typeof window=="object"&&window)return window;throw new Error("Unable to resolve global `this`")};o.exports=function(){if(this)return this;try{Object.defineProperty(Object.prototype,"__global__",{get:function(){return this},configurable:!0})}catch{return r()}try{return __global__||r()}finally{delete Object.prototype.__global__}}()},{}],188:[function(t,o,f){o.exports=t("./is-implemented")()?globalThis:t("./implementation")},{"./implementation":187,"./is-implemented":189}],189:[function(t,o,f){o.exports=function(){return typeof globalThis=="object"&&!!globalThis&&globalThis.Array===Array}},{}],190:[function(t,o,f){var r=t("is-string-blank");o.exports=function(a){var l=typeof a;if(l==="string"){var c=a;if((a=+a)==0&&r(c))return!1}else if(l!=="number")return!1;return a-a<1}},{"is-string-blank":237}],191:[function(t,o,f){var r=t("dtype");o.exports=function(a,l,c){if(!a)throw new TypeError("must specify data as first parameter");if(c=0|+(c||0),Array.isArray(a)&&a[0]&&typeof a[0][0]=="number"){var i,s,u,h,d=a[0].length,m=a.length*d;l&&typeof l!="string"||(l=new(r(l||"float32"))(m+c));var p=l.length-c;if(m!==p)throw new Error("source length "+m+" ("+d+"x"+a.length+") does not match destination length "+p);for(i=0,u=c;ic[0]-u[0]/2&&(y=u[0]/2,v+=u[1]);return i}},{"css-font/stringify":102}],193:[function(t,o,f){function r(i,s){s||(s={}),(typeof i=="string"||Array.isArray(i))&&(s.family=i);var u=Array.isArray(s.family)?s.family.join(", "):s.family;if(!u)throw Error("`family` must be defined");var h=s.size||s.fontSize||s.em||48,d=s.weight||s.fontWeight||"",m=(i=[s.style||s.fontStyle||"",d,h].join(" ")+"px "+u,s.origin||"top");if(r.cache[u]&&h<=r.cache[u].em)return a(r.cache[u],m);var p=s.canvas||r.canvas,g=p.getContext("2d"),y={upper:s.upper!==void 0?s.upper:"H",lower:s.lower!==void 0?s.lower:"x",descent:s.descent!==void 0?s.descent:"p",ascent:s.ascent!==void 0?s.ascent:"h",tittle:s.tittle!==void 0?s.tittle:"i",overshoot:s.overshoot!==void 0?s.overshoot:"O"},v=Math.ceil(1.5*h);p.height=v,p.width=.5*v,g.font=i;var x={top:0};g.clearRect(0,0,v,v),g.textBaseline="top",g.fillStyle="black",g.fillText("H",0,0);var _=l(g.getImageData(0,0,v,v));g.clearRect(0,0,v,v),g.textBaseline="bottom",g.fillText("H",0,v);var A=l(g.getImageData(0,0,v,v));x.lineHeight=x.bottom=v-A+_,g.clearRect(0,0,v,v),g.textBaseline="alphabetic",g.fillText("H",0,v);var b=v-l(g.getImageData(0,0,v,v))-1+_;x.baseline=x.alphabetic=b,g.clearRect(0,0,v,v),g.textBaseline="middle",g.fillText("H",0,.5*v);var k=l(g.getImageData(0,0,v,v));x.median=x.middle=v-k-1+_-.5*v,g.clearRect(0,0,v,v),g.textBaseline="hanging",g.fillText("H",0,.5*v);var w=l(g.getImageData(0,0,v,v));x.hanging=v-w-1+_-.5*v,g.clearRect(0,0,v,v),g.textBaseline="ideographic",g.fillText("H",0,v);var M=l(g.getImageData(0,0,v,v));if(x.ideographic=v-M-1+_,y.upper&&(g.clearRect(0,0,v,v),g.textBaseline="top",g.fillText(y.upper,0,0),x.upper=l(g.getImageData(0,0,v,v)),x.capHeight=x.baseline-x.upper),y.lower&&(g.clearRect(0,0,v,v),g.textBaseline="top",g.fillText(y.lower,0,0),x.lower=l(g.getImageData(0,0,v,v)),x.xHeight=x.baseline-x.lower),y.tittle&&(g.clearRect(0,0,v,v),g.textBaseline="top",g.fillText(y.tittle,0,0),x.tittle=l(g.getImageData(0,0,v,v))),y.ascent&&(g.clearRect(0,0,v,v),g.textBaseline="top",g.fillText(y.ascent,0,0),x.ascent=l(g.getImageData(0,0,v,v))),y.descent&&(g.clearRect(0,0,v,v),g.textBaseline="top",g.fillText(y.descent,0,0),x.descent=c(g.getImageData(0,0,v,v))),y.overshoot){g.clearRect(0,0,v,v),g.textBaseline="top",g.fillText(y.overshoot,0,0);var T=c(g.getImageData(0,0,v,v));x.overshoot=T-b}for(var E in x)x[E]/=h;return x.em=h,r.cache[u]=x,a(x,m)}function a(i,s){var u={};for(var h in typeof s=="string"&&(s=i[s]),i)h!=="em"&&(u[h]=i[h]-s);return u}function l(i){for(var s=i.height,u=i.data,h=3;h0;h-=4)if(u[h]!==0)return Math.floor(.25*(h-3)/s)}o.exports=r,r.canvas=document.createElement("canvas"),r.cache={}},{}],194:[function(t,o,f){o.exports=function(r,a){if(typeof r!="string")throw new TypeError("must specify type string");if(a=a||{},typeof document>"u"&&!a.canvas)return null;var l=a.canvas||document.createElement("canvas");typeof a.width=="number"&&(l.width=a.width),typeof a.height=="number"&&(l.height=a.height);var c,i=a;try{var s=[r];r.indexOf("webgl")===0&&s.push("experimental-"+r);for(var u=0;u halfCharStep + halfCharWidth || - floor(uv.x) < halfCharStep - halfCharWidth) return; - - uv += charId * charStep; - uv = uv / atlasSize; - - vec4 color = fontColor; - vec4 mask = texture2D(atlas, uv); - - float maskY = lightness(mask); - // float colorY = lightness(color); - color.a *= maskY; - color.a *= opacity; - - // color.a += .1; - - // antialiasing, see yiq color space y-channel formula - // color.rgb += (1. - color.rgb) * (1. - mask.rgb); - - gl_FragColor = color; - }`});return{regl:T,draw:E,atlas:{}}},M.prototype.update=function(T){var E=this;if(typeof T=="string")T={text:T};else if(!T)return;(T=a(T,{position:"position positions coord coords coordinates",font:"font fontFace fontface typeface cssFont css-font family fontFamily",fontSize:"fontSize fontsize size font-size",text:"text texts chars characters value values symbols",align:"align alignment textAlign textbaseline",baseline:"baseline textBaseline textbaseline",direction:"dir direction textDirection",color:"color colour fill fill-color fillColor textColor textcolor",kerning:"kerning kern",range:"range dataBox",viewport:"vp viewport viewBox viewbox viewPort",opacity:"opacity alpha transparency visible visibility opaque",offset:"offset positionOffset padding shift indent indentation"},!0)).opacity!=null&&(Array.isArray(T.opacity)?this.opacity=T.opacity.map(function(ve){return parseFloat(ve)}):this.opacity=parseFloat(T.opacity)),T.viewport!=null&&(this.viewport=d(T.viewport),this.viewportArray=[this.viewport.x,this.viewport.y,this.viewport.width,this.viewport.height]),this.viewport==null&&(this.viewport={x:0,y:0,width:this.gl.drawingBufferWidth,height:this.gl.drawingBufferHeight},this.viewportArray=[this.viewport.x,this.viewport.y,this.viewport.width,this.viewport.height]),T.kerning!=null&&(this.kerning=T.kerning),T.offset!=null&&(typeof T.offset=="number"&&(T.offset=[T.offset,0]),this.positionOffset=_(T.offset)),T.direction&&(this.direction=T.direction),T.range&&(this.range=T.range,this.scale=[1/(T.range[2]-T.range[0]),1/(T.range[3]-T.range[1])],this.translate=[-T.range[0],-T.range[1]]),T.scale&&(this.scale=T.scale),T.translate&&(this.translate=T.translate),this.scale||(this.scale=[1/this.viewport.width,1/this.viewport.height]),this.translate||(this.translate=[0,0]),this.font.length||T.font||(T.font=M.baseFontSize+"px sans-serif");var S,P=!1,L=!1;if(T.font&&(Array.isArray(T.font)?T.font:[T.font]).forEach(function(ve,Me){if(typeof ve=="string")try{ve=r.parse(ve)}catch{ve=r.parse(M.baseFontSize+"px "+ve)}else ve=r.parse(r.stringify(ve));var we=r.stringify({size:M.baseFontSize,family:ve.family,stretch:k?ve.stretch:void 0,variant:ve.variant,weight:ve.weight,style:ve.style}),Ce=p(ve.size),Fe=Math.round(Ce[0]*g(Ce[1]));if(Fe!==E.fontSize[Me]&&(L=!0,E.fontSize[Me]=Fe),!(E.font[Me]&&we==E.font[Me].baseString||(P=!0,E.font[Me]=M.fonts[we],E.font[Me]))){var ze=ve.family.join(", "),$e=[ve.style];ve.style!=ve.variant&&$e.push(ve.variant),ve.variant!=ve.weight&&$e.push(ve.weight),k&&ve.weight!=ve.stretch&&$e.push(ve.stretch),E.font[Me]={baseString:we,family:ze,weight:ve.weight,stretch:ve.stretch,style:ve.style,variant:ve.variant,width:{},kerning:{},metrics:x(ze,{origin:"top",fontSize:M.baseFontSize,fontStyle:$e.join(" ")})},M.fonts[we]=E.font[Me]}}),(P||L)&&this.font.forEach(function(ve,Me){var we=r.stringify({size:E.fontSize[Me],family:ve.family,stretch:k?ve.stretch:void 0,variant:ve.variant,weight:ve.weight,style:ve.style});if(E.fontAtlas[Me]=E.shader.atlas[we],!E.fontAtlas[Me]){var Ce=ve.metrics;E.shader.atlas[we]=E.fontAtlas[Me]={fontString:we,step:2*Math.ceil(E.fontSize[Me]*Ce.bottom*.5),em:E.fontSize[Me],cols:0,rows:0,height:0,width:0,chars:[],ids:{},texture:E.regl.texture()}}T.text==null&&(T.text=E.text)}),typeof T.text=="string"&&T.position&&T.position.length>2){for(var R=Array(.5*T.position.length),F=0;F2){for(var O=!T.position[0].length,N=h.mallocFloat(2*this.count),B=0,W=0;B1?E.align[Me]:E.align[0]:E.align;if(typeof we=="number")return we;switch(we){case"right":case"end":return-ve;case"center":case"centre":case"middle":return .5*-ve}return 0})),this.baseline==null&&T.baseline==null&&(T.baseline=0),T.baseline!=null&&(this.baseline=T.baseline,Array.isArray(this.baseline)||(this.baseline=[this.baseline]),this.baselineOffset=this.baseline.map(function(ve,Me){var we=(E.font[Me]||E.font[0]).metrics,Ce=0;return Ce+=.5*we.bottom,Ce+=typeof ve=="number"?ve-we.baseline:-we[ve],Ce*=-1})),T.color!=null)if(T.color||(T.color="transparent"),typeof T.color!="string"&&isNaN(T.color)){var ge;if(typeof T.color[0]=="number"&&T.color.length>this.counts.length){var fe=T.color.length;ge=h.mallocUint8(fe);for(var me=(T.color.subarray||T.color.slice).bind(T.color),_e=0;_e4||this.baselineOffset.length>1||this.align&&this.align.length>1||this.fontAtlas.length>1||this.positionOffset.length>2){var Le=Math.max(.5*this.position.length||0,.25*this.color.length||0,this.baselineOffset.length||0,this.alignOffset.length||0,this.font.length||0,this.opacity.length||0,.5*this.positionOffset.length||0);this.batch=Array(Le);for(var de=0;de1?this.counts[de]:this.counts[0],offset:this.textOffsets.length>1?this.textOffsets[de]:this.textOffsets[0],color:this.color?this.color.length<=4?this.color:this.color.subarray(4*de,4*de+4):[0,0,0,255],opacity:Array.isArray(this.opacity)?this.opacity[de]:this.opacity,baseline:this.baselineOffset[de]!=null?this.baselineOffset[de]:this.baselineOffset[0],align:this.align?this.alignOffset[de]!=null?this.alignOffset[de]:this.alignOffset[0]:0,atlas:this.fontAtlas[de]||this.fontAtlas[0],positionOffset:this.positionOffset.length>2?this.positionOffset.subarray(2*de,2*de+2):this.positionOffset}}else this.count?this.batch=[{count:this.count,offset:0,color:this.color||[0,0,0,255],opacity:Array.isArray(this.opacity)?this.opacity[0]:this.opacity,baseline:this.baselineOffset[0],align:this.alignOffset?this.alignOffset[0]:0,atlas:this.fontAtlas[0],positionOffset:this.positionOffset}]:this.batch=[]},M.prototype.destroy=function(){},M.prototype.kerning=!0,M.prototype.position={constant:new Float32Array(2)},M.prototype.translate=null,M.prototype.scale=null,M.prototype.font=null,M.prototype.text="",M.prototype.positionOffset=[0,0],M.prototype.opacity=1,M.prototype.color=new Uint8Array([0,0,0,255]),M.prototype.alignOffset=[0,0],M.maxAtlasSize=1024,M.atlasCanvas=document.createElement("canvas"),M.atlasContext=M.atlasCanvas.getContext("2d",{alpha:!1}),M.baseFontSize=64,M.fonts={},o.exports=M},{"bit-twiddle":81,"color-normalize":89,"css-font":99,"detect-kerning":125,"es6-weak-map":183,"flatten-vertex-data":191,"font-atlas":192,"font-measure":193,"gl-util/context":226,"is-plain-obj":236,"object-assign":247,"parse-rect":249,"parse-unit":251,"pick-by-alias":253,regl:283,"to-px":314,"typedarray-pool":327}],226:[function(t,o,f){(function(r){(function(){var a=t("pick-by-alias");function l(s){if(s.container)if(s.container==document.body)document.body.style.width||(s.canvas.width=s.width||s.pixelRatio*r.innerWidth),document.body.style.height||(s.canvas.height=s.height||s.pixelRatio*r.innerHeight);else{var u=s.container.getBoundingClientRect();s.canvas.width=s.width||u.right-u.left,s.canvas.height=s.height||u.bottom-u.top}}function c(s){return typeof s.getContext=="function"&&"width"in s&&"height"in s}function i(){var s=document.createElement("canvas");return s.style.position="absolute",s.style.top=0,s.style.left=0,s}o.exports=function(s){var u;if(s?typeof s=="string"&&(s={container:s}):s={},c(s)?s={container:s}:s=typeof(u=s).nodeName=="string"&&typeof u.appendChild=="function"&&typeof u.getBoundingClientRect=="function"?{container:s}:function(d){return typeof d.drawArrays=="function"||typeof d.drawElements=="function"}(s)?{gl:s}:a(s,{container:"container target element el canvas holder parent parentNode wrapper use ref root node",gl:"gl context webgl glContext",attrs:"attributes attrs contextAttributes",pixelRatio:"pixelRatio pxRatio px ratio pxratio pixelratio",width:"w width",height:"h height"},!0),s.pixelRatio||(s.pixelRatio=r.pixelRatio||1),s.gl)return s.gl;if(s.canvas&&(s.container=s.canvas.parentNode),s.container){if(typeof s.container=="string"){var h=document.querySelector(s.container);if(!h)throw Error("Element "+s.container+" is not found");s.container=h}c(s.container)?(s.canvas=s.container,s.container=s.canvas.parentNode):s.canvas||(s.canvas=i(),s.container.appendChild(s.canvas),l(s))}else if(!s.canvas){if(typeof document>"u")throw Error("Not DOM environment. Use headless-gl.");s.container=document.body||document.documentElement,s.canvas=i(),s.container.appendChild(s.canvas),l(s)}return s.gl||["webgl","experimental-webgl","webgl-experimental"].some(function(d){try{s.gl=s.canvas.getContext(d,s.attrs)}catch{}return s.gl}),s.gl}}).call(this)}).call(this,typeof jo<"u"?jo:typeof self<"u"?self:typeof window<"u"?window:{})},{"pick-by-alias":253}],227:[function(t,o,f){o.exports=function(r){typeof r=="string"&&(r=[r]);for(var a=[].slice.call(arguments,1),l=[],c=0;c>1,p=-7,g=l?i-1:0,y=l?-1:1,v=r[a+g];for(g+=y,s=v&(1<<-p)-1,v>>=-p,p+=h;p>0;s=256*s+r[a+g],g+=y,p-=8);for(u=s&(1<<-p)-1,s>>=-p,p+=c;p>0;u=256*u+r[a+g],g+=y,p-=8);if(s===0)s=1-m;else{if(s===d)return u?NaN:1/0*(v?-1:1);u+=Math.pow(2,c),s-=m}return(v?-1:1)*u*Math.pow(2,s-c)},f.write=function(r,a,l,c,i,s){var u,h,d,m=8*s-i-1,p=(1<>1,y=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,v=c?0:s-1,x=c?1:-1,_=a<0||a===0&&1/a<0?1:0;for(a=Math.abs(a),isNaN(a)||a===1/0?(h=isNaN(a)?1:0,u=p):(u=Math.floor(Math.log(a)/Math.LN2),a*(d=Math.pow(2,-u))<1&&(u--,d*=2),(a+=u+g>=1?y/d:y*Math.pow(2,1-g))*d>=2&&(u++,d/=2),u+g>=p?(h=0,u=p):u+g>=1?(h=(a*d-1)*Math.pow(2,i),u+=g):(h=a*Math.pow(2,g-1)*Math.pow(2,i),u=0));i>=8;r[l+v]=255&h,v+=x,h/=256,i-=8);for(u=u<0;r[l+v]=255&u,v+=x,u/=256,m-=8);r[l+v-x]|=128*_}},{}],231:[function(t,o,f){typeof Object.create=="function"?o.exports=function(r,a){a&&(r.super_=a,r.prototype=Object.create(a.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}))}:o.exports=function(r,a){if(a){r.super_=a;var l=function(){};l.prototype=a.prototype,r.prototype=new l,r.prototype.constructor=r}}},{}],232:[function(t,o,f){o.exports=!0},{}],233:[function(t,o,f){o.exports=typeof navigator<"u"&&(/MSIE/.test(navigator.userAgent)||/Trident\//.test(navigator.appVersion))},{}],234:[function(t,o,f){o.exports=l,o.exports.isMobile=l,o.exports.default=l;var r=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,a=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino|android|ipad|playbook|silk/i;function l(c){c||(c={});var i=c.ua;if(i||typeof navigator>"u"||(i=navigator.userAgent),i&&i.headers&&typeof i.headers["user-agent"]=="string"&&(i=i.headers["user-agent"]),typeof i!="string")return!1;var s=c.tablet?a.test(i):r.test(i);return!s&&c.tablet&&c.featureDetect&&navigator&&navigator.maxTouchPoints>1&&i.indexOf("Macintosh")!==-1&&i.indexOf("Safari")!==-1&&(s=!0),s}},{}],235:[function(t,o,f){o.exports=function(r){var a=typeof r;return r!==null&&(a==="object"||a==="function")}},{}],236:[function(t,o,f){var r=Object.prototype.toString;o.exports=function(a){var l;return r.call(a)==="[object Object]"&&((l=Object.getPrototypeOf(a))===null||l===Object.getPrototypeOf({}))}},{}],237:[function(t,o,f){o.exports=function(r){for(var a,l=r.length,c=0;c13)&&a!==32&&a!==133&&a!==160&&a!==5760&&a!==6158&&(a<8192||a>8205)&&a!==8232&&a!==8233&&a!==8239&&a!==8287&&a!==8288&&a!==12288&&a!==65279)return!1;return!0}},{}],238:[function(t,o,f){o.exports=function(r){return typeof r=="string"&&(r=r.trim(),!!(/^[mzlhvcsqta]\s*[-+.0-9][^mlhvzcsqta]+/i.test(r)&&/[\dz]$/i.test(r)&&r.length>4))}},{}],239:[function(t,o,f){(function(r,a){typeof f=="object"&&o!==void 0?o.exports=a():(r=r||self).mapboxgl=a()})(this,function(){var r,a,l;function c(i,s){if(r)if(a){var u="var sharedChunk = {}; ("+r+")(sharedChunk); ("+a+")(sharedChunk);",h={};r(h),(l=s(h)).workerUrl=window.URL.createObjectURL(new Blob([u],{type:"text/javascript"}))}else a=s;else r=s}return c(0,function(i){function s(C,z){return C(z={exports:{}},z.exports),z.exports}var u=h;function h(C,z,Z,oe){this.cx=3*C,this.bx=3*(Z-C)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*z,this.by=3*(oe-z)-this.cy,this.ay=1-this.cy-this.by,this.p1x=C,this.p1y=oe,this.p2x=Z,this.p2y=oe}h.prototype.sampleCurveX=function(C){return((this.ax*C+this.bx)*C+this.cx)*C},h.prototype.sampleCurveY=function(C){return((this.ay*C+this.by)*C+this.cy)*C},h.prototype.sampleCurveDerivativeX=function(C){return(3*this.ax*C+2*this.bx)*C+this.cx},h.prototype.solveCurveX=function(C,z){var Z,oe,pe,xe,Se;for(z===void 0&&(z=1e-6),pe=C,Se=0;Se<8;Se++){if(xe=this.sampleCurveX(pe)-C,Math.abs(xe)(oe=1))return oe;for(;Zxe?Z=pe:oe=pe,pe=.5*(oe-Z)+Z}return pe},h.prototype.solve=function(C,z){return this.sampleCurveY(this.solveCurveX(C,z))};var d=m;function m(C,z){this.x=C,this.y=z}function p(C,z,Z,oe){var pe=new u(C,z,Z,oe);return function(xe){return pe.solve(xe)}}m.prototype={clone:function(){return new m(this.x,this.y)},add:function(C){return this.clone()._add(C)},sub:function(C){return this.clone()._sub(C)},multByPoint:function(C){return this.clone()._multByPoint(C)},divByPoint:function(C){return this.clone()._divByPoint(C)},mult:function(C){return this.clone()._mult(C)},div:function(C){return this.clone()._div(C)},rotate:function(C){return this.clone()._rotate(C)},rotateAround:function(C,z){return this.clone()._rotateAround(C,z)},matMult:function(C){return this.clone()._matMult(C)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(C){return this.x===C.x&&this.y===C.y},dist:function(C){return Math.sqrt(this.distSqr(C))},distSqr:function(C){var z=C.x-this.x,Z=C.y-this.y;return z*z+Z*Z},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(C){return Math.atan2(this.y-C.y,this.x-C.x)},angleWith:function(C){return this.angleWithSep(C.x,C.y)},angleWithSep:function(C,z){return Math.atan2(this.x*z-this.y*C,this.x*C+this.y*z)},_matMult:function(C){var z=C[0]*this.x+C[1]*this.y,Z=C[2]*this.x+C[3]*this.y;return this.x=z,this.y=Z,this},_add:function(C){return this.x+=C.x,this.y+=C.y,this},_sub:function(C){return this.x-=C.x,this.y-=C.y,this},_mult:function(C){return this.x*=C,this.y*=C,this},_div:function(C){return this.x/=C,this.y/=C,this},_multByPoint:function(C){return this.x*=C.x,this.y*=C.y,this},_divByPoint:function(C){return this.x/=C.x,this.y/=C.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var C=this.y;return this.y=this.x,this.x=-C,this},_rotate:function(C){var z=Math.cos(C),Z=Math.sin(C),oe=z*this.x-Z*this.y,pe=Z*this.x+z*this.y;return this.x=oe,this.y=pe,this},_rotateAround:function(C,z){var Z=Math.cos(C),oe=Math.sin(C),pe=z.x+Z*(this.x-z.x)-oe*(this.y-z.y),xe=z.y+oe*(this.x-z.x)+Z*(this.y-z.y);return this.x=pe,this.y=xe,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},m.convert=function(C){return C instanceof m?C:Array.isArray(C)?new m(C[0],C[1]):C};var g=p(.25,.1,.25,1);function y(C,z,Z){return Math.min(Z,Math.max(z,C))}function v(C,z,Z){var oe=Z-z,pe=((C-z)%oe+oe)%oe+z;return pe===z?Z:pe}function x(C){for(var z=[],Z=arguments.length-1;Z-- >0;)z[Z]=arguments[Z+1];for(var oe=0,pe=z;oe>z/4).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,C)}()}function k(C){return!!C&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(C)}function w(C,z){C.forEach(function(Z){z[Z]&&(z[Z]=z[Z].bind(z))})}function M(C,z){return C.indexOf(z,C.length-z.length)!==-1}function T(C,z,Z){var oe={};for(var pe in C)oe[pe]=z.call(Z||this,C[pe],pe,C);return oe}function E(C,z,Z){var oe={};for(var pe in C)z.call(Z||this,C[pe],pe,C)&&(oe[pe]=C[pe]);return oe}function S(C){return Array.isArray(C)?C.map(S):typeof C=="object"&&C?T(C,S):C}var P={};function L(C){P[C]||(typeof console<"u"&&console.warn(C),P[C]=!0)}function R(C,z,Z){return(Z.y-C.y)*(z.x-C.x)>(z.y-C.y)*(Z.x-C.x)}function F(C){for(var z=0,Z=0,oe=C.length,pe=oe-1,xe=void 0,Se=void 0;Z@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,function(oe,pe,xe,Se){var Ne=xe||Se;return z[pe]=!Ne||Ne.toLowerCase(),""}),z["max-age"]){var Z=parseInt(z["max-age"],10);isNaN(Z)?delete z["max-age"]:z["max-age"]=Z}return z}var N=null;function B(C){if(N==null){var z=C.navigator?C.navigator.userAgent:null;N=!!C.safari||!(!z||!(/\b(iPad|iPhone|iPod)\b/.test(z)||z.match("Safari")&&!z.match("Chrome")))}return N}function W(C){try{var z=self[C];return z.setItem("_mapbox_test_",1),z.removeItem("_mapbox_test_"),!0}catch{return!1}}var G,K,te,Y,J=self.performance&&self.performance.now?self.performance.now.bind(self.performance):Date.now.bind(Date),re=self.requestAnimationFrame||self.mozRequestAnimationFrame||self.webkitRequestAnimationFrame||self.msRequestAnimationFrame,U=self.cancelAnimationFrame||self.mozCancelAnimationFrame||self.webkitCancelAnimationFrame||self.msCancelAnimationFrame,V={now:J,frame:function(C){var z=re(C);return{cancel:function(){return U(z)}}},getImageData:function(C,z){z===void 0&&(z=0);var Z=self.document.createElement("canvas"),oe=Z.getContext("2d");if(!oe)throw new Error("failed to create canvas 2d context");return Z.width=C.width,Z.height=C.height,oe.drawImage(C,0,0,C.width,C.height),oe.getImageData(-z,-z,C.width+2*z,C.height+2*z)},resolveURL:function(C){return G||(G=self.document.createElement("a")),G.href=C,G.href},hardwareConcurrency:self.navigator.hardwareConcurrency||4,get devicePixelRatio(){return self.devicePixelRatio},get prefersReducedMotion(){return!!self.matchMedia&&(K==null&&(K=self.matchMedia("(prefers-reduced-motion: reduce)")),K.matches)}},H={API_URL:"https://api.mapbox.com",get EVENTS_URL(){return this.API_URL?this.API_URL.indexOf("https://api.mapbox.cn")===0?"https://events.mapbox.cn/events/v2":this.API_URL.indexOf("https://api.mapbox.com")===0?"https://events.mapbox.com/events/v2":null:null},FEEDBACK_URL:"https://apps.mapbox.com/feedback",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,MAX_PARALLEL_IMAGE_REQUESTS:16},ne={supported:!1,testSupport:function(C){q||!Y||(Q?ee(C):te=C)}},q=!1,Q=!1;function ee(C){var z=C.createTexture();C.bindTexture(C.TEXTURE_2D,z);try{if(C.texImage2D(C.TEXTURE_2D,0,C.RGBA,C.RGBA,C.UNSIGNED_BYTE,Y),C.isContextLost())return;ne.supported=!0}catch{}C.deleteTexture(z),q=!0}self.document&&((Y=self.document.createElement("img")).onload=function(){te&&ee(te),te=null,Q=!0},Y.onerror=function(){q=!0,te=null},Y.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");var ie="01",ae=function(C,z){this._transformRequestFn=C,this._customAccessToken=z,this._createSkuToken()};function ue(C){return C.indexOf("mapbox:")===0}ae.prototype._createSkuToken=function(){var C=function(){for(var z="",Z=0;Z<10;Z++)z+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",ie,z].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=C.token,this._skuTokenExpiresAt=C.tokenExpiresAt},ae.prototype._isSkuTokenExpired=function(){return Date.now()>this._skuTokenExpiresAt},ae.prototype.transformRequest=function(C,z){return this._transformRequestFn&&this._transformRequestFn(C,z)||{url:C}},ae.prototype.normalizeStyleURL=function(C,z){if(!ue(C))return C;var Z=me(C);return Z.path="/styles/v1"+Z.path,this._makeAPIURL(Z,this._customAccessToken||z)},ae.prototype.normalizeGlyphsURL=function(C,z){if(!ue(C))return C;var Z=me(C);return Z.path="/fonts/v1"+Z.path,this._makeAPIURL(Z,this._customAccessToken||z)},ae.prototype.normalizeSourceURL=function(C,z){if(!ue(C))return C;var Z=me(C);return Z.path="/v4/"+Z.authority+".json",Z.params.push("secure"),this._makeAPIURL(Z,this._customAccessToken||z)},ae.prototype.normalizeSpriteURL=function(C,z,Z,oe){var pe=me(C);return ue(C)?(pe.path="/styles/v1"+pe.path+"/sprite"+z+Z,this._makeAPIURL(pe,this._customAccessToken||oe)):(pe.path+=""+z+Z,_e(pe))},ae.prototype.normalizeTileURL=function(C,z){if(this._isSkuTokenExpired()&&this._createSkuToken(),C&&!ue(C))return C;var Z=me(C),oe=V.devicePixelRatio>=2||z===512?"@2x":"",pe=ne.supported?".webp":"$1";Z.path=Z.path.replace(/(\.(png|jpg)\d*)(?=$)/,""+oe+pe),Z.path=Z.path.replace(/^.+\/v4\//,"/"),Z.path="/v4"+Z.path;var xe=this._customAccessToken||function(Se){for(var Ne=0,Ze=Se;Ne=1&&self.localStorage.setItem(z,JSON.stringify(this.eventData))}catch{L("Unable to write to LocalStorage")}},ke.prototype.processRequests=function(C){},ke.prototype.postEvent=function(C,z,Z,oe){var pe=this;if(H.EVENTS_URL){var xe=me(H.EVENTS_URL);xe.params.push("access_token="+(oe||H.ACCESS_TOKEN||""));var Se={event:this.type,created:new Date(C).toISOString(),sdkIdentifier:"mapbox-gl-js",sdkVersion:"1.10.1",skuId:ie,userId:this.anonId},Ne=z?x(Se,z):Se,Ze={url:_e(xe),headers:{"Content-Type":"text/plain"},body:JSON.stringify([Ne])};this.pendingRequest=Wt(Ze,function(ct){pe.pendingRequest=null,Z(ct),pe.saveEventData(),pe.processRequests(oe)})}},ke.prototype.queueRequest=function(C,z){this.queue.push(C),this.processRequests(z)};var Le,de,ve=function(C){function z(){C.call(this,"map.load"),this.success={},this.skuToken=""}return C&&(z.__proto__=C),z.prototype=Object.create(C&&C.prototype),z.prototype.constructor=z,z.prototype.postMapLoadEvent=function(Z,oe,pe,xe){this.skuToken=pe,(H.EVENTS_URL&&xe||H.ACCESS_TOKEN&&Array.isArray(Z)&&Z.some(function(Se){return ue(Se)||ge(Se)}))&&this.queueRequest({id:oe,timestamp:Date.now()},xe)},z.prototype.processRequests=function(Z){var oe=this;if(!this.pendingRequest&&this.queue.length!==0){var pe=this.queue.shift(),xe=pe.id,Se=pe.timestamp;xe&&this.success[xe]||(this.anonId||this.fetchEventData(),k(this.anonId)||(this.anonId=b()),this.postEvent(Se,{skuToken:this.skuToken},function(Ne){Ne||xe&&(oe.success[xe]=!0)},Z))}},z}(ke),Me=new(function(C){function z(Z){C.call(this,"appUserTurnstile"),this._customAccessToken=Z}return C&&(z.__proto__=C),z.prototype=Object.create(C&&C.prototype),z.prototype.constructor=z,z.prototype.postTurnstileEvent=function(Z,oe){H.EVENTS_URL&&H.ACCESS_TOKEN&&Array.isArray(Z)&&Z.some(function(pe){return ue(pe)||ge(pe)})&&this.queueRequest(Date.now(),oe)},z.prototype.processRequests=function(Z){var oe=this;if(!this.pendingRequest&&this.queue.length!==0){this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();var pe=Ae(H.ACCESS_TOKEN),xe=pe?pe.u:H.ACCESS_TOKEN,Se=xe!==this.eventData.tokenU;k(this.anonId)||(this.anonId=b(),Se=!0);var Ne=this.queue.shift();if(this.eventData.lastSuccess){var Ze=new Date(this.eventData.lastSuccess),ct=new Date(Ne),gt=(Ne-this.eventData.lastSuccess)/864e5;Se=Se||gt>=1||gt<-1||Ze.getDate()!==ct.getDate()}else Se=!0;if(!Se)return this.processRequests();this.postEvent(Ne,{"enabled.telemetry":!1},function(Bt){Bt||(oe.eventData.lastSuccess=Ne,oe.eventData.tokenU=xe)},Z)}},z}(ke)),we=Me.postTurnstileEvent.bind(Me),Ce=new ve,Fe=Ce.postMapLoadEvent.bind(Ce),ze=500,$e=50;function Ke(){self.caches&&!Le&&(Le=self.caches.open("mapbox-tiles"))}function Re(C,z,Z){if(Ke(),Le){var oe={status:z.status,statusText:z.statusText,headers:new self.Headers};z.headers.forEach(function(xe,Se){return oe.headers.set(Se,xe)});var pe=O(z.headers.get("Cache-Control")||"");pe["no-store"]||(pe["max-age"]&&oe.headers.set("Expires",new Date(Z+1e3*pe["max-age"]).toUTCString()),new Date(oe.headers.get("Expires")).getTime()-Z<42e4||function(xe,Se){if(de===void 0)try{new Response(new ReadableStream),de=!0}catch{de=!1}de?Se(xe.body):xe.blob().then(Se)}(z,function(xe){var Se=new self.Response(xe,oe);Ke(),Le&&Le.then(function(Ne){return Ne.put(Ve(C.url),Se)}).catch(function(Ne){return L(Ne.message)})}))}}function Ve(C){var z=C.indexOf("?");return z<0?C:C.slice(0,z)}function We(C,z){if(Ke(),!Le)return z(null);var Z=Ve(C.url);Le.then(function(oe){oe.match(Z).then(function(pe){var xe=function(Se){if(!Se)return!1;var Ne=new Date(Se.headers.get("Expires")||0),Ze=O(Se.headers.get("Cache-Control")||"");return Ne>Date.now()&&!Ze["no-cache"]}(pe);oe.delete(Z),xe&&oe.put(Z,pe.clone()),z(null,pe,xe)}).catch(z)}).catch(z)}var Ye,nt=1/0;function ft(){return Ye==null&&(Ye=self.OffscreenCanvas&&new self.OffscreenCanvas(1,1).getContext("2d")&&typeof self.createImageBitmap=="function"),Ye}var yt={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};typeof Object.freeze=="function"&&Object.freeze(yt);var Ot=function(C){function z(Z,oe,pe){oe===401&&ge(pe)&&(Z+=": you may have provided an invalid Mapbox access token. See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes"),C.call(this,Z),this.status=oe,this.url=pe,this.name=this.constructor.name,this.message=Z}return C&&(z.__proto__=C),z.prototype=Object.create(C&&C.prototype),z.prototype.constructor=z,z.prototype.toString=function(){return this.name+": "+this.message+" ("+this.status+"): "+this.url},z}(Error),Tt=D()?function(){return self.worker&&self.worker.referrer}:function(){return(self.location.protocol==="blob:"?self.parent:self).location.href};function at(C,z){var Z,oe=new self.AbortController,pe=new self.Request(C.url,{method:C.method||"GET",body:C.body,credentials:C.credentials,headers:C.headers,referrer:Tt(),signal:oe.signal}),xe=!1,Se=!1,Ne=(Z=pe.url).indexOf("sku=")>0&&ge(Z);C.type==="json"&&pe.headers.set("Accept","application/json");var Ze=function(gt,Bt,Xt){if(!Se){if(gt&>.message!=="SecurityError"&&L(gt),Bt&&Xt)return ct(Bt);var Gt=Date.now();self.fetch(pe).then(function(on){if(on.ok){var yn=Ne?on.clone():null;return ct(on,yn,Gt)}return z(new Ot(on.statusText,on.status,C.url))}).catch(function(on){on.code!==20&&z(new Error(on.message))})}},ct=function(gt,Bt,Xt){(C.type==="arrayBuffer"?gt.arrayBuffer():C.type==="json"?gt.json():gt.text()).then(function(Gt){Se||(Bt&&Xt&&Re(pe,Bt,Xt),xe=!0,z(null,Gt,gt.headers.get("Cache-Control"),gt.headers.get("Expires")))}).catch(function(Gt){Se||z(new Error(Gt.message))})};return Ne?We(pe,Ze):Ze(null,null),{cancel:function(){Se=!0,xe||oe.abort()}}}var et=function(C,z){if(Z=C.url,!(/^file:/.test(Z)||/^file:/.test(Tt())&&!/^\w+:/.test(Z))){if(self.fetch&&self.Request&&self.AbortController&&self.Request.prototype.hasOwnProperty("signal"))return at(C,z);if(D()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",C,z,void 0,!0)}var Z;return function(oe,pe){var xe=new self.XMLHttpRequest;for(var Se in xe.open(oe.method||"GET",oe.url,!0),oe.type==="arrayBuffer"&&(xe.responseType="arraybuffer"),oe.headers)xe.setRequestHeader(Se,oe.headers[Se]);return oe.type==="json"&&(xe.responseType="text",xe.setRequestHeader("Accept","application/json")),xe.withCredentials=oe.credentials==="include",xe.onerror=function(){pe(new Error(xe.statusText))},xe.onload=function(){if((xe.status>=200&&xe.status<300||xe.status===0)&&xe.response!==null){var Ne=xe.response;if(oe.type==="json")try{Ne=JSON.parse(xe.response)}catch(Ze){return pe(Ze)}pe(null,Ne,xe.getResponseHeader("Cache-Control"),xe.getResponseHeader("Expires"))}else pe(new Ot(xe.statusText,xe.status,oe.url))},xe.send(oe.body),{cancel:function(){return xe.abort()}}}(C,z)},Lt=function(C,z){return et(x(C,{type:"arrayBuffer"}),z)},Wt=function(C,z){return et(x(C,{method:"POST"}),z)},Jt,Be;Jt=[],Be=0;var Ge=function(C,z){if(ne.supported&&(C.headers||(C.headers={}),C.headers.accept="image/webp,*/*"),Be>=H.MAX_PARALLEL_IMAGE_REQUESTS){var Z={requestParameters:C,callback:z,cancelled:!1,cancel:function(){this.cancelled=!0}};return Jt.push(Z),Z}Be++;var oe=!1,pe=function(){if(!oe)for(oe=!0,Be--;Jt.length&&Be0||this._oneTimeListeners&&this._oneTimeListeners[C]&&this._oneTimeListeners[C].length>0||this._eventedParent&&this._eventedParent.listens(C)},Te.prototype.setEventedParent=function(C,z){return this._eventedParent=C,this._eventedParentData=z,this};var Pe={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},expression_name:{type:"enum",values:{let:{group:"Variable binding"},var:{group:"Variable binding"},literal:{group:"Types"},array:{group:"Types"},at:{group:"Lookup"},in:{group:"Lookup"},"index-of":{group:"Lookup"},slice:{group:"Lookup"},case:{group:"Decision"},match:{group:"Decision"},coalesce:{group:"Decision"},step:{group:"Ramps, scales, curves"},interpolate:{group:"Ramps, scales, curves"},"interpolate-hcl":{group:"Ramps, scales, curves"},"interpolate-lab":{group:"Ramps, scales, curves"},ln2:{group:"Math"},pi:{group:"Math"},e:{group:"Math"},typeof:{group:"Types"},string:{group:"Types"},number:{group:"Types"},boolean:{group:"Types"},object:{group:"Types"},collator:{group:"Types"},format:{group:"Types"},image:{group:"Types"},"number-format":{group:"Types"},"to-string":{group:"Types"},"to-number":{group:"Types"},"to-boolean":{group:"Types"},"to-rgba":{group:"Color"},"to-color":{group:"Types"},rgb:{group:"Color"},rgba:{group:"Color"},get:{group:"Lookup"},has:{group:"Lookup"},length:{group:"Lookup"},properties:{group:"Feature data"},"feature-state":{group:"Feature data"},"geometry-type":{group:"Feature data"},id:{group:"Feature data"},zoom:{group:"Zoom"},"heatmap-density":{group:"Heatmap"},"line-progress":{group:"Feature data"},accumulated:{group:"Feature data"},"+":{group:"Math"},"*":{group:"Math"},"-":{group:"Math"},"/":{group:"Math"},"%":{group:"Math"},"^":{group:"Math"},sqrt:{group:"Math"},log10:{group:"Math"},ln:{group:"Math"},log2:{group:"Math"},sin:{group:"Math"},cos:{group:"Math"},tan:{group:"Math"},asin:{group:"Math"},acos:{group:"Math"},atan:{group:"Math"},min:{group:"Math"},max:{group:"Math"},round:{group:"Math"},abs:{group:"Math"},ceil:{group:"Math"},floor:{group:"Math"},distance:{group:"Math"},"==":{group:"Decision"},"!=":{group:"Decision"},">":{group:"Decision"},"<":{group:"Decision"},">=":{group:"Decision"},"<=":{group:"Decision"},all:{group:"Decision"},any:{group:"Decision"},"!":{group:"Decision"},within:{group:"Decision"},"is-supported-script":{group:"String"},upcase:{group:"String"},downcase:{group:"String"},concat:{group:"String"},"resolved-locale":{group:"String"}}},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}},qe=function(C,z,Z,oe){this.message=(C?C+": ":"")+Z,oe&&(this.identifier=oe),z!=null&&z.__line__&&(this.line=z.__line__)};function rt(C){var z=C.key,Z=C.value;return Z?[new qe(z,Z,"constants have been deprecated as of v8")]:[]}function lt(C){for(var z=[],Z=arguments.length-1;Z-- >0;)z[Z]=arguments[Z+1];for(var oe=0,pe=z;oe":C.itemType.kind==="value"?"array":"array<"+z+">"}return C.kind}var Kt=[Ut,tt,bt,Ft,Et,st,Pt,It(De),St];function qt(C,z){if(z.kind==="error")return null;if(C.kind==="array"){if(z.kind==="array"&&(z.N===0&&z.itemType.kind==="value"||!qt(C.itemType,z.itemType))&&(typeof C.N!="number"||C.N===z.N))return null}else{if(C.kind===z.kind)return null;if(C.kind==="value"){for(var Z=0,oe=Kt;Z255?255:Ze}function pe(Ze){return Ze<0?0:Ze>1?1:Ze}function xe(Ze){return Ze[Ze.length-1]==="%"?oe(parseFloat(Ze)/100*255):oe(parseInt(Ze))}function Se(Ze){return Ze[Ze.length-1]==="%"?pe(parseFloat(Ze)/100):pe(parseFloat(Ze))}function Ne(Ze,ct,gt){return gt<0?gt+=1:gt>1&&(gt-=1),6*gt<1?Ze+(ct-Ze)*gt*6:2*gt<1?ct:3*gt<2?Ze+(ct-Ze)*(2/3-gt)*6:Ze}try{z.parseCSSColor=function(Ze){var ct,gt=Ze.replace(/ /g,"").toLowerCase();if(gt in Z)return Z[gt].slice();if(gt[0]==="#")return gt.length===4?(ct=parseInt(gt.substr(1),16))>=0&&ct<=4095?[(3840&ct)>>4|(3840&ct)>>8,240&ct|(240&ct)>>4,15&ct|(15&ct)<<4,1]:null:gt.length===7&&(ct=parseInt(gt.substr(1),16))>=0&&ct<=16777215?[(16711680&ct)>>16,(65280&ct)>>8,255&ct,1]:null;var Bt=gt.indexOf("("),Xt=gt.indexOf(")");if(Bt!==-1&&Xt+1===gt.length){var Gt=gt.substr(0,Bt),on=gt.substr(Bt+1,Xt-(Bt+1)).split(","),yn=1;switch(Gt){case"rgba":if(on.length!==4)return null;yn=Se(on.pop());case"rgb":return on.length!==3?null:[xe(on[0]),xe(on[1]),xe(on[2]),yn];case"hsla":if(on.length!==4)return null;yn=Se(on.pop());case"hsl":if(on.length!==3)return null;var Cn=(parseFloat(on[0])%360+360)%360/360,Sn=Se(on[1]),$n=Se(on[2]),Vn=$n<=.5?$n*(Sn+1):$n+Sn-$n*Sn,Xn=2*$n-Vn;return[oe(255*Ne(Xn,Vn,Cn+1/3)),oe(255*Ne(Xn,Vn,Cn)),oe(255*Ne(Xn,Vn,Cn-1/3)),yn];default:return null}}return null}}catch{}}).parseCSSColor,tn=function(C,z,Z,oe){oe===void 0&&(oe=1),this.r=C,this.g=z,this.b=Z,this.a=oe};tn.parse=function(C){if(C){if(C instanceof tn)return C;if(typeof C=="string"){var z=pn(C);if(z)return new tn(z[0]/255*z[3],z[1]/255*z[3],z[2]/255*z[3],z[3])}}},tn.prototype.toString=function(){var C=this.toArray(),z=C[0],Z=C[1],oe=C[2],pe=C[3];return"rgba("+Math.round(z)+","+Math.round(Z)+","+Math.round(oe)+","+pe+")"},tn.prototype.toArray=function(){var C=this.r,z=this.g,Z=this.b,oe=this.a;return oe===0?[0,0,0,0]:[255*C/oe,255*z/oe,255*Z/oe,oe]},tn.black=new tn(0,0,0,1),tn.white=new tn(1,1,1,1),tn.transparent=new tn(0,0,0,0),tn.red=new tn(1,0,0,1);var nn=function(C,z,Z){this.sensitivity=C?z?"variant":"case":z?"accent":"base",this.locale=Z,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})};nn.prototype.compare=function(C,z){return this.collator.compare(C,z)},nn.prototype.resolvedLocale=function(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale};var sn=function(C,z,Z,oe,pe){this.text=C,this.image=z,this.scale=Z,this.fontStack=oe,this.textColor=pe},gn=function(C){this.sections=C};gn.fromString=function(C){return new gn([new sn(C,null,null,null,null)])},gn.prototype.isEmpty=function(){return this.sections.length===0||!this.sections.some(function(C){return C.text.length!==0||C.image&&C.image.name.length!==0})},gn.factory=function(C){return C instanceof gn?C:gn.fromString(C)},gn.prototype.toString=function(){return this.sections.length===0?"":this.sections.map(function(C){return C.text}).join("")},gn.prototype.serialize=function(){for(var C=["format"],z=0,Z=this.sections;z=0&&C<=255&&typeof z=="number"&&z>=0&&z<=255&&typeof Z=="number"&&Z>=0&&Z<=255?oe===void 0||typeof oe=="number"&&oe>=0&&oe<=1?null:"Invalid rgba value ["+[C,z,Z,oe].join(", ")+"]: 'a' must be between 0 and 1.":"Invalid rgba value ["+(typeof oe=="number"?[C,z,Z,oe]:[C,z,Z]).join(", ")+"]: 'r', 'g', and 'b' must be between 0 and 255."}function qn(C){if(C===null||typeof C=="string"||typeof C=="boolean"||typeof C=="number"||C instanceof tn||C instanceof nn||C instanceof gn||C instanceof bn)return!0;if(Array.isArray(C)){for(var z=0,Z=C;z2){var Ne=C[1];if(typeof Ne!="string"||!(Ne in Sr)||Ne==="object")return z.error('The item type argument of "array" must be one of string, number, boolean',1);xe=Sr[Ne],oe++}else xe=De;if(C.length>3){if(C[2]!==null&&(typeof C[2]!="number"||C[2]<0||C[2]!==Math.floor(C[2])))return z.error('The length argument to "array" must be a positive integer literal',2);Se=C[2],oe++}Z=It(xe,Se)}else Z=Sr[pe];for(var Ze=[];oe1)&&z.push(oe)}}return z.concat(this.args.map(function(pe){return pe.serialize()}))};var Dn=function(C){this.type=st,this.sections=C};Dn.parse=function(C,z){if(C.length<2)return z.error("Expected at least one argument.");var Z=C[1];if(!Array.isArray(Z)&&typeof Z=="object")return z.error("First argument must be an image or text section.");for(var oe=[],pe=!1,xe=1;xe<=C.length-1;++xe){var Se=C[xe];if(pe&&typeof Se=="object"&&!Array.isArray(Se)){pe=!1;var Ne=null;if(Se["font-scale"]&&!(Ne=z.parse(Se["font-scale"],1,tt)))return null;var Ze=null;if(Se["text-font"]&&!(Ze=z.parse(Se["text-font"],1,It(bt))))return null;var ct=null;if(Se["text-color"]&&!(ct=z.parse(Se["text-color"],1,Et)))return null;var gt=oe[oe.length-1];gt.scale=Ne,gt.font=Ze,gt.textColor=ct}else{var Bt=z.parse(C[xe],1,De);if(!Bt)return null;var Xt=Bt.type.kind;if(Xt!=="string"&&Xt!=="value"&&Xt!=="null"&&Xt!=="resolvedImage")return z.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");pe=!0,oe.push({content:Bt,scale:null,font:null,textColor:null})}}return new Dn(oe)},Dn.prototype.evaluate=function(C){return new gn(this.sections.map(function(z){var Z=z.content.evaluate(C);return Wn(Z)===St?new sn("",Z,null,null,null):new sn(ar(Z),null,z.scale?z.scale.evaluate(C):null,z.font?z.font.evaluate(C).join(","):null,z.textColor?z.textColor.evaluate(C):null)}))},Dn.prototype.eachChild=function(C){for(var z=0,Z=this.sections;z-1),Z},lr.prototype.eachChild=function(C){C(this.input)},lr.prototype.outputDefined=function(){return!1},lr.prototype.serialize=function(){return["image",this.input.serialize()]};var Yr={"to-boolean":Ft,"to-color":Et,"to-number":tt,"to-string":bt},Mn=function(C,z){this.type=C,this.args=z};Mn.parse=function(C,z){if(C.length<2)return z.error("Expected at least one argument.");var Z=C[0];if((Z==="to-boolean"||Z==="to-string")&&C.length!==2)return z.error("Expected one argument.");for(var oe=Yr[Z],pe=[],xe=1;xe4?"Invalid rbga value "+JSON.stringify(z)+": expected an array containing either three or four numeric values.":In(z[0],z[1],z[2],z[3])))return new tn(z[0]/255,z[1]/255,z[2]/255,z[3])}throw new yr(Z||"Could not parse color from value '"+(typeof z=="string"?z:String(JSON.stringify(z)))+"'")}if(this.type.kind==="number"){for(var Se=null,Ne=0,Ze=this.args;Ne=z[2])&&!(C[1]<=z[1])&&!(C[3]>=z[3])}function qr(C,z){var Z,oe=(180+C[0])/360,pe=(Z=C[1],(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+Z*Math.PI/360)))/360),xe=Math.pow(2,z.z);return[Math.round(oe*xe*8192),Math.round(pe*xe*8192)]}function _i(C,z,Z){return z[1]>C[1]!=Z[1]>C[1]&&C[0]<(Z[0]-z[0])*(C[1]-z[1])/(Z[1]-z[1])+z[0]}function cn(C,z){for(var Z,oe,pe,xe,Se,Ne,Ze,ct=!1,gt=0,Bt=z.length;gt0&&Bt<0||gt<0&&Bt>0}function fn(C,z,Z){for(var oe=0,pe=Z;oeZ[2]){var pe=.5*oe,xe=C[0]-Z[0]>pe?-oe:Z[0]-C[0]>pe?oe:0;xe===0&&(xe=C[0]-Z[2]>pe?-oe:Z[2]-C[0]>pe?oe:0),C[0]+=xe}Gr(z,C)}function wn(C,z,Z,oe){for(var pe=8192*Math.pow(2,oe.z),xe=[8192*oe.x,8192*oe.y],Se=[],Ne=0,Ze=C;Ne=0)return!1;var Z=!0;return C.eachChild(function(oe){Z&&!Yn(oe,z)&&(Z=!1)}),Z}kn.parse=function(C,z){if(C.length!==2)return z.error("'within' expression requires exactly one argument, but found "+(C.length-1)+" instead.");if(qn(C[1])){var Z=C[1];if(Z.type==="FeatureCollection")for(var oe=0;oez))throw new yr("Input is not a number.");Se=Ne-1}return 0}or.prototype.parse=function(C,z,Z,oe,pe){return pe===void 0&&(pe={}),z?this.concat(z,Z,oe)._parse(C,pe):this._parse(C,pe)},or.prototype._parse=function(C,z){function Z(ct,gt,Bt){return Bt==="assert"?new Kn(gt,[ct]):Bt==="coerce"?new Mn(gt,[ct]):ct}if(C!==null&&typeof C!="string"&&typeof C!="boolean"&&typeof C!="number"||(C=["literal",C]),Array.isArray(C)){if(C.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');var oe=C[0];if(typeof oe!="string")return this.error("Expression name must be a string, but found "+typeof oe+' instead. If you wanted a literal array, use ["literal", [...]].',0),null;var pe=this.registry[oe];if(pe){var xe=pe.parse(C,this);if(!xe)return null;if(this.expectedType){var Se=this.expectedType,Ne=xe.type;if(Se.kind!=="string"&&Se.kind!=="number"&&Se.kind!=="boolean"&&Se.kind!=="object"&&Se.kind!=="array"||Ne.kind!=="value")if(Se.kind!=="color"&&Se.kind!=="formatted"&&Se.kind!=="resolvedImage"||Ne.kind!=="value"&&Ne.kind!=="string"){if(this.checkSubtype(Se,Ne))return null}else xe=Z(xe,Se,z.typeAnnotation||"coerce");else xe=Z(xe,Se,z.typeAnnotation||"assert")}if(!(xe instanceof Dr)&&xe.type.kind!=="resolvedImage"&&function ct(gt){if(gt instanceof ir)return ct(gt.boundExpression);if(gt instanceof Bn&>.name==="error"||gt instanceof Nr||gt instanceof kn)return!1;var Bt=gt instanceof Mn||gt instanceof Kn,Xt=!0;return gt.eachChild(function(Gt){Xt=Bt?Xt&&ct(Gt):Xt&&Gt instanceof Dr}),Xt?Pn(gt)&&Yn(gt,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"]):!1}(xe)){var Ze=new nr;try{xe=new Dr(xe.type,xe.evaluate(Ze))}catch(ct){return this.error(ct.message),null}}return xe}return this.error('Unknown expression "'+oe+'". If you wanted a literal array, use ["literal", [...]].',0)}return C===void 0?this.error("'undefined' value invalid. Use null instead."):typeof C=="object"?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error("Expected an array, but found "+typeof C+" instead.")},or.prototype.concat=function(C,z,Z){var oe=typeof C=="number"?this.path.concat(C):this.path,pe=Z?this.scope.concat(Z):this.scope;return new or(this.registry,oe,z||null,pe,this.errors)},or.prototype.error=function(C){for(var z=[],Z=arguments.length-1;Z-- >0;)z[Z]=arguments[Z+1];var oe=""+this.key+z.map(function(pe){return"["+pe+"]"}).join("");this.errors.push(new wt(oe,C))},or.prototype.checkSubtype=function(C,z){var Z=qt(C,z);return Z&&this.error(Z),Z};var wr=function(C,z,Z){this.type=C,this.input=z,this.labels=[],this.outputs=[];for(var oe=0,pe=Z;oe=Se)return z.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',Ze);var gt=z.parse(Ne,ct,pe);if(!gt)return null;pe=pe||gt.type,oe.push([Se,gt])}return new wr(pe,Z,oe)},wr.prototype.evaluate=function(C){var z=this.labels,Z=this.outputs;if(z.length===1)return Z[0].evaluate(C);var oe=this.input.evaluate(C);if(oe<=z[0])return Z[0].evaluate(C);var pe=z.length;return oe>=z[pe-1]?Z[pe-1].evaluate(C):Z[xr(z,oe)].evaluate(C)},wr.prototype.eachChild=function(C){C(this.input);for(var z=0,Z=this.outputs;z0&&C.push(this.labels[z]),C.push(this.outputs[z].serialize());return C};var Ir=Object.freeze({__proto__:null,number:Ar,color:function(C,z,Z){return new tn(Ar(C.r,z.r,Z),Ar(C.g,z.g,Z),Ar(C.b,z.b,Z),Ar(C.a,z.a,Z))},array:function(C,z,Z){return C.map(function(oe,pe){return Ar(oe,z[pe],Z)})}}),Br=6/29,ai=3*Br*Br,Vi=Math.PI/180,$i=180/Math.PI;function Er(C){return C>.008856451679035631?Math.pow(C,1/3):C/ai+4/29}function ci(C){return C>Br?C*C*C:ai*(C-4/29)}function li(C){return 255*(C<=.0031308?12.92*C:1.055*Math.pow(C,1/2.4)-.055)}function ra(C){return(C/=255)<=.04045?C/12.92:Math.pow((C+.055)/1.055,2.4)}function eo(C){var z=ra(C.r),Z=ra(C.g),oe=ra(C.b),pe=Er((.4124564*z+.3575761*Z+.1804375*oe)/.95047),xe=Er((.2126729*z+.7151522*Z+.072175*oe)/1);return{l:116*xe-16,a:500*(pe-xe),b:200*(xe-Er((.0193339*z+.119192*Z+.9503041*oe)/1.08883)),alpha:C.a}}function Co(C){var z=(C.l+16)/116,Z=isNaN(C.a)?z:z+C.a/500,oe=isNaN(C.b)?z:z-C.b/200;return z=1*ci(z),Z=.95047*ci(Z),oe=1.08883*ci(oe),new tn(li(3.2404542*Z-1.5371385*z-.4985314*oe),li(-.969266*Z+1.8760108*z+.041556*oe),li(.0556434*Z-.2040259*z+1.0572252*oe),C.alpha)}function ms(C,z,Z){var oe=z-C;return C+Z*(oe>180||oe<-180?oe-360*Math.round(oe/360):oe)}var ba={forward:eo,reverse:Co,interpolate:function(C,z,Z){return{l:Ar(C.l,z.l,Z),a:Ar(C.a,z.a,Z),b:Ar(C.b,z.b,Z),alpha:Ar(C.alpha,z.alpha,Z)}}},_a={forward:function(C){var z=eo(C),Z=z.l,oe=z.a,pe=z.b,xe=Math.atan2(pe,oe)*$i;return{h:xe<0?xe+360:xe,c:Math.sqrt(oe*oe+pe*pe),l:Z,alpha:C.a}},reverse:function(C){var z=C.h*Vi,Z=C.c;return Co({l:C.l,a:Math.cos(z)*Z,b:Math.sin(z)*Z,alpha:C.alpha})},interpolate:function(C,z,Z){return{h:ms(C.h,z.h,Z),c:Ar(C.c,z.c,Z),l:Ar(C.l,z.l,Z),alpha:Ar(C.alpha,z.alpha,Z)}}},ns=Object.freeze({__proto__:null,lab:ba,hcl:_a}),ua=function(C,z,Z,oe,pe){this.type=C,this.operator=z,this.interpolation=Z,this.input=oe,this.labels=[],this.outputs=[];for(var xe=0,Se=pe;xe1}))return z.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);oe={name:"cubic-bezier",controlPoints:Ne}}if(C.length-1<4)return z.error("Expected at least 4 arguments, but found only "+(C.length-1)+".");if((C.length-1)%2!=0)return z.error("Expected an even number of arguments.");if(!(pe=z.parse(pe,2,tt)))return null;var Ze=[],ct=null;Z==="interpolate-hcl"||Z==="interpolate-lab"?ct=Et:z.expectedType&&z.expectedType.kind!=="value"&&(ct=z.expectedType);for(var gt=0;gt=Bt)return z.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',Gt);var yn=z.parse(Xt,on,ct);if(!yn)return null;ct=ct||yn.type,Ze.push([Bt,yn])}return ct.kind==="number"||ct.kind==="color"||ct.kind==="array"&&ct.itemType.kind==="number"&&typeof ct.N=="number"?new ua(ct,Z,oe,pe,Ze):z.error("Type "+Zt(ct)+" is not interpolatable.")},ua.prototype.evaluate=function(C){var z=this.labels,Z=this.outputs;if(z.length===1)return Z[0].evaluate(C);var oe=this.input.evaluate(C);if(oe<=z[0])return Z[0].evaluate(C);var pe=z.length;if(oe>=z[pe-1])return Z[pe-1].evaluate(C);var xe=xr(z,oe),Se=z[xe],Ne=z[xe+1],Ze=ua.interpolationFactor(this.interpolation,oe,Se,Ne),ct=Z[xe].evaluate(C),gt=Z[xe+1].evaluate(C);return this.operator==="interpolate"?Ir[this.type.kind.toLowerCase()](ct,gt,Ze):this.operator==="interpolate-hcl"?_a.reverse(_a.interpolate(_a.forward(ct),_a.forward(gt),Ze)):ba.reverse(ba.interpolate(ba.forward(ct),ba.forward(gt),Ze))},ua.prototype.eachChild=function(C){C(this.input);for(var z=0,Z=this.outputs;z=Z.length)throw new yr("Array index out of bounds: "+z+" > "+(Z.length-1)+".");if(z!==Math.floor(z))throw new yr("Array index must be an integer, but found "+z+" instead.");return Z[z]},rs.prototype.eachChild=function(C){C(this.index),C(this.input)},rs.prototype.outputDefined=function(){return!1},rs.prototype.serialize=function(){return["at",this.index.serialize(),this.input.serialize()]};var Ms=function(C,z){this.type=Ft,this.needle=C,this.haystack=z};Ms.parse=function(C,z){if(C.length!==3)return z.error("Expected 2 arguments, but found "+(C.length-1)+" instead.");var Z=z.parse(C[1],1,De),oe=z.parse(C[2],2,De);return Z&&oe?mn(Z.type,[Ft,bt,tt,Ut,De])?new Ms(Z,oe):z.error("Expected first argument to be of type boolean, string, number or null, but found "+Zt(Z.type)+" instead"):null},Ms.prototype.evaluate=function(C){var z=this.needle.evaluate(C),Z=this.haystack.evaluate(C);if(!Z)return!1;if(!Fn(z,["boolean","string","number","null"]))throw new yr("Expected first argument to be of type boolean, string, number or null, but found "+Zt(Wn(z))+" instead.");if(!Fn(Z,["string","array"]))throw new yr("Expected second argument to be of type array or string, but found "+Zt(Wn(Z))+" instead.");return Z.indexOf(z)>=0},Ms.prototype.eachChild=function(C){C(this.needle),C(this.haystack)},Ms.prototype.outputDefined=function(){return!0},Ms.prototype.serialize=function(){return["in",this.needle.serialize(),this.haystack.serialize()]};var Ns=function(C,z,Z){this.type=tt,this.needle=C,this.haystack=z,this.fromIndex=Z};Ns.parse=function(C,z){if(C.length<=2||C.length>=5)return z.error("Expected 3 or 4 arguments, but found "+(C.length-1)+" instead.");var Z=z.parse(C[1],1,De),oe=z.parse(C[2],2,De);if(!Z||!oe)return null;if(!mn(Z.type,[Ft,bt,tt,Ut,De]))return z.error("Expected first argument to be of type boolean, string, number or null, but found "+Zt(Z.type)+" instead");if(C.length===4){var pe=z.parse(C[3],3,tt);return pe?new Ns(Z,oe,pe):null}return new Ns(Z,oe)},Ns.prototype.evaluate=function(C){var z=this.needle.evaluate(C),Z=this.haystack.evaluate(C);if(!Fn(z,["boolean","string","number","null"]))throw new yr("Expected first argument to be of type boolean, string, number or null, but found "+Zt(Wn(z))+" instead.");if(!Fn(Z,["string","array"]))throw new yr("Expected second argument to be of type array or string, but found "+Zt(Wn(Z))+" instead.");if(this.fromIndex){var oe=this.fromIndex.evaluate(C);return Z.indexOf(z,oe)}return Z.indexOf(z)},Ns.prototype.eachChild=function(C){C(this.needle),C(this.haystack),this.fromIndex&&C(this.fromIndex)},Ns.prototype.outputDefined=function(){return!1},Ns.prototype.serialize=function(){if(this.fromIndex!=null&&this.fromIndex!==void 0){var C=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),C]}return["index-of",this.needle.serialize(),this.haystack.serialize()]};var Io=function(C,z,Z,oe,pe,xe){this.inputType=C,this.type=z,this.input=Z,this.cases=oe,this.outputs=pe,this.otherwise=xe};Io.parse=function(C,z){if(C.length<5)return z.error("Expected at least 4 arguments, but found only "+(C.length-1)+".");if(C.length%2!=1)return z.error("Expected an even number of arguments.");var Z,oe;z.expectedType&&z.expectedType.kind!=="value"&&(oe=z.expectedType);for(var pe={},xe=[],Se=2;SeNumber.MAX_SAFE_INTEGER)return ct.error("Branch labels must be integers no larger than "+Number.MAX_SAFE_INTEGER+".");if(typeof Xt=="number"&&Math.floor(Xt)!==Xt)return ct.error("Numeric branch labels must be integer values.");if(Z){if(ct.checkSubtype(Z,Wn(Xt)))return null}else Z=Wn(Xt);if(pe[String(Xt)]!==void 0)return ct.error("Branch labels must be unique.");pe[String(Xt)]=xe.length}var Gt=z.parse(Ze,Se,oe);if(!Gt)return null;oe=oe||Gt.type,xe.push(Gt)}var on=z.parse(C[1],1,De);if(!on)return null;var yn=z.parse(C[C.length-1],C.length-1,oe);return yn?on.type.kind!=="value"&&z.concat(1).checkSubtype(Z,on.type)?null:new Io(Z,oe,on,pe,xe,yn):null},Io.prototype.evaluate=function(C){var z=this.input.evaluate(C);return(Wn(z)===this.inputType&&this.outputs[this.cases[z]]||this.otherwise).evaluate(C)},Io.prototype.eachChild=function(C){C(this.input),this.outputs.forEach(C),C(this.otherwise)},Io.prototype.outputDefined=function(){return this.outputs.every(function(C){return C.outputDefined()})&&this.otherwise.outputDefined()},Io.prototype.serialize=function(){for(var C=this,z=["match",this.input.serialize()],Z=[],oe={},pe=0,xe=Object.keys(this.cases).sort();pe=5)return z.error("Expected 3 or 4 arguments, but found "+(C.length-1)+" instead.");var Z=z.parse(C[1],1,De),oe=z.parse(C[2],2,tt);if(!Z||!oe)return null;if(!mn(Z.type,[It(De),bt,De]))return z.error("Expected first argument to be of type array or string, but found "+Zt(Z.type)+" instead");if(C.length===4){var pe=z.parse(C[3],3,tt);return pe?new Zo(Z.type,Z,oe,pe):null}return new Zo(Z.type,Z,oe)},Zo.prototype.evaluate=function(C){var z=this.input.evaluate(C),Z=this.beginIndex.evaluate(C);if(!Fn(z,["string","array"]))throw new yr("Expected first argument to be of type array or string, but found "+Zt(Wn(z))+" instead.");if(this.endIndex){var oe=this.endIndex.evaluate(C);return z.slice(Z,oe)}return z.slice(Z)},Zo.prototype.eachChild=function(C){C(this.input),C(this.beginIndex),this.endIndex&&C(this.endIndex)},Zo.prototype.outputDefined=function(){return!1},Zo.prototype.serialize=function(){if(this.endIndex!=null&&this.endIndex!==void 0){var C=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),C]}return["slice",this.input.serialize(),this.beginIndex.serialize()]};var Zu=wa("==",function(C,z,Z){return z===Z},Rc),Kl=wa("!=",function(C,z,Z){return z!==Z},function(C,z,Z,oe){return!Rc(0,z,Z,oe)}),zc=wa("<",function(C,z,Z){return z",function(C,z,Z){return z>Z},function(C,z,Z,oe){return oe.compare(z,Z)>0}),yc=wa("<=",function(C,z,Z){return z<=Z},function(C,z,Z,oe){return oe.compare(z,Z)<=0}),Bc=wa(">=",function(C,z,Z){return z>=Z},function(C,z,Z,oe){return oe.compare(z,Z)>=0}),Vs=function(C,z,Z,oe,pe){this.type=bt,this.number=C,this.locale=z,this.currency=Z,this.minFractionDigits=oe,this.maxFractionDigits=pe};Vs.parse=function(C,z){if(C.length!==3)return z.error("Expected two arguments.");var Z=z.parse(C[1],1,tt);if(!Z)return null;var oe=C[2];if(typeof oe!="object"||Array.isArray(oe))return z.error("NumberFormat options argument must be an object.");var pe=null;if(oe.locale&&!(pe=z.parse(oe.locale,1,bt)))return null;var xe=null;if(oe.currency&&!(xe=z.parse(oe.currency,1,bt)))return null;var Se=null;if(oe["min-fraction-digits"]&&!(Se=z.parse(oe["min-fraction-digits"],1,tt)))return null;var Ne=null;return oe["max-fraction-digits"]&&!(Ne=z.parse(oe["max-fraction-digits"],1,tt))?null:new Vs(Z,pe,xe,Se,Ne)},Vs.prototype.evaluate=function(C){return new Intl.NumberFormat(this.locale?this.locale.evaluate(C):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(C):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(C):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(C):void 0}).format(this.number.evaluate(C))},Vs.prototype.eachChild=function(C){C(this.number),this.locale&&C(this.locale),this.currency&&C(this.currency),this.minFractionDigits&&C(this.minFractionDigits),this.maxFractionDigits&&C(this.maxFractionDigits)},Vs.prototype.outputDefined=function(){return!1},Vs.prototype.serialize=function(){var C={};return this.locale&&(C.locale=this.locale.serialize()),this.currency&&(C.currency=this.currency.serialize()),this.minFractionDigits&&(C["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(C["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),C]};var qs=function(C){this.type=tt,this.input=C};qs.parse=function(C,z){if(C.length!==2)return z.error("Expected 1 argument, but found "+(C.length-1)+" instead.");var Z=z.parse(C[1],1);return Z?Z.type.kind!=="array"&&Z.type.kind!=="string"&&Z.type.kind!=="value"?z.error("Expected argument of type string or array, but found "+Zt(Z.type)+" instead."):new qs(Z):null},qs.prototype.evaluate=function(C){var z=this.input.evaluate(C);if(typeof z=="string"||Array.isArray(z))return z.length;throw new yr("Expected value to be of type string or array, but found "+Zt(Wn(z))+" instead.")},qs.prototype.eachChild=function(C){C(this.input)},qs.prototype.outputDefined=function(){return!1},qs.prototype.serialize=function(){var C=["length"];return this.eachChild(function(z){C.push(z.serialize())}),C};var xl={"==":Zu,"!=":Kl,">":Nc,"<":zc,">=":Bc,"<=":yc,array:Kn,at:rs,boolean:Kn,case:to,coalesce:Ts,collator:Nr,format:Dn,image:lr,in:Ms,"index-of":Ns,interpolate:ua,"interpolate-hcl":ua,"interpolate-lab":ua,length:qs,let:co,literal:Dr,match:Io,number:Kn,"number-format":Vs,object:Kn,slice:Zo,step:wr,string:Kn,"to-boolean":Mn,"to-color":Mn,"to-number":Mn,"to-string":Mn,var:ir,within:kn};function bl(C,z){var Z=z[0],oe=z[1],pe=z[2],xe=z[3];Z=Z.evaluate(C),oe=oe.evaluate(C),pe=pe.evaluate(C);var Se=xe?xe.evaluate(C):1,Ne=In(Z,oe,pe,Se);if(Ne)throw new yr(Ne);return new tn(Z/255*Se,oe/255*Se,pe/255*Se,Se)}function _l(C,z){return C in z}function Ql(C,z){var Z=z[C];return Z===void 0?null:Z}function Es(C){return{type:C}}function Ju(C){return{result:"success",value:C}}function vs(C){return{result:"error",value:C}}function wl(C){return C["property-type"]==="data-driven"||C["property-type"]==="cross-faded-data-driven"}function Ku(C){return!!C.expression&&C.expression.parameters.indexOf("zoom")>-1}function Hs(C){return!!C.expression&&C.expression.interpolated}function ya(C){return C instanceof Number?"number":C instanceof String?"string":C instanceof Boolean?"boolean":Array.isArray(C)?"array":C===null?"null":typeof C}function je(C){return typeof C=="object"&&C!==null&&!Array.isArray(C)}function He(C){return C}function Qe(C,z,Z){return C!==void 0?C:z!==void 0?z:Z!==void 0?Z:void 0}function ut(C,z,Z,oe,pe){return Qe(typeof Z===pe?oe[Z]:void 0,C.default,z.default)}function mt(C,z,Z){if(ya(Z)!=="number")return Qe(C.default,z.default);var oe=C.stops.length;if(oe===1||Z<=C.stops[0][0])return C.stops[0][1];if(Z>=C.stops[oe-1][0])return C.stops[oe-1][1];var pe=xr(C.stops.map(function(xe){return xe[0]}),Z);return C.stops[pe][1]}function pt(C,z,Z){var oe=C.base!==void 0?C.base:1;if(ya(Z)!=="number")return Qe(C.default,z.default);var pe=C.stops.length;if(pe===1||Z<=C.stops[0][0])return C.stops[0][1];if(Z>=C.stops[pe-1][0])return C.stops[pe-1][1];var xe=xr(C.stops.map(function(Bt){return Bt[0]}),Z),Se=function(Bt,Xt,Gt,on){var yn=on-Gt,Cn=Bt-Gt;return yn===0?0:Xt===1?Cn/yn:(Math.pow(Xt,Cn)-1)/(Math.pow(Xt,yn)-1)}(Z,oe,C.stops[xe][0],C.stops[xe+1][0]),Ne=C.stops[xe][1],Ze=C.stops[xe+1][1],ct=Ir[z.type]||He;if(C.colorSpace&&C.colorSpace!=="rgb"){var gt=ns[C.colorSpace];ct=function(Bt,Xt){return gt.reverse(gt.interpolate(gt.forward(Bt),gt.forward(Xt),Se))}}return typeof Ne.evaluate=="function"?{evaluate:function(){for(var Bt=[],Xt=arguments.length;Xt--;)Bt[Xt]=arguments[Xt];var Gt=Ne.evaluate.apply(void 0,Bt),on=Ze.evaluate.apply(void 0,Bt);if(Gt!==void 0&&on!==void 0)return ct(Gt,on,Se)}}:ct(Ne,Ze,Se)}function Ct(C,z,Z){return z.type==="color"?Z=tn.parse(Z):z.type==="formatted"?Z=gn.fromString(Z.toString()):z.type==="resolvedImage"?Z=bn.fromString(Z.toString()):ya(Z)===z.type||z.type==="enum"&&z.values[Z]||(Z=void 0),Qe(Z,C.default,z.default)}Bn.register(xl,{error:[{kind:"error"},[bt],function(C,z){var Z=z[0];throw new yr(Z.evaluate(C))}],typeof:[bt,[De],function(C,z){return Zt(Wn(z[0].evaluate(C)))}],"to-rgba":[It(tt,4),[Et],function(C,z){return z[0].evaluate(C).toArray()}],rgb:[Et,[tt,tt,tt],bl],rgba:[Et,[tt,tt,tt,tt],bl],has:{type:Ft,overloads:[[[bt],function(C,z){return _l(z[0].evaluate(C),C.properties())}],[[bt,Pt],function(C,z){var Z=z[0],oe=z[1];return _l(Z.evaluate(C),oe.evaluate(C))}]]},get:{type:De,overloads:[[[bt],function(C,z){return Ql(z[0].evaluate(C),C.properties())}],[[bt,Pt],function(C,z){var Z=z[0],oe=z[1];return Ql(Z.evaluate(C),oe.evaluate(C))}]]},"feature-state":[De,[bt],function(C,z){return Ql(z[0].evaluate(C),C.featureState||{})}],properties:[Pt,[],function(C){return C.properties()}],"geometry-type":[bt,[],function(C){return C.geometryType()}],id:[De,[],function(C){return C.id()}],zoom:[tt,[],function(C){return C.globals.zoom}],"heatmap-density":[tt,[],function(C){return C.globals.heatmapDensity||0}],"line-progress":[tt,[],function(C){return C.globals.lineProgress||0}],accumulated:[De,[],function(C){return C.globals.accumulated===void 0?null:C.globals.accumulated}],"+":[tt,Es(tt),function(C,z){for(var Z=0,oe=0,pe=z;oe":[Ft,[bt,De],function(C,z){var Z=z[0],oe=z[1],pe=C.properties()[Z.value],xe=oe.value;return typeof pe==typeof xe&&pe>xe}],"filter-id->":[Ft,[De],function(C,z){var Z=z[0],oe=C.id(),pe=Z.value;return typeof oe==typeof pe&&oe>pe}],"filter-<=":[Ft,[bt,De],function(C,z){var Z=z[0],oe=z[1],pe=C.properties()[Z.value],xe=oe.value;return typeof pe==typeof xe&&pe<=xe}],"filter-id-<=":[Ft,[De],function(C,z){var Z=z[0],oe=C.id(),pe=Z.value;return typeof oe==typeof pe&&oe<=pe}],"filter->=":[Ft,[bt,De],function(C,z){var Z=z[0],oe=z[1],pe=C.properties()[Z.value],xe=oe.value;return typeof pe==typeof xe&&pe>=xe}],"filter-id->=":[Ft,[De],function(C,z){var Z=z[0],oe=C.id(),pe=Z.value;return typeof oe==typeof pe&&oe>=pe}],"filter-has":[Ft,[De],function(C,z){return z[0].value in C.properties()}],"filter-has-id":[Ft,[],function(C){return C.id()!==null&&C.id()!==void 0}],"filter-type-in":[Ft,[It(bt)],function(C,z){return z[0].value.indexOf(C.geometryType())>=0}],"filter-id-in":[Ft,[It(De)],function(C,z){return z[0].value.indexOf(C.id())>=0}],"filter-in-small":[Ft,[bt,It(De)],function(C,z){var Z=z[0];return z[1].value.indexOf(C.properties()[Z.value])>=0}],"filter-in-large":[Ft,[bt,It(De)],function(C,z){var Z=z[0],oe=z[1];return function(pe,xe,Se,Ne){for(;Se<=Ne;){var Ze=Se+Ne>>1;if(xe[Ze]===pe)return!0;xe[Ze]>pe?Ne=Ze-1:Se=Ze+1}return!1}(C.properties()[Z.value],oe.value,0,oe.value.length-1)}],all:{type:Ft,overloads:[[[Ft,Ft],function(C,z){var Z=z[0],oe=z[1];return Z.evaluate(C)&&oe.evaluate(C)}],[Es(Ft),function(C,z){for(var Z=0,oe=z;Z0&&typeof C[0]=="string"&&C[0]in xl}function Yt(C,z){var Z=new or(xl,[],z?function(pe){var xe={color:Et,string:bt,number:tt,enum:bt,boolean:Ft,formatted:st,resolvedImage:St};return pe.type==="array"?It(xe[pe.value]||De,pe.length):xe[pe.type]}(z):void 0),oe=Z.parse(C,void 0,void 0,void 0,z&&z.type==="string"?{typeAnnotation:"coerce"}:void 0);return oe?Ju(new Qt(oe,z)):vs(Z.errors)}Qt.prototype.evaluateWithoutErrorHandling=function(C,z,Z,oe,pe,xe){return this._evaluator.globals=C,this._evaluator.feature=z,this._evaluator.featureState=Z,this._evaluator.canonical=oe,this._evaluator.availableImages=pe||null,this._evaluator.formattedSection=xe,this.expression.evaluate(this._evaluator)},Qt.prototype.evaluate=function(C,z,Z,oe,pe,xe){this._evaluator.globals=C,this._evaluator.feature=z||null,this._evaluator.featureState=Z||null,this._evaluator.canonical=oe,this._evaluator.availableImages=pe||null,this._evaluator.formattedSection=xe||null;try{var Se=this.expression.evaluate(this._evaluator);if(Se==null||typeof Se=="number"&&Se!=Se)return this._defaultValue;if(this._enumValues&&!(Se in this._enumValues))throw new yr("Expected value to be one of "+Object.keys(this._enumValues).map(function(Ne){return JSON.stringify(Ne)}).join(", ")+", but found "+JSON.stringify(Se)+" instead.");return Se}catch(Ne){return this._warningHistory[Ne.message]||(this._warningHistory[Ne.message]=!0,typeof console<"u"&&console.warn(Ne.message)),this._defaultValue}};var an=function(C,z){this.kind=C,this._styleExpression=z,this.isStateDependent=C!=="constant"&&!Zn(z.expression)};an.prototype.evaluateWithoutErrorHandling=function(C,z,Z,oe,pe,xe){return this._styleExpression.evaluateWithoutErrorHandling(C,z,Z,oe,pe,xe)},an.prototype.evaluate=function(C,z,Z,oe,pe,xe){return this._styleExpression.evaluate(C,z,Z,oe,pe,xe)};var hn=function(C,z,Z,oe){this.kind=C,this.zoomStops=Z,this._styleExpression=z,this.isStateDependent=C!=="camera"&&!Zn(z.expression),this.interpolationType=oe};function xn(C,z){if((C=Yt(C,z)).result==="error")return C;var Z=C.value.expression,oe=Pn(Z);if(!oe&&!wl(z))return vs([new wt("","data expressions not supported")]);var pe=Yn(Z,["zoom"]);if(!pe&&!Ku(z))return vs([new wt("","zoom expressions not supported")]);var xe=function Ne(Ze){var ct=null;if(Ze instanceof co)ct=Ne(Ze.result);else if(Ze instanceof Ts)for(var gt=0,Bt=Ze.args;gtoe.maximum?[new qe(z,Z,Z+" is greater than the maximum value "+oe.maximum)]:[]}function Fr(C){var z,Z,oe,pe=C.valueSpec,xe=ot(C.value.type),Se={},Ne=xe!=="categorical"&&C.value.property===void 0,Ze=!Ne,ct=ya(C.value.stops)==="array"&&ya(C.value.stops[0])==="array"&&ya(C.value.stops[0][0])==="object",gt=On({key:C.key,value:C.value,valueSpec:C.styleSpec.function,style:C.style,styleSpec:C.styleSpec,objectElementValidators:{stops:function(Gt){if(xe==="identity")return[new qe(Gt.key,Gt.value,'identity function may not have a "stops" property')];var on=[],yn=Gt.value;return on=on.concat(sr({key:Gt.key,value:yn,valueSpec:Gt.valueSpec,style:Gt.style,styleSpec:Gt.styleSpec,arrayElementValidator:Bt})),ya(yn)==="array"&&yn.length===0&&on.push(new qe(Gt.key,yn,"array must have at least one stop")),on},default:function(Gt){return ln({key:Gt.key,value:Gt.value,valueSpec:pe,style:Gt.style,styleSpec:Gt.styleSpec})}}});return xe==="identity"&&Ne&>.push(new qe(C.key,C.value,'missing required property "property"')),xe==="identity"||C.value.stops||gt.push(new qe(C.key,C.value,'missing required property "stops"')),xe==="exponential"&&C.valueSpec.expression&&!Hs(C.valueSpec)&>.push(new qe(C.key,C.value,"exponential functions not supported")),C.styleSpec.$version>=8&&(Ze&&!wl(C.valueSpec)?gt.push(new qe(C.key,C.value,"property functions not supported")):Ne&&!Ku(C.valueSpec)&>.push(new qe(C.key,C.value,"zoom functions not supported"))),xe!=="categorical"&&!ct||C.value.property!==void 0||gt.push(new qe(C.key,C.value,'"property" property is required')),gt;function Bt(Gt){var on=[],yn=Gt.value,Cn=Gt.key;if(ya(yn)!=="array")return[new qe(Cn,yn,"array expected, "+ya(yn)+" found")];if(yn.length!==2)return[new qe(Cn,yn,"array length 2 expected, length "+yn.length+" found")];if(ct){if(ya(yn[0])!=="object")return[new qe(Cn,yn,"object expected, "+ya(yn[0])+" found")];if(yn[0].zoom===void 0)return[new qe(Cn,yn,"object stop key must have zoom")];if(yn[0].value===void 0)return[new qe(Cn,yn,"object stop key must have value")];if(oe&&oe>ot(yn[0].zoom))return[new qe(Cn,yn[0].zoom,"stop zoom values must appear in ascending order")];ot(yn[0].zoom)!==oe&&(oe=ot(yn[0].zoom),Z=void 0,Se={}),on=on.concat(On({key:Cn+"[0]",value:yn[0],valueSpec:{zoom:{}},style:Gt.style,styleSpec:Gt.styleSpec,objectElementValidators:{zoom:mr,value:Xt}}))}else on=on.concat(Xt({key:Cn+"[0]",value:yn[0],valueSpec:{},style:Gt.style,styleSpec:Gt.styleSpec},yn));return en(At(yn[1]))?on.concat([new qe(Cn+"[1]",yn[1],"expressions are not allowed in function stops.")]):on.concat(ln({key:Cn+"[1]",value:yn[1],valueSpec:pe,style:Gt.style,styleSpec:Gt.styleSpec}))}function Xt(Gt,on){var yn=ya(Gt.value),Cn=ot(Gt.value),Sn=Gt.value!==null?Gt.value:on;if(z){if(yn!==z)return[new qe(Gt.key,Sn,yn+" stop domain type must match previous stop domain type "+z)]}else z=yn;if(yn!=="number"&&yn!=="string"&&yn!=="boolean")return[new qe(Gt.key,Sn,"stop domain value must be a number, string, or boolean")];if(yn!=="number"&&xe!=="categorical"){var $n="number expected, "+yn+" found";return wl(pe)&&xe===void 0&&($n+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new qe(Gt.key,Sn,$n)]}return xe!=="categorical"||yn!=="number"||isFinite(Cn)&&Math.floor(Cn)===Cn?xe!=="categorical"&&yn==="number"&&Z!==void 0&&Cn=2&&C[1]!=="$id"&&C[1]!=="$type";case"in":return C.length>=3&&(typeof C[1]!="string"||Array.isArray(C[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return C.length!==3||Array.isArray(C[1])||Array.isArray(C[2]);case"any":case"all":for(var z=0,Z=C.slice(1);zz?1:0}function ca(C){if(!C)return!0;var z,Z=C[0];return C.length<=1?Z!=="any":Z==="=="?da(C[1],C[2],"=="):Z==="!="?za(da(C[1],C[2],"==")):Z==="<"||Z===">"||Z==="<="||Z===">="?da(C[1],C[2],Z):Z==="any"?(z=C.slice(1),["any"].concat(z.map(ca))):Z==="all"?["all"].concat(C.slice(1).map(ca)):Z==="none"?["all"].concat(C.slice(1).map(ca).map(za)):Z==="in"?fo(C[1],C.slice(2)):Z==="!in"?za(fo(C[1],C.slice(2))):Z==="has"?so(C[1]):Z==="!has"?za(so(C[1])):Z!=="within"||C}function da(C,z,Z){switch(C){case"$type":return["filter-type-"+Z,z];case"$id":return["filter-id-"+Z,z];default:return["filter-"+Z,C,z]}}function fo(C,z){if(z.length===0)return!1;switch(C){case"$type":return["filter-type-in",["literal",z]];case"$id":return["filter-id-in",["literal",z]];default:return z.length>200&&!z.some(function(Z){return typeof Z!=typeof z[0]})?["filter-in-large",C,["literal",z.sort(ha)]]:["filter-in-small",C,["literal",z]]}}function so(C){switch(C){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",C]}}function za(C){return["!",C]}function Na(C){return Ur(At(C.value))?jr(lt({},C,{expressionContext:"filter",valueSpec:{value:"boolean"}})):function z(Z){var oe=Z.value,pe=Z.key;if(ya(oe)!=="array")return[new qe(pe,oe,"array expected, "+ya(oe)+" found")];var xe,Se=Z.styleSpec,Ne=[];if(oe.length<1)return[new qe(pe,oe,"filter array must have at least 1 element")];switch(Ne=Ne.concat(Kr({key:pe+"[0]",value:oe[0],valueSpec:Se.filter_operator,style:Z.style,styleSpec:Z.styleSpec})),ot(oe[0])){case"<":case"<=":case">":case">=":oe.length>=2&&ot(oe[1])==="$type"&&Ne.push(new qe(pe,oe,'"$type" cannot be use with operator "'+oe[0]+'"'));case"==":case"!=":oe.length!==3&&Ne.push(new qe(pe,oe,'filter array for operator "'+oe[0]+'" must have 3 elements'));case"in":case"!in":oe.length>=2&&(xe=ya(oe[1]))!=="string"&&Ne.push(new qe(pe+"[1]",oe[1],"string expected, "+xe+" found"));for(var Ze=2;Ze=gt[Gt+0]&&oe>=gt[Gt+1])?(Se[Xt]=!0,xe.push(ct[Xt])):Se[Xt]=!1}}},Tr.prototype._forEachCell=function(C,z,Z,oe,pe,xe,Se,Ne){for(var Ze=this._convertToCellCoord(C),ct=this._convertToCellCoord(z),gt=this._convertToCellCoord(Z),Bt=this._convertToCellCoord(oe),Xt=Ze;Xt<=gt;Xt++)for(var Gt=ct;Gt<=Bt;Gt++){var on=this.d*Gt+Xt;if((!Ne||Ne(this._convertFromCellCoord(Xt),this._convertFromCellCoord(Gt),this._convertFromCellCoord(Xt+1),this._convertFromCellCoord(Gt+1)))&&pe.call(this,C,z,Z,oe,on,xe,Se,Ne))return}},Tr.prototype._convertFromCellCoord=function(C){return(C-this.padding)/this.scale},Tr.prototype._convertToCellCoord=function(C){return Math.max(0,Math.min(this.d-1,Math.floor(C*this.scale)+this.padding))},Tr.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var C=this.cells,z=3+this.cells.length+1+1,Z=0,oe=0;oe=0)){var Bt=C[gt];ct[gt]=yi[Ze].shallow.indexOf(gt)>=0?Bt:di(Bt,z)}C instanceof Error&&(ct.message=C.message)}if(ct.$name)throw new Error("$name property is reserved for worker serialization logic.");return Ze!=="Object"&&(ct.$name=Ze),ct}throw new Error("can't serialize object of type "+typeof C)}function Ui(C){if(C==null||typeof C=="boolean"||typeof C=="number"||typeof C=="string"||C instanceof Boolean||C instanceof Number||C instanceof String||C instanceof Date||C instanceof RegExp||Rr(C)||Wr(C)||ArrayBuffer.isView(C)||C instanceof $r)return C;if(Array.isArray(C))return C.map(Ui);if(typeof C=="object"){var z=C.$name||"Object",Z=yi[z].klass;if(!Z)throw new Error("can't deserialize unregistered class "+z);if(Z.deserialize)return Z.deserialize(C);for(var oe=Object.create(Z.prototype),pe=0,xe=Object.keys(C);pe=0?Ne:Ui(Ne)}}return oe}throw new Error("can't deserialize object of type "+typeof C)}var ea=function(){this.first=!0};ea.prototype.update=function(C,z){var Z=Math.floor(C);return this.first?(this.first=!1,this.lastIntegerZoom=Z,this.lastIntegerZoomTime=0,this.lastZoom=C,this.lastFloorZoom=Z,!0):(this.lastFloorZoom>Z?(this.lastIntegerZoom=Z+1,this.lastIntegerZoomTime=z):this.lastFloorZoom=128&&C<=255},Arabic:function(C){return C>=1536&&C<=1791},"Arabic Supplement":function(C){return C>=1872&&C<=1919},"Arabic Extended-A":function(C){return C>=2208&&C<=2303},"Hangul Jamo":function(C){return C>=4352&&C<=4607},"Unified Canadian Aboriginal Syllabics":function(C){return C>=5120&&C<=5759},Khmer:function(C){return C>=6016&&C<=6143},"Unified Canadian Aboriginal Syllabics Extended":function(C){return C>=6320&&C<=6399},"General Punctuation":function(C){return C>=8192&&C<=8303},"Letterlike Symbols":function(C){return C>=8448&&C<=8527},"Number Forms":function(C){return C>=8528&&C<=8591},"Miscellaneous Technical":function(C){return C>=8960&&C<=9215},"Control Pictures":function(C){return C>=9216&&C<=9279},"Optical Character Recognition":function(C){return C>=9280&&C<=9311},"Enclosed Alphanumerics":function(C){return C>=9312&&C<=9471},"Geometric Shapes":function(C){return C>=9632&&C<=9727},"Miscellaneous Symbols":function(C){return C>=9728&&C<=9983},"Miscellaneous Symbols and Arrows":function(C){return C>=11008&&C<=11263},"CJK Radicals Supplement":function(C){return C>=11904&&C<=12031},"Kangxi Radicals":function(C){return C>=12032&&C<=12255},"Ideographic Description Characters":function(C){return C>=12272&&C<=12287},"CJK Symbols and Punctuation":function(C){return C>=12288&&C<=12351},Hiragana:function(C){return C>=12352&&C<=12447},Katakana:function(C){return C>=12448&&C<=12543},Bopomofo:function(C){return C>=12544&&C<=12591},"Hangul Compatibility Jamo":function(C){return C>=12592&&C<=12687},Kanbun:function(C){return C>=12688&&C<=12703},"Bopomofo Extended":function(C){return C>=12704&&C<=12735},"CJK Strokes":function(C){return C>=12736&&C<=12783},"Katakana Phonetic Extensions":function(C){return C>=12784&&C<=12799},"Enclosed CJK Letters and Months":function(C){return C>=12800&&C<=13055},"CJK Compatibility":function(C){return C>=13056&&C<=13311},"CJK Unified Ideographs Extension A":function(C){return C>=13312&&C<=19903},"Yijing Hexagram Symbols":function(C){return C>=19904&&C<=19967},"CJK Unified Ideographs":function(C){return C>=19968&&C<=40959},"Yi Syllables":function(C){return C>=40960&&C<=42127},"Yi Radicals":function(C){return C>=42128&&C<=42191},"Hangul Jamo Extended-A":function(C){return C>=43360&&C<=43391},"Hangul Syllables":function(C){return C>=44032&&C<=55215},"Hangul Jamo Extended-B":function(C){return C>=55216&&C<=55295},"Private Use Area":function(C){return C>=57344&&C<=63743},"CJK Compatibility Ideographs":function(C){return C>=63744&&C<=64255},"Arabic Presentation Forms-A":function(C){return C>=64336&&C<=65023},"Vertical Forms":function(C){return C>=65040&&C<=65055},"CJK Compatibility Forms":function(C){return C>=65072&&C<=65103},"Small Form Variants":function(C){return C>=65104&&C<=65135},"Arabic Presentation Forms-B":function(C){return C>=65136&&C<=65279},"Halfwidth and Fullwidth Forms":function(C){return C>=65280&&C<=65519}};function aa(C){for(var z=0,Z=C;z=65097&&C<=65103)||!!Or["CJK Compatibility Ideographs"](C)||!!Or["CJK Compatibility"](C)||!!Or["CJK Radicals Supplement"](C)||!!Or["CJK Strokes"](C)||!(!Or["CJK Symbols and Punctuation"](C)||C>=12296&&C<=12305||C>=12308&&C<=12319||C===12336)||!!Or["CJK Unified Ideographs Extension A"](C)||!!Or["CJK Unified Ideographs"](C)||!!Or["Enclosed CJK Letters and Months"](C)||!!Or["Hangul Compatibility Jamo"](C)||!!Or["Hangul Jamo Extended-A"](C)||!!Or["Hangul Jamo Extended-B"](C)||!!Or["Hangul Jamo"](C)||!!Or["Hangul Syllables"](C)||!!Or.Hiragana(C)||!!Or["Ideographic Description Characters"](C)||!!Or.Kanbun(C)||!!Or["Kangxi Radicals"](C)||!!Or["Katakana Phonetic Extensions"](C)||!(!Or.Katakana(C)||C===12540)||!(!Or["Halfwidth and Fullwidth Forms"](C)||C===65288||C===65289||C===65293||C>=65306&&C<=65310||C===65339||C===65341||C===65343||C>=65371&&C<=65503||C===65507||C>=65512&&C<=65519)||!(!Or["Small Form Variants"](C)||C>=65112&&C<=65118||C>=65123&&C<=65126)||!!Or["Unified Canadian Aboriginal Syllabics"](C)||!!Or["Unified Canadian Aboriginal Syllabics Extended"](C)||!!Or["Vertical Forms"](C)||!!Or["Yijing Hexagram Symbols"](C)||!!Or["Yi Syllables"](C)||!!Or["Yi Radicals"](C))}function oa(C){return!(Ci(C)||function(z){return!(!Or["Latin-1 Supplement"](z)||z!==167&&z!==169&&z!==174&&z!==177&&z!==188&&z!==189&&z!==190&&z!==215&&z!==247)||!(!Or["General Punctuation"](z)||z!==8214&&z!==8224&&z!==8225&&z!==8240&&z!==8241&&z!==8251&&z!==8252&&z!==8258&&z!==8263&&z!==8264&&z!==8265&&z!==8273)||!!Or["Letterlike Symbols"](z)||!!Or["Number Forms"](z)||!(!Or["Miscellaneous Technical"](z)||!(z>=8960&&z<=8967||z>=8972&&z<=8991||z>=8996&&z<=9e3||z===9003||z>=9085&&z<=9114||z>=9150&&z<=9165||z===9167||z>=9169&&z<=9179||z>=9186&&z<=9215))||!(!Or["Control Pictures"](z)||z===9251)||!!Or["Optical Character Recognition"](z)||!!Or["Enclosed Alphanumerics"](z)||!!Or["Geometric Shapes"](z)||!(!Or["Miscellaneous Symbols"](z)||z>=9754&&z<=9759)||!(!Or["Miscellaneous Symbols and Arrows"](z)||!(z>=11026&&z<=11055||z>=11088&&z<=11097||z>=11192&&z<=11243))||!!Or["CJK Symbols and Punctuation"](z)||!!Or.Katakana(z)||!!Or["Private Use Area"](z)||!!Or["CJK Compatibility Forms"](z)||!!Or["Small Form Variants"](z)||!!Or["Halfwidth and Fullwidth Forms"](z)||z===8734||z===8756||z===8757||z>=9984&&z<=10087||z>=10102&&z<=10131||z===65532||z===65533}(C))}function Xi(C){return C>=1424&&C<=2303||Or["Arabic Presentation Forms-A"](C)||Or["Arabic Presentation Forms-B"](C)}function Da(C,z){return!(!z&&Xi(C))&&!(C>=2304&&C<=3583||C>=3840&&C<=4255||Or.Khmer(C))}function gi(C){for(var z=0,Z=C;z-1&&(Pi=tl),Ss&&Ss(C)};function ka(){ho.fire(new Oe("pluginStateChange",{pluginStatus:Pi,pluginURL:no}))}var ho=new Te,qo=function(){return Pi},Pa=function(){if(Pi!==Aa||!no)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Pi=Ro,ka(),no&&Lt({url:no},function(C){C?Cs(C):(Pi=Il,ka())})},xs={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:function(){return Pi===Il||xs.applyArabicShaping!=null},isLoading:function(){return Pi===Ro},setState:function(C){Pi=C.pluginStatus,no=C.pluginURL},isParsed:function(){return xs.applyArabicShaping!=null&&xs.processBidirectionalText!=null&&xs.processStyledBidirectionalText!=null},getPluginURL:function(){return no}},Ia=function(C,z){this.zoom=C,z?(this.now=z.now,this.fadeDuration=z.fadeDuration,this.zoomHistory=z.zoomHistory,this.transition=z.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new ea,this.transition={})};Ia.prototype.isSupportedScript=function(C){return function(z,Z){for(var oe=0,pe=z;oethis.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:z+(1-z)*Z}:{fromScale:.5,toScale:1,t:1-(1-Z)*z}};var ls=function(C,z){this.property=C,this.value=z,this.expression=function(Z,oe){if(je(Z))return new _n(Z,oe);if(en(Z)){var pe=xn(Z,oe);if(pe.result==="error")throw new Error(pe.value.map(function(Se){return Se.key+": "+Se.message}).join(", "));return pe.value}var xe=Z;return typeof Z=="string"&&oe.type==="color"&&(xe=tn.parse(Z)),{kind:"constant",evaluate:function(){return xe}}}(z===void 0?C.specification.default:z,C.specification)};ls.prototype.isDataDriven=function(){return this.expression.kind==="source"||this.expression.kind==="composite"},ls.prototype.possiblyEvaluate=function(C,z,Z){return this.property.possiblyEvaluate(this,C,z,Z)};var Mu=function(C){this.property=C,this.value=new ls(C,void 0)};Mu.prototype.transitioned=function(C,z){return new Df(this.property,this.value,z,x({},C.transition,this.transition),C.now)},Mu.prototype.untransitioned=function(){return new Df(this.property,this.value,null,{},0)};var eu=function(C){this._properties=C,this._values=Object.create(C.defaultTransitionablePropertyValues)};eu.prototype.getValue=function(C){return S(this._values[C].value.value)},eu.prototype.setValue=function(C,z){this._values.hasOwnProperty(C)||(this._values[C]=new Mu(this._values[C].property)),this._values[C].value=new ls(this._values[C].property,z===null?void 0:S(z))},eu.prototype.getTransition=function(C){return S(this._values[C].transition)},eu.prototype.setTransition=function(C,z){this._values.hasOwnProperty(C)||(this._values[C]=new Mu(this._values[C].property)),this._values[C].transition=S(z)||void 0},eu.prototype.serialize=function(){for(var C={},z=0,Z=Object.keys(this._values);zthis.end)return this.prior=null,pe;if(this.value.isDataDriven())return this.prior=null,pe;if(oe=1)return 1;var Ze=Ne*Ne,ct=Ze*Ne;return 4*(Ne<.5?ct:3*(Ne-Ze)+ct-.75)}(Se))}return pe};var Lo=function(C){this._properties=C,this._values=Object.create(C.defaultTransitioningPropertyValues)};Lo.prototype.possiblyEvaluate=function(C,z,Z){for(var oe=new tu(this._properties),pe=0,xe=Object.keys(this._values);pexe.zoomHistory.lastIntegerZoom?{from:Z,to:oe}:{from:pe,to:oe}},z.prototype.interpolate=function(Z){return Z},z}(Ii),If=function(C){this.specification=C};If.prototype.possiblyEvaluate=function(C,z,Z,oe){if(C.value!==void 0){if(C.expression.kind==="constant"){var pe=C.expression.evaluate(z,null,{},Z,oe);return this._calculate(pe,pe,pe,z)}return this._calculate(C.expression.evaluate(new Ia(Math.floor(z.zoom-1),z)),C.expression.evaluate(new Ia(Math.floor(z.zoom),z)),C.expression.evaluate(new Ia(Math.floor(z.zoom+1),z)),z)}},If.prototype._calculate=function(C,z,Z,oe){return oe.zoom>oe.zoomHistory.lastIntegerZoom?{from:C,to:z}:{from:Z,to:z}},If.prototype.interpolate=function(C){return C};var nu=function(C){this.specification=C};nu.prototype.possiblyEvaluate=function(C,z,Z,oe){return!!C.expression.evaluate(z,null,{},Z,oe)},nu.prototype.interpolate=function(){return!1};var Gs=function(C){for(var z in this.properties=C,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[],C){var Z=C[z];Z.specification.overridable&&this.overridableProperties.push(z);var oe=this.defaultPropertyValues[z]=new ls(Z,void 0),pe=this.defaultTransitionablePropertyValues[z]=new Mu(Z);this.defaultTransitioningPropertyValues[z]=pe.untransitioned(),this.defaultPossiblyEvaluatedValues[z]=oe.possiblyEvaluate({})}};Qn("DataDrivenProperty",Ii),Qn("DataConstantProperty",wi),Qn("CrossFadedDataDrivenProperty",Pf),Qn("CrossFadedProperty",If),Qn("ColorRampProperty",nu);var Al=function(C){function z(Z,oe){if(C.call(this),this.id=Z.id,this.type=Z.type,this._featureFilter={filter:function(){return!0},needGeometry:!1},Z.type!=="custom"&&(Z=Z,this.metadata=Z.metadata,this.minzoom=Z.minzoom,this.maxzoom=Z.maxzoom,Z.type!=="background"&&(this.source=Z.source,this.sourceLayer=Z["source-layer"],this.filter=Z.filter),oe.layout&&(this._unevaluatedLayout=new Of(oe.layout)),oe.paint)){for(var pe in this._transitionablePaint=new eu(oe.paint),Z.paint)this.setPaintProperty(pe,Z.paint[pe],{validate:!1});for(var xe in Z.layout)this.setLayoutProperty(xe,Z.layout[xe],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new tu(oe.paint)}}return C&&(z.__proto__=C),z.prototype=Object.create(C&&C.prototype),z.prototype.constructor=z,z.prototype.getCrossfadeParameters=function(){return this._crossfadeParameters},z.prototype.getLayoutProperty=function(Z){return Z==="visibility"?this.visibility:this._unevaluatedLayout.getValue(Z)},z.prototype.setLayoutProperty=function(Z,oe,pe){if(pe===void 0&&(pe={}),oe!=null){var xe="layers."+this.id+".layout."+Z;if(this._validate(vr,xe,Z,oe,pe))return}Z!=="visibility"?this._unevaluatedLayout.setValue(Z,oe):this.visibility=oe},z.prototype.getPaintProperty=function(Z){return M(Z,"-transition")?this._transitionablePaint.getTransition(Z.slice(0,-11)):this._transitionablePaint.getValue(Z)},z.prototype.setPaintProperty=function(Z,oe,pe){if(pe===void 0&&(pe={}),oe!=null){var xe="layers."+this.id+".paint."+Z;if(this._validate(ur,xe,Z,oe,pe))return!1}if(M(Z,"-transition"))return this._transitionablePaint.setTransition(Z.slice(0,-11),oe||void 0),!1;var Se=this._transitionablePaint._values[Z],Ne=Se.property.specification["property-type"]==="cross-faded-data-driven",Ze=Se.value.isDataDriven(),ct=Se.value;this._transitionablePaint.setValue(Z,oe),this._handleSpecialPaintPropertyUpdate(Z);var gt=this._transitionablePaint._values[Z].value;return gt.isDataDriven()||Ze||Ne||this._handleOverridablePaintPropertyUpdate(Z,ct,gt)},z.prototype._handleSpecialPaintPropertyUpdate=function(Z){},z.prototype._handleOverridablePaintPropertyUpdate=function(Z,oe,pe){return!1},z.prototype.isHidden=function(Z){return!!(this.minzoom&&Z=this.maxzoom)||this.visibility==="none"},z.prototype.updateTransitions=function(Z){this._transitioningPaint=this._transitionablePaint.transitioned(Z,this._transitioningPaint)},z.prototype.hasTransition=function(){return this._transitioningPaint.hasTransition()},z.prototype.recalculate=function(Z,oe){Z.getCrossfadeParameters&&(this._crossfadeParameters=Z.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(Z,void 0,oe)),this.paint=this._transitioningPaint.possiblyEvaluate(Z,void 0,oe)},z.prototype.serialize=function(){var Z={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(Z.layout=Z.layout||{},Z.layout.visibility=this.visibility),E(Z,function(oe,pe){return!(oe===void 0||pe==="layout"&&!Object.keys(oe).length||pe==="paint"&&!Object.keys(oe).length)})},z.prototype._validate=function(Z,oe,pe,xe,Se){return Se===void 0&&(Se={}),(!Se||Se.validate!==!1)&&kr(this,Z.call(Jn,{key:oe,layerType:this.type,objectKey:pe,value:xe,styleSpec:Pe,style:{glyphs:!0,sprite:!0}}))},z.prototype.is3D=function(){return!1},z.prototype.isTileClipped=function(){return!1},z.prototype.hasOffscreenPass=function(){return!1},z.prototype.resize=function(){},z.prototype.isStateDependent=function(){for(var Z in this.paint._values){var oe=this.paint.get(Z);if(oe instanceof Do&&wl(oe.property.specification)&&(oe.value.kind==="source"||oe.value.kind==="composite")&&oe.value.isStateDependent)return!0}return!1},z}(Te),vd={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},jc=function(C,z){this._structArray=C,this._pos1=z*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8},Ta=function(){this.isTransferred=!1,this.capacity=-1,this.resize(0)};function Fa(C,z){z===void 0&&(z=1);var Z=0,oe=0;return{members:C.map(function(pe){var xe,Se=(xe=pe.type,vd[xe].BYTES_PER_ELEMENT),Ne=Z=Qu(Z,Math.max(z,Se)),Ze=pe.components||1;return oe=Math.max(oe,Se),Z+=Se*Ze,{name:pe.name,type:pe.type,components:Ze,offset:Ne}}),size:Qu(Z,Math.max(oe,z)),alignment:z}}function Qu(C,z){return Math.ceil(C/z)*z}Ta.serialize=function(C,z){return C._trim(),z&&(C.isTransferred=!0,z.push(C.arrayBuffer)),{length:C.length,arrayBuffer:C.arrayBuffer}},Ta.deserialize=function(C){var z=Object.create(this.prototype);return z.arrayBuffer=C.arrayBuffer,z.length=C.length,z.capacity=C.arrayBuffer.byteLength/z.bytesPerElement,z._refreshViews(),z},Ta.prototype._trim=function(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())},Ta.prototype.clear=function(){this.length=0},Ta.prototype.resize=function(C){this.reserve(C),this.length=C},Ta.prototype.reserve=function(C){if(C>this.capacity){this.capacity=Math.max(C,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);var z=this.uint8;this._refreshViews(),z&&this.uint8.set(z)}},Ta.prototype._refreshViews=function(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")};var Eu=function(C){function z(){C.apply(this,arguments)}return C&&(z.__proto__=C),z.prototype=Object.create(C&&C.prototype),z.prototype.constructor=z,z.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},z.prototype.emplaceBack=function(Z,oe){var pe=this.length;return this.resize(pe+1),this.emplace(pe,Z,oe)},z.prototype.emplace=function(Z,oe,pe){var xe=2*Z;return this.int16[xe+0]=oe,this.int16[xe+1]=pe,Z},z}(Ta);Eu.prototype.bytesPerElement=4,Qn("StructArrayLayout2i4",Eu);var Ao=function(C){function z(){C.apply(this,arguments)}return C&&(z.__proto__=C),z.prototype=Object.create(C&&C.prototype),z.prototype.constructor=z,z.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},z.prototype.emplaceBack=function(Z,oe,pe,xe){var Se=this.length;return this.resize(Se+1),this.emplace(Se,Z,oe,pe,xe)},z.prototype.emplace=function(Z,oe,pe,xe,Se){var Ne=4*Z;return this.int16[Ne+0]=oe,this.int16[Ne+1]=pe,this.int16[Ne+2]=xe,this.int16[Ne+3]=Se,Z},z}(Ta);Ao.prototype.bytesPerElement=8,Qn("StructArrayLayout4i8",Ao);var ec=function(C){function z(){C.apply(this,arguments)}return C&&(z.__proto__=C),z.prototype=Object.create(C&&C.prototype),z.prototype.constructor=z,z.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},z.prototype.emplaceBack=function(Z,oe,pe,xe,Se,Ne){var Ze=this.length;return this.resize(Ze+1),this.emplace(Ze,Z,oe,pe,xe,Se,Ne)},z.prototype.emplace=function(Z,oe,pe,xe,Se,Ne,Ze){var ct=6*Z;return this.int16[ct+0]=oe,this.int16[ct+1]=pe,this.int16[ct+2]=xe,this.int16[ct+3]=Se,this.int16[ct+4]=Ne,this.int16[ct+5]=Ze,Z},z}(Ta);ec.prototype.bytesPerElement=12,Qn("StructArrayLayout2i4i12",ec);var Uc=function(C){function z(){C.apply(this,arguments)}return C&&(z.__proto__=C),z.prototype=Object.create(C&&C.prototype),z.prototype.constructor=z,z.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},z.prototype.emplaceBack=function(Z,oe,pe,xe,Se,Ne){var Ze=this.length;return this.resize(Ze+1),this.emplace(Ze,Z,oe,pe,xe,Se,Ne)},z.prototype.emplace=function(Z,oe,pe,xe,Se,Ne,Ze){var ct=4*Z,gt=8*Z;return this.int16[ct+0]=oe,this.int16[ct+1]=pe,this.uint8[gt+4]=xe,this.uint8[gt+5]=Se,this.uint8[gt+6]=Ne,this.uint8[gt+7]=Ze,Z},z}(Ta);Uc.prototype.bytesPerElement=8,Qn("StructArrayLayout2i4ub8",Uc);var vc=function(C){function z(){C.apply(this,arguments)}return C&&(z.__proto__=C),z.prototype=Object.create(C&&C.prototype),z.prototype.constructor=z,z.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},z.prototype.emplaceBack=function(Z,oe,pe,xe,Se,Ne,Ze,ct,gt,Bt){var Xt=this.length;return this.resize(Xt+1),this.emplace(Xt,Z,oe,pe,xe,Se,Ne,Ze,ct,gt,Bt)},z.prototype.emplace=function(Z,oe,pe,xe,Se,Ne,Ze,ct,gt,Bt,Xt){var Gt=9*Z,on=18*Z;return this.uint16[Gt+0]=oe,this.uint16[Gt+1]=pe,this.uint16[Gt+2]=xe,this.uint16[Gt+3]=Se,this.uint16[Gt+4]=Ne,this.uint16[Gt+5]=Ze,this.uint16[Gt+6]=ct,this.uint16[Gt+7]=gt,this.uint8[on+16]=Bt,this.uint8[on+17]=Xt,Z},z}(Ta);vc.prototype.bytesPerElement=18,Qn("StructArrayLayout8ui2ub18",vc);var $c=function(C){function z(){C.apply(this,arguments)}return C&&(z.__proto__=C),z.prototype=Object.create(C&&C.prototype),z.prototype.constructor=z,z.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},z.prototype.emplaceBack=function(Z,oe,pe,xe,Se,Ne,Ze,ct,gt,Bt,Xt,Gt){var on=this.length;return this.resize(on+1),this.emplace(on,Z,oe,pe,xe,Se,Ne,Ze,ct,gt,Bt,Xt,Gt)},z.prototype.emplace=function(Z,oe,pe,xe,Se,Ne,Ze,ct,gt,Bt,Xt,Gt,on){var yn=12*Z;return this.int16[yn+0]=oe,this.int16[yn+1]=pe,this.int16[yn+2]=xe,this.int16[yn+3]=Se,this.uint16[yn+4]=Ne,this.uint16[yn+5]=Ze,this.uint16[yn+6]=ct,this.uint16[yn+7]=gt,this.int16[yn+8]=Bt,this.int16[yn+9]=Xt,this.int16[yn+10]=Gt,this.int16[yn+11]=on,Z},z}(Ta);$c.prototype.bytesPerElement=24,Qn("StructArrayLayout4i4ui4i24",$c);var Su=function(C){function z(){C.apply(this,arguments)}return C&&(z.__proto__=C),z.prototype=Object.create(C&&C.prototype),z.prototype.constructor=z,z.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},z.prototype.emplaceBack=function(Z,oe,pe){var xe=this.length;return this.resize(xe+1),this.emplace(xe,Z,oe,pe)},z.prototype.emplace=function(Z,oe,pe,xe){var Se=3*Z;return this.float32[Se+0]=oe,this.float32[Se+1]=pe,this.float32[Se+2]=xe,Z},z}(Ta);Su.prototype.bytesPerElement=12,Qn("StructArrayLayout3f12",Su);var xd=function(C){function z(){C.apply(this,arguments)}return C&&(z.__proto__=C),z.prototype=Object.create(C&&C.prototype),z.prototype.constructor=z,z.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)},z.prototype.emplaceBack=function(Z){var oe=this.length;return this.resize(oe+1),this.emplace(oe,Z)},z.prototype.emplace=function(Z,oe){var pe=1*Z;return this.uint32[pe+0]=oe,Z},z}(Ta);xd.prototype.bytesPerElement=4,Qn("StructArrayLayout1ul4",xd);var Op=function(C){function z(){C.apply(this,arguments)}return C&&(z.__proto__=C),z.prototype=Object.create(C&&C.prototype),z.prototype.constructor=z,z.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},z.prototype.emplaceBack=function(Z,oe,pe,xe,Se,Ne,Ze,ct,gt){var Bt=this.length;return this.resize(Bt+1),this.emplace(Bt,Z,oe,pe,xe,Se,Ne,Ze,ct,gt)},z.prototype.emplace=function(Z,oe,pe,xe,Se,Ne,Ze,ct,gt,Bt){var Xt=10*Z,Gt=5*Z;return this.int16[Xt+0]=oe,this.int16[Xt+1]=pe,this.int16[Xt+2]=xe,this.int16[Xt+3]=Se,this.int16[Xt+4]=Ne,this.int16[Xt+5]=Ze,this.uint32[Gt+3]=ct,this.uint16[Xt+8]=gt,this.uint16[Xt+9]=Bt,Z},z}(Ta);Op.prototype.bytesPerElement=20,Qn("StructArrayLayout6i1ul2ui20",Op);var tc=function(C){function z(){C.apply(this,arguments)}return C&&(z.__proto__=C),z.prototype=Object.create(C&&C.prototype),z.prototype.constructor=z,z.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},z.prototype.emplaceBack=function(Z,oe,pe,xe,Se,Ne){var Ze=this.length;return this.resize(Ze+1),this.emplace(Ze,Z,oe,pe,xe,Se,Ne)},z.prototype.emplace=function(Z,oe,pe,xe,Se,Ne,Ze){var ct=6*Z;return this.int16[ct+0]=oe,this.int16[ct+1]=pe,this.int16[ct+2]=xe,this.int16[ct+3]=Se,this.int16[ct+4]=Ne,this.int16[ct+5]=Ze,Z},z}(Ta);tc.prototype.bytesPerElement=12,Qn("StructArrayLayout2i2i2i12",tc);var bd=function(C){function z(){C.apply(this,arguments)}return C&&(z.__proto__=C),z.prototype=Object.create(C&&C.prototype),z.prototype.constructor=z,z.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},z.prototype.emplaceBack=function(Z,oe,pe,xe,Se){var Ne=this.length;return this.resize(Ne+1),this.emplace(Ne,Z,oe,pe,xe,Se)},z.prototype.emplace=function(Z,oe,pe,xe,Se,Ne){var Ze=4*Z,ct=8*Z;return this.float32[Ze+0]=oe,this.float32[Ze+1]=pe,this.float32[Ze+2]=xe,this.int16[ct+6]=Se,this.int16[ct+7]=Ne,Z},z}(Ta);bd.prototype.bytesPerElement=16,Qn("StructArrayLayout2f1f2i16",bd);var Vc=function(C){function z(){C.apply(this,arguments)}return C&&(z.__proto__=C),z.prototype=Object.create(C&&C.prototype),z.prototype.constructor=z,z.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},z.prototype.emplaceBack=function(Z,oe,pe,xe){var Se=this.length;return this.resize(Se+1),this.emplace(Se,Z,oe,pe,xe)},z.prototype.emplace=function(Z,oe,pe,xe,Se){var Ne=12*Z,Ze=3*Z;return this.uint8[Ne+0]=oe,this.uint8[Ne+1]=pe,this.float32[Ze+1]=xe,this.float32[Ze+2]=Se,Z},z}(Ta);Vc.prototype.bytesPerElement=12,Qn("StructArrayLayout2ub2f12",Vc);var us=function(C){function z(){C.apply(this,arguments)}return C&&(z.__proto__=C),z.prototype=Object.create(C&&C.prototype),z.prototype.constructor=z,z.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},z.prototype.emplaceBack=function(Z,oe,pe){var xe=this.length;return this.resize(xe+1),this.emplace(xe,Z,oe,pe)},z.prototype.emplace=function(Z,oe,pe,xe){var Se=3*Z;return this.uint16[Se+0]=oe,this.uint16[Se+1]=pe,this.uint16[Se+2]=xe,Z},z}(Ta);us.prototype.bytesPerElement=6,Qn("StructArrayLayout3ui6",us);var Pp=function(C){function z(){C.apply(this,arguments)}return C&&(z.__proto__=C),z.prototype=Object.create(C&&C.prototype),z.prototype.constructor=z,z.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},z.prototype.emplaceBack=function(Z,oe,pe,xe,Se,Ne,Ze,ct,gt,Bt,Xt,Gt,on,yn,Cn,Sn,$n){var Vn=this.length;return this.resize(Vn+1),this.emplace(Vn,Z,oe,pe,xe,Se,Ne,Ze,ct,gt,Bt,Xt,Gt,on,yn,Cn,Sn,$n)},z.prototype.emplace=function(Z,oe,pe,xe,Se,Ne,Ze,ct,gt,Bt,Xt,Gt,on,yn,Cn,Sn,$n,Vn){var Xn=24*Z,dr=12*Z,br=48*Z;return this.int16[Xn+0]=oe,this.int16[Xn+1]=pe,this.uint16[Xn+2]=xe,this.uint16[Xn+3]=Se,this.uint32[dr+2]=Ne,this.uint32[dr+3]=Ze,this.uint32[dr+4]=ct,this.uint16[Xn+10]=gt,this.uint16[Xn+11]=Bt,this.uint16[Xn+12]=Xt,this.float32[dr+7]=Gt,this.float32[dr+8]=on,this.uint8[br+36]=yn,this.uint8[br+37]=Cn,this.uint8[br+38]=Sn,this.uint32[dr+10]=$n,this.int16[Xn+22]=Vn,Z},z}(Ta);Pp.prototype.bytesPerElement=48,Qn("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Pp);var Ip=function(C){function z(){C.apply(this,arguments)}return C&&(z.__proto__=C),z.prototype=Object.create(C&&C.prototype),z.prototype.constructor=z,z.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},z.prototype.emplaceBack=function(Z,oe,pe,xe,Se,Ne,Ze,ct,gt,Bt,Xt,Gt,on,yn,Cn,Sn,$n,Vn,Xn,dr,br,Hr,Vr,ti,vi,xi,ui,Ei){var ki=this.length;return this.resize(ki+1),this.emplace(ki,Z,oe,pe,xe,Se,Ne,Ze,ct,gt,Bt,Xt,Gt,on,yn,Cn,Sn,$n,Vn,Xn,dr,br,Hr,Vr,ti,vi,xi,ui,Ei)},z.prototype.emplace=function(Z,oe,pe,xe,Se,Ne,Ze,ct,gt,Bt,Xt,Gt,on,yn,Cn,Sn,$n,Vn,Xn,dr,br,Hr,Vr,ti,vi,xi,ui,Ei,ki){var bi=34*Z,Ma=17*Z;return this.int16[bi+0]=oe,this.int16[bi+1]=pe,this.int16[bi+2]=xe,this.int16[bi+3]=Se,this.int16[bi+4]=Ne,this.int16[bi+5]=Ze,this.int16[bi+6]=ct,this.int16[bi+7]=gt,this.uint16[bi+8]=Bt,this.uint16[bi+9]=Xt,this.uint16[bi+10]=Gt,this.uint16[bi+11]=on,this.uint16[bi+12]=yn,this.uint16[bi+13]=Cn,this.uint16[bi+14]=Sn,this.uint16[bi+15]=$n,this.uint16[bi+16]=Vn,this.uint16[bi+17]=Xn,this.uint16[bi+18]=dr,this.uint16[bi+19]=br,this.uint16[bi+20]=Hr,this.uint16[bi+21]=Vr,this.uint16[bi+22]=ti,this.uint32[Ma+12]=vi,this.float32[Ma+13]=xi,this.float32[Ma+14]=ui,this.float32[Ma+15]=Ei,this.float32[Ma+16]=ki,Z},z}(Ta);Ip.prototype.bytesPerElement=68,Qn("StructArrayLayout8i15ui1ul4f68",Ip);var ce=function(C){function z(){C.apply(this,arguments)}return C&&(z.__proto__=C),z.prototype=Object.create(C&&C.prototype),z.prototype.constructor=z,z.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},z.prototype.emplaceBack=function(Z){var oe=this.length;return this.resize(oe+1),this.emplace(oe,Z)},z.prototype.emplace=function(Z,oe){var pe=1*Z;return this.float32[pe+0]=oe,Z},z}(Ta);ce.prototype.bytesPerElement=4,Qn("StructArrayLayout1f4",ce);var I=function(C){function z(){C.apply(this,arguments)}return C&&(z.__proto__=C),z.prototype=Object.create(C&&C.prototype),z.prototype.constructor=z,z.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},z.prototype.emplaceBack=function(Z,oe,pe){var xe=this.length;return this.resize(xe+1),this.emplace(xe,Z,oe,pe)},z.prototype.emplace=function(Z,oe,pe,xe){var Se=3*Z;return this.int16[Se+0]=oe,this.int16[Se+1]=pe,this.int16[Se+2]=xe,Z},z}(Ta);I.prototype.bytesPerElement=6,Qn("StructArrayLayout3i6",I);var j=function(C){function z(){C.apply(this,arguments)}return C&&(z.__proto__=C),z.prototype=Object.create(C&&C.prototype),z.prototype.constructor=z,z.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},z.prototype.emplaceBack=function(Z,oe,pe){var xe=this.length;return this.resize(xe+1),this.emplace(xe,Z,oe,pe)},z.prototype.emplace=function(Z,oe,pe,xe){var Se=2*Z,Ne=4*Z;return this.uint32[Se+0]=oe,this.uint16[Ne+2]=pe,this.uint16[Ne+3]=xe,Z},z}(Ta);j.prototype.bytesPerElement=8,Qn("StructArrayLayout1ul2ui8",j);var $=function(C){function z(){C.apply(this,arguments)}return C&&(z.__proto__=C),z.prototype=Object.create(C&&C.prototype),z.prototype.constructor=z,z.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},z.prototype.emplaceBack=function(Z,oe){var pe=this.length;return this.resize(pe+1),this.emplace(pe,Z,oe)},z.prototype.emplace=function(Z,oe,pe){var xe=2*Z;return this.uint16[xe+0]=oe,this.uint16[xe+1]=pe,Z},z}(Ta);$.prototype.bytesPerElement=4,Qn("StructArrayLayout2ui4",$);var X=function(C){function z(){C.apply(this,arguments)}return C&&(z.__proto__=C),z.prototype=Object.create(C&&C.prototype),z.prototype.constructor=z,z.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},z.prototype.emplaceBack=function(Z){var oe=this.length;return this.resize(oe+1),this.emplace(oe,Z)},z.prototype.emplace=function(Z,oe){var pe=1*Z;return this.uint16[pe+0]=oe,Z},z}(Ta);X.prototype.bytesPerElement=2,Qn("StructArrayLayout1ui2",X);var se=function(C){function z(){C.apply(this,arguments)}return C&&(z.__proto__=C),z.prototype=Object.create(C&&C.prototype),z.prototype.constructor=z,z.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},z.prototype.emplaceBack=function(Z,oe){var pe=this.length;return this.resize(pe+1),this.emplace(pe,Z,oe)},z.prototype.emplace=function(Z,oe,pe){var xe=2*Z;return this.float32[xe+0]=oe,this.float32[xe+1]=pe,Z},z}(Ta);se.prototype.bytesPerElement=8,Qn("StructArrayLayout2f8",se);var he=function(C){function z(){C.apply(this,arguments)}return C&&(z.__proto__=C),z.prototype=Object.create(C&&C.prototype),z.prototype.constructor=z,z.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},z.prototype.emplaceBack=function(Z,oe,pe,xe){var Se=this.length;return this.resize(Se+1),this.emplace(Se,Z,oe,pe,xe)},z.prototype.emplace=function(Z,oe,pe,xe,Se){var Ne=4*Z;return this.float32[Ne+0]=oe,this.float32[Ne+1]=pe,this.float32[Ne+2]=xe,this.float32[Ne+3]=Se,Z},z}(Ta);he.prototype.bytesPerElement=16,Qn("StructArrayLayout4f16",he);var ye=function(C){function z(){C.apply(this,arguments)}C&&(z.__proto__=C),z.prototype=Object.create(C&&C.prototype),z.prototype.constructor=z;var Z={anchorPointX:{configurable:!0},anchorPointY:{configurable:!0},x1:{configurable:!0},y1:{configurable:!0},x2:{configurable:!0},y2:{configurable:!0},featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0},anchorPoint:{configurable:!0}};return Z.anchorPointX.get=function(){return this._structArray.int16[this._pos2+0]},Z.anchorPointY.get=function(){return this._structArray.int16[this._pos2+1]},Z.x1.get=function(){return this._structArray.int16[this._pos2+2]},Z.y1.get=function(){return this._structArray.int16[this._pos2+3]},Z.x2.get=function(){return this._structArray.int16[this._pos2+4]},Z.y2.get=function(){return this._structArray.int16[this._pos2+5]},Z.featureIndex.get=function(){return this._structArray.uint32[this._pos4+3]},Z.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+8]},Z.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+9]},Z.anchorPoint.get=function(){return new d(this.anchorPointX,this.anchorPointY)},Object.defineProperties(z.prototype,Z),z}(jc);ye.prototype.size=20;var be=function(C){function z(){C.apply(this,arguments)}return C&&(z.__proto__=C),z.prototype=Object.create(C&&C.prototype),z.prototype.constructor=z,z.prototype.get=function(Z){return new ye(this,Z)},z}(Op);Qn("CollisionBoxArray",be);var Ee=function(C){function z(){C.apply(this,arguments)}C&&(z.__proto__=C),z.prototype=Object.create(C&&C.prototype),z.prototype.constructor=z;var Z={anchorX:{configurable:!0},anchorY:{configurable:!0},glyphStartIndex:{configurable:!0},numGlyphs:{configurable:!0},vertexStartIndex:{configurable:!0},lineStartIndex:{configurable:!0},lineLength:{configurable:!0},segment:{configurable:!0},lowerSize:{configurable:!0},upperSize:{configurable:!0},lineOffsetX:{configurable:!0},lineOffsetY:{configurable:!0},writingMode:{configurable:!0},placedOrientation:{configurable:!0},hidden:{configurable:!0},crossTileID:{configurable:!0},associatedIconIndex:{configurable:!0}};return Z.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},Z.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},Z.glyphStartIndex.get=function(){return this._structArray.uint16[this._pos2+2]},Z.numGlyphs.get=function(){return this._structArray.uint16[this._pos2+3]},Z.vertexStartIndex.get=function(){return this._structArray.uint32[this._pos4+2]},Z.lineStartIndex.get=function(){return this._structArray.uint32[this._pos4+3]},Z.lineLength.get=function(){return this._structArray.uint32[this._pos4+4]},Z.segment.get=function(){return this._structArray.uint16[this._pos2+10]},Z.lowerSize.get=function(){return this._structArray.uint16[this._pos2+11]},Z.upperSize.get=function(){return this._structArray.uint16[this._pos2+12]},Z.lineOffsetX.get=function(){return this._structArray.float32[this._pos4+7]},Z.lineOffsetY.get=function(){return this._structArray.float32[this._pos4+8]},Z.writingMode.get=function(){return this._structArray.uint8[this._pos1+36]},Z.placedOrientation.get=function(){return this._structArray.uint8[this._pos1+37]},Z.placedOrientation.set=function(oe){this._structArray.uint8[this._pos1+37]=oe},Z.hidden.get=function(){return this._structArray.uint8[this._pos1+38]},Z.hidden.set=function(oe){this._structArray.uint8[this._pos1+38]=oe},Z.crossTileID.get=function(){return this._structArray.uint32[this._pos4+10]},Z.crossTileID.set=function(oe){this._structArray.uint32[this._pos4+10]=oe},Z.associatedIconIndex.get=function(){return this._structArray.int16[this._pos2+22]},Object.defineProperties(z.prototype,Z),z}(jc);Ee.prototype.size=48;var Ue=function(C){function z(){C.apply(this,arguments)}return C&&(z.__proto__=C),z.prototype=Object.create(C&&C.prototype),z.prototype.constructor=z,z.prototype.get=function(Z){return new Ee(this,Z)},z}(Pp);Qn("PlacedSymbolArray",Ue);var Xe=function(C){function z(){C.apply(this,arguments)}C&&(z.__proto__=C),z.prototype=Object.create(C&&C.prototype),z.prototype.constructor=z;var Z={anchorX:{configurable:!0},anchorY:{configurable:!0},rightJustifiedTextSymbolIndex:{configurable:!0},centerJustifiedTextSymbolIndex:{configurable:!0},leftJustifiedTextSymbolIndex:{configurable:!0},verticalPlacedTextSymbolIndex:{configurable:!0},placedIconSymbolIndex:{configurable:!0},verticalPlacedIconSymbolIndex:{configurable:!0},key:{configurable:!0},textBoxStartIndex:{configurable:!0},textBoxEndIndex:{configurable:!0},verticalTextBoxStartIndex:{configurable:!0},verticalTextBoxEndIndex:{configurable:!0},iconBoxStartIndex:{configurable:!0},iconBoxEndIndex:{configurable:!0},verticalIconBoxStartIndex:{configurable:!0},verticalIconBoxEndIndex:{configurable:!0},featureIndex:{configurable:!0},numHorizontalGlyphVertices:{configurable:!0},numVerticalGlyphVertices:{configurable:!0},numIconVertices:{configurable:!0},numVerticalIconVertices:{configurable:!0},useRuntimeCollisionCircles:{configurable:!0},crossTileID:{configurable:!0},textBoxScale:{configurable:!0},textOffset0:{configurable:!0},textOffset1:{configurable:!0},collisionCircleDiameter:{configurable:!0}};return Z.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},Z.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},Z.rightJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+2]},Z.centerJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+3]},Z.leftJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+4]},Z.verticalPlacedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+5]},Z.placedIconSymbolIndex.get=function(){return this._structArray.int16[this._pos2+6]},Z.verticalPlacedIconSymbolIndex.get=function(){return this._structArray.int16[this._pos2+7]},Z.key.get=function(){return this._structArray.uint16[this._pos2+8]},Z.textBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+9]},Z.textBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+10]},Z.verticalTextBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+11]},Z.verticalTextBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+12]},Z.iconBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+13]},Z.iconBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+14]},Z.verticalIconBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+15]},Z.verticalIconBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+16]},Z.featureIndex.get=function(){return this._structArray.uint16[this._pos2+17]},Z.numHorizontalGlyphVertices.get=function(){return this._structArray.uint16[this._pos2+18]},Z.numVerticalGlyphVertices.get=function(){return this._structArray.uint16[this._pos2+19]},Z.numIconVertices.get=function(){return this._structArray.uint16[this._pos2+20]},Z.numVerticalIconVertices.get=function(){return this._structArray.uint16[this._pos2+21]},Z.useRuntimeCollisionCircles.get=function(){return this._structArray.uint16[this._pos2+22]},Z.crossTileID.get=function(){return this._structArray.uint32[this._pos4+12]},Z.crossTileID.set=function(oe){this._structArray.uint32[this._pos4+12]=oe},Z.textBoxScale.get=function(){return this._structArray.float32[this._pos4+13]},Z.textOffset0.get=function(){return this._structArray.float32[this._pos4+14]},Z.textOffset1.get=function(){return this._structArray.float32[this._pos4+15]},Z.collisionCircleDiameter.get=function(){return this._structArray.float32[this._pos4+16]},Object.defineProperties(z.prototype,Z),z}(jc);Xe.prototype.size=68;var it=function(C){function z(){C.apply(this,arguments)}return C&&(z.__proto__=C),z.prototype=Object.create(C&&C.prototype),z.prototype.constructor=z,z.prototype.get=function(Z){return new Xe(this,Z)},z}(Ip);Qn("SymbolInstanceArray",it);var xt=function(C){function z(){C.apply(this,arguments)}return C&&(z.__proto__=C),z.prototype=Object.create(C&&C.prototype),z.prototype.constructor=z,z.prototype.getoffsetX=function(Z){return this.float32[1*Z+0]},z}(ce);Qn("GlyphOffsetArray",xt);var Dt=function(C){function z(){C.apply(this,arguments)}return C&&(z.__proto__=C),z.prototype=Object.create(C&&C.prototype),z.prototype.constructor=z,z.prototype.getx=function(Z){return this.int16[3*Z+0]},z.prototype.gety=function(Z){return this.int16[3*Z+1]},z.prototype.gettileUnitDistanceFromAnchor=function(Z){return this.int16[3*Z+2]},z}(I);Qn("SymbolLineVertexArray",Dt);var _t=function(C){function z(){C.apply(this,arguments)}C&&(z.__proto__=C),z.prototype=Object.create(C&&C.prototype),z.prototype.constructor=z;var Z={featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0}};return Z.featureIndex.get=function(){return this._structArray.uint32[this._pos4+0]},Z.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+2]},Z.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+3]},Object.defineProperties(z.prototype,Z),z}(jc);_t.prototype.size=8;var Mt=function(C){function z(){C.apply(this,arguments)}return C&&(z.__proto__=C),z.prototype=Object.create(C&&C.prototype),z.prototype.constructor=z,z.prototype.get=function(Z){return new _t(this,Z)},z}(j);Qn("FeatureIndexArray",Mt);var vt=Fa([{name:"a_pos",components:2,type:"Int16"}],4).members,Nt=function(C){C===void 0&&(C=[]),this.segments=C};function Rt(C,z){return 256*(C=y(Math.floor(C),0,255))+(z=y(Math.floor(z),0,255))}Nt.prototype.prepareSegment=function(C,z,Z,oe){var pe=this.segments[this.segments.length-1];return C>Nt.MAX_VERTEX_ARRAY_LENGTH&&L("Max vertices per segment is "+Nt.MAX_VERTEX_ARRAY_LENGTH+": bucket requested "+C),(!pe||pe.vertexLength+C>Nt.MAX_VERTEX_ARRAY_LENGTH||pe.sortKey!==oe)&&(pe={vertexOffset:z.length,primitiveOffset:Z.length,vertexLength:0,primitiveLength:0},oe!==void 0&&(pe.sortKey=oe),this.segments.push(pe)),pe},Nt.prototype.get=function(){return this.segments},Nt.prototype.destroy=function(){for(var C=0,z=this.segments;C>>16)*Ne&65535)<<16)&4294967295)<<15|ct>>>17))*Ze+(((ct>>>16)*Ze&65535)<<16)&4294967295)<<13|xe>>>19))+((5*(xe>>>16)&65535)<<16)&4294967295))+((58964+(Se>>>16)&65535)<<16);switch(ct=0,oe){case 3:ct^=(255&z.charCodeAt(gt+2))<<16;case 2:ct^=(255&z.charCodeAt(gt+1))<<8;case 1:xe^=ct=(65535&(ct=(ct=(65535&(ct^=255&z.charCodeAt(gt)))*Ne+(((ct>>>16)*Ne&65535)<<16)&4294967295)<<15|ct>>>17))*Ze+(((ct>>>16)*Ze&65535)<<16)&4294967295}return xe^=z.length,xe=2246822507*(65535&(xe^=xe>>>16))+((2246822507*(xe>>>16)&65535)<<16)&4294967295,xe=3266489909*(65535&(xe^=xe>>>13))+((3266489909*(xe>>>16)&65535)<<16)&4294967295,(xe^=xe>>>16)>>>0}}),dn=s(function(C){C.exports=function(z,Z){for(var oe,pe=z.length,xe=Z^pe,Se=0;pe>=4;)oe=1540483477*(65535&(oe=255&z.charCodeAt(Se)|(255&z.charCodeAt(++Se))<<8|(255&z.charCodeAt(++Se))<<16|(255&z.charCodeAt(++Se))<<24))+((1540483477*(oe>>>16)&65535)<<16),xe=1540483477*(65535&xe)+((1540483477*(xe>>>16)&65535)<<16)^(oe=1540483477*(65535&(oe^=oe>>>24))+((1540483477*(oe>>>16)&65535)<<16)),pe-=4,++Se;switch(pe){case 3:xe^=(255&z.charCodeAt(Se+2))<<16;case 2:xe^=(255&z.charCodeAt(Se+1))<<8;case 1:xe=1540483477*(65535&(xe^=255&z.charCodeAt(Se)))+((1540483477*(xe>>>16)&65535)<<16)}return xe=1540483477*(65535&(xe^=xe>>>13))+((1540483477*(xe>>>16)&65535)<<16),(xe^=xe>>>15)>>>0}}),En=rn,Tn=rn,tr=dn;En.murmur3=Tn,En.murmur2=tr;var er=function(){this.ids=[],this.positions=[],this.indexed=!1};er.prototype.add=function(C,z,Z,oe){this.ids.push(cr(C)),this.positions.push(z,Z,oe)},er.prototype.getPositions=function(C){for(var z=cr(C),Z=0,oe=this.ids.length-1;Z>1;this.ids[pe]>=z?oe=pe:Z=pe+1}for(var xe=[];this.ids[Z]===z;){var Se=this.positions[3*Z],Ne=this.positions[3*Z+1],Ze=this.positions[3*Z+2];xe.push({index:Se,start:Ne,end:Ze}),Z++}return xe},er.serialize=function(C,z){var Z=new Float64Array(C.ids),oe=new Uint32Array(C.positions);return function pe(xe,Se,Ne,Ze){for(;Ne>1],gt=Ne-1,Bt=Ze+1;;){do gt++;while(xe[gt]ct);if(gt>=Bt)break;Xr(xe,gt,Bt),Xr(Se,3*gt,3*Bt),Xr(Se,3*gt+1,3*Bt+1),Xr(Se,3*gt+2,3*Bt+2)}Bt-Nepo.max||Se.ypo.max)&&(L("Geometry exceeds allowed extent, reduce your vector tile buffer size"),Se.x=y(Se.x,po.min,po.max),Se.y=y(Se.y,po.min,po.max))}return Z}function Ls(C,z,Z,oe,pe){C.emplaceBack(2*z+(oe+1)/2,2*Z+(pe+1)/2)}var Ho=function(C){this.zoom=C.zoom,this.overscaling=C.overscaling,this.layers=C.layers,this.layerIds=this.layers.map(function(z){return z.id}),this.index=C.index,this.hasPattern=!1,this.layoutVertexArray=new Eu,this.indexArray=new us,this.segments=new Nt,this.programConfigurations=new Ga(vt,C.layers,C.zoom),this.stateDependentLayerIds=this.layers.filter(function(z){return z.isStateDependent()}).map(function(z){return z.id})};function nl(C,z){for(var Z=0;Z1){if(_d(C,z))return!0;for(var oe=0;oe1?C.distSqr(Z):C.distSqr(Z.sub(z)._mult(pe)._add(z))}function Rp(C,z){for(var Z,oe,pe,xe=!1,Se=0;Sez.y!=pe.y>z.y&&z.x<(pe.x-oe.x)*(z.y-oe.y)/(pe.y-oe.y)+oe.x&&(xe=!xe);return xe}function ru(C,z){for(var Z=!1,oe=0,pe=C.length-1;oez.y!=Se.y>z.y&&z.x<(Se.x-xe.x)*(z.y-xe.y)/(Se.y-xe.y)+xe.x&&(Z=!Z)}return Z}function zp(C,z,Z){var oe=Z[0],pe=Z[2];if(C.xpe.x&&z.x>pe.x||C.ype.y&&z.y>pe.y)return!1;var xe=R(C,z,Z[0]);return xe!==R(C,z,Z[1])||xe!==R(C,z,Z[2])||xe!==R(C,z,Z[3])}function go(C,z,Z){var oe=z.paint.get(C).value;return oe.kind==="constant"?oe.value:Z.programConfigurations.get(z.id).getMaxValue(C)}function Ws(C){return Math.sqrt(C[0]*C[0]+C[1]*C[1])}function Ys(C,z,Z,oe,pe){if(!z[0]&&!z[1])return C;var xe=d.convert(z)._mult(pe);Z==="viewport"&&xe._rotate(-oe);for(var Se=[],Ne=0;Ne=8192||gt<0||gt>=8192)){var Bt=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,C.sortKey),Xt=Bt.vertexLength;Ls(this.layoutVertexArray,ct,gt,-1,-1),Ls(this.layoutVertexArray,ct,gt,1,-1),Ls(this.layoutVertexArray,ct,gt,1,1),Ls(this.layoutVertexArray,ct,gt,-1,1),this.indexArray.emplaceBack(Xt,Xt+1,Xt+2),this.indexArray.emplaceBack(Xt,Xt+3,Xt+2),Bt.vertexLength+=4,Bt.primitiveLength+=2}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,C,Z,{},oe)},Qn("CircleBucket",Ho,{omit:["layers"]});var vg=new Gs({"circle-sort-key":new Ii(Pe.layout_circle["circle-sort-key"])}),k5={paint:new Gs({"circle-radius":new Ii(Pe.paint_circle["circle-radius"]),"circle-color":new Ii(Pe.paint_circle["circle-color"]),"circle-blur":new Ii(Pe.paint_circle["circle-blur"]),"circle-opacity":new Ii(Pe.paint_circle["circle-opacity"]),"circle-translate":new wi(Pe.paint_circle["circle-translate"]),"circle-translate-anchor":new wi(Pe.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new wi(Pe.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new wi(Pe.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Ii(Pe.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Ii(Pe.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Ii(Pe.paint_circle["circle-stroke-opacity"])}),layout:vg},Fl=typeof Float32Array<"u"?Float32Array:Array;function C1(C){return C[0]=1,C[1]=0,C[2]=0,C[3]=0,C[4]=0,C[5]=1,C[6]=0,C[7]=0,C[8]=0,C[9]=0,C[10]=1,C[11]=0,C[12]=0,C[13]=0,C[14]=0,C[15]=1,C}function Np(C,z,Z){var oe=z[0],pe=z[1],xe=z[2],Se=z[3],Ne=z[4],Ze=z[5],ct=z[6],gt=z[7],Bt=z[8],Xt=z[9],Gt=z[10],on=z[11],yn=z[12],Cn=z[13],Sn=z[14],$n=z[15],Vn=Z[0],Xn=Z[1],dr=Z[2],br=Z[3];return C[0]=Vn*oe+Xn*Ne+dr*Bt+br*yn,C[1]=Vn*pe+Xn*Ze+dr*Xt+br*Cn,C[2]=Vn*xe+Xn*ct+dr*Gt+br*Sn,C[3]=Vn*Se+Xn*gt+dr*on+br*$n,Vn=Z[4],Xn=Z[5],dr=Z[6],br=Z[7],C[4]=Vn*oe+Xn*Ne+dr*Bt+br*yn,C[5]=Vn*pe+Xn*Ze+dr*Xt+br*Cn,C[6]=Vn*xe+Xn*ct+dr*Gt+br*Sn,C[7]=Vn*Se+Xn*gt+dr*on+br*$n,Vn=Z[8],Xn=Z[9],dr=Z[10],br=Z[11],C[8]=Vn*oe+Xn*Ne+dr*Bt+br*yn,C[9]=Vn*pe+Xn*Ze+dr*Xt+br*Cn,C[10]=Vn*xe+Xn*ct+dr*Gt+br*Sn,C[11]=Vn*Se+Xn*gt+dr*on+br*$n,Vn=Z[12],Xn=Z[13],dr=Z[14],br=Z[15],C[12]=Vn*oe+Xn*Ne+dr*Bt+br*yn,C[13]=Vn*pe+Xn*Ze+dr*Xt+br*Cn,C[14]=Vn*xe+Xn*ct+dr*Gt+br*Sn,C[15]=Vn*Se+Xn*gt+dr*on+br*$n,C}Math.hypot||(Math.hypot=function(){for(var C=arguments,z=0,Z=arguments.length;Z--;)z+=C[Z]*C[Z];return Math.sqrt(z)});var T5=Np,Mh,M5=function(C,z,Z){return C[0]=z[0]-Z[0],C[1]=z[1]-Z[1],C[2]=z[2]-Z[2],C};Mh=new Fl(3),Fl!=Float32Array&&(Mh[0]=0,Mh[1]=0,Mh[2]=0);function xg(C,z,Z){var oe=z[0],pe=z[1],xe=z[2],Se=z[3];return C[0]=Z[0]*oe+Z[4]*pe+Z[8]*xe+Z[12]*Se,C[1]=Z[1]*oe+Z[5]*pe+Z[9]*xe+Z[13]*Se,C[2]=Z[2]*oe+Z[6]*pe+Z[10]*xe+Z[14]*Se,C[3]=Z[3]*oe+Z[7]*pe+Z[11]*xe+Z[15]*Se,C}(function(){(function(){var C=new Fl(4);return Fl!=Float32Array&&(C[0]=0,C[1]=0,C[2]=0,C[3]=0),C})()})();var L1=function(C){var z=C[0],Z=C[1];return z*z+Z*Z},oG=(function(){(function(){var C=new Fl(2);return Fl!=Float32Array&&(C[0]=0,C[1]=0),C})()}(),function(C){function z(Z){C.call(this,Z,k5)}return C&&(z.__proto__=C),z.prototype=Object.create(C&&C.prototype),z.prototype.constructor=z,z.prototype.createBucket=function(Z){return new Ho(Z)},z.prototype.queryRadius=function(Z){var oe=Z;return go("circle-radius",this,oe)+go("circle-stroke-width",this,oe)+Ws(this.paint.get("circle-translate"))},z.prototype.queryIntersectsFeature=function(Z,oe,pe,xe,Se,Ne,Ze,ct){for(var gt=Ys(Z,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),Ne.angle,Ze),Bt=this.paint.get("circle-radius").evaluate(oe,pe)+this.paint.get("circle-stroke-width").evaluate(oe,pe),Xt=this.paint.get("circle-pitch-alignment")==="map",Gt=Xt?gt:function(Hr,Vr){return Hr.map(function(ti){return kC(ti,Vr)})}(gt,ct),on=Xt?Bt*Ze:Bt,yn=0,Cn=xe;ynC.width||pe.height>C.height||Z.x>C.width-pe.width||Z.y>C.height-pe.height)throw new RangeError("out of range source coordinates for image copy");if(pe.width>z.width||pe.height>z.height||oe.x>z.width-pe.width||oe.y>z.height-pe.height)throw new RangeError("out of range destination coordinates for image copy");for(var Se=C.data,Ne=z.data,Ze=0;Ze80*Z){oe=xe=C[0],pe=Se=C[1];for(var on=Z;onxe&&(xe=Ne),Ze>Se&&(Se=Ze);ct=(ct=Math.max(xe-oe,Se-pe))!==0?1/ct:0}return D1(Xt,Gt,Z,oe,pe,ct),Gt}function CC(C,z,Z,oe,pe){var xe,Se;if(pe===O5(C,z,Z,oe)>0)for(xe=z;xe=z;xe-=oe)Se=OC(xe,C[xe],C[xe+1],Se);return Se&&jx(Se,Se.next)&&(P1(Se),Se=Se.next),Se}function Ad(C,z){if(!C)return C;z||(z=C);var Z,oe=C;do if(Z=!1,oe.steiner||!jx(oe,oe.next)&&cs(oe.prev,oe,oe.next)!==0)oe=oe.next;else{if(P1(oe),(oe=z=oe.prev)===oe.next)break;Z=!0}while(Z||oe!==z);return z}function D1(C,z,Z,oe,pe,xe,Se){if(C){!Se&&xe&&function(gt,Bt,Xt,Gt){var on=gt;do on.z===null&&(on.z=L5(on.x,on.y,Bt,Xt,Gt)),on.prevZ=on.prev,on.nextZ=on.next,on=on.next;while(on!==gt);on.prevZ.nextZ=null,on.prevZ=null,function(yn){var Cn,Sn,$n,Vn,Xn,dr,br,Hr,Vr=1;do{for(Sn=yn,yn=null,Xn=null,dr=0;Sn;){for(dr++,$n=Sn,br=0,Cn=0;Cn0||Hr>0&&$n;)br!==0&&(Hr===0||!$n||Sn.z<=$n.z)?(Vn=Sn,Sn=Sn.nextZ,br--):(Vn=$n,$n=$n.nextZ,Hr--),Xn?Xn.nextZ=Vn:yn=Vn,Vn.prevZ=Xn,Xn=Vn;Sn=$n}Xn.nextZ=null,Vr*=2}while(dr>1)}(on)}(C,oe,pe,xe);for(var Ne,Ze,ct=C;C.prev!==C.next;)if(Ne=C.prev,Ze=C.next,xe?dG(C,oe,pe,xe):hG(C))z.push(Ne.i/Z),z.push(C.i/Z),z.push(Ze.i/Z),P1(C),C=Ze.next,ct=Ze.next;else if((C=Ze)===ct){Se?Se===1?D1(C=pG(Ad(C),z,Z),z,Z,oe,pe,xe,2):Se===2&&gG(C,z,Z,oe,pe,xe):D1(Ad(C),z,Z,oe,pe,xe,1);break}}}function hG(C){var z=C.prev,Z=C,oe=C.next;if(cs(z,Z,oe)>=0)return!1;for(var pe=C.next.next;pe!==C.prev;){if(bg(z.x,z.y,Z.x,Z.y,oe.x,oe.y,pe.x,pe.y)&&cs(pe.prev,pe,pe.next)>=0)return!1;pe=pe.next}return!0}function dG(C,z,Z,oe){var pe=C.prev,xe=C,Se=C.next;if(cs(pe,xe,Se)>=0)return!1;for(var Ne=pe.xxe.x?pe.x>Se.x?pe.x:Se.x:xe.x>Se.x?xe.x:Se.x,gt=pe.y>xe.y?pe.y>Se.y?pe.y:Se.y:xe.y>Se.y?xe.y:Se.y,Bt=L5(Ne,Ze,z,Z,oe),Xt=L5(ct,gt,z,Z,oe),Gt=C.prevZ,on=C.nextZ;Gt&&Gt.z>=Bt&&on&&on.z<=Xt;){if(Gt!==C.prev&&Gt!==C.next&&bg(pe.x,pe.y,xe.x,xe.y,Se.x,Se.y,Gt.x,Gt.y)&&cs(Gt.prev,Gt,Gt.next)>=0||(Gt=Gt.prevZ,on!==C.prev&&on!==C.next&&bg(pe.x,pe.y,xe.x,xe.y,Se.x,Se.y,on.x,on.y)&&cs(on.prev,on,on.next)>=0))return!1;on=on.nextZ}for(;Gt&&Gt.z>=Bt;){if(Gt!==C.prev&&Gt!==C.next&&bg(pe.x,pe.y,xe.x,xe.y,Se.x,Se.y,Gt.x,Gt.y)&&cs(Gt.prev,Gt,Gt.next)>=0)return!1;Gt=Gt.prevZ}for(;on&&on.z<=Xt;){if(on!==C.prev&&on!==C.next&&bg(pe.x,pe.y,xe.x,xe.y,Se.x,Se.y,on.x,on.y)&&cs(on.prev,on,on.next)>=0)return!1;on=on.nextZ}return!0}function pG(C,z,Z){var oe=C;do{var pe=oe.prev,xe=oe.next.next;!jx(pe,xe)&&LC(pe,oe,oe.next,xe)&&O1(pe,xe)&&O1(xe,pe)&&(z.push(pe.i/Z),z.push(oe.i/Z),z.push(xe.i/Z),P1(oe),P1(oe.next),oe=C=xe),oe=oe.next}while(oe!==C);return Ad(oe)}function gG(C,z,Z,oe,pe,xe){var Se=C;do{for(var Ne=Se.next.next;Ne!==Se.prev;){if(Se.i!==Ne.i&&bG(Se,Ne)){var Ze=DC(Se,Ne);return Se=Ad(Se,Se.next),Ze=Ad(Ze,Ze.next),D1(Se,z,Z,oe,pe,xe),void D1(Ze,z,Z,oe,pe,xe)}Ne=Ne.next}Se=Se.next}while(Se!==C)}function mG(C,z){return C.x-z.x}function yG(C,z){if(z=function(oe,pe){var xe,Se=pe,Ne=oe.x,Ze=oe.y,ct=-1/0;do{if(Ze<=Se.y&&Ze>=Se.next.y&&Se.next.y!==Se.y){var gt=Se.x+(Ze-Se.y)*(Se.next.x-Se.x)/(Se.next.y-Se.y);if(gt<=Ne&>>ct){if(ct=gt,gt===Ne){if(Ze===Se.y)return Se;if(Ze===Se.next.y)return Se.next}xe=Se.x=Se.x&&Se.x>=Gt&&Ne!==Se.x&&bg(Zexe.x||Se.x===xe.x&&vG(xe,Se)))&&(xe=Se,yn=Bt)),Se=Se.next;while(Se!==Xt);return xe}(C,z)){var Z=DC(z,C);Ad(z,z.next),Ad(Z,Z.next)}}function vG(C,z){return cs(C.prev,C,z.prev)<0&&cs(z.next,C,C.next)<0}function L5(C,z,Z,oe,pe){return(C=1431655765&((C=858993459&((C=252645135&((C=16711935&((C=32767*(C-Z)*pe)|C<<8))|C<<4))|C<<2))|C<<1))|(z=1431655765&((z=858993459&((z=252645135&((z=16711935&((z=32767*(z-oe)*pe)|z<<8))|z<<4))|z<<2))|z<<1))<<1}function xG(C){var z=C,Z=C;do(z.x=0&&(C-Se)*(oe-Ne)-(Z-Se)*(z-Ne)>=0&&(Z-Se)*(xe-Ne)-(pe-Se)*(oe-Ne)>=0}function bG(C,z){return C.next.i!==z.i&&C.prev.i!==z.i&&!function(Z,oe){var pe=Z;do{if(pe.i!==Z.i&&pe.next.i!==Z.i&&pe.i!==oe.i&&pe.next.i!==oe.i&&LC(pe,pe.next,Z,oe))return!0;pe=pe.next}while(pe!==Z);return!1}(C,z)&&(O1(C,z)&&O1(z,C)&&function(Z,oe){var pe=Z,xe=!1,Se=(Z.x+oe.x)/2,Ne=(Z.y+oe.y)/2;do pe.y>Ne!=pe.next.y>Ne&&pe.next.y!==pe.y&&Se<(pe.next.x-pe.x)*(Ne-pe.y)/(pe.next.y-pe.y)+pe.x&&(xe=!xe),pe=pe.next;while(pe!==Z);return xe}(C,z)&&(cs(C.prev,C,z.prev)||cs(C,z.prev,z))||jx(C,z)&&cs(C.prev,C,C.next)>0&&cs(z.prev,z,z.next)>0)}function cs(C,z,Z){return(z.y-C.y)*(Z.x-z.x)-(z.x-C.x)*(Z.y-z.y)}function jx(C,z){return C.x===z.x&&C.y===z.y}function LC(C,z,Z,oe){var pe=$x(cs(C,z,Z)),xe=$x(cs(C,z,oe)),Se=$x(cs(Z,oe,C)),Ne=$x(cs(Z,oe,z));return pe!==xe&&Se!==Ne||!(pe!==0||!Ux(C,Z,z))||!(xe!==0||!Ux(C,oe,z))||!(Se!==0||!Ux(Z,C,oe))||!(Ne!==0||!Ux(Z,z,oe))}function Ux(C,z,Z){return z.x<=Math.max(C.x,Z.x)&&z.x>=Math.min(C.x,Z.x)&&z.y<=Math.max(C.y,Z.y)&&z.y>=Math.min(C.y,Z.y)}function $x(C){return C>0?1:C<0?-1:0}function O1(C,z){return cs(C.prev,C,C.next)<0?cs(C,z,C.next)>=0&&cs(C,C.prev,z)>=0:cs(C,z,C.prev)<0||cs(C,C.next,z)<0}function DC(C,z){var Z=new D5(C.i,C.x,C.y),oe=new D5(z.i,z.x,z.y),pe=C.next,xe=z.prev;return C.next=z,z.prev=C,Z.next=pe,pe.prev=Z,oe.next=Z,Z.prev=oe,xe.next=oe,oe.prev=xe,oe}function OC(C,z,Z,oe){var pe=new D5(C,z,Z);return oe?(pe.next=oe.next,pe.prev=oe,oe.next.prev=pe,oe.next=pe):(pe.prev=pe,pe.next=pe),pe}function P1(C){C.next.prev=C.prev,C.prev.next=C.next,C.prevZ&&(C.prevZ.nextZ=C.nextZ),C.nextZ&&(C.nextZ.prevZ=C.prevZ)}function D5(C,z,Z){this.i=C,this.x=z,this.y=Z,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function O5(C,z,Z,oe){for(var pe=0,xe=z,Se=Z-oe;xeZe;){if(ct-Ze>600){var Bt=ct-Ze+1,Xt=Ne-Ze+1,Gt=Math.log(Bt),on=.5*Math.exp(2*Gt/3),yn=.5*Math.sqrt(Gt*on*(Bt-on)/Bt)*(Xt-Bt/2<0?-1:1),Cn=Math.max(Ze,Math.floor(Ne-Xt*on/Bt+yn)),Sn=Math.min(ct,Math.floor(Ne+(Bt-Xt)*on/Bt+yn));xe(Se,Ne,Cn,Sn,gt)}var $n=Se[Ne],Vn=Ze,Xn=ct;for(I1(Se,Ze,Ne),gt(Se[ct],$n)>0&&I1(Se,Ze,ct);Vn0;)Xn--}gt(Se[Ze],$n)===0?I1(Se,Ze,Xn):(Xn++,I1(Se,Xn,ct)),Xn<=Ne&&(Ze=Xn+1),Ne<=Xn&&(ct=Xn-1)}})(C,z,Z||0,oe||C.length-1,pe||wG)}function I1(C,z,Z){var oe=C[z];C[z]=C[Z],C[Z]=oe}function wG(C,z){return Cz?1:0}function P5(C,z){var Z=C.length;if(Z<=1)return[C];for(var oe,pe,xe=[],Se=0;Se1)for(var Ze=0;Ze0&&(oe+=C[pe-1].length,Z.holes.push(oe))}return Z},C5.default=fG;var qc=function(C){this.zoom=C.zoom,this.overscaling=C.overscaling,this.layers=C.layers,this.layerIds=this.layers.map(function(z){return z.id}),this.index=C.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Eu,this.indexArray=new us,this.indexArray2=new $,this.programConfigurations=new Ga(SC,C.layers,C.zoom),this.segments=new Nt,this.segments2=new Nt,this.stateDependentLayerIds=this.layers.filter(function(z){return z.isStateDependent()}).map(function(z){return z.id})};qc.prototype.populate=function(C,z,Z){this.hasPattern=I5("fill",this.layers,z);for(var oe=this.layers[0].layout.get("fill-sort-key"),pe=[],xe=0,Se=C;xe>3}if(pe--,oe===1||oe===2)xe+=C.readSVarint(),Se+=C.readSVarint(),oe===1&&(z&&Ne.push(z),z=[]),z.push(new d(xe,Se));else{if(oe!==7)throw new Error("unknown command "+oe);z&&z.push(z[0].clone())}}return z&&Ne.push(z),Ne},_g.prototype.bbox=function(){var C=this._pbf;C.pos=this._geometry;for(var z=C.readVarint()+C.pos,Z=1,oe=0,pe=0,xe=0,Se=1/0,Ne=-1/0,Ze=1/0,ct=-1/0;C.pos>3}if(oe--,Z===1||Z===2)(pe+=C.readSVarint())Ne&&(Ne=pe),(xe+=C.readSVarint())ct&&(ct=xe);else if(Z!==7)throw new Error("unknown command "+Z)}return[Se,Ze,Ne,ct]},_g.prototype.toGeoJSON=function(C,z,Z){var oe,pe,xe=this.extent*Math.pow(2,Z),Se=this.extent*C,Ne=this.extent*z,Ze=this.loadGeometry(),ct=_g.types[this.type];function gt(Gt){for(var on=0;on>3;pe=Se===1?oe.readString():Se===2?oe.readFloat():Se===3?oe.readDouble():Se===4?oe.readVarint64():Se===5?oe.readVarint():Se===6?oe.readSVarint():Se===7?oe.readBoolean():null}return pe}(Z))}function LG(C,z,Z){if(C===3){var oe=new FC(Z,Z.readVarint()+Z.pos);oe.length&&(z[oe.name]=oe)}}RC.prototype.feature=function(C){if(C<0||C>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[C];var z=this._pbf.readVarint()+this._pbf.pos;return new IC(this._pbf,z,this.extent,this._keys,this._values)};var wg={VectorTile:function(C,z){this.layers=C.readFields(LG,{},z)},VectorTileFeature:IC,VectorTileLayer:FC},DG=wg.VectorTileFeature.types,R5=Math.pow(2,13);function F1(C,z,Z,oe,pe,xe,Se,Ne){C.emplaceBack(z,Z,2*Math.floor(oe*R5)+Se,pe*R5*2,xe*R5*2,Math.round(Ne))}var Hc=function(C){this.zoom=C.zoom,this.overscaling=C.overscaling,this.layers=C.layers,this.layerIds=this.layers.map(function(z){return z.id}),this.index=C.index,this.hasPattern=!1,this.layoutVertexArray=new ec,this.indexArray=new us,this.programConfigurations=new Ga(PC,C.layers,C.zoom),this.segments=new Nt,this.stateDependentLayerIds=this.layers.filter(function(z){return z.isStateDependent()}).map(function(z){return z.id})};function OG(C,z){return C.x===z.x&&(C.x<0||C.x>8192)||C.y===z.y&&(C.y<0||C.y>8192)}function PG(C){return C.every(function(z){return z.x<0})||C.every(function(z){return z.x>8192})||C.every(function(z){return z.y<0})||C.every(function(z){return z.y>8192})}Hc.prototype.populate=function(C,z,Z){this.features=[],this.hasPattern=I5("fill-extrusion",this.layers,z);for(var oe=0,pe=C;oe=1){var $n=on[Cn-1];if(!OG(Sn,$n)){Bt.vertexLength+4>Nt.MAX_VERTEX_ARRAY_LENGTH&&(Bt=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));var Vn=Sn.sub($n)._perp()._unit(),Xn=$n.dist(Sn);yn+Xn>32768&&(yn=0),F1(this.layoutVertexArray,Sn.x,Sn.y,Vn.x,Vn.y,0,0,yn),F1(this.layoutVertexArray,Sn.x,Sn.y,Vn.x,Vn.y,0,1,yn),yn+=Xn,F1(this.layoutVertexArray,$n.x,$n.y,Vn.x,Vn.y,0,0,yn),F1(this.layoutVertexArray,$n.x,$n.y,Vn.x,Vn.y,0,1,yn);var dr=Bt.vertexLength;this.indexArray.emplaceBack(dr,dr+2,dr+1),this.indexArray.emplaceBack(dr+1,dr+2,dr+3),Bt.vertexLength+=4,Bt.primitiveLength+=2}}}}if(Bt.vertexLength+Ze>Nt.MAX_VERTEX_ARRAY_LENGTH&&(Bt=this.segments.prepareSegment(Ze,this.layoutVertexArray,this.indexArray)),DG[C.type]==="Polygon"){for(var br=[],Hr=[],Vr=Bt.vertexLength,ti=0,vi=Ne;ti=2&&C[Ze-1].equals(C[Ze-2]);)Ze--;for(var ct=0;ct0;if(Hr&&Sn>ct){var ti=gt.dist(Gt);if(ti>2*Bt){var vi=gt.sub(gt.sub(Gt)._mult(Bt/ti)._round());this.updateDistance(Gt,vi),this.addCurrentVertex(vi,yn,0,0,Xt),Gt=vi}}var xi=Gt&&on,ui=xi?Z:Ne?"butt":oe;if(xi&&ui==="round"&&(drpe&&(ui="bevel"),ui==="bevel"&&(dr>2&&(ui="flipbevel"),dr100)$n=Cn.mult(-1);else{var Ei=dr*yn.add(Cn).mag()/yn.sub(Cn).mag();$n._perp()._mult(Ei*(Vr?-1:1))}this.addCurrentVertex(gt,$n,0,0,Xt),this.addCurrentVertex(gt,$n.mult(-1),0,0,Xt)}else if(ui==="bevel"||ui==="fakeround"){var ki=-Math.sqrt(dr*dr-1),bi=Vr?ki:0,Ma=Vr?0:ki;if(Gt&&this.addCurrentVertex(gt,yn,bi,Ma,Xt),ui==="fakeround")for(var ma=Math.round(180*br/Math.PI/20),Oa=1;Oa2*Bt){var Ya=gt.add(on.sub(gt)._mult(Bt/yo)._round());this.updateDistance(gt,Ya),this.addCurrentVertex(Ya,Cn,0,0,Xt),gt=Ya}}}}},zl.prototype.addCurrentVertex=function(C,z,Z,oe,pe,xe){xe===void 0&&(xe=!1);var Se=z.x+z.y*Z,Ne=z.y-z.x*Z,Ze=-z.x+z.y*oe,ct=-z.y-z.x*oe;this.addHalfVertex(C,Se,Ne,xe,!1,Z,pe),this.addHalfVertex(C,Ze,ct,xe,!0,-oe,pe),this.distance>BC/2&&this.totalDistance===0&&(this.distance=0,this.addCurrentVertex(C,z,Z,oe,pe,xe))},zl.prototype.addHalfVertex=function(C,z,Z,oe,pe,xe,Se){var Ne=C.x,Ze=C.y,ct=.5*this.scaledDistance;this.layoutVertexArray.emplaceBack((Ne<<1)+(oe?1:0),(Ze<<1)+(pe?1:0),Math.round(63*z)+128,Math.round(63*Z)+128,1+(xe===0?0:xe<0?-1:1)|(63&ct)<<2,ct>>6);var gt=Se.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,gt),Se.primitiveLength++),pe?this.e2=gt:this.e1=gt},zl.prototype.updateScaledDistance=function(){this.scaledDistance=this.totalDistance>0?(this.clipStart+(this.clipEnd-this.clipStart)*this.distance/this.totalDistance)*(BC-1):this.distance},zl.prototype.updateDistance=function(C,z){this.distance+=C.dist(z),this.updateScaledDistance()},Qn("LineBucket",zl,{omit:["layers","patternFeatures"]});var NG=new Gs({"line-cap":new wi(Pe.layout_line["line-cap"]),"line-join":new Ii(Pe.layout_line["line-join"]),"line-miter-limit":new wi(Pe.layout_line["line-miter-limit"]),"line-round-limit":new wi(Pe.layout_line["line-round-limit"]),"line-sort-key":new Ii(Pe.layout_line["line-sort-key"])}),jC={paint:new Gs({"line-opacity":new Ii(Pe.paint_line["line-opacity"]),"line-color":new Ii(Pe.paint_line["line-color"]),"line-translate":new wi(Pe.paint_line["line-translate"]),"line-translate-anchor":new wi(Pe.paint_line["line-translate-anchor"]),"line-width":new Ii(Pe.paint_line["line-width"]),"line-gap-width":new Ii(Pe.paint_line["line-gap-width"]),"line-offset":new Ii(Pe.paint_line["line-offset"]),"line-blur":new Ii(Pe.paint_line["line-blur"]),"line-dasharray":new If(Pe.paint_line["line-dasharray"]),"line-pattern":new Pf(Pe.paint_line["line-pattern"]),"line-gradient":new nu(Pe.paint_line["line-gradient"])}),layout:NG},UC=new(function(C){function z(){C.apply(this,arguments)}return C&&(z.__proto__=C),z.prototype=Object.create(C&&C.prototype),z.prototype.constructor=z,z.prototype.possiblyEvaluate=function(Z,oe){return oe=new Ia(Math.floor(oe.zoom),{now:oe.now,fadeDuration:oe.fadeDuration,zoomHistory:oe.zoomHistory,transition:oe.transition}),C.prototype.possiblyEvaluate.call(this,Z,oe)},z.prototype.evaluate=function(Z,oe,pe,xe){return oe=x({},oe,{zoom:Math.floor(oe.zoom)}),C.prototype.evaluate.call(this,Z,oe,pe,xe)},z}(Ii))(jC.paint.properties["line-width"].specification);UC.useIntegerZoom=!0;var BG=function(C){function z(Z){C.call(this,Z,jC)}return C&&(z.__proto__=C),z.prototype=Object.create(C&&C.prototype),z.prototype.constructor=z,z.prototype._handleSpecialPaintPropertyUpdate=function(Z){Z==="line-gradient"&&this._updateGradient()},z.prototype._updateGradient=function(){var Z=this._transitionablePaint._values["line-gradient"].value.expression;this.gradient=EC(Z,"lineProgress"),this.gradientTexture=null},z.prototype.recalculate=function(Z,oe){C.prototype.recalculate.call(this,Z,oe),this.paint._values["line-floorwidth"]=UC.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,Z)},z.prototype.createBucket=function(Z){return new zl(Z)},z.prototype.queryRadius=function(Z){var oe=Z,pe=$C(go("line-width",this,oe),go("line-gap-width",this,oe)),xe=go("line-offset",this,oe);return pe/2+Math.abs(xe)+Ws(this.paint.get("line-translate"))},z.prototype.queryIntersectsFeature=function(Z,oe,pe,xe,Se,Ne,Ze){var ct=Ys(Z,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),Ne.angle,Ze),gt=Ze/2*$C(this.paint.get("line-width").evaluate(oe,pe),this.paint.get("line-gap-width").evaluate(oe,pe)),Bt=this.paint.get("line-offset").evaluate(oe,pe);return Bt&&(xe=function(Xt,Gt){for(var on=[],yn=new d(0,0),Cn=0;Cn=3){for(var Sn=0;Sn0?z+2*C:C}var z5=Fa([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),jG=Fa([{name:"a_projected_pos",components:3,type:"Float32"}],4),UG=(Fa([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),Fa([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}])),VC=(Fa([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]),Fa([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4)),$G=Fa([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);Fa([{name:"triangle",components:3,type:"Uint16"}]),Fa([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),Fa([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),Fa([{type:"Float32",name:"offsetX"}]),Fa([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);function VG(C,z,Z){return C.sections.forEach(function(oe){oe.text=function(pe,xe,Se){var Ne=xe.layout.get("text-transform").evaluate(Se,{});return Ne==="uppercase"?pe=pe.toLocaleUpperCase():Ne==="lowercase"&&(pe=pe.toLocaleLowerCase()),xs.applyArabicShaping&&(pe=xs.applyArabicShaping(pe)),pe}(oe.text,z,Z)}),C}var z1={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"},qC=function(C,z,Z,oe,pe){var xe,Se,Ne=8*pe-oe-1,Ze=(1<>1,gt=-7,Bt=Z?pe-1:0,Xt=Z?-1:1,Gt=C[z+Bt];for(Bt+=Xt,xe=Gt&(1<<-gt)-1,Gt>>=-gt,gt+=Ne;gt>0;xe=256*xe+C[z+Bt],Bt+=Xt,gt-=8);for(Se=xe&(1<<-gt)-1,xe>>=-gt,gt+=oe;gt>0;Se=256*Se+C[z+Bt],Bt+=Xt,gt-=8);if(xe===0)xe=1-ct;else{if(xe===Ze)return Se?NaN:1/0*(Gt?-1:1);Se+=Math.pow(2,oe),xe-=ct}return(Gt?-1:1)*Se*Math.pow(2,xe-oe)},HC=function(C,z,Z,oe,pe,xe){var Se,Ne,Ze,ct=8*xe-pe-1,gt=(1<>1,Xt=pe===23?Math.pow(2,-24)-Math.pow(2,-77):0,Gt=oe?0:xe-1,on=oe?1:-1,yn=z<0||z===0&&1/z<0?1:0;for(z=Math.abs(z),isNaN(z)||z===1/0?(Ne=isNaN(z)?1:0,Se=gt):(Se=Math.floor(Math.log(z)/Math.LN2),z*(Ze=Math.pow(2,-Se))<1&&(Se--,Ze*=2),(z+=Se+Bt>=1?Xt/Ze:Xt*Math.pow(2,1-Bt))*Ze>=2&&(Se++,Ze/=2),Se+Bt>=gt?(Ne=0,Se=gt):Se+Bt>=1?(Ne=(z*Ze-1)*Math.pow(2,pe),Se+=Bt):(Ne=z*Math.pow(2,Bt-1)*Math.pow(2,pe),Se=0));pe>=8;C[Z+Gt]=255&Ne,Gt+=on,Ne/=256,pe-=8);for(Se=Se<0;C[Z+Gt]=255&Se,Gt+=on,Se/=256,ct-=8);C[Z+Gt-on]|=128*yn},Vx=io;function io(C){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(C)?C:new Uint8Array(C||0),this.pos=0,this.type=0,this.length=this.buf.length}io.Varint=0,io.Fixed64=1,io.Bytes=2,io.Fixed32=5;var GC=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function Eh(C){return C.type===io.Bytes?C.readVarint()+C.pos:C.pos+1}function Ag(C,z,Z){return Z?4294967296*z+(C>>>0):4294967296*(z>>>0)+(C>>>0)}function WC(C,z,Z){var oe=z<=16383?1:z<=2097151?2:z<=268435455?3:Math.floor(Math.log(z)/(7*Math.LN2));Z.realloc(oe);for(var pe=Z.pos-1;pe>=C;pe--)Z.buf[pe+oe]=Z.buf[pe]}function qG(C,z){for(var Z=0;Z>>8,C[Z+2]=z>>>16,C[Z+3]=z>>>24}function YC(C,z){return(C[z]|C[z+1]<<8|C[z+2]<<16)+(C[z+3]<<24)}io.prototype={destroy:function(){this.buf=null},readFields:function(C,z,Z){for(Z=Z||this.length;this.pos>3,xe=this.pos;this.type=7&oe,C(pe,z,this),this.pos===xe&&this.skip(oe)}return z},readMessage:function(C,z){return this.readFields(C,z,this.readVarint()+this.pos)},readFixed32:function(){var C=qx(this.buf,this.pos);return this.pos+=4,C},readSFixed32:function(){var C=YC(this.buf,this.pos);return this.pos+=4,C},readFixed64:function(){var C=qx(this.buf,this.pos)+4294967296*qx(this.buf,this.pos+4);return this.pos+=8,C},readSFixed64:function(){var C=qx(this.buf,this.pos)+4294967296*YC(this.buf,this.pos+4);return this.pos+=8,C},readFloat:function(){var C=qC(this.buf,this.pos,!0,23,4);return this.pos+=4,C},readDouble:function(){var C=qC(this.buf,this.pos,!0,52,8);return this.pos+=8,C},readVarint:function(C){var z,Z,oe=this.buf;return z=127&(Z=oe[this.pos++]),Z<128?z:(z|=(127&(Z=oe[this.pos++]))<<7,Z<128?z:(z|=(127&(Z=oe[this.pos++]))<<14,Z<128?z:(z|=(127&(Z=oe[this.pos++]))<<21,Z<128?z:function(pe,xe,Se){var Ne,Ze,ct=Se.buf;if(Ze=ct[Se.pos++],Ne=(112&Ze)>>4,Ze<128||(Ze=ct[Se.pos++],Ne|=(127&Ze)<<3,Ze<128)||(Ze=ct[Se.pos++],Ne|=(127&Ze)<<10,Ze<128)||(Ze=ct[Se.pos++],Ne|=(127&Ze)<<17,Ze<128)||(Ze=ct[Se.pos++],Ne|=(127&Ze)<<24,Ze<128)||(Ze=ct[Se.pos++],Ne|=(1&Ze)<<31,Ze<128))return Ag(pe,Ne,xe);throw new Error("Expected varint not more than 10 bytes")}(z|=(15&(Z=oe[this.pos]))<<28,C,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var C=this.readVarint();return C%2==1?(C+1)/-2:C/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var C=this.readVarint()+this.pos,z=this.pos;return this.pos=C,C-z>=12&&GC?function(Z,oe,pe){return GC.decode(Z.subarray(oe,pe))}(this.buf,z,C):function(Z,oe,pe){for(var xe="",Se=oe;Se239?4:gt>223?3:gt>191?2:1;if(Se+Xt>pe)break;Xt===1?gt<128&&(Bt=gt):Xt===2?(192&(Ne=Z[Se+1]))==128&&(Bt=(31>)<<6|63&Ne)<=127&&(Bt=null):Xt===3?(Ne=Z[Se+1],Ze=Z[Se+2],(192&Ne)==128&&(192&Ze)==128&&((Bt=(15>)<<12|(63&Ne)<<6|63&Ze)<=2047||Bt>=55296&&Bt<=57343)&&(Bt=null)):Xt===4&&(Ne=Z[Se+1],Ze=Z[Se+2],ct=Z[Se+3],(192&Ne)==128&&(192&Ze)==128&&(192&ct)==128&&((Bt=(15>)<<18|(63&Ne)<<12|(63&Ze)<<6|63&ct)<=65535||Bt>=1114112)&&(Bt=null)),Bt===null?(Bt=65533,Xt=1):Bt>65535&&(Bt-=65536,xe+=String.fromCharCode(Bt>>>10&1023|55296),Bt=56320|1023&Bt),xe+=String.fromCharCode(Bt),Se+=Xt}return xe}(this.buf,z,C)},readBytes:function(){var C=this.readVarint()+this.pos,z=this.buf.subarray(this.pos,C);return this.pos=C,z},readPackedVarint:function(C,z){if(this.type!==io.Bytes)return C.push(this.readVarint(z));var Z=Eh(this);for(C=C||[];this.pos127;);else if(z===io.Bytes)this.pos=this.readVarint()+this.pos;else if(z===io.Fixed32)this.pos+=4;else{if(z!==io.Fixed64)throw new Error("Unimplemented type: "+z);this.pos+=8}},writeTag:function(C,z){this.writeVarint(C<<3|z)},realloc:function(C){for(var z=this.length||16;z268435455||C<0?function(z,Z){var oe,pe;if(z>=0?(oe=z%4294967296|0,pe=z/4294967296|0):(pe=~(-z/4294967296),4294967295^(oe=~(-z%4294967296))?oe=oe+1|0:(oe=0,pe=pe+1|0)),z>=18446744073709552e3||z<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");Z.realloc(10),function(xe,Se,Ne){Ne.buf[Ne.pos++]=127&xe|128,xe>>>=7,Ne.buf[Ne.pos++]=127&xe|128,xe>>>=7,Ne.buf[Ne.pos++]=127&xe|128,xe>>>=7,Ne.buf[Ne.pos++]=127&xe|128,xe>>>=7,Ne.buf[Ne.pos]=127&xe}(oe,0,Z),function(xe,Se){var Ne=(7&xe)<<4;Se.buf[Se.pos++]|=Ne|((xe>>>=3)?128:0),xe&&(Se.buf[Se.pos++]=127&xe|((xe>>>=7)?128:0),xe&&(Se.buf[Se.pos++]=127&xe|((xe>>>=7)?128:0),xe&&(Se.buf[Se.pos++]=127&xe|((xe>>>=7)?128:0),xe&&(Se.buf[Se.pos++]=127&xe|((xe>>>=7)?128:0),xe&&(Se.buf[Se.pos++]=127&xe)))))}(pe,Z)}(C,this):(this.realloc(4),this.buf[this.pos++]=127&C|(C>127?128:0),C<=127||(this.buf[this.pos++]=127&(C>>>=7)|(C>127?128:0),C<=127||(this.buf[this.pos++]=127&(C>>>=7)|(C>127?128:0),C<=127||(this.buf[this.pos++]=C>>>7&127))))},writeSVarint:function(C){this.writeVarint(C<0?2*-C-1:2*C)},writeBoolean:function(C){this.writeVarint(!!C)},writeString:function(C){C=String(C),this.realloc(4*C.length),this.pos++;var z=this.pos;this.pos=function(oe,pe,xe){for(var Se,Ne,Ze=0;Ze55295&&Se<57344){if(!Ne){Se>56319||Ze+1===pe.length?(oe[xe++]=239,oe[xe++]=191,oe[xe++]=189):Ne=Se;continue}if(Se<56320){oe[xe++]=239,oe[xe++]=191,oe[xe++]=189,Ne=Se;continue}Se=Ne-55296<<10|Se-56320|65536,Ne=null}else Ne&&(oe[xe++]=239,oe[xe++]=191,oe[xe++]=189,Ne=null);Se<128?oe[xe++]=Se:(Se<2048?oe[xe++]=Se>>6|192:(Se<65536?oe[xe++]=Se>>12|224:(oe[xe++]=Se>>18|240,oe[xe++]=Se>>12&63|128),oe[xe++]=Se>>6&63|128),oe[xe++]=63&Se|128)}return xe}(this.buf,C,this.pos);var Z=this.pos-z;Z>=128&&WC(z,Z,this),this.pos=z-1,this.writeVarint(Z),this.pos+=Z},writeFloat:function(C){this.realloc(4),HC(this.buf,C,this.pos,!0,23,4),this.pos+=4},writeDouble:function(C){this.realloc(8),HC(this.buf,C,this.pos,!0,52,8),this.pos+=8},writeBytes:function(C){var z=C.length;this.writeVarint(z),this.realloc(z);for(var Z=0;Z=128&&WC(Z,oe,this),this.pos=Z-1,this.writeVarint(oe),this.pos+=oe},writeMessage:function(C,z,Z){this.writeTag(C,io.Bytes),this.writeRawMessage(z,Z)},writePackedVarint:function(C,z){z.length&&this.writeMessage(C,qG,z)},writePackedSVarint:function(C,z){z.length&&this.writeMessage(C,HG,z)},writePackedBoolean:function(C,z){z.length&&this.writeMessage(C,YG,z)},writePackedFloat:function(C,z){z.length&&this.writeMessage(C,GG,z)},writePackedDouble:function(C,z){z.length&&this.writeMessage(C,WG,z)},writePackedFixed32:function(C,z){z.length&&this.writeMessage(C,XG,z)},writePackedSFixed32:function(C,z){z.length&&this.writeMessage(C,ZG,z)},writePackedFixed64:function(C,z){z.length&&this.writeMessage(C,JG,z)},writePackedSFixed64:function(C,z){z.length&&this.writeMessage(C,KG,z)},writeBytesField:function(C,z){this.writeTag(C,io.Bytes),this.writeBytes(z)},writeFixed32Field:function(C,z){this.writeTag(C,io.Fixed32),this.writeFixed32(z)},writeSFixed32Field:function(C,z){this.writeTag(C,io.Fixed32),this.writeSFixed32(z)},writeFixed64Field:function(C,z){this.writeTag(C,io.Fixed64),this.writeFixed64(z)},writeSFixed64Field:function(C,z){this.writeTag(C,io.Fixed64),this.writeSFixed64(z)},writeVarintField:function(C,z){this.writeTag(C,io.Varint),this.writeVarint(z)},writeSVarintField:function(C,z){this.writeTag(C,io.Varint),this.writeSVarint(z)},writeStringField:function(C,z){this.writeTag(C,io.Bytes),this.writeString(z)},writeFloatField:function(C,z){this.writeTag(C,io.Fixed32),this.writeFloat(z)},writeDoubleField:function(C,z){this.writeTag(C,io.Fixed64),this.writeDouble(z)},writeBooleanField:function(C,z){this.writeVarintField(C,!!z)}};function QG(C,z,Z){C===1&&Z.readMessage(eW,z)}function eW(C,z,Z){if(C===3){var oe=Z.readMessage(tW,{}),pe=oe.id,xe=oe.bitmap,Se=oe.width,Ne=oe.height,Ze=oe.left,ct=oe.top,gt=oe.advance;z.push({id:pe,bitmap:new Bp({width:Se+6,height:Ne+6},xe),metrics:{width:Se,height:Ne,left:Ze,top:ct,advance:gt}})}}function tW(C,z,Z){C===1?z.id=Z.readVarint():C===2?z.bitmap=Z.readBytes():C===3?z.width=Z.readVarint():C===4?z.height=Z.readVarint():C===5?z.left=Z.readSVarint():C===6?z.top=Z.readSVarint():C===7&&(z.advance=Z.readVarint())}function XC(C){for(var z=0,Z=0,oe=0,pe=C;oe=0;Xt--){var Gt=Se[Xt];if(!(Bt.w>Gt.w||Bt.h>Gt.h)){if(Bt.x=Gt.x,Bt.y=Gt.y,Ze=Math.max(Ze,Bt.y+Bt.h),Ne=Math.max(Ne,Bt.x+Bt.w),Bt.w===Gt.w&&Bt.h===Gt.h){var on=Se.pop();Xt0&&Pg>Oo&&(Oo=Pg)}else{var nb=ma[Ra.fontStack],Vp=nb&&nb[Tl];if(Vp&&Vp.rect)Gc=Vp.rect,al=Vp.metrics;else{var rb=Ma[Ra.fontStack],ib=rb&&rb[Tl];if(!ib)continue;al=ib.metrics}au=24*(sa-Ra.scale)}Wc?(bi.verticalizable=!0,No.push({glyph:Tl,imageName:Lh,x:Xs,y:Ps+au,vertical:Wc,scale:Ra.scale,fontStack:Ra.fontStack,sectionIndex:Bo,metrics:al,rect:Gc}),Xs+=Is*Ra.scale+Ya):(No.push({glyph:Tl,imageName:Lh,x:Xs,y:Ps+au,vertical:Wc,scale:Ra.scale,fontStack:Ra.fontStack,sectionIndex:Bo,metrics:al,rect:Gc}),Xs+=al.advance*Ra.scale+Ya)}if(No.length!==0){var ab=Xs-Ya;Bs=Math.max(ab,Bs),rW(No,0,No.length-1,il,Oo)}Xs=0;var ob=va*sa+Oo;zo.lineOffset=Math.max(Oo,Sa),Ps+=ob,kl=Math.max(ob,kl),++ps}else Ps+=va,++ps}var Td,Ig=Ps- -17,sb=B5(ao),Fg=sb.horizontalAlign,Md=sb.verticalAlign;(function($1,lb,ub,cb,V1,fb,q1,hb,H1){var db=(lb-ub)*V1,Rg=0;Rg=fb!==q1?-hb*cb- -17:(-cb*H1+.5)*q1;for(var zg=0,Ng=$1;zg=0&&oe>=C&&Wx[this.text.charCodeAt(oe)];oe--)Z--;this.text=this.text.substring(C,Z),this.sectionIndex=this.sectionIndex.slice(C,Z)},rl.prototype.substring=function(C,z){var Z=new rl;return Z.text=this.text.substring(C,z),Z.sectionIndex=this.sectionIndex.slice(C,z),Z.sections=this.sections,Z},rl.prototype.toString=function(){return this.text},rl.prototype.getMaxScale=function(){var C=this;return this.sectionIndex.reduce(function(z,Z){return Math.max(z,C.sections[Z].scale)},0)},rl.prototype.addTextSection=function(C,z){this.text+=C.text,this.sections.push(Tg.forText(C.scale,C.fontStack||z));for(var Z=this.sections.length-1,oe=0;oe=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)};var Wx={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},iu={};function ZC(C,z,Z,oe,pe,xe){if(z.imageName){var Se=oe[z.imageName];return Se?Se.displaySize[0]*z.scale*24/xe+pe:0}var Ne=Z[z.fontStack],Ze=Ne&&Ne[C];return Ze?Ze.metrics.advance*z.scale+pe:0}function JC(C,z,Z,oe){var pe=Math.pow(C-z,2);return oe?C=0,Bt=0,Xt=0;Xt-Z/2;){if(--Se<0)return!1;Ne-=C[Se].dist(xe),xe=C[Se]}Ne+=C[Se].dist(C[Se+1]),Se++;for(var Ze=[],ct=0;Neoe;)ct-=Ze.shift().angleDelta;if(ct>pe)return!1;Se++,Ne+=Bt.dist(Xt)}return!0}function r9(C){for(var z=0,Z=0;Zct){var on=(ct-Ze)/Gt,yn=Ar(Bt.x,Xt.x,on),Cn=Ar(Bt.y,Xt.y,on),Sn=new Mg(yn,Cn,Xt.angleTo(Bt),gt);return Sn._round(),!Se||n9(C,Sn,Ne,Se,z)?Sn:void 0}Ze+=Gt}}function oW(C,z,Z,oe,pe,xe,Se,Ne,Ze){var ct=i9(oe,xe,Se),gt=a9(oe,pe),Bt=gt*Se,Xt=C[0].x===0||C[0].x===Ze||C[0].y===0||C[0].y===Ze;return z-Bt=0&&Oa=0&&Bi=0&&vi+Hr<=Vr){var va=new Mg(Oa,Bi,Ma,ui);va._round(),Sn&&!n9(on,va,Vn,Sn,$n)||xi.push(va)}}ti+=bi}return dr||xi.length||Xn||(xi=Gt(on,ti/2,Cn,Sn,$n,Vn,Xn,!0,br)),xi}(C,Xt?z/2*Ne%z:(gt/2+2*xe)*Se*Ne%z,z,ct,Z,Bt,Xt,!1,Ze)}function o9(C,z,Z,oe,pe){for(var xe=[],Se=0;Se=oe&&Bt.x>=oe||(gt.x>=oe?gt=new d(oe,gt.y+(Bt.y-gt.y)*((oe-gt.x)/(Bt.x-gt.x)))._round():Bt.x>=oe&&(Bt=new d(oe,gt.y+(Bt.y-gt.y)*((oe-gt.x)/(Bt.x-gt.x)))._round()),gt.y>=pe&&Bt.y>=pe||(gt.y>=pe?gt=new d(gt.x+(Bt.x-gt.x)*((pe-gt.y)/(Bt.y-gt.y)),pe)._round():Bt.y>=pe&&(Bt=new d(gt.x+(Bt.x-gt.x)*((pe-gt.y)/(Bt.y-gt.y)),pe)._round()),Ze&>.equals(Ze[Ze.length-1])||(Ze=[gt],xe.push(Ze)),Ze.push(Bt)))))}return xe}function s9(C,z,Z,oe){var pe=[],xe=C.image,Se=xe.pixelRatio,Ne=xe.paddedRect.w-2,Ze=xe.paddedRect.h-2,ct=C.right-C.left,gt=C.bottom-C.top,Bt=xe.stretchX||[[0,Ne]],Xt=xe.stretchY||[[0,Ze]],Gt=function(va,ao){return va+ao[1]-ao[0]},on=Bt.reduce(Gt,0),yn=Xt.reduce(Gt,0),Cn=Ne-on,Sn=Ze-yn,$n=0,Vn=on,Xn=0,dr=yn,br=0,Hr=Cn,Vr=0,ti=Sn;if(xe.content&&oe){var vi=xe.content;$n=Yx(Bt,0,vi[0]),Xn=Yx(Xt,0,vi[1]),Vn=Yx(Bt,vi[0],vi[2]),dr=Yx(Xt,vi[1],vi[3]),br=vi[0]-$n,Vr=vi[1]-Xn,Hr=vi[2]-vi[0]-Vn,ti=vi[3]-vi[1]-dr}var xi=function(va,ao,Wa,yo){var Ya=Xx(va.stretch-$n,Vn,ct,C.left),ds=Zx(va.fixed-br,Hr,va.stretch,on),vo=Xx(ao.stretch-Xn,dr,gt,C.top),Xs=Zx(ao.fixed-Vr,ti,ao.stretch,yn),Ps=Xx(Wa.stretch-$n,Vn,ct,C.left),Bs=Zx(Wa.fixed-br,Hr,Wa.stretch,on),kl=Xx(yo.stretch-Xn,dr,gt,C.top),il=Zx(yo.fixed-Vr,ti,yo.stretch,yn),ps=new d(Ya,vo),js=new d(Ps,vo),Jo=new d(Ps,kl),bs=new d(Ya,kl),sa=new d(ds/Se,Xs/Se),Sa=new d(Bs/Se,il/Se),zo=z*Math.PI/180;if(zo){var No=Math.sin(zo),Oo=Math.cos(zo),xo=[Oo,-No,No,Oo];ps._matMult(xo),js._matMult(xo),bs._matMult(xo),Jo._matMult(xo)}var Ra=va.stretch+va.fixed,Bo=Wa.stretch+Wa.fixed,Tl=ao.stretch+ao.fixed,au=yo.stretch+yo.fixed;return{tl:ps,tr:js,bl:bs,br:Jo,tex:{x:xe.paddedRect.x+1+Ra,y:xe.paddedRect.y+1+Tl,w:Bo-Ra,h:au-Tl},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:sa,pixelOffsetBR:Sa,minFontScaleX:Hr/Se/ct,minFontScaleY:ti/Se/gt,isSDF:Z}};if(oe&&(xe.stretchX||xe.stretchY))for(var ui=l9(Bt,Cn,on),Ei=l9(Xt,Sn,yn),ki=0;ki0&&(Gt=Math.max(10,Gt),this.circleDiameter=Gt)}else{var on=xe.top*Se-Ne,yn=xe.bottom*Se+Ne,Cn=xe.left*Se-Ne,Sn=xe.right*Se+Ne,$n=xe.collisionPadding;if($n&&(Cn-=$n[0]*Se,on-=$n[1]*Se,Sn+=$n[2]*Se,yn+=$n[3]*Se),ct){var Vn=new d(Cn,on),Xn=new d(Sn,on),dr=new d(Cn,yn),br=new d(Sn,yn),Hr=ct*Math.PI/180;Vn._rotate(Hr),Xn._rotate(Hr),dr._rotate(Hr),br._rotate(Hr),Cn=Math.min(Vn.x,Xn.x,dr.x,br.x),Sn=Math.max(Vn.x,Xn.x,dr.x,br.x),on=Math.min(Vn.y,Xn.y,dr.y,br.y),yn=Math.max(Vn.y,Xn.y,dr.y,br.y)}C.emplaceBack(z.x,z.y,Cn,on,Sn,yn,Z,oe,pe)}this.boxEndIndex=C.length},Eg=function(C,z){if(C===void 0&&(C=[]),z===void 0&&(z=sW),this.data=C,this.length=this.data.length,this.compare=z,this.length>0)for(var Z=(this.length>>1)-1;Z>=0;Z--)this._down(Z)};function sW(C,z){return Cz?1:0}function lW(C,z,Z){z===void 0&&(z=1),Z===void 0&&(Z=!1);for(var oe=1/0,pe=1/0,xe=-1/0,Se=-1/0,Ne=C[0],Ze=0;Zexe)&&(xe=ct.x),(!Ze||ct.y>Se)&&(Se=ct.y)}var gt=xe-oe,Bt=Se-pe,Xt=Math.min(gt,Bt),Gt=Xt/2,on=new Eg([],uW);if(Xt===0)return new d(oe,pe);for(var yn=oe;ynSn.d||!Sn.d)&&(Sn=Vn,Z&&console.log("found best %d after %d probes",Math.round(1e4*Vn.d)/1e4,$n)),Vn.max-Sn.d<=z||(Gt=Vn.h/2,on.push(new Sg(Vn.p.x-Gt,Vn.p.y-Gt,Gt,C)),on.push(new Sg(Vn.p.x+Gt,Vn.p.y-Gt,Gt,C)),on.push(new Sg(Vn.p.x-Gt,Vn.p.y+Gt,Gt,C)),on.push(new Sg(Vn.p.x+Gt,Vn.p.y+Gt,Gt,C)),$n+=4)}return Z&&(console.log("num probes: "+$n),console.log("best distance: "+Sn.d)),Sn.p}function uW(C,z){return z.max-C.max}function Sg(C,z,Z,oe){this.p=new d(C,z),this.h=Z,this.d=function(pe,xe){for(var Se=!1,Ne=1/0,Ze=0;Zepe.y!=on.y>pe.y&&pe.x<(on.x-Gt.x)*(pe.y-Gt.y)/(on.y-Gt.y)+Gt.x&&(Se=!Se),Ne=Math.min(Ne,Th(pe,Gt,on))}return(Se?1:-1)*Math.sqrt(Ne)}(this.p,oe),this.max=this.d+this.h*Math.SQRT2}Eg.prototype.push=function(C){this.data.push(C),this.length++,this._up(this.length-1)},Eg.prototype.pop=function(){if(this.length!==0){var C=this.data[0],z=this.data.pop();return this.length--,this.length>0&&(this.data[0]=z,this._down(0)),C}},Eg.prototype.peek=function(){return this.data[0]},Eg.prototype._up=function(C){for(var z=this.data,Z=this.compare,oe=z[C];C>0;){var pe=C-1>>1,xe=z[pe];if(Z(oe,xe)>=0)break;z[C]=xe,C=pe}z[C]=oe},Eg.prototype._down=function(C){for(var z=this.data,Z=this.compare,oe=this.length>>1,pe=z[C];C=0)break;z[C]=Se,C=xe}z[C]=pe};var U5=Number.POSITIVE_INFINITY;function u9(C,z){return z[1]!==U5?function(Z,oe,pe){var xe=0,Se=0;switch(oe=Math.abs(oe),pe=Math.abs(pe),Z){case"top-right":case"top-left":case"top":Se=pe-7;break;case"bottom-right":case"bottom-left":case"bottom":Se=7-pe}switch(Z){case"top-right":case"bottom-right":case"right":xe=-oe;break;case"top-left":case"bottom-left":case"left":xe=oe}return[xe,Se]}(C,z[0],z[1]):function(Z,oe){var pe=0,xe=0;oe<0&&(oe=0);var Se=oe/Math.sqrt(2);switch(Z){case"top-right":case"top-left":xe=Se-7;break;case"bottom-right":case"bottom-left":xe=7-Se;break;case"bottom":xe=7-oe;break;case"top":xe=oe-7}switch(Z){case"top-right":case"bottom-right":pe=-Se;break;case"top-left":case"bottom-left":pe=Se;break;case"left":pe=oe;break;case"right":pe=-oe}return[pe,xe]}(C,z[0])}function $5(C){switch(C){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function c9(C,z,Z,oe,pe,xe,Se,Ne,Ze,ct,gt,Bt,Xt,Gt,on){var yn=function(Xn,dr,br,Hr,Vr,ti,vi,xi){for(var ui=Hr.layout.get("text-rotate").evaluate(ti,{})*Math.PI/180,Ei=[],ki=0,bi=dr.positionedLines;ki32640&&L(C.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".'):Cn.kind==="composite"&&((Sn=[128*Gt.compositeTextSizes[0].evaluate(Se,{},on),128*Gt.compositeTextSizes[1].evaluate(Se,{},on)])[0]>32640||Sn[1]>32640)&&L(C.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".'),C.addSymbols(C.text,yn,Sn,Ne,xe,Se,ct,z,Ze.lineStartIndex,Ze.lineLength,Xt,on);for(var $n=0,Vn=gt;$n=0;Se--)if(oe.dist(xe[Se])0)&&(xe.value.kind!=="constant"||xe.value.value.length>0),ct=Ne.value.kind!=="constant"||!!Ne.value.value||Object.keys(Ne.parameters).length>0,gt=pe.get("symbol-sort-key");if(this.features=[],Ze||ct){for(var Bt=z.iconDependencies,Xt=z.glyphDependencies,Gt=z.availableImages,on=new Ia(this.zoom),yn=0,Cn=C;yn=0;for(var ma=0,Oa=Vr.sections;ma=0;Ne--)xe[Ne]={x:z[Ne].x,y:z[Ne].y,tileUnitDistanceFromAnchor:pe},Ne>0&&(pe+=z[Ne-1].dist(z[Ne]));for(var Ze=0;Ze0},Ua.prototype.hasIconData=function(){return this.icon.segments.get().length>0},Ua.prototype.hasDebugData=function(){return this.textCollisionBox&&this.iconCollisionBox},Ua.prototype.hasTextCollisionBoxData=function(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0},Ua.prototype.hasIconCollisionBoxData=function(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0},Ua.prototype.addIndicesForPlacedSymbol=function(C,z){for(var Z=C.placedSymbolArray.get(z),oe=Z.vertexStartIndex+4*Z.numGlyphs,pe=Z.vertexStartIndex;pe1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(C),this.sortedAngle=C,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(var Z=0,oe=this.symbolInstanceIndexes;Z=0&&Ze.indexOf(Se)===Ne&&z.addIndicesForPlacedSymbol(z.text,Se)}),xe.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,xe.verticalPlacedTextSymbolIndex),xe.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,xe.placedIconSymbolIndex),xe.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,xe.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}},Qn("SymbolBucket",Ua,{omit:["layers","collisionBoxArray","features","compareText"]}),Ua.MAX_GLYPHS=65535,Ua.addDynamicAttributes=V5;var pW=new Gs({"symbol-placement":new wi(Pe.layout_symbol["symbol-placement"]),"symbol-spacing":new wi(Pe.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new wi(Pe.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Ii(Pe.layout_symbol["symbol-sort-key"]),"symbol-z-order":new wi(Pe.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new wi(Pe.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new wi(Pe.layout_symbol["icon-ignore-placement"]),"icon-optional":new wi(Pe.layout_symbol["icon-optional"]),"icon-rotation-alignment":new wi(Pe.layout_symbol["icon-rotation-alignment"]),"icon-size":new Ii(Pe.layout_symbol["icon-size"]),"icon-text-fit":new wi(Pe.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new wi(Pe.layout_symbol["icon-text-fit-padding"]),"icon-image":new Ii(Pe.layout_symbol["icon-image"]),"icon-rotate":new Ii(Pe.layout_symbol["icon-rotate"]),"icon-padding":new wi(Pe.layout_symbol["icon-padding"]),"icon-keep-upright":new wi(Pe.layout_symbol["icon-keep-upright"]),"icon-offset":new Ii(Pe.layout_symbol["icon-offset"]),"icon-anchor":new Ii(Pe.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new wi(Pe.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new wi(Pe.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new wi(Pe.layout_symbol["text-rotation-alignment"]),"text-field":new Ii(Pe.layout_symbol["text-field"]),"text-font":new Ii(Pe.layout_symbol["text-font"]),"text-size":new Ii(Pe.layout_symbol["text-size"]),"text-max-width":new Ii(Pe.layout_symbol["text-max-width"]),"text-line-height":new wi(Pe.layout_symbol["text-line-height"]),"text-letter-spacing":new Ii(Pe.layout_symbol["text-letter-spacing"]),"text-justify":new Ii(Pe.layout_symbol["text-justify"]),"text-radial-offset":new Ii(Pe.layout_symbol["text-radial-offset"]),"text-variable-anchor":new wi(Pe.layout_symbol["text-variable-anchor"]),"text-anchor":new Ii(Pe.layout_symbol["text-anchor"]),"text-max-angle":new wi(Pe.layout_symbol["text-max-angle"]),"text-writing-mode":new wi(Pe.layout_symbol["text-writing-mode"]),"text-rotate":new Ii(Pe.layout_symbol["text-rotate"]),"text-padding":new wi(Pe.layout_symbol["text-padding"]),"text-keep-upright":new wi(Pe.layout_symbol["text-keep-upright"]),"text-transform":new Ii(Pe.layout_symbol["text-transform"]),"text-offset":new Ii(Pe.layout_symbol["text-offset"]),"text-allow-overlap":new wi(Pe.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new wi(Pe.layout_symbol["text-ignore-placement"]),"text-optional":new wi(Pe.layout_symbol["text-optional"])}),q5={paint:new Gs({"icon-opacity":new Ii(Pe.paint_symbol["icon-opacity"]),"icon-color":new Ii(Pe.paint_symbol["icon-color"]),"icon-halo-color":new Ii(Pe.paint_symbol["icon-halo-color"]),"icon-halo-width":new Ii(Pe.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Ii(Pe.paint_symbol["icon-halo-blur"]),"icon-translate":new wi(Pe.paint_symbol["icon-translate"]),"icon-translate-anchor":new wi(Pe.paint_symbol["icon-translate-anchor"]),"text-opacity":new Ii(Pe.paint_symbol["text-opacity"]),"text-color":new Ii(Pe.paint_symbol["text-color"],{runtimeType:Et,getOverride:function(C){return C.textColor},hasOverride:function(C){return!!C.textColor}}),"text-halo-color":new Ii(Pe.paint_symbol["text-halo-color"]),"text-halo-width":new Ii(Pe.paint_symbol["text-halo-width"]),"text-halo-blur":new Ii(Pe.paint_symbol["text-halo-blur"]),"text-translate":new wi(Pe.paint_symbol["text-translate"]),"text-translate-anchor":new wi(Pe.paint_symbol["text-translate-anchor"])}),layout:pW},Lg=function(C){this.type=C.property.overrides?C.property.overrides.runtimeType:Ut,this.defaultValue=C};Lg.prototype.evaluate=function(C){if(C.formattedSection){var z=this.defaultValue.property.overrides;if(z&&z.hasOverride(C.formattedSection))return z.getOverride(C.formattedSection)}return C.feature&&C.featureState?this.defaultValue.evaluate(C.feature,C.featureState):this.defaultValue.property.specification.default},Lg.prototype.eachChild=function(C){this.defaultValue.isConstant()||C(this.defaultValue.value._styleExpression.expression)},Lg.prototype.outputDefined=function(){return!1},Lg.prototype.serialize=function(){return null},Qn("FormatSectionOverride",Lg,{omit:["defaultValue"]});var gW=function(C){function z(Z){C.call(this,Z,q5)}return C&&(z.__proto__=C),z.prototype=Object.create(C&&C.prototype),z.prototype.constructor=z,z.prototype.recalculate=function(Z,oe){if(C.prototype.recalculate.call(this,Z,oe),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")!=="point"?this.layout._values["icon-rotation-alignment"]="map":this.layout._values["icon-rotation-alignment"]="viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")!=="point"?this.layout._values["text-rotation-alignment"]="map":this.layout._values["text-rotation-alignment"]="viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){var pe=this.layout.get("text-writing-mode");if(pe){for(var xe=[],Se=0,Ne=pe;Se",targetMapId:oe,sourceMapId:xe.mapId})}}},Dg.prototype.receive=function(C){var z=C.data,Z=z.id;if(Z&&(!z.targetMapId||this.mapId===z.targetMapId))if(z.type===""){delete this.tasks[Z];var oe=this.cancelCallbacks[Z];delete this.cancelCallbacks[Z],oe&&oe()}else D()||z.mustQueue?(this.tasks[Z]=z,this.taskQueue.push(Z),this.invoker.trigger()):this.processTask(Z,z)},Dg.prototype.process=function(){if(this.taskQueue.length){var C=this.taskQueue.shift(),z=this.tasks[C];delete this.tasks[C],this.taskQueue.length&&this.invoker.trigger(),z&&this.processTask(C,z)}},Dg.prototype.processTask=function(C,z){var Z=this;if(z.type===""){var oe=this.callbacks[C];delete this.callbacks[C],oe&&(z.error?oe(Ui(z.error)):oe(null,Ui(z.data)))}else{var pe=!1,xe=B(this.globalScope)?void 0:[],Se=z.hasCallback?function(gt,Bt){pe=!0,delete Z.cancelCallbacks[C],Z.target.postMessage({id:C,type:"",sourceMapId:Z.mapId,error:gt?di(gt):null,data:di(Bt,xe)},xe)}:function(gt){pe=!0},Ne=null,Ze=Ui(z.data);if(this.parent[z.type])Ne=this.parent[z.type](z.sourceMapId,Ze,Se);else if(this.parent.getWorkerSource){var ct=z.type.split(".");Ne=this.parent.getWorkerSource(z.sourceMapId,ct[0],Ze.source)[ct[1]](Ze,Se)}else Se(new Error("Could not find function "+z.type));!pe&&Ne&&Ne.cancel&&(this.cancelCallbacks[C]=Ne.cancel)}},Dg.prototype.remove=function(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)};var fs=function(C,z){C&&(z?this.setSouthWest(C).setNorthEast(z):C.length===4?this.setSouthWest([C[0],C[1]]).setNorthEast([C[2],C[3]]):this.setSouthWest(C[0]).setNorthEast(C[1]))};fs.prototype.setNorthEast=function(C){return this._ne=C instanceof mo?new mo(C.lng,C.lat):mo.convert(C),this},fs.prototype.setSouthWest=function(C){return this._sw=C instanceof mo?new mo(C.lng,C.lat):mo.convert(C),this},fs.prototype.extend=function(C){var z,Z,oe=this._sw,pe=this._ne;if(C instanceof mo)z=C,Z=C;else{if(!(C instanceof fs)){if(Array.isArray(C)){if(C.length===4||C.every(Array.isArray)){var xe=C;return this.extend(fs.convert(xe))}var Se=C;return this.extend(mo.convert(Se))}return this}if(z=C._sw,Z=C._ne,!z||!Z)return this}return oe||pe?(oe.lng=Math.min(z.lng,oe.lng),oe.lat=Math.min(z.lat,oe.lat),pe.lng=Math.max(Z.lng,pe.lng),pe.lat=Math.max(Z.lat,pe.lat)):(this._sw=new mo(z.lng,z.lat),this._ne=new mo(Z.lng,Z.lat)),this},fs.prototype.getCenter=function(){return new mo((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},fs.prototype.getSouthWest=function(){return this._sw},fs.prototype.getNorthEast=function(){return this._ne},fs.prototype.getNorthWest=function(){return new mo(this.getWest(),this.getNorth())},fs.prototype.getSouthEast=function(){return new mo(this.getEast(),this.getSouth())},fs.prototype.getWest=function(){return this._sw.lng},fs.prototype.getSouth=function(){return this._sw.lat},fs.prototype.getEast=function(){return this._ne.lng},fs.prototype.getNorth=function(){return this._ne.lat},fs.prototype.toArray=function(){return[this._sw.toArray(),this._ne.toArray()]},fs.prototype.toString=function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"},fs.prototype.isEmpty=function(){return!(this._sw&&this._ne)},fs.prototype.contains=function(C){var z=mo.convert(C),Z=z.lng,oe=z.lat,pe=this._sw.lat<=oe&&oe<=this._ne.lat,xe=this._sw.lng<=Z&&Z<=this._ne.lng;return this._sw.lng>this._ne.lng&&(xe=this._sw.lng>=Z&&Z>=this._ne.lng),pe&&xe},fs.convert=function(C){return!C||C instanceof fs?C:new fs(C)};var mo=function(C,z){if(isNaN(C)||isNaN(z))throw new Error("Invalid LngLat object: ("+C+", "+z+")");if(this.lng=+C,this.lat=+z,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")};mo.prototype.wrap=function(){return new mo(v(this.lng,-180,180),this.lat)},mo.prototype.toArray=function(){return[this.lng,this.lat]},mo.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},mo.prototype.distanceTo=function(C){var z=Math.PI/180,Z=this.lat*z,oe=C.lat*z,pe=Math.sin(Z)*Math.sin(oe)+Math.cos(Z)*Math.cos(oe)*Math.cos((C.lng-this.lng)*z);return 63710088e-1*Math.acos(Math.min(pe,1))},mo.prototype.toBounds=function(C){C===void 0&&(C=0);var z=360*C/40075017,Z=z/Math.cos(Math.PI/180*this.lat);return new fs(new mo(this.lng-Z,this.lat-z),new mo(this.lng+Z,this.lat+z))},mo.convert=function(C){if(C instanceof mo)return C;if(Array.isArray(C)&&(C.length===2||C.length===3))return new mo(Number(C[0]),Number(C[1]));if(!Array.isArray(C)&&typeof C=="object"&&C!==null)return new mo(Number("lng"in C?C.lng:C.lon),Number(C.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")};var y9=2*Math.PI*63710088e-1;function v9(C){return y9*Math.cos(C*Math.PI/180)}function x9(C){return(180+C)/360}function b9(C){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+C*Math.PI/360)))/360}function _9(C,z){return C/v9(z)}function G5(C){var z=180-360*C;return 360/Math.PI*Math.atan(Math.exp(z*Math.PI/180))-90}var Up=function(C,z,Z){Z===void 0&&(Z=0),this.x=+C,this.y=+z,this.z=+Z};Up.fromLngLat=function(C,z){z===void 0&&(z=0);var Z=mo.convert(C);return new Up(x9(Z.lng),b9(Z.lat),_9(z,Z.lat))},Up.prototype.toLngLat=function(){return new mo(360*this.x-180,G5(this.y))},Up.prototype.toAltitude=function(){return C=this.z,z=this.y,C*v9(G5(z));var C,z},Up.prototype.meterInMercatorCoordinateUnits=function(){return 1/y9*(C=G5(this.y),1/Math.cos(C*Math.PI/180));var C};var $p=function(C,z,Z){this.z=C,this.x=z,this.y=Z,this.key=U1(0,C,C,z,Z)};$p.prototype.equals=function(C){return this.z===C.z&&this.x===C.x&&this.y===C.y},$p.prototype.url=function(C,z){var Z,oe,pe,xe,Se,Ne=(Z=this.x,oe=this.y,pe=this.z,xe=m9(256*Z,256*(oe=Math.pow(2,pe)-oe-1),pe),Se=m9(256*(Z+1),256*(oe+1),pe),xe[0]+","+xe[1]+","+Se[0]+","+Se[1]),Ze=function(ct,gt,Bt){for(var Xt,Gt="",on=ct;on>0;on--)Gt+=(gt&(Xt=1<this.canonical.z?new hs(C,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new hs(C,this.wrap,C,this.canonical.x>>z,this.canonical.y>>z)},hs.prototype.calculateScaledKey=function(C,z){var Z=this.canonical.z-C;return C>this.canonical.z?U1(this.wrap*+z,C,this.canonical.z,this.canonical.x,this.canonical.y):U1(this.wrap*+z,C,C,this.canonical.x>>Z,this.canonical.y>>Z)},hs.prototype.isChildOf=function(C){if(C.wrap!==this.wrap)return!1;var z=this.canonical.z-C.canonical.z;return C.overscaledZ===0||C.overscaledZ>z&&C.canonical.y===this.canonical.y>>z},hs.prototype.children=function(C){if(this.overscaledZ>=C)return[new hs(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];var z=this.canonical.z+1,Z=2*this.canonical.x,oe=2*this.canonical.y;return[new hs(z,this.wrap,z,Z,oe),new hs(z,this.wrap,z,Z+1,oe),new hs(z,this.wrap,z,Z,oe+1),new hs(z,this.wrap,z,Z+1,oe+1)]},hs.prototype.isLessThan=function(C){return this.wrapC.wrap)&&(this.overscaledZC.overscaledZ)&&(this.canonical.xC.canonical.x)&&this.canonical.y=this.dim+1||z<-1||z>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(z+1)*this.stride+(C+1)},Sh.prototype._unpackMapbox=function(C,z,Z){return(256*C*256+256*z+Z)/10-1e4},Sh.prototype._unpackTerrarium=function(C,z,Z){return 256*C+z+Z/256-32768},Sh.prototype.getPixels=function(){return new Rl({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))},Sh.prototype.backfillBorder=function(C,z,Z){if(this.dim!==C.dim)throw new Error("dem dimension mismatch");var oe=z*this.dim,pe=z*this.dim+this.dim,xe=Z*this.dim,Se=Z*this.dim+this.dim;switch(z){case-1:oe=pe-1;break;case 1:pe=oe+1}switch(Z){case-1:xe=Se-1;break;case 1:Se=xe+1}for(var Ne=-z*this.dim,Ze=-Z*this.dim,ct=xe;ct=0&>[3]>=0&&Ne.insert(Se,gt[0],gt[1],gt[2],gt[3])}},Ch.prototype.loadVTLayers=function(){return this.vtLayers||(this.vtLayers=new wg.VectorTile(new Vx(this.rawTileData)).layers,this.sourceLayerCoder=new eb(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers},Ch.prototype.query=function(C,z,Z,oe){var pe=this;this.loadVTLayers();for(var xe=C.params||{},Se=8192/C.tileSize/C.scale,Ne=qi(xe.filter),Ze=C.queryGeometry,ct=C.queryPadding*Se,gt=k9(Ze),Bt=this.grid.query(gt.minX-ct,gt.minY-ct,gt.maxX+ct,gt.maxY+ct),Xt=k9(C.cameraQueryGeometry),Gt=this.grid3D.query(Xt.minX-ct,Xt.minY-ct,Xt.maxX+ct,Xt.maxY+ct,function(dr,br,Hr,Vr){return function(ti,vi,xi,ui,Ei){for(var ki=0,bi=ti;ki=Ma.x&&Ei>=Ma.y)return!0}var ma=[new d(vi,xi),new d(vi,Ei),new d(ui,Ei),new d(ui,xi)];if(ti.length>2){for(var Oa=0,Bi=ma;Oa=0)return!0;return!1}(xe,Bt)){var Xt=this.sourceLayerCoder.decode(Z),Gt=this.vtLayers[Xt].feature(oe);if(pe.filter(new Ia(this.tileID.overscaledZ),Gt))for(var on=this.getId(Gt,Xt),yn=0;ynoe)pe=!1;else if(z)if(this.expirationTime$e&&(C.getActor().send("enforceCacheSizeLimit",ze),nt=0)},i.clamp=y,i.clearTileCache=function(C){var z=self.caches.delete("mapbox-tiles");C&&z.catch(C).then(function(){return C()})},i.clipLine=o9,i.clone=function(C){var z=new Fl(16);return z[0]=C[0],z[1]=C[1],z[2]=C[2],z[3]=C[3],z[4]=C[4],z[5]=C[5],z[6]=C[6],z[7]=C[7],z[8]=C[8],z[9]=C[9],z[10]=C[10],z[11]=C[11],z[12]=C[12],z[13]=C[13],z[14]=C[14],z[15]=C[15],z},i.clone$1=S,i.clone$2=function(C){var z=new Fl(3);return z[0]=C[0],z[1]=C[1],z[2]=C[2],z},i.collisionCircleLayout=$G,i.config=H,i.create=function(){var C=new Fl(16);return Fl!=Float32Array&&(C[1]=0,C[2]=0,C[3]=0,C[4]=0,C[6]=0,C[7]=0,C[8]=0,C[9]=0,C[11]=0,C[12]=0,C[13]=0,C[14]=0),C[0]=1,C[5]=1,C[10]=1,C[15]=1,C},i.create$1=function(){var C=new Fl(9);return Fl!=Float32Array&&(C[1]=0,C[2]=0,C[3]=0,C[5]=0,C[6]=0,C[7]=0),C[0]=1,C[4]=1,C[8]=1,C},i.create$2=function(){var C=new Fl(4);return Fl!=Float32Array&&(C[1]=0,C[2]=0),C[0]=1,C[3]=1,C},i.createCommonjsModule=s,i.createExpression=Yt,i.createLayout=Fa,i.createStyleLayer=function(C){return C.type==="custom"?new bW(C):new _W[C.type](C)},i.cross=function(C,z,Z){var oe=z[0],pe=z[1],xe=z[2],Se=Z[0],Ne=Z[1],Ze=Z[2];return C[0]=pe*Ze-xe*Ne,C[1]=xe*Se-oe*Ze,C[2]=oe*Ne-pe*Se,C},i.deepEqual=function C(z,Z){if(Array.isArray(z)){if(!Array.isArray(Z)||z.length!==Z.length)return!1;for(var oe=0;oe0&&(xe=1/Math.sqrt(xe)),C[0]=z[0]*xe,C[1]=z[1]*xe,C[2]=z[2]*xe,C},i.number=Ar,i.offscreenCanvasSupported=ft,i.ortho=function(C,z,Z,oe,pe,xe,Se){var Ne=1/(z-Z),Ze=1/(oe-pe),ct=1/(xe-Se);return C[0]=-2*Ne,C[1]=0,C[2]=0,C[3]=0,C[4]=0,C[5]=-2*Ze,C[6]=0,C[7]=0,C[8]=0,C[9]=0,C[10]=2*ct,C[11]=0,C[12]=(z+Z)*Ne,C[13]=(pe+oe)*Ze,C[14]=(Se+xe)*ct,C[15]=1,C},i.parseGlyphPBF=function(C){return new Vx(C).readFields(QG,[])},i.pbf=Vx,i.performSymbolLayout=function(C,z,Z,oe,pe,xe,Se){C.createArrays();var Ne=512*C.overscaling;C.tilePixelRatio=8192/Ne,C.compareText={},C.iconsNeedLinear=!1;var Ze=C.layers[0].layout,ct=C.layers[0]._unevaluatedLayout._values,gt={};if(C.textSizeData.kind==="composite"){var Bt=C.textSizeData,Xt=Bt.minZoom,Gt=Bt.maxZoom;gt.compositeTextSizes=[ct["text-size"].possiblyEvaluate(new Ia(Xt),Se),ct["text-size"].possiblyEvaluate(new Ia(Gt),Se)]}if(C.iconSizeData.kind==="composite"){var on=C.iconSizeData,yn=on.minZoom,Cn=on.maxZoom;gt.compositeIconSizes=[ct["icon-size"].possiblyEvaluate(new Ia(yn),Se),ct["icon-size"].possiblyEvaluate(new Ia(Cn),Se)]}gt.layoutTextSize=ct["text-size"].possiblyEvaluate(new Ia(C.zoom+1),Se),gt.layoutIconSize=ct["icon-size"].possiblyEvaluate(new Ia(C.zoom+1),Se),gt.textMaxSize=ct["text-size"].possiblyEvaluate(new Ia(18));for(var Sn=24*Ze.get("text-line-height"),$n=Ze.get("text-rotation-alignment")==="map"&&Ze.get("symbol-placement")!=="point",Vn=Ze.get("text-keep-upright"),Xn=Ze.get("text-size"),dr=function(){var Vr=Hr[br],ti=Ze.get("text-font").evaluate(Vr,{},Se).join(","),vi=Xn.evaluate(Vr,{},Se),xi=gt.layoutTextSize.evaluate(Vr,{},Se),ui=gt.layoutIconSize.evaluate(Vr,{},Se),Ei={horizontal:{},vertical:void 0},ki=Vr.text,bi=[0,0];if(ki){var Ma=ki.toString(),ma=24*Ze.get("text-letter-spacing").evaluate(Vr,{},Se),Oa=function(sa){for(var Sa=0,zo=sa;Sa=8192||W1.y<0||W1.y>=8192||function(Go,Zc,TW,Ed,Q5,C9,gb,Rf,mb,Y1,yb,vb,e4,L9,X1,D9,O9,P9,I9,F9,Lu,xb,R9,zf,MW){var t4,qp,Ug,$g,Vg,qg=Go.addToLineVertexArray(Zc,TW),z9=0,N9=0,B9=0,j9=0,n4=-1,r4=-1,Dh={},U9=En(""),i4=0,a4=0;if(Rf._unevaluatedLayout.getValue("text-radial-offset")===void 0?(t4=Rf.layout.get("text-offset").evaluate(Lu,{},zf).map(function(J1){return 24*J1}),i4=t4[0],a4=t4[1]):(i4=24*Rf.layout.get("text-radial-offset").evaluate(Lu,{},zf),a4=U5),Go.allowVerticalPlacement&&Ed.vertical){var $9=Rf.layout.get("text-rotate").evaluate(Lu,{},zf)+90,EW=Ed.vertical;$g=new Jx(mb,Zc,Y1,yb,vb,EW,e4,L9,X1,$9),gb&&(Vg=new Jx(mb,Zc,Y1,yb,vb,gb,O9,P9,X1,$9))}if(Q5){var o4=Rf.layout.get("icon-rotate").evaluate(Lu,{}),V9=Rf.layout.get("icon-text-fit")!=="none",q9=s9(Q5,o4,R9,V9),s4=gb?s9(gb,o4,R9,V9):void 0;Ug=new Jx(mb,Zc,Y1,yb,vb,Q5,O9,P9,!1,o4),z9=4*q9.length;var H9=Go.iconSizeData,Z1=null;H9.kind==="source"?(Z1=[128*Rf.layout.get("icon-size").evaluate(Lu,{})])[0]>32640&&L(Go.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".'):H9.kind==="composite"&&((Z1=[128*xb.compositeIconSizes[0].evaluate(Lu,{},zf),128*xb.compositeIconSizes[1].evaluate(Lu,{},zf)])[0]>32640||Z1[1]>32640)&&L(Go.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".'),Go.addSymbols(Go.icon,q9,Z1,F9,I9,Lu,!1,Zc,qg.lineStartIndex,qg.lineLength,-1,zf),n4=Go.icon.placedSymbolArray.length-1,s4&&(N9=4*s4.length,Go.addSymbols(Go.icon,s4,Z1,F9,I9,Lu,Cu.vertical,Zc,qg.lineStartIndex,qg.lineLength,-1,zf),r4=Go.icon.placedSymbolArray.length-1)}for(var G9 in Ed.horizontal){var bb=Ed.horizontal[G9];if(!qp){U9=En(bb.text);var SW=Rf.layout.get("text-rotate").evaluate(Lu,{},zf);qp=new Jx(mb,Zc,Y1,yb,vb,bb,e4,L9,X1,SW)}var W9=bb.positionedLines.length===1;if(B9+=c9(Go,Zc,bb,C9,Rf,X1,Lu,D9,qg,Ed.vertical?Cu.horizontal:Cu.horizontalOnly,W9?Object.keys(Ed.horizontal):[G9],Dh,n4,xb,zf),W9)break}Ed.vertical&&(j9+=c9(Go,Zc,Ed.vertical,C9,Rf,X1,Lu,D9,qg,Cu.vertical,["vertical"],Dh,r4,xb,zf));var CW=qp?qp.boxStartIndex:Go.collisionBoxArray.length,LW=qp?qp.boxEndIndex:Go.collisionBoxArray.length,DW=$g?$g.boxStartIndex:Go.collisionBoxArray.length,OW=$g?$g.boxEndIndex:Go.collisionBoxArray.length,PW=Ug?Ug.boxStartIndex:Go.collisionBoxArray.length,IW=Ug?Ug.boxEndIndex:Go.collisionBoxArray.length,FW=Vg?Vg.boxStartIndex:Go.collisionBoxArray.length,RW=Vg?Vg.boxEndIndex:Go.collisionBoxArray.length,Nf=-1,_b=function(J1,X9){return J1&&J1.circleDiameter?Math.max(J1.circleDiameter,X9):X9};Nf=_b(qp,Nf),Nf=_b($g,Nf),Nf=_b(Ug,Nf);var Y9=(Nf=_b(Vg,Nf))>-1?1:0;Y9&&(Nf*=MW/24),Go.glyphOffsetArray.length>=Ua.MAX_GLYPHS&&L("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Lu.sortKey!==void 0&&Go.addToSortKeyRanges(Go.symbolInstances.length,Lu.sortKey),Go.symbolInstances.emplaceBack(Zc.x,Zc.y,Dh.right>=0?Dh.right:-1,Dh.center>=0?Dh.center:-1,Dh.left>=0?Dh.left:-1,Dh.vertical||-1,n4,r4,U9,CW,LW,DW,OW,PW,IW,FW,RW,Y1,B9,j9,z9,N9,Y9,0,e4,i4,a4,Nf)}(sa,W1,kW,zo,No,Oo,Lh,sa.layers[0],sa.collisionBoxArray,Sa.index,Sa.sourceLayerIndex,sa.index,Y5,rb,ob,Tl,nb,ib,Td,Wc,Sa,xo,au,al,Ra)};if(Ig==="line")for(var $1=0,lb=o9(Sa.geometry,0,0,8192,8192);$11){var zg=aW(Rg,ab,zo.vertical||Yc,No,24,Pg);zg&&Md(Rg,zg)}}else if(Sa.type==="Polygon")for(var Ng=0,pb=P5(Sa.geometry,0);Ng=mn.maxzoom||mn.visibility!=="none"&&(p(qt,this.zoom,Te),(tt[mn.id]=mn.createBucket({index:ot.bucketLayerIDs.length,layers:qt,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:De,sourceID:this.source})).populate(Je,bt,this.tileID.canonical),ot.bucketLayerIDs.push(qt.map(function(sn){return sn.id})))}}}var Fn=i.mapObject(bt.glyphDependencies,function(sn){return Object.keys(sn).map(Number)});Object.keys(Fn).length?Pe.send("getGlyphs",{uid:this.uid,stacks:Fn},function(sn,gn){At||(At=sn,wt=gn,nn.call(rt))}):wt={};var pn=Object.keys(bt.iconDependencies);pn.length?Pe.send("getImages",{icons:pn,source:this.source,tileID:this.tileID,type:"icons"},function(sn,gn){At||(At=sn,$t=gn,nn.call(rt))}):$t={};var tn=Object.keys(bt.patternDependencies);function nn(){if(At)return qe(At);if(wt&&$t&&Ut){var sn=new d(wt),gn=new i.ImageAtlas($t,Ut);for(var bn in tt){var In=tt[bn];In instanceof i.SymbolBucket?(p(In.layers,this.zoom,Te),i.performSymbolLayout(In,wt,sn.positions,$t,gn.iconPositions,this.showCollisionBoxes,this.tileID.canonical)):In.hasPattern&&(In instanceof i.LineBucket||In instanceof i.FillBucket||In instanceof i.FillExtrusionBucket)&&(p(In.layers,this.zoom,Te),In.addFeatures(bt,this.tileID.canonical,gn.patternPositions))}this.status="done",qe(null,{buckets:i.values(tt).filter(function(qn){return!qn.isEmpty()}),featureIndex:ot,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:sn.image,imageAtlas:gn,glyphMap:this.returnDependencies?wt:null,iconMap:this.returnDependencies?$t:null,glyphPositions:this.returnDependencies?sn.positions:null})}}tn.length?Pe.send("getImages",{icons:tn,source:this.source,tileID:this.tileID,type:"patterns"},function(sn,gn){At||(At=sn,Ut=gn,nn.call(rt))}):Ut={},nn.call(this)};var y=function(Oe,Ie,Te,Pe){this.actor=Oe,this.layerIndex=Ie,this.availableImages=Te,this.loadVectorData=Pe||g,this.loading={},this.loaded={}};y.prototype.loadTile=function(Oe,Ie){var Te=this,Pe=Oe.uid;this.loading||(this.loading={});var qe=!!(Oe&&Oe.request&&Oe.request.collectResourceTiming)&&new i.RequestPerformance(Oe.request),rt=this.loading[Pe]=new m(Oe);rt.abort=this.loadVectorData(Oe,function(lt,ot){if(delete Te.loading[Pe],lt||!ot)return rt.status="done",Te.loaded[Pe]=rt,Ie(lt);var At=ot.rawData,wt={};ot.expires&&(wt.expires=ot.expires),ot.cacheControl&&(wt.cacheControl=ot.cacheControl);var $t={};if(qe){var Ut=qe.finish();Ut&&($t.resourceTiming=JSON.parse(JSON.stringify(Ut)))}rt.vectorTile=ot.vectorTile,rt.parse(ot.vectorTile,Te.layerIndex,Te.availableImages,Te.actor,function(tt,bt){if(tt||!bt)return Ie(tt);Ie(null,i.extend({rawTileData:At.slice(0)},bt,wt,$t))}),Te.loaded=Te.loaded||{},Te.loaded[Pe]=rt})},y.prototype.reloadTile=function(Oe,Ie){var Te=this,Pe=this.loaded,qe=Oe.uid,rt=this;if(Pe&&Pe[qe]){var lt=Pe[qe];lt.showCollisionBoxes=Oe.showCollisionBoxes;var ot=function(At,wt){var $t=lt.reloadCallback;$t&&(delete lt.reloadCallback,lt.parse(lt.vectorTile,rt.layerIndex,Te.availableImages,rt.actor,$t)),Ie(At,wt)};lt.status==="parsing"?lt.reloadCallback=ot:lt.status==="done"&&(lt.vectorTile?lt.parse(lt.vectorTile,this.layerIndex,this.availableImages,this.actor,ot):ot())}},y.prototype.abortTile=function(Oe,Ie){var Te=this.loading,Pe=Oe.uid;Te&&Te[Pe]&&Te[Pe].abort&&(Te[Pe].abort(),delete Te[Pe]),Ie()},y.prototype.removeTile=function(Oe,Ie){var Te=this.loaded,Pe=Oe.uid;Te&&Te[Pe]&&delete Te[Pe],Ie()};var v=i.window.ImageBitmap,x=function(){this.loaded={}};x.prototype.loadTile=function(Oe,Ie){var Te=Oe.uid,Pe=Oe.encoding,qe=Oe.rawImageData,rt=v&&qe instanceof v?this.getImageData(qe):qe,lt=new i.DEMData(Te,rt,Pe);this.loaded=this.loaded||{},this.loaded[Te]=lt,Ie(null,lt)},x.prototype.getImageData=function(Oe){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(Oe.width,Oe.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=Oe.width,this.offscreenCanvas.height=Oe.height,this.offscreenCanvasContext.drawImage(Oe,0,0,Oe.width,Oe.height);var Ie=this.offscreenCanvasContext.getImageData(-1,-1,Oe.width+2,Oe.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new i.RGBAImage({width:Ie.width,height:Ie.height},Ie.data)},x.prototype.removeTile=function(Oe){var Ie=this.loaded,Te=Oe.uid;Ie&&Ie[Te]&&delete Ie[Te]};var _=function Oe(Ie,Te){var Pe,qe=Ie&&Ie.type;if(qe==="FeatureCollection")for(Pe=0;Pe=0!=!!Ie&&Oe.reverse()}var k=i.vectorTile.VectorTileFeature.prototype.toGeoJSON,w=function(Oe){this._feature=Oe,this.extent=i.EXTENT,this.type=Oe.type,this.properties=Oe.tags,"id"in Oe&&!isNaN(Oe.id)&&(this.id=parseInt(Oe.id,10))};w.prototype.loadGeometry=function(){if(this._feature.type===1){for(var Oe=[],Ie=0,Te=this._feature.geometry;Ie>31}function te(Oe,Ie){for(var Te=Oe.loadGeometry(),Pe=Oe.type,qe=0,rt=0,lt=Te.length,ot=0;ot>1;(function ot(At,wt,$t,Ut,tt,bt){for(;tt>Ut;){if(tt-Ut>600){var Ft=tt-Ut+1,Et=$t-Ut+1,Pt=Math.log(Ft),De=.5*Math.exp(2*Pt/3),Je=.5*Math.sqrt(Pt*De*(Ft-De)/Ft)*(Et-Ft/2<0?-1:1),st=Math.max(Ut,Math.floor($t-Et*De/Ft+Je)),St=Math.min(tt,Math.floor($t+(Ft-Et)*De/Ft+Je));ot(At,wt,$t,st,St,bt)}var It=wt[2*$t+bt],Zt=Ut,Kt=tt;for(re(At,wt,Ut,$t),wt[2*tt+bt]>It&&re(At,wt,Ut,tt);ZtIt;)Kt--}wt[2*Ut+bt]===It?re(At,wt,Ut,Kt):(Kt++,re(At,wt,Kt,tt)),Kt<=$t&&(Ut=Kt+1),$t<=Kt&&(tt=Kt-1)}})(Oe,Ie,lt,Pe,qe,rt%2),J(Oe,Ie,Te,Pe,lt-1,rt+1),J(Oe,Ie,Te,lt+1,qe,rt+1)}}function re(Oe,Ie,Te,Pe){U(Oe,Te,Pe),U(Ie,2*Te,2*Pe),U(Ie,2*Te+1,2*Pe+1)}function U(Oe,Ie,Te){var Pe=Oe[Ie];Oe[Ie]=Oe[Te],Oe[Te]=Pe}function V(Oe,Ie,Te,Pe){var qe=Oe-Te,rt=Ie-Pe;return qe*qe+rt*rt}L.fromVectorTileJs=R,L.fromGeojsonVt=F,L.GeoJSONWrapper=D;var H=function(Oe){return Oe[0]},ne=function(Oe){return Oe[1]},q=function(Oe,Ie,Te,Pe,qe){Ie===void 0&&(Ie=H),Te===void 0&&(Te=ne),Pe===void 0&&(Pe=64),qe===void 0&&(qe=Float64Array),this.nodeSize=Pe,this.points=Oe;for(var rt=Oe.length<65536?Uint16Array:Uint32Array,lt=this.ids=new rt(Oe.length),ot=this.coords=new qe(2*Oe.length),At=0;At=lt&&Ut<=At&&tt>=ot&&tt<=wt&&Ft.push(qe[Je]);else{var st=Math.floor((De+Pt)/2);Ut=rt[2*st],tt=rt[2*st+1],Ut>=lt&&Ut<=At&&tt>=ot&&tt<=wt&&Ft.push(qe[st]);var St=(Et+1)%2;(Et===0?lt<=Ut:ot<=tt)&&(bt.push(De),bt.push(st-1),bt.push(St)),(Et===0?At>=Ut:wt>=tt)&&(bt.push(st+1),bt.push(Pt),bt.push(St))}}return Ft}(this.ids,this.coords,Oe,Ie,Te,Pe,this.nodeSize)},q.prototype.within=function(Oe,Ie,Te){return function(Pe,qe,rt,lt,ot,At){for(var wt=[0,Pe.length-1,0],$t=[],Ut=ot*ot;wt.length;){var tt=wt.pop(),bt=wt.pop(),Ft=wt.pop();if(bt-Ft<=At)for(var Et=Ft;Et<=bt;Et++)V(qe[2*Et],qe[2*Et+1],rt,lt)<=Ut&&$t.push(Pe[Et]);else{var Pt=Math.floor((Ft+bt)/2),De=qe[2*Pt],Je=qe[2*Pt+1];V(De,Je,rt,lt)<=Ut&&$t.push(Pe[Pt]);var st=(tt+1)%2;(tt===0?rt-ot<=De:lt-ot<=Je)&&(wt.push(Ft),wt.push(Pt-1),wt.push(st)),(tt===0?rt+ot>=De:lt+ot>=Je)&&(wt.push(Pt+1),wt.push(bt),wt.push(st))}}return $t}(this.ids,this.coords,Oe,Ie,Te,this.nodeSize)};var Q={minZoom:0,maxZoom:16,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:function(Oe){return Oe}},ee=function(Oe){this.options=me(Object.create(Q),Oe),this.trees=new Array(this.options.maxZoom+1)};function ie(Oe,Ie,Te,Pe,qe){return{x:Oe,y:Ie,zoom:1/0,id:Te,parentId:-1,numPoints:Pe,properties:qe}}function ae(Oe,Ie){var Te=Oe.geometry.coordinates,Pe=Te[0],qe=Te[1];return{x:ge(Pe),y:fe(qe),zoom:1/0,index:Ie,parentId:-1}}function ue(Oe){return{type:"Feature",id:Oe.id,properties:le(Oe),geometry:{type:"Point",coordinates:[(Pe=Oe.x,360*(Pe-.5)),(Ie=Oe.y,Te=(180-360*Ie)*Math.PI/180,360*Math.atan(Math.exp(Te))/Math.PI-90)]}};var Ie,Te,Pe}function le(Oe){var Ie=Oe.numPoints,Te=Ie>=1e4?Math.round(Ie/1e3)+"k":Ie>=1e3?Math.round(Ie/100)/10+"k":Ie;return me(me({},Oe.properties),{cluster:!0,cluster_id:Oe.id,point_count:Ie,point_count_abbreviated:Te})}function ge(Oe){return Oe/360+.5}function fe(Oe){var Ie=Math.sin(Oe*Math.PI/180),Te=.5-.25*Math.log((1+Ie)/(1-Ie))/Math.PI;return Te<0?0:Te>1?1:Te}function me(Oe,Ie){for(var Te in Ie)Oe[Te]=Ie[Te];return Oe}function _e(Oe){return Oe.x}function Ae(Oe){return Oe.y}function ke(Oe,Ie,Te,Pe,qe,rt){var lt=qe-Te,ot=rt-Pe;if(lt!==0||ot!==0){var At=((Oe-Te)*lt+(Ie-Pe)*ot)/(lt*lt+ot*ot);At>1?(Te=qe,Pe=rt):At>0&&(Te+=lt*At,Pe+=ot*At)}return(lt=Oe-Te)*lt+(ot=Ie-Pe)*ot}function Le(Oe,Ie,Te,Pe){var qe={id:Oe===void 0?null:Oe,type:Ie,geometry:Te,tags:Pe,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(rt){var lt=rt.geometry,ot=rt.type;if(ot==="Point"||ot==="MultiPoint"||ot==="LineString")de(rt,lt);else if(ot==="Polygon"||ot==="MultiLineString")for(var At=0;At0&&(lt+=Pe?(qe*wt-At*rt)/2:Math.sqrt(Math.pow(At-qe,2)+Math.pow(wt-rt,2))),qe=At,rt=wt}var $t=Ie.length-3;Ie[2]=1,function Ut(tt,bt,Ft,Et){for(var Pt,De=Et,Je=Ft-bt>>1,st=Ft-bt,St=tt[bt],It=tt[bt+1],Zt=tt[Ft],Kt=tt[Ft+1],qt=bt+3;qtDe)Pt=qt,De=mn;else if(mn===De){var Fn=Math.abs(qt-Je);FnEt&&(Pt-bt>3&&Ut(tt,bt,Pt,Et),tt[Pt+2]=De,Ft-Pt>3&&Ut(tt,Pt,Ft,Et))}(Ie,0,$t,Te),Ie[$t+2]=1,Ie.size=Math.abs(lt),Ie.start=0,Ie.end=Ie.size}function Ce(Oe,Ie,Te,Pe){for(var qe=0;qe1?1:Te}function $e(Oe,Ie,Te,Pe,qe,rt,lt,ot){if(Pe/=Ie,rt>=(Te/=Ie)&<=Pe)return null;for(var At=[],wt=0;wt=Te&&Ft=Pe)){var Et=[];if(tt==="Point"||tt==="MultiPoint")Ke(Ut,Et,Te,Pe,qe);else if(tt==="LineString")Re(Ut,Et,Te,Pe,qe,!1,ot.lineMetrics);else if(tt==="MultiLineString")We(Ut,Et,Te,Pe,qe,!1);else if(tt==="Polygon")We(Ut,Et,Te,Pe,qe,!0);else if(tt==="MultiPolygon")for(var Pt=0;Pt=Te&<<=Pe&&(Ie.push(Oe[rt]),Ie.push(Oe[rt+1]),Ie.push(Oe[rt+2]))}}function Re(Oe,Ie,Te,Pe,qe,rt,lt){for(var ot,At,wt=Ve(Oe),$t=qe===0?nt:ft,Ut=Oe.start,tt=0;ttTe&&(At=$t(wt,bt,Ft,Pt,De,Te),lt&&(wt.start=Ut+ot*At)):Je>Pe?st=Te&&(At=$t(wt,bt,Ft,Pt,De,Te),St=!0),st>Pe&&Je<=Pe&&(At=$t(wt,bt,Ft,Pt,De,Pe),St=!0),!rt&&St&&(lt&&(wt.end=Ut+ot*At),Ie.push(wt),wt=Ve(Oe)),lt&&(Ut+=ot)}var It=Oe.length-3;bt=Oe[It],Ft=Oe[It+1],Et=Oe[It+2],(Je=qe===0?bt:Ft)>=Te&&Je<=Pe&&Ye(wt,bt,Ft,Et),It=wt.length-3,rt&&It>=3&&(wt[It]!==wt[0]||wt[It+1]!==wt[1])&&Ye(wt,wt[0],wt[1],wt[2]),wt.length&&Ie.push(wt)}function Ve(Oe){var Ie=[];return Ie.size=Oe.size,Ie.start=Oe.start,Ie.end=Oe.end,Ie}function We(Oe,Ie,Te,Pe,qe,rt){for(var lt=0;ltlt.maxX&&(lt.maxX=$t),Ut>lt.maxY&&(lt.maxY=Ut)}return lt}function Lt(Oe,Ie,Te,Pe){var qe=Ie.geometry,rt=Ie.type,lt=[];if(rt==="Point"||rt==="MultiPoint")for(var ot=0;ot0&&Ie.size<(qe?lt:Pe))Te.numPoints+=Ie.length/3;else{for(var ot=[],At=0;Atlt)&&(Te.numSimplified++,ot.push(Ie[At]),ot.push(Ie[At+1])),Te.numPoints++;qe&&function(wt,$t){for(var Ut=0,tt=0,bt=wt.length,Ft=bt-2;tt0===$t)for(tt=0,bt=wt.length;tt24)throw new Error("maxZoom should be in the 0-24 range");if(Ie.promoteId&&Ie.generateId)throw new Error("promoteId and generateId cannot be used together.");var Pe=function(qe,rt){var lt=[];if(qe.type==="FeatureCollection")for(var ot=0;ot=Pe;wt--){var $t=+Date.now();ot=this._cluster(ot,wt),this.trees[wt]=new q(ot,_e,Ae,rt,Float32Array),Te&&console.log("z%d: %d clusters in %dms",wt,ot.length,+Date.now()-$t)}return Te&&console.timeEnd("total time"),this},ee.prototype.getClusters=function(Oe,Ie){var Te=((Oe[0]+180)%360+360)%360-180,Pe=Math.max(-90,Math.min(90,Oe[1])),qe=Oe[2]===180?180:((Oe[2]+180)%360+360)%360-180,rt=Math.max(-90,Math.min(90,Oe[3]));if(Oe[2]-Oe[0]>=360)Te=-180,qe=180;else if(Te>qe){var lt=this.getClusters([Te,Pe,180,rt],Ie),ot=this.getClusters([-180,Pe,qe,rt],Ie);return lt.concat(ot)}for(var At=this.trees[this._limitZoom(Ie)],wt=[],$t=0,Ut=At.range(ge(Te),fe(rt),ge(qe),fe(Pe));$t1?this._map(wt,!0):null,Pt=(At<<5)+(Ie+1)+this.points.length,De=0,Je=Ut;De>5},ee.prototype._getOriginZoom=function(Oe){return(Oe-this.points.length)%32},ee.prototype._map=function(Oe,Ie){if(Oe.numPoints)return Ie?me({},Oe.properties):Oe.properties;var Te=this.points[Oe.index].properties,Pe=this.options.map(Te);return Ie&&Pe===Te?me({},Pe):Pe},Jt.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},Jt.prototype.splitTile=function(Oe,Ie,Te,Pe,qe,rt,lt){for(var ot=[Oe,Ie,Te,Pe],At=this.options,wt=At.debug;ot.length;){Pe=ot.pop(),Te=ot.pop(),Ie=ot.pop(),Oe=ot.pop();var $t=1<1&&console.time("creation"),tt=this.tiles[Ut]=et(Oe,Ie,Te,Pe,At),this.tileCoords.push({z:Ie,x:Te,y:Pe}),wt)){wt>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",Ie,Te,Pe,tt.numFeatures,tt.numPoints,tt.numSimplified),console.timeEnd("creation"));var bt="z"+Ie;this.stats[bt]=(this.stats[bt]||0)+1,this.total++}if(tt.source=Oe,qe){if(Ie===At.maxZoom||Ie===qe)continue;var Ft=1<1&&console.time("clipping");var Et,Pt,De,Je,st,St,It=.5*At.buffer/At.extent,Zt=.5-It,Kt=.5+It,qt=1+It;Et=Pt=De=Je=null,st=$e(Oe,$t,Te-It,Te+Kt,0,tt.minX,tt.maxX,At),St=$e(Oe,$t,Te+Zt,Te+qt,0,tt.minX,tt.maxX,At),Oe=null,st&&(Et=$e(st,$t,Pe-It,Pe+Kt,1,tt.minY,tt.maxY,At),Pt=$e(st,$t,Pe+Zt,Pe+qt,1,tt.minY,tt.maxY,At),st=null),St&&(De=$e(St,$t,Pe-It,Pe+Kt,1,tt.minY,tt.maxY,At),Je=$e(St,$t,Pe+Zt,Pe+qt,1,tt.minY,tt.maxY,At),St=null),wt>1&&console.timeEnd("clipping"),ot.push(Et||[],Ie+1,2*Te,2*Pe),ot.push(Pt||[],Ie+1,2*Te,2*Pe+1),ot.push(De||[],Ie+1,2*Te+1,2*Pe),ot.push(Je||[],Ie+1,2*Te+1,2*Pe+1)}}},Jt.prototype.getTile=function(Oe,Ie,Te){var Pe=this.options,qe=Pe.extent,rt=Pe.debug;if(Oe<0||Oe>24)return null;var lt=1<1&&console.log("drilling down to z%d-%d-%d",Oe,Ie,Te);for(var At,wt=Oe,$t=Ie,Ut=Te;!At&&wt>0;)wt--,$t=Math.floor($t/2),Ut=Math.floor(Ut/2),At=this.tiles[Be(wt,$t,Ut)];return At&&At.source?(rt>1&&console.log("found parent tile z%d-%d-%d",wt,$t,Ut),rt>1&&console.time("drilling down"),this.splitTile(At.source,wt,$t,Ut,Oe,Ie,Te),rt>1&&console.timeEnd("drilling down"),this.tiles[ot]?Tt(this.tiles[ot],qe):null):null};var kt=function(Oe){function Ie(Te,Pe,qe,rt){Oe.call(this,Te,Pe,qe,Ge),rt&&(this.loadGeoJSON=rt)}return Oe&&(Ie.__proto__=Oe),Ie.prototype=Object.create(Oe&&Oe.prototype),Ie.prototype.constructor=Ie,Ie.prototype.loadData=function(Te,Pe){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),this._pendingCallback=Pe,this._pendingLoadDataParams=Te,this._state&&this._state!=="Idle"?this._state="NeedsLoadData":(this._state="Coalescing",this._loadData())},Ie.prototype._loadData=function(){var Te=this;if(this._pendingCallback&&this._pendingLoadDataParams){var Pe=this._pendingCallback,qe=this._pendingLoadDataParams;delete this._pendingCallback,delete this._pendingLoadDataParams;var rt=!!(qe&&qe.request&&qe.request.collectResourceTiming)&&new i.RequestPerformance(qe.request);this.loadGeoJSON(qe,function(lt,ot){if(lt||!ot)return Pe(lt);if(typeof ot!="object")return Pe(new Error("Input data given to '"+qe.source+"' is not a valid GeoJSON object."));_(ot,!0);try{Te._geoJSONIndex=qe.cluster?new ee(function($t){var Ut=$t.superclusterOptions,tt=$t.clusterProperties;if(!tt||!Ut)return Ut;for(var bt={},Ft={},Et={accumulated:null,zoom:0},Pt={properties:null},De=Object.keys(tt),Je=0,st=De;Je"u"||typeof document>"u"?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var he,ye,be=new Blob([""],{type:"text/javascript"}),Ee=URL.createObjectURL(be);try{ye=new Worker(Ee),he=!0}catch{he=!1}return ye&&ye.terminate(),URL.revokeObjectURL(Ee),he}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var he=document.createElement("canvas");he.width=he.height=1;var ye=he.getContext("2d");if(!ye)return!1;var be=ye.getImageData(0,0,1,1);return be&&be.width===he.width}()?function(he){return X[he]===void 0&&(X[he]=function(ye){var be=function(Ue){var Xe=document.createElement("canvas"),it=Object.create(j.webGLContextAttributes);return it.failIfMajorPerformanceCaveat=Ue,Xe.probablySupportsContext?Xe.probablySupportsContext("webgl",it)||Xe.probablySupportsContext("experimental-webgl",it):Xe.supportsContext?Xe.supportsContext("webgl",it)||Xe.supportsContext("experimental-webgl",it):Xe.getContext("webgl",it)||Xe.getContext("experimental-webgl",it)}(ye);if(!be)return!1;var Ee=be.createShader(be.VERTEX_SHADER);return!Ee||be.isContextLost()?!1:(be.shaderSource(Ee,"void main() {}"),be.compileShader(Ee),be.getShaderParameter(Ee,be.COMPILE_STATUS)===!0)}(he)),X[he]}(se&&se.failIfMajorPerformanceCaveat)?void 0:"insufficient WebGL support":"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support"}I.exports?I.exports=j:window&&(window.mapboxgl=window.mapboxgl||{},window.mapboxgl.supported=j,window.mapboxgl.notSupportedReason=$);var X={};j.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0}}),u={create:function(I,j,$){var X=i.window.document.createElement(I);return j!==void 0&&(X.className=j),$&&$.appendChild(X),X},createNS:function(I,j){return i.window.document.createElementNS(I,j)}},h=i.window.document.documentElement.style;function d(I){if(!h)return I[0];for(var j=0;j=0?0:I.button},u.remove=function(I){I.parentNode&&I.parentNode.removeChild(I)};var A=function(I){function j(){I.call(this),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new i.RGBAImage({width:1,height:1}),this.dirty=!0}return I&&(j.__proto__=I),j.prototype=Object.create(I&&I.prototype),j.prototype.constructor=j,j.prototype.isLoaded=function(){return this.loaded},j.prototype.setLoaded=function($){if(this.loaded!==$&&(this.loaded=$,$)){for(var X=0,se=this.requestors;X=0?1.2:1))}function T(I,j,$,X,se,he,ye){for(var be=0;be65535)Ue(new Error("glyphs > 65535 not supported"));else if(xt.ranges[_t])Ue(null,{stack:Xe,id:it,glyph:Dt});else{var Mt=xt.requests[_t];Mt||(Mt=xt.requests[_t]=[],S.loadGlyphRange(Xe,_t,$.url,$.requestManager,function(vt,Nt){if(Nt){for(var Rt in Nt)$._doesCharSupportLocalGlyph(+Rt)||(xt.glyphs[+Rt]=Nt[+Rt]);xt.ranges[_t]=!0}for(var Vt=0,rn=Mt;Vt1&&(Ee=I[++be]);var Xe=Math.abs(Ue-Ee.left),it=Math.abs(Ue-Ee.right),xt=Math.min(Xe,it),Dt=void 0,_t=se/$*(X+1);if(Ee.isDash){var Mt=X-Math.abs(_t);Dt=Math.sqrt(xt*xt+Mt*Mt)}else Dt=X-Math.sqrt(xt*xt+_t*_t);this.data[ye+Ue]=Math.max(0,Math.min(255,Dt+128))}},F.prototype.addRegularDash=function(I){for(var j=I.length-1;j>=0;--j){var $=I[j],X=I[j+1];$.zeroLength?I.splice(j,1):X&&X.isDash===$.isDash&&(X.left=$.left,I.splice(j,1))}var se=I[0],he=I[I.length-1];se.isDash===he.isDash&&(se.left=he.left-this.width,he.right=se.right+this.width);for(var ye=this.width*this.nextRow,be=0,Ee=I[be],Ue=0;Ue1&&(Ee=I[++be]);var Xe=Math.abs(Ue-Ee.left),it=Math.abs(Ue-Ee.right),xt=Math.min(Xe,it),Dt=Ee.isDash?xt:-xt;this.data[ye+Ue]=Math.max(0,Math.min(255,Dt+128))}},F.prototype.addDash=function(I,j){var $=j?7:0,X=2*$+1;if(this.nextRow+X>this.height)return i.warnOnce("LineAtlas out of space"),null;for(var se=0,he=0;he=$&&I.x=X&&I.y0&&(Ue[new i.OverscaledTileID($.overscaledZ,ye,X.z,he,X.y-1).key]={backfilled:!1},Ue[new i.OverscaledTileID($.overscaledZ,$.wrap,X.z,X.x,X.y-1).key]={backfilled:!1},Ue[new i.OverscaledTileID($.overscaledZ,Ee,X.z,be,X.y-1).key]={backfilled:!1}),X.y+10&&(se.resourceTiming=$._resourceTiming,$._resourceTiming=[]),$.fire(new i.Event("data",se))}})},j.prototype.onAdd=function($){this.map=$,this.load()},j.prototype.setData=function($){var X=this;return this._data=$,this.fire(new i.Event("dataloading",{dataType:"source"})),this._updateWorkerData(function(se){if(se)X.fire(new i.ErrorEvent(se));else{var he={dataType:"source",sourceDataType:"content"};X._collectResourceTiming&&X._resourceTiming&&X._resourceTiming.length>0&&(he.resourceTiming=X._resourceTiming,X._resourceTiming=[]),X.fire(new i.Event("data",he))}}),this},j.prototype.getClusterExpansionZoom=function($,X){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:$,source:this.id},X),this},j.prototype.getClusterChildren=function($,X){return this.actor.send("geojson.getClusterChildren",{clusterId:$,source:this.id},X),this},j.prototype.getClusterLeaves=function($,X,se,he){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:$,limit:X,offset:se},he),this},j.prototype._updateWorkerData=function($){var X=this;this._loaded=!1;var se=i.extend({},this.workerOptions),he=this._data;typeof he=="string"?(se.request=this.map._requestManager.transformRequest(i.browser.resolveURL(he),i.ResourceType.Source),se.request.collectResourceTiming=this._collectResourceTiming):se.data=JSON.stringify(he),this.actor.send(this.type+".loadData",se,function(ye,be){X._removed||be&&be.abandoned||(X._loaded=!0,be&&be.resourceTiming&&be.resourceTiming[X.id]&&(X._resourceTiming=be.resourceTiming[X.id].slice(0)),X.actor.send(X.type+".coalesce",{source:se.source},null),$(ye))})},j.prototype.loaded=function(){return this._loaded},j.prototype.loadTile=function($,X){var se=this,he=$.actor?"reloadTile":"loadTile";$.actor=this.actor;var ye={type:this.type,uid:$.uid,tileID:$.tileID,zoom:$.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:i.browser.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};$.request=this.actor.send(he,ye,function(be,Ee){return delete $.request,$.unloadVectorData(),$.aborted?X(null):be?X(be):($.loadVectorData(Ee,se.map.painter,he==="reloadTile"),X(null))})},j.prototype.abortTile=function($){$.request&&($.request.cancel(),delete $.request),$.aborted=!0},j.prototype.unloadTile=function($){$.unloadVectorData(),this.actor.send("removeTile",{uid:$.uid,type:this.type,source:this.id})},j.prototype.onRemove=function(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})},j.prototype.serialize=function(){return i.extend({},this._options,{type:this.type,data:this._data})},j.prototype.hasTransition=function(){return!1},j}(i.Evented),te=i.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]),Y=function(I){function j($,X,se,he){I.call(this),this.id=$,this.dispatcher=se,this.coordinates=X.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(he),this.options=X}return I&&(j.__proto__=I),j.prototype=Object.create(I&&I.prototype),j.prototype.constructor=j,j.prototype.load=function($,X){var se=this;this._loaded=!1,this.fire(new i.Event("dataloading",{dataType:"source"})),this.url=this.options.url,i.getImage(this.map._requestManager.transformRequest(this.url,i.ResourceType.Image),function(he,ye){se._loaded=!0,he?se.fire(new i.ErrorEvent(he)):ye&&(se.image=ye,$&&(se.coordinates=$),X&&X(),se._finishLoading())})},j.prototype.loaded=function(){return this._loaded},j.prototype.updateImage=function($){var X=this;return this.image&&$.url?(this.options.url=$.url,this.load($.coordinates,function(){X.texture=null}),this):this},j.prototype._finishLoading=function(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"metadata"})))},j.prototype.onAdd=function($){this.map=$,this.load()},j.prototype.setCoordinates=function($){var X=this;this.coordinates=$;var se=$.map(i.MercatorCoordinate.fromLngLat);this.tileID=function(ye){for(var be=1/0,Ee=1/0,Ue=-1/0,Xe=-1/0,it=0,xt=ye;itX.end(0)?this.fire(new i.ErrorEvent(new i.ValidationError("sources."+this.id,null,"Playback for this video can be set only between the "+X.start(0)+" and "+X.end(0)+"-second mark."))):this.video.currentTime=$}},j.prototype.getVideo=function(){return this.video},j.prototype.onAdd=function($){this.map||(this.map=$,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))},j.prototype.prepare=function(){if(!(Object.keys(this.tiles).length===0||this.video.readyState<2)){var $=this.map.painter.context,X=$.gl;for(var se in this.boundsBuffer||(this.boundsBuffer=$.createVertexBuffer(this._boundsArray,te.members)),this.boundsSegments||(this.boundsSegments=i.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(X.LINEAR,X.CLAMP_TO_EDGE),X.texSubImage2D(X.TEXTURE_2D,0,0,0,X.RGBA,X.UNSIGNED_BYTE,this.video)):(this.texture=new i.Texture($,this.video,X.RGBA),this.texture.bind(X.LINEAR,X.CLAMP_TO_EDGE)),this.tiles){var he=this.tiles[se];he.state!=="loaded"&&(he.state="loaded",he.texture=this.texture)}}},j.prototype.serialize=function(){return{type:"video",urls:this.urls,coordinates:this.coordinates}},j.prototype.hasTransition=function(){return this.video&&!this.video.paused},j}(Y),re=function(I){function j($,X,se,he){I.call(this,$,X,se,he),X.coordinates?Array.isArray(X.coordinates)&&X.coordinates.length===4&&!X.coordinates.some(function(ye){return!Array.isArray(ye)||ye.length!==2||ye.some(function(be){return typeof be!="number"})})||this.fire(new i.ErrorEvent(new i.ValidationError("sources."+$,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new i.ErrorEvent(new i.ValidationError("sources."+$,null,'missing required property "coordinates"'))),X.animate&&typeof X.animate!="boolean"&&this.fire(new i.ErrorEvent(new i.ValidationError("sources."+$,null,'optional "animate" property must be a boolean value'))),X.canvas?typeof X.canvas=="string"||X.canvas instanceof i.window.HTMLCanvasElement||this.fire(new i.ErrorEvent(new i.ValidationError("sources."+$,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new i.ErrorEvent(new i.ValidationError("sources."+$,null,'missing required property "canvas"'))),this.options=X,this.animate=X.animate===void 0||X.animate}return I&&(j.__proto__=I),j.prototype=Object.create(I&&I.prototype),j.prototype.constructor=j,j.prototype.load=function(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof i.window.HTMLCanvasElement?this.options.canvas:i.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new i.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())},j.prototype.getCanvas=function(){return this.canvas},j.prototype.onAdd=function($){this.map=$,this.load(),this.canvas&&this.animate&&this.play()},j.prototype.onRemove=function(){this.pause()},j.prototype.prepare=function(){var $=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,$=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,$=!0),!this._hasInvalidDimensions()&&Object.keys(this.tiles).length!==0){var X=this.map.painter.context,se=X.gl;for(var he in this.boundsBuffer||(this.boundsBuffer=X.createVertexBuffer(this._boundsArray,te.members)),this.boundsSegments||(this.boundsSegments=i.SegmentVector.simpleSegment(0,0,4,2)),this.texture?($||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new i.Texture(X,this.canvas,se.RGBA,{premultiply:!0}),this.tiles){var ye=this.tiles[he];ye.state!=="loaded"&&(ye.state="loaded",ye.texture=this.texture)}}},j.prototype.serialize=function(){return{type:"canvas",coordinates:this.coordinates}},j.prototype.hasTransition=function(){return this._playing},j.prototype._hasInvalidDimensions=function(){for(var $=0,X=[this.canvas.width,this.canvas.height];$this.max){var ye=this._getAndRemoveByKey(this.order[0]);ye&&this.onRemove(ye)}return this},q.prototype.has=function(I){return I.wrapped().key in this.data},q.prototype.getAndRemove=function(I){return this.has(I)?this._getAndRemoveByKey(I.wrapped().key):null},q.prototype._getAndRemoveByKey=function(I){var j=this.data[I].shift();return j.timeout&&clearTimeout(j.timeout),this.data[I].length===0&&delete this.data[I],this.order.splice(this.order.indexOf(I),1),j.value},q.prototype.getByKey=function(I){var j=this.data[I];return j?j[0].value:null},q.prototype.get=function(I){return this.has(I)?this.data[I.wrapped().key][0].value:null},q.prototype.remove=function(I,j){if(!this.has(I))return this;var $=I.wrapped().key,X=j===void 0?0:this.data[$].indexOf(j),se=this.data[$][X];return this.data[$].splice(X,1),se.timeout&&clearTimeout(se.timeout),this.data[$].length===0&&delete this.data[$],this.onRemove(se.value),this.order.splice(this.order.indexOf($),1),this},q.prototype.setMaxSize=function(I){for(this.max=I;this.order.length>this.max;){var j=this._getAndRemoveByKey(this.order[0]);j&&this.onRemove(j)}return this},q.prototype.filter=function(I){var j=[];for(var $ in this.data)for(var X=0,se=this.data[$];X1||(Math.abs(Xe)>1&&(Math.abs(Xe+xt)===1?Xe+=xt:Math.abs(Xe-xt)===1&&(Xe-=xt)),Ue.dem&&Ee.dem&&(Ee.dem.backfillBorder(Ue.dem,Xe,it),Ee.neighboringTiles&&Ee.neighboringTiles[Dt]&&(Ee.neighboringTiles[Dt].backfilled=!0)))}},j.prototype.getTile=function($){return this.getTileByID($.key)},j.prototype.getTileByID=function($){return this._tiles[$]},j.prototype._retainLoadedChildren=function($,X,se,he){for(var ye in this._tiles){var be=this._tiles[ye];if(!(he[ye]||!be.hasData()||be.tileID.overscaledZ<=X||be.tileID.overscaledZ>se)){for(var Ee=be.tileID;be&&be.tileID.overscaledZ>X+1;){var Ue=be.tileID.scaledTo(be.tileID.overscaledZ-1);(be=this._tiles[Ue.key])&&be.hasData()&&(Ee=Ue)}for(var Xe=Ee;Xe.overscaledZ>X;)if($[(Xe=Xe.scaledTo(Xe.overscaledZ-1)).key]){he[Ee.key]=Ee;break}}}},j.prototype.findLoadedParent=function($,X){if($.key in this._loadedParentTiles){var se=this._loadedParentTiles[$.key];return se&&se.tileID.overscaledZ>=X?se:null}for(var he=$.overscaledZ-1;he>=X;he--){var ye=$.scaledTo(he),be=this._getLoadedTile(ye);if(be)return be}},j.prototype._getLoadedTile=function($){var X=this._tiles[$.key];return X&&X.hasData()?X:this._cache.getByKey($.wrapped().key)},j.prototype.updateCacheSize=function($){var X=(Math.ceil($.width/this._source.tileSize)+1)*(Math.ceil($.height/this._source.tileSize)+1),se=Math.floor(5*X),he=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,se):se;this._cache.setMaxSize(he)},j.prototype.handleWrapJump=function($){var X=($-(this._prevLng===void 0?$:this._prevLng))/360,se=Math.round(X);if(this._prevLng=$,se){var he={};for(var ye in this._tiles){var be=this._tiles[ye];be.tileID=be.tileID.unwrapTo(be.tileID.wrap+se),he[be.tileID.key]=be}for(var Ee in this._tiles=he,this._timers)clearTimeout(this._timers[Ee]),delete this._timers[Ee];for(var Ue in this._tiles){var Xe=this._tiles[Ue];this._setTileReloadTimer(Ue,Xe)}}},j.prototype.update=function($){var X=this;if(this.transform=$,this._sourceLoaded&&!this._paused){var se;this.updateCacheSize($),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used?this._source.tileID?se=$.getVisibleUnwrappedCoordinates(this._source.tileID).map(function(Tn){return new i.OverscaledTileID(Tn.canonical.z,Tn.wrap,Tn.canonical.z,Tn.canonical.x,Tn.canonical.y)}):(se=$.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}),this._source.hasTile&&(se=se.filter(function(Tn){return X._source.hasTile(Tn)}))):se=[];var he=$.coveringZoomLevel(this._source),ye=Math.max(he-j.maxOverzooming,this._source.minzoom),be=Math.max(he+j.maxUnderzooming,this._source.minzoom),Ee=this._updateRetainedTiles(se,he);if(lt(this._source.type)){for(var Ue={},Xe={},it=0,xt=Object.keys(Ee);itthis._source.maxzoom){var Nt=Mt.children(this._source.maxzoom)[0],Rt=this.getTile(Nt);if(Rt&&Rt.hasData()){se[Nt.key]=Nt;continue}}else{var Vt=Mt.children(this._source.maxzoom);if(se[Vt[0].key]&&se[Vt[1].key]&&se[Vt[2].key]&&se[Vt[3].key])continue}for(var rn=vt.wasRequested(),dn=Mt.overscaledZ-1;dn>=ye;--dn){var En=Mt.scaledTo(dn);if(he[En.key]||(he[En.key]=!0,!(vt=this.getTile(En))&&rn&&(vt=this._addTile(En)),vt&&(se[En.key]=En,rn=vt.wasRequested(),vt.hasData())))break}}}return se},j.prototype._updateLoadedParentTileCache=function(){for(var $ in this._loadedParentTiles={},this._tiles){for(var X=[],se=void 0,he=this._tiles[$].tileID;he.overscaledZ>0;){if(he.key in this._loadedParentTiles){se=this._loadedParentTiles[he.key];break}X.push(he.key);var ye=he.scaledTo(he.overscaledZ-1);if(se=this._getLoadedTile(ye))break;he=ye}for(var be=0,Ee=X;be0||(X.hasData()&&X.state!=="reloading"?this._cache.add(X.tileID,X,X.getExpiryTimeout()):(X.aborted=!0,this._abortTile(X),this._unloadTile(X))))},j.prototype.clearTiles=function(){for(var $ in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile($);this._cache.reset()},j.prototype.tilesIn=function($,X,se){var he=this,ye=[],be=this.transform;if(!be)return ye;for(var Ee=se?be.getCameraQueryGeometry($):$,Ue=$.map(function(dn){return be.pointCoordinate(dn)}),Xe=Ee.map(function(dn){return be.pointCoordinate(dn)}),it=this.getIds(),xt=1/0,Dt=1/0,_t=-1/0,Mt=-1/0,vt=0,Nt=Xe;vt=0&&gr[1].y+er>=0){var cr=Ue.map(function(oi){return Tn.getTilePoint(oi)}),Xr=Xe.map(function(oi){return Tn.getTilePoint(oi)});ye.push({tile:En,tileID:Tn,queryGeometry:cr,cameraQueryGeometry:Xr,scale:tr})}}},rn=0;rn=i.browser.now())return!0}return!1},j.prototype.setFeatureState=function($,X,se){$=$||"_geojsonTileLayer",this._state.updateState($,X,se)},j.prototype.removeFeatureState=function($,X,se){$=$||"_geojsonTileLayer",this._state.removeFeatureState($,X,se)},j.prototype.getFeatureState=function($,X){return $=$||"_geojsonTileLayer",this._state.getState($,X)},j.prototype.setDependencies=function($,X,se){var he=this._tiles[$];he&&he.setDependencies(X,se)},j.prototype.reloadTilesForDependencies=function($,X){for(var se in this._tiles)this._tiles[se].hasDependency($,X)&&this._reloadTile(se,"reloading");this._cache.filter(function(he){return!he.hasDependency($,X)})},j}(i.Evented);function rt(I,j){var $=Math.abs(2*I.wrap)-+(I.wrap<0),X=Math.abs(2*j.wrap)-+(j.wrap<0);return I.overscaledZ-j.overscaledZ||X-$||j.canonical.y-I.canonical.y||j.canonical.x-I.canonical.x}function lt(I){return I==="raster"||I==="image"||I==="video"}function ot(){return new i.window.Worker(ce.workerUrl)}qe.maxOverzooming=10,qe.maxUnderzooming=3;var At="mapboxgl_preloaded_worker_pool",wt=function(){this.active={}};wt.prototype.acquire=function(I){if(!this.workers)for(this.workers=[];this.workers.length0?(X-he)/ye:0;return this.points[se].mult(1-be).add(this.points[j].mult(be))};var mn=function(I,j,$){var X=this.boxCells=[],se=this.circleCells=[];this.xCellCount=Math.ceil(I/$),this.yCellCount=Math.ceil(j/$);for(var he=0;he=-j[0]&&$<=j[0]&&X>=-j[1]&&X<=j[1]}function gn(I,j,$,X,se,he,ye,be){var Ee=X?I.textSizeData:I.iconSizeData,Ue=i.evaluateSizeForZoom(Ee,$.transform.zoom),Xe=[256/$.width*2+1,256/$.height*2+1],it=X?I.text.dynamicLayoutVertexArray:I.icon.dynamicLayoutVertexArray;it.clear();for(var xt=I.lineVertexArray,Dt=X?I.text.placedSymbolArray:I.icon.placedSymbolArray,_t=$.transform.width/$.transform.height,Mt=!1,vt=0;vtMath.abs($.x-j.x)*X?{useVertical:!0}:(I===i.WritingMode.vertical?j.y<$.y:j.x>$.x)?{needsFlipping:!0}:null}function qn(I,j,$,X,se,he,ye,be,Ee,Ue,Xe,it,xt,Dt){var _t,Mt=j/24,vt=I.lineOffsetX*Mt,Nt=I.lineOffsetY*Mt;if(I.numGlyphs>1){var Rt=I.glyphStartIndex+I.numGlyphs,Vt=I.lineStartIndex,rn=I.lineStartIndex+I.lineLength,dn=bn(Mt,be,vt,Nt,$,Xe,it,I,Ee,he,xt);if(!dn)return{notEnoughRoom:!0};var En=tn(dn.first.point,ye).point,Tn=tn(dn.last.point,ye).point;if(X&&!$){var tr=In(I.writingMode,En,Tn,Dt);if(tr)return tr}_t=[dn.first];for(var er=I.glyphStartIndex+1;er0?oi.point:Wn(it,Xr,gr,1,se),Gn=In(I.writingMode,gr,Ai,Dt);if(Gn)return Gn}var Mr=ar(Mt*be.getoffsetX(I.glyphStartIndex),vt,Nt,$,Xe,it,I.segment,I.lineStartIndex,I.lineStartIndex+I.lineLength,Ee,he,xt);if(!Mr)return{notEnoughRoom:!0};_t=[Mr]}for(var si=0,Qr=_t;si0?1:-1,_t=0;X&&(Dt*=-1,_t=Math.PI),Dt<0&&(_t+=Math.PI);for(var Mt=Dt>0?be+ye:be+ye+1,vt=se,Nt=se,Rt=0,Vt=0,rn=Math.abs(xt),dn=[];Rt+Vt<=rn;){if((Mt+=Dt)=Ee)return null;if(Nt=vt,dn.push(vt),(vt=it[Mt])===void 0){var En=new i.Point(Ue.getx(Mt),Ue.gety(Mt)),Tn=tn(En,Xe);if(Tn.signedDistanceFromCamera>0)vt=it[Mt]=Tn.point;else{var tr=Mt-Dt;vt=Wn(Rt===0?he:new i.Point(Ue.getx(tr),Ue.gety(tr)),En,Nt,rn-Rt+1,Xe)}}Rt+=Vt,Vt=Nt.dist(vt)}var er=(rn-Rt)/Vt,gr=vt.sub(Nt),cr=gr.mult(er)._add(Nt);cr._add(gr._unit()._perp()._mult($*Dt));var Xr=_t+Math.atan2(vt.y-Nt.y,vt.x-Nt.x);return dn.push(cr),{point:cr,angle:Xr,path:dn}}mn.prototype.keysLength=function(){return this.boxKeys.length+this.circleKeys.length},mn.prototype.insert=function(I,j,$,X,se){this._forEachCell(j,$,X,se,this._insertBoxCell,this.boxUid++),this.boxKeys.push(I),this.bboxes.push(j),this.bboxes.push($),this.bboxes.push(X),this.bboxes.push(se)},mn.prototype.insertCircle=function(I,j,$,X){this._forEachCell(j-X,$-X,j+X,$+X,this._insertCircleCell,this.circleUid++),this.circleKeys.push(I),this.circles.push(j),this.circles.push($),this.circles.push(X)},mn.prototype._insertBoxCell=function(I,j,$,X,se,he){this.boxCells[se].push(he)},mn.prototype._insertCircleCell=function(I,j,$,X,se,he){this.circleCells[se].push(he)},mn.prototype._query=function(I,j,$,X,se,he){if($<0||I>this.width||X<0||j>this.height)return!se&&[];var ye=[];if(I<=0&&j<=0&&this.width<=$&&this.height<=X){if(se)return!0;for(var be=0;be0:ye},mn.prototype._queryCircle=function(I,j,$,X,se){var he=I-$,ye=I+$,be=j-$,Ee=j+$;if(ye<0||he>this.width||Ee<0||be>this.height)return!X&&[];var Ue=[],Xe={hitTest:X,circle:{x:I,y:j,radius:$},seenUids:{box:{},circle:{}}};return this._forEachCell(he,be,ye,Ee,this._queryCellCircle,Ue,Xe,se),X?Ue.length>0:Ue},mn.prototype.query=function(I,j,$,X,se){return this._query(I,j,$,X,!1,se)},mn.prototype.hitTest=function(I,j,$,X,se){return this._query(I,j,$,X,!0,se)},mn.prototype.hitTestCircle=function(I,j,$,X){return this._queryCircle(I,j,$,!0,X)},mn.prototype._queryCell=function(I,j,$,X,se,he,ye,be){var Ee=ye.seenUids,Ue=this.boxCells[se];if(Ue!==null)for(var Xe=this.bboxes,it=0,xt=Ue;it=Xe[_t+0]&&X>=Xe[_t+1]&&(!be||be(this.boxKeys[Dt]))){if(ye.hitTest)return he.push(!0),!0;he.push({key:this.boxKeys[Dt],x1:Xe[_t],y1:Xe[_t+1],x2:Xe[_t+2],y2:Xe[_t+3]})}}}var Mt=this.circleCells[se];if(Mt!==null)for(var vt=this.circles,Nt=0,Rt=Mt;Ntye*ye+be*be},mn.prototype._circleAndRectCollide=function(I,j,$,X,se,he,ye){var be=(he-X)/2,Ee=Math.abs(I-(X+be));if(Ee>be+$)return!1;var Ue=(ye-se)/2,Xe=Math.abs(j-(se+Ue));if(Xe>Ue+$)return!1;if(Ee<=be||Xe<=Ue)return!0;var it=Ee-be,xt=Xe-Ue;return it*it+xt*xt<=$*$};var Dr=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function yr(I,j){for(var $=0;$=1;Ai--)oi.push(cr.path[Ai]);for(var Gn=1;Gn0){for(var mi=oi[0].clone(),Mi=oi[0].clone(),Zi=1;Zi=tr.x&&Mi.x<=er.x&&mi.y>=tr.y&&Mi.y<=er.y?[oi]:Mi.xer.x||Mi.yer.y?[]:i.clipLine([oi],tr.x,tr.y,er.x,er.y)}for(var fi=0,zi=Qr;fi=this.screenRightBoundary||X<100||j>this.screenBottomBoundary},Kn.prototype.isInsideGrid=function(I,j,$,X){return $>=0&&I=0&&j0)return this.prevPlacement&&this.prevPlacement.variableOffsets[it.crossTileID]&&this.prevPlacement.placements[it.crossTileID]&&this.prevPlacement.placements[it.crossTileID].text&&(Mt=this.prevPlacement.variableOffsets[it.crossTileID].anchor),this.variableOffsets[it.crossTileID]={textOffset:vt,width:$,height:X,anchor:I,textBoxScale:se,prevAnchor:Mt},this.markUsedJustification(xt,I,it,Dt),xt.allowVerticalPlacement&&(this.markUsedOrientation(xt,Dt,it),this.placedOrientations[it.crossTileID]=Dt),{shift:Nt,placedGlyphBoxes:Rt}},pr.prototype.placeLayerBucketPart=function(I,j,$){var X=this,se=I.parameters,he=se.bucket,ye=se.layout,be=se.posMatrix,Ee=se.textLabelPlaneMatrix,Ue=se.labelToScreenMatrix,Xe=se.textPixelRatio,it=se.holdingForFade,xt=se.collisionBoxArray,Dt=se.partiallyEvaluatedTextSize,_t=se.collisionGroup,Mt=ye.get("text-optional"),vt=ye.get("icon-optional"),Nt=ye.get("text-allow-overlap"),Rt=ye.get("icon-allow-overlap"),Vt=ye.get("text-rotation-alignment")==="map",rn=ye.get("text-pitch-alignment")==="map",dn=ye.get("icon-text-fit")!=="none",En=ye.get("symbol-z-order")==="viewport-y",Tn=Nt&&(Rt||!he.hasIconData()||vt),tr=Rt&&(Nt||!he.hasTextData()||Mt);!he.collisionArrays&&xt&&he.deserializeCollisionBoxes(xt);var er=function(Gn,Mr){if(!j[Gn.crossTileID])if(it)X.placements[Gn.crossTileID]=new Mn(!1,!1,!1);else{var si,Qr=!1,mi=!1,Mi=!0,Zi=null,fi={box:null,offscreen:null},zi={box:null,offscreen:null},Oi=null,ta=null,Ni=0,na=0,pa=0;Mr.textFeatureIndex?Ni=Mr.textFeatureIndex:Gn.useRuntimeCollisionCircles&&(Ni=Gn.featureIndex),Mr.verticalTextFeatureIndex&&(na=Mr.verticalTextFeatureIndex);var Ga=Mr.textBox;if(Ga){var ko=function(go){var Ws=i.WritingMode.horizontal;if(he.allowVerticalPlacement&&!go&&X.prevPlacement){var Ys=X.prevPlacement.placedOrientations[Gn.crossTileID];Ys&&(X.placedOrientations[Gn.crossTileID]=Ys,Ws=Ys,X.markUsedOrientation(he,Ws,Gn))}return Ws},To=function(go,Ws){if(he.allowVerticalPlacement&&Gn.numVerticalGlyphVertices>0&&Mr.verticalTextBox)for(var Ys=0,vg=he.writingModes;Ys0&&(Ha=Ha.filter(function(go){return go!==po.anchor})).unshift(po.anchor)}var ro=function(go,Ws,Ys){for(var vg=go.x2-go.x1,k5=go.y2-go.y1,Fl=Gn.textBoxScale,C1=dn&&!Rt?Ws:null,Np={box:[],offscreen:!1},T5=Nt?2*Ha.length:Ha.length,Mh=0;Mh=Ha.length,L1=X.attemptAnchorPlacement(M5,go,vg,k5,Fl,Vt,rn,Xe,be,_t,xg,Gn,he,Ys,C1);if(L1&&(Np=L1.placedGlyphBoxes)&&Np.box&&Np.box.length){Qr=!0,Zi=L1.shift;break}}return Np};To(function(){return ro(Ga,Mr.iconBox,i.WritingMode.horizontal)},function(){var go=Mr.verticalTextBox,Ws=fi&&fi.box&&fi.box.length;return he.allowVerticalPlacement&&!Ws&&Gn.numVerticalGlyphVertices>0&&go?ro(go,Mr.verticalIconBox,i.WritingMode.vertical):{box:null,offscreen:null}}),fi&&(Qr=fi.box,Mi=fi.offscreen);var Ls=ko(fi&&fi.box);if(!Qr&&X.prevPlacement){var Ho=X.prevPlacement.variableOffsets[Gn.crossTileID];Ho&&(X.variableOffsets[Gn.crossTileID]=Ho,X.markUsedJustification(he,Ho.anchor,Gn,Ls))}}else{var nl=function(go,Ws){var Ys=X.collisionIndex.placeCollisionBox(go,Nt,Xe,be,_t.predicate);return Ys&&Ys.box&&Ys.box.length&&(X.markUsedOrientation(he,Ws,Gn),X.placedOrientations[Gn.crossTileID]=Ws),Ys};To(function(){return nl(Ga,i.WritingMode.horizontal)},function(){var go=Mr.verticalTextBox;return he.allowVerticalPlacement&&Gn.numVerticalGlyphVertices>0&&go?nl(go,i.WritingMode.vertical):{box:null,offscreen:null}}),ko(fi&&fi.box&&fi.box.length)}}if(Qr=(si=fi)&&si.box&&si.box.length>0,Mi=si&&si.offscreen,Gn.useRuntimeCollisionCircles){var xc=he.text.placedSymbolArray.get(Gn.centerJustifiedTextSymbolIndex),Ff=i.evaluateSizeForFeature(he.textSizeData,Dt,xc),Fp=ye.get("text-padding"),_d=Gn.collisionCircleDiameter;Oi=X.collisionIndex.placeCollisionCircles(Nt,xc,he.lineVertexArray,he.glyphOffsetArray,Ff,be,Ee,Ue,$,rn,_t.predicate,_d,Fp),Qr=Nt||Oi.circles.length>0&&!Oi.collisionDetected,Mi=Mi&&Oi.offscreen}if(Mr.iconFeatureIndex&&(pa=Mr.iconFeatureIndex),Mr.iconBox){var wd=function(go){var Ws=dn&&Zi?Gr(go,Zi.x,Zi.y,Vt,rn,X.transform.angle):go;return X.collisionIndex.placeCollisionBox(Ws,Rt,Xe,be,_t.predicate)};mi=zi&&zi.box&&zi.box.length&&Mr.verticalIconBox?(ta=wd(Mr.verticalIconBox)).box.length>0:(ta=wd(Mr.iconBox)).box.length>0,Mi=Mi&&ta.offscreen}var Ds=Mt||Gn.numHorizontalGlyphVertices===0&&Gn.numVerticalGlyphVertices===0,Th=vt||Gn.numIconVertices===0;if(Ds||Th?Th?Ds||(mi=mi&&Qr):Qr=mi&&Qr:mi=Qr=mi&&Qr,Qr&&si&&si.box&&(zi&&zi.box&&na?X.collisionIndex.insertCollisionBox(si.box,ye.get("text-ignore-placement"),he.bucketInstanceId,na,_t.ID):X.collisionIndex.insertCollisionBox(si.box,ye.get("text-ignore-placement"),he.bucketInstanceId,Ni,_t.ID)),mi&&ta&&X.collisionIndex.insertCollisionBox(ta.box,ye.get("icon-ignore-placement"),he.bucketInstanceId,pa,_t.ID),Oi&&(Qr&&X.collisionIndex.insertCollisionCircles(Oi.circles,ye.get("text-ignore-placement"),he.bucketInstanceId,Ni,_t.ID),$)){var Rp=he.bucketInstanceId,ru=X.collisionCircleArrays[Rp];ru===void 0&&(ru=X.collisionCircleArrays[Rp]=new rr);for(var zp=0;zp=0;--cr){var Xr=gr[cr];er(he.symbolInstances.get(Xr),he.collisionArrays[Xr])}else for(var oi=I.symbolInstanceStart;oi=0&&(I.text.placedSymbolArray.get(Ee).crossTileID=se>=0&&Ee!==se?0:$.crossTileID)}},pr.prototype.markUsedOrientation=function(I,j,$){for(var X=j===i.WritingMode.horizontal||j===i.WritingMode.horizontalOnly?j:0,se=j===i.WritingMode.vertical?j:0,he=0,ye=[$.leftJustifiedTextSymbolIndex,$.centerJustifiedTextSymbolIndex,$.rightJustifiedTextSymbolIndex];he0||rn>0,er=Rt.numIconVertices>0,gr=X.placedOrientations[Rt.crossTileID],cr=gr===i.WritingMode.vertical,Xr=gr===i.WritingMode.horizontal||gr===i.WritingMode.horizontalOnly;if(tr){var oi=Un(Tn.text),Ai=cr?Nn:oi;Dt(I.text,Vt,Ai);var Gn=Xr?Nn:oi;Dt(I.text,rn,Gn);var Mr=Tn.text.isHidden();[Rt.rightJustifiedTextSymbolIndex,Rt.centerJustifiedTextSymbolIndex,Rt.leftJustifiedTextSymbolIndex].forEach(function(pa){pa>=0&&(I.text.placedSymbolArray.get(pa).hidden=Mr||cr?1:0)}),Rt.verticalPlacedTextSymbolIndex>=0&&(I.text.placedSymbolArray.get(Rt.verticalPlacedTextSymbolIndex).hidden=Mr||Xr?1:0);var si=X.variableOffsets[Rt.crossTileID];si&&X.markUsedJustification(I,si.anchor,Rt,gr);var Qr=X.placedOrientations[Rt.crossTileID];Qr&&(X.markUsedJustification(I,"left",Rt,Qr),X.markUsedOrientation(I,Qr,Rt))}if(er){var mi=Un(Tn.icon),Mi=!(it&&Rt.verticalPlacedIconSymbolIndex&&cr);if(Rt.placedIconSymbolIndex>=0){var Zi=Mi?mi:Nn;Dt(I.icon,Rt.numIconVertices,Zi),I.icon.placedSymbolArray.get(Rt.placedIconSymbolIndex).hidden=Tn.icon.isHidden()}if(Rt.verticalPlacedIconSymbolIndex>=0){var fi=Mi?Nn:mi;Dt(I.icon,Rt.numVerticalIconVertices,fi),I.icon.placedSymbolArray.get(Rt.verticalPlacedIconSymbolIndex).hidden=Tn.icon.isHidden()}}if(I.hasIconCollisionBoxData()||I.hasTextCollisionBoxData()){var zi=I.collisionArrays[Nt];if(zi){var Oi=new i.Point(0,0);if(zi.textBox||zi.verticalTextBox){var ta=!0;if(Ee){var Ni=X.variableOffsets[dn];Ni?(Oi=Nr(Ni.anchor,Ni.width,Ni.height,Ni.textOffset,Ni.textBoxScale),Ue&&Oi._rotate(Xe?X.transform.angle:-X.transform.angle)):ta=!1}zi.textBox&&qr(I.textCollisionBox.collisionVertexArray,Tn.text.placed,!ta||cr,Oi.x,Oi.y),zi.verticalTextBox&&qr(I.textCollisionBox.collisionVertexArray,Tn.text.placed,!ta||Xr,Oi.x,Oi.y)}var na=!!(!Xr&&zi.verticalIconBox);zi.iconBox&&qr(I.iconCollisionBox.collisionVertexArray,Tn.icon.placed,na,it?Oi.x:0,it?Oi.y:0),zi.verticalIconBox&&qr(I.iconCollisionBox.collisionVertexArray,Tn.icon.placed,!na,it?Oi.x:0,it?Oi.y:0)}}},Mt=0;MtI},pr.prototype.setStale=function(){this.stale=!0};var _i=Math.pow(2,25),cn=Math.pow(2,24),jn=Math.pow(2,17),jt=Math.pow(2,16),fn=Math.pow(2,9),vn=Math.pow(2,8),Hn=Math.pow(2,1);function Un(I){if(I.opacity===0&&!I.placed)return 0;if(I.opacity===1&&I.placed)return 4294967295;var j=I.placed?1:0,$=Math.floor(127*I.opacity);return $*_i+j*cn+$*jn+j*jt+$*fn+j*vn+$*Hn+j}var Nn=0,Rn=function(I){this._sortAcrossTiles=I.layout.get("symbol-z-order")!=="viewport-y"&&I.layout.get("symbol-sort-key").constantOr(1)!==void 0,this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]};Rn.prototype.continuePlacement=function(I,j,$,X,se){for(var he=this._bucketParts;this._currentTileIndex2};this._currentPlacementIndex>=0;){var ye=j[I[this._currentPlacementIndex]],be=this.placement.collisionIndex.transform.zoom;if(ye.type==="symbol"&&(!ye.minzoom||ye.minzoom<=be)&&(!ye.maxzoom||ye.maxzoom>be)){if(this._inProgressLayer||(this._inProgressLayer=new Rn(ye)),this._inProgressLayer.continuePlacement($[ye.source],this.placement,this._showCollisionBoxes,ye,he))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0},wn.prototype.commit=function(I){return this.placement.commit(I),this.placement};var An=512/i.EXTENT/2,kn=function(I,j,$){this.tileID=I,this.indexedSymbolInstances={},this.bucketInstanceId=$;for(var X=0;XI.overscaledZ)for(var be in ye){var Ee=ye[be];Ee.tileID.isChildOf(I)&&Ee.findMatches(j.symbolInstances,I,se)}else{var Ue=ye[I.scaledTo(Number(he)).key];Ue&&Ue.findMatches(j.symbolInstances,I,se)}}for(var Xe=0;Xe1?"@2x":"",it=i.getJSON(he.transformRequest(he.normalizeSpriteURL(se,Xe,".json"),i.ResourceType.SpriteJSON),function(_t,Mt){it=null,Ue||(Ue=_t,be=Mt,Dt())}),xt=i.getImage(he.transformRequest(he.normalizeSpriteURL(se,Xe,".png"),i.ResourceType.SpriteImage),function(_t,Mt){xt=null,Ue||(Ue=_t,Ee=Mt,Dt())});function Dt(){if(Ue)ye(Ue);else if(be&&Ee){var _t=i.browser.getImageData(Ee),Mt={};for(var vt in be){var Nt=be[vt],Rt=Nt.width,Vt=Nt.height,rn=Nt.x,dn=Nt.y,En=Nt.sdf,Tn=Nt.pixelRatio,tr=Nt.stretchX,er=Nt.stretchY,gr=Nt.content,cr=new i.RGBAImage({width:Rt,height:Vt});i.RGBAImage.copy(_t,cr,{x:rn,y:dn},{x:0,y:0},{width:Rt,height:Vt}),Mt[vt]={data:cr,pixelRatio:Tn,sdf:En,stretchX:tr,stretchY:er,content:gr}}ye(null,Mt)}}return{cancel:function(){it&&(it.cancel(),it=null),xt&&(xt.cancel(),xt=null)}}}($,this.map._requestManager,function(se,he){if(X._spriteRequest=null,se)X.fire(new i.ErrorEvent(se));else if(he)for(var ye in he)X.imageManager.addImage(ye,he[ye]);X.imageManager.setLoaded(!0),X._availableImages=X.imageManager.listImages(),X.dispatcher.broadcast("setImages",X._availableImages),X.fire(new i.Event("data",{dataType:"style"}))})},j.prototype._validateLayer=function($){var X=this.sourceCaches[$.source];if(X){var se=$.sourceLayer;if(se){var he=X.getSource();(he.type==="geojson"||he.vectorLayerIds&&he.vectorLayerIds.indexOf(se)===-1)&&this.fire(new i.ErrorEvent(new Error('Source layer "'+se+'" does not exist on source "'+he.id+'" as specified by style layer "'+$.id+'"')))}}},j.prototype.loaded=function(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(var $ in this.sourceCaches)if(!this.sourceCaches[$].loaded())return!1;return!!this.imageManager.isLoaded()},j.prototype._serializeLayers=function($){for(var X=[],se=0,he=$;se0)throw new Error("Unimplemented: "+he.map(function(ye){return ye.command}).join(", ")+".");return se.forEach(function(ye){ye.command!=="setTransition"&&X[ye.command].apply(X,ye.args)}),this.stylesheet=$,!0},j.prototype.addImage=function($,X){if(this.getImage($))return this.fire(new i.ErrorEvent(new Error("An image with this name already exists.")));this.imageManager.addImage($,X),this._availableImages=this.imageManager.listImages(),this._changedImages[$]=!0,this._changed=!0,this.fire(new i.Event("data",{dataType:"style"}))},j.prototype.updateImage=function($,X){this.imageManager.updateImage($,X)},j.prototype.getImage=function($){return this.imageManager.getImage($)},j.prototype.removeImage=function($){if(!this.getImage($))return this.fire(new i.ErrorEvent(new Error("No image with this name exists.")));this.imageManager.removeImage($),this._availableImages=this.imageManager.listImages(),this._changedImages[$]=!0,this._changed=!0,this.fire(new i.Event("data",{dataType:"style"}))},j.prototype.listImages=function(){return this._checkLoaded(),this.imageManager.listImages()},j.prototype.addSource=function($,X,se){var he=this;if(se===void 0&&(se={}),this._checkLoaded(),this.sourceCaches[$]!==void 0)throw new Error("There is already a source with this ID");if(!X.type)throw new Error("The type property must be defined, but the only the following properties were given: "+Object.keys(X).join(", ")+".");if(!(["vector","raster","geojson","video","image"].indexOf(X.type)>=0)||!this._validate(i.validateStyle.source,"sources."+$,X,null,se)){this.map&&this.map._collectResourceTiming&&(X.collectResourceTiming=!0);var ye=this.sourceCaches[$]=new qe($,X,this.dispatcher);ye.style=this,ye.setEventedParent(this,function(){return{isSourceLoaded:he.loaded(),source:ye.serialize(),sourceId:$}}),ye.onAdd(this.map),this._changed=!0}},j.prototype.removeSource=function($){if(this._checkLoaded(),this.sourceCaches[$]===void 0)throw new Error("There is no source with this ID");for(var X in this._layers)if(this._layers[X].source===$)return this.fire(new i.ErrorEvent(new Error('Source "'+$+'" cannot be removed while layer "'+X+'" is using it.')));var se=this.sourceCaches[$];delete this.sourceCaches[$],delete this._updatedSources[$],se.fire(new i.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:$})),se.setEventedParent(null),se.clearTiles(),se.onRemove&&se.onRemove(this.map),this._changed=!0},j.prototype.setGeoJSONSourceData=function($,X){this._checkLoaded(),this.sourceCaches[$].getSource().setData(X),this._changed=!0},j.prototype.getSource=function($){return this.sourceCaches[$]&&this.sourceCaches[$].getSource()},j.prototype.addLayer=function($,X,se){se===void 0&&(se={}),this._checkLoaded();var he=$.id;if(this.getLayer(he))this.fire(new i.ErrorEvent(new Error('Layer with id "'+he+'" already exists on this map')));else{var ye;if($.type==="custom"){if(ir(this,i.validateCustomStyleLayer($)))return;ye=i.createStyleLayer($)}else{if(typeof $.source=="object"&&(this.addSource(he,$.source),$=i.clone$1($),$=i.extend($,{source:he})),this._validate(i.validateStyle.layer,"layers."+he,$,{arrayIndex:-1},se))return;ye=i.createStyleLayer($),this._validateLayer(ye),ye.setEventedParent(this,{layer:{id:he}}),this._serializedLayers[ye.id]=ye.serialize()}var be=X?this._order.indexOf(X):this._order.length;if(X&&be===-1)this.fire(new i.ErrorEvent(new Error('Layer with id "'+X+'" does not exist on this map.')));else{if(this._order.splice(be,0,he),this._layerOrderChanged=!0,this._layers[he]=ye,this._removedLayers[he]&&ye.source&&ye.type!=="custom"){var Ee=this._removedLayers[he];delete this._removedLayers[he],Ee.type!==ye.type?this._updatedSources[ye.source]="clear":(this._updatedSources[ye.source]="reload",this.sourceCaches[ye.source].pause())}this._updateLayer(ye),ye.onAdd&&ye.onAdd(this.map)}}},j.prototype.moveLayer=function($,X){if(this._checkLoaded(),this._changed=!0,this._layers[$]){if($!==X){var se=this._order.indexOf($);this._order.splice(se,1);var he=X?this._order.indexOf(X):this._order.length;X&&he===-1?this.fire(new i.ErrorEvent(new Error('Layer with id "'+X+'" does not exist on this map.'))):(this._order.splice(he,0,$),this._layerOrderChanged=!0)}}else this.fire(new i.ErrorEvent(new Error("The layer '"+$+"' does not exist in the map's style and cannot be moved.")))},j.prototype.removeLayer=function($){this._checkLoaded();var X=this._layers[$];if(X){X.setEventedParent(null);var se=this._order.indexOf($);this._order.splice(se,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[$]=X,delete this._layers[$],delete this._serializedLayers[$],delete this._updatedLayers[$],delete this._updatedPaintProps[$],X.onRemove&&X.onRemove(this.map)}else this.fire(new i.ErrorEvent(new Error("The layer '"+$+"' does not exist in the map's style and cannot be removed.")))},j.prototype.getLayer=function($){return this._layers[$]},j.prototype.hasLayer=function($){return $ in this._layers},j.prototype.setLayerZoomRange=function($,X,se){this._checkLoaded();var he=this.getLayer($);he?he.minzoom===X&&he.maxzoom===se||(X!=null&&(he.minzoom=X),se!=null&&(he.maxzoom=se),this._updateLayer(he)):this.fire(new i.ErrorEvent(new Error("The layer '"+$+"' does not exist in the map's style and cannot have zoom extent.")))},j.prototype.setFilter=function($,X,se){se===void 0&&(se={}),this._checkLoaded();var he=this.getLayer($);if(he){if(!i.deepEqual(he.filter,X))return X==null?(he.filter=void 0,void this._updateLayer(he)):void(this._validate(i.validateStyle.filter,"layers."+he.id+".filter",X,null,se)||(he.filter=i.clone$1(X),this._updateLayer(he)))}else this.fire(new i.ErrorEvent(new Error("The layer '"+$+"' does not exist in the map's style and cannot be filtered.")))},j.prototype.getFilter=function($){return i.clone$1(this.getLayer($).filter)},j.prototype.setLayoutProperty=function($,X,se,he){he===void 0&&(he={}),this._checkLoaded();var ye=this.getLayer($);ye?i.deepEqual(ye.getLayoutProperty(X),se)||(ye.setLayoutProperty(X,se,he),this._updateLayer(ye)):this.fire(new i.ErrorEvent(new Error("The layer '"+$+"' does not exist in the map's style and cannot be styled.")))},j.prototype.getLayoutProperty=function($,X){var se=this.getLayer($);if(se)return se.getLayoutProperty(X);this.fire(new i.ErrorEvent(new Error("The layer '"+$+"' does not exist in the map's style.")))},j.prototype.setPaintProperty=function($,X,se,he){he===void 0&&(he={}),this._checkLoaded();var ye=this.getLayer($);ye?i.deepEqual(ye.getPaintProperty(X),se)||(ye.setPaintProperty(X,se,he)&&this._updateLayer(ye),this._changed=!0,this._updatedPaintProps[$]=!0):this.fire(new i.ErrorEvent(new Error("The layer '"+$+"' does not exist in the map's style and cannot be styled.")))},j.prototype.getPaintProperty=function($,X){return this.getLayer($).getPaintProperty(X)},j.prototype.setFeatureState=function($,X){this._checkLoaded();var se=$.source,he=$.sourceLayer,ye=this.sourceCaches[se];if(ye!==void 0){var be=ye.getSource().type;be==="geojson"&&he?this.fire(new i.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):be!=="vector"||he?($.id===void 0&&this.fire(new i.ErrorEvent(new Error("The feature id parameter must be provided."))),ye.setFeatureState(he,$.id,X)):this.fire(new i.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new i.ErrorEvent(new Error("The source '"+se+"' does not exist in the map's style.")))},j.prototype.removeFeatureState=function($,X){this._checkLoaded();var se=$.source,he=this.sourceCaches[se];if(he!==void 0){var ye=he.getSource().type,be=ye==="vector"?$.sourceLayer:void 0;ye!=="vector"||be?X&&typeof $.id!="string"&&typeof $.id!="number"?this.fire(new i.ErrorEvent(new Error("A feature id is requred to remove its specific state property."))):he.removeFeatureState(be,$.id,X):this.fire(new i.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new i.ErrorEvent(new Error("The source '"+se+"' does not exist in the map's style.")))},j.prototype.getFeatureState=function($){this._checkLoaded();var X=$.source,se=$.sourceLayer,he=this.sourceCaches[X];if(he!==void 0){if(he.getSource().type!=="vector"||se)return $.id===void 0&&this.fire(new i.ErrorEvent(new Error("The feature id parameter must be provided."))),he.getFeatureState(se,$.id);this.fire(new i.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new i.ErrorEvent(new Error("The source '"+X+"' does not exist in the map's style.")))},j.prototype.getTransition=function(){return i.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)},j.prototype.serialize=function(){return i.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:i.mapObject(this.sourceCaches,function($){return $.serialize()}),layers:this._serializeLayers(this._order)},function($){return $!==void 0})},j.prototype._updateLayer=function($){this._updatedLayers[$.id]=!0,$.source&&!this._updatedSources[$.source]&&this.sourceCaches[$.source].getSource().type!=="raster"&&(this._updatedSources[$.source]="reload",this.sourceCaches[$.source].pause()),this._changed=!0},j.prototype._flattenAndSortRenderedFeatures=function($){for(var X=this,se=function(gr){return X._layers[gr].type==="fill-extrusion"},he={},ye=[],be=this._order.length-1;be>=0;be--){var Ee=this._order[be];if(se(Ee)){he[Ee]=be;for(var Ue=0,Xe=$;Ue=0;vt--){var Nt=this._order[vt];if(se(Nt))for(var Rt=ye.length-1;Rt>=0;Rt--){var Vt=ye[Rt].feature;if(he[Vt.layer.id] 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,0.0,1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),eo=wa("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),Co=wa("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,0,1);}"),ms=wa(`#pragma mapbox: define highp vec4 color -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize lowp float opacity -gl_FragColor=color*opacity; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`attribute vec2 a_pos;uniform mat4 u_matrix; -#pragma mapbox: define highp vec4 color -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize lowp float opacity -gl_Position=u_matrix*vec4(a_pos,0,1);}`),ba=wa(`varying vec2 v_pos; -#pragma mapbox: define highp vec4 outline_color -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize highp vec4 outline_color -#pragma mapbox: initialize lowp float opacity -float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos; -#pragma mapbox: define highp vec4 outline_color -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize highp vec4 outline_color -#pragma mapbox: initialize lowp float opacity -gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),_a=wa(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos; -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp vec4 pattern_from -#pragma mapbox: define lowp vec4 pattern_to -void main() { -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump vec4 pattern_from -#pragma mapbox: initialize mediump vec4 pattern_to -vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos; -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp vec4 pattern_from -#pragma mapbox: define lowp vec4 pattern_to -#pragma mapbox: define lowp float pixel_ratio_from -#pragma mapbox: define lowp float pixel_ratio_to -void main() { -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump vec4 pattern_from -#pragma mapbox: initialize mediump vec4 pattern_to -#pragma mapbox: initialize lowp float pixel_ratio_from -#pragma mapbox: initialize lowp float pixel_ratio_to -vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),ns=wa(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b; -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp vec4 pattern_from -#pragma mapbox: define lowp vec4 pattern_to -void main() { -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump vec4 pattern_from -#pragma mapbox: initialize mediump vec4 pattern_to -vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b; -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp vec4 pattern_from -#pragma mapbox: define lowp vec4 pattern_to -#pragma mapbox: define lowp float pixel_ratio_from -#pragma mapbox: define lowp float pixel_ratio_to -void main() { -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump vec4 pattern_from -#pragma mapbox: initialize mediump vec4 pattern_to -#pragma mapbox: initialize lowp float pixel_ratio_from -#pragma mapbox: initialize lowp float pixel_ratio_to -vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),ua=wa(`varying vec4 v_color;void main() {gl_FragColor=v_color; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec4 v_color; -#pragma mapbox: define highp float base -#pragma mapbox: define highp float height -#pragma mapbox: define highp vec4 color -void main() { -#pragma mapbox: initialize highp float base -#pragma mapbox: initialize highp float height -#pragma mapbox: initialize highp vec4 color -vec3 normal=a_normal_ed.xyz;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),ys=wa(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting; -#pragma mapbox: define lowp float base -#pragma mapbox: define lowp float height -#pragma mapbox: define lowp vec4 pattern_from -#pragma mapbox: define lowp vec4 pattern_to -#pragma mapbox: define lowp float pixel_ratio_from -#pragma mapbox: define lowp float pixel_ratio_to -void main() { -#pragma mapbox: initialize lowp float base -#pragma mapbox: initialize lowp float height -#pragma mapbox: initialize mediump vec4 pattern_from -#pragma mapbox: initialize mediump vec4 pattern_to -#pragma mapbox: initialize lowp float pixel_ratio_from -#pragma mapbox: initialize lowp float pixel_ratio_to -vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting; -#pragma mapbox: define lowp float base -#pragma mapbox: define lowp float height -#pragma mapbox: define lowp vec4 pattern_from -#pragma mapbox: define lowp vec4 pattern_to -#pragma mapbox: define lowp float pixel_ratio_from -#pragma mapbox: define lowp float pixel_ratio_to -void main() { -#pragma mapbox: initialize lowp float base -#pragma mapbox: initialize lowp float height -#pragma mapbox: initialize mediump vec4 pattern_from -#pragma mapbox: initialize mediump vec4 pattern_to -#pragma mapbox: initialize lowp float pixel_ratio_from -#pragma mapbox: initialize lowp float pixel_ratio_to -vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0 -? a_pos -: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),Ts=wa(`#ifdef GL_ES -precision highp float; -#endif -uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform float u_maxzoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggeration=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/ pow(2.0,(u_zoom-u_maxzoom)*exaggeration+19.2562-u_zoom);gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),co=wa(`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent; -#define PI 3.141592653589793 -void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),rs=wa(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale; -#pragma mapbox: define highp vec4 color -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,` -#define scale 0.015873016 -attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar; -#pragma mapbox: define highp vec4 color -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -#pragma mapbox: define mediump float gapwidth -#pragma mapbox: define lowp float offset -#pragma mapbox: define mediump float width -void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump float gapwidth -#pragma mapbox: initialize lowp float offset -#pragma mapbox: initialize mediump float width -float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}`),Ms=wa(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp float v_lineprogress; -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,vec2(v_lineprogress,0.5));gl_FragColor=color*(alpha*opacity); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,` -#define MAX_LINE_DISTANCE 32767.0 -#define scale 0.015873016 -attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_lineprogress; -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -#pragma mapbox: define mediump float gapwidth -#pragma mapbox: define lowp float offset -#pragma mapbox: define mediump float width -void main() { -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump float gapwidth -#pragma mapbox: initialize lowp float offset -#pragma mapbox: initialize mediump float width -float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_lineprogress=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0/MAX_LINE_DISTANCE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}`),Ns=wa(`uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width; -#pragma mapbox: define lowp vec4 pattern_from -#pragma mapbox: define lowp vec4 pattern_to -#pragma mapbox: define lowp float pixel_ratio_from -#pragma mapbox: define lowp float pixel_ratio_to -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize mediump vec4 pattern_from -#pragma mapbox: initialize mediump vec4 pattern_to -#pragma mapbox: initialize lowp float pixel_ratio_from -#pragma mapbox: initialize lowp float pixel_ratio_to -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,` -#define scale 0.015873016 -#define LINE_DISTANCE_SCALE 2.0 -attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width; -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp float offset -#pragma mapbox: define mediump float gapwidth -#pragma mapbox: define mediump float width -#pragma mapbox: define lowp float floorwidth -#pragma mapbox: define lowp vec4 pattern_from -#pragma mapbox: define lowp vec4 pattern_to -#pragma mapbox: define lowp float pixel_ratio_from -#pragma mapbox: define lowp float pixel_ratio_to -void main() { -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize lowp float offset -#pragma mapbox: initialize mediump float gapwidth -#pragma mapbox: initialize mediump float width -#pragma mapbox: initialize lowp float floorwidth -#pragma mapbox: initialize mediump vec4 pattern_from -#pragma mapbox: initialize mediump vec4 pattern_to -#pragma mapbox: initialize lowp float pixel_ratio_from -#pragma mapbox: initialize lowp float pixel_ratio_to -float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),Io=wa(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale; -#pragma mapbox: define highp vec4 color -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -#pragma mapbox: define mediump float width -#pragma mapbox: define lowp float floorwidth -void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump float width -#pragma mapbox: initialize lowp float floorwidth -float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,` -#define scale 0.015873016 -#define LINE_DISTANCE_SCALE 2.0 -attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale; -#pragma mapbox: define highp vec4 color -#pragma mapbox: define lowp float blur -#pragma mapbox: define lowp float opacity -#pragma mapbox: define mediump float gapwidth -#pragma mapbox: define lowp float offset -#pragma mapbox: define mediump float width -#pragma mapbox: define lowp float floorwidth -void main() { -#pragma mapbox: initialize highp vec4 color -#pragma mapbox: initialize lowp float blur -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize mediump float gapwidth -#pragma mapbox: initialize lowp float offset -#pragma mapbox: initialize mediump float width -#pragma mapbox: initialize lowp float floorwidth -float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),to=wa(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,"uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),Zo=wa(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity; -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize lowp float opacity -lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity; -#pragma mapbox: define lowp float opacity -void main() { -#pragma mapbox: initialize lowp float opacity -vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? -camera_to_anchor_distance/u_camera_to_center_distance : -u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),0.0,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;v_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));}`),mc=wa(`#define SDF_PX 8.0 -uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1; -#pragma mapbox: define highp vec4 fill_color -#pragma mapbox: define highp vec4 halo_color -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp float halo_width -#pragma mapbox: define lowp float halo_blur -void main() { -#pragma mapbox: initialize highp vec4 fill_color -#pragma mapbox: initialize highp vec4 halo_color -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize lowp float halo_width -#pragma mapbox: initialize lowp float halo_blur -float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1; -#pragma mapbox: define highp vec4 fill_color -#pragma mapbox: define highp vec4 halo_color -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp float halo_width -#pragma mapbox: define lowp float halo_blur -void main() { -#pragma mapbox: initialize highp vec4 fill_color -#pragma mapbox: initialize highp vec4 halo_color -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize lowp float halo_width -#pragma mapbox: initialize lowp float halo_blur -vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? -camera_to_anchor_distance/u_camera_to_center_distance : -u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),Rc=wa(`#define SDF_PX 8.0 -#define SDF 1.0 -#define ICON 0.0 -uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1; -#pragma mapbox: define highp vec4 fill_color -#pragma mapbox: define highp vec4 halo_color -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp float halo_width -#pragma mapbox: define lowp float halo_blur -void main() { -#pragma mapbox: initialize highp vec4 fill_color -#pragma mapbox: initialize highp vec4 halo_color -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize lowp float halo_width -#pragma mapbox: initialize lowp float halo_blur -float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha; -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity); -#ifdef OVERDRAW_INSPECTOR -gl_FragColor=vec4(1.0); -#endif -}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1; -#pragma mapbox: define highp vec4 fill_color -#pragma mapbox: define highp vec4 halo_color -#pragma mapbox: define lowp float opacity -#pragma mapbox: define lowp float halo_width -#pragma mapbox: define lowp float halo_blur -void main() { -#pragma mapbox: initialize highp vec4 fill_color -#pragma mapbox: initialize highp vec4 halo_color -#pragma mapbox: initialize lowp float opacity -#pragma mapbox: initialize lowp float halo_width -#pragma mapbox: initialize lowp float halo_blur -vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? -camera_to_anchor_distance/u_camera_to_center_distance : -u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`);function wa(I,j){var $=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,X={};return{fragmentSource:I=I.replace($,function(se,he,ye,be,Ee){return X[Ee]=!0,he==="define"?` -#ifndef HAS_UNIFORM_u_`+Ee+` -varying `+ye+" "+be+" "+Ee+`; -#else -uniform `+ye+" "+be+" u_"+Ee+`; -#endif -`:` -#ifdef HAS_UNIFORM_u_`+Ee+` - `+ye+" "+be+" "+Ee+" = u_"+Ee+`; -#endif -`}),vertexSource:j=j.replace($,function(se,he,ye,be,Ee){var Ue=be==="float"?"vec2":"vec4",Xe=Ee.match(/color/)?"color":Ue;return X[Ee]?he==="define"?` -#ifndef HAS_UNIFORM_u_`+Ee+` -uniform lowp float u_`+Ee+`_t; -attribute `+ye+" "+Ue+" a_"+Ee+`; -varying `+ye+" "+be+" "+Ee+`; -#else -uniform `+ye+" "+be+" u_"+Ee+`; -#endif -`:Xe==="vec4"?` -#ifndef HAS_UNIFORM_u_`+Ee+` - `+Ee+" = a_"+Ee+`; -#else - `+ye+" "+be+" "+Ee+" = u_"+Ee+`; -#endif -`:` -#ifndef HAS_UNIFORM_u_`+Ee+` - `+Ee+" = unpack_mix_"+Xe+"(a_"+Ee+", u_"+Ee+`_t); -#else - `+ye+" "+be+" "+Ee+" = u_"+Ee+`; -#endif -`:he==="define"?` -#ifndef HAS_UNIFORM_u_`+Ee+` -uniform lowp float u_`+Ee+`_t; -attribute `+ye+" "+Ue+" a_"+Ee+`; -#else -uniform `+ye+" "+be+" u_"+Ee+`; -#endif -`:Xe==="vec4"?` -#ifndef HAS_UNIFORM_u_`+Ee+` - `+ye+" "+be+" "+Ee+" = a_"+Ee+`; -#else - `+ye+" "+be+" "+Ee+" = u_"+Ee+`; -#endif -`:` -#ifndef HAS_UNIFORM_u_`+Ee+` - `+ye+" "+be+" "+Ee+" = unpack_mix_"+Xe+"(a_"+Ee+", u_"+Ee+`_t); -#else - `+ye+" "+be+" "+Ee+" = u_"+Ee+`; -#endif -`})}}var Zu=Object.freeze({__proto__:null,prelude:Br,background:ai,backgroundPattern:Vi,circle:$i,clippingMask:Er,heatmap:ci,heatmapTexture:li,collisionBox:ra,collisionCircle:eo,debug:Co,fill:ms,fillOutline:ba,fillOutlinePattern:_a,fillPattern:ns,fillExtrusion:ua,fillExtrusionPattern:ys,hillshadePrepare:Ts,hillshade:co,line:rs,lineGradient:Ms,linePattern:Ns,lineSDF:Io,raster:to,symbolIcon:Zo,symbolSDF:mc,symbolTextAndIcon:Rc}),Kl=function(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null};Kl.prototype.bind=function(I,j,$,X,se,he,ye,be){this.context=I;for(var Ee=this.boundPaintVertexBuffers.length!==X.length,Ue=0;!Ee&&Ue>16,be>>16],u_pixel_coord_lower:[65535&ye,65535&be]}}zc.prototype.draw=function(I,j,$,X,se,he,ye,be,Ee,Ue,Xe,it,xt,Dt,_t,Mt){var vt,Nt=I.gl;if(!this.failedToCreate){for(var Rt in I.program.set(this.program),I.setDepthMode($),I.setStencilMode(X),I.setColorMode(se),I.setCullFace(he),this.fixedUniforms)this.fixedUniforms[Rt].set(ye[Rt]);Dt&&Dt.setUniforms(I,this.binderUniforms,it,{zoom:xt});for(var Vt=(vt={},vt[Nt.LINES]=2,vt[Nt.TRIANGLES]=3,vt[Nt.LINE_STRIP]=1,vt)[j],rn=0,dn=Xe.get();rn0?1-1/(1.001-ye):-ye),u_contrast_factor:(he=se.paint.get("raster-contrast"),he>0?1/(1-he):1+he),u_spin_weights:pt(se.paint.get("raster-hue-rotate"))};var he,ye};function pt(I){I*=Math.PI/180;var j=Math.sin(I),$=Math.cos(I);return[(2*$+1)/3,(-Math.sqrt(3)*j-$+1)/3,(Math.sqrt(3)*j-$+1)/3]}var Ct,Qt=function(I,j,$,X,se,he,ye,be,Ee,Ue){var Xe=se.transform;return{u_is_size_zoom_constant:+(I==="constant"||I==="source"),u_is_size_feature_constant:+(I==="constant"||I==="camera"),u_size_t:j?j.uSizeT:0,u_size:j?j.uSize:0,u_camera_to_center_distance:Xe.cameraToCenterDistance,u_pitch:Xe.pitch/360*2*Math.PI,u_rotate_symbol:+$,u_aspect_ratio:Xe.width/Xe.height,u_fade_change:se.options.fadeDuration?se.symbolFadeChange:1,u_matrix:he,u_label_plane_matrix:ye,u_coord_matrix:be,u_is_text:+Ee,u_pitch_with_map:+X,u_texsize:Ue,u_texture:0}},en=function(I,j,$,X,se,he,ye,be,Ee,Ue,Xe){var it=se.transform;return i.extend(Qt(I,j,$,X,se,he,ye,be,Ee,Ue),{u_gamma_scale:X?Math.cos(it._pitch)*it.cameraToCenterDistance:1,u_device_pixel_ratio:i.browser.devicePixelRatio,u_is_halo:+Xe})},Yt=function(I,j,$,X,se,he,ye,be,Ee,Ue){return i.extend(en(I,j,$,X,se,he,ye,be,!0,Ee,!0),{u_texsize_icon:Ue,u_texture_icon:1})},an=function(I,j,$){return{u_matrix:I,u_opacity:j,u_color:$}},hn=function(I,j,$,X,se,he){return i.extend(function(ye,be,Ee,Ue){var Xe=Ee.imageManager.getPattern(ye.from.toString()),it=Ee.imageManager.getPattern(ye.to.toString()),xt=Ee.imageManager.getPixelSize(),Dt=xt.width,_t=xt.height,Mt=Math.pow(2,Ue.tileID.overscaledZ),vt=Ue.tileSize*Math.pow(2,Ee.transform.tileZoom)/Mt,Nt=vt*(Ue.tileID.canonical.x+Ue.tileID.wrap*Mt),Rt=vt*Ue.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:Xe.tl,u_pattern_br_a:Xe.br,u_pattern_tl_b:it.tl,u_pattern_br_b:it.br,u_texsize:[Dt,_t],u_mix:be.t,u_pattern_size_a:Xe.displaySize,u_pattern_size_b:it.displaySize,u_scale_a:be.fromScale,u_scale_b:be.toScale,u_tile_units_to_pixels:1/Dn(Ue,1,Ee.transform.tileZoom),u_pixel_coord_upper:[Nt>>16,Rt>>16],u_pixel_coord_lower:[65535&Nt,65535&Rt]}}(X,he,$,se),{u_matrix:I,u_opacity:j})},xn={fillExtrusion:function(I,j){return{u_matrix:new i.UniformMatrix4f(I,j.u_matrix),u_lightpos:new i.Uniform3f(I,j.u_lightpos),u_lightintensity:new i.Uniform1f(I,j.u_lightintensity),u_lightcolor:new i.Uniform3f(I,j.u_lightcolor),u_vertical_gradient:new i.Uniform1f(I,j.u_vertical_gradient),u_opacity:new i.Uniform1f(I,j.u_opacity)}},fillExtrusionPattern:function(I,j){return{u_matrix:new i.UniformMatrix4f(I,j.u_matrix),u_lightpos:new i.Uniform3f(I,j.u_lightpos),u_lightintensity:new i.Uniform1f(I,j.u_lightintensity),u_lightcolor:new i.Uniform3f(I,j.u_lightcolor),u_vertical_gradient:new i.Uniform1f(I,j.u_vertical_gradient),u_height_factor:new i.Uniform1f(I,j.u_height_factor),u_image:new i.Uniform1i(I,j.u_image),u_texsize:new i.Uniform2f(I,j.u_texsize),u_pixel_coord_upper:new i.Uniform2f(I,j.u_pixel_coord_upper),u_pixel_coord_lower:new i.Uniform2f(I,j.u_pixel_coord_lower),u_scale:new i.Uniform3f(I,j.u_scale),u_fade:new i.Uniform1f(I,j.u_fade),u_opacity:new i.Uniform1f(I,j.u_opacity)}},fill:function(I,j){return{u_matrix:new i.UniformMatrix4f(I,j.u_matrix)}},fillPattern:function(I,j){return{u_matrix:new i.UniformMatrix4f(I,j.u_matrix),u_image:new i.Uniform1i(I,j.u_image),u_texsize:new i.Uniform2f(I,j.u_texsize),u_pixel_coord_upper:new i.Uniform2f(I,j.u_pixel_coord_upper),u_pixel_coord_lower:new i.Uniform2f(I,j.u_pixel_coord_lower),u_scale:new i.Uniform3f(I,j.u_scale),u_fade:new i.Uniform1f(I,j.u_fade)}},fillOutline:function(I,j){return{u_matrix:new i.UniformMatrix4f(I,j.u_matrix),u_world:new i.Uniform2f(I,j.u_world)}},fillOutlinePattern:function(I,j){return{u_matrix:new i.UniformMatrix4f(I,j.u_matrix),u_world:new i.Uniform2f(I,j.u_world),u_image:new i.Uniform1i(I,j.u_image),u_texsize:new i.Uniform2f(I,j.u_texsize),u_pixel_coord_upper:new i.Uniform2f(I,j.u_pixel_coord_upper),u_pixel_coord_lower:new i.Uniform2f(I,j.u_pixel_coord_lower),u_scale:new i.Uniform3f(I,j.u_scale),u_fade:new i.Uniform1f(I,j.u_fade)}},circle:function(I,j){return{u_camera_to_center_distance:new i.Uniform1f(I,j.u_camera_to_center_distance),u_scale_with_map:new i.Uniform1i(I,j.u_scale_with_map),u_pitch_with_map:new i.Uniform1i(I,j.u_pitch_with_map),u_extrude_scale:new i.Uniform2f(I,j.u_extrude_scale),u_device_pixel_ratio:new i.Uniform1f(I,j.u_device_pixel_ratio),u_matrix:new i.UniformMatrix4f(I,j.u_matrix)}},collisionBox:function(I,j){return{u_matrix:new i.UniformMatrix4f(I,j.u_matrix),u_camera_to_center_distance:new i.Uniform1f(I,j.u_camera_to_center_distance),u_pixels_to_tile_units:new i.Uniform1f(I,j.u_pixels_to_tile_units),u_extrude_scale:new i.Uniform2f(I,j.u_extrude_scale),u_overscale_factor:new i.Uniform1f(I,j.u_overscale_factor)}},collisionCircle:function(I,j){return{u_matrix:new i.UniformMatrix4f(I,j.u_matrix),u_inv_matrix:new i.UniformMatrix4f(I,j.u_inv_matrix),u_camera_to_center_distance:new i.Uniform1f(I,j.u_camera_to_center_distance),u_viewport_size:new i.Uniform2f(I,j.u_viewport_size)}},debug:function(I,j){return{u_color:new i.UniformColor(I,j.u_color),u_matrix:new i.UniformMatrix4f(I,j.u_matrix),u_overlay:new i.Uniform1i(I,j.u_overlay),u_overlay_scale:new i.Uniform1f(I,j.u_overlay_scale)}},clippingMask:function(I,j){return{u_matrix:new i.UniformMatrix4f(I,j.u_matrix)}},heatmap:function(I,j){return{u_extrude_scale:new i.Uniform1f(I,j.u_extrude_scale),u_intensity:new i.Uniform1f(I,j.u_intensity),u_matrix:new i.UniformMatrix4f(I,j.u_matrix)}},heatmapTexture:function(I,j){return{u_matrix:new i.UniformMatrix4f(I,j.u_matrix),u_world:new i.Uniform2f(I,j.u_world),u_image:new i.Uniform1i(I,j.u_image),u_color_ramp:new i.Uniform1i(I,j.u_color_ramp),u_opacity:new i.Uniform1f(I,j.u_opacity)}},hillshade:function(I,j){return{u_matrix:new i.UniformMatrix4f(I,j.u_matrix),u_image:new i.Uniform1i(I,j.u_image),u_latrange:new i.Uniform2f(I,j.u_latrange),u_light:new i.Uniform2f(I,j.u_light),u_shadow:new i.UniformColor(I,j.u_shadow),u_highlight:new i.UniformColor(I,j.u_highlight),u_accent:new i.UniformColor(I,j.u_accent)}},hillshadePrepare:function(I,j){return{u_matrix:new i.UniformMatrix4f(I,j.u_matrix),u_image:new i.Uniform1i(I,j.u_image),u_dimension:new i.Uniform2f(I,j.u_dimension),u_zoom:new i.Uniform1f(I,j.u_zoom),u_maxzoom:new i.Uniform1f(I,j.u_maxzoom),u_unpack:new i.Uniform4f(I,j.u_unpack)}},line:function(I,j){return{u_matrix:new i.UniformMatrix4f(I,j.u_matrix),u_ratio:new i.Uniform1f(I,j.u_ratio),u_device_pixel_ratio:new i.Uniform1f(I,j.u_device_pixel_ratio),u_units_to_pixels:new i.Uniform2f(I,j.u_units_to_pixels)}},lineGradient:function(I,j){return{u_matrix:new i.UniformMatrix4f(I,j.u_matrix),u_ratio:new i.Uniform1f(I,j.u_ratio),u_device_pixel_ratio:new i.Uniform1f(I,j.u_device_pixel_ratio),u_units_to_pixels:new i.Uniform2f(I,j.u_units_to_pixels),u_image:new i.Uniform1i(I,j.u_image)}},linePattern:function(I,j){return{u_matrix:new i.UniformMatrix4f(I,j.u_matrix),u_texsize:new i.Uniform2f(I,j.u_texsize),u_ratio:new i.Uniform1f(I,j.u_ratio),u_device_pixel_ratio:new i.Uniform1f(I,j.u_device_pixel_ratio),u_image:new i.Uniform1i(I,j.u_image),u_units_to_pixels:new i.Uniform2f(I,j.u_units_to_pixels),u_scale:new i.Uniform3f(I,j.u_scale),u_fade:new i.Uniform1f(I,j.u_fade)}},lineSDF:function(I,j){return{u_matrix:new i.UniformMatrix4f(I,j.u_matrix),u_ratio:new i.Uniform1f(I,j.u_ratio),u_device_pixel_ratio:new i.Uniform1f(I,j.u_device_pixel_ratio),u_units_to_pixels:new i.Uniform2f(I,j.u_units_to_pixels),u_patternscale_a:new i.Uniform2f(I,j.u_patternscale_a),u_patternscale_b:new i.Uniform2f(I,j.u_patternscale_b),u_sdfgamma:new i.Uniform1f(I,j.u_sdfgamma),u_image:new i.Uniform1i(I,j.u_image),u_tex_y_a:new i.Uniform1f(I,j.u_tex_y_a),u_tex_y_b:new i.Uniform1f(I,j.u_tex_y_b),u_mix:new i.Uniform1f(I,j.u_mix)}},raster:function(I,j){return{u_matrix:new i.UniformMatrix4f(I,j.u_matrix),u_tl_parent:new i.Uniform2f(I,j.u_tl_parent),u_scale_parent:new i.Uniform1f(I,j.u_scale_parent),u_buffer_scale:new i.Uniform1f(I,j.u_buffer_scale),u_fade_t:new i.Uniform1f(I,j.u_fade_t),u_opacity:new i.Uniform1f(I,j.u_opacity),u_image0:new i.Uniform1i(I,j.u_image0),u_image1:new i.Uniform1i(I,j.u_image1),u_brightness_low:new i.Uniform1f(I,j.u_brightness_low),u_brightness_high:new i.Uniform1f(I,j.u_brightness_high),u_saturation_factor:new i.Uniform1f(I,j.u_saturation_factor),u_contrast_factor:new i.Uniform1f(I,j.u_contrast_factor),u_spin_weights:new i.Uniform3f(I,j.u_spin_weights)}},symbolIcon:function(I,j){return{u_is_size_zoom_constant:new i.Uniform1i(I,j.u_is_size_zoom_constant),u_is_size_feature_constant:new i.Uniform1i(I,j.u_is_size_feature_constant),u_size_t:new i.Uniform1f(I,j.u_size_t),u_size:new i.Uniform1f(I,j.u_size),u_camera_to_center_distance:new i.Uniform1f(I,j.u_camera_to_center_distance),u_pitch:new i.Uniform1f(I,j.u_pitch),u_rotate_symbol:new i.Uniform1i(I,j.u_rotate_symbol),u_aspect_ratio:new i.Uniform1f(I,j.u_aspect_ratio),u_fade_change:new i.Uniform1f(I,j.u_fade_change),u_matrix:new i.UniformMatrix4f(I,j.u_matrix),u_label_plane_matrix:new i.UniformMatrix4f(I,j.u_label_plane_matrix),u_coord_matrix:new i.UniformMatrix4f(I,j.u_coord_matrix),u_is_text:new i.Uniform1i(I,j.u_is_text),u_pitch_with_map:new i.Uniform1i(I,j.u_pitch_with_map),u_texsize:new i.Uniform2f(I,j.u_texsize),u_texture:new i.Uniform1i(I,j.u_texture)}},symbolSDF:function(I,j){return{u_is_size_zoom_constant:new i.Uniform1i(I,j.u_is_size_zoom_constant),u_is_size_feature_constant:new i.Uniform1i(I,j.u_is_size_feature_constant),u_size_t:new i.Uniform1f(I,j.u_size_t),u_size:new i.Uniform1f(I,j.u_size),u_camera_to_center_distance:new i.Uniform1f(I,j.u_camera_to_center_distance),u_pitch:new i.Uniform1f(I,j.u_pitch),u_rotate_symbol:new i.Uniform1i(I,j.u_rotate_symbol),u_aspect_ratio:new i.Uniform1f(I,j.u_aspect_ratio),u_fade_change:new i.Uniform1f(I,j.u_fade_change),u_matrix:new i.UniformMatrix4f(I,j.u_matrix),u_label_plane_matrix:new i.UniformMatrix4f(I,j.u_label_plane_matrix),u_coord_matrix:new i.UniformMatrix4f(I,j.u_coord_matrix),u_is_text:new i.Uniform1i(I,j.u_is_text),u_pitch_with_map:new i.Uniform1i(I,j.u_pitch_with_map),u_texsize:new i.Uniform2f(I,j.u_texsize),u_texture:new i.Uniform1i(I,j.u_texture),u_gamma_scale:new i.Uniform1f(I,j.u_gamma_scale),u_device_pixel_ratio:new i.Uniform1f(I,j.u_device_pixel_ratio),u_is_halo:new i.Uniform1i(I,j.u_is_halo)}},symbolTextAndIcon:function(I,j){return{u_is_size_zoom_constant:new i.Uniform1i(I,j.u_is_size_zoom_constant),u_is_size_feature_constant:new i.Uniform1i(I,j.u_is_size_feature_constant),u_size_t:new i.Uniform1f(I,j.u_size_t),u_size:new i.Uniform1f(I,j.u_size),u_camera_to_center_distance:new i.Uniform1f(I,j.u_camera_to_center_distance),u_pitch:new i.Uniform1f(I,j.u_pitch),u_rotate_symbol:new i.Uniform1i(I,j.u_rotate_symbol),u_aspect_ratio:new i.Uniform1f(I,j.u_aspect_ratio),u_fade_change:new i.Uniform1f(I,j.u_fade_change),u_matrix:new i.UniformMatrix4f(I,j.u_matrix),u_label_plane_matrix:new i.UniformMatrix4f(I,j.u_label_plane_matrix),u_coord_matrix:new i.UniformMatrix4f(I,j.u_coord_matrix),u_is_text:new i.Uniform1i(I,j.u_is_text),u_pitch_with_map:new i.Uniform1i(I,j.u_pitch_with_map),u_texsize:new i.Uniform2f(I,j.u_texsize),u_texsize_icon:new i.Uniform2f(I,j.u_texsize_icon),u_texture:new i.Uniform1i(I,j.u_texture),u_texture_icon:new i.Uniform1i(I,j.u_texture_icon),u_gamma_scale:new i.Uniform1f(I,j.u_gamma_scale),u_device_pixel_ratio:new i.Uniform1f(I,j.u_device_pixel_ratio),u_is_halo:new i.Uniform1i(I,j.u_is_halo)}},background:function(I,j){return{u_matrix:new i.UniformMatrix4f(I,j.u_matrix),u_opacity:new i.Uniform1f(I,j.u_opacity),u_color:new i.UniformColor(I,j.u_color)}},backgroundPattern:function(I,j){return{u_matrix:new i.UniformMatrix4f(I,j.u_matrix),u_opacity:new i.Uniform1f(I,j.u_opacity),u_image:new i.Uniform1i(I,j.u_image),u_pattern_tl_a:new i.Uniform2f(I,j.u_pattern_tl_a),u_pattern_br_a:new i.Uniform2f(I,j.u_pattern_br_a),u_pattern_tl_b:new i.Uniform2f(I,j.u_pattern_tl_b),u_pattern_br_b:new i.Uniform2f(I,j.u_pattern_br_b),u_texsize:new i.Uniform2f(I,j.u_texsize),u_mix:new i.Uniform1f(I,j.u_mix),u_pattern_size_a:new i.Uniform2f(I,j.u_pattern_size_a),u_pattern_size_b:new i.Uniform2f(I,j.u_pattern_size_b),u_scale_a:new i.Uniform1f(I,j.u_scale_a),u_scale_b:new i.Uniform1f(I,j.u_scale_b),u_pixel_coord_upper:new i.Uniform2f(I,j.u_pixel_coord_upper),u_pixel_coord_lower:new i.Uniform2f(I,j.u_pixel_coord_lower),u_tile_units_to_pixels:new i.Uniform1f(I,j.u_tile_units_to_pixels)}}};function _n(I,j,$,X,se,he,ye){for(var be=I.context,Ee=be.gl,Ue=I.useProgram("collisionBox"),Xe=[],it=0,xt=0,Dt=0;Dt0){var rn=i.create(),dn=Nt;i.mul(rn,vt.placementInvProjMatrix,I.transform.glCoordMatrix),i.mul(rn,rn,vt.placementViewportMatrix),Xe.push({circleArray:Vt,circleOffset:xt,transform:dn,invTransform:rn}),xt=it+=Vt.length/4}Rt&&Ue.draw(be,Ee.LINES,dt.disabled,Oe.disabled,I.colorModeForRenderPass(),Te.disabled,Ql(Nt,I.transform,Mt),$.id,Rt.layoutVertexBuffer,Rt.indexBuffer,Rt.segments,null,I.transform.zoom,null,null,Rt.collisionVertexBuffer)}}if(ye&&Xe.length){var En=I.useProgram("collisionCircle"),Tn=new i.StructArrayLayout2f1f2i16;Tn.resize(4*it),Tn._trim();for(var tr=0,er=0,gr=Xe;er=0&&(_t[vt.associatedIconIndex]={shiftedAnchor:gr,angle:cr})}else yr(vt.numGlyphs,xt)}if(Xe){Dt.clear();for(var oi=I.icon.placedSymbolArray,Ai=0;Ai0){var ye=i.browser.now(),be=(ye-I.timeAdded)/he,Ee=j?(ye-j.timeAdded)/he:-1,Ue=$.getSource(),Xe=se.coveringZoomLevel({tileSize:Ue.tileSize,roundZoom:Ue.roundZoom}),it=!j||Math.abs(j.tileID.overscaledZ-Xe)>Math.abs(I.tileID.overscaledZ-Xe),xt=it&&I.refreshedUponExpiration?1:i.clamp(it?be:1-Ee,0,1);return I.refreshedUponExpiration&&be>=1&&(I.refreshedUponExpiration=!1),j?{opacity:1,mix:1-xt}:{opacity:xt,mix:0}}return{opacity:1,mix:0}}var da=new i.Color(1,0,0,1),fo=new i.Color(0,1,0,1),so=new i.Color(0,0,1,1),za=new i.Color(1,0,1,1),Na=new i.Color(0,1,1,1);function lo(I){var j=I.transform.padding;Fo(I,I.transform.height-(j.top||0),3,da),Fo(I,j.bottom||0,3,fo),is(I,j.left||0,3,so),is(I,I.transform.width-(j.right||0),3,za);var $=I.transform.centerPoint;(function(X,se,he,ye){as(X,se-1,he-10,2,20,ye),as(X,se-10,he-1,20,2,ye)})(I,$.x,I.transform.height-$.y,Na)}function Fo(I,j,$,X){as(I,0,j+$/2,I.transform.width,$,X)}function is(I,j,$,X){as(I,j-$/2,0,$,I.transform.height,X)}function as(I,j,$,X,se,he){var ye=I.context,be=ye.gl;be.enable(be.SCISSOR_TEST),be.scissor(j*i.browser.devicePixelRatio,$*i.browser.devicePixelRatio,X*i.browser.devicePixelRatio,se*i.browser.devicePixelRatio),ye.clear({color:he}),be.disable(be.SCISSOR_TEST)}function os(I,j,$){var X=I.context,se=X.gl,he=$.posMatrix,ye=I.useProgram("debug"),be=dt.disabled,Ee=Oe.disabled,Ue=I.colorModeForRenderPass();X.activeTexture.set(se.TEXTURE0),I.emptyTexture.bind(se.LINEAR,se.CLAMP_TO_EDGE),ye.draw(X,se.LINE_STRIP,be,Ee,Ue,Te.disabled,Ju(he,i.Color.red),"$debug",I.debugBuffer,I.tileBorderIndexBuffer,I.debugSegments);var Xe=j.getTileByID($.key).latestRawTileData,it=Xe&&Xe.byteLength||0,xt=Math.floor(it/1024),Dt=j.getTile($).tileSize,_t=512/Math.min(Dt,512)*($.overscaledZ/I.transform.zoom)*.5,Mt=$.canonical.toString();$.overscaledZ!==$.canonical.z&&(Mt+=" => "+$.overscaledZ),function(vt,Nt){vt.initDebugOverlayCanvas();var Rt=vt.debugOverlayCanvas,Vt=vt.context.gl,rn=vt.debugOverlayCanvas.getContext("2d");rn.clearRect(0,0,Rt.width,Rt.height),rn.shadowColor="white",rn.shadowBlur=2,rn.lineWidth=1.5,rn.strokeStyle="white",rn.textBaseline="top",rn.font="bold 36px Open Sans, sans-serif",rn.fillText(Nt,5,5),rn.strokeText(Nt,5,5),vt.debugOverlayTexture.update(Rt),vt.debugOverlayTexture.bind(Vt.LINEAR,Vt.CLAMP_TO_EDGE)}(I,Mt+" "+xt+"kb"),ye.draw(X,se.TRIANGLES,be,Ee,Ie.alphaBlended,Te.disabled,Ju(he,i.Color.transparent,_t),"$debug",I.debugBuffer,I.quadTriangleIndexBuffer,I.debugSegments)}var ss={symbol:function(I,j,$,X,se){if(I.renderPass==="translucent"){var he=Oe.disabled,ye=I.colorModeForRenderPass();$.layout.get("text-variable-anchor")&&function(be,Ee,Ue,Xe,it,xt,Dt){for(var _t=Ee.transform,Mt=it==="map",vt=xt==="map",Nt=0,Rt=be;Nt256&&this.clearStencil(),$.setColorMode(Ie.disabled),$.setDepthMode(dt.disabled);var se=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(var he=0,ye=j;he256&&this.clearStencil();var I=this.nextStencilID++,j=this.context.gl;return new Oe({func:j.NOTEQUAL,mask:255},I,255,j.KEEP,j.KEEP,j.REPLACE)},ia.prototype.stencilModeForClipping=function(I){var j=this.context.gl;return new Oe({func:j.EQUAL,mask:255},this._tileClippingMaskIDs[I.key],0,j.KEEP,j.KEEP,j.REPLACE)},ia.prototype.stencilConfigForOverlap=function(I){var j,$=this.context.gl,X=I.sort(function(Ee,Ue){return Ue.overscaledZ-Ee.overscaledZ}),se=X[X.length-1].overscaledZ,he=X[0].overscaledZ-se+1;if(he>1){this.currentStencilSource=void 0,this.nextStencilID+he>256&&this.clearStencil();for(var ye={},be=0;be=0;this.currentLayer--){var dn=this.style._layers[X[this.currentLayer]],En=se[dn.source],Tn=Ue[dn.source];this._renderTileClippingMasks(dn,Tn),this.renderLayer(this,En,dn,Tn)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer0?j.pop():null},ia.prototype.isPatternMissing=function(I){if(!I)return!1;if(!I.from||!I.to)return!0;var j=this.imageManager.getPattern(I.from.toString()),$=this.imageManager.getPattern(I.to.toString());return!j||!$},ia.prototype.useProgram=function(I,j){this.cache=this.cache||{};var $=""+I+(j?j.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"");return this.cache[$]||(this.cache[$]=new zc(this.context,Zu[I],j,xn[I],this._showOverdrawInspector)),this.cache[$]},ia.prototype.setCustomLayerDefaults=function(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()},ia.prototype.setBaseState=function(){var I=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(I.FUNC_ADD)},ia.prototype.initDebugOverlayCanvas=function(){if(this.debugOverlayCanvas==null){this.debugOverlayCanvas=i.window.document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512;var I=this.context.gl;this.debugOverlayTexture=new i.Texture(this.context,this.debugOverlayCanvas,I.RGBA)}},ia.prototype.destroy=function(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()};var ht=function(I,j){this.points=I,this.planes=j};ht.fromInvProjectionMatrix=function(I,j,$){var X=Math.pow(2,$),se=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(function(ye){return i.transformMat4([],ye,I)}).map(function(ye){return i.scale$1([],ye,1/ye[3]/j*X)}),he=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(function(ye){var be=i.sub([],se[ye[0]],se[ye[1]]),Ee=i.sub([],se[ye[2]],se[ye[1]]),Ue=i.normalize([],i.cross([],be,Ee)),Xe=-i.dot(Ue,se[ye[1]]);return Ue.concat(Xe)});return new ht(se,he)};var zt=function(I,j){this.min=I,this.max=j,this.center=i.scale$2([],i.add([],this.min,this.max),.5)};zt.prototype.quadrant=function(I){for(var j=[I%2==0,I<2],$=i.clone$2(this.min),X=i.clone$2(this.max),se=0;se=0;if(he===0)return 0;he!==j.length&&($=!1)}if($)return 2;for(var be=0;be<3;be++){for(var Ee=Number.MAX_VALUE,Ue=-Number.MAX_VALUE,Xe=0;Xethis.max[be]-this.min[be])return 0}return 1};var ln=function(I,j,$,X){if(I===void 0&&(I=0),j===void 0&&(j=0),$===void 0&&($=0),X===void 0&&(X=0),isNaN(I)||I<0||isNaN(j)||j<0||isNaN($)||$<0||isNaN(X)||X<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=I,this.bottom=j,this.left=$,this.right=X};ln.prototype.interpolate=function(I,j,$){return j.top!=null&&I.top!=null&&(this.top=i.number(I.top,j.top,$)),j.bottom!=null&&I.bottom!=null&&(this.bottom=i.number(I.bottom,j.bottom,$)),j.left!=null&&I.left!=null&&(this.left=i.number(I.left,j.left,$)),j.right!=null&&I.right!=null&&(this.right=i.number(I.right,j.right,$)),this},ln.prototype.getCenter=function(I,j){var $=i.clamp((this.left+I-this.right)/2,0,I),X=i.clamp((this.top+j-this.bottom)/2,0,j);return new i.Point($,X)},ln.prototype.equals=function(I){return this.top===I.top&&this.bottom===I.bottom&&this.left===I.left&&this.right===I.right},ln.prototype.clone=function(){return new ln(this.top,this.bottom,this.left,this.right)},ln.prototype.toJSON=function(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}};var Ht=function(I,j,$,X,se){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=se===void 0||se,this._minZoom=I||0,this._maxZoom=j||22,this._minPitch=$??0,this._maxPitch=X??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new i.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new ln,this._posMatrixCache={},this._alignedPosMatrixCache={}},un={minZoom:{configurable:!0},maxZoom:{configurable:!0},minPitch:{configurable:!0},maxPitch:{configurable:!0},renderWorldCopies:{configurable:!0},worldSize:{configurable:!0},centerOffset:{configurable:!0},size:{configurable:!0},bearing:{configurable:!0},pitch:{configurable:!0},fov:{configurable:!0},zoom:{configurable:!0},center:{configurable:!0},padding:{configurable:!0},centerPoint:{configurable:!0},unmodified:{configurable:!0},point:{configurable:!0}};Ht.prototype.clone=function(){var I=new Ht(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return I.tileSize=this.tileSize,I.latRange=this.latRange,I.width=this.width,I.height=this.height,I._center=this._center,I.zoom=this.zoom,I.angle=this.angle,I._fov=this._fov,I._pitch=this._pitch,I._unmodified=this._unmodified,I._edgeInsets=this._edgeInsets.clone(),I._calcMatrices(),I},un.minZoom.get=function(){return this._minZoom},un.minZoom.set=function(I){this._minZoom!==I&&(this._minZoom=I,this.zoom=Math.max(this.zoom,I))},un.maxZoom.get=function(){return this._maxZoom},un.maxZoom.set=function(I){this._maxZoom!==I&&(this._maxZoom=I,this.zoom=Math.min(this.zoom,I))},un.minPitch.get=function(){return this._minPitch},un.minPitch.set=function(I){this._minPitch!==I&&(this._minPitch=I,this.pitch=Math.max(this.pitch,I))},un.maxPitch.get=function(){return this._maxPitch},un.maxPitch.set=function(I){this._maxPitch!==I&&(this._maxPitch=I,this.pitch=Math.min(this.pitch,I))},un.renderWorldCopies.get=function(){return this._renderWorldCopies},un.renderWorldCopies.set=function(I){I===void 0?I=!0:I===null&&(I=!1),this._renderWorldCopies=I},un.worldSize.get=function(){return this.tileSize*this.scale},un.centerOffset.get=function(){return this.centerPoint._sub(this.size._div(2))},un.size.get=function(){return new i.Point(this.width,this.height)},un.bearing.get=function(){return-this.angle/Math.PI*180},un.bearing.set=function(I){var j=-i.wrap(I,-180,180)*Math.PI/180;this.angle!==j&&(this._unmodified=!1,this.angle=j,this._calcMatrices(),this.rotationMatrix=i.create$2(),i.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))},un.pitch.get=function(){return this._pitch/Math.PI*180},un.pitch.set=function(I){var j=i.clamp(I,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==j&&(this._unmodified=!1,this._pitch=j,this._calcMatrices())},un.fov.get=function(){return this._fov/Math.PI*180},un.fov.set=function(I){I=Math.max(.01,Math.min(60,I)),this._fov!==I&&(this._unmodified=!1,this._fov=I/180*Math.PI,this._calcMatrices())},un.zoom.get=function(){return this._zoom},un.zoom.set=function(I){var j=Math.min(Math.max(I,this.minZoom),this.maxZoom);this._zoom!==j&&(this._unmodified=!1,this._zoom=j,this.scale=this.zoomScale(j),this.tileZoom=Math.floor(j),this.zoomFraction=j-this.tileZoom,this._constrain(),this._calcMatrices())},un.center.get=function(){return this._center},un.center.set=function(I){I.lat===this._center.lat&&I.lng===this._center.lng||(this._unmodified=!1,this._center=I,this._constrain(),this._calcMatrices())},un.padding.get=function(){return this._edgeInsets.toJSON()},un.padding.set=function(I){this._edgeInsets.equals(I)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,I,1),this._calcMatrices())},un.centerPoint.get=function(){return this._edgeInsets.getCenter(this.width,this.height)},Ht.prototype.isPaddingEqual=function(I){return this._edgeInsets.equals(I)},Ht.prototype.interpolatePadding=function(I,j,$){this._unmodified=!1,this._edgeInsets.interpolate(I,j,$),this._constrain(),this._calcMatrices()},Ht.prototype.coveringZoomLevel=function(I){var j=(I.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/I.tileSize));return Math.max(0,j)},Ht.prototype.getVisibleUnwrappedCoordinates=function(I){var j=[new i.UnwrappedTileID(0,I)];if(this._renderWorldCopies)for(var $=this.pointCoordinate(new i.Point(0,0)),X=this.pointCoordinate(new i.Point(this.width,0)),se=this.pointCoordinate(new i.Point(this.width,this.height)),he=this.pointCoordinate(new i.Point(0,this.height)),ye=Math.floor(Math.min($.x,X.x,se.x,he.x)),be=Math.floor(Math.max($.x,X.x,se.x,he.x)),Ee=ye-1;Ee<=be+1;Ee++)Ee!==0&&j.push(new i.UnwrappedTileID(Ee,I));return j},Ht.prototype.coveringTiles=function(I){var j=this.coveringZoomLevel(I),$=j;if(I.minzoom!==void 0&&jI.maxzoom&&(j=I.maxzoom);var X=i.MercatorCoordinate.fromLngLat(this.center),se=Math.pow(2,j),he=[se*X.x,se*X.y,0],ye=ht.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,j),be=I.minzoom||0;this.pitch<=60&&this._edgeInsets.top<.1&&(be=j);var Ee=function(gr){return{aabb:new zt([gr*se,0,0],[(gr+1)*se,se,0]),zoom:0,x:0,y:0,wrap:gr,fullyVisible:!1}},Ue=[],Xe=[],it=j,xt=I.reparseOverscaled?$:j;if(this._renderWorldCopies)for(var Dt=1;Dt<=3;Dt++)Ue.push(Ee(-Dt)),Ue.push(Ee(Dt));for(Ue.push(Ee(0));Ue.length>0;){var _t=Ue.pop(),Mt=_t.x,vt=_t.y,Nt=_t.fullyVisible;if(!Nt){var Rt=_t.aabb.intersects(ye);if(Rt===0)continue;Nt=Rt===2}var Vt=_t.aabb.distanceX(he),rn=_t.aabb.distanceY(he),dn=Math.max(Math.abs(Vt),Math.abs(rn)),En=3+(1<En&&_t.zoom>=be)Xe.push({tileID:new i.OverscaledTileID(_t.zoom===it?xt:_t.zoom,_t.wrap,_t.zoom,Mt,vt),distanceSq:i.sqrLen([he[0]-.5-Mt,he[1]-.5-vt])});else for(var Tn=0;Tn<4;Tn++){var tr=(Mt<<1)+Tn%2,er=(vt<<1)+(Tn>>1);Ue.push({aabb:_t.aabb.quadrant(Tn),zoom:_t.zoom+1,x:tr,y:er,wrap:_t.wrap,fullyVisible:Nt})}}return Xe.sort(function(gr,cr){return gr.distanceSq-cr.distanceSq}).map(function(gr){return gr.tileID})},Ht.prototype.resize=function(I,j){this.width=I,this.height=j,this.pixelsToGLUnits=[2/I,-2/j],this._constrain(),this._calcMatrices()},un.unmodified.get=function(){return this._unmodified},Ht.prototype.zoomScale=function(I){return Math.pow(2,I)},Ht.prototype.scaleZoom=function(I){return Math.log(I)/Math.LN2},Ht.prototype.project=function(I){var j=i.clamp(I.lat,-this.maxValidLatitude,this.maxValidLatitude);return new i.Point(i.mercatorXfromLng(I.lng)*this.worldSize,i.mercatorYfromLat(j)*this.worldSize)},Ht.prototype.unproject=function(I){return new i.MercatorCoordinate(I.x/this.worldSize,I.y/this.worldSize).toLngLat()},un.point.get=function(){return this.project(this.center)},Ht.prototype.setLocationAtPoint=function(I,j){var $=this.pointCoordinate(j),X=this.pointCoordinate(this.centerPoint),se=this.locationCoordinate(I),he=new i.MercatorCoordinate(se.x-($.x-X.x),se.y-($.y-X.y));this.center=this.coordinateLocation(he),this._renderWorldCopies&&(this.center=this.center.wrap())},Ht.prototype.locationPoint=function(I){return this.coordinatePoint(this.locationCoordinate(I))},Ht.prototype.pointLocation=function(I){return this.coordinateLocation(this.pointCoordinate(I))},Ht.prototype.locationCoordinate=function(I){return i.MercatorCoordinate.fromLngLat(I)},Ht.prototype.coordinateLocation=function(I){return I.toLngLat()},Ht.prototype.pointCoordinate=function(I){var j=[I.x,I.y,0,1],$=[I.x,I.y,1,1];i.transformMat4(j,j,this.pixelMatrixInverse),i.transformMat4($,$,this.pixelMatrixInverse);var X=j[3],se=$[3],he=j[0]/X,ye=$[0]/se,be=j[1]/X,Ee=$[1]/se,Ue=j[2]/X,Xe=$[2]/se,it=Ue===Xe?0:(0-Ue)/(Xe-Ue);return new i.MercatorCoordinate(i.number(he,ye,it)/this.worldSize,i.number(be,Ee,it)/this.worldSize)},Ht.prototype.coordinatePoint=function(I){var j=[I.x*this.worldSize,I.y*this.worldSize,0,1];return i.transformMat4(j,j,this.pixelMatrix),new i.Point(j[0]/j[3],j[1]/j[3])},Ht.prototype.getBounds=function(){return new i.LngLatBounds().extend(this.pointLocation(new i.Point(0,0))).extend(this.pointLocation(new i.Point(this.width,0))).extend(this.pointLocation(new i.Point(this.width,this.height))).extend(this.pointLocation(new i.Point(0,this.height)))},Ht.prototype.getMaxBounds=function(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new i.LngLatBounds([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null},Ht.prototype.setMaxBounds=function(I){I?(this.lngRange=[I.getWest(),I.getEast()],this.latRange=[I.getSouth(),I.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])},Ht.prototype.calculatePosMatrix=function(I,j){j===void 0&&(j=!1);var $=I.key,X=j?this._alignedPosMatrixCache:this._posMatrixCache;if(X[$])return X[$];var se=I.canonical,he=this.worldSize/this.zoomScale(se.z),ye=se.x+Math.pow(2,se.z)*I.wrap,be=i.identity(new Float64Array(16));return i.translate(be,be,[ye*he,se.y*he,0]),i.scale(be,be,[he/i.EXTENT,he/i.EXTENT,1]),i.multiply(be,j?this.alignedProjMatrix:this.projMatrix,be),X[$]=new Float32Array(be),X[$]},Ht.prototype.customLayerMatrix=function(){return this.mercatorMatrix.slice()},Ht.prototype._constrain=function(){if(this.center&&this.width&&this.height&&!this._constraining){this._constraining=!0;var I,j,$,X,se=-90,he=90,ye=-180,be=180,Ee=this.size,Ue=this._unmodified;if(this.latRange){var Xe=this.latRange;se=i.mercatorYfromLat(Xe[1])*this.worldSize,I=(he=i.mercatorYfromLat(Xe[0])*this.worldSize)-sehe&&(X=he-Mt)}if(this.lngRange){var vt=xt.x,Nt=Ee.x/2;vt-Ntbe&&($=be-Nt)}$===void 0&&X===void 0||(this.center=this.unproject(new i.Point($!==void 0?$:xt.x,X!==void 0?X:xt.y))),this._unmodified=Ue,this._constraining=!1}},Ht.prototype._calcMatrices=function(){if(this.height){var I=this._fov/2,j=this.centerOffset;this.cameraToCenterDistance=.5/Math.tan(I)*this.height;var $=Math.PI/2+this._pitch,X=this._fov*(.5+j.y/this.height),se=Math.sin(X)*this.cameraToCenterDistance/Math.sin(i.clamp(Math.PI-$-X,.01,Math.PI-.01)),he=this.point,ye=he.x,be=he.y,Ee=1.01*(Math.cos(Math.PI/2-this._pitch)*se+this.cameraToCenterDistance),Ue=this.height/50,Xe=new Float64Array(16);i.perspective(Xe,this._fov,this.width/this.height,Ue,Ee),Xe[8]=2*-j.x/this.width,Xe[9]=2*j.y/this.height,i.scale(Xe,Xe,[1,-1,1]),i.translate(Xe,Xe,[0,0,-this.cameraToCenterDistance]),i.rotateX(Xe,Xe,this._pitch),i.rotateZ(Xe,Xe,this.angle),i.translate(Xe,Xe,[-ye,-be,0]),this.mercatorMatrix=i.scale([],Xe,[this.worldSize,this.worldSize,this.worldSize]),i.scale(Xe,Xe,[1,1,i.mercatorZfromAltitude(1,this.center.lat)*this.worldSize,1]),this.projMatrix=Xe,this.invProjMatrix=i.invert([],this.projMatrix);var it=this.width%2/2,xt=this.height%2/2,Dt=Math.cos(this.angle),_t=Math.sin(this.angle),Mt=ye-Math.round(ye)+Dt*it+_t*xt,vt=be-Math.round(be)+Dt*xt+_t*it,Nt=new Float64Array(Xe);if(i.translate(Nt,Nt,[Mt>.5?Mt-1:Mt,vt>.5?vt-1:vt,0]),this.alignedProjMatrix=Nt,Xe=i.create(),i.scale(Xe,Xe,[this.width/2,-this.height/2,1]),i.translate(Xe,Xe,[1,-1,0]),this.labelPlaneMatrix=Xe,Xe=i.create(),i.scale(Xe,Xe,[1,-1,1]),i.translate(Xe,Xe,[-1,-1,0]),i.scale(Xe,Xe,[2/this.width,2/this.height,1]),this.glCoordMatrix=Xe,this.pixelMatrix=i.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),!(Xe=i.invert(new Float64Array(16),this.pixelMatrix)))throw new Error("failed to invert matrix");this.pixelMatrixInverse=Xe,this._posMatrixCache={},this._alignedPosMatrixCache={}}},Ht.prototype.maxPitchScaleFactor=function(){if(!this.pixelMatrixInverse)return 1;var I=this.pointCoordinate(new i.Point(0,0)),j=[I.x*this.worldSize,I.y*this.worldSize,0,1];return i.transformMat4(j,j,this.pixelMatrix)[3]/this.cameraToCenterDistance},Ht.prototype.getCameraPoint=function(){var I=this._pitch,j=Math.tan(I)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new i.Point(0,j))},Ht.prototype.getCameraQueryGeometry=function(I){var j=this.getCameraPoint();if(I.length===1)return[I[0],j];for(var $=j.x,X=j.y,se=j.x,he=j.y,ye=0,be=I;ye=3&&!I.some(function($){return isNaN($)})){var j=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(I[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+I[2],+I[1]],zoom:+I[0],bearing:j,pitch:+(I[4]||0)}),!0}return!1},Ln.prototype._updateHashUnthrottled=function(){var I=this.getHashString();try{i.window.history.replaceState(i.window.history.state,"",I)}catch{}};var zn={linearity:.3,easing:i.bezier(0,0,.3,1)},Jn=i.extend({deceleration:2500,maxSpeed:1400},zn),fr=i.extend({deceleration:20,maxSpeed:1400},zn),ur=i.extend({deceleration:1e3,maxSpeed:360},zn),vr=i.extend({deceleration:1e3,maxSpeed:90},zn),kr=function(I){this._map=I,this.clear()};function hr(I,j){(!I.duration||I.duration0&&j-I[0].time>160;)I.shift()},kr.prototype._onMoveEnd=function(I){if(this._drainInertiaBuffer(),!(this._inertiaBuffer.length<2)){for(var j={zoom:0,bearing:0,pitch:0,pan:new i.Point(0,0),pinchAround:void 0,around:void 0},$=0,X=this._inertiaBuffer;$=this._clickTolerance||this._map.fire(new $r(I.type,this._map,I))},Qn.prototype.dblclick=function(I){return this._firePreventable(new $r(I.type,this._map,I))},Qn.prototype.mouseover=function(I){this._map.fire(new $r(I.type,this._map,I))},Qn.prototype.mouseout=function(I){this._map.fire(new $r(I.type,this._map,I))},Qn.prototype.touchstart=function(I){return this._firePreventable(new Jr(I.type,this._map,I))},Qn.prototype.touchmove=function(I){this._map.fire(new Jr(I.type,this._map,I))},Qn.prototype.touchend=function(I){this._map.fire(new Jr(I.type,this._map,I))},Qn.prototype.touchcancel=function(I){this._map.fire(new Jr(I.type,this._map,I))},Qn.prototype._firePreventable=function(I){if(this._map.fire(I),I.defaultPrevented)return{}},Qn.prototype.isEnabled=function(){return!0},Qn.prototype.isActive=function(){return!1},Qn.prototype.enable=function(){},Qn.prototype.disable=function(){};var pi=function(I){this._map=I};pi.prototype.reset=function(){this._delayContextMenu=!1,delete this._contextMenuEvent},pi.prototype.mousemove=function(I){this._map.fire(new $r(I.type,this._map,I))},pi.prototype.mousedown=function(){this._delayContextMenu=!0},pi.prototype.mouseup=function(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new $r("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)},pi.prototype.contextmenu=function(I){this._delayContextMenu?this._contextMenuEvent=I:this._map.fire(new $r(I.type,this._map,I)),this._map.listens("contextmenu")&&I.preventDefault()},pi.prototype.isEnabled=function(){return!0},pi.prototype.isActive=function(){return!1},pi.prototype.enable=function(){},pi.prototype.disable=function(){};var Rr=function(I,j){this._map=I,this._el=I.getCanvasContainer(),this._container=I.getContainer(),this._clickTolerance=j.clickTolerance||1};function Wr(I,j){for(var $={},X=0;Xthis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=I.timeStamp),$.length===this.numTouches&&(this.centroid=function(X){for(var se=new i.Point(0,0),he=0,ye=X;he30)&&(this.aborted=!0)}}},di.prototype.touchend=function(I,j,$){if((!this.centroid||I.timeStamp-this.startTime>500)&&(this.aborted=!0),$.length===0){var X=!this.aborted&&this.centroid;if(this.reset(),X)return X}};var Ui=function(I){this.singleTap=new di(I),this.numTaps=I.numTaps,this.reset()};Ui.prototype.reset=function(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()},Ui.prototype.touchstart=function(I,j,$){this.singleTap.touchstart(I,j,$)},Ui.prototype.touchmove=function(I,j,$){this.singleTap.touchmove(I,j,$)},Ui.prototype.touchend=function(I,j,$){var X=this.singleTap.touchend(I,j,$);if(X){var se=I.timeStamp-this.lastTime<500,he=!this.lastTap||this.lastTap.dist(X)<30;if(se&&he||this.reset(),this.count++,this.lastTime=I.timeStamp,this.lastTap=X,this.count===this.numTaps)return this.reset(),X}};var ea=function(){this._zoomIn=new Ui({numTouches:1,numTaps:2}),this._zoomOut=new Ui({numTouches:2,numTaps:1}),this.reset()};ea.prototype.reset=function(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()},ea.prototype.touchstart=function(I,j,$){this._zoomIn.touchstart(I,j,$),this._zoomOut.touchstart(I,j,$)},ea.prototype.touchmove=function(I,j,$){this._zoomIn.touchmove(I,j,$),this._zoomOut.touchmove(I,j,$)},ea.prototype.touchend=function(I,j,$){var X=this,se=this._zoomIn.touchend(I,j,$),he=this._zoomOut.touchend(I,j,$);return se?(this._active=!0,I.preventDefault(),setTimeout(function(){return X.reset()},0),{cameraAnimation:function(ye){return ye.easeTo({duration:300,zoom:ye.getZoom()+1,around:ye.unproject(se)},{originalEvent:I})}}):he?(this._active=!0,I.preventDefault(),setTimeout(function(){return X.reset()},0),{cameraAnimation:function(ye){return ye.easeTo({duration:300,zoom:ye.getZoom()-1,around:ye.unproject(he)},{originalEvent:I})}}):void 0},ea.prototype.touchcancel=function(){this.reset()},ea.prototype.enable=function(){this._enabled=!0},ea.prototype.disable=function(){this._enabled=!1,this.reset()},ea.prototype.isEnabled=function(){return this._enabled},ea.prototype.isActive=function(){return this._active};var Or=function(I){this.reset(),this._clickTolerance=I.clickTolerance||1};Or.prototype.reset=function(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton},Or.prototype._correctButton=function(I,j){return!1},Or.prototype._move=function(I,j){return{}},Or.prototype.mousedown=function(I,j){if(!this._lastPoint){var $=u.mouseButton(I);this._correctButton(I,$)&&(this._lastPoint=j,this._eventButton=$)}},Or.prototype.mousemoveWindow=function(I,j){var $=this._lastPoint;if($&&(I.preventDefault(),this._moved||!(j.dist($)0&&(this._active=!0);var X=Wr($,j),se=new i.Point(0,0),he=new i.Point(0,0),ye=0;for(var be in X){var Ee=X[be],Ue=this._touches[be];Ue&&(se._add(Ee),he._add(Ee.sub(Ue)),ye++,X[be]=Ee)}if(this._touches=X,!(yeMath.abs(I.x)}var Ss=function(I){function j(){I.apply(this,arguments)}return I&&(j.__proto__=I),j.prototype=Object.create(I&&I.prototype),j.prototype.constructor=j,j.prototype.reset=function(){I.prototype.reset.call(this),this._valid=void 0,delete this._firstMove,delete this._lastPoints},j.prototype._start=function($){this._lastPoints=$,tl($[0].sub($[1]))&&(this._valid=!1)},j.prototype._move=function($,X,se){var he=$[0].sub(this._lastPoints[0]),ye=$[1].sub(this._lastPoints[1]);if(this._valid=this.gestureBeginsVertically(he,ye,se.timeStamp),this._valid)return this._lastPoints=$,this._active=!0,{pitchDelta:-.5*((he.y+ye.y)/2)}},j.prototype.gestureBeginsVertically=function($,X,se){if(this._valid!==void 0)return this._valid;var he=$.mag()>=2,ye=X.mag()>=2;if(he||ye){if(!he||!ye)return this._firstMove===void 0&&(this._firstMove=se),se-this._firstMove<100&&void 0;var be=$.y>0==X.y>0;return tl($)&&tl(X)&&be}},j}(Xi),Pi={panStep:100,bearingStep:15,pitchStep:10},no=function(){var I=Pi;this._panStep=I.panStep,this._bearingStep=I.bearingStep,this._pitchStep=I.pitchStep};function Cs(I){return I*(2-I)}no.prototype.reset=function(){this._active=!1},no.prototype.keydown=function(I){var j=this;if(!(I.altKey||I.ctrlKey||I.metaKey)){var $=0,X=0,se=0,he=0,ye=0;switch(I.keyCode){case 61:case 107:case 171:case 187:$=1;break;case 189:case 109:case 173:$=-1;break;case 37:I.shiftKey?X=-1:(I.preventDefault(),he=-1);break;case 39:I.shiftKey?X=1:(I.preventDefault(),he=1);break;case 38:I.shiftKey?se=1:(I.preventDefault(),ye=-1);break;case 40:I.shiftKey?se=-1:(I.preventDefault(),ye=1);break;default:return}return{cameraAnimation:function(be){var Ee=be.getZoom();be.easeTo({duration:300,easeId:"keyboardHandler",easing:Cs,zoom:$?Math.round(Ee)+$*(I.shiftKey?2:1):Ee,bearing:be.getBearing()+X*j._bearingStep,pitch:be.getPitch()+se*j._pitchStep,offset:[-he*j._panStep,-ye*j._panStep],center:be.getCenter()},{originalEvent:I})}}}},no.prototype.enable=function(){this._enabled=!0},no.prototype.disable=function(){this._enabled=!1,this.reset()},no.prototype.isEnabled=function(){return this._enabled},no.prototype.isActive=function(){return this._active};var ka=function(I,j){this._map=I,this._el=I.getCanvasContainer(),this._handler=j,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=1/450,i.bindAll(["_onWheel","_onTimeout","_onScrollFrame","_onScrollFinished"],this)};ka.prototype.setZoomRate=function(I){this._defaultZoomRate=I},ka.prototype.setWheelZoomRate=function(I){this._wheelZoomRate=I},ka.prototype.isEnabled=function(){return!!this._enabled},ka.prototype.isActive=function(){return!!this._active||this._finishTimeout!==void 0},ka.prototype.isZooming=function(){return!!this._zooming},ka.prototype.enable=function(I){this.isEnabled()||(this._enabled=!0,this._aroundCenter=I&&I.around==="center")},ka.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},ka.prototype.wheel=function(I){if(this.isEnabled()){var j=I.deltaMode===i.window.WheelEvent.DOM_DELTA_LINE?40*I.deltaY:I.deltaY,$=i.browser.now(),X=$-(this._lastWheelEventTime||0);this._lastWheelEventTime=$,j!==0&&j%4.000244140625==0?this._type="wheel":j!==0&&Math.abs(j)<4?this._type="trackpad":X>400?(this._type=null,this._lastValue=j,this._timeout=setTimeout(this._onTimeout,40,I)):this._type||(this._type=Math.abs(X*j)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,j+=this._lastValue)),I.shiftKey&&j&&(j/=4),this._type&&(this._lastWheelEvent=I,this._delta-=j,this._active||this._start(I)),I.preventDefault()}},ka.prototype._onTimeout=function(I){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(I)},ka.prototype._start=function(I){if(this._delta){this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);var j=u.mousePos(this._el,I);this._around=i.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(j)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}},ka.prototype.renderFrame=function(){return this._onScrollFrame()},ka.prototype._onScrollFrame=function(){var I=this;if(this._frameId&&(this._frameId=null,this.isActive())){var j=this._map.transform;if(this._delta!==0){var $=this._type==="wheel"&&Math.abs(this._delta)>4.000244140625?this._wheelZoomRate:this._defaultZoomRate,X=2/(1+Math.exp(-Math.abs(this._delta*$)));this._delta<0&&X!==0&&(X=1/X);var se=typeof this._targetZoom=="number"?j.zoomScale(this._targetZoom):j.scale;this._targetZoom=Math.min(j.maxZoom,Math.max(j.minZoom,j.scaleZoom(se*X))),this._type==="wheel"&&(this._startZoom=j.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}var he,ye=typeof this._targetZoom=="number"?this._targetZoom:j.zoom,be=this._startZoom,Ee=this._easing,Ue=!1;if(this._type==="wheel"&&be&&Ee){var Xe=Math.min((i.browser.now()-this._lastWheelEventTime)/200,1),it=Ee(Xe);he=i.number(be,ye,it),Xe<1?this._frameId||(this._frameId=!0):Ue=!0}else he=ye,Ue=!0;return this._active=!0,Ue&&(this._active=!1,this._finishTimeout=setTimeout(function(){I._zooming=!1,I._handler._triggerRenderFrame(),delete I._targetZoom,delete I._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!Ue,zoomDelta:he-j.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}},ka.prototype._smoothOutEasing=function(I){var j=i.ease;if(this._prevEase){var $=this._prevEase,X=(i.browser.now()-$.start)/$.duration,se=$.easing(X+.01)-$.easing(X),he=.27/Math.sqrt(se*se+1e-4)*.01,ye=Math.sqrt(.0729-he*he);j=i.bezier(he,ye,.25,1)}return this._prevEase={start:i.browser.now(),duration:I,easing:j},j},ka.prototype.reset=function(){this._active=!1};var ho=function(I,j){this._clickZoom=I,this._tapZoom=j};ho.prototype.enable=function(){this._clickZoom.enable(),this._tapZoom.enable()},ho.prototype.disable=function(){this._clickZoom.disable(),this._tapZoom.disable()},ho.prototype.isEnabled=function(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()},ho.prototype.isActive=function(){return this._clickZoom.isActive()||this._tapZoom.isActive()};var qo=function(){this.reset()};qo.prototype.reset=function(){this._active=!1},qo.prototype.dblclick=function(I,j){return I.preventDefault(),{cameraAnimation:function($){$.easeTo({duration:300,zoom:$.getZoom()+(I.shiftKey?-1:1),around:$.unproject(j)},{originalEvent:I})}}},qo.prototype.enable=function(){this._enabled=!0},qo.prototype.disable=function(){this._enabled=!1,this.reset()},qo.prototype.isEnabled=function(){return this._enabled},qo.prototype.isActive=function(){return this._active};var Pa=function(){this._tap=new Ui({numTouches:1,numTaps:1}),this.reset()};Pa.prototype.reset=function(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()},Pa.prototype.touchstart=function(I,j,$){this._swipePoint||(this._tapTime&&I.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?$.length>0&&(this._swipePoint=j[0],this._swipeTouch=$[0].identifier):this._tap.touchstart(I,j,$))},Pa.prototype.touchmove=function(I,j,$){if(this._tapTime){if(this._swipePoint){if($[0].identifier!==this._swipeTouch)return;var X=j[0],se=X.y-this._swipePoint.y;return this._swipePoint=X,I.preventDefault(),this._active=!0,{zoomDelta:se/128}}}else this._tap.touchmove(I,j,$)},Pa.prototype.touchend=function(I,j,$){this._tapTime?this._swipePoint&&$.length===0&&this.reset():this._tap.touchend(I,j,$)&&(this._tapTime=I.timeStamp)},Pa.prototype.touchcancel=function(){this.reset()},Pa.prototype.enable=function(){this._enabled=!0},Pa.prototype.disable=function(){this._enabled=!1,this.reset()},Pa.prototype.isEnabled=function(){return this._enabled},Pa.prototype.isActive=function(){return this._active};var xs=function(I,j,$){this._el=I,this._mousePan=j,this._touchPan=$};xs.prototype.enable=function(I){this._inertiaOptions=I||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")},xs.prototype.disable=function(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")},xs.prototype.isEnabled=function(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()},xs.prototype.isActive=function(){return this._mousePan.isActive()||this._touchPan.isActive()};var Ia=function(I,j,$){this._pitchWithRotate=I.pitchWithRotate,this._mouseRotate=j,this._mousePitch=$};Ia.prototype.enable=function(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()},Ia.prototype.disable=function(){this._mouseRotate.disable(),this._mousePitch.disable()},Ia.prototype.isEnabled=function(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())},Ia.prototype.isActive=function(){return this._mouseRotate.isActive()||this._mousePitch.isActive()};var ls=function(I,j,$,X){this._el=I,this._touchZoom=j,this._touchRotate=$,this._tapDragZoom=X,this._rotationDisabled=!1,this._enabled=!0};ls.prototype.enable=function(I){this._touchZoom.enable(I),this._rotationDisabled||this._touchRotate.enable(I),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")},ls.prototype.disable=function(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")},ls.prototype.isEnabled=function(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()},ls.prototype.isActive=function(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()},ls.prototype.disableRotation=function(){this._rotationDisabled=!0,this._touchRotate.disable()},ls.prototype.enableRotation=function(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()};var Mu=function(I){return I.zoom||I.drag||I.pitch||I.rotate},eu=function(I){function j(){I.apply(this,arguments)}return I&&(j.__proto__=I),j.prototype=Object.create(I&&I.prototype),j.prototype.constructor=j,j}(i.Event);function Df(I){return I.panDelta&&I.panDelta.mag()||I.zoomDelta||I.bearingDelta||I.pitchDelta}var Lo=function(I,j){this._map=I,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new kr(I),this._bearingSnap=j.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(j),i.bindAll(["handleEvent","handleWindowEvent"],this);var $=this._el;this._listeners=[[$,"touchstart",{passive:!1}],[$,"touchmove",{passive:!1}],[$,"touchend",void 0],[$,"touchcancel",void 0],[$,"mousedown",void 0],[$,"mousemove",void 0],[$,"mouseup",void 0],[i.window.document,"mousemove",{capture:!0}],[i.window.document,"mouseup",void 0],[$,"mouseover",void 0],[$,"mouseout",void 0],[$,"dblclick",void 0],[$,"click",void 0],[$,"keydown",{capture:!1}],[$,"keyup",void 0],[$,"wheel",{passive:!1}],[$,"contextmenu",void 0],[i.window,"blur",void 0]];for(var X=0,se=this._listeners;Xye?Math.min(2,En):Math.max(.5,En),cr=Math.pow(gr,1-tr),Xr=he.unproject(rn.add(dn.mult(tr*cr)).mult(er));he.setLocationAtPoint(he.renderWorldCopies?Xr.wrap():Xr,Mt)}se._fireMoveEvents(X)},function(tr){se._afterEase(X,tr)},$),this},j.prototype._prepareEase=function($,X,se){se===void 0&&(se={}),this._moving=!0,X||se.moving||this.fire(new i.Event("movestart",$)),this._zooming&&!se.zooming&&this.fire(new i.Event("zoomstart",$)),this._rotating&&!se.rotating&&this.fire(new i.Event("rotatestart",$)),this._pitching&&!se.pitching&&this.fire(new i.Event("pitchstart",$))},j.prototype._fireMoveEvents=function($){this.fire(new i.Event("move",$)),this._zooming&&this.fire(new i.Event("zoom",$)),this._rotating&&this.fire(new i.Event("rotate",$)),this._pitching&&this.fire(new i.Event("pitch",$))},j.prototype._afterEase=function($,X){if(!this._easeId||!X||this._easeId!==X){delete this._easeId;var se=this._zooming,he=this._rotating,ye=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,se&&this.fire(new i.Event("zoomend",$)),he&&this.fire(new i.Event("rotateend",$)),ye&&this.fire(new i.Event("pitchend",$)),this.fire(new i.Event("moveend",$))}},j.prototype.flyTo=function($,X){var se=this;if(!$.essential&&i.browser.prefersReducedMotion){var he=i.pick($,["center","zoom","bearing","pitch","around"]);return this.jumpTo(he,X)}this.stop(),$=i.extend({offset:[0,0],speed:1.2,curve:1.42,easing:i.ease},$);var ye=this.transform,be=this.getZoom(),Ee=this.getBearing(),Ue=this.getPitch(),Xe=this.getPadding(),it="zoom"in $?i.clamp(+$.zoom,ye.minZoom,ye.maxZoom):be,xt="bearing"in $?this._normalizeBearing($.bearing,Ee):Ee,Dt="pitch"in $?+$.pitch:Ue,_t="padding"in $?$.padding:ye.padding,Mt=ye.zoomScale(it-be),vt=i.Point.convert($.offset),Nt=ye.centerPoint.add(vt),Rt=ye.pointLocation(Nt),Vt=i.LngLat.convert($.center||Rt);this._normalizeCenter(Vt);var rn=ye.project(Rt),dn=ye.project(Vt).sub(rn),En=$.curve,Tn=Math.max(ye.width,ye.height),tr=Tn/Mt,er=dn.mag();if("minZoom"in $){var gr=i.clamp(Math.min($.minZoom,be,it),ye.minZoom,ye.maxZoom),cr=Tn/ye.zoomScale(gr-be);En=Math.sqrt(cr/er*2)}var Xr=En*En;function oi(fi){var zi=(tr*tr-Tn*Tn+(fi?-1:1)*Xr*Xr*er*er)/(2*(fi?tr:Tn)*Xr*er);return Math.log(Math.sqrt(zi*zi+1)-zi)}function Ai(fi){return(Math.exp(fi)-Math.exp(-fi))/2}function Gn(fi){return(Math.exp(fi)+Math.exp(-fi))/2}var Mr=oi(0),si=function(fi){return Gn(Mr)/Gn(Mr+En*fi)},Qr=function(fi){return Tn*((Gn(Mr)*(Ai(zi=Mr+En*fi)/Gn(zi))-Ai(Mr))/Xr)/er;var zi},mi=(oi(1)-Mr)/En;if(Math.abs(er)<1e-6||!isFinite(mi)){if(Math.abs(Tn-tr)<1e-6)return this.easeTo($,X);var Mi=tr$.maxDuration&&($.duration=0),this._zooming=!0,this._rotating=Ee!==xt,this._pitching=Dt!==Ue,this._padding=!ye.isPaddingEqual(_t),this._prepareEase(X,!1),this._ease(function(fi){var zi=fi*mi,Oi=1/si(zi);ye.zoom=fi===1?it:be+ye.scaleZoom(Oi),se._rotating&&(ye.bearing=i.number(Ee,xt,fi)),se._pitching&&(ye.pitch=i.number(Ue,Dt,fi)),se._padding&&(ye.interpolatePadding(Xe,_t,fi),Nt=ye.centerPoint.add(vt));var ta=fi===1?Vt:ye.unproject(rn.add(dn.mult(Qr(zi))).mult(Oi));ye.setLocationAtPoint(ye.renderWorldCopies?ta.wrap():ta,Nt),se._fireMoveEvents(X)},function(){return se._afterEase(X)},$),this},j.prototype.isEasing=function(){return!!this._easeFrameId},j.prototype.stop=function(){return this._stop()},j.prototype._stop=function($,X){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){var se=this._onEaseEnd;delete this._onEaseEnd,se.call(this,X)}if(!$){var he=this.handlers;he&&he.stop()}return this},j.prototype._ease=function($,X,se){se.animate===!1||se.duration===0?($(1),X()):(this._easeStart=i.browser.now(),this._easeOptions=se,this._onEaseFrame=$,this._onEaseEnd=X,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))},j.prototype._renderFrameCallback=function(){var $=Math.min((i.browser.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing($)),$<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},j.prototype._normalizeBearing=function($,X){$=i.wrap($,-180,180);var se=Math.abs($-X);return Math.abs($-360-X)180?-360:se<-180?360:0}},j}(i.Evented),Do=function(I){I===void 0&&(I={}),this.options=I,i.bindAll(["_updateEditLink","_updateData","_updateCompact"],this)};Do.prototype.getDefaultPosition=function(){return"bottom-right"},Do.prototype.onAdd=function(I){var j=this.options&&this.options.compact;return this._map=I,this._container=u.create("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._innerContainer=u.create("div","mapboxgl-ctrl-attrib-inner",this._container),j&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),j===void 0&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container},Do.prototype.onRemove=function(){u.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0},Do.prototype._updateEditLink=function(){var I=this._editLink;I||(I=this._editLink=this._container.querySelector(".mapbox-improve-map"));var j=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||i.config.ACCESS_TOKEN}];if(I){var $=j.reduce(function(X,se,he){return se.value&&(X+=se.key+"="+se.value+(he=0)return!1;return!0})).join(" | ");ye!==this._attribHTML&&(this._attribHTML=ye,I.length?(this._innerContainer.innerHTML=ye,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}},Do.prototype._updateCompact=function(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact")};var tu=function(){i.bindAll(["_updateLogo"],this),i.bindAll(["_updateCompact"],this)};tu.prototype.onAdd=function(I){this._map=I,this._container=u.create("div","mapboxgl-ctrl");var j=u.create("a","mapboxgl-ctrl-logo");return j.target="_blank",j.rel="noopener nofollow",j.href="https://www.mapbox.com/",j.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),j.setAttribute("rel","noopener nofollow"),this._container.appendChild(j),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container},tu.prototype.onRemove=function(){u.remove(this._container),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)},tu.prototype.getDefaultPosition=function(){return"bottom-left"},tu.prototype._updateLogo=function(I){I&&I.sourceDataType!=="metadata"||(this._container.style.display=this._logoRequired()?"block":"none")},tu.prototype._logoRequired=function(){if(this._map.style){var I=this._map.style.sourceCaches;for(var j in I)if(I[j].getSource().mapbox_logo)return!0;return!1}},tu.prototype._updateCompact=function(){var I=this._container.children;if(I.length){var j=I[0];this._map.getCanvasContainer().offsetWidth<250?j.classList.add("mapboxgl-compact"):j.classList.remove("mapboxgl-compact")}};var wi=function(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1};wi.prototype.add=function(I){var j=++this._id;return this._queue.push({callback:I,id:j,cancelled:!1}),j},wi.prototype.remove=function(I){for(var j=this._currentlyRunning,$=0,X=j?this._queue.concat(j):this._queue;$X.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(X.minPitch!=null&&X.maxPitch!=null&&X.minPitch>X.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(X.minPitch!=null&&X.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(X.maxPitch!=null&&X.maxPitch>60)throw new Error("maxPitch must be less than or equal to 60");var he=new Ht(X.minZoom,X.maxZoom,X.minPitch,X.maxPitch,X.renderWorldCopies);if(I.call(this,he,X),this._interactive=X.interactive,this._maxTileCacheSize=X.maxTileCacheSize,this._failIfMajorPerformanceCaveat=X.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=X.preserveDrawingBuffer,this._antialias=X.antialias,this._trackResize=X.trackResize,this._bearingSnap=X.bearingSnap,this._refreshExpiredTiles=X.refreshExpiredTiles,this._fadeDuration=X.fadeDuration,this._crossSourceCollisions=X.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=X.collectResourceTiming,this._renderTaskQueue=new wi,this._controls=[],this._mapId=i.uniqueId(),this._locale=i.extend({},Ii,X.locale),this._requestManager=new i.RequestManager(X.transformRequest,X.accessToken),typeof X.container=="string"){if(this._container=i.window.document.getElementById(X.container),!this._container)throw new Error("Container '"+X.container+"' not found.")}else{if(!(X.container instanceof If))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=X.container}if(X.maxBounds&&this.setMaxBounds(X.maxBounds),i.bindAll(["_onWindowOnline","_onWindowResize","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");this.on("move",function(){return se._update(!1)}),this.on("moveend",function(){return se._update(!1)}),this.on("zoom",function(){return se._update(!0)}),i.window!==void 0&&(i.window.addEventListener("online",this._onWindowOnline,!1),i.window.addEventListener("resize",this._onWindowResize,!1)),this.handlers=new Lo(this,X);var ye=typeof X.hash=="string"&&X.hash||void 0;this._hash=X.hash&&new Ln(ye).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:X.center,zoom:X.zoom,bearing:X.bearing,pitch:X.pitch}),X.bounds&&(this.resize(),this.fitBounds(X.bounds,i.extend({},X.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=X.localIdeographFontFamily,X.style&&this.setStyle(X.style,{localIdeographFontFamily:X.localIdeographFontFamily}),X.attributionControl&&this.addControl(new Do({customAttribution:X.customAttribution})),this.addControl(new tu,X.logoPosition),this.on("style.load",function(){se.transform.unmodified&&se.jumpTo(se.style.stylesheet)}),this.on("data",function(be){se._update(be.dataType==="style"),se.fire(new i.Event(be.dataType+"data",be))}),this.on("dataloading",function(be){se.fire(new i.Event(be.dataType+"dataloading",be))})}I&&(j.__proto__=I),j.prototype=Object.create(I&&I.prototype),j.prototype.constructor=j;var $={showTileBoundaries:{configurable:!0},showPadding:{configurable:!0},showCollisionBoxes:{configurable:!0},showOverdrawInspector:{configurable:!0},repaint:{configurable:!0},vertices:{configurable:!0},version:{configurable:!0}};return j.prototype._getMapId=function(){return this._mapId},j.prototype.addControl=function(X,se){if(se===void 0&&X.getDefaultPosition&&(se=X.getDefaultPosition()),se===void 0&&(se="top-right"),!X||!X.onAdd)return this.fire(new i.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));var he=X.onAdd(this);this._controls.push(X);var ye=this._controlPositions[se];return se.indexOf("bottom")!==-1?ye.insertBefore(he,ye.firstChild):ye.appendChild(he),this},j.prototype.removeControl=function(X){if(!X||!X.onRemove)return this.fire(new i.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));var se=this._controls.indexOf(X);return se>-1&&this._controls.splice(se,1),X.onRemove(this),this},j.prototype.resize=function(X){var se=this._containerDimensions(),he=se[0],ye=se[1];this._resizeCanvas(he,ye),this.transform.resize(he,ye),this.painter.resize(he,ye);var be=!this._moving;return be&&(this.stop(),this.fire(new i.Event("movestart",X)).fire(new i.Event("move",X))),this.fire(new i.Event("resize",X)),be&&this.fire(new i.Event("moveend",X)),this},j.prototype.getBounds=function(){return this.transform.getBounds()},j.prototype.getMaxBounds=function(){return this.transform.getMaxBounds()},j.prototype.setMaxBounds=function(X){return this.transform.setMaxBounds(i.LngLatBounds.convert(X)),this._update()},j.prototype.setMinZoom=function(X){if((X=X??-2)>=-2&&X<=this.transform.maxZoom)return this.transform.minZoom=X,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=X,this._update(),this.getZoom()>X&&this.setZoom(X),this;throw new Error("maxZoom must be greater than the current minZoom")},j.prototype.getMaxZoom=function(){return this.transform.maxZoom},j.prototype.setMinPitch=function(X){if((X=X??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(X>=0&&X<=this.transform.maxPitch)return this.transform.minPitch=X,this._update(),this.getPitch()60)throw new Error("maxPitch must be less than or equal to 60");if(X>=this.transform.minPitch)return this.transform.maxPitch=X,this._update(),this.getPitch()>X&&this.setPitch(X),this;throw new Error("maxPitch must be greater than the current minPitch")},j.prototype.getMaxPitch=function(){return this.transform.maxPitch},j.prototype.getRenderWorldCopies=function(){return this.transform.renderWorldCopies},j.prototype.setRenderWorldCopies=function(X){return this.transform.renderWorldCopies=X,this._update()},j.prototype.project=function(X){return this.transform.locationPoint(i.LngLat.convert(X))},j.prototype.unproject=function(X){return this.transform.pointLocation(i.Point.convert(X))},j.prototype.isMoving=function(){return this._moving||this.handlers.isMoving()},j.prototype.isZooming=function(){return this._zooming||this.handlers.isZooming()},j.prototype.isRotating=function(){return this._rotating||this.handlers.isRotating()},j.prototype._createDelegatedListener=function(X,se,he){var ye,be=this;if(X==="mouseenter"||X==="mouseover"){var Ee=!1;return{layer:se,listener:he,delegates:{mousemove:function(Xe){var it=be.getLayer(se)?be.queryRenderedFeatures(Xe.point,{layers:[se]}):[];it.length?Ee||(Ee=!0,he.call(be,new $r(X,be,Xe.originalEvent,{features:it}))):Ee=!1},mouseout:function(){Ee=!1}}}}if(X==="mouseleave"||X==="mouseout"){var Ue=!1;return{layer:se,listener:he,delegates:{mousemove:function(Xe){(be.getLayer(se)?be.queryRenderedFeatures(Xe.point,{layers:[se]}):[]).length?Ue=!0:Ue&&(Ue=!1,he.call(be,new $r(X,be,Xe.originalEvent)))},mouseout:function(Xe){Ue&&(Ue=!1,he.call(be,new $r(X,be,Xe.originalEvent)))}}}}return{layer:se,listener:he,delegates:(ye={},ye[X]=function(Xe){var it=be.getLayer(se)?be.queryRenderedFeatures(Xe.point,{layers:[se]}):[];it.length&&(Xe.features=it,he.call(be,Xe),delete Xe.features)},ye)}},j.prototype.on=function(X,se,he){if(he===void 0)return I.prototype.on.call(this,X,se);var ye=this._createDelegatedListener(X,se,he);for(var be in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[X]=this._delegatedListeners[X]||[],this._delegatedListeners[X].push(ye),ye.delegates)this.on(be,ye.delegates[be]);return this},j.prototype.once=function(X,se,he){if(he===void 0)return I.prototype.once.call(this,X,se);var ye=this._createDelegatedListener(X,se,he);for(var be in ye.delegates)this.once(be,ye.delegates[be]);return this},j.prototype.off=function(X,se,he){var ye=this;return he===void 0?I.prototype.off.call(this,X,se):(this._delegatedListeners&&this._delegatedListeners[X]&&function(be){for(var Ee=be[X],Ue=0;Ue180;){var ye=$.locationPoint(I);if(ye.x>=0&&ye.y>=0&&ye.x<=$.width&&ye.y<=$.height)break;I.lng>$.center.lng?I.lng-=360:I.lng+=360}return I}Fa.prototype.down=function(I,j){this.mouseRotate.mousedown(I,j),this.mousePitch&&this.mousePitch.mousedown(I,j),u.disableDrag()},Fa.prototype.move=function(I,j){var $=this.map,X=this.mouseRotate.mousemoveWindow(I,j);if(X&&X.bearingDelta&&$.setBearing($.getBearing()+X.bearingDelta),this.mousePitch){var se=this.mousePitch.mousemoveWindow(I,j);se&&se.pitchDelta&&$.setPitch($.getPitch()+se.pitchDelta)}},Fa.prototype.off=function(){var I=this.element;u.removeEventListener(I,"mousedown",this.mousedown),u.removeEventListener(I,"touchstart",this.touchstart,{passive:!1}),u.removeEventListener(I,"touchmove",this.touchmove),u.removeEventListener(I,"touchend",this.touchend),u.removeEventListener(I,"touchcancel",this.reset),this.offTemp()},Fa.prototype.offTemp=function(){u.enableDrag(),u.removeEventListener(i.window,"mousemove",this.mousemove),u.removeEventListener(i.window,"mouseup",this.mouseup)},Fa.prototype.mousedown=function(I){this.down(i.extend({},I,{ctrlKey:!0,preventDefault:function(){return I.preventDefault()}}),u.mousePos(this.element,I)),u.addEventListener(i.window,"mousemove",this.mousemove),u.addEventListener(i.window,"mouseup",this.mouseup)},Fa.prototype.mousemove=function(I){this.move(I,u.mousePos(this.element,I))},Fa.prototype.mouseup=function(I){this.mouseRotate.mouseupWindow(I),this.mousePitch&&this.mousePitch.mouseupWindow(I),this.offTemp()},Fa.prototype.touchstart=function(I){I.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=u.touchPos(this.element,I.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:function(){return I.preventDefault()}},this._startPos))},Fa.prototype.touchmove=function(I){I.targetTouches.length!==1?this.reset():(this._lastPos=u.touchPos(this.element,I.targetTouches)[0],this.move({preventDefault:function(){return I.preventDefault()}},this._lastPos))},Fa.prototype.touchend=function(I){I.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)X.getEast()||se.latitudeX.getNorth())},j.prototype._setErrorState=function(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}},j.prototype._onSuccess=function($){if(this._map){if(this._isOutOfMapMaxBounds($))return this._setErrorState(),this.fire(new i.Event("outofmaxbounds",$)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=$,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker($),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera($),this.options.showUserLocation&&this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"),this.fire(new i.Event("geolocate",$)),this._finish()}},j.prototype._updateCamera=function($){var X=new i.LngLat($.coords.longitude,$.coords.latitude),se=$.coords.accuracy,he=this._map.getBearing(),ye=i.extend({bearing:he},this.options.fitBoundsOptions);this._map.fitBounds(X.toBounds(se),ye,{geolocateSource:!0})},j.prototype._updateMarker=function($){if($){var X=new i.LngLat($.coords.longitude,$.coords.latitude);this._accuracyCircleMarker.setLngLat(X).addTo(this._map),this._userLocationDotMarker.setLngLat(X).addTo(this._map),this._accuracy=$.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},j.prototype._updateCircleRadius=function(){var $=this._map._container.clientHeight/2,X=this._map.unproject([0,$]),se=this._map.unproject([1,$]),he=X.distanceTo(se),ye=Math.ceil(2*this._accuracy/he);this._circleElement.style.width=ye+"px",this._circleElement.style.height=ye+"px"},j.prototype._onZoom=function(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},j.prototype._onError=function($){if(this._map){if(this.options.trackUserLocation)if($.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;var X=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=X,this._geolocateButton.setAttribute("aria-label",X),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if($.code===3&&Su)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("mapboxgl-user-location-dot-stale"),this.fire(new i.Event("error",$)),this._finish()}},j.prototype._finish=function(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},j.prototype._setupUI=function($){var X=this;if(this._container.addEventListener("contextmenu",function(ye){return ye.preventDefault()}),this._geolocateButton=u.create("button","mapboxgl-ctrl-geolocate",this._container),u.create("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden",!0),this._geolocateButton.type="button",$===!1){i.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");var se=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=se,this._geolocateButton.setAttribute("aria-label",se)}else{var he=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=he,this._geolocateButton.setAttribute("aria-label",he)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=u.create("div","mapboxgl-user-location-dot"),this._userLocationDotMarker=new Uc(this._dotElement),this._circleElement=u.create("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Uc({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",function(ye){var be=ye.originalEvent&&ye.originalEvent.type==="resize";ye.geolocateSource||X._watchState!=="ACTIVE_LOCK"||be||(X._watchState="BACKGROUND",X._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),X._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),X.fire(new i.Event("trackuserlocationend")))})},j.prototype.trigger=function(){if(!this._setup)return i.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new i.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":$c--,Su=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new i.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new i.Event("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){var $;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),++$c>1?($={maximumAge:6e5,timeout:0},Su=!0):($=this.options.positionOptions,Su=!1),this._geolocationWatchID=i.window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,$)}}else i.window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0},j.prototype._clearWatch=function(){i.window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)},j}(i.Evented),Op={maxWidth:100,unit:"metric"},tc=function(I){this.options=i.extend({},Op,I),i.bindAll(["_onMove","setUnit"],this)};function bd(I,j,$){var X=$&&$.maxWidth||100,se=I._container.clientHeight/2,he=I.unproject([0,se]),ye=I.unproject([X,se]),be=he.distanceTo(ye);if($&&$.unit==="imperial"){var Ee=3.2808*be;Ee>5280?Vc(j,X,Ee/5280,I._getUIString("ScaleControl.Miles")):Vc(j,X,Ee,I._getUIString("ScaleControl.Feet"))}else $&&$.unit==="nautical"?Vc(j,X,be/1852,I._getUIString("ScaleControl.NauticalMiles")):be>=1e3?Vc(j,X,be/1e3,I._getUIString("ScaleControl.Kilometers")):Vc(j,X,be,I._getUIString("ScaleControl.Meters"))}function Vc(I,j,$,X){var se,he,ye,be=(se=$,he=Math.pow(10,(""+Math.floor(se)).length-1),ye=(ye=se/he)>=10?10:ye>=5?5:ye>=3?3:ye>=2?2:ye>=1?1:function(Ue){var Xe=Math.pow(10,Math.ceil(-Math.log(Ue)/Math.LN10));return Math.round(Ue*Xe)/Xe}(ye),he*ye),Ee=be/$;I.style.width=j*Ee+"px",I.innerHTML=be+" "+X}tc.prototype.getDefaultPosition=function(){return"bottom-left"},tc.prototype._onMove=function(){bd(this._map,this._container,this.options)},tc.prototype.onAdd=function(I){return this._map=I,this._container=u.create("div","mapboxgl-ctrl mapboxgl-ctrl-scale",I.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container},tc.prototype.onRemove=function(){u.remove(this._container),this._map.off("move",this._onMove),this._map=void 0},tc.prototype.setUnit=function(I){this.options.unit=I,bd(this._map,this._container,this.options)};var us=function(I){this._fullscreen=!1,I&&I.container&&(I.container instanceof i.window.HTMLElement?this._container=I.container:i.warnOnce("Full screen control 'container' must be a DOM element.")),i.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in i.window.document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in i.window.document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in i.window.document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in i.window.document&&(this._fullscreenchange="MSFullscreenChange")};us.prototype.onAdd=function(I){return this._map=I,this._container||(this._container=this._map.getContainer()),this._controlContainer=u.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",i.warnOnce("This device does not support fullscreen mode.")),this._controlContainer},us.prototype.onRemove=function(){u.remove(this._controlContainer),this._map=null,i.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)},us.prototype._checkFullscreenSupport=function(){return!!(i.window.document.fullscreenEnabled||i.window.document.mozFullScreenEnabled||i.window.document.msFullscreenEnabled||i.window.document.webkitFullscreenEnabled)},us.prototype._setupUI=function(){var I=this._fullscreenButton=u.create("button","mapboxgl-ctrl-fullscreen",this._controlContainer);u.create("span","mapboxgl-ctrl-icon",I).setAttribute("aria-hidden",!0),I.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),i.window.document.addEventListener(this._fullscreenchange,this._changeIcon)},us.prototype._updateTitle=function(){var I=this._getTitle();this._fullscreenButton.setAttribute("aria-label",I),this._fullscreenButton.title=I},us.prototype._getTitle=function(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")},us.prototype._isFullscreen=function(){return this._fullscreen},us.prototype._changeIcon=function(){(i.window.document.fullscreenElement||i.window.document.mozFullScreenElement||i.window.document.webkitFullscreenElement||i.window.document.msFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())},us.prototype._onClickFullscreen=function(){this._isFullscreen()?i.window.document.exitFullscreen?i.window.document.exitFullscreen():i.window.document.mozCancelFullScreen?i.window.document.mozCancelFullScreen():i.window.document.msExitFullscreen?i.window.document.msExitFullscreen():i.window.document.webkitCancelFullScreen&&i.window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()};var Pp={closeButton:!0,closeOnClick:!0,className:"",maxWidth:"240px"},Ip=function(I){function j($){I.call(this),this.options=i.extend(Object.create(Pp),$),i.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}return I&&(j.__proto__=I),j.prototype=Object.create(I&&I.prototype),j.prototype.constructor=j,j.prototype.addTo=function($){return this._map&&this.remove(),this._map=$,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new i.Event("open")),this},j.prototype.isOpen=function(){return!!this._map},j.prototype.remove=function(){return this._content&&u.remove(this._content),this._container&&(u.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new i.Event("close")),this},j.prototype.getLngLat=function(){return this._lngLat},j.prototype.setLngLat=function($){return this._lngLat=i.LngLat.convert($),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("mapboxgl-track-pointer")),this},j.prototype.trackPointer=function(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("mapboxgl-track-pointer")),this},j.prototype.getElement=function(){return this._container},j.prototype.setText=function($){return this.setDOMContent(i.window.document.createTextNode($))},j.prototype.setHTML=function($){var X,se=i.window.document.createDocumentFragment(),he=i.window.document.createElement("body");for(he.innerHTML=$;X=he.firstChild;)se.appendChild(X);return this.setDOMContent(se)},j.prototype.getMaxWidth=function(){return this._container&&this._container.style.maxWidth},j.prototype.setMaxWidth=function($){return this.options.maxWidth=$,this._update(),this},j.prototype.setDOMContent=function($){return this._createContent(),this._content.appendChild($),this._update(),this},j.prototype.addClassName=function($){this._container&&this._container.classList.add($)},j.prototype.removeClassName=function($){this._container&&this._container.classList.remove($)},j.prototype.toggleClassName=function($){if(this._container)return this._container.classList.toggle($)},j.prototype._createContent=function(){this._content&&u.remove(this._content),this._content=u.create("div","mapboxgl-popup-content",this._container),this.options.closeButton&&(this._closeButton=u.create("button","mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))},j.prototype._onMouseUp=function($){this._update($.point)},j.prototype._onMouseMove=function($){this._update($.point)},j.prototype._onDrag=function($){this._update($.point)},j.prototype._update=function($){var X=this,se=this._lngLat||this._trackPointer;if(this._map&&se&&this._content&&(this._container||(this._container=u.create("div","mapboxgl-popup",this._map.getContainer()),this._tip=u.create("div","mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(function(xt){return X._container.classList.add(xt)}),this._trackPointer&&this._container.classList.add("mapboxgl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Qu(this._lngLat,this._pos,this._map.transform)),!this._trackPointer||$)){var he=this._pos=this._trackPointer&&$?$:this._map.project(this._lngLat),ye=this.options.anchor,be=function xt(Dt){if(Dt){if(typeof Dt=="number"){var _t=Math.round(Math.sqrt(.5*Math.pow(Dt,2)));return{center:new i.Point(0,0),top:new i.Point(0,Dt),"top-left":new i.Point(_t,_t),"top-right":new i.Point(-_t,_t),bottom:new i.Point(0,-Dt),"bottom-left":new i.Point(_t,-_t),"bottom-right":new i.Point(-_t,-_t),left:new i.Point(Dt,0),right:new i.Point(-Dt,0)}}if(Dt instanceof i.Point||Array.isArray(Dt)){var Mt=i.Point.convert(Dt);return{center:Mt,top:Mt,"top-left":Mt,"top-right":Mt,bottom:Mt,"bottom-left":Mt,"bottom-right":Mt,left:Mt,right:Mt}}return{center:i.Point.convert(Dt.center||[0,0]),top:i.Point.convert(Dt.top||[0,0]),"top-left":i.Point.convert(Dt["top-left"]||[0,0]),"top-right":i.Point.convert(Dt["top-right"]||[0,0]),bottom:i.Point.convert(Dt.bottom||[0,0]),"bottom-left":i.Point.convert(Dt["bottom-left"]||[0,0]),"bottom-right":i.Point.convert(Dt["bottom-right"]||[0,0]),left:i.Point.convert(Dt.left||[0,0]),right:i.Point.convert(Dt.right||[0,0])}}return xt(new i.Point(0,0))}(this.options.offset);if(!ye){var Ee,Ue=this._container.offsetWidth,Xe=this._container.offsetHeight;Ee=he.y+be.bottom.ythis._map.transform.height-Xe?["bottom"]:[],he.xthis._map.transform.width-Ue/2&&Ee.push("right"),ye=Ee.length===0?"bottom":Ee.join("-")}var it=he.add(be[ye]).round();u.setTransform(this._container,Eu[ye]+" translate("+it.x+"px,"+it.y+"px)"),Ao(this._container,ye,"popup")}},j.prototype._onClose=function(){this.remove()},j}(i.Evented),ce={version:i.version,supported:s,setRTLTextPlugin:i.setRTLTextPlugin,getRTLTextPluginStatus:i.getRTLTextPluginStatus,Map:Al,NavigationControl:Ta,GeolocateControl:xd,AttributionControl:Do,ScaleControl:tc,FullscreenControl:us,Popup:Ip,Marker:Uc,Style:Ar,LngLat:i.LngLat,LngLatBounds:i.LngLatBounds,Point:i.Point,MercatorCoordinate:i.MercatorCoordinate,Evented:i.Evented,config:i.config,prewarm:function(){tt().acquire(At)},clearPrewarmedResources:function(){var I=$t;I&&(I.isPreloaded()&&I.numActive()===1?(I.release(At),$t=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get accessToken(){return i.config.ACCESS_TOKEN},set accessToken(I){i.config.ACCESS_TOKEN=I},get baseApiUrl(){return i.config.API_URL},set baseApiUrl(I){i.config.API_URL=I},get workerCount(){return wt.workerCount},set workerCount(I){wt.workerCount=I},get maxParallelImageRequests(){return i.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(I){i.config.MAX_PARALLEL_IMAGE_REQUESTS=I},clearStorage:function(I){i.clearTileCache(I)},workerUrl:""};return ce}),l})},{}],240:[function(t,o,f){o.exports=Math.log2||function(r){return Math.log(r)*Math.LOG2E}},{}],241:[function(t,o,f){o.exports=function(a,l){l||(l=a,a=window);var c=0,i=0,s=0,u={shift:!1,alt:!1,control:!1,meta:!1},h=!1;function d(k){var w=!1;return"altKey"in k&&(w=w||k.altKey!==u.alt,u.alt=!!k.altKey),"shiftKey"in k&&(w=w||k.shiftKey!==u.shift,u.shift=!!k.shiftKey),"ctrlKey"in k&&(w=w||k.ctrlKey!==u.control,u.control=!!k.ctrlKey),"metaKey"in k&&(w=w||k.metaKey!==u.meta,u.meta=!!k.metaKey),w}function m(k,w){var M=r.x(w),T=r.y(w);"buttons"in w&&(k=0|w.buttons),(k!==c||M!==i||T!==s||d(w))&&(c=0|k,i=M||0,s=T||0,l&&l(c,i,s,u))}function p(k){m(0,k)}function g(){(c||i||s||u.shift||u.alt||u.meta||u.control)&&(i=s=0,c=0,u.shift=u.alt=u.control=u.meta=!1,l&&l(0,0,0,u))}function y(k){d(k)&&l&&l(c,i,s,u)}function v(k){r.buttons(k)===0?m(0,k):m(c,k)}function x(k){m(c|r.buttons(k),k)}function _(k){m(c&~r.buttons(k),k)}function A(){h||(h=!0,a.addEventListener("mousemove",v),a.addEventListener("mousedown",x),a.addEventListener("mouseup",_),a.addEventListener("mouseleave",p),a.addEventListener("mouseenter",p),a.addEventListener("mouseout",p),a.addEventListener("mouseover",p),a.addEventListener("blur",g),a.addEventListener("keyup",y),a.addEventListener("keydown",y),a.addEventListener("keypress",y),a!==window&&(window.addEventListener("blur",g),window.addEventListener("keyup",y),window.addEventListener("keydown",y),window.addEventListener("keypress",y)))}A();var b={element:a};return Object.defineProperties(b,{enabled:{get:function(){return h},set:function(k){k?A():function(){h&&(h=!1,a.removeEventListener("mousemove",v),a.removeEventListener("mousedown",x),a.removeEventListener("mouseup",_),a.removeEventListener("mouseleave",p),a.removeEventListener("mouseenter",p),a.removeEventListener("mouseout",p),a.removeEventListener("mouseover",p),a.removeEventListener("blur",g),a.removeEventListener("keyup",y),a.removeEventListener("keydown",y),a.removeEventListener("keypress",y),a!==window&&(window.removeEventListener("blur",g),window.removeEventListener("keyup",y),window.removeEventListener("keydown",y),window.removeEventListener("keypress",y)))}()},enumerable:!0},buttons:{get:function(){return c},enumerable:!0},x:{get:function(){return i},enumerable:!0},y:{get:function(){return s},enumerable:!0},mods:{get:function(){return u},enumerable:!0}}),b};var r=t("mouse-event")},{"mouse-event":243}],242:[function(t,o,f){var r={left:0,top:0};o.exports=function(a,l,c){l=l||a.currentTarget||a.srcElement,Array.isArray(c)||(c=[0,0]);var i=a.clientX||0,s=a.clientY||0,u=(h=l,h===window||h===document||h===document.body?r:h.getBoundingClientRect()),h;return c[0]=i-u.left,c[1]=s-u.top,c}},{}],243:[function(t,o,f){function r(a){return a.target||a.srcElement||window}f.buttons=function(a){if(typeof a=="object"){if("buttons"in a)return a.buttons;if("which"in a){if((l=a.which)===2)return 4;if(l===3)return 2;if(l>0)return 1<=0)return 1<0&&h(m,M))}catch(T){y.call(new x(M),T)}}}function y(k){var w=this;w.triggered||(w.triggered=!0,w.def&&(w=w.def),w.msg=k,w.state=2,w.chain.length>0&&h(m,w))}function v(k,w,M,T){for(var E=0;E1&&(m*=M=Math.sqrt(M),p*=M);var T=m*m,E=p*p,S=(y==v?-1:1)*Math.sqrt(Math.abs((T*E-T*w*w-E*k*k)/(T*w*w+E*k*k)));S==1/0&&(S=1);var P=S*m*w/p+(h+x)/2,L=S*-p*k/m+(d+_)/2,R=Math.asin(((d-L)/p).toFixed(9)),F=Math.asin(((_-L)/p).toFixed(9));(R=hF&&(R-=2*r),!v&&F>R&&(F-=2*r)}if(Math.abs(F-R)>a){var D=F,O=x,N=_;F=R+a*(v&&F>R?1:-1);var B=i(x=P+m*Math.cos(F),_=L+p*Math.sin(F),m,p,g,0,v,O,N,[F,D,P,L])}var W=Math.tan((F-R)/4),G=4/3*m*W,K=4/3*p*W,te=[2*h-(h+G*Math.sin(R)),2*d-(d-K*Math.cos(R)),x+G*Math.sin(F),_-K*Math.cos(F),x,_];if(A)return te;B&&(te=te.concat(B));for(var Y=0;Y7&&(m.push(M.splice(0,7)),M.unshift("C"));break;case"S":var E=A,S=b;d!="C"&&d!="S"||(E+=E-p,S+=S-g),M=["C",E,S,M[1],M[2],M[3],M[4]];break;case"T":d=="Q"||d=="T"?(x=2*A-x,_=2*b-_):(x=A,_=b),M=c(A,b,x,_,M[1],M[2]);break;case"Q":x=M[1],_=M[2],M=c(A,b,M[1],M[2],M[3],M[4]);break;case"L":M=l(A,b,M[1],M[2]);break;case"H":M=l(A,b,M[1],b);break;case"V":M=l(A,b,A,M[1]);break;case"Z":M=l(A,b,y,v)}d=T,A=M[M.length-2],b=M[M.length-1],M.length>4?(p=M[M.length-4],g=M[M.length-3]):(p=A,g=b),m.push(M)}return m}},{}],247:[function(t,o,f){var r=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable;function c(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}o.exports=function(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[0]==="5")return!1;for(var s={},u=0;u<10;u++)s["_"+String.fromCharCode(u)]=u;if(Object.getOwnPropertyNames(s).map(function(d){return s[d]}).join("")!=="0123456789")return!1;var h={};return"abcdefghijklmnopqrst".split("").forEach(function(d){h[d]=d}),Object.keys(Object.assign({},h)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}()?Object.assign:function(i,s){for(var u,h,d=c(i),m=1;m1e4)throw Error("References have circular dependency. Please, check them.");s[_]=x}),y=y.reverse(),s=s.map(function(x){return y.forEach(function(_){x=x.replace(new RegExp("(\\"+h+_+"\\"+h+")","g"),p[0]+"$1"+p[1])}),x})});var m=new RegExp("\\"+h+"([0-9]+)\\"+h);return d?s:function p(g,y,v){for(var x,_=[],A=0;x=m.exec(g);){if(A++>1e4)throw Error("Circular references in parenthesis");_.push(g.slice(0,x.index)),_.push(p(y[x[1]],y)),g=g.slice(x.index+x[0].length)}return _.push(g),_}(s[0],s)}function a(c,i){if(i&&i.flat){var s,u=i&&i.escape||"___",h=c[0];if(!h)return"";for(var d=new RegExp("\\"+u+"([0-9]+)\\"+u),m=0;h!=s;){if(m++>1e4)throw Error("Circular references in "+c);s=h,h=h.replace(d,p)}return h}return c.reduce(function g(y,v){return Array.isArray(v)&&(v=v.reduce(g,"")),y+v},"");function p(g,y){if(c[y]==null)throw Error("Reference "+y+"is undefined");return c[y]}}function l(c,i){return Array.isArray(c)?a(c,i):r(c,i)}l.parse=r,l.stringify=a,o.exports=l},{}],249:[function(t,o,f){var r=t("pick-by-alias");o.exports=function(a){var l;return arguments.length>1&&(a=arguments),typeof a=="string"?a=a.split(/\s/).map(parseFloat):typeof a=="number"&&(a=[a]),a.length&&typeof a[0]=="number"?l=a.length===1?{width:a[0],height:a[0],x:0,y:0}:a.length===2?{width:a[0],height:a[1],x:0,y:0}:{x:a[0],y:a[1],width:a[2]-a[0]||0,height:a[3]-a[1]||0}:a&&(a=r(a,{left:"x l left Left",top:"y t top Top",width:"w width W Width",height:"h height W Width",bottom:"b bottom Bottom",right:"r right Right"}),l={x:a.left||0,y:a.top||0},a.width==null?a.right?l.width=a.right-l.x:l.width=0:l.width=a.width,a.height==null?a.bottom?l.height=a.bottom-l.y:l.height=0:l.height=a.height),l}},{"pick-by-alias":253}],250:[function(t,o,f){o.exports=function(c){var i=[];return c.replace(a,function(s,u,h){var d=u.toLowerCase();for(h=function(m){var p=m.match(l);return p?p.map(Number):[]}(h),d=="m"&&h.length>2&&(i.push([u].concat(h.splice(0,2))),d="l",u=u=="m"?"l":"L");;){if(h.length==r[d])return h.unshift(u),i.push(h);if(h.length=-r},pointBetween:function(l,c,i){var s=l[1]-c[1],u=i[0]-c[0],h=l[0]-c[0],d=i[1]-c[1],m=h*u+s*d;return!(m-r)},pointsSameX:function(l,c){return Math.abs(l[0]-c[0])r!=h-s>r&&(u-p)*(s-g)/(h-g)+p-i>r&&(d=!d),u=p,h=g}return d}};return a}},{}],257:[function(t,o,f){var r={toPolygon:function(a,l){function c(u){if(u.length<=0)return a.segments({inverted:!1,regions:[]});function h(p){var g=p.slice(0,p.length-1);return a.segments({inverted:!1,regions:[g]})}for(var d=h(u[0]),m=1;m0})}function x(L,R){var F=L.seg,D=R.seg,O=F.start,N=F.end,B=D.start,W=D.end;c&&c.checkIntersection(F,D);var G=l.linesIntersect(O,N,B,W);if(G===!1){if(!l.pointsCollinear(O,N,B)||l.pointsSame(O,W)||l.pointsSame(N,B))return!1;var K=l.pointsSame(O,B),te=l.pointsSame(N,W);if(K&&te)return R;var Y=!K&&l.pointBetween(O,B,W),J=!te&&l.pointBetween(N,B,W);if(K)return J?d(R,N):d(L,W),R;Y&&(te||(J?d(R,N):d(L,W)),d(R,O))}else G.alongA===0&&(G.alongB===-1?d(L,B):G.alongB===0?d(L,G.pt):G.alongB===1&&d(L,W)),G.alongB===0&&(G.alongA===-1?d(R,O):G.alongA===0?d(R,G.pt):G.alongA===1&&d(R,N));return!1}for(var _=[];!s.isEmpty();){var A=s.getHead();if(c&&c.vert(A.pt[0]),A.isStart){let L=function(){if(k){var R=x(A,k);if(R)return R}return!!w&&x(A,w)};c&&c.segmentNew(A.seg,A.primary);var b=v(A),k=b.before?b.before.ev:null,w=b.after?b.after.ev:null;c&&c.tempStatus(A.seg,!!k&&k.seg,!!w&&w.seg);var M,T=L();if(T){var E;a?(E=A.seg.myFill.below===null||A.seg.myFill.above!==A.seg.myFill.below)&&(T.seg.myFill.above=!T.seg.myFill.above):T.seg.otherFill=A.seg.myFill,c&&c.segmentUpdate(T.seg),A.other.remove(),A.remove()}if(s.getHead()!==A){c&&c.rewind(A.seg);continue}a?(E=A.seg.myFill.below===null||A.seg.myFill.above!==A.seg.myFill.below,A.seg.myFill.below=w?w.seg.myFill.above:p,A.seg.myFill.above=E?!A.seg.myFill.below:A.seg.myFill.below):A.seg.otherFill===null&&(M=w?A.primary===w.primary?w.seg.otherFill.above:w.seg.myFill.above:A.primary?g:p,A.seg.otherFill={above:M,below:M}),c&&c.status(A.seg,!!k&&k.seg,!!w&&w.seg),A.other.status=b.insert(r.node({ev:A}))}else{var S=A.status;if(S===null)throw new Error("PolyBool: Zero-length segment detected; your epsilon is probably too small or too large");if(y.exists(S.prev)&&y.exists(S.next)&&x(S.prev.ev,S.next.ev),c&&c.statusRemove(S.ev.seg),S.remove(),!A.primary){var P=A.seg.myFill;A.seg.myFill=A.seg.otherFill,A.seg.otherFill=P}_.push(A.seg)}s.getHead().remove()}return c&&c.done(),_}return a?{addRegion:function(p){for(var g,y,v,x=p[p.length-1],_=0;_0&&!this.aborted;){var s=this.ifds_to_read.shift();s.offset&&this.scan_ifd(s.id,s.offset,c)}},l.prototype.read_uint16=function(c){var i=this.input;if(c+2>i.length)throw r("unexpected EOF","EBADDATA");return this.big_endian?256*i[c]+i[c+1]:i[c]+256*i[c+1]},l.prototype.read_uint32=function(c){var i=this.input;if(c+4>i.length)throw r("unexpected EOF","EBADDATA");return this.big_endian?16777216*i[c]+65536*i[c+1]+256*i[c+2]+i[c+3]:i[c]+256*i[c+1]+65536*i[c+2]+16777216*i[c+3]},l.prototype.is_subifd_link=function(c,i){return c===0&&i===34665||c===0&&i===34853||c===34665&&i===40965},l.prototype.exif_format_length=function(c){switch(c){case 1:case 2:case 6:case 7:return 1;case 3:case 8:return 2;case 4:case 9:case 11:return 4;case 5:case 10:case 12:return 8;default:return 0}},l.prototype.exif_format_read=function(c,i){var s;switch(c){case 1:case 2:return s=this.input[i];case 6:return(s=this.input[i])|33554430*(128&s);case 3:return s=this.read_uint16(i);case 8:return(s=this.read_uint16(i))|131070*(32768&s);case 4:return s=this.read_uint32(i);case 9:return 0|(s=this.read_uint32(i));case 5:case 10:case 11:case 12:case 7:default:return null}},l.prototype.scan_ifd=function(c,i,s){var u=this.read_uint16(i);i+=2;for(var h=0;hthis.input.length)throw r("unexpected EOF","EBADDATA");for(var _=[],A=v,b=0;b0&&(this.ifds_to_read.push({id:d,offset:_[0]}),x=!0),s({is_big_endian:this.big_endian,ifd:c,tag:d,format:m,count:p,entry_offset:i+this.start,data_length:y,data_offset:v+this.start,value:_,is_subifd_link:x})===!1)return void(this.aborted=!0);i+=12}c===0&&this.ifds_to_read.push({id:1,offset:this.read_uint32(i)})},o.exports.ExifParser=l,o.exports.get_orientation=function(c){var i=0;try{return new l(c,0,c.length).each(function(s){if(s.ifd===0&&s.tag===274&&Array.isArray(s.value))return i=s.value[0],!1}),i}catch{return-1}}},{}],264:[function(t,o,f){var r=t("./common").readUInt16BE,a=t("./common").readUInt32BE;function l(d,m){if(d.length<4+m)return null;var p=a(d,m);return d.length>4&15,g=15&d[4],y=d[5]>>4&15,v=r(d,6),x=8,_=0;_b.width||A.width===b.width&&A.height>b.height?A:b}),y=p.reduce(function(A,b){return A.height>b.height||A.height===b.height&&A.width>b.width?A:b}),g.width>y.height||g.width===y.height&&g.height>y.width?g:y),x=1;m.transforms.forEach(function(A){var b={1:6,2:5,3:8,4:7,5:4,6:3,7:2,8:1},k={1:4,2:3,3:2,4:1,5:6,6:5,7:8,8:7};if(A.type==="imir"&&(x=A.value===0?k[x]:b[x=b[x=k[x]]]),A.type==="irot")for(var w=0;w1&&(v.variants=y.variants),y.orientation&&(v.orientation=y.orientation),y.exif_location&&y.exif_location.offset+y.exif_location.length<=u.length){var x=l(u,y.exif_location.offset),_=u.slice(y.exif_location.offset+x+4,y.exif_location.offset+y.exif_location.length),A=i.get_orientation(_);A>0&&(v.orientation=A)}return v}}}}}}},{"../common":262,"../exif_utils":263,"../miaf_utils":264}],266:[function(t,o,f){var r=t("../common").str2arr,a=t("../common").sliceEq,l=t("../common").readUInt16LE,c=r("BM");o.exports=function(i){if(!(i.length<26)&&a(i,0,c))return{width:l(i,18),height:l(i,22),type:"bmp",mime:"image/bmp",wUnits:"px",hUnits:"px"}}},{"../common":262}],267:[function(t,o,f){var r=t("../common").str2arr,a=t("../common").sliceEq,l=t("../common").readUInt16LE,c=r("GIF87a"),i=r("GIF89a");o.exports=function(s){if(!(s.length<10)&&(a(s,0,c)||a(s,0,i)))return{width:l(s,6),height:l(s,8),type:"gif",mime:"image/gif",wUnits:"px",hUnits:"px"}}},{"../common":262}],268:[function(t,o,f){var r=t("../common").readUInt16LE;o.exports=function(a){var l=r(a,0),c=r(a,2),i=r(a,4);if(l===0&&c===1&&i){for(var s=[],u={width:0,height:0},h=0;hu.width||m>u.height)&&(u=p)}return{width:u.width,height:u.height,variants:s,type:"ico",mime:"image/x-icon",wUnits:"px",hUnits:"px"}}}},{"../common":262}],269:[function(t,o,f){var r=t("../common").readUInt16BE,a=t("../common").str2arr,l=t("../common").sliceEq,c=t("../exif_utils"),i=a("Exif\0\0");o.exports=function(s){if(!(s.length<2)&&s[0]===255&&s[1]===216&&s[2]===255)for(var u=2;;){for(;;){if(s.length-u<2)return;if(s[u++]===255)break}for(var h,d,m=s[u++];m===255;)m=s[u++];if(208<=m&&m<=217||m===1)h=0;else{if(!(192<=m&&m<=254)||s.length-u<2)return;h=r(s,u)-2,u+=2}if(m===217||m===218)return;if(m===225&&h>=10&&l(s,u,i)&&(d=c.get_orientation(s.slice(u+6,u+h))),h>=5&&192<=m&&m<=207&&m!==196&&m!==200&&m!==204){if(s.length-u0&&(p.orientation=d),p}u+=h}}},{"../common":262,"../exif_utils":263}],270:[function(t,o,f){var r=t("../common").str2arr,a=t("../common").sliceEq,l=t("../common").readUInt32BE,c=r(`‰PNG\r - -`),i=r("IHDR");o.exports=function(s){if(!(s.length<24)&&a(s,0,c)&&a(s,12,i))return{width:l(s,16),height:l(s,20),type:"png",mime:"image/png",wUnits:"px",hUnits:"px"}}},{"../common":262}],271:[function(t,o,f){var r=t("../common").str2arr,a=t("../common").sliceEq,l=t("../common").readUInt32BE,c=r("8BPS\0");o.exports=function(i){if(!(i.length<22)&&a(i,0,c))return{width:l(i,18),height:l(i,14),type:"psd",mime:"image/vnd.adobe.photoshop",wUnits:"px",hUnits:"px"}}},{"../common":262}],272:[function(t,o,f){function r(d){return typeof d=="number"&&isFinite(d)&&d>0}var a=/<[-_.:a-zA-Z0-9][^>]*>/,l=/^<([-_.:a-zA-Z0-9]+:)?svg\s/,c=/[^-]\bwidth="([^%]+?)"|[^-]\bwidth='([^%]+?)'/,i=/\bheight="([^%]+?)"|\bheight='([^%]+?)'/,s=/\bview[bB]ox="(.+?)"|\bview[bB]ox='(.+?)'/,u=/in$|mm$|cm$|pt$|pc$|px$|em$|ex$/;function h(d){return u.test(d)?d.match(u)[0]:"px"}o.exports=function(d){if(function(M){var T,E=0,S=M.length;for(M[0]===239&&M[1]===187&&M[2]===191&&(E=3);E>14&16383),type:"webp",mime:"image/webp",wUnits:"px",hUnits:"px"}}}function m(p,g){return{width:1+(p[g+6]<<16|p[g+5]<<8|p[g+4]),height:1+(p[g+9]<p.length)){for(;g+8=10?y=y||h(p,g+8):_==="VP8L"&&A>=9?y=y||d(p,g+8):_==="VP8X"&&A>=10?y=y||m(p,g+8):_==="EXIF"&&(v=i.get_orientation(p.slice(g+8,g+8+A)),g=1/0),g+=8+A}else g++;if(y)return v>0&&(y.orientation=v),y}}}},{"../common":262,"../exif_utils":263}],275:[function(t,o,f){o.exports={avif:t("./parse_sync/avif"),bmp:t("./parse_sync/bmp"),gif:t("./parse_sync/gif"),ico:t("./parse_sync/ico"),jpeg:t("./parse_sync/jpeg"),png:t("./parse_sync/png"),psd:t("./parse_sync/psd"),svg:t("./parse_sync/svg"),tiff:t("./parse_sync/tiff"),webp:t("./parse_sync/webp")}},{"./parse_sync/avif":265,"./parse_sync/bmp":266,"./parse_sync/gif":267,"./parse_sync/ico":268,"./parse_sync/jpeg":269,"./parse_sync/png":270,"./parse_sync/psd":271,"./parse_sync/svg":272,"./parse_sync/tiff":273,"./parse_sync/webp":274}],276:[function(t,o,f){var r=t("./lib/parsers_sync");o.exports=function(a){return function(l){for(var c=Object.keys(r),i=0;i1)for(var A=1;A"u"?r:window,c=["moz","webkit"],i="AnimationFrame",s=l["request"+i],u=l["cancel"+i]||l["cancelRequest"+i],h=0;!s&&h1&&(R.scaleRatio=[R.scale[0]*R.viewport.width,R.scale[1]*R.viewport.height],y(R),R.after&&R.after(R))}function P(R){if(R){R.length!=null?typeof R[0]=="number"&&(R=[{positions:R}]):Array.isArray(R)||(R=[R]);var F=0,D=0;if(T.groups=M=R.map(function(te,Y){var J=M[Y];return te&&(typeof te=="function"?te={after:te}:typeof te[0]=="number"&&(te={positions:te}),te=c(te,{color:"color colors fill",capSize:"capSize cap capsize cap-size",lineWidth:"lineWidth line-width width line thickness",opacity:"opacity alpha",range:"range dataBox",viewport:"viewport viewBox",errors:"errors error",positions:"positions position data points"}),J||(M[Y]=J={id:Y,scale:null,translate:null,scaleFract:null,translateFract:null,draw:!0},te=i({},w,te)),l(J,te,[{lineWidth:function(re){return .5*+re},capSize:function(re){return .5*+re},opacity:parseFloat,errors:function(re){return re=s(re),D+=re.length,re},positions:function(re,U){return re=s(re,"float64"),U.count=Math.floor(re.length/2),U.bounds=r(re,2),U.offset=F,F+=U.count,re}},{color:function(re,U){var V=U.count;if(re||(re="transparent"),!Array.isArray(re)||typeof re[0]=="number"){var H=re;re=Array(V);for(var ne=0;ne 0. && baClipping < length(normalWidth * endBotJoin)) { - //handle miter clipping - bTopCoord -= normalWidth * endTopJoin; - bTopCoord += normalize(endTopJoin * normalWidth) * baClipping; - } - - if (nextReverse) { - //make join rectangular - vec2 miterShift = normalWidth * endJoinDirection * miterLimit * .5; - float normalAdjust = 1. - min(miterLimit / endMiterRatio, 1.); - bBotCoord = bCoord + miterShift - normalAdjust * normalWidth * currNormal * .5; - bTopCoord = bCoord + miterShift + normalAdjust * normalWidth * currNormal * .5; - } - else if (!prevReverse && abClipping > 0. && abClipping < length(normalWidth * startBotJoin)) { - //handle miter clipping - aBotCoord -= normalWidth * startBotJoin; - aBotCoord += normalize(startBotJoin * normalWidth) * abClipping; - } - - vec2 aTopPosition = (aTopCoord) * adjustedScale + translate; - vec2 aBotPosition = (aBotCoord) * adjustedScale + translate; - - vec2 bTopPosition = (bTopCoord) * adjustedScale + translate; - vec2 bBotPosition = (bBotCoord) * adjustedScale + translate; - - //position is normalized 0..1 coord on the screen - vec2 position = (aTopPosition * lineTop + aBotPosition * lineBot) * lineStart + (bTopPosition * lineTop + bBotPosition * lineBot) * lineEnd; - - startCoord = aCoord * scaleRatio + translate * viewport.zw + viewport.xy; - endCoord = bCoord * scaleRatio + translate * viewport.zw + viewport.xy; - - gl_Position = vec4(position * 2.0 - 1.0, depth, 1); - - enableStartMiter = step(dot(currTangent, prevTangent), .5); - enableEndMiter = step(dot(currTangent, nextTangent), .5); - - //bevel miter cutoffs - if (miterMode == 1.) { - if (enableStartMiter == 1.) { - vec2 startMiterWidth = vec2(startJoinDirection) * thickness * miterLimit * .5; - startCutoff = vec4(aCoord, aCoord); - startCutoff.zw += vec2(-startJoinDirection.y, startJoinDirection.x) / scaleRatio; - startCutoff = startCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw; - startCutoff += viewport.xyxy; - startCutoff += startMiterWidth.xyxy; - } - - if (enableEndMiter == 1.) { - vec2 endMiterWidth = vec2(endJoinDirection) * thickness * miterLimit * .5; - endCutoff = vec4(bCoord, bCoord); - endCutoff.zw += vec2(-endJoinDirection.y, endJoinDirection.x) / scaleRatio; - endCutoff = endCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw; - endCutoff += viewport.xyxy; - endCutoff += endMiterWidth.xyxy; - } - } - - //round miter cutoffs - else if (miterMode == 2.) { - if (enableStartMiter == 1.) { - vec2 startMiterWidth = vec2(startJoinDirection) * thickness * abs(dot(startJoinDirection, currNormal)) * .5; - startCutoff = vec4(aCoord, aCoord); - startCutoff.zw += vec2(-startJoinDirection.y, startJoinDirection.x) / scaleRatio; - startCutoff = startCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw; - startCutoff += viewport.xyxy; - startCutoff += startMiterWidth.xyxy; - } - - if (enableEndMiter == 1.) { - vec2 endMiterWidth = vec2(endJoinDirection) * thickness * abs(dot(endJoinDirection, currNormal)) * .5; - endCutoff = vec4(bCoord, bCoord); - endCutoff.zw += vec2(-endJoinDirection.y, endJoinDirection.x) / scaleRatio; - endCutoff = endCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw; - endCutoff += viewport.xyxy; - endCutoff += endMiterWidth.xyxy; - } - } -} -`]),frag:c([`precision highp float; -#define GLSLIFY 1 - -uniform float dashLength, pixelRatio, thickness, opacity, id, miterMode; -uniform sampler2D dashTexture; - -varying vec4 fragColor; -varying vec2 tangent; -varying vec4 startCutoff, endCutoff; -varying vec2 startCoord, endCoord; -varying float enableStartMiter, enableEndMiter; - -float distToLine(vec2 p, vec2 a, vec2 b) { - vec2 diff = b - a; - vec2 perp = normalize(vec2(-diff.y, diff.x)); - return dot(p - a, perp); -} - -void main() { - float alpha = 1., distToStart, distToEnd; - float cutoff = thickness * .5; - - //bevel miter - if (miterMode == 1.) { - if (enableStartMiter == 1.) { - distToStart = distToLine(gl_FragCoord.xy, startCutoff.xy, startCutoff.zw); - if (distToStart < -1.) { - discard; - return; - } - alpha *= min(max(distToStart + 1., 0.), 1.); - } - - if (enableEndMiter == 1.) { - distToEnd = distToLine(gl_FragCoord.xy, endCutoff.xy, endCutoff.zw); - if (distToEnd < -1.) { - discard; - return; - } - alpha *= min(max(distToEnd + 1., 0.), 1.); - } - } - - // round miter - else if (miterMode == 2.) { - if (enableStartMiter == 1.) { - distToStart = distToLine(gl_FragCoord.xy, startCutoff.xy, startCutoff.zw); - if (distToStart < 0.) { - float radius = length(gl_FragCoord.xy - startCoord); - - if(radius > cutoff + .5) { - discard; - return; - } - - alpha -= smoothstep(cutoff - .5, cutoff + .5, radius); - } - } - - if (enableEndMiter == 1.) { - distToEnd = distToLine(gl_FragCoord.xy, endCutoff.xy, endCutoff.zw); - if (distToEnd < 0.) { - float radius = length(gl_FragCoord.xy - endCoord); - - if(radius > cutoff + .5) { - discard; - return; - } - - alpha -= smoothstep(cutoff - .5, cutoff + .5, radius); - } - } - } - - float t = fract(dot(tangent, gl_FragCoord.xy) / dashLength) * .5 + .25; - float dash = texture2D(dashTexture, vec2(t, .5)).r; - - gl_FragColor = fragColor; - gl_FragColor.a *= alpha * opacity * dash; -} -`]),attributes:{lineEnd:{buffer:b,divisor:0,stride:8,offset:0},lineTop:{buffer:b,divisor:0,stride:8,offset:4},aColor:{buffer:_.prop("colorBuffer"),stride:4,offset:0,divisor:1},bColor:{buffer:_.prop("colorBuffer"),stride:4,offset:4,divisor:1},prevCoord:{buffer:_.prop("positionBuffer"),stride:8,offset:0,divisor:1},aCoord:{buffer:_.prop("positionBuffer"),stride:8,offset:8,divisor:1},bCoord:{buffer:_.prop("positionBuffer"),stride:8,offset:16,divisor:1},nextCoord:{buffer:_.prop("positionBuffer"),stride:8,offset:24,divisor:1}}},k))}catch{A=w}return{fill:_({primitive:"triangle",elements:function(M,T){return T.triangles},offset:0,vert:c([`precision highp float; -#define GLSLIFY 1 - -attribute vec2 position, positionFract; - -uniform vec4 color; -uniform vec2 scale, scaleFract, translate, translateFract; -uniform float pixelRatio, id; -uniform vec4 viewport; -uniform float opacity; - -varying vec4 fragColor; - -const float MAX_LINES = 256.; - -void main() { - float depth = (MAX_LINES - 4. - id) / (MAX_LINES); - - vec2 position = position * scale + translate - + positionFract * scale + translateFract - + position * scaleFract - + positionFract * scaleFract; - - gl_Position = vec4(position * 2.0 - 1.0, depth, 1); - - fragColor = color / 255.; - fragColor.a *= opacity; -} -`]),frag:c([`precision highp float; -#define GLSLIFY 1 - -varying vec4 fragColor; - -void main() { - gl_FragColor = fragColor; -} -`]),uniforms:{scale:_.prop("scale"),color:_.prop("fill"),scaleFract:_.prop("scaleFract"),translateFract:_.prop("translateFract"),translate:_.prop("translate"),opacity:_.prop("opacity"),pixelRatio:_.context("pixelRatio"),id:_.prop("id"),viewport:function(M,T){return[T.viewport.x,T.viewport.y,M.viewportWidth,M.viewportHeight]}},attributes:{position:{buffer:_.prop("positionBuffer"),stride:8,offset:8},positionFract:{buffer:_.prop("positionFractBuffer"),stride:8,offset:8}},blend:k.blend,depth:{enable:!1},scissor:k.scissor,stencil:k.stencil,viewport:k.viewport}),rect:w,miter:A}},x.defaults={dashes:null,join:"miter",miterLimit:1,thickness:10,cap:"square",color:"black",opacity:1,overlay:!1,viewport:null,range:null,close:!1,fill:null},x.prototype.render=function(){for(var _,A=[],b=arguments.length;b--;)A[b]=arguments[b];A.length&&(_=this).update.apply(_,A),this.draw()},x.prototype.draw=function(){for(var _=this,A=[],b=arguments.length;b--;)A[b]=arguments[b];return(A.length?A:this.passes).forEach(function(k,w){var M;if(k&&Array.isArray(k))return(M=_).draw.apply(M,k);typeof k=="number"&&(k=_.passes[k]),k&&k.count>1&&k.opacity&&(_.regl._refresh(),k.fill&&k.triangles&&k.triangles.length>2&&_.shaders.fill(k),k.thickness&&(k.scale[0]*k.viewport.width>x.precisionThreshold||k.scale[1]*k.viewport.height>x.precisionThreshold||k.join==="rect"||!k.join&&(k.thickness<=2||k.count>=x.maxPoints)?_.shaders.rect(k):_.shaders.miter(k)))}),this},x.prototype.update=function(_){var A=this;if(_){_.length!=null?typeof _[0]=="number"&&(_=[{positions:_}]):Array.isArray(_)||(_=[_]);var b=this.regl,k=this.gl;if(_.forEach(function(S,P){var L=A.passes[P];if(S!==void 0)if(S!==null){if(typeof S[0]=="number"&&(S={positions:S}),S=i(S,{positions:"positions points data coords",thickness:"thickness lineWidth lineWidths line-width linewidth width stroke-width strokewidth strokeWidth",join:"lineJoin linejoin join type mode",miterLimit:"miterlimit miterLimit",dashes:"dash dashes dasharray dash-array dashArray",color:"color colour stroke colors colours stroke-color strokeColor",fill:"fill fill-color fillColor",opacity:"alpha opacity",overlay:"overlay crease overlap intersect",close:"closed close closed-path closePath",range:"range dataBox",viewport:"viewport viewBox",hole:"holes hole hollow",splitNull:"splitNull"}),L||(A.passes[P]=L={id:P,scale:null,scaleFract:null,translate:null,translateFract:null,count:0,hole:[],depth:0,dashLength:1,dashTexture:b.texture({channels:1,data:new Uint8Array([255]),width:1,height:1,mag:"linear",min:"linear"}),colorBuffer:b.buffer({usage:"dynamic",type:"uint8",data:new Uint8Array}),positionBuffer:b.buffer({usage:"dynamic",type:"float",data:new Uint8Array}),positionFractBuffer:b.buffer({usage:"dynamic",type:"float",data:new Uint8Array})},S=l({},x.defaults,S)),S.thickness!=null&&(L.thickness=parseFloat(S.thickness)),S.opacity!=null&&(L.opacity=parseFloat(S.opacity)),S.miterLimit!=null&&(L.miterLimit=parseFloat(S.miterLimit)),S.overlay!=null&&(L.overlay=!!S.overlay,P=q});(V=V.slice(0,Q)).push(q)}for(var ee=function(Lt){var Wt=W.slice(2*ne,2*V[Lt]).concat(q?W.slice(2*q):[]),Jt=(L.hole||[]).map(function(Ge){return Ge-q+(V[Lt]-ne)}),Be=u(Wt,Jt);Be=Be.map(function(Ge){return Ge+ne+(Ge+new.length)&&(M=w.length);for(var T=0,E=new Array(M);T 1.0 + delta) { - discard; - } - - alpha -= smoothstep(1.0 - delta, 1.0 + delta, radius); - - float borderRadius = fragBorderRadius; - float ratio = smoothstep(borderRadius - delta, borderRadius + delta, radius); - vec4 color = mix(fragColor, fragBorderColor, ratio); - color.a *= alpha * opacity; - gl_FragColor = color; -} -`]),F.vert=m([`precision highp float; -#define GLSLIFY 1 - -attribute float x, y, xFract, yFract; -attribute float size, borderSize; -attribute vec4 colorId, borderColorId; -attribute float isActive; - -uniform bool constPointSize; -uniform float pixelRatio; -uniform vec2 paletteSize, scale, scaleFract, translate, translateFract; -uniform sampler2D paletteTexture; - -const float maxSize = 100.; - -varying vec4 fragColor, fragBorderColor; -varying float fragBorderRadius, fragWidth; - -float pointSizeScale = (constPointSize) ? 2. : pixelRatio; - -bool isDirect = (paletteSize.x < 1.); - -vec4 getColor(vec4 id) { - return isDirect ? id / 255. : texture2D(paletteTexture, - vec2( - (id.x + .5) / paletteSize.x, - (id.y + .5) / paletteSize.y - ) - ); -} - -void main() { - // ignore inactive points - if (isActive == 0.) return; - - vec2 position = vec2(x, y); - vec2 positionFract = vec2(xFract, yFract); - - vec4 color = getColor(colorId); - vec4 borderColor = getColor(borderColorId); - - float size = size * maxSize / 255.; - float borderSize = borderSize * maxSize / 255.; - - gl_PointSize = (size + borderSize) * pointSizeScale; - - vec2 pos = (position + translate) * scale - + (positionFract + translateFract) * scale - + (position + translate) * scaleFract - + (positionFract + translateFract) * scaleFract; - - gl_Position = vec4(pos * 2. - 1., 0., 1.); - - fragBorderRadius = 1. - 2. * borderSize / (size + borderSize); - fragColor = color; - fragBorderColor = borderColor.a == 0. || borderSize == 0. ? vec4(color.rgb, 0.) : borderColor; - fragWidth = 1. / gl_PointSize; -} -`]),v&&(F.frag=F.frag.replace("smoothstep","smoothStep"),R.frag=R.frag.replace("smoothstep","smoothStep")),this.drawCircle=w(F)}b.defaults={color:"black",borderColor:"transparent",borderSize:0,size:12,opacity:1,marker:void 0,viewport:null,range:null,pixelSize:null,count:0,offset:0,bounds:null,positions:[],snap:1e4},b.prototype.render=function(){return arguments.length&&this.update.apply(this,arguments),this.draw(),this},b.prototype.draw=function(){for(var w=this,M=arguments.length,T=new Array(M),E=0;EAe)?me.tree=h(fe,{bounds:Me}):Ae&&Ae.length&&(me.tree=Ae),me.tree){var we={primitive:"points",usage:"static",data:me.tree,type:"uint32"};me.elements?me.elements(we):me.elements=L.elements(we)}var Ce=x.float32(fe);return ke({data:Ce,usage:"dynamic"}),Le({data:x.fract32(fe,Ce),usage:"dynamic"}),de({data:new Uint8Array(ve),type:"uint8",usage:"stream"}),fe}},{marker:function(fe,me,_e){var Ae=me.activation;if(Ae.forEach(function(Ce){return Ce&&Ce.destroy&&Ce.destroy()}),Ae.length=0,fe&&typeof fe[0]!="number"){for(var ke=[],Le=0,de=Math.min(fe.length,me.count);Le=0)return P;if(w instanceof Uint8Array||w instanceof Uint8ClampedArray)M=w;else{M=new Uint8Array(w.length);for(var L=0,R=w.length;L4*E&&(this.tooManyColors=!0),this.updatePalette(T),S.length===1?S[0]:S},b.prototype.updatePalette=function(w){if(!this.tooManyColors){var M=this.maxColors,T=this.paletteTexture,E=Math.ceil(.25*w.length/M);if(E>1)for(var S=.25*(w=w.slice()).length%M;S2?(k[0],k[2],x=k[1],_=k[3]):k.length?(x=k[0],_=k[1]):(k.x,x=k.y,k.x+k.width,_=k.y+k.height),w.length>2?(A=w[0],b=w[2],w[1],w[3]):w.length?(A=w[0],b=w[1]):(A=w.x,w.y,b=w.x+w.width,w.y+w.height),[A,x,b,_]}function p(g){if(typeof g=="number")return[g,g,g,g];if(g.length===2)return[g[0],g[1],g[0],g[1]];var y=s(g);return[y.x,y.y,y.x+y.width,y.y+y.height]}o.exports=h,h.prototype.render=function(){for(var g,y=this,v=[],x=arguments.length;x--;)v[x]=arguments[x];return v.length&&(g=this).update.apply(g,v),this.regl.attributes.preserveDrawingBuffer?this.draw():(this.dirty?this.planned==null&&(this.planned=c(function(){y.draw(),y.dirty=!0,y.planned=null})):(this.draw(),this.dirty=!0,c(function(){y.dirty=!1})),this)},h.prototype.update=function(){for(var g,y=[],v=arguments.length;v--;)y[v]=arguments[v];if(y.length){for(var x=0;xD))&&(A.lower||!(F"u"?1:window.devicePixelRatio,Ut=!1,tt={},bt=function(Et){},Ft=function(){};if(typeof ot=="string"?Pe=document.querySelector(ot):typeof ot=="object"&&(typeof ot.nodeName=="string"&&typeof ot.appendChild=="function"&&typeof ot.getBoundingClientRect=="function"?Pe=ot:typeof ot.drawArrays=="function"||typeof ot.drawElements=="function"?rt=(lt=ot).canvas:("gl"in ot?lt=ot.gl:"canvas"in ot?rt=c(ot.canvas):"container"in ot&&(qe=c(ot.container)),"attributes"in ot&&(Te=ot.attributes),"extensions"in ot&&(At=l(ot.extensions)),"optionalExtensions"in ot&&(wt=l(ot.optionalExtensions)),"onDone"in ot&&(bt=ot.onDone),"profile"in ot&&(Ut=!!ot.profile),"pixelRatio"in ot&&($t=+ot.pixelRatio),"cachedCode"in ot&&(tt=ot.cachedCode))),Pe&&(Pe.nodeName.toLowerCase()==="canvas"?rt=Pe:qe=Pe),!lt){if(!rt){if(!(Pe=function(Et,Pt,De){function Je(){var It=window.innerWidth,Zt=window.innerHeight;Et!==document.body&&(It=(Zt=St.getBoundingClientRect()).right-Zt.left,Zt=Zt.bottom-Zt.top),St.width=De*It,St.height=De*Zt}var st,St=document.createElement("canvas");return q(St.style,{border:0,margin:0,padding:0,top:0,left:0,width:"100%",height:"100%"}),Et.appendChild(St),Et===document.body&&(St.style.position="absolute",q(Et.style,{margin:0,padding:0})),Et!==document.body&&typeof ResizeObserver=="function"?(st=new ResizeObserver(function(){setTimeout(Je)})).observe(Et):window.addEventListener("resize",Je,!1),Je(),{canvas:St,onDestroy:function(){st?st.disconnect():window.removeEventListener("resize",Je),Et.removeChild(St)}}}(qe||document.body,0,$t)))return null;rt=Pe.canvas,Ft=Pe.onDestroy}Te.premultipliedAlpha===void 0&&(Te.premultipliedAlpha=!0),lt=function(Et,Pt){function De(Je){try{return Et.getContext(Je,Pt)}catch{return null}}return De("webgl")||De("experimental-webgl")||De("webgl-experimental")}(rt,Te)}return lt?{gl:lt,canvas:rt,container:qe,extensions:At,optionalExtensions:wt,pixelRatio:$t,profile:Ut,cachedCode:tt,onDone:bt,onDestroy:Ft}:(Ft(),bt("webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org"),null)}function s(Te,Pe){for(var qe=Array(Te),rt=0;rt>>=Pe))<<3,(Pe|=qe=(15<(Te>>>=qe))<<2)|(qe=(3<(Te>>>=qe))<<1)|Te>>>qe>>1}function h(){function Te(rt){e:{for(var lt=16;268435456>=lt;lt*=16)if(rt<=lt){rt=lt;break e}rt=0}return 0<(lt=qe[u(rt)>>2]).length?lt.pop():new ArrayBuffer(rt)}function Pe(rt){qe[u(rt.byteLength)>>2].push(rt)}var qe=s(8,function(){return[]});return{alloc:Te,free:Pe,allocType:function(rt,lt){var ot=null;switch(rt){case 5120:ot=new Int8Array(Te(lt),0,lt);break;case 5121:ot=new Uint8Array(Te(lt),0,lt);break;case 5122:ot=new Int16Array(Te(2*lt),0,lt);break;case 5123:ot=new Uint16Array(Te(2*lt),0,lt);break;case 5124:ot=new Int32Array(Te(4*lt),0,lt);break;case 5125:ot=new Uint32Array(Te(4*lt),0,lt);break;case 5126:ot=new Float32Array(Te(4*lt),0,lt);break;default:return null}return ot.length!==lt?ot.subarray(0,lt):ot},freeType:function(rt){Pe(rt.buffer)}}}function d(Te){return!!Te&&typeof Te=="object"&&Array.isArray(Te.shape)&&Array.isArray(Te.stride)&&typeof Te.offset=="number"&&Te.shape.length===Te.stride.length&&(Array.isArray(Te.data)||ge(Te.data))}function m(Te,Pe,qe,rt,lt,ot){for(var At=0;At(Ft=De)&&(Ft=bt.buffer.byteLength,St===5123?Ft>>=1:St===5125&&(Ft>>=2)),bt.vertCount=Ft,Ft=Pt,0>Pt&&(Ft=4,(Pt=bt.buffer.dimension)===1&&(Ft=0),Pt===2&&(Ft=1),Pt===3&&(Ft=4)),bt.primType=Ft}function At(bt){rt.elementsCount--,delete wt[bt.id],bt.buffer.destroy(),bt.buffer=null}var wt={},$t=0,Ut={uint8:5121,uint16:5123};Pe.oes_element_index_uint&&(Ut.uint32=5125),lt.prototype.bind=function(){this.buffer.bind()};var tt=[];return{create:function(bt,Ft){function Et(Je){if(Je)if(typeof Je=="number")Pt(Je),De.primType=4,De.vertCount=0|Je,De.type=5121;else{var st=null,St=35044,It=-1,Zt=-1,Kt=0,qt=0;Array.isArray(Je)||ge(Je)||d(Je)?st=Je:("data"in Je&&(st=Je.data),"usage"in Je&&(St=ke[Je.usage]),"primitive"in Je&&(It=Me[Je.primitive]),"count"in Je&&(Zt=0|Je.count),"type"in Je&&(qt=Ut[Je.type]),"length"in Je?Kt=0|Je.length:(Kt=Zt,qt===5123||qt===5122?Kt*=2:qt!==5125&&qt!==5124||(Kt*=4))),ot(De,st,St,It,Zt,Kt,qt)}else Pt(),De.primType=4,De.vertCount=0,De.type=5121;return Et}var Pt=qe.create(null,34963,!0),De=new lt(Pt._buffer);return rt.elementsCount++,Et(bt),Et._reglType="elements",Et._elements=De,Et.subdata=function(Je,st){return Pt.subdata(Je,st),Et},Et.destroy=function(){At(De)},Et},createStream:function(bt){var Ft=tt.pop();return Ft||(Ft=new lt(qe.create(null,34963,!0,!1)._buffer)),ot(Ft,bt,35040,-1,-1,0,0),Ft},destroyStream:function(bt){tt.push(bt)},getElements:function(bt){return typeof bt=="function"&&bt._elements instanceof lt?bt._elements:null},clear:function(){fe(wt).forEach(At)}}}function _(Te){for(var Pe=ue.allocType(5123,Te.length),qe=0;qe>>31<<15,lt=(ot<<1>>>24)-127,ot=ot>>13&1023;Pe[qe]=-24>lt?rt:-14>lt?rt+(ot+1024>>-14-lt):15>=vn,jt.height>>=vn,Ft(jt,fn[vn]),cn.mipmask|=1<jn;++jn)cn.images[jn]=null;return cn}function Kt(cn){for(var jn=cn.images,jt=0;jtcn){for(var jn=0;jn=--this.refCount&&sn(this)}}),At.profile&&(ot.getTotalTextureSize=function(){var cn=0;return Object.keys(pr).forEach(function(jn){cn+=pr[jn].stats.size}),cn}),{create2D:function(cn,jn){function jt(vn,Hn){var Un=fn.texInfo;qt.call(Un);var Nn=Zt();return typeof vn=="number"?st(Nn,0|vn,typeof Hn=="number"?0|Hn:0|vn):vn?(mn(Un,vn),St(Nn,vn)):st(Nn,1,1),Un.genMipmaps&&(Nn.mipmask=(Nn.width<<1)-1),fn.mipmask=Nn.mipmask,$t(fn,Nn),fn.internalformat=Nn.internalformat,jt.width=Nn.width,jt.height=Nn.height,tn(fn),It(Nn,3553),Fn(Un,3553),nn(),Kt(Nn),At.profile&&(fn.stats.size=S(fn.internalformat,fn.type,Nn.width,Nn.height,Un.genMipmaps,!1)),jt.format=Dn[fn.internalformat],jt.type=lr[fn.type],jt.mag=Yr[Un.magFilter],jt.min=Mn[Un.minFilter],jt.wrapS=rr[Un.wrapS],jt.wrapT=rr[Un.wrapT],jt}var fn=new pn(3553);return pr[fn.id]=fn,ot.textureCount++,jt(cn,jn),jt.subimage=function(vn,Hn,Un,Nn){Hn|=0,Un|=0,Nn|=0;var Rn=Pt();return $t(Rn,fn),Rn.width=0,Rn.height=0,Ft(Rn,vn),Rn.width=Rn.width||(fn.width>>Nn)-Hn,Rn.height=Rn.height||(fn.height>>Nn)-Un,tn(fn),Et(Rn,3553,Hn,Un,Nn),nn(),De(Rn),jt},jt.resize=function(vn,Hn){var Un=0|vn,Nn=0|Hn||Un;if(Un===fn.width&&Nn===fn.height)return jt;jt.width=fn.width=Un,jt.height=fn.height=Nn,tn(fn);for(var Rn=0;fn.mipmask>>Rn;++Rn){var wn=Un>>Rn,An=Nn>>Rn;if(!wn||!An)break;Te.texImage2D(3553,Rn,fn.format,wn,An,0,fn.format,fn.type,null)}return nn(),At.profile&&(fn.stats.size=S(fn.internalformat,fn.type,Un,Nn,!1,!1)),jt},jt._reglType="texture2d",jt._texture=fn,At.profile&&(jt.stats=fn.stats),jt.destroy=function(){fn.decRef()},jt},createCube:function(cn,jn,jt,fn,vn,Hn){function Un(wn,An,kn,Pn,Zn,Yn){var ir,or=Nn.texInfo;for(qt.call(or),ir=0;6>ir;++ir)Rn[ir]=Zt();if(typeof wn!="number"&&wn){if(typeof wn=="object")if(An)St(Rn[0],wn),St(Rn[1],An),St(Rn[2],kn),St(Rn[3],Pn),St(Rn[4],Zn),St(Rn[5],Yn);else if(mn(or,wn),Ut(Nn,wn),"faces"in wn)for(wn=wn.faces,ir=0;6>ir;++ir)$t(Rn[ir],Nn),St(Rn[ir],wn[ir]);else for(ir=0;6>ir;++ir)St(Rn[ir],wn)}else for(wn=0|wn||1,ir=0;6>ir;++ir)st(Rn[ir],wn,wn);for($t(Nn,Rn[0]),Nn.mipmask=or.genMipmaps?(Rn[0].width<<1)-1:Rn[0].mipmask,Nn.internalformat=Rn[0].internalformat,Un.width=Rn[0].width,Un.height=Rn[0].height,tn(Nn),ir=0;6>ir;++ir)It(Rn[ir],34069+ir);for(Fn(or,34067),nn(),At.profile&&(Nn.stats.size=S(Nn.internalformat,Nn.type,Un.width,Un.height,or.genMipmaps,!0)),Un.format=Dn[Nn.internalformat],Un.type=lr[Nn.type],Un.mag=Yr[or.magFilter],Un.min=Mn[or.minFilter],Un.wrapS=rr[or.wrapS],Un.wrapT=rr[or.wrapT],ir=0;6>ir;++ir)Kt(Rn[ir]);return Un}var Nn=new pn(34067);pr[Nn.id]=Nn,ot.cubeCount++;var Rn=Array(6);return Un(cn,jn,jt,fn,vn,Hn),Un.subimage=function(wn,An,kn,Pn,Zn){kn|=0,Pn|=0,Zn|=0;var Yn=Pt();return $t(Yn,Nn),Yn.width=0,Yn.height=0,Ft(Yn,An),Yn.width=Yn.width||(Nn.width>>Zn)-kn,Yn.height=Yn.height||(Nn.height>>Zn)-Pn,tn(Nn),Et(Yn,34069+wn,kn,Pn,Zn),nn(),De(Yn),Un},Un.resize=function(wn){if((wn|=0)!==Nn.width){Un.width=Nn.width=wn,Un.height=Nn.height=wn,tn(Nn);for(var An=0;6>An;++An)for(var kn=0;Nn.mipmask>>kn;++kn)Te.texImage2D(34069+An,kn,Nn.format,wn>>kn,wn>>kn,0,Nn.format,Nn.type,null);return nn(),At.profile&&(Nn.stats.size=S(Nn.internalformat,Nn.type,Un.width,Un.height,!1,!0)),Un}},Un._reglType="textureCube",Un._texture=Nn,At.profile&&(Un.stats=Nn.stats),Un.destroy=function(){Nn.decRef()},Un},clear:function(){for(var cn=0;cnfn;++fn)if(jt.mipmask&1<>fn,jt.height>>fn,0,jt.internalformat,jt.type,null);else for(var vn=0;6>vn;++vn)Te.texImage2D(34069+vn,fn,jt.internalformat,jt.width>>fn,jt.height>>fn,0,jt.internalformat,jt.type,null);Fn(jt.texInfo,jt.target)})},refresh:function(){for(var cn=0;cngn;++gn){for(ar=0;arsn;++sn)nn[sn].resize(gn);return tn.width=tn.height=gn,tn},_reglType:"framebufferCube",destroy:function(){nn.forEach(function(sn){sn.destroy()})}})},clear:function(){fe(Fn).forEach(Je)},restore:function(){It.cur=null,It.next=null,It.dirty=!0,fe(Fn).forEach(function(pn){pn.framebuffer=Te.createFramebuffer(),st(pn)})}})}function R(){this.w=this.z=this.y=this.x=this.state=0,this.buffer=null,this.size=0,this.normalized=!1,this.type=5126,this.divisor=this.stride=this.offset=0}function F(Te,Pe,qe,rt,lt,ot,At){function wt(){this.id=++tt,this.attributes=[],this.elements=null,this.ownsElements=!1,this.offset=this.count=0,this.instances=-1,this.primitive=4;var Et=Pe.oes_vertex_array_object;this.vao=Et?Et.createVertexArrayOES():null,bt[this.id]=this,this.buffers=[]}var $t=qe.maxAttributes,Ut=Array($t);for(qe=0;qe<$t;++qe)Ut[qe]=new R;var tt=0,bt={},Ft={Record:R,scope:{},state:Ut,currentVAO:null,targetVAO:null,restore:Pe.oes_vertex_array_object?function(){Pe.oes_vertex_array_object&&fe(bt).forEach(function(Et){Et.refresh()})}:function(){},createVAO:function(Et){function Pt(Je){var st;Array.isArray(Je)?(st=Je,De.elements&&De.ownsElements&&De.elements.destroy(),De.elements=null,De.ownsElements=!1,De.offset=0,De.count=0,De.instances=-1,De.primitive=4):(Je.elements?(st=Je.elements,De.ownsElements?(typeof st=="function"&&st._reglType==="elements"?De.elements.destroy():De.elements(st),De.ownsElements=!1):ot.getElements(Je.elements)?(De.elements=Je.elements,De.ownsElements=!1):(De.elements=ot.create(Je.elements),De.ownsElements=!0)):(De.elements=null,De.ownsElements=!1),st=Je.attributes,De.offset=0,De.count=-1,De.instances=-1,De.primitive=4,De.elements&&(De.count=De.elements._elements.vertCount,De.primitive=De.elements._elements.primType),"offset"in Je&&(De.offset=0|Je.offset),"count"in Je&&(De.count=0|Je.count),"instances"in Je&&(De.instances=0|Je.instances),"primitive"in Je&&(De.primitive=Me[Je.primitive])),Je={};var St=De.attributes;St.length=st.length;for(var It=0;It=mn.byteLength?Zt.subdata(mn):(Zt.destroy(),De.buffers[It]=null)),De.buffers[It]||(Zt=De.buffers[It]=lt.create(Kt,34962,!1,!0)),qt.buffer=lt.getBuffer(Zt),qt.size=0|qt.buffer.dimension,qt.normalized=!1,qt.type=qt.buffer.dtype,qt.offset=0,qt.stride=0,qt.divisor=0,qt.state=1,Je[It]=1):lt.getBuffer(Kt)?(qt.buffer=lt.getBuffer(Kt),qt.size=0|qt.buffer.dimension,qt.normalized=!1,qt.type=qt.buffer.dtype,qt.offset=0,qt.stride=0,qt.divisor=0,qt.state=1):lt.getBuffer(Kt.buffer)?(qt.buffer=lt.getBuffer(Kt.buffer),qt.size=0|(+Kt.size||qt.buffer.dimension),qt.normalized=!!Kt.normalized||!1,qt.type="type"in Kt?Ae[Kt.type]:qt.buffer.dtype,qt.offset=0|(Kt.offset||0),qt.stride=0|(Kt.stride||0),qt.divisor=0|(Kt.divisor||0),qt.state=1):"x"in Kt&&(qt.x=+Kt.x||0,qt.y=+Kt.y||0,qt.z=+Kt.z||0,qt.w=+Kt.w||0,qt.state=2)}for(Zt=0;ZtPt&&(Pt=De.stats.uniformsCount)}),Pt},qe.getMaxAttributesCount=function(){var Pt=0;return Ft.forEach(function(De){De.stats.attributesCount>Pt&&(Pt=De.stats.attributesCount)}),Pt}),{clear:function(){var Pt=Te.deleteShader.bind(Te);fe(Ut).forEach(Pt),Ut={},fe(tt).forEach(Pt),tt={},Ft.forEach(function(De){Te.deleteProgram(De.program)}),Ft.length=0,bt={},qe.shaderCount=0},program:function(Pt,De,Je,st){var St=bt[De];St||(St=bt[De]={});var It=St[Pt];if(It&&(It.refCount++,!st))return It;var Zt=new wt(De,Pt);return qe.shaderCount++,$t(Zt,Je,st),It||(St[Pt]=Zt),Ft.push(Zt),q(Zt,{destroy:function(){if(Zt.refCount--,0>=Zt.refCount){Te.deleteProgram(Zt.program);var Kt=Ft.indexOf(Zt);Ft.splice(Kt,1),qe.shaderCount--}0>=St[Zt.vertId].refCount&&(Te.deleteShader(tt[Zt.vertId]),delete tt[Zt.vertId],delete bt[Zt.fragId][Zt.vertId]),Object.keys(bt[Zt.fragId]).length||(Te.deleteShader(Ut[Zt.fragId]),delete Ut[Zt.fragId],delete bt[Zt.fragId])}})},restore:function(){Ut={},tt={};for(var Pt=0;Pt>>Pe|Te<<32-Pe}function B(Te,Pe){var qe=(65535&Te)+(65535&Pe);return(Te>>16)+(Pe>>16)+(qe>>16)<<16|65535&qe}function W(Te){return Array.prototype.slice.call(Te)}function G(Te){return W(Te).join("")}function K(Te){function Pe(){var tt=[],bt=[];return q(function(){tt.push.apply(tt,W(arguments))},{def:function(){var Ft="v"+lt++;return bt.push(Ft),0>>4&15)+"0123456789abcdef".charAt(15&Pt);return De}(function(Et){for(var Pt=Array(Et.length>>2),De=0;De>5]|=(255&Et.charCodeAt(De/8))<<24-De%32;var Je,st,St,It,Zt,Kt,qt,mn,Fn,pn,tn,nn=8*Et.length;for(Et=[1779033703,-1150833019,1013904242,-1521486534,1359893119,-1694144372,528734635,1541459225],De=Array(64),Pt[nn>>5]|=128<<24-nn%32,Pt[15+(nn+64>>9<<4)]=nn,mn=0;mnFn;Fn++){var sn;16>Fn?De[Fn]=Pt[Fn+mn]:(pn=Fn,tn=B(tn=N(tn=De[Fn-2],17)^N(tn,19)^tn>>>10,De[Fn-7]),sn=N(sn=De[Fn-15],7)^N(sn,18)^sn>>>3,De[pn]=B(B(tn,sn),De[Fn-16])),pn=B(B(B(B(qt,pn=N(pn=It,6)^N(pn,11)^N(pn,25)),It&Zt^~It&Kt),Wt[Fn]),De[Fn]),tn=B(qt=N(qt=nn,2)^N(qt,13)^N(qt,22),nn&Je^nn&st^Je&st),qt=Kt,Kt=Zt,Zt=It,It=B(St,pn),St=st,st=Je,Je=nn,nn=B(pn,tn)}Et[0]=B(nn,Et[0]),Et[1]=B(Je,Et[1]),Et[2]=B(st,Et[2]),Et[3]=B(St,Et[3]),Et[4]=B(It,Et[4]),Et[5]=B(Zt,Et[5]),Et[6]=B(Kt,Et[6]),Et[7]=B(qt,Et[7])}for(Pt="",De=0;De<32*Et.length;De+=8)Pt+=String.fromCharCode(Et[De>>5]>>>24-De%32&255);return Pt}(function(Et){for(var Pt,De,Je="",st=-1;++st=Pt&&56320<=De&&57343>=De&&(Pt=65536+((1023&Pt)<<10)+(1023&De),st++),127>=Pt?Je+=String.fromCharCode(Pt):2047>=Pt?Je+=String.fromCharCode(192|Pt>>>6&31,128|63&Pt):65535>=Pt?Je+=String.fromCharCode(224|Pt>>>12&15,128|Pt>>>6&63,128|63&Pt):2097151>=Pt&&(Je+=String.fromCharCode(240|Pt>>>18&7,128|Pt>>>12&63,128|Pt>>>6&63,128|63&Pt));return Je}(Ft))),rt[bt])?rt[bt].apply(null,At):(Ft=Function.apply(null,ot.concat(Ft)),rt&&(rt[bt]=Ft),Ft.apply(null,At))}}}function te(Te){return Array.isArray(Te)||ge(Te)||d(Te)}function Y(Te){return Te.sort(function(Pe,qe){return Pe==="viewport"?-1:qe==="viewport"?1:Pe"+Br+"?"+Pn+".constant["+Br+"]:0;"}).join(""),"}}else{","if(",ir,"(",Pn,".buffer)){",wr,"=",Zn,".createStream(",34962,",",Pn,".buffer);","}else{",wr,"=",Zn,".getBuffer(",Pn,".buffer);","}",Ar,'="type" in ',Pn,"?",Yn.glTypes,"[",Pn,".type]:",wr,".dtype;",or.normalized,"=!!",Pn,".normalized;"),kn("size"),kn("offset"),kn("stride"),kn("divisor"),An("}}"),An.exit("if(",or.isStream,"){",Zn,".destroyStream(",wr,");","}"),or})}),Un}function Fn(jt,fn,vn,Hn,Un){function Nn(xr){var wr=wn[xr];wr&&(kn[xr]=wr)}var Rn=function(xr,wr){if(typeof(Ar=xr.static).frag=="string"&&typeof Ar.vert=="string"){if(0"u"?"Date.now()":"performance.now()"}function Rn(xr){xr(kn=fn.def(),"=",Nn(),";"),typeof Un=="string"?xr(Yn,".count+=",Un,";"):xr(Yn,".count++;"),Et&&(Hn?xr(Pn=fn.def(),"=",or,".getNumPendingQueries();"):xr(or,".beginQuery(",Yn,");"))}function wn(xr){xr(Yn,".cpuTime+=",Nn(),"-",kn,";"),Et&&(Hn?xr(or,".pushScopeStats(",Pn,",",or,".getNumPendingQueries(),",Yn,");"):xr(or,".endQuery();"))}function An(xr){var wr=fn.def(ir,".profile");fn(ir,".profile=",xr,";"),fn.exit(ir,".profile=",wr,";")}var kn,Pn,Zn=jt.shared,Yn=jt.stats,ir=Zn.current,or=Zn.timer;if(vn=vn.profile){if(re(vn))return void(vn.enable?(Rn(fn),wn(fn.exit),An("true")):An("false"));An(vn=vn.append(jt,fn))}else vn=fn.def(ir,".profile");Rn(Zn=jt.block()),fn("if(",vn,"){",Zn,"}"),wn(jt=jt.block()),fn.exit("if(",vn,"){",jt,"}")}function In(jt,fn,vn,Hn,Un){function Nn(wn,An,kn){function Pn(){fn("if(!",or,".buffer){",Yn,".enableVertexAttribArray(",ir,");}");var Ir,Br=kn.type;Ir=kn.size?fn.def(kn.size,"||",An):An,fn("if(",or,".type!==",Br,"||",or,".size!==",Ir,"||",Ar.map(function(ai){return or+"."+ai+"!=="+kn[ai]}).join("||"),"){",Yn,".bindBuffer(",34962,",",xr,".buffer);",Yn,".vertexAttribPointer(",[ir,Ir,Br,kn.normalized,kn.stride,kn.offset],");",or,".type=",Br,";",or,".size=",Ir,";",Ar.map(function(ai){return or+"."+ai+"="+kn[ai]+";"}).join(""),"}"),Mn&&(Br=kn.divisor,fn("if(",or,".divisor!==",Br,"){",jt.instancing,".vertexAttribDivisorANGLE(",[ir,Br],");",or,".divisor=",Br,";}"))}function Zn(){fn("if(",or,".buffer){",Yn,".disableVertexAttribArray(",ir,");",or,".buffer=null;","}if(",Jt.map(function(Ir,Br){return or+"."+Ir+"!=="+wr[Br]}).join("||"),"){",Yn,".vertexAttrib4f(",ir,",",wr,");",Jt.map(function(Ir,Br){return or+"."+Ir+"="+wr[Br]+";"}).join(""),"}")}var Yn=Rn.gl,ir=fn.def(wn,".location"),or=fn.def(Rn.attributes,"[",ir,"]");wn=kn.state;var xr=kn.buffer,wr=[kn.x,kn.y,kn.z,kn.w],Ar=["buffer","normalized","offset","stride"];wn===1?Pn():wn===2?Zn():(fn("if(",wn,"===",1,"){"),Pn(),fn("}else{"),Zn(),fn("}"))}var Rn=jt.shared;Hn.forEach(function(wn){var An,kn=wn.name,Pn=vn.attributes[kn];if(Pn){if(!Un(Pn))return;An=Pn.append(jt,fn)}else{if(!Un(Ie))return;var Zn=jt.scopeAttrib(kn);An={},Object.keys(new lr).forEach(function(Yn){An[Yn]=fn.def(Zn,".",Yn)})}Nn(jt.link(wn),function(Yn){switch(Yn){case 35664:case 35667:case 35671:return 2;case 35665:case 35668:case 35672:return 3;case 35666:case 35669:case 35673:return 4;default:return 1}}(wn.info.type),An)})}function qn(jt,fn,vn,Hn,Un,Nn){for(var Rn,wn=jt.shared,An=wn.gl,kn=0;kn>1)",wn],");")}function ai(){vn(An,".drawArraysInstancedANGLE(",[or,xr,wr,wn],");")}ir&&ir!=="null"?Ir?Br():(vn("if(",ir,"){"),Br(),vn("}else{"),ai(),vn("}")):ai()}function Rn(){function Br(){vn(Pn+".drawElements("+[or,wr,Ar,xr+"<<(("+Ar+"-5121)>>1)"]+");")}function ai(){vn(Pn+".drawArrays("+[or,xr,wr]+");")}ir&&ir!=="null"?Ir?Br():(vn("if(",ir,"){"),Br(),vn("}else{"),ai(),vn("}")):ai()}var wn,An,kn=jt.shared,Pn=kn.gl,Zn=kn.draw,Yn=Hn.draw,ir=function(){var Br=Yn.elements,ai=fn;return Br?((Br.contextDep&&Hn.contextDynamic||Br.propDep)&&(ai=vn),Br=Br.append(jt,ai),Yn.elementsActive&&ai("if("+Br+")"+Pn+".bindBuffer(34963,"+Br+".buffer.buffer);")):(Br=ai.def(),ai(Br,"=",Zn,".","elements",";","if(",Br,"){",Pn,".bindBuffer(",34963,",",Br,".buffer.buffer);}","else if(",kn.vao,".currentVAO){",Br,"=",jt.shared.elements+".getElements("+kn.vao,".currentVAO.elements);",nr?"":"if("+Br+")"+Pn+".bindBuffer(34963,"+Br+".buffer.buffer);","}")),Br}(),or=Un("primitive"),xr=Un("offset"),wr=function(){var Br=Yn.count,ai=fn;return Br?((Br.contextDep&&Hn.contextDynamic||Br.propDep)&&(ai=vn),Br=Br.append(jt,ai)):Br=ai.def(Zn,".","count"),Br}();if(typeof wr=="number"){if(wr===0)return}else vn("if(",wr,"){"),vn.exit("}");Mn&&(wn=Un("instances"),An=jt.instancing);var Ar=ir+".type",Ir=Yn.elements&&re(Yn.elements)&&!Yn.vaoActive;Mn&&(typeof wn!="number"||0<=wn)?typeof wn=="string"?(vn("if(",wn,">0){"),Nn(),vn("}else if(",wn,"<0){"),Rn(),vn("}")):Nn():Rn()}function ar(jt,fn,vn,Hn,Un){return Un=(fn=It()).proc("body",Un),Mn&&(fn.instancing=Un.def(fn.shared.extensions,".angle_instanced_arrays")),jt(fn,Un,vn,Hn),fn.compile().body}function Dr(jt,fn,vn,Hn){gn(jt,fn),vn.useVAO?vn.drawVAO?fn(jt.shared.vao,".setVAO(",vn.drawVAO.append(jt,fn),");"):fn(jt.shared.vao,".setVAO(",jt.shared.vao,".targetVAO);"):(fn(jt.shared.vao,".setVAO(null);"),In(jt,fn,vn,Hn.attributes,function(){return!0})),qn(jt,fn,vn,Hn.uniforms,function(){return!0},!1),Wn(jt,fn,fn,vn)}function yr(jt,fn,vn,Hn){function Un(){return!0}jt.batchId="a1",gn(jt,fn),In(jt,fn,vn,Hn.attributes,Un),qn(jt,fn,vn,Hn.uniforms,Un,!1),Wn(jt,fn,fn,vn)}function Sr(jt,fn,vn,Hn){function Un(Zn){return Zn.contextDep&&Rn||Zn.propDep}function Nn(Zn){return!Un(Zn)}gn(jt,fn);var Rn=vn.contextDep,wn=fn.def(),An=fn.def();jt.shared.props=An,jt.batchId=wn;var kn=jt.scope(),Pn=jt.scope();fn(kn.entry,"for(",wn,"=0;",wn,"<","a1",";++",wn,"){",An,"=","a0","[",wn,"];",Pn,"}",kn.exit),vn.needsContext&&pn(jt,Pn,vn.context),vn.needsFramebuffer&&tn(jt,Pn,vn.framebuffer),sn(jt,Pn,vn.state,Un),vn.profile&&Un(vn.profile)&&bn(jt,Pn,vn,!1,!0),Hn?(vn.useVAO?vn.drawVAO?Un(vn.drawVAO)?Pn(jt.shared.vao,".setVAO(",vn.drawVAO.append(jt,Pn),");"):kn(jt.shared.vao,".setVAO(",vn.drawVAO.append(jt,kn),");"):kn(jt.shared.vao,".setVAO(",jt.shared.vao,".targetVAO);"):(kn(jt.shared.vao,".setVAO(null);"),In(jt,kn,vn,Hn.attributes,Nn),In(jt,Pn,vn,Hn.attributes,Un)),qn(jt,kn,vn,Hn.uniforms,Nn,!1),qn(jt,Pn,vn,Hn.uniforms,Un,!0),Wn(jt,kn,Pn,vn)):(fn=jt.global.def("{}"),Hn=vn.shader.progVar.append(jt,Pn),An=Pn.def(Hn,".id"),kn=Pn.def(fn,"[",An,"]"),Pn(jt.shared.gl,".useProgram(",Hn,".program);","if(!",kn,"){",kn,"=",fn,"[",An,"]=",jt.link(function(Zn){return ar(yr,jt,vn,Zn,2)}),"(",Hn,");}",kn,".call(this,a0[",wn,"],",wn,");"))}function Kn(jt,fn){function vn(wn){var An=fn.shader[wn];An&&(An=An.append(jt,Hn),isNaN(An)?Hn.set(Un.shader,"."+wn,An):Hn.set(Un.shader,"."+wn,jt.link(An,{stable:!0})))}var Hn=jt.proc("scope",3);jt.batchId="a2";var Un=jt.shared,Nn=Un.current;if(pn(jt,Hn,fn.context),fn.framebuffer&&fn.framebuffer.append(jt,Hn),Y(Object.keys(fn.state)).forEach(function(wn){var An=fn.state[wn],kn=An.append(jt,Hn);A(kn)?kn.forEach(function(Pn,Zn){isNaN(Pn)?Hn.set(jt.next[wn],"["+Zn+"]",Pn):Hn.set(jt.next[wn],"["+Zn+"]",jt.link(Pn,{stable:!0}))}):re(An)?Hn.set(Un.next,"."+wn,jt.link(kn,{stable:!0})):Hn.set(Un.next,"."+wn,kn)}),bn(jt,Hn,fn,!0,!0),["elements","offset","count","instances","primitive"].forEach(function(wn){var An=fn.draw[wn];An&&(An=An.append(jt,Hn),isNaN(An)?Hn.set(Un.draw,"."+wn,An):Hn.set(Un.draw,"."+wn,jt.link(An),{stable:!0}))}),Object.keys(fn.uniforms).forEach(function(wn){var An=fn.uniforms[wn].append(jt,Hn);Array.isArray(An)&&(An="["+An.map(function(kn){return isNaN(kn)?kn:jt.link(kn,{stable:!0})})+"]"),Hn.set(Un.uniforms,"["+jt.link(Pe.id(wn),{stable:!0})+"]",An)}),Object.keys(fn.attributes).forEach(function(wn){var An=fn.attributes[wn].append(jt,Hn),kn=jt.scopeAttrib(wn);Object.keys(new lr).forEach(function(Pn){Hn.set(kn,"."+Pn,An[Pn])})}),fn.scopeVAO){var Rn=fn.scopeVAO.append(jt,Hn);isNaN(Rn)?Hn.set(Un.vao,".targetVAO",Rn):Hn.set(Un.vao,".targetVAO",jt.link(Rn,{stable:!0}))}vn("vert"),vn("frag"),0=--this.refCount&&At(this)},lt.profile&&(rt.getTotalRenderbufferSize=function(){var bt=0;return Object.keys(tt).forEach(function(Ft){bt+=tt[Ft].stats.size}),bt}),{create:function(bt,Ft){function Et(De,Je){var st=0,St=0,It=32854;if(typeof De=="object"&&De?("shape"in De?(st=0|(St=De.shape)[0],St=0|St[1]):("radius"in De&&(st=St=0|De.radius),"width"in De&&(st=0|De.width),"height"in De&&(St=0|De.height)),"format"in De&&(It=wt[De.format])):typeof De=="number"?(st=0|De,St=typeof Je=="number"?0|Je:st):De||(st=St=1),st!==Pt.width||St!==Pt.height||It!==Pt.format)return Et.width=Pt.width=st,Et.height=Pt.height=St,Pt.format=It,Te.bindRenderbuffer(36161,Pt.renderbuffer),Te.renderbufferStorage(36161,It,st,St),lt.profile&&(Pt.stats.size=Tt[Pt.format]*Pt.width*Pt.height),Et.format=$t[Pt.format],Et}var Pt=new ot(Te.createRenderbuffer());return tt[Pt.id]=Pt,rt.renderbufferCount++,Et(bt,Ft),Et.resize=function(De,Je){var st=0|De,St=0|Je||st;return st===Pt.width&&St===Pt.height||(Et.width=Pt.width=st,Et.height=Pt.height=St,Te.bindRenderbuffer(36161,Pt.renderbuffer),Te.renderbufferStorage(36161,Pt.format,st,St),lt.profile&&(Pt.stats.size=Tt[Pt.format]*Pt.width*Pt.height)),Et},Et._reglType="renderbuffer",Et._renderbuffer=Pt,lt.profile&&(Et.stats=Pt.stats),Et.destroy=function(){Pt.decRef()},Et},clear:function(){fe(tt).forEach(At)},restore:function(){fe(tt).forEach(function(bt){bt.renderbuffer=Te.createRenderbuffer(),Te.bindRenderbuffer(36161,bt.renderbuffer),Te.renderbufferStorage(36161,bt.format,bt.width,bt.height)}),Te.bindRenderbuffer(36161,null)}}},et=[];et[6408]=4,et[6407]=3;var Lt=[];Lt[5121]=1,Lt[5126]=4,Lt[36193]=2;var Wt=[1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998],Jt=["x","y","z","w"],Be="blend.func blend.equation stencil.func stencil.opFront stencil.opBack sample.coverage viewport scissor.box polygonOffset.offset".split(" "),Ge={0:0,1:1,zero:0,one:1,"src color":768,"one minus src color":769,"src alpha":770,"one minus src alpha":771,"dst color":774,"one minus dst color":775,"dst alpha":772,"one minus dst alpha":773,"constant color":32769,"one minus constant color":32770,"constant alpha":32771,"one minus constant alpha":32772,"src alpha saturate":776},kt={never:512,less:513,"<":513,equal:514,"=":514,"==":514,"===":514,lequal:515,"<=":515,greater:516,">":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519},dt={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},Oe={cw:2304,ccw:2305},Ie=new J(!1,!1,!1,function(){});return function(Te){function Pe(){if(yr.length===0)Zt&&Zt.update(),lr=null;else{lr=ie.next(Pe),tt();for(var Mn=yr.length-1;0<=Mn;--Mn){var rr=yr[Mn];rr&&rr(Fn,null,0)}Et.flush(),Zt&&Zt.update()}}function qe(){!lr&&0=yr.length&&rt()}}}}function Ut(){var Mn=ar.viewport,rr=ar.scissor_box;Mn[0]=Mn[1]=rr[0]=rr[1]=0,Fn.viewportWidth=Fn.framebufferWidth=Fn.drawingBufferWidth=Mn[2]=rr[2]=Et.drawingBufferWidth,Fn.viewportHeight=Fn.framebufferHeight=Fn.drawingBufferHeight=Mn[3]=rr[3]=Et.drawingBufferHeight}function tt(){Fn.tick+=1,Fn.time=Ft(),Ut(),Wn.procs.poll()}function bt(){bn.refresh(),Ut(),Wn.procs.refresh(),Zt&&Zt.update()}function Ft(){return(ae()-Kt)/1e3}if(!(Te=i(Te)))return null;var Et=Te.gl,Pt=Et.getContextAttributes();Et.isContextLost();var De=function(Mn,rr){function nr(pr){var qr;pr=pr.toLowerCase();try{qr=Bn[pr]=Mn.getExtension(pr)}catch{}return!!qr}for(var Bn={},Nr=0;Nrrr;++rr)Yr(q({framebuffer:Mn.framebuffer.faces[rr]},Mn),wt);else Yr(Mn,wt);else wt(0,Mn)},prop:ee.define.bind(null,1),context:ee.define.bind(null,2),this:ee.define.bind(null,3),draw:At({}),buffer:function(Mn){return tn.create(Mn,34962,!1,!1)},elements:function(Mn){return nn.create(Mn,!1)},texture:bn.create2D,cube:bn.createCube,renderbuffer:In.create,framebuffer:qn.create,framebufferCube:qn.createCube,vao:sn.createVAO,attributes:Pt,frame:$t,on:function(Mn,rr){var nr;switch(Mn){case"frame":return $t(rr);case"lost":nr=Sr;break;case"restore":nr=Kn;break;case"destroy":nr=Dn}return nr.push(rr),{cancel:function(){for(var Bn=0;Bn2?"one of ".concat(i," ").concat(c.slice(0,s-1).join(", "),", or ")+c[s-1]:s===2?"one of ".concat(i," ").concat(c[0]," or ").concat(c[1]):"of ".concat(i," ").concat(c[0])}return"of ".concat(i," ").concat(String(c))}a("ERR_INVALID_OPT_VALUE",function(c,i){return'The value "'+i+'" is invalid for option "'+c+'"'},TypeError),a("ERR_INVALID_ARG_TYPE",function(c,i,s){var u,h,d;if(typeof i=="string"&&(h="not ",i.substr(0,h.length)===h)?(u="must not be",i=i.replace(/^not /,"")):u="must be",function(p,g,y){return(y===void 0||y>p.length)&&(y=p.length),p.substring(y-g.length,y)===g}(c," argument"))d="The ".concat(c," ").concat(u," ").concat(l(i,"type"));else{var m=function(p,g,y){return typeof y!="number"&&(y=0),!(y+g.length>p.length)&&p.indexOf(g,y)!==-1}(c,".")?"property":"argument";d='The "'.concat(c,'" ').concat(m," ").concat(u," ").concat(l(i,"type"))}return d+=". Received type ".concat(typeof s)},TypeError),a("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),a("ERR_METHOD_NOT_IMPLEMENTED",function(c){return"The "+c+" method is not implemented"}),a("ERR_STREAM_PREMATURE_CLOSE","Premature close"),a("ERR_STREAM_DESTROYED",function(c){return"Cannot call "+c+" after a stream was destroyed"}),a("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),a("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),a("ERR_STREAM_WRITE_AFTER_END","write after end"),a("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),a("ERR_UNKNOWN_ENCODING",function(c){return"Unknown encoding: "+c},TypeError),a("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),o.exports.codes=r},{}],287:[function(t,o,f){(function(r){(function(){var a=Object.keys||function(p){var g=[];for(var y in p)g.push(y);return g};o.exports=h;var l=t("./_stream_readable"),c=t("./_stream_writable");t("inherits")(h,l);for(var i=a(c.prototype),s=0;s0)if(typeof V=="string"||ee.objectMode||Object.getPrototypeOf(V)===s.prototype||(V=function(ie){return s.from(ie)}(V)),ne)ee.endEmitted?M(U,new w):L(U,ee,V,!0);else if(ee.ended)M(U,new b);else{if(ee.destroyed)return!1;ee.reading=!1,ee.decoder&&!H?(V=ee.decoder.write(V),ee.objectMode||V.length!==0?L(U,ee,V,!1):O(U,ee)):L(U,ee,V,!1)}else ne||(ee.reading=!1,O(U,ee));return!ee.ended&&(ee.lengthV.highWaterMark&&(V.highWaterMark=function(H){return H>=1073741824?H=1073741824:(H--,H|=H>>>1,H|=H>>>2,H|=H>>>4,H|=H>>>8,H|=H>>>16,H++),H}(U)),U<=V.length?U:V.ended?V.length:(V.needReadable=!0,0))}function F(U){var V=U._readableState;h("emitReadable",V.needReadable,V.emittedReadable),V.needReadable=!1,V.emittedReadable||(h("emitReadable",V.flowing),V.emittedReadable=!0,r.nextTick(D,U))}function D(U){var V=U._readableState;h("emitReadable_",V.destroyed,V.length,V.ended),V.destroyed||!V.length&&!V.ended||(U.emit("readable"),V.emittedReadable=!1),V.needReadable=!V.flowing&&!V.ended&&V.length<=V.highWaterMark,K(U)}function O(U,V){V.readingMore||(V.readingMore=!0,r.nextTick(N,U,V))}function N(U,V){for(;!V.reading&&!V.ended&&(V.length0,V.resumeScheduled&&!V.paused?V.flowing=!0:U.listenerCount("data")>0&&U.resume()}function W(U){h("readable nexttick read 0"),U.read(0)}function G(U,V){h("resume",V.reading),V.reading||U.read(0),V.resumeScheduled=!1,U.emit("resume"),K(U),V.flowing&&!V.reading&&U.read(0)}function K(U){var V=U._readableState;for(h("flow",V.flowing);V.flowing&&U.read()!==null;);}function te(U,V){return V.length===0?null:(V.objectMode?H=V.buffer.shift():!U||U>=V.length?(H=V.decoder?V.buffer.join(""):V.buffer.length===1?V.buffer.first():V.buffer.concat(V.length),V.buffer.clear()):H=V.buffer.consume(U,V.decoder),H);var H}function Y(U){var V=U._readableState;h("endReadable",V.endEmitted),V.endEmitted||(V.ended=!0,r.nextTick(J,V,U))}function J(U,V){if(h("endReadableNT",U.endEmitted,U.length),!U.endEmitted&&U.length===0&&(U.endEmitted=!0,V.readable=!1,V.emit("end"),U.autoDestroy)){var H=V._writableState;(!H||H.autoDestroy&&H.finished)&&V.destroy()}}function re(U,V){for(var H=0,ne=U.length;H=V.highWaterMark:V.length>0)||V.ended))return h("read: emitReadable",V.length,V.ended),V.length===0&&V.ended?Y(this):F(this),null;if((U=R(U,V))===0&&V.ended)return V.length===0&&Y(this),null;var ne,q=V.needReadable;return h("need readable",q),(V.length===0||V.length-U0?te(U,V):null)===null?(V.needReadable=V.length<=V.highWaterMark,U=0):(V.length-=U,V.awaitDrain=0),V.length===0&&(V.ended||(V.needReadable=!0),H!==U&&V.ended&&Y(this)),ne!==null&&this.emit("data",ne),ne},S.prototype._read=function(U){M(this,new k("_read()"))},S.prototype.pipe=function(U,V){var H=this,ne=this._readableState;switch(ne.pipesCount){case 0:ne.pipes=U;break;case 1:ne.pipes=[ne.pipes,U];break;default:ne.pipes.push(U)}ne.pipesCount+=1,h("pipe count=%d opts=%j",ne.pipesCount,V);var q=(!V||V.end!==!1)&&U!==r.stdout&&U!==r.stderr?ee:me;function Q(_e,Ae){h("onunpipe"),_e===H&&Ae&&Ae.hasUnpiped===!1&&(Ae.hasUnpiped=!0,h("cleanup"),U.removeListener("close",ge),U.removeListener("finish",fe),U.removeListener("drain",ie),U.removeListener("error",le),U.removeListener("unpipe",Q),H.removeListener("end",ee),H.removeListener("end",me),H.removeListener("data",ue),ae=!0,!ne.awaitDrain||U._writableState&&!U._writableState.needDrain||ie())}function ee(){h("onend"),U.end()}ne.endEmitted?r.nextTick(q):H.once("end",q),U.on("unpipe",Q);var ie=function(_e){return function(){var Ae=_e._readableState;h("pipeOnDrain",Ae.awaitDrain),Ae.awaitDrain&&Ae.awaitDrain--,Ae.awaitDrain===0&&c(_e,"data")&&(Ae.flowing=!0,K(_e))}}(H);U.on("drain",ie);var ae=!1;function ue(_e){h("ondata");var Ae=U.write(_e);h("dest.write",Ae),Ae===!1&&((ne.pipesCount===1&&ne.pipes===U||ne.pipesCount>1&&re(ne.pipes,U)!==-1)&&!ae&&(h("false write response, pause",ne.awaitDrain),ne.awaitDrain++),H.pause())}function le(_e){h("onerror",_e),me(),U.removeListener("error",le),c(U,"error")===0&&M(U,_e)}function ge(){U.removeListener("finish",fe),me()}function fe(){h("onfinish"),U.removeListener("close",ge),me()}function me(){h("unpipe"),H.unpipe(U)}return H.on("data",ue),function(_e,Ae,ke){if(typeof _e.prependListener=="function")return _e.prependListener(Ae,ke);_e._events&&_e._events[Ae]?Array.isArray(_e._events[Ae])?_e._events[Ae].unshift(ke):_e._events[Ae]=[ke,_e._events[Ae]]:_e.on(Ae,ke)}(U,"error",le),U.once("close",ge),U.once("finish",fe),U.emit("pipe",H),ne.flowing||(h("pipe resume"),H.resume()),U},S.prototype.unpipe=function(U){var V=this._readableState,H={hasUnpiped:!1};if(V.pipesCount===0)return this;if(V.pipesCount===1)return U&&U!==V.pipes||(U||(U=V.pipes),V.pipes=null,V.pipesCount=0,V.flowing=!1,U&&U.emit("unpipe",this,H)),this;if(!U){var ne=V.pipes,q=V.pipesCount;V.pipes=null,V.pipesCount=0,V.flowing=!1;for(var Q=0;Q0,ne.flowing!==!1&&this.resume()):U==="readable"&&(ne.endEmitted||ne.readableListening||(ne.readableListening=ne.needReadable=!0,ne.flowing=!1,ne.emittedReadable=!1,h("on readable",ne.length,ne.reading),ne.length?F(this):ne.reading||r.nextTick(W,this))),H},S.prototype.addListener=S.prototype.on,S.prototype.removeListener=function(U,V){var H=i.prototype.removeListener.call(this,U,V);return U==="readable"&&r.nextTick(B,this),H},S.prototype.removeAllListeners=function(U){var V=i.prototype.removeAllListeners.apply(this,arguments);return U!=="readable"&&U!==void 0||r.nextTick(B,this),V},S.prototype.resume=function(){var U=this._readableState;return U.flowing||(h("resume"),U.flowing=!U.readableListening,function(V,H){H.resumeScheduled||(H.resumeScheduled=!0,r.nextTick(G,V,H))}(this,U)),U.paused=!1,this},S.prototype.pause=function(){return h("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(h("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},S.prototype.wrap=function(U){var V=this,H=this._readableState,ne=!1;for(var q in U.on("end",function(){if(h("wrapped end"),H.decoder&&!H.ended){var ee=H.decoder.end();ee&&ee.length&&V.push(ee)}V.push(null)}),U.on("data",function(ee){h("wrapped data"),H.decoder&&(ee=H.decoder.write(ee)),H.objectMode&&ee==null||(H.objectMode||ee&&ee.length)&&(V.push(ee)||(ne=!0,U.pause()))}),U)this[q]===void 0&&typeof U[q]=="function"&&(this[q]=function(ee){return function(){return U[ee].apply(U,arguments)}}(q));for(var Q=0;Q-1))throw new w(N);return this._writableState.defaultEncoding=N,this},Object.defineProperty(S.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(S.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),S.prototype._write=function(N,B,W){W(new v("_write()"))},S.prototype._writev=null,S.prototype.end=function(N,B,W){var G=this._writableState;return typeof N=="function"?(W=N,N=null,B=null):typeof B=="function"&&(W=B,B=null),N!=null&&this.write(N,B),G.corked&&(G.corked=1,this.uncork()),G.ending||function(K,te,Y){te.ending=!0,O(K,te),Y&&(te.finished?r.nextTick(Y):K.once("finish",Y)),te.ended=!0,K.writable=!1}(this,G,W),this},Object.defineProperty(S.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(S.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState!==void 0&&this._writableState.destroyed},set:function(N){this._writableState&&(this._writableState.destroyed=N)}}),S.prototype.destroy=m.destroy,S.prototype._undestroy=m.undestroy,S.prototype._destroy=function(N,B){B(N)}}).call(this)}).call(this,t("_process"),typeof jo<"u"?jo:typeof self<"u"?self:typeof window<"u"?window:{})},{"../errors":286,"./_stream_duplex":287,"./internal/streams/destroy":294,"./internal/streams/state":298,"./internal/streams/stream":299,_process:277,buffer:85,inherits:231,"util-deprecate":330}],292:[function(t,o,f){(function(r){(function(){var a;function l(A,b,k){return b in A?Object.defineProperty(A,b,{value:k,enumerable:!0,configurable:!0,writable:!0}):A[b]=k,A}var c=t("./end-of-stream"),i=Symbol("lastResolve"),s=Symbol("lastReject"),u=Symbol("error"),h=Symbol("ended"),d=Symbol("lastPromise"),m=Symbol("handlePromise"),p=Symbol("stream");function g(A,b){return{value:A,done:b}}function y(A){var b=A[i];if(b!==null){var k=A[p].read();k!==null&&(A[d]=null,A[i]=null,A[s]=null,b(g(k,!1)))}}function v(A){r.nextTick(y,A)}var x=Object.getPrototypeOf(function(){}),_=Object.setPrototypeOf((l(a={get stream(){return this[p]},next:function(){var A=this,b=this[u];if(b!==null)return Promise.reject(b);if(this[h])return Promise.resolve(g(void 0,!0));if(this[p].destroyed)return new Promise(function(T,E){r.nextTick(function(){A[u]?E(A[u]):T(g(void 0,!0))})});var k,w=this[d];if(w)k=new Promise(function(T,E){return function(S,P){T.then(function(){E[h]?S(g(void 0,!0)):E[m](S,P)},P)}}(w,this));else{var M=this[p].read();if(M!==null)return Promise.resolve(g(M,!1));k=new Promise(this[m])}return this[d]=k,k}},Symbol.asyncIterator,function(){return this}),l(a,"return",function(){var A=this;return new Promise(function(b,k){A[p].destroy(null,function(w){w?k(w):b(g(void 0,!0))})})}),a),x);o.exports=function(A){var b,k=Object.create(_,(l(b={},p,{value:A,writable:!0}),l(b,i,{value:null,writable:!0}),l(b,s,{value:null,writable:!0}),l(b,u,{value:null,writable:!0}),l(b,h,{value:A._readableState.endEmitted,writable:!0}),l(b,m,{value:function(w,M){var T=k[p].read();T?(k[d]=null,k[i]=null,k[s]=null,w(g(T,!1))):(k[i]=w,k[s]=M)},writable:!0}),b));return k[d]=null,c(A,function(w){if(w&&w.code!=="ERR_STREAM_PREMATURE_CLOSE"){var M=k[s];return M!==null&&(k[d]=null,k[i]=null,k[s]=null,M(w)),void(k[u]=w)}var T=k[i];T!==null&&(k[d]=null,k[i]=null,k[s]=null,T(g(void 0,!0))),k[h]=!0}),A.on("readable",v.bind(null,k)),k}}).call(this)}).call(this,t("_process"))},{"./end-of-stream":295,_process:277}],293:[function(t,o,f){function r(u,h){var d=Object.keys(u);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(u);h&&(m=m.filter(function(p){return Object.getOwnPropertyDescriptor(u,p).enumerable})),d.push.apply(d,m)}return d}function a(u,h,d){return h in u?Object.defineProperty(u,h,{value:d,enumerable:!0,configurable:!0,writable:!0}):u[h]=d,u}function l(u,h){for(var d=0;d0?this.tail.next=p:this.head=p,this.tail=p,++this.length}},{key:"unshift",value:function(m){var p={data:m,next:this.head};this.length===0&&(this.tail=p),this.head=p,++this.length}},{key:"shift",value:function(){if(this.length!==0){var m=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,m}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(m){if(this.length===0)return"";for(var p=this.head,g=""+p.data;p=p.next;)g+=m+p.data;return g}},{key:"concat",value:function(m){if(this.length===0)return c.alloc(0);for(var p,g,y,v=c.allocUnsafe(m>>>0),x=this.head,_=0;x;)p=x.data,g=v,y=_,c.prototype.copy.call(p,g,y),_+=x.data.length,x=x.next;return v}},{key:"consume",value:function(m,p){var g;return mv.length?v.length:m;if(x===v.length?y+=v:y+=v.slice(0,m),(m-=x)==0){x===v.length?(++g,p.next?this.head=p.next:this.head=this.tail=null):(this.head=p,p.data=v.slice(x));break}++g}return this.length-=g,y}},{key:"_getBuffer",value:function(m){var p=c.allocUnsafe(m),g=this.head,y=1;for(g.data.copy(p),m-=g.data.length;g=g.next;){var v=g.data,x=m>v.length?v.length:m;if(v.copy(p,p.length-m,0,x),(m-=x)==0){x===v.length?(++y,g.next?this.head=g.next:this.head=this.tail=null):(this.head=g,g.data=v.slice(x));break}++y}return this.length-=y,p}},{key:s,value:function(m,p){return i(this,function(g){for(var y=1;y0,function(k){y||(y=k),k&&x.forEach(u),b||(x.forEach(u),v(y))})});return p.reduce(h)}},{"../../../errors":286,"./end-of-stream":295}],298:[function(t,o,f){var r=t("../../../errors").codes.ERR_INVALID_OPT_VALUE;o.exports={getHighWaterMark:function(a,l,c,i){var s=function(u,h,d){return u.highWaterMark!=null?u.highWaterMark:h?u[d]:null}(l,i,c);if(s!=null){if(!isFinite(s)||Math.floor(s)!==s||s<0)throw new r(i?c:"highWaterMark",s);return Math.floor(s)}return a.objectMode?16:16384}}},{"../../../errors":286}],299:[function(t,o,f){o.exports=t("events").EventEmitter},{events:84}],300:[function(t,o,f){var r=t("safe-buffer").Buffer,a=r.isEncoding||function(g){switch((g=""+g)&&g.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function l(g){var y;switch(this.encoding=function(v){var x=function(_){if(!_)return"utf8";for(var A;;)switch(_){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return _;default:if(A)return;_=(""+_).toLowerCase(),A=!0}}(v);if(typeof x!="string"&&(r.isEncoding===a||!a(v)))throw new Error("Unknown encoding: "+v);return x||v}(g),this.encoding){case"utf16le":this.text=s,this.end=u,y=4;break;case"utf8":this.fillLast=i,y=4;break;case"base64":this.text=h,this.end=d,y=3;break;default:return this.write=m,void(this.end=p)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(y)}function c(g){return g<=127?0:g>>5==6?2:g>>4==14?3:g>>3==30?4:g>>6==2?-1:-2}function i(g){var y=this.lastTotal-this.lastNeed,v=function(x,_,A){if((192&_[0])!=128)return x.lastNeed=0,"�";if(x.lastNeed>1&&_.length>1){if((192&_[1])!=128)return x.lastNeed=1,"�";if(x.lastNeed>2&&_.length>2&&(192&_[2])!=128)return x.lastNeed=2,"�"}}(this,g);return v!==void 0?v:this.lastNeed<=g.length?(g.copy(this.lastChar,y,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(g.copy(this.lastChar,y,0,g.length),void(this.lastNeed-=g.length))}function s(g,y){if((g.length-y)%2==0){var v=g.toString("utf16le",y);if(v){var x=v.charCodeAt(v.length-1);if(x>=55296&&x<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=g[g.length-2],this.lastChar[1]=g[g.length-1],v.slice(0,-1)}return v}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=g[g.length-1],g.toString("utf16le",y,g.length-1)}function u(g){var y=g&&g.length?this.write(g):"";if(this.lastNeed){var v=this.lastTotal-this.lastNeed;return y+this.lastChar.toString("utf16le",0,v)}return y}function h(g,y){var v=(g.length-y)%3;return v===0?g.toString("base64",y):(this.lastNeed=3-v,this.lastTotal=3,v===1?this.lastChar[0]=g[g.length-1]:(this.lastChar[0]=g[g.length-2],this.lastChar[1]=g[g.length-1]),g.toString("base64",y,g.length-v))}function d(g){var y=g&&g.length?this.write(g):"";return this.lastNeed?y+this.lastChar.toString("base64",0,3-this.lastNeed):y}function m(g){return g.toString(this.encoding)}function p(g){return g&&g.length?this.write(g):""}f.StringDecoder=l,l.prototype.write=function(g){if(g.length===0)return"";var y,v;if(this.lastNeed){if((y=this.fillLast(g))===void 0)return"";v=this.lastNeed,this.lastNeed=0}else v=0;return v=0?(w>0&&(_.lastNeed=w-1),w):--k=0?(w>0&&(_.lastNeed=w-2),w):--k=0?(w>0&&(w===2?w=0:_.lastNeed=w-3),w):0}(this,g,y);if(!this.lastNeed)return g.toString("utf8",y);this.lastTotal=v;var x=g.length-(v-this.lastNeed);return g.copy(this.lastChar,0,x),g.toString("utf8",y,x)},l.prototype.fillLast=function(g){if(this.lastNeed<=g.length)return g.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);g.copy(this.lastChar,this.lastTotal-this.lastNeed,0,g.length),this.lastNeed-=g.length}},{"safe-buffer":284}],301:[function(t,o,f){(function(r,a){(function(){var l=t("assert"),c=t("debug")("stream-parser");o.exports=function(v){var x=v&&typeof v._transform=="function",_=v&&typeof v._write=="function";if(!x&&!_)throw new Error("must pass a Writable or Transform stream in");c("extending Parser into stream"),v._bytes=s,v._skipBytes=u,x&&(v._passthrough=h),x?v._transform=m:v._write=d};function i(v){c("initializing parser stream"),v._parserBytesLeft=0,v._parserBuffers=[],v._parserBuffered=0,v._parserState=-1,v._parserCallback=null,typeof v.push=="function"&&(v._parserOutput=v.push.bind(v)),v._parserInit=!0}function s(v,x){l(!this._parserCallback,'there is already a "callback" set!'),l(isFinite(v)&&v>0,'can only buffer a finite number of bytes > 0, got "'+v+'"'),this._parserInit||i(this),c("buffering %o bytes",v),this._parserBytesLeft=v,this._parserCallback=x,this._parserState=0}function u(v,x){l(!this._parserCallback,'there is already a "callback" set!'),l(v>0,'can only skip > 0 bytes, got "'+v+'"'),this._parserInit||i(this),c("skipping %o bytes",v),this._parserBytesLeft=v,this._parserCallback=x,this._parserState=1}function h(v,x){l(!this._parserCallback,'There is already a "callback" set!'),l(v>0,'can only pass through > 0 bytes, got "'+v+'"'),this._parserInit||i(this),c("passing through %o bytes",v),this._parserBytesLeft=v,this._parserCallback=x,this._parserState=2}function d(v,x,_){this._parserInit||i(this),c("write(%o bytes)",v.length),typeof x=="function"&&(_=x),g(this,v,null,_)}function m(v,x,_){this._parserInit||i(this),c("transform(%o bytes)",v.length),typeof x!="function"&&(x=this._parserOutput),g(this,v,x,_)}function p(v,x,_,A){if(v._parserBytesLeft-=x.length,c("%o bytes left for stream piece",v._parserBytesLeft),v._parserState===0?(v._parserBuffers.push(x),v._parserBuffered+=x.length):v._parserState===2&&_(x),v._parserBytesLeft!==0)return A;var b=v._parserCallback;if(b&&v._parserState===0&&v._parserBuffers.length>1&&(x=a.concat(v._parserBuffers,v._parserBuffered)),v._parserState!==0&&(x=null),v._parserCallback=null,v._parserBuffered=0,v._parserState=-1,v._parserBuffers.splice(0),b){var k=[];x&&k.push(x),_&&k.push(_);var w=b.length>k.length;w&&k.push(y(A));var M=b.apply(v,k);if(!w||A===M)return A}}var g=y(function v(x,_,A,b){return x._parserBytesLeft<=0?b(new Error("got data but not currently parsing anything")):_.length<=x._parserBytesLeft?function(){return p(x,_,A,b)}:function(){var k=_.slice(0,x._parserBytesLeft);return p(x,k,A,function(w){return w?b(w):_.length>k.length?function(){return v(x,_.slice(k.length),A,b)}:void 0})}});function y(v){return function(){for(var x=v.apply(this,arguments);typeof x=="function";)x=x();return x}}}).call(this)}).call(this,t("_process"),t("buffer").Buffer)},{_process:277,assert:75,buffer:85,debug:302}],302:[function(t,o,f){(function(r){(function(){function a(){var l;try{l=f.storage.debug}catch{}return!l&&r!==void 0&&"env"in r&&(l=r.env.DEBUG),l}(f=o.exports=t("./debug")).log=function(){return typeof console=="object"&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},f.formatArgs=function(l){var c=this.useColors;if(l[0]=(c?"%c":"")+this.namespace+(c?" %c":" ")+l[0]+(c?"%c ":" ")+"+"+f.humanize(this.diff),!!c){var i="color: "+this.color;l.splice(1,0,i,"color: inherit");var s=0,u=0;l[0].replace(/%[a-zA-Z%]/g,function(h){h!=="%%"&&(s++,h==="%c"&&(u=s))}),l.splice(u,0,i)}},f.save=function(l){try{l==null?f.storage.removeItem("debug"):f.storage.debug=l}catch{}},f.load=a,f.useColors=function(){return typeof window<"u"&&window.process&&window.process.type==="renderer"?!0: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+)/)},f.storage=typeof chrome<"u"&&chrome.storage!==void 0?chrome.storage.local:function(){try{return window.localStorage}catch{}}(),f.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],f.formatters.j=function(l){try{return JSON.stringify(l)}catch(c){return"[UnexpectedJSONParseError]: "+c.message}},f.enable(a())}).call(this)}).call(this,t("_process"))},{"./debug":303,_process:277}],303:[function(t,o,f){var r;function a(l){function c(){if(c.enabled){var i=c,s=+new Date,u=s-(r||s);i.diff=u,i.prev=r,i.curr=s,r=s;for(var h=new Array(arguments.length),d=0;d0)return function(m){if(!((m=String(m)).length>100)){var p=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(m);if(p){var g=parseFloat(p[1]);switch((p[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*g;case"days":case"day":case"d":return g*c;case"hours":case"hour":case"hrs":case"hr":case"h":return g*l;case"minutes":case"minute":case"mins":case"min":case"m":return g*a;case"seconds":case"second":case"secs":case"sec":case"s":return g*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return g;default:return}}}}(s);if(d==="number"&&isNaN(s)===!1)return u.long?i(h=s,c,"day")||i(h,l,"hour")||i(h,a,"minute")||i(h,r,"second")||h+" ms":function(m){return m>=c?Math.round(m/c)+"d":m>=l?Math.round(m/l)+"h":m>=a?Math.round(m/a)+"m":m>=r?Math.round(m/r)+"s":m+"ms"}(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))}},{}],305:[function(t,o,f){var r=t("parenthesis");o.exports=function(a,l,c){if(a==null)throw Error("First argument should be a string");if(l==null)throw Error("Separator should be a string or a RegExp");c?(typeof c=="string"||Array.isArray(c))&&(c={ignore:c}):c={},c.escape==null&&(c.escape=!0),c.ignore==null?c.ignore=["[]","()","{}","<>",'""',"''","``","“”","«»"]:(typeof c.ignore=="string"&&(c.ignore=[c.ignore]),c.ignore=c.ignore.map(function(p){return p.length===1&&(p+=p),p}));var i=r.parse(a,{flat:!0,brackets:c.ignore}),s=i[0].split(l);if(c.escape){for(var u=[],h=0;h0;){A=k[k.length-1];var w=r[A];if(s[A]=0&&h[A].push(u[T])}s[A]=M}else{if(c[A]===l[A]){var E=[],S=[],P=0;for(M=b.length-1;M>=0;--M){var L=b[M];if(i[L]=!1,E.push(L),S.push(h[L]),P+=h[L].length,u[L]=g.length,L===A){b.length=M;break}}g.push(E);var R=new Array(P);for(M=0;M1&&(m=1),m<-1&&(m=-1),(s*d-u*h<0?-1:1)*Math.acos(m)};f.default=function(s){var u=s.px,h=s.py,d=s.cx,m=s.cy,p=s.rx,g=s.ry,y=s.xAxisRotation,v=y===void 0?0:y,x=s.largeArcFlag,_=x===void 0?0:x,A=s.sweepFlag,b=A===void 0?0:A,k=[];if(p===0||g===0)return[];var w=Math.sin(v*a/360),M=Math.cos(v*a/360),T=M*(u-d)/2+w*(h-m)/2,E=-w*(u-d)/2+M*(h-m)/2;if(T===0&&E===0)return[];p=Math.abs(p),g=Math.abs(g);var S=Math.pow(T,2)/Math.pow(p,2)+Math.pow(E,2)/Math.pow(g,2);S>1&&(p*=Math.sqrt(S),g*=Math.sqrt(S));var P=function(G,K,te,Y,J,re,U,V,H,ne,q,Q){var ee=Math.pow(J,2),ie=Math.pow(re,2),ae=Math.pow(q,2),ue=Math.pow(Q,2),le=ee*ie-ee*ue-ie*ae;le<0&&(le=0),le/=ee*ue+ie*ae;var ge=(le=Math.sqrt(le)*(U===V?-1:1))*J/re*Q,fe=le*-re/J*q,me=ne*ge-H*fe+(G+te)/2,_e=H*ge+ne*fe+(K+Y)/2,Ae=(q-ge)/J,ke=(Q-fe)/re,Le=(-q-ge)/J,de=(-Q-fe)/re,ve=i(1,0,Ae,ke),Me=i(Ae,ke,Le,de);return V===0&&Me>0&&(Me-=a),V===1&&Me<0&&(Me+=a),[me,_e,ve,Me]}(u,h,d,m,p,g,_,b,w,M,T,E),L=r(P,4),R=L[0],F=L[1],D=L[2],O=L[3],N=Math.abs(O)/(a/4);Math.abs(1-N)<1e-7&&(N=1);var B=Math.max(Math.ceil(N),1);O/=B;for(var W=0;Wu[2]&&(u[2]=m[p+0]),m[p+1]>u[3]&&(u[3]=m[p+1]);return u}},{"abs-svg-path":70,assert:75,"is-svg-path":238,"normalize-svg-path":309,"parse-svg-path":250}],309:[function(t,o,f){o.exports=function(c){for(var i,s=[],u=0,h=0,d=0,m=0,p=null,g=null,y=0,v=0,x=0,_=c.length;x<_;x++){var A=c[x],b=A[0];switch(b){case"M":d=A[1],m=A[2];break;case"A":var k=r({px:y,py:v,cx:A[6],cy:A[7],rx:A[1],ry:A[2],xAxisRotation:A[3],largeArcFlag:A[4],sweepFlag:A[5]});if(!k.length)continue;for(var w,M=0;M4?(u=A[A.length-4],h=A[A.length-3]):(u=y,h=v),s.push(A)}return s};var r=t("svg-arc-to-cubic-bezier");function a(c,i,s,u){return["C",c,i,s,u,s,u]}function l(c,i,s,u,h,d){return["C",c/3+2/3*s,i/3+2/3*u,h/3+2/3*s,d/3+2/3*u,h,d]}},{"svg-arc-to-cubic-bezier":307}],310:[function(t,o,f){var r,a=t("svg-path-bounds"),l=t("parse-svg-path"),c=t("draw-svg-path"),i=t("is-svg-path"),s=t("bitmap-sdf"),u=document.createElement("canvas"),h=u.getContext("2d");o.exports=function(d,m){if(!i(d))throw Error("Argument should be valid svg path string");m||(m={});var p,g;m.shape?(p=m.shape[0],g=m.shape[1]):(p=u.width=m.w||m.width||200,g=u.height=m.h||m.height||200);var y=Math.min(p,g),v=m.stroke||0,x=m.viewbox||m.viewBox||a(d),_=[p/(x[2]-x[0]),g/(x[3]-x[1])],A=Math.min(_[0]||0,_[1]||0)/2;if(h.fillStyle="black",h.fillRect(0,0,p,g),h.fillStyle="white",v&&(typeof v!="number"&&(v=1),h.strokeStyle=v>0?"white":"black",h.lineWidth=Math.abs(v)),h.translate(.5*p,.5*g),h.scale(A,A),function(){if(r!=null)return r;var w=document.createElement("canvas").getContext("2d");if(w.canvas.width=w.canvas.height=1,!window.Path2D)return r=!1;var M=new Path2D("M0,0h1v1h-1v-1Z");w.fillStyle="black",w.fill(M);var T=w.getImageData(0,0,1,1);return r=T&&T.data&&T.data[3]===255}()){var b=new Path2D(d);h.fill(b),v&&h.stroke(b)}else{var k=l(d);c(h,k),h.fill(),v&&h.stroke()}return h.setTransform(1,0,0,1,0,0),s(h,{cutoff:m.cutoff!=null?m.cutoff:.5,radius:m.radius!=null?m.radius:.5*y})}},{"bitmap-sdf":82,"draw-svg-path":126,"is-svg-path":238,"parse-svg-path":250,"svg-path-bounds":308}],311:[function(t,o,f){(function(r,a){(function(){var l=t("process/browser.js").nextTick,c=Function.prototype.apply,i=Array.prototype.slice,s={},u=0;function h(d,m){this._id=d,this._clearFn=m}f.setTimeout=function(){return new h(c.call(setTimeout,window,arguments),clearTimeout)},f.setInterval=function(){return new h(c.call(setInterval,window,arguments),clearInterval)},f.clearTimeout=f.clearInterval=function(d){d.close()},h.prototype.unref=h.prototype.ref=function(){},h.prototype.close=function(){this._clearFn.call(window,this._id)},f.enroll=function(d,m){clearTimeout(d._idleTimeoutId),d._idleTimeout=m},f.unenroll=function(d){clearTimeout(d._idleTimeoutId),d._idleTimeout=-1},f._unrefActive=f.active=function(d){clearTimeout(d._idleTimeoutId);var m=d._idleTimeout;m>=0&&(d._idleTimeoutId=setTimeout(function(){d._onTimeout&&d._onTimeout()},m))},f.setImmediate=typeof r=="function"?r:function(d){var m=u++,p=!(arguments.length<2)&&i.call(arguments,1);return s[m]=!0,l(function(){s[m]&&(p?d.apply(null,p):d.call(null),f.clearImmediate(m))}),m},f.clearImmediate=typeof a=="function"?a:function(d){delete s[d]}}).call(this)}).call(this,t("timers").setImmediate,t("timers").clearImmediate)},{"process/browser.js":277,timers:311}],312:[function(t,o,f){(function(r){var a=/^\s+/,l=/\s+$/,c=0,i=r.round,s=r.min,u=r.max,h=r.random;function d(H,ne){if(ne=ne||{},(H=H||"")instanceof d)return H;if(!(this instanceof d))return new d(H,ne);var q=function(Q){var ee={r:0,g:0,b:0},ie=1,ae=null,ue=null,le=null,ge=!1,fe=!1;typeof Q=="string"&&(Q=function(ke){ke=ke.replace(a,"").replace(l,"").toLowerCase();var Le,de=!1;if(R[ke])ke=R[ke],de=!0;else if(ke=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};return(Le=U.rgb.exec(ke))?{r:Le[1],g:Le[2],b:Le[3]}:(Le=U.rgba.exec(ke))?{r:Le[1],g:Le[2],b:Le[3],a:Le[4]}:(Le=U.hsl.exec(ke))?{h:Le[1],s:Le[2],l:Le[3]}:(Le=U.hsla.exec(ke))?{h:Le[1],s:Le[2],l:Le[3],a:Le[4]}:(Le=U.hsv.exec(ke))?{h:Le[1],s:Le[2],v:Le[3]}:(Le=U.hsva.exec(ke))?{h:Le[1],s:Le[2],v:Le[3],a:Le[4]}:(Le=U.hex8.exec(ke))?{r:B(Le[1]),g:B(Le[2]),b:B(Le[3]),a:te(Le[4]),format:de?"name":"hex8"}:(Le=U.hex6.exec(ke))?{r:B(Le[1]),g:B(Le[2]),b:B(Le[3]),format:de?"name":"hex"}:(Le=U.hex4.exec(ke))?{r:B(Le[1]+""+Le[1]),g:B(Le[2]+""+Le[2]),b:B(Le[3]+""+Le[3]),a:te(Le[4]+""+Le[4]),format:de?"name":"hex8"}:(Le=U.hex3.exec(ke))?{r:B(Le[1]+""+Le[1]),g:B(Le[2]+""+Le[2]),b:B(Le[3]+""+Le[3]),format:de?"name":"hex"}:!1}(Q)),typeof Q=="object"&&(V(Q.r)&&V(Q.g)&&V(Q.b)?(me=Q.r,_e=Q.g,Ae=Q.b,ee={r:255*O(me,255),g:255*O(_e,255),b:255*O(Ae,255)},ge=!0,fe=String(Q.r).substr(-1)==="%"?"prgb":"rgb"):V(Q.h)&&V(Q.s)&&V(Q.v)?(ae=G(Q.s),ue=G(Q.v),ee=function(ke,Le,de){ke=6*O(ke,360),Le=O(Le,100),de=O(de,100);var ve=r.floor(ke),Me=ke-ve,we=de*(1-Le),Ce=de*(1-Me*Le),Fe=de*(1-(1-Me)*Le),ze=ve%6;return{r:255*[de,Ce,we,we,Fe,de][ze],g:255*[Fe,de,de,Ce,we,we][ze],b:255*[we,we,Fe,de,de,Ce][ze]}}(Q.h,ae,ue),ge=!0,fe="hsv"):V(Q.h)&&V(Q.s)&&V(Q.l)&&(ae=G(Q.s),le=G(Q.l),ee=function(ke,Le,de){var ve,Me,we;function Ce($e,Ke,Re){return Re<0&&(Re+=1),Re>1&&(Re-=1),Re<1/6?$e+6*(Ke-$e)*Re:Re<.5?Ke:Re<2/3?$e+(Ke-$e)*(2/3-Re)*6:$e}if(ke=O(ke,360),Le=O(Le,100),de=O(de,100),Le===0)ve=Me=we=de;else{var Fe=de<.5?de*(1+Le):de+Le-de*Le,ze=2*de-Fe;ve=Ce(ze,Fe,ke+1/3),Me=Ce(ze,Fe,ke),we=Ce(ze,Fe,ke-1/3)}return{r:255*ve,g:255*Me,b:255*we}}(Q.h,ae,le),ge=!0,fe="hsl"),Q.hasOwnProperty("a")&&(ie=Q.a));var me,_e,Ae;return ie=D(ie),{ok:ge,format:Q.format||fe,r:s(255,u(ee.r,0)),g:s(255,u(ee.g,0)),b:s(255,u(ee.b,0)),a:ie}}(H);this._originalInput=H,this._r=q.r,this._g=q.g,this._b=q.b,this._a=q.a,this._roundA=i(100*this._a)/100,this._format=ne.format||q.format,this._gradientType=ne.gradientType,this._r<1&&(this._r=i(this._r)),this._g<1&&(this._g=i(this._g)),this._b<1&&(this._b=i(this._b)),this._ok=q.ok,this._tc_id=c++}function m(H,ne,q){H=O(H,255),ne=O(ne,255),q=O(q,255);var Q,ee,ie=u(H,ne,q),ae=s(H,ne,q),ue=(ie+ae)/2;if(ie==ae)Q=ee=0;else{var le=ie-ae;switch(ee=ue>.5?le/(2-ie-ae):le/(ie+ae),ie){case H:Q=(ne-q)/le+(ne>1)+720)%360;--ne;)Q.h=(Q.h+ee)%360,ie.push(d(Q));return ie}function L(H,ne){ne=ne||6;for(var q=d(H).toHsv(),Q=q.h,ee=q.s,ie=q.v,ae=[],ue=1/ne;ne--;)ae.push(d({h:Q,s:ee,v:ie})),ie=(ie+ue)%1;return ae}d.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var H=this.toRgb();return(299*H.r+587*H.g+114*H.b)/1e3},getLuminance:function(){var H,ne,q,Q=this.toRgb();return H=Q.r/255,ne=Q.g/255,q=Q.b/255,.2126*(H<=.03928?H/12.92:r.pow((H+.055)/1.055,2.4))+.7152*(ne<=.03928?ne/12.92:r.pow((ne+.055)/1.055,2.4))+.0722*(q<=.03928?q/12.92:r.pow((q+.055)/1.055,2.4))},setAlpha:function(H){return this._a=D(H),this._roundA=i(100*this._a)/100,this},toHsv:function(){var H=p(this._r,this._g,this._b);return{h:360*H.h,s:H.s,v:H.v,a:this._a}},toHsvString:function(){var H=p(this._r,this._g,this._b),ne=i(360*H.h),q=i(100*H.s),Q=i(100*H.v);return this._a==1?"hsv("+ne+", "+q+"%, "+Q+"%)":"hsva("+ne+", "+q+"%, "+Q+"%, "+this._roundA+")"},toHsl:function(){var H=m(this._r,this._g,this._b);return{h:360*H.h,s:H.s,l:H.l,a:this._a}},toHslString:function(){var H=m(this._r,this._g,this._b),ne=i(360*H.h),q=i(100*H.s),Q=i(100*H.l);return this._a==1?"hsl("+ne+", "+q+"%, "+Q+"%)":"hsla("+ne+", "+q+"%, "+Q+"%, "+this._roundA+")"},toHex:function(H){return g(this._r,this._g,this._b,H)},toHexString:function(H){return"#"+this.toHex(H)},toHex8:function(H){return function(ne,q,Q,ee,ie){var ae=[W(i(ne).toString(16)),W(i(q).toString(16)),W(i(Q).toString(16)),W(K(ee))];return ie&&ae[0].charAt(0)==ae[0].charAt(1)&&ae[1].charAt(0)==ae[1].charAt(1)&&ae[2].charAt(0)==ae[2].charAt(1)&&ae[3].charAt(0)==ae[3].charAt(1)?ae[0].charAt(0)+ae[1].charAt(0)+ae[2].charAt(0)+ae[3].charAt(0):ae.join("")}(this._r,this._g,this._b,this._a,H)},toHex8String:function(H){return"#"+this.toHex8(H)},toRgb:function(){return{r:i(this._r),g:i(this._g),b:i(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+i(this._r)+", "+i(this._g)+", "+i(this._b)+")":"rgba("+i(this._r)+", "+i(this._g)+", "+i(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:i(100*O(this._r,255))+"%",g:i(100*O(this._g,255))+"%",b:i(100*O(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+i(100*O(this._r,255))+"%, "+i(100*O(this._g,255))+"%, "+i(100*O(this._b,255))+"%)":"rgba("+i(100*O(this._r,255))+"%, "+i(100*O(this._g,255))+"%, "+i(100*O(this._b,255))+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":!(this._a<1)&&(F[g(this._r,this._g,this._b,!0)]||!1)},toFilter:function(H){var ne="#"+y(this._r,this._g,this._b,this._a),q=ne,Q=this._gradientType?"GradientType = 1, ":"";if(H){var ee=d(H);q="#"+y(ee._r,ee._g,ee._b,ee._a)}return"progid:DXImageTransform.Microsoft.gradient("+Q+"startColorstr="+ne+",endColorstr="+q+")"},toString:function(H){var ne=!!H;H=H||this._format;var q=!1,Q=this._a<1&&this._a>=0;return ne||!Q||H!=="hex"&&H!=="hex6"&&H!=="hex3"&&H!=="hex4"&&H!=="hex8"&&H!=="name"?(H==="rgb"&&(q=this.toRgbString()),H==="prgb"&&(q=this.toPercentageRgbString()),H!=="hex"&&H!=="hex6"||(q=this.toHexString()),H==="hex3"&&(q=this.toHexString(!0)),H==="hex4"&&(q=this.toHex8String(!0)),H==="hex8"&&(q=this.toHex8String()),H==="name"&&(q=this.toName()),H==="hsl"&&(q=this.toHslString()),H==="hsv"&&(q=this.toHsvString()),q||this.toHexString()):H==="name"&&this._a===0?this.toName():this.toRgbString()},clone:function(){return d(this.toString())},_applyModification:function(H,ne){var q=H.apply(null,[this].concat([].slice.call(ne)));return this._r=q._r,this._g=q._g,this._b=q._b,this.setAlpha(q._a),this},lighten:function(){return this._applyModification(A,arguments)},brighten:function(){return this._applyModification(b,arguments)},darken:function(){return this._applyModification(k,arguments)},desaturate:function(){return this._applyModification(v,arguments)},saturate:function(){return this._applyModification(x,arguments)},greyscale:function(){return this._applyModification(_,arguments)},spin:function(){return this._applyModification(w,arguments)},_applyCombination:function(H,ne){return H.apply(null,[this].concat([].slice.call(ne)))},analogous:function(){return this._applyCombination(P,arguments)},complement:function(){return this._applyCombination(M,arguments)},monochromatic:function(){return this._applyCombination(L,arguments)},splitcomplement:function(){return this._applyCombination(S,arguments)},triad:function(){return this._applyCombination(T,arguments)},tetrad:function(){return this._applyCombination(E,arguments)}},d.fromRatio=function(H,ne){if(typeof H=="object"){var q={};for(var Q in H)H.hasOwnProperty(Q)&&(q[Q]=Q==="a"?H[Q]:G(H[Q]));H=q}return d(H,ne)},d.equals=function(H,ne){return!(!H||!ne)&&d(H).toRgbString()==d(ne).toRgbString()},d.random=function(){return d.fromRatio({r:h(),g:h(),b:h()})},d.mix=function(H,ne,q){q=q===0?0:q||50;var Q=d(H).toRgb(),ee=d(ne).toRgb(),ie=q/100;return d({r:(ee.r-Q.r)*ie+Q.r,g:(ee.g-Q.g)*ie+Q.g,b:(ee.b-Q.b)*ie+Q.b,a:(ee.a-Q.a)*ie+Q.a})},d.readability=function(H,ne){var q=d(H),Q=d(ne);return(r.max(q.getLuminance(),Q.getLuminance())+.05)/(r.min(q.getLuminance(),Q.getLuminance())+.05)},d.isReadable=function(H,ne,q){var Q,ee,ie=d.readability(H,ne);switch(ee=!1,(Q=function(ae){var ue,le;return ue=((ae=ae||{level:"AA",size:"small"}).level||"AA").toUpperCase(),le=(ae.size||"small").toLowerCase(),ue!=="AA"&&ue!=="AAA"&&(ue="AA"),le!=="small"&&le!=="large"&&(le="small"),{level:ue,size:le}}(q)).level+Q.size){case"AAsmall":case"AAAlarge":ee=ie>=4.5;break;case"AAlarge":ee=ie>=3;break;case"AAAsmall":ee=ie>=7}return ee},d.mostReadable=function(H,ne,q){var Q,ee,ie,ae,ue=null,le=0;ee=(q=q||{}).includeFallbackColors,ie=q.level,ae=q.size;for(var ge=0;gele&&(le=Q,ue=d(ne[ge]));return d.isReadable(H,ue,{level:ie,size:ae})||!ee?ue:(q.includeFallbackColors=!1,d.mostReadable(H,["#fff","#000"],q))};var R=d.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},F=d.hexNames=function(H){var ne={};for(var q in H)H.hasOwnProperty(q)&&(ne[H[q]]=q);return ne}(R);function D(H){return H=parseFloat(H),(isNaN(H)||H<0||H>1)&&(H=1),H}function O(H,ne){(function(Q){return typeof Q=="string"&&Q.indexOf(".")!=-1&&parseFloat(Q)===1})(H)&&(H="100%");var q=function(Q){return typeof Q=="string"&&Q.indexOf("%")!=-1}(H);return H=s(ne,u(0,parseFloat(H))),q&&(H=parseInt(H*ne,10)/100),r.abs(H-ne)<1e-6?1:H%ne/parseFloat(ne)}function N(H){return s(1,u(0,H))}function B(H){return parseInt(H,16)}function W(H){return H.length==1?"0"+H:""+H}function G(H){return H<=1&&(H=100*H+"%"),H}function K(H){return r.round(255*parseFloat(H)).toString(16)}function te(H){return B(H)/255}var Y,J,re,U=(J="[\\s|\\(]+("+(Y="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+Y+")[,|\\s]+("+Y+")\\s*\\)?",re="[\\s|\\(]+("+Y+")[,|\\s]+("+Y+")[,|\\s]+("+Y+")[,|\\s]+("+Y+")\\s*\\)?",{CSS_UNIT:new RegExp(Y),rgb:new RegExp("rgb"+J),rgba:new RegExp("rgba"+re),hsl:new RegExp("hsl"+J),hsla:new RegExp("hsla"+re),hsv:new RegExp("hsv"+J),hsva:new RegExp("hsva"+re),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function V(H){return!!U.CSS_UNIT.exec(H)}o!==void 0&&o.exports?o.exports=d:window.tinycolor=d})(Math)},{}],313:[function(t,o,f){o.exports=a,o.exports.float32=o.exports.float=a,o.exports.fract32=o.exports.fract=function(l,c){if(l.length){if(l instanceof Float32Array)return new Float32Array(l.length);c instanceof Float32Array||(c=a(l));for(var i=0,s=c.length;ib&&(b=T[0]),T[1]k&&(k=T[1])}function M(T){switch(T.type){case"GeometryCollection":T.geometries.forEach(M);break;case"Point":w(T.coordinates);break;case"MultiPoint":T.coordinates.forEach(w)}}for(v in y.arcs.forEach(function(T){for(var E,S=-1,P=T.length;++Sb&&(b=E[0]),E[1]k&&(k=E[1])}),y.objects)M(y.objects[v]);return[_,A,b,k]}function i(y,v){var x=v.id,_=v.bbox,A=v.properties==null?{}:v.properties,b=s(y,v);return x==null&&_==null?{type:"Feature",properties:A,geometry:b}:_==null?{type:"Feature",id:x,properties:A,geometry:b}:{type:"Feature",id:x,bbox:_,properties:A,geometry:b}}function s(y,v){var x=l(y.transform),_=y.arcs;function A(T,E){E.length&&E.pop();for(var S=_[T<0?~T:T],P=0,L=S.length;P1)_=d(y,v,x);else for(A=0,_=new Array(b=y.arcs.length);A1)for(var E,S,P=1,L=k(T[0]);PL&&(S=T[0],T[0]=T[P],T[P]=S,L=E);return T}).filter(function(w){return w.length>0})}}function p(y,v){for(var x=0,_=y.length;x<_;){var A=x+_>>>1;y[A]=2))throw new Error("n must be ≥2");var x,_=(w=y.bbox||c(y))[0],A=w[1],b=w[2],k=w[3];v={scale:[b-_?(b-_)/(x-1):1,k-A?(k-A)/(x-1):1],translate:[_,A]}}var w,M,T=g(v),E=y.objects,S={};function P(R){return T(R)}function L(R){var F;switch(R.type){case"GeometryCollection":F={type:"GeometryCollection",geometries:R.geometries.map(L)};break;case"Point":F={type:"Point",coordinates:P(R.coordinates)};break;case"MultiPoint":F={type:"MultiPoint",coordinates:R.coordinates.map(P)};break;default:return R}return R.id!=null&&(F.id=R.id),R.bbox!=null&&(F.bbox=R.bbox),R.properties!=null&&(F.properties=R.properties),F}for(M in E)S[M]=L(E[M]);return{type:"Topology",bbox:w,transform:v,objects:S,arcs:y.arcs.map(function(R){var F,D=0,O=1,N=R.length,B=new Array(N);for(B[0]=T(R[0],0);++D":(c.length>100&&(c=c.slice(0,99)+"…"),c=c.replace(a,function(i){switch(i){case` -`:return"\\n";case"\r":return"\\r";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029";default:throw new Error("Unexpected character")}}))}},{"./safe-to-string":318}],320:[function(t,o,f){var r=t("../value/is"),a={object:!0,function:!0,undefined:!0};o.exports=function(l){return!!r(l)&&hasOwnProperty.call(a,typeof l)}},{"../value/is":326}],321:[function(t,o,f){var r=t("../lib/resolve-exception"),a=t("./is");o.exports=function(l){return a(l)?l:r(l,"%v is not a plain function",arguments[1])}},{"../lib/resolve-exception":317,"./is":322}],322:[function(t,o,f){var r=t("../function/is"),a=/^\s*class[\s{/}]/,l=Function.prototype.toString;o.exports=function(c){return!!r(c)&&!a.test(l.call(c))}},{"../function/is":316}],323:[function(t,o,f){var r=t("../object/is");o.exports=function(a){if(!r(a))return!1;try{return!!a.constructor&&a.constructor.prototype===a}catch{return!1}}},{"../object/is":320}],324:[function(t,o,f){var r=t("../value/is"),a=t("../object/is"),l=Object.prototype.toString;o.exports=function(c){if(!r(c))return null;if(a(c)){var i=c.toString;if(typeof i!="function"||i===l)return null}try{return""+c}catch{return null}}},{"../object/is":320,"../value/is":326}],325:[function(t,o,f){var r=t("../lib/resolve-exception"),a=t("./is");o.exports=function(l){return a(l)?l:r(l,"Cannot use %v",arguments[1])}},{"../lib/resolve-exception":317,"./is":326}],326:[function(t,o,f){o.exports=function(r){return r!=null}},{}],327:[function(t,o,f){(function(r){(function(){var a=t("bit-twiddle"),l=t("dup"),c=t("buffer").Buffer;r.__TYPEDARRAY_POOL||(r.__TYPEDARRAY_POOL={UINT8:l([32,0]),UINT16:l([32,0]),UINT32:l([32,0]),BIGUINT64:l([32,0]),INT8:l([32,0]),INT16:l([32,0]),INT32:l([32,0]),BIGINT64:l([32,0]),FLOAT:l([32,0]),DOUBLE:l([32,0]),DATA:l([32,0]),UINT8C:l([32,0]),BUFFER:l([32,0])});var i=typeof Uint8ClampedArray<"u",s=typeof BigUint64Array<"u",u=typeof BigInt64Array<"u",h=r.__TYPEDARRAY_POOL;h.UINT8C||(h.UINT8C=l([32,0])),h.BIGUINT64||(h.BIGUINT64=l([32,0])),h.BIGINT64||(h.BIGINT64=l([32,0])),h.BUFFER||(h.BUFFER=l([32,0]));var d=h.DATA,m=h.BUFFER;function p(L){if(L){var R=L.length||L.byteLength,F=a.log2(R);d[F].push(L)}}function g(L){L=a.nextPow2(L);var R=a.log2(L),F=d[R];return F.length>0?F.pop():new ArrayBuffer(L)}function y(L){return new Uint8Array(g(L),0,L)}function v(L){return new Uint16Array(g(2*L),0,L)}function x(L){return new Uint32Array(g(4*L),0,L)}function _(L){return new Int8Array(g(L),0,L)}function A(L){return new Int16Array(g(2*L),0,L)}function b(L){return new Int32Array(g(4*L),0,L)}function k(L){return new Float32Array(g(4*L),0,L)}function w(L){return new Float64Array(g(8*L),0,L)}function M(L){return i?new Uint8ClampedArray(g(L),0,L):y(L)}function T(L){return s?new BigUint64Array(g(8*L),0,L):null}function E(L){return u?new BigInt64Array(g(8*L),0,L):null}function S(L){return new DataView(g(L),0,L)}function P(L){L=a.nextPow2(L);var R=a.log2(L),F=m[R];return F.length>0?F.pop():new c(L)}f.free=function(L){if(c.isBuffer(L))m[a.log2(L.length)].push(L);else{if(Object.prototype.toString.call(L)!=="[object ArrayBuffer]"&&(L=L.buffer),!L)return;var R=L.length||L.byteLength,F=0|a.log2(R);d[F].push(L)}},f.freeUint8=f.freeUint16=f.freeUint32=f.freeBigUint64=f.freeInt8=f.freeInt16=f.freeInt32=f.freeBigInt64=f.freeFloat32=f.freeFloat=f.freeFloat64=f.freeDouble=f.freeUint8Clamped=f.freeDataView=function(L){p(L.buffer)},f.freeArrayBuffer=p,f.freeBuffer=function(L){m[a.log2(L.length)].push(L)},f.malloc=function(L,R){if(R===void 0||R==="arraybuffer")return g(L);switch(R){case"uint8":return y(L);case"uint16":return v(L);case"uint32":return x(L);case"int8":return _(L);case"int16":return A(L);case"int32":return b(L);case"float":case"float32":return k(L);case"double":case"float64":return w(L);case"uint8_clamped":return M(L);case"bigint64":return E(L);case"biguint64":return T(L);case"buffer":return P(L);case"data":case"dataview":return S(L);default:return null}return null},f.mallocArrayBuffer=g,f.mallocUint8=y,f.mallocUint16=v,f.mallocUint32=x,f.mallocInt8=_,f.mallocInt16=A,f.mallocInt32=b,f.mallocFloat32=f.mallocFloat=k,f.mallocFloat64=f.mallocDouble=w,f.mallocUint8Clamped=M,f.mallocBigUint64=T,f.mallocBigInt64=E,f.mallocDataView=S,f.mallocBuffer=P,f.clearCache=function(){for(var L=0;L<32;++L)h.UINT8[L].length=0,h.UINT16[L].length=0,h.UINT32[L].length=0,h.INT8[L].length=0,h.INT16[L].length=0,h.INT32[L].length=0,h.FLOAT[L].length=0,h.DOUBLE[L].length=0,h.BIGUINT64[L].length=0,h.BIGINT64[L].length=0,h.UINT8C[L].length=0,d[L].length=0,m[L].length=0}}).call(this)}).call(this,typeof jo<"u"?jo:typeof self<"u"?self:typeof window<"u"?window:{})},{"bit-twiddle":81,buffer:85,dup:128}],328:[function(t,o,f){var r=/[\'\"]/;o.exports=function(a){return a?(r.test(a.charAt(0))&&(a=a.substr(1)),r.test(a.charAt(a.length-1))&&(a=a.substr(0,a.length-1)),a):""}},{}],329:[function(t,o,f){o.exports=function(r,a,l){Array.isArray(l)||(l=[].slice.call(arguments,2));for(var c=0,i=l.length;c2111)throw g.replace(/\{0\}/,this.local.name);return p},toMonthIndex:function(p,g,y){var v=this.intercalaryMonth(p);if(y&&g!==v||g<1||g>12)throw r.local.invalidMonth.replace(/\{0\}/,this.local.name);return v?!y&&g<=v?g-1:g:g-1},toChineseMonth:function(p,g){p.year&&(g=(p=p.year()).month());var y=this.intercalaryMonth(p);if(g<0||g>(y?12:11))throw r.local.invalidMonth.replace(/\{0\}/,this.local.name);return y?g>13},isIntercalaryMonth:function(p,g){p.year&&(g=(p=p.year()).month());var y=this.intercalaryMonth(p);return!!y&&y===g},leapYear:function(p){return this.intercalaryMonth(p)!==0},weekOfYear:function(p,g,y){var v,x=this._validateYear(p,r.local.invalidyear),_=m[x-m[0]],A=_>>9&4095,b=_>>5&15,k=31&_;(v=l.newDate(A,b,k)).add(4-(v.dayOfWeek()||7),"d");var w=this.toJD(p,g,y)-v.toJD();return 1+Math.floor(w/7)},monthsInYear:function(p){return this.leapYear(p)?13:12},daysInMonth:function(p,g){p.year&&(g=p.month(),p=p.year()),p=this._validateYear(p);var y=d[p-d[0]];if(g>(y>>13?12:11))throw r.local.invalidMonth.replace(/\{0\}/,this.local.name);return y&1<<12-g?30:29},weekDay:function(p,g,y){return(this.dayOfWeek(p,g,y)||7)<6},toJD:function(p,g,y){var v=this._validate(p,_,y,r.local.invalidDate);p=this._validateYear(v.year()),g=v.month(),y=v.day();var x=this.isIntercalaryMonth(p,g),_=this.toChineseMonth(p,g),A=function(b,k,w,M,T){var E,S,P;if(typeof b=="object")S=b,E=k||{};else{var L;if(!(typeof b=="number"&&b>=1888&&b<=2111))throw new Error("Lunar year outside range 1888-2111");if(!(typeof k=="number"&&k>=1&&k<=12))throw new Error("Lunar month outside range 1 - 12");if(!(typeof w=="number"&&w>=1&&w<=30))throw new Error("Lunar day outside range 1 - 30");typeof M=="object"?(L=!1,E=M):(L=!!M,E=T||{}),S={year:b,month:k,day:w,isIntercalary:L}}P=S.day-1;var R,F=d[S.year-d[0]],D=F>>13;R=D&&(S.month>D||S.isIntercalary)?S.month:S.month-1;for(var O=0;O>9&4095,(N>>5&15)-1,(31&N)+P);return E.year=B.getFullYear(),E.month=1+B.getMonth(),E.day=B.getDate(),E}(p,_,y,x);return l.toJD(A.year,A.month,A.day)},fromJD:function(p){var g=l.fromJD(p),y=function(x,_,A,b){var k,w;if(typeof x=="object")k=x,w=_||{};else{if(!(typeof x=="number"&&x>=1888&&x<=2111))throw new Error("Solar year outside range 1888-2111");if(!(typeof _=="number"&&_>=1&&_<=12))throw new Error("Solar month outside range 1 - 12");if(!(typeof A=="number"&&A>=1&&A<=31))throw new Error("Solar day outside range 1 - 31");k={year:x,month:_,day:A},w=b||{}}var M=m[k.year-m[0]],T=k.year<<9|k.month<<5|k.day;w.year=T>=M?k.year:k.year-1,M=m[w.year-m[0]];var E,S=new Date(M>>9&4095,(M>>5&15)-1,31&M),P=new Date(k.year,k.month-1,k.day);E=Math.round((P-S)/864e5);var L,R=d[w.year-d[0]];for(L=0;L<13;L++){var F=R&1<<12-L?30:29;if(E>13;return!D||L=2&&h<=6},extraInfo:function(i,s,u){var h=this._validate(i,s,u,r.local.invalidDate);return{century:c[Math.floor((h.year()-1)/100)+1]||""}},toJD:function(i,s,u){var h=this._validate(i,s,u,r.local.invalidDate);return i=h.year()+(h.year()<0?1:0),s=h.month(),(u=h.day())+(s>1?16:0)+(s>2?32*(s-2):0)+400*(i-1)+this.jdEpoch-1},fromJD:function(i){i=Math.floor(i+.5)-Math.floor(this.jdEpoch)-1;var s=Math.floor(i/400)+1;i-=400*(s-1),i+=i>15?16:0;var u=Math.floor(i/32)+1,h=i-32*(u-1)+1;return this.newDate(s<=0?s-1:s,u,h)}});var c={20:"Fruitbat",21:"Anchovy"};r.calendars.discworld=l},{"../main":346,"object-assign":247}],335:[function(t,o,f){var r=t("../main"),a=t("object-assign");function l(c){this.local=this.regionalOptions[c||""]||this.regionalOptions[""]}l.prototype=new r.baseCalendar,a(l.prototype,{name:"Ethiopian",jdEpoch:17242205e-1,daysPerMonth:[30,30,30,30,30,30,30,30,30,30,30,30,5],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Ethiopian",epochs:["BEE","EE"],monthNames:["Meskerem","Tikemet","Hidar","Tahesas","Tir","Yekatit","Megabit","Miazia","Genbot","Sene","Hamle","Nehase","Pagume"],monthNamesShort:["Mes","Tik","Hid","Tah","Tir","Yek","Meg","Mia","Gen","Sen","Ham","Neh","Pag"],dayNames:["Ehud","Segno","Maksegno","Irob","Hamus","Arb","Kidame"],dayNamesShort:["Ehu","Seg","Mak","Iro","Ham","Arb","Kid"],dayNamesMin:["Eh","Se","Ma","Ir","Ha","Ar","Ki"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:!1}},leapYear:function(c){var i=this._validate(c,this.minMonth,this.minDay,r.local.invalidYear);return(c=i.year()+(i.year()<0?1:0))%4==3||c%4==-1},monthsInYear:function(c){return this._validate(c,this.minMonth,this.minDay,r.local.invalidYear||r.regionalOptions[""].invalidYear),13},weekOfYear:function(c,i,s){var u=this.newDate(c,i,s);return u.add(-u.dayOfWeek(),"d"),Math.floor((u.dayOfYear()-1)/7)+1},daysInMonth:function(c,i){var s=this._validate(c,i,this.minDay,r.local.invalidMonth);return this.daysPerMonth[s.month()-1]+(s.month()===13&&this.leapYear(s.year())?1:0)},weekDay:function(c,i,s){return(this.dayOfWeek(c,i,s)||7)<6},toJD:function(c,i,s){var u=this._validate(c,i,s,r.local.invalidDate);return(c=u.year())<0&&c++,u.day()+30*(u.month()-1)+365*(c-1)+Math.floor(c/4)+this.jdEpoch-1},fromJD:function(c){var i=Math.floor(c)+.5-this.jdEpoch,s=Math.floor((i-Math.floor((i+366)/1461))/365)+1;s<=0&&s--,i=Math.floor(c)+.5-this.newDate(s,1,1).toJD();var u=Math.floor(i/30)+1,h=i-30*(u-1)+1;return this.newDate(s,u,h)}}),r.calendars.ethiopian=l},{"../main":346,"object-assign":247}],336:[function(t,o,f){var r=t("../main"),a=t("object-assign");function l(i){this.local=this.regionalOptions[i||""]||this.regionalOptions[""]}function c(i,s){return i-s*Math.floor(i/s)}l.prototype=new r.baseCalendar,a(l.prototype,{name:"Hebrew",jdEpoch:347995.5,daysPerMonth:[30,29,30,29,30,29,30,29,30,29,30,29,29],hasYearZero:!1,minMonth:1,firstMonth:7,minDay:1,regionalOptions:{"":{name:"Hebrew",epochs:["BAM","AM"],monthNames:["Nisan","Iyar","Sivan","Tammuz","Av","Elul","Tishrei","Cheshvan","Kislev","Tevet","Shevat","Adar","Adar II"],monthNamesShort:["Nis","Iya","Siv","Tam","Av","Elu","Tis","Che","Kis","Tev","She","Ada","Ad2"],dayNames:["Yom Rishon","Yom Sheni","Yom Shlishi","Yom Revi'i","Yom Chamishi","Yom Shishi","Yom Shabbat"],dayNamesShort:["Ris","She","Shl","Rev","Cha","Shi","Sha"],dayNamesMin:["Ri","She","Shl","Re","Ch","Shi","Sha"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:!1}},leapYear:function(i){var s=this._validate(i,this.minMonth,this.minDay,r.local.invalidYear);return this._leapYear(s.year())},_leapYear:function(i){return c(7*(i=i<0?i+1:i)+1,19)<7},monthsInYear:function(i){return this._validate(i,this.minMonth,this.minDay,r.local.invalidYear),this._leapYear(i.year?i.year():i)?13:12},weekOfYear:function(i,s,u){var h=this.newDate(i,s,u);return h.add(-h.dayOfWeek(),"d"),Math.floor((h.dayOfYear()-1)/7)+1},daysInYear:function(i){return i=this._validate(i,this.minMonth,this.minDay,r.local.invalidYear).year(),this.toJD(i===-1?1:i+1,7,1)-this.toJD(i,7,1)},daysInMonth:function(i,s){return i.year&&(s=i.month(),i=i.year()),this._validate(i,s,this.minDay,r.local.invalidMonth),s===12&&this.leapYear(i)||s===8&&c(this.daysInYear(i),10)===5?30:s===9&&c(this.daysInYear(i),10)===3?29:this.daysPerMonth[s-1]},weekDay:function(i,s,u){return this.dayOfWeek(i,s,u)!==6},extraInfo:function(i,s,u){var h=this._validate(i,s,u,r.local.invalidDate);return{yearType:(this.leapYear(h)?"embolismic":"common")+" "+["deficient","regular","complete"][this.daysInYear(h)%10-3]}},toJD:function(i,s,u){var h=this._validate(i,s,u,r.local.invalidDate);i=h.year(),s=h.month(),u=h.day();var d=i<=0?i+1:i,m=this.jdEpoch+this._delay1(d)+this._delay2(d)+u+1;if(s<7){for(var p=7;p<=this.monthsInYear(i);p++)m+=this.daysInMonth(i,p);for(p=1;p=this.toJD(s===-1?1:s+1,7,1);)s++;for(var u=ithis.toJD(s,u,this.daysInMonth(s,u));)u++;var h=i-this.toJD(s,u,1)+1;return this.newDate(s,u,h)}}),r.calendars.hebrew=l},{"../main":346,"object-assign":247}],337:[function(t,o,f){var r=t("../main"),a=t("object-assign");function l(c){this.local=this.regionalOptions[c||""]||this.regionalOptions[""]}l.prototype=new r.baseCalendar,a(l.prototype,{name:"Islamic",jdEpoch:19484395e-1,daysPerMonth:[30,29,30,29,30,29,30,29,30,29,30,29],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Islamic",epochs:["BH","AH"],monthNames:["Muharram","Safar","Rabi' al-awwal","Rabi' al-thani","Jumada al-awwal","Jumada al-thani","Rajab","Sha'aban","Ramadan","Shawwal","Dhu al-Qi'dah","Dhu al-Hijjah"],monthNamesShort:["Muh","Saf","Rab1","Rab2","Jum1","Jum2","Raj","Sha'","Ram","Shaw","DhuQ","DhuH"],dayNames:["Yawm al-ahad","Yawm al-ithnayn","Yawm ath-thulaathaa'","Yawm al-arbi'aa'","Yawm al-khamīs","Yawm al-jum'a","Yawm as-sabt"],dayNamesShort:["Aha","Ith","Thu","Arb","Kha","Jum","Sab"],dayNamesMin:["Ah","It","Th","Ar","Kh","Ju","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:6,isRTL:!1}},leapYear:function(c){return(11*this._validate(c,this.minMonth,this.minDay,r.local.invalidYear).year()+14)%30<11},weekOfYear:function(c,i,s){var u=this.newDate(c,i,s);return u.add(-u.dayOfWeek(),"d"),Math.floor((u.dayOfYear()-1)/7)+1},daysInYear:function(c){return this.leapYear(c)?355:354},daysInMonth:function(c,i){var s=this._validate(c,i,this.minDay,r.local.invalidMonth);return this.daysPerMonth[s.month()-1]+(s.month()===12&&this.leapYear(s.year())?1:0)},weekDay:function(c,i,s){return this.dayOfWeek(c,i,s)!==5},toJD:function(c,i,s){var u=this._validate(c,i,s,r.local.invalidDate);return c=u.year(),i=u.month(),c=c<=0?c+1:c,(s=u.day())+Math.ceil(29.5*(i-1))+354*(c-1)+Math.floor((3+11*c)/30)+this.jdEpoch-1},fromJD:function(c){c=Math.floor(c)+.5;var i=Math.floor((30*(c-this.jdEpoch)+10646)/10631);i=i<=0?i-1:i;var s=Math.min(12,Math.ceil((c-29-this.toJD(i,1,1))/29.5)+1),u=c-this.toJD(i,s,1)+1;return this.newDate(i,s,u)}}),r.calendars.islamic=l},{"../main":346,"object-assign":247}],338:[function(t,o,f){var r=t("../main"),a=t("object-assign");function l(c){this.local=this.regionalOptions[c||""]||this.regionalOptions[""]}l.prototype=new r.baseCalendar,a(l.prototype,{name:"Julian",jdEpoch:17214235e-1,daysPerMonth:[31,28,31,30,31,30,31,31,30,31,30,31],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Julian",epochs:["BC","AD"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"mm/dd/yyyy",firstDay:0,isRTL:!1}},leapYear:function(c){var i=this._validate(c,this.minMonth,this.minDay,r.local.invalidYear);return(c=i.year()<0?i.year()+1:i.year())%4==0},weekOfYear:function(c,i,s){var u=this.newDate(c,i,s);return u.add(4-(u.dayOfWeek()||7),"d"),Math.floor((u.dayOfYear()-1)/7)+1},daysInMonth:function(c,i){var s=this._validate(c,i,this.minDay,r.local.invalidMonth);return this.daysPerMonth[s.month()-1]+(s.month()===2&&this.leapYear(s.year())?1:0)},weekDay:function(c,i,s){return(this.dayOfWeek(c,i,s)||7)<6},toJD:function(c,i,s){var u=this._validate(c,i,s,r.local.invalidDate);return c=u.year(),i=u.month(),s=u.day(),c<0&&c++,i<=2&&(c--,i+=12),Math.floor(365.25*(c+4716))+Math.floor(30.6001*(i+1))+s-1524.5},fromJD:function(c){var i=Math.floor(c+.5)+1524,s=Math.floor((i-122.1)/365.25),u=Math.floor(365.25*s),h=Math.floor((i-u)/30.6001),d=h-Math.floor(h<14?1:13),m=s-Math.floor(d>2?4716:4715),p=i-u-Math.floor(30.6001*h);return m<=0&&m--,this.newDate(m,d,p)}}),r.calendars.julian=l},{"../main":346,"object-assign":247}],339:[function(t,o,f){var r=t("../main"),a=t("object-assign");function l(s){this.local=this.regionalOptions[s||""]||this.regionalOptions[""]}function c(s,u){return s-u*Math.floor(s/u)}function i(s,u){return c(s-1,u)+1}l.prototype=new r.baseCalendar,a(l.prototype,{name:"Mayan",jdEpoch:584282.5,hasYearZero:!0,minMonth:0,firstMonth:0,minDay:0,regionalOptions:{"":{name:"Mayan",epochs:["",""],monthNames:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17"],monthNamesShort:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17"],dayNames:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"],dayNamesShort:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"],dayNamesMin:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"],digits:null,dateFormat:"YYYY.m.d",firstDay:0,isRTL:!1,haabMonths:["Pop","Uo","Zip","Zotz","Tzec","Xul","Yaxkin","Mol","Chen","Yax","Zac","Ceh","Mac","Kankin","Muan","Pax","Kayab","Cumku","Uayeb"],tzolkinMonths:["Imix","Ik","Akbal","Kan","Chicchan","Cimi","Manik","Lamat","Muluc","Oc","Chuen","Eb","Ben","Ix","Men","Cib","Caban","Etznab","Cauac","Ahau"]}},leapYear:function(s){return this._validate(s,this.minMonth,this.minDay,r.local.invalidYear),!1},formatYear:function(s){s=this._validate(s,this.minMonth,this.minDay,r.local.invalidYear).year();var u=Math.floor(s/400);return s%=400,s+=s<0?400:0,u+"."+Math.floor(s/20)+"."+s%20},forYear:function(s){if((s=s.split(".")).length<3)throw"Invalid Mayan year";for(var u=0,h=0;h19||h>0&&d<0)throw"Invalid Mayan year";u=20*u+d}return u},monthsInYear:function(s){return this._validate(s,this.minMonth,this.minDay,r.local.invalidYear),18},weekOfYear:function(s,u,h){return this._validate(s,u,h,r.local.invalidDate),0},daysInYear:function(s){return this._validate(s,this.minMonth,this.minDay,r.local.invalidYear),360},daysInMonth:function(s,u){return this._validate(s,u,this.minDay,r.local.invalidMonth),20},daysInWeek:function(){return 5},dayOfWeek:function(s,u,h){return this._validate(s,u,h,r.local.invalidDate).day()},weekDay:function(s,u,h){return this._validate(s,u,h,r.local.invalidDate),!0},extraInfo:function(s,u,h){var d=this._validate(s,u,h,r.local.invalidDate).toJD(),m=this._toHaab(d),p=this._toTzolkin(d);return{haabMonthName:this.local.haabMonths[m[0]-1],haabMonth:m[0],haabDay:m[1],tzolkinDayName:this.local.tzolkinMonths[p[0]-1],tzolkinDay:p[0],tzolkinTrecena:p[1]}},_toHaab:function(s){var u=c((s-=this.jdEpoch)+8+340,365);return[Math.floor(u/20)+1,c(u,20)]},_toTzolkin:function(s){return[i((s-=this.jdEpoch)+20,20),i(s+4,13)]},toJD:function(s,u,h){var d=this._validate(s,u,h,r.local.invalidDate);return d.day()+20*d.month()+360*d.year()+this.jdEpoch},fromJD:function(s){s=Math.floor(s)+.5-this.jdEpoch;var u=Math.floor(s/360);s%=360,s+=s<0?360:0;var h=Math.floor(s/20),d=s%20;return this.newDate(u,h,d)}}),r.calendars.mayan=l},{"../main":346,"object-assign":247}],340:[function(t,o,f){var r=t("../main"),a=t("object-assign");function l(i){this.local=this.regionalOptions[i||""]||this.regionalOptions[""]}l.prototype=new r.baseCalendar;var c=r.instance("gregorian");a(l.prototype,{name:"Nanakshahi",jdEpoch:22576735e-1,daysPerMonth:[31,31,31,31,31,30,30,30,30,30,30,30],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Nanakshahi",epochs:["BN","AN"],monthNames:["Chet","Vaisakh","Jeth","Harh","Sawan","Bhadon","Assu","Katak","Maghar","Poh","Magh","Phagun"],monthNamesShort:["Che","Vai","Jet","Har","Saw","Bha","Ass","Kat","Mgr","Poh","Mgh","Pha"],dayNames:["Somvaar","Mangalvar","Budhvaar","Veervaar","Shukarvaar","Sanicharvaar","Etvaar"],dayNamesShort:["Som","Mangal","Budh","Veer","Shukar","Sanichar","Et"],dayNamesMin:["So","Ma","Bu","Ve","Sh","Sa","Et"],digits:null,dateFormat:"dd-mm-yyyy",firstDay:0,isRTL:!1}},leapYear:function(i){var s=this._validate(i,this.minMonth,this.minDay,r.local.invalidYear||r.regionalOptions[""].invalidYear);return c.leapYear(s.year()+(s.year()<1?1:0)+1469)},weekOfYear:function(i,s,u){var h=this.newDate(i,s,u);return h.add(1-(h.dayOfWeek()||7),"d"),Math.floor((h.dayOfYear()-1)/7)+1},daysInMonth:function(i,s){var u=this._validate(i,s,this.minDay,r.local.invalidMonth);return this.daysPerMonth[u.month()-1]+(u.month()===12&&this.leapYear(u.year())?1:0)},weekDay:function(i,s,u){return(this.dayOfWeek(i,s,u)||7)<6},toJD:function(i,s,u){var h=this._validate(i,s,u,r.local.invalidMonth);(i=h.year())<0&&i++;for(var d=h.day(),m=1;m=this.toJD(s+1,1,1);)s++;for(var u=i-Math.floor(this.toJD(s,1,1)+.5)+1,h=1;u>this.daysInMonth(s,h);)u-=this.daysInMonth(s,h),h++;return this.newDate(s,h,u)}}),r.calendars.nanakshahi=l},{"../main":346,"object-assign":247}],341:[function(t,o,f){var r=t("../main"),a=t("object-assign");function l(c){this.local=this.regionalOptions[c||""]||this.regionalOptions[""]}l.prototype=new r.baseCalendar,a(l.prototype,{name:"Nepali",jdEpoch:17007095e-1,daysPerMonth:[31,31,32,32,31,30,30,29,30,29,30,30],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,daysPerYear:365,regionalOptions:{"":{name:"Nepali",epochs:["BBS","ABS"],monthNames:["Baisakh","Jestha","Ashadh","Shrawan","Bhadra","Ashwin","Kartik","Mangsir","Paush","Mangh","Falgun","Chaitra"],monthNamesShort:["Bai","Je","As","Shra","Bha","Ash","Kar","Mang","Pau","Ma","Fal","Chai"],dayNames:["Aaitabaar","Sombaar","Manglbaar","Budhabaar","Bihibaar","Shukrabaar","Shanibaar"],dayNamesShort:["Aaita","Som","Mangl","Budha","Bihi","Shukra","Shani"],dayNamesMin:["Aai","So","Man","Bu","Bi","Shu","Sha"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:1,isRTL:!1}},leapYear:function(c){return this.daysInYear(c)!==this.daysPerYear},weekOfYear:function(c,i,s){var u=this.newDate(c,i,s);return u.add(-u.dayOfWeek(),"d"),Math.floor((u.dayOfYear()-1)/7)+1},daysInYear:function(c){if(c=this._validate(c,this.minMonth,this.minDay,r.local.invalidYear).year(),this.NEPALI_CALENDAR_DATA[c]===void 0)return this.daysPerYear;for(var i=0,s=this.minMonth;s<=12;s++)i+=this.NEPALI_CALENDAR_DATA[c][s];return i},daysInMonth:function(c,i){return c.year&&(i=c.month(),c=c.year()),this._validate(c,i,this.minDay,r.local.invalidMonth),this.NEPALI_CALENDAR_DATA[c]===void 0?this.daysPerMonth[i-1]:this.NEPALI_CALENDAR_DATA[c][i]},weekDay:function(c,i,s){return this.dayOfWeek(c,i,s)!==6},toJD:function(c,i,s){var u=this._validate(c,i,s,r.local.invalidDate);c=u.year(),i=u.month(),s=u.day();var h=r.instance(),d=0,m=i,p=c;this._createMissingCalendarData(c);var g=c-(m>9||m===9&&s>=this.NEPALI_CALENDAR_DATA[p][0]?56:57);for(i!==9&&(d=s,m--);m!==9;)m<=0&&(m=12,p--),d+=this.NEPALI_CALENDAR_DATA[p][m],m--;return i===9?(d+=s-this.NEPALI_CALENDAR_DATA[p][0])<0&&(d+=h.daysInYear(g)):d+=this.NEPALI_CALENDAR_DATA[p][9]-this.NEPALI_CALENDAR_DATA[p][0],h.newDate(g,1,1).add(d,"d").toJD()},fromJD:function(c){var i=r.instance().fromJD(c),s=i.year(),u=i.dayOfYear(),h=s+56;this._createMissingCalendarData(h);for(var d=9,m=this.NEPALI_CALENDAR_DATA[h][0],p=this.NEPALI_CALENDAR_DATA[h][d]-m+1;u>p;)++d>12&&(d=1,h++),p+=this.NEPALI_CALENDAR_DATA[h][d];var g=this.NEPALI_CALENDAR_DATA[h][d]-(p-u);return this.newDate(h,d,g)},_createMissingCalendarData:function(c){var i=this.daysPerMonth.slice(0);i.unshift(17);for(var s=c-1;s0?474:473))%2820+474+38)%2816<682},weekOfYear:function(i,s,u){var h=this.newDate(i,s,u);return h.add(-(h.dayOfWeek()+1)%7,"d"),Math.floor((h.dayOfYear()-1)/7)+1},daysInMonth:function(i,s){var u=this._validate(i,s,this.minDay,r.local.invalidMonth);return this.daysPerMonth[u.month()-1]+(u.month()===12&&this.leapYear(u.year())?1:0)},weekDay:function(i,s,u){return this.dayOfWeek(i,s,u)!==5},toJD:function(i,s,u){var h=this._validate(i,s,u,r.local.invalidDate);i=h.year(),s=h.month(),u=h.day();var d=i-(i>=0?474:473),m=474+c(d,2820);return u+(s<=7?31*(s-1):30*(s-1)+6)+Math.floor((682*m-110)/2816)+365*(m-1)+1029983*Math.floor(d/2820)+this.jdEpoch-1},fromJD:function(i){var s=(i=Math.floor(i)+.5)-this.toJD(475,1,1),u=Math.floor(s/1029983),h=c(s,1029983),d=2820;if(h!==1029982){var m=Math.floor(h/366),p=c(h,366);d=Math.floor((2134*m+2816*p+2815)/1028522)+m+1}var g=d+2820*u+474;g=g<=0?g-1:g;var y=i-this.toJD(g,1,1)+1,v=y<=186?Math.ceil(y/31):Math.ceil((y-6)/30),x=i-this.toJD(g,v,1)+1;return this.newDate(g,v,x)}}),r.calendars.persian=l,r.calendars.jalali=l},{"../main":346,"object-assign":247}],343:[function(t,o,f){var r=t("../main"),a=t("object-assign"),l=r.instance();function c(i){this.local=this.regionalOptions[i||""]||this.regionalOptions[""]}c.prototype=new r.baseCalendar,a(c.prototype,{name:"Taiwan",jdEpoch:24194025e-1,yearsOffset:1911,daysPerMonth:[31,28,31,30,31,30,31,31,30,31,30,31],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Taiwan",epochs:["BROC","ROC"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:1,isRTL:!1}},leapYear:function(i){var s=this._validate(i,this.minMonth,this.minDay,r.local.invalidYear);return i=this._t2gYear(s.year()),l.leapYear(i)},weekOfYear:function(i,s,u){var h=this._validate(i,this.minMonth,this.minDay,r.local.invalidYear);return i=this._t2gYear(h.year()),l.weekOfYear(i,h.month(),h.day())},daysInMonth:function(i,s){var u=this._validate(i,s,this.minDay,r.local.invalidMonth);return this.daysPerMonth[u.month()-1]+(u.month()===2&&this.leapYear(u.year())?1:0)},weekDay:function(i,s,u){return(this.dayOfWeek(i,s,u)||7)<6},toJD:function(i,s,u){var h=this._validate(i,s,u,r.local.invalidDate);return i=this._t2gYear(h.year()),l.toJD(i,h.month(),h.day())},fromJD:function(i){var s=l.fromJD(i),u=this._g2tYear(s.year());return this.newDate(u,s.month(),s.day())},_t2gYear:function(i){return i+this.yearsOffset+(i>=-this.yearsOffset&&i<=-1?1:0)},_g2tYear:function(i){return i-this.yearsOffset-(i>=1&&i<=this.yearsOffset?1:0)}}),r.calendars.taiwan=c},{"../main":346,"object-assign":247}],344:[function(t,o,f){var r=t("../main"),a=t("object-assign"),l=r.instance();function c(i){this.local=this.regionalOptions[i||""]||this.regionalOptions[""]}c.prototype=new r.baseCalendar,a(c.prototype,{name:"Thai",jdEpoch:15230985e-1,yearsOffset:543,daysPerMonth:[31,28,31,30,31,30,31,31,30,31,30,31],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Thai",epochs:["BBE","BE"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:!1}},leapYear:function(i){var s=this._validate(i,this.minMonth,this.minDay,r.local.invalidYear);return i=this._t2gYear(s.year()),l.leapYear(i)},weekOfYear:function(i,s,u){var h=this._validate(i,this.minMonth,this.minDay,r.local.invalidYear);return i=this._t2gYear(h.year()),l.weekOfYear(i,h.month(),h.day())},daysInMonth:function(i,s){var u=this._validate(i,s,this.minDay,r.local.invalidMonth);return this.daysPerMonth[u.month()-1]+(u.month()===2&&this.leapYear(u.year())?1:0)},weekDay:function(i,s,u){return(this.dayOfWeek(i,s,u)||7)<6},toJD:function(i,s,u){var h=this._validate(i,s,u,r.local.invalidDate);return i=this._t2gYear(h.year()),l.toJD(i,h.month(),h.day())},fromJD:function(i){var s=l.fromJD(i),u=this._g2tYear(s.year());return this.newDate(u,s.month(),s.day())},_t2gYear:function(i){return i-this.yearsOffset-(i>=1&&i<=this.yearsOffset?1:0)},_g2tYear:function(i){return i+this.yearsOffset+(i>=-this.yearsOffset&&i<=-1?1:0)}}),r.calendars.thai=c},{"../main":346,"object-assign":247}],345:[function(t,o,f){var r=t("../main"),a=t("object-assign");function l(i){this.local=this.regionalOptions[i||""]||this.regionalOptions[""]}l.prototype=new r.baseCalendar,a(l.prototype,{name:"UmmAlQura",hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Umm al-Qura",epochs:["BH","AH"],monthNames:["Al-Muharram","Safar","Rabi' al-awwal","Rabi' Al-Thani","Jumada Al-Awwal","Jumada Al-Thani","Rajab","Sha'aban","Ramadan","Shawwal","Dhu al-Qi'dah","Dhu al-Hijjah"],monthNamesShort:["Muh","Saf","Rab1","Rab2","Jum1","Jum2","Raj","Sha'","Ram","Shaw","DhuQ","DhuH"],dayNames:["Yawm al-Ahad","Yawm al-Ithnain","Yawm al-Thalāthā’","Yawm al-Arba‘ā’","Yawm al-Khamīs","Yawm al-Jum‘a","Yawm al-Sabt"],dayNamesMin:["Ah","Ith","Th","Ar","Kh","Ju","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:6,isRTL:!0}},leapYear:function(i){var s=this._validate(i,this.minMonth,this.minDay,r.local.invalidYear);return this.daysInYear(s.year())===355},weekOfYear:function(i,s,u){var h=this.newDate(i,s,u);return h.add(-h.dayOfWeek(),"d"),Math.floor((h.dayOfYear()-1)/7)+1},daysInYear:function(i){for(var s=0,u=1;u<=12;u++)s+=this.daysInMonth(i,u);return s},daysInMonth:function(i,s){for(var u=this._validate(i,s,this.minDay,r.local.invalidMonth).toJD()-24e5+.5,h=0,d=0;du)return c[h]-c[h-1];h++}return 30},weekDay:function(i,s,u){return this.dayOfWeek(i,s,u)!==5},toJD:function(i,s,u){var h=this._validate(i,s,u,r.local.invalidDate),d=12*(h.year()-1)+h.month()-15292;return h.day()+c[d-1]-1+24e5-.5},fromJD:function(i){for(var s=i-24e5+.5,u=0,h=0;hs);h++)u++;var d=u+15292,m=Math.floor((d-1)/12),p=m+1,g=d-12*m,y=s-c[u-1]+1;return this.newDate(p,g,y)},isValid:function(i,s,u){var h=r.baseCalendar.prototype.isValid.apply(this,arguments);return h&&(h=(i=i.year!=null?i.year:i)>=1276&&i<=1500),h},_validate:function(i,s,u,h){var d=r.baseCalendar.prototype._validate.apply(this,arguments);if(d.year<1276||d.year>1500)throw h.replace(/\{0\}/,this.local.name);return d}}),r.calendars.ummalqura=l;var c=[20,50,79,109,138,168,197,227,256,286,315,345,374,404,433,463,492,522,551,581,611,641,670,700,729,759,788,818,847,877,906,936,965,995,1024,1054,1083,1113,1142,1172,1201,1231,1260,1290,1320,1350,1379,1409,1438,1468,1497,1527,1556,1586,1615,1645,1674,1704,1733,1763,1792,1822,1851,1881,1910,1940,1969,1999,2028,2058,2087,2117,2146,2176,2205,2235,2264,2294,2323,2353,2383,2413,2442,2472,2501,2531,2560,2590,2619,2649,2678,2708,2737,2767,2796,2826,2855,2885,2914,2944,2973,3003,3032,3062,3091,3121,3150,3180,3209,3239,3268,3298,3327,3357,3386,3416,3446,3476,3505,3535,3564,3594,3623,3653,3682,3712,3741,3771,3800,3830,3859,3889,3918,3948,3977,4007,4036,4066,4095,4125,4155,4185,4214,4244,4273,4303,4332,4362,4391,4421,4450,4480,4509,4539,4568,4598,4627,4657,4686,4716,4745,4775,4804,4834,4863,4893,4922,4952,4981,5011,5040,5070,5099,5129,5158,5188,5218,5248,5277,5307,5336,5366,5395,5425,5454,5484,5513,5543,5572,5602,5631,5661,5690,5720,5749,5779,5808,5838,5867,5897,5926,5956,5985,6015,6044,6074,6103,6133,6162,6192,6221,6251,6281,6311,6340,6370,6399,6429,6458,6488,6517,6547,6576,6606,6635,6665,6694,6724,6753,6783,6812,6842,6871,6901,6930,6960,6989,7019,7048,7078,7107,7137,7166,7196,7225,7255,7284,7314,7344,7374,7403,7433,7462,7492,7521,7551,7580,7610,7639,7669,7698,7728,7757,7787,7816,7846,7875,7905,7934,7964,7993,8023,8053,8083,8112,8142,8171,8201,8230,8260,8289,8319,8348,8378,8407,8437,8466,8496,8525,8555,8584,8614,8643,8673,8702,8732,8761,8791,8821,8850,8880,8909,8938,8968,8997,9027,9056,9086,9115,9145,9175,9205,9234,9264,9293,9322,9352,9381,9410,9440,9470,9499,9529,9559,9589,9618,9648,9677,9706,9736,9765,9794,9824,9853,9883,9913,9943,9972,10002,10032,10061,10090,10120,10149,10178,10208,10237,10267,10297,10326,10356,10386,10415,10445,10474,10504,10533,10562,10592,10621,10651,10680,10710,10740,10770,10799,10829,10858,10888,10917,10947,10976,11005,11035,11064,11094,11124,11153,11183,11213,11242,11272,11301,11331,11360,11389,11419,11448,11478,11507,11537,11567,11596,11626,11655,11685,11715,11744,11774,11803,11832,11862,11891,11921,11950,11980,12010,12039,12069,12099,12128,12158,12187,12216,12246,12275,12304,12334,12364,12393,12423,12453,12483,12512,12542,12571,12600,12630,12659,12688,12718,12747,12777,12807,12837,12866,12896,12926,12955,12984,13014,13043,13072,13102,13131,13161,13191,13220,13250,13280,13310,13339,13368,13398,13427,13456,13486,13515,13545,13574,13604,13634,13664,13693,13723,13752,13782,13811,13840,13870,13899,13929,13958,13988,14018,14047,14077,14107,14136,14166,14195,14224,14254,14283,14313,14342,14372,14401,14431,14461,14490,14520,14550,14579,14609,14638,14667,14697,14726,14756,14785,14815,14844,14874,14904,14933,14963,14993,15021,15051,15081,15110,15140,15169,15199,15228,15258,15287,15317,15347,15377,15406,15436,15465,15494,15524,15553,15582,15612,15641,15671,15701,15731,15760,15790,15820,15849,15878,15908,15937,15966,15996,16025,16055,16085,16114,16144,16174,16204,16233,16262,16292,16321,16350,16380,16409,16439,16468,16498,16528,16558,16587,16617,16646,16676,16705,16734,16764,16793,16823,16852,16882,16912,16941,16971,17001,17030,17060,17089,17118,17148,17177,17207,17236,17266,17295,17325,17355,17384,17414,17444,17473,17502,17532,17561,17591,17620,17650,17679,17709,17738,17768,17798,17827,17857,17886,17916,17945,17975,18004,18034,18063,18093,18122,18152,18181,18211,18241,18270,18300,18330,18359,18388,18418,18447,18476,18506,18535,18565,18595,18625,18654,18684,18714,18743,18772,18802,18831,18860,18890,18919,18949,18979,19008,19038,19068,19098,19127,19156,19186,19215,19244,19274,19303,19333,19362,19392,19422,19452,19481,19511,19540,19570,19599,19628,19658,19687,19717,19746,19776,19806,19836,19865,19895,19924,19954,19983,20012,20042,20071,20101,20130,20160,20190,20219,20249,20279,20308,20338,20367,20396,20426,20455,20485,20514,20544,20573,20603,20633,20662,20692,20721,20751,20780,20810,20839,20869,20898,20928,20957,20987,21016,21046,21076,21105,21135,21164,21194,21223,21253,21282,21312,21341,21371,21400,21430,21459,21489,21519,21548,21578,21607,21637,21666,21696,21725,21754,21784,21813,21843,21873,21902,21932,21962,21991,22021,22050,22080,22109,22138,22168,22197,22227,22256,22286,22316,22346,22375,22405,22434,22464,22493,22522,22552,22581,22611,22640,22670,22700,22730,22759,22789,22818,22848,22877,22906,22936,22965,22994,23024,23054,23083,23113,23143,23173,23202,23232,23261,23290,23320,23349,23379,23408,23438,23467,23497,23527,23556,23586,23616,23645,23674,23704,23733,23763,23792,23822,23851,23881,23910,23940,23970,23999,24029,24058,24088,24117,24147,24176,24206,24235,24265,24294,24324,24353,24383,24413,24442,24472,24501,24531,24560,24590,24619,24648,24678,24707,24737,24767,24796,24826,24856,24885,24915,24944,24974,25003,25032,25062,25091,25121,25150,25180,25210,25240,25269,25299,25328,25358,25387,25416,25446,25475,25505,25534,25564,25594,25624,25653,25683,25712,25742,25771,25800,25830,25859,25888,25918,25948,25977,26007,26037,26067,26096,26126,26155,26184,26214,26243,26272,26302,26332,26361,26391,26421,26451,26480,26510,26539,26568,26598,26627,26656,26686,26715,26745,26775,26805,26834,26864,26893,26923,26952,26982,27011,27041,27070,27099,27129,27159,27188,27218,27248,27277,27307,27336,27366,27395,27425,27454,27484,27513,27542,27572,27602,27631,27661,27691,27720,27750,27779,27809,27838,27868,27897,27926,27956,27985,28015,28045,28074,28104,28134,28163,28193,28222,28252,28281,28310,28340,28369,28399,28428,28458,28488,28517,28547,28577,28607,28636,28665,28695,28724,28754,28783,28813,28843,28872,28901,28931,28960,28990,29019,29049,29078,29108,29137,29167,29196,29226,29255,29285,29315,29345,29375,29404,29434,29463,29492,29522,29551,29580,29610,29640,29669,29699,29729,29759,29788,29818,29847,29876,29906,29935,29964,29994,30023,30053,30082,30112,30141,30171,30200,30230,30259,30289,30318,30348,30378,30408,30437,30467,30496,30526,30555,30585,30614,30644,30673,30703,30732,30762,30791,30821,30850,30880,30909,30939,30968,30998,31027,31057,31086,31116,31145,31175,31204,31234,31263,31293,31322,31352,31381,31411,31441,31471,31500,31530,31559,31589,31618,31648,31676,31706,31736,31766,31795,31825,31854,31884,31913,31943,31972,32002,32031,32061,32090,32120,32150,32180,32209,32239,32268,32298,32327,32357,32386,32416,32445,32475,32504,32534,32563,32593,32622,32652,32681,32711,32740,32770,32799,32829,32858,32888,32917,32947,32976,33006,33035,33065,33094,33124,33153,33183,33213,33243,33272,33302,33331,33361,33390,33420,33450,33479,33509,33539,33568,33598,33627,33657,33686,33716,33745,33775,33804,33834,33863,33893,33922,33952,33981,34011,34040,34069,34099,34128,34158,34187,34217,34247,34277,34306,34336,34365,34395,34424,34454,34483,34512,34542,34571,34601,34631,34660,34690,34719,34749,34778,34808,34837,34867,34896,34926,34955,34985,35015,35044,35074,35103,35133,35162,35192,35222,35251,35280,35310,35340,35370,35399,35429,35458,35488,35517,35547,35576,35605,35635,35665,35694,35723,35753,35782,35811,35841,35871,35901,35930,35960,35989,36019,36048,36078,36107,36136,36166,36195,36225,36254,36284,36314,36343,36373,36403,36433,36462,36492,36521,36551,36580,36610,36639,36669,36698,36728,36757,36786,36816,36845,36875,36904,36934,36963,36993,37022,37052,37081,37111,37141,37170,37200,37229,37259,37288,37318,37347,37377,37406,37436,37465,37495,37524,37554,37584,37613,37643,37672,37701,37731,37760,37790,37819,37849,37878,37908,37938,37967,37997,38027,38056,38085,38115,38144,38174,38203,38233,38262,38292,38322,38351,38381,38410,38440,38469,38499,38528,38558,38587,38617,38646,38676,38705,38735,38764,38794,38823,38853,38882,38912,38941,38971,39001,39030,39059,39089,39118,39148,39178,39208,39237,39267,39297,39326,39355,39385,39414,39444,39473,39503,39532,39562,39592,39621,39650,39680,39709,39739,39768,39798,39827,39857,39886,39916,39946,39975,40005,40035,40064,40094,40123,40153,40182,40212,40241,40271,40300,40330,40359,40389,40418,40448,40477,40507,40536,40566,40595,40625,40655,40685,40714,40744,40773,40803,40832,40862,40892,40921,40951,40980,41009,41039,41068,41098,41127,41157,41186,41216,41245,41275,41304,41334,41364,41393,41422,41452,41481,41511,41540,41570,41599,41629,41658,41688,41718,41748,41777,41807,41836,41865,41894,41924,41953,41983,42012,42042,42072,42102,42131,42161,42190,42220,42249,42279,42308,42337,42367,42397,42426,42456,42485,42515,42545,42574,42604,42633,42662,42692,42721,42751,42780,42810,42839,42869,42899,42929,42958,42988,43017,43046,43076,43105,43135,43164,43194,43223,43253,43283,43312,43342,43371,43401,43430,43460,43489,43519,43548,43578,43607,43637,43666,43696,43726,43755,43785,43814,43844,43873,43903,43932,43962,43991,44021,44050,44080,44109,44139,44169,44198,44228,44258,44287,44317,44346,44375,44405,44434,44464,44493,44523,44553,44582,44612,44641,44671,44700,44730,44759,44788,44818,44847,44877,44906,44936,44966,44996,45025,45055,45084,45114,45143,45172,45202,45231,45261,45290,45320,45350,45380,45409,45439,45468,45498,45527,45556,45586,45615,45644,45674,45704,45733,45763,45793,45823,45852,45882,45911,45940,45970,45999,46028,46058,46088,46117,46147,46177,46206,46236,46265,46295,46324,46354,46383,46413,46442,46472,46501,46531,46560,46590,46620,46649,46679,46708,46738,46767,46797,46826,46856,46885,46915,46944,46974,47003,47033,47063,47092,47122,47151,47181,47210,47240,47269,47298,47328,47357,47387,47417,47446,47476,47506,47535,47565,47594,47624,47653,47682,47712,47741,47771,47800,47830,47860,47890,47919,47949,47978,48008,48037,48066,48096,48125,48155,48184,48214,48244,48273,48303,48333,48362,48392,48421,48450,48480,48509,48538,48568,48598,48627,48657,48687,48717,48746,48776,48805,48834,48864,48893,48922,48952,48982,49011,49041,49071,49100,49130,49160,49189,49218,49248,49277,49306,49336,49365,49395,49425,49455,49484,49514,49543,49573,49602,49632,49661,49690,49720,49749,49779,49809,49838,49868,49898,49927,49957,49986,50016,50045,50075,50104,50133,50163,50192,50222,50252,50281,50311,50340,50370,50400,50429,50459,50488,50518,50547,50576,50606,50635,50665,50694,50724,50754,50784,50813,50843,50872,50902,50931,50960,50990,51019,51049,51078,51108,51138,51167,51197,51227,51256,51286,51315,51345,51374,51403,51433,51462,51492,51522,51552,51582,51611,51641,51670,51699,51729,51758,51787,51816,51846,51876,51906,51936,51965,51995,52025,52054,52083,52113,52142,52171,52200,52230,52260,52290,52319,52349,52379,52408,52438,52467,52497,52526,52555,52585,52614,52644,52673,52703,52733,52762,52792,52822,52851,52881,52910,52939,52969,52998,53028,53057,53087,53116,53146,53176,53205,53235,53264,53294,53324,53353,53383,53412,53441,53471,53500,53530,53559,53589,53619,53648,53678,53708,53737,53767,53796,53825,53855,53884,53913,53943,53973,54003,54032,54062,54092,54121,54151,54180,54209,54239,54268,54297,54327,54357,54387,54416,54446,54476,54505,54535,54564,54593,54623,54652,54681,54711,54741,54770,54800,54830,54859,54889,54919,54948,54977,55007,55036,55066,55095,55125,55154,55184,55213,55243,55273,55302,55332,55361,55391,55420,55450,55479,55508,55538,55567,55597,55627,55657,55686,55716,55745,55775,55804,55834,55863,55892,55922,55951,55981,56011,56040,56070,56100,56129,56159,56188,56218,56247,56276,56306,56335,56365,56394,56424,56454,56483,56513,56543,56572,56601,56631,56660,56690,56719,56749,56778,56808,56837,56867,56897,56926,56956,56985,57015,57044,57074,57103,57133,57162,57192,57221,57251,57280,57310,57340,57369,57399,57429,57458,57487,57517,57546,57576,57605,57634,57664,57694,57723,57753,57783,57813,57842,57871,57901,57930,57959,57989,58018,58048,58077,58107,58137,58167,58196,58226,58255,58285,58314,58343,58373,58402,58432,58461,58491,58521,58551,58580,58610,58639,58669,58698,58727,58757,58786,58816,58845,58875,58905,58934,58964,58994,59023,59053,59082,59111,59141,59170,59200,59229,59259,59288,59318,59348,59377,59407,59436,59466,59495,59525,59554,59584,59613,59643,59672,59702,59731,59761,59791,59820,59850,59879,59909,59939,59968,59997,60027,60056,60086,60115,60145,60174,60204,60234,60264,60293,60323,60352,60381,60411,60440,60469,60499,60528,60558,60588,60618,60648,60677,60707,60736,60765,60795,60824,60853,60883,60912,60942,60972,61002,61031,61061,61090,61120,61149,61179,61208,61237,61267,61296,61326,61356,61385,61415,61445,61474,61504,61533,61563,61592,61621,61651,61680,61710,61739,61769,61799,61828,61858,61888,61917,61947,61976,62006,62035,62064,62094,62123,62153,62182,62212,62242,62271,62301,62331,62360,62390,62419,62448,62478,62507,62537,62566,62596,62625,62655,62685,62715,62744,62774,62803,62832,62862,62891,62921,62950,62980,63009,63039,63069,63099,63128,63157,63187,63216,63246,63275,63305,63334,63363,63393,63423,63453,63482,63512,63541,63571,63600,63630,63659,63689,63718,63747,63777,63807,63836,63866,63895,63925,63955,63984,64014,64043,64073,64102,64131,64161,64190,64220,64249,64279,64309,64339,64368,64398,64427,64457,64486,64515,64545,64574,64603,64633,64663,64692,64722,64752,64782,64811,64841,64870,64899,64929,64958,64987,65017,65047,65076,65106,65136,65166,65195,65225,65254,65283,65313,65342,65371,65401,65431,65460,65490,65520,65549,65579,65608,65638,65667,65697,65726,65755,65785,65815,65844,65874,65903,65933,65963,65992,66022,66051,66081,66110,66140,66169,66199,66228,66258,66287,66317,66346,66376,66405,66435,66465,66494,66524,66553,66583,66612,66641,66671,66700,66730,66760,66789,66819,66849,66878,66908,66937,66967,66996,67025,67055,67084,67114,67143,67173,67203,67233,67262,67292,67321,67351,67380,67409,67439,67468,67497,67527,67557,67587,67617,67646,67676,67705,67735,67764,67793,67823,67852,67882,67911,67941,67971,68e3,68030,68060,68089,68119,68148,68177,68207,68236,68266,68295,68325,68354,68384,68414,68443,68473,68502,68532,68561,68591,68620,68650,68679,68708,68738,68768,68797,68827,68857,68886,68916,68946,68975,69004,69034,69063,69092,69122,69152,69181,69211,69240,69270,69300,69330,69359,69388,69418,69447,69476,69506,69535,69565,69595,69624,69654,69684,69713,69743,69772,69802,69831,69861,69890,69919,69949,69978,70008,70038,70067,70097,70126,70156,70186,70215,70245,70274,70303,70333,70362,70392,70421,70451,70481,70510,70540,70570,70599,70629,70658,70687,70717,70746,70776,70805,70835,70864,70894,70924,70954,70983,71013,71042,71071,71101,71130,71159,71189,71218,71248,71278,71308,71337,71367,71397,71426,71455,71485,71514,71543,71573,71602,71632,71662,71691,71721,71751,71781,71810,71839,71869,71898,71927,71957,71986,72016,72046,72075,72105,72135,72164,72194,72223,72253,72282,72311,72341,72370,72400,72429,72459,72489,72518,72548,72577,72607,72637,72666,72695,72725,72754,72784,72813,72843,72872,72902,72931,72961,72991,73020,73050,73080,73109,73139,73168,73197,73227,73256,73286,73315,73345,73375,73404,73434,73464,73493,73523,73552,73581,73611,73640,73669,73699,73729,73758,73788,73818,73848,73877,73907,73936,73965,73995,74024,74053,74083,74113,74142,74172,74202,74231,74261,74291,74320,74349,74379,74408,74437,74467,74497,74526,74556,74586,74615,74645,74675,74704,74733,74763,74792,74822,74851,74881,74910,74940,74969,74999,75029,75058,75088,75117,75147,75176,75206,75235,75264,75294,75323,75353,75383,75412,75442,75472,75501,75531,75560,75590,75619,75648,75678,75707,75737,75766,75796,75826,75856,75885,75915,75944,75974,76003,76032,76062,76091,76121,76150,76180,76210,76239,76269,76299,76328,76358,76387,76416,76446,76475,76505,76534,76564,76593,76623,76653,76682,76712,76741,76771,76801,76830,76859,76889,76918,76948,76977,77007,77036,77066,77096,77125,77155,77185,77214,77243,77273,77302,77332,77361,77390,77420,77450,77479,77509,77539,77569,77598,77627,77657,77686,77715,77745,77774,77804,77833,77863,77893,77923,77952,77982,78011,78041,78070,78099,78129,78158,78188,78217,78247,78277,78307,78336,78366,78395,78425,78454,78483,78513,78542,78572,78601,78631,78661,78690,78720,78750,78779,78808,78838,78867,78897,78926,78956,78985,79015,79044,79074,79104,79133,79163,79192,79222,79251,79281,79310,79340,79369,79399,79428,79458,79487,79517,79546,79576,79606,79635,79665,79695,79724,79753,79783,79812,79841,79871,79900,79930,79960,79990]},{"../main":346,"object-assign":247}],346:[function(t,o,f){var r=t("object-assign");function a(){this.regionalOptions=[],this.regionalOptions[""]={invalidCalendar:"Calendar {0} not found",invalidDate:"Invalid {0} date",invalidMonth:"Invalid {0} month",invalidYear:"Invalid {0} year",differentCalendars:"Cannot mix {0} and {1} dates"},this.local=this.regionalOptions[""],this.calendars={},this._localCals={}}function l(h,d,m,p){if(this._calendar=h,this._year=d,this._month=m,this._day=p,this._calendar._validateLevel===0&&!this._calendar.isValid(this._year,this._month,this._day))throw(u.local.invalidDate||u.regionalOptions[""].invalidDate).replace(/\{0\}/,this._calendar.local.name)}function c(h,d){return"000000".substring(0,d-(h=""+h).length)+h}function i(){this.shortYearCutoff="+10"}function s(h){this.local=this.regionalOptions[h]||this.regionalOptions[""]}r(a.prototype,{instance:function(h,d){h=(h||"gregorian").toLowerCase(),d=d||"";var m=this._localCals[h+"-"+d];if(!m&&this.calendars[h]&&(m=new this.calendars[h](d),this._localCals[h+"-"+d]=m),!m)throw(this.local.invalidCalendar||this.regionalOptions[""].invalidCalendar).replace(/\{0\}/,h);return m},newDate:function(h,d,m,p,g){return(p=(h!=null&&h.year?h.calendar():typeof p=="string"?this.instance(p,g):p)||this.instance()).newDate(h,d,m)},substituteDigits:function(h){return function(d){return(d+"").replace(/[0-9]/g,function(m){return h[m]})}},substituteChineseDigits:function(h,d){return function(m){for(var p="",g=0;m>0;){var y=m%10;p=(y===0?"":h[y]+d[g])+p,g++,m=Math.floor(m/10)}return p.indexOf(h[1]+d[1])===0&&(p=p.substr(1)),p||h[0]}}}),r(l.prototype,{newDate:function(h,d,m){return this._calendar.newDate(h??this,d,m)},year:function(h){return arguments.length===0?this._year:this.set(h,"y")},month:function(h){return arguments.length===0?this._month:this.set(h,"m")},day:function(h){return arguments.length===0?this._day:this.set(h,"d")},date:function(h,d,m){if(!this._calendar.isValid(h,d,m))throw(u.local.invalidDate||u.regionalOptions[""].invalidDate).replace(/\{0\}/,this._calendar.local.name);return this._year=h,this._month=d,this._day=m,this},leapYear:function(){return this._calendar.leapYear(this)},epoch:function(){return this._calendar.epoch(this)},formatYear:function(){return this._calendar.formatYear(this)},monthOfYear:function(){return this._calendar.monthOfYear(this)},weekOfYear:function(){return this._calendar.weekOfYear(this)},daysInYear:function(){return this._calendar.daysInYear(this)},dayOfYear:function(){return this._calendar.dayOfYear(this)},daysInMonth:function(){return this._calendar.daysInMonth(this)},dayOfWeek:function(){return this._calendar.dayOfWeek(this)},weekDay:function(){return this._calendar.weekDay(this)},extraInfo:function(){return this._calendar.extraInfo(this)},add:function(h,d){return this._calendar.add(this,h,d)},set:function(h,d){return this._calendar.set(this,h,d)},compareTo:function(h){if(this._calendar.name!==h._calendar.name)throw(u.local.differentCalendars||u.regionalOptions[""].differentCalendars).replace(/\{0\}/,this._calendar.local.name).replace(/\{1\}/,h._calendar.local.name);var d=this._year!==h._year?this._year-h._year:this._month!==h._month?this.monthOfYear()-h.monthOfYear():this._day-h._day;return d===0?0:d<0?-1:1},calendar:function(){return this._calendar},toJD:function(){return this._calendar.toJD(this)},fromJD:function(h){return this._calendar.fromJD(h)},toJSDate:function(){return this._calendar.toJSDate(this)},fromJSDate:function(h){return this._calendar.fromJSDate(h)},toString:function(){return(this.year()<0?"-":"")+c(Math.abs(this.year()),4)+"-"+c(this.month(),2)+"-"+c(this.day(),2)}}),r(i.prototype,{_validateLevel:0,newDate:function(h,d,m){return h==null?this.today():(h.year&&(this._validate(h,d,m,u.local.invalidDate||u.regionalOptions[""].invalidDate),m=h.day(),d=h.month(),h=h.year()),new l(this,h,d,m))},today:function(){return this.fromJSDate(new Date)},epoch:function(h){return this._validate(h,this.minMonth,this.minDay,u.local.invalidYear||u.regionalOptions[""].invalidYear).year()<0?this.local.epochs[0]:this.local.epochs[1]},formatYear:function(h){var d=this._validate(h,this.minMonth,this.minDay,u.local.invalidYear||u.regionalOptions[""].invalidYear);return(d.year()<0?"-":"")+c(Math.abs(d.year()),4)},monthsInYear:function(h){return this._validate(h,this.minMonth,this.minDay,u.local.invalidYear||u.regionalOptions[""].invalidYear),12},monthOfYear:function(h,d){var m=this._validate(h,d,this.minDay,u.local.invalidMonth||u.regionalOptions[""].invalidMonth);return(m.month()+this.monthsInYear(m)-this.firstMonth)%this.monthsInYear(m)+this.minMonth},fromMonthOfYear:function(h,d){var m=(d+this.firstMonth-2*this.minMonth)%this.monthsInYear(h)+this.minMonth;return this._validate(h,m,this.minDay,u.local.invalidMonth||u.regionalOptions[""].invalidMonth),m},daysInYear:function(h){var d=this._validate(h,this.minMonth,this.minDay,u.local.invalidYear||u.regionalOptions[""].invalidYear);return this.leapYear(d)?366:365},dayOfYear:function(h,d,m){var p=this._validate(h,d,m,u.local.invalidDate||u.regionalOptions[""].invalidDate);return p.toJD()-this.newDate(p.year(),this.fromMonthOfYear(p.year(),this.minMonth),this.minDay).toJD()+1},daysInWeek:function(){return 7},dayOfWeek:function(h,d,m){var p=this._validate(h,d,m,u.local.invalidDate||u.regionalOptions[""].invalidDate);return(Math.floor(this.toJD(p))+2)%this.daysInWeek()},extraInfo:function(h,d,m){return this._validate(h,d,m,u.local.invalidDate||u.regionalOptions[""].invalidDate),{}},add:function(h,d,m){return this._validate(h,this.minMonth,this.minDay,u.local.invalidDate||u.regionalOptions[""].invalidDate),this._correctAdd(h,this._add(h,d,m),d,m)},_add:function(h,d,m){if(this._validateLevel++,m==="d"||m==="w"){var p=h.toJD()+d*(m==="w"?this.daysInWeek():1),g=h.calendar().fromJD(p);return this._validateLevel--,[g.year(),g.month(),g.day()]}try{var y=h.year()+(m==="y"?d:0),v=h.monthOfYear()+(m==="m"?d:0);g=h.day(),m==="y"?(h.month()!==this.fromMonthOfYear(y,v)&&(v=this.newDate(y,h.month(),this.minDay).monthOfYear()),v=Math.min(v,this.monthsInYear(y)),g=Math.min(g,this.daysInMonth(y,this.fromMonthOfYear(y,v)))):m==="m"&&(function(_){for(;v<_.minMonth;)y--,v+=_.monthsInYear(y);for(var A=_.monthsInYear(y);v>A-1+_.minMonth;)y++,v-=A,A=_.monthsInYear(y)}(this),g=Math.min(g,this.daysInMonth(y,this.fromMonthOfYear(y,v))));var x=[y,this.fromMonthOfYear(y,v),g];return this._validateLevel--,x}catch(_){throw this._validateLevel--,_}},_correctAdd:function(h,d,m,p){if(!(this.hasYearZero||p!=="y"&&p!=="m"||d[0]!==0&&h.year()>0==d[0]>0)){var g={y:[1,1,"y"],m:[1,this.monthsInYear(-1),"m"],w:[this.daysInWeek(),this.daysInYear(-1),"d"],d:[1,this.daysInYear(-1),"d"]}[p],y=m<0?-1:1;d=this._add(h,m*g[0]+y*g[1],g[2])}return h.date(d[0],d[1],d[2])},set:function(h,d,m){this._validate(h,this.minMonth,this.minDay,u.local.invalidDate||u.regionalOptions[""].invalidDate);var p=m==="y"?d:h.year(),g=m==="m"?d:h.month(),y=m==="d"?d:h.day();return m!=="y"&&m!=="m"||(y=Math.min(y,this.daysInMonth(p,g))),h.date(p,g,y)},isValid:function(h,d,m){this._validateLevel++;var p=this.hasYearZero||h!==0;if(p){var g=this.newDate(h,d,this.minDay);p=d>=this.minMonth&&d-this.minMonth=this.minDay&&m-this.minDay13.5?13:1),A=g-(_>2.5?4716:4715);return A<=0&&A--,this.newDate(A,_,x)},toJSDate:function(h,d,m){var p=this._validate(h,d,m,u.local.invalidDate||u.regionalOptions[""].invalidDate),g=new Date(p.year(),p.month()-1,p.day());return g.setHours(0),g.setMinutes(0),g.setSeconds(0),g.setMilliseconds(0),g.setHours(g.getHours()>12?g.getHours()+2:0),g},fromJSDate:function(h){return this.newDate(h.getFullYear(),h.getMonth()+1,h.getDate())}});var u=o.exports=new a;u.cdate=l,u.baseCalendar=i,u.calendars.gregorian=s},{"object-assign":247}],347:[function(t,o,f){var r=t("object-assign"),a=t("./main");r(a.regionalOptions[""],{invalidArguments:"Invalid arguments",invalidFormat:"Cannot format a date from another calendar",missingNumberAt:"Missing number at position {0}",unknownNameAt:"Unknown name at position {0}",unexpectedLiteralAt:"Unexpected literal at position {0}",unexpectedText:"Additional text found at end"}),a.local=a.regionalOptions[""],r(a.cdate.prototype,{formatDate:function(l,c){return typeof l!="string"&&(c=l,l=""),this._calendar.formatDate(l||"",this,c)}}),r(a.baseCalendar.prototype,{UNIX_EPOCH:a.instance().newDate(1970,1,1).toJD(),SECS_PER_DAY:86400,TICKS_EPOCH:a.instance().jdEpoch,TICKS_PER_DAY:864e9,ATOM:"yyyy-mm-dd",COOKIE:"D, dd M yyyy",FULL:"DD, MM d, yyyy",ISO_8601:"yyyy-mm-dd",JULIAN:"J",RFC_822:"D, d M yy",RFC_850:"DD, dd-M-yy",RFC_1036:"D, d M yy",RFC_1123:"D, d M yyyy",RFC_2822:"D, d M yyyy",RSS:"D, d M yy",TICKS:"!",TIMESTAMP:"@",W3C:"yyyy-mm-dd",formatDate:function(l,c,i){if(typeof l!="string"&&(i=c,c=l,l=""),!c)return"";if(c.calendar()!==this)throw a.local.invalidFormat||a.regionalOptions[""].invalidFormat;l=l||this.local.dateFormat;for(var s,u,h,d,m=(i=i||{}).dayNamesShort||this.local.dayNamesShort,p=i.dayNames||this.local.dayNames,g=i.monthNumbers||this.local.monthNumbers,y=i.monthNamesShort||this.local.monthNamesShort,v=i.monthNames||this.local.monthNames,x=(i.calculateWeek||this.local.calculateWeek,function(P,L){for(var R=1;S+R1}),_=function(P,L,R,F){var D=""+L;if(x(P,F))for(;D.length1},M=function(N,B){var W=w(N,B),G=[2,3,W?4:2,W?4:2,10,11,20]["oyYJ@!".indexOf(N)+1],K=new RegExp("^-?\\d{1,"+G+"}"),te=c.substring(R).match(K);if(!te)throw(a.local.missingNumberAt||a.regionalOptions[""].missingNumberAt).replace(/\{0\}/,R);return R+=te[0].length,parseInt(te[0],10)},T=this,E=function(){if(typeof m=="function"){w("m");var N=m.call(T,c.substring(R));return R+=N.length,N}return M("m")},S=function(N,B,W,G){for(var K=w(N,G)?W:B,te=0;te-1){x=1,_=A;for(var O=this.daysInMonth(v,x);_>O;O=this.daysInMonth(v,x))x++,_-=O}return y>-1?this.fromJD(y):this.newDate(v,x,_)},determineDate:function(l,c,i,s,u){i&&typeof i!="object"&&(u=s,s=i,i=null),typeof s!="string"&&(u=s,s="");var h=this;return c=c?c.newDate():null,l=l==null?c:typeof l=="string"?function(d){try{return h.parseDate(s,d,u)}catch{}for(var m=((d=d.toLowerCase()).match(/^c/)&&i?i.newDate():null)||h.today(),p=/([+-]?[0-9]+)\s*(d|w|m|y)?/g,g=p.exec(d);g;)m.add(parseInt(g[1],10),g[2]||"d"),g=p.exec(d);return m}(l):typeof l=="number"?isNaN(l)||l===1/0||l===-1/0?c:h.today().add(l,"d"):h.newDate(l)}})},{"./main":346,"object-assign":247}],348:[function(t,o,f){o.exports=[{path:"",backoff:0},{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0,noRotate:!0},{path:"M2,2V-2H-2V2Z",backoff:0,noRotate:!0}]},{}],349:[function(t,o,f){var r=t("./arrow_paths"),a=t("../../plots/font_attributes"),l=t("../../plots/cartesian/constants"),c=t("../../plot_api/plot_template").templatedArray;t("../../constants/axis_placeable_objects"),o.exports=c("annotation",{visible:{valType:"boolean",dflt:!0,editType:"calc+arraydraw"},text:{valType:"string",editType:"calc+arraydraw"},textangle:{valType:"angle",dflt:0,editType:"calc+arraydraw"},font:a({editType:"calc+arraydraw",colorEditType:"arraydraw"}),width:{valType:"number",min:1,dflt:null,editType:"calc+arraydraw"},height:{valType:"number",min:1,dflt:null,editType:"calc+arraydraw"},opacity:{valType:"number",min:0,max:1,dflt:1,editType:"arraydraw"},align:{valType:"enumerated",values:["left","center","right"],dflt:"center",editType:"arraydraw"},valign:{valType:"enumerated",values:["top","middle","bottom"],dflt:"middle",editType:"arraydraw"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)",editType:"arraydraw"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)",editType:"arraydraw"},borderpad:{valType:"number",min:0,dflt:1,editType:"calc+arraydraw"},borderwidth:{valType:"number",min:0,dflt:1,editType:"calc+arraydraw"},showarrow:{valType:"boolean",dflt:!0,editType:"calc+arraydraw"},arrowcolor:{valType:"color",editType:"arraydraw"},arrowhead:{valType:"integer",min:0,max:r.length,dflt:1,editType:"arraydraw"},startarrowhead:{valType:"integer",min:0,max:r.length,dflt:1,editType:"arraydraw"},arrowside:{valType:"flaglist",flags:["end","start"],extras:["none"],dflt:"end",editType:"arraydraw"},arrowsize:{valType:"number",min:.3,dflt:1,editType:"calc+arraydraw"},startarrowsize:{valType:"number",min:.3,dflt:1,editType:"calc+arraydraw"},arrowwidth:{valType:"number",min:.1,editType:"calc+arraydraw"},standoff:{valType:"number",min:0,dflt:0,editType:"calc+arraydraw"},startstandoff:{valType:"number",min:0,dflt:0,editType:"calc+arraydraw"},ax:{valType:"any",editType:"calc+arraydraw"},ay:{valType:"any",editType:"calc+arraydraw"},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",l.idRegex.x.toString()],editType:"calc"},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",l.idRegex.y.toString()],editType:"calc"},xref:{valType:"enumerated",values:["paper",l.idRegex.x.toString()],editType:"calc"},x:{valType:"any",editType:"calc+arraydraw"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto",editType:"calc+arraydraw"},xshift:{valType:"number",dflt:0,editType:"calc+arraydraw"},yref:{valType:"enumerated",values:["paper",l.idRegex.y.toString()],editType:"calc"},y:{valType:"any",editType:"calc+arraydraw"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto",editType:"calc+arraydraw"},yshift:{valType:"number",dflt:0,editType:"calc+arraydraw"},clicktoshow:{valType:"enumerated",values:[!1,"onoff","onout"],dflt:!1,editType:"arraydraw"},xclick:{valType:"any",editType:"arraydraw"},yclick:{valType:"any",editType:"arraydraw"},hovertext:{valType:"string",editType:"arraydraw"},hoverlabel:{bgcolor:{valType:"color",editType:"arraydraw"},bordercolor:{valType:"color",editType:"arraydraw"},font:a({editType:"arraydraw"}),editType:"arraydraw"},captureevents:{valType:"boolean",editType:"arraydraw"},editType:"calc",_deprecated:{ref:{valType:"string",editType:"calc"}}})},{"../../constants/axis_placeable_objects":472,"../../plot_api/plot_template":543,"../../plots/cartesian/constants":561,"../../plots/font_attributes":585,"./arrow_paths":348}],350:[function(t,o,f){var r=t("../../lib"),a=t("../../plots/cartesian/axes"),l=t("./draw").draw;function c(s){var u=s._fullLayout;r.filterVisible(u.annotations).forEach(function(h){var d=a.getFromId(s,h.xref),m=a.getFromId(s,h.yref),p=a.getRefType(h.xref),g=a.getRefType(h.yref);h._extremes={},p==="range"&&i(h,d),g==="range"&&i(h,m)})}function i(s,u){var h,d=u._id,m=d.charAt(0),p=s[m],g=s["a"+m],y=s[m+"ref"],v=s["a"+m+"ref"],x=s["_"+m+"padplus"],_=s["_"+m+"padminus"],A={x:1,y:-1}[m]*s[m+"shift"],b=3*s.arrowsize*s.arrowwidth||0,k=b+A,w=b-A,M=3*s.startarrowsize*s.arrowwidth||0,T=M+A,E=M-A;if(v===y){var S=a.findExtremes(u,[u.r2c(p)],{ppadplus:k,ppadminus:w}),P=a.findExtremes(u,[u.r2c(g)],{ppadplus:Math.max(x,T),ppadminus:Math.max(_,E)});h={min:[S.min[0],P.min[0]],max:[S.max[0],P.max[0]]}}else T=g?T+g:T,E=g?E-g:E,h=a.findExtremes(u,[u.r2c(p)],{ppadplus:Math.max(x,k,T),ppadminus:Math.max(_,w,E)});s._extremes[d]=h}o.exports=function(s){var u=s._fullLayout;if(r.filterVisible(u.annotations).length&&s._fullData.length)return r.syncOrAsync([l,c],s)}},{"../../lib":503,"../../plots/cartesian/axes":554,"./draw":355}],351:[function(t,o,f){var r=t("../../lib"),a=t("../../registry"),l=t("../../plot_api/plot_template").arrayEditor;function c(s,u){var h,d,m,p,g,y,v,x=s._fullLayout.annotations,_=[],A=[],b=[],k=(u||[]).length;for(h=0;h0||h.explicitOff.length>0},onClick:function(s,u){var h,d,m=c(s,u),p=m.on,g=m.off.concat(m.explicitOff),y={},v=s._fullLayout.annotations;if(!(!p.length&&!g.length)){for(h=0;h2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[bt]}for(var ze=!1,$e=["x","y"],Ke=0;Ke<$e.length;Ke++){var Re,Ve,We,Ye,nt,ft=$e[Ke],yt=k[ft+"ref"]||ft,Ot=k["a"+ft+"ref"],Tt={x:T,y:E}[ft],at=(K+(ft==="x"?0:-90))*Math.PI/180,et=we*Math.cos(at),Lt=Ce*Math.sin(at),Wt=Math.abs(et)+Math.abs(Lt),Jt=k[ft+"anchor"],Be=k[ft+"shift"]*(ft==="x"?1:-1),Ge=G[ft],kt=s.getRefType(yt);if(Tt&&kt!=="domain"){var dt=Tt.r2fraction(k[ft]);(dt<0||dt>1)&&(Ot===yt?((dt=Tt.r2fraction(k["a"+ft]))<0||dt>1)&&(ze=!0):ze=!0),Re=Tt._offset+Tt.r2p(k[ft]),Ye=.5}else{var Oe=kt==="domain";ft==="x"?(We=k[ft],Re=Oe?Tt._offset+Tt._length*We:Re=R.l+R.w*We):(We=1-k[ft],Re=Oe?Tt._offset+Tt._length*We:Re=R.t+R.h*We),Ye=k.showarrow?.5:We}if(k.showarrow){Ge.head=Re;var Ie=k["a"+ft];if(nt=et*Fe(.5,k.xanchor)-Lt*Fe(.5,k.yanchor),Ot===yt){var Te=s.getRefType(Ot);Te==="domain"?(ft==="y"&&(Ie=1-Ie),Ge.tail=Tt._offset+Tt._length*Ie):Te==="paper"?ft==="y"?(Ie=1-Ie,Ge.tail=R.t+R.h*Ie):Ge.tail=R.l+R.w*Ie:Ge.tail=Tt._offset+Tt.r2p(Ie),Ve=nt}else Ge.tail=Re+Ie,Ve=nt+Ie;Ge.text=Ge.tail+nt;var Pe=L[ft==="x"?"width":"height"];if(yt==="paper"&&(Ge.head=c.constrain(Ge.head,1,Pe-1)),Ot==="pixel"){var qe=-Math.max(Ge.tail-3,Ge.text),rt=Math.min(Ge.tail+3,Ge.text)-Pe;qe>0?(Ge.tail+=qe,Ge.text+=qe):rt>0&&(Ge.tail-=rt,Ge.text-=rt)}Ge.tail+=Be,Ge.head+=Be}else Ve=nt=Wt*Fe(Ye,Jt),Ge.text=Re+nt;Ge.text+=Be,nt+=Be,Ve+=Be,k["_"+ft+"padplus"]=Wt/2+Ve,k["_"+ft+"padminus"]=Wt/2-Ve,k["_"+ft+"size"]=Wt,k["_"+ft+"shift"]=nt}if(ze)U.remove();else{var lt=0,ot=0;if(k.align!=="left"&&(lt=(ve-Le)*(k.align==="center"?.5:1)),k.valign!=="top"&&(ot=(Me-de)*(k.valign==="middle"?.5:1)),Ae)_e.select("svg").attr({x:ne+lt-1,y:ne+ot}).call(h.setClipUrl,Q?W:null,b);else{var At=ne+ot-ke.top,wt=ne+lt-ke.left;ue.call(m.positionText,wt,At).call(h.setClipUrl,Q?W:null,b)}ee.select("rect").call(h.setRect,ne,ne,ve,Me),q.call(h.setRect,V/2,V/2,we-V,Ce-V),U.call(h.setTranslate,Math.round(G.x.text-we/2),Math.round(G.y.text-Ce/2)),Y.attr({transform:"rotate("+K+","+G.x.text+","+G.y.text+")"});var $t,Ut=function(tt,bt){te.selectAll(".annotation-arrow-g").remove();var Ft=G.x.head,Et=G.y.head,Pt=G.x.tail+tt,De=G.y.tail+bt,Je=G.x.text+tt,st=G.y.text+bt,St=c.rotationXYMatrix(K,Je,st),It=c.apply2DTransform(St),Zt=c.apply2DTransform2(St),Kt=+q.attr("width"),qt=+q.attr("height"),mn=Je-.5*Kt,Fn=mn+Kt,pn=st-.5*qt,tn=pn+qt,nn=[[mn,pn,mn,tn],[mn,tn,Fn,tn],[Fn,tn,Fn,pn],[Fn,pn,mn,pn]].map(Zt);if(!nn.reduce(function(Dn,lr){return Dn^!!c.segmentsIntersect(Ft,Et,Ft+1e6,Et+1e6,lr[0],lr[1],lr[2],lr[3])},!1)){nn.forEach(function(Dn){var lr=c.segmentsIntersect(Pt,De,Ft,Et,Dn[0],Dn[1],Dn[2],Dn[3]);lr&&(Pt=lr.x,De=lr.y)});var sn=k.arrowwidth,gn=k.arrowcolor,bn=k.arrowside,In=te.append("g").style({opacity:u.opacity(gn)}).classed("annotation-arrow-g",!0),qn=In.append("path").attr("d","M"+Pt+","+De+"L"+Ft+","+Et).style("stroke-width",sn+"px").call(u.stroke,u.rgb(gn));if(v(qn,bn,k),F.annotationPosition&&qn.node().parentNode&&!M){var Wn=Ft,ar=Et;if(k.standoff){var Dr=Math.sqrt(Math.pow(Ft-Pt,2)+Math.pow(Et-De,2));Wn+=k.standoff*(Pt-Ft)/Dr,ar+=k.standoff*(De-Et)/Dr}var yr,Sr,Kn=In.append("path").classed("annotation-arrow",!0).classed("anndrag",!0).classed("cursor-move",!0).attr({d:"M3,3H-3V-3H3ZM0,0L"+(Pt-Wn)+","+(De-ar),transform:i(Wn,ar)}).style("stroke-width",sn+6+"px").call(u.stroke,"rgba(0,0,0,0)").call(u.fill,"rgba(0,0,0,0)");g.init({element:Kn.node(),gd:b,prepFn:function(){var Dn=h.getTranslate(U);yr=Dn.x,Sr=Dn.y,T&&T.autorange&&O(T._name+".autorange",!0),E&&E.autorange&&O(E._name+".autorange",!0)},moveFn:function(Dn,lr){var Yr=It(yr,Sr),Mn=Yr[0]+Dn,rr=Yr[1]+lr;U.call(h.setTranslate,Mn,rr),N("x",_(T,Dn,"x",R,k)),N("y",_(E,lr,"y",R,k)),k.axref===k.xref&&N("ax",_(T,Dn,"ax",R,k)),k.ayref===k.yref&&N("ay",_(E,lr,"ay",R,k)),In.attr("transform",i(Dn,lr)),Y.attr({transform:"rotate("+K+","+Mn+","+rr+")"})},doneFn:function(){a.call("_guiRelayout",b,B());var Dn=document.querySelector(".js-notes-box-panel");Dn&&Dn.redraw(Dn.selectedObj)}})}}};k.showarrow&&Ut(0,0),J&&g.init({element:U.node(),gd:b,prepFn:function(){$t=Y.attr("transform")},moveFn:function(tt,bt){var Ft="pointer";if(k.showarrow)k.axref===k.xref?N("ax",_(T,tt,"ax",R,k)):N("ax",k.ax+tt),k.ayref===k.yref?N("ay",_(E,bt,"ay",R.w,k)):N("ay",k.ay+bt),Ut(tt,bt);else{if(M)return;var Et,Pt;if(T)Et=_(T,tt,"x",R,k);else{var De=k._xsize/R.w,Je=k.x+(k._xshift-k.xshift)/R.w-De/2;Et=g.align(Je+tt/R.w,De,0,1,k.xanchor)}if(E)Pt=_(E,bt,"y",R,k);else{var st=k._ysize/R.h,St=k.y-(k._yshift+k.yshift)/R.h-st/2;Pt=g.align(St-bt/R.h,st,0,1,k.yanchor)}N("x",Et),N("y",Pt),T&&E||(Ft=g.getCursor(T?.5:Et,E?.5:Pt,k.xanchor,k.yanchor))}Y.attr({transform:i(tt,bt)+$t}),p(U,Ft)},clickFn:function(tt,bt){k.captureevents&&b.emit("plotly_clickannotation",le(bt))},doneFn:function(){p(U),a.call("_guiRelayout",b,B());var tt=document.querySelector(".js-notes-box-panel");tt&&tt.redraw(tt.selectedObj)}})}}}o.exports={draw:function(b){var k=b._fullLayout;k._infolayer.selectAll(".annotation").remove();for(var w=0;w=0,M=d.indexOf("end")>=0,T=_.backoff*b+m.standoff,E=A.backoff*k+m.startstandoff;if(x.nodeName==="line"){p={x:+h.attr("x1"),y:+h.attr("y1")},g={x:+h.attr("x2"),y:+h.attr("y2")};var S=p.x-g.x,P=p.y-g.y;if(v=(y=Math.atan2(P,S))+Math.PI,T&&E&&T+E>Math.sqrt(S*S+P*P))return void te();if(T){if(T*T>S*S+P*P)return void te();var L=T*Math.cos(y),R=T*Math.sin(y);g.x+=L,g.y+=R,h.attr({x2:g.x,y2:g.y})}if(E){if(E*E>S*S+P*P)return void te();var F=E*Math.cos(y),D=E*Math.sin(y);p.x-=F,p.y-=D,h.attr({x1:p.x,y1:p.y})}}else if(x.nodeName==="path"){var O=x.getTotalLength(),N="";if(O1){m=!0;break}}m?c.fullLayout._infolayer.select(".annotation-"+c.id+'[data-index="'+h+'"]').remove():(d._pdata=a(c.glplot.cameraParams,[i.xaxis.r2l(d.x)*s[0],i.yaxis.r2l(d.y)*s[1],i.zaxis.r2l(d.z)*s[2]]),r(c.graphDiv,d,h,c.id,d._xa,d._ya))}}},{"../../plots/gl3d/project":607,"../annotations/draw":355}],362:[function(t,o,f){var r=t("../../registry"),a=t("../../lib");o.exports={moduleType:"component",name:"annotations3d",schema:{subplots:{scene:{annotations:t("./attributes")}}},layoutAttributes:t("./attributes"),handleDefaults:t("./defaults"),includeBasePlot:function(l,c){var i=r.subplotsRegistry.gl3d;if(i)for(var s=i.attrRegex,u=Object.keys(l),h=0;h=0)))return d;if(v===3)g[v]>1&&(g[v]=1);else if(g[v]>=1)return d}var x=Math.round(255*g[0])+", "+Math.round(255*g[1])+", "+Math.round(255*g[2]);return y?"rgba("+x+", "+g[3]+")":"rgb("+x+")"}c.tinyRGB=function(d){var m=d.toRgb();return"rgb("+Math.round(m.r)+", "+Math.round(m.g)+", "+Math.round(m.b)+")"},c.rgb=function(d){return c.tinyRGB(r(d))},c.opacity=function(d){return d?r(d).getAlpha():0},c.addOpacity=function(d,m){var p=r(d).toRgb();return"rgba("+Math.round(p.r)+", "+Math.round(p.g)+", "+Math.round(p.b)+", "+m+")"},c.combine=function(d,m){var p=r(d).toRgb();if(p.a===1)return r(d).toRgbString();var g=r(m||u).toRgb(),y=g.a===1?g:{r:255*(1-g.a)+g.r*g.a,g:255*(1-g.a)+g.g*g.a,b:255*(1-g.a)+g.b*g.a},v={r:y.r*(1-p.a)+p.r*p.a,g:y.g*(1-p.a)+p.g*p.a,b:y.b*(1-p.a)+p.b*p.a};return r(v).toRgbString()},c.contrast=function(d,m,p){var g=r(d);return g.getAlpha()!==1&&(g=r(c.combine(d,u))),(g.isDark()?m?g.lighten(m):u:p?g.darken(p):s).toString()},c.stroke=function(d,m){var p=r(m);d.style({stroke:c.tinyRGB(p),"stroke-opacity":p.getAlpha()})},c.fill=function(d,m){var p=r(m);d.style({fill:c.tinyRGB(p),"fill-opacity":p.getAlpha()})},c.clean=function(d){if(d&&typeof d=="object"){var m,p,g,y,v=Object.keys(d);for(m=0;m0?Ie>=lt:Ie<=lt));Te++)Ie>At&&Ie0?Ie>=lt:Ie<=lt));Te++)Ie>Oe[0]&&Ie1){var Ot=Math.pow(10,Math.floor(Math.log(yt)/Math.LN10));nt*=Ot*u.roundUp(yt/Ot,[2,5,10]),(Math.abs(Ae.start)/Ae.size+1e-6)%1<2e-6&&(We.tick0=0)}We.dtick=nt}We.domain=B?[Re+ne/ie.h,Re+Ce-ne/ie.h]:[Re+H/ie.w,Re+Ce-H/ie.w],We.setScale(),D.attr("transform",h(Math.round(ie.l),Math.round(ie.t)));var Tt,at=D.select("."+E.cbtitleunshift).attr("transform",h(-Math.round(ie.l),-Math.round(ie.t))),et=We.ticklabelposition,Lt=We.title.font.size,Wt=D.select("."+E.cbaxis),Jt=0,Be=0;function Ge(kt,dt){var Oe={propContainer:We,propName:O._propPrefix+"title",traceIndex:O._traceIndex,_meta:O._meta,placeholder:ee._dfltTitle.colorbar,containerGroup:D.select("."+E.cbtitle)},Ie=kt.charAt(0)==="h"?kt.substr(1):"h"+kt;D.selectAll("."+Ie+",."+Ie+"-math-group").remove(),y.draw(N,kt,d(Oe,dt||{}))}return u.syncOrAsync([l.previousPromises,function(){var kt,dt;(B&&Ye||!B&&!Ye)&&(ge==="top"&&(kt=H+ie.l+ie.w*q,dt=ne+ie.t+ie.h*(1-Re-Ce)+3+.75*Lt),ge==="bottom"&&(kt=H+ie.l+ie.w*q,dt=ne+ie.t+ie.h*(1-Re)-3-.25*Lt),ge==="right"&&(dt=ne+ie.t+ie.h*Q+3+.75*Lt,kt=H+ie.l+ie.w*Re),Ge(We._id+"title",{attributes:{x:kt,y:dt,"text-anchor":B?"start":"middle"}}))},function(){if(!B&&!Ye||B&&Ye){var kt,dt=D.select("."+E.cbtitle),Oe=dt.select("text"),Ie=[-Y/2,Y/2],Te=dt.select(".h"+We._id+"title-math-group").node(),Pe=15.6;if(Oe.node()&&(Pe=parseInt(Oe.node().style.fontSize,10)*w),Te?(kt=p.bBox(Te),Be=kt.width,(Jt=kt.height)>Pe&&(Ie[1]-=(Jt-Pe)/2)):Oe.node()&&!Oe.classed(E.jsPlaceholder)&&(kt=p.bBox(Oe.node()),Be=kt.width,Jt=kt.height),B){if(Jt){if(Jt+=5,ge==="top")We.domain[1]-=Jt/ie.h,Ie[1]*=-1;else{We.domain[0]+=Jt/ie.h;var qe=v.lineCount(Oe);Ie[1]+=(1-qe)*Pe}dt.attr("transform",h(Ie[0],Ie[1])),We.setScale()}}else Be&&(ge==="right"&&(We.domain[0]+=(Be+Lt/2)/ie.w),dt.attr("transform",h(Ie[0],Ie[1])),We.setScale())}D.selectAll("."+E.cbfills+",."+E.cblines).attr("transform",B?h(0,Math.round(ie.h*(1-We.domain[1]))):h(Math.round(ie.w*We.domain[0]),0)),Wt.attr("transform",B?h(0,Math.round(-ie.t)):h(Math.round(-ie.l),0));var rt=D.select("."+E.cbfills).selectAll("rect."+E.cbfill).attr("style","").data(Le);rt.enter().append("rect").classed(E.cbfill,!0).style("stroke","none"),rt.exit().remove();var lt=fe.map(We.c2p).map(Math.round).sort(function(Ut,tt){return Ut-tt});rt.each(function(Ut,tt){var bt=[tt===0?fe[0]:(Le[tt]+Le[tt-1])/2,tt===Le.length-1?fe[1]:(Le[tt]+Le[tt+1])/2].map(We.c2p).map(Math.round);B&&(bt[1]=u.constrain(bt[1]+(bt[1]>bt[0])?1:-1,lt[0],lt[1]));var Ft=r.select(this).attr(B?"x":"y",Fe).attr(B?"y":"x",r.min(bt)).attr(B?"width":"height",Math.max(ve,2)).attr(B?"height":"width",Math.max(r.max(bt)-r.min(bt),2));if(O._fillgradient)p.gradient(Ft,N,O._id,B?"vertical":"horizontalreversed",O._fillgradient,"fill");else{var Et=_e(Ut).replace("e-","");Ft.attr("fill",a(Et).toHexString())}});var ot=D.select("."+E.cblines).selectAll("path."+E.cbline).data(ue.color&&ue.width?de:[]);ot.enter().append("path").classed(E.cbline,!0),ot.exit().remove(),ot.each(function(Ut){var tt=Fe,bt=Math.round(We.c2p(Ut))+ue.width/2%1;r.select(this).attr("d","M"+(B?tt+","+bt:bt+","+tt)+(B?"h":"v")+ve).call(p.lineGroupStyle,ue.width,me(Ut),ue.dash)}),Wt.selectAll("g."+We._id+"tick,path").remove();var At=Fe+ve+(Y||0)/2-(O.ticks==="outside"?1:0),wt=i.calcTicks(We),$t=i.getTickSigns(We)[2];return i.drawTicks(N,We,{vals:We.ticks==="inside"?i.clipEnds(We,wt):wt,layer:Wt,path:i.makeTickPath(We,At,$t),transFn:i.makeTransTickFn(We)}),i.drawLabels(N,We,{vals:wt,layer:Wt,transFn:i.makeTransTickLabelFn(We),labelFns:i.makeLabelFns(We,At)})},function(){if(B&&!Ye||!B&&Ye){var kt,dt,Oe=We.position||0,Ie=We._offset+We._length/2;if(ge==="right")dt=Ie,kt=ie.l+ie.w*Oe+10+Lt*(We.showticklabels?1:.5);else if(kt=Ie,ge==="bottom"&&(dt=ie.t+ie.h*Oe+10+(et.indexOf("inside")===-1?We.tickfont.size:0)+(We.ticks!=="intside"&&O.ticklen||0)),ge==="top"){var Te=le.text.split("
    ").length;dt=ie.t+ie.h*Oe+10-ve-w*Lt*Te}Ge((B?"h":"v")+We._id+"title",{avoid:{selection:r.select(N).selectAll("g."+We._id+"tick"),side:ge,offsetTop:B?0:ie.t,offsetLeft:B?ie.l:0,maxShift:B?ee.width:ee.height},attributes:{x:kt,y:dt,"text-anchor":"middle"},transform:{rotate:B?-90:0,offset:0}})}},l.previousPromises,function(){var kt,dt=ve+Y/2;et.indexOf("inside")===-1&&(kt=p.bBox(Wt.node()),dt+=B?kt.width:kt.height),Tt=at.select("text");var Oe=0,Ie=B&&ge==="top",Te=!B&&ge==="right",Pe=0;if(Tt.node()&&!Tt.classed(E.jsPlaceholder)){var qe,rt=at.select(".h"+We._id+"title-math-group").node();rt&&(B&&Ye||!B&&!Ye)?(Oe=(kt=p.bBox(rt)).width,qe=kt.height):(Oe=(kt=p.bBox(at.node())).right-ie.l-(B?Fe:Ve),qe=kt.bottom-ie.t-(B?Ve:Fe),B||ge!=="top"||(dt+=kt.height,Pe=kt.height)),Te&&(Tt.attr("transform",h(Oe/2+Lt/2,0)),Oe*=2),dt=Math.max(dt,B?Oe:qe)}var lt=2*(B?H:ne)+dt+J+Y/2,ot=0;!B&&le.text&&V==="bottom"&&Q<=0&&(lt+=ot=lt/2,Pe+=ot),ee._hColorbarMoveTitle=ot,ee._hColorbarMoveCBTitle=Pe;var At=J+Y;D.select("."+E.cbbg).attr("x",(B?Fe:Ve)-At/2-(B?H:0)).attr("y",(B?Ve:Fe)-(B?we:ne+Pe-ot)).attr(B?"width":"height",Math.max(lt-ot,2)).attr(B?"height":"width",Math.max(we+At,2)).call(g.fill,re).call(g.stroke,O.bordercolor).style("stroke-width",J);var wt=Te?Math.max(Oe-10,0):0;if(D.selectAll("."+E.cboutline).attr("x",(B?Fe:Ve+H)+wt).attr("y",(B?Ve+ne-we:Fe)+(Ie?Jt:0)).attr(B?"width":"height",Math.max(ve,2)).attr(B?"height":"width",Math.max(we-(B?2*ne+Jt:2*H+wt),2)).call(g.stroke,O.outlinecolor).style({fill:"none","stroke-width":Y}),D.attr("transform",h(ie.l-(B?ze*lt:0),ie.t-(B?0:(1-$e)*lt-Pe))),!B&&(J||a(re).getAlpha()&&!a.equals(ee.paper_bgcolor,re))){var $t=Wt.selectAll("text"),Ut=$t[0].length,tt=D.select("."+E.cbbg).node(),bt=p.bBox(tt),Ft=p.getTranslate(D);$t.each(function(It,Zt){var Kt=Ut-1;if(Zt===0||Zt===Kt){var qt,mn=p.bBox(this),Fn=p.getTranslate(this);if(Zt===Kt){var pn=mn.right+Fn.x;(qt=bt.right+Ft.x+Ve-J-2+q-pn)>0&&(qt=0)}else if(Zt===0){var tn=mn.left+Fn.x;(qt=bt.left+Ft.x+Ve+J+2-tn)<0&&(qt=0)}qt&&(Ut<3?this.setAttribute("transform","translate("+qt+",0) "+this.getAttribute("transform")):this.setAttribute("visibility","hidden"))}})}var Et={},Pt=M[U],De=T[U],Je=M[V],st=T[V],St=lt-ve;B?(G==="pixels"?(Et.y=Q,Et.t=we*Je,Et.b=we*st):(Et.t=Et.b=0,Et.yt=Q+W*Je,Et.yb=Q-W*st),te==="pixels"?(Et.x=q,Et.l=lt*Pt,Et.r=lt*De):(Et.l=St*Pt,Et.r=St*De,Et.xl=q-K*Pt,Et.xr=q+K*De)):(G==="pixels"?(Et.x=q,Et.l=we*Pt,Et.r=we*De):(Et.l=Et.r=0,Et.xl=q+W*Pt,Et.xr=q-W*De),te==="pixels"?(Et.y=1-Q,Et.t=lt*Je,Et.b=lt*st):(Et.t=St*Je,Et.b=St*st,Et.yt=Q-K*Je,Et.yb=Q+K*st)),l.autoMargin(N,O._id,Et)}],N)}(R,L,S);F&&F.then&&(S._promises||[]).push(F),S._context.edits.colorbarPosition&&function(D,O,N){var B,W,G,K=O.orientation==="v",te=N._fullLayout._size;s.init({element:D.node(),gd:N,prepFn:function(){B=D.attr("transform"),m(D)},moveFn:function(Y,J){D.attr("transform",B+h(Y,J)),W=s.align((K?O._uFrac:O._vFrac)+Y/te.w,K?O._thickFrac:O._lenFrac,0,1,O.xanchor),G=s.align((K?O._vFrac:1-O._uFrac)-J/te.h,K?O._lenFrac:O._thickFrac,0,1,O.yanchor);var re=s.getCursor(W,G,O.xanchor,O.yanchor);m(D,re)},doneFn:function(){if(m(D),W!==void 0&&G!==void 0){var Y={};Y[O._propPrefix+"x"]=W,Y[O._propPrefix+"y"]=G,O._traceIndex!==void 0?c.call("_guiRestyle",N,Y,O._traceIndex):c.call("_guiRelayout",N,Y)}}})}(R,L,S)}),P.exit().each(function(L){l.autoMargin(S,L._id)}).remove(),P.order()}}},{"../../constants/alignment":471,"../../lib":503,"../../lib/extend":493,"../../lib/setcursor":524,"../../lib/svg_text_utils":529,"../../plots/cartesian/axes":554,"../../plots/cartesian/axis_defaults":556,"../../plots/cartesian/layout_attributes":569,"../../plots/cartesian/position_defaults":572,"../../plots/plots":619,"../../registry":638,"../color":366,"../colorscale/helpers":377,"../dragelement":385,"../drawing":388,"../titles":464,"./constants":368,"@plotly/d3":58,tinycolor2:312}],371:[function(t,o,f){var r=t("../../lib");o.exports=function(a){return r.isPlainObject(a.colorbar)}},{"../../lib":503}],372:[function(t,o,f){o.exports={moduleType:"component",name:"colorbar",attributes:t("./attributes"),supplyDefaults:t("./defaults"),draw:t("./draw").draw,hasColorbar:t("./has_colorbar")}},{"./attributes":367,"./defaults":369,"./draw":370,"./has_colorbar":371}],373:[function(t,o,f){var r=t("../colorbar/attributes"),a=t("../../lib/regex").counter,l=t("../../lib/sort_object_keys"),c=t("./scales.js").scales;l(c);function i(s){return"`"+s+"`"}o.exports=function(s,u){s=s||"";var h,d=(u=u||{}).cLetter||"c",m=("onlyIfNumerical"in u&&u.onlyIfNumerical,"noScale"in u?u.noScale:s==="marker.line"),p="showScaleDflt"in u?u.showScaleDflt:d==="z",g=typeof u.colorscaleDflt=="string"?c[u.colorscaleDflt]:null,y=u.editTypeOverride||"",v=s?s+".":"";"colorAttr"in u?(h=u.colorAttr,u.colorAttr):i(v+(h={z:"z",c:"color"}[d]));var x=d+"auto",_=d+"min",A=d+"max",b=d+"mid",k={};k[_]=k[A]=void 0;var w={};w[x]=!1;var M={};return h==="color"&&(M.color={valType:"color",arrayOk:!0,editType:y||"style"},u.anim&&(M.color.anim=!0)),M[x]={valType:"boolean",dflt:!0,editType:"calc",impliedEdits:k},M[_]={valType:"number",dflt:null,editType:y||"plot",impliedEdits:w},M[A]={valType:"number",dflt:null,editType:y||"plot",impliedEdits:w},M[b]={valType:"number",dflt:null,editType:"calc",impliedEdits:k},M.colorscale={valType:"colorscale",editType:"calc",dflt:g,impliedEdits:{autocolorscale:!1}},M.autocolorscale={valType:"boolean",dflt:u.autoColorDflt!==!1,editType:"calc",impliedEdits:{colorscale:void 0}},M.reversescale={valType:"boolean",dflt:!1,editType:"plot"},m||(M.showscale={valType:"boolean",dflt:p,editType:"calc"},M.colorbar=r),u.noColorAxis||(M.coloraxis={valType:"subplotid",regex:a("coloraxis"),dflt:null,editType:"calc"}),M}},{"../../lib/regex":520,"../../lib/sort_object_keys":526,"../colorbar/attributes":367,"./scales.js":381}],374:[function(t,o,f){var r=t("fast-isnumeric"),a=t("../../lib"),l=t("./helpers").extractOpts;o.exports=function(c,i,s){var u,h=c._fullLayout,d=s.vals,m=s.containerStr,p=m?a.nestedProperty(i,m).get():i,g=l(p),y=g.auto!==!1,v=g.min,x=g.max,_=g.mid,A=function(){return a.aggNums(Math.min,null,d)},b=function(){return a.aggNums(Math.max,null,d)};v===void 0?v=A():y&&(v=p._colorAx&&r(v)?Math.min(v,A()):A()),x===void 0?x=b():y&&(x=p._colorAx&&r(x)?Math.max(x,b()):b()),y&&_!==void 0&&(x-_>_-v?v=_-(x-_):x-_<_-v&&(x=_+(_-v))),v===x&&(v-=.5,x+=.5),g._sync("min",v),g._sync("max",x),g.autocolorscale&&(u=v*x<0?h.colorscale.diverging:v>=0?h.colorscale.sequential:h.colorscale.sequentialminus,g._sync("colorscale",u))}},{"../../lib":503,"./helpers":377,"fast-isnumeric":190}],375:[function(t,o,f){var r=t("../../lib"),a=t("./helpers").hasColorscale,l=t("./helpers").extractOpts;o.exports=function(c,i){function s(y,v){var x=y["_"+v];x!==void 0&&(y[v]=x)}function u(y,v){var x=v.container?r.nestedProperty(y,v.container).get():y;if(x)if(x.coloraxis)x._colorAx=i[x.coloraxis];else{var _=l(x),A=_.auto;(A||_.min===void 0)&&s(x,v.min),(A||_.max===void 0)&&s(x,v.max),_.autocolorscale&&s(x,"colorscale")}}for(var h=0;h=0;A--,b++){var k=v[A];_[b]=[1-k[0],k[1]]}return _}function g(v,x){x=x||{};for(var _=v.domain,A=v.range,b=A.length,k=new Array(b),w=0;w4/3-h?u:h}},{}],383:[function(t,o,f){var r=t("../../lib"),a=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];o.exports=function(l,c,i,s){return l=i==="left"?0:i==="center"?1:i==="right"?2:r.constrain(Math.floor(3*l),0,2),c=s==="bottom"?0:s==="middle"?1:s==="top"?2:r.constrain(Math.floor(3*c),0,2),a[c][l]}},{"../../lib":503}],384:[function(t,o,f){f.selectMode=function(r){return r==="lasso"||r==="select"},f.drawMode=function(r){return r==="drawclosedpath"||r==="drawopenpath"||r==="drawline"||r==="drawrect"||r==="drawcircle"},f.openMode=function(r){return r==="drawline"||r==="drawopenpath"},f.rectMode=function(r){return r==="select"||r==="drawline"||r==="drawrect"||r==="drawcircle"},f.freeMode=function(r){return r==="lasso"||r==="drawclosedpath"||r==="drawopenpath"},f.selectingOrDrawing=function(r){return f.freeMode(r)||f.rectMode(r)}},{}],385:[function(t,o,f){var r=t("mouse-event-offset"),a=t("has-hover"),l=t("has-passive-events"),c=t("../../lib").removeElement,i=t("../../plots/cartesian/constants"),s=o.exports={};s.align=t("./align"),s.getCursor=t("./cursor");var u=t("./unhover");function h(){var m=document.createElement("div");m.className="dragcover";var p=m.style;return p.position="fixed",p.left=0,p.right=0,p.top=0,p.bottom=0,p.zIndex=999999999,p.background="none",document.body.appendChild(m),m}function d(m){return r(m.changedTouches?m.changedTouches[0]:m,document.body)}s.unhover=u.wrapped,s.unhoverRaw=u.raw,s.init=function(m){var p,g,y,v,x,_,A,b,k=m.gd,w=1,M=k._context.doubleClickDelay,T=m.element;k._mouseDownTime||(k._mouseDownTime=0),T.style.pointerEvents="all",T.onmousedown=S,l?(T._ontouchstart&&T.removeEventListener("touchstart",T._ontouchstart),T._ontouchstart=S,T.addEventListener("touchstart",S,{passive:!1})):T.ontouchstart=S;var E=m.clampFn||function(R,F,D){return Math.abs(R)M&&(w=Math.max(w-1,1)),k._dragged)m.doneFn&&m.doneFn();else if(m.clickFn&&m.clickFn(w,_),!b){var F;try{F=new MouseEvent("click",R)}catch{var D=d(R);(F=document.createEvent("MouseEvents")).initMouseEvent("click",R.bubbles,R.cancelable,R.view,R.detail,R.screenX,R.screenY,D[0],D[1],R.ctrlKey,R.altKey,R.shiftKey,R.metaKey,R.button,R.relatedTarget)}A.dispatchEvent(F)}k._dragging=!1,k._dragged=!1}else k._dragged=!1}},s.coverSlip=h},{"../../lib":503,"../../plots/cartesian/constants":561,"./align":382,"./cursor":383,"./unhover":386,"has-hover":228,"has-passive-events":229,"mouse-event-offset":242}],386:[function(t,o,f){var r=t("../../lib/events"),a=t("../../lib/throttle"),l=t("../../lib/dom").getGraphDiv,c=t("../fx/constants"),i=o.exports={};i.wrapped=function(s,u,h){(s=l(s))._fullLayout&&a.clear(s._fullLayout._uid+c.HOVERID),i.raw(s,u,h)},i.raw=function(s,u){var h=s._fullLayout,d=s._hoverdata;u||(u={}),u.target&&!s._dragged&&r.triggerHandler(s,"plotly_beforehover",u)===!1||(h._hoverlayer.selectAll("g").remove(),h._hoverlayer.selectAll("line").remove(),h._hoverlayer.selectAll("circle").remove(),s._hoverdata=void 0,u.target&&d&&s.emit("plotly_unhover",{event:u,points:d}))}},{"../../lib/dom":491,"../../lib/events":492,"../../lib/throttle":530,"../fx/constants":400}],387:[function(t,o,f){f.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid",editType:"style"},f.pattern={shape:{valType:"enumerated",values:["","/","\\","x","-","|","+","."],dflt:"",arrayOk:!0,editType:"style"},fillmode:{valType:"enumerated",values:["replace","overlay"],dflt:"replace",editType:"style"},bgcolor:{valType:"color",arrayOk:!0,editType:"style"},fgcolor:{valType:"color",arrayOk:!0,editType:"style"},fgopacity:{valType:"number",editType:"style",min:0,max:1},size:{valType:"number",min:0,dflt:8,arrayOk:!0,editType:"style"},solidity:{valType:"number",min:0,max:1,dflt:.3,arrayOk:!0,editType:"style"},editType:"style"}},{}],388:[function(t,o,f){var r=t("@plotly/d3"),a=t("../../lib"),l=a.numberFormat,c=t("fast-isnumeric"),i=t("tinycolor2"),s=t("../../registry"),u=t("../color"),h=t("../colorscale"),d=a.strTranslate,m=t("../../lib/svg_text_utils"),p=t("../../constants/xmlns_namespaces"),g=t("../../constants/alignment").LINE_SPACING,y=t("../../constants/interactions").DESELECTDIM,v=t("../../traces/scatter/subtypes"),x=t("../../traces/scatter/make_bubble_size_func"),_=t("../../components/fx/helpers").appendArrayPointValue,A=o.exports={};function b(Y,J,re){var U=J.fillpattern,V=U&&A.getPatternAttr(U.shape,0,"");if(V){var H=A.getPatternAttr(U.bgcolor,0,null),ne=A.getPatternAttr(U.fgcolor,0,null),q=U.fgopacity,Q=A.getPatternAttr(U.size,0,8),ee=A.getPatternAttr(U.solidity,0,.3),ie=J.uid;A.pattern(Y,"point",re,ie,V,Q,ee,void 0,U.fillmode,H,ne,q)}else J.fillcolor&&Y.call(u.fill,J.fillcolor)}A.font=function(Y,J,re,U){a.isPlainObject(J)&&(U=J.color,re=J.size,J=J.family),J&&Y.style("font-family",J),re+1&&Y.style("font-size",re+"px"),U&&Y.call(u.fill,U)},A.setPosition=function(Y,J,re){Y.attr("x",J).attr("y",re)},A.setSize=function(Y,J,re){Y.attr("width",J).attr("height",re)},A.setRect=function(Y,J,re,U,V){Y.call(A.setPosition,J,re).call(A.setSize,U,V)},A.translatePoint=function(Y,J,re,U){var V=re.c2p(Y.x),H=U.c2p(Y.y);return!!(c(V)&&c(H)&&J.node())&&(J.node().nodeName==="text"?J.attr("x",V).attr("y",H):J.attr("transform",d(V,H)),!0)},A.translatePoints=function(Y,J,re){Y.each(function(U){var V=r.select(this);A.translatePoint(U,V,J,re)})},A.hideOutsideRangePoint=function(Y,J,re,U,V,H){J.attr("display",re.isPtWithinRange(Y,V)&&U.isPtWithinRange(Y,H)?null:"none")},A.hideOutsideRangePoints=function(Y,J){if(J._hasClipOnAxisFalse){var re=J.xaxis,U=J.yaxis;Y.each(function(V){var H=V[0].trace,ne=H.xcalendar,q=H.ycalendar,Q=s.traceIs(H,"bar-like")?".bartext":".point,.textpoint";Y.selectAll(Q).each(function(ee){A.hideOutsideRangePoint(ee,r.select(this),re,U,ne,q)})})}},A.crispRound=function(Y,J,re){return J&&c(J)?Y._context.staticPlot?J:J<1?1:Math.round(J):re||0},A.singleLineStyle=function(Y,J,re,U,V){J.style("fill","none");var H=(((Y||[])[0]||{}).trace||{}).line||{},ne=re||H.width||0,q=V||H.dash||"";u.stroke(J,U||H.color),A.dashLine(J,q,ne)},A.lineGroupStyle=function(Y,J,re,U){Y.style("fill","none").each(function(V){var H=(((V||[])[0]||{}).trace||{}).line||{},ne=J||H.width||0,q=U||H.dash||"";r.select(this).call(u.stroke,re||H.color).call(A.dashLine,q,ne)})},A.dashLine=function(Y,J,re){re=+re||0,J=A.dashStyle(J,re),Y.style({"stroke-dasharray":J,"stroke-width":re+"px"})},A.dashStyle=function(Y,J){J=+J||1;var re=Math.max(J,3);return Y==="solid"?Y="":Y==="dot"?Y=re+"px,"+re+"px":Y==="dash"?Y=3*re+"px,"+3*re+"px":Y==="longdash"?Y=5*re+"px,"+5*re+"px":Y==="dashdot"?Y=3*re+"px,"+re+"px,"+re+"px,"+re+"px":Y==="longdashdot"&&(Y=5*re+"px,"+2*re+"px,"+re+"px,"+2*re+"px"),Y},A.singleFillStyle=function(Y,J){var re=r.select(Y.node());b(Y,((re.data()[0]||[])[0]||{}).trace||{},J)},A.fillGroupStyle=function(Y,J){Y.style("stroke-width",0).each(function(re){var U=r.select(this);re[0].trace&&b(U,re[0].trace,J)})};var k=t("./symbol_defs");A.symbolNames=[],A.symbolFuncs=[],A.symbolNeedLines={},A.symbolNoDot={},A.symbolNoFill={},A.symbolList=[],Object.keys(k).forEach(function(Y){var J=k[Y],re=J.n;A.symbolList.push(re,String(re),Y,re+100,String(re+100),Y+"-open"),A.symbolNames[re]=Y,A.symbolFuncs[re]=J.f,J.needLine&&(A.symbolNeedLines[re]=!0),J.noDot?A.symbolNoDot[re]=!0:A.symbolList.push(re+200,String(re+200),Y+"-dot",re+300,String(re+300),Y+"-open-dot"),J.noFill&&(A.symbolNoFill[re]=!0)});var w=A.symbolNames.length;function M(Y,J){var re=Y%100;return A.symbolFuncs[re](J)+(Y>=200?"M0,0.5L0.5,0L0,-0.5L-0.5,0Z":"")}A.symbolNumber=function(Y){if(c(Y))Y=+Y;else if(typeof Y=="string"){var J=0;Y.indexOf("-open")>0&&(J=100,Y=Y.replace("-open","")),Y.indexOf("-dot")>0&&(J+=200,Y=Y.replace("-dot","")),(Y=A.symbolNames.indexOf(Y))>=0&&(Y+=J)}return Y%100>=w||Y>=400?0:Math.floor(Math.max(Y,0))};var T={x1:1,x2:0,y1:0,y2:0},E={x1:0,x2:0,y1:1,y2:0},S=l("~f"),P={radial:{node:"radialGradient"},radialreversed:{node:"radialGradient",reversed:!0},horizontal:{node:"linearGradient",attrs:T},horizontalreversed:{node:"linearGradient",attrs:T,reversed:!0},vertical:{node:"linearGradient",attrs:E},verticalreversed:{node:"linearGradient",attrs:E,reversed:!0}};A.gradient=function(Y,J,re,U,V,H){for(var ne=V.length,q=P[U],Q=new Array(ne),ee=0;ee=100,J.attr("d",M(Q,q))}var ee,ie,ae,ue=!1;if(Y.so)ae=ne.outlierwidth,ie=ne.outliercolor,ee=H.outliercolor;else{var le=(ne||{}).width;ae=(Y.mlw+1||le+1||(Y.trace?(Y.trace.marker.line||{}).width:0)+1)-1||0,ie="mlc"in Y?Y.mlcc=U.lineScale(Y.mlc):a.isArrayOrTypedArray(ne.color)?u.defaultLine:ne.color,a.isArrayOrTypedArray(H.color)&&(ee=u.defaultLine,ue=!0),ee="mc"in Y?Y.mcc=U.markerScale(Y.mc):H.color||"rgba(0,0,0,0)",U.selectedColorFn&&(ee=U.selectedColorFn(Y))}if(Y.om)J.call(u.stroke,ee).style({"stroke-width":(ae||1)+"px",fill:"none"});else{J.style("stroke-width",(Y.isBlank?0:ae)+"px");var ge=H.gradient,fe=Y.mgt;fe?ue=!0:fe=ge&&ge.type,a.isArrayOrTypedArray(fe)&&(fe=fe[0],P[fe]||(fe=0));var me=H.pattern,_e=me&&A.getPatternAttr(me.shape,Y.i,"");if(fe&&fe!=="none"){var Ae=Y.mgc;Ae?ue=!0:Ae=ge.color;var ke=re.uid;ue&&(ke+="-"+Y.i),A.gradient(J,V,ke,fe,[[0,Ae],[1,ee]],"fill")}else if(_e){var Le=A.getPatternAttr(me.bgcolor,Y.i,null),de=A.getPatternAttr(me.fgcolor,Y.i,null),ve=me.fgopacity,Me=A.getPatternAttr(me.size,Y.i,8),we=A.getPatternAttr(me.solidity,Y.i,.3),Ce=Y.mcc||a.isArrayOrTypedArray(me.shape)||a.isArrayOrTypedArray(me.bgcolor)||a.isArrayOrTypedArray(me.size)||a.isArrayOrTypedArray(me.solidity),Fe=re.uid;Ce&&(Fe+="-"+Y.i),A.pattern(J,"point",V,Fe,_e,Me,we,Y.mcc,me.fillmode,Le,de,ve)}else u.fill(J,ee);ae&&u.stroke(J,ie)}},A.makePointStyleFns=function(Y){var J={},re=Y.marker;return J.markerScale=A.tryColorscale(re,""),J.lineScale=A.tryColorscale(re,"line"),s.traceIs(Y,"symbols")&&(J.ms2mrc=v.isBubble(Y)?x(Y):function(){return(re.size||6)/2}),Y.selectedpoints&&a.extendFlat(J,A.makeSelectedPointStyleFns(Y)),J},A.makeSelectedPointStyleFns=function(Y){var J={},re=Y.selected||{},U=Y.unselected||{},V=Y.marker||{},H=re.marker||{},ne=U.marker||{},q=V.opacity,Q=H.opacity,ee=ne.opacity,ie=Q!==void 0,ae=ee!==void 0;(a.isArrayOrTypedArray(q)||ie||ae)&&(J.selectedOpacityFn=function(Le){var de=Le.mo===void 0?V.opacity:Le.mo;return Le.selected?ie?Q:de:ae?ee:y*de});var ue=V.color,le=H.color,ge=ne.color;(le||ge)&&(J.selectedColorFn=function(Le){var de=Le.mcc||ue;return Le.selected?le||de:ge||de});var fe=V.size,me=H.size,_e=ne.size,Ae=me!==void 0,ke=_e!==void 0;return s.traceIs(Y,"symbols")&&(Ae||ke)&&(J.selectedSizeFn=function(Le){var de=Le.mrc||fe/2;return Le.selected?Ae?me/2:de:ke?_e/2:de}),J},A.makeSelectedTextStyleFns=function(Y){var J={},re=Y.selected||{},U=Y.unselected||{},V=Y.textfont||{},H=re.textfont||{},ne=U.textfont||{},q=V.color,Q=H.color,ee=ne.color;return J.selectedTextColorFn=function(ie){var ae=ie.tc||q;return ie.selected?Q||ae:ee||(Q?ae:u.addOpacity(ae,y))},J},A.selectedPointStyle=function(Y,J){if(Y.size()&&J.selectedpoints){var re=A.makeSelectedPointStyleFns(J),U=J.marker||{},V=[];re.selectedOpacityFn&&V.push(function(H,ne){H.style("opacity",re.selectedOpacityFn(ne))}),re.selectedColorFn&&V.push(function(H,ne){u.fill(H,re.selectedColorFn(ne))}),re.selectedSizeFn&&V.push(function(H,ne){var q=ne.mx||U.symbol||0,Q=re.selectedSizeFn(ne);H.attr("d",M(A.symbolNumber(q),Q)),ne.mrc2=Q}),V.length&&Y.each(function(H){for(var ne=r.select(this),q=0;q0?re:0}A.textPointStyle=function(Y,J,re){if(Y.size()){var U;if(J.selectedpoints){var V=A.makeSelectedTextStyleFns(J);U=V.selectedTextColorFn}var H=J.texttemplate,ne=re._fullLayout;Y.each(function(q){var Q=r.select(this),ee=H?a.extractOption(q,J,"txt","texttemplate"):a.extractOption(q,J,"tx","text");if(ee||ee===0){if(H){var ie=J._module.formatLabels,ae=ie?ie(q,J,ne):{},ue={};_(ue,J,q.i);var le=J._meta||{};ee=a.texttemplateString(ee,ae,ne._d3locale,ue,q,le)}var ge=q.tp||J.textposition,fe=F(q,J),me=U?U(q):q.tc||J.textfont.color;Q.call(A.font,q.tf||J.textfont.family,fe,me).text(ee).call(m.convertToTspans,re).call(R,ge,fe,q.mrc)}else Q.remove()})}},A.selectedTextStyle=function(Y,J){if(Y.size()&&J.selectedpoints){var re=A.makeSelectedTextStyleFns(J);Y.each(function(U){var V=r.select(this),H=re.selectedTextColorFn(U),ne=U.tp||J.textposition,q=F(U,J);u.fill(V,H);var Q=s.traceIs(J,"bar-like");R(V,ne,q,U.mrc2||U.mrc,Q)})}};function D(Y,J,re,U){var V=Y[0]-J[0],H=Y[1]-J[1],ne=re[0]-J[0],q=re[1]-J[1],Q=Math.pow(V*V+H*H,.25),ee=Math.pow(ne*ne+q*q,.25),ie=(ee*ee*V-Q*Q*ne)*U,ae=(ee*ee*H-Q*Q*q)*U,ue=3*ee*(Q+ee),le=3*Q*(Q+ee);return[[r.round(J[0]+(ue&&ie/ue),2),r.round(J[1]+(ue&&ae/ue),2)],[r.round(J[0]-(le&&ie/le),2),r.round(J[1]-(le&&ae/le),2)]]}A.smoothopen=function(Y,J){if(Y.length<3)return"M"+Y.join("L");var re,U="M"+Y[0],V=[];for(re=1;re=1e4&&(A.savedBBoxes={},B=0),re&&(A.savedBBoxes[re]=le),B++,a.extendFlat({},le)},A.setClipUrl=function(Y,J,re){Y.attr("clip-path",G(J,re))},A.getTranslate=function(Y){var J=(Y[Y.attr?"attr":"getAttribute"]("transform")||"").replace(/.*\btranslate\((-?\d*\.?\d*)[^-\d]*(-?\d*\.?\d*)[^\d].*/,function(re,U,V){return[U,V].join(" ")}).split(" ");return{x:+J[0]||0,y:+J[1]||0}},A.setTranslate=function(Y,J,re){var U=Y.attr?"attr":"getAttribute",V=Y.attr?"attr":"setAttribute",H=Y[U]("transform")||"";return J=J||0,re=re||0,H=H.replace(/(\btranslate\(.*?\);?)/,"").trim(),H=(H+=d(J,re)).trim(),Y[V]("transform",H),H},A.getScale=function(Y){var J=(Y[Y.attr?"attr":"getAttribute"]("transform")||"").replace(/.*\bscale\((\d*\.?\d*)[^\d]*(\d*\.?\d*)[^\d].*/,function(re,U,V){return[U,V].join(" ")}).split(" ");return{x:+J[0]||1,y:+J[1]||1}},A.setScale=function(Y,J,re){var U=Y.attr?"attr":"getAttribute",V=Y.attr?"attr":"setAttribute",H=Y[U]("transform")||"";return J=J||1,re=re||1,H=H.replace(/(\bscale\(.*?\);?)/,"").trim(),H=(H+="scale("+J+","+re+")").trim(),Y[V]("transform",H),H};var K=/\s*sc.*/;A.setPointGroupScale=function(Y,J,re){if(J=J||1,re=re||1,Y){var U=J===1&&re===1?"":"scale("+J+","+re+")";Y.each(function(){var V=(this.getAttribute("transform")||"").replace(K,"");V=(V+=U).trim(),this.setAttribute("transform",V)})}};var te=/translate\([^)]*\)\s*$/;A.setTextPointsScale=function(Y,J,re){Y&&Y.each(function(){var U,V=r.select(this),H=V.select("text");if(H.node()){var ne=parseFloat(H.attr("x")||0),q=parseFloat(H.attr("y")||0),Q=(V.attr("transform")||"").match(te);U=J===1&&re===1?[]:[d(ne,q),"scale("+J+","+re+")",d(-ne,-q)],Q&&U.push(Q),V.attr("transform",U.join(""))}})}},{"../../components/fx/helpers":402,"../../constants/alignment":471,"../../constants/interactions":478,"../../constants/xmlns_namespaces":480,"../../lib":503,"../../lib/svg_text_utils":529,"../../registry":638,"../../traces/scatter/make_bubble_size_func":944,"../../traces/scatter/subtypes":952,"../color":366,"../colorscale":378,"./symbol_defs":389,"@plotly/d3":58,"fast-isnumeric":190,tinycolor2:312}],389:[function(t,o,f){var r=t("@plotly/d3");o.exports={circle:{n:0,f:function(a){var l=r.round(a,2);return"M"+l+",0A"+l+","+l+" 0 1,1 0,-"+l+"A"+l+","+l+" 0 0,1 "+l+",0Z"}},square:{n:1,f:function(a){var l=r.round(a,2);return"M"+l+","+l+"H-"+l+"V-"+l+"H"+l+"Z"}},diamond:{n:2,f:function(a){var l=r.round(1.3*a,2);return"M"+l+",0L0,"+l+"L-"+l+",0L0,-"+l+"Z"}},cross:{n:3,f:function(a){var l=r.round(.4*a,2),c=r.round(1.2*a,2);return"M"+c+","+l+"H"+l+"V"+c+"H-"+l+"V"+l+"H-"+c+"V-"+l+"H-"+l+"V-"+c+"H"+l+"V-"+l+"H"+c+"Z"}},x:{n:4,f:function(a){var l=r.round(.8*a/Math.sqrt(2),2),c="l"+l+","+l,i="l"+l+",-"+l,s="l-"+l+",-"+l,u="l-"+l+","+l;return"M0,"+l+c+i+s+i+s+u+s+u+c+u+c+"Z"}},"triangle-up":{n:5,f:function(a){var l=r.round(2*a/Math.sqrt(3),2);return"M-"+l+","+r.round(a/2,2)+"H"+l+"L0,-"+r.round(a,2)+"Z"}},"triangle-down":{n:6,f:function(a){var l=r.round(2*a/Math.sqrt(3),2);return"M-"+l+",-"+r.round(a/2,2)+"H"+l+"L0,"+r.round(a,2)+"Z"}},"triangle-left":{n:7,f:function(a){var l=r.round(2*a/Math.sqrt(3),2);return"M"+r.round(a/2,2)+",-"+l+"V"+l+"L-"+r.round(a,2)+",0Z"}},"triangle-right":{n:8,f:function(a){var l=r.round(2*a/Math.sqrt(3),2);return"M-"+r.round(a/2,2)+",-"+l+"V"+l+"L"+r.round(a,2)+",0Z"}},"triangle-ne":{n:9,f:function(a){var l=r.round(.6*a,2),c=r.round(1.2*a,2);return"M-"+c+",-"+l+"H"+l+"V"+c+"Z"}},"triangle-se":{n:10,f:function(a){var l=r.round(.6*a,2),c=r.round(1.2*a,2);return"M"+l+",-"+c+"V"+l+"H-"+c+"Z"}},"triangle-sw":{n:11,f:function(a){var l=r.round(.6*a,2),c=r.round(1.2*a,2);return"M"+c+","+l+"H-"+l+"V-"+c+"Z"}},"triangle-nw":{n:12,f:function(a){var l=r.round(.6*a,2),c=r.round(1.2*a,2);return"M-"+l+","+c+"V-"+l+"H"+c+"Z"}},pentagon:{n:13,f:function(a){var l=r.round(.951*a,2),c=r.round(.588*a,2),i=r.round(-a,2),s=r.round(-.309*a,2);return"M"+l+","+s+"L"+c+","+r.round(.809*a,2)+"H-"+c+"L-"+l+","+s+"L0,"+i+"Z"}},hexagon:{n:14,f:function(a){var l=r.round(a,2),c=r.round(a/2,2),i=r.round(a*Math.sqrt(3)/2,2);return"M"+i+",-"+c+"V"+c+"L0,"+l+"L-"+i+","+c+"V-"+c+"L0,-"+l+"Z"}},hexagon2:{n:15,f:function(a){var l=r.round(a,2),c=r.round(a/2,2),i=r.round(a*Math.sqrt(3)/2,2);return"M-"+c+","+i+"H"+c+"L"+l+",0L"+c+",-"+i+"H-"+c+"L-"+l+",0Z"}},octagon:{n:16,f:function(a){var l=r.round(.924*a,2),c=r.round(.383*a,2);return"M-"+c+",-"+l+"H"+c+"L"+l+",-"+c+"V"+c+"L"+c+","+l+"H-"+c+"L-"+l+","+c+"V-"+c+"Z"}},star:{n:17,f:function(a){var l=1.4*a,c=r.round(.225*l,2),i=r.round(.951*l,2),s=r.round(.363*l,2),u=r.round(.588*l,2),h=r.round(-l,2),d=r.round(-.309*l,2),m=r.round(.118*l,2),p=r.round(.809*l,2);return"M"+c+","+d+"H"+i+"L"+s+","+m+"L"+u+","+p+"L0,"+r.round(.382*l,2)+"L-"+u+","+p+"L-"+s+","+m+"L-"+i+","+d+"H-"+c+"L0,"+h+"Z"}},hexagram:{n:18,f:function(a){var l=r.round(.66*a,2),c=r.round(.38*a,2),i=r.round(.76*a,2);return"M-"+i+",0l-"+c+",-"+l+"h"+i+"l"+c+",-"+l+"l"+c+","+l+"h"+i+"l-"+c+","+l+"l"+c+","+l+"h-"+i+"l-"+c+","+l+"l-"+c+",-"+l+"h-"+i+"Z"}},"star-triangle-up":{n:19,f:function(a){var l=r.round(a*Math.sqrt(3)*.8,2),c=r.round(.8*a,2),i=r.round(1.6*a,2),s=r.round(4*a,2),u="A "+s+","+s+" 0 0 1 ";return"M-"+l+","+c+u+l+","+c+u+"0,-"+i+u+"-"+l+","+c+"Z"}},"star-triangle-down":{n:20,f:function(a){var l=r.round(a*Math.sqrt(3)*.8,2),c=r.round(.8*a,2),i=r.round(1.6*a,2),s=r.round(4*a,2),u="A "+s+","+s+" 0 0 1 ";return"M"+l+",-"+c+u+"-"+l+",-"+c+u+"0,"+i+u+l+",-"+c+"Z"}},"star-square":{n:21,f:function(a){var l=r.round(1.1*a,2),c=r.round(2*a,2),i="A "+c+","+c+" 0 0 1 ";return"M-"+l+",-"+l+i+"-"+l+","+l+i+l+","+l+i+l+",-"+l+i+"-"+l+",-"+l+"Z"}},"star-diamond":{n:22,f:function(a){var l=r.round(1.4*a,2),c=r.round(1.9*a,2),i="A "+c+","+c+" 0 0 1 ";return"M-"+l+",0"+i+"0,"+l+i+l+",0"+i+"0,-"+l+i+"-"+l+",0Z"}},"diamond-tall":{n:23,f:function(a){var l=r.round(.7*a,2),c=r.round(1.4*a,2);return"M0,"+c+"L"+l+",0L0,-"+c+"L-"+l+",0Z"}},"diamond-wide":{n:24,f:function(a){var l=r.round(1.4*a,2),c=r.round(.7*a,2);return"M0,"+c+"L"+l+",0L0,-"+c+"L-"+l+",0Z"}},hourglass:{n:25,f:function(a){var l=r.round(a,2);return"M"+l+","+l+"H-"+l+"L"+l+",-"+l+"H-"+l+"Z"},noDot:!0},bowtie:{n:26,f:function(a){var l=r.round(a,2);return"M"+l+","+l+"V-"+l+"L-"+l+","+l+"V-"+l+"Z"},noDot:!0},"circle-cross":{n:27,f:function(a){var l=r.round(a,2);return"M0,"+l+"V-"+l+"M"+l+",0H-"+l+"M"+l+",0A"+l+","+l+" 0 1,1 0,-"+l+"A"+l+","+l+" 0 0,1 "+l+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(a){var l=r.round(a,2),c=r.round(a/Math.sqrt(2),2);return"M"+c+","+c+"L-"+c+",-"+c+"M"+c+",-"+c+"L-"+c+","+c+"M"+l+",0A"+l+","+l+" 0 1,1 0,-"+l+"A"+l+","+l+" 0 0,1 "+l+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(a){var l=r.round(a,2);return"M0,"+l+"V-"+l+"M"+l+",0H-"+l+"M"+l+","+l+"H-"+l+"V-"+l+"H"+l+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(a){var l=r.round(a,2);return"M"+l+","+l+"L-"+l+",-"+l+"M"+l+",-"+l+"L-"+l+","+l+"M"+l+","+l+"H-"+l+"V-"+l+"H"+l+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(a){var l=r.round(1.3*a,2);return"M"+l+",0L0,"+l+"L-"+l+",0L0,-"+l+"ZM0,-"+l+"V"+l+"M-"+l+",0H"+l},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(a){var l=r.round(1.3*a,2),c=r.round(.65*a,2);return"M"+l+",0L0,"+l+"L-"+l+",0L0,-"+l+"ZM-"+c+",-"+c+"L"+c+","+c+"M-"+c+","+c+"L"+c+",-"+c},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(a){var l=r.round(1.4*a,2);return"M0,"+l+"V-"+l+"M"+l+",0H-"+l},needLine:!0,noDot:!0,noFill:!0},"x-thin":{n:34,f:function(a){var l=r.round(a,2);return"M"+l+","+l+"L-"+l+",-"+l+"M"+l+",-"+l+"L-"+l+","+l},needLine:!0,noDot:!0,noFill:!0},asterisk:{n:35,f:function(a){var l=r.round(1.2*a,2),c=r.round(.85*a,2);return"M0,"+l+"V-"+l+"M"+l+",0H-"+l+"M"+c+","+c+"L-"+c+",-"+c+"M"+c+",-"+c+"L-"+c+","+c},needLine:!0,noDot:!0,noFill:!0},hash:{n:36,f:function(a){var l=r.round(a/2,2),c=r.round(a,2);return"M"+l+","+c+"V-"+c+"m-"+c+",0V"+c+"M"+c+","+l+"H-"+c+"m0,-"+c+"H"+c},needLine:!0,noFill:!0},"y-up":{n:37,f:function(a){var l=r.round(1.2*a,2),c=r.round(1.6*a,2),i=r.round(.8*a,2);return"M-"+l+","+i+"L0,0M"+l+","+i+"L0,0M0,-"+c+"L0,0"},needLine:!0,noDot:!0,noFill:!0},"y-down":{n:38,f:function(a){var l=r.round(1.2*a,2),c=r.round(1.6*a,2),i=r.round(.8*a,2);return"M-"+l+",-"+i+"L0,0M"+l+",-"+i+"L0,0M0,"+c+"L0,0"},needLine:!0,noDot:!0,noFill:!0},"y-left":{n:39,f:function(a){var l=r.round(1.2*a,2),c=r.round(1.6*a,2),i=r.round(.8*a,2);return"M"+i+","+l+"L0,0M"+i+",-"+l+"L0,0M-"+c+",0L0,0"},needLine:!0,noDot:!0,noFill:!0},"y-right":{n:40,f:function(a){var l=r.round(1.2*a,2),c=r.round(1.6*a,2),i=r.round(.8*a,2);return"M-"+i+","+l+"L0,0M-"+i+",-"+l+"L0,0M"+c+",0L0,0"},needLine:!0,noDot:!0,noFill:!0},"line-ew":{n:41,f:function(a){var l=r.round(1.4*a,2);return"M"+l+",0H-"+l},needLine:!0,noDot:!0,noFill:!0},"line-ns":{n:42,f:function(a){var l=r.round(1.4*a,2);return"M0,"+l+"V-"+l},needLine:!0,noDot:!0,noFill:!0},"line-ne":{n:43,f:function(a){var l=r.round(a,2);return"M"+l+",-"+l+"L-"+l+","+l},needLine:!0,noDot:!0,noFill:!0},"line-nw":{n:44,f:function(a){var l=r.round(a,2);return"M"+l+","+l+"L-"+l+",-"+l},needLine:!0,noDot:!0,noFill:!0},"arrow-up":{n:45,f:function(a){var l=r.round(a,2);return"M0,0L-"+l+","+r.round(2*a,2)+"H"+l+"Z"},noDot:!0},"arrow-down":{n:46,f:function(a){var l=r.round(a,2);return"M0,0L-"+l+",-"+r.round(2*a,2)+"H"+l+"Z"},noDot:!0},"arrow-left":{n:47,f:function(a){var l=r.round(2*a,2),c=r.round(a,2);return"M0,0L"+l+",-"+c+"V"+c+"Z"},noDot:!0},"arrow-right":{n:48,f:function(a){var l=r.round(2*a,2),c=r.round(a,2);return"M0,0L-"+l+",-"+c+"V"+c+"Z"},noDot:!0},"arrow-bar-up":{n:49,f:function(a){var l=r.round(a,2);return"M-"+l+",0H"+l+"M0,0L-"+l+","+r.round(2*a,2)+"H"+l+"Z"},needLine:!0,noDot:!0},"arrow-bar-down":{n:50,f:function(a){var l=r.round(a,2);return"M-"+l+",0H"+l+"M0,0L-"+l+",-"+r.round(2*a,2)+"H"+l+"Z"},needLine:!0,noDot:!0},"arrow-bar-left":{n:51,f:function(a){var l=r.round(2*a,2),c=r.round(a,2);return"M0,-"+c+"V"+c+"M0,0L"+l+",-"+c+"V"+c+"Z"},needLine:!0,noDot:!0},"arrow-bar-right":{n:52,f:function(a){var l=r.round(2*a,2),c=r.round(a,2);return"M0,-"+c+"V"+c+"M0,0L-"+l+",-"+c+"V"+c+"Z"},needLine:!0,noDot:!0}}},{"@plotly/d3":58}],390:[function(t,o,f){o.exports={visible:{valType:"boolean",editType:"calc"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"],editType:"calc"},symmetric:{valType:"boolean",editType:"calc"},array:{valType:"data_array",editType:"calc"},arrayminus:{valType:"data_array",editType:"calc"},value:{valType:"number",min:0,dflt:10,editType:"calc"},valueminus:{valType:"number",min:0,dflt:10,editType:"calc"},traceref:{valType:"integer",min:0,dflt:0,editType:"style"},tracerefminus:{valType:"integer",min:0,dflt:0,editType:"style"},copy_ystyle:{valType:"boolean",editType:"plot"},copy_zstyle:{valType:"boolean",editType:"style"},color:{valType:"color",editType:"style"},thickness:{valType:"number",min:0,dflt:2,editType:"style"},width:{valType:"number",min:0,editType:"plot"},editType:"calc",_deprecated:{opacity:{valType:"number",editType:"style"}}}},{}],391:[function(t,o,f){var r=t("fast-isnumeric"),a=t("../../registry"),l=t("../../plots/cartesian/axes"),c=t("../../lib"),i=t("./compute_error");function s(u,h,d,m){var p=h["error_"+m]||{},g=[];if(p.visible&&["linear","log"].indexOf(d.type)!==-1){for(var y=i(p),v=0;v0;s.each(function(g){var y,v=g[0].trace,x=v.error_x||{},_=v.error_y||{};v.ids&&(y=function(w){return w.id});var A=c.hasMarkers(v)&&v.marker.maxdisplayed>0;_.visible||x.visible||(g=[]);var b=r.select(this).selectAll("g.errorbar").data(g,y);if(b.exit().remove(),g.length){x.visible||b.selectAll("path.xerror").remove(),_.visible||b.selectAll("path.yerror").remove(),b.style("opacity",1);var k=b.enter().append("g").classed("errorbar",!0);p&&k.style("opacity",0).transition().duration(h.duration).style("opacity",1),l.setClipUrl(b,u.layerClipId,i),b.each(function(w){var M=r.select(this),T=function(F,D,O){var N={x:D.c2p(F.x),y:O.c2p(F.y)};return F.yh!==void 0&&(N.yh=O.c2p(F.yh),N.ys=O.c2p(F.ys),a(N.ys)||(N.noYS=!0,N.ys=O.c2p(F.ys,!0))),F.xh!==void 0&&(N.xh=D.c2p(F.xh),N.xs=D.c2p(F.xs),a(N.xs)||(N.noXS=!0,N.xs=D.c2p(F.xs,!0))),N}(w,d,m);if(!A||w.vis){var E,S=M.select("path.yerror");if(_.visible&&a(T.x)&&a(T.yh)&&a(T.ys)){var P=_.width;E="M"+(T.x-P)+","+T.yh+"h"+2*P+"m-"+P+",0V"+T.ys,T.noYS||(E+="m-"+P+",0h"+2*P),S.size()?p&&(S=S.transition().duration(h.duration).ease(h.easing)):S=M.append("path").style("vector-effect","non-scaling-stroke").classed("yerror",!0),S.attr("d",E)}else S.remove();var L=M.select("path.xerror");if(x.visible&&a(T.y)&&a(T.xh)&&a(T.xs)){var R=(x.copy_ystyle?_:x).width;E="M"+T.xh+","+(T.y-R)+"v"+2*R+"m0,-"+R+"H"+T.xs,T.noXS||(E+="m0,-"+R+"v"+2*R),L.size()?p&&(L=L.transition().duration(h.duration).ease(h.easing)):L=M.append("path").style("vector-effect","non-scaling-stroke").classed("xerror",!0),L.attr("d",E)}else L.remove()}})}})}},{"../../traces/scatter/subtypes":952,"../drawing":388,"@plotly/d3":58,"fast-isnumeric":190}],396:[function(t,o,f){var r=t("@plotly/d3"),a=t("../color");o.exports=function(l){l.each(function(c){var i=c[0].trace,s=i.error_y||{},u=i.error_x||{},h=r.select(this);h.selectAll("path.yerror").style("stroke-width",s.thickness+"px").call(a.stroke,s.color),u.copy_ystyle&&(u=s),h.selectAll("path.xerror").style("stroke-width",u.thickness+"px").call(a.stroke,u.color)})}},{"../color":366,"@plotly/d3":58}],397:[function(t,o,f){var r=t("../../plots/font_attributes"),a=t("./layout_attributes").hoverlabel,l=t("../../lib/extend").extendFlat;o.exports={hoverlabel:{bgcolor:l({},a.bgcolor,{arrayOk:!0}),bordercolor:l({},a.bordercolor,{arrayOk:!0}),font:r({arrayOk:!0,editType:"none"}),align:l({},a.align,{arrayOk:!0}),namelength:l({},a.namelength,{arrayOk:!0}),editType:"none"}}},{"../../lib/extend":493,"../../plots/font_attributes":585,"./layout_attributes":407}],398:[function(t,o,f){var r=t("../../lib"),a=t("../../registry");function l(c,i,s,u){u=u||r.identity,Array.isArray(c)&&(i[0][s]=u(c))}o.exports=function(c){var i=c.calcdata,s=c._fullLayout;function u(g){return function(y){return r.coerceHoverinfo({hoverinfo:y},{_module:g._module},s)}}for(var h=0;h=0&&d.indexde[0]._length||Oe<0||Oe>ve[0]._length)return g.unhoverRaw(ee,ie)}if(ie.pointerX=dt+de[0]._offset,ie.pointerY=Oe+ve[0]._offset,Re="xval"in ie?x.flat(ge,ie.xval):x.p2c(de,dt),Ve="yval"in ie?x.flat(ge,ie.yval):x.p2c(ve,Oe),!a(Re[0])||!a(Ve[0]))return c.warn("Fx.hover failed",ie,ee),g.unhoverRaw(ee,ie)}var Pe=1/0;function qe(Mn,rr){for(Ye=0;YeWt&&(Jt.splice(0,Wt),Pe=Jt[0].distance),Ae&&Ke!==0&&Jt.length===0){Lt.distance=Ke,Lt.index=!1;var pr=ft._module.hoverPoints(Lt,at,et,"closest",{hoverLayer:fe._hoverlayer});if(pr&&(pr=pr.filter(function(fn){return fn.spikeDistance<=Ke})),pr&&pr.length){var qr,_i=pr.filter(function(fn){return fn.xa.showspikes&&fn.xa.spikesnap!=="hovered data"});if(_i.length){var cn=_i[0];a(cn.x0)&&a(cn.y0)&&(qr=lt(cn),(!Ge.vLinePoint||Ge.vLinePoint.spikeDistance>qr.spikeDistance)&&(Ge.vLinePoint=qr))}var jn=pr.filter(function(fn){return fn.ya.showspikes&&fn.ya.spikesnap!=="hovered data"});if(jn.length){var jt=jn[0];a(jt.x0)&&a(jt.y0)&&(qr=lt(jt),(!Ge.hLinePoint||Ge.hLinePoint.spikeDistance>qr.spikeDistance)&&(Ge.hLinePoint=qr))}}}}}function rt(Mn,rr,nr){for(var Bn,Nr=null,Gr=1/0,pr=0;pr0&&Math.abs(Mn.distance)De-1;St--)qt(Jt[St]);Jt=It,$t()}var mn=ee._hoverdata,Fn=[],pn=J(ee),tn=re(ee);for(We=0;We1||Jt.length>1)||ze==="closest"&&kt&&Jt.length>1,Dn=p.combine(fe.plot_bgcolor||p.background,fe.paper_bgcolor),lr=O(Jt,{gd:ee,hovermode:ze,rotateLabels:Kn,bgColor:Dn,container:fe._hoverlayer,outerContainer:fe._paper.node(),commonLabelOpts:fe.hoverlabel,hoverdistance:fe.hoverdistance});if(x.isUnifiedHover(ze)||(function(Mn,rr,nr){var Bn,Nr,Gr,pr,qr,_i,cn,jn=0,jt=1,fn=Mn.size(),vn=new Array(fn),Hn=0;function Un(Yn){var ir=Yn[0],or=Yn[Yn.length-1];if(Nr=ir.pmin-ir.pos-ir.dp+ir.size,Gr=or.pos+or.dp+or.size-ir.pmax,Nr>.01){for(qr=Yn.length-1;qr>=0;qr--)Yn[qr].dp+=Nr;Bn=!1}if(!(Gr<.01)){if(Nr<-.01){for(qr=Yn.length-1;qr>=0;qr--)Yn[qr].dp-=Gr;Bn=!1}if(Bn){var xr=0;for(pr=0;prir.pmax&&xr++;for(pr=Yn.length-1;pr>=0&&!(xr<=0);pr--)(_i=Yn[pr]).pos>ir.pmax-1&&(_i.del=!0,xr--);for(pr=0;pr=0;qr--)Yn[qr].dp-=Gr;for(pr=Yn.length-1;pr>=0&&!(xr<=0);pr--)(_i=Yn[pr]).pos+_i.dp+_i.size>ir.pmax&&(_i.del=!0,xr--)}}}for(Mn.each(function(Yn){var ir=Yn[rr],or=ir._id.charAt(0)==="x",xr=ir.range;Hn===0&&xr&&xr[0]>xr[1]!==or&&(jt=-1),vn[Hn++]=[{datum:Yn,traceIndex:Yn.trace.index,dp:0,pos:Yn.pos,posref:Yn.posref,size:Yn.by*(or?M:1)/2,pmin:0,pmax:or?nr.width:nr.height}]}),vn.sort(function(Yn,ir){return Yn[0].posref-ir[0].posref||jt*(ir[0].traceIndex-Yn[0].traceIndex)});!Bn&&jn<=fn;){for(jn++,Bn=!0,pr=0;pr.01&&wn.pmin===An.pmin&&wn.pmax===An.pmax){for(qr=Rn.length-1;qr>=0;qr--)Rn[qr].dp+=Nr;for(Nn.push.apply(Nn,Rn),vn.splice(pr+1,1),cn=0,qr=Nn.length-1;qr>=0;qr--)cn+=Nn[qr].dp;for(Gr=cn/Nn.length,qr=Nn.length-1;qr>=0;qr--)Nn[qr].dp-=Gr;Bn=!1}else pr++}vn.forEach(Un)}for(pr=vn.length-1;pr>=0;pr--){var kn=vn[pr];for(qr=kn.length-1;qr>=0;qr--){var Pn=kn[qr],Zn=Pn.datum;Zn.offset=Pn.dp,Zn.del=Pn.del}}}(lr,Kn?"xa":"ya",fe),B(lr,Kn,fe._invScaleX,fe._invScaleY)),le&&le.tagName){var Yr=v.getComponentMethod("annotations","hasClickToShow")(ee,Fn);d(r.select(le),Yr?"pointer":"")}!le||ue||!function(Mn,rr,nr){if(!nr||nr.length!==Mn._hoverdata.length)return!0;for(var Bn=nr.length-1;Bn>=0;Bn--){var Nr=nr[Bn],Gr=Mn._hoverdata[Bn];if(Nr.curveNumber!==Gr.curveNumber||String(Nr.pointNumber)!==String(Gr.pointNumber)||String(Nr.pointNumbers)!==String(Gr.pointNumbers))return!0}return!1}(ee,0,mn)||(mn&&ee.emit("plotly_unhover",{event:ie,points:mn}),ee.emit("plotly_hover",{event:ie,points:ee._hoverdata,xaxes:de,yaxes:ve,xvals:Re,yvals:Ve}))})(V,H,ne,q,Q)})},f.loneHover=function(V,H){var ne=!0;Array.isArray(V)||(ne=!1,V=[V]);var q=H.gd,Q=J(q),ee=re(q),ie=O(V.map(function(le){var ge=le._x0||le.x0||le.x||0,fe=le._x1||le.x1||le.x||0,me=le._y0||le.y0||le.y||0,_e=le._y1||le.y1||le.y||0,Ae=le.eventData;if(Ae){var ke=Math.min(ge,fe),Le=Math.max(ge,fe),de=Math.min(me,_e),ve=Math.max(me,_e),Me=le.trace;if(v.traceIs(Me,"gl3d")){var we=q._fullLayout[Me.scene]._scene.container,Ce=we.offsetLeft,Fe=we.offsetTop;ke+=Ce,Le+=Ce,de+=Fe,ve+=Fe}Ae.bbox={x0:ke+ee,x1:Le+ee,y0:de+Q,y1:ve+Q},H.inOut_bbox&&H.inOut_bbox.push(Ae.bbox)}else Ae=!1;return{color:le.color||p.defaultLine,x0:le.x0||le.x||0,x1:le.x1||le.x||0,y0:le.y0||le.y||0,y1:le.y1||le.y||0,xLabel:le.xLabel,yLabel:le.yLabel,zLabel:le.zLabel,text:le.text,name:le.name,idealAlign:le.idealAlign,borderColor:le.borderColor,fontFamily:le.fontFamily,fontSize:le.fontSize,fontColor:le.fontColor,nameLength:le.nameLength,textAlign:le.textAlign,trace:le.trace||{index:0,hoverinfo:""},xa:{_offset:0},ya:{_offset:0},index:0,hovertemplate:le.hovertemplate||!1,hovertemplateLabels:le.hovertemplateLabels||!1,eventData:Ae}}),{gd:q,hovermode:"closest",rotateLabels:!1,bgColor:H.bgColor||p.background,container:r.select(H.container),outerContainer:H.outerContainer||H.container}),ae=0,ue=0;return ie.sort(function(le,ge){return le.y0-ge.y0}).each(function(le,ge){var fe=le.y0-le.by/2;le.offset=fe-5([\s\S]*)<\/extra>/;function O(V,H){var ne=H.gd,q=ne._fullLayout,Q=H.hovermode,ee=H.rotateLabels,ie=H.bgColor,ae=H.container,ue=H.outerContainer,le=H.commonLabelOpts||{};if(V.length===0)return[[]];var ge=H.fontFamily||_.HOVERFONT,fe=H.fontSize||_.HOVERFONTSIZE,me=V[0],_e=me.xa,Ae=me.ya,ke=Q.charAt(0),Le=me[ke+"Label"],de=U(ne,ue),ve=de.top,Me=de.width,we=de.height,Ce=Le!==void 0&&me.distance<=H.hoverdistance&&(Q==="x"||Q==="y");if(Ce){var Fe,ze,$e=!0;for(Fe=0;Feq.width-Kt?(st=q.width-Kt,bt.attr("d","M"+(Kt-S)+",0L"+Kt+","+Zt+S+"v"+Zt+(2*P+It.height)+"H-"+Kt+"V"+Zt+S+"H"+(Kt-2*S)+"Z")):bt.attr("d","M0,0L"+S+","+Zt+S+"H"+(P+It.width/2)+"v"+Zt+(2*P+It.height)+"H-"+(P+It.width/2)+"V"+Zt+S+"H-"+S+"Z")}else{var qt,mn,Fn;Ae.side==="right"?(qt="start",mn=1,Fn="",st=_e._offset+_e._length):(qt="end",mn=-1,Fn="-",st=_e._offset),St=Ae._offset+(me.y0+me.y1)/2,Ft.attr("text-anchor",qt),bt.attr("d","M0,0L"+Fn+S+","+S+"V"+(P+It.height/2)+"h"+Fn+(2*P+It.width)+"V-"+(P+It.height/2)+"H"+Fn+S+"V-"+S+"Z");var pn,tn=It.height/2,nn=ve-It.top-tn,sn="clip"+q._uid+"commonlabel"+Ae._id;if(st=0?Ge:kt+Ie=0?kt:wt+Ie=0?Jt:Be+Te=0?Be:$t+Te=0,tt.idealAlign!=="top"&&qn||!Wn?qn?(tn+=sn/2,tt.anchor="start"):tt.anchor="middle":(tn-=sn/2,tt.anchor="end");else if(tt.pos=tn,qn=pn+nn/2+ar<=Me,Wn=pn-nn/2-ar>=0,tt.idealAlign!=="left"&&qn||!Wn)if(qn)pn+=nn/2,tt.anchor="start";else{tt.anchor="middle";var Dr=ar/2,yr=pn+Dr-Me,Sr=pn-Dr;yr>0&&(pn-=yr),Sr<0&&(pn+=-Sr)}else pn-=nn/2,tt.anchor="end";Zt.attr("text-anchor",tt.anchor),qt&&Kt.attr("text-anchor",tt.anchor),bt.attr("transform",i(pn,tn)+(ee?s(k):""))}),Ut}function N(V,H,ne,q,Q,ee){var ie="",ae="";V.nameOverride!==void 0&&(V.name=V.nameOverride),V.name&&(V.trace._meta&&(V.name=c.templateString(V.name,V.trace._meta)),ie=te(V.name,V.nameLength));var ue=ne.charAt(0),le=ue==="x"?"y":"x";V.zLabel!==void 0?(V.xLabel!==void 0&&(ae+="x: "+V.xLabel+"
    "),V.yLabel!==void 0&&(ae+="y: "+V.yLabel+"
    "),V.trace.type!=="choropleth"&&V.trace.type!=="choroplethmapbox"&&(ae+=(ae?"z: ":"")+V.zLabel)):H&&V[ue+"Label"]===Q?ae=V[le+"Label"]||"":V.xLabel===void 0?V.yLabel!==void 0&&V.trace.type!=="scattercarpet"&&(ae=V.yLabel):ae=V.yLabel===void 0?V.xLabel:"("+V.xLabel+", "+V.yLabel+")",!V.text&&V.text!==0||Array.isArray(V.text)||(ae+=(ae?"
    ":"")+V.text),V.extraText!==void 0&&(ae+=(ae?"
    ":"")+V.extraText),ee&&ae===""&&!V.hovertemplate&&(ie===""&&ee.remove(),ae=ie);var ge=V.hovertemplate||!1;if(ge){var fe=V.hovertemplateLabels||V;V[ue+"Label"]!==Q&&(fe[ue+"other"]=fe[ue+"Val"],fe[ue+"otherLabel"]=fe[ue+"Label"]),ae=(ae=c.hovertemplateString(ge,fe,q._d3locale,V.eventData[0]||{},V.trace._meta)).replace(D,function(me,_e){return ie=te(_e,V.nameLength),""})}return[ae,ie]}function B(V,H,ne,q){var Q=function(ie){return ie*ne},ee=function(ie){return ie*q};V.each(function(ie){var ae=r.select(this);if(ie.del)return ae.remove();var ue=ae.select("text.nums"),le=ie.anchor,ge=le==="end"?-1:1,fe={start:1,end:-1,middle:0}[le],me=fe*(S+P),_e=me+fe*(ie.txwidth+P),Ae=0,ke=ie.offset,Le=le==="middle";Le&&(me-=ie.tx2width/2,_e+=ie.txwidth/2+P),H&&(ke*=-E,Ae=ie.offset*T),ae.select("path").attr("d",Le?"M-"+Q(ie.bx/2+ie.tx2width/2)+","+ee(ke-ie.by/2)+"h"+Q(ie.bx)+"v"+ee(ie.by)+"h-"+Q(ie.bx)+"Z":"M0,0L"+Q(ge*S+Ae)+","+ee(S+ke)+"v"+ee(ie.by/2-S)+"h"+Q(ge*ie.bx)+"v-"+ee(ie.by)+"H"+Q(ge*S+Ae)+"V"+ee(ke-S)+"Z");var de=Ae+me,ve=ke+ie.ty0-ie.by/2+P,Me=ie.textAlign||"auto";Me!=="auto"&&(Me==="left"&&le!=="start"?(ue.attr("text-anchor","start"),de=Le?-ie.bx/2-ie.tx2width/2+P:-ie.bx-P):Me==="right"&&le!=="end"&&(ue.attr("text-anchor","end"),de=Le?ie.bx/2-ie.tx2width/2-P:ie.bx+P)),ue.call(h.positionText,Q(de),ee(ve)),ie.tx2width&&(ae.select("text.name").call(h.positionText,Q(_e+fe*P+Ae),ee(ke+ie.ty0-ie.by/2+P)),ae.select("rect").call(m.setRect,Q(_e+(fe-1)*ie.tx2width/2+Ae),ee(ke-ie.by/2-1),Q(ie.tx2width),ee(ie.by+2)))})}function W(V,H){var ne=V.index,q=V.trace||{},Q=V.cd[0],ee=V.cd[ne]||{};function ie(me){return me||a(me)&&me===0}var ae=Array.isArray(ne)?function(me,_e){var Ae=c.castOption(Q,ne,me);return ie(Ae)?Ae:c.extractOption({},q,"",_e)}:function(me,_e){return c.extractOption(ee,q,me,_e)};function ue(me,_e,Ae){var ke=ae(_e,Ae);ie(ke)&&(V[me]=ke)}if(ue("hoverinfo","hi","hoverinfo"),ue("bgcolor","hbg","hoverlabel.bgcolor"),ue("borderColor","hbc","hoverlabel.bordercolor"),ue("fontFamily","htf","hoverlabel.font.family"),ue("fontSize","hts","hoverlabel.font.size"),ue("fontColor","htc","hoverlabel.font.color"),ue("nameLength","hnl","hoverlabel.namelength"),ue("textAlign","hta","hoverlabel.align"),V.posref=H==="y"||H==="closest"&&q.orientation==="h"?V.xa._offset+(V.x0+V.x1)/2:V.ya._offset+(V.y0+V.y1)/2,V.x0=c.constrain(V.x0,0,V.xa._length),V.x1=c.constrain(V.x1,0,V.xa._length),V.y0=c.constrain(V.y0,0,V.ya._length),V.y1=c.constrain(V.y1,0,V.ya._length),V.xLabelVal!==void 0&&(V.xLabel="xLabel"in V?V.xLabel:y.hoverLabelText(V.xa,V.xLabelVal,q.xhoverformat),V.xVal=V.xa.c2d(V.xLabelVal)),V.yLabelVal!==void 0&&(V.yLabel="yLabel"in V?V.yLabel:y.hoverLabelText(V.ya,V.yLabelVal,q.yhoverformat),V.yVal=V.ya.c2d(V.yLabelVal)),V.zLabelVal!==void 0&&V.zLabel===void 0&&(V.zLabel=String(V.zLabelVal)),!(isNaN(V.xerr)||V.xa.type==="log"&&V.xerr<=0)){var le=y.tickText(V.xa,V.xa.c2l(V.xerr),"hover").text;V.xerrneg!==void 0?V.xLabel+=" +"+le+" / -"+y.tickText(V.xa,V.xa.c2l(V.xerrneg),"hover").text:V.xLabel+=" ± "+le,H==="x"&&(V.distance+=1)}if(!(isNaN(V.yerr)||V.ya.type==="log"&&V.yerr<=0)){var ge=y.tickText(V.ya,V.ya.c2l(V.yerr),"hover").text;V.yerrneg!==void 0?V.yLabel+=" +"+ge+" / -"+y.tickText(V.ya,V.ya.c2l(V.yerrneg),"hover").text:V.yLabel+=" ± "+ge,H==="y"&&(V.distance+=1)}var fe=V.hoverinfo||V.trace.hoverinfo;return fe&&fe!=="all"&&((fe=Array.isArray(fe)?fe:fe.split("+")).indexOf("x")===-1&&(V.xLabel=void 0),fe.indexOf("y")===-1&&(V.yLabel=void 0),fe.indexOf("z")===-1&&(V.zLabel=void 0),fe.indexOf("text")===-1&&(V.text=void 0),fe.indexOf("name")===-1&&(V.name=void 0)),V}function G(V,H,ne){var q,Q,ee=ne.container,ie=ne.fullLayout,ae=ie._size,ue=ne.event,le=!!H.hLinePoint,ge=!!H.vLinePoint;if(ee.selectAll(".spikeline").remove(),ge||le){var fe=p.combine(ie.plot_bgcolor,ie.paper_bgcolor);if(le){var me,_e,Ae=H.hLinePoint;q=Ae&&Ae.xa,(Q=Ae&&Ae.ya).spikesnap==="cursor"?(me=ue.pointerX,_e=ue.pointerY):(me=q._offset+Ae.x,_e=Q._offset+Ae.y);var ke,Le,de=l.readability(Ae.color,fe)<1.5?p.contrast(fe):Ae.color,ve=Q.spikemode,Me=Q.spikethickness,we=Q.spikecolor||de,Ce=y.getPxPosition(V,Q);if(ve.indexOf("toaxis")!==-1||ve.indexOf("across")!==-1){if(ve.indexOf("toaxis")!==-1&&(ke=Ce,Le=me),ve.indexOf("across")!==-1){var Fe=Q._counterDomainMin,ze=Q._counterDomainMax;Q.anchor==="free"&&(Fe=Math.min(Fe,Q.position),ze=Math.max(ze,Q.position)),ke=ae.l+Fe*ae.w,Le=ae.l+ze*ae.w}ee.insert("line",":first-child").attr({x1:ke,x2:Le,y1:_e,y2:_e,"stroke-width":Me,stroke:we,"stroke-dasharray":m.dashStyle(Q.spikedash,Me)}).classed("spikeline",!0).classed("crisp",!0),ee.insert("line",":first-child").attr({x1:ke,x2:Le,y1:_e,y2:_e,"stroke-width":Me+2,stroke:fe}).classed("spikeline",!0).classed("crisp",!0)}ve.indexOf("marker")!==-1&&ee.insert("circle",":first-child").attr({cx:Ce+(Q.side!=="right"?Me:-Me),cy:_e,r:Me,fill:we}).classed("spikeline",!0)}if(ge){var $e,Ke,Re=H.vLinePoint;q=Re&&Re.xa,Q=Re&&Re.ya,q.spikesnap==="cursor"?($e=ue.pointerX,Ke=ue.pointerY):($e=q._offset+Re.x,Ke=Q._offset+Re.y);var Ve,We,Ye=l.readability(Re.color,fe)<1.5?p.contrast(fe):Re.color,nt=q.spikemode,ft=q.spikethickness,yt=q.spikecolor||Ye,Ot=y.getPxPosition(V,q);if(nt.indexOf("toaxis")!==-1||nt.indexOf("across")!==-1){if(nt.indexOf("toaxis")!==-1&&(Ve=Ot,We=Ke),nt.indexOf("across")!==-1){var Tt=q._counterDomainMin,at=q._counterDomainMax;q.anchor==="free"&&(Tt=Math.min(Tt,q.position),at=Math.max(at,q.position)),Ve=ae.t+(1-at)*ae.h,We=ae.t+(1-Tt)*ae.h}ee.insert("line",":first-child").attr({x1:$e,x2:$e,y1:Ve,y2:We,"stroke-width":ft,stroke:yt,"stroke-dasharray":m.dashStyle(q.spikedash,ft)}).classed("spikeline",!0).classed("crisp",!0),ee.insert("line",":first-child").attr({x1:$e,x2:$e,y1:Ve,y2:We,"stroke-width":ft+2,stroke:fe}).classed("spikeline",!0).classed("crisp",!0)}nt.indexOf("marker")!==-1&&ee.insert("circle",":first-child").attr({cx:$e,cy:Ot-(q.side!=="top"?ft:-ft),r:ft,fill:yt}).classed("spikeline",!0)}}}function K(V,H){return!H||H.vLinePoint!==V._spikepoints.vLinePoint||H.hLinePoint!==V._spikepoints.hLinePoint}function te(V,H){return h.plainText(V||"",{len:H,allowedTags:["br","sub","sup","b","i","em"]})}function Y(V,H,ne){var q=H[V+"a"],Q=H[V+"Val"],ee=H.cd[0];if(q.type==="category")Q=q._categoriesMap[Q];else if(q.type==="date"){var ie=H.trace[V+"periodalignment"];if(ie){var ae=H.cd[H.index],ue=ae[V+"Start"];ue===void 0&&(ue=ae[V]);var le=ae[V+"End"];le===void 0&&(le=ae[V]);var ge=le-ue;ie==="end"?Q+=ge:ie==="middle"&&(Q+=ge/2)}Q=q.d2c(Q)}return ee&&ee.t&&ee.t.posLetter===q._id&&(ne.boxmode!=="group"&&ne.violinmode!=="group"||(Q+=ee.t.dPos)),Q}function J(V){return V.offsetTop+V.clientTop}function re(V){return V.offsetLeft+V.clientLeft}function U(V,H){var ne=V._fullLayout,q=H.getBoundingClientRect(),Q=q.x,ee=q.y,ie=Q+q.width,ae=ee+q.height,ue=c.apply3DTransform(ne._invTransform)(Q,ee),le=c.apply3DTransform(ne._invTransform)(ie,ae),ge=ue[0],fe=ue[1],me=le[0],_e=le[1];return{x:ge,y:fe,width:me-ge,height:_e-fe,top:Math.min(fe,_e),left:Math.min(ge,me),right:Math.max(ge,me),bottom:Math.max(fe,_e)}}},{"../../lib":503,"../../lib/events":492,"../../lib/override_cursor":514,"../../lib/svg_text_utils":529,"../../plots/cartesian/axes":554,"../../registry":638,"../color":366,"../dragelement":385,"../drawing":388,"../legend/defaults":418,"../legend/draw":419,"./constants":400,"./helpers":402,"@plotly/d3":58,"fast-isnumeric":190,tinycolor2:312}],404:[function(t,o,f){var r=t("../../lib"),a=t("../color"),l=t("./helpers").isUnifiedHover;o.exports=function(c,i,s,u){u=u||{};var h=i.legend;function d(m){u.font[m]||(u.font[m]=h?i.legend.font[m]:i.font[m])}i&&l(i.hovermode)&&(u.font||(u.font={}),d("size"),d("family"),d("color"),h?(u.bgcolor||(u.bgcolor=a.combine(i.legend.bgcolor,i.paper_bgcolor)),u.bordercolor||(u.bordercolor=i.legend.bordercolor)):u.bgcolor||(u.bgcolor=i.paper_bgcolor)),s("hoverlabel.bgcolor",u.bgcolor),s("hoverlabel.bordercolor",u.bordercolor),s("hoverlabel.namelength",u.namelength),r.coerceFont(s,"hoverlabel.font",u.font),s("hoverlabel.align",u.align)}},{"../../lib":503,"../color":366,"./helpers":402}],405:[function(t,o,f){var r=t("../../lib"),a=t("./layout_attributes");o.exports=function(l,c){function i(s,u){return c[s]!==void 0?c[s]:r.coerce(l,c,a,s,u)}return i("clickmode"),i("hovermode")}},{"../../lib":503,"./layout_attributes":407}],406:[function(t,o,f){var r=t("@plotly/d3"),a=t("../../lib"),l=t("../dragelement"),c=t("./helpers"),i=t("./layout_attributes"),s=t("./hover");o.exports={moduleType:"component",name:"fx",constants:t("./constants"),schema:{layout:i},attributes:t("./attributes"),layoutAttributes:i,supplyLayoutGlobalDefaults:t("./layout_global_defaults"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),getDistanceFunction:c.getDistanceFunction,getClosest:c.getClosest,inbox:c.inbox,quadrature:c.quadrature,appendArrayPointValue:c.appendArrayPointValue,castHoverOption:function(u,h,d){return a.castOption(u,h,"hoverlabel."+d)},castHoverinfo:function(u,h,d){return a.castOption(u,d,"hoverinfo",function(m){return a.coerceHoverinfo({hoverinfo:m},{_module:u._module},h)})},hover:s.hover,unhover:l.unhover,loneHover:s.loneHover,loneUnhover:function(u){var h=a.isD3Selection(u)?u:r.select(u);h.selectAll("g.hovertext").remove(),h.selectAll(".spikeline").remove()},click:t("./click")}},{"../../lib":503,"../dragelement":385,"./attributes":397,"./calc":398,"./click":399,"./constants":400,"./defaults":401,"./helpers":402,"./hover":403,"./layout_attributes":407,"./layout_defaults":408,"./layout_global_defaults":409,"@plotly/d3":58}],407:[function(t,o,f){var r=t("./constants"),a=t("../../plots/font_attributes"),l=a({editType:"none"});l.family.dflt=r.HOVERFONT,l.size.dflt=r.HOVERFONTSIZE,o.exports={clickmode:{valType:"flaglist",flags:["event","select"],dflt:"event",editType:"plot",extras:["none"]},dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","drawclosedpath","drawopenpath","drawline","drawrect","drawcircle","orbit","turntable",!1],dflt:"zoom",editType:"modebar"},hovermode:{valType:"enumerated",values:["x","y","closest",!1,"x unified","y unified"],dflt:"closest",editType:"modebar"},hoverdistance:{valType:"integer",min:-1,dflt:20,editType:"none"},spikedistance:{valType:"integer",min:-1,dflt:-1,editType:"none"},hoverlabel:{bgcolor:{valType:"color",editType:"none"},bordercolor:{valType:"color",editType:"none"},font:l,grouptitlefont:a({editType:"none"}),align:{valType:"enumerated",values:["left","right","auto"],dflt:"auto",editType:"none"},namelength:{valType:"integer",min:-1,dflt:15,editType:"none"},editType:"none"},selectdirection:{valType:"enumerated",values:["h","v","d","any"],dflt:"any",editType:"none"}}},{"../../plots/font_attributes":585,"./constants":400}],408:[function(t,o,f){var r=t("../../lib"),a=t("./layout_attributes"),l=t("./hovermode_defaults"),c=t("./hoverlabel_defaults");o.exports=function(i,s){function u(p,g){return r.coerce(i,s,a,p,g)}l(i,s)&&(u("hoverdistance"),u("spikedistance")),u("dragmode")==="select"&&u("selectdirection");var h=s._has("mapbox"),d=s._has("geo"),m=s._basePlotModules.length;s.dragmode==="zoom"&&((h||d)&&m===1||h&&d&&m===2)&&(s.dragmode="pan"),c(i,s,u),r.coerceFont(u,"hoverlabel.grouptitlefont",s.hoverlabel.font)}},{"../../lib":503,"./hoverlabel_defaults":404,"./hovermode_defaults":405,"./layout_attributes":407}],409:[function(t,o,f){var r=t("../../lib"),a=t("./hoverlabel_defaults"),l=t("./layout_attributes");o.exports=function(c,i){a(c,i,function(s,u){return r.coerce(c,i,l,s,u)})}},{"../../lib":503,"./hoverlabel_defaults":404,"./layout_attributes":407}],410:[function(t,o,f){var r=t("../../lib"),a=t("../../lib/regex").counter,l=t("../../plots/domain").attributes,c=t("../../plots/cartesian/constants").idRegex,i=t("../../plot_api/plot_template"),s={rows:{valType:"integer",min:1,editType:"plot"},roworder:{valType:"enumerated",values:["top to bottom","bottom to top"],dflt:"top to bottom",editType:"plot"},columns:{valType:"integer",min:1,editType:"plot"},subplots:{valType:"info_array",freeLength:!0,dimensions:2,items:{valType:"enumerated",values:[a("xy").toString(),""],editType:"plot"},editType:"plot"},xaxes:{valType:"info_array",freeLength:!0,items:{valType:"enumerated",values:[c.x.toString(),""],editType:"plot"},editType:"plot"},yaxes:{valType:"info_array",freeLength:!0,items:{valType:"enumerated",values:[c.y.toString(),""],editType:"plot"},editType:"plot"},pattern:{valType:"enumerated",values:["independent","coupled"],dflt:"coupled",editType:"plot"},xgap:{valType:"number",min:0,max:1,editType:"plot"},ygap:{valType:"number",min:0,max:1,editType:"plot"},domain:l({name:"grid",editType:"plot",noGridCell:!0},{}),xside:{valType:"enumerated",values:["bottom","bottom plot","top plot","top"],dflt:"bottom plot",editType:"plot"},yside:{valType:"enumerated",values:["left","left plot","right plot","right"],dflt:"left plot",editType:"plot"},editType:"plot"};function u(m,p,g){var y=p[g+"axes"],v=Object.keys((m._splomAxes||{})[g]||{});return Array.isArray(y)?y:v.length?v:void 0}function h(m,p,g,y,v,x){var _=p(m+"gap",g),A=p("domain."+m);p(m+"side",y);for(var b=new Array(v),k=A[0],w=(A[1]-k)/(v-_),M=w*(1-_),T=0;T1){!A&&!b&&!k&&D("pattern")==="independent"&&(A=!0),M._hasSubplotGrid=A;var S,P,L=D("roworder")==="top to bottom",R=A?.2:.1,F=A?.3:.1;w&&p._splomGridDflt&&(S=p._splomGridDflt.xside,P=p._splomGridDflt.yside),M._domains={x:h("x",D,R,S,E),y:h("y",D,F,P,T,L)}}else delete p.grid}function D(O,N){return r.coerce(g,M,s,O,N)}},contentDefaults:function(m,p){var g=p.grid;if(g&&g._domains){var y,v,x,_,A,b,k,w=m.grid||{},M=p._subplots,T=g._hasSubplotGrid,E=g.rows,S=g.columns,P=g.pattern==="independent",L=g._axisMap={};if(T){var R=w.subplots||[];b=g.subplots=new Array(E);var F=1;for(y=0;y1);if(T===!1&&(d.legend=void 0),(T!==!1||g.uirevision)&&(v("uirevision",d.uirevision),T!==!1)){v("bgcolor",d.paper_bgcolor),v("bordercolor"),v("borderwidth");var E,S,P,L=a.coerceFont(v,"font",d.font),R=v("orientation")==="h";if(R?(E=0,r.getComponentMethod("rangeslider","isVisible")(h.xaxis)?(S=1.1,P="bottom"):(S=-.1,P="top")):(E=1.02,S=1,P="auto"),v("traceorder",w),u.isGrouped(d.legend)&&v("tracegroupgap"),v("itemsizing"),v("itemwidth"),v("itemclick"),v("itemdoubleclick"),v("groupclick"),v("x",E),v("xanchor"),v("y",S),v("yanchor",P),v("valign"),a.noneOrAll(g,y,["x","y"]),v("title.text")){v("title.side",R?"left":"top");var F=a.extendFlat({},L,{size:a.bigFont(L.size)});a.coerceFont(v,"title.font",F)}}}},{"../../lib":503,"../../plot_api/plot_template":543,"../../plots/attributes":550,"../../plots/layout_attributes":610,"../../registry":638,"./attributes":416,"./helpers":422}],419:[function(t,o,f){var r=t("@plotly/d3"),a=t("../../lib"),l=t("../../plots/plots"),c=t("../../registry"),i=t("../../lib/events"),s=t("../dragelement"),u=t("../drawing"),h=t("../color"),d=t("../../lib/svg_text_utils"),m=t("./handle_click"),p=t("./constants"),g=t("../../constants/alignment"),y=g.LINE_SPACING,v=g.FROM_TL,x=g.FROM_BR,_=t("./get_legend_data"),A=t("./style"),b=t("./helpers");function k(L,R,F,D,O){var N=F.data()[0][0].trace,B={event:O,node:F.node(),curveNumber:N.index,expandedIndex:N._expandedIndex,data:L.data,layout:L.layout,frames:L._transitionData._frames,config:L._context,fullData:L._fullData,fullLayout:L._fullLayout};N._group&&(B.group=N._group),c.traceIs(N,"pie-like")&&(B.label=F.datum()[0].label),i.triggerHandler(L,"plotly_legendclick",B)!==!1&&(D===1?R._clickTimeout=setTimeout(function(){L._fullLayout&&m(F,L,D)},L._context.doubleClickDelay):D===2&&(R._clickTimeout&&clearTimeout(R._clickTimeout),L._legendMouseDownTime=0,i.triggerHandler(L,"plotly_legenddoubleclick",B)!==!1&&m(F,L,D)))}function w(L,R,F){var D,O,N=L.data()[0][0],B=N.trace,W=c.traceIs(B,"pie-like"),G=!F._inHover&&R._context.edits.legendText&&!W,K=F._maxNameLength;N.groupTitle?(D=N.groupTitle.text,O=N.groupTitle.font):(O=F.font,F.entries?D=N.text:(D=W?N.label:B.name,B._meta&&(D=a.templateString(D,B._meta))));var te=a.ensureSingle(L,"text","legendtext");te.attr("text-anchor","start").call(u.font,O).text(G?M(D,K):D);var Y=F.itemwidth+2*p.itemGap;d.positionText(te,Y,0),G?te.call(d.makeEditable,{gd:R,text:D}).call(E,L,R,F).on("edit",function(J){this.text(M(J,K)).call(E,L,R,F);var re=N.trace._fullInput||{},U={};if(c.hasTransform(re,"groupby")){var V=c.getTransformIndices(re,"groupby"),H=V[V.length-1],ne=a.keyedContainer(re,"transforms["+H+"].styles","target","value.name");ne.set(N.trace._group,J),U=ne.constructUpdate()}else U.name=J;return c.call("_guiRestyle",R,U,B.index)}):E(te,L,R,F)}function M(L,R){var F=Math.max(4,R);if(L&&L.trim().length>=F/2)return L;for(var D=F-(L=L||"").length;D>0;D--)L+=" ";return L}function T(L,R){var F,D=R._context.doubleClickDelay,O=1,N=a.ensureSingle(L,"rect","legendtoggle",function(B){R._context.staticPlot||B.style("cursor","pointer").attr("pointer-events","all"),B.call(h.fill,"rgba(0,0,0,0)")});R._context.staticPlot||(N.on("mousedown",function(){(F=new Date().getTime())-R._legendMouseDownTimeD&&(O=Math.max(O-1,1)),k(R,B,L,O,r.event)}}))}function E(L,R,F,D,O){D._inHover&&L.attr("data-notex",!0),d.convertToTspans(L,F,function(){(function(N,B,W,G){var K=N.data()[0][0];if(!W._inHover&&K&&!K.trace.showlegend)return void N.remove();var te=N.select("g[class*=math-group]"),Y=te.node();W||(W=B._fullLayout.legend);var J,re=W.borderwidth;J=G===1?W.title.font:K.groupTitle?K.groupTitle.font:W.font;var U,V,H=J.size*y;if(Y){var ne=u.bBox(Y);U=ne.height,V=ne.width,G===1?u.setTranslate(te,re,re+.75*U):u.setTranslate(te,0,.25*U)}else{var q=N.select(G===1?".legendtitletext":".legendtext"),Q=d.lineCount(q),ee=q.node();if(U=H*Q,V=ee?u.bBox(ee).width:0,G===1)W.title.side==="left"&&(V+=2*p.itemGap),d.positionText(q,re+p.titlePad,re+H);else{var ie=2*p.itemGap+W.itemwidth;K.groupTitle&&(ie=p.itemGap,V-=W.itemwidth),d.positionText(q,ie,-H*((Q-1)/2-.3))}}G===1?(W._titleWidth=V,W._titleHeight=U):(K.lineHeight=H,K.height=Math.max(U,16)+3,K.width=V)})(R,F,D,O)})}function S(L){return a.isRightAnchor(L)?"right":a.isCenterAnchor(L)?"center":"left"}function P(L){return a.isBottomAnchor(L)?"bottom":a.isMiddleAnchor(L)?"middle":"top"}o.exports=function(L,R){return R||(R=L._fullLayout.legend||{}),function(F,D){var O,N,B=F._fullLayout,W="legend"+B._uid,G=D._inHover;if(G?(O=D.layer,W+="-hover"):O=B._infolayer,!!O){if(F._legendMouseDownTime||(F._legendMouseDownTime=0),G){if(!D.entries)return;N=_(D.entries,D)}else{if(!F.calcdata)return;N=B.showlegend&&_(F.calcdata,D)}var K=B.hiddenlabels||[];if(!(G||B.showlegend&&N.length))return O.selectAll(".legend").remove(),B._topdefs.select("#"+W).remove(),l.autoMargin(F,"legend");var te=a.ensureSingle(O,"g","legend",function(Q){G||Q.attr("pointer-events","all")}),Y=a.ensureSingleById(B._topdefs,"clipPath",W,function(Q){Q.append("rect")}),J=a.ensureSingle(te,"rect","bg",function(Q){Q.attr("shape-rendering","crispEdges")});J.call(h.stroke,D.bordercolor).call(h.fill,D.bgcolor).style("stroke-width",D.borderwidth+"px");var re=a.ensureSingle(te,"g","scrollbox"),U=D.title;if(D._titleWidth=0,D._titleHeight=0,U.text){var V=a.ensureSingle(re,"text","legendtitletext");V.attr("text-anchor","start").call(u.font,U.font).text(U.text),E(V,re,F,D,1)}else re.selectAll(".legendtitletext").remove();var H=a.ensureSingle(te,"rect","scrollbar",function(Q){Q.attr(p.scrollBarEnterAttrs).call(h.fill,p.scrollBarColor)}),ne=re.selectAll("g.groups").data(N);ne.enter().append("g").attr("class","groups"),ne.exit().remove();var q=ne.selectAll("g.traces").data(a.identity);q.enter().append("g").attr("class","traces"),q.exit().remove(),q.style("opacity",function(Q){var ee=Q[0].trace;return c.traceIs(ee,"pie-like")?K.indexOf(Q[0].label)!==-1?.5:1:ee.visible==="legendonly"?.5:1}).each(function(){r.select(this).call(w,F,D)}).call(A,F,D).each(function(){G||r.select(this).call(T,F)}),a.syncOrAsync([l.previousPromises,function(){return function(Q,ee,ie,ae){var ue=Q._fullLayout;ae||(ae=ue.legend);var le=ue._size,ge=b.isVertical(ae),fe=b.isGrouped(ae),me=ae.borderwidth,_e=2*me,Ae=p.itemGap,ke=ae.itemwidth+2*Ae,Le=2*(me+Ae),de=P(ae),ve=ae.y<0||ae.y===0&&de==="top",Me=ae.y>1||ae.y===1&&de==="bottom",we=ae.tracegroupgap;ae._maxHeight=Math.max(ve||Me?ue.height/2:le.h,30);var Ce=0;ae._width=0,ae._height=0;var Fe=function(kt){var dt=0,Oe=0,Ie=kt.title.side;return Ie&&(Ie.indexOf("left")!==-1&&(dt=kt._titleWidth),Ie.indexOf("top")!==-1&&(Oe=kt._titleHeight)),[dt,Oe]}(ae);if(ge)ie.each(function(kt){var dt=kt[0].height;u.setTranslate(this,me+Fe[0],me+Fe[1]+ae._height+dt/2+Ae),ae._height+=dt,ae._width=Math.max(ae._width,kt[0].width)}),Ce=ke+ae._width,ae._width+=Ae+ke+_e,ae._height+=Le,fe&&(ee.each(function(kt,dt){u.setTranslate(this,0,dt*ae.tracegroupgap)}),ae._height+=(ae._lgroupsLength-1)*ae.tracegroupgap);else{var ze=S(ae),$e=ae.x<0||ae.x===0&&ze==="right",Ke=ae.x>1||ae.x===1&&ze==="left",Re=Me||ve,Ve=ue.width/2;ae._maxWidth=Math.max($e?Re&&ze==="left"?le.l+le.w:Ve:Ke?Re&&ze==="right"?le.r+le.w:Ve:le.w,2*ke);var We=0,Ye=0;ie.each(function(kt){var dt=kt[0].width+ke;We=Math.max(We,dt),Ye+=dt}),Ce=null;var nt=0;if(fe){var ft=0,yt=0,Ot=0;ee.each(function(){var kt=0,dt=0;r.select(this).selectAll("g.traces").each(function(Ie){var Te=Ie[0].width,Pe=Ie[0].height;u.setTranslate(this,Fe[0],Fe[1]+me+Ae+Pe/2+dt),dt+=Pe,kt=Math.max(kt,ke+Te)});var Oe=kt+Ae;yt>0&&Oe+me+yt>ae._maxWidth?(nt=Math.max(nt,yt),yt=0,Ot+=ft+we,ft=dt):ft=Math.max(ft,dt),u.setTranslate(this,yt,Ot),yt+=Oe}),ae._width=Math.max(nt,yt)+me,ae._height=Ot+ft+Le}else{var Tt=ie.size(),at=Ye+_e+(Tt-1)*Ae=ae._maxWidth&&(nt=Math.max(nt,Jt),Lt=0,Wt+=et,ae._height+=et,et=0),u.setTranslate(this,Fe[0]+me+Lt,Fe[1]+me+Wt+dt/2+Ae),Jt=Lt+Oe+Ae,Lt+=Ie,et=Math.max(et,dt)}),at?(ae._width=Lt+_e,ae._height=et+Le):(ae._width=Math.max(nt,Jt)+_e,ae._height+=et+Le)}}ae._width=Math.ceil(Math.max(ae._width+Fe[0],ae._titleWidth+2*(me+p.titlePad))),ae._height=Math.ceil(Math.max(ae._height+Fe[1],ae._titleHeight+2*(me+p.itemGap))),ae._effHeight=Math.min(ae._height,ae._maxHeight);var Be=Q._context.edits,Ge=Be.legendText||Be.legendPosition;ie.each(function(kt){var dt=r.select(this).select(".legendtoggle"),Oe=kt[0].height,Ie=Ge?ke:Ce||ke+kt[0].width;ge||(Ie+=Ae/2),u.setRect(dt,0,-Oe/2,Ie,Oe)})}(F,ne,q,D)},function(){var Q,ee,ie,ae,ue=B._size,le=D.borderwidth;if(!G){if(function(Re){var Ve=Re._fullLayout.legend,We=S(Ve),Ye=P(Ve);return l.autoMargin(Re,"legend",{x:Ve.x,y:Ve.y,l:Ve._width*v[We],r:Ve._width*x[We],b:Ve._effHeight*x[Ye],t:Ve._effHeight*v[Ye]})}(F))return;var ge=ue.l+ue.w*D.x-v[S(D)]*D._width,fe=ue.t+ue.h*(1-D.y)-v[P(D)]*D._effHeight;if(B.margin.autoexpand){var me=ge,_e=fe;ge=a.constrain(ge,0,B.width-D._width),fe=a.constrain(fe,0,B.height-D._effHeight),ge!==me&&a.log("Constrain legend.x to make legend fit inside graph"),fe!==_e&&a.log("Constrain legend.y to make legend fit inside graph")}u.setTranslate(te,ge,fe)}if(H.on(".drag",null),te.on("wheel",null),G||D._height<=D._maxHeight||F._context.staticPlot){var Ae=D._effHeight;G&&(Ae=D._height),J.attr({width:D._width-le,height:Ae-le,x:le/2,y:le/2}),u.setTranslate(re,0,0),Y.select("rect").attr({width:D._width-2*le,height:Ae-2*le,x:le,y:le}),u.setClipUrl(re,W,F),u.setRect(H,0,0,0,0),delete D._scrollY}else{var ke,Le,de,ve=Math.max(p.scrollBarMinHeight,D._effHeight*D._effHeight/D._height),Me=D._effHeight-ve-2*p.scrollBarMargin,we=D._height-D._effHeight,Ce=Me/we,Fe=Math.min(D._scrollY||0,we);J.attr({width:D._width-2*le+p.scrollBarWidth+p.scrollBarMargin,height:D._effHeight-le,x:le/2,y:le/2}),Y.select("rect").attr({width:D._width-2*le+p.scrollBarWidth+p.scrollBarMargin,height:D._effHeight-2*le,x:le,y:le+Fe}),u.setClipUrl(re,W,F),Ke(Fe,ve,Ce),te.on("wheel",function(){Ke(Fe=a.constrain(D._scrollY+r.event.deltaY/Me*we,0,we),ve,Ce),Fe!==0&&Fe!==we&&r.event.preventDefault()});var ze=r.behavior.drag().on("dragstart",function(){var Re=r.event.sourceEvent;ke=Re.type==="touchstart"?Re.changedTouches[0].clientY:Re.clientY,de=Fe}).on("drag",function(){var Re=r.event.sourceEvent;Re.buttons===2||Re.ctrlKey||(Le=Re.type==="touchmove"?Re.changedTouches[0].clientY:Re.clientY,Ke(Fe=function(Ve,We,Ye){var nt=(Ye-We)/Ce+Ve;return a.constrain(nt,0,we)}(de,ke,Le),ve,Ce))});H.call(ze);var $e=r.behavior.drag().on("dragstart",function(){var Re=r.event.sourceEvent;Re.type==="touchstart"&&(ke=Re.changedTouches[0].clientY,de=Fe)}).on("drag",function(){var Re=r.event.sourceEvent;Re.type==="touchmove"&&(Le=Re.changedTouches[0].clientY,Ke(Fe=function(Ve,We,Ye){var nt=(We-Ye)/Ce+Ve;return a.constrain(nt,0,we)}(de,ke,Le),ve,Ce))});re.call($e)}function Ke(Re,Ve,We){D._scrollY=F._fullLayout.legend._scrollY=Re,u.setTranslate(re,0,-Re),u.setRect(H,D._width,p.scrollBarMargin+Re*We,p.scrollBarWidth,Ve),Y.select("rect").attr("y",le+Re)}F._context.edits.legendPosition&&(te.classed("cursor-move",!0),s.init({element:te.node(),gd:F,prepFn:function(){var Re=u.getTranslate(te);ie=Re.x,ae=Re.y},moveFn:function(Re,Ve){var We=ie+Re,Ye=ae+Ve;u.setTranslate(te,We,Ye),Q=s.align(We,0,ue.l,ue.l+ue.w,D.xanchor),ee=s.align(Ye,0,ue.t+ue.h,ue.t,D.yanchor)},doneFn:function(){Q!==void 0&&ee!==void 0&&c.call("_guiRelayout",F,{"legend.x":Q,"legend.y":ee})},clickFn:function(Re,Ve){var We=O.selectAll("g.traces").filter(function(){var Ye=this.getBoundingClientRect();return Ve.clientX>=Ye.left&&Ve.clientX<=Ye.right&&Ve.clientY>=Ye.top&&Ve.clientY<=Ye.bottom});We.size()>0&&k(F,te,We,Re,Ve)}}))}],F)}}(L,R)}},{"../../constants/alignment":471,"../../lib":503,"../../lib/events":492,"../../lib/svg_text_utils":529,"../../plots/plots":619,"../../registry":638,"../color":366,"../dragelement":385,"../drawing":388,"./constants":417,"./get_legend_data":420,"./handle_click":421,"./helpers":422,"./style":424,"@plotly/d3":58}],420:[function(t,o,f){var r=t("../../registry"),a=t("./helpers");o.exports=function(l,c){var i,s,u=c._inHover,h=a.isGrouped(c),d=a.isReversed(c),m={},p=[],g=!1,y={},v=0,x=0;function _(B,W){if(B!==""&&a.isGrouped(c))p.indexOf(B)===-1?(p.push(B),g=!0,m[B]=[W]):m[B].push(W);else{var G="~~i"+v;p.push(G),m[G]=[W],v++}}for(i=0;iL&&(P=L)}E[i][0]._groupMinRank=P,E[i][0]._preGroupSort=i}var R=function(B,W){return B.trace.legendrank-W.trace.legendrank||B._preSort-W._preSort};for(E.forEach(function(B,W){B[0]._preGroupSort=W}),E.sort(function(B,W){return B[0]._groupMinRank-W[0]._groupMinRank||B[0]._preGroupSort-W[0]._preGroupSort}),i=0;iA?A:x}o.exports=function(x,_,A){var b=_._fullLayout;A||(A=b.legend);var k=A.itemsizing==="constant",w=A.itemwidth,M=(w+2*p.itemGap)/2,T=c(M,0),E=function(L,R,F,D){var O;if(L+1)O=L;else{if(!(R&&R.width>0))return 0;O=R.width}return k?D:Math.min(O,F)};function S(L,R,F){var D=L[0].trace,O=D.marker||{},N=O.line||{},B=F?D.visible&&D.type===F:a.traceIs(D,"bar"),W=r.select(R).select("g.legendpoints").selectAll("path.legend"+F).data(B?[L]:[]);W.enter().append("path").classed("legend"+F,!0).attr("d","M6,6H-6V-6H6Z").attr("transform",T),W.exit().remove(),W.each(function(G){var K=r.select(this),te=G[0],Y=E(te.mlw,O.line,5,2);K.style("stroke-width",Y+"px");var J=te.mcc;if(!A._inHover&&"mc"in te){var re=u(O),U=re.mid;U===void 0&&(U=(re.max+re.min)/2),J=i.tryColorscale(O,"")(U)}var V=J||te.mc||O.color,H=O.pattern,ne=H&&i.getPatternAttr(H.shape,0,"");if(ne){var q=i.getPatternAttr(H.bgcolor,0,null),Q=i.getPatternAttr(H.fgcolor,0,null),ee=H.fgopacity,ie=v(H.size,8,10),ae=v(H.solidity,.5,1),ue="legend-"+D.uid;K.call(i.pattern,"legend",_,ue,ne,ie,ae,J,H.fillmode,q,Q,ee)}else K.call(s.fill,V);Y&&s.stroke(K,te.mlc||N.color)})}function P(L,R,F){var D=L[0],O=D.trace,N=F?O.visible&&O.type===F:a.traceIs(O,F),B=r.select(R).select("g.legendpoints").selectAll("path.legend"+F).data(N?[L]:[]);if(B.enter().append("path").classed("legend"+F,!0).attr("d","M6,6H-6V-6H6Z").attr("transform",T),B.exit().remove(),B.size()){var W=(O.marker||{}).line,G=E(m(W.width,D.pts),W,5,2),K=l.minExtend(O,{marker:{line:{width:G}}});K.marker.line.color=W.color;var te=l.minExtend(D,{trace:K});d(B,te,K)}}x.each(function(L){var R=r.select(this),F=l.ensureSingle(R,"g","layers");F.style("opacity",L[0].trace.opacity);var D=A.valign,O=L[0].lineHeight,N=L[0].height;if(D!=="middle"&&O&&N){var B={top:1,bottom:-1}[D]*(.5*(O-N+3));F.attr("transform",c(0,B))}else F.attr("transform",null);F.selectAll("g.legendfill").data([L]).enter().append("g").classed("legendfill",!0),F.selectAll("g.legendlines").data([L]).enter().append("g").classed("legendlines",!0);var W=F.selectAll("g.legendsymbols").data([L]);W.enter().append("g").classed("legendsymbols",!0),W.selectAll("g.legendpoints").data([L]).enter().append("g").classed("legendpoints",!0)}).each(function(L){var R,F=L[0].trace,D=[];if(F.visible)switch(F.type){case"histogram2d":case"heatmap":D=[["M-15,-2V4H15V-2Z"]],R=!0;break;case"choropleth":case"choroplethmapbox":D=[["M-6,-6V6H6V-6Z"]],R=!0;break;case"densitymapbox":D=[["M-6,0 a6,6 0 1,0 12,0 a 6,6 0 1,0 -12,0"]],R="radial";break;case"cone":D=[["M-6,2 A2,2 0 0,0 -6,6 V6L6,4Z"],["M-6,-6 A2,2 0 0,0 -6,-2 L6,-4Z"],["M-6,-2 A2,2 0 0,0 -6,2 L6,0Z"]],R=!1;break;case"streamtube":D=[["M-6,2 A2,2 0 0,0 -6,6 H6 A2,2 0 0,1 6,2 Z"],["M-6,-6 A2,2 0 0,0 -6,-2 H6 A2,2 0 0,1 6,-6 Z"],["M-6,-2 A2,2 0 0,0 -6,2 H6 A2,2 0 0,1 6,-2 Z"]],R=!1;break;case"surface":D=[["M-6,-6 A2,3 0 0,0 -6,0 H6 A2,3 0 0,1 6,-6 Z"],["M-6,1 A2,3 0 0,1 -6,6 H6 A2,3 0 0,0 6,0 Z"]],R=!0;break;case"mesh3d":D=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6H6L0,6Z"]],R=!1;break;case"volume":D=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6H6L0,6Z"]],R=!0;break;case"isosurface":D=[["M-6,6H0L-6,-6Z"],["M6,6H0L6,-6Z"],["M-6,-6 A12,24 0 0,0 6,-6 L0,6Z"]],R=!1}var O=r.select(this).select("g.legendpoints").selectAll("path.legend3dandfriends").data(D);O.enter().append("path").classed("legend3dandfriends",!0).attr("transform",T).style("stroke-miterlimit",1),O.exit().remove(),O.each(function(N,B){var W,G=r.select(this),K=u(F),te=K.colorscale,Y=K.reversescale;if(te){if(!R){var J=te.length;W=B===0?te[Y?J-1:0][1]:B===1?te[Y?0:J-1][1]:te[Math.floor((J-1)/2)][1]}}else{var re=F.vertexcolor||F.facecolor||F.color;W=l.isArrayOrTypedArray(re)?re[B]||re[0]:re}G.attr("d",N[0]),W?G.call(s.fill,W):G.call(function(U){if(U.size()){var V="legendfill-"+F.uid;i.gradient(U,_,V,g(Y,R==="radial"),te,"fill")}})})}).each(function(L){var R=L[0].trace,F=R.type==="waterfall";if(L[0]._distinct&&F){var D=L[0].trace[L[0].dir].marker;return L[0].mc=D.color,L[0].mlw=D.line.width,L[0].mlc=D.line.color,S(L,this,"waterfall")}var O=[];R.visible&&F&&(O=L[0].hasTotals?[["increasing","M-6,-6V6H0Z"],["totals","M6,6H0L-6,-6H-0Z"],["decreasing","M6,6V-6H0Z"]]:[["increasing","M-6,-6V6H6Z"],["decreasing","M6,6V-6H-6Z"]]);var N=r.select(this).select("g.legendpoints").selectAll("path.legendwaterfall").data(O);N.enter().append("path").classed("legendwaterfall",!0).attr("transform",T).style("stroke-miterlimit",1),N.exit().remove(),N.each(function(B){var W=r.select(this),G=R[B[0]].marker,K=E(void 0,G.line,5,2);W.attr("d",B[1]).style("stroke-width",K+"px").call(s.fill,G.color),K&&W.call(s.stroke,G.line.color)})}).each(function(L){S(L,this,"funnel")}).each(function(L){S(L,this)}).each(function(L){var R=L[0].trace,F=r.select(this).select("g.legendpoints").selectAll("path.legendbox").data(R.visible&&a.traceIs(R,"box-violin")?[L]:[]);F.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform",T),F.exit().remove(),F.each(function(){var D=r.select(this);if(R.boxpoints!=="all"&&R.points!=="all"||s.opacity(R.fillcolor)!==0||s.opacity((R.line||{}).color)!==0){var O=E(void 0,R.line,5,2);D.style("stroke-width",O+"px").call(s.fill,R.fillcolor),O&&s.stroke(D,R.line.color)}else{var N=l.minExtend(R,{marker:{size:k?12:l.constrain(R.marker.size,2,16),sizeref:1,sizemin:1,sizemode:"diameter"}});F.call(i.pointStyle,N,_)}})}).each(function(L){P(L,this,"funnelarea")}).each(function(L){P(L,this,"pie")}).each(function(L){var R,F,D=y(L),O=D.showFill,N=D.showLine,B=D.showGradientLine,W=D.showGradientFill,G=D.anyFill,K=D.anyLine,te=L[0],Y=te.trace,J=u(Y),re=J.colorscale,U=J.reversescale,V=h.hasMarkers(Y)||!G?"M5,0":K?"M5,-2":"M5,-3",H=r.select(this),ne=H.select(".legendfill").selectAll("path").data(O||W?[L]:[]);if(ne.enter().append("path").classed("js-fill",!0),ne.exit().remove(),ne.attr("d",V+"h"+w+"v6h-"+w+"z").call(function(ee){if(ee.size())if(O)i.fillGroupStyle(ee,_);else{var ie="legendfill-"+Y.uid;i.gradient(ee,_,ie,g(U),re,"fill")}}),N||B){var q=E(void 0,Y.line,10,5);F=l.minExtend(Y,{line:{width:q}}),R=[l.minExtend(te,{trace:F})]}var Q=H.select(".legendlines").selectAll("path").data(N||B?[R]:[]);Q.enter().append("path").classed("js-line",!0),Q.exit().remove(),Q.attr("d",V+(B?"l"+w+",0.0001":"h"+w)).call(N?i.lineGroupStyle:function(ee){if(ee.size()){var ie="legendline-"+Y.uid;i.lineGroupStyle(ee),i.gradient(ee,_,ie,g(U),re,"stroke")}})}).each(function(L){var R,F,D=y(L),O=D.anyFill,N=D.anyLine,B=D.showLine,W=D.showMarker,G=L[0],K=G.trace,te=!W&&!N&&!O&&h.hasText(K);function Y(Q,ee,ie,ae){var ue=l.nestedProperty(K,Q).get(),le=l.isArrayOrTypedArray(ue)&&ee?ee(ue):ue;if(k&&le&&ae!==void 0&&(le=ae),ie){if(leie[1])return ie[1]}return le}function J(Q){return G._distinct&&G.index&&Q[G.index]?Q[G.index]:Q[0]}if(W||te||B){var re={},U={};if(W){re.mc=Y("marker.color",J),re.mx=Y("marker.symbol",J),re.mo=Y("marker.opacity",l.mean,[.2,1]),re.mlc=Y("marker.line.color",J),re.mlw=Y("marker.line.width",l.mean,[0,5],2),U.marker={sizeref:1,sizemin:1,sizemode:"diameter"};var V=Y("marker.size",l.mean,[2,16],12);re.ms=V,U.marker.size=V}B&&(U.line={width:Y("line.width",J,[0,10],5)}),te&&(re.tx="Aa",re.tp=Y("textposition",J),re.ts=10,re.tc=Y("textfont.color",J),re.tf=Y("textfont.family",J)),R=[l.minExtend(G,re)],(F=l.minExtend(K,U)).selectedpoints=null,F.texttemplate=null}var H=r.select(this).select("g.legendpoints"),ne=H.selectAll("path.scatterpts").data(W?R:[]);ne.enter().insert("path",":first-child").classed("scatterpts",!0).attr("transform",T),ne.exit().remove(),ne.call(i.pointStyle,F,_),W&&(R[0].mrc=3);var q=H.selectAll("g.pointtext").data(te?R:[]);q.enter().append("g").classed("pointtext",!0).append("text").attr("transform",T),q.exit().remove(),q.selectAll("text").call(i.textPointStyle,F,_)}).each(function(L){var R=L[0].trace,F=r.select(this).select("g.legendpoints").selectAll("path.legendcandle").data(R.visible&&R.type==="candlestick"?[L,L]:[]);F.enter().append("path").classed("legendcandle",!0).attr("d",function(D,O){return O?"M-15,0H-8M-8,6V-6H8Z":"M15,0H8M8,-6V6H-8Z"}).attr("transform",T).style("stroke-miterlimit",1),F.exit().remove(),F.each(function(D,O){var N=r.select(this),B=R[O?"increasing":"decreasing"],W=E(void 0,B.line,5,2);N.style("stroke-width",W+"px").call(s.fill,B.fillcolor),W&&s.stroke(N,B.line.color)})}).each(function(L){var R=L[0].trace,F=r.select(this).select("g.legendpoints").selectAll("path.legendohlc").data(R.visible&&R.type==="ohlc"?[L,L]:[]);F.enter().append("path").classed("legendohlc",!0).attr("d",function(D,O){return O?"M-15,0H0M-8,-6V0":"M15,0H0M8,6V0"}).attr("transform",T).style("stroke-miterlimit",1),F.exit().remove(),F.each(function(D,O){var N=r.select(this),B=R[O?"increasing":"decreasing"],W=E(void 0,B.line,5,2);N.style("fill","none").call(i.dashLine,B.line.dash,W),W&&s.stroke(N,B.line.color)})})}},{"../../lib":503,"../../registry":638,"../../traces/pie/helpers":906,"../../traces/pie/style_one":912,"../../traces/scatter/subtypes":952,"../color":366,"../colorscale/helpers":377,"../drawing":388,"./constants":417,"@plotly/d3":58}],425:[function(t,o,f){t("./constants"),o.exports={editType:"modebar",orientation:{valType:"enumerated",values:["v","h"],dflt:"h",editType:"modebar"},bgcolor:{valType:"color",editType:"modebar"},color:{valType:"color",editType:"modebar"},activecolor:{valType:"color",editType:"modebar"},uirevision:{valType:"any",editType:"none"},add:{valType:"string",arrayOk:!0,dflt:"",editType:"modebar"},remove:{valType:"string",arrayOk:!0,dflt:"",editType:"modebar"}}},{"./constants":427}],426:[function(t,o,f){var r=t("../../registry"),a=t("../../plots/plots"),l=t("../../plots/cartesian/axis_ids"),c=t("../../fonts/ploticon"),i=t("../shapes/draw").eraseActiveShape,s=t("../../lib"),u=s._,h=o.exports={};function d(b,k){var w,M,T=k.currentTarget,E=T.getAttribute("data-attr"),S=T.getAttribute("data-val")||!0,P=b._fullLayout,L={},R=l.list(b,null,!0),F=P._cartesianSpikesEnabled;if(E==="zoom"){var D,O=S==="in"?.5:2,N=(1+O)/2,B=(1-O)/2;for(M=0;M1?(U=["toggleHover"],V=["resetViews"]):P?(re=["zoomInGeo","zoomOutGeo"],U=["hoverClosestGeo"],V=["resetGeo"]):S?(U=["hoverClosest3d"],V=["resetCameraDefault3d","resetCameraLastSave3d"]):O?(re=["zoomInMapbox","zoomOutMapbox"],U=["toggleHover"],V=["resetViewMapbox"]):F?U=["hoverClosestGl2d"]:L?U=["hoverClosestPie"]:W?(U=["hoverClosestCartesian","hoverCompareCartesian"],V=["resetViewSankey"]):U=["toggleHover"],E&&(U=["toggleSpikelines","hoverClosestCartesian","hoverCompareCartesian"]),(function(ae){for(var ue=0;ue0)){var _=function(b,k,w){for(var M=w.filter(function(P){return k[P].anchor===b._id}),T=0,E=0;E=fe.max)le=ee[ge+1];else if(ue=fe.pmax)le=ee[ge+1];else if(ue0?b+x:x;return{ppad:x,ppadplus:_?w:M,ppadminus:_?M:w}}return{ppad:x}}function h(d,m,p,g,y){var v=d.type==="category"||d.type==="multicategory"?d.r2c:d.d2c;if(m!==void 0)return[v(m),v(p)];if(g){var x,_,A,b,k=1/0,w=-1/0,M=g.match(l.segmentRE);for(d.type==="date"&&(v=c.decodeDate(v)),x=0;xw&&(w=b)));return w>=k?[k,w]:void 0}}o.exports=function(d){var m=d._fullLayout,p=r.filterVisible(m.shapes);if(p.length&&d._fullData.length)for(var g=0;gge?(_e=ue,de="y0",Ae=ge,ve="y1"):(_e=ge,de="y1",Ae=ue,ve="y0"),Wt(dt),Ge(ee,q),function(Oe,Ie,Te){var Pe=Ie.xref,qe=Ie.yref,rt=l.getFromId(Te,Pe),lt=l.getFromId(Te,qe),ot="";Pe==="paper"||rt.autorange||(ot+=Pe),qe==="paper"||lt.autorange||(ot+=qe),h.setClipUrl(Oe,ot?"clip"+Te._fullLayout._uid+ot:null,Te)}(ne,q,H),Lt.moveFn=Fe==="move"?Jt:Be,Lt.altKey=dt.altKey)},doneFn:function(){x(H)||(p(ne),kt(ee),b(ne,H,q),r.call("_guiRelayout",H,ie.getUpdateObj()))},clickFn:function(){x(H)||kt(ee)}};function Wt(dt){if(x(H))Fe=null;else if(Ke)Fe=dt.target.tagName==="path"?"move":dt.target.attributes["data-line-point"].value==="start-point"?"resize-over-start-point":"resize-over-end-point";else{var Oe=Lt.element.getBoundingClientRect(),Ie=Oe.right-Oe.left,Te=Oe.bottom-Oe.top,Pe=dt.clientX-Oe.left,qe=dt.clientY-Oe.top,rt=!Re&&Ie>10&&Te>10&&!dt.shiftKey?m.getCursor(Pe/Ie,1-qe/Te):"move";p(ne,rt),Fe=rt.split("-")[0]}}function Jt(dt,Oe){if(q.type==="path"){var Ie=function(qe){return qe},Te=Ie,Pe=Ie;ze?Ve("xanchor",q.xanchor=Tt(fe+dt)):(Te=function(qe){return Tt(yt(qe)+dt)},We&&We.type==="date"&&(Te=y.encodeDate(Te))),$e?Ve("yanchor",q.yanchor=at(me+Oe)):(Pe=function(qe){return at(Ot(qe)+Oe)},nt&&nt.type==="date"&&(Pe=y.encodeDate(Pe))),Ve("path",q.path=w(Ce,Te,Pe))}else ze?Ve("xanchor",q.xanchor=Tt(fe+dt)):(Ve("x0",q.x0=Tt(ae+dt)),Ve("x1",q.x1=Tt(le+dt))),$e?Ve("yanchor",q.yanchor=at(me+Oe)):(Ve("y0",q.y0=at(ue+Oe)),Ve("y1",q.y1=at(ge+Oe)));ne.attr("d",k(H,q)),Ge(ee,q)}function Be(dt,Oe){if(Re){var Ie=function(De){return De},Te=Ie,Pe=Ie;ze?Ve("xanchor",q.xanchor=Tt(fe+dt)):(Te=function(De){return Tt(yt(De)+dt)},We&&We.type==="date"&&(Te=y.encodeDate(Te))),$e?Ve("yanchor",q.yanchor=at(me+Oe)):(Pe=function(De){return at(Ot(De)+Oe)},nt&&nt.type==="date"&&(Pe=y.encodeDate(Pe))),Ve("path",q.path=w(Ce,Te,Pe))}else if(Ke){if(Fe==="resize-over-start-point"){var qe=ae+dt,rt=$e?ue-Oe:ue+Oe;Ve("x0",q.x0=ze?qe:Tt(qe)),Ve("y0",q.y0=$e?rt:at(rt))}else if(Fe==="resize-over-end-point"){var lt=le+dt,ot=$e?ge-Oe:ge+Oe;Ve("x1",q.x1=ze?lt:Tt(lt)),Ve("y1",q.y1=$e?ot:at(ot))}}else{var At=function(De){return Fe.indexOf(De)!==-1},wt=At("n"),$t=At("s"),Ut=At("w"),tt=At("e"),bt=wt?_e+Oe:_e,Ft=$t?Ae+Oe:Ae,Et=Ut?ke+dt:ke,Pt=tt?Le+dt:Le;$e&&(wt&&(bt=_e-Oe),$t&&(Ft=Ae-Oe)),(!$e&&Ft-bt>10||$e&&bt-Ft>10)&&(Ve(de,q[de]=$e?bt:at(bt)),Ve(ve,q[ve]=$e?Ft:at(Ft))),Pt-Et>10&&(Ve(Me,q[Me]=ze?Et:Tt(Et)),Ve(we,q[we]=ze?Pt:Tt(Pt)))}ne.attr("d",k(H,q)),Ge(ee,q)}function Ge(dt,Oe){(ze||$e)&&function(){var Ie=Oe.type!=="path",Te=dt.selectAll(".visual-cue").data([0]);Te.enter().append("path").attr({fill:"#fff","fill-rule":"evenodd",stroke:"#000","stroke-width":1}).classed("visual-cue",!0);var Pe=yt(ze?Oe.xanchor:a.midRange(Ie?[Oe.x0,Oe.x1]:y.extractPathCoords(Oe.path,g.paramIsX))),qe=Ot($e?Oe.yanchor:a.midRange(Ie?[Oe.y0,Oe.y1]:y.extractPathCoords(Oe.path,g.paramIsY)));if(Pe=y.roundPositionForSharpStrokeRendering(Pe,1),qe=y.roundPositionForSharpStrokeRendering(qe,1),ze&&$e){var rt="M"+(Pe-1-1)+","+(qe-1-1)+"h-8v2h8 v8h2v-8 h8v-2h-8 v-8h-2 Z";Te.attr("d",rt)}else if(ze){var lt="M"+(Pe-1-1)+","+(qe-9-1)+"v18 h2 v-18 Z";Te.attr("d",lt)}else{var ot="M"+(Pe-9-1)+","+(qe-1-1)+"h18 v2 h-18 Z";Te.attr("d",ot)}}()}function kt(dt){dt.selectAll(".visual-cue").remove()}m.init(Lt),et.node().onmousemove=Wt}(T,re,P,E,F,J):P.editable===!0&&re.style("pointer-events",te||u.opacity(B)*N<=.5?"stroke":"all");re.node().addEventListener("click",function(){return function(H,ne){if(_(H)){var q=+ne.node().getAttribute("data-index");if(q>=0){if(q===H._fullLayout._activeShapeIndex)return void M(H);H._fullLayout._activeShapeIndex=q,H._fullLayout._deactivateShape=M,v(H)}}}(T,re)})}}function b(T,E,S){var P=(S.xref+S.yref).replace(/paper/g,"").replace(/[xyz][1-9]* *domain/g,"");h.setClipUrl(T,P?"clip"+E._fullLayout._uid+P:null,E)}function k(T,E){var S,P,L,R,F,D,O,N,B=E.type,W=l.getRefType(E.xref),G=l.getRefType(E.yref),K=l.getFromId(T,E.xref),te=l.getFromId(T,E.yref),Y=T._fullLayout._size;if(K?W==="domain"?P=function(ee){return K._offset+K._length*ee}:(S=y.shapePositionToRange(K),P=function(ee){return K._offset+K.r2p(S(ee,!0))}):P=function(ee){return Y.l+Y.w*ee},te?G==="domain"?R=function(ee){return te._offset+te._length*(1-ee)}:(L=y.shapePositionToRange(te),R=function(ee){return te._offset+te.r2p(L(ee,!0))}):R=function(ee){return Y.t+Y.h*(1-ee)},B==="path")return K&&K.type==="date"&&(P=y.decodeDate(P)),te&&te.type==="date"&&(R=y.decodeDate(R)),function(ee,ie,ae){var ue=ee.path,le=ee.xsizemode,ge=ee.ysizemode,fe=ee.xanchor,me=ee.yanchor;return ue.replace(g.segmentRE,function(_e){var Ae=0,ke=_e.charAt(0),Le=g.paramIsX[ke],de=g.paramIsY[ke],ve=g.numParams[ke],Me=_e.substr(1).replace(g.paramRE,function(we){return Le[Ae]?we=le==="pixel"?ie(fe)+Number(we):ie(we):de[Ae]&&(we=ge==="pixel"?ae(me)-Number(we):ae(we)),++Ae>ve&&(we="X"),we});return Ae>ve&&(Me=Me.replace(/[\s,]*X.*/,""),a.log("Ignoring extra params in segment "+_e)),ke+Me})}(E,P,R);if(E.xsizemode==="pixel"){var J=P(E.xanchor);F=J+E.x0,D=J+E.x1}else F=P(E.x0),D=P(E.x1);if(E.ysizemode==="pixel"){var re=R(E.yanchor);O=re-E.y0,N=re-E.y1}else O=R(E.y0),N=R(E.y1);if(B==="line")return"M"+F+","+O+"L"+D+","+N;if(B==="rect")return"M"+F+","+O+"H"+D+"V"+N+"H"+F+"Z";var U=(F+D)/2,V=(O+N)/2,H=Math.abs(U-F),ne=Math.abs(V-O),q="A"+H+","+ne,Q=U+H+","+V;return"M"+Q+q+" 0 1,1 "+(U+","+(V-ne))+q+" 0 0,1 "+Q+"Z"}function w(T,E,S){return T.replace(g.segmentRE,function(P){var L=0,R=P.charAt(0),F=g.paramIsX[R],D=g.paramIsY[R],O=g.numParams[R];return R+P.substr(1).replace(g.paramRE,function(N){return L>=O||(F[L]?N=E(N):D[L]&&(N=S(N)),L++),N})})}function M(T){_(T)&&T._fullLayout._activeShapeIndex>=0&&(s(T),delete T._fullLayout._activeShapeIndex,v(T))}o.exports={draw:v,drawOne:A,eraseActiveShape:function(T){if(_(T)){s(T);var E=T._fullLayout._activeShapeIndex,S=(T.layout||{}).shapes||[];if(E=0&&d(w),A.attr("d",y(_)),F&&!k&&(R=function(J,re){for(var U=0;U1&&(V.length!==2||V[1][0]!=="Z")&&(L===0&&(V[0][0]="M"),_[P]=V,M(),T())}}()}}function K(J,re){(function(U,V){if(_.length)for(var H=0;H<_.length;H++)for(var ne=0;ne<_[H].length;ne++)for(var q=0;q+2<_[H][ne].length;q+=2)_[H][ne][q+1]=R[H][ne][q+1]+U,_[H][ne][q+2]=R[H][ne][q+2]+V})(J,re),M()}function te(J){(P=+J.srcElement.getAttribute("data-i"))||(P=0),S[P].moveFn=K}function Y(){T()}}},{"../../../plots/cartesian/handle_outline":565,"../../../registry":638,"../../dragelement":385,"../../dragelement/helpers":384,"./constants":452,"./helpers":455,"./newshapes":456}],455:[function(t,o,f){var r=t("parse-svg-path"),a=t("./constants"),l=a.CIRCLE_SIDES,c=a.SQRT2,i=t("../../../plots/cartesian/helpers"),s=i.p2r,u=i.r2p,h=[0,3,4,5,6,1,2],d=[0,3,4,1,2];function m(g,y){return Math.abs(g-y)<=1e-6}function p(g,y){var v=y[1]-g[1],x=y[2]-g[2];return Math.sqrt(v*v+x*x)}f.writePaths=function(g){var y=g.length;if(!y)return"M0,0Z";for(var v="",x=0;x0&&w0&&(Y=Y.transition().duration(N.transition.duration).ease(N.transition.easing)),Y.attr("transform",s(te-.5*d.gripWidth,N._dims.currentValueTotalHeight))}}function L(O,N){var B=O._dims;return B.inputAreaStart+d.stepInset+(B.inputAreaLength-2*d.stepInset)*Math.min(1,Math.max(0,N))}function R(O,N){var B=O._dims;return Math.min(1,Math.max(0,(N-d.stepInset-B.inputAreaStart)/(B.inputAreaLength-2*d.stepInset-2*B.inputAreaStart)))}function F(O,N,B){var W=B._dims,G=i.ensureSingle(O,"rect",d.railTouchRectClass,function(K){K.call(E,N,O,B).style("pointer-events","all")});G.attr({width:W.inputAreaLength,height:Math.max(W.inputAreaWidth,d.tickOffset+B.ticklen+W.labelHeight)}).call(l.fill,B.bgcolor).attr("opacity",0),c.setTranslate(G,0,W.currentValueTotalHeight)}function D(O,N){var B=N._dims,W=B.inputAreaLength-2*d.railInset,G=i.ensureSingle(O,"rect",d.railRectClass);G.attr({width:W,height:d.railWidth,rx:d.railRadius,ry:d.railRadius,"shape-rendering":"crispEdges"}).call(l.stroke,N.bordercolor).call(l.fill,N.bgcolor).style("stroke-width",N.borderwidth+"px"),c.setTranslate(G,d.railInset,.5*(B.inputAreaWidth-d.railWidth)+B.currentValueTotalHeight)}o.exports=function(O){var N=O._fullLayout,B=function(J,re){for(var U=J[d.name],V=[],H=0;H0?[0]:[]);function G(J){J._commandObserver&&(J._commandObserver.remove(),delete J._commandObserver),a.autoMargin(O,v(J))}if(W.enter().append("g").classed(d.containerClassName,!0).style("cursor","ew-resize"),W.exit().each(function(){r.select(this).selectAll("g."+d.groupClassName).each(G)}).remove(),B.length!==0){var K=W.selectAll("g."+d.groupClassName).data(B,x);K.enter().append("g").classed(d.groupClassName,!0),K.exit().each(G).remove();for(var te=0;te0||ae<0){var fe={left:[-ue,0],right:[ue,0],top:[0,-ue],bottom:[0,ue]}[M.side];H.attr("transform",s(fe[0],fe[1]))}}}return Y.call(J),G&&(D?Y.on(".opacity",null):(L=0,R=!0,Y.text(k).on("mouseover.opacity",function(){r.select(this).transition().duration(m.SHOW_PLACEHOLDER).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(m.HIDE_PLACEHOLDER).style("opacity",0)})),Y.call(d.makeEditable,{gd:y}).on("edit",function(V){w!==void 0?c.call("_guiRestyle",y,b,V,w):c.call("_guiRelayout",y,b,V)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(J)}).on("input",function(V){this.text(V||" ").call(d.positionText,T.x,T.y)})),Y.classed("js-placeholder",R),S}}},{"../../constants/alignment":471,"../../constants/interactions":478,"../../lib":503,"../../lib/svg_text_utils":529,"../../plots/plots":619,"../../registry":638,"../color":366,"../drawing":388,"@plotly/d3":58,"fast-isnumeric":190}],465:[function(t,o,f){var r=t("../../plots/font_attributes"),a=t("../color/attributes"),l=t("../../lib/extend").extendFlat,c=t("../../plot_api/edit_types").overrideAll,i=t("../../plots/pad_attributes"),s=t("../../plot_api/plot_template").templatedArray,u=s("button",{visible:{valType:"boolean"},method:{valType:"enumerated",values:["restyle","relayout","animate","update","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},args2:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""},execute:{valType:"boolean",dflt:!0}});o.exports=c(s("updatemenu",{_arrayAttrRegexps:[/^updatemenus\[(0|[1-9][0-9]+)\]\.buttons/],visible:{valType:"boolean"},type:{valType:"enumerated",values:["dropdown","buttons"],dflt:"dropdown"},direction:{valType:"enumerated",values:["left","right","up","down"],dflt:"down"},active:{valType:"integer",min:-1,dflt:0},showactive:{valType:"boolean",dflt:!0},buttons:u,x:{valType:"number",min:-2,max:3,dflt:-.05},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"right"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},pad:l(i({editType:"arraydraw"}),{}),font:r({}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1,editType:"arraydraw"}}),"arraydraw","from-root")},{"../../lib/extend":493,"../../plot_api/edit_types":536,"../../plot_api/plot_template":543,"../../plots/font_attributes":585,"../../plots/pad_attributes":618,"../color/attributes":365}],466:[function(t,o,f){o.exports={name:"updatemenus",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",dropdownButtonGroupClassName:"updatemenu-dropdown-button-group",dropdownButtonClassName:"updatemenu-dropdown-button",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:24,arrowPadX:16,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF",arrowSymbol:{left:"◄",right:"►",up:"▲",down:"▼"}}},{}],467:[function(t,o,f){var r=t("../../lib"),a=t("../../plots/array_container_defaults"),l=t("./attributes"),c=t("./constants").name,i=l.buttons;function s(h,d,m){function p(g,y){return r.coerce(h,d,l,g,y)}p("visible",a(h,d,{name:"buttons",handleItemDefaults:u}).length>0)&&(p("active"),p("direction"),p("type"),p("showactive"),p("x"),p("y"),r.noneOrAll(h,d,["x","y"]),p("xanchor"),p("yanchor"),p("pad.t"),p("pad.r"),p("pad.b"),p("pad.l"),r.coerceFont(p,"font",m.font),p("bgcolor",m.paper_bgcolor),p("bordercolor"),p("borderwidth"))}function u(h,d){function m(p,g){return r.coerce(h,d,i,p,g)}m("visible",h.method==="skip"||Array.isArray(h.args))&&(m("method"),m("args"),m("args2"),m("label"),m("execute"))}o.exports=function(h,d){a(h,d,{name:c,handleItemDefaults:s})}},{"../../lib":503,"../../plots/array_container_defaults":549,"./attributes":465,"./constants":466}],468:[function(t,o,f){var r=t("@plotly/d3"),a=t("../../plots/plots"),l=t("../color"),c=t("../drawing"),i=t("../../lib"),s=t("../../lib/svg_text_utils"),u=t("../../plot_api/plot_template").arrayEditor,h=t("../../constants/alignment").LINE_SPACING,d=t("./constants"),m=t("./scrollbox");function p(L){return L._index}function g(L,R){return+L.attr(d.menuIndexAttrName)===R._index}function y(L,R,F,D,O,N,B,W){R.active=B,u(L.layout,d.name,R).applyUpdate("active",B),R.type==="buttons"?x(L,D,null,null,R):R.type==="dropdown"&&(O.attr(d.menuIndexAttrName,"-1"),v(L,D,O,N,R),W||x(L,D,O,N,R))}function v(L,R,F,D,O){var N=i.ensureSingle(R,"g",d.headerClassName,function(Y){Y.style("pointer-events","all")}),B=O._dims,W=O.active,G=O.buttons[W]||d.blankHeaderOpts,K={y:O.pad.t,yPad:0,x:O.pad.l,xPad:0,index:0},te={width:B.headerWidth,height:B.headerHeight};N.call(_,O,G,L).call(S,O,K,te),i.ensureSingle(R,"text",d.headerArrowClassName,function(Y){Y.attr("text-anchor","end").call(c.font,O.font).text(d.arrowSymbol[O.direction])}).attr({x:B.headerWidth-d.arrowOffsetX+O.pad.l,y:B.headerHeight/2+d.textOffsetY+O.pad.t}),N.on("click",function(){F.call(P,String(g(F,O)?-1:O._index)),x(L,R,F,D,O)}),N.on("mouseover",function(){N.call(w)}),N.on("mouseout",function(){N.call(M,O)}),c.setTranslate(R,B.lx,B.ly)}function x(L,R,F,D,O){F||(F=R).attr("pointer-events","all");var N=function(H){return+H.attr(d.menuIndexAttrName)==-1}(F)&&O.type!=="buttons"?[]:O.buttons,B=O.type==="dropdown"?d.dropdownButtonClassName:d.buttonClassName,W=F.selectAll("g."+B).data(i.filterVisible(N)),G=W.enter().append("g").classed(B,!0),K=W.exit();O.type==="dropdown"?(G.attr("opacity","0").transition().attr("opacity","1"),K.transition().attr("opacity","0").remove()):K.remove();var te=0,Y=0,J=O._dims,re=["up","down"].indexOf(O.direction)!==-1;O.type==="dropdown"&&(re?Y=J.headerHeight+d.gapButtonHeader:te=J.headerWidth+d.gapButtonHeader),O.type==="dropdown"&&O.direction==="up"&&(Y=-d.gapButtonHeader+d.gapButton-J.openHeight),O.type==="dropdown"&&O.direction==="left"&&(te=-d.gapButtonHeader+d.gapButton-J.openWidth);var U={x:J.lx+te+O.pad.l,y:J.ly+Y+O.pad.t,yPad:d.gapButton,xPad:d.gapButton,index:0},V={l:U.x+O.borderwidth,t:U.y+O.borderwidth};W.each(function(H,ne){var q=r.select(this);q.call(_,O,H,L).call(S,O,U),q.on("click",function(){r.event.defaultPrevented||(H.execute&&(H.args2&&O.active===ne?(y(L,O,0,R,F,D,-1),a.executeAPICommand(L,H.method,H.args2)):(y(L,O,0,R,F,D,ne),a.executeAPICommand(L,H.method,H.args))),L.emit("plotly_buttonclicked",{menu:O,button:H,active:O.active}))}),q.on("mouseover",function(){q.call(w)}),q.on("mouseout",function(){q.call(M,O),W.call(k,O)})}),W.call(k,O),re?(V.w=Math.max(J.openWidth,J.headerWidth),V.h=U.y-V.t):(V.w=U.x-V.l,V.h=Math.max(J.openHeight,J.headerHeight)),V.direction=O.direction,D&&(W.size()?function(H,ne,q,Q,ee,ie){var ae,ue,le,ge=ee.direction,fe=ge==="up"||ge==="down",me=ee._dims,_e=ee.active;if(fe)for(ue=0,le=0;le<_e;le++)ue+=me.heights[le]+d.gapButton;else for(ae=0,le=0;le<_e;le++)ae+=me.widths[le]+d.gapButton;Q.enable(ie,ae,ue),Q.hbar&&Q.hbar.attr("opacity","0").transition().attr("opacity","1"),Q.vbar&&Q.vbar.attr("opacity","0").transition().attr("opacity","1")}(0,0,0,D,O,V):function(H){var ne=!!H.hbar,q=!!H.vbar;ne&&H.hbar.transition().attr("opacity","0").each("end",function(){ne=!1,q||H.disable()}),q&&H.vbar.transition().attr("opacity","0").each("end",function(){q=!1,ne||H.disable()})}(D))}function _(L,R,F,D){L.call(A,R).call(b,R,F,D)}function A(L,R){i.ensureSingle(L,"rect",d.itemRectClassName,function(F){F.attr({rx:d.rx,ry:d.ry,"shape-rendering":"crispEdges"})}).call(l.stroke,R.bordercolor).call(l.fill,R.bgcolor).style("stroke-width",R.borderwidth+"px")}function b(L,R,F,D){var O=i.ensureSingle(L,"text",d.itemTextClassName,function(W){W.attr({"text-anchor":"start","data-notex":1})}),N=F.label,B=D._fullLayout._meta;B&&(N=i.templateString(N,B)),O.call(c.font,R.font).text(N).call(s.convertToTspans,D)}function k(L,R){var F=R.active;L.each(function(D,O){var N=r.select(this);O===F&&R.showactive&&N.select("rect."+d.itemRectClassName).call(l.fill,d.activeColor)})}function w(L){L.select("rect."+d.itemRectClassName).call(l.fill,d.hoverColor)}function M(L,R){L.select("rect."+d.itemRectClassName).call(l.fill,R.bgcolor)}function T(L,R){var F=R._dims={width1:0,height1:0,heights:[],widths:[],totalWidth:0,totalHeight:0,openWidth:0,openHeight:0,lx:0,ly:0},D=c.tester.selectAll("g."+d.dropdownButtonClassName).data(i.filterVisible(R.buttons));D.enter().append("g").classed(d.dropdownButtonClassName,!0);var O=["up","down"].indexOf(R.direction)!==-1;D.each(function(te,Y){var J=r.select(this);J.call(_,R,te,L);var re=J.select("."+d.itemTextClassName),U=re.node()&&c.bBox(re.node()).width,V=Math.max(U+d.textPadX,d.minWidth),H=R.font.size*h,ne=s.lineCount(re),q=Math.max(H*ne,d.minHeight)+d.textOffsetY;q=Math.ceil(q),V=Math.ceil(V),F.widths[Y]=V,F.heights[Y]=q,F.height1=Math.max(F.height1,q),F.width1=Math.max(F.width1,V),O?(F.totalWidth=Math.max(F.totalWidth,V),F.openWidth=F.totalWidth,F.totalHeight+=q+d.gapButton,F.openHeight+=q+d.gapButton):(F.totalWidth+=V+d.gapButton,F.openWidth+=V+d.gapButton,F.totalHeight=Math.max(F.totalHeight,q),F.openHeight=F.totalHeight)}),O?F.totalHeight-=d.gapButton:F.totalWidth-=d.gapButton,F.headerWidth=F.width1+d.arrowPadX,F.headerHeight=F.height1,R.type==="dropdown"&&(O?(F.width1+=d.arrowPadX,F.totalHeight=F.height1):F.totalWidth=F.width1,F.totalWidth+=d.arrowPadX),D.remove();var N=F.totalWidth+R.pad.l+R.pad.r,B=F.totalHeight+R.pad.t+R.pad.b,W=L._fullLayout._size;F.lx=W.l+W.w*R.x,F.ly=W.t+W.h*(1-R.y);var G="left";i.isRightAnchor(R)&&(F.lx-=N,G="right"),i.isCenterAnchor(R)&&(F.lx-=N/2,G="center");var K="top";i.isBottomAnchor(R)&&(F.ly-=B,K="bottom"),i.isMiddleAnchor(R)&&(F.ly-=B/2,K="middle"),F.totalWidth=Math.ceil(F.totalWidth),F.totalHeight=Math.ceil(F.totalHeight),F.lx=Math.round(F.lx),F.ly=Math.round(F.ly),a.autoMargin(L,E(R),{x:R.x,y:R.y,l:N*({right:1,center:.5}[G]||0),r:N*({left:1,center:.5}[G]||0),b:B*({top:1,middle:.5}[K]||0),t:B*({bottom:1,middle:.5}[K]||0)})}function E(L){return d.autoMarginIdRoot+L._index}function S(L,R,F,D){D=D||{};var O=L.select("."+d.itemRectClassName),N=L.select("."+d.itemTextClassName),B=R.borderwidth,W=F.index,G=R._dims;c.setTranslate(L,B+F.x,B+F.y);var K=["up","down"].indexOf(R.direction)!==-1,te=D.height||(K?G.heights[W]:G.height1);O.attr({x:0,y:0,width:D.width||(K?G.width1:G.widths[W]),height:te});var Y=R.font.size*h,J=(s.lineCount(N)-1)*Y/2;s.positionText(N,d.textOffsetX,te/2-J+d.textOffsetY),K?F.y+=G.heights[W]+F.yPad:F.x+=G.widths[W]+F.xPad,F.index++}function P(L,R){L.attr(d.menuIndexAttrName,R||"-1").selectAll("g."+d.dropdownButtonClassName).remove()}o.exports=function(L){var R=L._fullLayout,F=i.filterVisible(R[d.name]);function D(Y){a.autoMargin(L,E(Y))}var O=R._menulayer.selectAll("g."+d.containerClassName).data(F.length>0?[0]:[]);if(O.enter().append("g").classed(d.containerClassName,!0).style("cursor","pointer"),O.exit().each(function(){r.select(this).selectAll("g."+d.headerGroupClassName).each(D)}).remove(),F.length!==0){var N=O.selectAll("g."+d.headerGroupClassName).data(F,p);N.enter().append("g").classed(d.headerGroupClassName,!0);for(var B=i.ensureSingle(O,"g",d.dropdownButtonGroupClassName,function(Y){Y.style("pointer-events","all")}),W=0;WS,R=i.barLength+2*i.barPad,F=i.barWidth+2*i.barPad,D=_,O=b+k;O+F>p&&(O=p-F);var N=this.container.selectAll("rect.scrollbar-horizontal").data(L?[0]:[]);N.exit().on(".drag",null).remove(),N.enter().append("rect").classed("scrollbar-horizontal",!0).call(a.fill,i.barColor),L?(this.hbar=N.attr({rx:i.barRadius,ry:i.barRadius,x:D,y:O,width:R,height:F}),this._hbarXMin=D+R/2,this._hbarTranslateMax=S-R):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var B=k>P,W=i.barWidth+2*i.barPad,G=i.barLength+2*i.barPad,K=_+A,te=b;K+W>m&&(K=m-W);var Y=this.container.selectAll("rect.scrollbar-vertical").data(B?[0]:[]);Y.exit().on(".drag",null).remove(),Y.enter().append("rect").classed("scrollbar-vertical",!0).call(a.fill,i.barColor),B?(this.vbar=Y.attr({rx:i.barRadius,ry:i.barRadius,x:K,y:te,width:W,height:G}),this._vbarYMin=te+G/2,this._vbarTranslateMax=P-G):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var J=this.id,re=g-.5,U=B?y+W+.5:y+.5,V=v-.5,H=L?x+F+.5:x+.5,ne=d._topdefs.selectAll("#"+J).data(L||B?[0]:[]);if(ne.exit().remove(),ne.enter().append("clipPath").attr("id",J).append("rect"),L||B?(this._clipRect=ne.select("rect").attr({x:Math.floor(re),y:Math.floor(V),width:Math.ceil(U)-Math.floor(re),height:Math.ceil(H)-Math.floor(V)}),this.container.call(l.setClipUrl,J,this.gd),this.bg.attr({x:_,y:b,width:A,height:k})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(l.setClipUrl,null),delete this._clipRect),L||B){var q=r.behavior.drag().on("dragstart",function(){r.event.sourceEvent.preventDefault()}).on("drag",this._onBoxDrag.bind(this));this.container.on("wheel",null).on("wheel",this._onBoxWheel.bind(this)).on(".drag",null).call(q);var Q=r.behavior.drag().on("dragstart",function(){r.event.sourceEvent.preventDefault(),r.event.sourceEvent.stopPropagation()}).on("drag",this._onBarDrag.bind(this));L&&this.hbar.on(".drag",null).call(Q),B&&this.vbar.on(".drag",null).call(Q)}this.setTranslate(u,h)},i.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(l.setClipUrl,null),delete this._clipRect),this.hbar&&(this.hbar.on(".drag",null),this.hbar.remove(),delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax),this.vbar&&(this.vbar.on(".drag",null),this.vbar.remove(),delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax)},i.prototype._onBoxDrag=function(){var s=this.translateX,u=this.translateY;this.hbar&&(s-=r.event.dx),this.vbar&&(u-=r.event.dy),this.setTranslate(s,u)},i.prototype._onBoxWheel=function(){var s=this.translateX,u=this.translateY;this.hbar&&(s+=r.event.deltaY),this.vbar&&(u+=r.event.deltaY),this.setTranslate(s,u)},i.prototype._onBarDrag=function(){var s=this.translateX,u=this.translateY;if(this.hbar){var h=s+this._hbarXMin,d=h+this._hbarTranslateMax;s=(c.constrain(r.event.x,h,d)-h)/(d-h)*(this.position.w-this._box.w)}if(this.vbar){var m=u+this._vbarYMin,p=m+this._vbarTranslateMax;u=(c.constrain(r.event.y,m,p)-m)/(p-m)*(this.position.h-this._box.h)}this.setTranslate(s,u)},i.prototype.setTranslate=function(s,u){var h=this.position.w-this._box.w,d=this.position.h-this._box.h;if(s=c.constrain(s||0,0,h),u=c.constrain(u||0,0,d),this.translateX=s,this.translateY=u,this.container.call(l.setTranslate,this._box.l-this.position.l-s,this._box.t-this.position.t-u),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+s-.5),y:Math.floor(this.position.t+u-.5)}),this.hbar){var m=s/h;this.hbar.call(l.setTranslate,s+m*this._hbarTranslateMax,u)}if(this.vbar){var p=u/d;this.vbar.call(l.setTranslate,s,u+p*this._vbarTranslateMax)}}},{"../../lib":503,"../color":366,"../drawing":388,"@plotly/d3":58}],471:[function(t,o,f){o.exports={FROM_BL:{left:0,center:.5,right:1,bottom:0,middle:.5,top:1},FROM_TL:{left:0,center:.5,right:1,bottom:1,middle:.5,top:0},FROM_BR:{left:1,center:.5,right:0,bottom:0,middle:.5,top:1},LINE_SPACING:1.3,CAP_SHIFT:.7,MID_SHIFT:.35,OPPOSITE_SIDE:{left:"right",right:"left",top:"bottom",bottom:"top"}}},{}],472:[function(t,o,f){o.exports={axisRefDescription:function(r,a,l){return["If set to a",r,"axis id (e.g. *"+r+"* or","*"+r+"2*), the `"+r+"` position refers to a",r,"coordinate. If set to *paper*, the `"+r+"`","position refers to the distance from the",a,"of the plotting","area in normalized coordinates where *0* (*1*) corresponds to the",a,"("+l+"). If set to a",r,"axis ID followed by","*domain* (separated by a space), the position behaves like for","*paper*, but refers to the distance in fractions of the domain","length from the",a,"of the domain of that axis: e.g.,","*"+r+"2 domain* refers to the domain of the second",r," axis and a",r,"position of 0.5 refers to the","point between the",a,"and the",l,"of the domain of the","second",r,"axis."].join(" ")}}},{}],473:[function(t,o,f){o.exports={INCREASING:{COLOR:"#3D9970",SYMBOL:"▲"},DECREASING:{COLOR:"#FF4136",SYMBOL:"▼"}}},{}],474:[function(t,o,f){o.exports={FORMAT_LINK:"https://github.com/d3/d3-format/tree/v1.4.5#d3-format",DATE_FORMAT_LINK:"https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format"}},{}],475:[function(t,o,f){o.exports={COMPARISON_OPS:["=","!=","<",">=",">","<="],COMPARISON_OPS2:["=","<",">=",">","<="],INTERVAL_OPS:["[]","()","[)","(]","][",")(","](",")["],SET_OPS:["{}","}{"],CONSTRAINT_REDUCTION:{"=":"=","<":"<","<=":"<",">":">",">=":">","[]":"[]","()":"[]","[)":"[]","(]":"[]","][":"][",")(":"][","](":"][",")[":"]["}}},{}],476:[function(t,o,f){o.exports={solid:[[],0],dot:[[.5,1],200],dash:[[.5,1],50],longdash:[[.5,1],10],dashdot:[[.5,.625,.875,1],50],longdashdot:[[.5,.7,.8,1],10]}},{}],477:[function(t,o,f){o.exports={circle:"●","circle-open":"○",square:"■","square-open":"□",diamond:"◆","diamond-open":"◇",cross:"+",x:"❌"}},{}],478:[function(t,o,f){o.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DESELECTDIM:.2}},{}],479:[function(t,o,f){o.exports={BADNUM:void 0,FP_SAFE:1e-4*Number.MAX_VALUE,ONEMAXYEAR:316224e5,ONEAVGYEAR:315576e5,ONEMINYEAR:31536e6,ONEMAXQUARTER:79488e5,ONEAVGQUARTER:78894e5,ONEMINQUARTER:76896e5,ONEMAXMONTH:26784e5,ONEAVGMONTH:26298e5,ONEMINMONTH:24192e5,ONEWEEK:6048e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:24405875e-1,ALMOST_EQUAL:.999999,LOG_CLIP:10,MINUS_SIGN:"−"}},{}],480:[function(t,o,f){f.xmlns="http://www.w3.org/2000/xmlns/",f.svg="http://www.w3.org/2000/svg",f.xlink="http://www.w3.org/1999/xlink",f.svgAttrs={xmlns:f.svg,"xmlns:xlink":f.xlink}},{}],481:[function(t,o,f){f.version=t("./version").version,t("native-promise-only"),t("../build/plotcss");for(var r=t("./registry"),a=f.register=r.register,l=t("./plot_api"),c=Object.keys(l),i=0;iplotly-logomark"}}},{}],483:[function(t,o,f){f.isLeftAnchor=function(r){return r.xanchor==="left"||r.xanchor==="auto"&&r.x<=1/3},f.isCenterAnchor=function(r){return r.xanchor==="center"||r.xanchor==="auto"&&r.x>1/3&&r.x<2/3},f.isRightAnchor=function(r){return r.xanchor==="right"||r.xanchor==="auto"&&r.x>=2/3},f.isTopAnchor=function(r){return r.yanchor==="top"||r.yanchor==="auto"&&r.y>=2/3},f.isMiddleAnchor=function(r){return r.yanchor==="middle"||r.yanchor==="auto"&&r.y>1/3&&r.y<2/3},f.isBottomAnchor=function(r){return r.yanchor==="bottom"||r.yanchor==="auto"&&r.y<=1/3}},{}],484:[function(t,o,f){var r=t("./mod"),a=r.mod,l=r.modHalf,c=Math.PI,i=2*c;function s(m){return Math.abs(m[1]-m[0])>i-1e-14}function u(m,p){return l(p-m,i)}function h(m,p){if(s(p))return!0;var g,y;p[0](y=a(y,i))&&(y+=i);var v=a(m,i),x=v+i;return v>=g&&v<=y||x>=g&&x<=y}function d(m,p,g,y,v,x,_){v=v||0,x=x||0;var A,b,k,w,M,T=s([g,y]);function E(R,F){return[R*Math.cos(F)+v,x-R*Math.sin(F)]}T?(A=0,b=c,k=i):g=v&&m<=x);var v,x},pathArc:function(m,p,g,y,v){return d(null,m,p,g,y,v,0)},pathSector:function(m,p,g,y,v){return d(null,m,p,g,y,v,1)},pathAnnulus:function(m,p,g,y,v,x){return d(m,p,g,y,v,x,1)}}},{"./mod":510}],485:[function(t,o,f){var r=Array.isArray,a=ArrayBuffer,l=DataView;function c(u){return a.isView(u)&&!(u instanceof l)}function i(u){return r(u)||c(u)}function s(u,h,d){if(i(u)){if(i(u[0])){for(var m=d,p=0;px.max?y.set(v):y.set(+g)}},integer:{coerceFunction:function(g,y,v,x){g%1||!r(g)||x.min!==void 0&&gx.max?y.set(v):y.set(+g)}},string:{coerceFunction:function(g,y,v,x){if(typeof g!="string"){var _=typeof g=="number";x.strict!==!0&&_?y.set(String(g)):y.set(v)}else x.noBlank&&!g?y.set(v):y.set(g)}},color:{coerceFunction:function(g,y,v){a(g).isValid()?y.set(g):y.set(v)}},colorlist:{coerceFunction:function(g,y,v){Array.isArray(g)&&g.length&&g.every(function(x){return a(x).isValid()})?y.set(g):y.set(v)}},colorscale:{coerceFunction:function(g,y,v){y.set(c.get(g,v))}},angle:{coerceFunction:function(g,y,v){g==="auto"?y.set("auto"):r(g)?y.set(d(+g,360)):y.set(v)}},subplotid:{coerceFunction:function(g,y,v,x){var _=x.regex||h(v);typeof g=="string"&&_.test(g)?y.set(g):y.set(v)},validateFunction:function(g,y){var v=y.dflt;return g===v||typeof g=="string"&&!!h(v).test(g)}},flaglist:{coerceFunction:function(g,y,v,x){if(typeof g=="string")if((x.extras||[]).indexOf(g)===-1){for(var _=g.split("+"),A=0;A<_.length;){var b=_[A];x.flags.indexOf(b)===-1||_.indexOf(b)=r&&N<=a?N:h}if(typeof N!="string"&&typeof N!="number")return h;N=String(N);var te=k(B),Y=N.charAt(0);!te||Y!=="G"&&Y!=="g"||(N=N.substr(1),B="");var J=te&&B.substr(0,7)==="chinese",re=N.match(J?A:_);if(!re)return h;var U=re[1],V=re[3]||"1",H=Number(re[5]||1),ne=Number(re[7]||0),q=Number(re[9]||0),Q=Number(re[11]||0);if(te){if(U.length===2)return h;var ee;U=Number(U);try{var ie=v.getComponentMethod("calendars","getCal")(B);if(J){var ae=V.charAt(V.length-1)==="i";V=parseInt(V,10),ee=ie.newDate(U,ie.toMonthIndex(U,V,ae),H)}else ee=ie.newDate(U,Number(V),H)}catch{return h}return ee?(ee.toJD()-y)*d+ne*m+q*p+Q*g:h}U=U.length===2?(Number(U)+2e3-b)%100+b:Number(U),V-=1;var ue=new Date(Date.UTC(2e3,V,H,ne,q));return ue.setUTCFullYear(U),ue.getUTCMonth()!==V||ue.getUTCDate()!==H?h:ue.getTime()+Q*g},r=f.MIN_MS=f.dateTime2ms("-9999"),a=f.MAX_MS=f.dateTime2ms("9999-12-31 23:59:59.9999"),f.isDateTime=function(N,B){return f.dateTime2ms(N,B)!==h};var M=90*d,T=3*m,E=5*p;function S(N,B,W,G,K){if((B||W||G||K)&&(N+=" "+w(B,2)+":"+w(W,2),(G||K)&&(N+=":"+w(G,2),K))){for(var te=4;K%10==0;)te-=1,K/=10;N+="."+w(K,te)}return N}f.ms2DateTime=function(N,B,W){if(typeof N!="number"||!(N>=r&&N<=a))return h;B||(B=0);var G,K,te,Y,J,re,U=Math.floor(10*s(N+.05,1)),V=Math.round(N-U/10);if(k(W)){var H=Math.floor(V/d)+y,ne=Math.floor(s(N,d));try{G=v.getComponentMethod("calendars","getCal")(W).fromJD(H).formatDate("yyyy-mm-dd")}catch{G=x("G%Y-%m-%d")(new Date(V))}if(G.charAt(0)==="-")for(;G.length<11;)G="-0"+G.substr(1);else for(;G.length<10;)G="0"+G;K=B=r+d&&N<=a-d))return h;var B=Math.floor(10*s(N+.05,1)),W=new Date(Math.round(N-B/10));return S(l("%Y-%m-%d")(W),W.getHours(),W.getMinutes(),W.getSeconds(),10*W.getUTCMilliseconds()+B)},f.cleanDate=function(N,B,W){if(N===h)return B;if(f.isJSDate(N)||typeof N=="number"&&isFinite(N)){if(k(W))return i.error("JS Dates and milliseconds are incompatible with world calendars",N),B;if(!(N=f.ms2DateTimeLocal(+N))&&B!==void 0)return B}else if(!f.isDateTime(N,W))return i.error("unrecognized date",N),B;return N};var P=/%\d?f/g,L=/%h/g,R={1:"1",2:"1",3:"2",4:"2"};function F(N,B,W,G){N=N.replace(P,function(te){var Y=Math.min(+te.charAt(1)||6,6);return(B/1e3%1+2).toFixed(Y).substr(2).replace(/0+$/,"")||"0"});var K=new Date(Math.floor(B+.05));if(N=N.replace(L,function(){return R[W("%q")(K)]}),k(G))try{N=v.getComponentMethod("calendars","worldCalFmt")(N,B,G)}catch{return"Invalid"}return W(N)(K)}var D=[59,59.9,59.99,59.999,59.9999];f.formatDate=function(N,B,W,G,K,te){if(K=k(K)&&K,!B)if(W==="y")B=te.year;else if(W==="m")B=te.month;else{if(W!=="d")return function(Y,J){var re=s(Y+.05,d),U=w(Math.floor(re/m),2)+":"+w(s(Math.floor(re/p),60),2);if(J!=="M"){c(J)||(J=0);var V=(100+Math.min(s(Y/g,60),D[J])).toFixed(J).substr(1);J>0&&(V=V.replace(/0+$/,"").replace(/[\.]$/,"")),U+=":"+V}return U}(N,W)+` -`+F(te.dayMonthYear,N,G,K);B=te.dayMonth+` -`+te.year}return F(B,N,G,K)};var O=3*d;f.incrementMonth=function(N,B,W){W=k(W)&&W;var G=s(N,d);if(N=Math.round(N-G),W)try{var K=Math.round(N/d)+y,te=v.getComponentMethod("calendars","getCal")(W),Y=te.fromJD(K);return B%12?te.add(Y,B,"m"):te.add(Y,B/12,"y"),(Y.toJD()-y)*d+G}catch{i.error("invalid ms "+N+" in calendar "+W)}var J=new Date(N+O);return J.setUTCMonth(J.getUTCMonth()+B)+G-O},f.findExactDates=function(N,B){for(var W,G,K=0,te=0,Y=0,J=0,re=k(B)&&v.getComponentMethod("calendars","getCal")(B),U=0;U0&&S[P+1][0]<0)return P;return null}switch(x=M==="RUS"||M==="FJI"?function(S){var P;if(E(S)===null)P=S;else for(P=new Array(S.length),b=0;bP?L[R++]=[S[b][0]+360,S[b][1]]:b===P?(L[R++]=S[b],L[R++]=[S[b][0],-90]):L[R++]=S[b];var F=m.tester(L);F.pts.pop(),T.push(F)}:function(S){T.push(m.tester(S))},k.type){case"MultiPolygon":for(_=0;_W&&(W=te,O=K)}else O=N;return c.default(O).geometry.coordinates}(F),L.fIn=S,L.fOut=F,k.push(F)}else u.log(["Location",L.loc,"does not have a valid GeoJSON geometry.","Traces with locationmode *geojson-id* only support","*Polygon* and *MultiPolygon* geometries."].join(" "))}delete b[P]}switch(_.type){case"FeatureCollection":var T=_.features;for(A=0;A100?(clearInterval(P),E("Unexpected error while fetching from "+M)):void S++},50)})}for(var k=0;k0&&(c.push(i),i=[])}return i.length>0&&c.push(i),c},f.makeLine=function(a){return a.length===1?{type:"LineString",coordinates:a[0]}:{type:"MultiLineString",coordinates:a}},f.makePolygon=function(a){if(a.length===1)return{type:"Polygon",coordinates:a};for(var l=new Array(a.length),c=0;c1||T<0||T>1?null:{x:u+x*T,y:h+b*T}}function s(u,h,d,m,p){var g=m*u+p*h;if(g<0)return m*m+p*p;if(g>d){var y=m-u,v=p-h;return y*y+v*v}var x=m*h-p*u;return x*x/d}f.segmentsIntersect=i,f.segmentDistance=function(u,h,d,m,p,g,y,v){if(i(u,h,d,m,p,g,y,v))return 0;var x=d-u,_=m-h,A=y-p,b=v-g,k=x*x+_*_,w=A*A+b*b,M=Math.min(s(x,_,k,p-u,g-h),s(x,_,k,y-u,v-h),s(A,b,w,u-p,h-g),s(A,b,w,d-p,m-g));return Math.sqrt(M)},f.getTextLocation=function(u,h,d,m){if(u===a&&m===l||(r={},a=u,l=m),r[d])return r[d];var p=u.getPointAtLength(c(d-m/2,h)),g=u.getPointAtLength(c(d+m/2,h)),y=Math.atan((g.y-p.y)/(g.x-p.x)),v=u.getPointAtLength(c(d,h)),x={x:(4*v.x+p.x+g.x)/6,y:(4*v.y+p.y+g.y)/6,theta:y};return r[d]=x,x},f.clearLocationCache=function(){a=null},f.getVisibleSegment=function(u,h,d){var m,p,g=h.left,y=h.right,v=h.top,x=h.bottom,_=0,A=u.getTotalLength(),b=A;function k(M){var T=u.getPointAtLength(M);M===0?m=T:M===A&&(p=T);var E=T.xy?T.x-y:0,S=T.yx?T.y-x:0;return Math.sqrt(E*E+S*S)}for(var w=k(_);w;){if((_+=w+d)>b)return;w=k(_)}for(w=k(b);w;){if(_>(b-=w+d))return;w=k(b)}return{min:_,max:b,len:b-_,total:A,isClosed:_===0&&b===A&&Math.abs(m.x-p.x)<.1&&Math.abs(m.y-p.y)<.1}},f.findPointOnPath=function(u,h,d,m){for(var p,g,y,v=(m=m||{}).pathLength||u.getTotalLength(),x=m.tolerance||.001,_=m.iterationLimit||30,A=u.getPointAtLength(0)[d]>u.getPointAtLength(v)[d]?-1:1,b=0,k=0,w=v;b<_;){if(p=(k+w)/2,y=(g=u.getPointAtLength(p))[d]-h,Math.abs(y)0?w=p:k=p,b++}return g}},{"./mod":510}],499:[function(t,o,f){var r=t("fast-isnumeric"),a=t("tinycolor2"),l=t("color-normalize"),c=t("../components/colorscale"),i=t("../components/color/attributes").defaultLine,s=t("./array").isArrayOrTypedArray,u=l(i);function h(p,g){var y=p;return y[3]*=g,y}function d(p){if(r(p))return u;var g=l(p);return g.length?g:u}function m(p){return r(p)?p:1}o.exports={formatColor:function(p,g,y){var v,x,_,A,b,k=p.color,w=s(k),M=s(g),T=c.extractOpts(p),E=[];if(v=T.colorscale!==void 0?c.makeColorScaleFuncFromTrace(p):d,x=w?function(P,L){return P[L]===void 0?u:l(v(P[L]))}:d,_=M?function(P,L){return P[L]===void 0?1:m(P[L])}:m,w||M)for(var S=0;S1?(l*r+l*a)/l:r+a,i=String(c).length;if(i>16){var s=String(a).length;if(i>=String(r).length+s){var u=parseFloat(c).toPrecision(12);u.indexOf("e+")===-1&&(c=+u)}}return c}},{}],503:[function(t,o,f){var r=t("@plotly/d3"),a=t("d3-time-format").utcFormat,l=t("d3-format").format,c=t("fast-isnumeric"),i=t("../constants/numerical"),s=i.FP_SAFE,u=-s,h=i.BADNUM,d=o.exports={};d.adjustFormat=function(U){return!U||/^\d[.]\df/.test(U)||/[.]\d%/.test(U)?U:U==="0.f"?"~f":/^\d%/.test(U)?"~%":/^\ds/.test(U)?"~s":!/^[~,.0$]/.test(U)&&/[&fps]/.test(U)?"~"+U:U};var m={};d.warnBadFormat=function(U){var V=String(U);m[V]||(m[V]=1,d.warn('encountered bad format: "'+V+'"'))},d.noFormat=function(U){return String(U)},d.numberFormat=function(U){var V;try{V=l(d.adjustFormat(U))}catch{return d.warnBadFormat(U),d.noFormat}return V},d.nestedProperty=t("./nested_property"),d.keyedContainer=t("./keyed_container"),d.relativeAttr=t("./relative_attr"),d.isPlainObject=t("./is_plain_object"),d.toLogRange=t("./to_log_range"),d.relinkPrivateKeys=t("./relink_private");var p=t("./array");d.isTypedArray=p.isTypedArray,d.isArrayOrTypedArray=p.isArrayOrTypedArray,d.isArray1D=p.isArray1D,d.ensureArray=p.ensureArray,d.concat=p.concat,d.maxRowLength=p.maxRowLength,d.minRowLength=p.minRowLength;var g=t("./mod");d.mod=g.mod,d.modHalf=g.modHalf;var y=t("./coerce");d.valObjectMeta=y.valObjectMeta,d.coerce=y.coerce,d.coerce2=y.coerce2,d.coerceFont=y.coerceFont,d.coercePattern=y.coercePattern,d.coerceHoverinfo=y.coerceHoverinfo,d.coerceSelectionMarkerOpacity=y.coerceSelectionMarkerOpacity,d.validate=y.validate;var v=t("./dates");d.dateTime2ms=v.dateTime2ms,d.isDateTime=v.isDateTime,d.ms2DateTime=v.ms2DateTime,d.ms2DateTimeLocal=v.ms2DateTimeLocal,d.cleanDate=v.cleanDate,d.isJSDate=v.isJSDate,d.formatDate=v.formatDate,d.incrementMonth=v.incrementMonth,d.dateTick0=v.dateTick0,d.dfltRange=v.dfltRange,d.findExactDates=v.findExactDates,d.MIN_MS=v.MIN_MS,d.MAX_MS=v.MAX_MS;var x=t("./search");d.findBin=x.findBin,d.sorterAsc=x.sorterAsc,d.sorterDes=x.sorterDes,d.distinctVals=x.distinctVals,d.roundUp=x.roundUp,d.sort=x.sort,d.findIndexOfMin=x.findIndexOfMin,d.sortObjectKeys=t("./sort_object_keys");var _=t("./stats");d.aggNums=_.aggNums,d.len=_.len,d.mean=_.mean,d.median=_.median,d.midRange=_.midRange,d.variance=_.variance,d.stdev=_.stdev,d.interp=_.interp;var A=t("./matrix");d.init2dArray=A.init2dArray,d.transposeRagged=A.transposeRagged,d.dot=A.dot,d.translationMatrix=A.translationMatrix,d.rotationMatrix=A.rotationMatrix,d.rotationXYMatrix=A.rotationXYMatrix,d.apply3DTransform=A.apply3DTransform,d.apply2DTransform=A.apply2DTransform,d.apply2DTransform2=A.apply2DTransform2,d.convertCssMatrix=A.convertCssMatrix,d.inverseTransformMatrix=A.inverseTransformMatrix;var b=t("./angles");d.deg2rad=b.deg2rad,d.rad2deg=b.rad2deg,d.angleDelta=b.angleDelta,d.angleDist=b.angleDist,d.isFullCircle=b.isFullCircle,d.isAngleInsideSector=b.isAngleInsideSector,d.isPtInsideSector=b.isPtInsideSector,d.pathArc=b.pathArc,d.pathSector=b.pathSector,d.pathAnnulus=b.pathAnnulus;var k=t("./anchor_utils");d.isLeftAnchor=k.isLeftAnchor,d.isCenterAnchor=k.isCenterAnchor,d.isRightAnchor=k.isRightAnchor,d.isTopAnchor=k.isTopAnchor,d.isMiddleAnchor=k.isMiddleAnchor,d.isBottomAnchor=k.isBottomAnchor;var w=t("./geometry2d");d.segmentsIntersect=w.segmentsIntersect,d.segmentDistance=w.segmentDistance,d.getTextLocation=w.getTextLocation,d.clearLocationCache=w.clearLocationCache,d.getVisibleSegment=w.getVisibleSegment,d.findPointOnPath=w.findPointOnPath;var M=t("./extend");d.extendFlat=M.extendFlat,d.extendDeep=M.extendDeep,d.extendDeepAll=M.extendDeepAll,d.extendDeepNoArrays=M.extendDeepNoArrays;var T=t("./loggers");d.log=T.log,d.warn=T.warn,d.error=T.error;var E=t("./regex");d.counterRegex=E.counter;var S=t("./throttle");d.throttle=S.throttle,d.throttleDone=S.done,d.clearThrottle=S.clear;var P=t("./dom");function L(U){var V={};for(var H in U)for(var ne=U[H],q=0;qs||U=V)&&c(U)&&U>=0&&U%1==0},d.noop=t("./noop"),d.identity=t("./identity"),d.repeat=function(U,V){for(var H=new Array(V),ne=0;neH?Math.max(H,Math.min(V,U)):Math.max(V,Math.min(H,U))},d.bBoxIntersect=function(U,V,H){return H=H||0,U.left<=V.right+H&&V.left<=U.right+H&&U.top<=V.bottom+H&&V.top<=U.bottom+H},d.simpleMap=function(U,V,H,ne,q){for(var Q=U.length,ee=new Array(Q),ie=0;ie=Math.pow(2,H)?q>10?(d.warn("randstr failed uniqueness"),ae):U(V,H,ne,(q||0)+1):ae},d.OptionControl=function(U,V){U||(U={}),V||(V="opt");var H={optionList:[],_newoption:function(ne){ne[V]=U,H[ne.name]=ne,H.optionList.push(ne)}};return H["_"+V]=U,H},d.smooth=function(U,V){if((V=Math.round(V)||0)<2)return U;var H,ne,q,Q,ee=U.length,ie=2*ee,ae=2*V-1,ue=new Array(ae),le=new Array(ee);for(H=0;H=ie&&(q-=ie*Math.floor(q/ie)),q<0?q=-1-q:q>=ee&&(q=ie-1-q),Q+=U[q]*ue[ne];le[H]=Q}return le},d.syncOrAsync=function(U,V,H){var ne;function q(){return d.syncOrAsync(U,V,H)}for(;U.length;)if((ne=(0,U.splice(0,1)[0])(V))&&ne.then)return ne.then(q);return H&&H(V)},d.stripTrailingSlash=function(U){return U.substr(-1)==="/"?U.substr(0,U.length-1):U},d.noneOrAll=function(U,V,H){if(U){var ne,q=!1,Q=!0;for(ne=0;ne0?q:0})},d.fillArray=function(U,V,H,ne){if(ne=ne||d.identity,d.isArrayOrTypedArray(U))for(var q=0;q1?q+ee[1]:"";if(Q&&(ee.length>1||ie.length>4||H))for(;ne.test(ie);)ie=ie.replace(ne,"$1"+Q+"$2");return ie+ae},d.TEMPLATE_STRING_REGEX=/%{([^\s%{}:]*)([:|\|][^}]*)?}/g;var B=/^\w*$/;d.templateString=function(U,V){var H={};return U.replace(d.TEMPLATE_STRING_REGEX,function(ne,q){var Q;return B.test(q)?Q=V[q]:(H[q]=H[q]||d.nestedProperty(V,q).get,Q=H[q]()),d.isValidTextValue(Q)?Q:""})};var W={max:10,count:0,name:"hovertemplate"};d.hovertemplateString=function(){return te.apply(W,arguments)};var G={max:10,count:0,name:"texttemplate"};d.texttemplateString=function(){return te.apply(G,arguments)};var K=/^[:|\|]/;function te(U,V,H){var ne=this,q=arguments;V||(V={});var Q={};return U.replace(d.TEMPLATE_STRING_REGEX,function(ee,ie,ae){var ue,le,ge,fe=ie==="_xother"||ie==="_yother",me=ie==="_xother_"||ie==="_yother_",_e=ie==="xother_"||ie==="yother_",Ae=ie==="xother"||ie==="yother"||fe||_e||me,ke=ie;if((fe||me)&&(ke=ke.substring(1)),(_e||me)&&(ke=ke.substring(0,ke.length-1)),Ae){if((ue=V[ke])===void 0)return""}else for(ge=3;ge=48&&ee<=57,ue=ie>=48&&ie<=57;if(ae&&(ne=10*ne+ee-48),ue&&(q=10*q+ie-48),!ae||!ue){if(ne!==q)return ne-q;if(ee!==ie)return ee-ie}}return q-ne};var Y=2e9;d.seedPseudoRandom=function(){Y=2e9},d.pseudoRandom=function(){var U=Y;return Y=(69069*Y+1)%4294967296,Math.abs(Y-U)<429496729?d.pseudoRandom():Y/4294967296},d.fillText=function(U,V,H){var ne=Array.isArray(H)?function(ee){H.push(ee)}:function(ee){H.text=ee},q=d.extractOption(U,V,"htx","hovertext");if(d.isValidTextValue(q))return ne(q);var Q=d.extractOption(U,V,"tx","text");return d.isValidTextValue(Q)?ne(Q):void 0},d.isValidTextValue=function(U){return U||U===0},d.formatPercent=function(U,V){V=V||0;for(var H=(Math.round(100*U*Math.pow(10,V))*Math.pow(.1,V)).toFixed(V)+"%",ne=0;ne1&&(ue=1):ue=0,d.strTranslate(q-ue*(H+ee),Q-ue*(ne+ie))+d.strScale(ue)+(ae?"rotate("+ae+(V?"":" "+H+" "+ne)+")":"")},d.ensureUniformFontSize=function(U,V){var H=d.extendFlat({},V);return H.size=Math.max(V.size,U._fullLayout.uniformtext.minsize||0),H},d.join2=function(U,V,H){var ne=U.length;return ne>1?U.slice(0,-1).join(V)+H+U[ne-1]:U.join(V)},d.bigFont=function(U){return Math.round(1.2*U)};var J=d.getFirefoxVersion(),re=J!==null&&J<86;d.getPositionFromD3Event=function(){return re?[r.event.layerX,r.event.layerY]:[r.event.offsetX,r.event.offsetY]}},{"../constants/numerical":479,"./anchor_utils":483,"./angles":484,"./array":485,"./clean_number":486,"./clear_responsive":488,"./coerce":489,"./dates":490,"./dom":491,"./extend":493,"./filter_unique":494,"./filter_visible":495,"./geometry2d":498,"./identity":501,"./increment":502,"./is_plain_object":504,"./keyed_container":505,"./localize":506,"./loggers":507,"./make_trace_groups":508,"./matrix":509,"./mod":510,"./nested_property":511,"./noop":512,"./notifier":513,"./preserve_drawing_buffer":517,"./push_unique":518,"./regex":520,"./relative_attr":521,"./relink_private":522,"./search":523,"./sort_object_keys":526,"./stats":527,"./throttle":530,"./to_log_range":531,"@plotly/d3":58,"d3-format":112,"d3-time-format":120,"fast-isnumeric":190}],504:[function(t,o,f){o.exports=function(r){return window&&window.process&&window.process.versions?Object.prototype.toString.call(r)==="[object Object]":Object.prototype.toString.call(r)==="[object Object]"&&Object.getPrototypeOf(r).hasOwnProperty("hasOwnProperty")}},{}],505:[function(t,o,f){var r=t("./nested_property"),a=/^\w*$/;o.exports=function(l,c,i,s){var u,h,d;i=i||"name",s=s||"value";var m={};c&&c.length?(d=r(l,c),h=d.get()):h=l,c=c||"";var p={};if(h)for(u=0;u2)return m[x]=2|m[x],y.set(v,null);if(g){for(u=x;u1){var i=["LOG:"];for(c=0;c1){var s=[];for(c=0;c"),"long")}},l.warn=function(){var c;if(r.logging>0){var i=["WARN:"];for(c=0;c0){var s=[];for(c=0;c"),"stick")}},l.error=function(){var c;if(r.logging>0){var i=["ERROR:"];for(c=0;c0){var s=[];for(c=0;c"),"stick")}}},{"../plot_api/plot_config":541,"./notifier":513}],508:[function(t,o,f){var r=t("@plotly/d3");o.exports=function(a,l,c){var i=a.selectAll("g."+c.replace(/\s/g,".")).data(l,function(u){return u[0].trace.uid});i.exit().remove(),i.enter().append("g").attr("class",c),i.order();var s=a.classed("rangeplot")?"nodeRangePlot3":"node3";return i.each(function(u){u[0][s]=r.select(this)}),i}},{"@plotly/d3":58}],509:[function(t,o,f){var r=t("gl-mat4");f.init2dArray=function(a,l){for(var c=new Array(a),i=0;ia/2?r-Math.round(r/a)*a:r}}},{}],511:[function(t,o,f){var r=t("fast-isnumeric"),a=t("./array").isArrayOrTypedArray;function l(m,p){return function(){var g,y,v,x,_,A=m;for(x=0;x/g),y=0;yh||b===a||bm)&&(!_||!p(x))}:function(x,_){var A=x[0],b=x[1];if(A===a||Ah||b===a||bm)return!1;var k,w,M,T,E,S=s.length,P=s[0][0],L=s[0][1],R=0;for(k=1;kMath.max(w,P)||b>Math.max(M,L)))if(by||Math.abs(r(d,x))>u)return!0;return!1},l.filter=function(c,i){var s=[c[0]],u=0,h=0;function d(m){c.push(m);var p=s.length,g=u;s.splice(h+1);for(var y=g+1;y1&&d(c.pop()),{addPt:d,raw:c,filtered:s}}},{"../constants/numerical":479,"./matrix":509}],516:[function(t,o,f){(function(r){(function(){var a=t("./show_no_webgl_msg"),l=t("regl");o.exports=function(c,i,s){var u=c._fullLayout,h=!0;return u._glcanvas.each(function(d){if(d.regl)d.regl.preloadCachedCode(s);else if(!d.pick||u._has("parcoords")){try{d.regl=l({canvas:this,attributes:{antialias:!d.pick,preserveDrawingBuffer:!0},pixelRatio:c._context.plotGlPixelRatio||r.devicePixelRatio,extensions:i||[],cachedCode:s||{}})}catch{h=!1}d.regl||(h=!1),h&&this.addEventListener("webglcontextlost",function(m){c&&c.emit&&c.emit("plotly_webglcontextlost",{event:m,layer:d.key})},!1)}}),h||a({container:u._glcontainer.node()}),h}}).call(this)}).call(this,typeof jo<"u"?jo:typeof self<"u"?self:typeof window<"u"?window:{})},{"./show_no_webgl_msg":525,regl:283}],517:[function(t,o,f){var r=t("fast-isnumeric"),a=t("is-mobile");o.exports=function(l){var c;if(typeof(c=l&&l.hasOwnProperty("userAgent")?l.userAgent:function(){var p;return typeof navigator<"u"&&(p=navigator.userAgent),p&&p.headers&&typeof p.headers["user-agent"]=="string"&&(p=p.headers["user-agent"]),p}())!="string")return!0;var i=a({ua:{headers:{"user-agent":c}},tablet:!0,featureDetect:!1});if(!i){for(var s=c.split(" "),u=1;u-1;h--){var d=s[h];if(d.substr(0,8)==="Version/"){var m=d.substr(8).split(".")[0];if(r(m)&&(m=+m),m>=13)return!0}}}return i}},{"fast-isnumeric":190,"is-mobile":234}],518:[function(t,o,f){o.exports=function(r,a){if(a instanceof RegExp){for(var l=a.toString(),c=0;ca.queueLength&&(c.undoQueue.queue.shift(),c.undoQueue.index--))},startSequence:function(c){c.undoQueue=c.undoQueue||{index:0,queue:[],sequence:!1},c.undoQueue.sequence=!0,c.undoQueue.beginSequence=!0},stopSequence:function(c){c.undoQueue=c.undoQueue||{index:0,queue:[],sequence:!1},c.undoQueue.sequence=!1,c.undoQueue.beginSequence=!1},undo:function(c){var i,s;if(!(c.undoQueue===void 0||isNaN(c.undoQueue.index)||c.undoQueue.index<=0)){for(c.undoQueue.index--,i=c.undoQueue.queue[c.undoQueue.index],c.undoQueue.inSequence=!0,s=0;s=c.undoQueue.queue.length)){for(i=c.undoQueue.queue[c.undoQueue.index],c.undoQueue.inSequence=!0,s=0;sm}function h(d,m){return d>=m}f.findBin=function(d,m,p){if(r(m.start))return p?Math.ceil((d-m.start)/m.size-1e-9)-1:Math.floor((d-m.start)/m.size+1e-9);var g,y,v=0,x=m.length,_=0,A=x>1?(m[x-1]-m[0])/(x-1):1;for(y=A>=0?p?i:s:p?h:u,d+=1e-9*A*(p?-1:1)*(A>=0?1:-1);v90&&a.log("Long binary search..."),v-1},f.sorterAsc=function(d,m){return d-m},f.sorterDes=function(d,m){return m-d},f.distinctVals=function(d){var m,p=d.slice();for(p.sort(f.sorterAsc),m=p.length-1;m>-1&&p[m]===c;m--);for(var g,y=p[m]-p[0]||1,v=y/(m||1)/1e4,x=[],_=0;_<=m;_++){var A=p[_],b=A-g;g===void 0?(x.push(A),g=A):b>v&&(y=Math.min(y,b),x.push(A),g=A)}return{vals:x,minDiff:y}},f.roundUp=function(d,m,p){for(var g,y=0,v=m.length-1,x=0,_=p?0:1,A=p?1:0,b=p?Math.ceil:Math.floor;y0&&(g=1),p&&g)return d.sort(m)}return g?d:d.reverse()},f.findIndexOfMin=function(d,m){m=m||l;for(var p,g=1/0,y=0;yi.length)&&(s=i.length),r(c)||(c=!1),a(i[0])){for(h=new Array(s),u=0;ul.length-1)return l[l.length-1];var i=c%1;return i*l[Math.ceil(c)]+(1-i)*l[Math.floor(c)]}},{"./array":485,"fast-isnumeric":190}],528:[function(t,o,f){var r=t("color-normalize");o.exports=function(a){return a?r(a):[0,0,0,1]}},{"color-normalize":89}],529:[function(t,o,f){var r=t("@plotly/d3"),a=t("../lib"),l=a.strTranslate,c=t("../constants/xmlns_namespaces"),i=t("../constants/alignment").LINE_SPACING,s=/([^$]*)([$]+[^$]*[$]+)([^$]*)/;f.convertToTspans=function(D,O,N){var B=D.text(),W=!D.attr("data-notex")&&O&&O._context.typesetMath&&typeof MathJax<"u"&&B.match(s),G=r.select(D.node().parentNode);if(!G.empty()){var K=D.attr("class")?D.attr("class").split(" ")[0]:"text";return K+="-math",G.selectAll("svg."+K).remove(),G.selectAll("g."+K+"-group").remove(),D.style("display",null).attr({"data-unformatted":B,"data-math":"N"}),W?(O&&O._promises||[]).push(new Promise(function(Y){D.style("display","none");var J=parseInt(D.node().style.fontSize,10),re={fontSize:J};(function(U,V,H){var ne,q,Q,ee,ie=parseInt((MathJax.version||"").split(".")[0]);if(ie!==2&&ie!==3)return void a.warn("No MathJax version:",MathJax.version);var ae=function(){var le="math-output-"+a.randstr({},64),ge=(ee=r.select("body").append("div").attr({id:le}).style({visibility:"hidden",position:"absolute","font-size":V.fontSize+"px"}).text(U.replace(u,"\\lt ").replace(h,"\\gt "))).node();return ie===2?MathJax.Hub.Typeset(ge):MathJax.typeset([ge])},ue=function(){var le=ee.select(ie===2?".MathJax_SVG":".MathJax"),ge=!le.empty()&&ee.select("svg").node();if(ge){var fe,me=ge.getBoundingClientRect();fe=ie===2?r.select("body").select("#MathJax_SVG_glyphs"):le.select("defs"),H(le,fe,me)}else a.log("There was an error in the tex syntax.",U),H();ee.remove()};ie===2?MathJax.Hub.Queue(function(){return q=a.extendDeepAll({},MathJax.Hub.config),Q=MathJax.Hub.processSectionDelay,MathJax.Hub.processSectionDelay!==void 0&&(MathJax.Hub.processSectionDelay=0),MathJax.Hub.Config({messageStyle:"none",tex2jax:{inlineMath:d},displayAlign:"left"})},function(){if((ne=MathJax.Hub.config.menuSettings.renderer)!=="SVG")return MathJax.Hub.setRenderer("SVG")},ae,ue,function(){if(ne!=="SVG")return MathJax.Hub.setRenderer(ne)},function(){return Q!==void 0&&(MathJax.Hub.processSectionDelay=Q),MathJax.Hub.Config(q)}):ie===3&&(q=a.extendDeepAll({},MathJax.config),MathJax.config.tex||(MathJax.config.tex={}),MathJax.config.tex.inlineMath=d,(ne=MathJax.config.startup.output)!=="svg"&&(MathJax.config.startup.output="svg"),MathJax.startup.defaultReady(),MathJax.startup.promise.then(function(){ae(),ue(),ne!=="svg"&&(MathJax.config.startup.output=ne),MathJax.config=q}))})(W[2],re,function(U,V,H){G.selectAll("svg."+K).remove(),G.selectAll("g."+K+"-group").remove();var ne=U&&U.select("svg");if(!ne||!ne.node())return te(),void Y();var q=G.append("g").classed(K+"-group",!0).attr({"pointer-events":"none","data-unformatted":B,"data-math":"Y"});q.node().appendChild(ne.node()),V&&V.node()&&ne.node().insertBefore(V.node().cloneNode(!0),ne.node().firstChild);var Q=H.width,ee=H.height;ne.attr({class:K,height:ee,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var ie=D.node().style.fill||"black",ae=ne.select("g");ae.attr({fill:ie,stroke:ie});var ue=ae.node().getBoundingClientRect(),le=ue.width,ge=ue.height;(le>Q||ge>ee)&&(ne.style("overflow","hidden"),le=(ue=ne.node().getBoundingClientRect()).width,ge=ue.height);var fe=+D.attr("x"),me=+D.attr("y"),_e=-(J||D.node().getBoundingClientRect().height)/4;if(K[0]==="y")q.attr({transform:"rotate("+[-90,fe,me]+")"+l(-le/2,_e-ge/2)});else if(K[0]==="l")me=_e-ge/2;else if(K[0]==="a"&&K.indexOf("atitle")!==0)fe=0,me=_e;else{var Ae=D.attr("text-anchor");fe-=le*(Ae==="middle"?.5:Ae==="end"?1:0),me=me+_e-ge/2}ne.attr({x:fe,y:me}),N&&N.call(D,q),Y(q)})})):te(),D}function te(){G.empty()||(K=D.attr("class")+"-math",G.select("svg."+K).remove()),D.text("").style("white-space","pre"),function(Y,J){J=J.replace(v," ");var re,U=!1,V=[],H=-1;function ne(){H++;var de=document.createElementNS(c.svg,"tspan");r.select(de).attr({class:"line",dy:H*i+"em"}),Y.appendChild(de),re=de;var ve=V;if(V=[{node:de}],ve.length>1)for(var Me=1;Me doesnt match end tag <"+de+">. Pretending it did match.",J),re=V[V.length-1].node}else a.log("Ignoring unexpected end tag .",J)}A.test(J)?ne():(re=Y,V=[{node:Y}]);for(var ie=J.split(x),ae=0;ae|>|>)/g,d=[["$","$"],["\\(","\\)"]],m={sup:"font-size:70%",sub:"font-size:70%",b:"font-weight:bold",i:"font-style:italic",a:"cursor:pointer",span:"",em:"font-style:italic;font-weight:bold"},p={sub:"0.3em",sup:"-0.6em"},g={sub:"-0.21em",sup:"0.42em"},y=["http:","https:","mailto:","",void 0,":"],v=f.NEWLINES=/(\r\n?|\n)/g,x=/(<[^<>]*>)/,_=/<(\/?)([^ >]*)(\s+(.*))?>/i,A=//i;f.BR_TAG_ALL=//gi;var b=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,k=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,w=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,M=/(^|[\s"'])popup\s*=\s*("([\w=,]*)"|'([\w=,]*)')/i;function T(D,O){if(!D)return null;var N=D.match(O),B=N&&(N[3]||N[4]);return B&&L(B)}var E=/(^|;)\s*color:/;f.plainText=function(D,O){for(var N=(O=O||{}).len!==void 0&&O.len!==-1?O.len:1/0,B=O.allowedTags!==void 0?O.allowedTags:["br"],W=3,G=D.split(x),K=[],te="",Y=0,J=0;JW?K.push(re.substr(0,ne-W)+"..."):K.push(re.substr(0,ne));break}te=""}}return K.join("")};var S={mu:"μ",amp:"&",lt:"<",gt:">",nbsp:" ",times:"×",plusmn:"±",deg:"°"},P=/&(#\d+|#x[\da-fA-F]+|[a-z]+);/g;function L(D){return D.replace(P,function(O,N){return(N.charAt(0)==="#"?function(B){if(!(B>1114111)){var W=String.fromCodePoint;if(W)return W(B);var G=String.fromCharCode;return B<=65535?G(B):G(55232+(B>>10),B%1024+56320)}}(N.charAt(1)==="x"?parseInt(N.substr(2),16):parseInt(N.substr(1),10)):S[N])||O})}function R(D){var O=encodeURI(decodeURI(D)),N=document.createElement("a"),B=document.createElement("a");N.href=D,B.href=O;var W=N.protocol,G=B.protocol;return y.indexOf(W)!==-1&&y.indexOf(G)!==-1?O:""}function F(D,O,N){var B,W,G,K=N.horizontalAlign,te=N.verticalAlign||"top",Y=D.node().getBoundingClientRect(),J=O.node().getBoundingClientRect();return W=te==="bottom"?function(){return Y.bottom-B.height}:te==="middle"?function(){return Y.top+(Y.height-B.height)/2}:function(){return Y.top},G=K==="right"?function(){return Y.right-B.width}:K==="center"?function(){return Y.left+(Y.width-B.width)/2}:function(){return Y.left},function(){B=this.node().getBoundingClientRect();var re=G()-J.left,U=W()-J.top,V=N.gd||{};if(N.gd){V._fullLayout._calcInverseTransform(V);var H=a.apply3DTransform(V._fullLayout._invTransform)(re,U);re=H[0],U=H[1]}return this.style({top:U+"px",left:re+"px","z-index":1e3}),this}}f.convertEntities=L,f.sanitizeHTML=function(D){D=D.replace(v," ");for(var O=document.createElement("p"),N=O,B=[],W=D.split(x),G=0;Gs.ts+c?d():s.timer=setTimeout(function(){d(),s.timer=null},c)},f.done=function(l){var c=r[l];return c&&c.timer?new Promise(function(i){var s=c.onDone;c.onDone=function(){s&&s(),i(),c.onDone=null}}):Promise.resolve()},f.clear=function(l){if(l)a(r[l]),delete r[l];else for(var c in r)f.clear(c)}},{}],531:[function(t,o,f){var r=t("fast-isnumeric");o.exports=function(a,l){if(a>0)return Math.log(a)/Math.LN10;var c=Math.log(Math.min(l[0],l[1]))/Math.LN10;return r(c)||(c=Math.log(Math.max(l[0],l[1]))/Math.LN10-6),c}},{"fast-isnumeric":190}],532:[function(t,o,f){var r=o.exports={},a=t("../plots/geo/constants").locationmodeToLayer,l=t("topojson-client").feature;r.getTopojsonName=function(c){return[c.scope.replace(/ /g,"-"),"_",c.resolution.toString(),"m"].join("")},r.getTopojsonPath=function(c,i){return c+i+".json"},r.getTopojsonFeatures=function(c,i){var s=a[c.locationmode],u=i.objects[s];return l(i,u).features}},{"../plots/geo/constants":587,"topojson-client":315}],533:[function(t,o,f){o.exports={moduleType:"locale",name:"en-US",dictionary:{"Click to enter Colorscale title":"Click to enter Colorscale title"},format:{date:"%m/%d/%Y"}}},{}],534:[function(t,o,f){o.exports={moduleType:"locale",name:"en",dictionary:{"Click to enter Colorscale title":"Click to enter Colourscale title"},format:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],periods:["AM","PM"],dateTime:"%a %b %e %X %Y",date:"%d/%m/%Y",time:"%H:%M:%S",decimal:".",thousands:",",grouping:[3],currency:["$",""],year:"%Y",month:"%b %Y",dayMonth:"%b %-d",dayMonthYear:"%b %-d, %Y"}}},{}],535:[function(t,o,f){var r=t("../registry");o.exports=function(a){for(var l,c,i=r.layoutArrayContainers,s=r.layoutArrayRegexes,u=a.split("[")[0],h=0;h0&&c.log("Clearing previous rejected promises from queue."),w._promises=[]},f.cleanLayout=function(w){var M,T;w||(w={}),w.xaxis1&&(w.xaxis||(w.xaxis=w.xaxis1),delete w.xaxis1),w.yaxis1&&(w.yaxis||(w.yaxis=w.yaxis1),delete w.yaxis1),w.scene1&&(w.scene||(w.scene=w.scene1),delete w.scene1);var E=(i.subplotsRegistry.cartesian||{}).attrRegex,S=(i.subplotsRegistry.polar||{}).attrRegex,P=(i.subplotsRegistry.ternary||{}).attrRegex,L=(i.subplotsRegistry.gl3d||{}).attrRegex,R=Object.keys(w);for(M=0;M3?(q.x=1.02,q.xanchor="left"):q.x<-2&&(q.x=-.02,q.xanchor="right"),q.y>3?(q.y=1.02,q.yanchor="bottom"):q.y<-2&&(q.y=-.02,q.yanchor="top")),g(w),w.dragmode==="rotate"&&(w.dragmode="orbit"),u.clean(w),w.template&&w.template.layout&&f.cleanLayout(w.template.layout),w},f.cleanData=function(w){for(var M=0;M0)return w.substr(0,M)}f.hasParent=function(w,M){for(var T=b(M);T;){if(T in w)return!0;T=b(T)}return!1};var k=["x","y","z"];f.clearAxisTypes=function(w,M,T){for(var E=0;E1&&l.warn("Full array edits are incompatible with other edits",y);var w=m[""][""];if(u(w))d.set(null);else{if(!Array.isArray(w))return l.warn("Unrecognized full array edit value",y,w),!0;d.set(w)}return!A&&(v(b,k),x(h),!0)}var M,T,E,S,P,L,R,F,D=Object.keys(m).map(Number).sort(c),O=d.get(),N=O||[],B=g(k,y).get(),W=[],G=-1,K=N.length;for(M=0;MN.length-(R?0:1))l.warn("index out of range",y,E);else if(L!==void 0)P.length>1&&l.warn("Insertion & removal are incompatible with edits to the same index.",y,E),u(L)?W.push(E):R?(L==="add"&&(L={}),N.splice(E,0,L),B&&B.splice(E,0,{})):l.warn("Unrecognized full object edit value",y,E,L),G===-1&&(G=E);else for(T=0;T=0;M--)N.splice(W[M],1),B&&B.splice(W[M],1);if(N.length?O||d.set(N):d.set(null),A)return!1;if(v(b,k),_!==a){var te;if(G===-1)te=D;else{for(K=Math.max(N.length,K),te=[],M=0;M=G);M++)te.push(E);for(M=G;M=de.data.length||Ce<-de.data.length)throw new Error(Me+" must be valid indices for gd.data.");if(ve.indexOf(Ce,we+1)>-1||Ce>=0&&ve.indexOf(-de.data.length+Ce)>-1||Ce<0&&ve.indexOf(de.data.length+Ce)>-1)throw new Error("each index in "+Me+" must be unique.")}}function O(de,ve,Me){if(!Array.isArray(de.data))throw new Error("gd.data must be an array.");if(ve===void 0)throw new Error("currentIndices is a required argument.");if(Array.isArray(ve)||(ve=[ve]),D(de,ve,"currentIndices"),Me===void 0||Array.isArray(Me)||(Me=[Me]),Me!==void 0&&D(de,Me,"newIndices"),Me!==void 0&&ve.length!==Me.length)throw new Error("current and new indices must be of equal length.")}function N(de,ve,Me,we,Ce){(function(Ye,nt,ft,yt){var Ot=c.isPlainObject(yt);if(!Array.isArray(Ye.data))throw new Error("gd.data must be an array");if(!c.isPlainObject(nt))throw new Error("update must be a key:value object");if(ft===void 0)throw new Error("indices must be an integer or array of integers");for(var Tt in D(Ye,ft,"indices"),nt){if(!Array.isArray(nt[Tt])||nt[Tt].length!==ft.length)throw new Error("attribute "+Tt+" must be an array of length equal to indices array length");if(Ot&&(!(Tt in yt)||!Array.isArray(yt[Tt])||yt[Tt].length!==nt[Tt].length))throw new Error("when maxPoints is set as a key:value object it must contain a 1:1 corrispondence with the keys and number of traces in the update object")}})(de,ve,Me,we);for(var Fe=function(Ye,nt,ft,yt){var Ot,Tt,at,et,Lt,Wt=c.isPlainObject(yt),Jt=[];for(var Be in Array.isArray(ft)||(ft=[ft]),ft=F(ft,Ye.data.length-1),nt)for(var Ge=0;Ge-1&&Me.indexOf("grouptitlefont")===-1?$e(Me,Me.replace("titlefont","title.font")):Me.indexOf("titleposition")>-1?$e(Me,Me.replace("titleposition","title.position")):Me.indexOf("titleside")>-1?$e(Me,Me.replace("titleside","title.side")):Me.indexOf("titleoffset")>-1&&$e(Me,Me.replace("titleoffset","title.offset")):$e(Me,Me.replace("title","title.text"));function $e(Ke,Re){de[Re]=de[Ke],delete de[Ke]}}function re(de,ve,Me){de=c.getGraphDiv(de),k.clearPromiseQueue(de);var we={};if(typeof ve=="string")we[ve]=Me;else{if(!c.isPlainObject(ve))return c.warn("Relayout fail.",ve,Me),Promise.reject();we=c.extendFlat({},ve)}Object.keys(we).length&&(de.changed=!0);var Ce=Q(de,we),Fe=Ce.flags;Fe.calc&&(de.calcdata=void 0);var ze=[m.previousPromises];Fe.layoutReplot?ze.push(w.layoutReplot):Object.keys(we).length&&(U(de,Fe,Ce)||m.supplyDefaults(de),Fe.legend&&ze.push(w.doLegend),Fe.layoutstyle&&ze.push(w.layoutStyles),Fe.axrange&&V(ze,Ce.rangesAltered),Fe.ticks&&ze.push(w.doTicksRelayout),Fe.modebar&&ze.push(w.doModeBar),Fe.camera&&ze.push(w.doCamera),Fe.colorbars&&ze.push(w.doColorBars),ze.push(S)),ze.push(m.rehover,m.redrag),u.add(de,re,[de,Ce.undoit],re,[de,Ce.redoit]);var $e=c.syncOrAsync(ze,de);return $e&&$e.then||($e=Promise.resolve(de)),$e.then(function(){return de.emit("plotly_relayout",Ce.eventData),de})}function U(de,ve,Me){var we=de._fullLayout;if(!ve.axrange)return!1;for(var Ce in ve)if(Ce!=="axrange"&&ve[Ce])return!1;for(var Fe in Me.rangesAltered){var ze=p.id2name(Fe),$e=de.layout[ze],Ke=we[ze];if(Ke.autorange=$e.autorange,$e.range&&(Ke.range=$e.range.slice()),Ke.cleanRange(),Ke._matchGroup){for(var Re in Ke._matchGroup)if(Re!==Fe){var Ve=we[p.id2name(Re)];Ve.autorange=Ke.autorange,Ve.range=Ke.range.slice(),Ve._input.range=Ke.range.slice()}}}return!0}function V(de,ve){var Me=ve?function(we){var Ce=[],Fe=!0;for(var ze in ve){var $e=p.getFromId(we,ze);if(Ce.push(ze),($e.ticklabelposition||"").indexOf("inside")!==-1&&$e._anchorAxis&&Ce.push($e._anchorAxis._id),$e._matchGroup)for(var Ke in $e._matchGroup)ve[Ke]||Ce.push(Ke);$e.automargin&&(Fe=!1)}return p.draw(we,Ce,{skipTitle:Fe})}:function(we){return p.draw(we,"redraw")};de.push(_,w.doAutoRangeAndConstraints,Me,w.drawData,w.finalDraw)}var H=/^[xyz]axis[0-9]*\.range(\[[0|1]\])?$/,ne=/^[xyz]axis[0-9]*\.autorange$/,q=/^[xyz]axis[0-9]*\.domain(\[[0|1]\])?$/;function Q(de,ve){var Me,we,Ce,Fe=de.layout,ze=de._fullLayout,$e=ze._guiEditing,Ke=K(ze._preGUI,$e),Re=Object.keys(ve),Ve=p.list(de),We=c.extendDeepAll({},ve),Ye={};for(J(ve),Re=Object.keys(ve),we=0;we0&&typeof Ge.parts[dt]!="string";)dt--;var Oe=Ge.parts[dt],Ie=Ge.parts[dt-1]+"."+Oe,Te=Ge.parts.slice(0,dt).join("."),Pe=i(de.layout,Te).get(),qe=i(ze,Te).get(),rt=Ge.get();if(kt!==void 0){Tt[Be]=kt,at[Be]=Oe==="reverse"?kt:G(rt);var lt=d.getLayoutValObject(ze,Ge.parts);if(lt&<.impliedEdits&&kt!==null)for(var ot in lt.impliedEdits)et(c.relativeAttr(Be,ot),lt.impliedEdits[ot]);if(["width","height"].indexOf(Be)!==-1)if(kt){et("autosize",null);var At=Be==="height"?"width":"height";et(At,ze[At])}else ze[Be]=de._initialAutoSize[Be];else if(Be==="autosize")et("width",kt?null:ze.width),et("height",kt?null:ze.height);else if(Ie.match(H))Jt(Ie),i(ze,Te+"._inputRange").set(null);else if(Ie.match(ne)){Jt(Ie),i(ze,Te+"._inputRange").set(null);var wt=i(ze,Te).get();wt._inputDomain&&(wt._input.domain=wt._inputDomain.slice())}else Ie.match(q)&&i(ze,Te+"._inputDomain").set(null);if(Oe==="type"){Lt=Pe;var $t=qe.type==="linear"&&kt==="log",Ut=qe.type==="log"&&kt==="linear";if($t||Ut){if(Lt&&Lt.range)if(qe.autorange)$t&&(Lt.range=Lt.range[1]>Lt.range[0]?[1,2]:[2,1]);else{var tt=Lt.range[0],bt=Lt.range[1];$t?(tt<=0&&bt<=0&&et(Te+".autorange",!0),tt<=0?tt=bt/1e6:bt<=0&&(bt=tt/1e6),et(Te+".range[0]",Math.log(tt)/Math.LN10),et(Te+".range[1]",Math.log(bt)/Math.LN10)):(et(Te+".range[0]",Math.pow(10,tt)),et(Te+".range[1]",Math.pow(10,bt)))}else et(Te+".autorange",!0);Array.isArray(ze._subplots.polar)&&ze._subplots.polar.length&&ze[Ge.parts[0]]&&Ge.parts[1]==="radialaxis"&&delete ze[Ge.parts[0]]._subplot.viewInitial["radialaxis.range"],h.getComponentMethod("annotations","convertCoords")(de,qe,kt,et),h.getComponentMethod("images","convertCoords")(de,qe,kt,et)}else et(Te+".autorange",!0),et(Te+".range",null);i(ze,Te+"._inputRange").set(null)}else if(Oe.match(T)){var Ft=i(ze,Be).get(),Et=(kt||{}).type;Et&&Et!=="-"||(Et="linear"),h.getComponentMethod("annotations","convertCoords")(de,Ft,Et,et),h.getComponentMethod("images","convertCoords")(de,Ft,Et,et)}var Pt=b.containerArrayMatch(Be);if(Pt){Me=Pt.array,we=Pt.index;var De=Pt.property,Je=lt||{editType:"calc"};we!==""&&De===""&&(b.isAddVal(kt)?at[Be]=null:b.isRemoveVal(kt)?at[Be]=(i(Fe,Me).get()||[])[we]:c.warn("unrecognized full object value",ve)),M.update(Ot,Je),Ye[Me]||(Ye[Me]={});var st=Ye[Me][we];st||(st=Ye[Me][we]={}),st[De]=kt,delete ve[Be]}else Oe==="reverse"?(Pe.range?Pe.range.reverse():(et(Te+".autorange",!0),Pe.range=[1,0]),qe.autorange?Ot.calc=!0:Ot.plot=!0):(ze._has("scatter-like")&&ze._has("regl")&&Be==="dragmode"&&(kt==="lasso"||kt==="select")&&rt!=="lasso"&&rt!=="select"||ze._has("gl2d")?Ot.plot=!0:lt?M.update(Ot,lt):Ot.calc=!0,Ge.set(kt))}}for(Me in Ye)b.applyContainerArrayChanges(de,Ke(Fe,Me),Ye[Me],Ot,Ke)||(Ot.plot=!0);for(var St in Wt){var It=(Lt=p.getFromId(de,St))&&Lt._constraintGroup;if(It)for(var Zt in Ot.calc=!0,It)Wt[Zt]||(p.getFromId(de,Zt)._constraintShrinkable=!0)}return(ee(de)||ve.height||ve.width)&&(Ot.plot=!0),(Ot.plot||Ot.calc)&&(Ot.layoutReplot=!0),{flags:Ot,rangesAltered:Wt,undoit:at,redoit:Tt,eventData:We}}function ee(de){var ve=de._fullLayout,Me=ve.width,we=ve.height;return de.layout.autosize&&m.plotAutoSize(de,de.layout,ve),ve.width!==Me||ve.height!==we}function ie(de,ve,Me,we){de=c.getGraphDiv(de),k.clearPromiseQueue(de),c.isPlainObject(ve)||(ve={}),c.isPlainObject(Me)||(Me={}),Object.keys(ve).length&&(de.changed=!0),Object.keys(Me).length&&(de.changed=!0);var Ce=k.coerceTraceIndices(de,we),Fe=Y(de,c.extendFlat({},ve),Ce),ze=Fe.flags,$e=Q(de,c.extendFlat({},Me)),Ke=$e.flags;(ze.calc||Ke.calc)&&(de.calcdata=void 0),ze.clearAxisTypes&&k.clearAxisTypes(de,Ce,Me);var Re=[];Ke.layoutReplot?Re.push(w.layoutReplot):ze.fullReplot?Re.push(f._doPlot):(Re.push(m.previousPromises),U(de,Ke,$e)||m.supplyDefaults(de),ze.style&&Re.push(w.doTraceStyle),(ze.colorbars||Ke.colorbars)&&Re.push(w.doColorBars),Ke.legend&&Re.push(w.doLegend),Ke.layoutstyle&&Re.push(w.layoutStyles),Ke.axrange&&V(Re,$e.rangesAltered),Ke.ticks&&Re.push(w.doTicksRelayout),Ke.modebar&&Re.push(w.doModeBar),Ke.camera&&Re.push(w.doCamera),Re.push(S)),Re.push(m.rehover,m.redrag),u.add(de,ie,[de,Fe.undoit,$e.undoit,Fe.traces],ie,[de,Fe.redoit,$e.redoit,Fe.traces]);var Ve=c.syncOrAsync(Re,de);return Ve&&Ve.then||(Ve=Promise.resolve(de)),Ve.then(function(){return de.emit("plotly_update",{data:Fe.eventData,layout:$e.eventData}),de})}function ae(de){return function(ve){ve._fullLayout._guiEditing=!0;var Me=de.apply(null,arguments);return ve._fullLayout._guiEditing=!1,Me}}var ue=[{pattern:/^hiddenlabels/,attr:"legend.uirevision"},{pattern:/^((x|y)axis\d*)\.((auto)?range|title\.text)/},{pattern:/axis\d*\.showspikes$/,attr:"modebar.uirevision"},{pattern:/(hover|drag)mode$/,attr:"modebar.uirevision"},{pattern:/^(scene\d*)\.camera/},{pattern:/^(geo\d*)\.(projection|center|fitbounds)/},{pattern:/^(ternary\d*\.[abc]axis)\.(min|title\.text)$/},{pattern:/^(polar\d*\.radialaxis)\.((auto)?range|angle|title\.text)/},{pattern:/^(polar\d*\.angularaxis)\.rotation/},{pattern:/^(mapbox\d*)\.(center|zoom|bearing|pitch)/},{pattern:/^legend\.(x|y)$/,attr:"editrevision"},{pattern:/^(shapes|annotations)/,attr:"editrevision"},{pattern:/^title\.text$/,attr:"editrevision"}],le=[{pattern:/^selectedpoints$/,attr:"selectionrevision"},{pattern:/(^|value\.)visible$/,attr:"legend.uirevision"},{pattern:/^dimensions\[\d+\]\.constraintrange/},{pattern:/^node\.(x|y|groups)/},{pattern:/^level$/},{pattern:/(^|value\.)name$/},{pattern:/colorbar\.title\.text$/},{pattern:/colorbar\.(x|y)$/,attr:"editrevision"}];function ge(de,ve){for(var Me=0;Me1;)if(we.pop(),(Me=i(ve,we.join(".")+".uirevision").get())!==void 0)return Me;return ve.uirevision}function me(de,ve){for(var Me=0;Me=Ce.length?Ce[0]:Ce[Re]:Ce}function $e(Re){return Array.isArray(Fe)?Re>=Fe.length?Fe[0]:Fe[Re]:Fe}function Ke(Re,Ve){var We=0;return function(){if(Re&&++We===Ve)return Re()}}return we._frameWaitingCnt===void 0&&(we._frameWaitingCnt=0),new Promise(function(Re,Ve){function We(){we._currentFrame&&we._currentFrame.onComplete&&we._currentFrame.onComplete();var Ge=we._currentFrame=we._frameQueue.shift();if(Ge){var kt=Ge.name?Ge.name.toString():null;de._fullLayout._currentFrame=kt,we._lastFrameAt=Date.now(),we._timeToNext=Ge.frameOpts.duration,m.transition(de,Ge.frame.data,Ge.frame.layout,k.coerceTraceIndices(de,Ge.frame.traces),Ge.frameOpts,Ge.transitionOpts).then(function(){Ge.onComplete&&Ge.onComplete()}),de.emit("plotly_animatingframe",{name:kt,frame:Ge.frame,animation:{frame:Ge.frameOpts,transition:Ge.transitionOpts}})}else de.emit("plotly_animated"),window.cancelAnimationFrame(we._animationRaf),we._animationRaf=null}function Ye(){de.emit("plotly_animating"),we._lastFrameAt=-1/0,we._timeToNext=0,we._runningTransitions=0,we._currentFrame=null;var Ge=function(){we._animationRaf=window.requestAnimationFrame(Ge),Date.now()-we._lastFrameAt>we._timeToNext&&We()};Ge()}var nt,ft,yt=0;function Ot(Ge){return Array.isArray(Ce)?yt>=Ce.length?Ge.transitionOpts=Ce[yt]:Ge.transitionOpts=Ce[0]:Ge.transitionOpts=Ce,yt++,Ge}var Tt=[],at=ve==null,et=Array.isArray(ve);if(!at&&!et&&c.isPlainObject(ve))Tt.push({type:"object",data:Ot(c.extendFlat({},ve))});else if(at||["string","number"].indexOf(typeof ve)!==-1)for(nt=0;nt0&&JtJt)&&Be.push(ft);Tt=Be}}Tt.length>0?function(Ge){if(Ge.length!==0){for(var kt=0;kt=0;we--)if(c.isPlainObject(ve[we])){var Ye=ve[we].name,nt=(Ke[Ye]||We[Ye]||{}).name,ft=ve[we].name,yt=Ke[nt]||We[nt];nt&&ft&&typeof ft=="number"&&yt&&E<5&&(E++,c.warn('addFrames: overwriting frame "'+(Ke[nt]||We[nt]).name+'" with a frame whose name of type "number" also equates to "'+nt+'". This is valid but may potentially lead to unexpected behavior since all plotly.js frame names are stored internally as strings.'),E===5&&c.warn("addFrames: This API call has yielded too many of these warnings. For the rest of this call, further warnings about numeric frame names will be suppressed.")),We[Ye]={name:Ye},Ve.push({frame:m.supplyFrameDefaults(ve[we]),index:Me&&Me[we]!==void 0&&Me[we]!==null?Me[we]:Re+we})}Ve.sort(function(Be,Ge){return Be.index>Ge.index?-1:Be.index=0;we--){if(typeof(Ce=Ve[we].frame).name=="number"&&c.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!Ce.name)for(;Ke[Ce.name="frame "+de._transitionData._counter++];);if(Ke[Ce.name]){for(Fe=0;Fe<$e.length&&($e[Fe]||{}).name!==Ce.name;Fe++);Ot.push({type:"replace",index:Fe,value:Ce}),Tt.unshift({type:"replace",index:Fe,value:$e[Fe]})}else ze=Math.max(0,Math.min(Ve[we].index,at)),Ot.push({type:"insert",index:ze,value:Ce}),Tt.unshift({type:"delete",index:ze}),at++}var et=m.modifyFrames,Lt=m.modifyFrames,Wt=[de,Tt],Jt=[de,Ot];return u&&u.add(de,et,Wt,Lt,Jt),m.modifyFrames(de,Ot)},f.deleteFrames=function(de,ve){if(de=c.getGraphDiv(de),!c.isPlotDiv(de))throw new Error("This element is not a Plotly plot: "+de);var Me,we,Ce=de._transitionData._frames,Fe=[],ze=[];if(!ve)for(ve=[],Me=0;Me=0;Me--)we=ve[Me],Fe.push({type:"delete",index:we}),ze.unshift({type:"insert",index:we,value:Ce[we]});var $e=m.modifyFrames,Ke=m.modifyFrames,Re=[de,ze],Ve=[de,Fe];return u&&u.add(de,$e,Re,Ke,Ve),m.modifyFrames(de,Fe)},f.addTraces=function de(ve,Me,we){ve=c.getGraphDiv(ve);var Ce,Fe,ze=[],$e=f.deleteTraces,Ke=de,Re=[ve,ze],Ve=[ve,Me];for(function(We,Ye,nt){var ft,yt;if(!Array.isArray(We.data))throw new Error("gd.data must be an array.");if(Ye===void 0)throw new Error("traces must be defined.");for(Array.isArray(Ye)||(Ye=[Ye]),ft=0;ft=0&&We=0&&We=R.length)return!1;if(T.dimensions===2){if(S++,E.length===S)return T;var F=E[S];if(!_(F))return!1;T=R[L][F]}else T=R[L]}else T=R}}return T}function _(T){return T===Math.round(T)&&T>=0}function A(){var T,E,S={};for(T in d(S,c),r.subplotsRegistry)if((E=r.subplotsRegistry[T]).layoutAttributes)if(Array.isArray(E.attr))for(var P=0;P=F.length)return!1;P=(S=(r.transformsRegistry[F[D].type]||{}).attributes)&&S[E[2]],R=3}else{var O=T._module;if(O||(O=(r.modules[T.type||l.type.dflt]||{})._module),!O)return!1;if(!(P=(S=O.attributes)&&S[L])){var N=O.basePlotModule;N&&N.attributes&&(P=N.attributes[L])}P||(P=l[L])}return x(P,E,R)},f.getLayoutValObject=function(T,E){return x(function(S,P){var L,R,F,D,O=S._basePlotModules;if(O){var N;for(L=0;L=d&&(h._input||{})._templateitemname;p&&(m=d);var g,y=u+"["+m+"]";function v(){g={},p&&(g[y]={},g[y].templateitemname=p)}function x(A,b){p?r.nestedProperty(g[y],A).set(b):g[y+"."+A]=b}function _(){var A=g;return v(),A}return v(),{modifyBase:function(A,b){g[A]=b},modifyItem:x,getUpdateObj:_,applyUpdate:function(A,b){A&&x(A,b);var k=_();for(var w in k)r.nestedProperty(s,w).set(k[w])}}}},{"../lib":503,"../plots/attributes":550}],544:[function(t,o,f){var r=t("@plotly/d3"),a=t("../registry"),l=t("../plots/plots"),c=t("../lib"),i=t("../lib/clear_gl_canvases"),s=t("../components/color"),u=t("../components/drawing"),h=t("../components/titles"),d=t("../components/modebar"),m=t("../plots/cartesian/axes"),p=t("../constants/alignment"),g=t("../plots/cartesian/constraints"),y=g.enforce,v=g.clean,x=t("../plots/cartesian/autorange").doAutoRange;function _(E,S,P){for(var L=0;L=E[1]||R[1]<=E[0])&&F[0]S[0])return!0}return!1}function A(E){var S,P,L,R,F,D,O=E._fullLayout,N=O._size,B=N.p,W=m.list(E,"",!0);if(O._paperdiv.style({width:E._context.responsive&&O.autosize&&!E._context._hasZeroWidth&&!E.layout.width?"100%":O.width+"px",height:E._context.responsive&&O.autosize&&!E._context._hasZeroHeight&&!E.layout.height?"100%":O.height+"px"}).selectAll(".main-svg").call(u.setSize,O.width,O.height),E._context.setBackground(E,O.paper_bgcolor),f.drawMainTitle(E),d.manage(E),!O._has("cartesian"))return l.previousPromises(E);function G(Ye,nt,ft){var yt=Ye._lw/2;return Ye._id.charAt(0)==="x"?nt?ft==="top"?nt._offset-B-yt:nt._offset+nt._length+B+yt:N.t+N.h*(1-(Ye.position||0))+yt%1:nt?ft==="right"?nt._offset+nt._length+B+yt:nt._offset-B-yt:N.l+N.w*(Ye.position||0)+yt%1}for(S=0;SN?T.push({code:"unused",traceType:L,templateCount:O,dataCount:N}):N>O&&T.push({code:"reused",traceType:L,templateCount:O,dataCount:N})}}else T.push({code:"data"});if(function B(W,G){for(var K in W)if(K.charAt(0)!=="_"){var te=W[K],Y=y(W,K,G);a(te)?(Array.isArray(W)&&te._template===!1&&te.templateitemname&&T.push({code:"missing",path:Y,templateitemname:te.templateitemname}),B(te,Y)):Array.isArray(te)&&v(te)&&B(te,Y)}}({data:S,layout:E},""),T.length)return T.map(x)}},{"../lib":503,"../plots/attributes":550,"../plots/plots":619,"./plot_config":541,"./plot_schema":542,"./plot_template":543}],546:[function(t,o,f){var r=t("fast-isnumeric"),a=t("./plot_api"),l=t("../plots/plots"),c=t("../lib"),i=t("../snapshot/helpers"),s=t("../snapshot/tosvg"),u=t("../snapshot/svgtoimg"),h=t("../version").version,d={format:{valType:"enumerated",values:["png","jpeg","webp","svg","full-json"],dflt:"png"},width:{valType:"number",min:1},height:{valType:"number",min:1},scale:{valType:"number",min:0,dflt:1},setBackground:{valType:"any",dflt:!1},imageDataOnly:{valType:"boolean",dflt:!1}};o.exports=function(m,p){var g,y,v,x;function _(N){return!(N in p)||c.validate(p[N],d[N])}if(p=p||{},c.isPlainObject(m)?(g=m.data||[],y=m.layout||{},v=m.config||{},x={}):(m=c.getGraphDiv(m),g=c.extendDeep([],m.data),y=c.extendDeep({},m.layout),v=m._context,x=m._fullLayout||{}),!_("width")&&p.width!==null||!_("height")&&p.height!==null)throw new Error("Height and width should be pixel values.");if(!_("format"))throw new Error("Export format is not "+c.join2(d.format.values,", "," or ")+".");var A={};function b(N,B){return c.coerce(p,A,d,N,B)}var k=b("format"),w=b("width"),M=b("height"),T=b("scale"),E=b("setBackground"),S=b("imageDataOnly"),P=document.createElement("div");P.style.position="absolute",P.style.left="-5000px",document.body.appendChild(P);var L=c.extendFlat({},y);w?L.width=w:p.width===null&&r(x.width)&&(L.width=x.width),M?L.height=M:p.height===null&&r(x.height)&&(L.height=x.height);var R=c.extendFlat({},v,{_exportedPlot:!0,staticPlot:!0,setBackground:E}),F=i.getRedrawFunc(P);function D(){return new Promise(function(N){setTimeout(N,i.getDelay(P._fullLayout))})}function O(){return new Promise(function(N,B){var W=s(P,k,T),G=P._fullLayout.width,K=P._fullLayout.height;function te(){a.purge(P),document.body.removeChild(P)}if(k==="full-json"){var Y=l.graphJson(P,!1,"keepdata","object",!0,!0);return Y.version=h,Y=JSON.stringify(Y),te(),N(S?Y:i.encodeJSON(Y))}if(te(),k==="svg")return N(S?W:i.encodeSVG(W));var J=document.createElement("canvas");J.id=c.randstr(),u({format:k,width:G,height:K,scale:T,canvas:J,svg:W,promise:!0}).then(N).catch(B)})}return new Promise(function(N,B){a.newPlot(P,g,L,R).then(F).then(D).then(O).then(function(W){N(function(G){return S?G.replace(i.IMAGE_URL_PREFIX,""):G}(W))}).catch(function(W){B(W)})})}},{"../lib":503,"../plots/plots":619,"../snapshot/helpers":642,"../snapshot/svgtoimg":644,"../snapshot/tosvg":646,"../version":1123,"./plot_api":540,"fast-isnumeric":190}],547:[function(t,o,f){var r=t("../lib"),a=t("../plots/plots"),l=t("./plot_schema"),c=t("./plot_config").dfltConfig,i=r.isPlainObject,s=Array.isArray,u=r.isArrayOrTypedArray;function h(A,b,k,w,M,T){T=T||[];for(var E=Object.keys(A),S=0;SF.length&&w.push(g("unused",M,L.concat(F.length)));var G,K,te,Y,J,re=F.length,U=Array.isArray(W);if(U&&(re=Math.min(re,W.length)),D.dimensions===2)for(K=0;KF[K].length&&w.push(g("unused",M,L.concat(K,F[K].length)));var V=F[K].length;for(G=0;G<(U?Math.min(V,W[K].length):V);G++)te=U?W[K][G]:W,Y=R[K][G],J=F[K][G],r.validate(Y,te)?J!==Y&&J!==+Y&&w.push(g("dynamic",M,L.concat(K,G),Y,J)):w.push(g("value",M,L.concat(K,G),Y))}else w.push(g("array",M,L.concat(K),R[K]));else for(K=0;K1&&T.push(g("object","layout"))),a.supplyDefaults(E);for(var S=E._fullData,P=k.length,L=0;L0&&Math.round(y)===y))return{vals:d};p=y}for(var v=u.calendar,x=m==="start",_=m==="end",A=s[h+"period0"],b=l(A,v)||0,k=[],w=[],M=[],T=d.length,E=0;ER;)L=c(L,-p,v);for(;L<=R;)L=c(L,p,v);P=c(L,-p,v)}else{for(L=b+(S=Math.round((R-b)/g))*g;L>R;)L-=g;for(;L<=R;)L+=g;P=L-g}k[E]=x?P:_?L:(P+L)/2,w[E]=P,M[E]=L}return{vals:k,starts:w,ends:M}}},{"../../constants/numerical":479,"../../lib":503,"fast-isnumeric":190}],552:[function(t,o,f){o.exports={xaxis:{valType:"subplotid",dflt:"x",editType:"calc+clearAxisTypes"},yaxis:{valType:"subplotid",dflt:"y",editType:"calc+clearAxisTypes"}}},{}],553:[function(t,o,f){var r=t("@plotly/d3"),a=t("fast-isnumeric"),l=t("../../lib"),c=t("../../constants/numerical").FP_SAFE,i=t("../../registry"),s=t("../../components/drawing"),u=t("./axis_ids"),h=u.getFromId,d=u.isLinked;function m(w,M){var T,E,S=[],P=w._fullLayout,L=g(P,M,0),R=g(P,M,1),F=y(w,M),D=F.min,O=F.max;if(D.length===0||O.length===0)return l.simpleMap(M.range,M.r2l);var N=D[0].val,B=O[0].val;for(T=1;T0&&((re=q-L(K)-R(te))>Q?U/re>ee&&(Y=K,J=te,ee=U/re):U/q>ee&&(Y={val:K.val,nopad:1},J={val:te.val,nopad:1},ee=U/q));if(N===B){var ie=N-1,ae=N+1;if(H)if(N===0)S=[0,1];else{var ue=(N>0?O:D).reduce(function(ge,fe){return Math.max(ge,R(fe))},0),le=N/(1-Math.min(.5,ue/q));S=N>0?[0,le]:[le,0]}else S=ne?[Math.max(0,ie),Math.max(1,ae)]:[ie,ae]}else H?(Y.val>=0&&(Y={val:0,nopad:1}),J.val<=0&&(J={val:0,nopad:1})):ne&&(Y.val-ee*L(Y)<0&&(Y={val:0,nopad:1}),J.val<=0&&(J={val:1,nopad:1})),ee=(J.val-Y.val-p(M,K.val,te.val))/(q-L(Y)-R(J)),S=[Y.val-ee*L(Y),J.val+ee*R(J)];return W&&S.reverse(),l.simpleMap(S,M.l2r||Number)}function p(w,M,T){var E=0;if(w.rangebreaks)for(var S=w.locateBreaks(M,T),P=0;P0?T.ppadplus:T.ppadminus)||T.ppad||0),H=U((w._m>0?T.ppadminus:T.ppadplus)||T.ppad||0),ne=U(T.vpadplus||T.vpad),q=U(T.vpadminus||T.vpad);if(!J){if(O=1/0,N=-1/0,Y)for(E=0;E0&&(O=S),S>N&&S-c&&(O=S),S>N&&S=ie;E--)ee(E);return{min:B,max:W,opts:T}},concatExtremes:y};function y(w,M,T){var E,S,P,L=M._id,R=w._fullData,F=w._fullLayout,D=[],O=[];function N(te,Y){for(E=0;E=T&&(D.extrapad||!L)){R=!1;break}S(M,D.val)&&D.pad<=T&&(L||!D.extrapad)&&(w.splice(F,1),F--)}if(R){var O=P&&M===0;w.push({val:M,pad:O?0:T,extrapad:!O&&L})}}function A(w){return a(w)&&Math.abs(w)=M}},{"../../components/drawing":388,"../../constants/numerical":479,"../../lib":503,"../../registry":638,"./axis_ids":558,"@plotly/d3":58,"fast-isnumeric":190}],554:[function(t,o,f){var r=t("@plotly/d3"),a=t("fast-isnumeric"),l=t("../../plots/plots"),c=t("../../registry"),i=t("../../lib"),s=i.strTranslate,u=t("../../lib/svg_text_utils"),h=t("../../components/titles"),d=t("../../components/color"),m=t("../../components/drawing"),p=t("./layout_attributes"),g=t("./clean_ticks"),y=t("../../constants/numerical"),v=y.ONEMAXYEAR,x=y.ONEAVGYEAR,_=y.ONEMINYEAR,A=y.ONEMAXQUARTER,b=y.ONEAVGQUARTER,k=y.ONEMINQUARTER,w=y.ONEMAXMONTH,M=y.ONEAVGMONTH,T=y.ONEMINMONTH,E=y.ONEWEEK,S=y.ONEDAY,P=S/2,L=y.ONEHOUR,R=y.ONEMIN,F=y.ONESEC,D=y.MINUS_SIGN,O=y.BADNUM,N={K:"zeroline"},B={K:"gridline",L:"path"},W={K:"tick",L:"path"},G={K:"tick",L:"text"},K=t("../../constants/alignment"),te=K.MID_SHIFT,Y=K.CAP_SHIFT,J=K.LINE_SPACING,re=K.OPPOSITE_SIDE,U=o.exports={};U.setConvert=t("./set_convert");var V=t("./axis_autotype"),H=t("./axis_ids"),ne=H.idSort,q=H.isLinked;U.id2name=H.id2name,U.name2id=H.name2id,U.cleanId=H.cleanId,U.list=H.list,U.listIds=H.listIds,U.getFromId=H.getFromId,U.getFromTrace=H.getFromTrace;var Q=t("./autorange");U.getAutoRange=Q.getAutoRange,U.findExtremes=Q.findExtremes;function ee(Be){var Ge=1e-4*(Be[1]-Be[0]);return[Be[0]-Ge,Be[1]+Ge]}U.coerceRef=function(Be,Ge,kt,dt,Oe,Ie){var Te=dt.charAt(dt.length-1),Pe=kt._fullLayout._subplots[Te+"axis"],qe=dt+"ref",rt={};return Oe||(Oe=Pe[0]||(typeof Ie=="string"?Ie:Ie[0])),Ie||(Ie=Oe),Pe=Pe.concat(Pe.map(function(lt){return lt+" domain"})),rt[qe]={valType:"enumerated",values:Pe.concat(Ie?typeof Ie=="string"?[Ie]:Ie:[]),dflt:Oe},i.coerce(Be,Ge,rt,qe)},U.getRefType=function(Be){return Be===void 0?Be:Be==="paper"?"paper":Be==="pixel"?"pixel":/( domain)$/.test(Be)?"domain":"range"},U.coercePosition=function(Be,Ge,kt,dt,Oe,Ie){var Te,Pe;if(U.getRefType(dt)!=="range")Te=i.ensureNumber,Pe=kt(Oe,Ie);else{var qe=U.getFromId(Ge,dt);Pe=kt(Oe,Ie=qe.fraction2r(Ie)),Te=qe.cleanPos}Be[Oe]=Te(Pe)},U.cleanPosition=function(Be,Ge,kt){return(kt==="paper"||kt==="pixel"?i.ensureNumber:U.getFromId(Ge,kt).cleanPos)(Be)},U.redrawComponents=function(Be,Ge){Ge=Ge||U.listIds(Be);var kt=Be._fullLayout;function dt(Oe,Ie,Te,Pe){for(var qe=c.getComponentMethod(Oe,Ie),rt={},lt=0;lt2e-6||((kt-Be._forceTick0)/Be._minDtick%1+1.000001)%1>2e-6)&&(Be._minDtick=0)):Be._minDtick=0},U.saveRangeInitial=function(Be,Ge){for(var kt=U.list(Be,"",!0),dt=!1,Oe=0;Oe.3*Kt||It(Et)||It(Pt))){var qt=Ft.dtick/2;tt+=tt+qt.8){var Je=Number(Ft.substr(1));De.exactYears>.8&&Je%12==0?tt=U.tickIncrement(tt,"M6","reverse")+1.5*S:De.exactMonths>.8?tt=U.tickIncrement(tt,"M1","reverse")+15.5*S:tt-=P;var st=U.tickIncrement(tt,Ft);if(st<=Et)return st}return tt}(Ut,Be,$t,Pe,Oe)),wt=Ut,0;wt<=qe;)wt=U.tickIncrement(wt,$t,!1,Oe);return{start:Ge.c2r(Ut,0,Oe),end:Ge.c2r(wt,0,Oe),size:$t,_dataSpan:qe-Pe}},U.prepTicks=function(Be,Ge){var kt=i.simpleMap(Be.range,Be.r2l,void 0,void 0,Ge);if(Be._dtickInit=Be.dtick,Be._tick0Init=Be.tick0,Be.tickmode==="auto"||!Be.dtick){var dt,Oe=Be.nticks;Oe||(Be.type==="category"||Be.type==="multicategory"?(dt=Be.tickfont?i.bigFont(Be.tickfont.size||12):15,Oe=Be._length/dt):(dt=Be._id.charAt(0)==="y"?40:80,Oe=i.constrain(Be._length/dt,4,9)+1),Be._name==="radialaxis"&&(Oe*=2)),Be.tickmode==="array"&&(Oe*=100),Be._roughDTick=Math.abs(kt[1]-kt[0])/Oe,U.autoTicks(Be,Be._roughDTick),Be._minDtick>0&&Be.dtick<2*Be._minDtick&&(Be.dtick=Be._minDtick,Be.tick0=Be.l2r(Be._forceTick0))}Be.ticklabelmode==="period"&&function(Ie){var Te;function Pe(){return!(a(Ie.dtick)||Ie.dtick.charAt(0)!=="M")}var qe=Pe(),rt=U.getTickFormat(Ie);if(rt){var lt=Ie._dtickInit!==Ie.dtick;/%[fLQsSMX]/.test(rt)||(/%[HI]/.test(rt)?(Te=L,lt&&!qe&&Ie.dtickqn&&Sr=Ie:At<=Ie;At=U.tickIncrement(At,Be.dtick,Te,Be.calendar)){if(Pt++,Be.rangebreaks&&!Te){if(At=qe)break}if(tt.length>Ut||At===bt)break;bt=At;var De=!1;lt&&At!==(0|At)&&(De=!0);var Je={minor:De,value:At};$t>1&&Pt%$t&&(Je.skipLabel=!0),tt.push(Je)}if(ot&&function(nn,sn,gn){for(var bn=0;bn0?(qn=bn-1,Wn=bn):(qn=bn,Wn=bn);var ar,Dr=nn[qn].value,yr=nn[Wn].value,Sr=Math.abs(yr-Dr),Kn=gn||Sr,Dn=0;Kn>=_?Dn=Sr>=_&&Sr<=v?Sr:x:gn===b&&Kn>=k?Dn=Sr>=k&&Sr<=A?Sr:b:Kn>=T?Dn=Sr>=T&&Sr<=w?Sr:M:gn===E&&Kn>=E?Dn=E:Kn>=S?Dn=S:gn===P&&Kn>=P?Dn=P:gn===L&&Kn>=L&&(Dn=L),Dn>=Sr&&(Dn=Sr,ar=!0);var lr=In+Dn;if(sn.rangebreaks&&Dn>0){for(var Yr=0,Mn=0;Mn<84;Mn++){var rr=(Mn+.5)/84;sn.maskBreaks(In*(1-rr)+rr*lr)!==O&&Yr++}(Dn*=Yr/84)||(nn[bn].drop=!0),ar&&Sr>E&&(Dn=Sr)}(Dn>0||bn===0)&&(nn[bn].periodX=In+Dn/2)}}(tt,Be,Be._definedDelta),Be.rangebreaks){var st=Be._id.charAt(0)==="y",St=1;Be.tickmode==="auto"&&(St=Be.tickfont?Be.tickfont.size:12);var It=NaN;for(Ft=tt.length-1;Ft>-1;Ft--)if(tt[Ft].drop)tt.splice(Ft,1);else{tt[Ft].value=Lt(tt[Ft].value,Be);var Zt=Be.c2p(tt[Ft].value);(st?It>Zt-St:Itqe||qtqe&&(Kt.periodX=qe),qt10||dt.substr(5)!=="01-01"?Be._tickround="d":Be._tickround=+Ge.substr(1)%12==0?"y":"m";else if(Ge>=S&&Oe<=10||Ge>=15*S)Be._tickround="d";else if(Ge>=R&&Oe<=16||Ge>=L)Be._tickround="M";else if(Ge>=F&&Oe<=19||Ge>=R)Be._tickround="S";else{var Ie=Be.l2r(kt+Ge).replace(/^-/,"").length;Be._tickround=Math.max(Oe,Ie)-20,Be._tickround<0&&(Be._tickround=4)}}else if(a(Ge)||Ge.charAt(0)==="L"){var Te=Be.range.map(Be.r2d||Number);a(Ge)||(Ge=Number(Ge.substr(1))),Be._tickround=2-Math.floor(Math.log(Ge)/Math.LN10+.01);var Pe=Math.max(Math.abs(Te[0]),Math.abs(Te[1])),qe=Math.floor(Math.log(Pe)/Math.LN10+.01),rt=Be.minexponent===void 0?3:Be.minexponent;Math.abs(qe)>rt&&(Ce(Be.exponentformat)&&!Fe(qe)?Be._tickexponent=3*Math.round((qe-1)/3):Be._tickexponent=qe)}else Be._tickround=null}function Me(Be,Ge,kt){var dt=Be.tickfont||{};return{x:Ge,dx:0,dy:0,text:kt||"",fontSize:dt.size,font:dt.family,fontColor:dt.color}}U.autoTicks=function(Be,Ge){var kt;function dt(lt){return Math.pow(lt,Math.floor(Math.log(Ge)/Math.LN10))}if(Be.type==="date"){Be.tick0=i.dateTick0(Be.calendar,0);var Oe=2*Ge;if(Oe>x)Ge/=x,kt=dt(10),Be.dtick="M"+12*de(Ge,kt,ge);else if(Oe>M)Ge/=M,Be.dtick="M"+de(Ge,1,fe);else if(Oe>S){Be.dtick=de(Ge,S,Be._hasDayOfWeekBreaks?[1,2,7,14]:_e);var Ie=U.getTickFormat(Be),Te=Be.ticklabelmode==="period";Te&&(Be._rawTick0=Be.tick0),/%[uVW]/.test(Ie)?Be.tick0=i.dateTick0(Be.calendar,2):Be.tick0=i.dateTick0(Be.calendar,1),Te&&(Be._dowTick0=Be.tick0)}else Oe>L?Be.dtick=de(Ge,L,fe):Oe>R?Be.dtick=de(Ge,R,me):Oe>F?Be.dtick=de(Ge,F,me):(kt=dt(10),Be.dtick=de(Ge,kt,ge))}else if(Be.type==="log"){Be.tick0=0;var Pe=i.simpleMap(Be.range,Be.r2l);if(Ge>.7)Be.dtick=Math.ceil(Ge);else if(Math.abs(Pe[1]-Pe[0])<1){var qe=1.5*Math.abs((Pe[1]-Pe[0])/Ge);Ge=Math.abs(Math.pow(10,Pe[1])-Math.pow(10,Pe[0]))/qe,kt=dt(10),Be.dtick="L"+de(Ge,kt,ge)}else Be.dtick=Ge>.3?"D2":"D1"}else Be.type==="category"||Be.type==="multicategory"?(Be.tick0=0,Be.dtick=Math.ceil(Math.max(Ge,1))):et(Be)?(Be.tick0=0,kt=1,Be.dtick=de(Ge,kt,Le)):(Be.tick0=0,kt=dt(10),Be.dtick=de(Ge,kt,ge));if(Be.dtick===0&&(Be.dtick=1),!a(Be.dtick)&&typeof Be.dtick!="string"){var rt=Be.dtick;throw Be.dtick=1,"ax.dtick error: "+String(rt)}},U.tickIncrement=function(Be,Ge,kt,dt){var Oe=kt?-1:1;if(a(Ge))return i.increment(Be,Oe*Ge);var Ie=Ge.charAt(0),Te=Oe*Number(Ge.substr(1));if(Ie==="M")return i.incrementMonth(Be,Te,dt);if(Ie==="L")return Math.log(Math.pow(10,Be)+Te)/Math.LN10;if(Ie==="D"){var Pe=Ge==="D2"?ke:Ae,qe=Be+.01*Oe,rt=i.roundUp(i.mod(qe,1),Pe,kt);return Math.floor(qe)+Math.log(r.round(Math.pow(10,rt),1))/Math.LN10}throw"unrecognized dtick "+String(Ge)},U.tickFirst=function(Be,Ge){var kt=Be.r2l||Number,dt=i.simpleMap(Be.range,kt,void 0,void 0,Ge),Oe=dt[1] ")}else Ut._prevDateHead=De,Je+="
    "+De;tt.text=Je}(Be,Ie,kt,Pe):qe==="log"?function(Ut,tt,bt,Ft,Et){var Pt=Ut.dtick,De=tt.x,Je=Ut.tickformat,st=typeof Pt=="string"&&Pt.charAt(0);if(Et==="never"&&(Et=""),Ft&&st!=="L"&&(Pt="L3",st="L"),Je||st==="L")tt.text=ze(Math.pow(10,De),Ut,Et,Ft);else if(a(Pt)||st==="D"&&i.mod(De+.01,1)<.1){var St=Math.round(De),It=Math.abs(St),Zt=Ut.exponentformat;Zt==="power"||Ce(Zt)&&Fe(St)?(tt.text=St===0?1:St===1?"10":"10"+(St>1?"":D)+It+"",tt.fontSize*=1.25):(Zt==="e"||Zt==="E")&&It>2?tt.text="1"+Zt+(St>0?"+":D)+It:(tt.text=ze(Math.pow(10,De),Ut,"","fakehover"),Pt==="D1"&&Ut._id.charAt(0)==="y"&&(tt.dy-=tt.fontSize/6))}else{if(st!=="D")throw"unrecognized dtick "+String(Pt);tt.text=String(Math.round(Math.pow(10,i.mod(De,1)))),tt.fontSize*=.75}if(Ut.dtick==="D1"){var Kt=String(tt.text).charAt(0);Kt!=="0"&&Kt!=="1"||(Ut._id.charAt(0)==="y"?tt.dx-=tt.fontSize/4:(tt.dy+=tt.fontSize/2,tt.dx+=(Ut.range[1]>Ut.range[0]?1:-1)*tt.fontSize*(De<0?.5:.25)))}}(Be,Ie,0,Pe,wt):qe==="category"?function(Ut,tt){var bt=Ut._categories[Math.round(tt.x)];bt===void 0&&(bt=""),tt.text=String(bt)}(Be,Ie):qe==="multicategory"?function(Ut,tt,bt){var Ft=Math.round(tt.x),Et=Ut._categories[Ft]||[],Pt=Et[1]===void 0?"":String(Et[1]),De=Et[0]===void 0?"":String(Et[0]);bt?tt.text=De+" - "+Pt:(tt.text=Pt,tt.text2=De)}(Be,Ie,kt):et(Be)?function(Ut,tt,bt,Ft,Et){if(Ut.thetaunit!=="radians"||bt)tt.text=ze(tt.x,Ut,Et,Ft);else{var Pt=tt.x/180;if(Pt===0)tt.text="0";else{var De=function(st){function St(qt,mn){return Math.abs(qt-mn)<=1e-6}var It=function(qt){for(var mn=1;!St(Math.round(qt*mn)/mn,qt);)mn*=10;return mn}(st),Zt=st*It,Kt=Math.abs(function qt(mn,Fn){return St(Fn,0)?mn:qt(Fn,mn%Fn)}(Zt,It));return[Math.round(Zt/Kt),Math.round(It/Kt)]}(Pt);if(De[1]>=100)tt.text=ze(i.deg2rad(tt.x),Ut,Et,Ft);else{var Je=tt.x<0;De[1]===1?De[0]===1?tt.text="π":tt.text=De[0]+"π":tt.text=["",De[0],"","⁄","",De[1],"","π"].join(""),Je&&(tt.text=D+tt.text)}}}}(Be,Ie,kt,Pe,wt):function(Ut,tt,bt,Ft,Et){Et==="never"?Et="":Ut.showexponent==="all"&&Math.abs(tt.x/Ut.dtick)<1e-6&&(Et="hide"),tt.text=ze(tt.x,Ut,Et,Ft)}(Be,Ie,0,Pe,wt),dt||(Be.tickprefix&&!At(Be.showtickprefix)&&(Ie.text=Be.tickprefix+Ie.text),Be.ticksuffix&&!At(Be.showticksuffix)&&(Ie.text+=Be.ticksuffix)),Be.tickson==="boundaries"||Be.showdividers){var $t=function(Ut){var tt=Be.l2p(Ut);return tt>=0&&tt<=Be._length?Ut:null};Ie.xbnd=[$t(Ie.x-.5),$t(Ie.x+Be.dtick-.5)]}return Ie},U.hoverLabelText=function(Be,Ge,kt){kt&&(Be=i.extendFlat({},Be,{hoverformat:kt}));var dt=Array.isArray(Ge)?Ge[0]:Ge,Oe=Array.isArray(Ge)?Ge[1]:void 0;if(Oe!==void 0&&Oe!==dt)return U.hoverLabelText(Be,dt,kt)+" - "+U.hoverLabelText(Be,Oe,kt);var Ie=Be.type==="log"&&dt<=0,Te=U.tickText(Be,Be.c2l(Ie?-dt:dt),"hover").text;return Ie?dt===0?"0":D+Te:Te};var we=["f","p","n","μ","m","","k","M","G","T"];function Ce(Be){return Be==="SI"||Be==="B"}function Fe(Be){return Be>14||Be<-15}function ze(Be,Ge,kt,dt){var Oe=Be<0,Ie=Ge._tickround,Te=kt||Ge.exponentformat||"B",Pe=Ge._tickexponent,qe=U.getTickFormat(Ge),rt=Ge.separatethousands;if(dt){var lt={exponentformat:Te,minexponent:Ge.minexponent,dtick:Ge.showexponent==="none"?Ge.dtick:a(Be)&&Math.abs(Be)||1,range:Ge.showexponent==="none"?Ge.range.map(Ge.r2d):[0,Be||1]};ve(lt),Ie=(Number(lt._tickround)||0)+4,Pe=lt._tickexponent,Ge.hoverformat&&(qe=Ge.hoverformat)}if(qe)return Ge._numFormat(qe)(Be).replace(/-/g,D);var ot,At=Math.pow(10,-Ie)/2;if(Te==="none"&&(Pe=0),(Be=Math.abs(Be))"+ot+"":Te==="B"&&Pe===9?Be+="B":Ce(Te)&&(Be+=we[Pe/3+5])),Oe?D+Be:Be}function $e(Be,Ge){for(var kt=[],dt={},Oe=0;Oe1&&kt=Oe.min&&Be=0,bt=lt(At,wt[1])<=0;return($t||tt)&&(Ut||bt)}if(Be.tickformatstops&&Be.tickformatstops.length>0)switch(Be.type){case"date":case"linear":for(Ge=0;Ge=Te(Oe)))){kt=dt;break}break;case"log":for(Ge=0;Ge0?Kn.bottom-nr:0,Bn)))),Ge.automargin){Dn={x:0,y:0,r:0,l:0,t:0,b:0};var Nr=[0,1];if(qe==="x"){if(Mn==="b"?Dn[Mn]=Ge._depth:(Dn[Mn]=Ge._depth=Math.max(Kn.width>0?nr-Kn.top:0,Bn),Nr.reverse()),Kn.width>0){var Gr=Kn.right-(Ge._offset+Ge._length);Gr>0&&(Dn.xr=1,Dn.r=Gr);var pr=Ge._offset-Kn.left;pr>0&&(Dn.xl=0,Dn.l=pr)}}else if(Mn==="l"?Dn[Mn]=Ge._depth=Math.max(Kn.height>0?nr-Kn.left:0,Bn):(Dn[Mn]=Ge._depth=Math.max(Kn.height>0?Kn.right-nr:0,Bn),Nr.reverse()),Kn.height>0){var qr=Kn.bottom-(Ge._offset+Ge._length);qr>0&&(Dn.yb=0,Dn.b=qr);var _i=Ge._offset-Kn.top;_i>0&&(Dn.yt=1,Dn.t=_i)}Dn[rt]=Ge.anchor==="free"?Ge.position:Ge._anchorAxis.domain[Nr[0]],Ge.title.text!==Te._dfltTitle[qe]&&(Dn[Mn]+=Ve(Ge)+(Ge.title.standoff||0)),Ge.mirror&&Ge.anchor!=="free"&&((lr={x:0,y:0,r:0,l:0,t:0,b:0})[rr]=Ge.linewidth,Ge.mirror&&Ge.mirror!==!0&&(lr[rr]+=Bn),Ge.mirror===!0||Ge.mirror==="ticks"?lr[rt]=Ge._anchorAxis.domain[Nr[1]]:Ge.mirror!=="all"&&Ge.mirror!=="allticks"||(lr[rt]=[Ge._counterDomainMin,Ge._counterDomainMax][Nr[1]]))}yr&&(Yr=c.getComponentMethod("rangeslider","autoMarginOpts")(Be,Ge)),l.autoMargin(Be,nt(Ge),Dn),l.autoMargin(Be,ft(Ge),lr),l.autoMargin(Be,yt(Ge),Yr)}),kt.skipTitle||yr&&Ge.side==="bottom"||ar.push(function(){return function(Kn,Dn){var lr,Yr=Kn._fullLayout,Mn=Dn._id,rr=Mn.charAt(0),nr=Dn.title.font.size;if(Dn.title.hasOwnProperty("standoff"))lr=Dn._depth+Dn.title.standoff+Ve(Dn);else{var Bn=Wt(Dn);if(Dn.type==="multicategory")lr=Dn._depth;else{var Nr=1.5*nr;Bn&&(Nr=.5*nr,Dn.ticks==="outside"&&(Nr+=Dn.ticklen)),lr=10+Nr+(Dn.linewidth?Dn.linewidth-1:0)}Bn||(lr+=rr==="x"?Dn.side==="top"?nr*(Dn.showticklabels?1:0):nr*(Dn.showticklabels?1.5:.5):Dn.side==="right"?nr*(Dn.showticklabels?1:.5):nr*(Dn.showticklabels?.5:0))}var Gr,pr,qr,_i,cn=U.getPxPosition(Kn,Dn);if(rr==="x"?(pr=Dn._offset+Dn._length/2,qr=Dn.side==="top"?cn-lr:cn+lr):(qr=Dn._offset+Dn._length/2,pr=Dn.side==="right"?cn+lr:cn-lr,Gr={rotate:"-90",offset:0}),Dn.type!=="multicategory"){var jn=Dn._selections[Dn._id+"tick"];if(_i={selection:jn,side:Dn.side},jn&&jn.node()&&jn.node().parentNode){var jt=m.getTranslate(jn.node().parentNode);_i.offsetLeft=jt.x,_i.offsetTop=jt.y}Dn.title.hasOwnProperty("standoff")&&(_i.pad=0)}return h.draw(Kn,Mn+"title",{propContainer:Dn,propName:Dn._name+".title.text",placeholder:Yr._dfltTitle[rr],avoid:_i,transform:Gr,attributes:{x:pr,y:qr,"text-anchor":"middle"}})}(Be,Ge)}),i.syncOrAsync(ar)}}function Sr(Kn){var Dn=Pe+(Kn||"tick");return tt[Dn]||(tt[Dn]=function(lr,Yr){var Mn,rr,nr,Bn;return lr._selections[Yr].size()?(Mn=1/0,rr=-1/0,nr=1/0,Bn=-1/0,lr._selections[Yr].each(function(){var Nr=Ye(this),Gr=m.bBox(Nr.node().parentNode);Mn=Math.min(Mn,Gr.top),rr=Math.max(rr,Gr.bottom),nr=Math.min(nr,Gr.left),Bn=Math.max(Bn,Gr.right)})):(Mn=0,rr=0,nr=0,Bn=0),{top:Mn,bottom:rr,left:nr,right:Bn,height:rr-Mn,width:Bn-nr}}(Ge,Dn)),tt[Dn]}},U.getTickSigns=function(Be){var Ge=Be._id.charAt(0),kt={x:"top",y:"right"}[Ge],dt=Be.side===kt?1:-1,Oe=[-1,1,dt,-dt];return Be.ticks!=="inside"==(Ge==="x")&&(Oe=Oe.map(function(Ie){return-Ie})),Be.side&&Oe.push({l:-1,t:-1,r:1,b:1}[Be.side.charAt(0)]),Oe},U.makeTransTickFn=function(Be){return Be._id.charAt(0)==="x"?function(Ge){return s(Be._offset+Be.l2p(Ge.x),0)}:function(Ge){return s(0,Be._offset+Be.l2p(Ge.x))}},U.makeTransTickLabelFn=function(Be){var Ge=function(Oe){var Ie=Oe.ticklabelposition||"",Te=function(bt){return Ie.indexOf(bt)!==-1},Pe=Te("top"),qe=Te("left"),rt=Te("right"),lt=Te("bottom"),ot=Te("inside"),At=lt||qe||Pe||rt;if(!At&&!ot)return[0,0];var wt=Oe.side,$t=At?(Oe.tickwidth||0)/2:0,Ut=3,tt=Oe.tickfont?Oe.tickfont.size:12;return(lt||Pe)&&($t+=tt*Y,Ut+=(Oe.linewidth||0)/2),(qe||rt)&&($t+=(Oe.linewidth||0)/2,Ut+=3),ot&&wt==="top"&&(Ut-=tt*(1-Y)),(qe||Pe)&&($t=-$t),wt!=="bottom"&&wt!=="right"||(Ut=-Ut),[At?$t:0,ot?Ut:0]}(Be),kt=Ge[0],dt=Ge[1];return Be._id.charAt(0)==="x"?function(Oe){return s(kt+Be._offset+Be.l2p(Ke(Oe)),dt)}:function(Oe){return s(dt,kt+Be._offset+Be.l2p(Ke(Oe)))}},U.makeTickPath=function(Be,Ge,kt,dt){dt=dt!==void 0?dt:Be.ticklen;var Oe=Be._id.charAt(0),Ie=(Be.linewidth||1)/2;return Oe==="x"?"M0,"+(Ge+Ie*kt)+"v"+dt*kt:"M"+(Ge+Ie*kt)+",0h"+dt*kt},U.makeLabelFns=function(Be,Ge,kt){var dt=Be.ticklabelposition||"",Oe=function(Kt){return dt.indexOf(Kt)!==-1},Ie=Oe("top"),Te=Oe("left"),Pe=Oe("right"),qe=Oe("bottom")||Te||Ie||Pe,rt=Oe("inside"),lt=dt==="inside"&&Be.ticks==="inside"||!rt&&Be.ticks==="outside"&&Be.tickson!=="boundaries",ot=0,At=0,wt=lt?Be.ticklen:0;if(rt?wt*=-1:qe&&(wt=0),lt&&(ot+=wt,kt)){var $t=i.deg2rad(kt);ot=wt*Math.cos($t)+1,At=wt*Math.sin($t)}Be.showticklabels&&(lt||Be.showline)&&(ot+=.2*Be.tickfont.size);var Ut,tt,bt,Ft,Et,Pt={labelStandoff:ot+=(Be.linewidth||1)/2*(rt?-1:1),labelShift:At},De=0,Je=Be.side,st=Be._id.charAt(0),St=Be.tickangle;if(st==="x")Ft=(Et=!rt&&Je==="bottom"||rt&&Je==="top")?1:-1,rt&&(Ft*=-1),Ut=At*Ft,tt=Ge+ot*Ft,bt=Et?1:-.2,Math.abs(St)===90&&(rt?bt+=te:bt=St===-90&&Je==="bottom"?Y:St===90&&Je==="top"?te:.5,De=te/2*(St/90)),Pt.xFn=function(Kt){return Kt.dx+Ut+De*Kt.fontSize},Pt.yFn=function(Kt){return Kt.dy+tt+Kt.fontSize*bt},Pt.anchorFn=function(Kt,qt){if(qe){if(Te)return"end";if(Pe)return"start"}return a(qt)&&qt!==0&&qt!==180?qt*Ft<0!==rt?"end":"start":"middle"},Pt.heightFn=function(Kt,qt,mn){return qt<-60||qt>60?-.5*mn:Be.side==="top"!==rt?-mn:0};else if(st==="y"){if(Ft=(Et=!rt&&Je==="left"||rt&&Je==="right")?1:-1,rt&&(Ft*=-1),Ut=ot,tt=At*Ft,bt=0,rt||Math.abs(St)!==90||(bt=St===-90&&Je==="left"||St===90&&Je==="right"?Y:.5),rt){var It=a(St)?+St:0;if(It!==0){var Zt=i.deg2rad(It);De=Math.abs(Math.sin(Zt))*Y*Ft,bt=0}}Pt.xFn=function(Kt){return Kt.dx+Ge-(Ut+Kt.fontSize*bt)*Ft+De*Kt.fontSize},Pt.yFn=function(Kt){return Kt.dy+tt+Kt.fontSize*te},Pt.anchorFn=function(Kt,qt){return a(qt)&&Math.abs(qt)===90?"middle":Et?"end":"start"},Pt.heightFn=function(Kt,qt,mn){return Be.side==="right"&&(qt*=-1),qt<-30?-mn:qt<30?-.5*mn:0}}return Pt},U.drawTicks=function(Be,Ge,kt){kt=kt||{};var dt=Ge._id+"tick",Oe=kt.vals;Ge.ticklabelmode==="period"&&(Oe=Oe.slice()).shift();var Ie=kt.layer.selectAll("path."+dt).data(Ge.ticks?Oe:[],Re);Ie.exit().remove(),Ie.enter().append("path").classed(dt,1).classed("ticks",1).classed("crisp",kt.crisp!==!1).call(d.stroke,Ge.tickcolor).style("stroke-width",m.crispRound(Be,Ge.tickwidth,1)+"px").attr("d",kt.path).style("display",null),Jt(Ge,[W]),Ie.attr("transform",kt.transFn)},U.drawGrid=function(Be,Ge,kt){kt=kt||{};var dt=Ge._id+"grid",Oe=kt.vals,Ie=kt.counterAxis;if(Ge.showgrid===!1)Oe=[];else if(Ie&&U.shouldShowZeroLine(Be,Ge,Ie))for(var Te=Ge.tickmode==="array",Pe=0;PeIt||sn.leftIt||sn.top+(Ge.tickangle?0:tn.fontSize/4)Ge["_visibleLabelMin_"+st._id]?pn.style("display","none"):It.K!=="tick"||St||pn.style("display",null)})})})})},wt(ot,lt+1?lt:rt);var $t=null;Ge._selections&&(Ge._selections[Te]=ot);var Ut=[function(){return At.length&&Promise.all(At)}];Ge.automargin&&dt._redrawFromAutoMarginCount&<===90?($t=90,Ut.push(function(){wt(ot,lt)})):Ut.push(function(){if(wt(ot,rt),Pe.length&&Ie==="x"&&!a(rt)&&(Ge.type!=="log"||String(Ge.dtick).charAt(0)!=="D")){$t=0;var Ft,Et=0,Pt=[];if(ot.each(function(nn){Et=Math.max(Et,nn.fontSize);var sn=Ge.l2p(nn.x),gn=Ye(this),bn=m.bBox(gn.node());Pt.push({top:0,bottom:10,height:10,left:sn-bn.width/2,right:sn+bn.width/2+2,width:bn.width+2})}),Ge.tickson!=="boundaries"&&!Ge.showdividers||kt.secondary){var De=Pe.length,Je=Math.abs((Pe[De-1].x-Pe[0].x)*Ge._m)/(De-1),st=Ge.ticklabelposition||"",St=function(nn){return st.indexOf(nn)!==-1},It=St("top"),Zt=St("left"),Kt=St("right"),qt=St("bottom")||Zt||It||Kt?(Ge.tickwidth||0)+6:0,mn=Je<2.5*Et||Ge.type==="multicategory"||Ge._name==="realaxis";for(Ft=0;Ft1)for(Pe=1;Pe2*S}(y,p))return"date";var b=g.autotypenumbers!=="strict";return function(k,w){for(var M=k.length,T=d(M),E=0,S=0,P={},L=0;L2*E}(y,b)?"category":function(k,w){for(var M=k.length,T=0;T=2){var E,S,P="";if(T.length===2){for(E=0;E<2;E++)if(S=A(T[E])){P=y;break}}var L=M("pattern",P);if(L===y)for(E=0;E<2;E++)(S=A(T[E]))&&(k.bounds[E]=T[E]=S-1);if(L)for(E=0;E<2;E++)switch(S=T[E],L){case y:if(!r(S)||(S=+S)!==Math.floor(S)||S<0||S>=7)return void(k.enabled=!1);k.bounds[E]=T[E]=S;break;case v:if(!r(S)||(S=+S)<0||S>24)return void(k.enabled=!1);k.bounds[E]=T[E]=S}if(w.autorange===!1){var R=w.range;if(R[0]R[1])return void(k.enabled=!1)}else if(T[0]>R[0]&&T[1]u?1:-1:+(c.substr(1)||1)-+(i.substr(1)||1)},f.ref2id=function(c){return!!/^[xyz]/.test(c)&&c.split(" ")[0]},f.isLinked=function(c,i){return l(i,c._axisMatchGroups)||l(i,c._axisConstraintGroups)}},{"../../registry":638,"./constants":561}],559:[function(t,o,f){o.exports=function(r,a,l,c){if(a.type==="category"){var i,s=r.categoryarray,u=Array.isArray(s)&&s.length>0;u&&(i="array");var h,d=l("categoryorder",i);d==="array"&&(h=l("categoryarray")),u||d!=="array"||(d=a.categoryorder="trace"),d==="trace"?a._initialCategories=[]:d==="array"?a._initialCategories=h.slice():(h=function(m,p){var g,y,v,x=p.dataAttr||m._id.charAt(0),_={};if(p.axData)g=p.axData;else for(g=[],y=0;yk?w.substr(k):M.substr(b))+T:w+M+_*A:T}function v(_,A){for(var b=A._size,k=b.h/b.w,w={},M=Object.keys(_),T=0;Tu*D)||W){for(b=0;bne&&ieV&&(V=ie);S/=(V-U)/(2*H),U=M.l2r(U),V=M.l2r(V),M.range=M._input.range=Y=0?Math.min(ie,.9):1/(1/Math.max(ie,-.3)+3.222))}function Y(ie,ae,ue,le,ge){return ie.append("path").attr("class","zoombox").style({fill:ae>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform",u(ue,le)).attr("d",ge+"Z")}function J(ie,ae,ue){return ie.append("path").attr("class","zoombox-corners").style({fill:d.background,stroke:d.defaultLine,"stroke-width":1,opacity:0}).attr("transform",u(ae,ue)).attr("d","M0,0Z")}function re(ie,ae,ue,le,ge,fe){ie.attr("d",le+"M"+ue.l+","+ue.t+"v"+ue.h+"h"+ue.w+"v-"+ue.h+"h-"+ue.w+"Z"),U(ie,ae,ge,fe)}function U(ie,ae,ue,le){ue||(ie.transition().style("fill",le>.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),ae.transition().style("opacity",1).duration(200))}function V(ie){r.select(ie).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function H(ie){O&&ie.data&&ie._context.showTips&&(a.notifier(a._(ie,"Double-click to zoom back out"),"long"),O=!1)}function ne(ie){var ae=Math.floor(Math.min(ie.b-ie.t,ie.r-ie.l,D)/2);return"M"+(ie.l-3.5)+","+(ie.t-.5+ae)+"h3v"+-ae+"h"+ae+"v-3h-"+(ae+3)+"ZM"+(ie.r+3.5)+","+(ie.t-.5+ae)+"h-3v"+-ae+"h"+-ae+"v-3h"+(ae+3)+"ZM"+(ie.r+3.5)+","+(ie.b+.5-ae)+"h-3v"+ae+"h"+-ae+"v3h"+(ae+3)+"ZM"+(ie.l-3.5)+","+(ie.b+.5-ae)+"h3v"+ae+"h"+ae+"v3h-"+(ae+3)+"Z"}function q(ie,ae,ue,le,ge){for(var fe,me,_e,Ae,ke=!1,Le={},de={},ve=(ge||{}).xaHash,Me=(ge||{}).yaHash,we=0;we=0)sn._fullLayout._deactivateShape(sn);else{var gn=sn._fullLayout.clickmode;if(V(sn),tn!==2||Jt||Zt(),Wt)gn.indexOf("select")>-1&&P(nn,sn,ve,Me,ae.id,wt),gn.indexOf("event")>-1&&p.click(sn,nn,ae.id);else if(tn===1&&Jt){var bn=me?ke:Ae,In=me==="s"||_e==="w"?0:1,qn=bn._name+".range["+In+"]",Wn=function(yr,Sr){var Kn,Dn=yr.range[Sr],lr=Math.abs(Dn-yr.range[1-Sr]);return yr.type==="date"?Dn:yr.type==="log"?(Kn=Math.ceil(Math.max(0,-Math.log(lr)/Math.LN10))+3,l("."+Kn+"g")(Math.pow(10,Dn))):(Kn=Math.floor(Math.log(Math.abs(Dn))/Math.LN10)-Math.floor(Math.log(lr)/Math.LN10)+4,l("."+String(Kn)+"g")(Dn))}(bn,In),ar="left",Dr="middle";if(bn.fixedrange)return;me?(Dr=me==="n"?"top":"bottom",bn.side==="right"&&(ar="right")):_e==="e"&&(ar="right"),sn._context.showAxisRangeEntryBoxes&&r.select(kt).call(h.makeEditable,{gd:sn,immediate:!0,background:sn._fullLayout.paper_bgcolor,text:String(Wn),fill:bn.tickfont?bn.tickfont.color:"#444",horizontalAlign:ar,verticalAlign:Dr}).on("edit",function(yr){var Sr=bn.d2r(yr);Sr!==void 0&&s.call("_guiRelayout",sn,qn,Sr)})}}}function tt(tn,nn){if(ie._transitioningWithDuration)return!1;var sn=Math.max(0,Math.min(Fe,at*tn+dt)),gn=Math.max(0,Math.min(ze,et*nn+Oe)),bn=Math.abs(sn-dt),In=Math.abs(gn-Oe);function qn(){rt="",Ie.r=Ie.l,Ie.t=Ie.b,ot.attr("d","M0,0Z")}if(Ie.l=Math.min(dt,sn),Ie.r=Math.max(dt,sn),Ie.t=Math.min(Oe,gn),Ie.b=Math.max(Oe,gn),$e.isSubplotConstrained)bn>D||In>D?(rt="xy",bn/Fe>In/ze?(In=bn*ze/Fe,Oe>gn?Ie.t=Oe-In:Ie.b=Oe+In):(bn=In*Fe/ze,dt>sn?Ie.l=dt-bn:Ie.r=dt+bn),ot.attr("d",ne(Ie))):qn();else if(Ke.isSubplotConstrained)if(bn>D||In>D){rt="xy";var Wn=Math.min(Ie.l/Fe,(ze-Ie.b)/ze),ar=Math.max(Ie.r/Fe,(ze-Ie.t)/ze);Ie.l=Wn*Fe,Ie.r=ar*Fe,Ie.b=(1-Wn)*ze,Ie.t=(1-ar)*ze,ot.attr("d",ne(Ie))}else qn();else!Ve||In0){var Dr;if(Ke.isSubplotConstrained||!Re&&Ve.length===1){for(Dr=0;Dr_[1]-1/4096&&(c.domain=h),a.noneOrAll(l.domain,c.domain,h)}return i("layer"),c}},{"../../lib":503,"fast-isnumeric":190}],573:[function(t,o,f){var r=t("./show_dflt");o.exports=function(a,l,c,i,s){s||(s={});var u=s.tickSuffixDflt,h=r(a);c("tickprefix")&&c("showtickprefix",h),c("ticksuffix",u)&&c("showticksuffix",h)}},{"./show_dflt":577}],574:[function(t,o,f){var r=t("../../constants/alignment").FROM_BL;o.exports=function(a,l,c){c===void 0&&(c=r[a.constraintoward||"center"]);var i=[a.r2l(a.range[0]),a.r2l(a.range[1])],s=i[0]+(i[1]-i[0])*c;a.range=a._input.range=[a.l2r(s+(i[0]-s)*l),a.l2r(s+(i[1]-s)*l)],a.setScale()}},{"../../constants/alignment":471}],575:[function(t,o,f){var r=t("polybooljs"),a=t("../../registry"),l=t("../../components/drawing").dashStyle,c=t("../../components/color"),i=t("../../components/fx"),s=t("../../components/fx/helpers").makeEventData,u=t("../../components/dragelement/helpers"),h=u.freeMode,d=u.rectMode,m=u.drawMode,p=u.openMode,g=u.selectMode,y=t("../../components/shapes/draw_newshape/display_outlines"),v=t("../../components/shapes/draw_newshape/helpers").handleEllipse,x=t("../../components/shapes/draw_newshape/newshapes"),_=t("../../lib"),A=t("../../lib/polygon"),b=t("../../lib/throttle"),k=t("./axis_ids").getFromId,w=t("../../lib/clear_gl_canvases"),M=t("../../plot_api/subroutines").redrawReglTraces,T=t("./constants"),E=T.MINSELECT,S=A.filter,P=A.tester,L=t("./handle_outline").clearSelect,R=t("./helpers"),F=R.p2r,D=R.axValue,O=R.getTransform;function N(H,ne,q,Q,ee,ie,ae){var ue,le,ge,fe,me,_e,Ae,ke,Le,de=ne._hoverdata,ve=ne._fullLayout.clickmode.indexOf("event")>-1,Me=[];if(function($e){return $e&&Array.isArray($e)&&$e[0].hoverOnBox!==!0}(de)){K(H,ne,ie);var we=function($e,Ke){var Re,Ve,We=$e[0],Ye=-1,nt=[];for(Ve=0;Ve0?function($e,Ke){var Re,Ve,We,Ye=[];for(We=0;We<$e.length;We++)(Re=$e[We]).cd[0].trace.selectedpoints&&Re.cd[0].trace.selectedpoints.length>0&&Ye.push(Re);if(Ye.length===1&&Ye[0]===Ke.searchInfo&&(Ve=Ke.searchInfo.cd[0].trace).selectedpoints.length===Ke.pointNumbers.length){for(We=0;We1||(We+=Re.selectedpoints.length)>1))return!1;return We===1}(ue)&&(_e=J(we))){for(ae&&ae.remove(),Le=0;Le=0&&Q._fullLayout._deactivateShape(Q),m(ne)){var ee=Q._fullLayout._zoomlayer.selectAll(".select-outline-"+q.id);if(ee&&Q._fullLayout._drawing){var ie=x(ee,H);ie&&a.call("_guiRelayout",Q,{shapes:ie}),Q._fullLayout._drawing=!1}}q.selection={},q.selection.selectionDefs=H.selectionDefs=[],q.selection.mergedPolygons=H.mergedPolygons=[]}function Y(H,ne,q,Q){var ee,ie,ae,ue=[],le=ne.map(function(Ae){return Ae._id}),ge=q.map(function(Ae){return Ae._id});for(ae=0;ae0?Q[0]:q;return!!ne.selectedpoints&&ne.selectedpoints.indexOf(ee)>-1}function re(H,ne,q){var Q,ee,ie,ae;for(Q=0;Q=0)_e._fullLayout._deactivateShape(_e);else if(!le){var qe=Ae.clickmode;b.done(kt).then(function(){if(b.clear(kt),Te===2){for(Wt.remove(),Re=0;Re-1&&N(Pe,_e,Q.xaxes,Q.yaxes,Q.subplot,Q,Wt),qe==="event"&&_e.emit("plotly_selected",void 0);i.click(_e,Pe)}).catch(_.error)}},Q.doneFn=function(){Ge.remove(),b.done(kt).then(function(){b.clear(kt),Q.gd.emit("plotly_selected",We),Ke&&Q.selectionDefs&&(Ke.subtract=Lt,Q.selectionDefs.push(Ke),Q.mergedPolygons.length=0,[].push.apply(Q.mergedPolygons,$e)),Q.doneFnCompleted&&Q.doneFnCompleted(dt)}).catch(_.error),le&&te(Q)}},clearSelect:L,clearSelectionsCache:te,selectOnClick:N}},{"../../components/color":366,"../../components/dragelement/helpers":384,"../../components/drawing":388,"../../components/fx":406,"../../components/fx/helpers":402,"../../components/shapes/draw_newshape/display_outlines":454,"../../components/shapes/draw_newshape/helpers":455,"../../components/shapes/draw_newshape/newshapes":456,"../../lib":503,"../../lib/clear_gl_canvases":487,"../../lib/polygon":515,"../../lib/throttle":530,"../../plot_api/subroutines":544,"../../registry":638,"./axis_ids":558,"./constants":561,"./handle_outline":565,"./helpers":566,polybooljs:254}],576:[function(t,o,f){var r=t("@plotly/d3"),a=t("d3-time-format").utcFormat,l=t("../../lib"),c=l.numberFormat,i=t("fast-isnumeric"),s=l.cleanNumber,u=l.ms2DateTime,h=l.dateTime2ms,d=l.ensureNumber,m=l.isArrayOrTypedArray,p=t("../../constants/numerical"),g=p.FP_SAFE,y=p.BADNUM,v=p.LOG_CLIP,x=p.ONEWEEK,_=p.ONEDAY,A=p.ONEHOUR,b=p.ONEMIN,k=p.ONESEC,w=t("./axis_ids"),M=t("./constants"),T=M.HOUR_PATTERN,E=M.WEEKDAY_PATTERN;function S(L){return Math.pow(10,L)}function P(L){return L!=null}o.exports=function(L,R){R=R||{};var F=L._id||"x",D=F.charAt(0);function O(q,Q){if(q>0)return Math.log(q)/Math.LN10;if(q<=0&&Q&&L.range&&L.range.length===2){var ee=L.range[0],ie=L.range[1];return .5*(ee+ie-2*v*Math.abs(ee-ie))}return y}function N(q,Q,ee,ie){if((ie||{}).msUTC&&i(q))return+q;var ae=h(q,ee||L.calendar);if(ae===y){if(!i(q))return y;q=+q;var ue=Math.floor(10*l.mod(q+.05,1)),le=Math.round(q-ue/10);ae=h(new Date(le))+ue/10}return ae}function B(q,Q,ee){return u(q,Q,ee||L.calendar)}function W(q){return L._categories[Math.round(q)]}function G(q){if(P(q)){if(L._categoriesMap===void 0&&(L._categoriesMap={}),L._categoriesMap[q]!==void 0)return L._categoriesMap[q];L._categories.push(typeof q=="number"?String(q):q);var Q=L._categories.length-1;return L._categoriesMap[q]=Q,Q}return y}function K(q){if(L._categoriesMap)return L._categoriesMap[q]}function te(q){var Q=K(q);return Q!==void 0?Q:i(q)?+q:void 0}function Y(q){return i(q)?+q:K(q)}function J(q,Q,ee){return r.round(ee+Q*q,2)}function re(q,Q,ee){return(q-ee)/Q}var U=function(q){return i(q)?J(q,L._m,L._b):y},V=function(q){return re(q,L._m,L._b)};if(L.rangebreaks){var H=D==="y";U=function(q){if(!i(q))return y;var Q=L._rangebreaks.length;if(!Q)return J(q,L._m,L._b);var ee=H;L.range[0]>L.range[1]&&(ee=!ee);for(var ie=ee?-1:1,ae=ie*q,ue=0,le=0;lefe)){ue=ae<(ge+fe)/2?le:le+1;break}ue=le+1}var me=L._B[ue]||0;return isFinite(me)?J(q,L._m2,me):0},V=function(q){var Q=L._rangebreaks.length;if(!Q)return re(q,L._m,L._b);for(var ee=0,ie=0;ieL._rangebreaks[ie].pmax&&(ee=ie+1);return re(q,L._m2,L._B[ee])}}L.c2l=L.type==="log"?O:d,L.l2c=L.type==="log"?S:d,L.l2p=U,L.p2l=V,L.c2p=L.type==="log"?function(q,Q){return U(O(q,Q))}:U,L.p2c=L.type==="log"?function(q){return S(V(q))}:V,["linear","-"].indexOf(L.type)!==-1?(L.d2r=L.r2d=L.d2c=L.r2c=L.d2l=L.r2l=s,L.c2d=L.c2r=L.l2d=L.l2r=d,L.d2p=L.r2p=function(q){return L.l2p(s(q))},L.p2d=L.p2r=V,L.cleanPos=d):L.type==="log"?(L.d2r=L.d2l=function(q,Q){return O(s(q),Q)},L.r2d=L.r2c=function(q){return S(s(q))},L.d2c=L.r2l=s,L.c2d=L.l2r=d,L.c2r=O,L.l2d=S,L.d2p=function(q,Q){return L.l2p(L.d2r(q,Q))},L.p2d=function(q){return S(V(q))},L.r2p=function(q){return L.l2p(s(q))},L.p2r=V,L.cleanPos=d):L.type==="date"?(L.d2r=L.r2d=l.identity,L.d2c=L.r2c=L.d2l=L.r2l=N,L.c2d=L.c2r=L.l2d=L.l2r=B,L.d2p=L.r2p=function(q,Q,ee){return L.l2p(N(q,0,ee))},L.p2d=L.p2r=function(q,Q,ee){return B(V(q),Q,ee)},L.cleanPos=function(q){return l.cleanDate(q,y,L.calendar)}):L.type==="category"?(L.d2c=L.d2l=G,L.r2d=L.c2d=L.l2d=W,L.d2r=L.d2l_noadd=te,L.r2c=function(q){var Q=Y(q);return Q!==void 0?Q:L.fraction2r(.5)},L.l2r=L.c2r=d,L.r2l=Y,L.d2p=function(q){return L.l2p(L.r2c(q))},L.p2d=function(q){return W(V(q))},L.r2p=L.d2p,L.p2r=V,L.cleanPos=function(q){return typeof q=="string"&&q!==""?q:d(q)}):L.type==="multicategory"&&(L.r2d=L.c2d=L.l2d=W,L.d2r=L.d2l_noadd=te,L.r2c=function(q){var Q=te(q);return Q!==void 0?Q:L.fraction2r(.5)},L.r2c_just_indices=K,L.l2r=L.c2r=d,L.r2l=te,L.d2p=function(q){return L.l2p(L.r2c(q))},L.p2d=function(q){return W(V(q))},L.r2p=L.d2p,L.p2r=V,L.cleanPos=function(q){return Array.isArray(q)||typeof q=="string"&&q!==""?q:d(q)},L.setupMultiCategory=function(q){var Q,ee,ie=L._traceIndices,ae=L._matchGroup;if(ae&&L._categories.length===0){for(var ue in ae)if(ue!==F){var le=R[w.id2name(ue)];ie=ie.concat(le._traceIndices)}}var ge=[[0,{}],[0,{}]],fe=[];for(Q=0;Qg&&(ae[ee]=g),ae[0]===ae[1]){var le=Math.max(1,Math.abs(1e-6*ae[0]));ae[0]-=le,ae[1]+=le}}else l.nestedProperty(L,q).set(ie)},L.setScale=function(q){var Q=R._size;if(L.overlaying){var ee=w.getFromId({_fullLayout:R},L.overlaying);L.domain=ee.domain}var ie=q&&L._r?"_r":"range",ae=L.calendar;L.cleanRange(ie);var ue,le,ge=L.r2l(L[ie][0],ae),fe=L.r2l(L[ie][1],ae),me=D==="y";if(me?(L._offset=Q.t+(1-L.domain[1])*Q.h,L._length=Q.h*(L.domain[1]-L.domain[0]),L._m=L._length/(ge-fe),L._b=-L._m*fe):(L._offset=Q.l+L.domain[0]*Q.w,L._length=Q.w*(L.domain[1]-L.domain[0]),L._m=L._length/(fe-ge),L._b=-L._m*ge),L._rangebreaks=[],L._lBreaks=0,L._m2=0,L._B=[],L.rangebreaks&&(L._rangebreaks=L.locateBreaks(Math.min(ge,fe),Math.max(ge,fe)),L._rangebreaks.length)){for(ue=0;uefe&&(_e=!_e),_e&&L._rangebreaks.reverse();var Ae=_e?-1:1;for(L._m2=Ae*L._length/(Math.abs(fe-ge)-L._lBreaks),L._B.push(-L._m2*(me?fe:ge)),ue=0;ueie&&(ie+=7,aeie&&(ie+=24,ae=ee&&ae=ee&&q=Ke.min&&(CeKe.max&&(Ke.max=Fe),ze=!1)}ze&&le.push({min:Ce,max:Fe})}};for(ee=0;eeh.duration?(function(){for(var T={},E=0;E rect").call(c.setTranslate,0,0).call(c.setScale,1,1),b.plot.call(c.setTranslate,k._offset,w._offset).call(c.setScale,1,1);var M=b.plot.selectAll(".scatterlayer .trace");M.selectAll(".point").call(c.setPointGroupScale,1,1),M.selectAll(".textpoint").call(c.setTextPointsScale,1,1),M.call(c.hideOutsideRangePoints,b)}function A(b,k){var w=b.plotinfo,M=w.xaxis,T=w.yaxis,E=M._length,S=T._length,P=!!b.xr1,L=!!b.yr1,R=[];if(P){var F=l.simpleMap(b.xr0,M.r2l),D=l.simpleMap(b.xr1,M.r2l),O=F[1]-F[0],N=D[1]-D[0];R[0]=(F[0]*(1-k)+k*D[0]-F[0])/(F[1]-F[0])*E,R[2]=E*(1-k+k*N/O),M.range[0]=M.l2r(F[0]*(1-k)+k*D[0]),M.range[1]=M.l2r(F[1]*(1-k)+k*D[1])}else R[0]=0,R[2]=E;if(L){var B=l.simpleMap(b.yr0,T.r2l),W=l.simpleMap(b.yr1,T.r2l),G=B[1]-B[0],K=W[1]-W[0];R[1]=(B[1]*(1-k)+k*W[1]-B[1])/(B[0]-B[1])*S,R[3]=S*(1-k+k*K/G),T.range[0]=M.l2r(B[0]*(1-k)+k*W[0]),T.range[1]=T.l2r(B[1]*(1-k)+k*W[1])}else R[1]=0,R[3]=S;i.drawOne(s,M,{skipTitle:!0}),i.drawOne(s,T,{skipTitle:!0}),i.redrawComponents(s,[M._id,T._id]);var te=P?E/R[2]:1,Y=L?S/R[3]:1,J=P?R[0]:0,re=L?R[1]:0,U=P?R[0]/R[2]*E:0,V=L?R[1]/R[3]*S:0,H=M._offset-U,ne=T._offset-V;w.clipRect.call(c.setTranslate,J,re).call(c.setScale,1/te,1/Y),w.plot.call(c.setTranslate,H,ne).call(c.setScale,te,Y),c.setPointGroupScale(w.zoomScalePts,1/te,1/Y),c.setTextPointsScale(w.zoomScaleTxt,1/te,1/Y)}i.redrawComponents(s)}},{"../../components/drawing":388,"../../lib":503,"../../registry":638,"./axes":554,"@plotly/d3":58}],582:[function(t,o,f){var r=t("../../registry").traceIs,a=t("./axis_autotype");function l(i){return{v:"x",h:"y"}[i.orientation||"v"]}function c(i,s){var u=l(i),h=r(i,"box-violin"),d=r(i._fullInput||{},"candlestick");return h&&!d&&s===u&&i[u]===void 0&&i[u+"0"]===void 0}o.exports=function(i,s,u,h){u("autotypenumbers",h.autotypenumbersDflt),u("type",(h.splomStash||{}).type)==="-"&&(function(d,m){if(d.type==="-"){var p,g=d._id,y=g.charAt(0);g.indexOf("scene")!==-1&&(g=y);var v=function(T,E,S){for(var P=0;P0&&(L["_"+S+"axes"]||{})[E]||(L[S+"axis"]||S)===E&&(c(L,S)||(L[S]||[]).length||L[S+"0"]))return L}}(m,g,y);if(v){if(v.type==="histogram"&&y==={v:"y",h:"x"}[v.orientation||"v"])return void(d.type="linear");var x=y+"calendar",_=v[x],A={noMultiCategory:!r(v,"cartesian")||r(v,"noMultiCategory")};if(v.type==="box"&&v._hasPreCompStats&&y==={h:"x",v:"y"}[v.orientation||"v"]&&(A.noMultiCategory=!0),A.autotypenumbers=d.autotypenumbers,c(v,y)){var b=l(v),k=[];for(p=0;p0?".":"")+p;a.isPlainObject(g)?s(g,h,y,m+1):h(y,p,g)}})}f.manageCommandObserver=function(u,h,d,m){var p={},g=!0;h&&h._commandObserver&&(p=h._commandObserver),p.cache||(p.cache={}),p.lookupTable={};var y=f.hasSimpleAPICommandBindings(u,d,p.lookupTable);if(h&&h._commandObserver){if(y)return p;if(h._commandObserver.remove)return h._commandObserver.remove(),h._commandObserver=null,p}if(y){l(u,y,p.cache),p.check=function(){if(g){var _=l(u,y,p.cache);return _.changed&&m&&p.lookupTable[_.value]!==void 0&&(p.disable(),Promise.resolve(m({value:_.value,type:y.type,prop:y.prop,traces:y.traces,index:p.lookupTable[_.value]})).then(p.enable,p.enable)),_.changed}};for(var v=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],x=0;x0&&N<0&&(N+=360);var G=(N-O)/4;return{type:"Polygon",coordinates:[[[O,B],[O,W],[O+G,W],[O+2*G,W],[O+3*G,W],[N,W],[N,B],[N-G,B],[N-2*G,B],[N-3*G,B],[O,B]]]}}o.exports=function(R){return new S(R)},P.plot=function(R,F,D){var O=this,N=F[this.id],B=[],W=!1;for(var G in w.layerNameToAdjective)if(G!=="frame"&&N["show"+G]){W=!0;break}for(var K=0;K0&&B._module.calcGeoJSON(N,F)}if(!this.updateProjection(R,F)){this.viewInitial&&this.scope===D.scope||this.saveViewInitial(D),this.scope=D.scope,this.updateBaseLayers(F,D),this.updateDims(F,D),this.updateFx(F,D),g.generalUpdatePerTraceModule(this.graphDiv,this,R,D);var W=this.layers.frontplot.select(".scatterlayer");this.dataPoints.point=W.selectAll(".point"),this.dataPoints.text=W.selectAll("text"),this.dataPaths.line=W.selectAll(".js-line");var G=this.layers.backplot.select(".choroplethlayer");this.dataPaths.choropleth=G.selectAll("path"),this.render()}},P.updateProjection=function(R,F){var D=this.graphDiv,O=F[this.id],N=F._size,B=O.domain,W=O.projection,G=O.lonaxis,K=O.lataxis,te=G._ax,Y=K._ax,J=this.projection=function(de){var ve=de.projection,Me=ve.type,we=w.projNames[Me];we="geo"+u.titleCase(we);for(var Ce=(a[we]||i[we])(),Fe=de._isSatellite?180*Math.acos(1/ve.distance)/Math.PI:de._isClipped?w.lonaxisSpan[Me]/2:null,ze=["center","rotate","parallels","clipExtent"],$e=function(Ve){return Ve?Ce:[]},Ke=0;KeFe*Math.PI/180}return!1},Ce.getPath=function(){return l().projection(Ce)},Ce.getBounds=function(Ve){return Ce.getPath().bounds(Ve)},Ce.precision(w.precision),de._isSatellite&&Ce.tilt(ve.tilt).distance(ve.distance),Fe&&Ce.clipAngle(Fe-w.clipPad),Ce}(O),re=[[N.l+N.w*B.x[0],N.t+N.h*(1-B.y[1])],[N.l+N.w*B.x[1],N.t+N.h*(1-B.y[0])]],U=O.center||{},V=W.rotation||{},H=G.range||[],ne=K.range||[];if(O.fitbounds){te._length=re[1][0]-re[0][0],Y._length=re[1][1]-re[0][1],te.range=v(D,te),Y.range=v(D,Y);var q=(te.range[0]+te.range[1])/2,Q=(Y.range[0]+Y.range[1])/2;if(O._isScoped)U={lon:q,lat:Q};else if(O._isClipped){U={lon:q,lat:Q},V={lon:q,lat:Q,roll:V.roll};var ee=W.type,ie=w.lonaxisSpan[ee]/2||180,ae=w.lataxisSpan[ee]/2||90;H=[q-ie,q+ie],ne=[Q-ae,Q+ae]}else U={lon:q,lat:Q},V={lon:q,lat:V.lat,roll:V.roll}}J.center([U.lon-V.lon,U.lat-V.lat]).rotate([-V.lon,-V.lat,V.roll]).parallels(W.parallels);var ue=L(H,ne);J.fitExtent(re,ue);var le=this.bounds=J.getBounds(ue),ge=this.fitScale=J.scale(),fe=J.translate();if(O.fitbounds){var me=J.getBounds(L(te.range,Y.range)),_e=Math.min((le[1][0]-le[0][0])/(me[1][0]-me[0][0]),(le[1][1]-le[0][1])/(me[1][1]-me[0][1]));isFinite(_e)?J.scale(_e*ge):u.warn("Something went wrong during"+this.id+"fitbounds computations.")}else J.scale(W.scale*ge);var Ae=this.midPt=[(le[0][0]+le[1][0])/2,(le[0][1]+le[1][1])/2];if(J.translate([fe[0]+(Ae[0]-fe[0]),fe[1]+(Ae[1]-fe[1])]).clipExtent(le),O._isAlbersUsa){var ke=J([U.lon,U.lat]),Le=J.translate();J.translate([Le[0]-(ke[0]-Le[0]),Le[1]-(ke[1]-Le[1])])}},P.updateBaseLayers=function(R,F){var D=this,O=D.topojson,N=D.layers,B=D.basePaths;function W(J){return J==="lonaxis"||J==="lataxis"}function G(J){return!!w.lineLayers[J]}function K(J){return!!w.fillLayers[J]}var te=(this.hasChoropleth?w.layersForChoropleth:w.layers).filter(function(J){return G(J)||K(J)?F["show"+J]:!W(J)||F[J].showgrid}),Y=D.framework.selectAll(".layer").data(te,String);Y.exit().each(function(J){delete N[J],delete B[J],r.select(this).remove()}),Y.enter().append("g").attr("class",function(J){return"layer "+J}).each(function(J){var re=N[J]=r.select(this);J==="bg"?D.bgRect=re.append("rect").style("pointer-events","all"):W(J)?B[J]=re.append("path").style("fill","none"):J==="backplot"?re.append("g").classed("choroplethlayer",!0):J==="frontplot"?re.append("g").classed("scatterlayer",!0):G(J)?B[J]=re.append("path").style("fill","none").style("stroke-miterlimit",2):K(J)&&(B[J]=re.append("path").style("stroke","none"))}),Y.order(),Y.each(function(J){var re=B[J],U=w.layerNameToAdjective[J];J==="frame"?re.datum(w.sphereSVG):G(J)||K(J)?re.datum(E(O,O.objects[J])):W(J)&&re.datum(function(V,H,ne){var q,Q,ee,ie=H[V],ae=w.scopeDefaults[H.scope];V==="lonaxis"?(q=ae.lonaxisRange,Q=ae.lataxisRange,ee=function(Le,de){return[Le,de]}):V==="lataxis"&&(q=ae.lataxisRange,Q=ae.lonaxisRange,ee=function(Le,de){return[de,Le]});var ue={type:"linear",range:[q[0],q[1]-1e-6],tick0:ie.tick0,dtick:ie.dtick};y.setConvert(ue,ne);var le=y.calcTicks(ue);H.isScoped||V!=="lonaxis"||le.pop();for(var ge=le.length,fe=new Array(ge),me=0;me-1&&b(r.event,O,[D.xaxis],[D.yaxis],D.id,K),W.indexOf("event")>-1&&p.click(O,r.event))})}function te(Y){return D.projection.invert([Y[0]+D.xaxis._offset,Y[1]+D.yaxis._offset])}},P.makeFramework=function(){var R=this,F=R.graphDiv,D=F._fullLayout,O="clip"+D._uid+R.id;R.clipDef=D._clips.append("clipPath").attr("id",O),R.clipRect=R.clipDef.append("rect"),R.framework=r.select(R.container).append("g").attr("class","geo "+R.id).call(m.setClipUrl,O,F),R.project=function(N){var B=R.projection(N);return B?[B[0]-R.xaxis._offset,B[1]-R.yaxis._offset]:[null,null]},R.xaxis={_id:"x",c2p:function(N){return R.project(N)[0]}},R.yaxis={_id:"y",c2p:function(N){return R.project(N)[1]}},R.mockAxis={type:"linear",showexponent:"all",exponentformat:"B"},y.setConvert(R.mockAxis,D)},P.saveViewInitial=function(R){var F,D=R.center||{},O=R.projection,N=O.rotation||{};this.viewInitial={fitbounds:R.fitbounds,"projection.scale":O.scale},F=R._isScoped?{"center.lon":D.lon,"center.lat":D.lat}:R._isClipped?{"projection.rotation.lon":N.lon,"projection.rotation.lat":N.lat}:{"center.lon":D.lon,"center.lat":D.lat,"projection.rotation.lon":N.lon},u.extendFlat(this.viewInitial,F)},P.render=function(){var R,F=this.projection,D=F.getPath();function O(B){var W=F(B.lonlat);return W?h(W[0],W[1]):null}function N(B){return F.isLonLatOverEdges(B.lonlat)?"none":null}for(R in this.basePaths)this.basePaths[R].attr("d",D);for(R in this.dataPaths)this.dataPaths[R].attr("d",function(B){return D(B.geojson)});for(R in this.dataPoints)this.dataPoints[R].attr("display",N).attr("transform",O)}},{"../../components/color":366,"../../components/dragelement":385,"../../components/drawing":388,"../../components/fx":406,"../../lib":503,"../../lib/geo_location_utils":496,"../../lib/topojson_utils":532,"../../registry":638,"../cartesian/autorange":553,"../cartesian/axes":554,"../cartesian/select":575,"../plots":619,"./constants":587,"./zoom":592,"@plotly/d3":58,"d3-geo":114,"d3-geo-projection":113,"topojson-client":315}],589:[function(t,o,f){var r=t("../../plots/get_data").getSubplotCalcData,a=t("../../lib").counterRegex,l=t("./geo"),c="geo",i=a(c),s={};s.geo={valType:"subplotid",dflt:c,editType:"calc"},o.exports={attr:c,name:c,idRoot:c,idRegex:i,attrRegex:i,attributes:s,layoutAttributes:t("./layout_attributes"),supplyLayoutDefaults:t("./layout_defaults"),plot:function(u){for(var h=u._fullLayout,d=u.calcdata,m=h._subplots.geo,p=0;p0&&K<0&&(K+=360);var te,Y,J,re=(G+K)/2;if(!A){var U=b?x.projRotate:[re,0,0];te=m("projection.rotation.lon",U[0]),m("projection.rotation.lat",U[1]),m("projection.rotation.roll",U[2]),m("showcoastlines",!b&&E)&&(m("coastlinecolor"),m("coastlinewidth")),m("showocean",!!E&&void 0)&&m("oceancolor")}A?(Y=-96.6,J=38.7):(Y=b?re:te,J=(W[0]+W[1])/2),m("center.lon",Y),m("center.lat",J),k&&(m("projection.tilt"),m("projection.distance")),w&&m("projection.parallels",x.projParallels||[0,60]),m("projection.scale"),m("showland",!!E&&void 0)&&m("landcolor"),m("showlakes",!!E&&void 0)&&m("lakecolor"),m("showrivers",!!E&&void 0)&&(m("rivercolor"),m("riverwidth")),m("showcountries",b&&v!=="usa"&&E)&&(m("countrycolor"),m("countrywidth")),(v==="usa"||v==="north america"&&y===50)&&(m("showsubunits",E),m("subunitcolor"),m("subunitwidth")),b||m("showframe",E)&&(m("framecolor"),m("framewidth")),m("bgcolor"),m("fitbounds")&&(delete d.projection.scale,b?(delete d.center.lon,delete d.center.lat):M?(delete d.center.lon,delete d.center.lat,delete d.projection.rotation.lon,delete d.projection.rotation.lat,delete d.lonaxis.range,delete d.lataxis.range):(delete d.center.lon,delete d.center.lat,delete d.projection.rotation.lon))}o.exports=function(h,d,m){a(h,d,m,{type:"geo",attributes:i,handleDefaults:u,fullData:m,partition:"y"})}},{"../../lib":503,"../get_data":593,"../subplot_defaults":632,"./constants":587,"./layout_attributes":590}],592:[function(t,o,f){var r=t("@plotly/d3"),a=t("../../lib"),l=t("../../registry"),c=Math.PI/180,i=180/Math.PI,s={cursor:"pointer"},u={cursor:"auto"};function h(E,S){return r.behavior.zoom().translate(S.translate()).scale(S.scale())}function d(E,S,P){var L=E.id,R=E.graphDiv,F=R.layout,D=F[L],O=R._fullLayout,N=O[L],B={},W={};function G(K,te){B[L+"."+K]=a.nestedProperty(D,K).get(),l.call("_storeDirectGUIEdit",F,O._preGUI,B);var Y=a.nestedProperty(N,K);Y.get()!==te&&(Y.set(te),a.nestedProperty(D,K).set(te),W[L+"."+K]=te)}P(G),G("projection.scale",S.scale()/E.fitScale),G("fitbounds",!1),R.emit("plotly_relayout",W)}function m(E,S){var P=h(0,S);function L(R){var F=S.invert(E.midPt);R("center.lon",F[0]),R("center.lat",F[1])}return P.on("zoomstart",function(){r.select(this).style(s)}).on("zoom",function(){S.scale(r.event.scale).translate(r.event.translate),E.render();var R=S.invert(E.midPt);E.graphDiv.emit("plotly_relayouting",{"geo.projection.scale":S.scale()/E.fitScale,"geo.center.lon":R[0],"geo.center.lat":R[1]})}).on("zoomend",function(){r.select(this).style(u),d(E,S,L)}),P}function p(E,S){var P,L,R,F,D,O,N,B,W,G=h(0,S);function K(Y){return S.invert(Y)}function te(Y){var J=S.rotate(),re=S.invert(E.midPt);Y("projection.rotation.lon",-J[0]),Y("center.lon",re[0]),Y("center.lat",re[1])}return G.on("zoomstart",function(){r.select(this).style(s),P=r.mouse(this),L=S.rotate(),R=S.translate(),F=L,D=K(P)}).on("zoom",function(){if(O=r.mouse(this),function(re){var U=K(re);if(!U)return!0;var V=S(U);return Math.abs(V[0]-re[0])>2||Math.abs(V[1]-re[1])>2}(P))return G.scale(S.scale()),void G.translate(S.translate());S.scale(r.event.scale),S.translate([R[0],r.event.translate[1]]),D?K(O)&&(B=K(O),N=[F[0]+(B[0]-D[0]),L[1],L[2]],S.rotate(N),F=N):D=K(P=O),W=!0,E.render();var Y=S.rotate(),J=S.invert(E.midPt);E.graphDiv.emit("plotly_relayouting",{"geo.projection.scale":S.scale()/E.fitScale,"geo.center.lon":J[0],"geo.center.lat":J[1],"geo.projection.rotation.lon":-Y[0]})}).on("zoomend",function(){r.select(this).style(u),W&&d(E,S,te)}),G}function g(E,S){var P;S.rotate(),S.scale();var L=h(0,S),R=function(G){for(var K=0,te=arguments.length,Y=[];++Kte?(F=(W>0?90:-90)-K,R=0):(F=Math.asin(W/te)*i-K,R=Math.sqrt(te*te-W*W));var Y=180-F-2*K,J=(Math.atan2(G,B)-Math.atan2(N,R))*i,re=(Math.atan2(G,B)-Math.atan2(N,-R))*i;return b(P[0],P[1],F,J)<=b(P[0],P[1],Y,re)?[F,J,P[2]]:[Y,re,P[2]]}function b(E,S,P,L){var R=k(P-E),F=k(L-S);return Math.sqrt(R*R+F*F)}function k(E){return(E%360+540)%360-180}function w(E,S,P){var L=P*c,R=E.slice(),F=S===0?1:0,D=S===2?1:2,O=Math.cos(L),N=Math.sin(L);return R[F]=E[F]*O-E[D]*N,R[D]=E[D]*O+E[F]*N,R}function M(E){return[Math.atan2(2*(E[0]*E[1]+E[2]*E[3]),1-2*(E[1]*E[1]+E[2]*E[2]))*i,Math.asin(Math.max(-1,Math.min(1,2*(E[0]*E[2]-E[3]*E[1]))))*i,Math.atan2(2*(E[0]*E[3]+E[1]*E[2]),1-2*(E[2]*E[2]+E[3]*E[3]))*i]}function T(E,S){for(var P=0,L=0,R=E.length;LMath.abs(A)?(m.boxEnd[1]=m.boxStart[1]+Math.abs(_)*D*(A>=0?1:-1),m.boxEnd[1]b[3]&&(m.boxEnd[1]=b[3],m.boxEnd[0]=m.boxStart[0]+(b[3]-m.boxStart[1])/Math.abs(D))):(m.boxEnd[0]=m.boxStart[0]+Math.abs(A)/D*(_>=0?1:-1),m.boxEnd[0]b[2]&&(m.boxEnd[0]=b[2],m.boxEnd[1]=m.boxStart[1]+(b[2]-m.boxStart[0])*Math.abs(D)))}}else m.boxEnabled?(_=m.boxStart[0]!==m.boxEnd[0],A=m.boxStart[1]!==m.boxEnd[1],_||A?(_&&(S(0,m.boxStart[0],m.boxEnd[0]),u.xaxis.autorange=!1),A&&(S(1,m.boxStart[1],m.boxEnd[1]),u.yaxis.autorange=!1),u.relayoutCallback()):u.glplot.setDirty(),m.boxEnabled=!1,m.boxInited=!1):m.boxInited&&(m.boxInited=!1);break;case"pan":m.boxEnabled=!1,m.boxInited=!1,y?(m.panning||(m.dragStart[0]=v,m.dragStart[1]=x),Math.abs(m.dragStart[0]-v).999&&(w="turntable"):w="turntable")}else w="turntable";p("dragmode",w),p("hovermode",g.getDfltFromLayout("hovermode"))}o.exports=function(d,m,p){var g=m._basePlotModules.length>1;c(d,m,p,{type:"gl3d",attributes:s,handleDefaults:h,fullLayout:m,font:m.font,fullData:p,getDfltFromLayout:function(y){if(!g)return r.validate(d[y],s[y])?d[y]:void 0},autotypenumbersDflt:m.autotypenumbers,paper_bgcolor:m.paper_bgcolor,calendar:m.calendar})}},{"../../../components/color":366,"../../../lib":503,"../../../registry":638,"../../get_data":593,"../../subplot_defaults":632,"./axis_defaults":601,"./layout_attributes":604}],604:[function(t,o,f){var r=t("./axis_attributes"),a=t("../../domain").attributes,l=t("../../../lib/extend").extendFlat,c=t("../../../lib").counterRegex;function i(s,u,h){return{x:{valType:"number",dflt:s,editType:"camera"},y:{valType:"number",dflt:u,editType:"camera"},z:{valType:"number",dflt:h,editType:"camera"},editType:"camera"}}o.exports={_arrayAttrRegexps:[c("scene",".annotations",!0)],bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)",editType:"plot"},camera:{up:l(i(0,0,1),{}),center:l(i(0,0,0),{}),eye:l(i(1.25,1.25,1.25),{}),projection:{type:{valType:"enumerated",values:["perspective","orthographic"],dflt:"perspective",editType:"calc"},editType:"calc"},editType:"camera"},domain:a({name:"scene",editType:"plot"}),aspectmode:{valType:"enumerated",values:["auto","cube","data","manual"],dflt:"auto",editType:"plot",impliedEdits:{"aspectratio.x":void 0,"aspectratio.y":void 0,"aspectratio.z":void 0}},aspectratio:{x:{valType:"number",min:0,editType:"plot",impliedEdits:{"^aspectmode":"manual"}},y:{valType:"number",min:0,editType:"plot",impliedEdits:{"^aspectmode":"manual"}},z:{valType:"number",min:0,editType:"plot",impliedEdits:{"^aspectmode":"manual"}},editType:"plot",impliedEdits:{aspectmode:"manual"}},xaxis:r,yaxis:r,zaxis:r,dragmode:{valType:"enumerated",values:["orbit","turntable","zoom","pan",!1],editType:"plot"},hovermode:{valType:"enumerated",values:["closest",!1],dflt:"closest",editType:"modebar"},uirevision:{valType:"any",editType:"none"},editType:"plot",_deprecated:{cameraposition:{valType:"info_array",editType:"camera"}}}},{"../../../lib":503,"../../../lib/extend":493,"../../domain":584,"./axis_attributes":600}],605:[function(t,o,f){var r=t("../../../lib/str2rgbarray"),a=["xaxis","yaxis","zaxis"];function l(){this.enabled=[!0,!0,!0],this.colors=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.drawSides=[!0,!0,!0],this.lineWidth=[1,1,1]}l.prototype.merge=function(c){for(var i=0;i<3;++i){var s=c[a[i]];s.visible?(this.enabled[i]=s.showspikes,this.colors[i]=r(s.spikecolor),this.drawSides[i]=s.spikesides,this.lineWidth[i]=s.spikethickness):(this.enabled[i]=!1,this.drawSides[i]=!1)}},o.exports=function(c){var i=new l;return i.merge(c),i}},{"../../../lib/str2rgbarray":528}],606:[function(t,o,f){o.exports=function(i){for(var s=i.axesOptions,u=i.glplot.axesPixels,h=i.fullSceneLayout,d=[[],[],[]],m=0;m<3;++m){var p=h[l[m]];if(p._length=(u[m].hi-u[m].lo)*u[m].pixelsPerDataUnit/i.dataScale[m],Math.abs(p._length)===1/0||isNaN(p._length))d[m]=[];else{p._input_range=p.range.slice(),p.range[0]=u[m].lo/i.dataScale[m],p.range[1]=u[m].hi/i.dataScale[m],p._m=1/(i.dataScale[m]*u[m].pixelsPerDataUnit),p.range[0]===p.range[1]&&(p.range[0]-=1,p.range[1]+=1);var g=p.tickmode;if(p.tickmode==="auto"){p.tickmode="linear";var y=p.nticks||a.constrain(p._length/40,4,9);r.autoTicks(p,Math.abs(p.range[1]-p.range[0])/y)}for(var v=r.calcTicks(p,{msUTC:!0}),x=0;x/g," "));d[m]=v,p.tickmode=g}}for(s.ticks=d,m=0;m<3;++m)for(c[m]=.5*(i.glplot.bounds[0][m]+i.glplot.bounds[1][m]),x=0;x<2;++x)s.bounds[x][m]=i.glplot.bounds[x][m];i.contourLevels=function(_){for(var A=new Array(3),b=0;b<3;++b){for(var k=_[b],w=new Array(k.length),M=0;MD.deltaY?1.1:.9090909090909091,N=S.glplot.getAspectratio();S.glplot.setAspectratio({x:O*N.x,y:O*N.y,z:O*N.z})}F(S)}},!!u&&{passive:!1}),S.glplot.canvas.addEventListener("mousemove",function(){if(S.fullSceneLayout.dragmode!==!1&&S.camera.mouseListener.buttons!==0){var D=R();S.graphDiv.emit("plotly_relayouting",D)}}),S.staticMode||S.glplot.canvas.addEventListener("webglcontextlost",function(D){P&&P.emit&&P.emit("plotly_webglcontextlost",{event:D,layer:S.id})},!1)),S.glplot.oncontextloss=function(){S.recoverContext()},S.glplot.onrender=function(){S.render()},!0},w.render=function(){var S,P=this,L=P.graphDiv,R=P.svgContainer,F=P.container.getBoundingClientRect();L._fullLayout._calcInverseTransform(L);var D=L._fullLayout._invScaleX,O=L._fullLayout._invScaleY,N=F.width*D,B=F.height*O;R.setAttributeNS(null,"viewBox","0 0 "+N+" "+B),R.setAttributeNS(null,"width",N),R.setAttributeNS(null,"height",B),b(P),P.glplot.axes.update(P.axesOptions);for(var W=Object.keys(P.traces),G=null,K=P.glplot.selection,te=0;te")):S.type==="isosurface"||S.type==="volume"?(H.valueLabel=p.hoverLabelText(P._mockAxis,P._mockAxis.d2l(K.traceCoordinate[3]),S.valuehoverformat),ee.push("value: "+H.valueLabel),K.textLabel&&ee.push(K.textLabel),re=ee.join("
    ")):re=K.textLabel;var ie={x:K.traceCoordinate[0],y:K.traceCoordinate[1],z:K.traceCoordinate[2],data:U._input,fullData:U,curveNumber:U.index,pointNumber:V};g.appendArrayPointValue(ie,U,V),S._module.eventData&&(ie=U._module.eventData(ie,K,U,{},V));var ae={points:[ie]};if(P.fullSceneLayout.hovermode){var ue=[];g.loneHover({trace:U,x:(.5+.5*J[0]/J[3])*N,y:(.5-.5*J[1]/J[3])*B,xLabel:H.xLabel,yLabel:H.yLabel,zLabel:H.zLabel,text:re,name:G.name,color:g.castHoverOption(U,V,"bgcolor")||G.color,borderColor:g.castHoverOption(U,V,"bordercolor"),fontFamily:g.castHoverOption(U,V,"font.family"),fontSize:g.castHoverOption(U,V,"font.size"),fontColor:g.castHoverOption(U,V,"font.color"),nameLength:g.castHoverOption(U,V,"namelength"),textAlign:g.castHoverOption(U,V,"align"),hovertemplate:d.castOption(U,V,"hovertemplate"),hovertemplateLabels:d.extendFlat({},ie,H),eventData:[ie]},{container:R,gd:L,inOut_bbox:ue}),ie.bbox=ue[0]}K.buttons&&K.distance<5?L.emit("plotly_click",ae):L.emit("plotly_hover",ae),this.oldEventData=ae}else g.loneUnhover(R),this.oldEventData&&L.emit("plotly_unhover",this.oldEventData),this.oldEventData=void 0;P.drawAnnotations(P)},w.recoverContext=function(){var S=this;S.glplot.dispose();var P=function(){S.glplot.gl.isContextLost()?requestAnimationFrame(P):S.initializeGLPlot()?S.plot.apply(S,S.plotArgs):d.error("Catastrophic and unrecoverable WebGL error. Context lost.")};requestAnimationFrame(P)};var T=["xaxis","yaxis","zaxis"];function E(S,P,L){for(var R=S.fullSceneLayout,F=0;F<3;F++){var D=T[F],O=D.charAt(0),N=R[D],B=P[O],W=P[O+"calendar"],G=P["_"+O+"length"];if(d.isArrayOrTypedArray(B))for(var K,te=0;te<(G||B.length);te++)if(d.isArrayOrTypedArray(B[te]))for(var Y=0;Yre[1][D])re[0][D]=-1,re[1][D]=1;else{var le=re[1][D]-re[0][D];re[0][D]-=le/32,re[1][D]+=le/32}if(N.autorange==="reversed"){var ge=re[0][D];re[0][D]=re[1][D],re[1][D]=ge}}else{var fe=N.range;re[0][D]=N.r2l(fe[0]),re[1][D]=N.r2l(fe[1])}re[0][D]===re[1][D]&&(re[0][D]-=1,re[1][D]+=1),U[D]=re[1][D]-re[0][D],this.glplot.setBounds(D,{min:re[0][D]*te[D],max:re[1][D]*te[D]})}var me=W.aspectmode;if(me==="cube")J=[1,1,1];else if(me==="manual"){var _e=W.aspectratio;J=[_e.x,_e.y,_e.z]}else{if(me!=="auto"&&me!=="data")throw new Error("scene.js aspectRatio was not one of the enumerated types");var Ae=[1,1,1];for(D=0;D<3;++D){var ke=V[B=(N=W[T[D]]).type];Ae[D]=Math.pow(ke.acc,1/ke.count)/te[D]}J=me==="data"||Math.max.apply(null,Ae)/Math.min.apply(null,Ae)<=4?Ae:[1,1,1]}W.aspectratio.x=G.aspectratio.x=J[0],W.aspectratio.y=G.aspectratio.y=J[1],W.aspectratio.z=G.aspectratio.z=J[2],this.glplot.setAspectratio(W.aspectratio),this.viewInitial.aspectratio||(this.viewInitial.aspectratio={x:W.aspectratio.x,y:W.aspectratio.y,z:W.aspectratio.z}),this.viewInitial.aspectmode||(this.viewInitial.aspectmode=W.aspectmode);var Le=W.domain||null,de=P._size||null;if(Le&&de){var ve=this.container.style;ve.position="absolute",ve.left=de.l+Le.x[0]*de.w+"px",ve.top=de.t+(1-Le.y[1])*de.h+"px",ve.width=de.w*(Le.x[1]-Le.x[0])+"px",ve.height=de.h*(Le.y[1]-Le.y[0])+"px"}this.glplot.redraw()}},w.destroy=function(){this.glplot&&(this.camera.mouseListener.enabled=!1,this.container.removeEventListener("wheel",this.camera.wheelListener),this.camera=null,this.glplot.dispose(),this.container.parentNode.removeChild(this.container),this.glplot=null)},w.getCamera=function(){var S;return this.camera.view.recalcMatrix(this.camera.view.lastT()),{up:{x:(S=this.camera).up[0],y:S.up[1],z:S.up[2]},center:{x:S.center[0],y:S.center[1],z:S.center[2]},eye:{x:S.eye[0],y:S.eye[1],z:S.eye[2]},projection:{type:S._ortho===!0?"orthographic":"perspective"}}},w.setViewport=function(S){var P,L=S.camera;this.camera.lookAt.apply(this,[[(P=L).eye.x,P.eye.y,P.eye.z],[P.center.x,P.center.y,P.center.z],[P.up.x,P.up.y,P.up.z]]),this.glplot.setAspectratio(S.aspectratio),L.projection.type==="orthographic"!==this.camera._ortho&&(this.glplot.redraw(),this.glplot.clearRGBA(),this.glplot.dispose(),this.initializeGLPlot())},w.isCameraChanged=function(S){var P=this.getCamera(),L=d.nestedProperty(S,this.id+".camera").get();function R(N,B,W,G){var K=["up","center","eye"],te=["x","y","z"];return B[K[W]]&&N[K[W]][te[G]]===B[K[W]][te[G]]}var F=!1;if(L===void 0)F=!0;else{for(var D=0;D<3;D++)for(var O=0;O<3;O++)if(!R(P,L,D,O)){F=!0;break}(!L.projection||P.projection&&P.projection.type!==L.projection.type)&&(F=!0)}return F},w.isAspectChanged=function(S){var P=this.glplot.getAspectratio(),L=d.nestedProperty(S,this.id+".aspectratio").get();return L===void 0||L.x!==P.x||L.y!==P.y||L.z!==P.z},w.saveLayout=function(S){var P,L,R,F,D,O,N=this.fullLayout,B=this.isCameraChanged(S),W=this.isAspectChanged(S),G=B||W;if(G){var K={};B&&(P=this.getCamera(),R=(L=d.nestedProperty(S,this.id+".camera")).get(),K[this.id+".camera"]=R),W&&(F=this.glplot.getAspectratio(),O=(D=d.nestedProperty(S,this.id+".aspectratio")).get(),K[this.id+".aspectratio"]=O),h.call("_storeDirectGUIEdit",S,N._preGUI,K),B&&(L.set(P),d.nestedProperty(N,this.id+".camera").set(P)),W&&(D.set(F),d.nestedProperty(N,this.id+".aspectratio").set(F),this.glplot.redraw())}return G},w.updateFx=function(S,P){var L=this.camera;if(L)if(S==="orbit")L.mode="orbit",L.keyBindingMode="rotate";else if(S==="turntable"){L.up=[0,0,1],L.mode="turntable",L.keyBindingMode="rotate";var R=this.graphDiv,F=R._fullLayout,D=this.fullSceneLayout.camera,O=D.up.x,N=D.up.y,B=D.up.z;if(B/Math.sqrt(O*O+N*N+B*B)<.999){var W=this.id+".camera.up",G={x:0,y:0,z:1},K={};K[W]=G;var te=R.layout;h.call("_storeDirectGUIEdit",te,F._preGUI,K),D.up=G,d.nestedProperty(te,W).set(G)}}else L.keyBindingMode=S;this.fullSceneLayout.hovermode=P},w.toImage=function(S){S||(S="png"),this.staticMode&&this.container.appendChild(r),this.glplot.redraw();var P=this.glplot.gl,L=P.drawingBufferWidth,R=P.drawingBufferHeight;P.bindFramebuffer(P.FRAMEBUFFER,null);var F=new Uint8Array(L*R*4);P.readPixels(0,0,L,R,P.RGBA,P.UNSIGNED_BYTE,F),function(W,G,K){for(var te=0,Y=K-1;te0)for(var U=255/re,V=0;V<3;++V)W[J+V]=Math.min(U*W[J+V],255)}}(F,L,R);var D=document.createElement("canvas");D.width=L,D.height=R;var O,N=D.getContext("2d"),B=N.createImageData(L,R);switch(B.data.set(F),N.putImageData(B,0,0),S){case"jpeg":O=D.toDataURL("image/jpeg");break;case"webp":O=D.toDataURL("image/webp");break;default:O=D.toDataURL("image/png")}return this.staticMode&&this.container.removeChild(r),O},w.setConvert=function(){for(var S=0;S<3;S++){var P=this.fullSceneLayout[T[S]];p.setConvert(P,this.fullLayout),P.setScale=d.noop}},w.make4thDimension=function(){var S=this.graphDiv._fullLayout;this._mockAxis={type:"linear",showexponent:"all",exponentformat:"B"},p.setConvert(this._mockAxis,S)},o.exports=k},{"../../../stackgl_modules":1124,"../../components/fx":406,"../../lib":503,"../../lib/show_no_webgl_msg":525,"../../lib/str2rgbarray":528,"../../plots/cartesian/axes":554,"../../registry":638,"./layout/convert":602,"./layout/spikes":605,"./layout/tick_marks":606,"./project":607,"has-passive-events":229,"webgl-context":331}],609:[function(t,o,f){o.exports=function(r,a,l,c){c=c||r.length;for(var i=new Array(c),s=0;sOpenStreetMap contributors',l=['© Carto',a].join(" "),c=['Map tiles by Stamen Design','under CC BY 3.0',"|",'Data by OpenStreetMap contributors','under ODbL'].join(" "),i={"open-street-map":{id:"osm",version:8,sources:{"plotly-osm-tiles":{type:"raster",attribution:a,tiles:["https://a.tile.openstreetmap.org/{z}/{x}/{y}.png","https://b.tile.openstreetmap.org/{z}/{x}/{y}.png"],tileSize:256}},layers:[{id:"plotly-osm-tiles",type:"raster",source:"plotly-osm-tiles",minzoom:0,maxzoom:22}]},"white-bg":{id:"white-bg",version:8,sources:{},layers:[{id:"white-bg",type:"background",paint:{"background-color":"#FFFFFF"},minzoom:0,maxzoom:22}]},"carto-positron":{id:"carto-positron",version:8,sources:{"plotly-carto-positron":{type:"raster",attribution:l,tiles:["https://cartodb-basemaps-c.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png"],tileSize:256}},layers:[{id:"plotly-carto-positron",type:"raster",source:"plotly-carto-positron",minzoom:0,maxzoom:22}]},"carto-darkmatter":{id:"carto-darkmatter",version:8,sources:{"plotly-carto-darkmatter":{type:"raster",attribution:l,tiles:["https://cartodb-basemaps-c.global.ssl.fastly.net/dark_all/{z}/{x}/{y}.png"],tileSize:256}},layers:[{id:"plotly-carto-darkmatter",type:"raster",source:"plotly-carto-darkmatter",minzoom:0,maxzoom:22}]},"stamen-terrain":{id:"stamen-terrain",version:8,sources:{"plotly-stamen-terrain":{type:"raster",attribution:c,tiles:["https://stamen-tiles.a.ssl.fastly.net/terrain/{z}/{x}/{y}.png"],tileSize:256}},layers:[{id:"plotly-stamen-terrain",type:"raster",source:"plotly-stamen-terrain",minzoom:0,maxzoom:22}]},"stamen-toner":{id:"stamen-toner",version:8,sources:{"plotly-stamen-toner":{type:"raster",attribution:c,tiles:["https://stamen-tiles.a.ssl.fastly.net/toner/{z}/{x}/{y}.png"],tileSize:256}},layers:[{id:"plotly-stamen-toner",type:"raster",source:"plotly-stamen-toner",minzoom:0,maxzoom:22}]},"stamen-watercolor":{id:"stamen-watercolor",version:8,sources:{"plotly-stamen-watercolor":{type:"raster",attribution:['Map tiles by Stamen Design','under CC BY 3.0',"|",'Data by OpenStreetMap contributors','under CC BY SA'].join(" "),tiles:["https://stamen-tiles.a.ssl.fastly.net/watercolor/{z}/{x}/{y}.png"],tileSize:256}},layers:[{id:"plotly-stamen-watercolor",type:"raster",source:"plotly-stamen-watercolor",minzoom:0,maxzoom:22}]}},s=r(i);o.exports={requiredVersion:"1.10.1",styleUrlPrefix:"mapbox://styles/mapbox/",styleUrlSuffix:"v9",styleValuesMapbox:["basic","streets","outdoors","light","dark","satellite","satellite-streets"],styleValueDflt:"basic",stylesNonMapbox:i,styleValuesNonMapbox:s,traceLayerPrefix:"plotly-trace-layer-",layoutLayerPrefix:"plotly-layout-layer-",wrongVersionErrorMsg:["Your custom plotly.js bundle is not using the correct mapbox-gl version","Please install mapbox-gl@1.10.1."].join(` -`),noAccessTokenErrorMsg:["Missing Mapbox access token.","Mapbox trace type require a Mapbox access token to be registered.","For example:"," Plotly.newPlot(gd, data, layout, { mapboxAccessToken: 'my-access-token' });","More info here: https://www.mapbox.com/help/define-access-token/"].join(` -`),missingStyleErrorMsg:["No valid mapbox style found, please set `mapbox.style` to one of:",s.join(", "),"or register a Mapbox access token to use a Mapbox-served style."].join(` -`),multipleTokensErrorMsg:["Set multiple mapbox access token across different mapbox subplot,","using first token found as mapbox-gl does not allow multipleaccess tokens on the same page."].join(` -`),mapOnErrorMsg:"Mapbox error.",mapboxLogo:{path0:"m 10.5,1.24 c -5.11,0 -9.25,4.15 -9.25,9.25 0,5.1 4.15,9.25 9.25,9.25 5.1,0 9.25,-4.15 9.25,-9.25 0,-5.11 -4.14,-9.25 -9.25,-9.25 z m 4.39,11.53 c -1.93,1.93 -4.78,2.31 -6.7,2.31 -0.7,0 -1.41,-0.05 -2.1,-0.16 0,0 -1.02,-5.64 2.14,-8.81 0.83,-0.83 1.95,-1.28 3.13,-1.28 1.27,0 2.49,0.51 3.39,1.42 1.84,1.84 1.89,4.75 0.14,6.52 z",path1:"M 10.5,-0.01 C 4.7,-0.01 0,4.7 0,10.49 c 0,5.79 4.7,10.5 10.5,10.5 5.8,0 10.5,-4.7 10.5,-10.5 C 20.99,4.7 16.3,-0.01 10.5,-0.01 Z m 0,19.75 c -5.11,0 -9.25,-4.15 -9.25,-9.25 0,-5.1 4.14,-9.26 9.25,-9.26 5.11,0 9.25,4.15 9.25,9.25 0,5.13 -4.14,9.26 -9.25,9.26 z",path2:"M 14.74,6.25 C 12.9,4.41 9.98,4.35 8.23,6.1 5.07,9.27 6.09,14.91 6.09,14.91 c 0,0 5.64,1.02 8.81,-2.14 C 16.64,11 16.59,8.09 14.74,6.25 Z m -2.27,4.09 -0.91,1.87 -0.9,-1.87 -1.86,-0.91 1.86,-0.9 0.9,-1.87 0.91,1.87 1.86,0.9 z",polygon:"11.56,12.21 10.66,10.34 8.8,9.43 10.66,8.53 11.56,6.66 12.47,8.53 14.33,9.43 12.47,10.34"},styleRules:{map:"overflow:hidden;position:relative;","missing-css":"display:none;",canary:"background-color:salmon;","ctrl-bottom-left":"position: absolute; pointer-events: none; z-index: 2; bottom: 0; left: 0;","ctrl-bottom-right":"position: absolute; pointer-events: none; z-index: 2; right: 0; bottom: 0;",ctrl:"clear: both; pointer-events: auto; transform: translate(0, 0);","ctrl-attrib.mapboxgl-compact .mapboxgl-ctrl-attrib-inner":"display: none;","ctrl-attrib.mapboxgl-compact:hover .mapboxgl-ctrl-attrib-inner":"display: block; margin-top:2px","ctrl-attrib.mapboxgl-compact:hover":"padding: 2px 24px 2px 4px; visibility: visible; margin-top: 6px;","ctrl-attrib.mapboxgl-compact::after":`content: ""; cursor: pointer; position: absolute; background-image: url('data:image/svg+xml;charset=utf-8,%3Csvg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"%3E %3Cpath fill="%23333333" fill-rule="evenodd" d="M4,10a6,6 0 1,0 12,0a6,6 0 1,0 -12,0 M9,7a1,1 0 1,0 2,0a1,1 0 1,0 -2,0 M9,10a1,1 0 1,1 2,0l0,3a1,1 0 1,1 -2,0"/%3E %3C/svg%3E'); background-color: rgba(255, 255, 255, 0.5); width: 24px; height: 24px; box-sizing: border-box; border-radius: 12px;`,"ctrl-attrib.mapboxgl-compact":"min-height: 20px; padding: 0; margin: 10px; position: relative; background-color: #fff; border-radius: 3px 12px 12px 3px;","ctrl-bottom-right > .mapboxgl-ctrl-attrib.mapboxgl-compact::after":"bottom: 0; right: 0","ctrl-bottom-left > .mapboxgl-ctrl-attrib.mapboxgl-compact::after":"bottom: 0; left: 0","ctrl-bottom-left .mapboxgl-ctrl":"margin: 0 0 10px 10px; float: left;","ctrl-bottom-right .mapboxgl-ctrl":"margin: 0 10px 10px 0; float: right;","ctrl-attrib":"color: rgba(0, 0, 0, 0.75); text-decoration: none; font-size: 12px","ctrl-attrib a":"color: rgba(0, 0, 0, 0.75); text-decoration: none; font-size: 12px","ctrl-attrib a:hover":"color: inherit; text-decoration: underline;","ctrl-attrib .mapbox-improve-map":"font-weight: bold; margin-left: 2px;","attrib-empty":"display: none;","ctrl-logo":`display:block; width: 21px; height: 21px; background-image: url('data:image/svg+xml;charset=utf-8,%3C?xml version="1.0" encoding="utf-8"?%3E %3Csvg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 21 21" style="enable-background:new 0 0 21 21;" xml:space="preserve"%3E%3Cg transform="translate(0,0.01)"%3E%3Cpath d="m 10.5,1.24 c -5.11,0 -9.25,4.15 -9.25,9.25 0,5.1 4.15,9.25 9.25,9.25 5.1,0 9.25,-4.15 9.25,-9.25 0,-5.11 -4.14,-9.25 -9.25,-9.25 z m 4.39,11.53 c -1.93,1.93 -4.78,2.31 -6.7,2.31 -0.7,0 -1.41,-0.05 -2.1,-0.16 0,0 -1.02,-5.64 2.14,-8.81 0.83,-0.83 1.95,-1.28 3.13,-1.28 1.27,0 2.49,0.51 3.39,1.42 1.84,1.84 1.89,4.75 0.14,6.52 z" style="opacity:0.9;fill:%23ffffff;enable-background:new" class="st0"/%3E%3Cpath d="M 10.5,-0.01 C 4.7,-0.01 0,4.7 0,10.49 c 0,5.79 4.7,10.5 10.5,10.5 5.8,0 10.5,-4.7 10.5,-10.5 C 20.99,4.7 16.3,-0.01 10.5,-0.01 Z m 0,19.75 c -5.11,0 -9.25,-4.15 -9.25,-9.25 0,-5.1 4.14,-9.26 9.25,-9.26 5.11,0 9.25,4.15 9.25,9.25 0,5.13 -4.14,9.26 -9.25,9.26 z" style="opacity:0.35;enable-background:new" class="st1"/%3E%3Cpath d="M 14.74,6.25 C 12.9,4.41 9.98,4.35 8.23,6.1 5.07,9.27 6.09,14.91 6.09,14.91 c 0,0 5.64,1.02 8.81,-2.14 C 16.64,11 16.59,8.09 14.74,6.25 Z m -2.27,4.09 -0.91,1.87 -0.9,-1.87 -1.86,-0.91 1.86,-0.9 0.9,-1.87 0.91,1.87 1.86,0.9 z" style="opacity:0.35;enable-background:new" class="st1"/%3E%3Cpolygon points="11.56,12.21 10.66,10.34 8.8,9.43 10.66,8.53 11.56,6.66 12.47,8.53 14.33,9.43 12.47,10.34 " style="opacity:0.9;fill:%23ffffff;enable-background:new" class="st0"/%3E%3C/g%3E%3C/svg%3E')`}}},{"../../lib/sort_object_keys":526}],612:[function(t,o,f){var r=t("../../lib");o.exports=function(a,l){var c=a.split(" "),i=c[0],s=c[1],u=r.isArrayOrTypedArray(l)?r.mean(l):l,h=.5+u/100,d=1.5+u/100,m=["",""],p=[0,0];switch(i){case"top":m[0]="top",p[1]=-d;break;case"bottom":m[0]="bottom",p[1]=d}switch(s){case"left":m[1]="right",p[0]=-h;break;case"right":m[1]="left",p[0]=h}return{anchor:m[0]&&m[1]?m.join("-"):m[0]?m[0]:m[1]?m[1]:"center",offset:p}}},{"../../lib":503}],613:[function(t,o,f){var r=t("mapbox-gl/dist/mapbox-gl-unminified"),a=t("../../lib"),l=a.strTranslate,c=a.strScale,i=t("../../plots/get_data").getSubplotCalcData,s=t("../../constants/xmlns_namespaces"),u=t("@plotly/d3"),h=t("../../components/drawing"),d=t("../../lib/svg_text_utils"),m=t("./mapbox"),p=f.constants=t("./constants");function g(y){return typeof y=="string"&&(p.styleValuesMapbox.indexOf(y)!==-1||y.indexOf("mapbox://")===0)}f.name="mapbox",f.attr="subplot",f.idRoot="mapbox",f.idRegex=f.attrRegex=a.counterRegex("mapbox"),f.attributes={subplot:{valType:"subplotid",dflt:"mapbox",editType:"calc"}},f.layoutAttributes=t("./layout_attributes"),f.supplyLayoutDefaults=t("./layout_defaults"),f.plot=function(y){var v=y._fullLayout,x=y.calcdata,_=v._subplots.mapbox;if(r.version!==p.requiredVersion)throw new Error(p.wrongVersionErrorMsg);var A=function(E,S){var P=E._fullLayout;if(E._context.mapboxAccessToken==="")return"";for(var L=[],R=[],F=!1,D=!1,O=0;O1&&a.warn(p.multipleTokensErrorMsg),L[0]):(R.length&&a.log(["Listed mapbox access token(s)",R.join(","),"but did not use a Mapbox map style, ignoring token(s)."].join(" ")),"")}(y,_);r.accessToken=A;for(var b=0;b<_.length;b++){var k=_[b],w=i(x,"mapbox",k),M=v[k],T=M._subplot;T||(T=new m(y,k),v[k]._subplot=T),T.viewInitial||(T.viewInitial={center:a.extendFlat({},M.center),zoom:M.zoom,bearing:M.bearing,pitch:M.pitch}),T.plot(w,v,y._promises)}},f.clean=function(y,v,x,_){for(var A=_._subplots.mapbox||[],b=0;bR/2){var F=E.split("|").join("
    ");P.text(F).attr("data-unformatted",F).call(d.convertToTspans,y),L=h.bBox(P.node())}P.attr("transform",l(-3,8-L.height)),S.insert("rect",".static-attribution").attr({x:-L.width-6,y:-L.height-3,width:L.width+6,height:L.height+3,fill:"rgba(255, 255, 255, 0.75)"});var D=1;L.width+6>R&&(D=R/(L.width+6));var O=[_.l+_.w*k.x[1],_.t+_.h*(1-k.y[0])];S.attr("transform",l(O[0],O[1])+c(D))}},f.updateFx=function(y){for(var v=y._fullLayout,x=v._subplots.mapbox,_=0;_0){for(var p=0;p0}function h(d){var m={},p={};switch(d.type){case"circle":r.extendFlat(p,{"circle-radius":d.circle.radius,"circle-color":d.color,"circle-opacity":d.opacity});break;case"line":r.extendFlat(p,{"line-width":d.line.width,"line-color":d.color,"line-opacity":d.opacity,"line-dasharray":d.line.dash});break;case"fill":r.extendFlat(p,{"fill-color":d.color,"fill-outline-color":d.fill.outlinecolor,"fill-opacity":d.opacity});break;case"symbol":var g=d.symbol,y=l(g.textposition,g.iconsize);r.extendFlat(m,{"icon-image":g.icon+"-15","icon-size":g.iconsize/10,"text-field":g.text,"text-size":g.textfont.size,"text-anchor":y.anchor,"text-offset":y.offset,"symbol-placement":g.placement}),r.extendFlat(p,{"icon-color":d.color,"text-color":g.textfont.color,"text-opacity":d.opacity});break;case"raster":r.extendFlat(p,{"raster-fade-duration":0,"raster-opacity":d.opacity})}return{layout:m,paint:p}}s.update=function(d){this.visible?this.needsNewImage(d)?this.updateImage(d):this.needsNewSource(d)?(this.removeLayer(),this.updateSource(d),this.updateLayer(d)):this.needsNewLayer(d)?this.updateLayer(d):this.updateStyle(d):(this.updateSource(d),this.updateLayer(d)),this.visible=u(d)},s.needsNewImage=function(d){return this.subplot.map.getSource(this.idSource)&&this.sourceType==="image"&&d.sourcetype==="image"&&(this.source!==d.source||JSON.stringify(this.coordinates)!==JSON.stringify(d.coordinates))},s.needsNewSource=function(d){return this.sourceType!==d.sourcetype||JSON.stringify(this.source)!==JSON.stringify(d.source)||this.layerType!==d.type},s.needsNewLayer=function(d){return this.layerType!==d.type||this.below!==this.subplot.belowLookup["layout-"+this.index]},s.lookupBelow=function(){return this.subplot.belowLookup["layout-"+this.index]},s.updateImage=function(d){this.subplot.map.getSource(this.idSource).updateImage({url:d.source,coordinates:d.coordinates});var m=this.findFollowingMapboxLayerId(this.lookupBelow());m!==null&&this.subplot.map.moveLayer(this.idLayer,m)},s.updateSource=function(d){var m=this.subplot.map;if(m.getSource(this.idSource)&&m.removeSource(this.idSource),this.sourceType=d.sourcetype,this.source=d.source,u(d)){var p=function(g){var y,v=g.sourcetype,x=g.source,_={type:v};return v==="geojson"?y="data":v==="vector"?y=typeof x=="string"?"url":"tiles":v==="raster"?(y="tiles",_.tileSize=256):v==="image"&&(y="url",_.coordinates=g.coordinates),_[y]=x,g.sourceattribution&&(_.attribution=a(g.sourceattribution)),_}(d);m.addSource(this.idSource,p)}},s.findFollowingMapboxLayerId=function(d){if(d==="traces")for(var m=this.subplot.getMapLayers(),p=0;p1)for(L=0;L-1&&x(B.originalEvent,R,[L.xaxis],[L.yaxis],L.id,N),W.indexOf("event")>-1&&u.click(R,B.originalEvent)}}},k.updateFx=function(S){var P=this,L=P.map,R=P.gd;if(!P.isStatic){var F,D=S.dragmode;F=d(D)?function(B,W){(B.range={})[P.id]=[N([W.xmin,W.ymin]),N([W.xmax,W.ymax])]}:function(B,W,G){(B.lassoPoints={})[P.id]=G.filtered.map(N)};var O=P.dragOptions;P.dragOptions=a.extendDeep(O||{},{dragmode:S.dragmode,element:P.div,gd:R,plotinfo:{id:P.id,domain:S[P.id].domain,xaxis:P.xaxis,yaxis:P.yaxis,fillRangeItems:F},xaxes:[P.xaxis],yaxes:[P.yaxis],subplot:P.id}),L.off("click",P.onClickInPanHandler),p(D)||m(D)?(L.dragPan.disable(),L.on("zoomstart",P.clearSelect),P.dragOptions.prepFn=function(B,W,G){g(B,W,G,P.dragOptions,D)},s.init(P.dragOptions)):(L.dragPan.enable(),L.off("zoomstart",P.clearSelect),P.div.onmousedown=null,P.onClickInPanHandler=P.onClickInPanFn(P.dragOptions),L.on("click",P.onClickInPanHandler))}function N(B){var W=P.map.unproject(B);return[W.lng,W.lat]}},k.updateFramework=function(S){var P=S[this.id].domain,L=S._size,R=this.div.style;R.width=L.w*(P.x[1]-P.x[0])+"px",R.height=L.h*(P.y[1]-P.y[0])+"px",R.left=L.l+P.x[0]*L.w+"px",R.top=L.t+(1-P.y[1])*L.h+"px",this.xaxis._offset=L.l+P.x[0]*L.w,this.xaxis._length=L.w*(P.x[1]-P.x[0]),this.yaxis._offset=L.t+(1-P.y[1])*L.h,this.yaxis._length=L.h*(P.y[1]-P.y[0])},k.updateLayers=function(S){var P,L=S[this.id].layers,R=this.layerList;if(L.length!==R.length){for(P=0;P=K.width-20?(J["text-anchor"]="start",J.x=5):(J["text-anchor"]="end",J.x=K._paper.attr("width")-7),te.attr(J);var re=te.select(".js-link-to-tool"),U=te.select(".js-link-spacer"),V=te.select(".js-sourcelinks");G._context.showSources&&G._context.showSources(G),G._context.showLink&&function(H,ne){ne.text("");var q=ne.append("a").attr({"xlink:xlink:href":"#",class:"link--impt link--embedview","font-weight":"bold"}).text(H._context.linkText+" "+String.fromCharCode(187));if(H._context.sendData)q.on("click",function(){b.sendDataToCloud(H)});else{var Q=window.location.pathname.split("/"),ee=window.location.search;q.attr({"xlink:xlink:show":"new","xlink:xlink:href":"/"+Q[2].split(".")[0]+"/"+Q[1]+ee})}}(G,re),U.text(re.text()&&V.text()?" - ":"")}},b.sendDataToCloud=function(G){var K=(window.PLOTLYENV||{}).BASE_URL||G._context.plotlyServerURL;if(K){G.emit("plotly_beforeexport");var te=r.select(G).append("div").attr("id","hiddenform").style("display","none"),Y=te.append("form").attr({action:K+"/external",method:"post",target:"_blank"});return Y.append("input").attr({type:"text",name:"data"}).node().value=b.graphJson(G,!1,"keepdata"),Y.node().submit(),te.remove(),G.emit("plotly_afterexport"),!1}};var M=["days","shortDays","months","shortMonths","periods","dateTime","date","time","decimal","thousands","grouping","currency"],T=["year","month","dayMonth","dayMonthYear"];function E(G,K){var te=G._context.locale;te||(te="en-US");var Y=!1,J={};function re(Q){for(var ee=!0,ie=0;ie1&&ke.length>1){for(i.getComponentMethod("grid","sizeDefaults")(U,re),J=0;J15&&ke.length>15&&re.shapes.length===0&&re.images.length===0,b.linkSubplots(H,re,V,Y),b.cleanPlot(H,re,V,Y);var we=!(!Y._has||!Y._has("gl2d")),Ce=!(!re._has||!re._has("gl2d")),Fe=!(!Y._has||!Y._has("cartesian"))||we,ze=!(!re._has||!re._has("cartesian"))||Ce;Fe&&!ze?Y._bgLayer.remove():ze&&!Fe&&(re._shouldCreateBgLayer=!0),Y._zoomlayer&&!G._dragging&&g({_fullLayout:Y}),function(Ve,We){var Ye,nt=[];We.meta&&(Ye=We._meta={meta:We.meta,layout:{meta:We.meta}});for(var ft=0;ft0){var ne=1-2*U;Y=Math.round(ne*Y),J=Math.round(ne*J)}}var q=b.layoutAttributes.width.min,Q=b.layoutAttributes.height.min;Y1,ie=!K.height&&Math.abs(te.height-J)>1;(ie||ee)&&(ee&&(te.width=Y),ie&&(te.height=J)),G._initialAutoSize||(G._initialAutoSize={width:Y,height:J}),b.sanitizeMargins(te)},b.supplyLayoutModuleDefaults=function(G,K,te,Y){var J,re,U,V=i.componentsRegistry,H=K._basePlotModules,ne=i.subplotsRegistry.cartesian;for(J in V)(U=V[J]).includeBasePlot&&U.includeBasePlot(G,K);for(var q in H.length||H.push(ne),K._has("cartesian")&&(i.getComponentMethod("grid","contentDefaults")(G,K),ne.finalizeSubplots(G,K)),K._subplots)K._subplots[q].sort(h.subplotSort);for(re=0;re1&&(te.l/=ae,te.r/=ae)}if(q){var ue=(te.t+te.b)/q;ue>1&&(te.t/=ue,te.b/=ue)}var le=te.xl!==void 0?te.xl:te.x,ge=te.xr!==void 0?te.xr:te.x,fe=te.yt!==void 0?te.yt:te.y,me=te.yb!==void 0?te.yb:te.y;Q[K]={l:{val:le,size:te.l+ie},r:{val:ge,size:te.r+ie},b:{val:me,size:te.b+ie},t:{val:fe,size:te.t+ie}},ee[K]=1}else delete Q[K],delete ee[K];if(!Y._replotting)return b.doAutoMargin(G)}},b.doAutoMargin=function(G){var K=G._fullLayout,te=K.width,Y=K.height;K._size||(K._size={}),F(K);var J=K._size,re=K.margin,U=h.extendFlat({},J),V=re.l,H=re.r,ne=re.t,q=re.b,Q=K._pushmargin,ee=K._pushmarginIds;if(K.margin.autoexpand!==!1){for(var ie in Q)ee[ie]||delete Q[ie];for(var ae in Q.base={l:{val:0,size:V},r:{val:1,size:H},t:{val:1,size:ne},b:{val:0,size:q}},Q){var ue=Q[ae].l||{},le=Q[ae].b||{},ge=ue.val,fe=ue.size,me=le.val,_e=le.size;for(var Ae in Q){if(c(fe)&&Q[Ae].r){var ke=Q[Ae].r.val,Le=Q[Ae].r.size;if(ke>ge){var de=(fe*ke+(Le-te)*ge)/(ke-ge),ve=(Le*(1-ge)+(fe-te)*(1-ke))/(ke-ge);de+ve>V+H&&(V=de,H=ve)}}if(c(_e)&&Q[Ae].t){var Me=Q[Ae].t.val,we=Q[Ae].t.size;if(Me>me){var Ce=(_e*Me+(we-Y)*me)/(Me-me),Fe=(we*(1-me)+(_e-Y)*(1-Me))/(Me-me);Ce+Fe>q+ne&&(q=Ce,ne=Fe)}}}}}var ze=h.constrain(te-re.l-re.r,2,64),$e=h.constrain(Y-re.t-re.b,2,64),Ke=Math.max(0,te-ze),Re=Math.max(0,Y-$e);if(Ke){var Ve=(V+H)/Ke;Ve>1&&(V/=Ve,H/=Ve)}if(Re){var We=(q+ne)/Re;We>1&&(q/=We,ne/=We)}if(J.l=Math.round(V),J.r=Math.round(H),J.t=Math.round(ne),J.b=Math.round(q),J.p=Math.round(re.pad),J.w=Math.round(te)-J.l-J.r,J.h=Math.round(Y)-J.t-J.b,!K._replotting&&b.didMarginChange(U,J)){"_redrawFromAutoMarginCount"in K?K._redrawFromAutoMarginCount++:K._redrawFromAutoMarginCount=1;var Ye=3*(1+Object.keys(ee).length);if(K._redrawFromAutoMarginCount0&&(G._transitioningWithDuration=!0),G._transitionData._interruptCallbacks.push(function(){Y=!0}),te.redraw&&G._transitionData._interruptCallbacks.push(function(){return i.call("redraw",G)}),G._transitionData._interruptCallbacks.push(function(){G.emit("plotly_transitioninterrupted",[])});var V=0,H=0;function ne(){return V++,function(){H++,Y||H!==V||function(q){G._transitionData&&(function(Q){if(Q)for(;Q.length;)Q.shift()}(G._transitionData._interruptCallbacks),Promise.resolve().then(function(){if(te.redraw)return i.call("redraw",G)}).then(function(){G._transitioning=!1,G._transitioningWithDuration=!1,G.emit("plotly_transitioned",[])}).then(q))}(U)}}te.runFn(ne),setTimeout(ne())})}],re=h.syncOrAsync(J,G);return re&&re.then||(re=Promise.resolve()),re.then(function(){return G})}b.didMarginChange=function(G,K){for(var te=0;te1)return!0}return!1},b.graphJson=function(G,K,te,Y,J,re){(J&&K&&!G._fullData||J&&!K&&!G._fullLayout)&&b.supplyDefaults(G);var U=J?G._fullData:G.data,V=J?G._fullLayout:G.layout,H=(G._transitionData||{})._frames;function ne(ee,ie){if(typeof ee=="function")return ie?"_function_":null;if(h.isPlainObject(ee)){var ae,ue={};return Object.keys(ee).sort().forEach(function(le){if(["_","["].indexOf(le.charAt(0))===-1)if(typeof ee[le]!="function"){if(te==="keepdata"){if(le.substr(le.length-3)==="src")return}else if(te==="keepstream"){if(typeof(ae=ee[le+"src"])=="string"&&ae.indexOf(":")>0&&!h.isPlainObject(ee.stream))return}else if(te!=="keepall"&&typeof(ae=ee[le+"src"])=="string"&&ae.indexOf(":")>0)return;ue[le]=ne(ee[le],ie)}else ie&&(ue[le]="_function")}),ue}return Array.isArray(ee)?ee.map(function(le){return ne(le,ie)}):h.isTypedArray(ee)?h.simpleMap(ee,h.identity):h.isJSDate(ee)?h.ms2DateTimeLocal(+ee):ee}var q={data:(U||[]).map(function(ee){var ie=ne(ee);return K&&delete ie.fit,ie})};if(!K&&(q.layout=ne(V),J)){var Q=V._size;q.layout.computed={margin:{b:Q.b,l:Q.l,r:Q.r,t:Q.t}}}return H&&(q.frames=ne(H)),re&&(q.config=ne(G._context,!0)),Y==="object"?q:JSON.stringify(q)},b.modifyFrames=function(G,K){var te,Y,J,re=G._transitionData._frames,U=G._transitionData._frameHash;for(te=0;te=0;re--)if(Ae[re].enabled){te._indexToPoints=Ae[re]._indexToPoints;break}Y&&Y.calc&&(_e=Y.calc(G,te))}Array.isArray(_e)&&_e[0]||(_e=[{x:m,y:m}]),_e[0].t||(_e[0].t={}),_e[0].trace=te,ne[fe]=_e}}for(B(U,V,H),J=0;J1e-10?p:0}function m(p,g,y){g=g||0,y=y||0;for(var v=p.length,x=new Array(v),_=0;_0?_:1/0}),v=r.mod(y+1,g.length);return[g[y],g[v]]},findIntersectionXY:u,findXYatLength:function(p,g,y,v){var x=-g*y,_=g*g+1,A=2*(g*x-y),b=x*x+y*y-p*p,k=Math.sqrt(A*A-4*_*b),w=(-A+k)/(2*_),M=(-A-k)/(2*_);return[[w,g*w+x+v],[M,g*M+x+v]]},clampTiny:d,pathPolygon:function(p,g,y,v,x,_){return"M"+m(h(p,g,y,v),x,_).join("L")},pathPolygonAnnulus:function(p,g,y,v,x,_,A){var b,k;p=90||Jt>90&&Be>=450?1:kt<=0&&Oe<=0?0:Math.max(kt,Oe),Ot=Jt<=180&&Be>=180||Jt>180&&Be>=540?-1:Ge>=0&&dt>=0?0:Math.min(Ge,dt),Tt=Jt<=270&&Be>=270||Jt>270&&Be>=630?-1:kt>=0&&Oe>=0?0:Math.min(kt,Oe),at=Be>=360?1:Ge<=0&&dt<=0?0:Math.max(Ge,dt),[Ot,Tt,at,et]}(ge),de=Le[2]-Le[0],ve=Le[3]-Le[1],Me=le/ue,we=Math.abs(ve/de);Me>we?(fe=ue,ke=(le-(me=ue*we))/q.h/2,_e=[ie[0],ie[1]],Ae=[ae[0]+ke,ae[1]-ke]):(me=le,ke=(ue-(fe=le/we))/q.w/2,_e=[ie[0]+ke,ie[1]-ke],Ae=[ae[0],ae[1]]),this.xLength2=fe,this.yLength2=me,this.xDomain2=_e,this.yDomain2=Ae;var Ce,Fe=this.xOffset2=q.l+q.w*_e[0],ze=this.yOffset2=q.t+q.h*(1-Ae[1]),$e=this.radius=fe/de,Ke=this.innerRadius=this.getHole(H)*$e,Re=this.cx=Fe-$e*Le[0],Ve=this.cy=ze+$e*Le[3],We=this.cxx=Re-Fe,Ye=this.cyy=Ve-ze,nt=Q.side;nt==="counterclockwise"?(Ce=nt,nt="top"):nt==="clockwise"&&(Ce=nt,nt="bottom"),this.radialAxis=this.mockAxis(V,H,Q,{_id:"x",side:nt,_trueSide:Ce,domain:[Ke/q.w,$e/q.w]}),this.angularAxis=this.mockAxis(V,H,ee,{side:"right",domain:[0,Math.PI],autorange:!1}),this.doAutoRange(V,H),this.updateAngularAxis(V,H),this.updateRadialAxis(V,H),this.updateRadialAxisTitle(V,H),this.xaxis=this.mockCartesianAxis(V,H,{_id:"x",domain:_e}),this.yaxis=this.mockCartesianAxis(V,H,{_id:"y",domain:Ae});var ft=this.pathSubplot();this.clipPaths.forTraces.select("path").attr("d",ft).attr("transform",s(We,Ye)),ne.frontplot.attr("transform",s(Fe,ze)).call(h.setClipUrl,this._hasClipOnAxisFalse?null:this.clipIds.forTraces,this.gd),ne.bg.attr("d",ft).attr("transform",s(Re,Ve)).call(u.fill,H.bgcolor)},Y.mockAxis=function(V,H,ne,q){var Q=c.extendFlat({},ne,q);return g(Q,H,V),Q},Y.mockCartesianAxis=function(V,H,ne){var q=this,Q=q.isSmith,ee=ne._id,ie=c.extendFlat({type:"linear"},ne);p(ie,V);var ae={x:[0,2],y:[1,3]};return ie.setRange=function(){var ue=q.sectorBBox,le=ae[ee],ge=q.radialAxis._rl,fe=(ge[1]-ge[0])/(1-q.getHole(H));ie.range=[ue[le[0]]*fe,ue[le[1]]*fe]},ie.isPtWithinRange=ee!=="x"||Q?function(){return!0}:function(ue){return q.isPtInside(ue)},ie.setRange(),ie.setScale(),ie},Y.doAutoRange=function(V,H){var ne=this.gd,q=this.radialAxis,Q=this.getRadial(H);y(ne,q);var ee=q.range;Q.range=ee.slice(),Q._input.range=ee.slice(),q._rl=[q.r2l(ee[0],null,"gregorian"),q.r2l(ee[1],null,"gregorian")]},Y.updateRadialAxis=function(V,H){var ne=this,q=ne.gd,Q=ne.layers,ee=ne.radius,ie=ne.innerRadius,ae=ne.cx,ue=ne.cy,le=ne.getRadial(H),ge=W(ne.getSector(H)[0],360),fe=ne.radialAxis,me=ie90&&ge<=270&&(fe.tickangle=180);var Ae=_e?function($e){var Ke=N(ne,F([$e.x,0]));return s(Ke[0]-ae,Ke[1]-ue)}:function($e){return s(fe.l2p($e.x)+ie,0)},ke=_e?function($e){return O(ne,$e.x,-1/0,1/0)}:function($e){return ne.pathArc(fe.r2p($e.x)+ie)},Le=J(le);if(ne.radialTickLayout!==Le&&(Q["radial-axis"].selectAll(".xtick").remove(),ne.radialTickLayout=Le),me){fe.setScale();var de=0,ve=_e?(fe.tickvals||[]).filter(function($e){return $e>=0}).map(function($e){return m.tickText(fe,$e,!0,!1)}):m.calcTicks(fe),Me=_e?ve:m.clipEnds(fe,ve),we=m.getTickSigns(fe)[2];_e&&((fe.ticks==="top"&&fe.side==="bottom"||fe.ticks==="bottom"&&fe.side==="top")&&(we=-we),fe.ticks==="top"&&fe.side==="top"&&(de=-fe.ticklen),fe.ticks==="bottom"&&fe.side==="bottom"&&(de=fe.ticklen)),m.drawTicks(q,fe,{vals:ve,layer:Q["radial-axis"],path:m.makeTickPath(fe,0,we),transFn:Ae,crisp:!1}),m.drawGrid(q,fe,{vals:Me,layer:Q["radial-grid"],path:ke,transFn:c.noop,crisp:!1}),m.drawLabels(q,fe,{vals:ve,layer:Q["radial-axis"],transFn:Ae,labelFns:m.makeLabelFns(fe,de)})}var Ce=ne.radialAxisAngle=ne.vangles?K(re(G(le.angle),ne.vangles)):le.angle,Fe=s(ae,ue),ze=Fe+i(-Ce);U(Q["radial-axis"],me&&(le.showticklabels||le.ticks),{transform:ze}),U(Q["radial-grid"],me&&le.showgrid,{transform:_e?"":Fe}),U(Q["radial-line"].select("line"),me&&le.showline,{x1:_e?-ee:ie,y1:0,x2:ee,y2:0,transform:ze}).attr("stroke-width",le.linewidth).call(u.stroke,le.linecolor)},Y.updateRadialAxisTitle=function(V,H,ne){if(!this.isSmith){var q=this.gd,Q=this.radius,ee=this.cx,ie=this.cy,ae=this.getRadial(H),ue=this.id+"title",le=0;if(ae.title){var ge=h.bBox(this.layers["radial-axis"].node()).height,fe=ae.title.font.size,me=ae.side;le=me==="top"?fe:me==="counterclockwise"?-(ge+.4*fe):ge+.8*fe}var _e=ne!==void 0?ne:this.radialAxisAngle,Ae=G(_e),ke=Math.cos(Ae),Le=Math.sin(Ae),de=ee+Q/2*ke+le*Le,ve=ie-Q/2*Le+le*ke;this.layers["radial-axis-title"]=A.draw(q,ue,{propContainer:ae,propName:this.id+".radialaxis.title",placeholder:B(q,"Click to enter radial axis title"),attributes:{x:de,y:ve,"text-anchor":"middle"},transform:{rotate:-_e}})}},Y.updateAngularAxis=function(V,H){var ne=this,q=ne.gd,Q=ne.layers,ee=ne.radius,ie=ne.innerRadius,ae=ne.cx,ue=ne.cy,le=ne.getAngular(H),ge=ne.angularAxis,fe=ne.isSmith;fe||(ne.fillViewInitialKey("angularaxis.rotation",le.rotation),ge.setGeometry(),ge.setScale());var me=fe?function($e){var Ke=N(ne,F([0,$e.x]));return Math.atan2(Ke[0]-ae,Ke[1]-ue)-Math.PI/2}:function($e){return ge.t2g($e.x)};ge.type==="linear"&&ge.thetaunit==="radians"&&(ge.tick0=K(ge.tick0),ge.dtick=K(ge.dtick));var _e=function($e){return s(ae+ee*Math.cos($e),ue-ee*Math.sin($e))},Ae=fe?function($e){var Ke=N(ne,F([0,$e.x]));return s(Ke[0],Ke[1])}:function($e){return _e(me($e))},ke=fe?function($e){var Ke=N(ne,F([0,$e.x])),Re=Math.atan2(Ke[0]-ae,Ke[1]-ue)-Math.PI/2;return s(Ke[0],Ke[1])+i(-K(Re))}:function($e){var Ke=me($e);return _e(Ke)+i(-K(Ke))},Le=fe?function($e){return D(ne,$e.x,0,1/0)}:function($e){var Ke=me($e),Re=Math.cos(Ke),Ve=Math.sin(Ke);return"M"+[ae+ie*Re,ue-ie*Ve]+"L"+[ae+ee*Re,ue-ee*Ve]},de=m.makeLabelFns(ge,0).labelStandoff,ve={xFn:function($e){var Ke=me($e);return Math.cos(Ke)*de},yFn:function($e){var Ke=me($e),Re=Math.sin(Ke)>0?.2:1;return-Math.sin(Ke)*(de+$e.fontSize*Re)+Math.abs(Math.cos(Ke))*($e.fontSize*S)},anchorFn:function($e){var Ke=me($e),Re=Math.cos(Ke);return Math.abs(Re)<.1?"middle":Re>0?"start":"end"},heightFn:function($e,Ke,Re){var Ve=me($e);return-.5*(1+Math.sin(Ve))*Re}},Me=J(le);ne.angularTickLayout!==Me&&(Q["angular-axis"].selectAll("."+ge._id+"tick").remove(),ne.angularTickLayout=Me);var we,Ce=fe?[1/0].concat(ge.tickvals||[]).map(function($e){return m.tickText(ge,$e,!0,!1)}):m.calcTicks(ge);if(fe&&(Ce[0].text="∞",Ce[0].fontSize*=1.75),H.gridshape==="linear"?(we=Ce.map(me),c.angleDelta(we[0],we[1])<0&&(we=we.slice().reverse())):we=null,ne.vangles=we,ge.type==="category"&&(Ce=Ce.filter(function($e){return c.isAngleInsideSector(me($e),ne.sectorInRad)})),ge.visible){var Fe=ge.ticks==="inside"?-1:1,ze=(ge.linewidth||1)/2;m.drawTicks(q,ge,{vals:Ce,layer:Q["angular-axis"],path:"M"+Fe*ze+",0h"+Fe*ge.ticklen,transFn:ke,crisp:!1}),m.drawGrid(q,ge,{vals:Ce,layer:Q["angular-grid"],path:Le,transFn:c.noop,crisp:!1}),m.drawLabels(q,ge,{vals:Ce,layer:Q["angular-axis"],repositionOnUpdate:!0,transFn:Ae,labelFns:ve})}U(Q["angular-line"].select("path"),le.showline,{d:ne.pathSubplot(),transform:s(ae,ue)}).attr("stroke-width",le.linewidth).call(u.stroke,le.linecolor)},Y.updateFx=function(V,H){this.gd._context.staticPlot||(!this.isSmith&&(this.updateAngularDrag(V),this.updateRadialDrag(V,H,0),this.updateRadialDrag(V,H,1)),this.updateHoverAndMainDrag(V))},Y.updateHoverAndMainDrag=function(V){var H,ne,q=this,Q=q.isSmith,ee=q.gd,ie=q.layers,ae=V._zoomlayer,ue=P.MINZOOM,le=P.OFFEDGE,ge=q.radius,fe=q.innerRadius,me=q.cx,_e=q.cy,Ae=q.cxx,ke=q.cyy,Le=q.sectorInRad,de=q.vangles,ve=q.radialAxis,Me=L.clampTiny,we=L.findXYatLength,Ce=L.findEnclosingVertexAngles,Fe=P.cornerHalfWidth,ze=P.cornerLen/2,$e=v.makeDragger(ie,"path","maindrag","crosshair");r.select($e).attr("d",q.pathSubplot()).attr("transform",s(me,_e)),$e.onmousemove=function(rt){_.hover(ee,rt,q.id),ee._fullLayout._lasthover=$e,ee._fullLayout._hoversubplot=q.id},$e.onmouseout=function(rt){ee._dragging||x.unhover(ee,rt)};var Ke,Re,Ve,We,Ye,nt,ft,yt,Ot,Tt={element:$e,gd:ee,subplot:q.id,plotinfo:{id:q.id,xaxis:q.xaxis,yaxis:q.yaxis},xaxes:[q.xaxis],yaxes:[q.yaxis]};function at(rt,lt){return Math.sqrt(rt*rt+lt*lt)}function et(rt,lt){return at(rt-Ae,lt-ke)}function Lt(rt,lt){return Math.atan2(ke-lt,rt-Ae)}function Wt(rt,lt){return[rt*Math.cos(lt),rt*Math.sin(-lt)]}function Jt(rt,lt){if(rt===0)return q.pathSector(2*Fe);var ot=ze/rt,At=lt-ot,wt=lt+ot,$t=Math.max(0,Math.min(rt,ge)),Ut=$t-Fe,tt=$t+Fe;return"M"+Wt(Ut,At)+"A"+[Ut,Ut]+" 0,0,0 "+Wt(Ut,wt)+"L"+Wt(tt,wt)+"A"+[tt,tt]+" 0,0,1 "+Wt(tt,At)+"Z"}function Be(rt,lt,ot){if(rt===0)return q.pathSector(2*Fe);var At,wt,$t=Wt(rt,lt),Ut=Wt(rt,ot),tt=Me(($t[0]+Ut[0])/2),bt=Me(($t[1]+Ut[1])/2);if(tt&&bt){var Ft=bt/tt,Et=-1/Ft,Pt=we(Fe,Ft,tt,bt);At=we(ze,Et,Pt[0][0],Pt[0][1]),wt=we(ze,Et,Pt[1][0],Pt[1][1])}else{var De,Je;bt?(De=ze,Je=Fe):(De=Fe,Je=ze),At=[[tt-De,bt-Je],[tt+De,bt-Je]],wt=[[tt-De,bt+Je],[tt+De,bt+Je]]}return"M"+At.join("L")+"L"+wt.reverse().join("L")+"Z"}function Ge(rt,lt){return lt=Math.max(Math.min(lt,ge),fe),rtue?(rt-1&&rt===1&&k(lt,ee,[q.xaxis],[q.yaxis],q.id,Tt),ot.indexOf("event")>-1&&_.click(ee,lt,q.id)}Tt.prepFn=function(rt,lt,ot){var At=ee._fullLayout.dragmode,wt=$e.getBoundingClientRect();ee._fullLayout._calcInverseTransform(ee);var $t=ee._fullLayout._invTransform;H=ee._fullLayout._invScaleX,ne=ee._fullLayout._invScaleY;var Ut=c.apply3DTransform($t)(lt-wt.left,ot-wt.top);if(Ke=Ut[0],Re=Ut[1],de){var tt=L.findPolygonOffset(ge,Le[0],Le[1],de);Ke+=Ae+tt[0],Re+=ke+tt[1]}switch(At){case"zoom":Tt.clickFn=qe,Q||(Tt.moveFn=de?Ie:dt,Tt.doneFn=Te,function(){Ve=null,We=null,Ye=q.pathSubplot(),nt=!1;var bt=ee._fullLayout[q.id];ft=a(bt.bgcolor).getLuminance(),(yt=v.makeZoombox(ae,ft,me,_e,Ye)).attr("fill-rule","evenodd"),Ot=v.makeCorners(ae,me,_e),w(ee)}());break;case"select":case"lasso":b(rt,lt,ot,Tt,At)}},x.init(Tt)},Y.updateRadialDrag=function(V,H,ne){var q=this,Q=q.gd,ee=q.layers,ie=q.radius,ae=q.innerRadius,ue=q.cx,le=q.cy,ge=q.radialAxis,fe=P.radialDragBoxSize,me=fe/2;if(ge.visible){var _e,Ae,ke,Le=G(q.radialAxisAngle),de=ge._rl,ve=de[0],Me=de[1],we=de[ne],Ce=.75*(de[1]-de[0])/(1-q.getHole(H))/ie;ne?(_e=ue+(ie+me)*Math.cos(Le),Ae=le-(ie+me)*Math.sin(Le),ke="radialdrag"):(_e=ue+(ae-me)*Math.cos(Le),Ae=le-(ae-me)*Math.sin(Le),ke="radialdrag-inner");var Fe,ze,$e,Ke=v.makeRectDragger(ee,ke,"crosshair",-me,-me,fe,fe),Re={element:Ke,gd:Q};U(r.select(Ke),ge.visible&&ae0==(ne?$e>ve:$eg?function(A){return A<=0}:function(A){return A>=0};h.c2g=function(A){var b=h.c2l(A)-p;return(_(b)?b:0)+x},h.g2c=function(A){return h.l2c(A+p-x)},h.g2p=function(A){return A*v},h.c2p=function(A){return h.g2p(h.c2g(A))}}})(i,s);break;case"angularaxis":(function(h,d){var m=h.type;if(m==="linear"){var p=h.d2c,g=h.c2d;h.d2c=function(y,v){return function(x,_){return _==="degrees"?l(x):x}(p(y),v)},h.c2d=function(y,v){return g(function(x,_){return _==="degrees"?c(x):x}(y,v))}}h.makeCalcdata=function(y,v){var x,_,A=y[v],b=y._length,k=function(S){return h.d2c(S,y.thetaunit)};if(A){if(r.isTypedArray(A)&&m==="linear"){if(b===A.length)return A;if(A.subarray)return A.subarray(0,b)}for(x=new Array(b),_=0;_0?1:0}function a(i){var s=i[0],u=i[1];if(!isFinite(s)||!isFinite(u))return[1,0];var h=(s+1)*(s+1)+u*u;return[(s*s+u*u-1)/h,2*u/h]}function l(i,s){var u=s[0],h=s[1];return[u*i.radius+i.cx,-h*i.radius+i.cy]}function c(i,s){return s*i.radius}o.exports={smith:a,reactanceArc:function(i,s,u,h){var d=l(i,a([u,s])),m=d[0],p=d[1],g=l(i,a([h,s])),y=g[0],v=g[1];if(s===0)return["M"+m+","+p,"L"+y+","+v].join(" ");var x=c(i,1/Math.abs(s));return["M"+m+","+p,"A"+x+","+x+" 0 0,"+(s<0?1:0)+" "+y+","+v].join(" ")},resistanceArc:function(i,s,u,h){var d=c(i,1/(s+1)),m=l(i,a([s,u])),p=m[0],g=m[1],y=l(i,a([s,h])),v=y[0],x=y[1];if(r(u)!==r(h)){var _=l(i,a([s,0]));return["M"+p+","+g,"A"+d+","+d+" 0 0,"+(00){for(var s=[],u=0;u=T&&(S.min=0,P.min=0,L.min=0,v.aaxis&&delete v.aaxis.min,v.baxis&&delete v.baxis.min,v.caxis&&delete v.caxis.min)}function y(v,x,_,A){var b=m[x._name];function k(P,L){return l.coerce(v,x,b,P,L)}k("uirevision",A.uirevision),x.type="linear";var w=k("color"),M=w!==b.color.dflt?w:_.font.color,T=x._name.charAt(0).toUpperCase(),E="Component "+T,S=k("title.text",E);x._hovertitle=S===E?S:T,l.coerceFont(k,"title.font",{family:_.font.family,size:l.bigFont(_.font.size),color:M}),k("min"),h(v,x,k,"linear"),s(v,x,k,"linear"),i(v,x,k,"linear"),u(v,x,k,{outerTicks:!0}),k("showticklabels")&&(l.coerceFont(k,"tickfont",{family:_.font.family,size:_.font.size,color:M}),k("tickangle"),k("tickformat")),d(v,x,k,{dfltColor:w,bgColor:_.bgColor,blend:60,showLine:!0,showGrid:!0,noZeroLine:!0,attributes:b}),k("hoverformat"),k("layer")}o.exports=function(v,x,_){c(v,x,_,{type:"ternary",attributes:m,handleDefaults:g,font:x.font,paper_bgcolor:x.paper_bgcolor})}},{"../../components/color":366,"../../lib":503,"../../plot_api/plot_template":543,"../cartesian/line_grid_defaults":571,"../cartesian/prefix_suffix_defaults":573,"../cartesian/tick_label_defaults":578,"../cartesian/tick_mark_defaults":579,"../cartesian/tick_value_defaults":580,"../subplot_defaults":632,"./layout_attributes":635}],637:[function(t,o,f){var r=t("@plotly/d3"),a=t("tinycolor2"),l=t("../../registry"),c=t("../../lib"),i=c.strTranslate,s=c._,u=t("../../components/color"),h=t("../../components/drawing"),d=t("../cartesian/set_convert"),m=t("../../lib/extend").extendFlat,p=t("../plots"),g=t("../cartesian/axes"),y=t("../../components/dragelement"),v=t("../../components/fx"),x=t("../../components/dragelement/helpers"),_=x.freeMode,A=x.rectMode,b=t("../../components/titles"),k=t("../cartesian/select").prepSelect,w=t("../cartesian/select").selectOnClick,M=t("../cartesian/select").clearSelect,T=t("../cartesian/select").clearSelectionsCache,E=t("../cartesian/constants");function S(W,G){this.id=W.id,this.graphDiv=W.graphDiv,this.init(G),this.makeFramework(G),this.aTickLayout=null,this.bTickLayout=null,this.cTickLayout=null}o.exports=S;var P=S.prototype;P.init=function(W){this.container=W._ternarylayer,this.defs=W._defs,this.layoutId=W._uid,this.traceHash={},this.layers={}},P.plot=function(W,G){var K=G[this.id],te=G._size;this._hasClipOnAxisFalse=!1;for(var Y=0;YL*ae?Y=(J=ae)*L:J=(Y=ie)/L,re=Q*Y/ie,U=ee*J/ae,K=G.l+G.w*ne-Y/2,te=G.t+G.h*(1-q)-J/2,V.x0=K,V.y0=te,V.w=Y,V.h=J,V.sum=ue,V.xaxis={type:"linear",range:[le+2*fe-ue,ue-le-2*ge],domain:[ne-re/2,ne+re/2],_id:"x"},d(V.xaxis,V.graphDiv._fullLayout),V.xaxis.setScale(),V.xaxis.isPtWithinRange=function(Fe){return Fe.a>=V.aaxis.range[0]&&Fe.a<=V.aaxis.range[1]&&Fe.b>=V.baxis.range[1]&&Fe.b<=V.baxis.range[0]&&Fe.c>=V.caxis.range[1]&&Fe.c<=V.caxis.range[0]},V.yaxis={type:"linear",range:[le,ue-ge-fe],domain:[q-U/2,q+U/2],_id:"y"},d(V.yaxis,V.graphDiv._fullLayout),V.yaxis.setScale(),V.yaxis.isPtWithinRange=function(){return!0};var me=V.yaxis.domain[0],_e=V.aaxis=m({},W.aaxis,{range:[le,ue-ge-fe],side:"left",tickangle:(+W.aaxis.tickangle||0)-30,domain:[me,me+U*L],anchor:"free",position:0,_id:"y",_length:Y});d(_e,V.graphDiv._fullLayout),_e.setScale();var Ae=V.baxis=m({},W.baxis,{range:[ue-le-fe,ge],side:"bottom",domain:V.xaxis.domain,anchor:"free",position:0,_id:"x",_length:Y});d(Ae,V.graphDiv._fullLayout),Ae.setScale();var ke=V.caxis=m({},W.caxis,{range:[ue-le-ge,fe],side:"right",tickangle:(+W.caxis.tickangle||0)+30,domain:[me,me+U*L],anchor:"free",position:0,_id:"y",_length:Y});d(ke,V.graphDiv._fullLayout),ke.setScale();var Le="M"+K+","+(te+J)+"h"+Y+"l-"+Y/2+",-"+J+"Z";V.clipDef.select("path").attr("d",Le),V.layers.plotbg.select("path").attr("d",Le);var de="M0,"+J+"h"+Y+"l-"+Y/2+",-"+J+"Z";V.clipDefRelative.select("path").attr("d",de);var ve=i(K,te);V.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",ve),V.clipDefRelative.select("path").attr("transform",null);var Me=i(K-Ae._offset,te+J);V.layers.baxis.attr("transform",Me),V.layers.bgrid.attr("transform",Me);var we=i(K+Y/2,te)+"rotate(30)"+i(0,-_e._offset);V.layers.aaxis.attr("transform",we),V.layers.agrid.attr("transform",we);var Ce=i(K+Y/2,te)+"rotate(-30)"+i(0,-ke._offset);V.layers.caxis.attr("transform",Ce),V.layers.cgrid.attr("transform",Ce),V.drawAxes(!0),V.layers.aline.select("path").attr("d",_e.showline?"M"+K+","+(te+J)+"l"+Y/2+",-"+J:"M0,0").call(u.stroke,_e.linecolor||"#000").style("stroke-width",(_e.linewidth||0)+"px"),V.layers.bline.select("path").attr("d",Ae.showline?"M"+K+","+(te+J)+"h"+Y:"M0,0").call(u.stroke,Ae.linecolor||"#000").style("stroke-width",(Ae.linewidth||0)+"px"),V.layers.cline.select("path").attr("d",ke.showline?"M"+(K+Y/2)+","+te+"l"+Y/2+","+J:"M0,0").call(u.stroke,ke.linecolor||"#000").style("stroke-width",(ke.linewidth||0)+"px"),V.graphDiv._context.staticPlot||V.initInteractions(),h.setClipUrl(V.layers.frontplot,V._hasClipOnAxisFalse?null:V.clipId,V.graphDiv)},P.drawAxes=function(W){var G=this.graphDiv,K=this.id.substr(7)+"title",te=this.layers,Y=this.aaxis,J=this.baxis,re=this.caxis;if(this.drawAx(Y),this.drawAx(J),this.drawAx(re),W){var U=Math.max(Y.showticklabels?Y.tickfont.size/2:0,(re.showticklabels?.75*re.tickfont.size:0)+(re.ticks==="outside"?.87*re.ticklen:0)),V=(J.showticklabels?J.tickfont.size:0)+(J.ticks==="outside"?J.ticklen:0)+3;te["a-title"]=b.draw(G,"a"+K,{propContainer:Y,propName:this.id+".aaxis.title",placeholder:s(G,"Click to enter Component A title"),attributes:{x:this.x0+this.w/2,y:this.y0-Y.title.font.size/3-U,"text-anchor":"middle"}}),te["b-title"]=b.draw(G,"b"+K,{propContainer:J,propName:this.id+".baxis.title",placeholder:s(G,"Click to enter Component B title"),attributes:{x:this.x0-V,y:this.y0+this.h+.83*J.title.font.size+V,"text-anchor":"middle"}}),te["c-title"]=b.draw(G,"c"+K,{propContainer:re,propName:this.id+".caxis.title",placeholder:s(G,"Click to enter Component C title"),attributes:{x:this.x0+this.w+V,y:this.y0+this.h+.83*re.title.font.size+V,"text-anchor":"middle"}})}},P.drawAx=function(W){var G,K=this.graphDiv,te=W._name,Y=te.charAt(0),J=W._id,re=this.layers[te],U=Y+"tickLayout",V=(G=W).ticks+String(G.ticklen)+String(G.showticklabels);this[U]!==V&&(re.selectAll("."+J+"tick").remove(),this[U]=V),W.setScale();var H=g.calcTicks(W),ne=g.clipEnds(W,H),q=g.makeTransTickFn(W),Q=g.getTickSigns(W)[2],ee=c.deg2rad(30),ie=Q*(W.linewidth||1)/2,ae=Q*W.ticklen,ue=this.w,le=this.h,ge=Y==="b"?"M0,"+ie+"l"+Math.sin(ee)*ae+","+Math.cos(ee)*ae:"M"+ie+",0l"+Math.cos(ee)*ae+","+-Math.sin(ee)*ae,fe={a:"M0,0l"+le+",-"+ue/2,b:"M0,0l-"+ue/2+",-"+le,c:"M0,0l-"+le+","+ue/2}[Y];g.drawTicks(K,W,{vals:W.ticks==="inside"?ne:H,layer:re,path:ge,transFn:q,crisp:!1}),g.drawGrid(K,W,{vals:ne,layer:this.layers[Y+"grid"],path:fe,transFn:q,crisp:!1}),g.drawLabels(K,W,{vals:H,layer:re,transFn:q,labelFns:g.makeLabelFns(W,0,30)})};var R=E.MINZOOM/2+.87,F="m-0.87,.5h"+R+"v3h-"+(R+5.2)+"l"+(R/2+2.6)+",-"+(.87*R+4.5)+"l2.6,1.5l-"+R/2+","+.87*R+"Z",D="m0.87,.5h-"+R+"v3h"+(R+5.2)+"l-"+(R/2+2.6)+",-"+(.87*R+4.5)+"l-2.6,1.5l"+R/2+","+.87*R+"Z",O="m0,1l"+R/2+","+.87*R+"l2.6,-1.5l-"+(R/2+2.6)+",-"+(.87*R+4.5)+"l-"+(R/2+2.6)+","+(.87*R+4.5)+"l2.6,1.5l"+R/2+",-"+.87*R+"Z",N=!0;function B(W){r.select(W).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}P.clearSelect=function(){T(this.dragOptions),M(this.dragOptions.gd)},P.initInteractions=function(){var W,G,K,te,Y,J,re,U,V,H,ne,q,Q=this,ee=Q.layers.plotbg.select("path").node(),ie=Q.graphDiv,ae=ie._fullLayout._zoomlayer;function ue(de){var ve={};return ve[Q.id+".aaxis.min"]=de.a,ve[Q.id+".baxis.min"]=de.b,ve[Q.id+".caxis.min"]=de.c,ve}function le(de,ve){var Me=ie._fullLayout.clickmode;B(ie),de===2&&(ie.emit("plotly_doubleclick",null),l.call("_guiRelayout",ie,ue({a:0,b:0,c:0}))),Me.indexOf("select")>-1&&de===1&&w(ve,ie,[Q.xaxis],[Q.yaxis],Q.id,Q.dragOptions),Me.indexOf("event")>-1&&v.click(ie,ve,Q.id)}function ge(de,ve){return 1-ve/Q.h}function fe(de,ve){return 1-(de+(Q.h-ve)/Math.sqrt(3))/Q.w}function me(de,ve){return(de-(Q.h-ve)/Math.sqrt(3))/Q.w}function _e(de,ve){var Me=K+de*W,we=te+ve*G,Ce=Math.max(0,Math.min(1,ge(0,te),ge(0,we))),Fe=Math.max(0,Math.min(1,fe(K,te),fe(Me,we))),ze=Math.max(0,Math.min(1,me(K,te),me(Me,we))),$e=(Ce/2+ze)*Q.w,Ke=(1-Ce/2-Fe)*Q.w,Re=($e+Ke)/2,Ve=Ke-$e,We=(1-Ce)*Q.h,Ye=We-Ve/L;Ve.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),q.transition().style("opacity",1).duration(200),H=!0),ie.emit("plotly_relayouting",ue(re))}function Ae(){B(ie),re!==Y&&(l.call("_guiRelayout",ie,ue(re)),N&&ie.data&&ie._context.showTips&&(c.notifier(s(ie,"Double-click to zoom back out"),"long"),N=!1))}function ke(de,ve){var Me=de/Q.xaxis._m,we=ve/Q.yaxis._m,Ce=[(re={a:Y.a-we,b:Y.b+(Me+we)/2,c:Y.c-(Me-we)/2}).a,re.b,re.c].sort(c.sorterAsc),Fe=Ce.indexOf(re.a),ze=Ce.indexOf(re.b),$e=Ce.indexOf(re.c);Ce[0]<0&&(Ce[1]+Ce[0]/2<0?(Ce[2]+=Ce[0]+Ce[1],Ce[0]=Ce[1]=0):(Ce[2]+=Ce[0]/2,Ce[1]+=Ce[0]/2,Ce[0]=0),re={a:Ce[Fe],b:Ce[ze],c:Ce[$e]},ve=(Y.a-re.a)*Q.yaxis._m,de=(Y.c-re.c-Y.b+re.b)*Q.xaxis._m);var Ke=i(Q.x0+de,Q.y0+ve);Q.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",Ke);var Re=i(-de,-ve);Q.clipDefRelative.select("path").attr("transform",Re),Q.aaxis.range=[re.a,Q.sum-re.b-re.c],Q.baxis.range=[Q.sum-re.a-re.c,re.b],Q.caxis.range=[Q.sum-re.a-re.b,re.c],Q.drawAxes(!1),Q._hasClipOnAxisFalse&&Q.plotContainer.select(".scatterlayer").selectAll(".trace").call(h.hideOutsideRangePoints,Q),ie.emit("plotly_relayouting",ue(re))}function Le(){l.call("_guiRelayout",ie,ue(re))}this.dragOptions={element:ee,gd:ie,plotinfo:{id:Q.id,domain:ie._fullLayout[Q.id].domain,xaxis:Q.xaxis,yaxis:Q.yaxis},subplot:Q.id,prepFn:function(de,ve,Me){Q.dragOptions.xaxes=[Q.xaxis],Q.dragOptions.yaxes=[Q.yaxis],W=ie._fullLayout._invScaleX,G=ie._fullLayout._invScaleY;var we=Q.dragOptions.dragmode=ie._fullLayout.dragmode;_(we)?Q.dragOptions.minDrag=1:Q.dragOptions.minDrag=void 0,we==="zoom"?(Q.dragOptions.moveFn=_e,Q.dragOptions.clickFn=le,Q.dragOptions.doneFn=Ae,function(Ce,Fe,ze){var $e=ee.getBoundingClientRect();K=Fe-$e.left,te=ze-$e.top,ie._fullLayout._calcInverseTransform(ie);var Ke=ie._fullLayout._invTransform,Re=c.apply3DTransform(Ke)(K,te);K=Re[0],te=Re[1],Y={a:Q.aaxis.range[0],b:Q.baxis.range[1],c:Q.caxis.range[1]},re=Y,J=Q.aaxis.range[1]-Y.a,U=a(Q.graphDiv._fullLayout[Q.id].bgcolor).getLuminance(),V="M0,"+Q.h+"L"+Q.w/2+", 0L"+Q.w+","+Q.h+"Z",H=!1,ne=ae.append("path").attr("class","zoombox").attr("transform",i(Q.x0,Q.y0)).style({fill:U>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("d",V),q=ae.append("path").attr("class","zoombox-corners").attr("transform",i(Q.x0,Q.y0)).style({fill:u.background,stroke:u.defaultLine,"stroke-width":1,opacity:0}).attr("d","M0,0Z"),Q.clearSelect(ie)}(0,ve,Me)):we==="pan"?(Q.dragOptions.moveFn=ke,Q.dragOptions.clickFn=le,Q.dragOptions.doneFn=Le,Y={a:Q.aaxis.range[0],b:Q.baxis.range[1],c:Q.caxis.range[1]},re=Y,Q.clearSelect(ie)):(A(we)||_(we))&&k(de,ve,Me,Q.dragOptions,we)}},ee.onmousemove=function(de){v.hover(ie,de,Q.id),ie._fullLayout._lasthover=ee,ie._fullLayout._hoversubplot=Q.id},ee.onmouseout=function(de){ie._dragging||y.unhover(ie,de)},y.init(this.dragOptions)}},{"../../components/color":366,"../../components/dragelement":385,"../../components/dragelement/helpers":384,"../../components/drawing":388,"../../components/fx":406,"../../components/titles":464,"../../lib":503,"../../lib/extend":493,"../../registry":638,"../cartesian/axes":554,"../cartesian/constants":561,"../cartesian/select":575,"../cartesian/set_convert":576,"../plots":619,"@plotly/d3":58,tinycolor2:312}],638:[function(t,o,f){var r=t("./lib/loggers"),a=t("./lib/noop"),l=t("./lib/push_unique"),c=t("./lib/is_plain_object"),i=t("./lib/dom").addStyleRule,s=t("./lib/extend"),u=t("./plots/attributes"),h=t("./plots/layout_attributes"),d=s.extendFlat,m=s.extendDeepAll;function p(w){var M=w.name,T=w.categories,E=w.meta;if(f.modules[M])r.log("Type "+M+" already registered");else{f.subplotsRegistry[w.basePlotModule.name]||function(N){var B=N.name;if(f.subplotsRegistry[B])return void r.log("Plot type "+B+" already registered.");for(var W in x(N),f.subplotsRegistry[B]=N,f.componentsRegistry)b(W,N.name)}(w.basePlotModule);for(var S={},P=0;P-1&&(y[x[h]].title={text:""});for(h=0;h")!==-1?"":S.html(L).text()});return S.remove(),P}(T),T=(T=T.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")).replace(u,"'"),a.isIE()&&(T=(T=(T=T.replace(/"/gi,"'")).replace(/(\('#)([^']*)('\))/gi,'("#$2")')).replace(/(\\')/gi,'"')),T}},{"../components/color":366,"../components/drawing":388,"../constants/xmlns_namespaces":480,"../lib":503,"@plotly/d3":58}],647:[function(t,o,f){var r=t("../../lib");o.exports=function(a,l){for(var c=0;cL+S||!r(P))}for(var F=0;Fh))return i}return s!==void 0?s:c.dflt},f.coerceColor=function(c,i,s){return a(i).isValid()?i:s!==void 0?s:c.dflt},f.coerceEnumerated=function(c,i,s){return c.coerceNumber&&(i=+i),c.values.indexOf(i)!==-1?i:s!==void 0?s:c.dflt},f.getValue=function(c,i){var s;return Array.isArray(c)?i0?ue+=le:_<0&&(ue-=le)}return ue}function U(ae){var ue=_,le=ae.b,ge=re(ae);return r.inbox(le-ue,ge-ue,R+(ge-ue)/(ge-le)-1)}var V=m[A+"a"],H=m[b+"a"];M=Math.abs(V.r2c(V.range[1])-V.r2c(V.range[0]));var ne=r.getDistanceFunction(y,k,w,function(ae){return(k(ae)+w(ae))/2});if(r.getClosest(T,ne,m),m.index!==!1&&T[m.index].p!==u){O||(K=function(ae){return Math.min(N(ae),ae.p-S.bargroupwidth/2)},te=function(ae){return Math.max(B(ae),ae.p+S.bargroupwidth/2)});var q=T[m.index],Q=E.base?q.b+q.s:q.s;m[b+"0"]=m[b+"1"]=H.c2p(q[b],!0),m[b+"LabelVal"]=Q;var ee=S.extents[S.extents.round(q.p)];m[A+"0"]=V.c2p(P?K(q):ee[0],!0),m[A+"1"]=V.c2p(P?te(q):ee[1],!0);var ie=q.orig_p!==void 0;return m[A+"LabelVal"]=ie?q.orig_p:q.p,m.labelLabel=s(V,m[A+"LabelVal"],E[A+"hoverformat"]),m.valueLabel=s(H,m[b+"LabelVal"],E[b+"hoverformat"]),m.baseLabel=s(H,q.b,E[b+"hoverformat"]),m.spikeDistance=(function(ae){var ue=_,le=ae.b,ge=re(ae);return r.inbox(le-ue,ge-ue,F+(ge-ue)/(ge-le)-1)}(q)+function(ae){return Y(N(ae),B(ae),F)}(q))/2,m[A+"Spike"]=V.c2p(q.p,!0),c(q,E,m),m.hovertemplate=E.hovertemplate,m}}function d(m,p){var g=p.mcc||m.marker.color,y=p.mlcc||m.marker.line.color,v=i(m,p);return l.opacity(g)?g:l.opacity(y)&&v?y:void 0}o.exports={hoverPoints:function(m,p,g,y,v){var x=h(m,p,g,y,v);if(x){var _=x.cd,A=_[0].trace,b=_[x.index];return x.color=d(A,b),a.getComponentMethod("errorbars","hoverInfo")(b,A,x),[x]}},hoverOnBars:h,getTraceColor:d}},{"../../components/color":366,"../../components/fx":406,"../../constants/numerical":479,"../../lib":503,"../../plots/cartesian/axes":554,"../../registry":638,"./helpers":654}],656:[function(t,o,f){o.exports={attributes:t("./attributes"),layoutAttributes:t("./layout_attributes"),supplyDefaults:t("./defaults").supplyDefaults,crossTraceDefaults:t("./defaults").crossTraceDefaults,supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),crossTraceCalc:t("./cross_trace_calc").crossTraceCalc,colorbar:t("../scatter/marker_colorbar"),arraysToCalcdata:t("./arrays_to_calcdata"),plot:t("./plot").plot,style:t("./style").style,styleOnSelect:t("./style").styleOnSelect,hoverPoints:t("./hover").hoverPoints,eventData:t("./event_data"),selectPoints:t("./select"),moduleType:"trace",name:"bar",basePlotModule:t("../../plots/cartesian"),categories:["bar-like","cartesian","svg","bar","oriented","errorBarsOK","showLegend","zoomScale"],animatable:!0,meta:{}}},{"../../plots/cartesian":568,"../scatter/marker_colorbar":945,"./arrays_to_calcdata":647,"./attributes":648,"./calc":649,"./cross_trace_calc":651,"./defaults":652,"./event_data":653,"./hover":655,"./layout_attributes":657,"./layout_defaults":658,"./plot":659,"./select":660,"./style":662}],657:[function(t,o,f){o.exports={barmode:{valType:"enumerated",values:["stack","group","overlay","relative"],dflt:"group",editType:"calc"},barnorm:{valType:"enumerated",values:["","fraction","percent"],dflt:"",editType:"calc"},bargap:{valType:"number",min:0,max:1,editType:"calc"},bargroupgap:{valType:"number",min:0,max:1,dflt:0,editType:"calc"}}},{}],658:[function(t,o,f){var r=t("../../registry"),a=t("../../plots/cartesian/axes"),l=t("../../lib"),c=t("./layout_attributes");o.exports=function(i,s,u){function h(A,b){return l.coerce(i,s,c,A,b)}for(var d=!1,m=!1,p=!1,g={},y=h("barmode"),v=0;v0}function P(F){return F==="auto"?0:F}function L(F,D){var O=Math.PI/180*D,N=Math.abs(Math.sin(O)),B=Math.abs(Math.cos(O));return{x:F.width*B+F.height*N,y:F.width*N+F.height*B}}function R(F,D,O,N,B,W){var G=!!W.isHorizontal,K=!!W.constrained,te=W.angle||0,Y=W.anchor||"end",J=Y==="end",re=Y==="start",U=((W.leftToRight||0)+1)/2,V=1-U,H=B.width,ne=B.height,q=Math.abs(D-F),Q=Math.abs(N-O),ee=q>2*k&&Q>2*k?k:0;q-=2*ee,Q-=2*ee;var ie=P(te);te!=="auto"||H<=q&&ne<=Q||!(H>q||ne>Q)||(H>Q||ne>q)&&H.01?Fe:function(Re,Ve,We){return We&&Re===Ve?Re:Math.abs(Re-Ve)>=2?Fe(Re):Re>Ve?Math.ceil(Re):Math.floor(Re)};Le=ze(Le,de,Q),de=ze(de,Le,Q),ve=ze(ve,Me,!Q),Me=ze(Me,ve,!Q)}var $e=E(l.ensureSingle(Ae,"path"),te,B,W);if($e.style("vector-effect","non-scaling-stroke").attr("d",isNaN((de-Le)*(Me-ve))||we&&F._context.staticPlot?"M0,0Z":"M"+Le+","+ve+"V"+Me+"H"+de+"V"+ve+"Z").call(s.setClipUrl,D.layerClipId,F),!te.uniformtext.mode&&ee){var Ke=s.makePointStyleFns(U);s.singlePointStyle(ge,$e,U,Ke,F)}(function(Re,Ve,We,Ye,nt,ft,yt,Ot,Tt,at,et){var Lt,Wt=Ve.xaxis,Jt=Ve.yaxis,Be=Re._fullLayout;function Ge(Kt,qt,mn){return l.ensureSingle(Kt,"text").text(qt).attr({class:"bartext bartext-"+Lt,"text-anchor":"middle","data-notex":1}).call(s.font,mn).call(c.convertToTspans,Re)}var kt=Ye[0].trace,dt=kt.orientation==="h",Oe=function(Kt,qt,mn,Fn,pn){var tn,nn=qt[0].trace;return tn=nn.texttemplate?function(sn,gn,bn,In,qn){var Wn=gn[0].trace,ar=l.castOption(Wn,bn,"texttemplate");if(!ar)return"";var Dr,yr,Sr,Kn,Dn=Wn.type==="histogram",lr=Wn.type==="waterfall",Yr=Wn.type==="funnel",Mn=Wn.orientation==="h";Mn?(Dr="y",yr=qn,Sr="x",Kn=In):(Dr="x",yr=In,Sr="y",Kn=qn);function rr(_i){return h(Kn,Kn.c2l(_i),!0).text}var nr=gn[bn],Bn={};Bn.label=nr.p,Bn.labelLabel=Bn[Dr+"Label"]=(Nr=nr.p,h(yr,yr.c2l(Nr),!0).text);var Nr,Gr=l.castOption(Wn,nr.i,"text");(Gr===0||Gr)&&(Bn.text=Gr),Bn.value=nr.s,Bn.valueLabel=Bn[Sr+"Label"]=rr(nr.s);var pr={};b(pr,Wn,nr.i),(Dn||pr.x===void 0)&&(pr.x=Mn?Bn.value:Bn.label),(Dn||pr.y===void 0)&&(pr.y=Mn?Bn.label:Bn.value),(Dn||pr.xLabel===void 0)&&(pr.xLabel=Mn?Bn.valueLabel:Bn.labelLabel),(Dn||pr.yLabel===void 0)&&(pr.yLabel=Mn?Bn.labelLabel:Bn.valueLabel),lr&&(Bn.delta=+nr.rawS||nr.s,Bn.deltaLabel=rr(Bn.delta),Bn.final=nr.v,Bn.finalLabel=rr(Bn.final),Bn.initial=Bn.final-Bn.delta,Bn.initialLabel=rr(Bn.initial)),Yr&&(Bn.value=nr.s,Bn.valueLabel=rr(Bn.value),Bn.percentInitial=nr.begR,Bn.percentInitialLabel=l.formatPercent(nr.begR),Bn.percentPrevious=nr.difR,Bn.percentPreviousLabel=l.formatPercent(nr.difR),Bn.percentTotal=nr.sumR,Bn.percenTotalLabel=l.formatPercent(nr.sumR));var qr=l.castOption(Wn,nr.i,"customdata");return qr&&(Bn.customdata=qr),l.texttemplateString(ar,Bn,sn._d3locale,pr,Bn,Wn._meta||{})}(Kt,qt,mn,Fn,pn):nn.textinfo?function(sn,gn,bn,In){var qn=sn[0].trace,Wn=qn.orientation==="h",ar=qn.type==="waterfall",Dr=qn.type==="funnel";function yr(qr){return h(Wn?bn:In,+qr,!0).text}var Sr,Kn=qn.textinfo,Dn=sn[gn],lr=Kn.split("+"),Yr=[],Mn=function(qr){return lr.indexOf(qr)!==-1};Mn("label")&&Yr.push((rr=sn[gn].p,h(Wn?In:bn,rr,!0).text));var rr;if(Mn("text")&&((Sr=l.castOption(qn,Dn.i,"text"))===0||Sr)&&Yr.push(Sr),ar){var nr=+Dn.rawS||Dn.s,Bn=Dn.v,Nr=Bn-nr;Mn("initial")&&Yr.push(yr(Nr)),Mn("delta")&&Yr.push(yr(nr)),Mn("final")&&Yr.push(yr(Bn))}if(Dr){Mn("value")&&Yr.push(yr(Dn.s));var Gr=0;Mn("percent initial")&&Gr++,Mn("percent previous")&&Gr++,Mn("percent total")&&Gr++;var pr=Gr>1;Mn("percent initial")&&(Sr=l.formatPercent(Dn.begR),pr&&(Sr+=" of initial"),Yr.push(Sr)),Mn("percent previous")&&(Sr=l.formatPercent(Dn.difR),pr&&(Sr+=" of previous"),Yr.push(Sr)),Mn("percent total")&&(Sr=l.formatPercent(Dn.sumR),pr&&(Sr+=" of total"),Yr.push(Sr))}return Yr.join("
    ")}(qt,mn,Fn,pn):y.getValue(nn.text,mn),y.coerceString(_,tn)}(Be,Ye,nt,Wt,Jt);Lt=function(Kt,qt){var mn=y.getValue(Kt.textposition,qt);return y.coerceEnumerated(A,mn)}(kt,nt);var Ie=at.mode==="stack"||at.mode==="relative",Te=Ye[nt],Pe=!Ie||Te._outmost;if(!Oe||Lt==="none"||(Te.isBlank||ft===yt||Ot===Tt)&&(Lt==="auto"||Lt==="inside"))return void We.select("text").remove();var qe=Be.font,rt=g.getBarColor(Ye[nt],kt),lt=g.getInsideTextFont(kt,nt,qe,rt),ot=g.getOutsideTextFont(kt,nt,qe),At=We.datum();dt?Wt.type==="log"&&At.s0<=0&&(ft=Wt.range[0]=Ut*(Et/tt):Et>=tt*(Ft/Ut);Ut>0&&tt>0&&(Pt||De||Je)?Lt="inside":(Lt="outside",wt.remove(),wt=null)}else Lt="inside";if(!wt){bt=l.ensureUniformFontSize(Re,Lt==="outside"?ot:lt);var st=(wt=Ge(We,Oe,bt)).attr("transform");if(wt.attr("transform",""),$t=s.bBox(wt.node()),Ut=$t.width,tt=$t.height,wt.attr("transform",st),Ut<=0||tt<=0)return void wt.remove()}var St,It,Zt=kt.textangle;Lt==="outside"?(It=kt.constraintext==="both"||kt.constraintext==="outside",St=function(Kt,qt,mn,Fn,pn,tn){var nn,sn=!!tn.isHorizontal,gn=!!tn.constrained,bn=tn.angle||0,In=pn.width,qn=pn.height,Wn=Math.abs(qt-Kt),ar=Math.abs(Fn-mn);nn=sn?ar>2*k?k:0:Wn>2*k?k:0;var Dr=1;gn&&(Dr=sn?Math.min(1,ar/qn):Math.min(1,Wn/In));var yr=P(bn),Sr=L(pn,yr),Kn=(sn?Sr.x:Sr.y)/2,Dn=(pn.left+pn.right)/2,lr=(pn.top+pn.bottom)/2,Yr=(Kt+qt)/2,Mn=(mn+Fn)/2,rr=0,nr=0,Bn=sn?T(qt,Kt):T(mn,Fn);return sn?(Yr=qt-Bn*nn,rr=Bn*Kn):(Mn=Fn+Bn*nn,nr=-Bn*Kn),{textX:Dn,textY:lr,targetX:Yr,targetY:Mn,anchorX:rr,anchorY:nr,scale:Dr,rotate:yr}}(ft,yt,Ot,Tt,$t,{isHorizontal:dt,constrained:It,angle:Zt})):(It=kt.constraintext==="both"||kt.constraintext==="inside",St=R(ft,yt,Ot,Tt,$t,{isHorizontal:dt,constrained:It,angle:Zt,anchor:kt.insidetextanchor})),St.fontSize=bt.size,m(kt.type==="histogram"?"bar":kt.type,St,Be),Te.transform=St,E(wt,Be,at,et).attr("transform",l.getTextTransform(St))})(F,D,Ae,J,fe,Le,de,ve,Me,B,W),D.layerClipId&&s.hideOutsideRangePoint(ge,Ae.select("text"),G,K,U.xcalendar,U.ycalendar)});var le=U.cliponaxis===!1;s.setClipUrl(re,le?null:D.layerClipId,F)});u.getComponentMethod("errorbars","plot")(F,Y,D,B)},toMoveInsideBar:R}},{"../../components/color":366,"../../components/drawing":388,"../../components/fx/helpers":402,"../../lib":503,"../../lib/svg_text_utils":529,"../../plots/cartesian/axes":554,"../../registry":638,"./attributes":648,"./constants":650,"./helpers":654,"./style":662,"./uniform_text":664,"@plotly/d3":58,"fast-isnumeric":190}],660:[function(t,o,f){function r(a,l,c,i,s){var u=l.c2p(i?a.s0:a.p0,!0),h=l.c2p(i?a.s1:a.p1,!0),d=c.c2p(i?a.p0:a.s0,!0),m=c.c2p(i?a.p1:a.s1,!0);return s?[(u+h)/2,(d+m)/2]:i?[h,(d+m)/2]:[(u+h)/2,m]}o.exports=function(a,l){var c,i=a.cd,s=a.xaxis,u=a.yaxis,h=i[0].trace,d=h.type==="funnel",m=h.orientation==="h",p=[];if(l===!1)for(c=0;c1||E.bargap===0&&E.bargroupgap===0&&!S[0].trace.marker.line.width)&&r.select(this).attr("shape-rendering","crispEdges")}),M.selectAll("g.points").each(function(S){g(r.select(this),S[0].trace,w)}),i.getComponentMethod("errorbars","style")(M)},styleTextPoints:y,styleOnSelect:function(w,M,T){var E=M[0].trace;E.selectedpoints?function(S,P,L){l.selectedPointStyle(S.selectAll("path"),P),function(R,F,D){R.each(function(O){var N,B=r.select(this);if(O.selected){N=c.ensureUniformFontSize(D,v(B,O,F,D));var W=F.selected.textfont&&F.selected.textfont.color;W&&(N.color=W),l.font(B,N)}else l.selectedTextStyle(B,F)})}(S.selectAll("text"),P,L)}(T,E,w):(g(T,E,w),i.getComponentMethod("errorbars","style")(T))},getInsideTextFont:_,getOutsideTextFont:A,getBarColor:k,resizeText:s}},{"../../components/color":366,"../../components/drawing":388,"../../lib":503,"../../registry":638,"./attributes":648,"./helpers":654,"./uniform_text":664,"@plotly/d3":58}],663:[function(t,o,f){var r=t("../../components/color"),a=t("../../components/colorscale/helpers").hasColorscale,l=t("../../components/colorscale/defaults"),c=t("../../lib").coercePattern;o.exports=function(i,s,u,h,d){var m=u("marker.color",h),p=a(i,"marker");p&&l(i,s,d,u,{prefix:"marker.",cLetter:"c"}),u("marker.line.color",r.defaultLine),a(i,"marker.line")&&l(i,s,d,u,{prefix:"marker.line.",cLetter:"c"}),u("marker.line.width"),u("marker.opacity"),c(u,"marker.pattern",m,p),u("selected.marker.color"),u("unselected.marker.color")}},{"../../components/color":366,"../../components/colorscale/defaults":376,"../../components/colorscale/helpers":377,"../../lib":503}],664:[function(t,o,f){var r=t("@plotly/d3"),a=t("../../lib");function l(c){return"_"+c+"Text_minsize"}o.exports={recordMinTextSize:function(c,i,s){if(s.uniformtext.mode){var u=l(c),h=s.uniformtext.minsize,d=i.scale*i.fontSize;i.hide=dy.range[1]&&(w+=Math.PI),r.getClosest(m,function(E){return _(k,w,[E.rp0,E.rp1],[E.thetag0,E.thetag1],x)?A+Math.min(1,Math.abs(E.thetag1-E.thetag0)/b)-1+(E.rp1-k)/(E.rp1-E.rp0)-1:1/0},u),u.index!==!1){var M=m[u.index];u.x0=u.x1=M.ct[0],u.y0=u.y1=M.ct[1];var T=a.extendFlat({},M,{r:M.s,theta:M.p});return c(M,p,u),i(T,p,g,u),u.hovertemplate=p.hovertemplate,u.color=l(p,M),u.xLabelVal=u.yLabelVal=void 0,M.s<0&&(u.idealAlign="left"),[u]}}},{"../../components/fx":406,"../../lib":503,"../../plots/polar/helpers":621,"../bar/hover":655,"../scatterpolar/hover":1006}],669:[function(t,o,f){o.exports={moduleType:"trace",name:"barpolar",basePlotModule:t("../../plots/polar"),categories:["polar","bar","showLegend"],attributes:t("./attributes"),layoutAttributes:t("./layout_attributes"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc").calc,crossTraceCalc:t("./calc").crossTraceCalc,plot:t("./plot"),colorbar:t("../scatter/marker_colorbar"),formatLabels:t("../scatterpolar/format_labels"),style:t("../bar/style").style,styleOnSelect:t("../bar/style").styleOnSelect,hoverPoints:t("./hover"),selectPoints:t("../bar/select"),meta:{}}},{"../../plots/polar":622,"../bar/select":660,"../bar/style":662,"../scatter/marker_colorbar":945,"../scatterpolar/format_labels":1005,"./attributes":665,"./calc":666,"./defaults":667,"./hover":668,"./layout_attributes":670,"./layout_defaults":671,"./plot":672}],670:[function(t,o,f){o.exports={barmode:{valType:"enumerated",values:["stack","overlay"],dflt:"stack",editType:"calc"},bargap:{valType:"number",dflt:.1,min:0,max:1,editType:"calc"}}},{}],671:[function(t,o,f){var r=t("../../lib"),a=t("./layout_attributes");o.exports=function(l,c,i){var s,u={};function h(p,g){return r.coerce(l[s]||{},c[s],a,p,g)}for(var d=0;d0?(T=w,E=M):(T=M,E=w);var S=[i.findEnclosingVertexAngles(T,x.vangles)[0],(T+E)/2,i.findEnclosingVertexAngles(E,x.vangles)[1]];return i.pathPolygonAnnulus(b,k,T,E,S,_,A)}:function(b,k,w,M){return l.pathAnnulus(b,k,w,M,_,A)}}(u),v=u.layers.frontplot.select("g.barlayer");l.makeTraceGroups(v,h,"trace bars").each(function(){var x=r.select(this),_=l.ensureSingle(x,"g","points").selectAll("g.point").data(l.identity);_.enter().append("g").style("vector-effect","non-scaling-stroke").style("stroke-miterlimit",2).classed("point",!0),_.exit().remove(),_.each(function(A){var b,k=r.select(this),w=A.rp0=p.c2p(A.s0),M=A.rp1=p.c2p(A.s1),T=A.thetag0=g.c2g(A.p0),E=A.thetag1=g.c2g(A.p1);if(a(w)&&a(M)&&a(T)&&a(E)&&w!==M&&T!==E){var S=p.c2g(A.s1),P=(T+E)/2;A.ct=[d.c2p(S*Math.cos(P)),m.c2p(S*Math.sin(P))],b=y(w,M,T,E)}else b="M0,0Z";l.ensureSingle(k,"path").attr("d",b)}),c.setClipUrl(x,u._hasClipOnAxisFalse?u.clipIds.forTraces:null,s)})}},{"../../components/drawing":388,"../../lib":503,"../../plots/polar/helpers":621,"@plotly/d3":58,"fast-isnumeric":190}],673:[function(t,o,f){var r=t("../scatter/attributes"),a=t("../bar/attributes"),l=t("../../components/color/attributes"),c=t("../../plots/cartesian/axis_format_attributes").axisHoverFormat,i=t("../../plots/template_attributes").hovertemplateAttrs,s=t("../../lib/extend").extendFlat,u=r.marker,h=u.line;o.exports={y:{valType:"data_array",editType:"calc+clearAxisTypes"},x:{valType:"data_array",editType:"calc+clearAxisTypes"},x0:{valType:"any",editType:"calc+clearAxisTypes"},y0:{valType:"any",editType:"calc+clearAxisTypes"},dx:{valType:"number",editType:"calc"},dy:{valType:"number",editType:"calc"},xperiod:r.xperiod,yperiod:r.yperiod,xperiod0:r.xperiod0,yperiod0:r.yperiod0,xperiodalignment:r.xperiodalignment,yperiodalignment:r.yperiodalignment,xhoverformat:c("x"),yhoverformat:c("y"),name:{valType:"string",editType:"calc+clearAxisTypes"},q1:{valType:"data_array",editType:"calc+clearAxisTypes"},median:{valType:"data_array",editType:"calc+clearAxisTypes"},q3:{valType:"data_array",editType:"calc+clearAxisTypes"},lowerfence:{valType:"data_array",editType:"calc"},upperfence:{valType:"data_array",editType:"calc"},notched:{valType:"boolean",editType:"calc"},notchwidth:{valType:"number",min:0,max:.5,dflt:.25,editType:"calc"},notchspan:{valType:"data_array",editType:"calc"},boxpoints:{valType:"enumerated",values:["all","outliers","suspectedoutliers",!1],editType:"calc"},jitter:{valType:"number",min:0,max:1,editType:"calc"},pointpos:{valType:"number",min:-2,max:2,editType:"calc"},boxmean:{valType:"enumerated",values:[!0,"sd",!1],editType:"calc"},mean:{valType:"data_array",editType:"calc"},sd:{valType:"data_array",editType:"calc"},orientation:{valType:"enumerated",values:["v","h"],editType:"calc+clearAxisTypes"},quartilemethod:{valType:"enumerated",values:["linear","exclusive","inclusive"],dflt:"linear",editType:"calc"},width:{valType:"number",min:0,dflt:0,editType:"calc"},marker:{outliercolor:{valType:"color",dflt:"rgba(0, 0, 0, 0)",editType:"style"},symbol:s({},u.symbol,{arrayOk:!1,editType:"plot"}),opacity:s({},u.opacity,{arrayOk:!1,dflt:1,editType:"style"}),size:s({},u.size,{arrayOk:!1,editType:"calc"}),color:s({},u.color,{arrayOk:!1,editType:"style"}),line:{color:s({},h.color,{arrayOk:!1,dflt:l.defaultLine,editType:"style"}),width:s({},h.width,{arrayOk:!1,dflt:0,editType:"style"}),outliercolor:{valType:"color",editType:"style"},outlierwidth:{valType:"number",min:0,dflt:1,editType:"style"},editType:"style"},editType:"plot"},line:{color:{valType:"color",editType:"style"},width:{valType:"number",min:0,dflt:2,editType:"style"},editType:"plot"},fillcolor:r.fillcolor,whiskerwidth:{valType:"number",min:0,max:1,dflt:.5,editType:"calc"},offsetgroup:a.offsetgroup,alignmentgroup:a.alignmentgroup,selected:{marker:r.selected.marker,editType:"style"},unselected:{marker:r.unselected.marker,editType:"style"},text:s({},r.text,{}),hovertext:s({},r.hovertext,{}),hovertemplate:i({}),hoveron:{valType:"flaglist",flags:["boxes","points"],dflt:"boxes+points",editType:"style"}}},{"../../components/color/attributes":365,"../../lib/extend":493,"../../plots/cartesian/axis_format_attributes":557,"../../plots/template_attributes":633,"../bar/attributes":648,"../scatter/attributes":927}],674:[function(t,o,f){var r=t("fast-isnumeric"),a=t("../../plots/cartesian/axes"),l=t("../../plots/cartesian/align_period"),c=t("../../lib"),i=t("../../constants/numerical").BADNUM,s=c._;o.exports=function(_,A){var b,k,w,M,T,E,S,P=_._fullLayout,L=a.getFromId(_,A.xaxis||"x"),R=a.getFromId(_,A.yaxis||"y"),F=[],D=A.type==="violin"?"_numViolins":"_numBoxes";A.orientation==="h"?(w=L,M="x",T=R,E="y",S=!!A.yperiodalignment):(w=R,M="y",T=L,E="x",S=!!A.xperiodalignment);var O,N,B,W,G,K,te=function(We,Ye,nt,ft){var yt,Ot=Ye+"0"in We,Tt="d"+Ye in We;if(Ye in We||Ot&&Tt){var at=nt.makeCalcdata(We,Ye);return[l(We,nt,Ye,at).vals,at]}yt=Ot?We[Ye+"0"]:"name"in We&&(nt.type==="category"||r(We.name)&&["linear","log"].indexOf(nt.type)!==-1||c.isDateTime(We.name)&&nt.type==="date")?We.name:ft;for(var et=nt.type==="multicategory"?nt.r2c_just_indices(yt):nt.d2c(yt,0,We[Ye+"calendar"]),Lt=We._length,Wt=new Array(Lt),Jt=0;JtO.uf};if(A._hasPreCompStats){var ne=A[M],q=function(We){return w.d2c((A[We]||[])[b])},Q=1/0,ee=-1/0;for(b=0;b=O.q1&&O.q3>=O.med){var ae=q("lowerfence");O.lf=ae!==i&&ae<=O.q1?ae:p(O,B,W);var ue=q("upperfence");O.uf=ue!==i&&ue>=O.q3?ue:g(O,B,W);var le=q("mean");O.mean=le!==i?le:W?c.mean(B,W):(O.q1+O.q3)/2;var ge=q("sd");O.sd=le!==i&&ge>=0?ge:W?c.stdev(B,W,O.mean):O.q3-O.q1,O.lo=y(O),O.uo=v(O);var fe=q("notchspan");fe=fe!==i&&fe>0?fe:x(O,W),O.ln=O.med-fe,O.un=O.med+fe;var me=O.lf,_e=O.uf;A.boxpoints&&B.length&&(me=Math.min(me,B[0]),_e=Math.max(_e,B[W-1])),A.notched&&(me=Math.min(me,O.ln),_e=Math.max(_e,O.un)),O.min=me,O.max=_e}else{var Ae;c.warn(["Invalid input - make sure that q1 <= median <= q3","q1 = "+O.q1,"median = "+O.med,"q3 = "+O.q3].join(` -`)),Ae=O.med!==i?O.med:O.q1!==i?O.q3!==i?(O.q1+O.q3)/2:O.q1:O.q3!==i?O.q3:0,O.med=Ae,O.q1=O.q3=Ae,O.lf=O.uf=Ae,O.mean=O.sd=Ae,O.ln=O.un=Ae,O.min=O.max=Ae}Q=Math.min(Q,O.min),ee=Math.max(ee,O.max),O.pts2=N.filter(H),F.push(O)}}A._extremes[w._id]=a.findExtremes(w,[Q,ee],{padded:!0})}else{var ke=w.makeCalcdata(A,M),Le=function(We,Ye){for(var nt=We.length,ft=new Array(nt+1),yt=0;yt=0&&Me0){var Ke,Re;(O={}).pos=O[E]=U[b],N=O.pts=ve[b].sort(d),W=(B=O[M]=N.map(m)).length,O.min=B[0],O.max=B[W-1],O.mean=c.mean(B,W),O.sd=c.stdev(B,W,O.mean),O.med=c.interp(B,.5),W%2&&(ze||$e)?(ze?(Ke=B.slice(0,W/2),Re=B.slice(W/2+1)):$e&&(Ke=B.slice(0,W/2+1),Re=B.slice(W/2)),O.q1=c.interp(Ke,.5),O.q3=c.interp(Re,.5)):(O.q1=c.interp(B,.25),O.q3=c.interp(B,.75)),O.lf=p(O,B,W),O.uf=g(O,B,W),O.lo=y(O),O.uo=v(O);var Ve=x(O,W);O.ln=O.med-Ve,O.un=O.med+Ve,we=Math.min(we,O.ln),Ce=Math.max(Ce,O.un),O.pts2=N.filter(H),F.push(O)}A._extremes[w._id]=a.findExtremes(w,A.notched?ke.concat([we,Ce]):ke,{padded:!0})}return function(We,Ye){if(c.isArrayOrTypedArray(Ye.selectedpoints))for(var nt=0;nt0?(F[0].t={num:P[D],dPos:V,posLetter:E,valLetter:M,labels:{med:s(_,"median:"),min:s(_,"min:"),q1:s(_,"q1:"),q3:s(_,"q3:"),max:s(_,"max:"),mean:A.boxmean==="sd"?s(_,"mean ± σ:"):s(_,"mean:"),lf:s(_,"lower fence:"),uf:s(_,"upper fence:")}},P[D]++,F):[{t:{empty:!0}}]};var u={text:"tx",hovertext:"htx"};function h(_,A,b){for(var k in u)c.isArrayOrTypedArray(A[k])&&(Array.isArray(b)?c.isArrayOrTypedArray(A[k][b[0]])&&(_[u[k]]=A[k][b[0]][b[1]]):_[u[k]]=A[k][b])}function d(_,A){return _.v-A.v}function m(_){return _.v}function p(_,A,b){return b===0?_.q1:Math.min(_.q1,A[Math.min(c.findBin(2.5*_.q1-1.5*_.q3,A,!0)+1,b-1)])}function g(_,A,b){return b===0?_.q3:Math.max(_.q3,A[Math.max(c.findBin(2.5*_.q3-1.5*_.q1,A),0)])}function y(_){return 4*_.q1-3*_.q3}function v(_){return 4*_.q3-3*_.q1}function x(_,A){return A===0?0:1.57*(_.q3-_.q1)/Math.sqrt(A)}},{"../../constants/numerical":479,"../../lib":503,"../../plots/cartesian/align_period":551,"../../plots/cartesian/axes":554,"fast-isnumeric":190}],675:[function(t,o,f){var r=t("../../plots/cartesian/axes"),a=t("../../lib"),l=t("../../plots/cartesian/constraints").getAxisGroup,c=["v","h"];function i(s,u,h,d){var m,p,g,y=u.calcdata,v=u._fullLayout,x=d._id,_=x.charAt(0),A=[],b=0;for(m=0;m1,E=1-v[s+"gap"],S=1-v[s+"groupgap"];for(m=0;m0){var ie=N.pointpos,ae=N.jitter,ue=N.marker.size/2,le=0;ie+ae>=0&&((le=Q*(ie+ae))>D?(ee=!0,ne=ue,V=le):le>re&&(ne=ue,V=D)),le<=D&&(V=D);var ge=0;ie-ae<=0&&((ge=-Q*(ie-ae))>O?(ee=!0,q=ue,H=ge):ge>U&&(q=ue,H=O)),ge<=O&&(H=O)}else V=D,H=O;var fe=new Array(g.length);for(p=0;p0?(T="v",E=P>0?Math.min(R,L):Math.min(L)):P>0?(T="h",E=Math.min(R)):E=0;if(E){p._length=E;var W=g("orientation",T);p._hasPreCompStats?W==="v"&&P===0?(g("x0",0),g("dx",1)):W==="h"&&S===0&&(g("y0",0),g("dy",1)):W==="v"&&P===0?g("x0"):W==="h"&&S===0&&g("y0"),a.getComponentMethod("calendars","handleTraceDefaults")(m,p,["x","y"],y)}else p.visible=!1}function d(m,p,g,y){var v=y.prefix,x=r.coerce2(m,p,u,"marker.outliercolor"),_=g("marker.line.outliercolor"),A="outliers";p._hasPreCompStats?A="all":(x||_)&&(A="suspectedoutliers");var b=g(v+"points",A);b?(g("jitter",b==="all"?.3:0),g("pointpos",b==="all"?-1.5:0),g("marker.symbol"),g("marker.opacity"),g("marker.size"),g("marker.color",p.line.color),g("marker.line.color"),g("marker.line.width"),b==="suspectedoutliers"&&(g("marker.line.outliercolor",p.marker.color),g("marker.line.outlierwidth")),g("selected.marker.color"),g("unselected.marker.color"),g("selected.marker.size"),g("unselected.marker.size"),g("text"),g("hovertext")):delete p.marker;var k=g("hoveron");k!=="all"&&k.indexOf("points")===-1||g("hovertemplate"),r.coerceSelectionMarkerOpacity(p,g)}o.exports={supplyDefaults:function(m,p,g,y){function v(M,T){return r.coerce(m,p,u,M,T)}if(h(m,p,v,y),p.visible!==!1){c(m,p,y,v),v("xhoverformat"),v("yhoverformat");var x=p._hasPreCompStats;x&&(v("lowerfence"),v("upperfence")),v("line.color",(m.marker||{}).color||g),v("line.width"),v("fillcolor",l.addOpacity(p.line.color,.5));var _=!1;if(x){var A=v("mean"),b=v("sd");A&&A.length&&(_=!0,b&&b.length&&(_="sd"))}v("boxmean",_),v("whiskerwidth"),v("width"),v("quartilemethod");var k=!1;if(x){var w=v("notchspan");w&&w.length&&(k=!0)}else r.validate(m.notchwidth,u.notchwidth)&&(k=!0);v("notched",k)&&v("notchwidth"),d(m,p,v,{prefix:"box"})}},crossTraceDefaults:function(m,p){var g,y;function v(A){return r.coerce(y._input,y,u,A)}for(var x=0;xb.lo&&(B.so=!0)}return M});A.enter().append("path").classed("point",!0),A.exit().remove(),A.call(l.translatePoints,p,g)}function s(u,h,d,m){var p,g,y=h.val,v=h.pos,x=!!v.rangebreaks,_=m.bPos,A=m.bPosPxOffset||0,b=d.boxmean||(d.meanline||{}).visible;Array.isArray(m.bdPos)?(p=m.bdPos[0],g=m.bdPos[1]):(p=m.bdPos,g=m.bdPos);var k=u.selectAll("path.mean").data(d.type==="box"&&d.boxmean||d.type==="violin"&&d.box.visible&&d.meanline.visible?a.identity:[]);k.enter().append("path").attr("class","mean").style({fill:"none","vector-effect":"non-scaling-stroke"}),k.exit().remove(),k.each(function(w){var M=v.c2l(w.pos+_,!0),T=v.l2p(M-p)+A,E=v.l2p(M+g)+A,S=x?(T+E)/2:v.l2p(M)+A,P=y.c2p(w.mean,!0),L=y.c2p(w.mean-w.sd,!0),R=y.c2p(w.mean+w.sd,!0);d.orientation==="h"?r.select(this).attr("d","M"+P+","+T+"V"+E+(b==="sd"?"m0,0L"+L+","+S+"L"+P+","+T+"L"+R+","+S+"Z":"")):r.select(this).attr("d","M"+T+","+P+"H"+E+(b==="sd"?"m0,0L"+S+","+L+"L"+T+","+P+"L"+S+","+R+"Z":""))})}o.exports={plot:function(u,h,d,m){var p=h.xaxis,g=h.yaxis;a.makeTraceGroups(m,d,"trace boxes").each(function(y){var v,x,_=r.select(this),A=y[0],b=A.t,k=A.trace;b.wdPos=b.bdPos*k.whiskerwidth,k.visible!==!0||b.empty?_.remove():(k.orientation==="h"?(v=g,x=p):(v=p,x=g),c(_,{pos:v,val:x},k,b),i(_,{x:p,y:g},k,b),s(_,{pos:v,val:x},k,b))})},plotBoxAndWhiskers:c,plotPoints:i,plotBoxMean:s}},{"../../components/drawing":388,"../../lib":503,"@plotly/d3":58}],683:[function(t,o,f){o.exports=function(r,a){var l,c,i=r.cd,s=r.xaxis,u=r.yaxis,h=[];if(a===!1)for(l=0;l=10)return null;for(var s=1/0,u=-1/0,h=c.length,d=0;d0?Math.floor:Math.ceil,W=O>0?Math.ceil:Math.floor,G=O>0?Math.min:Math.max,K=O>0?Math.max:Math.min,te=B(F+N),Y=W(D-N),J=[[g=R(F)]];for(s=te;s*O=0;i--)s[p-i]=r[g][i],u[p-i]=a[g][i];for(h.push({x:s,y:u,bicubic:d}),i=g,s=[],u=[];i>=0;i--)s[g-i]=r[i][0],u[g-i]=a[i][0];return h.push({x:s,y:u,bicubic:m}),h}},{}],697:[function(t,o,f){var r=t("../../plots/cartesian/axes"),a=t("../../lib/extend").extendFlat;o.exports=function(l,c,i){var s,u,h,d,m,p,g,y,v,x,_,A,b,k,w=l["_"+c],M=l[c+"axis"],T=M._gridlines=[],E=M._minorgridlines=[],S=M._boundarylines=[],P=l["_"+i],L=l[i+"axis"];M.tickmode==="array"&&(M.tickvals=w.slice());var R=l._xctrl,F=l._yctrl,D=R[0].length,O=R.length,N=l._a.length,B=l._b.length;r.prepTicks(M),M.tickmode==="array"&&delete M.tickvals;var W=M.smoothing?3:1;function G(te){var Y,J,re,U,V,H,ne,q,Q,ee,ie,ae,ue=[],le=[],ge={};if(c==="b")for(J=l.b2j(te),re=Math.floor(Math.max(0,Math.min(B-2,J))),U=J-re,ge.length=B,ge.crossLength=N,ge.xy=function(fe){return l.evalxy([],fe,J)},ge.dxy=function(fe,me){return l.dxydi([],fe,re,me,U)},Y=0;Y0&&(Q=l.dxydi([],Y-1,re,0,U),ue.push(V[0]+Q[0]/3),le.push(V[1]+Q[1]/3),ee=l.dxydi([],Y-1,re,1,U),ue.push(q[0]-ee[0]/3),le.push(q[1]-ee[1]/3)),ue.push(q[0]),le.push(q[1]),V=q;else for(Y=l.a2i(te),H=Math.floor(Math.max(0,Math.min(N-2,Y))),ne=Y-H,ge.length=N,ge.crossLength=B,ge.xy=function(fe){return l.evalxy([],Y,fe)},ge.dxy=function(fe,me){return l.dxydj([],H,fe,ne,me)},J=0;J0&&(ie=l.dxydj([],H,J-1,ne,0),ue.push(V[0]+ie[0]/3),le.push(V[1]+ie[1]/3),ae=l.dxydj([],H,J-1,ne,1),ue.push(q[0]-ae[0]/3),le.push(q[1]-ae[1]/3)),ue.push(q[0]),le.push(q[1]),V=q;return ge.axisLetter=c,ge.axis=M,ge.crossAxis=L,ge.value=te,ge.constvar=i,ge.index=y,ge.x=ue,ge.y=le,ge.smoothing=L.smoothing,ge}function K(te){var Y,J,re,U,V,H=[],ne=[],q={};if(q.length=w.length,q.crossLength=P.length,c==="b")for(re=Math.max(0,Math.min(B-2,te)),V=Math.min(1,Math.max(0,te-re)),q.xy=function(Q){return l.evalxy([],Q,te)},q.dxy=function(Q,ee){return l.dxydi([],Q,re,ee,V)},Y=0;Yw.length-1||T.push(a(K(u),{color:M.gridcolor,width:M.gridwidth}));for(y=p;yw.length-1||_<0||_>w.length-1))for(A=w[h],b=w[_],s=0;sw[w.length-1]||E.push(a(G(x),{color:M.minorgridcolor,width:M.minorgridwidth}));M.startline&&S.push(a(K(0),{color:M.startlinecolor,width:M.startlinewidth})),M.endline&&S.push(a(K(w.length-1),{color:M.endlinecolor,width:M.endlinewidth}))}else{for(d=5e-15,p=(m=[Math.floor((w[w.length-1]-M.tick0)/M.dtick*(1+d)),Math.ceil((w[0]-M.tick0)/M.dtick/(1+d))].sort(function(te,Y){return te-Y}))[0],g=m[1],y=p;y<=g;y++)v=M.tick0+M.dtick*y,T.push(a(G(v),{color:M.gridcolor,width:M.gridwidth}));for(y=p-1;yw[w.length-1]||E.push(a(G(x),{color:M.minorgridcolor,width:M.minorgridwidth}));M.startline&&S.push(a(G(w[0]),{color:M.startlinecolor,width:M.startlinewidth})),M.endline&&S.push(a(G(w[w.length-1]),{color:M.endlinecolor,width:M.endlinewidth}))}}},{"../../lib/extend":493,"../../plots/cartesian/axes":554}],698:[function(t,o,f){var r=t("../../plots/cartesian/axes"),a=t("../../lib/extend").extendFlat;o.exports=function(l,c){var i,s,u,h=c._labels=[],d=c._gridlines;for(i=0;il.length&&(a=a.slice(0,l.length)):a=[],i=0;i90&&(v-=180,d=-d),{angle:v,flip:d,p:r.c2p(c,a,l),offsetMultplier:m}}},{}],712:[function(t,o,f){var r=t("@plotly/d3"),a=t("../../components/drawing"),l=t("./map_1d_array"),c=t("./makepath"),i=t("./orient_text"),s=t("../../lib/svg_text_utils"),u=t("../../lib"),h=u.strRotate,d=u.strTranslate,m=t("../../constants/alignment");function p(_,A,b,k,w,M){var T="const-"+w+"-lines",E=b.selectAll("."+T).data(M);E.enter().append("path").classed(T,!0).style("vector-effect","non-scaling-stroke"),E.each(function(S){var P=S,L=P.x,R=P.y,F=l([],L,_.c2p),D=l([],R,A.c2p),O="M"+c(F,D,P.smoothing);r.select(this).attr("d",O).style("stroke-width",P.width).style("stroke",P.color).style("fill","none")}),E.exit().remove()}function g(_,A,b,k,w,M,T,E){var S=M.selectAll("text."+E).data(T);S.enter().append("text").classed(E,!0);var P=0,L={};return S.each(function(R,F){var D;if(R.axis.tickangle==="auto")D=i(k,A,b,R.xy,R.dxy);else{var O=(R.axis.tickangle+180)*Math.PI/180;D=i(k,A,b,R.xy,[Math.cos(O),Math.sin(O)])}F||(L={angle:D.angle,flip:D.flip});var N=(R.endAnchor?-1:1)*D.flip,B=r.select(this).attr({"text-anchor":N>0?"start":"end","data-notex":1}).call(a.font,R.font).text(R.text).call(s.convertToTspans,_),W=a.bBox(this);B.attr("transform",d(D.p[0],D.p[1])+h(D.angle)+d(R.axis.labelpadding*N,.3*W.height)),P=Math.max(P,W.width+R.axis.labelpadding)}),S.exit().remove(),L.maxExtent=P,L}o.exports=function(_,A,b,k){var w=A.xaxis,M=A.yaxis,T=_._fullLayout._clips;u.makeTraceGroups(k,b,"trace").each(function(E){var S=r.select(this),P=E[0],L=P.trace,R=L.aaxis,F=L.baxis,D=u.ensureSingle(S,"g","minorlayer"),O=u.ensureSingle(S,"g","majorlayer"),N=u.ensureSingle(S,"g","boundarylayer"),B=u.ensureSingle(S,"g","labellayer");S.style("opacity",L.opacity),p(w,M,O,R,"a",R._gridlines),p(w,M,O,F,"b",F._gridlines),p(w,M,D,R,"a",R._minorgridlines),p(w,M,D,F,"b",F._minorgridlines),p(w,M,N,R,"a-boundary",R._boundarylines),p(w,M,N,F,"b-boundary",F._boundarylines);var W=g(_,w,M,L,P,B,R._labels,"a-label"),G=g(_,w,M,L,P,B,F._labels,"b-label");(function(K,te,Y,J,re,U,V,H){var ne,q,Q,ee,ie=u.aggNums(Math.min,null,Y.a),ae=u.aggNums(Math.max,null,Y.a),ue=u.aggNums(Math.min,null,Y.b),le=u.aggNums(Math.max,null,Y.b);ne=.5*(ie+ae),q=ue,Q=Y.ab2xy(ne,q,!0),ee=Y.dxyda_rough(ne,q),V.angle===void 0&&u.extendFlat(V,i(Y,re,U,Q,Y.dxydb_rough(ne,q))),x(K,te,Y,J,Q,ee,Y.aaxis,re,U,V,"a-title"),ne=ie,q=.5*(ue+le),Q=Y.ab2xy(ne,q,!0),ee=Y.dxydb_rough(ne,q),H.angle===void 0&&u.extendFlat(H,i(Y,re,U,Q,Y.dxyda_rough(ne,q))),x(K,te,Y,J,Q,ee,Y.baxis,re,U,H,"b-title")})(_,B,L,P,w,M,W,G),function(K,te,Y,J,re){var U,V,H,ne,q=Y.select("#"+K._clipPathId);q.size()||(q=Y.append("clipPath").classed("carpetclip",!0));var Q=u.ensureSingle(q,"path","carpetboundary"),ee=te.clipsegments,ie=[];for(ne=0;ne90&&B<270,G=r.select(this);G.text(T.title.text).call(s.convertToTspans,_),W&&(D=(-s.lineCount(G)+v)*y*N-D),G.attr("transform",d(O.p[0],O.p[1])+h(O.angle)+d(0,D)).attr("text-anchor","middle").call(a.font,T.title.font)}),F.exit().remove()}},{"../../components/drawing":388,"../../constants/alignment":471,"../../lib":503,"../../lib/svg_text_utils":529,"./makepath":709,"./map_1d_array":710,"./orient_text":711,"@plotly/d3":58}],713:[function(t,o,f){var r=t("./constants"),a=t("../../lib/search").findBin,l=t("./compute_control_points"),c=t("./create_spline_evaluator"),i=t("./create_i_derivative_evaluator"),s=t("./create_j_derivative_evaluator");o.exports=function(u){var h=u._a,d=u._b,m=h.length,p=d.length,g=u.aaxis,y=u.baxis,v=h[0],x=h[m-1],_=d[0],A=d[p-1],b=h[h.length-1]-h[0],k=d[d.length-1]-d[0],w=b*r.RELATIVE_CULL_TOLERANCE,M=k*r.RELATIVE_CULL_TOLERANCE;v-=w,x+=w,_-=M,A+=M,u.isVisible=function(T,E){return T>v&&T_&&Ex||E<_||E>A},u.setScale=function(){var T=u._x,E=u._y,S=l(u._xctrl,u._yctrl,T,E,g.smoothing,y.smoothing);u._xctrl=S[0],u._yctrl=S[1],u.evalxy=c([u._xctrl,u._yctrl],m,p,g.smoothing,y.smoothing),u.dxydi=i([u._xctrl,u._yctrl],g.smoothing,y.smoothing),u.dxydj=s([u._xctrl,u._yctrl],g.smoothing,y.smoothing)},u.i2a=function(T){var E=Math.max(0,Math.floor(T[0]),m-2),S=T[0]-E;return(1-S)*h[E]+S*h[E+1]},u.j2b=function(T){var E=Math.max(0,Math.floor(T[1]),m-2),S=T[1]-E;return(1-S)*d[E]+S*d[E+1]},u.ij2ab=function(T){return[u.i2a(T[0]),u.j2b(T[1])]},u.a2i=function(T){var E=Math.max(0,Math.min(a(T,h),m-2)),S=h[E],P=h[E+1];return Math.max(0,Math.min(m-1,E+(T-S)/(P-S)))},u.b2j=function(T){var E=Math.max(0,Math.min(a(T,d),p-2)),S=d[E],P=d[E+1];return Math.max(0,Math.min(p-1,E+(T-S)/(P-S)))},u.ab2ij=function(T){return[u.a2i(T[0]),u.b2j(T[1])]},u.i2c=function(T,E){return u.evalxy([],T,E)},u.ab2xy=function(T,E,S){if(!S&&(Th[m-1]|Ed[p-1]))return[!1,!1];var P=u.a2i(T),L=u.b2j(E),R=u.evalxy([],P,L);if(S){var F,D,O,N,B=0,W=0,G=[];Th[m-1]?(F=m-2,D=1,B=(T-h[m-1])/(h[m-1]-h[m-2])):D=P-(F=Math.max(0,Math.min(m-2,Math.floor(P)))),Ed[p-1]?(O=p-2,N=1,W=(E-d[p-1])/(d[p-1]-d[p-2])):N=L-(O=Math.max(0,Math.min(p-2,Math.floor(L)))),B&&(u.dxydi(G,F,O,D,N),R[0]+=G[0]*B,R[1]+=G[1]*B),W&&(u.dxydj(G,F,O,D,N),R[0]+=G[0]*W,R[1]+=G[1]*W)}return R},u.c2p=function(T,E,S){return[E.c2p(T[0]),S.c2p(T[1])]},u.p2x=function(T,E,S){return[E.p2c(T[0]),S.p2c(T[1])]},u.dadi=function(T){var E=Math.max(0,Math.min(h.length-2,T));return h[E+1]-h[E]},u.dbdj=function(T){var E=Math.max(0,Math.min(d.length-2,T));return d[E+1]-d[E]},u.dxyda=function(T,E,S,P){var L=u.dxydi(null,T,E,S,P),R=u.dadi(T,S);return[L[0]/R,L[1]/R]},u.dxydb=function(T,E,S,P){var L=u.dxydj(null,T,E,S,P),R=u.dbdj(E,P);return[L[0]/R,L[1]/R]},u.dxyda_rough=function(T,E,S){var P=b*(S||.1),L=u.ab2xy(T+P,E,!0),R=u.ab2xy(T-P,E,!0);return[.5*(L[0]-R[0])/P,.5*(L[1]-R[1])/P]},u.dxydb_rough=function(T,E,S){var P=k*(S||.1),L=u.ab2xy(T,E+P,!0),R=u.ab2xy(T,E-P,!0);return[.5*(L[0]-R[0])/P,.5*(L[1]-R[1])/P]},u.dpdx=function(T){return T._m},u.dpdy=function(T){return T._m}}},{"../../lib/search":523,"./compute_control_points":701,"./constants":702,"./create_i_derivative_evaluator":703,"./create_j_derivative_evaluator":704,"./create_spline_evaluator":705}],714:[function(t,o,f){var r=t("../../lib");o.exports=function(a,l,c){var i,s,u,h=[],d=[],m=a[0].length,p=a.length;function g(te,Y){var J,re=0,U=0;return te>0&&(J=a[Y][te-1])!==void 0&&(U++,re+=J),te0&&(J=a[Y-1][te])!==void 0&&(U++,re+=J),Y0&&s0&&i1e-5);return r.log("Smoother converged to",P,"after",L,"iterations"),a}},{"../../lib":503}],715:[function(t,o,f){var r=t("../../lib").isArray1D;o.exports=function(a,l,c){var i=c("x"),s=i&&i.length,u=c("y"),h=u&&u.length;if(!s&&!h)return!1;if(l._cheater=!i,s&&!r(i)||h&&!r(u))l._length=null;else{var d=s?i.length:1/0;h&&(d=Math.min(d,u.length)),l.a&&l.a.length&&(d=Math.min(d,l.a.length)),l.b&&l.b.length&&(d=Math.min(d,l.b.length)),l._length=d}return!0}},{"../../lib":503}],716:[function(t,o,f){var r=t("../../plots/template_attributes").hovertemplateAttrs,a=t("../scattergeo/attributes"),l=t("../../components/colorscale/attributes"),c=t("../../plots/attributes"),i=t("../../components/color/attributes").defaultLine,s=t("../../lib/extend").extendFlat,u=a.marker.line;o.exports=s({locations:{valType:"data_array",editType:"calc"},locationmode:a.locationmode,z:{valType:"data_array",editType:"calc"},geojson:s({},a.geojson,{}),featureidkey:a.featureidkey,text:s({},a.text,{}),hovertext:s({},a.hovertext,{}),marker:{line:{color:s({},u.color,{dflt:i}),width:s({},u.width,{dflt:1}),editType:"calc"},opacity:{valType:"number",arrayOk:!0,min:0,max:1,dflt:1,editType:"style"},editType:"calc"},selected:{marker:{opacity:a.selected.marker.opacity,editType:"plot"},editType:"plot"},unselected:{marker:{opacity:a.unselected.marker.opacity,editType:"plot"},editType:"plot"},hoverinfo:s({},c.hoverinfo,{editType:"calc",flags:["location","z","text","name"]}),hovertemplate:r(),showlegend:s({},c.showlegend,{dflt:!1})},l("",{cLetter:"z",editTypeOverride:"calc"}))},{"../../components/color/attributes":365,"../../components/colorscale/attributes":373,"../../lib/extend":493,"../../plots/attributes":550,"../../plots/template_attributes":633,"../scattergeo/attributes":969}],717:[function(t,o,f){var r=t("fast-isnumeric"),a=t("../../constants/numerical").BADNUM,l=t("../../components/colorscale/calc"),c=t("../scatter/arrays_to_calcdata"),i=t("../scatter/calc_selection");function s(u){return u&&typeof u=="string"}o.exports=function(u,h){var d,m=h._length,p=new Array(m);d=h.geojson?function(_){return s(_)||r(_)}:s;for(var g=0;g")}}(c,g,u),[c]}},{"../../lib":503,"../../plots/cartesian/axes":554,"./attributes":716}],721:[function(t,o,f){o.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),colorbar:t("../heatmap/colorbar"),calc:t("./calc"),calcGeoJSON:t("./plot").calcGeoJSON,plot:t("./plot").plot,style:t("./style").style,styleOnSelect:t("./style").styleOnSelect,hoverPoints:t("./hover"),eventData:t("./event_data"),selectPoints:t("./select"),moduleType:"trace",name:"choropleth",basePlotModule:t("../../plots/geo"),categories:["geo","noOpacity","showLegend"],meta:{}}},{"../../plots/geo":589,"../heatmap/colorbar":795,"./attributes":716,"./calc":717,"./defaults":718,"./event_data":719,"./hover":720,"./plot":722,"./select":723,"./style":724}],722:[function(t,o,f){var r=t("@plotly/d3"),a=t("../../lib"),l=t("../../lib/geo_location_utils"),c=t("../../lib/topojson_utils").getTopojsonFeatures,i=t("../../plots/cartesian/autorange").findExtremes,s=t("./style").style;o.exports={calcGeoJSON:function(u,h){for(var d=u[0].trace,m=h[d.geo],p=m._subplot,g=d.locationmode,y=d._length,v=g==="geojson-id"?l.extractTraceFeature(u):c(d,p.topojson),x=[],_=[],A=0;A=0;c--){var i=l[c].id;if(typeof i=="string"&&i.indexOf("water")===0){for(var s=c+1;s=0;h--)s.removeLayer(u[h][1])},i.dispose=function(){var s=this.subplot.map;this._removeLayers(),s.removeSource(this.sourceId)},o.exports=function(s,u){var h=u[0].trace,d=new c(s,h.uid),m=d.sourceId,p=r(u),g=d.below=s.belowLookup["trace-"+h.uid];return s.map.addSource(m,{type:"geojson",data:p.geojson}),d._addLayers(p,g),u[0].trace._glTrace=d,d}},{"../../plots/mapbox/constants":611,"./convert":726}],730:[function(t,o,f){var r=t("../../components/colorscale/attributes"),a=t("../../plots/cartesian/axis_format_attributes").axisHoverFormat,l=t("../../plots/template_attributes").hovertemplateAttrs,c=t("../mesh3d/attributes"),i=t("../../plots/attributes"),s=t("../../lib/extend").extendFlat,u={x:{valType:"data_array",editType:"calc+clearAxisTypes"},y:{valType:"data_array",editType:"calc+clearAxisTypes"},z:{valType:"data_array",editType:"calc+clearAxisTypes"},u:{valType:"data_array",editType:"calc"},v:{valType:"data_array",editType:"calc"},w:{valType:"data_array",editType:"calc"},sizemode:{valType:"enumerated",values:["scaled","absolute"],editType:"calc",dflt:"scaled"},sizeref:{valType:"number",editType:"calc",min:0},anchor:{valType:"enumerated",editType:"calc",values:["tip","tail","cm","center"],dflt:"cm"},text:{valType:"string",dflt:"",arrayOk:!0,editType:"calc"},hovertext:{valType:"string",dflt:"",arrayOk:!0,editType:"calc"},hovertemplate:l({editType:"calc"},{keys:["norm"]}),uhoverformat:a("u",1),vhoverformat:a("v",1),whoverformat:a("w",1),xhoverformat:a("x"),yhoverformat:a("y"),zhoverformat:a("z"),showlegend:s({},i.showlegend,{dflt:!1})};s(u,r("",{colorAttr:"u/v/w norm",showScaleDflt:!0,editTypeOverride:"calc"})),["opacity","lightposition","lighting"].forEach(function(h){u[h]=c[h]}),u.hoverinfo=s({},i.hoverinfo,{editType:"calc",flags:["x","y","z","u","v","w","norm","text","name"],dflt:"x+y+z+norm+text+name"}),u.transforms=void 0,o.exports=u},{"../../components/colorscale/attributes":373,"../../lib/extend":493,"../../plots/attributes":550,"../../plots/cartesian/axis_format_attributes":557,"../../plots/template_attributes":633,"../mesh3d/attributes":867}],731:[function(t,o,f){var r=t("../../components/colorscale/calc");o.exports=function(a,l){for(var c=l.u,i=l.v,s=l.w,u=Math.min(l.x.length,l.y.length,l.z.length,c.length,i.length,s.length),h=-1/0,d=1/0,m=0;mu.level||u.starts.length&&s===u.level)}break;case"constraint":if(c.prefixBoundary=!1,c.edgepaths.length)return;var h=c.x.length,d=c.y.length,m=-1/0,p=1/0;for(l=0;l":v>m&&(c.prefixBoundary=!0);break;case"<":(vm||c.starts.length&&y===p)&&(c.prefixBoundary=!0);break;case"][":g=Math.min(v[0],v[1]),y=Math.max(v[0],v[1]),gm&&(c.prefixBoundary=!0)}}}},{}],738:[function(t,o,f){var r=t("../../components/colorscale"),a=t("./make_color_map"),l=t("./end_plus");o.exports={min:"zmin",max:"zmax",calc:function(c,i,s){var u=i.contours,h=i.line,d=u.size||1,m=u.coloring,p=a(i,{isColorbar:!0});if(m==="heatmap"){var g=r.extractOpts(i);s._fillgradient=g.reversescale?r.flipScale(g.colorscale):g.colorscale,s._zrange=[g.min,g.max]}else m==="fill"&&(s._fillcolor=p);s._line={color:m==="lines"?p:h.color,width:u.showlines!==!1?h.width:0,dash:h.dash},s._levels={start:u.start,end:l(u),size:d}}}},{"../../components/colorscale":378,"./end_plus":746,"./make_color_map":751}],739:[function(t,o,f){o.exports={BOTTOMSTART:[1,9,13,104,713],TOPSTART:[4,6,7,104,713],LEFTSTART:[8,12,14,208,1114],RIGHTSTART:[2,3,11,208,1114],NEWDELTA:[null,[-1,0],[0,-1],[-1,0],[1,0],null,[0,-1],[-1,0],[0,1],[0,1],null,[0,1],[1,0],[1,0],[0,-1]],CHOOSESADDLE:{104:[4,1],208:[2,8],713:[7,13],1114:[11,14]},SADDLEREMAINDER:{1:4,2:8,4:1,7:13,8:2,11:14,13:7,14:11},LABELDISTANCE:2,LABELINCREASE:10,LABELMIN:3,LABELMAX:10,LABELOPTIMIZER:{EDGECOST:1,ANGLECOST:1,NEIGHBORCOST:5,SAMELEVELFACTOR:10,SAMELEVELDISTANCE:5,MAXCOST:100,INITIALSEARCHPOINTS:10,ITERATIONS:5}}},{}],740:[function(t,o,f){var r=t("fast-isnumeric"),a=t("./label_defaults"),l=t("../../components/color"),c=l.addOpacity,i=l.opacity,s=t("../../constants/filter_ops"),u=s.CONSTRAINT_REDUCTION,h=s.COMPARISON_OPS2;o.exports=function(d,m,p,g,y,v){var x,_,A,b=m.contours,k=p("contours.operation");b._operation=u[k],function(w,M){var T;h.indexOf(M.operation)===-1?(w("contours.value",[0,1]),Array.isArray(M.value)?M.value.length>2?M.value=M.value.slice(2):M.length===0?M.value=[0,1]:M.length<2?(T=parseFloat(M.value[0]),M.value=[T,T+1]):M.value=[parseFloat(M.value[0]),parseFloat(M.value[1])]:r(M.value)&&(T=parseFloat(M.value),M.value=[T,T+1])):(w("contours.value",0),r(M.value)||(Array.isArray(M.value)?M.value=parseFloat(M.value[0]):M.value=0))}(p,b),k==="="?x=b.showlines=!0:(x=p("contours.showlines"),A=p("fillcolor",c((d.line||{}).color||y,.5))),x&&(_=p("line.color",A&&i(A)?c(m.fillcolor,1):y),p("line.width",2),p("line.dash")),p("line.smoothing"),a(p,g,_,v)}},{"../../components/color":366,"../../constants/filter_ops":475,"./label_defaults":750,"fast-isnumeric":190}],741:[function(t,o,f){var r=t("../../constants/filter_ops"),a=t("fast-isnumeric");function l(s,u){var h,d=Array.isArray(u);function m(p){return a(p)?+p:null}return r.COMPARISON_OPS2.indexOf(s)!==-1?h=m(d?u[0]:u):r.INTERVAL_OPS.indexOf(s)!==-1?h=d?[m(u[0]),m(u[1])]:[m(u),m(u)]:r.SET_OPS.indexOf(s)!==-1&&(h=d?u.map(m):[m(u)]),h}function c(s){return function(u){u=l(s,u);var h=Math.min(u[0],u[1]),d=Math.max(u[0],u[1]);return{start:h,end:d,size:d-h}}}function i(s){return function(u){return{start:u=l(s,u),end:1/0,size:1/0}}}o.exports={"[]":c("[]"),"][":c("]["),">":i(">"),"<":i("<"),"=":i("=")}},{"../../constants/filter_ops":475,"fast-isnumeric":190}],742:[function(t,o,f){o.exports=function(r,a,l,c){var i=c("contours.start"),s=c("contours.end"),u=i===!1||s===!1,h=l("contours.size");!(u?a.autocontour=!0:l("autocontour",!1))&&h||l("ncontours")}},{}],743:[function(t,o,f){var r=t("../../lib");function a(l){return r.extendFlat({},l,{edgepaths:r.extendDeep([],l.edgepaths),paths:r.extendDeep([],l.paths),starts:r.extendDeep([],l.starts)})}o.exports=function(l,c){var i,s,u,h=function(p){return p.reverse()},d=function(p){return p};switch(c){case"=":case"<":return l;case">":for(l.length!==1&&r.warn("Contour data invalid for the specified inequality operation."),s=l[0],i=0;i1e3){r.warn("Too many contours, clipping at 1000",c);break}return d}},{"../../lib":503,"./constraint_mapping":741,"./end_plus":746}],746:[function(t,o,f){o.exports=function(r){return r.end+r.size/1e6}},{}],747:[function(t,o,f){var r=t("../../lib"),a=t("./constants");function l(s,u,h,d){return Math.abs(s[0]-u[0])20&&ee?Q===208||Q===1114?ae=ie[0]===0?1:-1:ue=ie[1]===0?1:-1:a.BOTTOMSTART.indexOf(Q)!==-1?ue=1:a.LEFTSTART.indexOf(Q)!==-1?ae=1:a.TOPSTART.indexOf(Q)!==-1?ue=-1:ae=-1,[ae,ue]}(y,h,u),x=[i(s,u,[-v[0],-v[1]])],_=s.z.length,A=s.z[0].length,b=u.slice(),k=v.slice();for(p=0;p<1e4;p++){if(y>20?(y=a.CHOOSESADDLE[y][(v[0]||v[1])<0?0:1],s.crossings[g]=a.SADDLEREMAINDER[y]):delete s.crossings[g],!(v=a.NEWDELTA[y])){r.log("Found bad marching index:",y,u,s.level);break}x.push(i(s,u,v)),u[0]+=v[0],u[1]+=v[1],g=u.join(","),l(x[x.length-1],x[x.length-2],d,m)&&x.pop();var w=v[0]&&(u[0]<0||u[0]>A-2)||v[1]&&(u[1]<0||u[1]>_-2);if(u[0]===b[0]&&u[1]===b[1]&&v[0]===k[0]&&v[1]===k[1]||h&&w)break;y=s.crossings[g]}p===1e4&&r.log("Infinite loop in contour?");var M,T,E,S,P,L,R,F,D,O,N,B,W,G,K,te=l(x[0],x[x.length-1],d,m),Y=0,J=.2*s.smoothing,re=[],U=0;for(p=1;p=U;p--)if((M=re[p])=U&&M+re[T]F&&D--,s.edgepaths[D]=N.concat(x,O));break}q||(s.edgepaths[F]=x.concat(O))}for(F=0;Fl?0:1)+(c[0][1]>l?0:2)+(c[1][1]>l?0:4)+(c[1][0]>l?0:8);return i===5||i===10?l>(c[0][0]+c[0][1]+c[1][0]+c[1][1])/4?i===5?713:1114:i===5?104:208:i===15?0:i}o.exports=function(l){var c,i,s,u,h,d,m,p,g,y=l[0].z,v=y.length,x=y[0].length,_=v===2||x===2;for(i=0;i=0&&(T=K,S=P):Math.abs(M[1]-T[1])<.01?Math.abs(M[1]-K[1])<.01&&(K[0]-M[0])*(T[0]-K[0])>=0&&(T=K,S=P):a.log("endpt to newendpt is not vert. or horz.",M,T,K)}if(M=T,S>=0)break;F+="L"+T}if(S===k.edgepaths.length){a.log("unclosed perimeter path");break}D=S,(N=O.indexOf(D)===-1)&&(D=O[0],F+="Z")}for(D=0;DT.center?T.right-P:P-T.left)/(F+Math.abs(Math.sin(R)*S)),N=(L>T.middle?T.bottom-L:L-T.top)/(Math.abs(D)+Math.cos(R)*S);if(O<1||N<1)return 1/0;var B=x.EDGECOST*(1/(O-1)+1/(N-1));B+=x.ANGLECOST*R*R;for(var W=P-F,G=L-D,K=P+F,te=L+D,Y=0;Y2*x.MAXCOST)break;N&&(P/=2),L=(S=R-P/2)+1.5*P}if(O<=x.MAXCOST)return F},f.addLabelData=function(k,w,M,T){var E=w.fontSize,S=w.width+E/3,P=Math.max(0,w.height-E/3),L=k.x,R=k.y,F=k.theta,D=Math.sin(F),O=Math.cos(F),N=function(W,G){return[L+W*O-G*D,R+W*D+G*O]},B=[N(-S/2,-P/2),N(-S/2,P/2),N(S/2,P/2),N(S/2,-P/2)];M.push({text:w.text,x:L,y:R,dy:w.dy,theta:F,level:w.level,width:S,height:P}),T.push(B)},f.drawLabels=function(k,w,M,T,E){var S=k.selectAll("text").data(w,function(R){return R.text+","+R.x+","+R.y+","+R.theta});if(S.exit().remove(),S.enter().append("text").attr({"data-notex":1,"text-anchor":"middle"}).each(function(R){var F=R.x+Math.sin(R.theta)*R.dy,D=R.y-Math.cos(R.theta)*R.dy;r.select(this).text(R.text).attr({x:F,y:D,transform:"rotate("+180*R.theta/Math.PI+" "+F+" "+D+")"}).call(i.convertToTspans,M)}),E){for(var P="",L=0;Ls.end&&(s.start=s.end=(s.start+s.end)/2),c._input.contours||(c._input.contours={}),a.extendFlat(c._input.contours,{start:s.start,end:s.end,size:s.size}),c._input.autocontour=!0}else if(s.type!=="constraint"){var m,p=s.start,g=s.end,y=c._input.contours;p>g&&(s.start=y.start=g,g=s.end=y.end=p,p=s.start),!(s.size>0)&&(m=p===g?1:l(p,g,c.ncontours).dtick,y.size=s.size=m)}}},{"../../lib":503,"../../plots/cartesian/axes":554}],755:[function(t,o,f){var r=t("@plotly/d3"),a=t("../../components/drawing"),l=t("../heatmap/style"),c=t("./make_color_map");o.exports=function(i){var s=r.select(i).selectAll("g.contour");s.style("opacity",function(u){return u[0].trace.opacity}),s.each(function(u){var h=r.select(this),d=u[0].trace,m=d.contours,p=d.line,g=m.size||1,y=m.start,v=m.type==="constraint",x=!v&&m.coloring==="lines",_=!v&&m.coloring==="fill",A=x||_?c(d):null;h.selectAll("g.contourlevel").each(function(w){r.select(this).selectAll("path").call(a.lineGroupStyle,p.width,x?A(w.level):p.color,p.dash)});var b=m.labelfont;if(h.selectAll("g.contourlabels text").each(function(w){a.font(r.select(this),{family:b.family,size:b.size,color:b.color||(x?A(w.level):p.color)})}),v)h.selectAll("g.contourfill path").style("fill",d.fillcolor);else if(_){var k;h.selectAll("g.contourfill path").style("fill",function(w){return k===void 0&&(k=w.level),A(w.level+.5*g)}),k===void 0&&(k=y),h.selectAll("g.contourbg path").style("fill",A(k-.5*g))}}),l(i)}},{"../../components/drawing":388,"../heatmap/style":805,"./make_color_map":751,"@plotly/d3":58}],756:[function(t,o,f){var r=t("../../components/colorscale/defaults"),a=t("./label_defaults");o.exports=function(l,c,i,s,u){var h,d=i("contours.coloring"),m="";d==="fill"&&(h=i("contours.showlines")),h!==!1&&(d!=="lines"&&(m=i("line.color","#000")),i("line.width",.5),i("line.dash")),d!=="none"&&(l.showlegend!==!0&&(c.showlegend=!1),c._dfltShowLegend=!1,r(l,c,s,i,{prefix:"",cLetter:"z"})),i("line.smoothing"),a(i,s,m,u)}},{"../../components/colorscale/defaults":376,"./label_defaults":750}],757:[function(t,o,f){var r=t("../heatmap/attributes"),a=t("../contour/attributes"),l=t("../../components/colorscale/attributes"),c=t("../../lib/extend").extendFlat,i=a.contours;o.exports=c({carpet:{valType:"string",editType:"calc"},z:r.z,a:r.x,a0:r.x0,da:r.dx,b:r.y,b0:r.y0,db:r.dy,text:r.text,hovertext:r.hovertext,transpose:r.transpose,atype:r.xtype,btype:r.ytype,fillcolor:a.fillcolor,autocontour:a.autocontour,ncontours:a.ncontours,contours:{type:i.type,start:i.start,end:i.end,size:i.size,coloring:{valType:"enumerated",values:["fill","lines","none"],dflt:"fill",editType:"calc"},showlines:i.showlines,showlabels:i.showlabels,labelfont:i.labelfont,labelformat:i.labelformat,operation:i.operation,value:i.value,editType:"calc",impliedEdits:{autocontour:!1}},line:{color:a.line.color,width:a.line.width,dash:a.line.dash,smoothing:a.line.smoothing,editType:"plot"},transforms:void 0},l("",{cLetter:"z",autoColorDflt:!1}))},{"../../components/colorscale/attributes":373,"../../lib/extend":493,"../contour/attributes":735,"../heatmap/attributes":792}],758:[function(t,o,f){var r=t("../../components/colorscale/calc"),a=t("../../lib"),l=t("../heatmap/convert_column_xyz"),c=t("../heatmap/clean_2d_array"),i=t("../heatmap/interp2d"),s=t("../heatmap/find_empties"),u=t("../heatmap/make_bound_array"),h=t("./defaults"),d=t("../carpet/lookup_carpetid"),m=t("../contour/set_contours");o.exports=function(p,g){var y=g._carpetTrace=d(p,g);if(y&&y.visible&&y.visible!=="legendonly"){if(!g.a||!g.b){var v=p.data[y.index],x=p.data[g.index];x.a||(x.a=v.a),x.b||(x.b=v.b),h(x,g,g._defaultColor,p._fullLayout)}var _=function(A,b){var k,w,M,T,E,S,P,L=b._carpetTrace,R=L.aaxis,F=L.baxis;R._minDtick=0,F._minDtick=0,a.isArray1D(b.z)&&l(b,R,F,"a","b",["z"]),k=b._a=b._a||b.a,T=b._b=b._b||b.b,k=k?R.makeCalcdata(b,"_a"):[],T=T?F.makeCalcdata(b,"_b"):[],w=b.a0||0,M=b.da||1,E=b.b0||0,S=b.db||1,P=b._z=c(b._z||b.z,b.transpose),b._emptypoints=s(P),i(P,b._emptypoints);var D=a.maxRowLength(P),O=b.xtype==="scaled"?"":k,N=u(b,O,w,M,D,R),B=b.ytype==="scaled"?"":T,W=u(b,B,E,S,P.length,F),G={a:N,b:W,z:P};return b.contours.type==="levels"&&b.contours.coloring!=="none"&&r(A,b,{vals:P,containerStr:"",cLetter:"z"}),[G]}(p,g);return m(g,g._z),_}}},{"../../components/colorscale/calc":374,"../../lib":503,"../carpet/lookup_carpetid":708,"../contour/set_contours":754,"../heatmap/clean_2d_array":794,"../heatmap/convert_column_xyz":796,"../heatmap/find_empties":798,"../heatmap/interp2d":801,"../heatmap/make_bound_array":803,"./defaults":759}],759:[function(t,o,f){var r=t("../../lib"),a=t("../heatmap/xyz_defaults"),l=t("./attributes"),c=t("../contour/constraint_defaults"),i=t("../contour/contours_defaults"),s=t("../contour/style_defaults");o.exports=function(u,h,d,m){function p(g,y){return r.coerce(u,h,l,g,y)}if(p("carpet"),u.a&&u.b){if(!a(u,h,p,m,"a","b"))return void(h.visible=!1);p("text"),p("contours.type")==="constraint"?c(u,h,p,m,d,{hasHover:!1}):(i(u,h,p,function(g){return r.coerce2(u,h,l,g)}),s(u,h,p,m,{hasHover:!1}))}else h._defaultColor=d,h._length=null}},{"../../lib":503,"../contour/constraint_defaults":740,"../contour/contours_defaults":742,"../contour/style_defaults":756,"../heatmap/xyz_defaults":807,"./attributes":757}],760:[function(t,o,f){o.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),colorbar:t("../contour/colorbar"),calc:t("./calc"),plot:t("./plot"),style:t("../contour/style"),moduleType:"trace",name:"contourcarpet",basePlotModule:t("../../plots/cartesian"),categories:["cartesian","svg","carpet","contour","symbols","showLegend","hasLines","carpetDependent","noHover","noSortingByValue"],meta:{}}},{"../../plots/cartesian":568,"../contour/colorbar":738,"../contour/style":755,"./attributes":757,"./calc":758,"./defaults":759,"./plot":761}],761:[function(t,o,f){var r=t("@plotly/d3"),a=t("../carpet/map_1d_array"),l=t("../carpet/makepath"),c=t("../../components/drawing"),i=t("../../lib"),s=t("../contour/make_crossings"),u=t("../contour/find_all_paths"),h=t("../contour/plot"),d=t("../contour/constants"),m=t("../contour/convert_to_constraints"),p=t("../contour/empty_pathinfo"),g=t("../contour/close_boundaries"),y=t("../carpet/lookup_carpetid"),v=t("../carpet/axis_aligned_line");function x(b,k,w){var M=b.getPointAtLength(k),T=b.getPointAtLength(w),E=T.x-M.x,S=T.y-M.y,P=Math.sqrt(E*E+S*S);return[E/P,S/P]}function _(b){var k=Math.sqrt(b[0]*b[0]+b[1]*b[1]);return[b[0]/k,b[1]/k]}function A(b,k){var w=Math.abs(b[0]*k[0]+b[1]*k[1]);return Math.sqrt(1-w*w)/w}o.exports=function(b,k,w,M){var T=k.xaxis,E=k.yaxis;i.makeTraceGroups(M,w,"contour").each(function(S){var P=r.select(this),L=S[0],R=L.trace,F=R._carpetTrace=y(b,R),D=b.calcdata[F.index][0];if(F.visible&&F.visible!=="legendonly"){var O=L.a,N=L.b,B=R.contours,W=p(B,k,L),G=B.type==="constraint",K=B._operation,te=G?K==="="?"lines":"fill":B.coloring,Y=[[O[0],N[N.length-1]],[O[O.length-1],N[N.length-1]],[O[O.length-1],N[0]],[O[0],N[0]]];s(W);var J=1e-8*(O[O.length-1]-O[0]),re=1e-8*(N[N.length-1]-N[0]);u(W,J,re);var U,V,H,ne,q=W;B.type==="constraint"&&(q=m(W,K)),function(ae,ue){var le,ge,fe,me,_e,Ae,ke,Le,de;for(le=0;le=0;ne--)U=D.clipsegments[ne],V=a([],U.x,T.c2p),H=a([],U.y,E.c2p),V.reverse(),H.reverse(),Q.push(l(V,H,U.bicubic));var ee="M"+Q.join("L")+"Z";(function(ae,ue,le,ge,fe,me){var _e,Ae,ke,Le,de=i.ensureSingle(ae,"g","contourbg").selectAll("path").data(me!=="fill"||fe?[]:[0]);de.enter().append("path"),de.exit().remove();var ve=[];for(Le=0;Le=0&&(yt=qe,Tt=at):Math.abs(ft[1]-yt[1])=0&&(yt=qe,Tt=at):i.log("endpt to newendpt is not vert. or horz.",ft,yt,qe)}if(Tt>=0)break;Lt+=Te(ft,yt),ft=yt}if(Tt===ze.edgepaths.length){i.log("unclosed perimeter path");break}nt=Tt,(Jt=Wt.indexOf(nt)===-1)&&(nt=Wt[0],Lt+=Te(ft,yt)+"Z",ft=null)}for(nt=0;ntUt&&(kt.max=Ut),kt.len=kt.max-kt.min}(this,Tt,yt,at,_e,Ot.height),!(at.len<(Ot.width+Ot.height)*d.LABELMIN)))for(var et=Math.min(Math.ceil(at.len/ft),d.LABELMAX),Lt=0;Lt0?+v[p]:0),g.push({type:"Feature",geometry:{type:"Point",coordinates:b},properties:k})}}var M=c.extractOpts(h),T=M.reversescale?c.flipScale(M.colorscale):M.colorscale,E=T[0][1],S=["interpolate",["linear"],["heatmap-density"],0,l.opacity(E)<1?E:l.addOpacity(E,0)];for(p=1;p=0;u--)i.removeLayer(s[u][1])},c.dispose=function(){var i=this.subplot.map;this._removeLayers(),i.removeSource(this.sourceId)},o.exports=function(i,s){var u=s[0].trace,h=new l(i,u.uid),d=h.sourceId,m=r(s),p=h.below=i.belowLookup["trace-"+u.uid];return i.map.addSource(d,{type:"geojson",data:m.geojson}),h._addLayers(m,p),h}},{"../../plots/mapbox/constants":611,"./convert":764}],770:[function(t,o,f){var r=t("../../lib");o.exports=function(a,l){for(var c=0;c"),d.color=function(k,w){var M=k.marker,T=w.mc||M.color,E=w.mlc||M.line.color,S=w.mlw||M.line.width;if(r(T))return T;if(r(E)&&S)return E}(p,y),[d]}}},{"../../components/color":366,"../../lib":503,"../bar/hover":655}],778:[function(t,o,f){o.exports={attributes:t("./attributes"),layoutAttributes:t("./layout_attributes"),supplyDefaults:t("./defaults").supplyDefaults,crossTraceDefaults:t("./defaults").crossTraceDefaults,supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),crossTraceCalc:t("./cross_trace_calc"),plot:t("./plot"),style:t("./style").style,hoverPoints:t("./hover"),eventData:t("./event_data"),selectPoints:t("../bar/select"),moduleType:"trace",name:"funnel",basePlotModule:t("../../plots/cartesian"),categories:["bar-like","cartesian","svg","oriented","showLegend","zoomScale"],meta:{}}},{"../../plots/cartesian":568,"../bar/select":660,"./attributes":771,"./calc":772,"./cross_trace_calc":774,"./defaults":775,"./event_data":776,"./hover":777,"./layout_attributes":779,"./layout_defaults":780,"./plot":781,"./style":782}],779:[function(t,o,f){o.exports={funnelmode:{valType:"enumerated",values:["stack","group","overlay"],dflt:"stack",editType:"calc"},funnelgap:{valType:"number",min:0,max:1,editType:"calc"},funnelgroupgap:{valType:"number",min:0,max:1,dflt:0,editType:"calc"}}},{}],780:[function(t,o,f){var r=t("../../lib"),a=t("./layout_attributes");o.exports=function(l,c,i){var s=!1;function u(m,p){return r.coerce(l,c,a,m,p)}for(var h=0;h path").each(function(x){if(!x.isBlank){var _=v.marker;r.select(this).call(l.fill,x.mc||_.color).call(l.stroke,x.mlc||_.line.color).call(a.dashLine,_.line.dash,x.mlw||_.line.width).style("opacity",v.selectedpoints&&!x.selected?c:1)}}),u(y,v,h),y.selectAll(".regions").each(function(){r.select(this).selectAll("path").style("stroke-width",0).call(l.fill,v.connector.fillcolor)}),y.selectAll(".lines").each(function(){var x=v.connector.line;a.lineGroupStyle(r.select(this).selectAll("path"),x.width,x.color,x.dash)})})}}},{"../../components/color":366,"../../components/drawing":388,"../../constants/interactions":478,"../bar/style":662,"../bar/uniform_text":664,"@plotly/d3":58}],783:[function(t,o,f){var r=t("../pie/attributes"),a=t("../../plots/attributes"),l=t("../../plots/domain").attributes,c=t("../../plots/template_attributes").hovertemplateAttrs,i=t("../../plots/template_attributes").texttemplateAttrs,s=t("../../lib/extend").extendFlat;o.exports={labels:r.labels,label0:r.label0,dlabel:r.dlabel,values:r.values,marker:{colors:r.marker.colors,line:{color:s({},r.marker.line.color,{dflt:null}),width:s({},r.marker.line.width,{dflt:1}),editType:"calc"},editType:"calc"},text:r.text,hovertext:r.hovertext,scalegroup:s({},r.scalegroup,{}),textinfo:s({},r.textinfo,{flags:["label","text","value","percent"]}),texttemplate:i({editType:"plot"},{keys:["label","color","value","text","percent"]}),hoverinfo:s({},a.hoverinfo,{flags:["label","text","value","percent","name"]}),hovertemplate:c({},{keys:["label","color","value","text","percent"]}),textposition:s({},r.textposition,{values:["inside","none"],dflt:"inside"}),textfont:r.textfont,insidetextfont:r.insidetextfont,title:{text:r.title.text,font:r.title.font,position:s({},r.title.position,{values:["top left","top center","top right"],dflt:"top center"}),editType:"plot"},domain:l({name:"funnelarea",trace:!0,editType:"calc"}),aspectratio:{valType:"number",min:0,dflt:1,editType:"plot"},baseratio:{valType:"number",min:0,max:1,dflt:.333,editType:"plot"}}},{"../../lib/extend":493,"../../plots/attributes":550,"../../plots/domain":584,"../../plots/template_attributes":633,"../pie/attributes":901}],784:[function(t,o,f){var r=t("../../plots/plots");f.name="funnelarea",f.plot=function(a,l,c,i){r.plotBasePlot(f.name,a,l,c,i)},f.clean=function(a,l,c,i){r.cleanBasePlot(f.name,a,l,c,i)}},{"../../plots/plots":619}],785:[function(t,o,f){var r=t("../pie/calc");o.exports={calc:function(a,l){return r.calc(a,l)},crossTraceCalc:function(a){r.crossTraceCalc(a,{type:"funnelarea"})}}},{"../pie/calc":903}],786:[function(t,o,f){var r=t("../../lib"),a=t("./attributes"),l=t("../../plots/domain").defaults,c=t("../bar/defaults").handleText,i=t("../pie/defaults").handleLabelsAndValues;o.exports=function(s,u,h,d){function m(k,w){return r.coerce(s,u,a,k,w)}var p=m("labels"),g=m("values"),y=i(p,g),v=y.len;if(u._hasLabels=y.hasLabels,u._hasValues=y.hasValues,!u._hasLabels&&u._hasValues&&(m("label0"),m("dlabel")),v){u._length=v,m("marker.line.width")&&m("marker.line.color",d.paper_bgcolor),m("marker.colors"),m("scalegroup");var x,_=m("text"),A=m("texttemplate");if(A||(x=m("textinfo",Array.isArray(_)?"text+percent":"percent")),m("hovertext"),m("hovertemplate"),A||x&&x!=="none"){var b=m("textposition");c(s,u,d,m,b,{moduleHasSelected:!1,moduleHasUnselected:!1,moduleHasConstrain:!1,moduleHasCliponaxis:!1,moduleHasTextangle:!1,moduleHasInsideanchor:!1})}l(u,d,m),m("title.text")&&(m("title.position"),r.coerceFont(m,"title.font",d.font)),m("aspectratio"),m("baseratio")}else u.visible=!1}},{"../../lib":503,"../../plots/domain":584,"../bar/defaults":652,"../pie/defaults":904,"./attributes":783}],787:[function(t,o,f){o.exports={moduleType:"trace",name:"funnelarea",basePlotModule:t("./base_plot"),categories:["pie-like","funnelarea","showLegend"],attributes:t("./attributes"),layoutAttributes:t("./layout_attributes"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc").calc,crossTraceCalc:t("./calc").crossTraceCalc,plot:t("./plot"),style:t("./style"),styleOne:t("../pie/style_one"),meta:{}}},{"../pie/style_one":912,"./attributes":783,"./base_plot":784,"./calc":785,"./defaults":786,"./layout_attributes":788,"./layout_defaults":789,"./plot":790,"./style":791}],788:[function(t,o,f){var r=t("../pie/layout_attributes").hiddenlabels;o.exports={hiddenlabels:r,funnelareacolorway:{valType:"colorlist",editType:"calc"},extendfunnelareacolors:{valType:"boolean",dflt:!0,editType:"calc"}}},{"../pie/layout_attributes":908}],789:[function(t,o,f){var r=t("../../lib"),a=t("./layout_attributes");o.exports=function(l,c){function i(s,u){return r.coerce(l,c,a,s,u)}i("hiddenlabels"),i("funnelareacolorway",c.colorway),i("extendfunnelareacolors")}},{"../../lib":503,"./layout_attributes":788}],790:[function(t,o,f){var r=t("@plotly/d3"),a=t("../../components/drawing"),l=t("../../lib"),c=l.strScale,i=l.strTranslate,s=t("../../lib/svg_text_utils"),u=t("../bar/plot").toMoveInsideBar,h=t("../bar/uniform_text"),d=h.recordMinTextSize,m=h.clearMinTextSize,p=t("../pie/helpers"),g=t("../pie/plot"),y=g.attachFxHandlers,v=g.determineInsideTextFont,x=g.layoutAreas,_=g.prerenderTitles,A=g.positionTitleOutside,b=g.formatSliceLabel;function k(w,M){return"l"+(M[0]-w[0])+","+(M[1]-w[1])}o.exports=function(w,M){var T=w._fullLayout;m("funnelarea",T),_(M,w),x(M,T._size),l.makeTraceGroups(T._funnelarealayer,M,"trace").each(function(E){var S=r.select(this),P=E[0],L=P.trace;(function(R){if(!R.length)return;var F=R[0],D=F.trace,O=D.aspectratio,N=D.baseratio;N>.999&&(N=.999);var B,W=Math.pow(N,2),G=F.vTotal,K=G,te=G*W/(1-W)/G;function Y(){var ke,Le={x:ke=Math.sqrt(te),y:-ke};return[Le.x,Le.y]}var J,re,U=[];for(U.push(Y()),J=R.length-1;J>-1;J--)if(!(re=R[J]).hidden){var V=re.v/K;te+=V,U.push(Y())}var H=1/0,ne=-1/0;for(J=0;J-1;J--)if(!(re=R[J]).hidden){var fe=U[ge+=1][0],me=U[ge][1];re.TL=[-fe,me],re.TR=[fe,me],re.BL=ue,re.BR=le,re.pxmid=(_e=re.TR,Ae=re.BR,[.5*(_e[0]+Ae[0]),.5*(_e[1]+Ae[1])]),ue=re.TL,le=re.TR}var _e,Ae})(E),S.each(function(){var R=r.select(this).selectAll("g.slice").data(E);R.enter().append("g").classed("slice",!0),R.exit().remove(),R.each(function(D,O){if(D.hidden)r.select(this).selectAll("path,g").remove();else{D.pointNumber=D.i,D.curveNumber=L.index;var N=P.cx,B=P.cy,W=r.select(this),G=W.selectAll("path.surface").data([D]);G.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),W.call(y,w,E);var K="M"+(N+D.TR[0])+","+(B+D.TR[1])+k(D.TR,D.BR)+k(D.BR,D.BL)+k(D.BL,D.TL)+"Z";G.attr("d",K),b(w,D,P);var te=p.castOption(L.textposition,D.pts),Y=W.selectAll("g.slicetext").data(D.text&&te!=="none"?[0]:[]);Y.enter().append("g").classed("slicetext",!0),Y.exit().remove(),Y.each(function(){var J=l.ensureSingle(r.select(this),"text","",function(ee){ee.attr("data-notex",1)}),re=l.ensureUniformFontSize(w,v(L,D,T.font));J.text(D.text).attr({class:"slicetext",transform:"","text-anchor":"middle"}).call(a.font,re).call(s.convertToTspans,w);var U,V,H,ne=a.bBox(J.node()),q=Math.min(D.BL[1],D.BR[1])+B,Q=Math.max(D.TL[1],D.TR[1])+B;V=Math.max(D.TL[0],D.BL[0])+N,H=Math.min(D.TR[0],D.BR[0])+N,(U=u(V,H,q,Q,ne,{isHorizontal:!0,constrained:!0,angle:0,anchor:"middle"})).fontSize=re.size,d(L.type,U,T),E[O].transform=U,J.attr("transform",l.getTextTransform(U))})}});var F=r.select(this).selectAll("g.titletext").data(L.title.text?[0]:[]);F.enter().append("g").classed("titletext",!0),F.exit().remove(),F.each(function(){var D=l.ensureSingle(r.select(this),"text","",function(B){B.attr("data-notex",1)}),O=L.title.text;L._meta&&(O=l.templateString(O,L._meta)),D.text(O).attr({class:"titletext",transform:"","text-anchor":"middle"}).call(a.font,L.title.font).call(s.convertToTspans,w);var N=A(P,T._size);D.attr("transform",i(N.x,N.y)+c(Math.min(1,N.scale))+i(N.tx,N.ty))})})})}},{"../../components/drawing":388,"../../lib":503,"../../lib/svg_text_utils":529,"../bar/plot":659,"../bar/uniform_text":664,"../pie/helpers":906,"../pie/plot":910,"@plotly/d3":58}],791:[function(t,o,f){var r=t("@plotly/d3"),a=t("../pie/style_one"),l=t("../bar/uniform_text").resizeText;o.exports=function(c){var i=c._fullLayout._funnelarealayer.selectAll(".trace");l(c,i,"funnelarea"),i.each(function(s){var u=s[0].trace,h=r.select(this);h.style({opacity:u.opacity}),h.selectAll("path.surface").each(function(d){r.select(this).call(a,d,u)})})}},{"../bar/uniform_text":664,"../pie/style_one":912,"@plotly/d3":58}],792:[function(t,o,f){var r=t("../scatter/attributes"),a=t("../../plots/attributes"),l=t("../../plots/font_attributes"),c=t("../../plots/cartesian/axis_format_attributes").axisHoverFormat,i=t("../../plots/template_attributes").hovertemplateAttrs,s=t("../../plots/template_attributes").texttemplateAttrs,u=t("../../components/colorscale/attributes"),h=t("../../lib/extend").extendFlat;o.exports=h({z:{valType:"data_array",editType:"calc"},x:h({},r.x,{impliedEdits:{xtype:"array"}}),x0:h({},r.x0,{impliedEdits:{xtype:"scaled"}}),dx:h({},r.dx,{impliedEdits:{xtype:"scaled"}}),y:h({},r.y,{impliedEdits:{ytype:"array"}}),y0:h({},r.y0,{impliedEdits:{ytype:"scaled"}}),dy:h({},r.dy,{impliedEdits:{ytype:"scaled"}}),xperiod:h({},r.xperiod,{impliedEdits:{xtype:"scaled"}}),yperiod:h({},r.yperiod,{impliedEdits:{ytype:"scaled"}}),xperiod0:h({},r.xperiod0,{impliedEdits:{xtype:"scaled"}}),yperiod0:h({},r.yperiod0,{impliedEdits:{ytype:"scaled"}}),xperiodalignment:h({},r.xperiodalignment,{impliedEdits:{xtype:"scaled"}}),yperiodalignment:h({},r.yperiodalignment,{impliedEdits:{ytype:"scaled"}}),text:{valType:"data_array",editType:"calc"},hovertext:{valType:"data_array",editType:"calc"},transpose:{valType:"boolean",dflt:!1,editType:"calc"},xtype:{valType:"enumerated",values:["array","scaled"],editType:"calc+clearAxisTypes"},ytype:{valType:"enumerated",values:["array","scaled"],editType:"calc+clearAxisTypes"},zsmooth:{valType:"enumerated",values:["fast","best",!1],dflt:!1,editType:"calc"},hoverongaps:{valType:"boolean",dflt:!0,editType:"none"},connectgaps:{valType:"boolean",editType:"calc"},xgap:{valType:"number",dflt:0,min:0,editType:"plot"},ygap:{valType:"number",dflt:0,min:0,editType:"plot"},xhoverformat:c("x"),yhoverformat:c("y"),zhoverformat:c("z",1),hovertemplate:i(),texttemplate:s({arrayOk:!1,editType:"plot"},{keys:["x","y","z","text"]}),textfont:l({editType:"plot",autoSize:!0,autoColor:!0,colorEditType:"style"}),showlegend:h({},a.showlegend,{dflt:!1})},{transforms:void 0},u("",{cLetter:"z",autoColorDflt:!1}))},{"../../components/colorscale/attributes":373,"../../lib/extend":493,"../../plots/attributes":550,"../../plots/cartesian/axis_format_attributes":557,"../../plots/font_attributes":585,"../../plots/template_attributes":633,"../scatter/attributes":927}],793:[function(t,o,f){var r=t("../../registry"),a=t("../../lib"),l=t("../../plots/cartesian/axes"),c=t("../../plots/cartesian/align_period"),i=t("../histogram2d/calc"),s=t("../../components/colorscale/calc"),u=t("./convert_column_xyz"),h=t("./clean_2d_array"),d=t("./interp2d"),m=t("./find_empties"),p=t("./make_bound_array"),g=t("../../constants/numerical").BADNUM;function y(v){for(var x=[],_=v.length,A=0;A<_;A++){var b=v[A];b!==g&&x.push(b)}return x}o.exports=function(v,x){var _,A,b,k,w,M,T,E,S,P,L,R=l.getFromId(v,x.xaxis||"x"),F=l.getFromId(v,x.yaxis||"y"),D=r.traceIs(x,"contour"),O=r.traceIs(x,"histogram"),N=r.traceIs(x,"gl2d"),B=D?"best":x.zsmooth;if(R._minDtick=0,F._minDtick=0,O)k=(L=i(v,x)).orig_x,_=L.x,A=L.x0,b=L.dx,E=L.orig_y,w=L.y,M=L.y0,T=L.dy,S=L.z;else{var W=x.z;a.isArray1D(W)?(u(x,R,F,"x","y",["z"]),_=x._x,w=x._y,W=x._z):(k=x.x?R.makeCalcdata(x,"x"):[],E=x.y?F.makeCalcdata(x,"y"):[],_=c(x,R,"x",k).vals,w=c(x,F,"y",E).vals,x._x=_,x._y=w),A=x.x0,b=x.dx,M=x.y0,T=x.dy,S=h(W,x,R,F)}function G(ee){B=x._input.zsmooth=x.zsmooth=!1,a.warn('cannot use zsmooth: "fast": '+ee)}if((R.rangebreaks||F.rangebreaks)&&(S=function(ee,ie,ae){for(var ue=[],le=-1,ge=0;gete){G("x scale is not linear");break}}if(w.length&&B==="fast"){var Y=(w[w.length-1]-w[0])/(w.length-1),J=Math.abs(Y/100);for(P=0;PJ){G("y scale is not linear");break}}}}var re=a.maxRowLength(S),U=x.xtype==="scaled"?"":_,V=p(x,U,A,b,re,R),H=x.ytype==="scaled"?"":w,ne=p(x,H,M,T,S.length,F);N||(x._extremes[R._id]=l.findExtremes(R,V),x._extremes[F._id]=l.findExtremes(F,ne));var q={x:V,y:ne,z:S,text:x._text||x.text,hovertext:x._hovertext||x.hovertext};if(x.xperiodalignment&&k&&(q.orig_x=k),x.yperiodalignment&&E&&(q.orig_y=E),U&&U.length===V.length-1&&(q.xCenter=U),H&&H.length===ne.length-1&&(q.yCenter=H),O&&(q.xRanges=L.xRanges,q.yRanges=L.yRanges,q.pts=L.pts),D||s(v,x,{vals:S,cLetter:"z"}),D&&x.contours&&x.contours.coloring==="heatmap"){var Q={type:x.type==="contour"?"heatmap":"histogram2d",xcalendar:x.xcalendar,ycalendar:x.ycalendar};q.xfill=p(Q,U,A,b,re,R),q.yfill=p(Q,H,M,T,S.length,F)}return[q]}},{"../../components/colorscale/calc":374,"../../constants/numerical":479,"../../lib":503,"../../plots/cartesian/align_period":551,"../../plots/cartesian/axes":554,"../../registry":638,"../histogram2d/calc":826,"./clean_2d_array":794,"./convert_column_xyz":796,"./find_empties":798,"./interp2d":801,"./make_bound_array":803}],794:[function(t,o,f){var r=t("fast-isnumeric"),a=t("../../lib"),l=t("../../constants/numerical").BADNUM;o.exports=function(c,i,s,u){var h,d,m,p,g,y;function v(w){if(r(w))return+w}if(i&&i.transpose){for(h=0,g=0;g=0;u--)(h=((g[[(c=(s=y[u])[0])-1,i=s[1]]]||_)[2]+(g[[c+1,i]]||_)[2]+(g[[c,i-1]]||_)[2]+(g[[c,i+1]]||_)[2])/20)&&(d[s]=[c,i,h],y.splice(u,1),m=!0);if(!m)throw"findEmpties iterated with no new neighbors";for(s in d)g[s]=d[s],p.push(d[s])}return p.sort(function(b,k){return k[2]-b[2]})}},{"../../lib":503}],799:[function(t,o,f){var r=t("../../components/fx"),a=t("../../lib"),l=t("../../plots/cartesian/axes"),c=t("../../components/colorscale").extractOpts;o.exports=function(i,s,u,h,d){d||(d={});var m,p,g,y,v=d.isContour,x=i.cd[0],_=x.trace,A=i.xa,b=i.ya,k=x.x,w=x.y,M=x.z,T=x.xCenter,E=x.yCenter,S=x.zmask,P=_.zhoverformat,L=k,R=w;if(i.index!==!1){try{g=Math.round(i.index[1]),y=Math.round(i.index[0])}catch{return void a.error("Error hovering on heatmap, pointNumber must be [row,col], found:",i.index)}if(g<0||g>=M[0].length||y<0||y>M.length)return}else{if(r.inbox(s-k[0],s-k[k.length-1],0)>0||r.inbox(u-w[0],u-w[w.length-1],0)>0)return;if(v){var F;for(L=[2*k[0]-k[1]],F=1;Fk&&(M=Math.max(M,Math.abs(i[d][m]-b)/(w-k))))}return M}o.exports=function(i,s){var u,h=1;for(c(i,s),u=0;u.01;u++)h=c(i,s,l(h));return h>.01&&r.log("interp2d didn't converge quickly",h),i}},{"../../lib":503}],802:[function(t,o,f){var r=t("../../lib");o.exports=function(a,l){a("texttemplate");var c=r.extendFlat({},l.font,{color:"auto",size:"auto"});r.coerceFont(a,"textfont",c)}},{"../../lib":503}],803:[function(t,o,f){var r=t("../../registry"),a=t("../../lib").isArrayOrTypedArray;o.exports=function(l,c,i,s,u,h){var d,m,p,g=[],y=r.traceIs(l,"contour"),v=r.traceIs(l,"histogram"),x=r.traceIs(l,"gl2d");if(a(c)&&c.length>1&&!v&&h.type!=="category"){var _=c.length;if(!(_<=u))return y?c.slice(0,u):c.slice(0,u+1);if(y||x)g=c.slice(0,u);else if(u===1)g=[c[0]-.5,c[0]+.5];else{for(g=[1.5*c[0]-.5*c[1]],p=1;p<_;p++)g.push(.5*(c[p-1]+c[p]));g.push(1.5*c[_-1]-.5*c[_-2])}if(_0;)R=E.c2p(U[N]),N--;for(R0;)O=S.c2p(V[N]),N--;if(OJe||Je>S._length))for(B=Ft;BSt||St>E._length)){var It=h({x:st,y:De},te,k._fullLayout);It.x=st,It.y=De;var Zt=K.z[N][B];Zt===void 0?(It.z="",It.zLabel=""):(It.z=Zt,It.zLabel=i.tickText($t,Zt,"hover").text);var Kt=K.text&&K.text[N]&&K.text[N][B];Kt!==void 0&&Kt!==!1||(Kt=""),It.text=Kt;var qt=s.texttemplateString(At,It,k._fullLayout._d3locale,It,te._meta||{});if(qt){var mn=qt.split("
    "),Fn=mn.length,pn=0;for(W=0;W0&&(k=!0);for(var T=0;Ts){var u=s-c[a];return c[a]=s,u}}return 0},max:function(a,l,c,i){var s=i[l];if(r(s)){if(s=Number(s),!r(c[a]))return c[a]=s,s;if(c[a]u?y>c?y>1.1*a?a:y>1.1*l?l:c:y>i?i:y>s?s:u:Math.pow(10,Math.floor(Math.log(y)/Math.LN10))}function p(y,v,x,_,A,b){if(_&&y>c){var k=g(v,A,b),w=g(x,A,b),M=y===a?0:1;return k[M]!==w[M]}return Math.floor(x/y)-Math.floor(v/y)>.1}function g(y,v,x){var _=v.c2d(y,a,x).split("-");return _[0]===""&&(_.unshift(),_[0]="-"+_[0]),_}o.exports=function(y,v,x,_,A){var b,k,w=-1.1*v,M=-.1*v,T=y-M,E=x[0],S=x[1],P=Math.min(d(E+M,E+T,_,A),d(S+M,S+T,_,A)),L=Math.min(d(E+w,E+M,_,A),d(S+w,S+M,_,A));if(P>L&&Lc){var R=b===a?1:6,F=b===a?"M12":"M1";return function(D,O){var N=_.c2d(D,a,A),B=N.indexOf("-",R);B>0&&(N=N.substr(0,B));var W=_.d2c(N,0,A);if(Wy.r2l(q)&&(ee=c.tickIncrement(ee,L.size,!0,k)),U.start=y.l2r(ee),ne||a.nestedProperty(g,E+".start").set(U.start)}var ie=L.end,ae=y.r2l(re.end),ue=ae!==void 0;if((L.endFound||ue)&&ae!==y.r2l(ie)){var le=ue?ae:a.aggNums(Math.max,null,w);U.end=y.l2r(le),ue||a.nestedProperty(g,E+".start").set(U.end)}var ge="autobin"+v;return g._input[ge]===!1&&(g._input[E]=a.extendFlat({},g[E]||{}),delete g._input[ge],delete g[ge]),[U,w]}o.exports={calc:function(p,g){var y,v,x,_,A=[],b=[],k=g.orientation==="h",w=c.getFromId(p,k?g.yaxis:g.xaxis),M=k?"y":"x",T={x:"y",y:"x"}[M],E=g[M+"calendar"],S=g.cumulative,P=m(p,g,w,M),L=P[0],R=P[1],F=typeof L.size=="string",D=[],O=F?D:L,N=[],B=[],W=[],G=0,K=g.histnorm,te=g.histfunc,Y=K.indexOf("density")!==-1;S.enabled&&Y&&(K=K.replace(/ ?density$/,""),Y=!1);var J,re=te==="max"||te==="min"?null:0,U=s.count,V=u[K],H=!1,ne=function(de){return w.r2c(de,0,E)};for(a.isArrayOrTypedArray(g[T])&&te!=="count"&&(J=g[T],H=te==="avg",U=s[te]),y=ne(L.start),x=ne(L.end)+(y-c.tickIncrement(y,L.size,!1,E))/1e6;y=0&&_=0;we--)$e(we);else if(ve==="increasing"){for(we=1;we=0;we--)de[we]+=de[we+1];Me==="exclude"&&(de.push(0),de.shift())}}(b,S.direction,S.currentbin);var me=Math.min(A.length,b.length),_e=[],Ae=0,ke=me-1;for(y=0;y=Ae;y--)if(b[y]){ke=y;break}for(y=Ae;y<=ke;y++)if(r(A[y])&&r(b[y])){var Le={p:A[y],s:b[y],b:0};S.enabled||(Le.pts=W[y],ae?Le.ph0=Le.ph1=W[y].length?R[W[y][0]]:A[y]:(g._computePh=!0,Le.ph0=ee(D[y]),Le.ph1=ee(D[y+1],!0))),_e.push(Le)}return _e.length===1&&(_e[0].width1=c.tickIncrement(_e[0].p,L.size,!1,E)-_e[0].p),i(_e,g),a.isArrayOrTypedArray(g.selectedpoints)&&a.tagSelected(_e,g,ge),_e},calcAllAutoBins:m}},{"../../lib":503,"../../plots/cartesian/axes":554,"../../registry":638,"../bar/arrays_to_calcdata":647,"./average":813,"./bin_functions":815,"./bin_label_vals":816,"./norm_functions":824,"fast-isnumeric":190}],818:[function(t,o,f){o.exports={eventDataKeys:["binNumber"]}},{}],819:[function(t,o,f){var r=t("../../lib"),a=t("../../plots/cartesian/axis_ids"),l=t("../../registry").traceIs,c=t("../bar/defaults").handleGroupingDefaults,i=r.nestedProperty,s=t("../../plots/cartesian/constraints").getAxisGroup,u=[{aStr:{x:"xbins.start",y:"ybins.start"},name:"start"},{aStr:{x:"xbins.end",y:"ybins.end"},name:"end"},{aStr:{x:"xbins.size",y:"ybins.size"},name:"size"},{aStr:{x:"nbinsx",y:"nbinsy"},name:"nbins"}],h=["x","y"];o.exports=function(d,m){var p,g,y,v,x,_,A,b=m._histogramBinOpts={},k=[],w={},M=[];function T(Y,J){return r.coerce(p._input,p,p._module.attributes,Y,J)}function E(Y){return Y.orientation==="v"?"x":"y"}function S(Y,J,re){var U=Y.uid+"__"+re;J||(J=U);var V=function(Q,ee){return a.getFromTrace({_fullLayout:m},Q,ee).type}(Y,re),H=Y[re+"calendar"]||"",ne=b[J],q=!0;ne&&(V===ne.axType&&H===ne.calendar?(q=!1,ne.traces.push(Y),ne.dirs.push(re)):(J=U,V!==ne.axType&&r.warn(["Attempted to group the bins of trace",Y.index,"set on a","type:"+V,"axis","with bins on","type:"+ne.axType,"axis."].join(" ")),H!==ne.calendar&&r.warn(["Attempted to group the bins of trace",Y.index,"set with a",H,"calendar","with bins",ne.calendar?"on a "+ne.calendar+" calendar":"w/o a set calendar"].join(" ")))),q&&(b[J]={traces:[Y],dirs:[re],axType:V,calendar:Y[re+"calendar"]||""}),Y["_"+re+"bingroup"]=J}for(x=0;xD&&P.splice(D,P.length-D),F.length>D&&F.splice(D,F.length-D);var O=[],N=[],B=[],W=typeof S.size=="string",G=typeof R.size=="string",K=[],te=[],Y=W?K:S,J=G?te:R,re=0,U=[],V=[],H=g.histnorm,ne=g.histfunc,q=H.indexOf("density")!==-1,Q=ne==="max"||ne==="min"?null:0,ee=l.count,ie=c[H],ae=!1,ue=[],le=[],ge="z"in g?g.z:"marker"in g&&Array.isArray(g.marker.color)?g.marker.color:"";ge&&ne!=="count"&&(ae=ne==="avg",ee=l[ne]);var fe=S.size,me=M(S.start),_e=M(S.end)+(me-a.tickIncrement(me,fe,!1,k))/1e6;for(y=me;y<_e;y=a.tickIncrement(y,fe,!1,k))N.push(Q),K.push(y),ae&&B.push(0);K.push(y);var Ae,ke=N.length,Le=(y-me)/ke,de=(Ae=me+Le/2,A.c2r(Ae,0,k)),ve=R.size,Me=T(R.start),we=T(R.end)+(Me-a.tickIncrement(Me,ve,!1,w))/1e6;for(y=Me;y=0&&x=0&&_-1,flipY:D.tiling.flip.indexOf("y")>-1,orientation:D.tiling.orientation,pad:{inner:D.tiling.pad},maxDepth:D._maxDepth}).descendants(),G=1/0,K=-1/0;W.forEach(function(U){var V=U.depth;V>=D._maxDepth?(U.x0=U.x1=(U.x0+U.x1)/2,U.y0=U.y1=(U.y0+U.y1)/2):(G=Math.min(G,V),K=Math.max(K,V))}),v=v.data(W,h.getPtId),D._maxVisibleLayers=isFinite(K)?K-G+1:0,v.enter().append("g").classed("slice",!0),S(v,!1,{},[_,A],w),v.order();var te=null;if(E&&R){var Y=h.getPtId(R);v.each(function(U){te===null&&h.getPtId(U)===Y&&(te={x0:U.x0,x1:U.x1,y0:U.y0,y1:U.y1})})}var J=function(){return te||{x0:0,x1:_,y0:0,y1:A}},re=v;return E&&(re=re.transition().each("end",function(){var U=r.select(this);h.setSliceCursor(U,p,{hideOnRoot:!0,hideOnLeaves:!1,isTransitioning:!1})})),re.each(function(U){U._x0=b(U.x0),U._x1=b(U.x1),U._y0=k(U.y0),U._y1=k(U.y1),U._hoverX=b(U.x1-D.tiling.pad),U._hoverY=k(B?U.y1-D.tiling.pad/2:U.y0+D.tiling.pad/2);var V=r.select(this),H=a.ensureSingle(V,"path","surface",function(ee){ee.style("pointer-events","all")});E?H.transition().attrTween("d",function(ee){var ie=P(ee,!1,J(),[_,A],{orientation:D.tiling.orientation,flipX:D.tiling.flip.indexOf("x")>-1,flipY:D.tiling.flip.indexOf("y")>-1});return function(ae){return w(ie(ae))}}):H.attr("d",w),V.call(d,y,p,g,{styleOne:s,eventDataKeys:u.eventDataKeys,transitionTime:u.CLICK_TRANSITION_TIME,transitionEasing:u.CLICK_TRANSITION_EASING}).call(h.setSliceCursor,p,{isTransitioning:p._transitioning}),H.call(s,U,D,{hovered:!1}),U.x0===U.x1||U.y0===U.y1?U._text="":U._text=m(U,y,D,g,F)||"";var ne=a.ensureSingle(V,"g","slicetext"),q=a.ensureSingle(ne,"text","",function(ee){ee.attr("data-notex",1)}),Q=a.ensureUniformFontSize(p,h.determineTextFont(D,U,F.font));q.text(U._text||" ").classed("slicetext",!0).attr("text-anchor",N?"end":O?"start":"middle").call(l.font,Q).call(c.convertToTspans,p),U.textBB=l.bBox(q.node()),U.transform=M(U,{fontSize:Q.size}),U.transform.fontSize=Q.size,E?q.transition().attrTween("transform",function(ee){var ie=L(ee,!1,J(),[_,A]);return function(ae){return T(ie(ae))}}):q.attr("transform",T(U))}),te}},{"../../components/drawing":388,"../../lib":503,"../../lib/svg_text_utils":529,"../sunburst/fx":1054,"../sunburst/helpers":1055,"../sunburst/plot":1059,"../treemap/constants":1078,"./partition":842,"./style":844,"@plotly/d3":58}],839:[function(t,o,f){o.exports={moduleType:"trace",name:"icicle",basePlotModule:t("./base_plot"),categories:[],animatable:!0,attributes:t("./attributes"),layoutAttributes:t("./layout_attributes"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc").calc,crossTraceCalc:t("./calc").crossTraceCalc,plot:t("./plot"),style:t("./style").style,colorbar:t("../scatter/marker_colorbar"),meta:{}}},{"../scatter/marker_colorbar":945,"./attributes":834,"./base_plot":835,"./calc":836,"./defaults":837,"./layout_attributes":840,"./layout_defaults":841,"./plot":843,"./style":844}],840:[function(t,o,f){o.exports={iciclecolorway:{valType:"colorlist",editType:"calc"},extendiciclecolors:{valType:"boolean",dflt:!0,editType:"calc"}}},{}],841:[function(t,o,f){var r=t("../../lib"),a=t("./layout_attributes");o.exports=function(l,c){function i(s,u){return r.coerce(l,c,a,s,u)}i("iciclecolorway",c.colorway),i("extendiciclecolors")}},{"../../lib":503,"./layout_attributes":840}],842:[function(t,o,f){var r=t("d3-hierarchy"),a=t("../treemap/flip_tree");o.exports=function(l,c,i){var s=i.flipX,u=i.flipY,h=i.orientation==="h",d=i.maxDepth,m=c[0],p=c[1];d&&(m=(l.height+1)*c[0]/Math.min(l.height+1,d),p=(l.height+1)*c[1]/Math.min(l.height+1,d));var g=r.partition().padding(i.pad.inner).size(h?[c[1],m]:[c[0],p])(l);return(h||s||u)&&a(g,c,{swapXY:h,flipX:s,flipY:u}),g}},{"../treemap/flip_tree":1083,"d3-hierarchy":115}],843:[function(t,o,f){var r=t("../treemap/draw"),a=t("./draw_descendants");o.exports=function(l,c,i,s){return r(l,c,i,s,{type:"icicle",drawDescendants:a})}},{"../treemap/draw":1080,"./draw_descendants":838}],844:[function(t,o,f){var r=t("@plotly/d3"),a=t("../../components/color"),l=t("../../lib"),c=t("../bar/uniform_text").resizeText;function i(s,u,h){var d=u.data.data,m=!u.children,p=d.i,g=l.castOption(h,p,"marker.line.color")||a.defaultLine,y=l.castOption(h,p,"marker.line.width")||0;s.style("stroke-width",y).call(a.fill,d.color).call(a.stroke,g).style("opacity",m?h.leaf.opacity:null)}o.exports={style:function(s){var u=s._fullLayout._iciclelayer.selectAll(".trace");c(s,u,"icicle"),u.each(function(h){var d=r.select(this),m=h[0].trace;d.style("opacity",m.opacity),d.selectAll("path.surface").each(function(p){r.select(this).call(i,p,m)})})},styleOne:i}},{"../../components/color":366,"../../lib":503,"../bar/uniform_text":664,"@plotly/d3":58}],845:[function(t,o,f){for(var r=t("../../plots/attributes"),a=t("../../plots/template_attributes").hovertemplateAttrs,l=t("../../lib/extend").extendFlat,c=t("./constants").colormodel,i=["rgb","rgba","rgba256","hsl","hsla"],s=[],u=[],h=0;h0||r.inbox(s-u.y0,s-(u.y0+u.h*h.dy),0)>0)){var p,g=Math.floor((i-u.x0)/h.dx),y=Math.floor(Math.abs(s-u.y0)/h.dy);if(h._hasZ?p=u.z[y][g]:h._hasSource&&(p=h._canvas.el.getContext("2d").getImageData(g,y,1,1).data),p){var v,x=u.hi||h.hoverinfo;if(x){var _=x.split("+");_.indexOf("all")!==-1&&(_=["color"]),_.indexOf("color")!==-1&&(v=!0)}var A,b=l.colormodel[h.colormodel],k=b.colormodel||h.colormodel,w=k.length,M=h._scaler(p),T=b.suffix,E=[];(h.hovertemplate||v)&&(E.push("["+[M[0]+T[0],M[1]+T[1],M[2]+T[2]].join(", ")),w===4&&E.push(", "+M[3]+T[3]),E.push("]"),E=E.join(""),c.extraText=k.toUpperCase()+": "+E),Array.isArray(h.hovertext)&&Array.isArray(h.hovertext[y])?A=h.hovertext[y][g]:Array.isArray(h.text)&&Array.isArray(h.text[y])&&(A=h.text[y][g]);var S=m.c2p(u.y0+(y+.5)*h.dy),P=u.x0+(g+.5)*h.dx,L=u.y0+(y+.5)*h.dy,R="["+p.slice(0,h.colormodel.length).join(", ")+"]";return[a.extendFlat(c,{index:[y,g],x0:d.c2p(u.x0+g*h.dx),x1:d.c2p(u.x0+(g+1)*h.dx),y0:S,y1:S,color:M,xVal:P,xLabelVal:P,yVal:L,yLabelVal:L,zLabelVal:R,text:A,hovertemplateLabels:{zLabel:R,colorLabel:E,"color[0]Label":M[0]+T[0],"color[1]Label":M[1]+T[1],"color[2]Label":M[2]+T[2],"color[3]Label":M[3]+T[3]}})]}}}},{"../../components/fx":406,"../../lib":503,"./constants":847}],852:[function(t,o,f){o.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),calc:t("./calc"),plot:t("./plot"),style:t("./style"),hoverPoints:t("./hover"),eventData:t("./event_data"),moduleType:"trace",name:"image",basePlotModule:t("../../plots/cartesian"),categories:["cartesian","svg","2dMap","noSortingByValue"],animatable:!1,meta:{}}},{"../../plots/cartesian":568,"./attributes":845,"./calc":846,"./defaults":848,"./event_data":849,"./hover":851,"./plot":853,"./style":854}],853:[function(t,o,f){var r=t("@plotly/d3"),a=t("../../lib"),l=a.strTranslate,c=t("../../constants/xmlns_namespaces"),i=t("./constants"),s=a.isIOS()||a.isSafari()||a.isIE();o.exports=function(u,h,d,m){var p=h.xaxis,g=h.yaxis,y=!(s||u._context._exportedPlot);a.makeTraceGroups(m,d,"im").each(function(v){var x=r.select(this),_=v[0],A=_.trace,b=(A.zsmooth==="fast"||A.zsmooth===!1&&y)&&!A._hasZ&&A._hasSource&&p.type==="linear"&&g.type==="linear";A._realImage=b;var k,w,M,T,E,S,P=_.z,L=_.x0,R=_.y0,F=_.w,D=_.h,O=A.dx,N=A.dy;for(S=0;k===void 0&&S0;)w=p.c2p(L+S*O),S--;for(S=0;T===void 0&&S0;)E=g.c2p(R+S*N),S--;wY[0];if(J||re){var U=k+B/2,V=T+W/2;K+="transform:"+l(U+"px",V+"px")+"scale("+(J?-1:1)+","+(re?-1:1)+")"+l(-U+"px",-V+"px")+";"}}G.attr("style",K);var H=new Promise(function(q){if(A._hasZ)q();else if(A._hasSource)if(A._canvas&&A._canvas.el.width===F&&A._canvas.el.height===D&&A._canvas.source===A.source)q();else{var Q=document.createElement("canvas");Q.width=F,Q.height=D;var ee=Q.getContext("2d");A._image=A._image||new Image;var ie=A._image;ie.onload=function(){ee.drawImage(ie,0,0),A._canvas={el:Q,source:A.source},q()},ie.setAttribute("src",A.source)}}).then(function(){var q;if(A._hasZ)q=ne(function(ee,ie){return P[ie][ee]}).toDataURL("image/png");else if(A._hasSource)if(b)q=A.source;else{var Q=A._canvas.el.getContext("2d").getImageData(0,0,F,D).data;q=ne(function(ee,ie){var ae=4*(ie*F+ee);return[Q[ae],Q[ae+1],Q[ae+2],Q[ae+3]]}).toDataURL("image/png")}G.attr({"xlink:href":q,height:W,width:B,x:k,y:T})});u._promises.push(H)}function ne(q){var Q=document.createElement("canvas");Q.width=B,Q.height=W;var ee,ie=Q.getContext("2d"),ae=function(de){return a.constrain(Math.round(p.c2p(L+de*O)-k),0,B)},ue=function(de){return a.constrain(Math.round(g.c2p(R+de*N)-T),0,W)},le=i.colormodel[A.colormodel],ge=le.colormodel||A.colormodel,fe=le.fmt;for(S=0;S<_.w;S++){var me=ae(S),_e=ae(S+1);if(_e!==me&&!isNaN(_e)&&!isNaN(me))for(var Ae=0;Ae<_.h;Ae++){var ke=ue(Ae),Le=ue(Ae+1);Le===ke||isNaN(Le)||isNaN(ke)||!q(S,Ae)||(ee=A._scaler(q(S,Ae)),ie.fillStyle=ee?ge+"("+fe(ee).join(",")+")":"rgba(0,0,0,0)",ie.fillRect(me,ke,_e-me,Le-ke))}}return Q}})}},{"../../constants/xmlns_namespaces":480,"../../lib":503,"./constants":847,"@plotly/d3":58}],854:[function(t,o,f){var r=t("@plotly/d3");o.exports=function(a){r.select(a).selectAll(".im image").style("opacity",function(l){return l[0].trace.opacity})}},{"@plotly/d3":58}],855:[function(t,o,f){var r=t("../../lib/extend").extendFlat,a=t("../../lib/extend").extendDeep,l=t("../../plot_api/edit_types").overrideAll,c=t("../../plots/font_attributes"),i=t("../../components/color/attributes"),s=t("../../plots/domain").attributes,u=t("../../plots/cartesian/layout_attributes"),h=t("../../plot_api/plot_template").templatedArray,d=t("../../constants/delta.js"),m=t("../../plots/cartesian/axis_format_attributes").descriptionOnlyNumbers,p=c({editType:"plot",colorEditType:"plot"}),g={color:{valType:"color",editType:"plot"},line:{color:{valType:"color",dflt:i.defaultLine,editType:"plot"},width:{valType:"number",min:0,dflt:0,editType:"plot"},editType:"calc"},thickness:{valType:"number",min:0,max:1,dflt:1,editType:"plot"},editType:"calc"},y={valType:"info_array",items:[{valType:"number",editType:"plot"},{valType:"number",editType:"plot"}],editType:"plot"},v=h("step",a({},g,{range:y}));o.exports={mode:{valType:"flaglist",editType:"calc",flags:["number","delta","gauge"],dflt:"number"},value:{valType:"number",editType:"calc",anim:!0},align:{valType:"enumerated",values:["left","center","right"],editType:"plot"},domain:s({name:"indicator",trace:!0,editType:"calc"}),title:{text:{valType:"string",editType:"plot"},align:{valType:"enumerated",values:["left","center","right"],editType:"plot"},font:r({},p,{}),editType:"plot"},number:{valueformat:{valType:"string",dflt:"",editType:"plot",description:m("value")},font:r({},p,{}),prefix:{valType:"string",dflt:"",editType:"plot"},suffix:{valType:"string",dflt:"",editType:"plot"},editType:"plot"},delta:{reference:{valType:"number",editType:"calc"},position:{valType:"enumerated",values:["top","bottom","left","right"],dflt:"bottom",editType:"plot"},relative:{valType:"boolean",editType:"plot",dflt:!1},valueformat:{valType:"string",editType:"plot",description:m("value")},increasing:{symbol:{valType:"string",dflt:d.INCREASING.SYMBOL,editType:"plot"},color:{valType:"color",dflt:d.INCREASING.COLOR,editType:"plot"},editType:"plot"},decreasing:{symbol:{valType:"string",dflt:d.DECREASING.SYMBOL,editType:"plot"},color:{valType:"color",dflt:d.DECREASING.COLOR,editType:"plot"},editType:"plot"},font:r({},p,{}),editType:"calc"},gauge:{shape:{valType:"enumerated",editType:"plot",dflt:"angular",values:["angular","bullet"]},bar:a({},g,{color:{dflt:"green"}}),bgcolor:{valType:"color",editType:"plot"},bordercolor:{valType:"color",dflt:i.defaultLine,editType:"plot"},borderwidth:{valType:"number",min:0,dflt:1,editType:"plot"},axis:l({range:y,visible:r({},u.visible,{dflt:!0}),tickmode:u.tickmode,nticks:u.nticks,tick0:u.tick0,dtick:u.dtick,tickvals:u.tickvals,ticktext:u.ticktext,ticks:r({},u.ticks,{dflt:"outside"}),ticklen:u.ticklen,tickwidth:u.tickwidth,tickcolor:u.tickcolor,ticklabelstep:u.ticklabelstep,showticklabels:u.showticklabels,tickfont:c({}),tickangle:u.tickangle,tickformat:u.tickformat,tickformatstops:u.tickformatstops,tickprefix:u.tickprefix,showtickprefix:u.showtickprefix,ticksuffix:u.ticksuffix,showticksuffix:u.showticksuffix,separatethousands:u.separatethousands,exponentformat:u.exponentformat,minexponent:u.minexponent,showexponent:u.showexponent,editType:"plot"},"plot"),steps:v,threshold:{line:{color:r({},g.line.color,{}),width:r({},g.line.width,{dflt:1}),editType:"plot"},thickness:r({},g.thickness,{dflt:.85}),value:{valType:"number",editType:"calc",dflt:!1},editType:"plot"},editType:"plot"}}},{"../../components/color/attributes":365,"../../constants/delta.js":473,"../../lib/extend":493,"../../plot_api/edit_types":536,"../../plot_api/plot_template":543,"../../plots/cartesian/axis_format_attributes":557,"../../plots/cartesian/layout_attributes":569,"../../plots/domain":584,"../../plots/font_attributes":585}],856:[function(t,o,f){var r=t("../../plots/plots");f.name="indicator",f.plot=function(a,l,c,i){r.plotBasePlot(f.name,a,l,c,i)},f.clean=function(a,l,c,i){r.cleanBasePlot(f.name,a,l,c,i)}},{"../../plots/plots":619}],857:[function(t,o,f){o.exports={calc:function(r,a){var l=[],c=a.value;typeof a._lastValue!="number"&&(a._lastValue=a.value);var i=a._lastValue,s=i;return a._hasDelta&&typeof a.delta.reference=="number"&&(s=a.delta.reference),l[0]={y:c,lastY:i,delta:c-s,relativeDelta:(c-s)/s},l}}},{}],858:[function(t,o,f){o.exports={defaultNumberFontSize:80,bulletNumberDomainSize:.25,bulletPadding:.025,innerRadius:.75,valueThickness:.5,titlePadding:5,horizontalPadding:10}},{}],859:[function(t,o,f){var r=t("../../lib"),a=t("./attributes"),l=t("../../plots/domain").defaults,c=t("../../plot_api/plot_template"),i=t("../../plots/array_container_defaults"),s=t("./constants.js"),u=t("../../plots/cartesian/tick_value_defaults"),h=t("../../plots/cartesian/tick_mark_defaults"),d=t("../../plots/cartesian/tick_label_defaults"),m=t("../../plots/cartesian/prefix_suffix_defaults");function p(g,y){function v(x,_){return r.coerce(g,y,a.gauge.steps,x,_)}v("color"),v("line.color"),v("line.width"),v("range"),v("thickness")}o.exports={supplyDefaults:function(g,y,v,x){function _(F,D){return r.coerce(g,y,a,F,D)}l(y,x,_),_("mode"),y._hasNumber=y.mode.indexOf("number")!==-1,y._hasDelta=y.mode.indexOf("delta")!==-1,y._hasGauge=y.mode.indexOf("gauge")!==-1;var A=_("value");y._range=[0,typeof A=="number"?1.5*A:1];var b,k,w,M,T,E,S=new Array(2);function P(F,D){return r.coerce(w,M,a.gauge,F,D)}function L(F,D){return r.coerce(T,E,a.gauge.axis,F,D)}if(y._hasNumber&&(_("number.valueformat"),_("number.font.color",x.font.color),_("number.font.family",x.font.family),_("number.font.size"),y.number.font.size===void 0&&(y.number.font.size=s.defaultNumberFontSize,S[0]=!0),_("number.prefix"),_("number.suffix"),b=y.number.font.size),y._hasDelta&&(_("delta.font.color",x.font.color),_("delta.font.family",x.font.family),_("delta.font.size"),y.delta.font.size===void 0&&(y.delta.font.size=(y._hasNumber?.5:1)*(b||s.defaultNumberFontSize),S[1]=!0),_("delta.reference",y.value),_("delta.relative"),_("delta.valueformat",y.delta.relative?"2%":""),_("delta.increasing.symbol"),_("delta.increasing.color"),_("delta.decreasing.symbol"),_("delta.decreasing.color"),_("delta.position"),k=y.delta.font.size),y._scaleNumbers=(!y._hasNumber||S[0])&&(!y._hasDelta||S[1])||!1,_("title.font.color",x.font.color),_("title.font.family",x.font.family),_("title.font.size",.25*(b||k||s.defaultNumberFontSize)),_("title.text"),y._hasGauge){(w=g.gauge)||(w={}),M=c.newContainer(y,"gauge"),P("shape"),(y._isBullet=y.gauge.shape==="bullet")||_("title.align","center"),(y._isAngular=y.gauge.shape==="angular")||_("align","center"),P("bgcolor",x.paper_bgcolor),P("borderwidth"),P("bordercolor"),P("bar.color"),P("bar.line.color"),P("bar.line.width"),P("bar.thickness",s.valueThickness*(y.gauge.shape==="bullet"?.5:1)),i(w,M,{name:"steps",handleItemDefaults:p}),P("threshold.value"),P("threshold.thickness"),P("threshold.line.width"),P("threshold.line.color"),T={},w&&(T=w.axis||{}),E=c.newContainer(M,"axis"),L("visible"),y._range=L("range",y._range);var R={outerTicks:!0};u(T,E,L,"linear"),m(T,E,L,"linear",R),d(T,E,L,"linear",R),h(T,E,L,R)}else _("title.align","center"),_("align","center"),y._isAngular=y._isBullet=!1;y._length=null}}},{"../../lib":503,"../../plot_api/plot_template":543,"../../plots/array_container_defaults":549,"../../plots/cartesian/prefix_suffix_defaults":573,"../../plots/cartesian/tick_label_defaults":578,"../../plots/cartesian/tick_mark_defaults":579,"../../plots/cartesian/tick_value_defaults":580,"../../plots/domain":584,"./attributes":855,"./constants.js":858}],860:[function(t,o,f){o.exports={moduleType:"trace",name:"indicator",basePlotModule:t("./base_plot"),categories:["svg","noOpacity","noHover"],animatable:!0,attributes:t("./attributes"),supplyDefaults:t("./defaults").supplyDefaults,calc:t("./calc").calc,plot:t("./plot"),meta:{}}},{"./attributes":855,"./base_plot":856,"./calc":857,"./defaults":859,"./plot":861}],861:[function(t,o,f){var r=t("@plotly/d3"),a=t("d3-interpolate").interpolate,l=t("d3-interpolate").interpolateNumber,c=t("../../lib"),i=c.strScale,s=c.strTranslate,u=c.rad2deg,h=t("../../constants/alignment").MID_SHIFT,d=t("../../components/drawing"),m=t("./constants"),p=t("../../lib/svg_text_utils"),g=t("../../plots/cartesian/axes"),y=t("../../plots/cartesian/axis_defaults"),v=t("../../plots/cartesian/position_defaults"),x=t("../../plots/cartesian/layout_attributes"),_=t("../../components/color"),A={left:"start",center:"middle",right:"end"},b={left:0,center:.5,right:1},k=/[yzafpn\xb5mkMGTPEZY]/;function w(L){return L&&L.duration>0}function M(L){L.each(function(R){_.stroke(r.select(this),R.line.color)}).each(function(R){_.fill(r.select(this),R.color)}).style("stroke-width",function(R){return R.line.width})}function T(L,R,F){var D=L._fullLayout,O=c.extendFlat({type:"linear",ticks:"outside",range:F,showline:!0},R),N={type:"linear",_id:"x"+R._id},B={letter:"x",font:D.font,noHover:!0,noTickson:!0};function W(G,K){return c.coerce(O,N,x,G,K)}return y(O,N,W,B,D),v(O,N,W,B),N}function E(L,R,F){return[Math.min(R/L.width,F/L.height),L,R+"x"+F]}function S(L,R,F,D){var O=document.createElementNS("http://www.w3.org/2000/svg","text"),N=r.select(O);return N.text(L).attr("x",0).attr("y",0).attr("text-anchor",F).attr("data-unformatted",L).call(p.convertToTspans,D).call(d.font,R),d.bBox(N.node())}function P(L,R,F,D,O,N){var B="_cache"+R;L[B]&&L[B].key===O||(L[B]={key:O,value:F});var W=c.aggNums(N,null,[L[B].value,D],2);return L[B].value=W,W}o.exports=function(L,R,F,D){var O,N=L._fullLayout;w(F)&&D&&(O=D()),c.makeTraceGroups(N._indicatorlayer,R,"trace").each(function(B){var W,G,K,te,Y,J=B[0].trace,re=r.select(this),U=J._hasGauge,V=J._isAngular,H=J._isBullet,ne=J.domain,q={w:N._size.w*(ne.x[1]-ne.x[0]),h:N._size.h*(ne.y[1]-ne.y[0]),l:N._size.l+N._size.w*ne.x[0],r:N._size.r+N._size.w*(1-ne.x[1]),t:N._size.t+N._size.h*(1-ne.y[1]),b:N._size.b+N._size.h*ne.y[0]},Q=q.l+q.w/2,ee=q.t+q.h/2,ie=Math.min(q.w/2,q.h),ae=m.innerRadius*ie,ue=J.align||"center";if(G=ee,U){if(V&&(W=Q,G=ee+ie/2,K=function(Le){return function(de,ve){var Me=Math.sqrt(de.width/2*(de.width/2)+de.height*de.height);return[ve/Me,de,ve]}(Le,.9*ae)}),H){var le=m.bulletPadding,ge=1-m.bulletNumberDomainSize+le;W=q.l+(ge+(1-ge)*b[ue])*q.w,K=function(Le){return E(Le,(m.bulletNumberDomainSize-le)*q.w,q.h)}}}else W=q.l+b[ue]*q.w,K=function(Le){return E(Le,q.w,q.h)};(function(Le,de,ve,Me){var we,Ce,Fe,ze=ve[0].trace,$e=Me.numbersX,Ke=Me.numbersY,Re=ze.align||"center",Ve=A[Re],We=Me.transitionOpts,Ye=Me.onComplete,nt=c.ensureSingle(de,"g","numbers"),ft=[];ze._hasNumber&&ft.push("number"),ze._hasDelta&&(ft.push("delta"),ze.delta.position==="left"&&ft.reverse());var yt=nt.selectAll("text").data(ft);function Ot(Ge,kt,dt,Oe){if(!Ge.match("s")||dt>=0==Oe>=0||kt(dt).slice(-1).match(k)||kt(Oe).slice(-1).match(k))return kt;var Ie=Ge.slice().replace("s","f").replace(/\d+/,function(Pe){return parseInt(Pe)-1}),Te=T(Le,{tickformat:Ie});return function(Pe){return Math.abs(Pe)<1?g.tickText(Te,Pe).text:kt(Pe)}}yt.enter().append("text"),yt.attr("text-anchor",function(){return Ve}).attr("class",function(Ge){return Ge}).attr("x",null).attr("y",null).attr("dx",null).attr("dy",null),yt.exit().remove();var Tt,at=ze.mode+ze.align;if(ze._hasDelta&&(Tt=function(){var Ge=T(Le,{tickformat:ze.delta.valueformat},ze._range);Ge.setScale(),g.prepTicks(Ge);var kt=function(qe){return g.tickText(Ge,qe).text},dt=function(qe){return ze.delta.relative?qe.relativeDelta:qe.delta},Oe=function(qe,rt){return qe===0||typeof qe!="number"||isNaN(qe)?"-":(qe>0?ze.delta.increasing.symbol:ze.delta.decreasing.symbol)+rt(qe)},Ie=function(qe){return qe.delta>=0?ze.delta.increasing.color:ze.delta.decreasing.color};ze._deltaLastValue===void 0&&(ze._deltaLastValue=dt(ve[0]));var Te=nt.select("text.delta");function Pe(){Te.text(Oe(dt(ve[0]),kt)).call(_.fill,Ie(ve[0])).call(p.convertToTspans,Le)}return Te.call(d.font,ze.delta.font).call(_.fill,Ie({delta:ze._deltaLastValue})),w(We)?Te.transition().duration(We.duration).ease(We.easing).tween("text",function(){var qe=r.select(this),rt=dt(ve[0]),lt=ze._deltaLastValue,ot=Ot(ze.delta.valueformat,kt,lt,rt),At=l(lt,rt);return ze._deltaLastValue=rt,function(wt){qe.text(Oe(At(wt),ot)),qe.call(_.fill,Ie({delta:At(wt)}))}}).each("end",function(){Pe(),Ye&&Ye()}).each("interrupt",function(){Pe(),Ye&&Ye()}):Pe(),Ce=S(Oe(dt(ve[0]),kt),ze.delta.font,Ve,Le),Te}(),at+=ze.delta.position+ze.delta.font.size+ze.delta.font.family+ze.delta.valueformat,at+=ze.delta.increasing.symbol+ze.delta.decreasing.symbol,Fe=Ce),ze._hasNumber&&(function(){var Ge=T(Le,{tickformat:ze.number.valueformat},ze._range);Ge.setScale(),g.prepTicks(Ge);var kt=function(Pe){return g.tickText(Ge,Pe).text},dt=ze.number.suffix,Oe=ze.number.prefix,Ie=nt.select("text.number");function Te(){var Pe=typeof ve[0].y=="number"?Oe+kt(ve[0].y)+dt:"-";Ie.text(Pe).call(d.font,ze.number.font).call(p.convertToTspans,Le)}w(We)?Ie.transition().duration(We.duration).ease(We.easing).each("end",function(){Te(),Ye&&Ye()}).each("interrupt",function(){Te(),Ye&&Ye()}).attrTween("text",function(){var Pe=r.select(this),qe=l(ve[0].lastY,ve[0].y);ze._lastValue=ve[0].y;var rt=Ot(ze.number.valueformat,kt,ve[0].lastY,ve[0].y);return function(lt){Pe.text(Oe+rt(qe(lt))+dt)}}):Te(),we=S(Oe+kt(ve[0].y)+dt,ze.number.font,Ve,Le)}(),at+=ze.number.font.size+ze.number.font.family+ze.number.valueformat+ze.number.suffix+ze.number.prefix,Fe=we),ze._hasDelta&&ze._hasNumber){var et,Lt,Wt=[(we.left+we.right)/2,(we.top+we.bottom)/2],Jt=[(Ce.left+Ce.right)/2,(Ce.top+Ce.bottom)/2],Be=.75*ze.delta.font.size;ze.delta.position==="left"&&(et=P(ze,"deltaPos",0,-1*(we.width*b[ze.align]+Ce.width*(1-b[ze.align])+Be),at,Math.min),Lt=Wt[1]-Jt[1],Fe={width:we.width+Ce.width+Be,height:Math.max(we.height,Ce.height),left:Ce.left+et,right:we.right,top:Math.min(we.top,Ce.top+Lt),bottom:Math.max(we.bottom,Ce.bottom+Lt)}),ze.delta.position==="right"&&(et=P(ze,"deltaPos",0,we.width*(1-b[ze.align])+Ce.width*b[ze.align]+Be,at,Math.max),Lt=Wt[1]-Jt[1],Fe={width:we.width+Ce.width+Be,height:Math.max(we.height,Ce.height),left:we.left,right:Ce.right+et,top:Math.min(we.top,Ce.top+Lt),bottom:Math.max(we.bottom,Ce.bottom+Lt)}),ze.delta.position==="bottom"&&(et=null,Lt=Ce.height,Fe={width:Math.max(we.width,Ce.width),height:we.height+Ce.height,left:Math.min(we.left,Ce.left),right:Math.max(we.right,Ce.right),top:we.bottom-we.height,bottom:we.bottom+Ce.height}),ze.delta.position==="top"&&(et=null,Lt=we.top,Fe={width:Math.max(we.width,Ce.width),height:we.height+Ce.height,left:Math.min(we.left,Ce.left),right:Math.max(we.right,Ce.right),top:we.bottom-we.height-Ce.height,bottom:we.bottom}),Tt.attr({dx:et,dy:Lt})}(ze._hasNumber||ze._hasDelta)&&nt.attr("transform",function(){var Ge=Me.numbersScaler(Fe);at+=Ge[2];var kt,dt=P(ze,"numbersScale",1,Ge[0],at,Math.min);ze._scaleNumbers||(dt=1),kt=ze._isAngular?Ke-dt*Fe.bottom:Ke-dt*(Fe.top+Fe.bottom)/2,ze._numbersTop=dt*Fe.top+kt;var Oe=Fe[Re];Re==="center"&&(Oe=(Fe.left+Fe.right)/2);var Ie=$e-dt*Oe;return Ie=P(ze,"numbersTranslate",0,Ie,at,Math.max),s(Ie,kt)+i(dt)})})(L,re,B,{numbersX:W,numbersY:G,numbersScaler:K,transitionOpts:F,onComplete:O}),U&&(te={range:J.gauge.axis.range,color:J.gauge.bgcolor,line:{color:J.gauge.bordercolor,width:0},thickness:1},Y={range:J.gauge.axis.range,color:"rgba(0, 0, 0, 0)",line:{color:J.gauge.bordercolor,width:J.gauge.borderwidth},thickness:1});var fe=re.selectAll("g.angular").data(V?B:[]);fe.exit().remove();var me=re.selectAll("g.angularaxis").data(V?B:[]);me.exit().remove(),V&&function(Le,de,ve,Me){var we,Ce,Fe,ze,$e=ve[0].trace,Ke=Me.size,Re=Me.radius,Ve=Me.innerRadius,We=Me.gaugeBg,Ye=Me.gaugeOutline,nt=[Ke.l+Ke.w/2,Ke.t+Ke.h/2+Re/2],ft=Me.gauge,yt=Me.layer,Ot=Me.transitionOpts,Tt=Me.onComplete,at=Math.PI/2;function et(Ut){var tt=$e.gauge.axis.range[0],bt=(Ut-tt)/($e.gauge.axis.range[1]-tt)*Math.PI-at;return bt<-at?-at:bt>at?at:bt}function Lt(Ut){return r.svg.arc().innerRadius((Ve+Re)/2-Ut/2*(Re-Ve)).outerRadius((Ve+Re)/2+Ut/2*(Re-Ve)).startAngle(-at)}function Wt(Ut){Ut.attr("d",function(tt){return Lt(tt.thickness).startAngle(et(tt.range[0])).endAngle(et(tt.range[1]))()})}ft.enter().append("g").classed("angular",!0),ft.attr("transform",s(nt[0],nt[1])),yt.enter().append("g").classed("angularaxis",!0).classed("crisp",!0),yt.selectAll("g.xangularaxistick,path,text").remove(),(we=T(Le,$e.gauge.axis)).type="linear",we.range=$e.gauge.axis.range,we._id="xangularaxis",we.ticklabeloverflow="allow",we.setScale();var Jt=function(Ut){return(we.range[0]-Ut.x)/(we.range[1]-we.range[0])*Math.PI+Math.PI},Be={},Ge=g.makeLabelFns(we,0).labelStandoff;Be.xFn=function(Ut){var tt=Jt(Ut);return Math.cos(tt)*Ge},Be.yFn=function(Ut){var tt=Jt(Ut),bt=Math.sin(tt)>0?.2:1;return-Math.sin(tt)*(Ge+Ut.fontSize*bt)+Math.abs(Math.cos(tt))*(Ut.fontSize*h)},Be.anchorFn=function(Ut){var tt=Jt(Ut),bt=Math.cos(tt);return Math.abs(bt)<.1?"middle":bt>0?"start":"end"},Be.heightFn=function(Ut,tt,bt){var Ft=Jt(Ut);return-.5*(1+Math.sin(Ft))*bt};var kt=function(Ut){return s(nt[0]+Re*Math.cos(Ut),nt[1]-Re*Math.sin(Ut))};if(Fe=function(Ut){return kt(Jt(Ut))},Ce=g.calcTicks(we),ze=g.getTickSigns(we)[2],we.visible){ze=we.ticks==="inside"?-1:1;var dt=(we.linewidth||1)/2;g.drawTicks(Le,we,{vals:Ce,layer:yt,path:"M"+ze*dt+",0h"+ze*we.ticklen,transFn:function(Ut){var tt=Jt(Ut);return kt(tt)+"rotate("+-u(tt)+")"}}),g.drawLabels(Le,we,{vals:Ce,layer:yt,transFn:Fe,labelFns:Be})}var Oe=[We].concat($e.gauge.steps),Ie=ft.selectAll("g.bg-arc").data(Oe);Ie.enter().append("g").classed("bg-arc",!0).append("path"),Ie.select("path").call(Wt).call(M),Ie.exit().remove();var Te=Lt($e.gauge.bar.thickness),Pe=ft.selectAll("g.value-arc").data([$e.gauge.bar]);Pe.enter().append("g").classed("value-arc",!0).append("path");var qe=Pe.select("path");w(Ot)?(qe.transition().duration(Ot.duration).ease(Ot.easing).each("end",function(){Tt&&Tt()}).each("interrupt",function(){Tt&&Tt()}).attrTween("d",(rt=Te,lt=et(ve[0].lastY),ot=et(ve[0].y),function(){var Ut=a(lt,ot);return function(tt){return rt.endAngle(Ut(tt))()}})),$e._lastValue=ve[0].y):qe.attr("d",typeof ve[0].y=="number"?Te.endAngle(et(ve[0].y)):"M0,0Z");var rt,lt,ot;qe.call(M),Pe.exit().remove(),Oe=[];var At=$e.gauge.threshold.value;(At||At===0)&&Oe.push({range:[At,At],color:$e.gauge.threshold.color,line:{color:$e.gauge.threshold.line.color,width:$e.gauge.threshold.line.width},thickness:$e.gauge.threshold.thickness});var wt=ft.selectAll("g.threshold-arc").data(Oe);wt.enter().append("g").classed("threshold-arc",!0).append("path"),wt.select("path").call(Wt).call(M),wt.exit().remove();var $t=ft.selectAll("g.gauge-outline").data([Ye]);$t.enter().append("g").classed("gauge-outline",!0).append("path"),$t.select("path").call(Wt).call(M),$t.exit().remove()}(L,0,B,{radius:ie,innerRadius:ae,gauge:fe,layer:me,size:q,gaugeBg:te,gaugeOutline:Y,transitionOpts:F,onComplete:O});var _e=re.selectAll("g.bullet").data(H?B:[]);_e.exit().remove();var Ae=re.selectAll("g.bulletaxis").data(H?B:[]);Ae.exit().remove(),H&&function(Le,de,ve,Me){var we,Ce,Fe,ze,$e,Ke=ve[0].trace,Re=Me.gauge,Ve=Me.layer,We=Me.gaugeBg,Ye=Me.gaugeOutline,nt=Me.size,ft=Ke.domain,yt=Me.transitionOpts,Ot=Me.onComplete;Re.enter().append("g").classed("bullet",!0),Re.attr("transform",s(nt.l,nt.t)),Ve.enter().append("g").classed("bulletaxis",!0).classed("crisp",!0),Ve.selectAll("g.xbulletaxistick,path,text").remove();var Tt=nt.h,at=Ke.gauge.bar.thickness*Tt,et=ft.x[0],Lt=ft.x[0]+(ft.x[1]-ft.x[0])*(Ke._hasNumber||Ke._hasDelta?1-m.bulletNumberDomainSize:1);(we=T(Le,Ke.gauge.axis))._id="xbulletaxis",we.domain=[et,Lt],we.setScale(),Ce=g.calcTicks(we),Fe=g.makeTransTickFn(we),ze=g.getTickSigns(we)[2],$e=nt.t+nt.h,we.visible&&(g.drawTicks(Le,we,{vals:we.ticks==="inside"?g.clipEnds(we,Ce):Ce,layer:Ve,path:g.makeTickPath(we,$e,ze),transFn:Fe}),g.drawLabels(Le,we,{vals:Ce,layer:Ve,transFn:Fe,labelFns:g.makeLabelFns(we,$e)}));function Wt(Ie){Ie.attr("width",function(Te){return Math.max(0,we.c2p(Te.range[1])-we.c2p(Te.range[0]))}).attr("x",function(Te){return we.c2p(Te.range[0])}).attr("y",function(Te){return .5*(1-Te.thickness)*Tt}).attr("height",function(Te){return Te.thickness*Tt})}var Jt=[We].concat(Ke.gauge.steps),Be=Re.selectAll("g.bg-bullet").data(Jt);Be.enter().append("g").classed("bg-bullet",!0).append("rect"),Be.select("rect").call(Wt).call(M),Be.exit().remove();var Ge=Re.selectAll("g.value-bullet").data([Ke.gauge.bar]);Ge.enter().append("g").classed("value-bullet",!0).append("rect"),Ge.select("rect").attr("height",at).attr("y",(Tt-at)/2).call(M),w(yt)?Ge.select("rect").transition().duration(yt.duration).ease(yt.easing).each("end",function(){Ot&&Ot()}).each("interrupt",function(){Ot&&Ot()}).attr("width",Math.max(0,we.c2p(Math.min(Ke.gauge.axis.range[1],ve[0].y)))):Ge.select("rect").attr("width",typeof ve[0].y=="number"?Math.max(0,we.c2p(Math.min(Ke.gauge.axis.range[1],ve[0].y))):0),Ge.exit().remove();var kt=ve.filter(function(){return Ke.gauge.threshold.value||Ke.gauge.threshold.value===0}),dt=Re.selectAll("g.threshold-bullet").data(kt);dt.enter().append("g").classed("threshold-bullet",!0).append("line"),dt.select("line").attr("x1",we.c2p(Ke.gauge.threshold.value)).attr("x2",we.c2p(Ke.gauge.threshold.value)).attr("y1",(1-Ke.gauge.threshold.thickness)/2*Tt).attr("y2",(1-(1-Ke.gauge.threshold.thickness)/2)*Tt).call(_.stroke,Ke.gauge.threshold.line.color).style("stroke-width",Ke.gauge.threshold.line.width),dt.exit().remove();var Oe=Re.selectAll("g.gauge-outline").data([Ye]);Oe.enter().append("g").classed("gauge-outline",!0).append("rect"),Oe.select("rect").call(Wt).call(M),Oe.exit().remove()}(L,0,B,{gauge:_e,layer:Ae,size:q,gaugeBg:te,gaugeOutline:Y,transitionOpts:F,onComplete:O});var ke=re.selectAll("text.title").data(B);ke.exit().remove(),ke.enter().append("text").classed("title",!0),ke.attr("text-anchor",function(){return H?A.right:A[J.title.align]}).text(J.title.text).call(d.font,J.title.font).call(p.convertToTspans,L),ke.attr("transform",function(){var Le,de=q.l+q.w*b[J.title.align],ve=m.titlePadding,Me=d.bBox(ke.node());return U?(V&&(J.gauge.axis.visible?Le=d.bBox(me.node()).top-ve-Me.bottom:Le=q.t+q.h/2-ie/2-Me.bottom-ve),H&&(Le=G-(Me.top+Me.bottom)/2,de=q.l-m.bulletPadding*q.w)):Le=J._numbersTop-ve-Me.bottom,s(de,Le)})})}},{"../../components/color":366,"../../components/drawing":388,"../../constants/alignment":471,"../../lib":503,"../../lib/svg_text_utils":529,"../../plots/cartesian/axes":554,"../../plots/cartesian/axis_defaults":556,"../../plots/cartesian/layout_attributes":569,"../../plots/cartesian/position_defaults":572,"./constants":858,"@plotly/d3":58,"d3-interpolate":116}],862:[function(t,o,f){var r=t("../../components/colorscale/attributes"),a=t("../../plots/cartesian/axis_format_attributes").axisHoverFormat,l=t("../../plots/template_attributes").hovertemplateAttrs,c=t("../mesh3d/attributes"),i=t("../../plots/attributes"),s=t("../../lib/extend").extendFlat,u=t("../../plot_api/edit_types").overrideAll,h=o.exports=u(s({x:{valType:"data_array"},y:{valType:"data_array"},z:{valType:"data_array"},value:{valType:"data_array"},isomin:{valType:"number"},isomax:{valType:"number"},surface:{show:{valType:"boolean",dflt:!0},count:{valType:"integer",dflt:2,min:1},fill:{valType:"number",min:0,max:1,dflt:1},pattern:{valType:"flaglist",flags:["A","B","C","D","E"],extras:["all","odd","even"],dflt:"all"}},spaceframe:{show:{valType:"boolean",dflt:!1},fill:{valType:"number",min:0,max:1,dflt:.15}},slices:{x:{show:{valType:"boolean",dflt:!1},locations:{valType:"data_array",dflt:[]},fill:{valType:"number",min:0,max:1,dflt:1}},y:{show:{valType:"boolean",dflt:!1},locations:{valType:"data_array",dflt:[]},fill:{valType:"number",min:0,max:1,dflt:1}},z:{show:{valType:"boolean",dflt:!1},locations:{valType:"data_array",dflt:[]},fill:{valType:"number",min:0,max:1,dflt:1}}},caps:{x:{show:{valType:"boolean",dflt:!0},fill:{valType:"number",min:0,max:1,dflt:1}},y:{show:{valType:"boolean",dflt:!0},fill:{valType:"number",min:0,max:1,dflt:1}},z:{show:{valType:"boolean",dflt:!0},fill:{valType:"number",min:0,max:1,dflt:1}}},text:{valType:"string",dflt:"",arrayOk:!0},hovertext:{valType:"string",dflt:"",arrayOk:!0},hovertemplate:l(),xhoverformat:a("x"),yhoverformat:a("y"),zhoverformat:a("z"),valuehoverformat:a("value",1),showlegend:s({},i.showlegend,{dflt:!1})},r("",{colorAttr:"`value`",showScaleDflt:!0,editTypeOverride:"calc"}),{opacity:c.opacity,lightposition:c.lightposition,lighting:c.lighting,flatshading:c.flatshading,contour:c.contour,hoverinfo:s({},i.hoverinfo)}),"calc","nested");h.flatshading.dflt=!0,h.lighting.facenormalsepsilon.dflt=0,h.x.editType=h.y.editType=h.z.editType=h.value.editType="calc+clearAxisTypes",h.transforms=void 0},{"../../components/colorscale/attributes":373,"../../lib/extend":493,"../../plot_api/edit_types":536,"../../plots/attributes":550,"../../plots/cartesian/axis_format_attributes":557,"../../plots/template_attributes":633,"../mesh3d/attributes":867}],863:[function(t,o,f){var r=t("../../components/colorscale/calc"),a=t("../streamtube/calc").processGrid,l=t("../streamtube/calc").filter;o.exports=function(c,i){i._len=Math.min(i.x.length,i.y.length,i.z.length,i.value.length),i._x=l(i.x,i._len),i._y=l(i.y,i._len),i._z=l(i.z,i._len),i._value=l(i.value,i._len);var s=a(i);i._gridFill=s.fill,i._Xs=s.Xs,i._Ys=s.Ys,i._Zs=s.Zs,i._len=s.len;for(var u=1/0,h=-1/0,d=0;d0;y--){var v=Math.min(g[y],g[y-1]),x=Math.max(g[y],g[y-1]);if(x>v&&v-1}function Q(Re,Ve){return Re===null?Ve:Re}function ee(Re,Ve,We){re();var Ye,nt,ft,yt=[Ve],Ot=[We];if(b>=1)yt=[Ve],Ot=[We];else if(b>0){var Tt=function(dt,Oe){var Ie=dt[0],Te=dt[1],Pe=dt[2],qe=function(tt,bt,Ft){for(var Et=[],Pt=0;Pt-1?We[Lt]:J(Wt,Jt,Be);et[Lt]=kt>-1?kt:V(Wt,Jt,Be,Q(Re,Ge))}Ye=et[0],nt=et[1],ft=et[2],p._meshI.push(Ye),p._meshJ.push(nt),p._meshK.push(ft),++P}}function ie(Re,Ve,We,Ye){var nt=Re[3];ntYe&&(nt=Ye);for(var ft=(Re[3]-nt)/(Re[3]-Ve[3]+1e-9),yt=[],Ot=0;Ot<4;Ot++)yt[Ot]=(1-ft)*Re[Ot]+ft*Ve[Ot];return yt}function ae(Re,Ve,We){return Re>=Ve&&Re<=We}function ue(Re){var Ve=.001*(Y-te);return Re>=te-Ve&&Re<=Y+Ve}function le(Re){for(var Ve=[],We=0;We<4;We++){var Ye=Re[We];Ve.push([p._x[Ye],p._y[Ye],p._z[Ye],p._value[Ye]])}return Ve}function ge(Re,Ve,We,Ye,nt,ft){ft||(ft=1),We=[-1,-1,-1];var yt=!1,Ot=[ae(Ve[0][3],Ye,nt),ae(Ve[1][3],Ye,nt),ae(Ve[2][3],Ye,nt)];if(!Ot[0]&&!Ot[1]&&!Ot[2])return!1;var Tt=function(et,Lt,Wt){return ue(Lt[0][3])&&ue(Lt[1][3])&&ue(Lt[2][3])?(ee(et,Lt,Wt),!0):ft<3&&ge(et,Lt,Wt,te,Y,++ft)};if(Ot[0]&&Ot[1]&&Ot[2])return Tt(Re,Ve,We)||yt;var at=!1;return[[0,1,2],[2,0,1],[1,2,0]].forEach(function(et){if(Ot[et[0]]&&Ot[et[1]]&&!Ot[et[2]]){var Lt=Ve[et[0]],Wt=Ve[et[1]],Jt=Ve[et[2]],Be=ie(Jt,Lt,Ye,nt),Ge=ie(Jt,Wt,Ye,nt);yt=Tt(Re,[Ge,Be,Lt],[-1,-1,We[et[0]]])||yt,yt=Tt(Re,[Lt,Wt,Ge],[We[et[0]],We[et[1]],-1])||yt,at=!0}}),at||[[0,1,2],[1,2,0],[2,0,1]].forEach(function(et){if(Ot[et[0]]&&!Ot[et[1]]&&!Ot[et[2]]){var Lt=Ve[et[0]],Wt=Ve[et[1]],Jt=Ve[et[2]],Be=ie(Wt,Lt,Ye,nt),Ge=ie(Jt,Lt,Ye,nt);yt=Tt(Re,[Ge,Be,Lt],[-1,-1,We[et[0]]])||yt,at=!0}}),yt}function fe(Re,Ve,We,Ye){var nt=!1,ft=le(Ve),yt=[ae(ft[0][3],We,Ye),ae(ft[1][3],We,Ye),ae(ft[2][3],We,Ye),ae(ft[3][3],We,Ye)];if(!(yt[0]||yt[1]||yt[2]||yt[3]))return nt;if(yt[0]&&yt[1]&&yt[2]&&yt[3])return S&&(nt=function(Tt,at,et){var Lt=function(Wt,Jt,Be){ee(Tt,[at[Wt],at[Jt],at[Be]],[et[Wt],et[Jt],et[Be]])};Lt(0,1,2),Lt(3,0,1),Lt(2,3,0),Lt(1,2,3)}(Re,ft,Ve)||nt),nt;var Ot=!1;return[[0,1,2,3],[3,0,1,2],[2,3,0,1],[1,2,3,0]].forEach(function(Tt){if(yt[Tt[0]]&&yt[Tt[1]]&&yt[Tt[2]]&&!yt[Tt[3]]){var at=ft[Tt[0]],et=ft[Tt[1]],Lt=ft[Tt[2]],Wt=ft[Tt[3]];if(S)nt=ee(Re,[at,et,Lt],[Ve[Tt[0]],Ve[Tt[1]],Ve[Tt[2]]])||nt;else{var Jt=ie(Wt,at,We,Ye),Be=ie(Wt,et,We,Ye),Ge=ie(Wt,Lt,We,Ye);nt=ee(null,[Jt,Be,Ge],[-1,-1,-1])||nt}Ot=!0}}),Ot||([[0,1,2,3],[1,2,3,0],[2,3,0,1],[3,0,1,2],[0,2,3,1],[1,3,2,0]].forEach(function(Tt){if(yt[Tt[0]]&&yt[Tt[1]]&&!yt[Tt[2]]&&!yt[Tt[3]]){var at=ft[Tt[0]],et=ft[Tt[1]],Lt=ft[Tt[2]],Wt=ft[Tt[3]],Jt=ie(Lt,at,We,Ye),Be=ie(Lt,et,We,Ye),Ge=ie(Wt,et,We,Ye),kt=ie(Wt,at,We,Ye);S?(nt=ee(Re,[at,kt,Jt],[Ve[Tt[0]],-1,-1])||nt,nt=ee(Re,[et,Be,Ge],[Ve[Tt[1]],-1,-1])||nt):nt=function(dt,Oe,Ie){var Te=function(Pe,qe,rt){ee(dt,[Oe[Pe],Oe[qe],Oe[rt]],[Ie[Pe],Ie[qe],Ie[rt]])};Te(0,1,2),Te(2,3,0)}(null,[Jt,Be,Ge,kt],[-1,-1,-1,-1])||nt,Ot=!0}}),Ot||[[0,1,2,3],[1,2,3,0],[2,3,0,1],[3,0,1,2]].forEach(function(Tt){if(yt[Tt[0]]&&!yt[Tt[1]]&&!yt[Tt[2]]&&!yt[Tt[3]]){var at=ft[Tt[0]],et=ft[Tt[1]],Lt=ft[Tt[2]],Wt=ft[Tt[3]],Jt=ie(et,at,We,Ye),Be=ie(Lt,at,We,Ye),Ge=ie(Wt,at,We,Ye);S?(nt=ee(Re,[at,Jt,Be],[Ve[Tt[0]],-1,-1])||nt,nt=ee(Re,[at,Be,Ge],[Ve[Tt[0]],-1,-1])||nt,nt=ee(Re,[at,Ge,Jt],[Ve[Tt[0]],-1,-1])||nt):nt=ee(null,[Jt,Be,Ge],[-1,-1,-1])||nt,Ot=!0}})),nt}function me(Re,Ve,We,Ye,nt,ft,yt,Ot,Tt,at,et){var Lt=!1;return E&&(q(Re,"A")&&(Lt=fe(null,[Ve,We,Ye,ft],at,et)||Lt),q(Re,"B")&&(Lt=fe(null,[We,Ye,nt,Tt],at,et)||Lt),q(Re,"C")&&(Lt=fe(null,[We,ft,yt,Tt],at,et)||Lt),q(Re,"D")&&(Lt=fe(null,[Ye,ft,Ot,Tt],at,et)||Lt),q(Re,"E")&&(Lt=fe(null,[We,Ye,ft,Tt],at,et)||Lt)),S&&(Lt=fe(Re,[We,Ye,ft,Tt],at,et)||Lt),Lt}function _e(Re,Ve,We,Ye,nt,ft,yt,Ot){return[Ot[0]===!0||ge(Re,le([Ve,We,Ye]),[Ve,We,Ye],ft,yt),Ot[1]===!0||ge(Re,le([Ye,nt,Ve]),[Ye,nt,Ve],ft,yt)]}function Ae(Re,Ve,We,Ye,nt,ft,yt,Ot,Tt){return Ot?_e(Re,Ve,We,nt,Ye,ft,yt,Tt):_e(Re,We,nt,Ye,Ve,ft,yt,Tt)}function ke(Re,Ve,We,Ye,nt,ft,yt){var Ot,Tt,at,et,Lt=!1,Wt=function(){Lt=ge(Re,[Ot,Tt,at],[-1,-1,-1],nt,ft)||Lt,Lt=ge(Re,[at,et,Ot],[-1,-1,-1],nt,ft)||Lt},Jt=yt[0],Be=yt[1],Ge=yt[2];return Jt&&(Ot=H(le([W(Ve,We-0,Ye-0)])[0],le([W(Ve-1,We-0,Ye-0)])[0],Jt),Tt=H(le([W(Ve,We-0,Ye-1)])[0],le([W(Ve-1,We-0,Ye-1)])[0],Jt),at=H(le([W(Ve,We-1,Ye-1)])[0],le([W(Ve-1,We-1,Ye-1)])[0],Jt),et=H(le([W(Ve,We-1,Ye-0)])[0],le([W(Ve-1,We-1,Ye-0)])[0],Jt),Wt()),Be&&(Ot=H(le([W(Ve-0,We,Ye-0)])[0],le([W(Ve-0,We-1,Ye-0)])[0],Be),Tt=H(le([W(Ve-0,We,Ye-1)])[0],le([W(Ve-0,We-1,Ye-1)])[0],Be),at=H(le([W(Ve-1,We,Ye-1)])[0],le([W(Ve-1,We-1,Ye-1)])[0],Be),et=H(le([W(Ve-1,We,Ye-0)])[0],le([W(Ve-1,We-1,Ye-0)])[0],Be),Wt()),Ge&&(Ot=H(le([W(Ve-0,We-0,Ye)])[0],le([W(Ve-0,We-0,Ye-1)])[0],Ge),Tt=H(le([W(Ve-0,We-1,Ye)])[0],le([W(Ve-0,We-1,Ye-1)])[0],Ge),at=H(le([W(Ve-1,We-1,Ye)])[0],le([W(Ve-1,We-1,Ye-1)])[0],Ge),et=H(le([W(Ve-1,We-0,Ye)])[0],le([W(Ve-1,We-0,Ye-1)])[0],Ge),Wt()),Lt}function Le(Re,Ve,We,Ye,nt,ft,yt,Ot,Tt,at,et,Lt){var Wt=Re;return Lt?(E&&Re==="even"&&(Wt=null),me(Wt,Ve,We,Ye,nt,ft,yt,Ot,Tt,at,et)):(E&&Re==="odd"&&(Wt=null),me(Wt,Tt,Ot,yt,ft,nt,Ye,We,Ve,at,et))}function de(Re,Ve,We,Ye,nt){for(var ft=[],yt=0,Ot=0;OtMath.abs(nt-K)?[G,nt]:[nt,K];Ce(Re,ft[0],ft[1])}}var yt=[[Math.min(te,K),Math.max(te,K)],[Math.min(G,Y),Math.max(G,Y)]];["x","y","z"].forEach(function(Ot){for(var Tt=[],at=0;at0&&(Ge.push(Oe.id),Ot==="x"?kt.push([Oe.distRatio,0,0]):Ot==="y"?kt.push([0,Oe.distRatio,0]):kt.push([0,0,Oe.distRatio]))}else Be=Ke(1,Ot==="x"?D-1:Ot==="y"?O-1:N-1);Ge.length>0&&(Tt[et]=Ot==="x"?Fe(null,Ge,Lt,Wt,kt,Tt[et]):Ot==="y"?ze(null,Ge,Lt,Wt,kt,Tt[et]):$e(null,Ge,Lt,Wt,kt,Tt[et]),et++),Be.length>0&&(Tt[et]=Ot==="x"?de(null,Be,Lt,Wt,Tt[et]):Ot==="y"?ve(null,Be,Lt,Wt,Tt[et]):Me(null,Be,Lt,Wt,Tt[et]),et++)}var Ie=p.caps[Ot];Ie.show&&Ie.fill&&(ne(Ie.fill),Tt[et]=Ot==="x"?de(null,[0,D-1],Lt,Wt,Tt[et]):Ot==="y"?ve(null,[0,O-1],Lt,Wt,Tt[et]):Me(null,[0,N-1],Lt,Wt,Tt[et]),et++)}}),P===0&&U(),p._meshX=v,p._meshY=x,p._meshZ=_,p._meshIntensity=A,p._Xs=L,p._Ys=R,p._Zs=F}(),p}o.exports={findNearestOnAxis:s,generateIsoMeshes:m,createIsosurfaceTrace:function(p,g){var y=p.glplot.gl,v=r({gl:y}),x=new u(p,v,g.uid);return v._trace=x,x.update(g),p.glplot.add(v),x}}},{"../../../stackgl_modules":1124,"../../components/colorscale":378,"../../lib/gl_format_color":499,"../../lib/str2rgbarray":528,"../../plots/gl3d/zip3":609}],865:[function(t,o,f){var r=t("../../lib"),a=t("../../registry"),l=t("./attributes"),c=t("../../components/colorscale/defaults");function i(s,u,h,d,m){var p=m("isomin"),g=m("isomax");g!=null&&p!=null&&p>g&&(u.isomin=null,u.isomax=null);var y=m("x"),v=m("y"),x=m("z"),_=m("value");y&&y.length&&v&&v.length&&x&&x.length&&_&&_.length?(a.getComponentMethod("calendars","handleTraceDefaults")(s,u,["x","y","z"],d),m("valuehoverformat"),["x","y","z"].forEach(function(A){m(A+"hoverformat");var b="caps."+A;m(b+".show")&&m(b+".fill");var k="slices."+A;m(k+".show")&&(m(k+".fill"),m(k+".locations"))}),m("spaceframe.show")&&m("spaceframe.fill"),m("surface.show")&&(m("surface.count"),m("surface.fill"),m("surface.pattern")),m("contour.show")&&(m("contour.color"),m("contour.width")),["text","hovertext","hovertemplate","lighting.ambient","lighting.diffuse","lighting.specular","lighting.roughness","lighting.fresnel","lighting.vertexnormalsepsilon","lighting.facenormalsepsilon","lightposition.x","lightposition.y","lightposition.z","flatshading","opacity"].forEach(function(A){m(A)}),c(s,u,d,m,{prefix:"",cLetter:"c"}),u._length=null):u.visible=!1}o.exports={supplyDefaults:function(s,u,h,d){i(s,u,h,d,function(m,p){return r.coerce(s,u,l,m,p)})},supplyIsoDefaults:i}},{"../../components/colorscale/defaults":376,"../../lib":503,"../../registry":638,"./attributes":862}],866:[function(t,o,f){o.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults").supplyDefaults,calc:t("./calc"),colorbar:{min:"cmin",max:"cmax"},plot:t("./convert").createIsosurfaceTrace,moduleType:"trace",name:"isosurface",basePlotModule:t("../../plots/gl3d"),categories:["gl3d","showLegend"],meta:{}}},{"../../plots/gl3d":598,"./attributes":862,"./calc":863,"./convert":864,"./defaults":865}],867:[function(t,o,f){var r=t("../../components/colorscale/attributes"),a=t("../../plots/cartesian/axis_format_attributes").axisHoverFormat,l=t("../../plots/template_attributes").hovertemplateAttrs,c=t("../surface/attributes"),i=t("../../plots/attributes"),s=t("../../lib/extend").extendFlat;o.exports=s({x:{valType:"data_array",editType:"calc+clearAxisTypes"},y:{valType:"data_array",editType:"calc+clearAxisTypes"},z:{valType:"data_array",editType:"calc+clearAxisTypes"},i:{valType:"data_array",editType:"calc"},j:{valType:"data_array",editType:"calc"},k:{valType:"data_array",editType:"calc"},text:{valType:"string",dflt:"",arrayOk:!0,editType:"calc"},hovertext:{valType:"string",dflt:"",arrayOk:!0,editType:"calc"},hovertemplate:l({editType:"calc"}),xhoverformat:a("x"),yhoverformat:a("y"),zhoverformat:a("z"),delaunayaxis:{valType:"enumerated",values:["x","y","z"],dflt:"z",editType:"calc"},alphahull:{valType:"number",dflt:-1,editType:"calc"},intensity:{valType:"data_array",editType:"calc"},intensitymode:{valType:"enumerated",values:["vertex","cell"],dflt:"vertex",editType:"calc"},color:{valType:"color",editType:"calc"},vertexcolor:{valType:"data_array",editType:"calc"},facecolor:{valType:"data_array",editType:"calc"},transforms:void 0},r("",{colorAttr:"`intensity`",showScaleDflt:!0,editTypeOverride:"calc"}),{opacity:c.opacity,flatshading:{valType:"boolean",dflt:!1,editType:"calc"},contour:{show:s({},c.contours.x.show,{}),color:c.contours.x.color,width:c.contours.x.width,editType:"calc"},lightposition:{x:s({},c.lightposition.x,{dflt:1e5}),y:s({},c.lightposition.y,{dflt:1e5}),z:s({},c.lightposition.z,{dflt:0}),editType:"calc"},lighting:s({vertexnormalsepsilon:{valType:"number",min:0,max:1,dflt:1e-12,editType:"calc"},facenormalsepsilon:{valType:"number",min:0,max:1,dflt:1e-6,editType:"calc"},editType:"calc"},c.lighting),hoverinfo:s({},i.hoverinfo,{editType:"calc"}),showlegend:s({},i.showlegend,{dflt:!1})})},{"../../components/colorscale/attributes":373,"../../lib/extend":493,"../../plots/attributes":550,"../../plots/cartesian/axis_format_attributes":557,"../../plots/template_attributes":633,"../surface/attributes":1061}],868:[function(t,o,f){var r=t("../../components/colorscale/calc");o.exports=function(a,l){l.intensity&&r(a,l,{vals:l.intensity,containerStr:"",cLetter:"c"})}},{"../../components/colorscale/calc":374}],869:[function(t,o,f){var r=t("../../../stackgl_modules").gl_mesh3d,a=t("../../../stackgl_modules").delaunay_triangulate,l=t("../../../stackgl_modules").alpha_shape,c=t("../../../stackgl_modules").convex_hull,i=t("../../lib/gl_format_color").parseColorScale,s=t("../../lib/str2rgbarray"),u=t("../../components/colorscale").extractOpts,h=t("../../plots/gl3d/zip3");function d(x,_,A){this.scene=x,this.uid=A,this.mesh=_,this.name="",this.color="#fff",this.data=null,this.showContour=!1}var m=d.prototype;function p(x){for(var _=[],A=x.length,b=0;b=_-.5)return!1;return!0}m.handlePick=function(x){if(x.object===this.mesh){var _=x.index=x.data.index;x.data._cellCenter?x.traceCoordinate=x.data.dataCoordinate:x.traceCoordinate=[this.data.x[_],this.data.y[_],this.data.z[_]];var A=this.data.hovertext||this.data.text;return Array.isArray(A)&&A[_]!==void 0?x.textLabel=A[_]:A&&(x.textLabel=A),!0}},m.update=function(x){var _=this.scene,A=_.fullSceneLayout;this.data=x;var b,k=x.x.length,w=h(g(A.xaxis,x.x,_.dataScale[0],x.xcalendar),g(A.yaxis,x.y,_.dataScale[1],x.ycalendar),g(A.zaxis,x.z,_.dataScale[2],x.zcalendar));if(x.i&&x.j&&x.k){if(x.i.length!==x.j.length||x.j.length!==x.k.length||!v(x.i,k)||!v(x.j,k)||!v(x.k,k))return;b=h(y(x.i),y(x.j),y(x.k))}else b=x.alphahull===0?c(w):x.alphahull>0?l(x.alphahull,w):function(S,P){for(var L=["x","y","z"].indexOf(S),R=[],F=P.length,D=0;DM):w=D>L,M=D;var O=y(L,R,F,D);O.pos=P,O.yc=(L+D)/2,O.i=S,O.dir=w?"increasing":"decreasing",O.x=O.pos,O.y=[F,R],T&&(O.orig_p=m[S]),b&&(O.tx=d.text[S]),k&&(O.htx=d.hovertext[S]),E.push(O)}else E.push({pos:P,empty:!0})}return d._extremes[g._id]=l.findExtremes(g,r.concat(_,x),{padded:!0}),E.length&&(E[0].t={labels:{open:a(h,"open:")+" ",high:a(h,"high:")+" ",low:a(h,"low:")+" ",close:a(h,"close:")+" "}}),E}o.exports={calc:function(h,d){var m=l.getFromId(h,d.xaxis),p=l.getFromId(h,d.yaxis),g=function(A,b,k){var w=k._minDiff;if(!w){var M,T=A._fullData,E=[];for(w=1/0,M=0;M"+b.labels[R]+r.hoverLabelText(_,F,A.yhoverformat):((L=a.extendFlat({},w)).y0=L.y1=D,L.yLabelVal=F,L.yLabel=b.labels[R]+r.hoverLabelText(_,F,A.yhoverformat),L.name="",k.push(L),S[F]=L)}return k}function m(p,g,y,v){var x=p.cd,_=p.ya,A=x[0].trace,b=x[0].t,k=h(p,g,y,v);if(!k)return[];var w=x[k.index],M=k.index=w.i,T=w.dir;function E(O){return b.labels[O]+r.hoverLabelText(_,A[O][M],A.yhoverformat)}var S=w.hi||A.hoverinfo,P=S.split("+"),L=S==="all",R=L||P.indexOf("y")!==-1,F=L||P.indexOf("text")!==-1,D=R?[E("open"),E("high"),E("low"),E("close")+" "+u[T]]:[];return F&&i(w,A,D),k.extraText=D.join("
    "),k.y0=k.y1=_.c2p(w.yc,!0),[k]}o.exports={hoverPoints:function(p,g,y,v){return p.cd[0].trace.hoverlabel.split?d(p,g,y,v):m(p,g,y,v)},hoverSplit:d,hoverOnPoints:m}},{"../../components/color":366,"../../components/fx":406,"../../constants/delta.js":473,"../../lib":503,"../../plots/cartesian/axes":554}],876:[function(t,o,f){o.exports={moduleType:"trace",name:"ohlc",basePlotModule:t("../../plots/cartesian"),categories:["cartesian","svg","showLegend"],meta:{},attributes:t("./attributes"),supplyDefaults:t("./defaults"),calc:t("./calc").calc,plot:t("./plot"),style:t("./style"),hoverPoints:t("./hover").hoverPoints,selectPoints:t("./select")}},{"../../plots/cartesian":568,"./attributes":872,"./calc":873,"./defaults":874,"./hover":875,"./plot":878,"./select":879,"./style":880}],877:[function(t,o,f){var r=t("../../registry"),a=t("../../lib");o.exports=function(l,c,i,s){var u=i("x"),h=i("open"),d=i("high"),m=i("low"),p=i("close");if(i("hoverlabel.split"),r.getComponentMethod("calendars","handleTraceDefaults")(l,c,["x"],s),h&&d&&m&&p){var g=Math.min(h.length,d.length,m.length,p.length);return u&&(g=Math.min(g,a.minRowLength(u))),c._length=g,g}}},{"../../lib":503,"../../registry":638}],878:[function(t,o,f){var r=t("@plotly/d3"),a=t("../../lib");o.exports=function(l,c,i,s){var u=c.yaxis,h=c.xaxis,d=!!h.rangebreaks;a.makeTraceGroups(s,i,"trace ohlc").each(function(m){var p=r.select(this),g=m[0],y=g.t;if(g.trace.visible!==!0||y.empty)p.remove();else{var v=y.tickLen,x=p.selectAll("path").data(a.identity);x.enter().append("path"),x.exit().remove(),x.attr("d",function(_){if(_.empty)return"M0,0Z";var A=h.c2p(_.pos-v,!0),b=h.c2p(_.pos+v,!0),k=d?(A+b)/2:h.c2p(_.pos,!0);return"M"+A+","+u.c2p(_.o,!0)+"H"+k+"M"+k+","+u.c2p(_.h,!0)+"V"+u.c2p(_.l,!0)+"M"+b+","+u.c2p(_.c,!0)+"H"+k})}})}},{"../../lib":503,"@plotly/d3":58}],879:[function(t,o,f){o.exports=function(r,a){var l,c=r.cd,i=r.xaxis,s=r.yaxis,u=[],h=c[0].t.bPos||0;if(a===!1)for(l=0;l=U.length||V[U[H]]!==void 0)return!1;V[U[H]]=!0}return!0}(J.map(function(U){return U.displayindex})))for(re=0;re0;_&&(v="array");var A=p("categoryorder",v);A==="array"?(p("categoryarray"),p("ticktext")):(delete d.categoryarray,delete d.ticktext),_||A!=="array"||(m.categoryorder="trace")}}o.exports=function(d,m,p,g){function y(b,k){return r.coerce(d,m,s,b,k)}var v=i(d,m,{name:"dimensions",handleItemDefaults:h}),x=function(b,k,w,M,T){T("line.shape"),T("line.hovertemplate");var E=T("line.color",M.colorway[0]);if(a(b,"line")&&r.isArrayOrTypedArray(E)){if(E.length)return T("line.colorscale"),l(b,k,M,T,{prefix:"line.",cLetter:"c"}),E.length;k.line.color=w}return 1/0}(d,m,p,g,y);c(m,g,y),Array.isArray(v)&&v.length||(m.visible=!1),u(m,v,"values",x),y("hoveron"),y("hovertemplate"),y("arrangement"),y("bundlecolors"),y("sortpaths"),y("counts");var _={family:g.font.family,size:Math.round(g.font.size),color:g.font.color};r.coerceFont(y,"labelfont",_);var A={family:g.font.family,size:Math.round(g.font.size/1.2),color:g.font.color};r.coerceFont(y,"tickfont",A)}},{"../../components/colorscale/defaults":376,"../../components/colorscale/helpers":377,"../../lib":503,"../../plots/array_container_defaults":549,"../../plots/domain":584,"../parcoords/merge_length":898,"./attributes":881}],885:[function(t,o,f){o.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),calc:t("./calc"),plot:t("./plot"),colorbar:{container:"line",min:"cmin",max:"cmax"},moduleType:"trace",name:"parcats",basePlotModule:t("./base_plot"),categories:["noOpacity"],meta:{}}},{"./attributes":881,"./base_plot":882,"./calc":883,"./defaults":884,"./plot":887}],886:[function(t,o,f){var r=t("@plotly/d3"),a=t("d3-interpolate").interpolateNumber,l=t("../../plot_api/plot_api"),c=t("../../components/fx"),i=t("../../lib"),s=i.strTranslate,u=t("../../components/drawing"),h=t("tinycolor2"),d=t("../../lib/svg_text_utils");function m(U,V,H,ne){var q=U.map(K.bind(0,V,H)),Q=ne.selectAll("g.parcatslayer").data([null]);Q.enter().append("g").attr("class","parcatslayer").style("pointer-events","all");var ee=Q.selectAll("g.trace.parcats").data(q,p),ie=ee.enter().append("g").attr("class","trace parcats");ee.attr("transform",function(ke){return s(ke.x,ke.y)}),ie.append("g").attr("class","paths");var ae=ee.select("g.paths").selectAll("path.path").data(function(ke){return ke.paths},p);ae.attr("fill",function(ke){return ke.model.color});var ue=ae.enter().append("path").attr("class","path").attr("stroke-opacity",0).attr("fill",function(ke){return ke.model.color}).attr("fill-opacity",0);k(ue),ae.attr("d",function(ke){return ke.svgD}),ue.empty()||ae.sort(y),ae.exit().remove(),ae.on("mouseover",v).on("mouseout",x).on("click",b),ie.append("g").attr("class","dimensions");var le=ee.select("g.dimensions").selectAll("g.dimension").data(function(ke){return ke.dimensions},p);le.enter().append("g").attr("class","dimension"),le.attr("transform",function(ke){return s(ke.x,0)}),le.exit().remove();var ge=le.selectAll("g.category").data(function(ke){return ke.categories},p),fe=ge.enter().append("g").attr("class","category");ge.attr("transform",function(ke){return s(0,ke.y)}),fe.append("rect").attr("class","catrect").attr("pointer-events","none"),ge.select("rect.catrect").attr("fill","none").attr("width",function(ke){return ke.width}).attr("height",function(ke){return ke.height}),M(fe);var me=ge.selectAll("rect.bandrect").data(function(ke){return ke.bands},p);me.each(function(){i.raiseToTop(this)}),me.attr("fill",function(ke){return ke.color});var _e=me.enter().append("rect").attr("class","bandrect").attr("stroke-opacity",0).attr("fill",function(ke){return ke.color}).attr("fill-opacity",0);me.attr("fill",function(ke){return ke.color}).attr("width",function(ke){return ke.width}).attr("height",function(ke){return ke.height}).attr("y",function(ke){return ke.y}).attr("cursor",function(ke){return ke.parcatsViewModel.arrangement==="fixed"?"default":ke.parcatsViewModel.arrangement==="perpendicular"?"ns-resize":"move"}),T(_e),me.exit().remove(),fe.append("text").attr("class","catlabel").attr("pointer-events","none");var Ae=V._fullLayout.paper_bgcolor;ge.select("text.catlabel").attr("text-anchor",function(ke){return g(ke)?"start":"end"}).attr("alignment-baseline","middle").style("text-shadow",d.makeTextShadow(Ae)).style("fill","rgb(0, 0, 0)").attr("x",function(ke){return g(ke)?ke.width+5:-5}).attr("y",function(ke){return ke.height/2}).text(function(ke){return ke.model.categoryLabel}).each(function(ke){u.font(r.select(this),ke.parcatsViewModel.categorylabelfont),d.convertToTspans(r.select(this),V)}),fe.append("text").attr("class","dimlabel"),ge.select("text.dimlabel").attr("text-anchor","middle").attr("alignment-baseline","baseline").attr("cursor",function(ke){return ke.parcatsViewModel.arrangement==="fixed"?"default":"ew-resize"}).attr("x",function(ke){return ke.width/2}).attr("y",-5).text(function(ke,Le){return Le===0?ke.parcatsViewModel.model.dimensions[ke.model.dimensionInd].dimensionLabel:null}).each(function(ke){u.font(r.select(this),ke.parcatsViewModel.labelfont)}),ge.selectAll("rect.bandrect").on("mouseover",R).on("mouseout",F),ge.exit().remove(),le.call(r.behavior.drag().origin(function(ke){return{x:ke.x,y:0}}).on("dragstart",D).on("drag",O).on("dragend",N)),ee.each(function(ke){ke.traceSelection=r.select(this),ke.pathSelection=r.select(this).selectAll("g.paths").selectAll("path.path"),ke.dimensionSelection=r.select(this).selectAll("g.dimensions").selectAll("g.dimension")}),ee.exit().remove()}function p(U){return U.key}function g(U){var V=U.parcatsViewModel.dimensions.length,H=U.parcatsViewModel.dimensions[V-1].model.dimensionInd;return U.model.dimensionInd===H}function y(U,V){return U.model.rawColor>V.model.rawColor?1:U.model.rawColor"),Ce=r.mouse(ie)[0];c.loneHover({trace:ae,x:_e-le.left+ge.left,y:Ae-le.top+ge.top,text:we,color:U.model.color,borderColor:"black",fontFamily:'Monaco, "Courier New", monospace',fontSize:10,fontColor:ke,idealAlign:Ce<_e?"right":"left",hovertemplate:(ae.line||{}).hovertemplate,hovertemplateLabels:ve,eventData:[{data:ae._input,fullData:ae,count:Le,probability:de}]},{container:ue._hoverlayer.node(),outerContainer:ue._paper.node(),gd:ie})}}}function x(U){if(!U.parcatsViewModel.dragDimension&&(k(r.select(this)),c.loneUnhover(U.parcatsViewModel.graphDiv._fullLayout._hoverlayer.node()),U.parcatsViewModel.pathSelection.sort(y),U.parcatsViewModel.hoverinfoItems.indexOf("skip")===-1)){var V=_(U),H=A(U);U.parcatsViewModel.graphDiv.emit("plotly_unhover",{points:V,event:r.event,constraints:H})}}function _(U){for(var V=[],H=B(U.parcatsViewModel),ne=0;ne1&&ge.displayInd===le.dimensions.length-1?(ne=ae.left,q="left"):(ne=ae.left+ae.width,q="right");var _e=ue.model.count,Ae=ue.model.categoryLabel,ke=_e/ue.parcatsViewModel.model.count,Le={countLabel:_e,categoryLabel:Ae,probabilityLabel:ke.toFixed(3)},de=[];ue.parcatsViewModel.hoverinfoItems.indexOf("count")!==-1&&de.push(["Count:",Le.countLabel].join(" ")),ue.parcatsViewModel.hoverinfoItems.indexOf("probability")!==-1&&de.push(["P("+Le.categoryLabel+"):",Le.probabilityLabel].join(" "));var ve=de.join("
    ");return{trace:fe,x:Q*(ne-V.left),y:ee*(me-V.top),text:ve,color:"lightgray",borderColor:"black",fontFamily:'Monaco, "Courier New", monospace',fontSize:12,fontColor:"black",idealAlign:q,hovertemplate:fe.hovertemplate,hovertemplateLabels:Le,eventData:[{data:fe._input,fullData:fe,count:_e,category:Ae,probability:ke}]}}function R(U){if(!U.parcatsViewModel.dragDimension&&U.parcatsViewModel.hoverinfoItems.indexOf("skip")===-1){if(r.mouse(this)[1]<-1)return;var V,H=U.parcatsViewModel.graphDiv,ne=H._fullLayout,q=ne._paperdiv.node().getBoundingClientRect(),Q=U.parcatsViewModel.hoveron;Q==="color"?(function(ee){var ie=r.select(ee).datum(),ae=E(ie);w(ae),ae.each(function(){i.raiseToTop(this)}),r.select(ee.parentNode).selectAll("rect.bandrect").filter(function(ue){return ue.color===ie.color}).each(function(){i.raiseToTop(this),r.select(this).attr("stroke","black").attr("stroke-width",1.5)})}(this),P(this,"plotly_hover",r.event)):(function(ee){r.select(ee.parentNode).selectAll("rect.bandrect").each(function(ie){var ae=E(ie);w(ae),ae.each(function(){i.raiseToTop(this)})}),r.select(ee.parentNode).select("rect.catrect").attr("stroke","black").attr("stroke-width",2.5)}(this),S(this,"plotly_hover",r.event)),U.parcatsViewModel.hoverinfoItems.indexOf("none")===-1&&(Q==="category"?V=L(H,q,this):Q==="color"?V=function(ee,ie,ae){ee._fullLayout._calcInverseTransform(ee);var ue,le,ge=ee._fullLayout._invScaleX,fe=ee._fullLayout._invScaleY,me=ae.getBoundingClientRect(),_e=r.select(ae).datum(),Ae=_e.categoryViewModel,ke=Ae.parcatsViewModel,Le=ke.model.dimensions[Ae.model.dimensionInd],de=ke.trace,ve=me.y+me.height/2;ke.dimensions.length>1&&Le.displayInd===ke.dimensions.length-1?(ue=me.left,le="left"):(ue=me.left+me.width,le="right");var Me=Ae.model.categoryLabel,we=_e.parcatsViewModel.model.count,Ce=0;_e.categoryViewModel.bands.forEach(function(ft){ft.color===_e.color&&(Ce+=ft.count)});var Fe=Ae.model.count,ze=0;ke.pathSelection.each(function(ft){ft.model.color===_e.color&&(ze+=ft.model.count)});var $e=Ce/we,Ke=Ce/ze,Re=Ce/Fe,Ve={countLabel:we,categoryLabel:Me,probabilityLabel:$e.toFixed(3)},We=[];Ae.parcatsViewModel.hoverinfoItems.indexOf("count")!==-1&&We.push(["Count:",Ve.countLabel].join(" ")),Ae.parcatsViewModel.hoverinfoItems.indexOf("probability")!==-1&&(We.push("P(color ∩ "+Me+"): "+Ve.probabilityLabel),We.push("P("+Me+" | color): "+Ke.toFixed(3)),We.push("P(color | "+Me+"): "+Re.toFixed(3)));var Ye=We.join("
    "),nt=h.mostReadable(_e.color,["black","white"]);return{trace:de,x:ge*(ue-ie.left),y:fe*(ve-ie.top),text:Ye,color:_e.color,borderColor:"black",fontFamily:'Monaco, "Courier New", monospace',fontColor:nt,fontSize:10,idealAlign:le,hovertemplate:de.hovertemplate,hovertemplateLabels:Ve,eventData:[{data:de._input,fullData:de,category:Me,count:we,probability:$e,categorycount:Fe,colorcount:ze,bandcolorcount:Ce}]}}(H,q,this):Q==="dimension"&&(V=function(ee,ie,ae){var ue=[];return r.select(ae.parentNode.parentNode).selectAll("g.category").select("rect.catrect").each(function(){ue.push(L(ee,ie,this))}),ue}(H,q,this)),V&&c.loneHover(V,{container:ne._hoverlayer.node(),outerContainer:ne._paper.node(),gd:H}))}}function F(U){var V=U.parcatsViewModel;!V.dragDimension&&(k(V.pathSelection),M(V.dimensionSelection.selectAll("g.category")),T(V.dimensionSelection.selectAll("g.category").selectAll("rect.bandrect")),c.loneUnhover(V.graphDiv._fullLayout._hoverlayer.node()),V.pathSelection.sort(y),V.hoverinfoItems.indexOf("skip")===-1)&&(U.parcatsViewModel.hoveron==="color"?P(this,"plotly_unhover",r.event):S(this,"plotly_unhover",r.event))}function D(U){U.parcatsViewModel.arrangement!=="fixed"&&(U.dragDimensionDisplayInd=U.model.displayInd,U.initialDragDimensionDisplayInds=U.parcatsViewModel.model.dimensions.map(function(V){return V.displayInd}),U.dragHasMoved=!1,U.dragCategoryDisplayInd=null,r.select(this).selectAll("g.category").select("rect.catrect").each(function(V){var H=r.mouse(this)[0],ne=r.mouse(this)[1];-2<=H&&H<=V.width+2&&-2<=ne&&ne<=V.height+2&&(U.dragCategoryDisplayInd=V.model.displayInd,U.initialDragCategoryDisplayInds=U.model.categories.map(function(q){return q.displayInd}),V.model.dragY=V.y,i.raiseToTop(this.parentNode),r.select(this.parentNode).selectAll("rect.bandrect").each(function(q){q.yle.y+le.height/2&&(Q.model.displayInd=le.model.displayInd,le.model.displayInd=ie),U.dragCategoryDisplayInd=Q.model.displayInd}if(U.dragCategoryDisplayInd===null||U.parcatsViewModel.arrangement==="freeform"){q.model.dragX=r.event.x;var ge=U.parcatsViewModel.dimensions[H],fe=U.parcatsViewModel.dimensions[ne];ge!==void 0&&q.model.dragXfe.x&&(q.model.displayInd=fe.model.displayInd,fe.model.displayInd=U.dragDimensionDisplayInd),U.dragDimensionDisplayInd=q.model.displayInd}J(U.parcatsViewModel),Y(U.parcatsViewModel),G(U.parcatsViewModel),W(U.parcatsViewModel)}}function N(U){if(U.parcatsViewModel.arrangement!=="fixed"&&U.dragDimensionDisplayInd!==null){r.select(this).selectAll("text").attr("font-weight","normal");var V={},H=B(U.parcatsViewModel),ne=U.parcatsViewModel.model.dimensions.map(function(le){return le.displayInd}),q=U.initialDragDimensionDisplayInds.some(function(le,ge){return le!==ne[ge]});q&&ne.forEach(function(le,ge){var fe=U.parcatsViewModel.model.dimensions[ge].containerInd;V["dimensions["+fe+"].displayindex"]=le});var Q=!1;if(U.dragCategoryDisplayInd!==null){var ee=U.model.categories.map(function(le){return le.displayInd});if(Q=U.initialDragCategoryDisplayInds.some(function(le,ge){return le!==ee[ge]})){var ie=U.model.categories.slice().sort(function(le,ge){return le.displayInd-ge.displayInd}),ae=ie.map(function(le){return le.categoryValue}),ue=ie.map(function(le){return le.categoryLabel});V["dimensions["+U.model.containerInd+"].categoryarray"]=[ae],V["dimensions["+U.model.containerInd+"].ticktext"]=[ue],V["dimensions["+U.model.containerInd+"].categoryorder"]="array"}}U.parcatsViewModel.hoverinfoItems.indexOf("skip")===-1&&!U.dragHasMoved&&U.potentialClickBand&&(U.parcatsViewModel.hoveron==="color"?P(U.potentialClickBand,"plotly_click",r.event.sourceEvent):S(U.potentialClickBand,"plotly_click",r.event.sourceEvent)),U.model.dragX=null,U.dragCategoryDisplayInd!==null&&(U.parcatsViewModel.dimensions[U.dragDimensionDisplayInd].categories[U.dragCategoryDisplayInd].model.dragY=null,U.dragCategoryDisplayInd=null),U.dragDimensionDisplayInd=null,U.parcatsViewModel.dragDimension=null,U.dragHasMoved=null,U.potentialClickBand=null,J(U.parcatsViewModel),Y(U.parcatsViewModel),r.transition().duration(300).ease("cubic-in-out").each(function(){G(U.parcatsViewModel,!0),W(U.parcatsViewModel,!0)}).each("end",function(){(q||Q)&&l.restyle(U.parcatsViewModel.graphDiv,V,[H])})}}function B(U){for(var V,H=U.graphDiv._fullData,ne=0;ne=0;ee--)ue+="C"+ae[ee]+","+(V[ee+1]+ne)+" "+ie[ee]+","+(V[ee]+ne)+" "+(U[ee]+H[ee])+","+(V[ee]+ne),ue+="l-"+H[ee]+",0 ";return ue+="Z"}function Y(U){var V=U.dimensions,H=U.model,ne=V.map(function(We){return We.categories.map(function(Ye){return Ye.y})}),q=U.model.dimensions.map(function(We){return We.categories.map(function(Ye){return Ye.displayInd})}),Q=U.model.dimensions.map(function(We){return We.displayInd}),ee=U.dimensions.map(function(We){return We.model.dimensionInd}),ie=V.map(function(We){return We.x}),ae=V.map(function(We){return We.width}),ue=[];for(var le in H.paths)H.paths.hasOwnProperty(le)&&ue.push(H.paths[le]);function ge(We){var Ye=We.categoryInds.map(function(nt,ft){return q[ft][nt]});return ee.map(function(nt){return Ye[nt]})}ue.sort(function(We,Ye){var nt=ge(We),ft=ge(Ye);return U.sortpaths==="backward"&&(nt.reverse(),ft.reverse()),nt.push(We.valueInds[0]),ft.push(Ye.valueInds[0]),U.bundlecolors&&(nt.unshift(We.rawColor),ft.unshift(Ye.rawColor)),ntft?1:0});for(var fe=new Array(ue.length),me=V[0].model.count,_e=V[0].categories.map(function(We){return We.height}).reduce(function(We,Ye){return We+Ye}),Ae=0;Ae0?_e*(Le.count/me):0;for(var de,ve=new Array(ne.length),Me=0;Me1?(U.width-80-16)/(ne-1):0)*q;var Q,ee,ie,ae,ue,le=[],ge=U.model.maxCats,fe=V.categories.length,me=V.count,_e=U.height-8*(ge-1),Ae=8*(ge-fe)/2,ke=V.categories.map(function(Le){return{displayInd:Le.displayInd,categoryInd:Le.categoryInd}});for(ke.sort(function(Le,de){return Le.displayInd-de.displayInd}),ue=0;ue0?ee.count/me*_e:0,ie={key:ee.valueInds[0],model:ee,width:16,height:Q,y:ee.dragY!==null?ee.dragY:Ae,bands:[],parcatsViewModel:U},Ae=Ae+Q+8,le.push(ie);return{key:V.dimensionInd,x:V.dragX!==null?V.dragX:H,y:0,width:16,model:V,categories:le,parcatsViewModel:U,dragCategoryDisplayInd:null,dragDimensionDisplayInd:null,initialDragDimensionDisplayInds:null,initialDragCategoryDisplayInds:null,dragHasMoved:null,potentialClickBand:null}}o.exports=function(U,V,H,ne){m(H,U,ne,V)}},{"../../components/drawing":388,"../../components/fx":406,"../../lib":503,"../../lib/svg_text_utils":529,"../../plot_api/plot_api":540,"@plotly/d3":58,"d3-interpolate":116,tinycolor2:312}],887:[function(t,o,f){var r=t("./parcats");o.exports=function(a,l,c,i){var s=a._fullLayout,u=s._paper,h=s._size;r(a,u,l,{width:h.w,height:h.h,margin:{t:h.t,r:h.r,b:h.b,l:h.l}},c,i)}},{"./parcats":886}],888:[function(t,o,f){var r=t("../../components/colorscale/attributes"),a=t("../../plots/cartesian/layout_attributes"),l=t("../../plots/font_attributes"),c=t("../../plots/domain").attributes,i=t("../../lib/extend").extendFlat,s=t("../../plot_api/plot_template").templatedArray;o.exports={domain:c({name:"parcoords",trace:!0,editType:"plot"}),labelangle:{valType:"angle",dflt:0,editType:"plot"},labelside:{valType:"enumerated",values:["top","bottom"],dflt:"top",editType:"plot"},labelfont:l({editType:"plot"}),tickfont:l({editType:"plot"}),rangefont:l({editType:"plot"}),dimensions:s("dimension",{label:{valType:"string",editType:"plot"},tickvals:i({},a.tickvals,{editType:"plot"}),ticktext:i({},a.ticktext,{editType:"plot"}),tickformat:i({},a.tickformat,{editType:"plot"}),visible:{valType:"boolean",dflt:!0,editType:"plot"},range:{valType:"info_array",items:[{valType:"number",editType:"plot"},{valType:"number",editType:"plot"}],editType:"plot"},constraintrange:{valType:"info_array",freeLength:!0,dimensions:"1-2",items:[{valType:"any",editType:"plot"},{valType:"any",editType:"plot"}],editType:"plot"},multiselect:{valType:"boolean",dflt:!0,editType:"plot"},values:{valType:"data_array",editType:"calc"},editType:"calc"}),line:i({editType:"calc"},r("line",{colorscaleDflt:"Viridis",autoColorDflt:!1,editTypeOverride:"calc"}))}},{"../../components/colorscale/attributes":373,"../../lib/extend":493,"../../plot_api/plot_template":543,"../../plots/cartesian/layout_attributes":569,"../../plots/domain":584,"../../plots/font_attributes":585}],889:[function(t,o,f){var r=t("./constants"),a=t("@plotly/d3"),l=t("../../lib/gup").keyFun,c=t("../../lib/gup").repeat,i=t("../../lib").sorterAsc,s=t("../../lib").strTranslate,u=r.bar.snapRatio;function h(L,R){return L*(1-u)+R*u}var d=r.bar.snapClose;function m(L,R){return L*(1-d)+R*d}function p(L,R,F,D){if(function(re,U){for(var V=0;V=U[V][0]&&re<=U[V][1])return!0;return!1}(F,D))return F;var O=L?-1:1,N=0,B=R.length-1;if(O<0){var W=N;N=B,B=W}for(var G=R[N],K=G,te=N;O*teR){Y=F;break}}if(O=K,isNaN(O)&&(O=isNaN(te)||isNaN(Y)?isNaN(te)?Y:te:R-G[te][1]q[1]+ee||Q=.9*q[1]+.1*q[0]?"n":Q<=.9*q[0]+.1*q[1]?"s":"ns"}(re,R);U&&(N.interval=W[O],N.intervalPix=re,N.region=U)}}if(L.ordinal&&!N.region){var V=L.unitTickvals,H=L.unitToPaddedPx.invert(R);for(F=0;F=ne[0]&&H<=ne[1]){N.clickableOrdinalRange=ne;break}}}return N}function w(L,R){a.event.sourceEvent.stopPropagation();var F=R.height-a.mouse(L)[1]-2*r.verticalPadding,D=R.brush.svgBrush;D.wasDragged=!0,D._dragging=!0,D.grabbingBar?D.newExtent=[F-D.grabPoint,F+D.barLength-D.grabPoint].map(R.unitToPaddedPx.invert):D.newExtent=[D.startExtent,R.unitToPaddedPx.invert(F)].sort(i),R.brush.filterSpecified=!0,D.extent=D.stayingIntervals.concat([D.newExtent]),D.brushCallback(R),b(L.parentNode)}function M(L,R){var F=k(R,R.height-a.mouse(L)[1]-2*r.verticalPadding),D="crosshair";F.clickableOrdinalRange?D="pointer":F.region&&(D=F.region+"-resize"),a.select(document.body).style("cursor",D)}function T(L){L.on("mousemove",function(R){a.event.preventDefault(),R.parent.inBrushDrag||M(this,R)}).on("mouseleave",function(R){R.parent.inBrushDrag||_()}).call(a.behavior.drag().on("dragstart",function(R){(function(F,D){a.event.sourceEvent.stopPropagation();var O=D.height-a.mouse(F)[1]-2*r.verticalPadding,N=D.unitToPaddedPx.invert(O),B=D.brush,W=k(D,O),G=W.interval,K=B.svgBrush;if(K.wasDragged=!1,K.grabbingBar=W.region==="ns",K.grabbingBar){var te=G.map(D.unitToPaddedPx);K.grabPoint=O-te[0]-r.verticalPadding,K.barLength=te[1]-te[0]}K.clickableOrdinalRange=W.clickableOrdinalRange,K.stayingIntervals=D.multiselect&&B.filterSpecified?B.filter.getConsolidated():[],G&&(K.stayingIntervals=K.stayingIntervals.filter(function(Y){return Y[0]!==G[0]&&Y[1]!==G[1]})),K.startExtent=W.region?G[W.region==="s"?1:0]:N,D.parent.inBrushDrag=!0,K.brushStartCallback()})(this,R)}).on("drag",function(R){w(this,R)}).on("dragend",function(R){(function(F,D){var O=D.brush,N=O.filter,B=O.svgBrush;B._dragging||(M(F,D),w(F,D),D.brush.svgBrush.wasDragged=!1),B._dragging=!1,a.event.sourceEvent.stopPropagation();var W=B.grabbingBar;if(B.grabbingBar=!1,B.grabLocation=void 0,D.parent.inBrushDrag=!1,_(),!B.wasDragged)return B.wasDragged=void 0,B.clickableOrdinalRange?O.filterSpecified&&D.multiselect?B.extent.push(B.clickableOrdinalRange):(B.extent=[B.clickableOrdinalRange],O.filterSpecified=!0):W?(B.extent=B.stayingIntervals,B.extent.length===0&&S(O)):S(O),B.brushCallback(D),b(F.parentNode),void B.brushEndCallback(O.filterSpecified?N.getConsolidated():[]);var G=function(){N.set(N.getConsolidated())};if(D.ordinal){var K=D.unitTickvals;K[K.length-1]B.newExtent[0];B.extent=B.stayingIntervals.concat(te?[B.newExtent]:[]),B.extent.length||S(O),B.brushCallback(D),te?b(F.parentNode,G):(G(),b(F.parentNode))}else G();B.brushEndCallback(O.filterSpecified?N.getConsolidated():[])})(this,R)}))}function E(L,R){return L[0]-R[0]}function S(L){L.filterSpecified=!1,L.svgBrush.extent=[[-1/0,1/0]]}function P(L){for(var R,F=L.slice(),D=[],O=F.shift();O;){for(R=O.slice();(O=F.shift())&&O[0]<=R[1];)R[1]=Math.max(R[1],O[1]);D.push(R)}return D.length===1&&D[0][0]>D[0][1]&&(D=[]),D}o.exports={makeBrush:function(L,R,F,D,O,N){var B,W=function(){var G,K,te=[];return{set:function(Y){(te=Y.map(function(J){return J.slice().sort(i)}).sort(E)).length===1&&te[0][0]===-1/0&&te[0][1]===1/0&&(te=[[0,-1]]),G=P(te),K=te.reduce(function(J,re){return[Math.min(J[0],re[0]),Math.max(J[1],re[1])]},[1/0,-1/0])},get:function(){return te.slice()},getConsolidated:function(){return G},getBounds:function(){return K}}}();return W.set(F),{filter:W,filterSpecified:R,svgBrush:{extent:[],brushStartCallback:D,brushCallback:(B=O,function(G){var K=G.brush,te=function(Y){return Y.svgBrush.extent.map(function(J){return J.slice()})}(K).slice();K.filter.set(te),B()}),brushEndCallback:N}}},ensureAxisBrush:function(L,R){var F=L.selectAll("."+r.cn.axisBrush).data(c,l);F.enter().append("g").classed(r.cn.axisBrush,!0),function(D,O){var N=D.selectAll(".background").data(c);N.enter().append("rect").classed("background",!0).call(g).call(y).style("pointer-events","auto").attr("transform",s(0,r.verticalPadding)),N.call(T).attr("height",function(G){return G.height-r.verticalPadding});var B=D.selectAll(".highlight-shadow").data(c);B.enter().append("line").classed("highlight-shadow",!0).attr("x",-r.bar.width/2).attr("stroke-width",r.bar.width+r.bar.strokeWidth).attr("stroke",O).attr("opacity",r.bar.strokeOpacity).attr("stroke-linecap","butt"),B.attr("y1",function(G){return G.height}).call(A);var W=D.selectAll(".highlight").data(c);W.enter().append("line").classed("highlight",!0).attr("x",-r.bar.width/2).attr("stroke-width",r.bar.width-r.bar.strokeWidth).attr("stroke",r.bar.fillColor).attr("opacity",r.bar.fillOpacity).attr("stroke-linecap","butt"),W.attr("y1",function(G){return G.height}).call(A)}(F,R)},cleanRanges:function(L,R){if(Array.isArray(L[0])?(L=L.map(function(D){return D.sort(i)}),L=R.multiselect?P(L.sort(E)):[L[0]]):L=[L.sort(i)],R.tickvals){var F=R.tickvals.slice().sort(i);if(!(L=L.map(function(D){var O=[p(0,F,D[0],[]),p(1,F,D[1],[])];if(O[1]>O[0])return O}).filter(function(D){return D})).length)return}return L.length>1?L:L[0]}}},{"../../lib":503,"../../lib/gup":500,"./constants":893,"@plotly/d3":58}],890:[function(t,o,f){o.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),calc:t("./calc"),colorbar:{container:"line",min:"cmin",max:"cmax"},moduleType:"trace",name:"parcoords",basePlotModule:t("./base_plot"),categories:["gl","regl","noOpacity","noHover"],meta:{}}},{"./attributes":888,"./base_plot":891,"./calc":892,"./defaults":894}],891:[function(t,o,f){var r=t("@plotly/d3"),a=t("../../plots/get_data").getModuleCalcData,l=t("./plot"),c=t("../../constants/xmlns_namespaces");f.name="parcoords",f.plot=function(i){var s=a(i.calcdata,"parcoords")[0];s.length&&l(i,s)},f.clean=function(i,s,u,h){var d=h._has&&h._has("parcoords"),m=s._has&&s._has("parcoords");d&&!m&&(h._paperdiv.selectAll(".parcoords").remove(),h._glimages.selectAll("*").remove())},f.toSVG=function(i){var s=i._fullLayout._glimages,u=r.select(i).selectAll(".svg-container");u.filter(function(h,d){return d===u.size()-1}).selectAll(".gl-canvas-context, .gl-canvas-focus").each(function(){var h=this.toDataURL("image/png");s.append("svg:image").attr({xmlns:c.svg,"xlink:href":h,preserveAspectRatio:"none",x:0,y:0,width:this.style.width,height:this.style.height})}),window.setTimeout(function(){r.selectAll("#filterBarPattern").attr("id","filterBarPattern")},60)}},{"../../constants/xmlns_namespaces":480,"../../plots/get_data":593,"./plot":900,"@plotly/d3":58}],892:[function(t,o,f){var r=t("../../lib").isArrayOrTypedArray,a=t("../../components/colorscale"),l=t("../../lib/gup").wrap;o.exports=function(c,i){var s,u;return a.hasColorscale(i,"line")&&r(i.line.color)?(s=i.line.color,u=a.extractOpts(i.line).colorscale,a.calc(c,i,{vals:s,containerStr:"line",cLetter:"c"})):(s=function(h){for(var d=new Array(h),m=0;md&&(r.log("parcoords traces support up to "+d+" dimensions at the moment"),A.splice(d));var b=i(g,y,{name:"dimensions",layout:x,handleItemDefaults:p}),k=function(M,T,E,S,P){var L=P("line.color",E);if(a(M,"line")&&r.isArrayOrTypedArray(L)){if(L.length)return P("line.colorscale"),l(M,T,S,P,{prefix:"line.",cLetter:"c"}),L.length;T.line.color=E}return 1/0}(g,y,v,x,_);c(y,x,_),Array.isArray(b)&&b.length||(y.visible=!1),m(y,b,"values",k);var w={family:x.font.family,size:Math.round(x.font.size/1.2),color:x.font.color};r.coerceFont(_,"labelfont",w),r.coerceFont(_,"tickfont",w),r.coerceFont(_,"rangefont",w),_("labelangle"),_("labelside")}},{"../../components/colorscale/defaults":376,"../../components/colorscale/helpers":377,"../../lib":503,"../../plots/array_container_defaults":549,"../../plots/cartesian/axes":554,"../../plots/domain":584,"./attributes":888,"./axisbrush":889,"./constants":893,"./merge_length":898}],895:[function(t,o,f){var r=t("../../lib").isTypedArray;f.convertTypedArray=function(a){return r(a)?Array.prototype.slice.call(a):a},f.isOrdinal=function(a){return!!a.tickvals},f.isVisible=function(a){return a.visible||!("visible"in a)}},{"../../lib":503}],896:[function(t,o,f){var r=t("./base_index");r.plot=t("./plot"),o.exports=r},{"./base_index":890,"./plot":900}],897:[function(t,o,f){var r=t("glslify"),a=r([`precision highp float; -#define GLSLIFY 1 - -varying vec4 fragColor; - -attribute vec4 p01_04, p05_08, p09_12, p13_16, - p17_20, p21_24, p25_28, p29_32, - p33_36, p37_40, p41_44, p45_48, - p49_52, p53_56, p57_60, colors; - -uniform mat4 dim0A, dim1A, dim0B, dim1B, dim0C, dim1C, dim0D, dim1D, - loA, hiA, loB, hiB, loC, hiC, loD, hiD; - -uniform vec2 resolution, viewBoxPos, viewBoxSize; -uniform float maskHeight; -uniform float drwLayer; // 0: context, 1: focus, 2: pick -uniform vec4 contextColor; -uniform sampler2D maskTexture, palette; - -bool isPick = (drwLayer > 1.5); -bool isContext = (drwLayer < 0.5); - -const vec4 ZEROS = vec4(0.0, 0.0, 0.0, 0.0); -const vec4 UNITS = vec4(1.0, 1.0, 1.0, 1.0); - -float val(mat4 p, mat4 v) { - return dot(matrixCompMult(p, v) * UNITS, UNITS); -} - -float axisY(float ratio, mat4 A, mat4 B, mat4 C, mat4 D) { - float y1 = val(A, dim0A) + val(B, dim0B) + val(C, dim0C) + val(D, dim0D); - float y2 = val(A, dim1A) + val(B, dim1B) + val(C, dim1C) + val(D, dim1D); - return y1 * (1.0 - ratio) + y2 * ratio; -} - -int iMod(int a, int b) { - return a - b * (a / b); -} - -bool fOutside(float p, float lo, float hi) { - return (lo < hi) && (lo > p || p > hi); -} - -bool vOutside(vec4 p, vec4 lo, vec4 hi) { - return ( - fOutside(p[0], lo[0], hi[0]) || - fOutside(p[1], lo[1], hi[1]) || - fOutside(p[2], lo[2], hi[2]) || - fOutside(p[3], lo[3], hi[3]) - ); -} - -bool mOutside(mat4 p, mat4 lo, mat4 hi) { - return ( - vOutside(p[0], lo[0], hi[0]) || - vOutside(p[1], lo[1], hi[1]) || - vOutside(p[2], lo[2], hi[2]) || - vOutside(p[3], lo[3], hi[3]) - ); -} - -bool outsideBoundingBox(mat4 A, mat4 B, mat4 C, mat4 D) { - return mOutside(A, loA, hiA) || - mOutside(B, loB, hiB) || - mOutside(C, loC, hiC) || - mOutside(D, loD, hiD); -} - -bool outsideRasterMask(mat4 A, mat4 B, mat4 C, mat4 D) { - mat4 pnts[4]; - pnts[0] = A; - pnts[1] = B; - pnts[2] = C; - pnts[3] = D; - - for(int i = 0; i < 4; ++i) { - for(int j = 0; j < 4; ++j) { - for(int k = 0; k < 4; ++k) { - if(0 == iMod( - int(255.0 * texture2D(maskTexture, - vec2( - (float(i * 2 + j / 2) + 0.5) / 8.0, - (pnts[i][j][k] * (maskHeight - 1.0) + 1.0) / maskHeight - ))[3] - ) / int(pow(2.0, float(iMod(j * 4 + k, 8)))), - 2 - )) return true; - } - } - } - return false; -} - -vec4 position(bool isContext, float v, mat4 A, mat4 B, mat4 C, mat4 D) { - float x = 0.5 * sign(v) + 0.5; - float y = axisY(x, A, B, C, D); - float z = 1.0 - abs(v); - - z += isContext ? 0.0 : 2.0 * float( - outsideBoundingBox(A, B, C, D) || - outsideRasterMask(A, B, C, D) - ); - - return vec4( - 2.0 * (vec2(x, y) * viewBoxSize + viewBoxPos) / resolution - 1.0, - z, - 1.0 - ); -} - -void main() { - mat4 A = mat4(p01_04, p05_08, p09_12, p13_16); - mat4 B = mat4(p17_20, p21_24, p25_28, p29_32); - mat4 C = mat4(p33_36, p37_40, p41_44, p45_48); - mat4 D = mat4(p49_52, p53_56, p57_60, ZEROS); - - float v = colors[3]; - - gl_Position = position(isContext, v, A, B, C, D); - - fragColor = - isContext ? vec4(contextColor) : - isPick ? vec4(colors.rgb, 1.0) : texture2D(palette, vec2(abs(v), 0.5)); -} -`]),l=r([`precision highp float; -#define GLSLIFY 1 - -varying vec4 fragColor; - -void main() { - gl_FragColor = fragColor; -} -`]),c=t("./constants").maxDimensionCount,i=t("../../lib"),s=new Uint8Array(4),u=new Uint8Array(4),h={shape:[256,1],format:"rgba",type:"uint8",mag:"nearest",min:"nearest"};function d(b,k,w,M,T){var E=b._gl;E.enable(E.SCISSOR_TEST),E.scissor(k,w,M,T),b.clear({color:[0,0,0,0],depth:1})}function m(b,k,w,M,T,E){var S=E.key;w.drawCompleted||(function(P){P.read({x:0,y:0,width:1,height:1,data:s})}(b),w.drawCompleted=!0),function P(L){var R=Math.min(M,T-L*M);L===0&&(window.cancelAnimationFrame(w.currentRafs[S]),delete w.currentRafs[S],d(b,E.scissorX,E.scissorY,E.scissorWidth,E.viewBoxSize[1])),w.clearOnly||(E.count=2*R,E.offset=2*L*M,k(E),L*M+R>>8*k)%256/255}function y(b,k,w){for(var M=new Array(8*k),T=0,E=0;EQ&&(Q=Y[U].dim1.canvasX,H=U);ne===0&&d(R,0,0,w.canvasWidth,w.canvasHeight);var ee=function(ke){var Le,de,ve,Me=[[],[]];for(ve=0;ve<64;ve++){var we=!ke&&veee._length&&(_e=_e.slice(0,ee._length));var Ae,ke=ee.tickvals;function Le(Ce,Fe){return{val:Ce,text:Ae[Fe]}}function de(Ce,Fe){return Ce.val-Fe.val}if(Array.isArray(ke)&&ke.length){Ae=ee.ticktext,Array.isArray(Ae)&&Ae.length?Ae.length>ke.length?Ae=Ae.slice(0,ke.length):ke.length>Ae.length&&(ke=ke.slice(0,Ae.length)):Ae=ke.map(l(ee.tickformat));for(var ve=1;ve=Fe||Re>=ze)return;var Ve=we.lineLayer.readPixel(Ke,ze-1-Re),We=Ve[3]!==0,Ye=We?Ve[2]+256*(Ve[1]+256*Ve[0]):null,nt={x:Ke,y:Re,clientX:Ce.clientX,clientY:Ce.clientY,dataIndex:we.model.key,curveNumber:Ye};Ye!==ae&&(We?Y.hover(nt):Y.unhover&&Y.unhover(nt),ae=Ye)}}),ie.style("opacity",function(we){return we.pick?0:1}),re.style("background","rgba(255, 255, 255, 0)");var ue=re.selectAll("."+_.cn.parcoords).data(ee,g);ue.exit().remove(),ue.enter().append("g").classed(_.cn.parcoords,!0).style("shape-rendering","crispEdges").style("pointer-events","none"),ue.attr("transform",function(we){return u(we.model.translateX,we.model.translateY)});var le=ue.selectAll("."+_.cn.parcoordsControlView).data(y,g);le.enter().append("g").classed(_.cn.parcoordsControlView,!0),le.attr("transform",function(we){return u(we.model.pad.l,we.model.pad.t)});var ge=le.selectAll("."+_.cn.yAxis).data(function(we){return we.dimensions},g);ge.enter().append("g").classed(_.cn.yAxis,!0),le.each(function(we){N(ge,we,V)}),ie.each(function(we){if(we.viewModel){!we.lineLayer||Y?we.lineLayer=b(this,we):we.lineLayer.update(we),(we.key||we.key===0)&&(we.viewModel[we.key]=we.lineLayer);var Ce=!we.context||Y;we.lineLayer.render(we.viewModel.panels,Ce)}}),ge.attr("transform",function(we){return u(we.xScale(we.xIndex),0)}),ge.call(r.behavior.drag().origin(function(we){return we}).on("drag",function(we){var Ce=we.parent;Q.linePickActive(!1),we.x=Math.max(-_.overdrag,Math.min(we.model.width+_.overdrag,r.event.x)),we.canvasX=we.x*we.model.canvasPixelRatio,ge.sort(function(Fe,ze){return Fe.x-ze.x}).each(function(Fe,ze){Fe.xIndex=ze,Fe.x=we===Fe?Fe.x:Fe.xScale(Fe.xIndex),Fe.canvasX=Fe.x*Fe.model.canvasPixelRatio}),N(ge,Ce,V),ge.filter(function(Fe){return Math.abs(we.xIndex-Fe.xIndex)!==0}).attr("transform",function(Fe){return u(Fe.xScale(Fe.xIndex),0)}),r.select(this).attr("transform",u(we.x,0)),ge.each(function(Fe,ze,$e){$e===we.parent.key&&(Ce.dimensions[ze]=Fe)}),Ce.contextLayer&&Ce.contextLayer.render(Ce.panels,!1,!L(Ce)),Ce.focusLayer.render&&Ce.focusLayer.render(Ce.panels)}).on("dragend",function(we){var Ce=we.parent;we.x=we.xScale(we.xIndex),we.canvasX=we.x*we.model.canvasPixelRatio,N(ge,Ce,V),r.select(this).attr("transform",function(Fe){return u(Fe.x,0)}),Ce.contextLayer&&Ce.contextLayer.render(Ce.panels,!1,!L(Ce)),Ce.focusLayer&&Ce.focusLayer.render(Ce.panels),Ce.pickLayer&&Ce.pickLayer.render(Ce.panels,!0),Q.linePickActive(!0),Y&&Y.axesMoved&&Y.axesMoved(Ce.key,Ce.dimensions.map(function(Fe){return Fe.crossfilterDimensionIndex}))})),ge.exit().remove();var fe=ge.selectAll("."+_.cn.axisOverlays).data(y,g);fe.enter().append("g").classed(_.cn.axisOverlays,!0),fe.selectAll("."+_.cn.axis).remove();var me=fe.selectAll("."+_.cn.axis).data(y,g);me.enter().append("g").classed(_.cn.axis,!0),me.each(function(we){var Ce=we.model.height/we.model.tickDistance,Fe=we.domainScale,ze=Fe.domain();r.select(this).call(r.svg.axis().orient("left").tickSize(4).outerTickSize(2).ticks(Ce,we.tickFormat).tickValues(we.ordinal?ze:null).tickFormat(function($e){return x.isOrdinal(we)?$e:B(we.model.dimensions[we.visibleIndex],$e)}).scale(Fe)),d.font(me.selectAll("text"),we.model.tickFont)}),me.selectAll(".domain, .tick>line").attr("fill","none").attr("stroke","black").attr("stroke-opacity",.25).attr("stroke-width","1px"),me.selectAll("text").style("text-shadow",h.makeTextShadow(H)).style("cursor","default");var _e=fe.selectAll("."+_.cn.axisHeading).data(y,g);_e.enter().append("g").classed(_.cn.axisHeading,!0);var Ae=_e.selectAll("."+_.cn.axisTitle).data(y,g);Ae.enter().append("text").classed(_.cn.axisTitle,!0).attr("text-anchor","middle").style("cursor","ew-resize").style("pointer-events","auto"),Ae.text(function(we){return we.label}).each(function(we){var Ce=r.select(this);d.font(Ce,we.model.labelFont),h.convertToTspans(Ce,G)}).attr("transform",function(we){var Ce=O(we.model.labelAngle,we.model.labelSide),Fe=_.axisTitleOffset;return(Ce.dir>0?"":u(0,2*Fe+we.model.height))+s(Ce.degrees)+u(-Fe*Ce.dx,-Fe*Ce.dy)}).attr("text-anchor",function(we){var Ce=O(we.model.labelAngle,we.model.labelSide);return 2*Math.abs(Ce.dx)>Math.abs(Ce.dy)?Ce.dir*Ce.dx<0?"start":"end":"middle"});var ke=fe.selectAll("."+_.cn.axisExtent).data(y,g);ke.enter().append("g").classed(_.cn.axisExtent,!0);var Le=ke.selectAll("."+_.cn.axisExtentTop).data(y,g);Le.enter().append("g").classed(_.cn.axisExtentTop,!0),Le.attr("transform",u(0,-_.axisExtentOffset));var de=Le.selectAll("."+_.cn.axisExtentTopText).data(y,g);de.enter().append("text").classed(_.cn.axisExtentTopText,!0).call(D),de.text(function(we){return W(we,!0)}).each(function(we){d.font(r.select(this),we.model.rangeFont)});var ve=ke.selectAll("."+_.cn.axisExtentBottom).data(y,g);ve.enter().append("g").classed(_.cn.axisExtentBottom,!0),ve.attr("transform",function(we){return u(0,we.model.height+_.axisExtentOffset)});var Me=ve.selectAll("."+_.cn.axisExtentBottomText).data(y,g);Me.enter().append("text").classed(_.cn.axisExtentBottomText,!0).attr("dy","0.75em").call(D),Me.text(function(we){return W(we,!1)}).each(function(we){d.font(r.select(this),we.model.rangeFont)}),A.ensureAxisBrush(fe,H)}},{"../../components/colorscale":378,"../../components/drawing":388,"../../lib":503,"../../lib/gup":500,"../../lib/svg_text_utils":529,"../../plots/cartesian/axes":554,"./axisbrush":889,"./constants":893,"./helpers":895,"./lines":897,"@plotly/d3":58,"color-rgba":91}],900:[function(t,o,f){var r=t("./parcoords"),a=t("../../lib/prepare_regl"),l=t("./helpers").isVisible,c={};function i(s,u,h){var d=u.indexOf(h),m=s.indexOf(d);return m===-1&&(m+=u.length),m}(o.exports=function(s,u){var h=s._fullLayout;if(a(s,[],c)){var d={},m={},p={},g={},y=h._size;u.forEach(function(v,x){var _=v[0].trace;p[x]=_.index;var A=g[x]=_._fullInput.index;d[x]=s.data[A].dimensions,m[x]=s.data[A].dimensions.slice()}),r(s,u,{width:y.w,height:y.h,margin:{t:y.t,r:y.r,b:y.b,l:y.l}},{filterChanged:function(v,x,_){var A=m[v][x],b=_.map(function(S){return S.slice()}),k="dimensions["+x+"].constraintrange",w=h._tracePreGUI[s._fullData[p[v]]._fullInput.uid];if(w[k]===void 0){var M=A.constraintrange;w[k]=M||null}var T=s._fullData[p[v]].dimensions[x];b.length?(b.length===1&&(b=b[0]),A.constraintrange=b,T.constraintrange=b.slice(),b=[b]):(delete A.constraintrange,delete T.constraintrange,b=null);var E={};E[k]=b,s.emit("plotly_restyle",[E,[g[v]]])},hover:function(v){s.emit("plotly_hover",v)},unhover:function(v){s.emit("plotly_unhover",v)},axesMoved:function(v,x){var _=function(A,b){return function(k,w){return i(A,b,k)-i(A,b,w)}}(x,m[v].filter(l));d[v].sort(_),m[v].filter(function(A){return!l(A)}).sort(function(A){return m[v].indexOf(A)}).forEach(function(A){d[v].splice(d[v].indexOf(A),1),d[v].splice(m[v].indexOf(A),0,A)}),s.emit("plotly_restyle",[{dimensions:[d[v]]},[g[v]]])}})}}).reglPrecompiled=c},{"../../lib/prepare_regl":516,"./helpers":895,"./parcoords":899}],901:[function(t,o,f){var r=t("../../plots/attributes"),a=t("../../plots/domain").attributes,l=t("../../plots/font_attributes"),c=t("../../components/color/attributes"),i=t("../../plots/template_attributes").hovertemplateAttrs,s=t("../../plots/template_attributes").texttemplateAttrs,u=t("../../lib/extend").extendFlat,h=l({editType:"plot",arrayOk:!0,colorEditType:"plot"});o.exports={labels:{valType:"data_array",editType:"calc"},label0:{valType:"number",dflt:0,editType:"calc"},dlabel:{valType:"number",dflt:1,editType:"calc"},values:{valType:"data_array",editType:"calc"},marker:{colors:{valType:"data_array",editType:"calc"},line:{color:{valType:"color",dflt:c.defaultLine,arrayOk:!0,editType:"style"},width:{valType:"number",min:0,dflt:0,arrayOk:!0,editType:"style"},editType:"calc"},editType:"calc"},text:{valType:"data_array",editType:"plot"},hovertext:{valType:"string",dflt:"",arrayOk:!0,editType:"style"},scalegroup:{valType:"string",dflt:"",editType:"calc"},textinfo:{valType:"flaglist",flags:["label","text","value","percent"],extras:["none"],editType:"calc"},hoverinfo:u({},r.hoverinfo,{flags:["label","text","value","percent","name"]}),hovertemplate:i({},{keys:["label","color","value","percent","text"]}),texttemplate:s({editType:"plot"},{keys:["label","color","value","percent","text"]}),textposition:{valType:"enumerated",values:["inside","outside","auto","none"],dflt:"auto",arrayOk:!0,editType:"plot"},textfont:u({},h,{}),insidetextorientation:{valType:"enumerated",values:["horizontal","radial","tangential","auto"],dflt:"auto",editType:"plot"},insidetextfont:u({},h,{}),outsidetextfont:u({},h,{}),automargin:{valType:"boolean",dflt:!1,editType:"plot"},title:{text:{valType:"string",dflt:"",editType:"plot"},font:u({},h,{}),position:{valType:"enumerated",values:["top left","top center","top right","middle center","bottom left","bottom center","bottom right"],editType:"plot"},editType:"plot"},domain:a({name:"pie",trace:!0,editType:"calc"}),hole:{valType:"number",min:0,max:1,dflt:0,editType:"calc"},sort:{valType:"boolean",dflt:!0,editType:"calc"},direction:{valType:"enumerated",values:["clockwise","counterclockwise"],dflt:"counterclockwise",editType:"calc"},rotation:{valType:"number",min:-360,max:360,dflt:0,editType:"calc"},pull:{valType:"number",min:0,max:1,dflt:0,arrayOk:!0,editType:"calc"},_deprecated:{title:{valType:"string",dflt:"",editType:"calc"},titlefont:u({},h,{}),titleposition:{valType:"enumerated",values:["top left","top center","top right","middle center","bottom left","bottom center","bottom right"],editType:"calc"}}}},{"../../components/color/attributes":365,"../../lib/extend":493,"../../plots/attributes":550,"../../plots/domain":584,"../../plots/font_attributes":585,"../../plots/template_attributes":633}],902:[function(t,o,f){var r=t("../../plots/plots");f.name="pie",f.plot=function(a,l,c,i){r.plotBasePlot(f.name,a,l,c,i)},f.clean=function(a,l,c,i){r.cleanBasePlot(f.name,a,l,c,i)}},{"../../plots/plots":619}],903:[function(t,o,f){var r=t("fast-isnumeric"),a=t("tinycolor2"),l=t("../../components/color"),c={};function i(u){return function(h,d){return!!h&&!!(h=a(h)).isValid()&&(h=l.addOpacity(h,h.getAlpha()),u[d]||(u[d]=h),h)}}function s(u,h){var d,m=JSON.stringify(u),p=h[m];if(!p){for(p=u.slice(),d=0;d=0}),(h.type==="funnelarea"?T:h.sort)&&p.sort(function(R,F){return F.v-R.v}),p[0]&&(p[0].vTotal=M),p},crossTraceCalc:function(u,h){var d=(h||{}).type;d||(d="pie");var m=u._fullLayout,p=u.calcdata,g=m[d+"colorway"],y=m["_"+d+"colormap"];m["extend"+d+"colors"]&&(g=s(g,c));for(var v=0,x=0;x0){g=!0;break}}g||(p=0)}return{hasLabels:d,hasValues:m,len:p}}o.exports={handleLabelsAndValues:s,supplyDefaults:function(u,h,d,m){function p(w,M){return a.coerce(u,h,l,w,M)}var g=s(p("labels"),p("values")),y=g.len;if(h._hasLabels=g.hasLabels,h._hasValues=g.hasValues,!h._hasLabels&&h._hasValues&&(p("label0"),p("dlabel")),y){h._length=y,p("marker.line.width")&&p("marker.line.color"),p("marker.colors"),p("scalegroup");var v,x=p("text"),_=p("texttemplate");if(_||(v=p("textinfo",Array.isArray(x)?"text+percent":"percent")),p("hovertext"),p("hovertemplate"),_||v&&v!=="none"){var A=p("textposition");i(u,h,m,p,A,{moduleHasSelected:!1,moduleHasUnselected:!1,moduleHasConstrain:!1,moduleHasCliponaxis:!1,moduleHasTextangle:!1,moduleHasInsideanchor:!1}),(Array.isArray(A)||A==="auto"||A==="outside")&&p("automargin"),(A==="inside"||A==="auto"||Array.isArray(A))&&p("insidetextorientation")}c(h,m,p);var b=p("hole");if(p("title.text")){var k=p("title.position",b?"middle center":"top center");b||k!=="middle center"||(h.title.position="top center"),a.coerceFont(p,"title.font",m.font)}p("sort"),p("direction"),p("rotation"),p("pull")}else h.visible=!1}}},{"../../lib":503,"../../plots/domain":584,"../bar/defaults":652,"./attributes":901,"fast-isnumeric":190}],905:[function(t,o,f){var r=t("../../components/fx/helpers").appendArrayMultiPointValues;o.exports=function(a,l){var c={curveNumber:l.index,pointNumbers:a.pts,data:l._input,fullData:l,label:a.label,color:a.color,value:a.v,percent:a.percent,text:a.text,bbox:a.bbox,v:a.v};return a.pts.length===1&&(c.pointNumber=c.i=a.pts[0]),r(c,l,a.pts),l.type==="funnelarea"&&(delete c.v,delete c.i),c}},{"../../components/fx/helpers":402}],906:[function(t,o,f){var r=t("../../lib");function a(l){return l.indexOf("e")!==-1?l.replace(/[.]?0+e/,"e"):l.indexOf(".")!==-1?l.replace(/[.]?0+$/,""):l}f.formatPiePercent=function(l,c){var i=a((100*l).toPrecision(3));return r.numSeparate(i,c)+"%"},f.formatPieValue=function(l,c){var i=a(l.toPrecision(10));return r.numSeparate(i,c)},f.getFirstFilled=function(l,c){if(Array.isArray(l))for(var i=0;i"),name:Q.hovertemplate||ee.indexOf("name")!==-1?Q.name:void 0,idealAlign:ne.pxmid[0]<0?"left":"right",color:v.castOption(me.bgcolor,ne.pts)||ne.color,borderColor:v.castOption(me.bordercolor,ne.pts),fontFamily:v.castOption(_e.family,ne.pts),fontSize:v.castOption(_e.size,ne.pts),fontColor:v.castOption(_e.color,ne.pts),nameLength:v.castOption(me.namelength,ne.pts),textAlign:v.castOption(me.align,ne.pts),hovertemplate:v.castOption(Q.hovertemplate,ne.pts),hovertemplateLabels:ne,eventData:[x(ne,Q)]},{container:q._hoverlayer.node(),outerContainer:q._paper.node(),gd:te,inOut_bbox:Ae}),ne.bbox=Ae[0],V._hasHoverLabel=!0}V._hasHoverEvent=!0,te.emit("plotly_hover",{points:[x(ne,Q)],event:r.event})}}),K.on("mouseout",function(ne){var q=te._fullLayout,Q=te._fullData[V.index],ee=r.select(this).datum();V._hasHoverEvent&&(ne.originalEvent=r.event,te.emit("plotly_unhover",{points:[x(ee,Q)],event:r.event}),V._hasHoverEvent=!1),V._hasHoverLabel&&(l.loneUnhover(q._hoverlayer.node()),V._hasHoverLabel=!1)}),K.on("click",function(ne){var q=te._fullLayout,Q=te._fullData[V.index];te._dragging||q.hovermode===!1||(te._hoverdata=[x(ne,Q)],l.click(te,r.event))})}function b(K,te,Y){var J=v.castOption(K.insidetextfont.color,te.pts);!J&&K._input.textfont&&(J=v.castOption(K._input.textfont.color,te.pts));var re=v.castOption(K.insidetextfont.family,te.pts)||v.castOption(K.textfont.family,te.pts)||Y.family,U=v.castOption(K.insidetextfont.size,te.pts)||v.castOption(K.textfont.size,te.pts)||Y.size;return{color:J||c.contrast(te.color),family:re,size:U}}function k(K,te){for(var Y,J,re=0;reze&&ze>Ke||$e=-4;ge-=2)fe(Math.PI*ge,"tan");for(ge=4;ge>=-4;ge-=2)fe(Math.PI*(ge+1),"tan")}if(ee||ae){for(ge=4;ge>=-4;ge-=2)fe(Math.PI*(ge+1.5),"rad");for(ge=4;ge>=-4;ge-=2)fe(Math.PI*(ge+.5),"rad")}}if(H||ue||ee){var me=Math.sqrt(K.width*K.width+K.height*K.height);if((U={scale:re*J*2/me,rCenter:1-re,rotate:0}).textPosAngle=(te.startangle+te.stopangle)/2,U.scale>=1)return U;le.push(U)}(ue||ae)&&((U=M(K,J,V,ne,q)).textPosAngle=(te.startangle+te.stopangle)/2,le.push(U)),(ue||ie)&&((U=T(K,J,V,ne,q)).textPosAngle=(te.startangle+te.stopangle)/2,le.push(U));for(var _e=0,Ae=0,ke=0;ke=1)break}return le[_e]}function M(K,te,Y,J,re){te=Math.max(0,te-2*y);var U=K.width/K.height,V=P(U,J,te,Y);return{scale:2*V/K.height,rCenter:E(U,V/te),rotate:S(re)}}function T(K,te,Y,J,re){te=Math.max(0,te-2*y);var U=K.height/K.width,V=P(U,J,te,Y);return{scale:2*V/K.width,rCenter:E(U,V/te),rotate:S(re+Math.PI/2)}}function E(K,te){return Math.cos(te)-K*te}function S(K){return(180/Math.PI*K+720)%180-90}function P(K,te,Y,J){var re=K+1/(2*Math.tan(te));return Y*Math.min(1/(Math.sqrt(re*re+.5)+re),J/(Math.sqrt(K*K+J/2)+K))}function L(K,te){return K.v!==te.vTotal||te.trace.hole?Math.min(1/(1+1/Math.sin(K.halfangle)),K.ring/2):1}function R(K,te){var Y=te.pxmid[0],J=te.pxmid[1],re=K.width/2,U=K.height/2;return Y<0&&(re*=-1),J<0&&(U*=-1),{scale:1,rCenter:1,rotate:0,x:re+Math.abs(U)*(re>0?1:-1)/2,y:U/(1+Y*Y/(J*J)),outside:!0}}function F(K,te){var Y,J,re,U=K.trace,V={x:K.cx,y:K.cy},H={tx:0,ty:0};H.ty+=U.title.font.size,re=O(U),U.title.position.indexOf("top")!==-1?(V.y-=(1+re)*K.r,H.ty-=K.titleBox.height):U.title.position.indexOf("bottom")!==-1&&(V.y+=(1+re)*K.r);var ne,q,Q=(ne=K.r,q=K.trace.aspectratio,ne/(q===void 0?1:q)),ee=te.w*(U.domain.x[1]-U.domain.x[0])/2;return U.title.position.indexOf("left")!==-1?(ee+=Q,V.x-=(1+re)*Q,H.tx+=K.titleBox.width/2):U.title.position.indexOf("center")!==-1?ee*=2:U.title.position.indexOf("right")!==-1&&(ee+=Q,V.x+=(1+re)*Q,H.tx-=K.titleBox.width/2),Y=ee/K.titleBox.width,J=D(K,te)/K.titleBox.height,{x:V.x,y:V.y,scale:Math.min(Y,J),tx:H.tx,ty:H.ty}}function D(K,te){var Y=K.trace,J=te.h*(Y.domain.y[1]-Y.domain.y[0]);return Math.min(K.titleBox.height,J/2)}function O(K){var te,Y=K.pull;if(!Y)return 0;if(Array.isArray(Y))for(Y=0,te=0;teY&&(Y=K.pull[te]);return Y}function N(K,te){for(var Y=[],J=0;J1?(Ae=ae.r,ke=Ae/le.aspectratio):(ke=ae.r,Ae=ke*le.aspectratio),Ae*=(1+le.baseratio)/2,_e=Ae*ke}fe=Math.min(fe,_e/ae.vTotal)}for(ue=0;ue")}if(U){var ge=s.castOption(re,te.i,"texttemplate");if(ge){var fe=function(_e){return{label:_e.label,value:_e.v,valueLabel:v.formatPieValue(_e.v,J.separators),percent:_e.v/Y.vTotal,percentLabel:v.formatPiePercent(_e.v/Y.vTotal,J.separators),color:_e.color,text:_e.text,customdata:s.castOption(re,_e.i,"customdata")}}(te),me=v.getFirstFilled(re.text,te.pts);(_(me)||me==="")&&(fe.text=me),te.text=s.texttemplateString(ge,fe,K._fullLayout._d3locale,fe,re._meta||{})}else te.text=""}}function G(K,te){var Y=K.rotate*Math.PI/180,J=Math.cos(Y),re=Math.sin(Y),U=(te.left+te.right)/2,V=(te.top+te.bottom)/2;K.textX=U*J-V*re,K.textY=U*re+V*J,K.noCenter=!0}o.exports={plot:function(K,te){var Y=K._fullLayout,J=Y._size;g("pie",Y),k(te,K),N(te,J);var re=s.makeTraceGroups(Y._pielayer,te,"trace").each(function(U){var V=r.select(this),H=U[0],ne=H.trace;(function(q){var Q,ee,ie,ae=q[0],ue=ae.r,le=ae.trace,ge=v.getRotationAngle(le.rotation),fe=2*Math.PI/ae.vTotal,me="px0",_e="px1";if(le.direction==="counterclockwise"){for(Q=0;Qae.vTotal/2?1:0,ee.halfangle=Math.PI*Math.min(ee.v/ae.vTotal,.5),ee.ring=1-le.hole,ee.rInscribed=L(ee,ae))})(U),V.attr("stroke-linejoin","round"),V.each(function(){var q=r.select(this).selectAll("g.slice").data(U);q.enter().append("g").classed("slice",!0),q.exit().remove();var Q=[[[],[]],[[],[]]],ee=!1;q.each(function(_e,Ae){if(_e.hidden)r.select(this).selectAll("path,g").remove();else{_e.pointNumber=_e.i,_e.curveNumber=ne.index,Q[_e.pxmid[1]<0?0:1][_e.pxmid[0]<0?0:1].push(_e);var ke=H.cx,Le=H.cy,de=r.select(this),ve=de.selectAll("path.surface").data([_e]);if(ve.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),de.call(A,K,U),ne.pull){var Me=+v.castOption(ne.pull,_e.pts)||0;Me>0&&(ke+=Me*_e.pxmid[0],Le+=Me*_e.pxmid[1])}_e.cxFinal=ke,_e.cyFinal=Le;var we=ne.hole;if(_e.v===H.vTotal){var Ce="M"+(ke+_e.px0[0])+","+(Le+_e.px0[1])+Re(_e.px0,_e.pxmid,!0,1)+Re(_e.pxmid,_e.px0,!0,1)+"Z";we?ve.attr("d","M"+(ke+we*_e.px0[0])+","+(Le+we*_e.px0[1])+Re(_e.px0,_e.pxmid,!1,we)+Re(_e.pxmid,_e.px0,!1,we)+"Z"+Ce):ve.attr("d",Ce)}else{var Fe=Re(_e.px0,_e.px1,!0,1);if(we){var ze=1-we;ve.attr("d","M"+(ke+we*_e.px1[0])+","+(Le+we*_e.px1[1])+Re(_e.px1,_e.px0,!1,we)+"l"+ze*_e.px0[0]+","+ze*_e.px0[1]+Fe+"Z")}else ve.attr("d","M"+ke+","+Le+"l"+_e.px0[0]+","+_e.px0[1]+Fe+"Z")}W(K,_e,H);var $e=v.castOption(ne.textposition,_e.pts),Ke=de.selectAll("g.slicetext").data(_e.text&&$e!=="none"?[0]:[]);Ke.enter().append("g").classed("slicetext",!0),Ke.exit().remove(),Ke.each(function(){var Ve=s.ensureSingle(r.select(this),"text","",function(at){at.attr("data-notex",1)}),We=s.ensureUniformFontSize(K,$e==="outside"?function(at,et,Lt){var Wt=v.castOption(at.outsidetextfont.color,et.pts)||v.castOption(at.textfont.color,et.pts)||Lt.color,Jt=v.castOption(at.outsidetextfont.family,et.pts)||v.castOption(at.textfont.family,et.pts)||Lt.family,Be=v.castOption(at.outsidetextfont.size,et.pts)||v.castOption(at.textfont.size,et.pts)||Lt.size;return{color:Wt,family:Jt,size:Be}}(ne,_e,Y.font):b(ne,_e,Y.font));Ve.text(_e.text).attr({class:"slicetext",transform:"","text-anchor":"middle"}).call(i.font,We).call(d.convertToTspans,K);var Ye,nt=i.bBox(Ve.node());if($e==="outside")Ye=R(nt,_e);else if(Ye=w(nt,_e,H),$e==="auto"&&Ye.scale<1){var ft=s.ensureUniformFontSize(K,ne.outsidetextfont);Ve.call(i.font,ft),Ye=R(nt=i.bBox(Ve.node()),_e)}var yt=Ye.textPosAngle,Ot=yt===void 0?_e.pxmid:B(H.r,yt);if(Ye.targetX=ke+Ot[0]*Ye.rCenter+(Ye.x||0),Ye.targetY=Le+Ot[1]*Ye.rCenter+(Ye.y||0),G(Ye,nt),Ye.outside){var Tt=Ye.targetY;_e.yLabelMin=Tt-nt.height/2,_e.yLabelMid=Tt,_e.yLabelMax=Tt+nt.height/2,_e.labelExtraX=0,_e.labelExtraY=0,ee=!0}Ye.fontSize=We.size,p(ne.type,Ye,Y),U[Ae].transform=Ye,Ve.attr("transform",s.getTextTransform(Ye))})}function Re(Ve,We,Ye,nt){var ft=nt*(We[0]-Ve[0]),yt=nt*(We[1]-Ve[1]);return"a"+nt*H.r+","+nt*H.r+" 0 "+_e.largeArc+(Ye?" 1 ":" 0 ")+ft+","+yt}});var ie=r.select(this).selectAll("g.titletext").data(ne.title.text?[0]:[]);if(ie.enter().append("g").classed("titletext",!0),ie.exit().remove(),ie.each(function(){var _e,Ae=s.ensureSingle(r.select(this),"text","",function(Le){Le.attr("data-notex",1)}),ke=ne.title.text;ne._meta&&(ke=s.templateString(ke,ne._meta)),Ae.text(ke).attr({class:"titletext",transform:"","text-anchor":"middle"}).call(i.font,ne.title.font).call(d.convertToTspans,K),_e=ne.title.position==="middle center"?function(Le){var de=Math.sqrt(Le.titleBox.width*Le.titleBox.width+Le.titleBox.height*Le.titleBox.height);return{x:Le.cx,y:Le.cy,scale:Le.trace.hole*Le.r*2/de,tx:0,ty:-Le.titleBox.height/2+Le.trace.title.font.size}}(H):F(H,J),Ae.attr("transform",h(_e.x,_e.y)+u(Math.min(1,_e.scale))+h(_e.tx,_e.ty))}),ee&&function(_e,Ae){var ke,Le,de,ve,Me,we,Ce,Fe,ze,$e,Ke,Re,Ve;function We(yt,Ot){return yt.pxmid[1]-Ot.pxmid[1]}function Ye(yt,Ot){return Ot.pxmid[1]-yt.pxmid[1]}function nt(yt,Ot){Ot||(Ot={});var Tt,at,et,Lt,Wt=Ot.labelExtraY+(Le?Ot.yLabelMax:Ot.yLabelMin),Jt=Le?yt.yLabelMin:yt.yLabelMax,Be=Le?yt.yLabelMax:yt.yLabelMin,Ge=yt.cyFinal+Me(yt.px0[1],yt.px1[1]),kt=Wt-Jt;if(kt*Ce>0&&(yt.labelExtraY=kt),Array.isArray(Ae.pull))for(at=0;at<$e.length;at++)(et=$e[at])===yt||(v.castOption(Ae.pull,yt.pts)||0)>=(v.castOption(Ae.pull,et.pts)||0)||((yt.pxmid[1]-et.pxmid[1])*Ce>0?(kt=et.cyFinal+Me(et.px0[1],et.px1[1])-Jt-yt.labelExtraY)*Ce>0&&(yt.labelExtraY+=kt):(Be+yt.labelExtraY-Ge)*Ce>0&&(Tt=3*we*Math.abs(at-$e.indexOf(yt)),(Lt=et.cxFinal+ve(et.px0[0],et.px1[0])+Tt-(yt.cxFinal+yt.pxmid[0])-yt.labelExtraX)*we>0&&(yt.labelExtraX+=Lt)))}for(Le=0;Le<2;Le++)for(de=Le?We:Ye,Me=Le?Math.max:Math.min,Ce=Le?1:-1,ke=0;ke<2;ke++){for(ve=ke?Math.max:Math.min,we=ke?1:-1,(Fe=_e[Le][ke]).sort(de),ze=_e[1-Le][ke],$e=ze.concat(Fe),Re=[],Ke=0;KeMath.abs(Fe)?Me+="l"+Fe*ke.pxmid[0]/ke.pxmid[1]+","+Fe+"H"+(ve+ke.labelExtraX+we):Me+="l"+ke.labelExtraX+","+Ce+"v"+(Fe-Ce)+"h"+we}else Me+="V"+(ke.yLabelMid+ke.labelExtraY)+"h"+we;s.ensureSingle(Le,"path","textline").call(c.stroke,Ae.outsidetextfont.color).attr({"stroke-width":Math.min(2,Ae.outsidetextfont.size/8),d:Me,fill:"none"})}else Le.select("path.textline").remove()})}(q,ne),ee&&ne.automargin){var ae=i.bBox(V.node()),ue=ne.domain,le=J.w*(ue.x[1]-ue.x[0]),ge=J.h*(ue.y[1]-ue.y[0]),fe=(.5*le-H.r)/J.w,me=(.5*ge-H.r)/J.h;a.autoMargin(K,"pie."+ne.uid+".automargin",{xl:ue.x[0]-fe,xr:ue.x[1]+fe,yb:ue.y[0]-me,yt:ue.y[1]+me,l:Math.max(H.cx-H.r-ae.left,0),r:Math.max(ae.right-(H.cx+H.r),0),b:Math.max(ae.bottom-(H.cy+H.r),0),t:Math.max(H.cy-H.r-ae.top,0),pad:5})}})});setTimeout(function(){re.selectAll("tspan").each(function(){var U=r.select(this);U.attr("dy")&&U.attr("dy",U.attr("dy"))})},0)},formatSliceLabel:W,transformInsideText:w,determineInsideTextFont:b,positionTitleOutside:F,prerenderTitles:k,layoutAreas:N,attachFxHandlers:A,computeTransform:G}},{"../../components/color":366,"../../components/drawing":388,"../../components/fx":406,"../../lib":503,"../../lib/svg_text_utils":529,"../../plots/plots":619,"../bar/constants":650,"../bar/uniform_text":664,"./event_data":905,"./helpers":906,"@plotly/d3":58}],911:[function(t,o,f){var r=t("@plotly/d3"),a=t("./style_one"),l=t("../bar/uniform_text").resizeText;o.exports=function(c){var i=c._fullLayout._pielayer.selectAll(".trace");l(c,i,"pie"),i.each(function(s){var u=s[0].trace,h=r.select(this);h.style({opacity:u.opacity}),h.selectAll("path.surface").each(function(d){r.select(this).call(a,d,u)})})}},{"../bar/uniform_text":664,"./style_one":912,"@plotly/d3":58}],912:[function(t,o,f){var r=t("../../components/color"),a=t("./helpers").castOption;o.exports=function(l,c,i){var s=i.marker.line,u=a(s.color,c.pts)||r.defaultLine,h=a(s.width,c.pts)||0;l.style("stroke-width",h).call(r.fill,c.color).call(r.stroke,u)}},{"../../components/color":366,"./helpers":906}],913:[function(t,o,f){var r=t("../scatter/attributes");o.exports={x:r.x,y:r.y,xy:{valType:"data_array",editType:"calc"},indices:{valType:"data_array",editType:"calc"},xbounds:{valType:"data_array",editType:"calc"},ybounds:{valType:"data_array",editType:"calc"},text:r.text,marker:{color:{valType:"color",arrayOk:!1,editType:"calc"},opacity:{valType:"number",min:0,max:1,dflt:1,arrayOk:!1,editType:"calc"},blend:{valType:"boolean",dflt:null,editType:"calc"},sizemin:{valType:"number",min:.1,max:2,dflt:.5,editType:"calc"},sizemax:{valType:"number",min:.1,dflt:20,editType:"calc"},border:{color:{valType:"color",arrayOk:!1,editType:"calc"},arearatio:{valType:"number",min:0,max:1,dflt:0,editType:"calc"},editType:"calc"},editType:"calc"},transforms:void 0}},{"../scatter/attributes":927}],914:[function(t,o,f){var r=t("../../../stackgl_modules").gl_pointcloud2d,a=t("../../lib/str2rgbarray"),l=t("../../plots/cartesian/autorange").findExtremes,c=t("../scatter/get_trace_color");function i(u,h){this.scene=u,this.uid=h,this.type="pointcloud",this.pickXData=[],this.pickYData=[],this.xData=[],this.yData=[],this.textLabels=[],this.color="rgb(0, 0, 0)",this.name="",this.hoverinfo="all",this.idToIndex=new Int32Array(0),this.bounds=[0,0,0,0],this.pointcloudOptions={positions:new Float32Array(0),idToIndex:this.idToIndex,sizemin:.5,sizemax:12,color:[0,0,0,1],areaRatio:1,borderColor:[0,0,0,1]},this.pointcloud=r(u.glplot,this.pointcloudOptions),this.pointcloud._trace=this}var s=i.prototype;s.handlePick=function(u){var h=this.idToIndex[u.pointId];return{trace:this,dataCoord:u.dataCoord,traceCoord:this.pickXYData?[this.pickXYData[2*h],this.pickXYData[2*h+1]]:[this.pickXData[h],this.pickYData[h]],textLabel:Array.isArray(this.textLabels)?this.textLabels[h]:this.textLabels,color:this.color,name:this.name,pointIndex:h,hoverinfo:this.hoverinfo}},s.update=function(u){this.index=u.index,this.textLabels=u.text,this.name=u.name,this.hoverinfo=u.hoverinfo,this.bounds=[1/0,1/0,-1/0,-1/0],this.updateFast(u),this.color=c(u,{})},s.updateFast=function(u){var h,d,m,p,g,y,v=this.xData=this.pickXData=u.x,x=this.yData=this.pickYData=u.y,_=this.pickXYData=u.xy,A=u.xbounds&&u.ybounds,b=u.indices,k=this.bounds;if(_){if(m=_,h=_.length>>>1,A)k[0]=u.xbounds[0],k[2]=u.xbounds[1],k[1]=u.ybounds[0],k[3]=u.ybounds[1];else for(y=0;yk[2]&&(k[2]=p),gk[3]&&(k[3]=g);if(b)d=b;else for(d=new Int32Array(h),y=0;yk[2]&&(k[2]=p),gk[3]&&(k[3]=g);this.idToIndex=d,this.pointcloudOptions.idToIndex=d,this.pointcloudOptions.positions=m;var w=a(u.marker.color),M=a(u.marker.border.color),T=u.opacity*u.marker.opacity;w[3]*=T,this.pointcloudOptions.color=w;var E=u.marker.blend;E===null&&(E=v.length<100||x.length<100),this.pointcloudOptions.blend=E,M[3]*=T,this.pointcloudOptions.borderColor=M;var S=u.marker.sizemin,P=Math.max(u.marker.sizemax,u.marker.sizemin);this.pointcloudOptions.sizeMin=S,this.pointcloudOptions.sizeMax=P,this.pointcloudOptions.areaRatio=u.marker.border.arearatio,this.pointcloud.update(this.pointcloudOptions);var L=this.scene.xaxis,R=this.scene.yaxis,F=P/2||.5;u._extremes[L._id]=l(L,[k[0],k[2]],{ppad:F}),u._extremes[R._id]=l(R,[k[1],k[3]],{ppad:F})},s.dispose=function(){this.pointcloud.dispose()},o.exports=function(u,h){var d=new i(u,h.uid);return d.update(h),d}},{"../../../stackgl_modules":1124,"../../lib/str2rgbarray":528,"../../plots/cartesian/autorange":553,"../scatter/get_trace_color":937}],915:[function(t,o,f){var r=t("../../lib"),a=t("./attributes");o.exports=function(l,c,i){function s(u,h){return r.coerce(l,c,a,u,h)}s("x"),s("y"),s("xbounds"),s("ybounds"),l.xy&&l.xy instanceof Float32Array&&(c.xy=l.xy),l.indices&&l.indices instanceof Int32Array&&(c.indices=l.indices),s("text"),s("marker.color",i),s("marker.opacity"),s("marker.blend"),s("marker.sizemin"),s("marker.sizemax"),s("marker.border.color",i),s("marker.border.arearatio"),c._length=null}},{"../../lib":503,"./attributes":913}],916:[function(t,o,f){o.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),calc:t("../scatter3d/calc"),plot:t("./convert"),moduleType:"trace",name:"pointcloud",basePlotModule:t("../../plots/gl2d"),categories:["gl","gl2d","showLegend"],meta:{}}},{"../../plots/gl2d":596,"../scatter3d/calc":956,"./attributes":913,"./convert":914,"./defaults":915}],917:[function(t,o,f){var r=t("../../plots/font_attributes"),a=t("../../plots/attributes"),l=t("../../components/color/attributes"),c=t("../../components/fx/attributes"),i=t("../../plots/domain").attributes,s=t("../../plots/template_attributes").hovertemplateAttrs,u=t("../../components/colorscale/attributes"),h=t("../../plot_api/plot_template").templatedArray,d=t("../../plots/cartesian/axis_format_attributes").descriptionOnlyNumbers,m=t("../../lib/extend").extendFlat,p=t("../../plot_api/edit_types").overrideAll;(o.exports=p({hoverinfo:m({},a.hoverinfo,{flags:[],arrayOk:!1}),hoverlabel:c.hoverlabel,domain:i({name:"sankey",trace:!0}),orientation:{valType:"enumerated",values:["v","h"],dflt:"h"},valueformat:{valType:"string",dflt:".3s",description:d("value")},valuesuffix:{valType:"string",dflt:""},arrangement:{valType:"enumerated",values:["snap","perpendicular","freeform","fixed"],dflt:"snap"},textfont:r({}),customdata:void 0,node:{label:{valType:"data_array",dflt:[]},groups:{valType:"info_array",impliedEdits:{x:[],y:[]},dimensions:2,freeLength:!0,dflt:[],items:{valType:"number",editType:"calc"}},x:{valType:"data_array",dflt:[]},y:{valType:"data_array",dflt:[]},color:{valType:"color",arrayOk:!0},customdata:{valType:"data_array",editType:"calc"},line:{color:{valType:"color",dflt:l.defaultLine,arrayOk:!0},width:{valType:"number",min:0,dflt:.5,arrayOk:!0}},pad:{valType:"number",arrayOk:!1,min:0,dflt:20},thickness:{valType:"number",arrayOk:!1,min:1,dflt:20},hoverinfo:{valType:"enumerated",values:["all","none","skip"],dflt:"all"},hoverlabel:c.hoverlabel,hovertemplate:s({},{keys:["value","label"]})},link:{label:{valType:"data_array",dflt:[]},color:{valType:"color",arrayOk:!0},customdata:{valType:"data_array",editType:"calc"},line:{color:{valType:"color",dflt:l.defaultLine,arrayOk:!0},width:{valType:"number",min:0,dflt:0,arrayOk:!0}},source:{valType:"data_array",dflt:[]},target:{valType:"data_array",dflt:[]},value:{valType:"data_array",dflt:[]},hoverinfo:{valType:"enumerated",values:["all","none","skip"],dflt:"all"},hoverlabel:c.hoverlabel,hovertemplate:s({},{keys:["value","label"]}),colorscales:h("concentrationscales",{editType:"calc",label:{valType:"string",editType:"calc",dflt:""},cmax:{valType:"number",editType:"calc",dflt:1},cmin:{valType:"number",editType:"calc",dflt:0},colorscale:m(u().colorscale,{dflt:[[0,"white"],[1,"black"]]})})}},"calc","nested")).transforms=void 0},{"../../components/color/attributes":365,"../../components/colorscale/attributes":373,"../../components/fx/attributes":397,"../../lib/extend":493,"../../plot_api/edit_types":536,"../../plot_api/plot_template":543,"../../plots/attributes":550,"../../plots/cartesian/axis_format_attributes":557,"../../plots/domain":584,"../../plots/font_attributes":585,"../../plots/template_attributes":633}],918:[function(t,o,f){var r=t("../../plot_api/edit_types").overrideAll,a=t("../../plots/get_data").getModuleCalcData,l=t("./plot"),c=t("../../components/fx/layout_attributes"),i=t("../../lib/setcursor"),s=t("../../components/dragelement"),u=t("../../plots/cartesian/select").prepSelect,h=t("../../lib"),d=t("../../registry");function m(p,g){var y=p._fullData[g],v=p._fullLayout,x=v.dragmode,_=v.dragmode==="pan"?"move":"crosshair",A=y._bgRect;if(x!=="pan"&&x!=="zoom"){i(A,_);var b={_id:"x",c2p:h.identity,_offset:y._sankey.translateX,_length:y._sankey.width},k={_id:"y",c2p:h.identity,_offset:y._sankey.translateY,_length:y._sankey.height},w={gd:p,element:A.node(),plotinfo:{id:g,xaxis:b,yaxis:k,fillRangeItems:h.noop},subplot:g,xaxes:[b],yaxes:[k],doneFnCompleted:function(M){var T,E=p._fullData[g],S=E.node.groups.slice(),P=[];function L(O){for(var N=E._sankey.graph.nodes,B=0;BM&&(M=p.source[d]),p.target[d]>M&&(M=p.target[d]);var T,E=M+1;h.node._count=E;var S=h.node.groups,P={};for(d=0;d0&&i(N,E)&&i(B,E)&&(!P.hasOwnProperty(N)||!P.hasOwnProperty(B)||P[N]!==P[B])){P.hasOwnProperty(B)&&(B=P[B]),P.hasOwnProperty(N)&&(N=P[N]),B=+B,x[N=+N]=x[B]=!0;var W="";p.label&&p.label[d]&&(W=p.label[d]);var G=null;W&&_.hasOwnProperty(W)&&(G=_[W]),g.push({pointNumber:d,label:W,color:y?p.color[d]:p.color,customdata:v?p.customdata[d]:p.customdata,concentrationscale:G,source:N,target:B,value:+O}),D.source.push(N),D.target.push(B)}}var K=E+S.length,te=c(m.color),Y=c(m.customdata),J=[];for(d=0;dE-1,childrenNodes:[],pointNumber:d,label:re,color:te?m.color[d]:m.color,customdata:Y?m.customdata[d]:m.customdata})}var U=!1;return function(V,H,ne){for(var q=a.init2dArray(V,0),Q=0;Q1})}(K,D.source,D.target)&&(U=!0),{circular:U,links:g,nodes:J,groups:S,groupLookup:P}}o.exports=function(h,d){var m=u(d);return l({circular:m.circular,_nodes:m.nodes,_links:m.links,_groups:m.groups,_groupLookup:m.groupLookup})}},{"../../components/colorscale":378,"../../lib":503,"../../lib/gup":500,"strongly-connected-components":306}],920:[function(t,o,f){o.exports={nodeTextOffsetHorizontal:4,nodeTextOffsetVertical:3,nodePadAcross:10,sankeyIterations:50,forceIterations:5,forceTicksPerFrame:10,duration:500,ease:"linear",cn:{sankey:"sankey",sankeyLinks:"sankey-links",sankeyLink:"sankey-link",sankeyNodeSet:"sankey-node-set",sankeyNode:"sankey-node",nodeRect:"node-rect",nodeLabel:"node-label"}}},{}],921:[function(t,o,f){var r=t("../../lib"),a=t("./attributes"),l=t("../../components/color"),c=t("tinycolor2"),i=t("../../plots/domain").defaults,s=t("../../components/fx/hoverlabel_defaults"),u=t("../../plot_api/plot_template"),h=t("../../plots/array_container_defaults");function d(m,p){function g(y,v){return r.coerce(m,p,a.link.colorscales,y,v)}g("label"),g("cmin"),g("cmax"),g("colorscale")}o.exports=function(m,p,g,y){function v(P,L){return r.coerce(m,p,a,P,L)}var x=r.extendDeep(y.hoverlabel,m.hoverlabel),_=m.node,A=u.newContainer(p,"node");function b(P,L){return r.coerce(_,A,a.node,P,L)}b("label"),b("groups"),b("x"),b("y"),b("pad"),b("thickness"),b("line.color"),b("line.width"),b("hoverinfo",m.hoverinfo),s(_,A,b,x),b("hovertemplate");var k=y.colorway;b("color",A.label.map(function(P,L){return l.addOpacity(function(R){return k[R%k.length]}(L),.8)})),b("customdata");var w=m.link||{},M=u.newContainer(p,"link");function T(P,L){return r.coerce(w,M,a.link,P,L)}T("label"),T("source"),T("target"),T("value"),T("line.color"),T("line.width"),T("hoverinfo",m.hoverinfo),s(w,M,T,x),T("hovertemplate");var E,S=c(y.paper_bgcolor).getLuminance()<.333?"rgba(255, 255, 255, 0.6)":"rgba(0, 0, 0, 0.2)";T("color",r.repeat(S,M.value.length)),T("customdata"),h(w,M,{name:"colorscales",handleItemDefaults:d}),i(p,y,v),v("orientation"),v("valueformat"),v("valuesuffix"),A.x.length&&A.y.length&&(E="freeform"),v("arrangement",E),r.coerceFont(v,"textfont",r.extendFlat({},y.font)),p._length=null}},{"../../components/color":366,"../../components/fx/hoverlabel_defaults":404,"../../lib":503,"../../plot_api/plot_template":543,"../../plots/array_container_defaults":549,"../../plots/domain":584,"./attributes":917,tinycolor2:312}],922:[function(t,o,f){o.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),calc:t("./calc"),plot:t("./plot"),moduleType:"trace",name:"sankey",basePlotModule:t("./base_plot"),selectPoints:t("./select.js"),categories:["noOpacity"],meta:{}}},{"./attributes":917,"./base_plot":918,"./calc":919,"./defaults":921,"./plot":923,"./select.js":925}],923:[function(t,o,f){var r=t("@plotly/d3"),a=t("../../lib"),l=a.numberFormat,c=t("./render"),i=t("../../components/fx"),s=t("../../components/color"),u=t("./constants").cn,h=a._;function d(w){return w!==""}function m(w,M){return w.filter(function(T){return T.key===M.traceId})}function p(w,M){r.select(w).select("path").style("fill-opacity",M),r.select(w).select("rect").style("fill-opacity",M)}function g(w){r.select(w).select("text.name").style("fill","black")}function y(w){return function(M){return w.node.sourceLinks.indexOf(M.link)!==-1||w.node.targetLinks.indexOf(M.link)!==-1}}function v(w){return function(M){return M.node.sourceLinks.indexOf(w.link)!==-1||M.node.targetLinks.indexOf(w.link)!==-1}}function x(w,M,T){M&&T&&m(T,M).selectAll("."+u.sankeyLink).filter(y(M)).call(A.bind(0,M,T,!1))}function _(w,M,T){M&&T&&m(T,M).selectAll("."+u.sankeyLink).filter(y(M)).call(b.bind(0,M,T,!1))}function A(w,M,T,E){var S=E.datum().link.label;E.style("fill-opacity",function(P){if(!P.link.concentrationscale)return .4}),S&&m(M,w).selectAll("."+u.sankeyLink).filter(function(P){return P.link.label===S}).style("fill-opacity",function(P){if(!P.link.concentrationscale)return .4}),T&&m(M,w).selectAll("."+u.sankeyNode).filter(v(w)).call(x)}function b(w,M,T,E){var S=E.datum().link.label;E.style("fill-opacity",function(P){return P.tinyColorAlpha}),S&&m(M,w).selectAll("."+u.sankeyLink).filter(function(P){return P.link.label===S}).style("fill-opacity",function(P){return P.tinyColorAlpha}),T&&m(M,w).selectAll(u.sankeyNode).filter(v(w)).call(_)}function k(w,M){var T=w.hoverlabel||{},E=a.nestedProperty(T,M).get();return!Array.isArray(E)&&E}o.exports=function(w,M){for(var T=w._fullLayout,E=T._paper,S=T._size,P=0;P"),color:k(G,"bgcolor")||s.addOpacity(J.color,1),borderColor:k(G,"bordercolor"),fontFamily:k(G,"font.family"),fontSize:k(G,"font.size"),fontColor:k(G,"font.color"),nameLength:k(G,"namelength"),textAlign:k(G,"align"),idealAlign:r.event.x"),color:k(G,"bgcolor")||W.tinyColorHue,borderColor:k(G,"bordercolor"),fontFamily:k(G,"font.family"),fontSize:k(G,"font.size"),fontColor:k(G,"font.color"),nameLength:k(G,"namelength"),textAlign:k(G,"align"),idealAlign:"left",hovertemplate:G.hovertemplate,hovertemplateLabels:V,eventData:[W.node]},{container:T._hoverlayer.node(),outerContainer:T._paper.node(),gd:w});p(q,.85),g(q)}}},unhover:function(B,W,G){w._fullLayout.hovermode!==!1&&(r.select(B).call(_,W,G),W.node.trace.node.hoverinfo!=="skip"&&(W.node.fullData=W.node.trace,w.emit("plotly_unhover",{event:r.event,points:[W.node]})),i.loneUnhover(T._hoverlayer.node()))},select:function(B,W,G){var K=W.node;K.originalEvent=r.event,w._hoverdata=[K],r.select(B).call(_,W,G),i.click(w,{target:!0})}}})}},{"../../components/color":366,"../../components/fx":406,"../../lib":503,"./constants":920,"./render":924,"@plotly/d3":58}],924:[function(t,o,f){var r=t("d3-force"),a=t("d3-interpolate").interpolateNumber,l=t("@plotly/d3"),c=t("@plotly/d3-sankey"),i=t("@plotly/d3-sankey-circular"),s=t("./constants"),u=t("tinycolor2"),h=t("../../components/color"),d=t("../../components/drawing"),m=t("../../lib"),p=m.strTranslate,g=m.strRotate,y=t("../../lib/gup"),v=y.keyFun,x=y.repeat,_=y.unwrap,A=t("../../lib/svg_text_utils"),b=t("../../registry"),k=t("../../constants/alignment"),w=k.CAP_SHIFT,M=k.LINE_SPACING;function T(Y,J,re){var U,V=_(J),H=V.trace,ne=H.domain,q=H.orientation==="h",Q=H.node.pad,ee=H.node.thickness,ie=Y.width*(ne.x[1]-ne.x[0]),ae=Y.height*(ne.y[1]-ne.y[0]),ue=V._nodes,le=V._links,ge=V.circular;(U=ge?i.sankeyCircular().circularLinkGap(0):c.sankey()).iterations(s.sankeyIterations).size(q?[ie,ae]:[ae,ie]).nodeWidth(ee).nodePadding(Q).nodeId(function(Ce){return Ce.pointNumber}).nodes(ue).links(le);var fe,me,_e,Ae=U();for(var ke in U.nodePadding()=Re||($e=Re-ze.y0)>1e-6&&(ze.y0+=$e,ze.y1+=$e),Re=ze.y1+Q})}(function(Ce){var Fe,ze,$e=Ce.map(function(Ye,nt){return{x0:Ye.x0,index:nt}}).sort(function(Ye,nt){return Ye.x0-nt.x0}),Ke=[],Re=-1,Ve=-1/0;for(fe=0;fe<$e.length;fe++){var We=Ce[$e[fe].index];We.x0>Ve+ee&&(Re+=1,Fe=We.x0),Ve=We.x0,Ke[Re]||(Ke[Re]=[]),Ke[Re].push(We),ze=Fe-We.x0,We.x0+=ze,We.x1+=ze}return Ke}(ue=Ae.nodes)),U.update(Ae)}return{circular:ge,key:re,trace:H,guid:m.randstr(),horizontal:q,width:ie,height:ae,nodePad:H.node.pad,nodeLineColor:H.node.line.color,nodeLineWidth:H.node.line.width,linkLineColor:H.link.line.color,linkLineWidth:H.link.line.width,valueFormat:H.valueformat,valueSuffix:H.valuesuffix,textFont:H.textfont,translateX:ne.x[0]*Y.width+Y.margin.l,translateY:Y.height-ne.y[1]*Y.height+Y.margin.t,dragParallel:q?ae:ie,dragPerpendicular:q?ie:ae,arrangement:H.arrangement,sankey:U,graph:Ae,forceLayouts:{},interactionState:{dragInProgress:!1,hovered:!1}}}function E(Y,J,re){var U=u(J.color),V=J.source.label+"|"+J.target.label+"__"+re;return J.trace=Y.trace,J.curveNumber=Y.trace.index,{circular:Y.circular,key:V,traceId:Y.key,pointNumber:J.pointNumber,link:J,tinyColorHue:h.tinyRGB(U),tinyColorAlpha:U.getAlpha(),linkPath:S,linkLineColor:Y.linkLineColor,linkLineWidth:Y.linkLineWidth,valueFormat:Y.valueFormat,valueSuffix:Y.valueSuffix,sankey:Y.sankey,parent:Y,interactionState:Y.interactionState,flow:J.flow}}function S(){return function(Y){if(Y.link.circular)return J=Y.link,re=J.width/2,U=J.circularPathData,J.circularLinkType==="top"?"M "+U.targetX+" "+(U.targetY+re)+" L"+U.rightInnerExtent+" "+(U.targetY+re)+"A"+(U.rightLargeArcRadius+re)+" "+(U.rightSmallArcRadius+re)+" 0 0 1 "+(U.rightFullExtent-re)+" "+(U.targetY-U.rightSmallArcRadius)+"L"+(U.rightFullExtent-re)+" "+U.verticalRightInnerExtent+"A"+(U.rightLargeArcRadius+re)+" "+(U.rightLargeArcRadius+re)+" 0 0 1 "+U.rightInnerExtent+" "+(U.verticalFullExtent-re)+"L"+U.leftInnerExtent+" "+(U.verticalFullExtent-re)+"A"+(U.leftLargeArcRadius+re)+" "+(U.leftLargeArcRadius+re)+" 0 0 1 "+(U.leftFullExtent+re)+" "+U.verticalLeftInnerExtent+"L"+(U.leftFullExtent+re)+" "+(U.sourceY-U.leftSmallArcRadius)+"A"+(U.leftLargeArcRadius+re)+" "+(U.leftSmallArcRadius+re)+" 0 0 1 "+U.leftInnerExtent+" "+(U.sourceY+re)+"L"+U.sourceX+" "+(U.sourceY+re)+"L"+U.sourceX+" "+(U.sourceY-re)+"L"+U.leftInnerExtent+" "+(U.sourceY-re)+"A"+(U.leftLargeArcRadius-re)+" "+(U.leftSmallArcRadius-re)+" 0 0 0 "+(U.leftFullExtent-re)+" "+(U.sourceY-U.leftSmallArcRadius)+"L"+(U.leftFullExtent-re)+" "+U.verticalLeftInnerExtent+"A"+(U.leftLargeArcRadius-re)+" "+(U.leftLargeArcRadius-re)+" 0 0 0 "+U.leftInnerExtent+" "+(U.verticalFullExtent+re)+"L"+U.rightInnerExtent+" "+(U.verticalFullExtent+re)+"A"+(U.rightLargeArcRadius-re)+" "+(U.rightLargeArcRadius-re)+" 0 0 0 "+(U.rightFullExtent+re)+" "+U.verticalRightInnerExtent+"L"+(U.rightFullExtent+re)+" "+(U.targetY-U.rightSmallArcRadius)+"A"+(U.rightLargeArcRadius-re)+" "+(U.rightSmallArcRadius-re)+" 0 0 0 "+U.rightInnerExtent+" "+(U.targetY-re)+"L"+U.targetX+" "+(U.targetY-re)+"Z":"M "+U.targetX+" "+(U.targetY-re)+" L"+U.rightInnerExtent+" "+(U.targetY-re)+"A"+(U.rightLargeArcRadius+re)+" "+(U.rightSmallArcRadius+re)+" 0 0 0 "+(U.rightFullExtent-re)+" "+(U.targetY+U.rightSmallArcRadius)+"L"+(U.rightFullExtent-re)+" "+U.verticalRightInnerExtent+"A"+(U.rightLargeArcRadius+re)+" "+(U.rightLargeArcRadius+re)+" 0 0 0 "+U.rightInnerExtent+" "+(U.verticalFullExtent+re)+"L"+U.leftInnerExtent+" "+(U.verticalFullExtent+re)+"A"+(U.leftLargeArcRadius+re)+" "+(U.leftLargeArcRadius+re)+" 0 0 0 "+(U.leftFullExtent+re)+" "+U.verticalLeftInnerExtent+"L"+(U.leftFullExtent+re)+" "+(U.sourceY+U.leftSmallArcRadius)+"A"+(U.leftLargeArcRadius+re)+" "+(U.leftSmallArcRadius+re)+" 0 0 0 "+U.leftInnerExtent+" "+(U.sourceY-re)+"L"+U.sourceX+" "+(U.sourceY-re)+"L"+U.sourceX+" "+(U.sourceY+re)+"L"+U.leftInnerExtent+" "+(U.sourceY+re)+"A"+(U.leftLargeArcRadius-re)+" "+(U.leftSmallArcRadius-re)+" 0 0 1 "+(U.leftFullExtent-re)+" "+(U.sourceY+U.leftSmallArcRadius)+"L"+(U.leftFullExtent-re)+" "+U.verticalLeftInnerExtent+"A"+(U.leftLargeArcRadius-re)+" "+(U.leftLargeArcRadius-re)+" 0 0 1 "+U.leftInnerExtent+" "+(U.verticalFullExtent-re)+"L"+U.rightInnerExtent+" "+(U.verticalFullExtent-re)+"A"+(U.rightLargeArcRadius-re)+" "+(U.rightLargeArcRadius-re)+" 0 0 1 "+(U.rightFullExtent+re)+" "+U.verticalRightInnerExtent+"L"+(U.rightFullExtent+re)+" "+(U.targetY+U.rightSmallArcRadius)+"A"+(U.rightLargeArcRadius-re)+" "+(U.rightSmallArcRadius-re)+" 0 0 1 "+U.rightInnerExtent+" "+(U.targetY+re)+"L"+U.targetX+" "+(U.targetY+re)+"Z";var J,re,U,V=Y.link.source.x1,H=Y.link.target.x0,ne=a(V,H),q=ne(.5),Q=ne(.5),ee=Y.link.y0-Y.link.width/2,ie=Y.link.y0+Y.link.width/2,ae=Y.link.y1-Y.link.width/2,ue=Y.link.y1+Y.link.width/2;return"M"+V+","+ee+"C"+q+","+ee+" "+Q+","+ae+" "+H+","+ae+"L"+H+","+ue+"C"+Q+","+ue+" "+q+","+ie+" "+V+","+ie+"Z"}}function P(Y,J){var re=u(J.color),U=s.nodePadAcross,V=Y.nodePad/2;J.dx=J.x1-J.x0,J.dy=J.y1-J.y0;var H=J.dx,ne=Math.max(.5,J.dy),q="node_"+J.pointNumber;return J.group&&(q=m.randstr()),J.trace=Y.trace,J.curveNumber=Y.trace.index,{index:J.pointNumber,key:q,partOfGroup:J.partOfGroup||!1,group:J.group,traceId:Y.key,trace:Y.trace,node:J,nodePad:Y.nodePad,nodeLineColor:Y.nodeLineColor,nodeLineWidth:Y.nodeLineWidth,textFont:Y.textFont,size:Y.horizontal?Y.height:Y.width,visibleWidth:Math.ceil(H),visibleHeight:ne,zoneX:-U,zoneY:-V,zoneWidth:H+2*U,zoneHeight:ne+2*V,labelY:Y.horizontal?J.dy/2+1:J.dx/2+1,left:J.originalLayer===1,sizeAcross:Y.width,forceLayouts:Y.forceLayouts,horizontal:Y.horizontal,darkBackground:re.getBrightness()<=128,tinyColorHue:h.tinyRGB(re),tinyColorAlpha:re.getAlpha(),valueFormat:Y.valueFormat,valueSuffix:Y.valueSuffix,sankey:Y.sankey,graph:Y.graph,arrangement:Y.arrangement,uniqueNodeLabelPathId:[Y.guid,Y.key,q].join("_"),interactionState:Y.interactionState,figure:Y}}function L(Y){Y.attr("transform",function(J){return p(J.node.x0.toFixed(3),J.node.y0.toFixed(3))})}function R(Y){Y.call(L)}function F(Y,J){Y.call(R),J.attr("d",S())}function D(Y){Y.attr("width",function(J){return J.node.x1-J.node.x0}).attr("height",function(J){return J.visibleHeight})}function O(Y){return Y.link.width>1||Y.linkLineWidth>0}function N(Y){return p(Y.translateX,Y.translateY)+(Y.horizontal?"matrix(1 0 0 1 0 0)":"matrix(0 1 1 0 0 0)")}function B(Y,J,re){Y.on(".basic",null).on("mouseover.basic",function(U){U.interactionState.dragInProgress||U.partOfGroup||(re.hover(this,U,J),U.interactionState.hovered=[this,U])}).on("mousemove.basic",function(U){U.interactionState.dragInProgress||U.partOfGroup||(re.follow(this,U),U.interactionState.hovered=[this,U])}).on("mouseout.basic",function(U){U.interactionState.dragInProgress||U.partOfGroup||(re.unhover(this,U,J),U.interactionState.hovered=!1)}).on("click.basic",function(U){U.interactionState.hovered&&(re.unhover(this,U,J),U.interactionState.hovered=!1),U.interactionState.dragInProgress||U.partOfGroup||re.select(this,U,J)})}function W(Y,J,re,U){var V=l.behavior.drag().origin(function(H){return{x:H.node.x0+H.visibleWidth/2,y:H.node.y0+H.visibleHeight/2}}).on("dragstart",function(H){if(H.arrangement!=="fixed"&&(m.ensureSingle(U._fullLayout._infolayer,"g","dragcover",function(q){U._fullLayout._dragCover=q}),m.raiseToTop(this),H.interactionState.dragInProgress=H.node,K(H.node),H.interactionState.hovered&&(re.nodeEvents.unhover.apply(0,H.interactionState.hovered),H.interactionState.hovered=!1),H.arrangement==="snap")){var ne=H.traceId+"|"+H.key;H.forceLayouts[ne]?H.forceLayouts[ne].alpha(1):function(q,Q,ee,ie){(function(ue){for(var le=0;le0&&fe.forceLayouts[le].alpha(0)}}(0,Q,ae,ee)).stop()}(0,ne,H),function(q,Q,ee,ie,ae){window.requestAnimationFrame(function ue(){var le;for(le=0;le0)window.requestAnimationFrame(ue);else{var ge=ee.node.originalX;ee.node.x0=ge-ee.visibleWidth/2,ee.node.x1=ge+ee.visibleWidth/2,G(ee,ae)}})}(Y,J,H,ne,U)}}).on("drag",function(H){if(H.arrangement!=="fixed"){var ne=l.event.x,q=l.event.y;H.arrangement==="snap"?(H.node.x0=ne-H.visibleWidth/2,H.node.x1=ne+H.visibleWidth/2,H.node.y0=q-H.visibleHeight/2,H.node.y1=q+H.visibleHeight/2):(H.arrangement==="freeform"&&(H.node.x0=ne-H.visibleWidth/2,H.node.x1=ne+H.visibleWidth/2),q=Math.max(0,Math.min(H.size-H.visibleHeight/2,q)),H.node.y0=q-H.visibleHeight/2,H.node.y1=q+H.visibleHeight/2),K(H.node),H.arrangement!=="snap"&&(H.sankey.update(H.graph),F(Y.filter(te(H)),J))}}).on("dragend",function(H){if(H.arrangement!=="fixed"){H.interactionState.dragInProgress=!1;for(var ne=0;neb&&W[w].gap;)w--;for(T=W[w].s,k=W.length-1;k>w;k--)W[k].s=T;for(;bR[p]&&p=0;i--){var s=r[i];if(s.type==="scatter"&&s.xaxis===l.xaxis&&s.yaxis===l.yaxis){s.opacity=void 0;break}}}}}},{}],934:[function(t,o,f){var r=t("../../lib"),a=t("../../registry"),l=t("./attributes"),c=t("./constants"),i=t("./subtypes"),s=t("./xy_defaults"),u=t("./period_defaults"),h=t("./stack_defaults"),d=t("./marker_defaults"),m=t("./line_defaults"),p=t("./line_shape_defaults"),g=t("./text_defaults"),y=t("./fillcolor_defaults"),v=t("../../lib").coercePattern;o.exports=function(x,_,A,b){function k(R,F){return r.coerce(x,_,l,R,F)}var w=s(x,_,b,k);if(w||(_.visible=!1),_.visible){u(x,_,b,k),k("xhoverformat"),k("yhoverformat");var M=h(x,_,b,k),T=!M&&w=Math.min(ge,fe)&&x<=Math.max(ge,fe)?0:1/0}var me=Math.max(3,le.mrc||0),_e=1-1/me,Ae=Math.abs(y.c2p(le.x)-x);return Ae=Math.min(ge,fe)&&_<=Math.max(ge,fe)?0:1/0}var me=Math.max(3,le.mrc||0),_e=1-1/me,Ae=Math.abs(v.c2p(le.y)-_);return Aeae!=(U=K[W][1])>=ae&&(Y=K[W-1][0],J=K[W][0],U-re&&(te=Y+(J-Y)*(ae-re)/(U-re),q=Math.min(q,te),Q=Math.max(Q,te)));q=Math.max(q,0),Q=Math.min(Q,y._length);var ue=i.defaultLine;return i.opacity(g.fillcolor)?ue=g.fillcolor:i.opacity((g.line||{}).color)&&(ue=g.line.color),r.extendFlat(u,{distance:u.maxHoverDistance,x0:q,x1:Q,y0:ae,y1:ae,color:ue,hovertemplate:!1}),delete u.index,g.text&&!Array.isArray(g.text)?u.text=String(g.text):u.text=g.name,[u]}}}},{"../../components/color":366,"../../components/fx":406,"../../lib":503,"../../registry":638,"./get_trace_color":937}],939:[function(t,o,f){var r=t("./subtypes");o.exports={hasLines:r.hasLines,hasMarkers:r.hasMarkers,hasText:r.hasText,isBubble:r.isBubble,attributes:t("./attributes"),supplyDefaults:t("./defaults"),crossTraceDefaults:t("./cross_trace_defaults"),calc:t("./calc").calc,crossTraceCalc:t("./cross_trace_calc"),arraysToCalcdata:t("./arrays_to_calcdata"),plot:t("./plot"),colorbar:t("./marker_colorbar"),formatLabels:t("./format_labels"),style:t("./style").style,styleOnSelect:t("./style").styleOnSelect,hoverPoints:t("./hover"),selectPoints:t("./select"),animatable:!0,moduleType:"trace",name:"scatter",basePlotModule:t("../../plots/cartesian"),categories:["cartesian","svg","symbols","errorBarsOK","showLegend","scatter-like","zoomScale"],meta:{}}},{"../../plots/cartesian":568,"./arrays_to_calcdata":926,"./attributes":927,"./calc":928,"./cross_trace_calc":932,"./cross_trace_defaults":933,"./defaults":934,"./format_labels":936,"./hover":938,"./marker_colorbar":945,"./plot":948,"./select":949,"./style":951,"./subtypes":952}],940:[function(t,o,f){var r=t("../../lib").isArrayOrTypedArray,a=t("../../components/colorscale/helpers").hasColorscale,l=t("../../components/colorscale/defaults");o.exports=function(c,i,s,u,h,d){var m=(c.marker||{}).color;h("line.color",s),a(c,"line")?l(c,i,u,h,{prefix:"line.",cLetter:"c"}):h("line.color",!r(m)&&m||s),h("line.width"),(d||{}).noDash||h("line.dash")}},{"../../components/colorscale/defaults":376,"../../components/colorscale/helpers":377,"../../lib":503}],941:[function(t,o,f){var r=t("../../constants/numerical"),a=r.BADNUM,l=r.LOG_CLIP,c=l+.5,i=l-.5,s=t("../../lib"),u=s.segmentsIntersect,h=s.constrain,d=t("./constants");o.exports=function(m,p){var g,y,v,x,_,A,b,k,w,M,T,E,S,P,L,R,F,D,O=p.xaxis,N=p.yaxis,B=O.type==="log",W=N.type==="log",G=O._length,K=N._length,te=p.connectGaps,Y=p.baseTolerance,J=p.shape,re=J==="linear",U=p.fill&&p.fill!=="none",V=[],H=d.minTolerance,ne=m.length,q=new Array(ne),Q=0;function ee(Ye){var nt=m[Ye];if(!nt)return!1;var ft=p.linearized?O.l2p(nt.x):O.c2p(nt.x),yt=p.linearized?N.l2p(nt.y):N.c2p(nt.y);if(ft===a){if(B&&(ft=O.c2p(nt.x,!0)),ft===a)return!1;W&&yt===a&&(ft*=Math.abs(O._m*K*(O._m>0?c:i)/(N._m*G*(N._m>0?c:i)))),ft*=1e3}if(yt===a){if(W&&(yt=N.c2p(nt.y,!0)),yt===a)return!1;yt*=1e3}return[ft,yt]}function ie(Ye,nt,ft,yt){var Ot=ft-Ye,Tt=yt-nt,at=.5-Ye,et=.5-nt,Lt=Ot*Ot+Tt*Tt,Wt=Ot*at+Tt*et;if(Wt>0&&Wtve||Ye[1]we)return[h(Ye[0],de,ve),h(Ye[1],Me,we)]}function ze(Ye,nt){return Ye[0]===nt[0]&&(Ye[0]===de||Ye[0]===ve)||Ye[1]===nt[1]&&(Ye[1]===Me||Ye[1]===we)||void 0}function $e(Ye,nt,ft){return function(yt,Ot){var Tt=Fe(yt),at=Fe(Ot),et=[];if(Tt&&at&&ze(Tt,at))return et;Tt&&et.push(Tt),at&&et.push(at);var Lt=2*s.constrain((yt[Ye]+Ot[Ye])/2,nt,ft)-((Tt||yt)[Ye]+(at||Ot)[Ye]);return Lt&&((Tt&&at?Lt>0==Tt[Ye]>at[Ye]?Tt:at:Tt||at)[Ye]+=Lt),et}}function Ke(Ye){var nt=Ye[0],ft=Ye[1],yt=nt===q[Q-1][0],Ot=ft===q[Q-1][1];if(!yt||!Ot)if(Q>1){var Tt=nt===q[Q-2][0],at=ft===q[Q-2][1];yt&&(nt===de||nt===ve)&&Tt?at?Q--:q[Q-1]=Ye:Ot&&(ft===Me||ft===we)&&at?Tt?Q--:q[Q-1]=Ye:q[Q++]=Ye}else q[Q++]=Ye}function Re(Ye){q[Q-1][0]!==Ye[0]&&q[Q-1][1]!==Ye[1]&&Ke([fe,me]),Ke(Ye),_e=null,fe=me=0}function Ve(Ye){if(F=Ye[0]/G,D=Ye[1]/K,le=Ye[0]ve?ve:0,ge=Ye[1]we?we:0,le||ge){if(Q)if(_e){var nt=ke(_e,Ye);nt.length>1&&(Re(nt[0]),q[Q++]=nt[1])}else Ae=ke(q[Q-1],Ye)[0],q[Q++]=Ae;else q[Q++]=[le||Ye[0],ge||Ye[1]];var ft=q[Q-1];le&&ge&&(ft[0]!==le||ft[1]!==ge)?(_e&&(fe!==le&&me!==ge?Ke(fe&&me?(yt=_e,Tt=(Ot=Ye)[0]-yt[0],at=(Ot[1]-yt[1])/Tt,(yt[1]*Ot[0]-Ot[1]*yt[0])/Tt>0?[at>0?de:ve,we]:[at>0?ve:de,Me]):[fe||le,me||ge]):fe&&me&&Ke([fe,me])),Ke([le,ge])):fe-le&&me-ge&&Ke([le||fe,ge||me]),_e=Ye,fe=le,me=ge}else _e&&Re(ke(_e,Ye)[0]),q[Q++]=Ye;var yt,Ot,Tt,at}for(J==="linear"||J==="spline"?ke=function(Ye,nt){for(var ft=[],yt=0,Ot=0;Ot<4;Ot++){var Tt=Ce[Ot],at=u(Ye[0],Ye[1],nt[0],nt[1],Tt[0],Tt[1],Tt[2],Tt[3]);at&&(!yt||Math.abs(at.x-ft[0][0])>1||Math.abs(at.y-ft[0][1])>1)&&(at=[at.x,at.y],yt&&ue(at,Ye)ae(A,We))break;v=A,(S=w[0]*k[0]+w[1]*k[1])>T?(T=S,x=A,b=!1):S=m.length||!A)break;Ve(A),y=A}}else Ve(x)}_e&&Ke([fe||_e[0],me||_e[1]]),V.push(q.slice(0,Q))}return V}},{"../../constants/numerical":479,"../../lib":503,"./constants":931}],942:[function(t,o,f){o.exports=function(r,a,l){l("line.shape")==="spline"&&l("line.smoothing")}},{}],943:[function(t,o,f){var r={tonextx:1,tonexty:1,tonext:1};o.exports=function(a,l,c){var i,s,u,h,d,m={},p=!1,g=-1,y=0,v=-1;for(s=0;s=0?d=v:(d=v=y,y++),d0?Math.max(d,s):0}}},{"fast-isnumeric":190}],945:[function(t,o,f){o.exports={container:"marker",min:"cmin",max:"cmax"}},{}],946:[function(t,o,f){var r=t("../../components/color"),a=t("../../components/colorscale/helpers").hasColorscale,l=t("../../components/colorscale/defaults"),c=t("./subtypes");o.exports=function(i,s,u,h,d,m){var p=c.isBubble(i),g=(i.line||{}).color;m=m||{},g&&(u=g),d("marker.symbol"),d("marker.opacity",p?.7:1),d("marker.size"),d("marker.color",u),a(i,"marker")&&l(i,s,h,d,{prefix:"marker.",cLetter:"c"}),m.noSelect||(d("selected.marker.color"),d("unselected.marker.color"),d("selected.marker.size"),d("unselected.marker.size")),m.noLine||(d("marker.line.color",g&&!Array.isArray(g)&&s.marker.color!==g?g:p?r.background:r.defaultLine),a(i,"marker.line")&&l(i,s,h,d,{prefix:"marker.line.",cLetter:"c"}),d("marker.line.width",p?1:0)),p&&(d("marker.sizeref"),d("marker.sizemin"),d("marker.sizemode")),m.gradient&&d("marker.gradient.type")!=="none"&&d("marker.gradient.color")}},{"../../components/color":366,"../../components/colorscale/defaults":376,"../../components/colorscale/helpers":377,"./subtypes":952}],947:[function(t,o,f){var r=t("../../lib").dateTick0,a=t("../../constants/numerical").ONEWEEK;function l(c,i){return r(i,c%a==0?1:0)}o.exports=function(c,i,s,u,h){if(h||(h={x:!0,y:!0}),h.x){var d=u("xperiod");d&&(u("xperiod0",l(d,i.xcalendar)),u("xperiodalignment"))}if(h.y){var m=u("yperiod");m&&(u("yperiod0",l(m,i.ycalendar)),u("yperiodalignment"))}}},{"../../constants/numerical":479,"../../lib":503}],948:[function(t,o,f){var r=t("@plotly/d3"),a=t("../../registry"),l=t("../../lib"),c=l.ensureSingle,i=l.identity,s=t("../../components/drawing"),u=t("./subtypes"),h=t("./line_points"),d=t("./link_traces"),m=t("../../lib/polygon").tester;function p(g,y,v,x,_,A,b){var k;(function(ve,Me,we,Ce,Fe){var ze=we.xaxis,$e=we.yaxis,Ke=r.extent(l.simpleMap(ze.range,ze.r2c)),Re=r.extent(l.simpleMap($e.range,$e.r2c)),Ve=Ce[0].trace;if(u.hasMarkers(Ve)){var We=Ve.marker.maxdisplayed;if(We!==0){var Ye=Ce.filter(function(Ot){return Ot.x>=Ke[0]&&Ot.x<=Ke[1]&&Ot.y>=Re[0]&&Ot.y<=Re[1]}),nt=Math.ceil(Ye.length/We),ft=0;Fe.forEach(function(Ot,Tt){var at=Ot[0].trace;u.hasMarkers(at)&&at.marker.maxdisplayed>0&&Tt0;function M(ve){return w?ve.transition():ve}var T=v.xaxis,E=v.yaxis,S=x[0].trace,P=S.line,L=r.select(A),R=c(L,"g","errorbars"),F=c(L,"g","lines"),D=c(L,"g","points"),O=c(L,"g","text");if(a.getComponentMethod("errorbars","plot")(g,R,v,b),S.visible===!0){var N,B;M(L).style("opacity",S.opacity);var W=S.fill.charAt(S.fill.length-1);W!=="x"&&W!=="y"&&(W=""),x[0][v.isRangePlot?"nodeRangePlot3":"node3"]=L;var G,K,te="",Y=[],J=S._prevtrace;J&&(te=J._prevRevpath||"",B=J._nextFill,Y=J._polygons);var re,U,V,H,ne,q,Q,ee="",ie="",ae=[],ue=l.noop;if(N=S._ownFill,u.hasLines(S)||S.fill!=="none"){for(B&&B.datum(x),["hv","vh","hvh","vhv"].indexOf(P.shape)!==-1?(re=s.steps(P.shape),U=s.steps(P.shape.split("").reverse().join(""))):re=U=P.shape==="spline"?function(ve){var Me=ve[ve.length-1];return ve.length>1&&ve[0][0]===Me[0]&&ve[0][1]===Me[1]?s.smoothclosed(ve.slice(1),P.smoothing):s.smoothopen(ve,P.smoothing)}:function(ve){return"M"+ve.join("L")},V=function(ve){return U(ve.reverse())},ae=h(x,{xaxis:T,yaxis:E,connectGaps:S.connectgaps,baseTolerance:Math.max(P.width||1,3)/4,shape:P.shape,simplify:P.simplify,fill:S.fill}),Q=S._polygons=new Array(ae.length),k=0;k1){var we=r.select(this);if(we.datum(x),ve)M(we.style("opacity",0).attr("d",G).call(s.lineGroupStyle)).style("opacity",1);else{var Ce=M(we);Ce.attr("d",G),s.singleLineStyle(x,Ce)}}}}}var le=F.selectAll(".js-line").data(ae);M(le.exit()).style("opacity",0).remove(),le.each(ue(!1)),le.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(s.lineGroupStyle).each(ue(!0)),s.setClipUrl(le,v.layerClipId,g),ae.length?(N?(N.datum(x),H&&q&&(W?(W==="y"?H[1]=q[1]=E.c2p(0,!0):W==="x"&&(H[0]=q[0]=T.c2p(0,!0)),M(N).attr("d","M"+q+"L"+H+"L"+ee.substr(1)).call(s.singleFillStyle,g)):M(N).attr("d",ee+"Z").call(s.singleFillStyle,g))):B&&(S.fill.substr(0,6)==="tonext"&&ee&&te?(S.fill==="tonext"?M(B).attr("d",ee+"Z"+te+"Z").call(s.singleFillStyle,g):M(B).attr("d",ee+"L"+te.substr(1)+"Z").call(s.singleFillStyle,g),S._polygons=S._polygons.concat(Y)):(fe(B),S._polygons=null)),S._prevRevpath=ie,S._prevPolygons=Q):(N?fe(N):B&&fe(B),S._polygons=S._prevRevpath=S._prevPolygons=null),D.datum(x),O.datum(x),function(ve,Me,we){var Ce,Fe=we[0].trace,ze=u.hasMarkers(Fe),$e=u.hasText(Fe),Ke=Le(Fe),Re=de,Ve=de;if(ze||$e){var We=i,Ye=Fe.stackgroup,nt=Ye&&g._fullLayout._scatterStackOpts[T._id+E._id][Ye].stackgaps==="infer zero";Fe.marker.maxdisplayed||Fe._needsCull?We=nt?_e:me:Ye&&!nt&&(We=Ae),ze&&(Re=We),$e&&(Ve=We)}var ft,yt=(Ce=ve.selectAll("path.point").data(Re,Ke)).enter().append("path").classed("point",!0);w&&yt.call(s.pointStyle,Fe,g).call(s.translatePoints,T,E).style("opacity",0).transition().style("opacity",1),Ce.order(),ze&&(ft=s.makePointStyleFns(Fe)),Ce.each(function(Ot){var Tt=r.select(this),at=M(Tt);s.translatePoint(Ot,at,T,E)?(s.singlePointStyle(Ot,at,Fe,ft,g),v.layerClipId&&s.hideOutsideRangePoint(Ot,at,T,E,Fe.xcalendar,Fe.ycalendar),Fe.customdata&&Tt.classed("plotly-customdata",Ot.data!==null&&Ot.data!==void 0)):at.remove()}),w?Ce.exit().transition().style("opacity",0).remove():Ce.exit().remove(),(Ce=Me.selectAll("g").data(Ve,Ke)).enter().append("g").classed("textpoint",!0).append("text"),Ce.order(),Ce.each(function(Ot){var Tt=r.select(this),at=M(Tt.select("text"));s.translatePoint(Ot,at,T,E)?v.layerClipId&&s.hideOutsideRangePoint(Ot,Tt,T,E,Fe.xcalendar,Fe.ycalendar):Tt.remove()}),Ce.selectAll("text").call(s.textPointStyle,Fe,g).each(function(Ot){var Tt=T.c2p(Ot.x),at=E.c2p(Ot.y);r.select(this).selectAll("tspan.line").each(function(){M(r.select(this)).attr({x:Tt,y:at})})}),Ce.exit().remove()}(D,O,x);var ge=S.cliponaxis===!1?null:v.layerClipId;s.setClipUrl(D,ge,g),s.setClipUrl(O,ge,g)}function fe(ve){M(ve).attr("d","M0,0Z")}function me(ve){return ve.filter(function(Me){return!Me.gap&&Me.vis})}function _e(ve){return ve.filter(function(Me){return Me.vis})}function Ae(ve){return ve.filter(function(Me){return!Me.gap})}function ke(ve){return ve.id}function Le(ve){if(ve.ids)return ke}function de(){return!1}}o.exports=function(g,y,v,x,_,A){var b,k,w=!_,M=!!_&&_.duration>0,T=d(g,y,v);(b=x.selectAll("g.trace").data(T,function(E){return E[0].trace.uid})).enter().append("g").attr("class",function(E){return"trace scatter trace"+E[0].trace.uid}).style("stroke-miterlimit",2),b.order(),function(E,S,P){S.each(function(L){var R=c(r.select(this),"g","fills");s.setClipUrl(R,P.layerClipId,E);var F=L[0].trace,D=[];F._ownfill&&D.push("_ownFill"),F._nexttrace&&D.push("_nextFill");var O=R.selectAll("g").data(D,i);O.enter().append("g"),O.exit().each(function(N){F[N]=null}).remove(),O.order().each(function(N){F[N]=c(r.select(this),"path","js-fill")})})}(g,b,y),M?(A&&(k=A()),r.transition().duration(_.duration).ease(_.easing).each("end",function(){k&&k()}).each("interrupt",function(){k&&k()}).each(function(){x.selectAll("g.trace").each(function(E,S){p(g,S,y,E,T,this,_)})})):b.each(function(E,S){p(g,S,y,E,T,this,_)}),w&&b.exit().remove(),x.selectAll("path:not([d])").remove()}},{"../../components/drawing":388,"../../lib":503,"../../lib/polygon":515,"../../registry":638,"./line_points":941,"./link_traces":943,"./subtypes":952,"@plotly/d3":58}],949:[function(t,o,f){var r=t("./subtypes");o.exports=function(a,l){var c,i,s,u,h=a.cd,d=a.xaxis,m=a.yaxis,p=[],g=h[0].trace;if(!r.hasMarkers(g)&&!r.hasText(g))return[];if(l===!1)for(c=0;c0){var v=s.c2l(g);s._lowerLogErrorBound||(s._lowerLogErrorBound=v),s._lowerErrorBound=Math.min(s._lowerLogErrorBound,v)}}else h[d]=[-m[0]*i,m[1]*i]}return h}o.exports=function(l,c,i){var s=[a(l.x,l.error_x,c[0],i.xaxis),a(l.y,l.error_y,c[1],i.yaxis),a(l.z,l.error_z,c[2],i.zaxis)],u=function(y){for(var v=0;v-1?-1:P.indexOf("right")>-1?1:0}function b(P){return P==null?0:P.indexOf("top")>-1?-1:P.indexOf("bottom")>-1?1:0}function k(P,L){return L(4*P)}function w(P){return p[P]}function M(P,L,R,F,D){var O=null;if(s.isArrayOrTypedArray(P)){O=[];for(var N=0;N=0){var G=function(K,te,Y){var J,re=(Y+1)%3,U=(Y+2)%3,V=[],H=[];for(J=0;J=0&&g("surfacecolor",y||v);for(var x=["x","y","z"],_=0;_<3;++_){var A="projection."+x[_];g(A+".show")&&(g(A+".opacity"),g(A+".scale"))}var b=r.getComponentMethod("errorbars","supplyDefaults");b(h,d,y||v||m,{axis:"z"}),b(h,d,y||v||m,{axis:"y",inherit:"z"}),b(h,d,y||v||m,{axis:"x",inherit:"z"})}else d.visible=!1}},{"../../lib":503,"../../registry":638,"../scatter/line_defaults":940,"../scatter/marker_defaults":946,"../scatter/subtypes":952,"../scatter/text_defaults":953,"./attributes":955}],960:[function(t,o,f){o.exports={plot:t("./convert"),attributes:t("./attributes"),markerSymbols:t("../../constants/gl3d_markers"),supplyDefaults:t("./defaults"),colorbar:[{container:"marker",min:"cmin",max:"cmax"},{container:"line",min:"cmin",max:"cmax"}],calc:t("./calc"),moduleType:"trace",name:"scatter3d",basePlotModule:t("../../plots/gl3d"),categories:["gl3d","symbols","showLegend","scatter-like"],meta:{}}},{"../../constants/gl3d_markers":477,"../../plots/gl3d":598,"./attributes":955,"./calc":956,"./convert":958,"./defaults":959}],961:[function(t,o,f){var r=t("../scatter/attributes"),a=t("../../plots/attributes"),l=t("../../plots/template_attributes").hovertemplateAttrs,c=t("../../plots/template_attributes").texttemplateAttrs,i=t("../../components/colorscale/attributes"),s=t("../../lib/extend").extendFlat,u=r.marker,h=r.line,d=u.line;o.exports={carpet:{valType:"string",editType:"calc"},a:{valType:"data_array",editType:"calc"},b:{valType:"data_array",editType:"calc"},mode:s({},r.mode,{dflt:"markers"}),text:s({},r.text,{}),texttemplate:c({editType:"plot"},{keys:["a","b","text"]}),hovertext:s({},r.hovertext,{}),line:{color:h.color,width:h.width,dash:h.dash,shape:s({},h.shape,{values:["linear","spline"]}),smoothing:h.smoothing,editType:"calc"},connectgaps:r.connectgaps,fill:s({},r.fill,{values:["none","toself","tonext"],dflt:"none"}),fillcolor:r.fillcolor,marker:s({symbol:u.symbol,opacity:u.opacity,maxdisplayed:u.maxdisplayed,size:u.size,sizeref:u.sizeref,sizemin:u.sizemin,sizemode:u.sizemode,line:s({width:d.width,editType:"calc"},i("marker.line")),gradient:u.gradient,editType:"calc"},i("marker")),textfont:r.textfont,textposition:r.textposition,selected:r.selected,unselected:r.unselected,hoverinfo:s({},a.hoverinfo,{flags:["a","b","text","name"]}),hoveron:r.hoveron,hovertemplate:l()}},{"../../components/colorscale/attributes":373,"../../lib/extend":493,"../../plots/attributes":550,"../../plots/template_attributes":633,"../scatter/attributes":927}],962:[function(t,o,f){var r=t("fast-isnumeric"),a=t("../scatter/colorscale_calc"),l=t("../scatter/arrays_to_calcdata"),c=t("../scatter/calc_selection"),i=t("../scatter/calc").calcMarkerSize,s=t("../carpet/lookup_carpetid");o.exports=function(u,h){var d=h._carpetTrace=s(u,h);if(d&&d.visible&&d.visible!=="legendonly"){var m;h.xaxis=d.xaxis,h.yaxis=d.yaxis;var p,g,y=h._length,v=new Array(y),x=!1;for(m=0;m")}return u}function k(w,M){var T;T=w.labelprefix&&w.labelprefix.length>0?w.labelprefix.replace(/ = $/,""):w._hovertitle,A.push(T+": "+M.toFixed(3)+w.labelsuffix)}}},{"../../lib":503,"../scatter/hover":938}],967:[function(t,o,f){o.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),colorbar:t("../scatter/marker_colorbar"),formatLabels:t("./format_labels"),calc:t("./calc"),plot:t("./plot"),style:t("../scatter/style").style,styleOnSelect:t("../scatter/style").styleOnSelect,hoverPoints:t("./hover"),selectPoints:t("../scatter/select"),eventData:t("./event_data"),moduleType:"trace",name:"scattercarpet",basePlotModule:t("../../plots/cartesian"),categories:["svg","carpet","symbols","showLegend","carpetDependent","zoomScale"],meta:{}}},{"../../plots/cartesian":568,"../scatter/marker_colorbar":945,"../scatter/select":949,"../scatter/style":951,"./attributes":961,"./calc":962,"./defaults":963,"./event_data":964,"./format_labels":965,"./hover":966,"./plot":968}],968:[function(t,o,f){var r=t("../scatter/plot"),a=t("../../plots/cartesian/axes"),l=t("../../components/drawing");o.exports=function(c,i,s,u){var h,d,m,p=s[0][0].carpet,g={xaxis:a.getFromId(c,p.xaxis||"x"),yaxis:a.getFromId(c,p.yaxis||"y"),plot:i.plot};for(r(c,g,s,u),h=0;h")}(m,_,s,d[0].t.labels),s.hovertemplate=m.hovertemplate,[s]}}},{"../../components/fx":406,"../../constants/numerical":479,"../../lib":503,"../scatter/get_trace_color":937,"./attributes":969}],975:[function(t,o,f){o.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),colorbar:t("../scatter/marker_colorbar"),formatLabels:t("./format_labels"),calc:t("./calc"),calcGeoJSON:t("./plot").calcGeoJSON,plot:t("./plot").plot,style:t("./style"),styleOnSelect:t("../scatter/style").styleOnSelect,hoverPoints:t("./hover"),eventData:t("./event_data"),selectPoints:t("./select"),moduleType:"trace",name:"scattergeo",basePlotModule:t("../../plots/geo"),categories:["geo","symbols","showLegend","scatter-like"],meta:{}}},{"../../plots/geo":589,"../scatter/marker_colorbar":945,"../scatter/style":951,"./attributes":969,"./calc":970,"./defaults":971,"./event_data":972,"./format_labels":973,"./hover":974,"./plot":976,"./select":977,"./style":978}],976:[function(t,o,f){var r=t("@plotly/d3"),a=t("../../lib"),l=t("../../lib/topojson_utils").getTopojsonFeatures,c=t("../../lib/geojson_utils"),i=t("../../lib/geo_location_utils"),s=t("../../plots/cartesian/autorange").findExtremes,u=t("../../constants/numerical").BADNUM,h=t("../scatter/calc").calcMarkerSize,d=t("../scatter/subtypes"),m=t("./style");o.exports={calcGeoJSON:function(p,g){var y,v,x=p[0].trace,_=g[x.geo],A=_._subplot,b=x._length;if(Array.isArray(x.locations)){var k=x.locationmode,w=k==="geojson-id"?i.extractTraceFeature(p):l(x,A.topojson);for(y=0;y=v,P=2*E,L={},R=w.makeCalcdata(A,"x"),F=M.makeCalcdata(A,"y"),D=i(A,w,"x",R),O=i(A,M,"y",F),N=D.vals,B=O.vals;A._x=N,A._y=B,A.xperiodalignment&&(A._origX=R,A._xStarts=D.starts,A._xEnds=D.ends),A.yperiodalignment&&(A._origY=F,A._yStarts=O.starts,A._yEnds=O.ends);var W=new Array(P),G=new Array(E);for(b=0;b1&&a.extendFlat(q.line,p.linePositions(J,U,V)),q.errorX||q.errorY){var Q=p.errorBarPositions(J,U,V,H,ne);q.errorX&&a.extendFlat(q.errorX,Q.x),q.errorY&&a.extendFlat(q.errorY,Q.y)}return q.text&&(a.extendFlat(q.text,{positions:V},p.textPosition(J,U,q.text,q.marker)),a.extendFlat(q.textSel,{positions:V},p.textPosition(J,U,q.text,q.markerSel)),a.extendFlat(q.textUnsel,{positions:V},p.textPosition(J,U,q.text,q.markerUnsel))),q}(_,0,A,W,N,B),Y=g(_,T);return d(k,A),S?te.marker&&(K=te.marker.sizeAvg||Math.max(te.marker.size,3)):K=u(A,E),h(_,A,w,M,N,B,K),te.errorX&&x(A,w,te.errorX),te.errorY&&x(A,M,te.errorY),te.fill&&!Y.fill2d&&(Y.fill2d=!0),te.marker&&!Y.scatter2d&&(Y.scatter2d=!0),te.line&&!Y.line2d&&(Y.line2d=!0),!te.errorX&&!te.errorY||Y.error2d||(Y.error2d=!0),te.text&&!Y.glText&&(Y.glText=!0),te.marker&&(te.marker.snap=E),Y.lineOptions.push(te.line),Y.errorXOptions.push(te.errorX),Y.errorYOptions.push(te.errorY),Y.fillOptions.push(te.fill),Y.markerOptions.push(te.marker),Y.markerSelectedOptions.push(te.markerSel),Y.markerUnselectedOptions.push(te.markerUnsel),Y.textOptions.push(te.text),Y.textSelectedOptions.push(te.textSel),Y.textUnselectedOptions.push(te.textUnsel),Y.selectBatch.push([]),Y.unselectBatch.push([]),L._scene=Y,L.index=Y.count,L.x=N,L.y=B,L.positions=W,Y.count++,[{x:!1,y:!1,t:L,trace:A}]}},{"../../constants/numerical":479,"../../lib":503,"../../plots/cartesian/align_period":551,"../../plots/cartesian/autorange":553,"../../plots/cartesian/axis_ids":558,"../scatter/calc":928,"../scatter/colorscale_calc":930,"./constants":982,"./convert":983,"./scene_update":991,"@plotly/point-cluster":59}],982:[function(t,o,f){o.exports={TOO_MANY_POINTS:1e5,SYMBOL_SDF_SIZE:200,SYMBOL_SIZE:20,SYMBOL_STROKE:1,DOT_RE:/-dot/,OPEN_RE:/-open/,DASHES:{solid:[1],dot:[1,1],dash:[4,1],longdash:[8,1],dashdot:[4,1,1,1],longdashdot:[8,1,1,1]}}},{}],983:[function(t,o,f){var r=t("fast-isnumeric"),a=t("svg-path-sdf"),l=t("color-normalize"),c=t("../../registry"),i=t("../../lib"),s=t("../../components/drawing"),u=t("../../plots/cartesian/axis_ids"),h=t("../../lib/gl_format_color").formatColor,d=t("../scatter/subtypes"),m=t("../scatter/make_bubble_size_func"),p=t("./helpers"),g=t("./constants"),y=t("../../constants/interactions").DESELECTDIM,v={start:1,left:1,end:-1,right:-1,middle:0,center:0,bottom:1,top:-1},x=t("../../components/fx/helpers").appendArrayPointValue;function _(R,F){var D,O=R._fullLayout,N=F._length,B=F.textfont,W=F.textposition,G=Array.isArray(W)?W:[W],K=B.color,te=B.size,Y=B.family,J={},re=R._context.plotGlPixelRatio,U=F.texttemplate;if(U){J.text=[];var V=O._d3locale,H=Array.isArray(U),ne=H?Math.min(U.length,N):N,q=H?function(ge){return U[ge]}:function(){return U};for(D=0;Dg.TOO_MANY_POINTS||d.hasMarkers(F)?"rect":"round";if(te&&F.connectgaps){var J=O[0],re=O[1];for(N=0;N1?K[N]:K[0]:K,U=Array.isArray(te)?te.length>1?te[N]:te[0]:te,V=v[re],H=v[U],ne=Y?Y/.8+1:0,q=-H*ne-.5*H;W.offset[N]=[V*ne/J,q/J]}}return W}}},{"../../components/drawing":388,"../../components/fx/helpers":402,"../../constants/interactions":478,"../../lib":503,"../../lib/gl_format_color":499,"../../plots/cartesian/axis_ids":558,"../../registry":638,"../scatter/make_bubble_size_func":944,"../scatter/subtypes":952,"./constants":982,"./helpers":987,"color-normalize":89,"fast-isnumeric":190,"svg-path-sdf":310}],984:[function(t,o,f){var r=t("../../lib"),a=t("../../registry"),l=t("./helpers"),c=t("./attributes"),i=t("../scatter/constants"),s=t("../scatter/subtypes"),u=t("../scatter/xy_defaults"),h=t("../scatter/period_defaults"),d=t("../scatter/marker_defaults"),m=t("../scatter/line_defaults"),p=t("../scatter/fillcolor_defaults"),g=t("../scatter/text_defaults");o.exports=function(y,v,x,_){function A(P,L){return r.coerce(y,v,c,P,L)}var b=!!y.marker&&l.isOpenSymbol(y.marker.symbol),k=s.isBubble(y),w=u(y,v,_,A);if(w){h(y,v,_,A),A("xhoverformat"),A("yhoverformat");var M=w100},f.isDotSymbol=function(a){return typeof a=="string"?r.DOT_RE.test(a):a>200}},{"./constants":982}],988:[function(t,o,f){var r=t("../../registry"),a=t("../../lib"),l=t("../scatter/get_trace_color");function c(i,s,u,h){var d=i.xa,m=i.ya,p=i.distance,g=i.dxy,y=i.index,v={pointNumber:y,x:s[y],y:u[y]};v.tx=Array.isArray(h.text)?h.text[y]:h.text,v.htx=Array.isArray(h.hovertext)?h.hovertext[y]:h.hovertext,v.data=Array.isArray(h.customdata)?h.customdata[y]:h.customdata,v.tp=Array.isArray(h.textposition)?h.textposition[y]:h.textposition;var x=h.textfont;x&&(v.ts=a.isArrayOrTypedArray(x.size)?x.size[y]:x.size,v.tc=Array.isArray(x.color)?x.color[y]:x.color,v.tf=Array.isArray(x.family)?x.family[y]:x.family);var _=h.marker;_&&(v.ms=a.isArrayOrTypedArray(_.size)?_.size[y]:_.size,v.mo=a.isArrayOrTypedArray(_.opacity)?_.opacity[y]:_.opacity,v.mx=a.isArrayOrTypedArray(_.symbol)?_.symbol[y]:_.symbol,v.mc=a.isArrayOrTypedArray(_.color)?_.color[y]:_.color);var A=_&&_.line;A&&(v.mlc=Array.isArray(A.color)?A.color[y]:A.color,v.mlw=a.isArrayOrTypedArray(A.width)?A.width[y]:A.width);var b=_&&_.gradient;b&&b.type!=="none"&&(v.mgt=Array.isArray(b.type)?b.type[y]:b.type,v.mgc=Array.isArray(b.color)?b.color[y]:b.color);var k=d.c2p(v.x,!0),w=m.c2p(v.y,!0),M=v.mrc||1,T=h.hoverlabel;T&&(v.hbg=Array.isArray(T.bgcolor)?T.bgcolor[y]:T.bgcolor,v.hbc=Array.isArray(T.bordercolor)?T.bordercolor[y]:T.bordercolor,v.hts=a.isArrayOrTypedArray(T.font.size)?T.font.size[y]:T.font.size,v.htc=Array.isArray(T.font.color)?T.font.color[y]:T.font.color,v.htf=Array.isArray(T.font.family)?T.font.family[y]:T.font.family,v.hnl=a.isArrayOrTypedArray(T.namelength)?T.namelength[y]:T.namelength);var E=h.hoverinfo;E&&(v.hi=Array.isArray(E)?E[y]:E);var S=h.hovertemplate;S&&(v.ht=Array.isArray(S)?S[y]:S);var P={};P[i.index]=v;var L=h._origX,R=h._origY,F=a.extendFlat({},i,{color:l(h,v),x0:k-M,x1:k+M,xLabelVal:L?L[y]:v.x,y0:w-M,y1:w+M,yLabelVal:R?R[y]:v.y,cd:P,distance:p,spikeDistance:g,hovertemplate:v.ht});return v.htx?F.text=v.htx:v.tx?F.text=v.tx:h.text&&(F.text=h.text),a.fillText(v,h,F),r.getComponentMethod("errorbars","hoverInfo")(v,h,F),F}o.exports={hoverPoints:function(i,s,u,h){var d,m,p,g,y,v,x,_,A,b,k=i.cd,w=k[0].t,M=k[0].trace,T=i.xa,E=i.ya,S=w.x,P=w.y,L=T.c2p(s),R=E.c2p(u),F=i.distance;if(w.tree){var D=T.p2c(L-F),O=T.p2c(L+F),N=E.p2c(R-F),B=E.p2c(R+F);d=h==="x"?w.tree.range(Math.min(D,O),Math.min(E._rl[0],E._rl[1]),Math.max(D,O),Math.max(E._rl[0],E._rl[1])):w.tree.range(Math.min(D,O),Math.min(N,B),Math.max(D,O),Math.max(N,B))}else d=w.ids;var W=F;if(h==="x"){var G=!!M.xperiodalignment,K=!!M.yperiodalignment;for(v=0;v=Math.min(te,Y)&&L<=Math.max(te,Y)?0:1/0}if(x=Math.min(J,re)&&R<=Math.max(J,re)?0:1/0}b=Math.sqrt(x*x+_*_),p=d[v]}}}else for(v=d.length-1;v>-1;v--)g=S[m=d[v]],y=P[m],x=T.c2p(g)-L,_=E.c2p(y)-R,(A=Math.sqrt(x*x+_*_))k.glText.length){var S=T-k.glText.length;for(_=0;_ie&&(isNaN(ee[ae])||isNaN(ee[ae+1]));)ae-=2;Q.positions=ee.slice(ie,ae+2)}return Q}),k.line2d.update(k.lineOptions)),k.error2d){var L=(k.errorXOptions||[]).concat(k.errorYOptions||[]);k.error2d.update(L)}k.scatter2d&&k.scatter2d.update(k.markerOptions),k.fillOrder=i.repeat(null,T),k.fill2d&&(k.fillOptions=k.fillOptions.map(function(Q,ee){var ie=x[ee];if(Q&&ie&&ie[0]&&ie[0].trace){var ae,ue,le=ie[0],ge=le.trace,fe=le.t,me=k.lineOptions[ee],_e=[];ge._ownfill&&_e.push(ee),ge._nexttrace&&_e.push(ee+1),_e.length&&(k.fillOrder[ee]=_e);var Ae,ke,Le=[],de=me&&me.positions||fe.positions;if(ge.fill==="tozeroy"){for(Ae=0;AeAe&&isNaN(de[ke+1]);)ke-=2;de[Ae+1]!==0&&(Le=[de[Ae],0]),Le=Le.concat(de.slice(Ae,ke+2)),de[ke+1]!==0&&(Le=Le.concat([de[ke],0]))}else if(ge.fill==="tozerox"){for(Ae=0;AeAe&&isNaN(de[ke]);)ke-=2;de[Ae]!==0&&(Le=[0,de[Ae+1]]),Le=Le.concat(de.slice(Ae,ke+2)),de[ke]!==0&&(Le=Le.concat([0,de[ke+1]]))}else if(ge.fill==="toself"||ge.fill==="tonext"){for(Le=[],ae=0,Q.splitNull=!0,ue=0;ue-1;for(_=0;_")}function _(A){return A+"°"}}o.exports={hoverPoints:function(u,h,d){var m=u.cd,p=m[0].trace,g=u.xa,y=u.ya,v=u.subplot,x=360*(h>=0?Math.floor((h+180)/360):Math.ceil((h-180)/360)),_=h-x;if(r.getClosest(m,function(P){var L=P.lonlat;if(L[0]===i)return 1/0;var R=a.modHalf(L[0],360),F=L[1],D=v.project([R,F]),O=D.x-g.c2p([_,F]),N=D.y-y.c2p([R,d]),B=Math.max(3,P.mrc||0);return Math.max(Math.sqrt(O*O+N*N)-B,1-3/B)},u),u.index!==!1){var A=m[u.index],b=A.lonlat,k=[a.modHalf(b[0],360)+x,b[1]],w=g.c2p(k),M=y.c2p(k),T=A.mrc||1;u.x0=w-T,u.x1=w+T,u.y0=M-T,u.y1=M+T;var E={};E[p.subplot]={_subplot:v};var S=p._module.formatLabels(A,p,E);return u.lonLabel=S.lonLabel,u.latLabel=S.latLabel,u.color=l(p,A),u.extraText=s(p,A,m[0].t.labels),u.hovertemplate=p.hovertemplate,[u]}},getExtraText:s}},{"../../components/fx":406,"../../constants/numerical":479,"../../lib":503,"../scatter/get_trace_color":937}],999:[function(t,o,f){o.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),colorbar:t("../scatter/marker_colorbar"),formatLabels:t("./format_labels"),calc:t("../scattergeo/calc"),plot:t("./plot"),hoverPoints:t("./hover").hoverPoints,eventData:t("./event_data"),selectPoints:t("./select"),styleOnSelect:function(r,a){a&&a[0].trace._glTrace.update(a)},moduleType:"trace",name:"scattermapbox",basePlotModule:t("../../plots/mapbox"),categories:["mapbox","gl","symbols","showLegend","scatter-like"],meta:{}}},{"../../plots/mapbox":613,"../scatter/marker_colorbar":945,"../scattergeo/calc":970,"./attributes":993,"./defaults":995,"./event_data":996,"./format_labels":997,"./hover":998,"./plot":1e3,"./select":1001}],1e3:[function(t,o,f){var r=t("./convert"),a=t("../../plots/mapbox/constants").traceLayerPrefix,l=["fill","line","circle","symbol"];function c(s,u){this.type="scattermapbox",this.subplot=s,this.uid=u,this.sourceIds={fill:"source-"+u+"-fill",line:"source-"+u+"-line",circle:"source-"+u+"-circle",symbol:"source-"+u+"-symbol"},this.layerIds={fill:a+u+"-fill",line:a+u+"-line",circle:a+u+"-circle",symbol:a+u+"-symbol"},this.below=null}var i=c.prototype;i.addSource=function(s,u){this.subplot.map.addSource(this.sourceIds[s],{type:"geojson",data:u.geojson})},i.setSourceData=function(s,u){this.subplot.map.getSource(this.sourceIds[s]).setData(u.geojson)},i.addLayer=function(s,u,h){this.subplot.addLayer({type:s,id:this.layerIds[s],source:this.sourceIds[s],layout:u.layout,paint:u.paint},h)},i.update=function(s){var u,h,d,m=this.subplot,p=m.map,g=r(m.gd,s),y=m.belowLookup["trace-"+this.uid];if(y!==this.below){for(u=l.length-1;u>=0;u--)h=l[u],p.removeLayer(this.layerIds[h]);for(u=0;u=0;u--){var h=l[u];s.removeLayer(this.layerIds[h]),s.removeSource(this.sourceIds[h])}},o.exports=function(s,u){for(var h=u[0].trace,d=new c(s,h.uid),m=r(s.gd,u),p=d.below=s.belowLookup["trace-"+h.uid],g=0;g")}}o.exports={hoverPoints:function(l,c,i,s){var u=r(l,c,i,s);if(u&&u[0].index!==!1){var h=u[0];if(h.index===void 0)return u;var d=l.subplot,m=h.cd[h.index],p=h.trace;if(d.isPtInside(m))return h.xLabelVal=void 0,h.yLabelVal=void 0,a(m,p,d,h),h.hovertemplate=p.hovertemplate,u}},makeHoverPointText:a}},{"../scatter/hover":938}],1007:[function(t,o,f){o.exports={moduleType:"trace",name:"scatterpolar",basePlotModule:t("../../plots/polar"),categories:["polar","symbols","showLegend","scatter-like"],attributes:t("./attributes"),supplyDefaults:t("./defaults").supplyDefaults,colorbar:t("../scatter/marker_colorbar"),formatLabels:t("./format_labels"),calc:t("./calc"),plot:t("./plot"),style:t("../scatter/style").style,styleOnSelect:t("../scatter/style").styleOnSelect,hoverPoints:t("./hover").hoverPoints,selectPoints:t("../scatter/select"),meta:{}}},{"../../plots/polar":622,"../scatter/marker_colorbar":945,"../scatter/select":949,"../scatter/style":951,"./attributes":1002,"./calc":1003,"./defaults":1004,"./format_labels":1005,"./hover":1006,"./plot":1008}],1008:[function(t,o,f){var r=t("../scatter/plot"),a=t("../../constants/numerical").BADNUM;o.exports=function(l,c,i){for(var s=c.layers.frontplot.select("g.scatterlayer"),u={xaxis:c.xaxis,yaxis:c.yaxis,plot:c.framework,layerClipId:c._hasClipOnAxisFalse?c.clipIds.forTraces:null},h=c.radialAxis,d=c.angularAxis,m=0;m=u&&(T.marker.cluster=b.tree),T.marker&&(T.markerSel.positions=T.markerUnsel.positions=T.marker.positions=P),T.line&&P.length>1&&s.extendFlat(T.line,i.linePositions(h,A,P)),T.text&&(s.extendFlat(T.text,{positions:P},i.textPosition(h,A,T.text,T.marker)),s.extendFlat(T.textSel,{positions:P},i.textPosition(h,A,T.text,T.markerSel)),s.extendFlat(T.textUnsel,{positions:P},i.textPosition(h,A,T.text,T.markerUnsel))),T.fill&&!y.fill2d&&(y.fill2d=!0),T.marker&&!y.scatter2d&&(y.scatter2d=!0),T.line&&!y.line2d&&(y.line2d=!0),T.text&&!y.glText&&(y.glText=!0),y.lineOptions.push(T.line),y.fillOptions.push(T.fill),y.markerOptions.push(T.marker),y.markerSelectedOptions.push(T.markerSel),y.markerUnselectedOptions.push(T.markerUnsel),y.textOptions.push(T.text),y.textSelectedOptions.push(T.textSel),y.textUnselectedOptions.push(T.textUnsel),y.selectBatch.push([]),y.unselectBatch.push([]),b.x=L,b.y=R,b.rawx=L,b.rawy=R,b.r=w,b.theta=M,b.positions=P,b._scene=y,b.index=y.count,y.count++}}),l(h,d,m)}},o.exports.reglPrecompiled={}},{"../../lib":503,"../scattergl/constants":982,"../scattergl/convert":983,"../scattergl/plot":990,"../scattergl/scene_update":991,"@plotly/point-cluster":59,"fast-isnumeric":190}],1017:[function(t,o,f){var r=t("../../plots/template_attributes").hovertemplateAttrs,a=t("../../plots/template_attributes").texttemplateAttrs,l=t("../../lib/extend").extendFlat,c=t("../scatter/attributes"),i=t("../../plots/attributes"),s=c.line;o.exports={mode:c.mode,real:{valType:"data_array",editType:"calc+clearAxisTypes"},imag:{valType:"data_array",editType:"calc+clearAxisTypes"},text:c.text,texttemplate:a({editType:"plot"},{keys:["real","imag","text"]}),hovertext:c.hovertext,line:{color:s.color,width:s.width,dash:s.dash,shape:l({},s.shape,{values:["linear","spline"]}),smoothing:s.smoothing,editType:"calc"},connectgaps:c.connectgaps,marker:c.marker,cliponaxis:l({},c.cliponaxis,{dflt:!1}),textposition:c.textposition,textfont:c.textfont,fill:l({},c.fill,{values:["none","toself","tonext"],dflt:"none"}),fillcolor:c.fillcolor,hoverinfo:l({},i.hoverinfo,{flags:["real","imag","text","name"]}),hoveron:c.hoveron,hovertemplate:r(),selected:c.selected,unselected:c.unselected}},{"../../lib/extend":493,"../../plots/attributes":550,"../../plots/template_attributes":633,"../scatter/attributes":927}],1018:[function(t,o,f){var r=t("fast-isnumeric"),a=t("../../constants/numerical").BADNUM,l=t("../scatter/colorscale_calc"),c=t("../scatter/arrays_to_calcdata"),i=t("../scatter/calc_selection"),s=t("../scatter/calc").calcMarkerSize;o.exports=function(u,h){for(var d=u._fullLayout,m=h.subplot,p=d[m].realaxis,g=d[m].imaginaryaxis,y=p.makeCalcdata(h,"real"),v=g.makeCalcdata(h,"imag"),x=h._length,_=new Array(x),A=0;A")}}o.exports={hoverPoints:function(l,c,i,s){var u=r(l,c,i,s);if(u&&u[0].index!==!1){var h=u[0];if(h.index===void 0)return u;var d=l.subplot,m=h.cd[h.index],p=h.trace;if(d.isPtInside(m))return h.xLabelVal=void 0,h.yLabelVal=void 0,a(m,p,d,h),h.hovertemplate=p.hovertemplate,u}},makeHoverPointText:a}},{"../scatter/hover":938}],1022:[function(t,o,f){o.exports={moduleType:"trace",name:"scattersmith",basePlotModule:t("../../plots/smith"),categories:["smith","symbols","showLegend","scatter-like"],attributes:t("./attributes"),supplyDefaults:t("./defaults"),colorbar:t("../scatter/marker_colorbar"),formatLabels:t("./format_labels"),calc:t("./calc"),plot:t("./plot"),style:t("../scatter/style").style,styleOnSelect:t("../scatter/style").styleOnSelect,hoverPoints:t("./hover").hoverPoints,selectPoints:t("../scatter/select"),meta:{}}},{"../../plots/smith":629,"../scatter/marker_colorbar":945,"../scatter/select":949,"../scatter/style":951,"./attributes":1017,"./calc":1018,"./defaults":1019,"./format_labels":1020,"./hover":1021,"./plot":1023}],1023:[function(t,o,f){var r=t("../scatter/plot"),a=t("../../constants/numerical").BADNUM,l=t("../../plots/smith/helpers").smith;o.exports=function(c,i,s){for(var u=i.layers.frontplot.select("g.scatterlayer"),h={xaxis:i.xaxis,yaxis:i.yaxis,plot:i.framework,layerClipId:i._hasClipOnAxisFalse?i.clipIds.forTraces:null},d=0;d"),u.hovertemplate=y.hovertemplate,s}function w(M,T){b.push(M._hovertitle+": "+T)}}},{"../scatter/hover":938}],1030:[function(t,o,f){o.exports={attributes:t("./attributes"),supplyDefaults:t("./defaults"),colorbar:t("../scatter/marker_colorbar"),formatLabels:t("./format_labels"),calc:t("./calc"),plot:t("./plot"),style:t("../scatter/style").style,styleOnSelect:t("../scatter/style").styleOnSelect,hoverPoints:t("./hover"),selectPoints:t("../scatter/select"),eventData:t("./event_data"),moduleType:"trace",name:"scatterternary",basePlotModule:t("../../plots/ternary"),categories:["ternary","symbols","showLegend","scatter-like"],meta:{}}},{"../../plots/ternary":634,"../scatter/marker_colorbar":945,"../scatter/select":949,"../scatter/style":951,"./attributes":1024,"./calc":1025,"./defaults":1026,"./event_data":1027,"./format_labels":1028,"./hover":1029,"./plot":1031}],1031:[function(t,o,f){var r=t("../scatter/plot");o.exports=function(a,l,c){var i=l.plotContainer;i.select(".scatterlayer").selectAll("*").remove();var s={xaxis:l.xaxis,yaxis:l.yaxis,plot:i,layerClipId:l._hasClipOnAxisFalse?l.clipIdRelative:null},u=l.layers.frontplot.select("g.scatterlayer");r(a,s,c,u)}},{"../scatter/plot":948}],1032:[function(t,o,f){var r=t("../scatter/attributes"),a=t("../../components/colorscale/attributes"),l=t("../../plots/cartesian/axis_format_attributes").axisHoverFormat,c=t("../../plots/template_attributes").hovertemplateAttrs,i=t("../scattergl/attributes"),s=t("../../plots/cartesian/constants").idRegex,u=t("../../plot_api/plot_template").templatedArray,h=t("../../lib/extend").extendFlat,d=r.marker,m=d.line,p=h(a("marker.line",{editTypeOverride:"calc"}),{width:h({},m.width,{editType:"calc"}),editType:"calc"}),g=h(a("marker"),{symbol:d.symbol,size:h({},d.size,{editType:"markerSize"}),sizeref:d.sizeref,sizemin:d.sizemin,sizemode:d.sizemode,opacity:d.opacity,colorbar:d.colorbar,line:p,editType:"calc"});function y(v){return{valType:"info_array",freeLength:!0,editType:"calc",items:{valType:"subplotid",regex:s[v],editType:"plot"}}}g.color.editType=g.cmin.editType=g.cmax.editType="style",o.exports={dimensions:u("dimension",{visible:{valType:"boolean",dflt:!0,editType:"calc"},label:{valType:"string",editType:"calc"},values:{valType:"data_array",editType:"calc+clearAxisTypes"},axis:{type:{valType:"enumerated",values:["linear","log","date","category"],editType:"calc+clearAxisTypes"},matches:{valType:"boolean",dflt:!1,editType:"calc"},editType:"calc+clearAxisTypes"},editType:"calc+clearAxisTypes"}),text:h({},i.text,{}),hovertext:h({},i.hovertext,{}),hovertemplate:c(),xhoverformat:l("x"),yhoverformat:l("y"),marker:g,xaxes:y("x"),yaxes:y("y"),diagonal:{visible:{valType:"boolean",dflt:!0,editType:"calc"},editType:"calc"},showupperhalf:{valType:"boolean",dflt:!0,editType:"calc"},showlowerhalf:{valType:"boolean",dflt:!0,editType:"calc"},selected:{marker:i.selected.marker,editType:"calc"},unselected:{marker:i.unselected.marker,editType:"calc"},opacity:i.opacity}},{"../../components/colorscale/attributes":373,"../../lib/extend":493,"../../plot_api/plot_template":543,"../../plots/cartesian/axis_format_attributes":557,"../../plots/cartesian/constants":561,"../../plots/template_attributes":633,"../scatter/attributes":927,"../scattergl/attributes":979}],1033:[function(t,o,f){var r=t("../../registry"),a=t("../../components/grid");o.exports={moduleType:"trace",name:"splom",categories:["gl","regl","cartesian","symbols","showLegend","scatter-like"],attributes:t("./attributes"),supplyDefaults:t("./defaults"),colorbar:t("../scatter/marker_colorbar"),calc:t("./calc"),plot:t("./plot"),hoverPoints:t("./hover").hoverPoints,selectPoints:t("./select"),editStyle:t("./edit_style"),meta:{}},r.register(a)},{"../../components/grid":410,"../../registry":638,"../scatter/marker_colorbar":945,"./attributes":1032,"./calc":1035,"./defaults":1036,"./edit_style":1037,"./hover":1039,"./plot":1041,"./select":1043}],1034:[function(t,o,f){var r=t("regl-line2d"),a=t("../../registry"),l=t("../../lib/prepare_regl"),c=t("../../plots/get_data").getModuleCalcData,i=t("../../plots/cartesian"),s=t("../../plots/cartesian/axis_ids").getFromId,u=t("../../plots/cartesian/axes").shouldShowZeroLine,h={};function d(p,g,y){for(var v=y.matrixOptions.data.length,x=g._visibleDims,_=y.viewOpts.ranges=new Array(v),A=0;Am?M.sizeAvg||Math.max(M.size,3):l(g,w),v=0;vP&&F||S-1,W=!0;if(c(M)||x.selectedpoints||B){var G=x._length;if(x.selectedpoints){A.selectBatch=x.selectedpoints;var K=x.selectedpoints,te={};for(m=0;m1&&(v=k[T-1],_=w[T-1],b=M[T-1]),u=0;uv?"-":"+")+"x")).replace("y",(x>_?"-":"+")+"y")).replace("z",(A>b?"-":"+")+"z");var W=function(){T=0,O=[],N=[],B=[]};(!T||T2?y.slice(1,v-1):v===2?[(y[0]+y[1])/2]:y}function p(y){var v=y.length;return v===1?[.5,.5]:[y[1]-y[0],y[v-1]-y[v-2]]}function g(y,v){var x=y.fullSceneLayout,_=y.dataScale,A=v._len,b={};function k(U,V){var H=x[V],ne=_[u[V]];return l.simpleMap(U,function(q){return H.d2l(q)*ne})}if(b.vectors=s(k(v._u,"xaxis"),k(v._v,"yaxis"),k(v._w,"zaxis"),A),!A)return{positions:[],cells:[]};var w=k(v._Xs,"xaxis"),M=k(v._Ys,"yaxis"),T=k(v._Zs,"zaxis");if(b.meshgrid=[w,M,T],b.gridFill=v._gridFill,v._slen)b.startingPositions=s(k(v._startsX,"xaxis"),k(v._startsY,"yaxis"),k(v._startsZ,"zaxis"));else{for(var E=M[0],S=m(w),P=m(T),L=new Array(S.length*P.length),R=0,F=0;F=0};T?(v=Math.min(M.length,S.length),x=function(ee){return O(M[ee])&&N(ee)},_=function(ee){return String(M[ee])}):(v=Math.min(E.length,S.length),x=function(ee){return O(E[ee])&&N(ee)},_=function(ee){return String(E[ee])}),L&&(v=Math.min(v,P.length));for(var B=0;B1){for(var te=l.randstr(),Y=0;Y"),name:O||re("name")?E.name:void 0,color:D("hoverlabel.bgcolor")||S.color,borderColor:D("hoverlabel.bordercolor"),fontFamily:D("hoverlabel.font.family"),fontSize:D("hoverlabel.font.size"),fontColor:D("hoverlabel.font.color"),nameLength:D("hoverlabel.namelength"),textAlign:D("hoverlabel.align"),hovertemplate:O,hovertemplateLabels:te,eventData:T};b&&(H.x0=W-w.rInscribed*w.rpx1,H.x1=W+w.rInscribed*w.rpx1,H.idealAlign=w.pxmid[0]<0?"left":"right"),k&&(H.x=W,H.idealAlign=W<0?"left":"right");var ne=[];c.loneHover(H,{container:M._hoverlayer.node(),outerContainer:M._paper.node(),gd:g,inOut_bbox:ne}),T[0].bbox=ne[0],_._hasHoverLabel=!0}if(k){var q=m.select("path.surface");v.styleOne(q,w,E,{hovered:!0})}_._hasHoverEvent=!0,g.emit("plotly_hover",{points:T||[d(w,E,v.eventDataKeys)],event:r.event})}}),m.on("mouseout",function(w){var M=g._fullLayout,T=g._fullData[_.index],E=r.select(this).datum();if(_._hasHoverEvent&&(w.originalEvent=r.event,g.emit("plotly_unhover",{points:[d(E,T,v.eventDataKeys)],event:r.event}),_._hasHoverEvent=!1),_._hasHoverLabel&&(c.loneUnhover(M._hoverlayer.node()),_._hasHoverLabel=!1),k){var S=m.select("path.surface");v.styleOne(S,E,T,{hovered:!1})}}),m.on("click",function(w){var M=g._fullLayout,T=g._fullData[_.index],E=b&&(u.isHierarchyRoot(w)||u.isLeaf(w)),S=u.getPtId(w),P=u.isEntry(w)?u.findEntryWithChild(A,S):u.findEntryWithLevel(A,S),L=u.getPtId(P),R={points:[d(w,T,v.eventDataKeys)],event:r.event};E||(R.nextLevel=L);var F=s.triggerHandler(g,"plotly_"+_.type+"click",R);if(F!==!1&&M.hovermode&&(g._hoverdata=[d(w,T,v.eventDataKeys)],c.click(g,r.event)),!E&&F!==!1&&!g._dragging&&!g._transitioning){a.call("_storeDirectGUIEdit",T,M._tracePreGUI[T.uid],{level:T.level});var D={data:[{level:L}],traces:[_.index]},O={frame:{redraw:!1,duration:v.transitionTime},transition:{duration:v.transitionTime,easing:v.transitionEasing},mode:"immediate",fromcurrent:!0};c.loneUnhover(M._hoverlayer.node()),a.call("animate",g,D,O)}})}},{"../../components/fx":406,"../../components/fx/helpers":402,"../../lib":503,"../../lib/events":492,"../../registry":638,"../pie/helpers":906,"./helpers":1055,"@plotly/d3":58}],1055:[function(t,o,f){var r=t("../../lib"),a=t("../../components/color"),l=t("../../lib/setcursor"),c=t("../pie/helpers");function i(s){return s.data.data.pid}f.findEntryWithLevel=function(s,u){var h;return u&&s.eachAfter(function(d){if(f.getPtId(d)===u)return h=d.copy()}),h||s},f.findEntryWithChild=function(s,u){var h;return s.eachAfter(function(d){for(var m=d.children||[],p=0;p0)},f.getMaxDepth=function(s){return s.maxdepth>=0?s.maxdepth:1/0},f.isHeader=function(s,u){return!(f.isLeaf(s)||s.depth===u._maxDepth-1)},f.getParent=function(s,u){return f.findEntryWithLevel(s,i(u))},f.listPath=function(s,u){var h=s.parent;if(!h)return[];var d=u?[h.data[u]]:[h];return f.listPath(h,u).concat(d)},f.getPath=function(s){return f.listPath(s,"label").join("/")+"/"},f.formatValue=c.formatPieValue,f.formatPercent=function(s,u){var h=r.formatPercent(s,0);return h==="0%"&&(h=c.formatPiePercent(s,u)),h}},{"../../components/color":366,"../../lib":503,"../../lib/setcursor":524,"../pie/helpers":906}],1056:[function(t,o,f){o.exports={moduleType:"trace",name:"sunburst",basePlotModule:t("./base_plot"),categories:[],animatable:!0,attributes:t("./attributes"),layoutAttributes:t("./layout_attributes"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc").calc,crossTraceCalc:t("./calc").crossTraceCalc,plot:t("./plot").plot,style:t("./style").style,colorbar:t("../scatter/marker_colorbar"),meta:{}}},{"../scatter/marker_colorbar":945,"./attributes":1049,"./base_plot":1050,"./calc":1051,"./defaults":1053,"./layout_attributes":1057,"./layout_defaults":1058,"./plot":1059,"./style":1060}],1057:[function(t,o,f){o.exports={sunburstcolorway:{valType:"colorlist",editType:"calc"},extendsunburstcolors:{valType:"boolean",dflt:!0,editType:"calc"}}},{}],1058:[function(t,o,f){var r=t("../../lib"),a=t("./layout_attributes");o.exports=function(l,c){function i(s,u){return r.coerce(l,c,a,s,u)}i("sunburstcolorway",c.colorway),i("extendsunburstcolors")}},{"../../lib":503,"./layout_attributes":1057}],1059:[function(t,o,f){var r=t("@plotly/d3"),a=t("d3-hierarchy"),l=t("d3-interpolate").interpolate,c=t("../../components/drawing"),i=t("../../lib"),s=t("../../lib/svg_text_utils"),u=t("../bar/uniform_text"),h=u.recordMinTextSize,d=u.clearMinTextSize,m=t("../pie/plot"),p=t("../pie/helpers").getRotationAngle,g=m.computeTransform,y=m.transformInsideText,v=t("./style").styleOne,x=t("../bar/style").resizeText,_=t("./fx"),A=t("./constants"),b=t("./helpers");function k(M,T,E,S){var P=M._fullLayout,L=!P.uniformtext.mode&&b.hasTransition(S),R=r.select(E).selectAll("g.slice"),F=T[0],D=F.trace,O=F.hierarchy,N=b.findEntryWithLevel(O,D.level),B=b.getMaxDepth(D),W=P._size,G=D.domain,K=W.w*(G.x[1]-G.x[0]),te=W.h*(G.y[1]-G.y[0]),Y=.5*Math.min(K,te),J=F.cx=W.l+W.w*(G.x[1]+G.x[0])/2,re=F.cy=W.t+W.h*(1-G.y[0])-te/2;if(!N)return R.remove();var U=null,V={};L&&R.each(function(Le){V[b.getPtId(Le)]={rpx0:Le.rpx0,rpx1:Le.rpx1,x0:Le.x0,x1:Le.x1,transform:Le.transform},!U&&b.isEntry(Le)&&(U=Le)});var H=function(Le){return a.partition().size([2*Math.PI,Le.height+1])(Le)}(N).descendants(),ne=N.height+1,q=0,Q=B;F.hasMultipleRoots&&b.isHierarchyRoot(N)&&(H=H.slice(1),ne-=1,q=1,Q+=1),H=H.filter(function(Le){return Le.y1<=Q});var ee=p(D.rotation);ee&&H.forEach(function(Le){Le.x0+=ee,Le.x1+=ee});var ie=Math.min(ne,B),ae=function(Le){return(Le-q)/ie*Y},ue=function(Le,de){return[Le*Math.cos(de),-Le*Math.sin(de)]},le=function(Le){return i.pathAnnulus(Le.rpx0,Le.rpx1,Le.x0,Le.x1,J,re)},ge=function(Le){return J+w(Le)[0]*(Le.transform.rCenter||0)+(Le.transform.x||0)},fe=function(Le){return re+w(Le)[1]*(Le.transform.rCenter||0)+(Le.transform.y||0)};(R=R.data(H,b.getPtId)).enter().append("g").classed("slice",!0),L?R.exit().transition().each(function(){var Le=r.select(this);Le.select("path.surface").transition().attrTween("d",function(de){var ve=function(Me){var we,Ce=b.getPtId(Me),Fe=V[Ce],ze=V[b.getPtId(N)];if(ze){var $e=(Me.x1>ze.x1?2*Math.PI:0)+ee;we=Me.rpx1me?2*Math.PI:0)+ee;Ve={x0:nt,x1:nt}}else Ve={rpx0:Y,rpx1:Y},i.extendFlat(Ve,ke(Re));else Ve={rpx0:0,rpx1:0};else Ve={x0:ee,x1:ee};return l(Ve,Ye)}($e);return function(Re){return le(Ke(Re))}}):ve.attr("d",le),de.call(_,N,M,T,{eventDataKeys:A.eventDataKeys,transitionTime:A.CLICK_TRANSITION_TIME,transitionEasing:A.CLICK_TRANSITION_EASING}).call(b.setSliceCursor,M,{hideOnRoot:!0,hideOnLeaves:!0,isTransitioning:M._transitioning}),ve.call(v,Le,D);var Me=i.ensureSingle(de,"g","slicetext"),we=i.ensureSingle(Me,"text","",function($e){$e.attr("data-notex",1)}),Ce=i.ensureUniformFontSize(M,b.determineTextFont(D,Le,P.font));we.text(f.formatSliceLabel(Le,N,D,T,P)).classed("slicetext",!0).attr("text-anchor","middle").call(c.font,Ce).call(s.convertToTspans,M);var Fe=c.bBox(we.node());Le.transform=y(Fe,Le,F),Le.transform.targetX=ge(Le),Le.transform.targetY=fe(Le);var ze=function($e,Ke){var Re=$e.transform;return g(Re,Ke),Re.fontSize=Ce.size,h(D.type,Re,P),i.getTextTransform(Re)};L?we.transition().attrTween("transform",function($e){var Ke=function(Re){var Ve,We=V[b.getPtId(Re)],Ye=Re.transform;if(We)Ve=We;else if(Ve={rpx1:Re.rpx1,transform:{textPosAngle:Ye.textPosAngle,scale:0,rotate:Ye.rotate,rCenter:Ye.rCenter,x:Ye.x,y:Ye.y}},U)if(Re.parent)if(me){var nt=Re.x1>me?2*Math.PI:0;Ve.x0=Ve.x1=nt}else i.extendFlat(Ve,ke(Re));else Ve.x0=Ve.x1=ee;else Ve.x0=Ve.x1=ee;var ft=l(Ve.transform.textPosAngle,Re.transform.textPosAngle),yt=l(Ve.rpx1,Re.rpx1),Ot=l(Ve.x0,Re.x0),Tt=l(Ve.x1,Re.x1),at=l(Ve.transform.scale,Ye.scale),et=l(Ve.transform.rotate,Ye.rotate),Lt=Ye.rCenter===0?3:Ve.transform.rCenter===0?1/3:1,Wt=l(Ve.transform.rCenter,Ye.rCenter);return function(Jt){var Be=yt(Jt),Ge=Ot(Jt),kt=Tt(Jt),dt=function(Ie){return Wt(Math.pow(Ie,Lt))}(Jt),Oe={pxmid:ue(Be,(Ge+kt)/2),rpx1:Be,transform:{textPosAngle:ft(Jt),rCenter:dt,x:Ye.x,y:Ye.y}};return h(D.type,Ye,P),{transform:{targetX:ge(Oe),targetY:fe(Oe),scale:at(Jt),rotate:et(Jt),rCenter:dt}}}}($e);return function(Re){return ze(Ke(Re),Fe)}}):we.attr("transform",ze(Le,Fe))})}function w(M){return T=M.rpx1,E=M.transform.textPosAngle,[T*Math.sin(E),-T*Math.cos(E)];var T,E}f.plot=function(M,T,E,S){var P,L,R=M._fullLayout,F=R._sunburstlayer,D=!E,O=!R.uniformtext.mode&&b.hasTransition(E);d("sunburst",R),(P=F.selectAll("g.trace.sunburst").data(T,function(N){return N[0].trace.uid})).enter().append("g").classed("trace",!0).classed("sunburst",!0).attr("stroke-linejoin","round"),P.order(),O?(S&&(L=S()),r.transition().duration(E.duration).ease(E.easing).each("end",function(){L&&L()}).each("interrupt",function(){L&&L()}).each(function(){F.selectAll("g.trace").each(function(N){k(M,N,this,E)})})):(P.each(function(N){k(M,N,this,E)}),R.uniformtext.mode&&x(M,R._sunburstlayer.selectAll(".trace"),"sunburst")),D&&P.exit().remove()},f.formatSliceLabel=function(M,T,E,S,P){var L=E.texttemplate,R=E.textinfo;if(!(L||R&&R!=="none"))return"";var F=P.separators,D=S[0],O=M.data.data,N=D.hierarchy,B=b.isHierarchyRoot(M),W=b.getParent(N,M),G=b.getValue(M);if(!L){var K,te=R.split("+"),Y=function(ee){return te.indexOf(ee)!==-1},J=[];if(Y("label")&&O.label&&J.push(O.label),O.hasOwnProperty("v")&&Y("value")&&J.push(b.formatValue(O.v,F)),!B){Y("current path")&&J.push(b.getPath(M.data));var re=0;Y("percent parent")&&re++,Y("percent entry")&&re++,Y("percent root")&&re++;var U=re>1;if(re){var V,H=function(ee){K=b.formatPercent(V,F),U&&(K+=" of "+ee),J.push(K)};Y("percent parent")&&!B&&(V=G/b.getValue(W),H("parent")),Y("percent entry")&&(V=G/b.getValue(T),H("entry")),Y("percent root")&&(V=G/b.getValue(N),H("root"))}}return Y("text")&&(K=i.castOption(E,O.i,"text"),i.isValidTextValue(K)&&J.push(K)),J.join("
    ")}var ne=i.castOption(E,O.i,"texttemplate");if(!ne)return"";var q={};O.label&&(q.label=O.label),O.hasOwnProperty("v")&&(q.value=O.v,q.valueLabel=b.formatValue(O.v,F)),q.currentPath=b.getPath(M.data),B||(q.percentParent=G/b.getValue(W),q.percentParentLabel=b.formatPercent(q.percentParent,F),q.parent=b.getPtLabel(W)),q.percentEntry=G/b.getValue(T),q.percentEntryLabel=b.formatPercent(q.percentEntry,F),q.entry=b.getPtLabel(T),q.percentRoot=G/b.getValue(N),q.percentRootLabel=b.formatPercent(q.percentRoot,F),q.root=b.getPtLabel(N),O.hasOwnProperty("color")&&(q.color=O.color);var Q=i.castOption(E,O.i,"text");return(i.isValidTextValue(Q)||Q==="")&&(q.text=Q),q.customdata=i.castOption(E,O.i,"customdata"),i.texttemplateString(ne,q,P._d3locale,q,E._meta||{})}},{"../../components/drawing":388,"../../lib":503,"../../lib/svg_text_utils":529,"../bar/style":662,"../bar/uniform_text":664,"../pie/helpers":906,"../pie/plot":910,"./constants":1052,"./fx":1054,"./helpers":1055,"./style":1060,"@plotly/d3":58,"d3-hierarchy":115,"d3-interpolate":116}],1060:[function(t,o,f){var r=t("@plotly/d3"),a=t("../../components/color"),l=t("../../lib"),c=t("../bar/uniform_text").resizeText;function i(s,u,h){var d=u.data.data,m=!u.children,p=d.i,g=l.castOption(h,p,"marker.line.color")||a.defaultLine,y=l.castOption(h,p,"marker.line.width")||0;s.style("stroke-width",y).call(a.fill,d.color).call(a.stroke,g).style("opacity",m?h.leaf.opacity:null)}o.exports={style:function(s){var u=s._fullLayout._sunburstlayer.selectAll(".trace");c(s,u,"sunburst"),u.each(function(h){var d=r.select(this),m=h[0].trace;d.style("opacity",m.opacity),d.selectAll("path.surface").each(function(p){r.select(this).call(i,p,m)})})},styleOne:i}},{"../../components/color":366,"../../lib":503,"../bar/uniform_text":664,"@plotly/d3":58}],1061:[function(t,o,f){var r=t("../../components/color"),a=t("../../components/colorscale/attributes"),l=t("../../plots/cartesian/axis_format_attributes").axisHoverFormat,c=t("../../plots/template_attributes").hovertemplateAttrs,i=t("../../plots/attributes"),s=t("../../lib/extend").extendFlat,u=t("../../plot_api/edit_types").overrideAll;function h(m){return{show:{valType:"boolean",dflt:!1},start:{valType:"number",dflt:null,editType:"plot"},end:{valType:"number",dflt:null,editType:"plot"},size:{valType:"number",dflt:null,min:0,editType:"plot"},project:{x:{valType:"boolean",dflt:!1},y:{valType:"boolean",dflt:!1},z:{valType:"boolean",dflt:!1}},color:{valType:"color",dflt:r.defaultLine},usecolormap:{valType:"boolean",dflt:!1},width:{valType:"number",min:1,max:16,dflt:2},highlight:{valType:"boolean",dflt:!0},highlightcolor:{valType:"color",dflt:r.defaultLine},highlightwidth:{valType:"number",min:1,max:16,dflt:2}}}var d=o.exports=u(s({z:{valType:"data_array"},x:{valType:"data_array"},y:{valType:"data_array"},text:{valType:"string",dflt:"",arrayOk:!0},hovertext:{valType:"string",dflt:"",arrayOk:!0},hovertemplate:c(),xhoverformat:l("x"),yhoverformat:l("y"),zhoverformat:l("z"),connectgaps:{valType:"boolean",dflt:!1,editType:"calc"},surfacecolor:{valType:"data_array"}},a("",{colorAttr:"z or surfacecolor",showScaleDflt:!0,autoColorDflt:!1,editTypeOverride:"calc"}),{contours:{x:h(),y:h(),z:h()},hidesurface:{valType:"boolean",dflt:!1},lightposition:{x:{valType:"number",min:-1e5,max:1e5,dflt:10},y:{valType:"number",min:-1e5,max:1e5,dflt:1e4},z:{valType:"number",min:-1e5,max:1e5,dflt:0}},lighting:{ambient:{valType:"number",min:0,max:1,dflt:.8},diffuse:{valType:"number",min:0,max:1,dflt:.8},specular:{valType:"number",min:0,max:2,dflt:.05},roughness:{valType:"number",min:0,max:1,dflt:.5},fresnel:{valType:"number",min:0,max:5,dflt:.2}},opacity:{valType:"number",min:0,max:1,dflt:1},opacityscale:{valType:"any",editType:"calc"},_deprecated:{zauto:s({},a.zauto,{}),zmin:s({},a.zmin,{}),zmax:s({},a.zmax,{})},hoverinfo:s({},i.hoverinfo),showlegend:s({},i.showlegend,{dflt:!1})}),"calc","nested");d.x.editType=d.y.editType=d.z.editType="calc+clearAxisTypes",d.transforms=void 0},{"../../components/color":366,"../../components/colorscale/attributes":373,"../../lib/extend":493,"../../plot_api/edit_types":536,"../../plots/attributes":550,"../../plots/cartesian/axis_format_attributes":557,"../../plots/template_attributes":633}],1062:[function(t,o,f){var r=t("../../components/colorscale/calc");o.exports=function(a,l){l.surfacecolor?r(a,l,{vals:l.surfacecolor,containerStr:"",cLetter:"c"}):r(a,l,{vals:l.z,containerStr:"",cLetter:"c"})}},{"../../components/colorscale/calc":374}],1063:[function(t,o,f){var r=t("../../../stackgl_modules").gl_surface3d,a=t("../../../stackgl_modules").ndarray,l=t("../../../stackgl_modules").ndarray_linear_interpolate.d2,c=t("../heatmap/interp2d"),i=t("../heatmap/find_empties"),s=t("../../lib").isArrayOrTypedArray,u=t("../../lib/gl_format_color").parseColorScale,h=t("../../lib/str2rgbarray"),d=t("../../components/colorscale").extractOpts;function m(E,S,P){this.scene=E,this.uid=P,this.surface=S,this.data=null,this.showContour=[!1,!1,!1],this.contourStart=[null,null,null],this.contourEnd=[null,null,null],this.contourSize=[0,0,0],this.minValues=[1/0,1/0,1/0],this.maxValues=[-1/0,-1/0,-1/0],this.dataScaleX=1,this.dataScaleY=1,this.refineData=!0,this.objectOffset=[0,0,0]}var p=m.prototype;p.getXat=function(E,S,P,L){var R=s(this.data.x)?s(this.data.x[0])?this.data.x[S][E]:this.data.x[E]:E;return P===void 0?R:L.d2l(R,0,P)},p.getYat=function(E,S,P,L){var R=s(this.data.y)?s(this.data.y[0])?this.data.y[S][E]:this.data.y[S]:S;return P===void 0?R:L.d2l(R,0,P)},p.getZat=function(E,S,P,L){var R=this.data.z[S][E];return R===null&&this.data.connectgaps&&this.data._interpolatedZ&&(R=this.data._interpolatedZ[S][E]),P===void 0?R:L.d2l(R,0,P)},p.handlePick=function(E){if(E.object===this.surface){var S=(E.data.index[0]-1)/this.dataScaleX-1,P=(E.data.index[1]-1)/this.dataScaleY-1,L=Math.max(Math.min(Math.round(S),this.data.z[0].length-1),0),R=Math.max(Math.min(Math.round(P),this.data._ylength-1),0);E.index=[L,R],E.traceCoordinate=[this.getXat(L,R),this.getYat(L,R),this.getZat(L,R)],E.dataCoordinate=[this.getXat(L,R,this.data.xcalendar,this.scene.fullSceneLayout.xaxis),this.getYat(L,R,this.data.ycalendar,this.scene.fullSceneLayout.yaxis),this.getZat(L,R,this.data.zcalendar,this.scene.fullSceneLayout.zaxis)];for(var F=0;F<3;F++){var D=E.dataCoordinate[F];D!=null&&(E.dataCoordinate[F]*=this.scene.dataScale[F])}var O=this.data.hovertext||this.data.text;return Array.isArray(O)&&O[R]&&O[R][L]!==void 0?E.textLabel=O[R][L]:E.textLabel=O||"",E.data.dataCoordinate=E.dataCoordinate.slice(),this.surface.highlight(E.data),this.scene.glplot.spikes.position=E.dataCoordinate,!0}};var g=[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,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997,1009,1013,1019,1021,1031,1033,1039,1049,1051,1061,1063,1069,1087,1091,1093,1097,1103,1109,1117,1123,1129,1151,1153,1163,1171,1181,1187,1193,1201,1213,1217,1223,1229,1231,1237,1249,1259,1277,1279,1283,1289,1291,1297,1301,1303,1307,1319,1321,1327,1361,1367,1373,1381,1399,1409,1423,1427,1429,1433,1439,1447,1451,1453,1459,1471,1481,1483,1487,1489,1493,1499,1511,1523,1531,1543,1549,1553,1559,1567,1571,1579,1583,1597,1601,1607,1609,1613,1619,1621,1627,1637,1657,1663,1667,1669,1693,1697,1699,1709,1721,1723,1733,1741,1747,1753,1759,1777,1783,1787,1789,1801,1811,1823,1831,1847,1861,1867,1871,1873,1877,1879,1889,1901,1907,1913,1931,1933,1949,1951,1973,1979,1987,1993,1997,1999,2003,2011,2017,2027,2029,2039,2053,2063,2069,2081,2083,2087,2089,2099,2111,2113,2129,2131,2137,2141,2143,2153,2161,2179,2203,2207,2213,2221,2237,2239,2243,2251,2267,2269,2273,2281,2287,2293,2297,2309,2311,2333,2339,2341,2347,2351,2357,2371,2377,2381,2383,2389,2393,2399,2411,2417,2423,2437,2441,2447,2459,2467,2473,2477,2503,2521,2531,2539,2543,2549,2551,2557,2579,2591,2593,2609,2617,2621,2633,2647,2657,2659,2663,2671,2677,2683,2687,2689,2693,2699,2707,2711,2713,2719,2729,2731,2741,2749,2753,2767,2777,2789,2791,2797,2801,2803,2819,2833,2837,2843,2851,2857,2861,2879,2887,2897,2903,2909,2917,2927,2939,2953,2957,2963,2969,2971,2999];function y(E,S){if(E0){P=g[L];break}return P}function _(E,S){if(!(E<1||S<1)){for(var P=v(E),L=v(S),R=1,F=0;Fk;)P--,P/=x(P),++P1?L:1},p.refineCoords=function(E){for(var S=this.dataScaleX,P=this.dataScaleY,L=E[0].shape[0],R=E[0].shape[1],F=0|Math.floor(E[0].shape[0]*S+1),D=0|Math.floor(E[0].shape[1]*P+1),O=1+L+1,N=1+R+1,B=a(new Float32Array(O*N),[O,N]),W=[1/S,0,0,0,1/P,0,0,0,1],G=0;G0&&this.contourStart[E]!==null&&this.contourEnd[E]!==null&&this.contourEnd[E]>this.contourStart[E]))for(R[E]=!0,S=this.contourStart[E];SR&&(this.minValues[S]=R),this.maxValues[S]",maxDimensionCount:60,overdrag:45,releaseTransitionDuration:120,releaseTransitionEase:"cubic-out",scrollbarCaptureWidth:18,scrollbarHideDelay:1e3,scrollbarHideDuration:1e3,scrollbarOffset:5,scrollbarWidth:8,transitionDuration:100,transitionEase:"cubic-out",uplift:5,wrapSpacer:" ",wrapSplitCharacter:" ",cn:{table:"table",tableControlView:"table-control-view",scrollBackground:"scroll-background",yColumn:"y-column",columnBlock:"column-block",scrollAreaClip:"scroll-area-clip",scrollAreaClipRect:"scroll-area-clip-rect",columnBoundary:"column-boundary",columnBoundaryClippath:"column-boundary-clippath",columnBoundaryRect:"column-boundary-rect",columnCells:"column-cells",columnCell:"column-cell",cellRect:"cell-rect",cellText:"cell-text",cellTextHolder:"cell-text-holder",scrollbarKit:"scrollbar-kit",scrollbar:"scrollbar",scrollbarSlider:"scrollbar-slider",scrollbarGlyph:"scrollbar-glyph",scrollbarCaptureZone:"scrollbar-capture-zone"}}},{}],1070:[function(t,o,f){var r=t("./constants"),a=t("../../lib/extend").extendFlat,l=t("fast-isnumeric");function c(p){if(Array.isArray(p)){for(var g=0,y=0;y=g||w===p.length-1)&&(v[x]=A,A.key=k++,A.firstRowIndex=b,A.lastRowIndex=w,A={firstRowIndex:null,lastRowIndex:null,rows:[]},x+=_,b=w+1,_=0);return v}o.exports=function(p,g){var y=s(g.cells.values),v=function(B){return B.slice(g.header.values.length,B.length)},x=s(g.header.values);x.length&&!x[0].length&&(x[0]=[""],x=s(x));var _=x.concat(v(y).map(function(){return u((x[0]||[""]).length)})),A=g.domain,b=Math.floor(p._fullLayout._size.w*(A.x[1]-A.x[0])),k=Math.floor(p._fullLayout._size.h*(A.y[1]-A.y[0])),w=g.header.values.length?_[0].map(function(){return g.header.height}):[r.emptyHeaderHeight],M=y.length?y[0].map(function(){return g.cells.height}):[],T=w.reduce(i,0),E=m(M,k-T+r.uplift),S=d(m(w,T),[]),P=d(E,S),L={},R=g._fullInput.columnorder.concat(v(y.map(function(B,W){return W}))),F=_.map(function(B,W){var G=Array.isArray(g.columnwidth)?g.columnwidth[Math.min(W,g.columnwidth.length-1)]:g.columnwidth;return l(G)?Number(G):1}),D=F.reduce(i,0);F=F.map(function(B){return B/D*b});var O=Math.max(c(g.header.line.width),c(g.cells.line.width)),N={key:g.uid+p._context.staticPlot,translateX:A.x[0]*p._fullLayout._size.w,translateY:p._fullLayout._size.h*(1-A.y[1]),size:p._fullLayout._size,width:b,maxLineWidth:O,height:k,columnOrder:R,groupHeight:k,rowBlocks:P,headerRowBlocks:S,scrollY:0,cells:a({},g.cells,{values:y}),headerCells:a({},g.header,{values:_}),gdColumns:_.map(function(B){return B[0]}),gdColumnsOriginalOrder:_.map(function(B){return B[0]}),prevPages:[0,0],scrollbarState:{scrollbarScrollInProgress:!1},columns:_.map(function(B,W){var G=L[B];return L[B]=(G||0)+1,{key:B+"__"+L[B],label:B,specIndex:W,xIndex:R[W],xScale:h,x:void 0,calcdata:void 0,columnWidth:F[W]}})};return N.columns.forEach(function(B){B.calcdata=N,B.x=h(B)}),N}},{"../../lib/extend":493,"./constants":1069,"fast-isnumeric":190}],1071:[function(t,o,f){var r=t("../../lib/extend").extendFlat;f.splitToPanels=function(a){var l=[0,0],c=r({},a,{key:"header",type:"header",page:0,prevPages:l,currentRepaint:[null,null],dragHandle:!0,values:a.calcdata.headerCells.values[a.specIndex],rowBlocks:a.calcdata.headerRowBlocks,calcdata:r({},a.calcdata,{cells:a.calcdata.headerCells})});return[r({},a,{key:"cells1",type:"cells",page:0,prevPages:l,currentRepaint:[null,null],dragHandle:!1,values:a.calcdata.cells.values[a.specIndex],rowBlocks:a.calcdata.rowBlocks}),r({},a,{key:"cells2",type:"cells",page:1,prevPages:l,currentRepaint:[null,null],dragHandle:!1,values:a.calcdata.cells.values[a.specIndex],rowBlocks:a.calcdata.rowBlocks}),c]},f.splitToCells=function(a){var l=function(c){var i=c.rowBlocks[c.page],s=i?i.rows[0].rowIndex:0,u=i?s+i.rows.length:0;return[s,u]}(a);return(a.values||[]).slice(l[0],l[1]).map(function(c,i){return{keyWithinBlock:i+(typeof c=="string"&&c.match(/[<$&> ]/)?"_keybuster_"+Math.random():""),key:l[0]+i,column:a,calcdata:a.calcdata,page:a.page,rowBlocks:a.rowBlocks,value:c}})}},{"../../lib/extend":493}],1072:[function(t,o,f){var r=t("../../lib"),a=t("./attributes"),l=t("../../plots/domain").defaults;o.exports=function(c,i,s,u){function h(d,m){return r.coerce(c,i,a,d,m)}l(i,u,h),h("columnwidth"),h("header.values"),h("header.format"),h("header.align"),h("header.prefix"),h("header.suffix"),h("header.height"),h("header.line.width"),h("header.line.color"),h("header.fill.color"),r.coerceFont(h,"header.font",r.extendFlat({},u.font)),function(d,m){for(var p=d.columnorder||[],g=d.header.values.length,y=p.slice(0,g),v=y.slice().sort(function(A,b){return A-b}),x=y.map(function(A){return v.indexOf(A)}),_=x.length;_/i),ie=!Q||ee;V.mayHaveMarkup=Q&&q.match(/[<&>]/);var ae,ue=typeof(ae=q)=="string"&&ae.match(r.latexCheck);V.latex=ue;var le,ge,fe=ue?"":M(V.calcdata.cells.prefix,H,ne)||"",me=ue?"":M(V.calcdata.cells.suffix,H,ne)||"",_e=ue?null:M(V.calcdata.cells.format,H,ne)||null,Ae=fe+(_e?l(_e)(V.value):V.value)+me;if(V.wrappingNeeded=!V.wrapped&&!ie&&!ue&&(le=w(Ae)),V.cellHeightMayIncrease=ee||ue||V.mayHaveMarkup||(le===void 0?w(Ae):le),V.needsConvertToTspans=V.mayHaveMarkup||V.wrappingNeeded||V.latex,V.wrappingNeeded){var ke=(r.wrapSplitCharacter===" "?Ae.replace(/ge&&le.push(fe),ge+=Ae}return le}(V,Q,q);ee.length===1&&(ee[0]===V.length-1?ee.unshift(ee[0]-1):ee.push(ee[0]+1)),ee[0]%2&&ee.reverse(),J.each(function(ie,ae){ie.page=ee[ae],ie.scrollY=Q}),J.attr("transform",function(ie){var ae=W(ie.rowBlocks,ie.page)-ie.scrollY;return h(0,ae)}),Y&&(F(Y,re,J,ee,U.prevPages,U,0),F(Y,re,J,ee,U.prevPages,U,1),A(re,Y))}}function R(Y,J,re,U){return function(V){var H=V.calcdata?V.calcdata:V,ne=J.filter(function(ie){return H.key===ie.key}),q=re||H.scrollbarState.dragMultiplier,Q=H.scrollY;H.scrollY=U===void 0?H.scrollY+q*a.event.dy:U;var ee=ne.selectAll("."+r.cn.yColumn).selectAll("."+r.cn.columnBlock).filter(E);return L(Y,ee,ne),H.scrollY===Q}}function F(Y,J,re,U,V,H,ne){U[ne]!==V[ne]&&(clearTimeout(H.currentRepaint[ne]),H.currentRepaint[ne]=setTimeout(function(){var q=re.filter(function(Q,ee){return ee===ne&&U[ee]!==V[ee]});b(Y,J,q,re),V[ne]=U[ne]}))}function D(Y,J,re,U){return function(){var V=a.select(J.parentNode);V.each(function(H){var ne=H.fragments;V.selectAll("tspan.line").each(function(ge,fe){ne[fe].width=this.getComputedTextLength()});var q,Q,ee=ne[ne.length-1].width,ie=ne.slice(0,-1),ae=[],ue=0,le=H.column.columnWidth-2*r.cellPad;for(H.value="";ie.length;)ue+(Q=(q=ie.shift()).width+ee)>le&&(H.value+=ae.join(r.wrapSpacer)+r.lineBreaker,ae=[],ue=0),ae.push(q.text),ue+=Q;ue&&(H.value+=ae.join(r.wrapSpacer)),H.wrapped=!0}),V.selectAll("tspan.line").remove(),k(V.select("."+r.cn.cellText),re,Y,U),a.select(J.parentNode.parentNode).call(B)}}function O(Y,J,re,U,V){return function(){if(!V.settledY){var H=a.select(J.parentNode),ne=te(V),q=V.key-ne.firstRowIndex,Q=ne.rows[q].rowHeight,ee=V.cellHeightMayIncrease?J.parentNode.getBoundingClientRect().height+2*r.cellPad:Q,ie=Math.max(ee,Q);ie-ne.rows[q].rowHeight&&(ne.rows[q].rowHeight=ie,Y.selectAll("."+r.cn.columnCell).call(B),L(null,Y.filter(E),0),A(re,U,!0)),H.attr("transform",function(){var ae=this.parentNode.getBoundingClientRect(),ue=a.select(this.parentNode).select("."+r.cn.cellRect).node().getBoundingClientRect(),le=this.transform.baseVal.consolidate(),ge=ue.top-ae.top+(le?le.matrix.f:r.cellPad);return h(N(V,a.select(this.parentNode).select("."+r.cn.cellTextHolder).node().getBoundingClientRect().width),ge)}),V.settledY=!0}}}function N(Y,J){switch(Y.align){case"left":return r.cellPad;case"right":return Y.column.columnWidth-(J||0)-r.cellPad;case"center":return(Y.column.columnWidth-(J||0))/2;default:return r.cellPad}}function B(Y){Y.attr("transform",function(J){var re=J.rowBlocks[0].auxiliaryBlocks.reduce(function(V,H){return V+G(H,1/0)},0),U=G(te(J),J.key);return h(0,U+re)}).selectAll("."+r.cn.cellRect).attr("height",function(J){return(re=te(J),U=J.key,re.rows[U-re.firstRowIndex]).rowHeight;var re,U})}function W(Y,J){for(var re=0,U=J-1;U>=0;U--)re+=K(Y[U]);return re}function G(Y,J){for(var re=0,U=0;U","<","|","/","\\"],dflt:">",editType:"plot"},thickness:{valType:"number",min:12,editType:"plot"},textfont:h({},i.textfont,{}),editType:"calc"},text:i.text,textinfo:s.textinfo,texttemplate:a({editType:"plot"},{keys:u.eventDataKeys.concat(["label","value"])}),hovertext:i.hovertext,hoverinfo:s.hoverinfo,hovertemplate:r({},{keys:u.eventDataKeys}),textfont:i.textfont,insidetextfont:i.insidetextfont,outsidetextfont:h({},i.outsidetextfont,{}),textposition:{valType:"enumerated",values:["top left","top center","top right","middle left","middle center","middle right","bottom left","bottom center","bottom right"],dflt:"top left",editType:"plot"},sort:i.sort,root:s.root,domain:c({name:"treemap",trace:!0,editType:"calc"})}},{"../../components/colorscale/attributes":373,"../../lib/extend":493,"../../plots/domain":584,"../../plots/template_attributes":633,"../pie/attributes":901,"../sunburst/attributes":1049,"./constants":1078}],1076:[function(t,o,f){var r=t("../../plots/plots");f.name="treemap",f.plot=function(a,l,c,i){r.plotBasePlot(f.name,a,l,c,i)},f.clean=function(a,l,c,i){r.cleanBasePlot(f.name,a,l,c,i)}},{"../../plots/plots":619}],1077:[function(t,o,f){var r=t("../sunburst/calc");f.calc=function(a,l){return r.calc(a,l)},f.crossTraceCalc=function(a){return r._runCrossTraceCalc("treemap",a)}},{"../sunburst/calc":1051}],1078:[function(t,o,f){o.exports={CLICK_TRANSITION_TIME:750,CLICK_TRANSITION_EASING:"poly",eventDataKeys:["currentPath","root","entry","percentRoot","percentEntry","percentParent"],gapWithPathbar:1}},{}],1079:[function(t,o,f){var r=t("../../lib"),a=t("./attributes"),l=t("../../components/color"),c=t("../../plots/domain").defaults,i=t("../bar/defaults").handleText,s=t("../bar/constants").TEXTPAD,u=t("../../components/colorscale"),h=u.hasColorscale,d=u.handleDefaults;o.exports=function(m,p,g,y){function v(E,S){return r.coerce(m,p,a,E,S)}var x=v("labels"),_=v("parents");if(x&&x.length&&_&&_.length){var A=v("values");A&&A.length?v("branchvalues"):v("count"),v("level"),v("maxdepth"),v("tiling.packing")==="squarify"&&v("tiling.squarifyratio"),v("tiling.flip"),v("tiling.pad");var b=v("text");v("texttemplate"),p.texttemplate||v("textinfo",Array.isArray(b)?"text+label":"label"),v("hovertext"),v("hovertemplate");var k=v("pathbar.visible");i(m,p,y,v,"auto",{hasPathbar:k,moduleHasSelected:!1,moduleHasUnselected:!1,moduleHasConstrain:!1,moduleHasCliponaxis:!1,moduleHasTextangle:!1,moduleHasInsideanchor:!1}),v("textposition");var w=p.textposition.indexOf("bottom")!==-1;v("marker.line.width")&&v("marker.line.color",y.paper_bgcolor);var M=v("marker.colors");(p._hasColorscale=h(m,"marker","colors")||(m.marker||{}).coloraxis)?d(m,p,y,v,{prefix:"marker.",cLetter:"c"}):v("marker.depthfade",!(M||[]).length);var T=2*p.textfont.size;v("marker.pad.t",w?T/4:T),v("marker.pad.l",T/4),v("marker.pad.r",T/4),v("marker.pad.b",w?T:T/4),p._hovered={marker:{line:{width:2,color:l.contrast(y.paper_bgcolor)}}},k&&(v("pathbar.thickness",p.pathbar.textfont.size+2*s),v("pathbar.side"),v("pathbar.edgeshape")),v("sort"),v("root.color"),c(p,y,v),p._length=null}else p.visible=!1}},{"../../components/color":366,"../../components/colorscale":378,"../../lib":503,"../../plots/domain":584,"../bar/constants":650,"../bar/defaults":652,"./attributes":1075}],1080:[function(t,o,f){var r=t("@plotly/d3"),a=t("../sunburst/helpers"),l=t("../bar/uniform_text").clearMinTextSize,c=t("../bar/style").resizeText,i=t("./plot_one");o.exports=function(s,u,h,d,m){var p,g,y=m.type,v=m.drawDescendants,x=s._fullLayout,_=x["_"+y+"layer"],A=!h;l(y,x),(p=_.selectAll("g.trace."+y).data(u,function(b){return b[0].trace.uid})).enter().append("g").classed("trace",!0).classed(y,!0),p.order(),!x.uniformtext.mode&&a.hasTransition(h)?(d&&(g=d()),r.transition().duration(h.duration).ease(h.easing).each("end",function(){g&&g()}).each("interrupt",function(){g&&g()}).each(function(){_.selectAll("g.trace").each(function(b){i(s,b,this,h,v)})})):(p.each(function(b){i(s,b,this,h,v)}),x.uniformtext.mode&&c(s,_.selectAll(".trace"),y)),A&&p.exit().remove()}},{"../bar/style":662,"../bar/uniform_text":664,"../sunburst/helpers":1055,"./plot_one":1089,"@plotly/d3":58}],1081:[function(t,o,f){var r=t("@plotly/d3"),a=t("../../lib"),l=t("../../components/drawing"),c=t("../../lib/svg_text_utils"),i=t("./partition"),s=t("./style").styleOne,u=t("./constants"),h=t("../sunburst/helpers"),d=t("../sunburst/fx");o.exports=function(m,p,g,y,v){var x=v.barDifY,_=v.width,A=v.height,b=v.viewX,k=v.viewY,w=v.pathSlice,M=v.toMoveInsideSlice,T=v.strTransform,E=v.hasTransition,S=v.handleSlicesExit,P=v.makeUpdateSliceInterpolator,L=v.makeUpdateTextInterpolator,R={},F=m._fullLayout,D=p[0],O=D.trace,N=D.hierarchy,B=_/O._entryDepth,W=h.listPath(g.data,"id"),G=i(N.copy(),[_,A],{packing:"dice",pad:{inner:0,top:0,left:0,right:0,bottom:0}}).descendants();(G=G.filter(function(te){var Y=W.indexOf(te.data.id);return Y!==-1&&(te.x0=B*Y,te.x1=B*(Y+1),te.y0=x,te.y1=x+A,te.onPathbar=!0,!0)})).reverse(),(y=y.data(G,h.getPtId)).enter().append("g").classed("pathbar",!0),S(y,!0,R,[_,A],w),y.order();var K=y;E&&(K=K.transition().each("end",function(){var te=r.select(this);h.setSliceCursor(te,m,{hideOnRoot:!1,hideOnLeaves:!1,isTransitioning:!1})})),K.each(function(te){te._x0=b(te.x0),te._x1=b(te.x1),te._y0=k(te.y0),te._y1=k(te.y1),te._hoverX=b(te.x1-Math.min(_,A)/2),te._hoverY=k(te.y1-A/2);var Y=r.select(this),J=a.ensureSingle(Y,"path","surface",function(H){H.style("pointer-events","all")});E?J.transition().attrTween("d",function(H){var ne=P(H,!0,R,[_,A]);return function(q){return w(ne(q))}}):J.attr("d",w),Y.call(d,g,m,p,{styleOne:s,eventDataKeys:u.eventDataKeys,transitionTime:u.CLICK_TRANSITION_TIME,transitionEasing:u.CLICK_TRANSITION_EASING}).call(h.setSliceCursor,m,{hideOnRoot:!1,hideOnLeaves:!1,isTransitioning:m._transitioning}),J.call(s,te,O,{hovered:!1}),te._text=(h.getPtLabel(te)||"").split("
    ").join(" ")||"";var re=a.ensureSingle(Y,"g","slicetext"),U=a.ensureSingle(re,"text","",function(H){H.attr("data-notex",1)}),V=a.ensureUniformFontSize(m,h.determineTextFont(O,te,F.font,{onPathbar:!0}));U.text(te._text||" ").classed("slicetext",!0).attr("text-anchor","start").call(l.font,V).call(c.convertToTspans,m),te.textBB=l.bBox(U.node()),te.transform=M(te,{fontSize:V.size,onPathbar:!0}),te.transform.fontSize=V.size,E?U.transition().attrTween("transform",function(H){var ne=L(H,!0,R,[_,A]);return function(q){return T(ne(q))}}):U.attr("transform",T(te))})}},{"../../components/drawing":388,"../../lib":503,"../../lib/svg_text_utils":529,"../sunburst/fx":1054,"../sunburst/helpers":1055,"./constants":1078,"./partition":1087,"./style":1090,"@plotly/d3":58}],1082:[function(t,o,f){var r=t("@plotly/d3"),a=t("../../lib"),l=t("../../components/drawing"),c=t("../../lib/svg_text_utils"),i=t("./partition"),s=t("./style").styleOne,u=t("./constants"),h=t("../sunburst/helpers"),d=t("../sunburst/fx"),m=t("../sunburst/plot").formatSliceLabel;o.exports=function(p,g,y,v,x){var _=x.width,A=x.height,b=x.viewX,k=x.viewY,w=x.pathSlice,M=x.toMoveInsideSlice,T=x.strTransform,E=x.hasTransition,S=x.handleSlicesExit,P=x.makeUpdateSliceInterpolator,L=x.makeUpdateTextInterpolator,R=x.prevEntry,F=p._fullLayout,D=g[0].trace,O=D.textposition.indexOf("left")!==-1,N=D.textposition.indexOf("right")!==-1,B=D.textposition.indexOf("bottom")!==-1,W=!B&&!D.marker.pad.t||B&&!D.marker.pad.b,G=i(y,[_,A],{packing:D.tiling.packing,squarifyratio:D.tiling.squarifyratio,flipX:D.tiling.flip.indexOf("x")>-1,flipY:D.tiling.flip.indexOf("y")>-1,pad:{inner:D.tiling.pad,top:D.marker.pad.t,left:D.marker.pad.l,right:D.marker.pad.r,bottom:D.marker.pad.b}}).descendants(),K=1/0,te=-1/0;G.forEach(function(V){var H=V.depth;H>=D._maxDepth?(V.x0=V.x1=(V.x0+V.x1)/2,V.y0=V.y1=(V.y0+V.y1)/2):(K=Math.min(K,H),te=Math.max(te,H))}),v=v.data(G,h.getPtId),D._maxVisibleLayers=isFinite(te)?te-K+1:0,v.enter().append("g").classed("slice",!0),S(v,!1,{},[_,A],w),v.order();var Y=null;if(E&&R){var J=h.getPtId(R);v.each(function(V){Y===null&&h.getPtId(V)===J&&(Y={x0:V.x0,x1:V.x1,y0:V.y0,y1:V.y1})})}var re=function(){return Y||{x0:0,x1:_,y0:0,y1:A}},U=v;return E&&(U=U.transition().each("end",function(){var V=r.select(this);h.setSliceCursor(V,p,{hideOnRoot:!0,hideOnLeaves:!1,isTransitioning:!1})})),U.each(function(V){var H=h.isHeader(V,D);V._x0=b(V.x0),V._x1=b(V.x1),V._y0=k(V.y0),V._y1=k(V.y1),V._hoverX=b(V.x1-D.marker.pad.r),V._hoverY=k(B?V.y1-D.marker.pad.b/2:V.y0+D.marker.pad.t/2);var ne=r.select(this),q=a.ensureSingle(ne,"path","surface",function(ae){ae.style("pointer-events","all")});E?q.transition().attrTween("d",function(ae){var ue=P(ae,!1,re(),[_,A]);return function(le){return w(ue(le))}}):q.attr("d",w),ne.call(d,y,p,g,{styleOne:s,eventDataKeys:u.eventDataKeys,transitionTime:u.CLICK_TRANSITION_TIME,transitionEasing:u.CLICK_TRANSITION_EASING}).call(h.setSliceCursor,p,{isTransitioning:p._transitioning}),q.call(s,V,D,{hovered:!1}),V.x0===V.x1||V.y0===V.y1?V._text="":V._text=H?W?"":h.getPtLabel(V)||"":m(V,y,D,g,F)||"";var Q=a.ensureSingle(ne,"g","slicetext"),ee=a.ensureSingle(Q,"text","",function(ae){ae.attr("data-notex",1)}),ie=a.ensureUniformFontSize(p,h.determineTextFont(D,V,F.font));ee.text(V._text||" ").classed("slicetext",!0).attr("text-anchor",N?"end":O||H?"start":"middle").call(l.font,ie).call(c.convertToTspans,p),V.textBB=l.bBox(ee.node()),V.transform=M(V,{fontSize:ie.size,isHeader:H}),V.transform.fontSize=ie.size,E?ee.transition().attrTween("transform",function(ae){var ue=L(ae,!1,re(),[_,A]);return function(le){return T(ue(le))}}):ee.attr("transform",T(V))}),Y}},{"../../components/drawing":388,"../../lib":503,"../../lib/svg_text_utils":529,"../sunburst/fx":1054,"../sunburst/helpers":1055,"../sunburst/plot":1059,"./constants":1078,"./partition":1087,"./style":1090,"@plotly/d3":58}],1083:[function(t,o,f){o.exports=function r(a,l,c){var i;c.swapXY&&(i=a.x0,a.x0=a.y0,a.y0=i,i=a.x1,a.x1=a.y1,a.y1=i),c.flipX&&(i=a.x0,a.x0=l[0]-a.x1,a.x1=l[0]-i),c.flipY&&(i=a.y0,a.y0=l[1]-a.y1,a.y1=l[1]-i);var s=a.children;if(s)for(var u=0;u-1?N+G:-(W+G):0,te={x0:B,x1:B,y0:K,y1:K+W},Y=function(Ce,Fe,ze){var $e=b.tiling.pad,Ke=function(Ye){return Ye-$e<=Fe.x0},Re=function(Ye){return Ye+$e>=Fe.x1},Ve=function(Ye){return Ye-$e<=Fe.y0},We=function(Ye){return Ye+$e>=Fe.y1};return Ce.x0===Fe.x0&&Ce.x1===Fe.x1&&Ce.y0===Fe.y0&&Ce.y1===Fe.y1?{x0:Ce.x0,x1:Ce.x1,y0:Ce.y0,y1:Ce.y1}:{x0:Ke(Ce.x0-$e)?0:Re(Ce.x0-$e)?ze[0]:Ce.x0,x1:Ke(Ce.x1+$e)?0:Re(Ce.x1+$e)?ze[0]:Ce.x1,y0:Ve(Ce.y0-$e)?0:We(Ce.y0-$e)?ze[1]:Ce.y0,y1:Ve(Ce.y1+$e)?0:We(Ce.y1+$e)?ze[1]:Ce.y1}},J=null,re={},U={},V=null,H=function(Ce,Fe){return Fe?re[m(Ce)]:U[m(Ce)]},ne=function(Ce,Fe,ze,$e){if(Fe)return re[m(w)]||te;var Ke=U[b.level]||ze;return function(Re){return Re.data.depth-M.data.depth=($e-=(k?Ot:Ot.r)-i)){var Tt=(ze+$e)/2;ze=Tt,$e=Tt}var at;Ye?Ke<(at=Re-(k?Ot:Ot.b))&&at"?(Ye.x-=Re,nt.x-=Re,ft.x-=Re,yt.x-=Re):Ae==="/"?(ft.x-=Re,yt.x-=Re,Ve.x-=Re/2,We.x-=Re/2):Ae==="\\"?(Ye.x-=Re,nt.x-=Re,Ve.x-=Re/2,We.x-=Re/2):Ae==="<"&&(Ve.x-=Re,We.x-=Re),_e(Ye),_e(yt),_e(Ve),_e(nt),_e(ft),_e(We),"M"+fe(Ye.x,Ye.y)+"L"+fe(nt.x,nt.y)+"L"+fe(We.x,We.y)+"L"+fe(ft.x,ft.y)+"L"+fe(yt.x,yt.y)+"L"+fe(Ve.x,Ve.y)+"Z"},toMoveInsideSlice:ke,makeUpdateSliceInterpolator:de,makeUpdateTextInterpolator:ve,handleSlicesExit:Me,hasTransition:L,strTransform:we}):E.remove()}},{"../../lib":503,"../bar/constants":650,"../bar/plot":659,"../bar/uniform_text":664,"../sunburst/helpers":1055,"./constants":1078,"./draw_ancestors":1081,"@plotly/d3":58,"d3-interpolate":116}],1090:[function(t,o,f){var r=t("@plotly/d3"),a=t("../../components/color"),l=t("../../lib"),c=t("../sunburst/helpers"),i=t("../bar/uniform_text").resizeText;function s(u,h,d,m){var p,g,y=(m||{}).hovered,v=h.data.data,x=v.i,_=v.color,A=c.isHierarchyRoot(h),b=1;if(y)p=d._hovered.marker.line.color,g=d._hovered.marker.line.width;else if(A&&_===d.root.color)b=100,p="rgba(0,0,0,0)",g=0;else if(p=l.castOption(d,x,"marker.line.color")||a.defaultLine,g=l.castOption(d,x,"marker.line.width")||0,!d._hasColorscale&&!h.onPathbar){var k=d.marker.depthfade;if(k){var w,M=a.combine(a.addOpacity(d._backgroundColor,.75),_);if(k===!0){var T=c.getMaxDepth(d);w=isFinite(T)?c.isLeaf(h)?0:d._maxVisibleLayers-(h.data.depth-d._entryDepth):h.data.height+1}else w=h.data.depth-d._entryDepth,d._atRootLevel||w++;if(w>0)for(var E=0;E0){var w,M,T,E,S,P=i.xa,L=i.ya;v.orientation==="h"?(S=s,w="y",T=L,M="x",E=P):(S=u,w="x",T=P,M="y",E=L);var R=y[i.index];if(S>=R.span[0]&&S<=R.span[1]){var F=r.extendFlat({},i),D=E.c2p(S,!0),O=c.getKdeValue(R,v,S),N=c.getPositionOnKdePath(R,v,D),B=T._offset,W=T._length;F[w+"0"]=N[0],F[w+"1"]=N[1],F[M+"0"]=F[M+"1"]=D,F[M+"Label"]=M+": "+a.hoverLabelText(E,S,v[M+"hoverformat"])+", "+y[0].t.labels.kde+" "+O.toFixed(3),F.spikeDistance=k[0].spikeDistance;var G=w+"Spike";F[G]=k[0][G],k[0].spikeDistance=void 0,k[0][G]=void 0,F.hovertemplate=!1,b.push(F),(p={stroke:i.color})[w+"1"]=r.constrain(B+N[0],B,B+W),p[w+"2"]=r.constrain(B+N[1],B,B+W),p[M+"1"]=p[M+"2"]=E._offset+D}}_&&(b=b.concat(k))}x.indexOf("points")!==-1&&(m=l.hoverOnPoints(i,s,u));var K=g.selectAll(".violinline-"+v.uid).data(p?[0]:[]);return K.enter().append("line").classed("violinline-"+v.uid,!0).attr("stroke-width",1.5),K.exit().remove(),K.attr(p),h==="closest"?m?[m]:b:(m&&b.push(m),b)}},{"../../lib":503,"../../plots/cartesian/axes":554,"../box/hover":678,"./helpers":1095}],1097:[function(t,o,f){o.exports={attributes:t("./attributes"),layoutAttributes:t("./layout_attributes"),supplyDefaults:t("./defaults"),crossTraceDefaults:t("../box/defaults").crossTraceDefaults,supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),crossTraceCalc:t("./cross_trace_calc"),plot:t("./plot"),style:t("./style"),styleOnSelect:t("../scatter/style").styleOnSelect,hoverPoints:t("./hover"),selectPoints:t("../box/select"),moduleType:"trace",name:"violin",basePlotModule:t("../../plots/cartesian"),categories:["cartesian","svg","symbols","oriented","box-violin","showLegend","violinLayout","zoomScale"],meta:{}}},{"../../plots/cartesian":568,"../box/defaults":676,"../box/select":683,"../scatter/style":951,"./attributes":1091,"./calc":1092,"./cross_trace_calc":1093,"./defaults":1094,"./hover":1096,"./layout_attributes":1098,"./layout_defaults":1099,"./plot":1100,"./style":1101}],1098:[function(t,o,f){var r=t("../box/layout_attributes"),a=t("../../lib").extendFlat;o.exports={violinmode:a({},r.boxmode,{}),violingap:a({},r.boxgap,{}),violingroupgap:a({},r.boxgroupgap,{})}},{"../../lib":503,"../box/layout_attributes":680}],1099:[function(t,o,f){var r=t("../../lib"),a=t("./layout_attributes"),l=t("../box/layout_defaults");o.exports=function(c,i,s){l._supply(c,i,s,function(u,h){return r.coerce(c,i,a,u,h)},"violin")}},{"../../lib":503,"../box/layout_defaults":681,"./layout_attributes":1098}],1100:[function(t,o,f){var r=t("@plotly/d3"),a=t("../../lib"),l=t("../../components/drawing"),c=t("../box/plot"),i=t("../scatter/line_points"),s=t("./helpers");o.exports=function(u,h,d,m){var p=u._fullLayout,g=h.xaxis,y=h.yaxis;function v(x){var _=i(x,{xaxis:g,yaxis:y,connectGaps:!0,baseTolerance:.75,shape:"spline",simplify:!0,linearized:!0});return l.smoothopen(_[0],1)}a.makeTraceGroups(m,d,"trace violins").each(function(x){var _=r.select(this),A=x[0],b=A.t,k=A.trace;if(k.visible!==!0||b.empty)_.remove();else{var w=b.bPos,M=b.bdPos,T=h[b.valLetter+"axis"],E=h[b.posLetter+"axis"],S=k.side==="both",P=S||k.side==="positive",L=S||k.side==="negative",R=_.selectAll("path.violin").data(a.identity);R.enter().append("path").style("vector-effect","non-scaling-stroke").attr("class","violin"),R.exit().remove(),R.each(function(K){var te,Y,J,re,U,V,H,ne,q=r.select(this),Q=K.density,ee=Q.length,ie=E.c2l(K.pos+w,!0),ae=E.l2p(ie);if(k.width)te=b.maxKDE/M;else{var ue=p._violinScaleGroupStats[k.scalegroup];te=k.scalemode==="count"?ue.maxKDE/M*(ue.maxCount/K.pts.length):ue.maxKDE/M}if(P){for(H=new Array(ee),U=0;U")),g.color=function(R,F){var D=R[F.dir].marker,O=D.color,N=D.line.color,B=D.line.width;if(a(O))return O;if(a(N)&&B)return N}(v,b),[g]}function L(R){return r(A,R,v[_+"hoverformat"])}}},{"../../components/color":366,"../../constants/delta.js":473,"../../plots/cartesian/axes":554,"../bar/hover":655}],1113:[function(t,o,f){o.exports={attributes:t("./attributes"),layoutAttributes:t("./layout_attributes"),supplyDefaults:t("./defaults").supplyDefaults,crossTraceDefaults:t("./defaults").crossTraceDefaults,supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),crossTraceCalc:t("./cross_trace_calc"),plot:t("./plot"),style:t("./style").style,hoverPoints:t("./hover"),eventData:t("./event_data"),selectPoints:t("../bar/select"),moduleType:"trace",name:"waterfall",basePlotModule:t("../../plots/cartesian"),categories:["bar-like","cartesian","svg","oriented","showLegend","zoomScale"],meta:{}}},{"../../plots/cartesian":568,"../bar/select":660,"./attributes":1106,"./calc":1107,"./cross_trace_calc":1109,"./defaults":1110,"./event_data":1111,"./hover":1112,"./layout_attributes":1114,"./layout_defaults":1115,"./plot":1116,"./style":1117}],1114:[function(t,o,f){o.exports={waterfallmode:{valType:"enumerated",values:["group","overlay"],dflt:"group",editType:"calc"},waterfallgap:{valType:"number",min:0,max:1,editType:"calc"},waterfallgroupgap:{valType:"number",min:0,max:1,dflt:0,editType:"calc"}}},{}],1115:[function(t,o,f){var r=t("../../lib"),a=t("./layout_attributes");o.exports=function(l,c,i){var s=!1;function u(m,p){return r.coerce(l,c,a,m,p)}for(var h=0;h0&&(N+=T?"M"+D[0]+","+O[1]+"V"+O[0]:"M"+D[1]+","+O[0]+"H"+D[0]),E!=="between"&&(L.isSum||R path").each(function(x){if(!x.isBlank){var _=v[x.dir].marker;r.select(this).call(l.fill,_.color).call(l.stroke,_.line.color).call(a.dashLine,_.line.dash,_.line.width).style("opacity",v.selectedpoints&&!x.selected?c:1)}}),u(y,v,h),y.selectAll(".lines").each(function(){var x=v.connector.line;a.lineGroupStyle(r.select(this).selectAll("path"),x.width,x.color,x.dash)})})}}},{"../../components/color":366,"../../components/drawing":388,"../../constants/interactions":478,"../bar/style":662,"../bar/uniform_text":664,"@plotly/d3":58}],1118:[function(t,o,f){var r=t("../plots/cartesian/axes"),a=t("../lib"),l=t("../plot_api/plot_schema"),c=t("./helpers").pointsAccessorFunction,i=t("../constants/numerical").BADNUM;f.moduleType="transform",f.name="aggregate";var s=f.attributes={enabled:{valType:"boolean",dflt:!0,editType:"calc"},groups:{valType:"string",strict:!0,noBlank:!0,arrayOk:!0,dflt:"x",editType:"calc"},aggregations:{_isLinkedToArray:"aggregation",target:{valType:"string",editType:"calc"},func:{valType:"enumerated",values:["count","sum","avg","median","mode","rms","stddev","min","max","first","last","change","range"],dflt:"first",editType:"calc"},funcmode:{valType:"enumerated",values:["sample","population"],dflt:"sample",editType:"calc"},enabled:{valType:"boolean",dflt:!0,editType:"calc"},editType:"calc"},editType:"calc"},u=s.aggregations;function h(g,y,v,x){if(x.enabled){for(var _=x.target,A=a.nestedProperty(y,_),b=A.get(),k=function(T,E){var S=T.func,P=E.d2c,L=E.c2d;switch(S){case"count":return d;case"first":return m;case"last":return p;case"sum":return function(R,F){for(var D=0,O=0;OO&&(O=G,N=W)}}return O?L(N):i};case"rms":return function(R,F){for(var D=0,O=0,N=0;N":return function(J){return Y(J)>K};case">=":return function(J){return Y(J)>=K};case"[]":return function(J){var re=Y(J);return re>=K[0]&&re<=K[1]};case"()":return function(J){var re=Y(J);return re>K[0]&&re=K[0]&&reK[0]&&re<=K[1]};case"][":return function(J){var re=Y(J);return re<=K[0]||re>=K[1]};case")(":return function(J){var re=Y(J);return reK[1]};case"](":return function(J){var re=Y(J);return re<=K[0]||re>K[1]};case")[":return function(J){var re=Y(J);return re=K[1]};case"{}":return function(J){return K.indexOf(Y(J))!==-1};case"}{":return function(J){return K.indexOf(Y(J))===-1}}}(p,l.getDataToCoordFunc(d,m,y,g),x),T={},E={},S=0;A?(k=function(F){T[F.astr]=r.extendDeep([],F.get()),F.set(new Array(v))},w=function(F,D){var O=T[F.astr][D];F.get()[D]=O}):(k=function(F){T[F.astr]=r.extendDeep([],F.get()),F.set([])},w=function(F,D){var O=T[F.astr][D];F.get().push(O)}),R(k);for(var P=c(m.transforms,p),L=0;L1?"%{group} (%{trace})":"%{group}");var g=s.styles,y=m.styles=[];if(g)for(d=0;d0?A-4:A;for(x=0;x>16&255,k[w++]=v>>8&255,k[w++]=255&v;return b===2&&(v=s[y.charCodeAt(x)]<<2|s[y.charCodeAt(x+1)]>>4,k[w++]=255&v),b===1&&(v=s[y.charCodeAt(x)]<<10|s[y.charCodeAt(x+1)]<<4|s[y.charCodeAt(x+2)]>>2,k[w++]=v>>8&255,k[w++]=255&v),k},c.fromByteArray=function(y){for(var v,x=y.length,_=x%3,A=[],b=0,k=x-_;bk?k:b+16383));return _===1?(v=y[x-1],A.push(i[v>>2]+i[v<<4&63]+"==")):_===2&&(v=(y[x-2]<<8)+y[x-1],A.push(i[v>>10]+i[v>>4&63]+i[v<<2&63]+"=")),A.join("")};for(var i=[],s=[],u=typeof Uint8Array<"u"?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,m=h.length;d0)throw new Error("Invalid string. Length must be a multiple of 4");var x=y.indexOf("=");return x===-1&&(x=v),[x,x===v?0:4-x%4]}function g(y,v,x){for(var _,A,b=[],k=v;k>18&63]+i[A>>12&63]+i[A>>6&63]+i[63&A]);return b.join("")}s["-".charCodeAt(0)]=62,s["_".charCodeAt(0)]=63},{}],2:[function(a,l,c){},{}],3:[function(a,l,c){(function(i){(function(){var s=a("base64-js"),u=a("ieee754");c.Buffer=d,c.SlowBuffer=function(q){return+q!=q&&(q=0),d.alloc(+q)},c.INSPECT_MAX_BYTES=50;function h(q){if(q>2147483647)throw new RangeError('The value "'+q+'" is invalid for option "size"');var Q=new Uint8Array(q);return Q.__proto__=d.prototype,Q}function d(q,Q,ee){if(typeof q=="number"){if(typeof Q=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return g(q)}return m(q,Q,ee)}function m(q,Q,ee){if(typeof q=="string")return function(ue,le){if(typeof le=="string"&&le!==""||(le="utf8"),!d.isEncoding(le))throw new TypeError("Unknown encoding: "+le);var ge=0|x(ue,le),fe=h(ge),me=fe.write(ue,le);return me!==ge&&(fe=fe.slice(0,me)),fe}(q,Q);if(ArrayBuffer.isView(q))return y(q);if(q==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof q);if(H(q,ArrayBuffer)||q&&H(q.buffer,ArrayBuffer))return function(ue,le,ge){if(le<0||ue.byteLength=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647 .toString(16)+" bytes");return 0|q}function x(q,Q){if(d.isBuffer(q))return q.length;if(ArrayBuffer.isView(q)||H(q,ArrayBuffer))return q.byteLength;if(typeof q!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof q);var ee=q.length,ie=arguments.length>2&&arguments[2]===!0;if(!ie&&ee===0)return 0;for(var ae=!1;;)switch(Q){case"ascii":case"latin1":case"binary":return ee;case"utf8":case"utf-8":return re(q).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*ee;case"hex":return ee>>>1;case"base64":return U(q).length;default:if(ae)return ie?-1:re(q).length;Q=(""+Q).toLowerCase(),ae=!0}}function _(q,Q,ee){var ie=!1;if((Q===void 0||Q<0)&&(Q=0),Q>this.length||((ee===void 0||ee>this.length)&&(ee=this.length),ee<=0)||(ee>>>=0)<=(Q>>>=0))return"";for(q||(q="utf8");;)switch(q){case"hex":return O(this,Q,ee);case"utf8":case"utf-8":return R(this,Q,ee);case"ascii":return F(this,Q,ee);case"latin1":case"binary":return D(this,Q,ee);case"base64":return L(this,Q,ee);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,Q,ee);default:if(ie)throw new TypeError("Unknown encoding: "+q);q=(q+"").toLowerCase(),ie=!0}}function A(q,Q,ee){var ie=q[Q];q[Q]=q[ee],q[ee]=ie}function b(q,Q,ee,ie,ae){if(q.length===0)return-1;if(typeof ee=="string"?(ie=ee,ee=0):ee>2147483647?ee=2147483647:ee<-2147483648&&(ee=-2147483648),ne(ee=+ee)&&(ee=ae?0:q.length-1),ee<0&&(ee=q.length+ee),ee>=q.length){if(ae)return-1;ee=q.length-1}else if(ee<0){if(!ae)return-1;ee=0}if(typeof Q=="string"&&(Q=d.from(Q,ie)),d.isBuffer(Q))return Q.length===0?-1:k(q,Q,ee,ie,ae);if(typeof Q=="number")return Q&=255,typeof Uint8Array.prototype.indexOf=="function"?ae?Uint8Array.prototype.indexOf.call(q,Q,ee):Uint8Array.prototype.lastIndexOf.call(q,Q,ee):k(q,[Q],ee,ie,ae);throw new TypeError("val must be string, number or Buffer")}function k(q,Q,ee,ie,ae){var ue,le=1,ge=q.length,fe=Q.length;if(ie!==void 0&&((ie=String(ie).toLowerCase())==="ucs2"||ie==="ucs-2"||ie==="utf16le"||ie==="utf-16le")){if(q.length<2||Q.length<2)return-1;le=2,ge/=2,fe/=2,ee/=2}function me(Le,de){return le===1?Le[de]:Le.readUInt16BE(de*le)}if(ae){var _e=-1;for(ue=ee;uege&&(ee=ge-fe),ue=ee;ue>=0;ue--){for(var Ae=!0,ke=0;keae&&(ie=ae):ie=ae;var ue=Q.length;ie>ue/2&&(ie=ue/2);for(var le=0;le>8,fe=le%256,me.push(fe),me.push(ge);return me}(Q,q.length-ee),q,ee,ie)}function L(q,Q,ee){return Q===0&&ee===q.length?s.fromByteArray(q):s.fromByteArray(q.slice(Q,ee))}function R(q,Q,ee){ee=Math.min(q.length,ee);for(var ie=[],ae=Q;ae239?4:me>223?3:me>191?2:1;if(ae+Ae<=ee)switch(Ae){case 1:me<128&&(_e=me);break;case 2:(192&(ue=q[ae+1]))==128&&(fe=(31&me)<<6|63&ue)>127&&(_e=fe);break;case 3:ue=q[ae+1],le=q[ae+2],(192&ue)==128&&(192&le)==128&&(fe=(15&me)<<12|(63&ue)<<6|63&le)>2047&&(fe<55296||fe>57343)&&(_e=fe);break;case 4:ue=q[ae+1],le=q[ae+2],ge=q[ae+3],(192&ue)==128&&(192&le)==128&&(192&ge)==128&&(fe=(15&me)<<18|(63&ue)<<12|(63&le)<<6|63&ge)>65535&&fe<1114112&&(_e=fe)}_e===null?(_e=65533,Ae=1):_e>65535&&(_e-=65536,ie.push(_e>>>10&1023|55296),_e=56320|1023&_e),ie.push(_e),ae+=Ae}return function(ke){var Le=ke.length;if(Le<=4096)return String.fromCharCode.apply(String,ke);for(var de="",ve=0;ve"u"||typeof console.error!="function"||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(d.prototype,"parent",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.buffer}}),Object.defineProperty(d.prototype,"offset",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.byteOffset}}),typeof Symbol<"u"&&Symbol.species!=null&&d[Symbol.species]===d&&Object.defineProperty(d,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),d.poolSize=8192,d.from=function(q,Q,ee){return m(q,Q,ee)},d.prototype.__proto__=Uint8Array.prototype,d.__proto__=Uint8Array,d.alloc=function(q,Q,ee){return function(ie,ae,ue){return p(ie),ie<=0?h(ie):ae!==void 0?typeof ue=="string"?h(ie).fill(ae,ue):h(ie).fill(ae):h(ie)}(q,Q,ee)},d.allocUnsafe=function(q){return g(q)},d.allocUnsafeSlow=function(q){return g(q)},d.isBuffer=function(q){return q!=null&&q._isBuffer===!0&&q!==d.prototype},d.compare=function(q,Q){if(H(q,Uint8Array)&&(q=d.from(q,q.offset,q.byteLength)),H(Q,Uint8Array)&&(Q=d.from(Q,Q.offset,Q.byteLength)),!d.isBuffer(q)||!d.isBuffer(Q))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(q===Q)return 0;for(var ee=q.length,ie=Q.length,ae=0,ue=Math.min(ee,ie);aeQ&&(q+=" ... "),""},d.prototype.compare=function(q,Q,ee,ie,ae){if(H(q,Uint8Array)&&(q=d.from(q,q.offset,q.byteLength)),!d.isBuffer(q))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof q);if(Q===void 0&&(Q=0),ee===void 0&&(ee=q?q.length:0),ie===void 0&&(ie=0),ae===void 0&&(ae=this.length),Q<0||ee>q.length||ie<0||ae>this.length)throw new RangeError("out of range index");if(ie>=ae&&Q>=ee)return 0;if(ie>=ae)return-1;if(Q>=ee)return 1;if(this===q)return 0;for(var ue=(ae>>>=0)-(ie>>>=0),le=(ee>>>=0)-(Q>>>=0),ge=Math.min(ue,le),fe=this.slice(ie,ae),me=q.slice(Q,ee),_e=0;_e>>=0,isFinite(ee)?(ee>>>=0,ie===void 0&&(ie="utf8")):(ie=ee,ee=void 0)}var ae=this.length-Q;if((ee===void 0||ee>ae)&&(ee=ae),q.length>0&&(ee<0||Q<0)||Q>this.length)throw new RangeError("Attempt to write outside buffer bounds");ie||(ie="utf8");for(var ue=!1;;)switch(ie){case"hex":return w(this,q,Q,ee);case"utf8":case"utf-8":return M(this,q,Q,ee);case"ascii":return T(this,q,Q,ee);case"latin1":case"binary":return E(this,q,Q,ee);case"base64":return S(this,q,Q,ee);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,q,Q,ee);default:if(ue)throw new TypeError("Unknown encoding: "+ie);ie=(""+ie).toLowerCase(),ue=!0}},d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function F(q,Q,ee){var ie="";ee=Math.min(q.length,ee);for(var ae=Q;aeie)&&(ee=ie);for(var ae="",ue=Q;ueee)throw new RangeError("Trying to access beyond buffer length")}function W(q,Q,ee,ie,ae,ue){if(!d.isBuffer(q))throw new TypeError('"buffer" argument must be a Buffer instance');if(Q>ae||Qq.length)throw new RangeError("Index out of range")}function G(q,Q,ee,ie,ae,ue){if(ee+ie>q.length)throw new RangeError("Index out of range");if(ee<0)throw new RangeError("Index out of range")}function K(q,Q,ee,ie,ae){return Q=+Q,ee>>>=0,ae||G(q,0,ee,4),u.write(q,Q,ee,ie,23,4),ee+4}function te(q,Q,ee,ie,ae){return Q=+Q,ee>>>=0,ae||G(q,0,ee,8),u.write(q,Q,ee,ie,52,8),ee+8}d.prototype.slice=function(q,Q){var ee=this.length;(q=~~q)<0?(q+=ee)<0&&(q=0):q>ee&&(q=ee),(Q=Q===void 0?ee:~~Q)<0?(Q+=ee)<0&&(Q=0):Q>ee&&(Q=ee),Q>>=0,Q>>>=0,ee||B(q,Q,this.length);for(var ie=this[q],ae=1,ue=0;++ue>>=0,Q>>>=0,ee||B(q,Q,this.length);for(var ie=this[q+--Q],ae=1;Q>0&&(ae*=256);)ie+=this[q+--Q]*ae;return ie},d.prototype.readUInt8=function(q,Q){return q>>>=0,Q||B(q,1,this.length),this[q]},d.prototype.readUInt16LE=function(q,Q){return q>>>=0,Q||B(q,2,this.length),this[q]|this[q+1]<<8},d.prototype.readUInt16BE=function(q,Q){return q>>>=0,Q||B(q,2,this.length),this[q]<<8|this[q+1]},d.prototype.readUInt32LE=function(q,Q){return q>>>=0,Q||B(q,4,this.length),(this[q]|this[q+1]<<8|this[q+2]<<16)+16777216*this[q+3]},d.prototype.readUInt32BE=function(q,Q){return q>>>=0,Q||B(q,4,this.length),16777216*this[q]+(this[q+1]<<16|this[q+2]<<8|this[q+3])},d.prototype.readIntLE=function(q,Q,ee){q>>>=0,Q>>>=0,ee||B(q,Q,this.length);for(var ie=this[q],ae=1,ue=0;++ue=(ae*=128)&&(ie-=Math.pow(2,8*Q)),ie},d.prototype.readIntBE=function(q,Q,ee){q>>>=0,Q>>>=0,ee||B(q,Q,this.length);for(var ie=Q,ae=1,ue=this[q+--ie];ie>0&&(ae*=256);)ue+=this[q+--ie]*ae;return ue>=(ae*=128)&&(ue-=Math.pow(2,8*Q)),ue},d.prototype.readInt8=function(q,Q){return q>>>=0,Q||B(q,1,this.length),128&this[q]?-1*(255-this[q]+1):this[q]},d.prototype.readInt16LE=function(q,Q){q>>>=0,Q||B(q,2,this.length);var ee=this[q]|this[q+1]<<8;return 32768&ee?4294901760|ee:ee},d.prototype.readInt16BE=function(q,Q){q>>>=0,Q||B(q,2,this.length);var ee=this[q+1]|this[q]<<8;return 32768&ee?4294901760|ee:ee},d.prototype.readInt32LE=function(q,Q){return q>>>=0,Q||B(q,4,this.length),this[q]|this[q+1]<<8|this[q+2]<<16|this[q+3]<<24},d.prototype.readInt32BE=function(q,Q){return q>>>=0,Q||B(q,4,this.length),this[q]<<24|this[q+1]<<16|this[q+2]<<8|this[q+3]},d.prototype.readFloatLE=function(q,Q){return q>>>=0,Q||B(q,4,this.length),u.read(this,q,!0,23,4)},d.prototype.readFloatBE=function(q,Q){return q>>>=0,Q||B(q,4,this.length),u.read(this,q,!1,23,4)},d.prototype.readDoubleLE=function(q,Q){return q>>>=0,Q||B(q,8,this.length),u.read(this,q,!0,52,8)},d.prototype.readDoubleBE=function(q,Q){return q>>>=0,Q||B(q,8,this.length),u.read(this,q,!1,52,8)},d.prototype.writeUIntLE=function(q,Q,ee,ie){q=+q,Q>>>=0,ee>>>=0,ie||W(this,q,Q,ee,Math.pow(2,8*ee)-1,0);var ae=1,ue=0;for(this[Q]=255&q;++ue>>=0,ee>>>=0,ie||W(this,q,Q,ee,Math.pow(2,8*ee)-1,0);var ae=ee-1,ue=1;for(this[Q+ae]=255&q;--ae>=0&&(ue*=256);)this[Q+ae]=q/ue&255;return Q+ee},d.prototype.writeUInt8=function(q,Q,ee){return q=+q,Q>>>=0,ee||W(this,q,Q,1,255,0),this[Q]=255&q,Q+1},d.prototype.writeUInt16LE=function(q,Q,ee){return q=+q,Q>>>=0,ee||W(this,q,Q,2,65535,0),this[Q]=255&q,this[Q+1]=q>>>8,Q+2},d.prototype.writeUInt16BE=function(q,Q,ee){return q=+q,Q>>>=0,ee||W(this,q,Q,2,65535,0),this[Q]=q>>>8,this[Q+1]=255&q,Q+2},d.prototype.writeUInt32LE=function(q,Q,ee){return q=+q,Q>>>=0,ee||W(this,q,Q,4,4294967295,0),this[Q+3]=q>>>24,this[Q+2]=q>>>16,this[Q+1]=q>>>8,this[Q]=255&q,Q+4},d.prototype.writeUInt32BE=function(q,Q,ee){return q=+q,Q>>>=0,ee||W(this,q,Q,4,4294967295,0),this[Q]=q>>>24,this[Q+1]=q>>>16,this[Q+2]=q>>>8,this[Q+3]=255&q,Q+4},d.prototype.writeIntLE=function(q,Q,ee,ie){if(q=+q,Q>>>=0,!ie){var ae=Math.pow(2,8*ee-1);W(this,q,Q,ee,ae-1,-ae)}var ue=0,le=1,ge=0;for(this[Q]=255&q;++ue>0)-ge&255;return Q+ee},d.prototype.writeIntBE=function(q,Q,ee,ie){if(q=+q,Q>>>=0,!ie){var ae=Math.pow(2,8*ee-1);W(this,q,Q,ee,ae-1,-ae)}var ue=ee-1,le=1,ge=0;for(this[Q+ue]=255&q;--ue>=0&&(le*=256);)q<0&&ge===0&&this[Q+ue+1]!==0&&(ge=1),this[Q+ue]=(q/le>>0)-ge&255;return Q+ee},d.prototype.writeInt8=function(q,Q,ee){return q=+q,Q>>>=0,ee||W(this,q,Q,1,127,-128),q<0&&(q=255+q+1),this[Q]=255&q,Q+1},d.prototype.writeInt16LE=function(q,Q,ee){return q=+q,Q>>>=0,ee||W(this,q,Q,2,32767,-32768),this[Q]=255&q,this[Q+1]=q>>>8,Q+2},d.prototype.writeInt16BE=function(q,Q,ee){return q=+q,Q>>>=0,ee||W(this,q,Q,2,32767,-32768),this[Q]=q>>>8,this[Q+1]=255&q,Q+2},d.prototype.writeInt32LE=function(q,Q,ee){return q=+q,Q>>>=0,ee||W(this,q,Q,4,2147483647,-2147483648),this[Q]=255&q,this[Q+1]=q>>>8,this[Q+2]=q>>>16,this[Q+3]=q>>>24,Q+4},d.prototype.writeInt32BE=function(q,Q,ee){return q=+q,Q>>>=0,ee||W(this,q,Q,4,2147483647,-2147483648),q<0&&(q=4294967295+q+1),this[Q]=q>>>24,this[Q+1]=q>>>16,this[Q+2]=q>>>8,this[Q+3]=255&q,Q+4},d.prototype.writeFloatLE=function(q,Q,ee){return K(this,q,Q,!0,ee)},d.prototype.writeFloatBE=function(q,Q,ee){return K(this,q,Q,!1,ee)},d.prototype.writeDoubleLE=function(q,Q,ee){return te(this,q,Q,!0,ee)},d.prototype.writeDoubleBE=function(q,Q,ee){return te(this,q,Q,!1,ee)},d.prototype.copy=function(q,Q,ee,ie){if(!d.isBuffer(q))throw new TypeError("argument should be a Buffer");if(ee||(ee=0),ie||ie===0||(ie=this.length),Q>=q.length&&(Q=q.length),Q||(Q=0),ie>0&&ie=this.length)throw new RangeError("Index out of range");if(ie<0)throw new RangeError("sourceEnd out of bounds");ie>this.length&&(ie=this.length),q.length-Q=0;--ue)q[ue+Q]=this[ue+ee];else Uint8Array.prototype.set.call(q,this.subarray(ee,ie),Q);return ae},d.prototype.fill=function(q,Q,ee,ie){if(typeof q=="string"){if(typeof Q=="string"?(ie=Q,Q=0,ee=this.length):typeof ee=="string"&&(ie=ee,ee=this.length),ie!==void 0&&typeof ie!="string")throw new TypeError("encoding must be a string");if(typeof ie=="string"&&!d.isEncoding(ie))throw new TypeError("Unknown encoding: "+ie);if(q.length===1){var ae=q.charCodeAt(0);(ie==="utf8"&&ae<128||ie==="latin1")&&(q=ae)}}else typeof q=="number"&&(q&=255);if(Q<0||this.length>>=0,ee=ee===void 0?this.length:ee>>>0,q||(q=0),typeof q=="number")for(ue=Q;ue55295&&ee<57344){if(!ae){if(ee>56319){(Q-=3)>-1&&ue.push(239,191,189);continue}if(le+1===ie){(Q-=3)>-1&&ue.push(239,191,189);continue}ae=ee;continue}if(ee<56320){(Q-=3)>-1&&ue.push(239,191,189),ae=ee;continue}ee=65536+(ae-55296<<10|ee-56320)}else ae&&(Q-=3)>-1&&ue.push(239,191,189);if(ae=null,ee<128){if((Q-=1)<0)break;ue.push(ee)}else if(ee<2048){if((Q-=2)<0)break;ue.push(ee>>6|192,63&ee|128)}else if(ee<65536){if((Q-=3)<0)break;ue.push(ee>>12|224,ee>>6&63|128,63&ee|128)}else{if(!(ee<1114112))throw new Error("Invalid code point");if((Q-=4)<0)break;ue.push(ee>>18|240,ee>>12&63|128,ee>>6&63|128,63&ee|128)}}return ue}function U(q){return s.toByteArray(function(Q){if((Q=(Q=Q.split("=")[0]).trim().replace(Y,"")).length<2)return"";for(;Q.length%4!=0;)Q+="=";return Q}(q))}function V(q,Q,ee,ie){for(var ae=0;ae=Q.length||ae>=q.length);++ae)Q[ae+ee]=q[ae];return ae}function H(q,Q){return q instanceof Q||q!=null&&q.constructor!=null&&q.constructor.name!=null&&q.constructor.name===Q.name}function ne(q){return q!=q}}).call(this)}).call(this,a("buffer").Buffer)},{"base64-js":1,buffer:3,ieee754:4}],4:[function(a,l,c){c.read=function(i,s,u,h,d){var m,p,g=8*d-h-1,y=(1<>1,x=-7,_=u?d-1:0,A=u?-1:1,b=i[s+_];for(_+=A,m=b&(1<<-x)-1,b>>=-x,x+=g;x>0;m=256*m+i[s+_],_+=A,x-=8);for(p=m&(1<<-x)-1,m>>=-x,x+=h;x>0;p=256*p+i[s+_],_+=A,x-=8);if(m===0)m=1-v;else{if(m===y)return p?NaN:1/0*(b?-1:1);p+=Math.pow(2,h),m-=v}return(b?-1:1)*p*Math.pow(2,m-h)},c.write=function(i,s,u,h,d,m){var p,g,y,v=8*m-d-1,x=(1<>1,A=d===23?Math.pow(2,-24)-Math.pow(2,-77):0,b=h?0:m-1,k=h?1:-1,w=s<0||s===0&&1/s<0?1:0;for(s=Math.abs(s),isNaN(s)||s===1/0?(g=isNaN(s)?1:0,p=x):(p=Math.floor(Math.log(s)/Math.LN2),s*(y=Math.pow(2,-p))<1&&(p--,y*=2),(s+=p+_>=1?A/y:A*Math.pow(2,1-_))*y>=2&&(p++,y/=2),p+_>=x?(g=0,p=x):p+_>=1?(g=(s*y-1)*Math.pow(2,d),p+=_):(g=s*Math.pow(2,_-1)*Math.pow(2,d),p=0));d>=8;i[u+b]=255&g,b+=k,g/=256,d-=8);for(p=p<0;i[u+b]=255&p,b+=k,p/=256,v-=8);i[u+b-k]|=128*w}},{}],5:[function(a,l,c){var i,s,u=l.exports={};function h(){throw new Error("setTimeout has not been defined")}function d(){throw new Error("clearTimeout has not been defined")}function m(k){if(i===setTimeout)return setTimeout(k,0);if((i===h||!i)&&setTimeout)return i=setTimeout,setTimeout(k,0);try{return i(k,0)}catch{try{return i.call(null,k,0)}catch{return i.call(this,k,0)}}}(function(){try{i=typeof setTimeout=="function"?setTimeout:h}catch{i=h}try{s=typeof clearTimeout=="function"?clearTimeout:d}catch{s=d}})();var p,g=[],y=!1,v=-1;function x(){y&&p&&(y=!1,p.length?g=p.concat(g):v=-1,g.length&&_())}function _(){if(!y){var k=m(x);y=!0;for(var w=g.length;w;){for(p=g,g=[];++v1)for(var M=1;M"u"?a("weak-map"):WeakMap,s=a("gl-buffer"),u=a("gl-vao"),h=new i;l.exports=function(d){var m=h.get(d),p=m&&(m._triangleBuffer.handle||m._triangleBuffer.buffer);if(!p||!d.isBuffer(p)){var g=s(d,new Float32Array([-1,-1,-1,4,4,-1]));(m=u(d,[{buffer:g,type:d.FLOAT,size:2}]))._triangleBuffer=g,h.set(d,m)}m.bind(),d.drawArrays(d.TRIANGLES,0,3),m.unbind()}},{"gl-buffer":78,"gl-vao":150,"weak-map":313}],9:[function(a,l,c){var i=a("pad-left");l.exports=function(s,u,h){u=typeof u=="number"?u:1,h=h||": ";var d=s.split(/\r?\n/),m=String(d.length+u-1).length;return d.map(function(p,g){var y=g+u,v=String(y).length;return i(y,m-v)+h+p}).join(` -`)}},{"pad-left":264}],10:[function(a,l,c){l.exports=function(u){var h=u.length;if(h===0)return[];if(h===1)return[0];for(var d=u[0].length,m=[u[0]],p=[0],g=1;g0?v=v.ushln(_):_<0&&(x=x.ushln(-_)),d(v,x)}},{"./div":17,"./is-rat":19,"./lib/is-bn":23,"./lib/num-to-bn":24,"./lib/rationalize":25,"./lib/str-to-bn":26}],19:[function(a,l,c){var i=a("./lib/is-bn");l.exports=function(s){return Array.isArray(s)&&s.length===2&&i(s[0])&&i(s[1])}},{"./lib/is-bn":23}],20:[function(a,l,c){var i=a("bn.js");l.exports=function(s){return s.cmp(new i(0))}},{"bn.js":33}],21:[function(a,l,c){var i=a("./bn-sign");l.exports=function(s){var u=s.length,h=s.words,d=0;if(u===1)d=h[0];else if(u===2)d=h[0]+67108864*h[1];else for(var m=0;m20?52:d+32}},{"bit-twiddle":32,"double-bits":64}],23:[function(a,l,c){a("bn.js"),l.exports=function(i){return i&&typeof i=="object"&&!!i.words}},{"bn.js":33}],24:[function(a,l,c){var i=a("bn.js"),s=a("double-bits");l.exports=function(u){var h=s.exponent(u);return h<52?new i(u):new i(u*Math.pow(2,52-h)).ushln(h-52)}},{"bn.js":33,"double-bits":64}],25:[function(a,l,c){var i=a("./num-to-bn"),s=a("./bn-sign");l.exports=function(u,h){var d=s(u),m=s(h);if(d===0)return[i(0),i(1)];if(m===0)return[i(0),i(0)];m<0&&(u=u.neg(),h=h.neg());var p=u.gcd(h);return p.cmpn(1)?[u.div(p),h.div(p)]:[u,h]}},{"./bn-sign":20,"./num-to-bn":24}],26:[function(a,l,c){var i=a("bn.js");l.exports=function(s){return new i(s)}},{"bn.js":33}],27:[function(a,l,c){var i=a("./lib/rationalize");l.exports=function(s,u){return i(s[0].mul(u[0]),s[1].mul(u[1]))}},{"./lib/rationalize":25}],28:[function(a,l,c){var i=a("./lib/bn-sign");l.exports=function(s){return i(s[0])*i(s[1])}},{"./lib/bn-sign":20}],29:[function(a,l,c){var i=a("./lib/rationalize");l.exports=function(s,u){return i(s[0].mul(u[1]).sub(s[1].mul(u[0])),s[1].mul(u[1]))}},{"./lib/rationalize":25}],30:[function(a,l,c){var i=a("./lib/bn-to-num"),s=a("./lib/ctz");l.exports=function(u){var h=u[0],d=u[1];if(h.cmpn(0)===0)return 0;var m=h.abs().divmod(d.abs()),p=m.div,g=i(p),y=m.mod,v=h.negative!==d.negative?-1:1;if(y.cmpn(0)===0)return v*g;if(g){var x=s(g)+4,_=i(y.ushln(x).divRound(d));return v*(g+_*Math.pow(2,-x))}var A=d.bitLength()-y.bitLength()+53;return _=i(y.ushln(A).divRound(d)),A<1023?v*_*Math.pow(2,-A):(_*=Math.pow(2,-1023),v*_*Math.pow(2,1023-A))}},{"./lib/bn-to-num":21,"./lib/ctz":22}],31:[function(a,l,c){function i(p,g,y,v,x){for(var _=x+1;v<=x;){var A=v+x>>>1,b=p[A];(y!==void 0?y(b,g):b-g)>=0?(_=A,x=A-1):v=A+1}return _}function s(p,g,y,v,x){for(var _=x+1;v<=x;){var A=v+x>>>1,b=p[A];(y!==void 0?y(b,g):b-g)>0?(_=A,x=A-1):v=A+1}return _}function u(p,g,y,v,x){for(var _=v-1;v<=x;){var A=v+x>>>1,b=p[A];(y!==void 0?y(b,g):b-g)<0?(_=A,v=A+1):x=A-1}return _}function h(p,g,y,v,x){for(var _=v-1;v<=x;){var A=v+x>>>1,b=p[A];(y!==void 0?y(b,g):b-g)<=0?(_=A,v=A+1):x=A-1}return _}function d(p,g,y,v,x){for(;v<=x;){var _=v+x>>>1,A=p[_],b=y!==void 0?y(A,g):A-g;if(b===0)return _;b<=0?v=_+1:x=_-1}return-1}function m(p,g,y,v,x,_){return typeof y=="function"?_(p,g,y,v===void 0?0:0|v,x===void 0?p.length-1:0|x):_(p,g,void 0,y===void 0?0:0|y,v===void 0?p.length-1:0|v)}l.exports={ge:function(p,g,y,v,x){return m(p,g,y,v,x,i)},gt:function(p,g,y,v,x){return m(p,g,y,v,x,s)},lt:function(p,g,y,v,x){return m(p,g,y,v,x,u)},le:function(p,g,y,v,x){return m(p,g,y,v,x,h)},eq:function(p,g,y,v,x){return m(p,g,y,v,x,d)}}},{}],32:[function(a,l,c){function i(u){var h=32;return(u&=-u)&&h--,65535&u&&(h-=16),16711935&u&&(h-=8),252645135&u&&(h-=4),858993459&u&&(h-=2),1431655765&u&&(h-=1),h}c.INT_BITS=32,c.INT_MAX=2147483647,c.INT_MIN=-1<<31,c.sign=function(u){return(u>0)-(u<0)},c.abs=function(u){var h=u>>31;return(u^h)-h},c.min=function(u,h){return h^(u^h)&-(u65535)<<4,h|=d=((u>>>=h)>255)<<3,h|=d=((u>>>=d)>15)<<2,(h|=d=((u>>>=d)>3)<<1)|(u>>>=d)>>1},c.log10=function(u){return u>=1e9?9:u>=1e8?8:u>=1e7?7:u>=1e6?6:u>=1e5?5:u>=1e4?4:u>=1e3?3:u>=100?2:u>=10?1:0},c.popCount=function(u){return 16843009*((u=(858993459&(u-=u>>>1&1431655765))+(u>>>2&858993459))+(u>>>4)&252645135)>>>24},c.countTrailingZeros=i,c.nextPow2=function(u){return u+=u===0,--u,u|=u>>>1,u|=u>>>2,u|=u>>>4,u|=u>>>8,(u|=u>>>16)+1},c.prevPow2=function(u){return u|=u>>>1,u|=u>>>2,u|=u>>>4,u|=u>>>8,(u|=u>>>16)-(u>>>1)},c.parity=function(u){return u^=u>>>16,u^=u>>>8,u^=u>>>4,27030>>>(u&=15)&1};var s=new Array(256);(function(u){for(var h=0;h<256;++h){var d=h,m=h,p=7;for(d>>>=1;d;d>>>=1)m<<=1,m|=1&d,--p;u[h]=m<>>8&255]<<16|s[u>>>16&255]<<8|s[u>>>24&255]},c.interleave2=function(u,h){return(u=1431655765&((u=858993459&((u=252645135&((u=16711935&((u&=65535)|u<<8))|u<<4))|u<<2))|u<<1))|(h=1431655765&((h=858993459&((h=252645135&((h=16711935&((h&=65535)|h<<8))|h<<4))|h<<2))|h<<1))<<1},c.deinterleave2=function(u,h){return(u=65535&((u=16711935&((u=252645135&((u=858993459&((u=u>>>h&1431655765)|u>>>1))|u>>>2))|u>>>4))|u>>>16))<<16>>16},c.interleave3=function(u,h,d){return u=1227133513&((u=3272356035&((u=251719695&((u=4278190335&((u&=1023)|u<<16))|u<<8))|u<<4))|u<<2),(u|=(h=1227133513&((h=3272356035&((h=251719695&((h=4278190335&((h&=1023)|h<<16))|h<<8))|h<<4))|h<<2))<<1)|(d=1227133513&((d=3272356035&((d=251719695&((d=4278190335&((d&=1023)|d<<16))|d<<8))|d<<4))|d<<2))<<2},c.deinterleave3=function(u,h){return(u=1023&((u=4278190335&((u=251719695&((u=3272356035&((u=u>>>h&1227133513)|u>>>2))|u>>>4))|u>>>8))|u>>>16))<<22>>22},c.nextCombination=function(u){var h=u|u-1;return h+1|(~h&-~h)-1>>>i(u)+1}},{}],33:[function(a,l,c){(function(i,s){function u(D,O){if(!D)throw new Error(O||"Assertion failed")}function h(D,O){D.super_=O;var N=function(){};N.prototype=O.prototype,D.prototype=new N,D.prototype.constructor=D}function d(D,O,N){if(d.isBN(D))return D;this.negative=0,this.words=null,this.length=0,this.red=null,D!==null&&(O!=="le"&&O!=="be"||(N=O,O=10),this._init(D||0,O||10,N||"be"))}var m;typeof i=="object"?i.exports=d:s.BN=d,d.BN=d,d.wordSize=26;try{m=typeof window<"u"&&window.Buffer!==void 0?window.Buffer:a("buffer").Buffer}catch{}function p(D,O){var N=D.charCodeAt(O);return N>=65&&N<=70?N-55:N>=97&&N<=102?N-87:N-48&15}function g(D,O,N){var B=p(D,N);return N-1>=O&&(B|=p(D,N-1)<<4),B}function y(D,O,N,B){for(var W=0,G=Math.min(D.length,N),K=O;K=49?te-49+10:te>=17?te-17+10:te}return W}d.isBN=function(D){return D instanceof d||D!==null&&typeof D=="object"&&D.constructor.wordSize===d.wordSize&&Array.isArray(D.words)},d.max=function(D,O){return D.cmp(O)>0?D:O},d.min=function(D,O){return D.cmp(O)<0?D:O},d.prototype._init=function(D,O,N){if(typeof D=="number")return this._initNumber(D,O,N);if(typeof D=="object")return this._initArray(D,O,N);O==="hex"&&(O=16),u(O===(0|O)&&O>=2&&O<=36);var B=0;(D=D.toString().replace(/\s+/g,""))[0]==="-"&&(B++,this.negative=1),B=0;B-=3)G=D[B]|D[B-1]<<8|D[B-2]<<16,this.words[W]|=G<>>26-K&67108863,(K+=24)>=26&&(K-=26,W++);else if(N==="le")for(B=0,W=0;B>>26-K&67108863,(K+=24)>=26&&(K-=26,W++);return this.strip()},d.prototype._parseHex=function(D,O,N){this.length=Math.ceil((D.length-O)/6),this.words=new Array(this.length);for(var B=0;B=O;B-=2)W=g(D,O,B)<=18?(G-=18,K+=1,this.words[K]|=W>>>26):G+=8;else for(B=(D.length-O)%2==0?O+1:O;B=18?(G-=18,K+=1,this.words[K]|=W>>>26):G+=8;this.strip()},d.prototype._parseBase=function(D,O,N){this.words=[0],this.length=1;for(var B=0,W=1;W<=67108863;W*=O)B++;B--,W=W/O|0;for(var G=D.length-N,K=G%B,te=Math.min(G,G-K)+N,Y=0,J=N;J1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},d.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},d.prototype.inspect=function(){return(this.red?""};var v=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],x=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],_=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function A(D,O,N){N.negative=O.negative^D.negative;var B=D.length+O.length|0;N.length=B,B=B-1|0;var W=0|D.words[0],G=0|O.words[0],K=W*G,te=67108863&K,Y=K/67108864|0;N.words[0]=te;for(var J=1;J>>26,U=67108863&Y,V=Math.min(J,O.length-1),H=Math.max(0,J-D.length+1);H<=V;H++){var ne=J-H|0;re+=(K=(W=0|D.words[ne])*(G=0|O.words[H])+U)/67108864|0,U=67108863&K}N.words[J]=0|U,Y=0|re}return Y!==0?N.words[J]=0|Y:N.length--,N.strip()}d.prototype.toString=function(D,O){var N;if(O=0|O||1,(D=D||10)===16||D==="hex"){N="";for(var B=0,W=0,G=0;G>>24-B&16777215)!==0||G!==this.length-1?v[6-te.length]+te+N:te+N,(B+=2)>=26&&(B-=26,G--)}for(W!==0&&(N=W.toString(16)+N);N.length%O!=0;)N="0"+N;return this.negative!==0&&(N="-"+N),N}if(D===(0|D)&&D>=2&&D<=36){var Y=x[D],J=_[D];N="";var re=this.clone();for(re.negative=0;!re.isZero();){var U=re.modn(J).toString(D);N=(re=re.idivn(J)).isZero()?U+N:v[Y-U.length]+U+N}for(this.isZero()&&(N="0"+N);N.length%O!=0;)N="0"+N;return this.negative!==0&&(N="-"+N),N}u(!1,"Base should be between 2 and 36")},d.prototype.toNumber=function(){var D=this.words[0];return this.length===2?D+=67108864*this.words[1]:this.length===3&&this.words[2]===1?D+=4503599627370496+67108864*this.words[1]:this.length>2&&u(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-D:D},d.prototype.toJSON=function(){return this.toString(16)},d.prototype.toBuffer=function(D,O){return u(m!==void 0),this.toArrayLike(m,D,O)},d.prototype.toArray=function(D,O){return this.toArrayLike(Array,D,O)},d.prototype.toArrayLike=function(D,O,N){var B=this.byteLength(),W=N||Math.max(1,B);u(B<=W,"byte array longer than desired length"),u(W>0,"Requested array length <= 0"),this.strip();var G,K,te=O==="le",Y=new D(W),J=this.clone();if(te){for(K=0;!J.isZero();K++)G=J.andln(255),J.iushrn(8),Y[K]=G;for(;K=4096&&(N+=13,O>>>=13),O>=64&&(N+=7,O>>>=7),O>=8&&(N+=4,O>>>=4),O>=2&&(N+=2,O>>>=2),N+O},d.prototype._zeroBits=function(D){if(D===0)return 26;var O=D,N=0;return!(8191&O)&&(N+=13,O>>>=13),!(127&O)&&(N+=7,O>>>=7),!(15&O)&&(N+=4,O>>>=4),!(3&O)&&(N+=2,O>>>=2),!(1&O)&&N++,N},d.prototype.bitLength=function(){var D=this.words[this.length-1],O=this._countBits(D);return 26*(this.length-1)+O},d.prototype.zeroBits=function(){if(this.isZero())return 0;for(var D=0,O=0;OD.length?this.clone().ior(D):D.clone().ior(this)},d.prototype.uor=function(D){return this.length>D.length?this.clone().iuor(D):D.clone().iuor(this)},d.prototype.iuand=function(D){var O;O=this.length>D.length?D:this;for(var N=0;ND.length?this.clone().iand(D):D.clone().iand(this)},d.prototype.uand=function(D){return this.length>D.length?this.clone().iuand(D):D.clone().iuand(this)},d.prototype.iuxor=function(D){var O,N;this.length>D.length?(O=this,N=D):(O=D,N=this);for(var B=0;BD.length?this.clone().ixor(D):D.clone().ixor(this)},d.prototype.uxor=function(D){return this.length>D.length?this.clone().iuxor(D):D.clone().iuxor(this)},d.prototype.inotn=function(D){u(typeof D=="number"&&D>=0);var O=0|Math.ceil(D/26),N=D%26;this._expand(O),N>0&&O--;for(var B=0;B0&&(this.words[B]=~this.words[B]&67108863>>26-N),this.strip()},d.prototype.notn=function(D){return this.clone().inotn(D)},d.prototype.setn=function(D,O){u(typeof D=="number"&&D>=0);var N=D/26|0,B=D%26;return this._expand(N+1),this.words[N]=O?this.words[N]|1<D.length?(N=this,B=D):(N=D,B=this);for(var W=0,G=0;G>>26;for(;W!==0&&G>>26;if(this.length=N.length,W!==0)this.words[this.length]=W,this.length++;else if(N!==this)for(;GD.length?this.clone().iadd(D):D.clone().iadd(this)},d.prototype.isub=function(D){if(D.negative!==0){D.negative=0;var O=this.iadd(D);return D.negative=1,O._normSign()}if(this.negative!==0)return this.negative=0,this.iadd(D),this.negative=1,this._normSign();var N,B,W=this.cmp(D);if(W===0)return this.negative=0,this.length=1,this.words[0]=0,this;W>0?(N=this,B=D):(N=D,B=this);for(var G=0,K=0;K>26,this.words[K]=67108863&O;for(;G!==0&&K>26,this.words[K]=67108863&O;if(G===0&&K>>13,H=0|K[1],ne=8191&H,q=H>>>13,Q=0|K[2],ee=8191&Q,ie=Q>>>13,ae=0|K[3],ue=8191&ae,le=ae>>>13,ge=0|K[4],fe=8191&ge,me=ge>>>13,_e=0|K[5],Ae=8191&_e,ke=_e>>>13,Le=0|K[6],de=8191&Le,ve=Le>>>13,Me=0|K[7],we=8191&Me,Ce=Me>>>13,Fe=0|K[8],ze=8191&Fe,$e=Fe>>>13,Ke=0|K[9],Re=8191&Ke,Ve=Ke>>>13,We=0|te[0],Ye=8191&We,nt=We>>>13,ft=0|te[1],yt=8191&ft,Ot=ft>>>13,Tt=0|te[2],at=8191&Tt,et=Tt>>>13,Lt=0|te[3],Wt=8191&Lt,Jt=Lt>>>13,Be=0|te[4],Ge=8191&Be,kt=Be>>>13,dt=0|te[5],Oe=8191&dt,Ie=dt>>>13,Te=0|te[6],Pe=8191&Te,qe=Te>>>13,rt=0|te[7],lt=8191&rt,ot=rt>>>13,At=0|te[8],wt=8191&At,$t=At>>>13,Ut=0|te[9],tt=8191&Ut,bt=Ut>>>13;N.negative=D.negative^O.negative,N.length=19;var Ft=(J+(B=Math.imul(U,Ye))|0)+((8191&(W=(W=Math.imul(U,nt))+Math.imul(V,Ye)|0))<<13)|0;J=((G=Math.imul(V,nt))+(W>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,B=Math.imul(ne,Ye),W=(W=Math.imul(ne,nt))+Math.imul(q,Ye)|0,G=Math.imul(q,nt);var Et=(J+(B=B+Math.imul(U,yt)|0)|0)+((8191&(W=(W=W+Math.imul(U,Ot)|0)+Math.imul(V,yt)|0))<<13)|0;J=((G=G+Math.imul(V,Ot)|0)+(W>>>13)|0)+(Et>>>26)|0,Et&=67108863,B=Math.imul(ee,Ye),W=(W=Math.imul(ee,nt))+Math.imul(ie,Ye)|0,G=Math.imul(ie,nt),B=B+Math.imul(ne,yt)|0,W=(W=W+Math.imul(ne,Ot)|0)+Math.imul(q,yt)|0,G=G+Math.imul(q,Ot)|0;var Pt=(J+(B=B+Math.imul(U,at)|0)|0)+((8191&(W=(W=W+Math.imul(U,et)|0)+Math.imul(V,at)|0))<<13)|0;J=((G=G+Math.imul(V,et)|0)+(W>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,B=Math.imul(ue,Ye),W=(W=Math.imul(ue,nt))+Math.imul(le,Ye)|0,G=Math.imul(le,nt),B=B+Math.imul(ee,yt)|0,W=(W=W+Math.imul(ee,Ot)|0)+Math.imul(ie,yt)|0,G=G+Math.imul(ie,Ot)|0,B=B+Math.imul(ne,at)|0,W=(W=W+Math.imul(ne,et)|0)+Math.imul(q,at)|0,G=G+Math.imul(q,et)|0;var De=(J+(B=B+Math.imul(U,Wt)|0)|0)+((8191&(W=(W=W+Math.imul(U,Jt)|0)+Math.imul(V,Wt)|0))<<13)|0;J=((G=G+Math.imul(V,Jt)|0)+(W>>>13)|0)+(De>>>26)|0,De&=67108863,B=Math.imul(fe,Ye),W=(W=Math.imul(fe,nt))+Math.imul(me,Ye)|0,G=Math.imul(me,nt),B=B+Math.imul(ue,yt)|0,W=(W=W+Math.imul(ue,Ot)|0)+Math.imul(le,yt)|0,G=G+Math.imul(le,Ot)|0,B=B+Math.imul(ee,at)|0,W=(W=W+Math.imul(ee,et)|0)+Math.imul(ie,at)|0,G=G+Math.imul(ie,et)|0,B=B+Math.imul(ne,Wt)|0,W=(W=W+Math.imul(ne,Jt)|0)+Math.imul(q,Wt)|0,G=G+Math.imul(q,Jt)|0;var Je=(J+(B=B+Math.imul(U,Ge)|0)|0)+((8191&(W=(W=W+Math.imul(U,kt)|0)+Math.imul(V,Ge)|0))<<13)|0;J=((G=G+Math.imul(V,kt)|0)+(W>>>13)|0)+(Je>>>26)|0,Je&=67108863,B=Math.imul(Ae,Ye),W=(W=Math.imul(Ae,nt))+Math.imul(ke,Ye)|0,G=Math.imul(ke,nt),B=B+Math.imul(fe,yt)|0,W=(W=W+Math.imul(fe,Ot)|0)+Math.imul(me,yt)|0,G=G+Math.imul(me,Ot)|0,B=B+Math.imul(ue,at)|0,W=(W=W+Math.imul(ue,et)|0)+Math.imul(le,at)|0,G=G+Math.imul(le,et)|0,B=B+Math.imul(ee,Wt)|0,W=(W=W+Math.imul(ee,Jt)|0)+Math.imul(ie,Wt)|0,G=G+Math.imul(ie,Jt)|0,B=B+Math.imul(ne,Ge)|0,W=(W=W+Math.imul(ne,kt)|0)+Math.imul(q,Ge)|0,G=G+Math.imul(q,kt)|0;var st=(J+(B=B+Math.imul(U,Oe)|0)|0)+((8191&(W=(W=W+Math.imul(U,Ie)|0)+Math.imul(V,Oe)|0))<<13)|0;J=((G=G+Math.imul(V,Ie)|0)+(W>>>13)|0)+(st>>>26)|0,st&=67108863,B=Math.imul(de,Ye),W=(W=Math.imul(de,nt))+Math.imul(ve,Ye)|0,G=Math.imul(ve,nt),B=B+Math.imul(Ae,yt)|0,W=(W=W+Math.imul(Ae,Ot)|0)+Math.imul(ke,yt)|0,G=G+Math.imul(ke,Ot)|0,B=B+Math.imul(fe,at)|0,W=(W=W+Math.imul(fe,et)|0)+Math.imul(me,at)|0,G=G+Math.imul(me,et)|0,B=B+Math.imul(ue,Wt)|0,W=(W=W+Math.imul(ue,Jt)|0)+Math.imul(le,Wt)|0,G=G+Math.imul(le,Jt)|0,B=B+Math.imul(ee,Ge)|0,W=(W=W+Math.imul(ee,kt)|0)+Math.imul(ie,Ge)|0,G=G+Math.imul(ie,kt)|0,B=B+Math.imul(ne,Oe)|0,W=(W=W+Math.imul(ne,Ie)|0)+Math.imul(q,Oe)|0,G=G+Math.imul(q,Ie)|0;var St=(J+(B=B+Math.imul(U,Pe)|0)|0)+((8191&(W=(W=W+Math.imul(U,qe)|0)+Math.imul(V,Pe)|0))<<13)|0;J=((G=G+Math.imul(V,qe)|0)+(W>>>13)|0)+(St>>>26)|0,St&=67108863,B=Math.imul(we,Ye),W=(W=Math.imul(we,nt))+Math.imul(Ce,Ye)|0,G=Math.imul(Ce,nt),B=B+Math.imul(de,yt)|0,W=(W=W+Math.imul(de,Ot)|0)+Math.imul(ve,yt)|0,G=G+Math.imul(ve,Ot)|0,B=B+Math.imul(Ae,at)|0,W=(W=W+Math.imul(Ae,et)|0)+Math.imul(ke,at)|0,G=G+Math.imul(ke,et)|0,B=B+Math.imul(fe,Wt)|0,W=(W=W+Math.imul(fe,Jt)|0)+Math.imul(me,Wt)|0,G=G+Math.imul(me,Jt)|0,B=B+Math.imul(ue,Ge)|0,W=(W=W+Math.imul(ue,kt)|0)+Math.imul(le,Ge)|0,G=G+Math.imul(le,kt)|0,B=B+Math.imul(ee,Oe)|0,W=(W=W+Math.imul(ee,Ie)|0)+Math.imul(ie,Oe)|0,G=G+Math.imul(ie,Ie)|0,B=B+Math.imul(ne,Pe)|0,W=(W=W+Math.imul(ne,qe)|0)+Math.imul(q,Pe)|0,G=G+Math.imul(q,qe)|0;var It=(J+(B=B+Math.imul(U,lt)|0)|0)+((8191&(W=(W=W+Math.imul(U,ot)|0)+Math.imul(V,lt)|0))<<13)|0;J=((G=G+Math.imul(V,ot)|0)+(W>>>13)|0)+(It>>>26)|0,It&=67108863,B=Math.imul(ze,Ye),W=(W=Math.imul(ze,nt))+Math.imul($e,Ye)|0,G=Math.imul($e,nt),B=B+Math.imul(we,yt)|0,W=(W=W+Math.imul(we,Ot)|0)+Math.imul(Ce,yt)|0,G=G+Math.imul(Ce,Ot)|0,B=B+Math.imul(de,at)|0,W=(W=W+Math.imul(de,et)|0)+Math.imul(ve,at)|0,G=G+Math.imul(ve,et)|0,B=B+Math.imul(Ae,Wt)|0,W=(W=W+Math.imul(Ae,Jt)|0)+Math.imul(ke,Wt)|0,G=G+Math.imul(ke,Jt)|0,B=B+Math.imul(fe,Ge)|0,W=(W=W+Math.imul(fe,kt)|0)+Math.imul(me,Ge)|0,G=G+Math.imul(me,kt)|0,B=B+Math.imul(ue,Oe)|0,W=(W=W+Math.imul(ue,Ie)|0)+Math.imul(le,Oe)|0,G=G+Math.imul(le,Ie)|0,B=B+Math.imul(ee,Pe)|0,W=(W=W+Math.imul(ee,qe)|0)+Math.imul(ie,Pe)|0,G=G+Math.imul(ie,qe)|0,B=B+Math.imul(ne,lt)|0,W=(W=W+Math.imul(ne,ot)|0)+Math.imul(q,lt)|0,G=G+Math.imul(q,ot)|0;var Zt=(J+(B=B+Math.imul(U,wt)|0)|0)+((8191&(W=(W=W+Math.imul(U,$t)|0)+Math.imul(V,wt)|0))<<13)|0;J=((G=G+Math.imul(V,$t)|0)+(W>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,B=Math.imul(Re,Ye),W=(W=Math.imul(Re,nt))+Math.imul(Ve,Ye)|0,G=Math.imul(Ve,nt),B=B+Math.imul(ze,yt)|0,W=(W=W+Math.imul(ze,Ot)|0)+Math.imul($e,yt)|0,G=G+Math.imul($e,Ot)|0,B=B+Math.imul(we,at)|0,W=(W=W+Math.imul(we,et)|0)+Math.imul(Ce,at)|0,G=G+Math.imul(Ce,et)|0,B=B+Math.imul(de,Wt)|0,W=(W=W+Math.imul(de,Jt)|0)+Math.imul(ve,Wt)|0,G=G+Math.imul(ve,Jt)|0,B=B+Math.imul(Ae,Ge)|0,W=(W=W+Math.imul(Ae,kt)|0)+Math.imul(ke,Ge)|0,G=G+Math.imul(ke,kt)|0,B=B+Math.imul(fe,Oe)|0,W=(W=W+Math.imul(fe,Ie)|0)+Math.imul(me,Oe)|0,G=G+Math.imul(me,Ie)|0,B=B+Math.imul(ue,Pe)|0,W=(W=W+Math.imul(ue,qe)|0)+Math.imul(le,Pe)|0,G=G+Math.imul(le,qe)|0,B=B+Math.imul(ee,lt)|0,W=(W=W+Math.imul(ee,ot)|0)+Math.imul(ie,lt)|0,G=G+Math.imul(ie,ot)|0,B=B+Math.imul(ne,wt)|0,W=(W=W+Math.imul(ne,$t)|0)+Math.imul(q,wt)|0,G=G+Math.imul(q,$t)|0;var Kt=(J+(B=B+Math.imul(U,tt)|0)|0)+((8191&(W=(W=W+Math.imul(U,bt)|0)+Math.imul(V,tt)|0))<<13)|0;J=((G=G+Math.imul(V,bt)|0)+(W>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,B=Math.imul(Re,yt),W=(W=Math.imul(Re,Ot))+Math.imul(Ve,yt)|0,G=Math.imul(Ve,Ot),B=B+Math.imul(ze,at)|0,W=(W=W+Math.imul(ze,et)|0)+Math.imul($e,at)|0,G=G+Math.imul($e,et)|0,B=B+Math.imul(we,Wt)|0,W=(W=W+Math.imul(we,Jt)|0)+Math.imul(Ce,Wt)|0,G=G+Math.imul(Ce,Jt)|0,B=B+Math.imul(de,Ge)|0,W=(W=W+Math.imul(de,kt)|0)+Math.imul(ve,Ge)|0,G=G+Math.imul(ve,kt)|0,B=B+Math.imul(Ae,Oe)|0,W=(W=W+Math.imul(Ae,Ie)|0)+Math.imul(ke,Oe)|0,G=G+Math.imul(ke,Ie)|0,B=B+Math.imul(fe,Pe)|0,W=(W=W+Math.imul(fe,qe)|0)+Math.imul(me,Pe)|0,G=G+Math.imul(me,qe)|0,B=B+Math.imul(ue,lt)|0,W=(W=W+Math.imul(ue,ot)|0)+Math.imul(le,lt)|0,G=G+Math.imul(le,ot)|0,B=B+Math.imul(ee,wt)|0,W=(W=W+Math.imul(ee,$t)|0)+Math.imul(ie,wt)|0,G=G+Math.imul(ie,$t)|0;var qt=(J+(B=B+Math.imul(ne,tt)|0)|0)+((8191&(W=(W=W+Math.imul(ne,bt)|0)+Math.imul(q,tt)|0))<<13)|0;J=((G=G+Math.imul(q,bt)|0)+(W>>>13)|0)+(qt>>>26)|0,qt&=67108863,B=Math.imul(Re,at),W=(W=Math.imul(Re,et))+Math.imul(Ve,at)|0,G=Math.imul(Ve,et),B=B+Math.imul(ze,Wt)|0,W=(W=W+Math.imul(ze,Jt)|0)+Math.imul($e,Wt)|0,G=G+Math.imul($e,Jt)|0,B=B+Math.imul(we,Ge)|0,W=(W=W+Math.imul(we,kt)|0)+Math.imul(Ce,Ge)|0,G=G+Math.imul(Ce,kt)|0,B=B+Math.imul(de,Oe)|0,W=(W=W+Math.imul(de,Ie)|0)+Math.imul(ve,Oe)|0,G=G+Math.imul(ve,Ie)|0,B=B+Math.imul(Ae,Pe)|0,W=(W=W+Math.imul(Ae,qe)|0)+Math.imul(ke,Pe)|0,G=G+Math.imul(ke,qe)|0,B=B+Math.imul(fe,lt)|0,W=(W=W+Math.imul(fe,ot)|0)+Math.imul(me,lt)|0,G=G+Math.imul(me,ot)|0,B=B+Math.imul(ue,wt)|0,W=(W=W+Math.imul(ue,$t)|0)+Math.imul(le,wt)|0,G=G+Math.imul(le,$t)|0;var mn=(J+(B=B+Math.imul(ee,tt)|0)|0)+((8191&(W=(W=W+Math.imul(ee,bt)|0)+Math.imul(ie,tt)|0))<<13)|0;J=((G=G+Math.imul(ie,bt)|0)+(W>>>13)|0)+(mn>>>26)|0,mn&=67108863,B=Math.imul(Re,Wt),W=(W=Math.imul(Re,Jt))+Math.imul(Ve,Wt)|0,G=Math.imul(Ve,Jt),B=B+Math.imul(ze,Ge)|0,W=(W=W+Math.imul(ze,kt)|0)+Math.imul($e,Ge)|0,G=G+Math.imul($e,kt)|0,B=B+Math.imul(we,Oe)|0,W=(W=W+Math.imul(we,Ie)|0)+Math.imul(Ce,Oe)|0,G=G+Math.imul(Ce,Ie)|0,B=B+Math.imul(de,Pe)|0,W=(W=W+Math.imul(de,qe)|0)+Math.imul(ve,Pe)|0,G=G+Math.imul(ve,qe)|0,B=B+Math.imul(Ae,lt)|0,W=(W=W+Math.imul(Ae,ot)|0)+Math.imul(ke,lt)|0,G=G+Math.imul(ke,ot)|0,B=B+Math.imul(fe,wt)|0,W=(W=W+Math.imul(fe,$t)|0)+Math.imul(me,wt)|0,G=G+Math.imul(me,$t)|0;var Fn=(J+(B=B+Math.imul(ue,tt)|0)|0)+((8191&(W=(W=W+Math.imul(ue,bt)|0)+Math.imul(le,tt)|0))<<13)|0;J=((G=G+Math.imul(le,bt)|0)+(W>>>13)|0)+(Fn>>>26)|0,Fn&=67108863,B=Math.imul(Re,Ge),W=(W=Math.imul(Re,kt))+Math.imul(Ve,Ge)|0,G=Math.imul(Ve,kt),B=B+Math.imul(ze,Oe)|0,W=(W=W+Math.imul(ze,Ie)|0)+Math.imul($e,Oe)|0,G=G+Math.imul($e,Ie)|0,B=B+Math.imul(we,Pe)|0,W=(W=W+Math.imul(we,qe)|0)+Math.imul(Ce,Pe)|0,G=G+Math.imul(Ce,qe)|0,B=B+Math.imul(de,lt)|0,W=(W=W+Math.imul(de,ot)|0)+Math.imul(ve,lt)|0,G=G+Math.imul(ve,ot)|0,B=B+Math.imul(Ae,wt)|0,W=(W=W+Math.imul(Ae,$t)|0)+Math.imul(ke,wt)|0,G=G+Math.imul(ke,$t)|0;var pn=(J+(B=B+Math.imul(fe,tt)|0)|0)+((8191&(W=(W=W+Math.imul(fe,bt)|0)+Math.imul(me,tt)|0))<<13)|0;J=((G=G+Math.imul(me,bt)|0)+(W>>>13)|0)+(pn>>>26)|0,pn&=67108863,B=Math.imul(Re,Oe),W=(W=Math.imul(Re,Ie))+Math.imul(Ve,Oe)|0,G=Math.imul(Ve,Ie),B=B+Math.imul(ze,Pe)|0,W=(W=W+Math.imul(ze,qe)|0)+Math.imul($e,Pe)|0,G=G+Math.imul($e,qe)|0,B=B+Math.imul(we,lt)|0,W=(W=W+Math.imul(we,ot)|0)+Math.imul(Ce,lt)|0,G=G+Math.imul(Ce,ot)|0,B=B+Math.imul(de,wt)|0,W=(W=W+Math.imul(de,$t)|0)+Math.imul(ve,wt)|0,G=G+Math.imul(ve,$t)|0;var tn=(J+(B=B+Math.imul(Ae,tt)|0)|0)+((8191&(W=(W=W+Math.imul(Ae,bt)|0)+Math.imul(ke,tt)|0))<<13)|0;J=((G=G+Math.imul(ke,bt)|0)+(W>>>13)|0)+(tn>>>26)|0,tn&=67108863,B=Math.imul(Re,Pe),W=(W=Math.imul(Re,qe))+Math.imul(Ve,Pe)|0,G=Math.imul(Ve,qe),B=B+Math.imul(ze,lt)|0,W=(W=W+Math.imul(ze,ot)|0)+Math.imul($e,lt)|0,G=G+Math.imul($e,ot)|0,B=B+Math.imul(we,wt)|0,W=(W=W+Math.imul(we,$t)|0)+Math.imul(Ce,wt)|0,G=G+Math.imul(Ce,$t)|0;var nn=(J+(B=B+Math.imul(de,tt)|0)|0)+((8191&(W=(W=W+Math.imul(de,bt)|0)+Math.imul(ve,tt)|0))<<13)|0;J=((G=G+Math.imul(ve,bt)|0)+(W>>>13)|0)+(nn>>>26)|0,nn&=67108863,B=Math.imul(Re,lt),W=(W=Math.imul(Re,ot))+Math.imul(Ve,lt)|0,G=Math.imul(Ve,ot),B=B+Math.imul(ze,wt)|0,W=(W=W+Math.imul(ze,$t)|0)+Math.imul($e,wt)|0,G=G+Math.imul($e,$t)|0;var sn=(J+(B=B+Math.imul(we,tt)|0)|0)+((8191&(W=(W=W+Math.imul(we,bt)|0)+Math.imul(Ce,tt)|0))<<13)|0;J=((G=G+Math.imul(Ce,bt)|0)+(W>>>13)|0)+(sn>>>26)|0,sn&=67108863,B=Math.imul(Re,wt),W=(W=Math.imul(Re,$t))+Math.imul(Ve,wt)|0,G=Math.imul(Ve,$t);var gn=(J+(B=B+Math.imul(ze,tt)|0)|0)+((8191&(W=(W=W+Math.imul(ze,bt)|0)+Math.imul($e,tt)|0))<<13)|0;J=((G=G+Math.imul($e,bt)|0)+(W>>>13)|0)+(gn>>>26)|0,gn&=67108863;var bn=(J+(B=Math.imul(Re,tt))|0)+((8191&(W=(W=Math.imul(Re,bt))+Math.imul(Ve,tt)|0))<<13)|0;return J=((G=Math.imul(Ve,bt))+(W>>>13)|0)+(bn>>>26)|0,bn&=67108863,Y[0]=Ft,Y[1]=Et,Y[2]=Pt,Y[3]=De,Y[4]=Je,Y[5]=st,Y[6]=St,Y[7]=It,Y[8]=Zt,Y[9]=Kt,Y[10]=qt,Y[11]=mn,Y[12]=Fn,Y[13]=pn,Y[14]=tn,Y[15]=nn,Y[16]=sn,Y[17]=gn,Y[18]=bn,J!==0&&(Y[19]=J,N.length++),N};function k(D,O,N){return new w().mulp(D,O,N)}function w(D,O){this.x=D,this.y=O}Math.imul||(b=A),d.prototype.mulTo=function(D,O){var N=this.length+D.length;return this.length===10&&D.length===10?b(this,D,O):N<63?A(this,D,O):N<1024?function(B,W,G){G.negative=W.negative^B.negative,G.length=B.length+W.length;for(var K=0,te=0,Y=0;Y>>26)|0)>>>26,J&=67108863}G.words[Y]=re,K=J,J=te}return K!==0?G.words[Y]=K:G.length--,G.strip()}(this,D,O):k(this,D,O)},w.prototype.makeRBT=function(D){for(var O=new Array(D),N=d.prototype._countBits(D)-1,B=0;B>=1;return B},w.prototype.permute=function(D,O,N,B,W,G){for(var K=0;K>>=1)W++;return 1<>>=13,N[2*G+1]=8191&W,W>>>=13;for(G=2*O;G>=26,O+=B/67108864|0,O+=W>>>26,this.words[N]=67108863&W}return O!==0&&(this.words[N]=O,this.length++),this},d.prototype.muln=function(D){return this.clone().imuln(D)},d.prototype.sqr=function(){return this.mul(this)},d.prototype.isqr=function(){return this.imul(this.clone())},d.prototype.pow=function(D){var O=function(G){for(var K=new Array(G.bitLength()),te=0;te>>J}return K}(D);if(O.length===0)return new d(1);for(var N=this,B=0;B=0);var O,N=D%26,B=(D-N)/26,W=67108863>>>26-N<<26-N;if(N!==0){var G=0;for(O=0;O>>26-N}G&&(this.words[O]=G,this.length++)}if(B!==0){for(O=this.length-1;O>=0;O--)this.words[O+B]=this.words[O];for(O=0;O=0),B=O?(O-O%26)/26:0;var W=D%26,G=Math.min((D-W)/26,this.length),K=67108863^67108863>>>W<G)for(this.length-=G,Y=0;Y=0&&(J!==0||Y>=B);Y--){var re=0|this.words[Y];this.words[Y]=J<<26-W|re>>>W,J=re&K}return te&&J!==0&&(te.words[te.length++]=J),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},d.prototype.ishrn=function(D,O,N){return u(this.negative===0),this.iushrn(D,O,N)},d.prototype.shln=function(D){return this.clone().ishln(D)},d.prototype.ushln=function(D){return this.clone().iushln(D)},d.prototype.shrn=function(D){return this.clone().ishrn(D)},d.prototype.ushrn=function(D){return this.clone().iushrn(D)},d.prototype.testn=function(D){u(typeof D=="number"&&D>=0);var O=D%26,N=(D-O)/26,B=1<=0);var O=D%26,N=(D-O)/26;if(u(this.negative===0,"imaskn works only with positive numbers"),this.length<=N)return this;if(O!==0&&N++,this.length=Math.min(N,this.length),O!==0){var B=67108863^67108863>>>O<=67108864;O++)this.words[O]-=67108864,O===this.length-1?this.words[O+1]=1:this.words[O+1]++;return this.length=Math.max(this.length,O+1),this},d.prototype.isubn=function(D){if(u(typeof D=="number"),u(D<67108864),D<0)return this.iaddn(-D);if(this.negative!==0)return this.negative=0,this.iaddn(D),this.negative=1,this;if(this.words[0]-=D,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var O=0;O>26)-(te/67108864|0),this.words[B+N]=67108863&W}for(;B>26,this.words[B+N]=67108863&W;if(K===0)return this.strip();for(u(K===-1),K=0,B=0;B>26,this.words[B]=67108863&W;return this.negative=1,this.strip()},d.prototype._wordDiv=function(D,O){var N=(this.length,D.length),B=this.clone(),W=D,G=0|W.words[W.length-1];(N=26-this._countBits(G))!==0&&(W=W.ushln(N),B.iushln(N),G=0|W.words[W.length-1]);var K,te=B.length-W.length;if(O!=="mod"){(K=new d(null)).length=te+1,K.words=new Array(K.length);for(var Y=0;Y=0;re--){var U=67108864*(0|B.words[W.length+re])+(0|B.words[W.length+re-1]);for(U=Math.min(U/G|0,67108863),B._ishlnsubmul(W,U,re);B.negative!==0;)U--,B.negative=0,B._ishlnsubmul(W,1,re),B.isZero()||(B.negative^=1);K&&(K.words[re]=U)}return K&&K.strip(),B.strip(),O!=="div"&&N!==0&&B.iushrn(N),{div:K||null,mod:B}},d.prototype.divmod=function(D,O,N){return u(!D.isZero()),this.isZero()?{div:new d(0),mod:new d(0)}:this.negative!==0&&D.negative===0?(G=this.neg().divmod(D,O),O!=="mod"&&(B=G.div.neg()),O!=="div"&&(W=G.mod.neg(),N&&W.negative!==0&&W.iadd(D)),{div:B,mod:W}):this.negative===0&&D.negative!==0?(G=this.divmod(D.neg(),O),O!=="mod"&&(B=G.div.neg()),{div:B,mod:G.mod}):this.negative&D.negative?(G=this.neg().divmod(D.neg(),O),O!=="div"&&(W=G.mod.neg(),N&&W.negative!==0&&W.isub(D)),{div:G.div,mod:W}):D.length>this.length||this.cmp(D)<0?{div:new d(0),mod:this}:D.length===1?O==="div"?{div:this.divn(D.words[0]),mod:null}:O==="mod"?{div:null,mod:new d(this.modn(D.words[0]))}:{div:this.divn(D.words[0]),mod:new d(this.modn(D.words[0]))}:this._wordDiv(D,O);var B,W,G},d.prototype.div=function(D){return this.divmod(D,"div",!1).div},d.prototype.mod=function(D){return this.divmod(D,"mod",!1).mod},d.prototype.umod=function(D){return this.divmod(D,"mod",!0).mod},d.prototype.divRound=function(D){var O=this.divmod(D);if(O.mod.isZero())return O.div;var N=O.div.negative!==0?O.mod.isub(D):O.mod,B=D.ushrn(1),W=D.andln(1),G=N.cmp(B);return G<0||W===1&&G===0?O.div:O.div.negative!==0?O.div.isubn(1):O.div.iaddn(1)},d.prototype.modn=function(D){u(D<=67108863);for(var O=(1<<26)%D,N=0,B=this.length-1;B>=0;B--)N=(O*N+(0|this.words[B]))%D;return N},d.prototype.idivn=function(D){u(D<=67108863);for(var O=0,N=this.length-1;N>=0;N--){var B=(0|this.words[N])+67108864*O;this.words[N]=B/D|0,O=B%D}return this.strip()},d.prototype.divn=function(D){return this.clone().idivn(D)},d.prototype.egcd=function(D){u(D.negative===0),u(!D.isZero());var O=this,N=D.clone();O=O.negative!==0?O.umod(D):O.clone();for(var B=new d(1),W=new d(0),G=new d(0),K=new d(1),te=0;O.isEven()&&N.isEven();)O.iushrn(1),N.iushrn(1),++te;for(var Y=N.clone(),J=O.clone();!O.isZero();){for(var re=0,U=1;!(O.words[0]&U)&&re<26;++re,U<<=1);if(re>0)for(O.iushrn(re);re-- >0;)(B.isOdd()||W.isOdd())&&(B.iadd(Y),W.isub(J)),B.iushrn(1),W.iushrn(1);for(var V=0,H=1;!(N.words[0]&H)&&V<26;++V,H<<=1);if(V>0)for(N.iushrn(V);V-- >0;)(G.isOdd()||K.isOdd())&&(G.iadd(Y),K.isub(J)),G.iushrn(1),K.iushrn(1);O.cmp(N)>=0?(O.isub(N),B.isub(G),W.isub(K)):(N.isub(O),G.isub(B),K.isub(W))}return{a:G,b:K,gcd:N.iushln(te)}},d.prototype._invmp=function(D){u(D.negative===0),u(!D.isZero());var O=this,N=D.clone();O=O.negative!==0?O.umod(D):O.clone();for(var B,W=new d(1),G=new d(0),K=N.clone();O.cmpn(1)>0&&N.cmpn(1)>0;){for(var te=0,Y=1;!(O.words[0]&Y)&&te<26;++te,Y<<=1);if(te>0)for(O.iushrn(te);te-- >0;)W.isOdd()&&W.iadd(K),W.iushrn(1);for(var J=0,re=1;!(N.words[0]&re)&&J<26;++J,re<<=1);if(J>0)for(N.iushrn(J);J-- >0;)G.isOdd()&&G.iadd(K),G.iushrn(1);O.cmp(N)>=0?(O.isub(N),W.isub(G)):(N.isub(O),G.isub(W))}return(B=O.cmpn(1)===0?W:G).cmpn(0)<0&&B.iadd(D),B},d.prototype.gcd=function(D){if(this.isZero())return D.abs();if(D.isZero())return this.abs();var O=this.clone(),N=D.clone();O.negative=0,N.negative=0;for(var B=0;O.isEven()&&N.isEven();B++)O.iushrn(1),N.iushrn(1);for(;;){for(;O.isEven();)O.iushrn(1);for(;N.isEven();)N.iushrn(1);var W=O.cmp(N);if(W<0){var G=O;O=N,N=G}else if(W===0||N.cmpn(1)===0)break;O.isub(N)}return N.iushln(B)},d.prototype.invm=function(D){return this.egcd(D).a.umod(D)},d.prototype.isEven=function(){return(1&this.words[0])==0},d.prototype.isOdd=function(){return(1&this.words[0])==1},d.prototype.andln=function(D){return this.words[0]&D},d.prototype.bincn=function(D){u(typeof D=="number");var O=D%26,N=(D-O)/26,B=1<>>26,K&=67108863,this.words[G]=K}return W!==0&&(this.words[G]=W,this.length++),this},d.prototype.isZero=function(){return this.length===1&&this.words[0]===0},d.prototype.cmpn=function(D){var O,N=D<0;if(this.negative!==0&&!N)return-1;if(this.negative===0&&N)return 1;if(this.strip(),this.length>1)O=1;else{N&&(D=-D),u(D<=67108863,"Number is too big");var B=0|this.words[0];O=B===D?0:BD.length)return 1;if(this.length=0;N--){var B=0|this.words[N],W=0|D.words[N];if(B!==W){BW&&(O=1);break}}return O},d.prototype.gtn=function(D){return this.cmpn(D)===1},d.prototype.gt=function(D){return this.cmp(D)===1},d.prototype.gten=function(D){return this.cmpn(D)>=0},d.prototype.gte=function(D){return this.cmp(D)>=0},d.prototype.ltn=function(D){return this.cmpn(D)===-1},d.prototype.lt=function(D){return this.cmp(D)===-1},d.prototype.lten=function(D){return this.cmpn(D)<=0},d.prototype.lte=function(D){return this.cmp(D)<=0},d.prototype.eqn=function(D){return this.cmpn(D)===0},d.prototype.eq=function(D){return this.cmp(D)===0},d.red=function(D){return new R(D)},d.prototype.toRed=function(D){return u(!this.red,"Already a number in reduction context"),u(this.negative===0,"red works only with positives"),D.convertTo(this)._forceRed(D)},d.prototype.fromRed=function(){return u(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},d.prototype._forceRed=function(D){return this.red=D,this},d.prototype.forceRed=function(D){return u(!this.red,"Already a number in reduction context"),this._forceRed(D)},d.prototype.redAdd=function(D){return u(this.red,"redAdd works only with red numbers"),this.red.add(this,D)},d.prototype.redIAdd=function(D){return u(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,D)},d.prototype.redSub=function(D){return u(this.red,"redSub works only with red numbers"),this.red.sub(this,D)},d.prototype.redISub=function(D){return u(this.red,"redISub works only with red numbers"),this.red.isub(this,D)},d.prototype.redShl=function(D){return u(this.red,"redShl works only with red numbers"),this.red.shl(this,D)},d.prototype.redMul=function(D){return u(this.red,"redMul works only with red numbers"),this.red._verify2(this,D),this.red.mul(this,D)},d.prototype.redIMul=function(D){return u(this.red,"redMul works only with red numbers"),this.red._verify2(this,D),this.red.imul(this,D)},d.prototype.redSqr=function(){return u(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},d.prototype.redISqr=function(){return u(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},d.prototype.redSqrt=function(){return u(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},d.prototype.redInvm=function(){return u(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},d.prototype.redNeg=function(){return u(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},d.prototype.redPow=function(D){return u(this.red&&!D.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,D)};var M={k256:null,p224:null,p192:null,p25519:null};function T(D,O){this.name=D,this.p=new d(O,16),this.n=this.p.bitLength(),this.k=new d(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function E(){T.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function S(){T.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P(){T.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function L(){T.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function R(D){if(typeof D=="string"){var O=d._prime(D);this.m=O.p,this.prime=O}else u(D.gtn(1),"modulus must be greater than 1"),this.m=D,this.prime=null}function F(D){R.call(this,D),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new d(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}T.prototype._tmp=function(){var D=new d(null);return D.words=new Array(Math.ceil(this.n/13)),D},T.prototype.ireduce=function(D){var O,N=D;do this.split(N,this.tmp),O=(N=(N=this.imulK(N)).iadd(this.tmp)).bitLength();while(O>this.n);var B=O0?N.isub(this.p):N.strip!==void 0?N.strip():N._strip(),N},T.prototype.split=function(D,O){D.iushrn(this.n,0,O)},T.prototype.imulK=function(D){return D.imul(this.k)},h(E,T),E.prototype.split=function(D,O){for(var N=Math.min(D.length,9),B=0;B>>22,W=G}W>>>=22,D.words[B-10]=W,W===0&&D.length>10?D.length-=10:D.length-=9},E.prototype.imulK=function(D){D.words[D.length]=0,D.words[D.length+1]=0,D.length+=2;for(var O=0,N=0;N>>=26,D.words[N]=W,O=B}return O!==0&&(D.words[D.length++]=O),D},d._prime=function(D){if(M[D])return M[D];var O;if(D==="k256")O=new E;else if(D==="p224")O=new S;else if(D==="p192")O=new P;else{if(D!=="p25519")throw new Error("Unknown prime "+D);O=new L}return M[D]=O,O},R.prototype._verify1=function(D){u(D.negative===0,"red works only with positives"),u(D.red,"red works only with red numbers")},R.prototype._verify2=function(D,O){u((D.negative|O.negative)==0,"red works only with positives"),u(D.red&&D.red===O.red,"red works only with red numbers")},R.prototype.imod=function(D){return this.prime?this.prime.ireduce(D)._forceRed(this):D.umod(this.m)._forceRed(this)},R.prototype.neg=function(D){return D.isZero()?D.clone():this.m.sub(D)._forceRed(this)},R.prototype.add=function(D,O){this._verify2(D,O);var N=D.add(O);return N.cmp(this.m)>=0&&N.isub(this.m),N._forceRed(this)},R.prototype.iadd=function(D,O){this._verify2(D,O);var N=D.iadd(O);return N.cmp(this.m)>=0&&N.isub(this.m),N},R.prototype.sub=function(D,O){this._verify2(D,O);var N=D.sub(O);return N.cmpn(0)<0&&N.iadd(this.m),N._forceRed(this)},R.prototype.isub=function(D,O){this._verify2(D,O);var N=D.isub(O);return N.cmpn(0)<0&&N.iadd(this.m),N},R.prototype.shl=function(D,O){return this._verify1(D),this.imod(D.ushln(O))},R.prototype.imul=function(D,O){return this._verify2(D,O),this.imod(D.imul(O))},R.prototype.mul=function(D,O){return this._verify2(D,O),this.imod(D.mul(O))},R.prototype.isqr=function(D){return this.imul(D,D.clone())},R.prototype.sqr=function(D){return this.mul(D,D)},R.prototype.sqrt=function(D){if(D.isZero())return D.clone();var O=this.m.andln(3);if(u(O%2==1),O===3){var N=this.m.add(new d(1)).iushrn(2);return this.pow(D,N)}for(var B=this.m.subn(1),W=0;!B.isZero()&&B.andln(1)===0;)W++,B.iushrn(1);u(!B.isZero());var G=new d(1).toRed(this),K=G.redNeg(),te=this.m.subn(1).iushrn(1),Y=this.m.bitLength();for(Y=new d(2*Y*Y).toRed(this);this.pow(Y,te).cmp(K)!==0;)Y.redIAdd(K);for(var J=this.pow(Y,B),re=this.pow(D,B.addn(1).iushrn(1)),U=this.pow(D,B),V=W;U.cmp(G)!==0;){for(var H=U,ne=0;H.cmp(G)!==0;ne++)H=H.redSqr();u(ne=0;B--){for(var Y=O.words[B],J=te-1;J>=0;J--){var re=Y>>J&1;W!==N[0]&&(W=this.sqr(W)),re!==0||G!==0?(G<<=1,G|=re,(++K===4||B===0&&J===0)&&(W=this.mul(W,N[G]),K=0,G=0)):K=0}te=26}return W},R.prototype.convertTo=function(D){var O=D.umod(this.m);return O===D?O.clone():O},R.prototype.convertFrom=function(D){var O=D.clone();return O.red=null,O},d.mont=function(D){return new F(D)},h(F,R),F.prototype.convertTo=function(D){return this.imod(D.ushln(this.shift))},F.prototype.convertFrom=function(D){var O=this.imod(D.mul(this.rinv));return O.red=null,O},F.prototype.imul=function(D,O){if(D.isZero()||O.isZero())return D.words[0]=0,D.length=1,D;var N=D.imul(O),B=N.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),W=N.isub(B).iushrn(this.shift),G=W;return W.cmp(this.m)>=0?G=W.isub(this.m):W.cmpn(0)<0&&(G=W.iadd(this.m)),G._forceRed(this)},F.prototype.mul=function(D,O){if(D.isZero()||O.isZero())return new d(0)._forceRed(this);var N=D.mul(O),B=N.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),W=N.isub(B).iushrn(this.shift),G=W;return W.cmp(this.m)>=0?G=W.isub(this.m):W.cmpn(0)<0&&(G=W.iadd(this.m)),G._forceRed(this)},F.prototype.invm=function(D){return this.imod(D._invmp(this.m).mul(this.r2))._forceRed(this)}})(l===void 0||l,this)},{buffer:2}],34:[function(a,l,c){l.exports=function(i){var s,u,h,d=i.length,m=0;for(s=0;s>>1;if(!(M<=0)){var T,E=s.mallocDouble(2*M*k),S=s.mallocInt32(k);if((k=m(x,M,E,S))>0){if(M===1&&b)u.init(k),T=u.sweepComplete(M,A,0,k,E,S,0,k,E,S);else{var P=s.mallocDouble(2*M*w),L=s.mallocInt32(w);(w=m(_,M,P,L))>0&&(u.init(k+w),T=M===1?u.sweepBipartite(M,A,0,k,E,S,0,w,P,L):h(M,A,b,k,E,S,w,P,L),s.free(P),s.free(L))}s.free(E),s.free(S)}return T}}}function g(x,_){i.push([x,_])}function y(x){return i=[],p(x,x,g,!0),i}function v(x,_){return i=[],p(x,_,g,!1),i}},{"./lib/intersect":37,"./lib/sweep":41,"typedarray-pool":308}],36:[function(a,l,c){function i(s){return s?function(u,h,d,m,p,g,y,v,x,_,A){return p-m>x-v?function(b,k,w,M,T,E,S,P,L,R,F){for(var D=2*b,O=M,N=D*M;O_-x?m?function(k,w,M,T,E,S,P,L,R,F,D){for(var O=2*k,N=T,B=O*T;N0;){var te=6*(G-=1),Y=k[te],J=k[te+1],re=k[te+2],U=k[te+3],V=k[te+4],H=k[te+5],ne=2*G,q=w[ne],Q=w[ne+1],ee=1&H,ie=!!(16&H),ae=F,ue=D,le=N,ge=B;if(ee&&(ae=N,ue=B,le=F,ge=D),!(2&H&&(re=x(S,Y,J,re,ae,ue,Q),J>=re)||4&H&&(J=_(S,Y,J,re,ae,ue,q))>=re)){var fe=re-J,me=V-U;if(ie){if(S*fe*(fe+me)<1<<22){if((W=m.scanComplete(S,Y,P,J,re,ae,ue,U,V,le,ge))!==void 0)return W;continue}}else{if(S*Math.min(fe,me)<128){if((W=h(S,Y,P,ee,J,re,ae,ue,U,V,le,ge))!==void 0)return W;continue}if(S*fe*me<1<<22){if((W=m.scanBipartite(S,Y,P,ee,J,re,ae,ue,U,V,le,ge))!==void 0)return W;continue}}var _e=y(S,Y,J,re,ae,ue,q,Q);if(J<_e)if(S*(_e-J)<128){if((W=d(S,Y+1,P,J,_e,ae,ue,U,V,le,ge))!==void 0)return W}else if(Y===S-2){if((W=ee?m.sweepBipartite(S,P,U,V,le,ge,J,_e,ae,ue):m.sweepBipartite(S,P,J,_e,ae,ue,U,V,le,ge))!==void 0)return W}else M(G++,Y+1,J,_e,U,V,ee,-1/0,1/0),M(G++,Y+1,U,V,J,_e,1^ee,-1/0,1/0);if(_e=p0)&&!(p1>=hi)"),v=g("lo===p0"),x=g("lo>>1,_=2*u,A=x,b=p[_*x+h];y=E?(A=T,b=E):M>=P?(A=w,b=M):(A=S,b=P):E>=P?(A=T,b=E):P>=M?(A=w,b=M):(A=S,b=P);for(var L=_*(v-1),R=_*A,F=0;F<_;++F,++L,++R){var D=p[L];p[L]=p[R],p[R]=D}var O=g[v-1];for(g[v-1]=g[A],g[A]=O,A=i(u,h,y,v-1,p,g,b),L=_*(v-1),R=_*A,F=0;F<_;++F,++L,++R)D=p[L],p[L]=p[R],p[R]=D;if(O=g[v-1],g[v-1]=g[A],g[A]=O,xd&&p[b+h]>_;--A,b-=y){for(var k=b,w=b+y,M=0;Mb;++b,v+=y)if(m[v+A]===g)if(_===b)_+=1,x+=y;else{for(var k=0;y>k;++k){var w=m[v+k];m[v+k]=m[x],m[x++]=w}var M=p[b];p[b]=p[_],p[_++]=M}return _},"lob;++b,v+=y)if(m[v+A]k;++k){var w=m[v+k];m[v+k]=m[x],m[x++]=w}var M=p[b];p[b]=p[_],p[_++]=M}return _},"lo<=p0":function(s,u,h,d,m,p,g){for(var y=2*s,v=y*h,x=v,_=h,A=s+u,b=h;d>b;++b,v+=y)if(m[v+A]<=g)if(_===b)_+=1,x+=y;else{for(var k=0;y>k;++k){var w=m[v+k];m[v+k]=m[x],m[x++]=w}var M=p[b];p[b]=p[_],p[_++]=M}return _},"hi<=p0":function(s,u,h,d,m,p,g){for(var y=2*s,v=y*h,x=v,_=h,A=s+u,b=h;d>b;++b,v+=y)if(m[v+A]<=g)if(_===b)_+=1,x+=y;else{for(var k=0;y>k;++k){var w=m[v+k];m[v+k]=m[x],m[x++]=w}var M=p[b];p[b]=p[_],p[_++]=M}return _},"lok;++k,v+=y){var w=m[v+A],M=m[v+b];if(wT;++T){var E=m[v+T];m[v+T]=m[x],m[x++]=E}var S=p[k];p[k]=p[_],p[_++]=S}}return _},"lo<=p0&&p0<=hi":function(s,u,h,d,m,p,g){for(var y=2*s,v=y*h,x=v,_=h,A=u,b=s+u,k=h;d>k;++k,v+=y){var w=m[v+A],M=m[v+b];if(w<=g&&g<=M)if(_===k)_+=1,x+=y;else{for(var T=0;y>T;++T){var E=m[v+T];m[v+T]=m[x],m[x++]=E}var S=p[k];p[k]=p[_],p[_++]=S}}return _},"!(lo>=p0)&&!(p1>=hi)":function(s,u,h,d,m,p,g,y){for(var v=2*s,x=v*h,_=x,A=h,b=u,k=s+u,w=h;d>w;++w,x+=v){var M=m[x+b],T=m[x+k];if(!(M>=g||y>=T))if(A===w)A+=1,_+=v;else{for(var E=0;v>E;++E){var S=m[x+E];m[x+E]=m[_],m[_++]=S}var P=p[w];p[w]=p[A],p[A++]=P}}return A}}},{}],40:[function(a,l,c){l.exports=function(g,y){y<=128?i(0,y-1,g):function v(x,_,A){var b=(_-x+1)/6|0,k=x+b,w=_-b,M=x+_>>1,T=M-b,E=M+b,S=k,P=T,L=M,R=E,F=w,D=x+1,O=_-1,N=0;m(S,P,A)&&(N=S,S=P,P=N),m(R,F,A)&&(N=R,R=F,F=N),m(S,L,A)&&(N=S,S=L,L=N),m(P,L,A)&&(N=P,P=L,L=N),m(S,R,A)&&(N=S,S=R,R=N),m(L,R,A)&&(N=L,L=R,R=N),m(P,F,A)&&(N=P,P=F,F=N),m(P,L,A)&&(N=P,P=L,L=N),m(R,F,A)&&(N=R,R=F,F=N);for(var B=A[2*P],W=A[2*P+1],G=A[2*R],K=A[2*R+1],te=2*S,Y=2*L,J=2*F,re=2*k,U=2*M,V=2*w,H=0;H<2;++H){var ne=A[te+H],q=A[Y+H],Q=A[J+H];A[re+H]=ne,A[U+H]=q,A[V+H]=Q}u(T,x,A),u(E,_,A);for(var ee=D;ee<=O;++ee)if(p(ee,B,W,A))ee!==D&&s(ee,D,A),++D;else if(!p(ee,G,K,A))for(;;){if(p(O,G,K,A)){p(O,B,W,A)?(h(ee,D,O,A),++D,--O):(s(ee,O,A),--O);break}if(--Og;){var M=v[w-2],T=v[w-1];if(Mv[y+1])}function p(g,y,v,x){var _=x[g*=2];return _>>1;u(v,K);var te=0,Y=0;for(N=0;N=1<<28)x(m,p,Y--,J=J-(1<<28)|0);else if(J>=0)x(h,d,te--,J);else if(J<=-(1<<28)){J=-J-(1<<28)|0;for(var re=0;re>>1;u(v,K);var te=0,Y=0,J=0;for(N=0;N>1==v[2*N+3]>>1&&(U=2,N+=1),re<0){for(var V=-(re>>1)-1,H=0;H>1)-1,U===0?x(h,d,te--,V):U===1?x(m,p,Y--,V):U===2&&x(g,y,J--,V)}},scanBipartite:function(A,b,k,w,M,T,E,S,P,L,R,F){var D=0,O=2*A,N=b,B=b+A,W=1,G=1;w?G=1<<28:W=1<<28;for(var K=M;K>>1;u(v,re);var U=0;for(K=0;K=1<<28?(H=!w,te-=1<<28):(H=!!w,te-=1),H)_(h,d,U++,te);else{var ne=F[te],q=O*te,Q=R[q+b+1],ee=R[q+b+1+A];e:for(var ie=0;ie>>1;u(v,te);var Y=0;for(B=0;B=1<<28)h[Y++]=W-(1<<28);else{var re=R[W-=1],U=D*W,V=L[U+b+1],H=L[U+b+1+A];e:for(var ne=0;ne=0;--ne)if(h[ne]===W){for(ie=ne+1;ie0;){for(var b=d.pop(),k=(g=d.pop(),x=-1,_=-1,y=p[g],1);k=0||(h.flip(g,b),s(u,h,d,x,g,_),s(u,h,d,g,_,x),s(u,h,d,_,b,x),s(u,h,d,b,x,_))}}},{"binary-search-bounds":31,"robust-in-sphere":282}],44:[function(a,l,c){var i,s=a("binary-search-bounds");function u(d,m,p,g,y,v,x){this.cells=d,this.neighbor=m,this.flags=g,this.constraint=p,this.active=y,this.next=v,this.boundary=x}function h(d,m){return d[0]-m[0]||d[1]-m[1]||d[2]-m[2]}l.exports=function(d,m,p){var g=function(P,L){for(var R=P.cells(),F=R.length,D=0;D0||x.length>0;){for(;v.length>0;){var w=v.pop();if(_[w]!==-y){_[w]=y,A[w];for(var M=0;M<3;++M){var T=k[3*w+M];T>=0&&_[T]===0&&(b[3*w+M]?x.push(T):(v.push(T),_[T]=y))}}}var E=x;x=v,v=E,x.length=0,y=-y}var S=function(P,L,R){for(var F=0,D=0;D1&&s(A[S[P-2]],A[S[P-1]],b)>0;)x.push([S[P-1],S[P-2],k]),P-=1;S.length=P,S.push(k);var L=E.upperIds;for(P=L.length;P>1&&s(A[L[P-2]],A[L[P-1]],b)<0;)x.push([L[P-2],L[P-1],k]),P-=1;L.length=P,L.push(k)}}function g(x,_){var A;return(A=x.a[0]<_.a[0]?s(x.a,x.b,_.a):s(_.b,_.a,x.a))?A:(A=_.b[0]E[0]&&k.push(new h(E,T,2,w),new h(T,E,1,w))}k.sort(d);for(var S=k[0].a[0]-(1+Math.abs(k[0].a[0]))*Math.pow(2,-52),P=[new u([S,1],[S,0],-1,[],[])],L=[],R=(w=0,k.length);w=0}}(),u.removeTriangle=function(d,m,p){var g=this.stars;h(g[d],m,p),h(g[m],p,d),h(g[p],d,m)},u.addTriangle=function(d,m,p){var g=this.stars;g[d].push(m,p),g[m].push(p,d),g[p].push(d,m)},u.opposite=function(d,m){for(var p=this.stars[m],g=1,y=p.length;gT[2]?1:0)}function k(M,T,E){if(M.length!==0){if(T)for(var S=0;S=0;--G){var ne=O[K=(ge=B[G])[0]],q=ne[0],Q=ne[1],ee=D[q],ie=D[Q];if((ee[0]-ie[0]||ee[1]-ie[1])<0){var ae=q;q=Q,Q=ae}ne[0]=q;var ue,le=ne[1]=ge[1];for(W&&(ue=ne[2]);G>0&&B[G-1][0]===K;){var ge,fe=(ge=B[--G])[1];W?O.push([le,fe,ue]):O.push([le,fe]),le=fe}W?O.push([le,Q,ue]):O.push([le,Q])}return te}(M,T,P,R,E));return k(T,F,E),!!F||P.length>0||R.length>0}},{"./lib/rat-seg-intersect":51,"big-rat":18,"big-rat/cmp":16,"big-rat/to-float":30,"box-intersect":35,nextafter:260,"rat-vec":273,"robust-segment-intersect":287,"union-find":309}],51:[function(a,l,c){l.exports=function(y,v,x,_){var A=d(v,y),b=d(_,x),k=g(A,b);if(h(k)===0)return null;var w=d(y,x),M=g(b,w),T=s(M,k),E=p(A,T);return m(y,E)};var i=a("big-rat/mul"),s=a("big-rat/div"),u=a("big-rat/sub"),h=a("big-rat/sign"),d=a("rat-vec/sub"),m=a("rat-vec/add"),p=a("rat-vec/muls");function g(y,v){return u(i(y[0],v[1]),i(y[1],v[0]))}},{"big-rat/div":17,"big-rat/mul":27,"big-rat/sign":28,"big-rat/sub":29,"rat-vec/add":272,"rat-vec/muls":274,"rat-vec/sub":275}],52:[function(a,l,c){l.exports={jet:[{index:0,rgb:[0,0,131]},{index:.125,rgb:[0,60,170]},{index:.375,rgb:[5,255,255]},{index:.625,rgb:[255,255,0]},{index:.875,rgb:[250,0,0]},{index:1,rgb:[128,0,0]}],hsv:[{index:0,rgb:[255,0,0]},{index:.169,rgb:[253,255,2]},{index:.173,rgb:[247,255,2]},{index:.337,rgb:[0,252,4]},{index:.341,rgb:[0,252,10]},{index:.506,rgb:[1,249,255]},{index:.671,rgb:[2,0,253]},{index:.675,rgb:[8,0,253]},{index:.839,rgb:[255,0,251]},{index:.843,rgb:[255,0,245]},{index:1,rgb:[255,0,6]}],hot:[{index:0,rgb:[0,0,0]},{index:.3,rgb:[230,0,0]},{index:.6,rgb:[255,210,0]},{index:1,rgb:[255,255,255]}],spring:[{index:0,rgb:[255,0,255]},{index:1,rgb:[255,255,0]}],summer:[{index:0,rgb:[0,128,102]},{index:1,rgb:[255,255,102]}],autumn:[{index:0,rgb:[255,0,0]},{index:1,rgb:[255,255,0]}],winter:[{index:0,rgb:[0,0,255]},{index:1,rgb:[0,255,128]}],bone:[{index:0,rgb:[0,0,0]},{index:.376,rgb:[84,84,116]},{index:.753,rgb:[169,200,200]},{index:1,rgb:[255,255,255]}],copper:[{index:0,rgb:[0,0,0]},{index:.804,rgb:[255,160,102]},{index:1,rgb:[255,199,127]}],greys:[{index:0,rgb:[0,0,0]},{index:1,rgb:[255,255,255]}],yignbu:[{index:0,rgb:[8,29,88]},{index:.125,rgb:[37,52,148]},{index:.25,rgb:[34,94,168]},{index:.375,rgb:[29,145,192]},{index:.5,rgb:[65,182,196]},{index:.625,rgb:[127,205,187]},{index:.75,rgb:[199,233,180]},{index:.875,rgb:[237,248,217]},{index:1,rgb:[255,255,217]}],greens:[{index:0,rgb:[0,68,27]},{index:.125,rgb:[0,109,44]},{index:.25,rgb:[35,139,69]},{index:.375,rgb:[65,171,93]},{index:.5,rgb:[116,196,118]},{index:.625,rgb:[161,217,155]},{index:.75,rgb:[199,233,192]},{index:.875,rgb:[229,245,224]},{index:1,rgb:[247,252,245]}],yiorrd:[{index:0,rgb:[128,0,38]},{index:.125,rgb:[189,0,38]},{index:.25,rgb:[227,26,28]},{index:.375,rgb:[252,78,42]},{index:.5,rgb:[253,141,60]},{index:.625,rgb:[254,178,76]},{index:.75,rgb:[254,217,118]},{index:.875,rgb:[255,237,160]},{index:1,rgb:[255,255,204]}],bluered:[{index:0,rgb:[0,0,255]},{index:1,rgb:[255,0,0]}],rdbu:[{index:0,rgb:[5,10,172]},{index:.35,rgb:[106,137,247]},{index:.5,rgb:[190,190,190]},{index:.6,rgb:[220,170,132]},{index:.7,rgb:[230,145,90]},{index:1,rgb:[178,10,28]}],picnic:[{index:0,rgb:[0,0,255]},{index:.1,rgb:[51,153,255]},{index:.2,rgb:[102,204,255]},{index:.3,rgb:[153,204,255]},{index:.4,rgb:[204,204,255]},{index:.5,rgb:[255,255,255]},{index:.6,rgb:[255,204,255]},{index:.7,rgb:[255,153,255]},{index:.8,rgb:[255,102,204]},{index:.9,rgb:[255,102,102]},{index:1,rgb:[255,0,0]}],rainbow:[{index:0,rgb:[150,0,90]},{index:.125,rgb:[0,0,200]},{index:.25,rgb:[0,25,255]},{index:.375,rgb:[0,152,255]},{index:.5,rgb:[44,255,150]},{index:.625,rgb:[151,255,0]},{index:.75,rgb:[255,234,0]},{index:.875,rgb:[255,111,0]},{index:1,rgb:[255,0,0]}],portland:[{index:0,rgb:[12,51,131]},{index:.25,rgb:[10,136,186]},{index:.5,rgb:[242,211,56]},{index:.75,rgb:[242,143,56]},{index:1,rgb:[217,30,30]}],blackbody:[{index:0,rgb:[0,0,0]},{index:.2,rgb:[230,0,0]},{index:.4,rgb:[230,210,0]},{index:.7,rgb:[255,255,255]},{index:1,rgb:[160,200,255]}],earth:[{index:0,rgb:[0,0,130]},{index:.1,rgb:[0,180,180]},{index:.2,rgb:[40,210,40]},{index:.4,rgb:[230,230,50]},{index:.6,rgb:[120,70,20]},{index:1,rgb:[255,255,255]}],electric:[{index:0,rgb:[0,0,0]},{index:.15,rgb:[30,0,100]},{index:.4,rgb:[120,0,100]},{index:.6,rgb:[160,90,0]},{index:.8,rgb:[230,200,0]},{index:1,rgb:[255,250,220]}],alpha:[{index:0,rgb:[255,255,255,0]},{index:1,rgb:[255,255,255,1]}],viridis:[{index:0,rgb:[68,1,84]},{index:.13,rgb:[71,44,122]},{index:.25,rgb:[59,81,139]},{index:.38,rgb:[44,113,142]},{index:.5,rgb:[33,144,141]},{index:.63,rgb:[39,173,129]},{index:.75,rgb:[92,200,99]},{index:.88,rgb:[170,220,50]},{index:1,rgb:[253,231,37]}],inferno:[{index:0,rgb:[0,0,4]},{index:.13,rgb:[31,12,72]},{index:.25,rgb:[85,15,109]},{index:.38,rgb:[136,34,106]},{index:.5,rgb:[186,54,85]},{index:.63,rgb:[227,89,51]},{index:.75,rgb:[249,140,10]},{index:.88,rgb:[249,201,50]},{index:1,rgb:[252,255,164]}],magma:[{index:0,rgb:[0,0,4]},{index:.13,rgb:[28,16,68]},{index:.25,rgb:[79,18,123]},{index:.38,rgb:[129,37,129]},{index:.5,rgb:[181,54,122]},{index:.63,rgb:[229,80,100]},{index:.75,rgb:[251,135,97]},{index:.88,rgb:[254,194,135]},{index:1,rgb:[252,253,191]}],plasma:[{index:0,rgb:[13,8,135]},{index:.13,rgb:[75,3,161]},{index:.25,rgb:[125,3,168]},{index:.38,rgb:[168,34,150]},{index:.5,rgb:[203,70,121]},{index:.63,rgb:[229,107,93]},{index:.75,rgb:[248,148,65]},{index:.88,rgb:[253,195,40]},{index:1,rgb:[240,249,33]}],warm:[{index:0,rgb:[125,0,179]},{index:.13,rgb:[172,0,187]},{index:.25,rgb:[219,0,170]},{index:.38,rgb:[255,0,130]},{index:.5,rgb:[255,63,74]},{index:.63,rgb:[255,123,0]},{index:.75,rgb:[234,176,0]},{index:.88,rgb:[190,228,0]},{index:1,rgb:[147,255,0]}],cool:[{index:0,rgb:[125,0,179]},{index:.13,rgb:[116,0,218]},{index:.25,rgb:[98,74,237]},{index:.38,rgb:[68,146,231]},{index:.5,rgb:[0,204,197]},{index:.63,rgb:[0,247,146]},{index:.75,rgb:[0,255,88]},{index:.88,rgb:[40,255,8]},{index:1,rgb:[147,255,0]}],"rainbow-soft":[{index:0,rgb:[125,0,179]},{index:.1,rgb:[199,0,180]},{index:.2,rgb:[255,0,121]},{index:.3,rgb:[255,108,0]},{index:.4,rgb:[222,194,0]},{index:.5,rgb:[150,255,0]},{index:.6,rgb:[0,255,55]},{index:.7,rgb:[0,246,150]},{index:.8,rgb:[50,167,222]},{index:.9,rgb:[103,51,235]},{index:1,rgb:[124,0,186]}],bathymetry:[{index:0,rgb:[40,26,44]},{index:.13,rgb:[59,49,90]},{index:.25,rgb:[64,76,139]},{index:.38,rgb:[63,110,151]},{index:.5,rgb:[72,142,158]},{index:.63,rgb:[85,174,163]},{index:.75,rgb:[120,206,163]},{index:.88,rgb:[187,230,172]},{index:1,rgb:[253,254,204]}],cdom:[{index:0,rgb:[47,15,62]},{index:.13,rgb:[87,23,86]},{index:.25,rgb:[130,28,99]},{index:.38,rgb:[171,41,96]},{index:.5,rgb:[206,67,86]},{index:.63,rgb:[230,106,84]},{index:.75,rgb:[242,149,103]},{index:.88,rgb:[249,193,135]},{index:1,rgb:[254,237,176]}],chlorophyll:[{index:0,rgb:[18,36,20]},{index:.13,rgb:[25,63,41]},{index:.25,rgb:[24,91,59]},{index:.38,rgb:[13,119,72]},{index:.5,rgb:[18,148,80]},{index:.63,rgb:[80,173,89]},{index:.75,rgb:[132,196,122]},{index:.88,rgb:[175,221,162]},{index:1,rgb:[215,249,208]}],density:[{index:0,rgb:[54,14,36]},{index:.13,rgb:[89,23,80]},{index:.25,rgb:[110,45,132]},{index:.38,rgb:[120,77,178]},{index:.5,rgb:[120,113,213]},{index:.63,rgb:[115,151,228]},{index:.75,rgb:[134,185,227]},{index:.88,rgb:[177,214,227]},{index:1,rgb:[230,241,241]}],"freesurface-blue":[{index:0,rgb:[30,4,110]},{index:.13,rgb:[47,14,176]},{index:.25,rgb:[41,45,236]},{index:.38,rgb:[25,99,212]},{index:.5,rgb:[68,131,200]},{index:.63,rgb:[114,156,197]},{index:.75,rgb:[157,181,203]},{index:.88,rgb:[200,208,216]},{index:1,rgb:[241,237,236]}],"freesurface-red":[{index:0,rgb:[60,9,18]},{index:.13,rgb:[100,17,27]},{index:.25,rgb:[142,20,29]},{index:.38,rgb:[177,43,27]},{index:.5,rgb:[192,87,63]},{index:.63,rgb:[205,125,105]},{index:.75,rgb:[216,162,148]},{index:.88,rgb:[227,199,193]},{index:1,rgb:[241,237,236]}],oxygen:[{index:0,rgb:[64,5,5]},{index:.13,rgb:[106,6,15]},{index:.25,rgb:[144,26,7]},{index:.38,rgb:[168,64,3]},{index:.5,rgb:[188,100,4]},{index:.63,rgb:[206,136,11]},{index:.75,rgb:[220,174,25]},{index:.88,rgb:[231,215,44]},{index:1,rgb:[248,254,105]}],par:[{index:0,rgb:[51,20,24]},{index:.13,rgb:[90,32,35]},{index:.25,rgb:[129,44,34]},{index:.38,rgb:[159,68,25]},{index:.5,rgb:[182,99,19]},{index:.63,rgb:[199,134,22]},{index:.75,rgb:[212,171,35]},{index:.88,rgb:[221,210,54]},{index:1,rgb:[225,253,75]}],phase:[{index:0,rgb:[145,105,18]},{index:.13,rgb:[184,71,38]},{index:.25,rgb:[186,58,115]},{index:.38,rgb:[160,71,185]},{index:.5,rgb:[110,97,218]},{index:.63,rgb:[50,123,164]},{index:.75,rgb:[31,131,110]},{index:.88,rgb:[77,129,34]},{index:1,rgb:[145,105,18]}],salinity:[{index:0,rgb:[42,24,108]},{index:.13,rgb:[33,50,162]},{index:.25,rgb:[15,90,145]},{index:.38,rgb:[40,118,137]},{index:.5,rgb:[59,146,135]},{index:.63,rgb:[79,175,126]},{index:.75,rgb:[120,203,104]},{index:.88,rgb:[193,221,100]},{index:1,rgb:[253,239,154]}],temperature:[{index:0,rgb:[4,35,51]},{index:.13,rgb:[23,51,122]},{index:.25,rgb:[85,59,157]},{index:.38,rgb:[129,79,143]},{index:.5,rgb:[175,95,130]},{index:.63,rgb:[222,112,101]},{index:.75,rgb:[249,146,66]},{index:.88,rgb:[249,196,65]},{index:1,rgb:[232,250,91]}],turbidity:[{index:0,rgb:[34,31,27]},{index:.13,rgb:[65,50,41]},{index:.25,rgb:[98,69,52]},{index:.38,rgb:[131,89,57]},{index:.5,rgb:[161,112,59]},{index:.63,rgb:[185,140,66]},{index:.75,rgb:[202,174,88]},{index:.88,rgb:[216,209,126]},{index:1,rgb:[233,246,171]}],"velocity-blue":[{index:0,rgb:[17,32,64]},{index:.13,rgb:[35,52,116]},{index:.25,rgb:[29,81,156]},{index:.38,rgb:[31,113,162]},{index:.5,rgb:[50,144,169]},{index:.63,rgb:[87,173,176]},{index:.75,rgb:[149,196,189]},{index:.88,rgb:[203,221,211]},{index:1,rgb:[254,251,230]}],"velocity-green":[{index:0,rgb:[23,35,19]},{index:.13,rgb:[24,64,38]},{index:.25,rgb:[11,95,45]},{index:.38,rgb:[39,123,35]},{index:.5,rgb:[95,146,12]},{index:.63,rgb:[152,165,18]},{index:.75,rgb:[201,186,69]},{index:.88,rgb:[233,216,137]},{index:1,rgb:[255,253,205]}],cubehelix:[{index:0,rgb:[0,0,0]},{index:.07,rgb:[22,5,59]},{index:.13,rgb:[60,4,105]},{index:.2,rgb:[109,1,135]},{index:.27,rgb:[161,0,147]},{index:.33,rgb:[210,2,142]},{index:.4,rgb:[251,11,123]},{index:.47,rgb:[255,29,97]},{index:.53,rgb:[255,54,69]},{index:.6,rgb:[255,85,46]},{index:.67,rgb:[255,120,34]},{index:.73,rgb:[255,157,37]},{index:.8,rgb:[241,191,57]},{index:.87,rgb:[224,220,93]},{index:.93,rgb:[218,241,142]},{index:1,rgb:[227,253,198]}]}},{}],53:[function(a,l,c){var i=a("./colorScale"),s=a("lerp");function u(m){return[m[0]/255,m[1]/255,m[2]/255,m[3]]}function h(m){for(var p,g="#",y=0;y<3;++y)g+=("00"+(p=(p=m[y]).toString(16))).substr(p.length);return g}function d(m){return"rgba("+m.join(",")+")"}l.exports=function(m){var p,g,y,v,x,_,A,b,k,w;if(m||(m={}),b=(m.nshades||72)-1,A=m.format||"hex",(_=m.colormap)||(_="jet"),typeof _=="string"){if(_=_.toLowerCase(),!i[_])throw Error(_+" not a supported colorscale");x=i[_]}else{if(!Array.isArray(_))throw Error("unsupported colormap option",_);x=_.slice()}if(x.length>b+1)throw new Error(_+" map requires nshades to be at least size "+x.length);k=Array.isArray(m.alpha)?m.alpha.length!==2?[1,1]:m.alpha.slice():typeof m.alpha=="number"?[m.alpha,m.alpha]:[1,1],p=x.map(function(P){return Math.round(P.index*b)}),k[0]=Math.min(Math.max(k[0],0),1),k[1]=Math.min(Math.max(k[1],0),1);var M=x.map(function(P,L){var R=x[L].index,F=x[L].rgb.slice();return F.length===4&&F[3]>=0&&F[3]<=1||(F[3]=k[0]+(k[1]-k[0])*R),F}),T=[];for(w=0;w0||m(p,g,v)?-1:1:_===0?A>0||m(p,g,y)?1:-1:s(A-_)}var w=i(p,g,y);return w>0?x>0&&i(p,g,v)>0?1:-1:w<0?x>0||i(p,g,v)>0?1:-1:i(p,g,v)>0||m(p,g,y)?1:-1};var i=a("robust-orientation"),s=a("signum"),u=a("two-sum"),h=a("robust-product"),d=a("robust-sum");function m(p,g,y){var v=u(p[0],-g[0]),x=u(p[1],-g[1]),_=u(y[0],-g[0]),A=u(y[1],-g[1]),b=d(h(v,_),h(x,A));return b[b.length-1]>=0}},{"robust-orientation":284,"robust-product":285,"robust-sum":289,signum:55,"two-sum":307}],55:[function(a,l,c){l.exports=function(i){return i<0?-1:i>0?1:0}},{}],56:[function(a,l,c){l.exports=function(u,h){var d=u.length,m=u.length-h.length;if(m)return m;switch(d){case 0:return 0;case 1:return u[0]-h[0];case 2:return u[0]+u[1]-h[0]-h[1]||i(u[0],u[1])-i(h[0],h[1]);case 3:var p=u[0]+u[1],g=h[0]+h[1];if(m=p+u[2]-(g+h[2]))return m;var y=i(u[0],u[1]),v=i(h[0],h[1]);return i(y,u[2])-i(v,h[2])||i(y+u[2],p)-i(v+h[2],g);case 4:var x=u[0],_=u[1],A=u[2],b=u[3],k=h[0],w=h[1],M=h[2],T=h[3];return x+_+A+b-(k+w+M+T)||i(x,_,A,b)-i(k,w,M,T,k)||i(x+_,x+A,x+b,_+A,_+b,A+b)-i(k+w,k+M,k+T,w+M,w+T,M+T)||i(x+_+A,x+_+b,x+A+b,_+A+b)-i(k+w+M,k+w+T,k+M+T,w+M+T);default:for(var E=u.slice().sort(s),S=h.slice().sort(s),P=0;Pi[u][0]&&(u=h);return su?[[u],[s]]:[[s]]}},{}],60:[function(a,l,c){l.exports=function(s){var u=i(s),h=u.length;if(h<=2)return[];for(var d=new Array(h),m=u[h-1],p=0;p=y[w]&&(k+=1);A[b]=k}}return g}(i(m,!0),d)}};var i=a("incremental-convex-hull"),s=a("affine-hull")},{"affine-hull":10,"incremental-convex-hull":233}],62:[function(a,l,c){l.exports=function(i,s,u,h,d,m){var p=d-1,g=d*d,y=p*p,v=(1+2*d)*y,x=d*y,_=g*(3-2*d),A=g*p;if(i.length){m||(m=new Array(i.length));for(var b=i.length-1;b>=0;--b)m[b]=v*i[b]+x*s[b]+_*u[b]+A*h[b];return m}return v*i+x*s+_*u+A*h},l.exports.derivative=function(i,s,u,h,d,m){var p=6*d*d-6*d,g=3*d*d-4*d+1,y=-6*d*d+6*d,v=3*d*d-2*d;if(i.length){m||(m=new Array(i.length));for(var x=i.length-1;x>=0;--x)m[x]=p*i[x]+g*s[x]+y*u[x]+v*h[x];return m}return p*i+g*s+y*u[x]+v*h}},{}],63:[function(a,l,c){var i=a("incremental-convex-hull"),s=a("uniq");function u(d,m){this.point=d,this.index=m}function h(d,m){for(var p=d.point,g=m.point,y=p.length,v=0;v=2)return!1;R[D]=O}return!0}):L.filter(function(R){for(var F=0;F<=g;++F){var D=T[R[F]];if(D<0)return!1;R[F]=D}return!0}),1&g)for(x=0;x>>31},l.exports.exponent=function(m){return(l.exports.hi(m)<<1>>>21)-1023},l.exports.fraction=function(m){var p=l.exports.lo(m),g=l.exports.hi(m),y=1048575&g;return 2146435072&g&&(y+=1<<20),[p,y]},l.exports.denormalized=function(m){return!(2146435072&l.exports.hi(m))}}).call(this)}).call(this,a("buffer").Buffer)},{buffer:3}],65:[function(a,l,c){l.exports=function(i,s){switch(s===void 0&&(s=0),typeof i){case"number":if(i>0)return function(u,h){var d,m;for(d=new Array(u),m=0;m=y-1){w=_.length-1;var T=p-g[y-1];for(M=0;M=y-1)for(var k=_.length-1,w=(g[y-1],0);w=0;--y)if(p[--g])return!1;return!0},d.jump=function(p){var g=this.lastT(),y=this.dimension;if(!(p0;--M)v.push(u(b[M-1],k[M-1],arguments[M])),x.push(0)}},d.push=function(p){var g=this.lastT(),y=this.dimension;if(!(p1e-6?1/A:0;this._time.push(p);for(var T=y;T>0;--T){var E=u(k[T-1],w[T-1],arguments[T]);v.push(E),x.push((E-v[_++])*M)}}},d.set=function(p){var g=this.dimension;if(!(p0;--b)y.push(u(_[b-1],A[b-1],arguments[b])),v.push(0)}},d.move=function(p){var g=this.lastT(),y=this.dimension;if(!(p<=g||arguments.length!==y+1)){var v=this._state,x=this._velocity,_=v.length-this.dimension,A=this.bounds,b=A[0],k=A[1],w=p-g,M=w>1e-6?1/w:0;this._time.push(p);for(var T=y;T>0;--T){var E=arguments[T];v.push(u(b[T-1],k[T-1],v[_++]+E)),x.push(E*M)}}},d.idle=function(p){var g=this.lastT();if(!(p=0;--M)v.push(u(b[M],k[M],v[_]+w*x[_])),x.push(0),_+=1}}},{"binary-search-bounds":31,"cubic-hermite":62}],69:[function(a,l,c){l.exports=function(b){return new d(b||A,null)};function i(b,k,w,M,T,E){this._color=b,this.key=k,this.value=w,this.left=M,this.right=T,this._count=E}function s(b){return new i(b._color,b.key,b.value,b.left,b.right,b._count)}function u(b,k){return new i(b,k.key,k.value,k.left,k.right,k._count)}function h(b){b._count=1+(b.left?b.left._count:0)+(b.right?b.right._count:0)}function d(b,k){this._compare=b,this.root=k}var m=d.prototype;function p(b,k){var w;return k.left&&(w=p(b,k.left))?w:(w=b(k.key,k.value))||(k.right?p(b,k.right):void 0)}function g(b,k,w,M){if(k(b,M.key)<=0){var T;if(M.left&&(T=g(b,k,w,M.left))||(T=w(M.key,M.value)))return T}if(M.right)return g(b,k,w,M.right)}function y(b,k,w,M,T){var E,S=w(b,T.key),P=w(k,T.key);if(S<=0&&(T.left&&(E=y(b,k,w,M,T.left))||P>0&&(E=M(T.key,T.value))))return E;if(P>0&&T.right)return y(b,k,w,M,T.right)}function v(b,k){this.tree=b,this._stack=k}Object.defineProperty(m,"keys",{get:function(){var b=[];return this.forEach(function(k,w){b.push(k)}),b}}),Object.defineProperty(m,"values",{get:function(){var b=[];return this.forEach(function(k,w){b.push(w)}),b}}),Object.defineProperty(m,"length",{get:function(){return this.root?this.root._count:0}}),m.insert=function(b,k){for(var w=this._compare,M=this.root,T=[],E=[];M;){var S=w(b,M.key);T.push(M),E.push(S),M=S<=0?M.left:M.right}T.push(new i(0,b,k,null,null,1));for(var P=T.length-2;P>=0;--P)M=T[P],E[P]<=0?T[P]=new i(M._color,M.key,M.value,T[P+1],M.right,M._count+1):T[P]=new i(M._color,M.key,M.value,M.left,T[P+1],M._count+1);for(P=T.length-1;P>1;--P){var L=T[P-1];if(M=T[P],L._color===1||M._color===1)break;var R=T[P-2];if(R.left===L)if(L.left===M){if(!(F=R.right)||F._color!==0){R._color=0,R.left=L.right,L._color=1,L.right=R,T[P-2]=L,T[P-1]=M,h(R),h(L),P>=3&&((D=T[P-3]).left===R?D.left=L:D.right=L);break}L._color=1,R.right=u(1,F),R._color=0,P-=1}else{if(!(F=R.right)||F._color!==0){L.right=M.left,R._color=0,R.left=M.right,M._color=1,M.left=L,M.right=R,T[P-2]=M,T[P-1]=L,h(R),h(L),h(M),P>=3&&((D=T[P-3]).left===R?D.left=M:D.right=M);break}L._color=1,R.right=u(1,F),R._color=0,P-=1}else if(L.right===M){if(!(F=R.left)||F._color!==0){R._color=0,R.right=L.left,L._color=1,L.left=R,T[P-2]=L,T[P-1]=M,h(R),h(L),P>=3&&((D=T[P-3]).right===R?D.right=L:D.left=L);break}L._color=1,R.left=u(1,F),R._color=0,P-=1}else{var F;if(!(F=R.left)||F._color!==0){var D;L.left=M.right,R._color=0,R.right=M.left,M._color=1,M.right=L,M.left=R,T[P-2]=M,T[P-1]=L,h(R),h(L),h(M),P>=3&&((D=T[P-3]).right===R?D.right=M:D.left=M);break}L._color=1,R.left=u(1,F),R._color=0,P-=1}}return T[0]._color=1,new d(w,T[0])},m.forEach=function(b,k,w){if(this.root)switch(arguments.length){case 1:return p(b,this.root);case 2:return g(k,this._compare,b,this.root);case 3:return this._compare(k,w)>=0?void 0:y(k,w,this._compare,b,this.root)}},Object.defineProperty(m,"begin",{get:function(){for(var b=[],k=this.root;k;)b.push(k),k=k.left;return new v(this,b)}}),Object.defineProperty(m,"end",{get:function(){for(var b=[],k=this.root;k;)b.push(k),k=k.right;return new v(this,b)}}),m.at=function(b){if(b<0)return new v(this,[]);for(var k=this.root,w=[];;){if(w.push(k),k.left){if(b=k.right._count)break;k=k.right}return new v(this,[])},m.ge=function(b){for(var k=this._compare,w=this.root,M=[],T=0;w;){var E=k(b,w.key);M.push(w),E<=0&&(T=M.length),w=E<=0?w.left:w.right}return M.length=T,new v(this,M)},m.gt=function(b){for(var k=this._compare,w=this.root,M=[],T=0;w;){var E=k(b,w.key);M.push(w),E<0&&(T=M.length),w=E<0?w.left:w.right}return M.length=T,new v(this,M)},m.lt=function(b){for(var k=this._compare,w=this.root,M=[],T=0;w;){var E=k(b,w.key);M.push(w),E>0&&(T=M.length),w=E<=0?w.left:w.right}return M.length=T,new v(this,M)},m.le=function(b){for(var k=this._compare,w=this.root,M=[],T=0;w;){var E=k(b,w.key);M.push(w),E>=0&&(T=M.length),w=E<0?w.left:w.right}return M.length=T,new v(this,M)},m.find=function(b){for(var k=this._compare,w=this.root,M=[];w;){var T=k(b,w.key);if(M.push(w),T===0)return new v(this,M);w=T<=0?w.left:w.right}return new v(this,[])},m.remove=function(b){var k=this.find(b);return k?k.remove():this},m.get=function(b){for(var k=this._compare,w=this.root;w;){var M=k(b,w.key);if(M===0)return w.value;w=M<=0?w.left:w.right}};var x=v.prototype;function _(b,k){b.key=k.key,b.value=k.value,b.left=k.left,b.right=k.right,b._color=k._color,b._count=k._count}function A(b,k){return bk?1:0}Object.defineProperty(x,"valid",{get:function(){return this._stack.length>0}}),Object.defineProperty(x,"node",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1]:null},enumerable:!0}),x.clone=function(){return new v(this.tree,this._stack.slice())},x.remove=function(){var b=this._stack;if(b.length===0)return this.tree;var k=new Array(b.length),w=b[b.length-1];k[k.length-1]=new i(w._color,w.key,w.value,w.left,w.right,w._count);for(var M=b.length-2;M>=0;--M)(w=b[M]).left===b[M+1]?k[M]=new i(w._color,w.key,w.value,k[M+1],w.right,w._count):k[M]=new i(w._color,w.key,w.value,w.left,k[M+1],w._count);if((w=k[k.length-1]).left&&w.right){var T=k.length;for(w=w.left;w.right;)k.push(w),w=w.right;var E=k[T-1];for(k.push(new i(w._color,E.key,E.value,w.left,w.right,w._count)),k[T-1].key=w.key,k[T-1].value=w.value,M=k.length-2;M>=T;--M)w=k[M],k[M]=new i(w._color,w.key,w.value,w.left,k[M+1],w._count);k[T-1].left=k[T]}if((w=k[k.length-1])._color===0){var S=k[k.length-2];for(S.left===w?S.left=null:S.right===w&&(S.right=null),k.pop(),M=0;M=0;--N){if(R=L[N],N===0)return void(R._color=1);if((F=L[N-1]).left===R){if((D=F.right).right&&D.right._color===0)return O=(D=F.right=s(D)).right=s(D.right),F.right=D.left,D.left=F,D.right=O,D._color=F._color,R._color=1,F._color=1,O._color=1,h(F),h(D),N>1&&((B=L[N-2]).left===F?B.left=D:B.right=D),void(L[N-1]=D);if(D.left&&D.left._color===0)return O=(D=F.right=s(D)).left=s(D.left),F.right=O.left,D.left=O.right,O.left=F,O.right=D,O._color=F._color,F._color=1,D._color=1,R._color=1,h(F),h(D),h(O),N>1&&((B=L[N-2]).left===F?B.left=O:B.right=O),void(L[N-1]=O);if(D._color===1){if(F._color===0)return F._color=1,void(F.right=u(0,D));F.right=u(0,D);continue}D=s(D),F.right=D.left,D.left=F,D._color=F._color,F._color=0,h(F),h(D),N>1&&((B=L[N-2]).left===F?B.left=D:B.right=D),L[N-1]=D,L[N]=F,N+11&&((B=L[N-2]).right===F?B.right=D:B.left=D),void(L[N-1]=D);if(D.right&&D.right._color===0)return O=(D=F.left=s(D)).right=s(D.right),F.left=O.right,D.right=O.left,O.right=F,O.left=D,O._color=F._color,F._color=1,D._color=1,R._color=1,h(F),h(D),h(O),N>1&&((B=L[N-2]).right===F?B.right=O:B.left=O),void(L[N-1]=O);if(D._color===1){if(F._color===0)return F._color=1,void(F.left=u(0,D));F.left=u(0,D);continue}var B;D=s(D),F.left=D.right,D.right=F,D._color=F._color,F._color=0,h(F),h(D),N>1&&((B=L[N-2]).right===F?B.right=D:B.left=D),L[N-1]=D,L[N]=F,N+10)return this._stack[this._stack.length-1].key},enumerable:!0}),Object.defineProperty(x,"value",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].value},enumerable:!0}),Object.defineProperty(x,"index",{get:function(){var b=0,k=this._stack;if(k.length===0){var w=this.tree.root;return w?w._count:0}k[k.length-1].left&&(b=k[k.length-1].left._count);for(var M=k.length-2;M>=0;--M)k[M+1]===k[M].right&&(++b,k[M].left&&(b+=k[M].left._count));return b},enumerable:!0}),x.next=function(){var b=this._stack;if(b.length!==0){var k=b[b.length-1];if(k.right)for(k=k.right;k;)b.push(k),k=k.left;else for(b.pop();b.length>0&&b[b.length-1].right===k;)k=b[b.length-1],b.pop()}},Object.defineProperty(x,"hasNext",{get:function(){var b=this._stack;if(b.length===0)return!1;if(b[b.length-1].right)return!0;for(var k=b.length-1;k>0;--k)if(b[k-1].left===b[k])return!0;return!1}}),x.update=function(b){var k=this._stack;if(k.length===0)throw new Error("Can't update empty node!");var w=new Array(k.length),M=k[k.length-1];w[w.length-1]=new i(M._color,M.key,b,M.left,M.right,M._count);for(var T=k.length-2;T>=0;--T)(M=k[T]).left===k[T+1]?w[T]=new i(M._color,M.key,M.value,w[T+1],M.right,M._count):w[T]=new i(M._color,M.key,M.value,M.left,w[T+1],M._count);return new d(this.tree._compare,w[0])},x.prev=function(){var b=this._stack;if(b.length!==0){var k=b[b.length-1];if(k.left)for(k=k.left;k;)b.push(k),k=k.right;else for(b.pop();b.length>0&&b[b.length-1].left===k;)k=b[b.length-1],b.pop()}},Object.defineProperty(x,"hasPrev",{get:function(){var b=this._stack;if(b.length===0)return!1;if(b[b.length-1].left)return!0;for(var k=b.length-1;k>0;--k)if(b[k-1].right===b[k])return!0;return!1}})},{}],70:[function(a,l,c){l.exports=function(T,E){var S=new g(T);return S.update(E),S};var i=a("./lib/text.js"),s=a("./lib/lines.js"),u=a("./lib/background.js"),h=a("./lib/cube.js"),d=a("./lib/ticks.js"),m=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);function p(T,E){return T[0]=E[0],T[1]=E[1],T[2]=E[2],T}function g(T){this.gl=T,this.pixelRatio=1,this.bounds=[[-10,-10,-10],[10,10,10]],this.ticks=[[],[],[]],this.autoTicks=!0,this.tickSpacing=[1,1,1],this.tickEnable=[!0,!0,!0],this.tickFont=["sans-serif","sans-serif","sans-serif"],this.tickSize=[12,12,12],this.tickAngle=[0,0,0],this.tickAlign=["auto","auto","auto"],this.tickColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.tickPad=[10,10,10],this.lastCubeProps={cubeEdges:[0,0,0],axis:[0,0,0]},this.labels=["x","y","z"],this.labelEnable=[!0,!0,!0],this.labelFont="sans-serif",this.labelSize=[20,20,20],this.labelAngle=[0,0,0],this.labelAlign=["auto","auto","auto"],this.labelColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.labelPad=[10,10,10],this.lineEnable=[!0,!0,!0],this.lineMirror=[!1,!1,!1],this.lineWidth=[1,1,1],this.lineColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.lineTickEnable=[!0,!0,!0],this.lineTickMirror=[!1,!1,!1],this.lineTickLength=[0,0,0],this.lineTickWidth=[1,1,1],this.lineTickColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.gridEnable=[!0,!0,!0],this.gridWidth=[1,1,1],this.gridColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.zeroEnable=[!0,!0,!0],this.zeroLineColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.zeroLineWidth=[2,2,2],this.backgroundEnable=[!1,!1,!1],this.backgroundColor=[[.8,.8,.8,.5],[.8,.8,.8,.5],[.8,.8,.8,.5]],this._firstInit=!0,this._text=null,this._lines=null,this._background=u(T)}var y=g.prototype;function v(){this.primalOffset=[0,0,0],this.primalMinor=[0,0,0],this.mirrorOffset=[0,0,0],this.mirrorMinor=[0,0,0]}y.update=function(T){function E(K,te,Y){if(Y in T){var J,re=T[Y],U=this[Y];(K?Array.isArray(re)&&Array.isArray(re[0]):Array.isArray(re))?this[Y]=J=[te(re[0]),te(re[1]),te(re[2])]:this[Y]=J=[te(re),te(re),te(re)];for(var V=0;V<3;++V)if(J[V]!==U[V])return!0}return!1}T=T||{};var S,P=E.bind(this,!1,Number),L=E.bind(this,!1,Boolean),R=E.bind(this,!1,String),F=E.bind(this,!0,function(K){if(Array.isArray(K)){if(K.length===3)return[+K[0],+K[1],+K[2],1];if(K.length===4)return[+K[0],+K[1],+K[2],+K[3]]}return[0,0,0,1]}),D=!1,O=!1;if("bounds"in T)for(var N=T.bounds,B=0;B<2;++B)for(var W=0;W<3;++W)N[B][W]!==this.bounds[B][W]&&(O=!0),this.bounds[B][W]=N[B][W];if("ticks"in T)for(S=T.ticks,D=!0,this.autoTicks=!1,B=0;B<3;++B)this.tickSpacing[B]=0;else P("tickSpacing")&&(this.autoTicks=!0,O=!0);if(this._firstInit&&("ticks"in T||"tickSpacing"in T||(this.autoTicks=!0),O=!0,D=!0,this._firstInit=!1),O&&this.autoTicks&&(S=d.create(this.bounds,this.tickSpacing),D=!0),D){for(B=0;B<3;++B)S[B].sort(function(K,te){return K.x-te.x});d.equal(S,this.ticks)?D=!1:this.ticks=S}L("tickEnable"),R("tickFont")&&(D=!0),P("tickSize"),P("tickAngle"),P("tickPad"),F("tickColor");var G=R("labels");R("labelFont")&&(G=!0),L("labelEnable"),P("labelSize"),P("labelPad"),F("labelColor"),L("lineEnable"),L("lineMirror"),P("lineWidth"),F("lineColor"),L("lineTickEnable"),L("lineTickMirror"),P("lineTickLength"),P("lineTickWidth"),F("lineTickColor"),L("gridEnable"),P("gridWidth"),F("gridColor"),L("zeroEnable"),F("zeroLineColor"),P("zeroLineWidth"),L("backgroundEnable"),F("backgroundColor"),this._text?this._text&&(G||D)&&this._text.update(this.bounds,this.labels,this.labelFont,this.ticks,this.tickFont):this._text=i(this.gl,this.bounds,this.labels,this.labelFont,this.ticks,this.tickFont),this._lines&&D&&(this._lines.dispose(),this._lines=null),this._lines||(this._lines=s(this.gl,this.bounds,this.ticks))};var x=[new v,new v,new v];function _(T,E,S,P,L){for(var R=T.primalOffset,F=T.primalMinor,D=T.mirrorOffset,O=T.mirrorMinor,N=P[E],B=0;B<3;++B)if(E!==B){var W=R,G=D,K=F,te=O;N&1<0?(K[B]=-1,te[B]=0):(K[B]=0,te[B]=1)}}var A=[0,0,0],b={model:m,view:m,projection:m,_ortho:!1};y.isOpaque=function(){return!0},y.isTransparent=function(){return!1},y.drawTransparent=function(T){};var k=[0,0,0],w=[0,0,0],M=[0,0,0];y.draw=function(T){T=T||b;for(var E=this.gl,S=T.model||m,P=T.view||m,L=T.projection||m,R=this.bounds,F=T._ortho||!1,D=h(S,P,L,R,F),O=D.cubeEdges,N=D.axis,B=P[12],W=P[13],G=P[14],K=P[15],te=(F?2:1)*this.pixelRatio*(L[3]*B+L[7]*W+L[11]*G+L[15]*K)/E.drawingBufferHeight,Y=0;Y<3;++Y)this.lastCubeProps.cubeEdges[Y]=O[Y],this.lastCubeProps.axis[Y]=N[Y];var J=x;for(Y=0;Y<3;++Y)_(x[Y],Y,this.bounds,O,N);E=this.gl;var re,U=A;for(Y=0;Y<3;++Y)this.backgroundEnable[Y]?U[Y]=N[Y]:U[Y]=0;for(this._background.draw(S,P,L,R,U,this.backgroundColor),this._lines.bind(S,P,L,this),Y=0;Y<3;++Y){var V=[0,0,0];N[Y]>0?V[Y]=R[1][Y]:V[Y]=R[0][Y];for(var H=0;H<2;++H){var ne=(Y+1+H)%3,q=(Y+1+(1^H))%3;this.gridEnable[ne]&&this._lines.drawGrid(ne,q,this.bounds,V,this.gridColor[ne],this.gridWidth[ne]*this.pixelRatio)}for(H=0;H<2;++H)ne=(Y+1+H)%3,q=(Y+1+(1^H))%3,this.zeroEnable[q]&&Math.min(R[0][q],R[1][q])<=0&&Math.max(R[0][q],R[1][q])>=0&&this._lines.drawZero(ne,q,this.bounds,V,this.zeroLineColor[q],this.zeroLineWidth[q]*this.pixelRatio)}for(Y=0;Y<3;++Y){this.lineEnable[Y]&&this._lines.drawAxisLine(Y,this.bounds,J[Y].primalOffset,this.lineColor[Y],this.lineWidth[Y]*this.pixelRatio),this.lineMirror[Y]&&this._lines.drawAxisLine(Y,this.bounds,J[Y].mirrorOffset,this.lineColor[Y],this.lineWidth[Y]*this.pixelRatio);var Q=p(k,J[Y].primalMinor),ee=p(w,J[Y].mirrorMinor),ie=this.lineTickLength;for(H=0;H<3;++H){var ae=te/S[5*H];Q[H]*=ie[H]*ae,ee[H]*=ie[H]*ae}this.lineTickEnable[Y]&&this._lines.drawAxisTicks(Y,J[Y].primalOffset,Q,this.lineTickColor[Y],this.lineTickWidth[Y]*this.pixelRatio),this.lineTickMirror[Y]&&this._lines.drawAxisTicks(Y,J[Y].mirrorOffset,ee,this.lineTickColor[Y],this.lineTickWidth[Y]*this.pixelRatio)}this._lines.unbind(),this._text.bind(S,P,L,this.pixelRatio);var ue,le;function ge(Le){(le=[0,0,0])[Le]=1}function fe(Le,de,ve){var Me=(Le+1)%3,we=(Le+2)%3,Ce=de[Me],Fe=de[we],ze=ve[Me],$e=ve[we];Ce>0&&$e>0||Ce>0&&$e<0||Ce<0&&$e>0||Ce<0&&$e<0?ge(Me):(Fe>0&&ze>0||Fe>0&&ze<0||Fe<0&&ze>0||Fe<0&&ze<0)&&ge(we)}for(Y=0;Y<3;++Y){var me=J[Y].primalMinor,_e=J[Y].mirrorMinor,Ae=p(M,J[Y].primalOffset);for(H=0;H<3;++H)this.lineTickEnable[Y]&&(Ae[H]+=te*me[H]*Math.max(this.lineTickLength[H],0)/S[5*H]);var ke=[0,0,0];if(ke[Y]=1,this.tickEnable[Y]){for(this.tickAngle[Y]===-3600?(this.tickAngle[Y]=0,this.tickAlign[Y]="auto"):this.tickAlign[Y]=-1,ue=1,(re=[this.tickAlign[Y],.5,ue])[0]==="auto"?re[0]=0:re[0]=parseInt(""+re[0]),le=[0,0,0],fe(Y,me,_e),H=0;H<3;++H)Ae[H]+=te*me[H]*this.tickPad[H]/S[5*H];this._text.drawTicks(Y,this.tickSize[Y],this.tickAngle[Y],Ae,this.tickColor[Y],ke,le,re)}if(this.labelEnable[Y]){for(ue=0,le=[0,0,0],this.labels[Y].length>4&&(ge(Y),ue=1),(re=[this.labelAlign[Y],.5,ue])[0]==="auto"?re[0]=0:re[0]=parseInt(""+re[0]),H=0;H<3;++H)Ae[H]+=te*me[H]*this.labelPad[H]/S[5*H];Ae[Y]+=.5*(R[0][Y]+R[1][Y]),this._text.drawLabel(Y,this.labelSize[Y],this.labelAngle[Y],Ae,this.labelColor[Y],[0,0,0],le,re)}}this._text.unbind()},y.dispose=function(){this._text.dispose(),this._lines.dispose(),this._background.dispose(),this._lines=null,this._text=null,this._background=null,this.gl=null}},{"./lib/background.js":71,"./lib/cube.js":72,"./lib/lines.js":73,"./lib/text.js":75,"./lib/ticks.js":76}],71:[function(a,l,c){l.exports=function(m){for(var p=[],g=[],y=0,v=0;v<3;++v)for(var x=(v+1)%3,_=(v+2)%3,A=[0,0,0],b=[0,0,0],k=-1;k<=1;k+=2){g.push(y,y+2,y+1,y+1,y+2,y+3),A[v]=k,b[v]=k;for(var w=-1;w<=1;w+=2){A[x]=w;for(var M=-1;M<=1;M+=2)A[_]=M,p.push(A[0],A[1],A[2],b[0],b[1],b[2]),y+=1}var T=x;x=_,_=T}var E=i(m,new Float32Array(p)),S=i(m,new Uint16Array(g),m.ELEMENT_ARRAY_BUFFER),P=s(m,[{buffer:E,type:m.FLOAT,size:3,offset:0,stride:24},{buffer:E,type:m.FLOAT,size:3,offset:12,stride:24}],S),L=u(m);return L.attributes.position.location=0,L.attributes.normal.location=1,new h(m,E,P,L)};var i=a("gl-buffer"),s=a("gl-vao"),u=a("./shaders").bg;function h(m,p,g,y){this.gl=m,this.buffer=p,this.vao=g,this.shader=y}var d=h.prototype;d.draw=function(m,p,g,y,v,x){for(var _=!1,A=0;A<3;++A)_=_||v[A];if(_){var b=this.gl;b.enable(b.POLYGON_OFFSET_FILL),b.polygonOffset(1,2),this.shader.bind(),this.shader.uniforms={model:m,view:p,projection:g,bounds:y,enable:v,colors:x},this.vao.bind(),this.vao.draw(this.gl.TRIANGLES,36),this.vao.unbind(),b.disable(b.POLYGON_OFFSET_FILL)}},d.dispose=function(){this.vao.dispose(),this.buffer.dispose(),this.shader.dispose()}},{"./shaders":74,"gl-buffer":78,"gl-vao":150}],72:[function(a,l,c){l.exports=function(w,M,T,E,S){s(d,M,w),s(d,T,d);for(var P=0,L=0;L<2;++L){g[2]=E[L][2];for(var R=0;R<2;++R){g[1]=E[R][1];for(var F=0;F<2;++F)g[0]=E[F][0],v(m[P],g,d),P+=1}}var D=-1;for(L=0;L<8;++L){for(var O=m[L][3],N=0;N<3;++N)p[L][N]=m[L][N]/O;S&&(p[L][2]*=-1),O<0&&(D<0||p[L][2]K&&(D|=1<K&&(D|=1<p[L][1])&&(ne=L);var q=-1;for(L=0;L<3;++L)(ee=ne^1<p[Q][0]&&(Q=ee))}var ie=A;ie[0]=ie[1]=ie[2]=0,ie[i.log2(q^ne)]=ne&q,ie[i.log2(ne^Q)]=ne&Q;var ae=7^Q;ae===D||ae===H?(ae=7^q,ie[i.log2(Q^ae)]=ae&Q):ie[i.log2(q^ae)]=ae&q;var ue=b,le=D;for(B=0;B<3;++B)ue[B]=le&1< HALF_PI) && (b <= ONE_AND_HALF_PI)) ? - b - PI : - b; -} - -float look_horizontal_or_vertical(float a, float ratio) { - // ratio controls the ratio between being horizontal to (vertical + horizontal) - // if ratio is set to 0.5 then it is 50%, 50%. - // when using a higher ratio e.g. 0.75 the result would - // likely be more horizontal than vertical. - - float b = positive_angle(a); - - return - (b < ( ratio) * HALF_PI) ? 0.0 : - (b < (2.0 - ratio) * HALF_PI) ? -HALF_PI : - (b < (2.0 + ratio) * HALF_PI) ? 0.0 : - (b < (4.0 - ratio) * HALF_PI) ? HALF_PI : - 0.0; -} - -float roundTo(float a, float b) { - return float(b * floor((a + 0.5 * b) / b)); -} - -float look_round_n_directions(float a, int n) { - float b = positive_angle(a); - float div = TWO_PI / float(n); - float c = roundTo(b, div); - return look_upwards(c); -} - -float applyAlignOption(float rawAngle, float delta) { - return - (option > 2) ? look_round_n_directions(rawAngle + delta, option) : // option 3-n: round to n directions - (option == 2) ? look_horizontal_or_vertical(rawAngle + delta, hv_ratio) : // horizontal or vertical - (option == 1) ? rawAngle + delta : // use free angle, and flip to align with one direction of the axis - (option == 0) ? look_upwards(rawAngle) : // use free angle, and stay upwards - (option ==-1) ? 0.0 : // useful for backward compatibility, all texts remains horizontal - rawAngle; // otherwise return back raw input angle -} - -bool isAxisTitle = (axis.x == 0.0) && - (axis.y == 0.0) && - (axis.z == 0.0); - -void main() { - //Compute world offset - float axisDistance = position.z; - vec3 dataPosition = axisDistance * axis + offset; - - float beta = angle; // i.e. user defined attributes for each tick - - float axisAngle; - float clipAngle; - float flip; - - if (enableAlign) { - axisAngle = (isAxisTitle) ? HALF_PI : - computeViewAngle(dataPosition, dataPosition + axis); - clipAngle = computeViewAngle(dataPosition, dataPosition + alignDir); - - axisAngle += (sin(axisAngle) < 0.0) ? PI : 0.0; - clipAngle += (sin(clipAngle) < 0.0) ? PI : 0.0; - - flip = (dot(vec2(cos(axisAngle), sin(axisAngle)), - vec2(sin(clipAngle),-cos(clipAngle))) > 0.0) ? 1.0 : 0.0; - - beta += applyAlignOption(clipAngle, flip * PI); - } - - //Compute plane offset - vec2 planeCoord = position.xy * pixelScale; - - mat2 planeXform = scale * mat2( - cos(beta), sin(beta), - -sin(beta), cos(beta) - ); - - vec2 viewOffset = 2.0 * planeXform * planeCoord / resolution; - - //Compute clip position - vec3 clipPosition = project(dataPosition); - - //Apply text offset in clip coordinates - clipPosition += vec3(viewOffset, 0.0); - - //Done - gl_Position = vec4(clipPosition, 1.0); -}`]),m=i([`precision highp float; -#define GLSLIFY 1 - -uniform vec4 color; -void main() { - gl_FragColor = color; -}`]);c.text=function(y){return s(y,d,m,null,[{name:"position",type:"vec3"}])};var p=i([`precision highp float; -#define GLSLIFY 1 - -attribute vec3 position; -attribute vec3 normal; - -uniform mat4 model, view, projection; -uniform vec3 enable; -uniform vec3 bounds[2]; - -varying vec3 colorChannel; - -void main() { - - vec3 signAxis = sign(bounds[1] - bounds[0]); - - vec3 realNormal = signAxis * normal; - - if(dot(realNormal, enable) > 0.0) { - vec3 minRange = min(bounds[0], bounds[1]); - vec3 maxRange = max(bounds[0], bounds[1]); - vec3 nPosition = mix(minRange, maxRange, 0.5 * (position + 1.0)); - gl_Position = projection * view * model * vec4(nPosition, 1.0); - } else { - gl_Position = vec4(0,0,0,0); - } - - colorChannel = abs(realNormal); -}`]),g=i([`precision highp float; -#define GLSLIFY 1 - -uniform vec4 colors[3]; - -varying vec3 colorChannel; - -void main() { - gl_FragColor = colorChannel.x * colors[0] + - colorChannel.y * colors[1] + - colorChannel.z * colors[2]; -}`]);c.bg=function(y){return s(y,p,g,null,[{name:"position",type:"vec3"},{name:"normal",type:"vec3"}])}},{"gl-shader":132,glslify:231}],75:[function(a,l,c){(function(i){(function(){l.exports=function(x,_,A,b,k,w){var M=s(x),T=u(x,[{buffer:M,size:3}]),E=d(x);E.attributes.position.location=0;var S=new g(x,E,M,T);return S.update(_,A,b,k,w),S};var s=a("gl-buffer"),u=a("gl-vao"),h=a("vectorize-text"),d=a("./shaders").text,m=window||i.global||{},p=m.__TEXT_CACHE||{};m.__TEXT_CACHE={};function g(x,_,A,b){this.gl=x,this.shader=_,this.buffer=A,this.vao=b,this.tickOffset=this.tickCount=this.labelOffset=this.labelCount=null}var y=g.prototype,v=[0,0];y.bind=function(x,_,A,b){this.vao.bind(),this.shader.bind();var k=this.shader.uniforms;k.model=x,k.view=_,k.projection=A,k.pixelScale=b,v[0]=this.gl.drawingBufferWidth,v[1]=this.gl.drawingBufferHeight,this.shader.uniforms.resolution=v},y.unbind=function(){this.vao.unbind()},y.update=function(x,_,A,b,k){var w=[];function M(D,O,N,B,W,G){var K=p[N];K||(K=p[N]={});var te=K[O];te||(te=K[O]=function(Q,ee){try{return h(Q,ee)}catch(ie){return console.warn('error vectorizing text:"'+Q+'" error:',ie),{cells:[],positions:[]}}}(O,{triangles:!0,font:N,textAlign:"center",textBaseline:"middle",lineSpacing:W,styletags:G}));for(var Y=(B||12)/12,J=te.positions,re=te.cells,U=0,V=re.length;U=0;--ne){var q=J[H[ne]];w.push(Y*q[0],-Y*q[1],D)}}for(var T=[0,0,0],E=[0,0,0],S=[0,0,0],P=[0,0,0],L={breaklines:!0,bolds:!0,italics:!0,subscripts:!0,superscripts:!0},R=0;R<3;++R){S[R]=w.length/3|0,M(.5*(x[0][R]+x[1][R]),_[R],A[R],12,1.25,L),P[R]=(w.length/3|0)-S[R],T[R]=w.length/3|0;for(var F=0;F=0&&(m=h.length-d-1);var p=Math.pow(10,m),g=Math.round(s*u*p),y=g+"";if(y.indexOf("e")>=0)return y;var v=g/p,x=g%p;g<0?(v=0|-Math.ceil(v),x=0|-x):(v=0|Math.floor(v),x|=0);var _=""+v;if(g<0&&(_="-"+_),m){for(var A=""+x;A.length=s[0][d];--p)m.push({x:p*u[d],text:i(u[d],p)});h.push(m)}return h},c.equal=function(s,u){for(var h=0;h<3;++h){if(s[h].length!==u[h].length)return!1;for(var d=0;dx)throw new Error("gl-buffer: If resizing buffer, must not specify offset");return y.bufferSubData(v,b,A),x}function g(y,v){for(var x=i.malloc(y.length,v),_=y.length,A=0;A<_;++A)x[A]=y[A];return x}m.bind=function(){this.gl.bindBuffer(this.type,this.handle)},m.unbind=function(){this.gl.bindBuffer(this.type,null)},m.dispose=function(){this.gl.deleteBuffer(this.handle)},m.update=function(y,v){if(typeof v!="number"&&(v=-1),this.bind(),typeof y=="object"&&y.shape!==void 0){var x=y.dtype;if(h.indexOf(x)<0&&(x="float32"),this.type===this.gl.ELEMENT_ARRAY_BUFFER&&(x=gl.getExtension("OES_element_index_uint")&&x!=="uint16"?"uint32":"uint16"),x===y.dtype&&function(k,w){for(var M=1,T=w.length-1;T>=0;--T){if(w[T]!==M)return!1;M*=k[T]}return!0}(y.shape,y.stride))y.offset===0&&y.data.length===y.shape[0]?this.length=p(this.gl,this.type,this.length,this.usage,y.data,v):this.length=p(this.gl,this.type,this.length,this.usage,y.data.subarray(y.offset,y.shape[0]),v);else{var _=i.malloc(y.size,x),A=u(_,y.shape);s.assign(A,y),this.length=p(this.gl,this.type,this.length,this.usage,v<0?_:_.subarray(0,y.size),v),i.free(_)}}else if(Array.isArray(y)){var b;b=this.type===this.gl.ELEMENT_ARRAY_BUFFER?g(y,"uint16"):g(y,"float32"),this.length=p(this.gl,this.type,this.length,this.usage,v<0?b:b.subarray(0,y.length),v),i.free(b)}else if(typeof y=="object"&&typeof y.length=="number")this.length=p(this.gl,this.type,this.length,this.usage,y,v);else{if(typeof y!="number"&&y!==void 0)throw new Error("gl-buffer: Invalid data type");if(v>=0)throw new Error("gl-buffer: Cannot specify offset when resizing buffer");(y|=0)<=0&&(y=1),this.gl.bufferData(this.type,0|y,this.usage),this.length=y}},l.exports=function(y,v,x,_){if(x=x||y.ARRAY_BUFFER,_=_||y.DYNAMIC_DRAW,x!==y.ARRAY_BUFFER&&x!==y.ELEMENT_ARRAY_BUFFER)throw new Error("gl-buffer: Invalid type for webgl buffer, must be either gl.ARRAY_BUFFER or gl.ELEMENT_ARRAY_BUFFER");if(_!==y.DYNAMIC_DRAW&&_!==y.STATIC_DRAW&&_!==y.STREAM_DRAW)throw new Error("gl-buffer: Invalid usage for buffer, must be either gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW");var A=y.createBuffer(),b=new d(y,x,A,0,_);return b.update(v),b}},{ndarray:259,"ndarray-ops":254,"typedarray-pool":308}],79:[function(a,l,c){var i=a("gl-vec3");l.exports=function(u,h){var d=u.positions,m=u.vectors,p={positions:[],vertexIntensity:[],vertexIntensityBounds:u.vertexIntensityBounds,vectors:[],cells:[],coneOffset:u.coneOffset,colormap:u.colormap};if(u.positions.length===0)return h&&(h[0]=[0,0,0],h[1]=[0,0,0]),p;for(var g=0,y=1/0,v=-1/0,x=1/0,_=-1/0,A=1/0,b=-1/0,k=null,w=null,M=[],T=1/0,E=!1,S=0;Sg&&(g=i.length(L)),S){var R=2*i.distance(k,P)/(i.length(w)+i.length(L));R?(T=Math.min(T,R),E=!1):E=!0}E||(k=P,w=L),M.push(L)}var F=[y,x,A],D=[v,_,b];h&&(h[0]=F,h[1]=D),g===0&&(g=1);var O=1/g;isFinite(T)||(T=1),p.vectorScale=T;var N=u.coneSize||.5;u.absoluteConeSize&&(N=u.absoluteConeSize*O),p.coneScale=N,S=0;for(var B=0;S=1},x.isTransparent=function(){return this.opacity<1},x.pickSlots=1,x.setPickBase=function(b){this.pickId=b},x.update=function(b){b=b||{};var k=this.gl;this.dirty=!0,"lightPosition"in b&&(this.lightPosition=b.lightPosition),"opacity"in b&&(this.opacity=b.opacity),"ambient"in b&&(this.ambientLight=b.ambient),"diffuse"in b&&(this.diffuseLight=b.diffuse),"specular"in b&&(this.specularLight=b.specular),"roughness"in b&&(this.roughness=b.roughness),"fresnel"in b&&(this.fresnel=b.fresnel),b.tubeScale!==void 0&&(this.tubeScale=b.tubeScale),b.vectorScale!==void 0&&(this.vectorScale=b.vectorScale),b.coneScale!==void 0&&(this.coneScale=b.coneScale),b.coneOffset!==void 0&&(this.coneOffset=b.coneOffset),b.colormap&&(this.texture.shape=[256,256],this.texture.minFilter=k.LINEAR_MIPMAP_LINEAR,this.texture.magFilter=k.LINEAR,this.texture.setPixels(function(ne){for(var q=g({colormap:ne,nshades:256,format:"rgba"}),Q=new Uint8Array(1024),ee=0;ee<256;++ee){for(var ie=q[ee],ae=0;ae<3;++ae)Q[4*ee+ae]=ie[ae];Q[4*ee+3]=255*ie[3]}return p(Q,[256,256,4],[4,0,1])}(b.colormap)),this.texture.generateMipmap());var w=b.cells,M=b.positions,T=b.vectors;if(M&&w&&T){var E=[],S=[],P=[],L=[],R=[];this.cells=w,this.positions=M,this.vectors=T;var F=b.meshColor||[1,1,1,1],D=b.vertexIntensity,O=1/0,N=-1/0;if(D)if(b.vertexIntensityBounds)O=+b.vertexIntensityBounds[0],N=+b.vertexIntensityBounds[1];else for(var B=0;B0){var O=this.triShader;O.bind(),O.uniforms=P,this.triangleVAO.bind(),k.drawArrays(k.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()}},x.drawPick=function(b){b=b||{};for(var k=this.gl,w=b.model||y,M=b.view||y,T=b.projection||y,E=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],S=0;S<3;++S)E[0][S]=Math.max(E[0][S],this.clipBounds[0][S]),E[1][S]=Math.min(E[1][S],this.clipBounds[1][S]);this._model=[].slice.call(w),this._view=[].slice.call(M),this._projection=[].slice.call(T),this._resolution=[k.drawingBufferWidth,k.drawingBufferHeight];var P={model:w,view:M,projection:T,clipBounds:E,tubeScale:this.tubeScale,vectorScale:this.vectorScale,coneScale:this.coneScale,coneOffset:this.coneOffset,pickId:this.pickId/255},L=this.pickShader;L.bind(),L.uniforms=P,this.triangleCount>0&&(this.triangleVAO.bind(),k.drawArrays(k.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind())},x.pick=function(b){if(!b||b.id!==this.pickId)return null;var k=b.value[0]+256*b.value[1]+65536*b.value[2],w=this.cells[k],M=this.positions[w[1]].slice(0,3),T={position:M,dataCoordinate:M,index:Math.floor(w[1]/48)};return this.traceType==="cone"?T.index=Math.floor(w[1]/48):this.traceType==="streamtube"&&(T.intensity=this.intensity[w[1]],T.velocity=this.vectors[w[1]].slice(0,3),T.divergence=this.vectors[w[1]][3],T.index=k),T},x.dispose=function(){this.texture.dispose(),this.triShader.dispose(),this.pickShader.dispose(),this.triangleVAO.dispose(),this.trianglePositions.dispose(),this.triangleVectors.dispose(),this.triangleColors.dispose(),this.triangleUVs.dispose(),this.triangleIds.dispose()},l.exports=function(b,k,w){var M=w.shaders;arguments.length===1&&(b=(k=b).gl);var T=_(b,M),E=A(b,M),S=h(b,p(new Uint8Array([255,255,255,255]),[1,1,4]));S.generateMipmap(),S.minFilter=b.LINEAR_MIPMAP_LINEAR,S.magFilter=b.LINEAR;var P=s(b),L=s(b),R=s(b),F=s(b),D=s(b),O=u(b,[{buffer:P,type:b.FLOAT,size:4},{buffer:D,type:b.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:R,type:b.FLOAT,size:4},{buffer:F,type:b.FLOAT,size:2},{buffer:L,type:b.FLOAT,size:4}]),N=new v(b,S,T,E,P,L,D,R,F,O,w.traceType||"cone");return N.update(k),N}},{colormap:53,"gl-buffer":78,"gl-mat4/invert":98,"gl-mat4/multiply":100,"gl-shader":132,"gl-texture2d":146,"gl-vao":150,ndarray:259}],81:[function(a,l,c){var i=a("glslify"),s=i([`precision highp float; - -precision highp float; -#define GLSLIFY 1 - -vec3 getOrthogonalVector(vec3 v) { - // Return up-vector for only-z vector. - // Return ax + by + cz = 0, a point that lies on the plane that has v as a normal and that isn't (0,0,0). - // From the above if-statement we have ||a|| > 0 U ||b|| > 0. - // Assign z = 0, x = -b, y = a: - // a*-b + b*a + c*0 = -ba + ba + 0 = 0 - if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) { - return normalize(vec3(-v.y, v.x, 0.0)); - } else { - return normalize(vec3(0.0, v.z, -v.y)); - } -} - -// Calculate the cone vertex and normal at the given index. -// -// The returned vertex is for a cone with its top at origin and height of 1.0, -// pointing in the direction of the vector attribute. -// -// Each cone is made up of a top vertex, a center base vertex and base perimeter vertices. -// These vertices are used to make up the triangles of the cone by the following: -// segment + 0 top vertex -// segment + 1 perimeter vertex a+1 -// segment + 2 perimeter vertex a -// segment + 3 center base vertex -// segment + 4 perimeter vertex a -// segment + 5 perimeter vertex a+1 -// Where segment is the number of the radial segment * 6 and a is the angle at that radial segment. -// To go from index to segment, floor(index / 6) -// To go from segment to angle, 2*pi * (segment/segmentCount) -// To go from index to segment index, index - (segment*6) -// -vec3 getConePosition(vec3 d, float rawIndex, float coneOffset, out vec3 normal) { - - const float segmentCount = 8.0; - - float index = rawIndex - floor(rawIndex / - (segmentCount * 6.0)) * - (segmentCount * 6.0); - - float segment = floor(0.001 + index/6.0); - float segmentIndex = index - (segment*6.0); - - normal = -normalize(d); - - if (segmentIndex > 2.99 && segmentIndex < 3.01) { - return mix(vec3(0.0), -d, coneOffset); - } - - float nextAngle = ( - (segmentIndex > 0.99 && segmentIndex < 1.01) || - (segmentIndex > 4.99 && segmentIndex < 5.01) - ) ? 1.0 : 0.0; - float angle = 2.0 * 3.14159 * ((segment + nextAngle) / segmentCount); - - vec3 v1 = mix(d, vec3(0.0), coneOffset); - vec3 v2 = v1 - d; - - vec3 u = getOrthogonalVector(d); - vec3 v = normalize(cross(u, d)); - - vec3 x = u * cos(angle) * length(d)*0.25; - vec3 y = v * sin(angle) * length(d)*0.25; - vec3 v3 = v2 + x + y; - if (segmentIndex < 3.0) { - vec3 tx = u * sin(angle); - vec3 ty = v * -cos(angle); - vec3 tangent = tx + ty; - normal = normalize(cross(v3 - v1, tangent)); - } - - if (segmentIndex == 0.0) { - return mix(d, vec3(0.0), coneOffset); - } - return v3; -} - -attribute vec3 vector; -attribute vec4 color, position; -attribute vec2 uv; - -uniform float vectorScale, coneScale, coneOffset; -uniform mat4 model, view, projection, inverseModel; -uniform vec3 eyePosition, lightPosition; - -varying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, f_position; -varying vec4 f_color; -varying vec2 f_uv; - -void main() { - // Scale the vector magnitude to stay constant with - // model & view changes. - vec3 normal; - vec3 XYZ = getConePosition(mat3(model) * ((vectorScale * coneScale) * vector), position.w, coneOffset, normal); - vec4 conePosition = model * vec4(position.xyz, 1.0) + vec4(XYZ, 0.0); - - //Lighting geometry parameters - vec4 cameraCoordinate = view * conePosition; - cameraCoordinate.xyz /= cameraCoordinate.w; - f_lightDirection = lightPosition - cameraCoordinate.xyz; - f_eyeDirection = eyePosition - cameraCoordinate.xyz; - f_normal = normalize((vec4(normal, 0.0) * inverseModel).xyz); - - // vec4 m_position = model * vec4(conePosition, 1.0); - vec4 t_position = view * conePosition; - gl_Position = projection * t_position; - - f_color = color; - f_data = conePosition.xyz; - f_position = position.xyz; - f_uv = uv; -} -`]),u=i([`#extension GL_OES_standard_derivatives : enable - -precision highp float; -#define GLSLIFY 1 - -float beckmannDistribution(float x, float roughness) { - float NdotH = max(x, 0.0001); - float cos2Alpha = NdotH * NdotH; - float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha; - float roughness2 = roughness * roughness; - float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha; - return exp(tan2Alpha / roughness2) / denom; -} - -float cookTorranceSpecular( - vec3 lightDirection, - vec3 viewDirection, - vec3 surfaceNormal, - float roughness, - float fresnel) { - - float VdotN = max(dot(viewDirection, surfaceNormal), 0.0); - float LdotN = max(dot(lightDirection, surfaceNormal), 0.0); - - //Half angle vector - vec3 H = normalize(lightDirection + viewDirection); - - //Geometric term - float NdotH = max(dot(surfaceNormal, H), 0.0); - float VdotH = max(dot(viewDirection, H), 0.000001); - float LdotH = max(dot(lightDirection, H), 0.000001); - float G1 = (2.0 * NdotH * VdotN) / VdotH; - float G2 = (2.0 * NdotH * LdotN) / LdotH; - float G = min(1.0, min(G1, G2)); - - //Distribution term - float D = beckmannDistribution(NdotH, roughness); - - //Fresnel term - float F = pow(1.0 - VdotN, fresnel); - - //Multiply terms and done - return G * F * D / max(3.14159265 * VdotN, 0.000001); -} - -bool outOfRange(float a, float b, float p) { - return ((p > max(a, b)) || - (p < min(a, b))); -} - -bool outOfRange(vec2 a, vec2 b, vec2 p) { - return (outOfRange(a.x, b.x, p.x) || - outOfRange(a.y, b.y, p.y)); -} - -bool outOfRange(vec3 a, vec3 b, vec3 p) { - return (outOfRange(a.x, b.x, p.x) || - outOfRange(a.y, b.y, p.y) || - outOfRange(a.z, b.z, p.z)); -} - -bool outOfRange(vec4 a, vec4 b, vec4 p) { - return outOfRange(a.xyz, b.xyz, p.xyz); -} - -uniform vec3 clipBounds[2]; -uniform float roughness, fresnel, kambient, kdiffuse, kspecular, opacity; -uniform sampler2D texture; - -varying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, f_position; -varying vec4 f_color; -varying vec2 f_uv; - -void main() { - if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard; - vec3 N = normalize(f_normal); - vec3 L = normalize(f_lightDirection); - vec3 V = normalize(f_eyeDirection); - - if(gl_FrontFacing) { - N = -N; - } - - float specular = min(1.0, max(0.0, cookTorranceSpecular(L, V, N, roughness, fresnel))); - float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0); - - vec4 surfaceColor = f_color * texture2D(texture, f_uv); - vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0); - - gl_FragColor = litColor * opacity; -} -`]),h=i([`precision highp float; - -precision highp float; -#define GLSLIFY 1 - -vec3 getOrthogonalVector(vec3 v) { - // Return up-vector for only-z vector. - // Return ax + by + cz = 0, a point that lies on the plane that has v as a normal and that isn't (0,0,0). - // From the above if-statement we have ||a|| > 0 U ||b|| > 0. - // Assign z = 0, x = -b, y = a: - // a*-b + b*a + c*0 = -ba + ba + 0 = 0 - if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) { - return normalize(vec3(-v.y, v.x, 0.0)); - } else { - return normalize(vec3(0.0, v.z, -v.y)); - } -} - -// Calculate the cone vertex and normal at the given index. -// -// The returned vertex is for a cone with its top at origin and height of 1.0, -// pointing in the direction of the vector attribute. -// -// Each cone is made up of a top vertex, a center base vertex and base perimeter vertices. -// These vertices are used to make up the triangles of the cone by the following: -// segment + 0 top vertex -// segment + 1 perimeter vertex a+1 -// segment + 2 perimeter vertex a -// segment + 3 center base vertex -// segment + 4 perimeter vertex a -// segment + 5 perimeter vertex a+1 -// Where segment is the number of the radial segment * 6 and a is the angle at that radial segment. -// To go from index to segment, floor(index / 6) -// To go from segment to angle, 2*pi * (segment/segmentCount) -// To go from index to segment index, index - (segment*6) -// -vec3 getConePosition(vec3 d, float rawIndex, float coneOffset, out vec3 normal) { - - const float segmentCount = 8.0; - - float index = rawIndex - floor(rawIndex / - (segmentCount * 6.0)) * - (segmentCount * 6.0); - - float segment = floor(0.001 + index/6.0); - float segmentIndex = index - (segment*6.0); - - normal = -normalize(d); - - if (segmentIndex > 2.99 && segmentIndex < 3.01) { - return mix(vec3(0.0), -d, coneOffset); - } - - float nextAngle = ( - (segmentIndex > 0.99 && segmentIndex < 1.01) || - (segmentIndex > 4.99 && segmentIndex < 5.01) - ) ? 1.0 : 0.0; - float angle = 2.0 * 3.14159 * ((segment + nextAngle) / segmentCount); - - vec3 v1 = mix(d, vec3(0.0), coneOffset); - vec3 v2 = v1 - d; - - vec3 u = getOrthogonalVector(d); - vec3 v = normalize(cross(u, d)); - - vec3 x = u * cos(angle) * length(d)*0.25; - vec3 y = v * sin(angle) * length(d)*0.25; - vec3 v3 = v2 + x + y; - if (segmentIndex < 3.0) { - vec3 tx = u * sin(angle); - vec3 ty = v * -cos(angle); - vec3 tangent = tx + ty; - normal = normalize(cross(v3 - v1, tangent)); - } - - if (segmentIndex == 0.0) { - return mix(d, vec3(0.0), coneOffset); - } - return v3; -} - -attribute vec4 vector; -attribute vec4 position; -attribute vec4 id; - -uniform mat4 model, view, projection; -uniform float vectorScale, coneScale, coneOffset; - -varying vec3 f_position; -varying vec4 f_id; - -void main() { - vec3 normal; - vec3 XYZ = getConePosition(mat3(model) * ((vectorScale * coneScale) * vector.xyz), position.w, coneOffset, normal); - vec4 conePosition = model * vec4(position.xyz, 1.0) + vec4(XYZ, 0.0); - gl_Position = projection * view * conePosition; - f_id = id; - f_position = position.xyz; -} -`]),d=i([`precision highp float; -#define GLSLIFY 1 - -bool outOfRange(float a, float b, float p) { - return ((p > max(a, b)) || - (p < min(a, b))); -} - -bool outOfRange(vec2 a, vec2 b, vec2 p) { - return (outOfRange(a.x, b.x, p.x) || - outOfRange(a.y, b.y, p.y)); -} - -bool outOfRange(vec3 a, vec3 b, vec3 p) { - return (outOfRange(a.x, b.x, p.x) || - outOfRange(a.y, b.y, p.y) || - outOfRange(a.z, b.z, p.z)); -} - -bool outOfRange(vec4 a, vec4 b, vec4 p) { - return outOfRange(a.xyz, b.xyz, p.xyz); -} - -uniform vec3 clipBounds[2]; -uniform float pickId; - -varying vec3 f_position; -varying vec4 f_id; - -void main() { - if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard; - - gl_FragColor = vec4(pickId, f_id.xyz); -}`]);c.meshShader={vertex:s,fragment:u,attributes:[{name:"position",type:"vec4"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"vector",type:"vec3"}]},c.pickShader={vertex:h,fragment:d,attributes:[{name:"position",type:"vec4"},{name:"id",type:"vec4"},{name:"vector",type:"vec3"}]}},{glslify:231}],82:[function(a,l,c){l.exports={0:"NONE",1:"ONE",2:"LINE_LOOP",3:"LINE_STRIP",4:"TRIANGLES",5:"TRIANGLE_STRIP",6:"TRIANGLE_FAN",256:"DEPTH_BUFFER_BIT",512:"NEVER",513:"LESS",514:"EQUAL",515:"LEQUAL",516:"GREATER",517:"NOTEQUAL",518:"GEQUAL",519:"ALWAYS",768:"SRC_COLOR",769:"ONE_MINUS_SRC_COLOR",770:"SRC_ALPHA",771:"ONE_MINUS_SRC_ALPHA",772:"DST_ALPHA",773:"ONE_MINUS_DST_ALPHA",774:"DST_COLOR",775:"ONE_MINUS_DST_COLOR",776:"SRC_ALPHA_SATURATE",1024:"STENCIL_BUFFER_BIT",1028:"FRONT",1029:"BACK",1032:"FRONT_AND_BACK",1280:"INVALID_ENUM",1281:"INVALID_VALUE",1282:"INVALID_OPERATION",1285:"OUT_OF_MEMORY",1286:"INVALID_FRAMEBUFFER_OPERATION",2304:"CW",2305:"CCW",2849:"LINE_WIDTH",2884:"CULL_FACE",2885:"CULL_FACE_MODE",2886:"FRONT_FACE",2928:"DEPTH_RANGE",2929:"DEPTH_TEST",2930:"DEPTH_WRITEMASK",2931:"DEPTH_CLEAR_VALUE",2932:"DEPTH_FUNC",2960:"STENCIL_TEST",2961:"STENCIL_CLEAR_VALUE",2962:"STENCIL_FUNC",2963:"STENCIL_VALUE_MASK",2964:"STENCIL_FAIL",2965:"STENCIL_PASS_DEPTH_FAIL",2966:"STENCIL_PASS_DEPTH_PASS",2967:"STENCIL_REF",2968:"STENCIL_WRITEMASK",2978:"VIEWPORT",3024:"DITHER",3042:"BLEND",3088:"SCISSOR_BOX",3089:"SCISSOR_TEST",3106:"COLOR_CLEAR_VALUE",3107:"COLOR_WRITEMASK",3317:"UNPACK_ALIGNMENT",3333:"PACK_ALIGNMENT",3379:"MAX_TEXTURE_SIZE",3386:"MAX_VIEWPORT_DIMS",3408:"SUBPIXEL_BITS",3410:"RED_BITS",3411:"GREEN_BITS",3412:"BLUE_BITS",3413:"ALPHA_BITS",3414:"DEPTH_BITS",3415:"STENCIL_BITS",3553:"TEXTURE_2D",4352:"DONT_CARE",4353:"FASTEST",4354:"NICEST",5120:"BYTE",5121:"UNSIGNED_BYTE",5122:"SHORT",5123:"UNSIGNED_SHORT",5124:"INT",5125:"UNSIGNED_INT",5126:"FLOAT",5386:"INVERT",5890:"TEXTURE",6401:"STENCIL_INDEX",6402:"DEPTH_COMPONENT",6406:"ALPHA",6407:"RGB",6408:"RGBA",6409:"LUMINANCE",6410:"LUMINANCE_ALPHA",7680:"KEEP",7681:"REPLACE",7682:"INCR",7683:"DECR",7936:"VENDOR",7937:"RENDERER",7938:"VERSION",9728:"NEAREST",9729:"LINEAR",9984:"NEAREST_MIPMAP_NEAREST",9985:"LINEAR_MIPMAP_NEAREST",9986:"NEAREST_MIPMAP_LINEAR",9987:"LINEAR_MIPMAP_LINEAR",10240:"TEXTURE_MAG_FILTER",10241:"TEXTURE_MIN_FILTER",10242:"TEXTURE_WRAP_S",10243:"TEXTURE_WRAP_T",10497:"REPEAT",10752:"POLYGON_OFFSET_UNITS",16384:"COLOR_BUFFER_BIT",32769:"CONSTANT_COLOR",32770:"ONE_MINUS_CONSTANT_COLOR",32771:"CONSTANT_ALPHA",32772:"ONE_MINUS_CONSTANT_ALPHA",32773:"BLEND_COLOR",32774:"FUNC_ADD",32777:"BLEND_EQUATION_RGB",32778:"FUNC_SUBTRACT",32779:"FUNC_REVERSE_SUBTRACT",32819:"UNSIGNED_SHORT_4_4_4_4",32820:"UNSIGNED_SHORT_5_5_5_1",32823:"POLYGON_OFFSET_FILL",32824:"POLYGON_OFFSET_FACTOR",32854:"RGBA4",32855:"RGB5_A1",32873:"TEXTURE_BINDING_2D",32926:"SAMPLE_ALPHA_TO_COVERAGE",32928:"SAMPLE_COVERAGE",32936:"SAMPLE_BUFFERS",32937:"SAMPLES",32938:"SAMPLE_COVERAGE_VALUE",32939:"SAMPLE_COVERAGE_INVERT",32968:"BLEND_DST_RGB",32969:"BLEND_SRC_RGB",32970:"BLEND_DST_ALPHA",32971:"BLEND_SRC_ALPHA",33071:"CLAMP_TO_EDGE",33170:"GENERATE_MIPMAP_HINT",33189:"DEPTH_COMPONENT16",33306:"DEPTH_STENCIL_ATTACHMENT",33635:"UNSIGNED_SHORT_5_6_5",33648:"MIRRORED_REPEAT",33901:"ALIASED_POINT_SIZE_RANGE",33902:"ALIASED_LINE_WIDTH_RANGE",33984:"TEXTURE0",33985:"TEXTURE1",33986:"TEXTURE2",33987:"TEXTURE3",33988:"TEXTURE4",33989:"TEXTURE5",33990:"TEXTURE6",33991:"TEXTURE7",33992:"TEXTURE8",33993:"TEXTURE9",33994:"TEXTURE10",33995:"TEXTURE11",33996:"TEXTURE12",33997:"TEXTURE13",33998:"TEXTURE14",33999:"TEXTURE15",34e3:"TEXTURE16",34001:"TEXTURE17",34002:"TEXTURE18",34003:"TEXTURE19",34004:"TEXTURE20",34005:"TEXTURE21",34006:"TEXTURE22",34007:"TEXTURE23",34008:"TEXTURE24",34009:"TEXTURE25",34010:"TEXTURE26",34011:"TEXTURE27",34012:"TEXTURE28",34013:"TEXTURE29",34014:"TEXTURE30",34015:"TEXTURE31",34016:"ACTIVE_TEXTURE",34024:"MAX_RENDERBUFFER_SIZE",34041:"DEPTH_STENCIL",34055:"INCR_WRAP",34056:"DECR_WRAP",34067:"TEXTURE_CUBE_MAP",34068:"TEXTURE_BINDING_CUBE_MAP",34069:"TEXTURE_CUBE_MAP_POSITIVE_X",34070:"TEXTURE_CUBE_MAP_NEGATIVE_X",34071:"TEXTURE_CUBE_MAP_POSITIVE_Y",34072:"TEXTURE_CUBE_MAP_NEGATIVE_Y",34073:"TEXTURE_CUBE_MAP_POSITIVE_Z",34074:"TEXTURE_CUBE_MAP_NEGATIVE_Z",34076:"MAX_CUBE_MAP_TEXTURE_SIZE",34338:"VERTEX_ATTRIB_ARRAY_ENABLED",34339:"VERTEX_ATTRIB_ARRAY_SIZE",34340:"VERTEX_ATTRIB_ARRAY_STRIDE",34341:"VERTEX_ATTRIB_ARRAY_TYPE",34342:"CURRENT_VERTEX_ATTRIB",34373:"VERTEX_ATTRIB_ARRAY_POINTER",34466:"NUM_COMPRESSED_TEXTURE_FORMATS",34467:"COMPRESSED_TEXTURE_FORMATS",34660:"BUFFER_SIZE",34661:"BUFFER_USAGE",34816:"STENCIL_BACK_FUNC",34817:"STENCIL_BACK_FAIL",34818:"STENCIL_BACK_PASS_DEPTH_FAIL",34819:"STENCIL_BACK_PASS_DEPTH_PASS",34877:"BLEND_EQUATION_ALPHA",34921:"MAX_VERTEX_ATTRIBS",34922:"VERTEX_ATTRIB_ARRAY_NORMALIZED",34930:"MAX_TEXTURE_IMAGE_UNITS",34962:"ARRAY_BUFFER",34963:"ELEMENT_ARRAY_BUFFER",34964:"ARRAY_BUFFER_BINDING",34965:"ELEMENT_ARRAY_BUFFER_BINDING",34975:"VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",35040:"STREAM_DRAW",35044:"STATIC_DRAW",35048:"DYNAMIC_DRAW",35632:"FRAGMENT_SHADER",35633:"VERTEX_SHADER",35660:"MAX_VERTEX_TEXTURE_IMAGE_UNITS",35661:"MAX_COMBINED_TEXTURE_IMAGE_UNITS",35663:"SHADER_TYPE",35664:"FLOAT_VEC2",35665:"FLOAT_VEC3",35666:"FLOAT_VEC4",35667:"INT_VEC2",35668:"INT_VEC3",35669:"INT_VEC4",35670:"BOOL",35671:"BOOL_VEC2",35672:"BOOL_VEC3",35673:"BOOL_VEC4",35674:"FLOAT_MAT2",35675:"FLOAT_MAT3",35676:"FLOAT_MAT4",35678:"SAMPLER_2D",35680:"SAMPLER_CUBE",35712:"DELETE_STATUS",35713:"COMPILE_STATUS",35714:"LINK_STATUS",35715:"VALIDATE_STATUS",35716:"INFO_LOG_LENGTH",35717:"ATTACHED_SHADERS",35718:"ACTIVE_UNIFORMS",35719:"ACTIVE_UNIFORM_MAX_LENGTH",35720:"SHADER_SOURCE_LENGTH",35721:"ACTIVE_ATTRIBUTES",35722:"ACTIVE_ATTRIBUTE_MAX_LENGTH",35724:"SHADING_LANGUAGE_VERSION",35725:"CURRENT_PROGRAM",36003:"STENCIL_BACK_REF",36004:"STENCIL_BACK_VALUE_MASK",36005:"STENCIL_BACK_WRITEMASK",36006:"FRAMEBUFFER_BINDING",36007:"RENDERBUFFER_BINDING",36048:"FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",36049:"FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",36050:"FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",36051:"FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",36053:"FRAMEBUFFER_COMPLETE",36054:"FRAMEBUFFER_INCOMPLETE_ATTACHMENT",36055:"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",36057:"FRAMEBUFFER_INCOMPLETE_DIMENSIONS",36061:"FRAMEBUFFER_UNSUPPORTED",36064:"COLOR_ATTACHMENT0",36096:"DEPTH_ATTACHMENT",36128:"STENCIL_ATTACHMENT",36160:"FRAMEBUFFER",36161:"RENDERBUFFER",36162:"RENDERBUFFER_WIDTH",36163:"RENDERBUFFER_HEIGHT",36164:"RENDERBUFFER_INTERNAL_FORMAT",36168:"STENCIL_INDEX8",36176:"RENDERBUFFER_RED_SIZE",36177:"RENDERBUFFER_GREEN_SIZE",36178:"RENDERBUFFER_BLUE_SIZE",36179:"RENDERBUFFER_ALPHA_SIZE",36180:"RENDERBUFFER_DEPTH_SIZE",36181:"RENDERBUFFER_STENCIL_SIZE",36194:"RGB565",36336:"LOW_FLOAT",36337:"MEDIUM_FLOAT",36338:"HIGH_FLOAT",36339:"LOW_INT",36340:"MEDIUM_INT",36341:"HIGH_INT",36346:"SHADER_COMPILER",36347:"MAX_VERTEX_UNIFORM_VECTORS",36348:"MAX_VARYING_VECTORS",36349:"MAX_FRAGMENT_UNIFORM_VECTORS",37440:"UNPACK_FLIP_Y_WEBGL",37441:"UNPACK_PREMULTIPLY_ALPHA_WEBGL",37442:"CONTEXT_LOST_WEBGL",37443:"UNPACK_COLORSPACE_CONVERSION_WEBGL",37444:"BROWSER_DEFAULT_WEBGL"}},{}],83:[function(a,l,c){var i=a("./1.0/numbers");l.exports=function(s){return i[s]}},{"./1.0/numbers":82}],84:[function(a,l,c){l.exports=function(v){var x=v.gl,_=i(x),A=s(x,[{buffer:_,type:x.FLOAT,size:3,offset:0,stride:40},{buffer:_,type:x.FLOAT,size:4,offset:12,stride:40},{buffer:_,type:x.FLOAT,size:3,offset:28,stride:40}]),b=u(x);b.attributes.position.location=0,b.attributes.color.location=1,b.attributes.offset.location=2;var k=new d(x,_,A,b);return k.update(v),k};var i=a("gl-buffer"),s=a("gl-vao"),u=a("./shaders/index"),h=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function d(v,x,_,A){this.gl=v,this.shader=A,this.buffer=x,this.vao=_,this.pixelRatio=1,this.bounds=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.lineWidth=[1,1,1],this.capSize=[10,10,10],this.lineCount=[0,0,0],this.lineOffset=[0,0,0],this.opacity=1,this.hasAlpha=!1}var m=d.prototype;function p(v,x){for(var _=0;_<3;++_)v[0][_]=Math.min(v[0][_],x[_]),v[1][_]=Math.max(v[1][_],x[_])}m.isOpaque=function(){return!this.hasAlpha},m.isTransparent=function(){return this.hasAlpha},m.drawTransparent=m.draw=function(v){var x=this.gl,_=this.shader.uniforms;this.shader.bind();var A=_.view=v.view||h,b=_.projection=v.projection||h;_.model=v.model||h,_.clipBounds=this.clipBounds,_.opacity=this.opacity;var k=A[12],w=A[13],M=A[14],T=A[15],E=(v._ortho?2:1)*this.pixelRatio*(b[3]*k+b[7]*w+b[11]*M+b[15]*T)/x.drawingBufferHeight;this.vao.bind();for(var S=0;S<3;++S)x.lineWidth(this.lineWidth[S]*this.pixelRatio),_.capSize=this.capSize[S]*E,this.lineCount[S]&&x.drawArrays(x.LINES,this.lineOffset[S],this.lineCount[S]);this.vao.unbind()};var g=function(){for(var v=new Array(3),x=0;x<3;++x){for(var _=[],A=1;A<=2;++A)for(var b=-1;b<=1;b+=2){var k=[0,0,0];k[(A+x)%3]=b,_.push(k)}v[x]=_}return v}();function y(v,x,_,A){for(var b=g[A],k=0;k0&&((R=E.slice())[M]+=P[1][M],b.push(E[0],E[1],E[2],L[0],L[1],L[2],L[3],0,0,0,R[0],R[1],R[2],L[0],L[1],L[2],L[3],0,0,0),p(this.bounds,R),w+=2+y(b,R,L,M))}}this.lineCount[M]=w-this.lineOffset[M]}this.buffer.update(b)}},m.dispose=function(){this.shader.dispose(),this.buffer.dispose(),this.vao.dispose()}},{"./shaders/index":85,"gl-buffer":78,"gl-vao":150}],85:[function(a,l,c){var i=a("glslify"),s=a("gl-shader"),u=i([`precision highp float; -#define GLSLIFY 1 - -attribute vec3 position, offset; -attribute vec4 color; -uniform mat4 model, view, projection; -uniform float capSize; -varying vec4 fragColor; -varying vec3 fragPosition; - -void main() { - vec4 worldPosition = model * vec4(position, 1.0); - worldPosition = (worldPosition / worldPosition.w) + vec4(capSize * offset, 0.0); - gl_Position = projection * view * worldPosition; - fragColor = color; - fragPosition = position; -}`]),h=i([`precision highp float; -#define GLSLIFY 1 - -bool outOfRange(float a, float b, float p) { - return ((p > max(a, b)) || - (p < min(a, b))); -} - -bool outOfRange(vec2 a, vec2 b, vec2 p) { - return (outOfRange(a.x, b.x, p.x) || - outOfRange(a.y, b.y, p.y)); -} - -bool outOfRange(vec3 a, vec3 b, vec3 p) { - return (outOfRange(a.x, b.x, p.x) || - outOfRange(a.y, b.y, p.y) || - outOfRange(a.z, b.z, p.z)); -} - -bool outOfRange(vec4 a, vec4 b, vec4 p) { - return outOfRange(a.xyz, b.xyz, p.xyz); -} - -uniform vec3 clipBounds[2]; -uniform float opacity; -varying vec3 fragPosition; -varying vec4 fragColor; - -void main() { - if ( - outOfRange(clipBounds[0], clipBounds[1], fragPosition) || - fragColor.a * opacity == 0. - ) discard; - - gl_FragColor = opacity * fragColor; -}`]);l.exports=function(d){return s(d,u,h,null,[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"offset",type:"vec3"}])}},{"gl-shader":132,glslify:231}],86:[function(a,l,c){var i=a("gl-texture2d");l.exports=function(k,w,M,T){s||(s=k.FRAMEBUFFER_UNSUPPORTED,u=k.FRAMEBUFFER_INCOMPLETE_ATTACHMENT,h=k.FRAMEBUFFER_INCOMPLETE_DIMENSIONS,d=k.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT);var E=k.getExtension("WEBGL_draw_buffers");if(!m&&E&&function(O,N){var B=O.getParameter(N.MAX_COLOR_ATTACHMENTS_WEBGL);m=new Array(B+1);for(var W=0;W<=B;++W){for(var G=new Array(B),K=0;KS||M<0||M>S)throw new Error("gl-fbo: Parameters are too large for FBO");var P=1;if("color"in(T=T||{})){if((P=Math.max(0|T.color,0))<0)throw new Error("gl-fbo: Must specify a nonnegative number of colors");if(P>1){if(!E)throw new Error("gl-fbo: Multiple draw buffer extension not supported");if(P>k.getParameter(E.MAX_COLOR_ATTACHMENTS_WEBGL))throw new Error("gl-fbo: Context does not support "+P+" draw buffers")}}var L=k.UNSIGNED_BYTE,R=k.getExtension("OES_texture_float");if(T.float&&P>0){if(!R)throw new Error("gl-fbo: Context does not support floating point textures");L=k.FLOAT}else T.preferFloat&&P>0&&R&&(L=k.FLOAT);var F=!0;"depth"in T&&(F=!!T.depth);var D=!1;return"stencil"in T&&(D=!!T.stencil),new _(k,w,M,L,P,F,D,E)};var s,u,h,d,m=null;function p(k){return[k.getParameter(k.FRAMEBUFFER_BINDING),k.getParameter(k.RENDERBUFFER_BINDING),k.getParameter(k.TEXTURE_BINDING_2D)]}function g(k,w){k.bindFramebuffer(k.FRAMEBUFFER,w[0]),k.bindRenderbuffer(k.RENDERBUFFER,w[1]),k.bindTexture(k.TEXTURE_2D,w[2])}function y(k){switch(k){case s:throw new Error("gl-fbo: Framebuffer unsupported");case u:throw new Error("gl-fbo: Framebuffer incomplete attachment");case h:throw new Error("gl-fbo: Framebuffer incomplete dimensions");case d:throw new Error("gl-fbo: Framebuffer incomplete missing attachment");default:throw new Error("gl-fbo: Framebuffer failed for unspecified reason")}}function v(k,w,M,T,E,S){if(!T)return null;var P=i(k,w,M,E,T);return P.magFilter=k.NEAREST,P.minFilter=k.NEAREST,P.mipSamples=1,P.bind(),k.framebufferTexture2D(k.FRAMEBUFFER,S,k.TEXTURE_2D,P.handle,0),P}function x(k,w,M,T,E){var S=k.createRenderbuffer();return k.bindRenderbuffer(k.RENDERBUFFER,S),k.renderbufferStorage(k.RENDERBUFFER,T,w,M),k.framebufferRenderbuffer(k.FRAMEBUFFER,E,k.RENDERBUFFER,S),S}function _(k,w,M,T,E,S,P,L){this.gl=k,this._shape=[0|w,0|M],this._destroyed=!1,this._ext=L,this.color=new Array(E);for(var R=0;R1&&Y.drawBuffersWEBGL(m[te]);var H=B.getExtension("WEBGL_depth_texture");H?J?O.depth=v(B,G,K,H.UNSIGNED_INT_24_8_WEBGL,B.DEPTH_STENCIL,B.DEPTH_STENCIL_ATTACHMENT):re&&(O.depth=v(B,G,K,B.UNSIGNED_SHORT,B.DEPTH_COMPONENT,B.DEPTH_ATTACHMENT)):re&&J?O._depth_rb=x(B,G,K,B.DEPTH_STENCIL,B.DEPTH_STENCIL_ATTACHMENT):re?O._depth_rb=x(B,G,K,B.DEPTH_COMPONENT16,B.DEPTH_ATTACHMENT):J&&(O._depth_rb=x(B,G,K,B.STENCIL_INDEX,B.STENCIL_ATTACHMENT));var ne=B.checkFramebufferStatus(B.FRAMEBUFFER);if(ne!==B.FRAMEBUFFER_COMPLETE){for(O._destroyed=!0,B.bindFramebuffer(B.FRAMEBUFFER,null),B.deleteFramebuffer(O.handle),O.handle=null,O.depth&&(O.depth.dispose(),O.depth=null),O._depth_rb&&(B.deleteRenderbuffer(O._depth_rb),O._depth_rb=null),V=0;VE||M<0||M>E)throw new Error("gl-fbo: Can't resize FBO, invalid dimensions");k._shape[0]=w,k._shape[1]=M;for(var S=p(T),P=0;P>8*F&255;this.pickOffset=A,k.bind();var D=k.uniforms;D.viewTransform=x,D.pickOffset=_,D.shape=this.shape;var O=k.attributes;return this.positionBuffer.bind(),O.position.pointer(),this.weightBuffer.bind(),O.weight.pointer(T.UNSIGNED_BYTE,!1),this.idBuffer.bind(),O.pickId.pointer(T.UNSIGNED_BYTE,!1),T.drawArrays(T.TRIANGLES,0,M),A+this.shape[0]*this.shape[1]}}}(),y.pick=function(x,_,A){var b=this.pickOffset,k=this.shape[0]*this.shape[1];if(A=b+k)return null;var w=A-b,M=this.xData,T=this.yData;return{object:this,pointId:w,dataCoord:[M[w%this.shape[0]],T[w/this.shape[0]|0]]}},y.update=function(x){var _=(x=x||{}).shape||[0,0],A=x.x||s(_[0]),b=x.y||s(_[1]),k=x.z||new Float32Array(_[0]*_[1]),w=x.zsmooth!==!1;this.xData=A,this.yData=b;var M,T,E,S,P=x.colorLevels||[0],L=x.colorValues||[0,0,0,1],R=P.length,F=this.bounds;w?(M=F[0]=A[0],T=F[1]=b[0],E=F[2]=A[A.length-1],S=F[3]=b[b.length-1]):(M=F[0]=A[0]+(A[1]-A[0])/2,T=F[1]=b[0]+(b[1]-b[0])/2,E=F[2]=A[A.length-1]+(A[A.length-1]-A[A.length-2])/2,S=F[3]=b[b.length-1]+(b[b.length-1]-b[b.length-2])/2);var D=1/(E-M),O=1/(S-T),N=_[0],B=_[1];this.shape=[N,B];var W=(w?(N-1)*(B-1):N*B)*(v.length>>>1);this.numVertices=W;for(var G=u.mallocUint8(4*W),K=u.mallocFloat32(2*W),te=u.mallocUint8(2*W),Y=u.mallocUint32(W),J=0,re=w?N-1:N,U=w?B-1:B,V=0;V max(a, b)) || - (p < min(a, b))); -} - -bool outOfRange(vec2 a, vec2 b, vec2 p) { - return (outOfRange(a.x, b.x, p.x) || - outOfRange(a.y, b.y, p.y)); -} - -bool outOfRange(vec3 a, vec3 b, vec3 p) { - return (outOfRange(a.x, b.x, p.x) || - outOfRange(a.y, b.y, p.y) || - outOfRange(a.z, b.z, p.z)); -} - -bool outOfRange(vec4 a, vec4 b, vec4 p) { - return outOfRange(a.xyz, b.xyz, p.xyz); -} - -uniform vec3 clipBounds[2]; -uniform sampler2D dashTexture; -uniform float dashScale; -uniform float opacity; - -varying vec3 worldPosition; -varying float pixelArcLength; -varying vec4 fragColor; - -void main() { - if ( - outOfRange(clipBounds[0], clipBounds[1], worldPosition) || - fragColor.a * opacity == 0. - ) discard; - - float dashWeight = texture2D(dashTexture, vec2(dashScale * pixelArcLength, 0)).r; - if(dashWeight < 0.5) { - discard; - } - gl_FragColor = fragColor * opacity; -} -`]),d=i([`precision highp float; -#define GLSLIFY 1 - -#define FLOAT_MAX 1.70141184e38 -#define FLOAT_MIN 1.17549435e-38 - -// https://github.com/mikolalysenko/glsl-read-float/blob/master/index.glsl -vec4 packFloat(float v) { - float av = abs(v); - - //Handle special cases - if(av < FLOAT_MIN) { - return vec4(0.0, 0.0, 0.0, 0.0); - } else if(v > FLOAT_MAX) { - return vec4(127.0, 128.0, 0.0, 0.0) / 255.0; - } else if(v < -FLOAT_MAX) { - return vec4(255.0, 128.0, 0.0, 0.0) / 255.0; - } - - vec4 c = vec4(0,0,0,0); - - //Compute exponent and mantissa - float e = floor(log2(av)); - float m = av * pow(2.0, -e) - 1.0; - - //Unpack mantissa - c[1] = floor(128.0 * m); - m -= c[1] / 128.0; - c[2] = floor(32768.0 * m); - m -= c[2] / 32768.0; - c[3] = floor(8388608.0 * m); - - //Unpack exponent - float ebias = e + 127.0; - c[0] = floor(ebias / 2.0); - ebias -= c[0] * 2.0; - c[1] += floor(ebias) * 128.0; - - //Unpack sign bit - c[0] += 128.0 * step(0.0, -v); - - //Scale back to range - return c / 255.0; -} - -bool outOfRange(float a, float b, float p) { - return ((p > max(a, b)) || - (p < min(a, b))); -} - -bool outOfRange(vec2 a, vec2 b, vec2 p) { - return (outOfRange(a.x, b.x, p.x) || - outOfRange(a.y, b.y, p.y)); -} - -bool outOfRange(vec3 a, vec3 b, vec3 p) { - return (outOfRange(a.x, b.x, p.x) || - outOfRange(a.y, b.y, p.y) || - outOfRange(a.z, b.z, p.z)); -} - -bool outOfRange(vec4 a, vec4 b, vec4 p) { - return outOfRange(a.xyz, b.xyz, p.xyz); -} - -uniform float pickId; -uniform vec3 clipBounds[2]; - -varying vec3 worldPosition; -varying float pixelArcLength; -varying vec4 fragColor; - -void main() { - if (outOfRange(clipBounds[0], clipBounds[1], worldPosition)) discard; - - gl_FragColor = vec4(pickId/255.0, packFloat(pixelArcLength).xyz); -}`]),m=[{name:"position",type:"vec3"},{name:"nextPosition",type:"vec3"},{name:"arcLength",type:"float"},{name:"lineWidth",type:"float"},{name:"color",type:"vec4"}];c.createShader=function(p){return s(p,u,h,null,m)},c.createPickShader=function(p){return s(p,u,d,null,m)}},{"gl-shader":132,glslify:231}],91:[function(a,l,c){l.exports=function(M){var T=M.gl||M.scene&&M.scene.gl,E=y(T);E.attributes.position.location=0,E.attributes.nextPosition.location=1,E.attributes.arcLength.location=2,E.attributes.lineWidth.location=3,E.attributes.color.location=4;var S=v(T);S.attributes.position.location=0,S.attributes.nextPosition.location=1,S.attributes.arcLength.location=2,S.attributes.lineWidth.location=3,S.attributes.color.location=4;for(var P=i(T),L=s(T,[{buffer:P,size:3,offset:0,stride:48},{buffer:P,size:3,offset:12,stride:48},{buffer:P,size:1,offset:24,stride:48},{buffer:P,size:1,offset:28,stride:48},{buffer:P,size:4,offset:32,stride:48}]),R=p(new Array(1024),[256,1,4]),F=0;F<1024;++F)R.data[F]=255;var D=u(T,R);D.wrap=T.REPEAT;var O=new k(T,E,S,P,L,D);return O.update(M),O};var i=a("gl-buffer"),s=a("gl-vao"),u=a("gl-texture2d"),h=new Uint8Array(4),d=new Float32Array(h.buffer),m=a("binary-search-bounds"),p=a("ndarray"),g=a("./lib/shaders"),y=g.createShader,v=g.createPickShader,x=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function _(M,T){for(var E=0,S=0;S<3;++S){var P=M[S]-T[S];E+=P*P}return Math.sqrt(E)}function A(M){for(var T=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],E=0;E<3;++E)T[0][E]=Math.max(M[0][E],T[0][E]),T[1][E]=Math.min(M[1][E],T[1][E]);return T}function b(M,T,E,S){this.arcLength=M,this.position=T,this.index=E,this.dataCoordinate=S}function k(M,T,E,S,P,L){this.gl=M,this.shader=T,this.pickShader=E,this.buffer=S,this.vao=P,this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.points=[],this.arcLength=[],this.vertexCount=0,this.bounds=[[0,0,0],[0,0,0]],this.pickId=0,this.lineWidth=1,this.texture=L,this.dashScale=1,this.opacity=1,this.hasAlpha=!1,this.dirty=!0,this.pixelRatio=1}var w=k.prototype;w.isTransparent=function(){return this.hasAlpha},w.isOpaque=function(){return!this.hasAlpha},w.pickSlots=1,w.setPickBase=function(M){this.pickId=M},w.drawTransparent=w.draw=function(M){if(this.vertexCount){var T=this.gl,E=this.shader,S=this.vao;E.bind(),E.uniforms={model:M.model||x,view:M.view||x,projection:M.projection||x,clipBounds:A(this.clipBounds),dashTexture:this.texture.bind(),dashScale:this.dashScale/this.arcLength[this.arcLength.length-1],opacity:this.opacity,screenShape:[T.drawingBufferWidth,T.drawingBufferHeight],pixelRatio:this.pixelRatio},S.bind(),S.draw(T.TRIANGLE_STRIP,this.vertexCount),S.unbind()}},w.drawPick=function(M){if(this.vertexCount){var T=this.gl,E=this.pickShader,S=this.vao;E.bind(),E.uniforms={model:M.model||x,view:M.view||x,projection:M.projection||x,pickId:this.pickId,clipBounds:A(this.clipBounds),screenShape:[T.drawingBufferWidth,T.drawingBufferHeight],pixelRatio:this.pixelRatio},S.bind(),S.draw(T.TRIANGLE_STRIP,this.vertexCount),S.unbind()}},w.update=function(M){var T,E;this.dirty=!0;var S=!!M.connectGaps;"dashScale"in M&&(this.dashScale=M.dashScale),this.hasAlpha=!1,"opacity"in M&&(this.opacity=+M.opacity,this.opacity<1&&(this.hasAlpha=!0));var P=[],L=[],R=[],F=0,D=0,O=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],N=M.position||M.positions;if(N){var B=M.color||M.colors||[0,0,0,1],W=M.lineWidth||1,G=!1;e:for(T=1;T0){for(var U=0;U<24;++U)P.push(P[P.length-12]);D+=2,G=!0}continue e}O[0][E]=Math.min(O[0][E],J[E],re[E]),O[1][E]=Math.max(O[1][E],J[E],re[E])}Array.isArray(B[0])?(K=B.length>T-1?B[T-1]:B.length>0?B[B.length-1]:[0,0,0,1],te=B.length>T?B[T]:B.length>0?B[B.length-1]:[0,0,0,1]):K=te=B,K.length===3&&(K=[K[0],K[1],K[2],1]),te.length===3&&(te=[te[0],te[1],te[2],1]),!this.hasAlpha&&K[3]<1&&(this.hasAlpha=!0),Y=Array.isArray(W)?W.length>T-1?W[T-1]:W.length>0?W[W.length-1]:[0,0,0,1]:W;var V=F;if(F+=_(J,re),G){for(E=0;E<2;++E)P.push(J[0],J[1],J[2],re[0],re[1],re[2],V,Y,K[0],K[1],K[2],K[3]);D+=2,G=!1}P.push(J[0],J[1],J[2],re[0],re[1],re[2],V,Y,K[0],K[1],K[2],K[3],J[0],J[1],J[2],re[0],re[1],re[2],V,-Y,K[0],K[1],K[2],K[3],re[0],re[1],re[2],J[0],J[1],J[2],F,-Y,te[0],te[1],te[2],te[3],re[0],re[1],re[2],J[0],J[1],J[2],F,Y,te[0],te[1],te[2],te[3]),D+=4}}if(this.buffer.update(P),L.push(F),R.push(N[N.length-1].slice()),this.bounds=O,this.vertexCount=D,this.points=R,this.arcLength=L,"dashes"in M){var H=M.dashes.slice();for(H.unshift(0),T=1;T1.0001)return null;E+=T[A]}return Math.abs(E-1)>.001?null:[b,d(m,T),T]}},{barycentric:14,"polytope-closest-point/lib/closest_point_2d.js":270}],111:[function(a,l,c){var i=a("glslify"),s=i([`precision highp float; -#define GLSLIFY 1 - -attribute vec3 position, normal; -attribute vec4 color; -attribute vec2 uv; - -uniform mat4 model - , view - , projection - , inverseModel; -uniform vec3 eyePosition - , lightPosition; - -varying vec3 f_normal - , f_lightDirection - , f_eyeDirection - , f_data; -varying vec4 f_color; -varying vec2 f_uv; - -vec4 project(vec3 p) { - return projection * view * model * vec4(p, 1.0); -} - -void main() { - gl_Position = project(position); - - //Lighting geometry parameters - vec4 cameraCoordinate = view * vec4(position , 1.0); - cameraCoordinate.xyz /= cameraCoordinate.w; - f_lightDirection = lightPosition - cameraCoordinate.xyz; - f_eyeDirection = eyePosition - cameraCoordinate.xyz; - f_normal = normalize((vec4(normal, 0.0) * inverseModel).xyz); - - f_color = color; - f_data = position; - f_uv = uv; -} -`]),u=i([`#extension GL_OES_standard_derivatives : enable - -precision highp float; -#define GLSLIFY 1 - -float beckmannDistribution(float x, float roughness) { - float NdotH = max(x, 0.0001); - float cos2Alpha = NdotH * NdotH; - float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha; - float roughness2 = roughness * roughness; - float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha; - return exp(tan2Alpha / roughness2) / denom; -} - -float cookTorranceSpecular( - vec3 lightDirection, - vec3 viewDirection, - vec3 surfaceNormal, - float roughness, - float fresnel) { - - float VdotN = max(dot(viewDirection, surfaceNormal), 0.0); - float LdotN = max(dot(lightDirection, surfaceNormal), 0.0); - - //Half angle vector - vec3 H = normalize(lightDirection + viewDirection); - - //Geometric term - float NdotH = max(dot(surfaceNormal, H), 0.0); - float VdotH = max(dot(viewDirection, H), 0.000001); - float LdotH = max(dot(lightDirection, H), 0.000001); - float G1 = (2.0 * NdotH * VdotN) / VdotH; - float G2 = (2.0 * NdotH * LdotN) / LdotH; - float G = min(1.0, min(G1, G2)); - - //Distribution term - float D = beckmannDistribution(NdotH, roughness); - - //Fresnel term - float F = pow(1.0 - VdotN, fresnel); - - //Multiply terms and done - return G * F * D / max(3.14159265 * VdotN, 0.000001); -} - -//#pragma glslify: beckmann = require(glsl-specular-beckmann) // used in gl-surface3d - -bool outOfRange(float a, float b, float p) { - return ((p > max(a, b)) || - (p < min(a, b))); -} - -bool outOfRange(vec2 a, vec2 b, vec2 p) { - return (outOfRange(a.x, b.x, p.x) || - outOfRange(a.y, b.y, p.y)); -} - -bool outOfRange(vec3 a, vec3 b, vec3 p) { - return (outOfRange(a.x, b.x, p.x) || - outOfRange(a.y, b.y, p.y) || - outOfRange(a.z, b.z, p.z)); -} - -bool outOfRange(vec4 a, vec4 b, vec4 p) { - return outOfRange(a.xyz, b.xyz, p.xyz); -} - -uniform vec3 clipBounds[2]; -uniform float roughness - , fresnel - , kambient - , kdiffuse - , kspecular; -uniform sampler2D texture; - -varying vec3 f_normal - , f_lightDirection - , f_eyeDirection - , f_data; -varying vec4 f_color; -varying vec2 f_uv; - -void main() { - if (f_color.a == 0.0 || - outOfRange(clipBounds[0], clipBounds[1], f_data) - ) discard; - - vec3 N = normalize(f_normal); - vec3 L = normalize(f_lightDirection); - vec3 V = normalize(f_eyeDirection); - - if(gl_FrontFacing) { - N = -N; - } - - float specular = min(1.0, max(0.0, cookTorranceSpecular(L, V, N, roughness, fresnel))); - //float specular = max(0.0, beckmann(L, V, N, roughness)); // used in gl-surface3d - - float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0); - - vec4 surfaceColor = vec4(f_color.rgb, 1.0) * texture2D(texture, f_uv); - vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0); - - gl_FragColor = litColor * f_color.a; -} -`]),h=i([`precision highp float; -#define GLSLIFY 1 - -attribute vec3 position; -attribute vec4 color; -attribute vec2 uv; - -uniform mat4 model, view, projection; - -varying vec4 f_color; -varying vec3 f_data; -varying vec2 f_uv; - -void main() { - gl_Position = projection * view * model * vec4(position, 1.0); - f_color = color; - f_data = position; - f_uv = uv; -}`]),d=i([`precision highp float; -#define GLSLIFY 1 - -bool outOfRange(float a, float b, float p) { - return ((p > max(a, b)) || - (p < min(a, b))); -} - -bool outOfRange(vec2 a, vec2 b, vec2 p) { - return (outOfRange(a.x, b.x, p.x) || - outOfRange(a.y, b.y, p.y)); -} - -bool outOfRange(vec3 a, vec3 b, vec3 p) { - return (outOfRange(a.x, b.x, p.x) || - outOfRange(a.y, b.y, p.y) || - outOfRange(a.z, b.z, p.z)); -} - -bool outOfRange(vec4 a, vec4 b, vec4 p) { - return outOfRange(a.xyz, b.xyz, p.xyz); -} - -uniform vec3 clipBounds[2]; -uniform sampler2D texture; -uniform float opacity; - -varying vec4 f_color; -varying vec3 f_data; -varying vec2 f_uv; - -void main() { - if (outOfRange(clipBounds[0], clipBounds[1], f_data)) discard; - - gl_FragColor = f_color * texture2D(texture, f_uv) * opacity; -}`]),m=i([`precision highp float; -#define GLSLIFY 1 - -bool outOfRange(float a, float b, float p) { - return ((p > max(a, b)) || - (p < min(a, b))); -} - -bool outOfRange(vec2 a, vec2 b, vec2 p) { - return (outOfRange(a.x, b.x, p.x) || - outOfRange(a.y, b.y, p.y)); -} - -bool outOfRange(vec3 a, vec3 b, vec3 p) { - return (outOfRange(a.x, b.x, p.x) || - outOfRange(a.y, b.y, p.y) || - outOfRange(a.z, b.z, p.z)); -} - -bool outOfRange(vec4 a, vec4 b, vec4 p) { - return outOfRange(a.xyz, b.xyz, p.xyz); -} - -attribute vec3 position; -attribute vec4 color; -attribute vec2 uv; -attribute float pointSize; - -uniform mat4 model, view, projection; -uniform vec3 clipBounds[2]; - -varying vec4 f_color; -varying vec2 f_uv; - -void main() { - if (outOfRange(clipBounds[0], clipBounds[1], position)) { - - gl_Position = vec4(0.0, 0.0 ,0.0 ,0.0); - } else { - gl_Position = projection * view * model * vec4(position, 1.0); - } - gl_PointSize = pointSize; - f_color = color; - f_uv = uv; -}`]),p=i([`precision highp float; -#define GLSLIFY 1 - -uniform sampler2D texture; -uniform float opacity; - -varying vec4 f_color; -varying vec2 f_uv; - -void main() { - vec2 pointR = gl_PointCoord.xy - vec2(0.5, 0.5); - if(dot(pointR, pointR) > 0.25) { - discard; - } - gl_FragColor = f_color * texture2D(texture, f_uv) * opacity; -}`]),g=i([`precision highp float; -#define GLSLIFY 1 - -attribute vec3 position; -attribute vec4 id; - -uniform mat4 model, view, projection; - -varying vec3 f_position; -varying vec4 f_id; - -void main() { - gl_Position = projection * view * model * vec4(position, 1.0); - f_id = id; - f_position = position; -}`]),y=i([`precision highp float; -#define GLSLIFY 1 - -bool outOfRange(float a, float b, float p) { - return ((p > max(a, b)) || - (p < min(a, b))); -} - -bool outOfRange(vec2 a, vec2 b, vec2 p) { - return (outOfRange(a.x, b.x, p.x) || - outOfRange(a.y, b.y, p.y)); -} - -bool outOfRange(vec3 a, vec3 b, vec3 p) { - return (outOfRange(a.x, b.x, p.x) || - outOfRange(a.y, b.y, p.y) || - outOfRange(a.z, b.z, p.z)); -} - -bool outOfRange(vec4 a, vec4 b, vec4 p) { - return outOfRange(a.xyz, b.xyz, p.xyz); -} - -uniform vec3 clipBounds[2]; -uniform float pickId; - -varying vec3 f_position; -varying vec4 f_id; - -void main() { - if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard; - - gl_FragColor = vec4(pickId, f_id.xyz); -}`]),v=i([`precision highp float; -#define GLSLIFY 1 - -bool outOfRange(float a, float b, float p) { - return ((p > max(a, b)) || - (p < min(a, b))); -} - -bool outOfRange(vec2 a, vec2 b, vec2 p) { - return (outOfRange(a.x, b.x, p.x) || - outOfRange(a.y, b.y, p.y)); -} - -bool outOfRange(vec3 a, vec3 b, vec3 p) { - return (outOfRange(a.x, b.x, p.x) || - outOfRange(a.y, b.y, p.y) || - outOfRange(a.z, b.z, p.z)); -} - -bool outOfRange(vec4 a, vec4 b, vec4 p) { - return outOfRange(a.xyz, b.xyz, p.xyz); -} - -attribute vec3 position; -attribute float pointSize; -attribute vec4 id; - -uniform mat4 model, view, projection; -uniform vec3 clipBounds[2]; - -varying vec3 f_position; -varying vec4 f_id; - -void main() { - if (outOfRange(clipBounds[0], clipBounds[1], position)) { - - gl_Position = vec4(0.0, 0.0, 0.0, 0.0); - } else { - gl_Position = projection * view * model * vec4(position, 1.0); - gl_PointSize = pointSize; - } - f_id = id; - f_position = position; -}`]),x=i([`precision highp float; -#define GLSLIFY 1 - -attribute vec3 position; - -uniform mat4 model, view, projection; - -void main() { - gl_Position = projection * view * model * vec4(position, 1.0); -}`]),_=i([`precision highp float; -#define GLSLIFY 1 - -uniform vec3 contourColor; - -void main() { - gl_FragColor = vec4(contourColor, 1.0); -} -`]);c.meshShader={vertex:s,fragment:u,attributes:[{name:"position",type:"vec3"},{name:"normal",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},c.wireShader={vertex:h,fragment:d,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},c.pointShader={vertex:m,fragment:p,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"pointSize",type:"float"}]},c.pickShader={vertex:g,fragment:y,attributes:[{name:"position",type:"vec3"},{name:"id",type:"vec4"}]},c.pointPickShader={vertex:v,fragment:y,attributes:[{name:"position",type:"vec3"},{name:"pointSize",type:"float"},{name:"id",type:"vec4"}]},c.contourShader={vertex:x,fragment:_,attributes:[{name:"position",type:"vec3"}]}},{glslify:231}],112:[function(a,l,c){var i=a("gl-shader"),s=a("gl-buffer"),u=a("gl-vao"),h=a("gl-texture2d"),d=a("normals"),m=a("gl-mat4/multiply"),p=a("gl-mat4/invert"),g=a("ndarray"),y=a("colormap"),v=a("simplicial-complex-contour"),x=a("typedarray-pool"),_=a("./lib/shaders"),A=a("./lib/closest-point"),b=_.meshShader,k=_.wireShader,w=_.pointShader,M=_.pickShader,T=_.pointPickShader,E=_.contourShader,S=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function P(G,K,te,Y,J,re,U,V,H,ne,q,Q,ee,ie,ae,ue,le,ge,fe,me,_e,Ae,ke,Le,de,ve,Me){this.gl=G,this.pixelRatio=1,this.cells=[],this.positions=[],this.intensity=[],this.texture=K,this.dirty=!0,this.triShader=te,this.lineShader=Y,this.pointShader=J,this.pickShader=re,this.pointPickShader=U,this.contourShader=V,this.trianglePositions=H,this.triangleColors=q,this.triangleNormals=ee,this.triangleUVs=Q,this.triangleIds=ne,this.triangleVAO=ie,this.triangleCount=0,this.lineWidth=1,this.edgePositions=ae,this.edgeColors=le,this.edgeUVs=ge,this.edgeIds=ue,this.edgeVAO=fe,this.edgeCount=0,this.pointPositions=me,this.pointColors=Ae,this.pointUVs=ke,this.pointSizes=Le,this.pointIds=_e,this.pointVAO=de,this.pointCount=0,this.contourLineWidth=1,this.contourPositions=ve,this.contourVAO=Me,this.contourCount=0,this.contourColor=[0,0,0],this.contourEnable=!0,this.pickVertex=!0,this.pickId=1,this.bounds=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.lightPosition=[1e5,1e5,0],this.ambientLight=.8,this.diffuseLight=.8,this.specularLight=2,this.roughness=.5,this.fresnel=1.5,this.opacity=1,this.hasAlpha=!1,this.opacityscale=!1,this._model=S,this._view=S,this._projection=S,this._resolution=[1,1]}var L=P.prototype;function R(G,K){if(!K||!K.length)return 1;for(var te=0;teG&&te>0){var Y=(K[te][0]-G)/(K[te][0]-K[te-1][0]);return K[te][1]*(1-Y)+Y*K[te-1][1]}}return 1}function F(G){var K=i(G,b.vertex,b.fragment);return K.attributes.position.location=0,K.attributes.color.location=2,K.attributes.uv.location=3,K.attributes.normal.location=4,K}function D(G){var K=i(G,k.vertex,k.fragment);return K.attributes.position.location=0,K.attributes.color.location=2,K.attributes.uv.location=3,K}function O(G){var K=i(G,w.vertex,w.fragment);return K.attributes.position.location=0,K.attributes.color.location=2,K.attributes.uv.location=3,K.attributes.pointSize.location=4,K}function N(G){var K=i(G,M.vertex,M.fragment);return K.attributes.position.location=0,K.attributes.id.location=1,K}function B(G){var K=i(G,T.vertex,T.fragment);return K.attributes.position.location=0,K.attributes.id.location=1,K.attributes.pointSize.location=4,K}function W(G){var K=i(G,E.vertex,E.fragment);return K.attributes.position.location=0,K}L.isOpaque=function(){return!this.hasAlpha},L.isTransparent=function(){return this.hasAlpha},L.pickSlots=1,L.setPickBase=function(G){this.pickId=G},L.highlight=function(G){if(G&&this.contourEnable){for(var K=v(this.cells,this.intensity,G.intensity),te=K.cells,Y=K.vertexIds,J=K.vertexWeights,re=te.length,U=x.mallocFloat32(6*re),V=0,H=0;H0&&((ne=this.triShader).bind(),ne.uniforms=V,this.triangleVAO.bind(),K.drawArrays(K.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()),this.edgeCount>0&&this.lineWidth>0&&((ne=this.lineShader).bind(),ne.uniforms=V,this.edgeVAO.bind(),K.lineWidth(this.lineWidth*this.pixelRatio),K.drawArrays(K.LINES,0,2*this.edgeCount),this.edgeVAO.unbind()),this.pointCount>0&&((ne=this.pointShader).bind(),ne.uniforms=V,this.pointVAO.bind(),K.drawArrays(K.POINTS,0,this.pointCount),this.pointVAO.unbind()),this.contourEnable&&this.contourCount>0&&this.contourLineWidth>0&&((ne=this.contourShader).bind(),ne.uniforms=V,this.contourVAO.bind(),K.drawArrays(K.LINES,0,this.contourCount),this.contourVAO.unbind())},L.drawPick=function(G){G=G||{};for(var K=this.gl,te=G.model||S,Y=G.view||S,J=G.projection||S,re=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],U=0;U<3;++U)re[0][U]=Math.max(re[0][U],this.clipBounds[0][U]),re[1][U]=Math.min(re[1][U],this.clipBounds[1][U]);this._model=[].slice.call(te),this._view=[].slice.call(Y),this._projection=[].slice.call(J),this._resolution=[K.drawingBufferWidth,K.drawingBufferHeight];var V,H={model:te,view:Y,projection:J,clipBounds:re,pickId:this.pickId/255};(V=this.pickShader).bind(),V.uniforms=H,this.triangleCount>0&&(this.triangleVAO.bind(),K.drawArrays(K.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()),this.edgeCount>0&&(this.edgeVAO.bind(),K.lineWidth(this.lineWidth*this.pixelRatio),K.drawArrays(K.LINES,0,2*this.edgeCount),this.edgeVAO.unbind()),this.pointCount>0&&((V=this.pointPickShader).bind(),V.uniforms=H,this.pointVAO.bind(),K.drawArrays(K.POINTS,0,this.pointCount),this.pointVAO.unbind())},L.pick=function(G){if(!G||G.id!==this.pickId)return null;for(var K=G.value[0]+256*G.value[1]+65536*G.value[2],te=this.cells[K],Y=this.positions,J=new Array(te.length),re=0;reT[J]&&(w.uniforms.dataAxis=p,w.uniforms.screenOffset=g,w.uniforms.color=O[b],w.uniforms.angle=N[b],E.drawArrays(E.TRIANGLES,T[J],T[re]-T[J]))),B[b]&&Y&&(g[1^b]-=U*R*W[b],w.uniforms.dataAxis=y,w.uniforms.screenOffset=g,w.uniforms.color=G[b],w.uniforms.angle=K[b],E.drawArrays(E.TRIANGLES,te,Y)),g[1^b]=U*S[2+(1^b)]-1,F[b+2]&&(g[1^b]+=U*R*D[b+2],JT[J]&&(w.uniforms.dataAxis=p,w.uniforms.screenOffset=g,w.uniforms.color=O[b+2],w.uniforms.angle=N[b+2],E.drawArrays(E.TRIANGLES,T[J],T[re]-T[J]))),B[b+2]&&Y&&(g[1^b]+=U*R*W[b+2],w.uniforms.dataAxis=y,w.uniforms.screenOffset=g,w.uniforms.color=G[b+2],w.uniforms.angle=K[b+2],E.drawArrays(E.TRIANGLES,te,Y))}),A.drawTitle=function(){var b=[0,0],k=[0,0];return function(){var w=this.plot,M=this.shader,T=w.gl,E=w.screenBox,S=w.titleCenter,P=w.titleAngle,L=w.titleColor,R=w.pixelRatio;if(this.titleCount){for(var F=0;F<2;++F)k[F]=2*(S[F]*R-E[F])/(E[2+F]-E[F])-1;M.bind(),M.uniforms.dataAxis=b,M.uniforms.screenOffset=k,M.uniforms.angle=P,M.uniforms.color=L,T.drawArrays(T.TRIANGLES,this.titleOffset,this.titleCount)}}}(),A.bind=(v=[0,0],x=[0,0],_=[0,0],function(){var b=this.plot,k=this.shader,w=b._tickBounds,M=b.dataBox,T=b.screenBox,E=b.viewBox;k.bind();for(var S=0;S<2;++S){var P=w[S],L=w[S+2]-P,R=.5*(M[S+2]+M[S]),F=M[S+2]-M[S],D=E[S],O=E[S+2]-D,N=T[S],B=T[S+2]-N;x[S]=2*L/F*O/B,v[S]=2*(P-R)/F*O/B}_[1]=2*b.pixelRatio/(T[3]-T[1]),_[0]=_[1]*(T[3]-T[1])/(T[2]-T[0]),k.uniforms.dataScale=x,k.uniforms.dataShift=v,k.uniforms.textScale=_,this.vbo.bind(),k.attributes.textCoordinate.pointer()}),A.update=function(b){var k,w,M,T,E,S=[],P=b.ticks,L=b.bounds;for(E=0;E<2;++E){var R=[Math.floor(S.length/3)],F=[-1/0],D=P[E];for(k=0;k=0){var D=x[F]-A[F]*(x[F+2]-x[F])/(A[F+2]-A[F]);F===0?w.drawLine(D,x[1],D,x[3],R[F],L[F]):w.drawLine(x[0],D,x[2],D,R[F],L[F])}}for(F=0;F=0;--v)this.objects[v].dispose();for(this.objects.length=0,v=this.overlays.length-1;v>=0;--v)this.overlays[v].dispose();this.overlays.length=0,this.gl=null},p.addObject=function(v){this.objects.indexOf(v)<0&&(this.objects.push(v),this.setDirty())},p.removeObject=function(v){for(var x=this.objects,_=0;_Math.abs(T))v.rotate(P,0,0,-M*E*Math.PI*k.rotateSpeed/window.innerWidth);else if(!k._ortho){var L=-k.zoomSpeed*S*T/window.innerHeight*(P-v.lastT())/20;v.pan(P,0,0,_*(Math.exp(L)-1))}}},!0)},k.enableMouseListeners(),k};var i=a("right-now"),s=a("3d-view"),u=a("mouse-change"),h=a("mouse-wheel"),d=a("mouse-event-offset"),m=a("has-passive-events")},{"3d-view":7,"has-passive-events":232,"mouse-change":247,"mouse-event-offset":248,"mouse-wheel":250,"right-now":278}],120:[function(a,l,c){var i=a("glslify"),s=a("gl-shader"),u=i([`precision mediump float; -#define GLSLIFY 1 -attribute vec2 position; -varying vec2 uv; -void main() { - uv = position; - gl_Position = vec4(position, 0, 1); -}`]),h=i([`precision mediump float; -#define GLSLIFY 1 - -uniform sampler2D accumBuffer; -varying vec2 uv; - -void main() { - vec4 accum = texture2D(accumBuffer, 0.5 * (uv + 1.0)); - gl_FragColor = min(vec4(1,1,1,1), accum); -}`]);l.exports=function(d){return s(d,u,h,null,[{name:"position",type:"vec2"}])}},{"gl-shader":132,glslify:231}],121:[function(a,l,c){var i=a("./camera.js"),s=a("gl-axes3d"),u=a("gl-axes3d/properties"),h=a("gl-spikes3d"),d=a("gl-select-static"),m=a("gl-fbo"),p=a("a-big-triangle"),g=a("mouse-change"),y=a("gl-mat4/perspective"),v=a("gl-mat4/ortho"),x=a("./lib/shader"),_=a("is-mobile")({tablet:!0,featureDetect:!0});function A(){this.mouse=[-1,-1],this.screen=null,this.distance=1/0,this.index=null,this.dataCoordinate=null,this.dataPosition=null,this.object=null,this.data=null}function b(w){var M=Math.round(Math.log(Math.abs(w))/Math.log(10));if(M<0){var T=Math.round(Math.pow(10,-M));return Math.ceil(w*T)/T}return M>0?(T=Math.round(Math.pow(10,M)),Math.ceil(w/T)*T):Math.ceil(w)}function k(w){return typeof w!="boolean"||w}l.exports={createScene:function(w){(w=w||{}).camera=w.camera||{};var M=w.canvas;M||(M=document.createElement("canvas"),w.container?w.container.appendChild(M):document.body.appendChild(M));var T=w.gl;if(T||(w.glOptions&&(_=!!w.glOptions.preserveDrawingBuffer),T=function(fe,me){var _e=null;try{(_e=fe.getContext("webgl",me))||(_e=fe.getContext("experimental-webgl",me))}catch{return null}return _e}(M,w.glOptions||{premultipliedAlpha:!0,antialias:!0,preserveDrawingBuffer:_})),!T)throw new Error("webgl not supported");var E=w.bounds||[[-10,-10,-10],[10,10,10]],S=new A,P=m(T,T.drawingBufferWidth,T.drawingBufferHeight,{preferFloat:!_}),L=x(T),R=w.cameraObject&&w.cameraObject._ortho===!0||w.camera.projection&&w.camera.projection.type==="orthographic"||!1,F={eye:w.camera.eye||[2,0,0],center:w.camera.center||[0,0,0],up:w.camera.up||[0,1,0],zoomMin:w.camera.zoomMax||.1,zoomMax:w.camera.zoomMin||100,mode:w.camera.mode||"turntable",_ortho:R},D=w.axes||{},O=s(T,D);O.enable=!D.disable;var N=w.spikes||{},B=h(T,N),W=[],G=[],K=[],te=[],Y=!0,J=!0,re=new Array(16),U=new Array(16),V={view:null,projection:re,model:U,_ortho:!1},H=(J=!0,[T.drawingBufferWidth,T.drawingBufferHeight]),ne=w.cameraObject||i(M,F),q={gl:T,contextLost:!1,pixelRatio:w.pixelRatio||1,canvas:M,selection:S,camera:ne,axes:O,axesPixels:null,spikes:B,bounds:E,objects:W,shape:H,aspect:w.aspectRatio||[1,1,1],pickRadius:w.pickRadius||10,zNear:w.zNear||.01,zFar:w.zFar||1e3,fovy:w.fovy||Math.PI/4,clearColor:w.clearColor||[0,0,0,0],autoResize:k(w.autoResize),autoBounds:k(w.autoBounds),autoScale:!!w.autoScale,autoCenter:k(w.autoCenter),clipToBounds:k(w.clipToBounds),snapToData:!!w.snapToData,onselect:w.onselect||null,onrender:w.onrender||null,onclick:w.onclick||null,cameraParams:V,oncontextloss:null,mouseListener:null,_stopped:!1,getAspectratio:function(){return{x:this.aspect[0],y:this.aspect[1],z:this.aspect[2]}},setAspectratio:function(fe){this.aspect[0]=fe.x,this.aspect[1]=fe.y,this.aspect[2]=fe.z,J=!0},setBounds:function(fe,me){this.bounds[0][fe]=me.min,this.bounds[1][fe]=me.max},setClearColor:function(fe){this.clearColor=fe},clearRGBA:function(){this.gl.clearColor(this.clearColor[0],this.clearColor[1],this.clearColor[2],this.clearColor[3]),this.gl.clear(this.gl.COLOR_BUFFER_BIT|this.gl.DEPTH_BUFFER_BIT)}},Q=[T.drawingBufferWidth/q.pixelRatio|0,T.drawingBufferHeight/q.pixelRatio|0];function ee(){if(!q._stopped&&q.autoResize){var fe=M.parentNode,me=1,_e=1;fe&&fe!==document.body?(me=fe.clientWidth,_e=fe.clientHeight):(me=window.innerWidth,_e=window.innerHeight);var Ae=0|Math.ceil(me*q.pixelRatio),ke=0|Math.ceil(_e*q.pixelRatio);if(Ae!==M.width||ke!==M.height){M.width=Ae,M.height=ke;var Le=M.style;Le.position=Le.position||"absolute",Le.left="0px",Le.top="0px",Le.width=me+"px",Le.height=_e+"px",Y=!0}}}q.autoResize&&ee();function ie(){for(var fe=W.length,me=te.length,_e=0;_e0&&K[me-1]===0;)K.pop(),te.pop().dispose()}function ae(){if(q.contextLost)return!0;T.isContextLost()&&(q.contextLost=!0,q.mouseListener.enabled=!1,q.selection.object=null,q.oncontextloss&&q.oncontextloss())}window.addEventListener("resize",ee),q.update=function(fe){q._stopped||(Y=!0,J=!0)},q.add=function(fe){q._stopped||(fe.axes=O,W.push(fe),G.push(-1),Y=!0,J=!0,ie())},q.remove=function(fe){if(!q._stopped){var me=W.indexOf(fe);me<0||(W.splice(me,1),G.pop(),Y=!0,J=!0,ie())}},q.dispose=function(){if(!q._stopped&&(q._stopped=!0,window.removeEventListener("resize",ee),M.removeEventListener("webglcontextlost",ae),q.mouseListener.enabled=!1,!q.contextLost)){O.dispose(),B.dispose();for(var fe=0;feS.distance)continue;for(var we=0;we 1.0) { - discard; - } - baseColor = mix(borderColor, color, step(radius, centerFraction)); - gl_FragColor = vec4(baseColor.rgb * baseColor.a, baseColor.a); - } -} -`]),c.pickVertex=i([`precision mediump float; -#define GLSLIFY 1 - -attribute vec2 position; -attribute vec4 pickId; - -uniform mat3 matrix; -uniform float pointSize; -uniform vec4 pickOffset; - -varying vec4 fragId; - -void main() { - vec3 hgPosition = matrix * vec3(position, 1); - gl_Position = vec4(hgPosition.xy, 0, hgPosition.z); - gl_PointSize = pointSize; - - vec4 id = pickId + pickOffset; - id.y += floor(id.x / 256.0); - id.x -= floor(id.x / 256.0) * 256.0; - - id.z += floor(id.y / 256.0); - id.y -= floor(id.y / 256.0) * 256.0; - - id.w += floor(id.z / 256.0); - id.z -= floor(id.z / 256.0) * 256.0; - - fragId = id; -} -`]),c.pickFragment=i([`precision mediump float; -#define GLSLIFY 1 - -varying vec4 fragId; - -void main() { - float radius = length(2.0 * gl_PointCoord.xy - 1.0); - if(radius > 1.0) { - discard; - } - gl_FragColor = fragId / 255.0; -} -`])},{glslify:231}],123:[function(a,l,c){var i=a("gl-shader"),s=a("gl-buffer"),u=a("typedarray-pool"),h=a("./lib/shader");function d(y,v,x,_,A){this.plot=y,this.offsetBuffer=v,this.pickBuffer=x,this.shader=_,this.pickShader=A,this.sizeMin=.5,this.sizeMinCap=2,this.sizeMax=20,this.areaRatio=1,this.pointCount=0,this.color=[1,0,0,1],this.borderColor=[0,0,0,1],this.blend=!1,this.pickOffset=0,this.points=null}l.exports=function(y,v){var x=y.gl,_=s(x),A=s(x),b=i(x,h.pointVertex,h.pointFragment),k=i(x,h.pickVertex,h.pickFragment),w=new d(y,_,A,b,k);return w.update(v),y.addObject(w),w};var m,p,g=d.prototype;g.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.offsetBuffer.dispose(),this.pickBuffer.dispose(),this.plot.removeObject(this)},g.update=function(y){var v;function x(T,E){return T in y?y[T]:E}y=y||{},this.sizeMin=x("sizeMin",.5),this.sizeMax=x("sizeMax",20),this.color=x("color",[1,0,0,1]).slice(),this.areaRatio=x("areaRatio",1),this.borderColor=x("borderColor",[0,0,0,1]).slice(),this.blend=x("blend",!1);var _=y.positions.length>>>1,A=y.positions instanceof Float32Array,b=y.idToIndex instanceof Int32Array&&y.idToIndex.length>=_,k=y.positions,w=A?k:u.mallocFloat32(k.length),M=b?y.idToIndex:u.mallocInt32(_);if(A||w.set(k),!b)for(w.set(k),v=0;v<_;v++)M[v]=v;this.points=k,this.offsetBuffer.update(w),this.pickBuffer.update(M),A||u.free(w),b||u.free(M),this.pointCount=_,this.pickOffset=0},g.unifiedDraw=(m=[1,0,0,0,1,0,0,0,1],p=[0,0,0,0],function(y){var v=y!==void 0,x=v?this.pickShader:this.shader,_=this.plot.gl,A=this.plot.dataBox;if(this.pointCount===0)return y;var b=A[2]-A[0],k=A[3]-A[1],w=function(S,P){var L,R=0,F=S.length>>>1;for(L=0;L=P[0]&&D<=P[2]&&O>=P[1]&&O<=P[3]&&R++}return R}(this.points,A),M=this.plot.pickPixelRatio*Math.max(Math.min(this.sizeMinCap,this.sizeMin),Math.min(this.sizeMax,this.sizeMax/Math.pow(w,.33333)));m[0]=2/b,m[4]=2/k,m[6]=-2*A[0]/b-1,m[7]=-2*A[1]/k-1,this.offsetBuffer.bind(),x.bind(),x.attributes.position.pointer(),x.uniforms.matrix=m,x.uniforms.color=this.color,x.uniforms.borderColor=this.borderColor,x.uniforms.pointCloud=M<5,x.uniforms.pointSize=M,x.uniforms.centerFraction=Math.min(1,Math.max(0,Math.sqrt(1-this.areaRatio))),v&&(p[0]=255&y,p[1]=y>>8&255,p[2]=y>>16&255,p[3]=y>>24&255,this.pickBuffer.bind(),x.attributes.pickId.pointer(_.UNSIGNED_BYTE),x.uniforms.pickOffset=p,this.pickOffset=y);var T=_.getParameter(_.BLEND),E=_.getParameter(_.DITHER);return T&&!this.blend&&_.disable(_.BLEND),E&&_.disable(_.DITHER),_.drawArrays(_.POINTS,0,this.pointCount),T&&!this.blend&&_.enable(_.BLEND),E&&_.enable(_.DITHER),y+this.pointCount}),g.draw=g.unifiedDraw,g.drawPick=g.unifiedDraw,g.pick=function(y,v,x){var _=this.pickOffset,A=this.pointCount;if(x<_||x>=_+A)return null;var b=x-_,k=this.points;return{object:this,pointId:b,dataCoord:[k[2*b],k[2*b+1]]}}},{"./lib/shader":122,"gl-buffer":78,"gl-shader":132,"typedarray-pool":308}],124:[function(a,l,c){l.exports=function(i,s,u,h){var d,m,p,g,y,v=s[0],x=s[1],_=s[2],A=s[3],b=u[0],k=u[1],w=u[2],M=u[3];return(m=v*b+x*k+_*w+A*M)<0&&(m=-m,b=-b,k=-k,w=-w,M=-M),1-m>1e-6?(d=Math.acos(m),p=Math.sin(d),g=Math.sin((1-h)*d)/p,y=Math.sin(h*d)/p):(g=1-h,y=h),i[0]=g*v+y*b,i[1]=g*x+y*k,i[2]=g*_+y*w,i[3]=g*A+y*M,i}},{}],125:[function(a,l,c){l.exports=function(i){return i||i===0?i.toString():""}},{}],126:[function(a,l,c){var i=a("vectorize-text");l.exports=function(u,h,d){var m=s[h];if(m||(m=s[h]={}),u in m)return m[u];var p={textAlign:"center",textBaseline:"middle",lineHeight:1,font:h,lineSpacing:1.25,styletags:{breaklines:!0,bolds:!0,italics:!0,subscripts:!0,superscripts:!0},triangles:!0},g=i(u,p);p.triangles=!1;var y,v,x=i(u,p);if(d&&d!==1){for(y=0;y max(a, b)) || - (p < min(a, b))); -} - -bool outOfRange(vec2 a, vec2 b, vec2 p) { - return (outOfRange(a.x, b.x, p.x) || - outOfRange(a.y, b.y, p.y)); -} - -bool outOfRange(vec3 a, vec3 b, vec3 p) { - return (outOfRange(a.x, b.x, p.x) || - outOfRange(a.y, b.y, p.y) || - outOfRange(a.z, b.z, p.z)); -} - -bool outOfRange(vec4 a, vec4 b, vec4 p) { - return outOfRange(a.xyz, b.xyz, p.xyz); -} - -attribute vec3 position; -attribute vec4 color; -attribute vec2 glyph; -attribute vec4 id; - -uniform vec4 highlightId; -uniform float highlightScale; -uniform mat4 model, view, projection; -uniform vec3 clipBounds[2]; - -varying vec4 interpColor; -varying vec4 pickId; -varying vec3 dataCoordinate; - -void main() { - if (outOfRange(clipBounds[0], clipBounds[1], position)) { - - gl_Position = vec4(0,0,0,0); - } else { - float scale = 1.0; - if(distance(highlightId, id) < 0.0001) { - scale = highlightScale; - } - - vec4 worldPosition = model * vec4(position, 1); - vec4 viewPosition = view * worldPosition; - viewPosition = viewPosition / viewPosition.w; - vec4 clipPosition = projection * (viewPosition + scale * vec4(glyph.x, -glyph.y, 0, 0)); - - gl_Position = clipPosition; - interpColor = color; - pickId = id; - dataCoordinate = position; - } -}`]),h=s([`precision highp float; -#define GLSLIFY 1 - -bool outOfRange(float a, float b, float p) { - return ((p > max(a, b)) || - (p < min(a, b))); -} - -bool outOfRange(vec2 a, vec2 b, vec2 p) { - return (outOfRange(a.x, b.x, p.x) || - outOfRange(a.y, b.y, p.y)); -} - -bool outOfRange(vec3 a, vec3 b, vec3 p) { - return (outOfRange(a.x, b.x, p.x) || - outOfRange(a.y, b.y, p.y) || - outOfRange(a.z, b.z, p.z)); -} - -bool outOfRange(vec4 a, vec4 b, vec4 p) { - return outOfRange(a.xyz, b.xyz, p.xyz); -} - -attribute vec3 position; -attribute vec4 color; -attribute vec2 glyph; -attribute vec4 id; - -uniform mat4 model, view, projection; -uniform vec2 screenSize; -uniform vec3 clipBounds[2]; -uniform float highlightScale, pixelRatio; -uniform vec4 highlightId; - -varying vec4 interpColor; -varying vec4 pickId; -varying vec3 dataCoordinate; - -void main() { - if (outOfRange(clipBounds[0], clipBounds[1], position)) { - - gl_Position = vec4(0,0,0,0); - } else { - float scale = pixelRatio; - if(distance(highlightId.bgr, id.bgr) < 0.001) { - scale *= highlightScale; - } - - vec4 worldPosition = model * vec4(position, 1.0); - vec4 viewPosition = view * worldPosition; - vec4 clipPosition = projection * viewPosition; - clipPosition /= clipPosition.w; - - gl_Position = clipPosition + vec4(screenSize * scale * vec2(glyph.x, -glyph.y), 0.0, 0.0); - interpColor = color; - pickId = id; - dataCoordinate = position; - } -}`]),d=s([`precision highp float; -#define GLSLIFY 1 - -bool outOfRange(float a, float b, float p) { - return ((p > max(a, b)) || - (p < min(a, b))); -} - -bool outOfRange(vec2 a, vec2 b, vec2 p) { - return (outOfRange(a.x, b.x, p.x) || - outOfRange(a.y, b.y, p.y)); -} - -bool outOfRange(vec3 a, vec3 b, vec3 p) { - return (outOfRange(a.x, b.x, p.x) || - outOfRange(a.y, b.y, p.y) || - outOfRange(a.z, b.z, p.z)); -} - -bool outOfRange(vec4 a, vec4 b, vec4 p) { - return outOfRange(a.xyz, b.xyz, p.xyz); -} - -attribute vec3 position; -attribute vec4 color; -attribute vec2 glyph; -attribute vec4 id; - -uniform float highlightScale; -uniform vec4 highlightId; -uniform vec3 axes[2]; -uniform mat4 model, view, projection; -uniform vec2 screenSize; -uniform vec3 clipBounds[2]; -uniform float scale, pixelRatio; - -varying vec4 interpColor; -varying vec4 pickId; -varying vec3 dataCoordinate; - -void main() { - if (outOfRange(clipBounds[0], clipBounds[1], position)) { - - gl_Position = vec4(0,0,0,0); - } else { - float lscale = pixelRatio * scale; - if(distance(highlightId, id) < 0.0001) { - lscale *= highlightScale; - } - - vec4 clipCenter = projection * view * model * vec4(position, 1); - vec3 dataPosition = position + 0.5*lscale*(axes[0] * glyph.x + axes[1] * glyph.y) * clipCenter.w * screenSize.y; - vec4 clipPosition = projection * view * model * vec4(dataPosition, 1); - - gl_Position = clipPosition; - interpColor = color; - pickId = id; - dataCoordinate = dataPosition; - } -} -`]),m=s([`precision highp float; -#define GLSLIFY 1 - -bool outOfRange(float a, float b, float p) { - return ((p > max(a, b)) || - (p < min(a, b))); -} - -bool outOfRange(vec2 a, vec2 b, vec2 p) { - return (outOfRange(a.x, b.x, p.x) || - outOfRange(a.y, b.y, p.y)); -} - -bool outOfRange(vec3 a, vec3 b, vec3 p) { - return (outOfRange(a.x, b.x, p.x) || - outOfRange(a.y, b.y, p.y) || - outOfRange(a.z, b.z, p.z)); -} - -bool outOfRange(vec4 a, vec4 b, vec4 p) { - return outOfRange(a.xyz, b.xyz, p.xyz); -} - -uniform vec3 fragClipBounds[2]; -uniform float opacity; - -varying vec4 interpColor; -varying vec3 dataCoordinate; - -void main() { - if ( - outOfRange(fragClipBounds[0], fragClipBounds[1], dataCoordinate) || - interpColor.a * opacity == 0. - ) discard; - gl_FragColor = interpColor * opacity; -} -`]),p=s([`precision highp float; -#define GLSLIFY 1 - -bool outOfRange(float a, float b, float p) { - return ((p > max(a, b)) || - (p < min(a, b))); -} - -bool outOfRange(vec2 a, vec2 b, vec2 p) { - return (outOfRange(a.x, b.x, p.x) || - outOfRange(a.y, b.y, p.y)); -} - -bool outOfRange(vec3 a, vec3 b, vec3 p) { - return (outOfRange(a.x, b.x, p.x) || - outOfRange(a.y, b.y, p.y) || - outOfRange(a.z, b.z, p.z)); -} - -bool outOfRange(vec4 a, vec4 b, vec4 p) { - return outOfRange(a.xyz, b.xyz, p.xyz); -} - -uniform vec3 fragClipBounds[2]; -uniform float pickGroup; - -varying vec4 pickId; -varying vec3 dataCoordinate; - -void main() { - if (outOfRange(fragClipBounds[0], fragClipBounds[1], dataCoordinate)) discard; - - gl_FragColor = vec4(pickGroup, pickId.bgr); -}`]),g=[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"glyph",type:"vec2"},{name:"id",type:"vec4"}],y={vertex:u,fragment:m,attributes:g},v={vertex:h,fragment:m,attributes:g},x={vertex:d,fragment:m,attributes:g},_={vertex:u,fragment:p,attributes:g},A={vertex:h,fragment:p,attributes:g},b={vertex:d,fragment:p,attributes:g};function k(w,M){var T=i(w,M),E=T.attributes;return E.position.location=0,E.color.location=1,E.glyph.location=2,E.id.location=3,T}c.createPerspective=function(w){return k(w,y)},c.createOrtho=function(w){return k(w,v)},c.createProject=function(w){return k(w,x)},c.createPickPerspective=function(w){return k(w,_)},c.createPickOrtho=function(w){return k(w,A)},c.createPickProject=function(w){return k(w,b)}},{"gl-shader":132,glslify:231}],128:[function(a,l,c){var i=a("is-string-blank"),s=a("gl-buffer"),u=a("gl-vao"),h=a("typedarray-pool"),d=a("gl-mat4/multiply"),m=a("./lib/shaders"),p=a("./lib/glyphs"),g=a("./lib/get-simple-string"),y=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function v(K,te){var Y=K[0],J=K[1],re=K[2],U=K[3];return K[0]=te[0]*Y+te[4]*J+te[8]*re+te[12]*U,K[1]=te[1]*Y+te[5]*J+te[9]*re+te[13]*U,K[2]=te[2]*Y+te[6]*J+te[10]*re+te[14]*U,K[3]=te[3]*Y+te[7]*J+te[11]*re+te[15]*U,K}function x(K,te,Y,J){return v(J,J),v(J,J),v(J,J)}function _(K,te){this.index=K,this.dataCoordinate=this.position=te}function A(K){return K===!0||K>1?1:K}function b(K,te,Y,J,re,U,V,H,ne,q,Q,ee){this.gl=K,this.pixelRatio=1,this.shader=te,this.orthoShader=Y,this.projectShader=J,this.pointBuffer=re,this.colorBuffer=U,this.glyphBuffer=V,this.idBuffer=H,this.vao=ne,this.vertexCount=0,this.lineVertexCount=0,this.opacity=1,this.hasAlpha=!1,this.lineWidth=0,this.projectScale=[2/3,2/3,2/3],this.projectOpacity=[1,1,1],this.projectHasAlpha=!1,this.pickId=0,this.pickPerspectiveShader=q,this.pickOrthoShader=Q,this.pickProjectShader=ee,this.points=[],this._selectResult=new _(0,[0,0,0]),this.useOrtho=!0,this.bounds=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],this.axesProject=[!0,!0,!0],this.axesBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.highlightId=[1,1,1,1],this.highlightScale=2,this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.dirty=!0}l.exports=function(K){var te=K.gl,Y=m.createPerspective(te),J=m.createOrtho(te),re=m.createProject(te),U=m.createPickPerspective(te),V=m.createPickOrtho(te),H=m.createPickProject(te),ne=s(te),q=s(te),Q=s(te),ee=s(te),ie=u(te,[{buffer:ne,size:3,type:te.FLOAT},{buffer:q,size:4,type:te.FLOAT},{buffer:Q,size:2,type:te.FLOAT},{buffer:ee,size:4,type:te.UNSIGNED_BYTE,normalized:!0}]),ae=new b(te,Y,J,re,ne,q,Q,ee,ie,U,V,H);return ae.update(K),ae};var k=b.prototype;k.pickSlots=1,k.setPickBase=function(K){this.pickId=K},k.isTransparent=function(){if(this.hasAlpha)return!0;for(var K=0;K<3;++K)if(this.axesProject[K]&&this.projectHasAlpha)return!0;return!1},k.isOpaque=function(){if(!this.hasAlpha)return!0;for(var K=0;K<3;++K)if(this.axesProject[K]&&!this.projectHasAlpha)return!0;return!1};var w=[0,0],M=[0,0,0],T=[0,0,0],E=[0,0,0,1],S=[0,0,0,1],P=y.slice(),L=[0,0,0],R=[[0,0,0],[0,0,0]];function F(K){return K[0]=K[1]=K[2]=0,K}function D(K,te){return K[0]=te[0],K[1]=te[1],K[2]=te[2],K[3]=1,K}function O(K,te,Y,J){return K[0]=te[0],K[1]=te[1],K[2]=te[2],K[Y]=J,K}function N(K,te,Y,J){var re,U=te.axesProject,V=te.gl,H=K.uniforms,ne=Y.model||y,q=Y.view||y,Q=Y.projection||y,ee=te.axesBounds,ie=function(we){for(var Ce=R,Fe=0;Fe<2;++Fe)for(var ze=0;ze<3;++ze)Ce[Fe][ze]=Math.max(Math.min(we[Fe][ze],1e8),-1e8);return Ce}(te.clipBounds);re=te.axes&&te.axes.lastCubeProps?te.axes.lastCubeProps.axis:[1,1,1],w[0]=2/V.drawingBufferWidth,w[1]=2/V.drawingBufferHeight,K.bind(),H.view=q,H.projection=Q,H.screenSize=w,H.highlightId=te.highlightId,H.highlightScale=te.highlightScale,H.clipBounds=ie,H.pickGroup=te.pickId/255,H.pixelRatio=J;for(var ae=0;ae<3;++ae)if(U[ae]){H.scale=te.projectScale[ae],H.opacity=te.projectOpacity[ae];for(var ue=P,le=0;le<16;++le)ue[le]=0;for(le=0;le<4;++le)ue[5*le]=1;ue[5*ae]=0,re[ae]<0?ue[12+ae]=ee[0][ae]:ue[12+ae]=ee[1][ae],d(ue,ne,ue),H.model=ue;var ge=(ae+1)%3,fe=(ae+2)%3,me=F(M),_e=F(T);me[ge]=1,_e[fe]=1;var Ae=x(0,0,0,D(E,me)),ke=x(0,0,0,D(S,_e));if(Math.abs(Ae[1])>Math.abs(ke[1])){var Le=Ae;Ae=ke,ke=Le,Le=me,me=_e,_e=Le;var de=ge;ge=fe,fe=de}Ae[0]<0&&(me[ge]=-1),ke[1]>0&&(_e[fe]=-1);var ve=0,Me=0;for(le=0;le<4;++le)ve+=Math.pow(ne[4*ge+le],2),Me+=Math.pow(ne[4*fe+le],2);me[ge]/=Math.sqrt(ve),_e[fe]/=Math.sqrt(Me),H.axes[0]=me,H.axes[1]=_e,H.fragClipBounds[0]=O(L,ie[0],ae,-1e8),H.fragClipBounds[1]=O(L,ie[1],ae,1e8),te.vao.bind(),te.vao.draw(V.TRIANGLES,te.vertexCount),te.lineWidth>0&&(V.lineWidth(te.lineWidth*J),te.vao.draw(V.LINES,te.lineVertexCount,te.vertexCount)),te.vao.unbind()}}var B=[[-1e8,-1e8,-1e8],[1e8,1e8,1e8]];function W(K,te,Y,J,re,U,V){var H=Y.gl;if((U===Y.projectHasAlpha||V)&&N(te,Y,J,re),U===Y.hasAlpha||V){K.bind();var ne=K.uniforms;ne.model=J.model||y,ne.view=J.view||y,ne.projection=J.projection||y,w[0]=2/H.drawingBufferWidth,w[1]=2/H.drawingBufferHeight,ne.screenSize=w,ne.highlightId=Y.highlightId,ne.highlightScale=Y.highlightScale,ne.fragClipBounds=B,ne.clipBounds=Y.axes.bounds,ne.opacity=Y.opacity,ne.pickGroup=Y.pickId/255,ne.pixelRatio=re,Y.vao.bind(),Y.vao.draw(H.TRIANGLES,Y.vertexCount),Y.lineWidth>0&&(H.lineWidth(Y.lineWidth*re),Y.vao.draw(H.LINES,Y.lineVertexCount,Y.vertexCount)),Y.vao.unbind()}}function G(K,te,Y,J){var re;re=Array.isArray(K)?te=this.pointCount||te<0)return null;var Y=this.points[te],J=this._selectResult;J.index=te;for(var re=0;re<3;++re)J.position[re]=J.dataCoordinate[re]=Y[re];return J},k.highlight=function(K){if(K){var te=K.index,Y=255&te,J=te>>8&255,re=te>>16&255;this.highlightId=[Y/255,J/255,re/255,0]}else this.highlightId=[1,1,1,1]},k.update=function(K){if("perspective"in(K=K||{})&&(this.useOrtho=!K.perspective),"orthographic"in K&&(this.useOrtho=!!K.orthographic),"lineWidth"in K&&(this.lineWidth=K.lineWidth),"project"in K)if(Array.isArray(K.project))this.axesProject=K.project;else{var te=!!K.project;this.axesProject=[te,te,te]}if("projectScale"in K)if(Array.isArray(K.projectScale))this.projectScale=K.projectScale.slice();else{var Y=+K.projectScale;this.projectScale=[Y,Y,Y]}if(this.projectHasAlpha=!1,"projectOpacity"in K){Array.isArray(K.projectOpacity)?this.projectOpacity=K.projectOpacity.slice():(Y=+K.projectOpacity,this.projectOpacity=[Y,Y,Y]);for(var J=0;J<3;++J)this.projectOpacity[J]=A(this.projectOpacity[J]),this.projectOpacity[J]<1&&(this.projectHasAlpha=!0)}this.hasAlpha=!1,"opacity"in K&&(this.opacity=A(K.opacity),this.opacity<1&&(this.hasAlpha=!0)),this.dirty=!0;var re,U,V=K.position,H=K.font||"normal",ne=K.alignment||[0,0];if(ne.length===2)re=ne[0],U=ne[1];else for(re=[],U=[],J=0;J0){var $e=0,Ke=fe,Re=[0,0,0,1],Ve=[0,0,0,1],We=Array.isArray(ie)&&Array.isArray(ie[0]),Ye=Array.isArray(le)&&Array.isArray(le[0]);e:for(J=0;J<_e;++J){for(ge+=1,Ae=V[J],ke=0;ke<3;++ke){if(isNaN(Ae[ke])||!isFinite(Ae[ke]))continue e;Q[ke]=Math.max(Q[ke],Ae[ke]),q[ke]=Math.min(q[ke],Ae[ke])}Le=(nt=G(ee,J,H,this.pixelRatio)).mesh,de=nt.lines,ve=nt.bounds;var nt,ft=nt.visible;if(ft)if(Array.isArray(ie)){if((yt=We?J0?1-ve[0][0]:Lt<0?1+ve[1][0]:1,Wt*=Wt>0?1-ve[0][1]:Wt<0?1+ve[1][1]:1],Be=Le.cells||[],Ge=Le.positions||[];for(ke=0;ke0){var R=g*w;_.drawBox(M-R,T-R,E+R,T+R,x),_.drawBox(M-R,S-R,E+R,S+R,x),_.drawBox(M-R,T-R,M+R,S+R,x),_.drawBox(E-R,T-R,E+R,S+R,x)}}}},d.update=function(m){m=m||{},this.innerFill=!!m.innerFill,this.outerFill=!!m.outerFill,this.innerColor=(m.innerColor||[0,0,0,.5]).slice(),this.outerColor=(m.outerColor||[0,0,0,.5]).slice(),this.borderColor=(m.borderColor||[0,0,0,1]).slice(),this.borderWidth=m.borderWidth||0,this.selectBox=(m.selectBox||this.selectBox).slice()},d.dispose=function(){this.boxBuffer.dispose(),this.boxShader.dispose(),this.plot.removeOverlay(this)}},{"./lib/shaders":129,"gl-buffer":78,"gl-shader":132}],131:[function(a,l,c){l.exports=function(g,y){var v=y[0],x=y[1],_=i(g,v,x,{}),A=s.mallocUint8(v*x*4);return new m(g,_,A)};var i=a("gl-fbo"),s=a("typedarray-pool"),u=a("ndarray"),h=a("bit-twiddle").nextPow2;function d(g,y,v,x,_){this.coord=[g,y],this.id=v,this.value=x,this.distance=_}function m(g,y,v){this.gl=g,this.fbo=y,this.buffer=v,this._readTimeout=null;var x=this;this._readCallback=function(){x.gl&&(y.bind(),g.readPixels(0,0,y.shape[0],y.shape[1],g.RGBA,g.UNSIGNED_BYTE,x.buffer),x._readTimeout=null)}}var p=m.prototype;Object.defineProperty(p,"shape",{get:function(){return this.gl?this.fbo.shape.slice():[0,0]},set:function(g){if(this.gl){this.fbo.shape=g;var y=this.fbo.shape[0],v=this.fbo.shape[1];if(v*y*4>this.buffer.length){s.free(this.buffer);for(var x=this.buffer=s.mallocUint8(h(v*y*4)),_=0;__)for(v=_;vx)for(v=x;v<_;v++)this.gl.disableVertexAttribArray(v);this.gl.lastAttribCount=x,this.gl.useProgram(this.program)},g.dispose=function(){for(var v=this.gl.lastAttribCount,x=0;x=0){for(var O=0|D.type.charAt(D.type.length-1),N=new Array(O),B=0;B=0;)W+=1;F[P]=W}var G=new Array(_.length);function K(){k.program=h.program(w,k._vref,k._fref,R,F);for(var te=0;te<_.length;++te)G[te]=w.getUniformLocation(k.program,_[te].name)}K(),k._relink=K,k.types={uniforms:u(_),attributes:u(A)},k.attributes=s(w,k,L,F),Object.defineProperty(k,"uniforms",i(w,k,_,G))},l.exports=function(v,x,_,A,b){var k=new p(v);return k.update(x,_,A,b),k}},{"./lib/GLError":133,"./lib/create-attributes":134,"./lib/create-uniforms":135,"./lib/reflect":136,"./lib/runtime-reflect":137,"./lib/shader-cache":138}],133:[function(a,l,c){function i(s,u,h){this.shortMessage=u||"",this.longMessage=h||"",this.rawError=s||"",this.message="gl-shader: "+(u||s||"")+(h?` -`+h:""),this.stack=new Error().stack}i.prototype=new Error,i.prototype.name="GLError",i.prototype.constructor=i,l.exports=i},{}],134:[function(a,l,c){l.exports=function(p,g,y,v){for(var x={},_=0,A=y.length;_=0){if((T=w.charCodeAt(w.length-1)-48)<2||T>4)throw new i("","Invalid data type for attribute "+k+": "+w);d(p,g,M[0],v,T,x,k)}else{if(!(w.indexOf("mat")>=0))throw new i("","Unknown data type for attribute "+k+": "+w);var T;if((T=w.charCodeAt(w.length-1)-48)<2||T>4)throw new i("","Invalid data type for attribute "+k+": "+w);m(p,g,M,v,T,x,k)}}}return x};var i=a("./GLError");function s(p,g,y,v,x,_){this._gl=p,this._wrapper=g,this._index=y,this._locations=v,this._dimension=x,this._constFunc=_}var u=s.prototype;u.pointer=function(p,g,y,v){var x=this._gl,_=this._locations[this._index];x.vertexAttribPointer(_,this._dimension,p||x.FLOAT,!!g,y||0,v||0),x.enableVertexAttribArray(_)},u.set=function(p,g,y,v){return this._constFunc(this._locations[this._index],p,g,y,v)},Object.defineProperty(u,"location",{get:function(){return this._locations[this._index]},set:function(p){return p!==this._locations[this._index]&&(this._locations[this._index]=0|p,this._wrapper.program=null),0|p}});var h=[function(p,g,y){return y.length===void 0?p.vertexAttrib1f(g,y):p.vertexAttrib1fv(g,y)},function(p,g,y,v){return y.length===void 0?p.vertexAttrib2f(g,y,v):p.vertexAttrib2fv(g,y)},function(p,g,y,v,x){return y.length===void 0?p.vertexAttrib3f(g,y,v,x):p.vertexAttrib3fv(g,y)},function(p,g,y,v,x,_){return y.length===void 0?p.vertexAttrib4f(g,y,v,x,_):p.vertexAttrib4fv(g,y)}];function d(p,g,y,v,x,_,A){var b=h[x],k=new s(p,g,y,v,x,b);Object.defineProperty(_,A,{set:function(w){return p.disableVertexAttribArray(v[y]),b(p,v[y],w),w},get:function(){return k},enumerable:!0})}function m(p,g,y,v,x,_,A){for(var b=new Array(x),k=new Array(x),w=0;w4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+O);d["uniformMatrix"+D+"fv"](g[E],!1,S);break}throw new s("","Unknown uniform data type for "+name+": "+O)}if((D=O.charCodeAt(O.length-1)-48)<2||D>4)throw new s("","Invalid data type");switch(O.charAt(0)){case"b":case"i":d["uniform"+D+"iv"](g[E],S);break;case"v":d["uniform"+D+"fv"](g[E],S);break;default:throw new s("","Unrecognized data type for vector "+name+": "+O)}}}}}}function v(A,b,k){if(typeof k=="object"){var w=x(k);Object.defineProperty(A,b,{get:u(w),set:y(k),enumerable:!0,configurable:!1})}else g[k]?Object.defineProperty(A,b,{get:(M=k,function(T,E,S){return T.getUniform(E.program,S[M])}),set:y(k),enumerable:!0,configurable:!1}):A[b]=function(T){switch(T){case"bool":return!1;case"int":case"sampler2D":case"samplerCube":case"float":return 0;default:var E=T.indexOf("vec");if(0<=E&&E<=1&&T.length===4+E){if((S=T.charCodeAt(T.length-1)-48)<2||S>4)throw new s("","Invalid data type");return T.charAt(0)==="b"?h(S,!1):h(S,0)}if(T.indexOf("mat")===0&&T.length===4){var S;if((S=T.charCodeAt(T.length-1)-48)<2||S>4)throw new s("","Invalid uniform dimension type for matrix "+name+": "+T);return h(S*S,0)}throw new s("","Unknown uniform data type for "+name+": "+T)}}(p[k].type);var M}function x(A){var b;if(Array.isArray(A)){b=new Array(A.length);for(var k=0;k1){g[0]in m||(m[g[0]]=[]),m=m[g[0]];for(var y=1;y1)for(var x=0;x"u"?a("weakmap-shim"):WeakMap),h=0;function d(y,v,x,_,A,b,k){this.id=y,this.src=v,this.type=x,this.shader=_,this.count=b,this.programs=[],this.cache=k}function m(y){this.gl=y,this.shaders=[{},{}],this.programs={}}d.prototype.dispose=function(){if(--this.count==0){for(var y=this.cache,v=y.gl,x=this.programs,_=0,A=x.length;_ 0 U ||b|| > 0. - // Assign z = 0, x = -b, y = a: - // a*-b + b*a + c*0 = -ba + ba + 0 = 0 - if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) { - return normalize(vec3(-v.y, v.x, 0.0)); - } else { - return normalize(vec3(0.0, v.z, -v.y)); - } -} - -// Calculate the tube vertex and normal at the given index. -// -// The returned vertex is for a tube ring with its center at origin, radius of length(d), pointing in the direction of d. -// -// Each tube segment is made up of a ring of vertices. -// These vertices are used to make up the triangles of the tube by connecting them together in the vertex array. -// The indexes of tube segments run from 0 to 8. -// -vec3 getTubePosition(vec3 d, float index, out vec3 normal) { - float segmentCount = 8.0; - - float angle = 2.0 * 3.14159 * (index / segmentCount); - - vec3 u = getOrthogonalVector(d); - vec3 v = normalize(cross(u, d)); - - vec3 x = u * cos(angle) * length(d); - vec3 y = v * sin(angle) * length(d); - vec3 v3 = x + y; - - normal = normalize(v3); - - return v3; -} - -attribute vec4 vector; -attribute vec4 color, position; -attribute vec2 uv; - -uniform float vectorScale, tubeScale; -uniform mat4 model, view, projection, inverseModel; -uniform vec3 eyePosition, lightPosition; - -varying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, f_position; -varying vec4 f_color; -varying vec2 f_uv; - -void main() { - // Scale the vector magnitude to stay constant with - // model & view changes. - vec3 normal; - vec3 XYZ = getTubePosition(mat3(model) * (tubeScale * vector.w * normalize(vector.xyz)), position.w, normal); - vec4 tubePosition = model * vec4(position.xyz, 1.0) + vec4(XYZ, 0.0); - - //Lighting geometry parameters - vec4 cameraCoordinate = view * tubePosition; - cameraCoordinate.xyz /= cameraCoordinate.w; - f_lightDirection = lightPosition - cameraCoordinate.xyz; - f_eyeDirection = eyePosition - cameraCoordinate.xyz; - f_normal = normalize((vec4(normal, 0.0) * inverseModel).xyz); - - // vec4 m_position = model * vec4(tubePosition, 1.0); - vec4 t_position = view * tubePosition; - gl_Position = projection * t_position; - - f_color = color; - f_data = tubePosition.xyz; - f_position = position.xyz; - f_uv = uv; -} -`]),u=i([`#extension GL_OES_standard_derivatives : enable - -precision highp float; -#define GLSLIFY 1 - -float beckmannDistribution(float x, float roughness) { - float NdotH = max(x, 0.0001); - float cos2Alpha = NdotH * NdotH; - float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha; - float roughness2 = roughness * roughness; - float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha; - return exp(tan2Alpha / roughness2) / denom; -} - -float cookTorranceSpecular( - vec3 lightDirection, - vec3 viewDirection, - vec3 surfaceNormal, - float roughness, - float fresnel) { - - float VdotN = max(dot(viewDirection, surfaceNormal), 0.0); - float LdotN = max(dot(lightDirection, surfaceNormal), 0.0); - - //Half angle vector - vec3 H = normalize(lightDirection + viewDirection); - - //Geometric term - float NdotH = max(dot(surfaceNormal, H), 0.0); - float VdotH = max(dot(viewDirection, H), 0.000001); - float LdotH = max(dot(lightDirection, H), 0.000001); - float G1 = (2.0 * NdotH * VdotN) / VdotH; - float G2 = (2.0 * NdotH * LdotN) / LdotH; - float G = min(1.0, min(G1, G2)); - - //Distribution term - float D = beckmannDistribution(NdotH, roughness); - - //Fresnel term - float F = pow(1.0 - VdotN, fresnel); - - //Multiply terms and done - return G * F * D / max(3.14159265 * VdotN, 0.000001); -} - -bool outOfRange(float a, float b, float p) { - return ((p > max(a, b)) || - (p < min(a, b))); -} - -bool outOfRange(vec2 a, vec2 b, vec2 p) { - return (outOfRange(a.x, b.x, p.x) || - outOfRange(a.y, b.y, p.y)); -} - -bool outOfRange(vec3 a, vec3 b, vec3 p) { - return (outOfRange(a.x, b.x, p.x) || - outOfRange(a.y, b.y, p.y) || - outOfRange(a.z, b.z, p.z)); -} - -bool outOfRange(vec4 a, vec4 b, vec4 p) { - return outOfRange(a.xyz, b.xyz, p.xyz); -} - -uniform vec3 clipBounds[2]; -uniform float roughness, fresnel, kambient, kdiffuse, kspecular, opacity; -uniform sampler2D texture; - -varying vec3 f_normal, f_lightDirection, f_eyeDirection, f_data, f_position; -varying vec4 f_color; -varying vec2 f_uv; - -void main() { - if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard; - vec3 N = normalize(f_normal); - vec3 L = normalize(f_lightDirection); - vec3 V = normalize(f_eyeDirection); - - if(gl_FrontFacing) { - N = -N; - } - - float specular = min(1.0, max(0.0, cookTorranceSpecular(L, V, N, roughness, fresnel))); - float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0); - - vec4 surfaceColor = f_color * texture2D(texture, f_uv); - vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0); - - gl_FragColor = litColor * opacity; -} -`]),h=i([`precision highp float; - -precision highp float; -#define GLSLIFY 1 - -vec3 getOrthogonalVector(vec3 v) { - // Return up-vector for only-z vector. - // Return ax + by + cz = 0, a point that lies on the plane that has v as a normal and that isn't (0,0,0). - // From the above if-statement we have ||a|| > 0 U ||b|| > 0. - // Assign z = 0, x = -b, y = a: - // a*-b + b*a + c*0 = -ba + ba + 0 = 0 - if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) { - return normalize(vec3(-v.y, v.x, 0.0)); - } else { - return normalize(vec3(0.0, v.z, -v.y)); - } -} - -// Calculate the tube vertex and normal at the given index. -// -// The returned vertex is for a tube ring with its center at origin, radius of length(d), pointing in the direction of d. -// -// Each tube segment is made up of a ring of vertices. -// These vertices are used to make up the triangles of the tube by connecting them together in the vertex array. -// The indexes of tube segments run from 0 to 8. -// -vec3 getTubePosition(vec3 d, float index, out vec3 normal) { - float segmentCount = 8.0; - - float angle = 2.0 * 3.14159 * (index / segmentCount); - - vec3 u = getOrthogonalVector(d); - vec3 v = normalize(cross(u, d)); - - vec3 x = u * cos(angle) * length(d); - vec3 y = v * sin(angle) * length(d); - vec3 v3 = x + y; - - normal = normalize(v3); - - return v3; -} - -attribute vec4 vector; -attribute vec4 position; -attribute vec4 id; - -uniform mat4 model, view, projection; -uniform float tubeScale; - -varying vec3 f_position; -varying vec4 f_id; - -void main() { - vec3 normal; - vec3 XYZ = getTubePosition(mat3(model) * (tubeScale * vector.w * normalize(vector.xyz)), position.w, normal); - vec4 tubePosition = model * vec4(position.xyz, 1.0) + vec4(XYZ, 0.0); - - gl_Position = projection * view * tubePosition; - f_id = id; - f_position = position.xyz; -} -`]),d=i([`precision highp float; -#define GLSLIFY 1 - -bool outOfRange(float a, float b, float p) { - return ((p > max(a, b)) || - (p < min(a, b))); -} - -bool outOfRange(vec2 a, vec2 b, vec2 p) { - return (outOfRange(a.x, b.x, p.x) || - outOfRange(a.y, b.y, p.y)); -} - -bool outOfRange(vec3 a, vec3 b, vec3 p) { - return (outOfRange(a.x, b.x, p.x) || - outOfRange(a.y, b.y, p.y) || - outOfRange(a.z, b.z, p.z)); -} - -bool outOfRange(vec4 a, vec4 b, vec4 p) { - return outOfRange(a.xyz, b.xyz, p.xyz); -} - -uniform vec3 clipBounds[2]; -uniform float pickId; - -varying vec3 f_position; -varying vec4 f_id; - -void main() { - if (outOfRange(clipBounds[0], clipBounds[1], f_position)) discard; - - gl_FragColor = vec4(pickId, f_id.xyz); -}`]);c.meshShader={vertex:s,fragment:u,attributes:[{name:"position",type:"vec4"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"vector",type:"vec4"}]},c.pickShader={vertex:h,fragment:d,attributes:[{name:"position",type:"vec4"},{name:"id",type:"vec4"},{name:"vector",type:"vec4"}]}},{glslify:231}],143:[function(a,l,c){var i=a("gl-vec3"),s=a("gl-vec4"),u=["xyz","xzy","yxz","yzx","zxy","zyx"],h=function(v,x,_,A){for(var b=0,k=0;k0)for(_e=0;_e<8;_e++){var Ae=(_e+1)%8;U.push(ne[_e],q[_e],q[Ae],q[Ae],ne[Ae],ne[_e]),H.push(ue,ae,ae,ae,ue,ue),Q.push(ee,ie,ie,ie,ee,ee);var ke=U.length;V.push([ke-6,ke-5,ke-4],[ke-3,ke-2,ke-1])}var Le=ne;ne=q,q=Le;var de=ue;ue=ae,ae=de;var ve=ee;ee=ie,ie=ve}return{positions:U,cells:V,vectors:H,vertexIntensity:Q}}(B,_,A,b)}),E=[],S=[],P=[],L=[];for(k=0;kx)return _-1}return _},m=function(v,x,_){return v_?_:v},p=function(v){var x=1/0;v.sort(function(k,w){return k-w});for(var _=v.length,A=1;A<_;A++){var b=Math.abs(v[A]-v[A-1]);bve-1||Ke>Me-1||Re>we-1)return i.create();var Ve,We,Ye,nt,ft,yt,Ot=Ae[0][Ce],Tt=Ae[0][$e],at=Ae[1][Fe],et=Ae[1][Ke],Lt=Ae[2][ze],Wt=(ke-Ot)/(Tt-Ot),Jt=(Le-at)/(et-at),Be=(de-Lt)/(Ae[2][Re]-Lt);switch(isFinite(Wt)||(Wt=.5),isFinite(Jt)||(Jt=.5),isFinite(Be)||(Be=.5),me.reversedX&&(Ce=ve-1-Ce,$e=ve-1-$e),me.reversedY&&(Fe=Me-1-Fe,Ke=Me-1-Ke),me.reversedZ&&(ze=we-1-ze,Re=we-1-Re),me.filled){case 5:ft=ze,yt=Re,Ye=Fe*we,nt=Ke*we,Ve=Ce*we*Me,We=$e*we*Me;break;case 4:ft=ze,yt=Re,Ve=Ce*we,We=$e*we,Ye=Fe*we*ve,nt=Ke*we*ve;break;case 3:Ye=Fe,nt=Ke,ft=ze*Me,yt=Re*Me,Ve=Ce*Me*we,We=$e*Me*we;break;case 2:Ye=Fe,nt=Ke,Ve=Ce*Me,We=$e*Me,ft=ze*Me*ve,yt=Re*Me*ve;break;case 1:Ve=Ce,We=$e,ft=ze*ve,yt=Re*ve,Ye=Fe*ve*we,nt=Ke*ve*we;break;default:Ve=Ce,We=$e,Ye=Fe*ve,nt=Ke*ve,ft=ze*ve*Me,yt=Re*ve*Me}var Ge=_e[Ve+Ye+ft],kt=_e[Ve+Ye+yt],dt=_e[Ve+nt+ft],Oe=_e[Ve+nt+yt],Ie=_e[We+Ye+ft],Te=_e[We+Ye+yt],Pe=_e[We+nt+ft],qe=_e[We+nt+yt],rt=i.create(),lt=i.create(),ot=i.create(),At=i.create();i.lerp(rt,Ge,Ie,Wt),i.lerp(lt,kt,Te,Wt),i.lerp(ot,dt,Pe,Wt),i.lerp(At,Oe,qe,Wt);var wt=i.create(),$t=i.create();i.lerp(wt,rt,ot,Jt),i.lerp($t,lt,At,Jt);var Ut=i.create();return i.lerp(Ut,wt,$t,Be),Ut}(le,v,M)},E=v.getDivergence||function(le,ge){var fe=i.create(),me=1e-4;i.add(fe,le,[me,0,0]);var _e=T(fe);i.subtract(_e,_e,ge),i.scale(_e,_e,1/me),i.add(fe,le,[0,me,0]);var Ae=T(fe);i.subtract(Ae,Ae,ge),i.scale(Ae,Ae,1/me),i.add(fe,le,[0,0,me]);var ke=T(fe);return i.subtract(ke,ke,ge),i.scale(ke,ke,1/me),i.add(fe,_e,Ae),i.add(fe,fe,ke),fe},S=[],P=x[0][0],L=x[0][1],R=x[0][2],F=x[1][0],D=x[1][1],O=x[1][2],N=function(le){var ge=le[0],fe=le[1],me=le[2];return!(geF||feD||meO)},B=10*i.distance(x[0],x[1])/A,W=B*B,G=1,K=0,te=_.length;te>1&&(G=function(le){for(var ge=[],fe=[],me=[],_e={},Ae={},ke={},Le=le.length,de=0;deK&&(K=Q),ne.push(Q),S.push({points:re,velocities:U,divergences:ne});for(var ee=0;ee<100*A&&re.lengthW&&i.scale(ie,ie,B/Math.sqrt(ae)),i.add(ie,ie,J),V=T(ie),i.squaredDistance(H,ie)-W>-1e-4*W&&(re.push(ie),H=ie,U.push(V),q=E(ie,V),Q=i.length(q),isFinite(Q)&&Q>K&&(K=Q),ne.push(Q)),J=ie}}var ue=h(S,v.colormap,K,G);return k?ue.tubeScale=k:(K===0&&(K=1),ue.tubeScale=.5*b*G/K),ue};var g=a("./lib/shaders"),y=a("gl-cone3d").createMesh;l.exports.createTubeMesh=function(v,x){return y(v,x,{shaders:g,traceType:"streamtube"})}},{"./lib/shaders":142,"gl-cone3d":79,"gl-vec3":169,"gl-vec4":205}],144:[function(a,l,c){var i=a("gl-shader"),s=a("glslify"),u=s([`precision highp float; -#define GLSLIFY 1 - -attribute vec4 uv; -attribute vec3 f; -attribute vec3 normal; - -uniform vec3 objectOffset; -uniform mat4 model, view, projection, inverseModel; -uniform vec3 lightPosition, eyePosition; -uniform sampler2D colormap; - -varying float value, kill; -varying vec3 worldCoordinate; -varying vec2 planeCoordinate; -varying vec3 lightDirection, eyeDirection, surfaceNormal; -varying vec4 vColor; - -void main() { - vec3 localCoordinate = vec3(uv.zw, f.x); - worldCoordinate = objectOffset + localCoordinate; - vec4 worldPosition = model * vec4(worldCoordinate, 1.0); - vec4 clipPosition = projection * view * worldPosition; - gl_Position = clipPosition; - kill = f.y; - value = f.z; - planeCoordinate = uv.xy; - - vColor = texture2D(colormap, vec2(value, value)); - - //Lighting geometry parameters - vec4 cameraCoordinate = view * worldPosition; - cameraCoordinate.xyz /= cameraCoordinate.w; - lightDirection = lightPosition - cameraCoordinate.xyz; - eyeDirection = eyePosition - cameraCoordinate.xyz; - surfaceNormal = normalize((vec4(normal,0) * inverseModel).xyz); -} -`]),h=s([`precision highp float; -#define GLSLIFY 1 - -float beckmannDistribution(float x, float roughness) { - float NdotH = max(x, 0.0001); - float cos2Alpha = NdotH * NdotH; - float tan2Alpha = (cos2Alpha - 1.0) / cos2Alpha; - float roughness2 = roughness * roughness; - float denom = 3.141592653589793 * roughness2 * cos2Alpha * cos2Alpha; - return exp(tan2Alpha / roughness2) / denom; -} - -float beckmannSpecular( - vec3 lightDirection, - vec3 viewDirection, - vec3 surfaceNormal, - float roughness) { - return beckmannDistribution(dot(surfaceNormal, normalize(lightDirection + viewDirection)), roughness); -} - -bool outOfRange(float a, float b, float p) { - return ((p > max(a, b)) || - (p < min(a, b))); -} - -bool outOfRange(vec2 a, vec2 b, vec2 p) { - return (outOfRange(a.x, b.x, p.x) || - outOfRange(a.y, b.y, p.y)); -} - -bool outOfRange(vec3 a, vec3 b, vec3 p) { - return (outOfRange(a.x, b.x, p.x) || - outOfRange(a.y, b.y, p.y) || - outOfRange(a.z, b.z, p.z)); -} - -bool outOfRange(vec4 a, vec4 b, vec4 p) { - return outOfRange(a.xyz, b.xyz, p.xyz); -} - -uniform vec3 lowerBound, upperBound; -uniform float contourTint; -uniform vec4 contourColor; -uniform sampler2D colormap; -uniform vec3 clipBounds[2]; -uniform float roughness, fresnel, kambient, kdiffuse, kspecular, opacity; -uniform float vertexColor; - -varying float value, kill; -varying vec3 worldCoordinate; -varying vec3 lightDirection, eyeDirection, surfaceNormal; -varying vec4 vColor; - -void main() { - if ( - kill > 0.0 || - vColor.a == 0.0 || - outOfRange(clipBounds[0], clipBounds[1], worldCoordinate) - ) discard; - - vec3 N = normalize(surfaceNormal); - vec3 V = normalize(eyeDirection); - vec3 L = normalize(lightDirection); - - if(gl_FrontFacing) { - N = -N; - } - - float specular = max(beckmannSpecular(L, V, N, roughness), 0.); - float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0); - - //decide how to interpolate color — in vertex or in fragment - vec4 surfaceColor = - step(vertexColor, .5) * texture2D(colormap, vec2(value, value)) + - step(.5, vertexColor) * vColor; - - vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0); - - gl_FragColor = mix(litColor, contourColor, contourTint) * opacity; -} -`]),d=s([`precision highp float; -#define GLSLIFY 1 - -attribute vec4 uv; -attribute float f; - -uniform vec3 objectOffset; -uniform mat3 permutation; -uniform mat4 model, view, projection; -uniform float height, zOffset; -uniform sampler2D colormap; - -varying float value, kill; -varying vec3 worldCoordinate; -varying vec2 planeCoordinate; -varying vec3 lightDirection, eyeDirection, surfaceNormal; -varying vec4 vColor; - -void main() { - vec3 dataCoordinate = permutation * vec3(uv.xy, height); - worldCoordinate = objectOffset + dataCoordinate; - vec4 worldPosition = model * vec4(worldCoordinate, 1.0); - - vec4 clipPosition = projection * view * worldPosition; - clipPosition.z += zOffset; - - gl_Position = clipPosition; - value = f + objectOffset.z; - kill = -1.0; - planeCoordinate = uv.zw; - - vColor = texture2D(colormap, vec2(value, value)); - - //Don't do lighting for contours - surfaceNormal = vec3(1,0,0); - eyeDirection = vec3(0,1,0); - lightDirection = vec3(0,0,1); -} -`]),m=s([`precision highp float; -#define GLSLIFY 1 - -bool outOfRange(float a, float b, float p) { - return ((p > max(a, b)) || - (p < min(a, b))); -} - -bool outOfRange(vec2 a, vec2 b, vec2 p) { - return (outOfRange(a.x, b.x, p.x) || - outOfRange(a.y, b.y, p.y)); -} - -bool outOfRange(vec3 a, vec3 b, vec3 p) { - return (outOfRange(a.x, b.x, p.x) || - outOfRange(a.y, b.y, p.y) || - outOfRange(a.z, b.z, p.z)); -} - -bool outOfRange(vec4 a, vec4 b, vec4 p) { - return outOfRange(a.xyz, b.xyz, p.xyz); -} - -uniform vec2 shape; -uniform vec3 clipBounds[2]; -uniform float pickId; - -varying float value, kill; -varying vec3 worldCoordinate; -varying vec2 planeCoordinate; -varying vec3 surfaceNormal; - -vec2 splitFloat(float v) { - float vh = 255.0 * v; - float upper = floor(vh); - float lower = fract(vh); - return vec2(upper / 255.0, floor(lower * 16.0) / 16.0); -} - -void main() { - if ((kill > 0.0) || - (outOfRange(clipBounds[0], clipBounds[1], worldCoordinate))) discard; - - vec2 ux = splitFloat(planeCoordinate.x / shape.x); - vec2 uy = splitFloat(planeCoordinate.y / shape.y); - gl_FragColor = vec4(pickId, ux.x, uy.x, ux.y + (uy.y/16.0)); -} -`]);c.createShader=function(p){var g=i(p,u,h,null,[{name:"uv",type:"vec4"},{name:"f",type:"vec3"},{name:"normal",type:"vec3"}]);return g.attributes.uv.location=0,g.attributes.f.location=1,g.attributes.normal.location=2,g},c.createPickShader=function(p){var g=i(p,u,m,null,[{name:"uv",type:"vec4"},{name:"f",type:"vec3"},{name:"normal",type:"vec3"}]);return g.attributes.uv.location=0,g.attributes.f.location=1,g.attributes.normal.location=2,g},c.createContourShader=function(p){var g=i(p,d,h,null,[{name:"uv",type:"vec4"},{name:"f",type:"float"}]);return g.attributes.uv.location=0,g.attributes.f.location=1,g},c.createPickContourShader=function(p){var g=i(p,d,m,null,[{name:"uv",type:"vec4"},{name:"f",type:"float"}]);return g.attributes.uv.location=0,g.attributes.f.location=1,g}},{"gl-shader":132,glslify:231}],145:[function(a,l,c){l.exports=function(V){var H=V.gl,ne=w(H),q=T(H),Q=M(H),ee=E(H),ie=s(H),ae=u(H,[{buffer:ie,size:4,stride:40,offset:0},{buffer:ie,size:3,stride:40,offset:16},{buffer:ie,size:3,stride:40,offset:28}]),ue=s(H),le=u(H,[{buffer:ue,size:4,stride:20,offset:0},{buffer:ue,size:1,stride:20,offset:16}]),ge=s(H),fe=u(H,[{buffer:ge,size:2,type:H.FLOAT}]),me=h(H,1,256,H.RGBA,H.UNSIGNED_BYTE);me.minFilter=H.LINEAR,me.magFilter=H.LINEAR;var _e=new F(H,[0,0],[[0,0,0],[0,0,0]],ne,q,ie,ae,me,Q,ee,ue,le,ge,fe,[0,0,0]),Ae={levels:[[],[],[]]};for(var ke in V)Ae[ke]=V[ke];return Ae.colormap=Ae.colormap||"jet",_e.update(Ae),_e};var i=a("bit-twiddle"),s=a("gl-buffer"),u=a("gl-vao"),h=a("gl-texture2d"),d=a("typedarray-pool"),m=a("colormap"),p=a("ndarray-ops"),g=a("ndarray-pack"),y=a("ndarray"),v=a("surface-nets"),x=a("gl-mat4/multiply"),_=a("gl-mat4/invert"),A=a("binary-search-bounds"),b=a("ndarray-gradient"),k=a("./lib/shaders"),w=k.createShader,M=k.createContourShader,T=k.createPickShader,E=k.createPickContourShader,S=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],P=[[0,0],[0,1],[1,0],[1,1],[1,0],[0,1]],L=[[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0]];function R(V,H,ne,q,Q){this.position=V,this.index=H,this.uv=ne,this.level=q,this.dataCoordinate=Q}(function(){for(var V=0;V<3;++V){var H=L[V],ne=(V+2)%3;H[(V+1)%3+0]=1,H[ne+3]=1,H[V+6]=1}})();function F(V,H,ne,q,Q,ee,ie,ae,ue,le,ge,fe,me,_e,Ae){this.gl=V,this.shape=H,this.bounds=ne,this.objectOffset=Ae,this.intensityBounds=[],this._shader=q,this._pickShader=Q,this._coordinateBuffer=ee,this._vao=ie,this._colorMap=ae,this._contourShader=ue,this._contourPickShader=le,this._contourBuffer=ge,this._contourVAO=fe,this._contourOffsets=[[],[],[]],this._contourCounts=[[],[],[]],this._vertexCount=0,this._pickResult=new R([0,0,0],[0,0],[0,0],[0,0,0],[0,0,0]),this._dynamicBuffer=me,this._dynamicVAO=_e,this._dynamicOffsets=[0,0,0],this._dynamicCounts=[0,0,0],this.contourWidth=[1,1,1],this.contourLevels=[[1],[1],[1]],this.contourTint=[0,0,0],this.contourColor=[[.5,.5,.5,1],[.5,.5,.5,1],[.5,.5,.5,1]],this.showContour=!0,this.showSurface=!0,this.enableHighlight=[!0,!0,!0],this.highlightColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.highlightTint=[1,1,1],this.highlightLevel=[-1,-1,-1],this.enableDynamic=[!0,!0,!0],this.dynamicLevel=[NaN,NaN,NaN],this.dynamicColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.dynamicTint=[1,1,1],this.dynamicWidth=[1,1,1],this.axesBounds=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],this.surfaceProject=[!1,!1,!1],this.contourProject=[[!1,!1,!1],[!1,!1,!1],[!1,!1,!1]],this.colorBounds=[!1,!1],this._field=[y(d.mallocFloat(1024),[0,0]),y(d.mallocFloat(1024),[0,0]),y(d.mallocFloat(1024),[0,0])],this.pickId=1,this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.snapToData=!1,this.pixelRatio=1,this.opacity=1,this.lightPosition=[10,1e4,0],this.ambientLight=.8,this.diffuseLight=.8,this.specularLight=2,this.roughness=.5,this.fresnel=1.5,this.vertexColor=0,this.dirty=!0}var D=F.prototype;D.genColormap=function(V,H){var ne=!1,q=g([m({colormap:V,nshades:256,format:"rgba"}).map(function(Q,ee){var ie=H?function(ae,ue){if(!ue||!ue.length)return 1;for(var le=0;leae&&le>0){var ge=(ue[le][0]-ae)/(ue[le][0]-ue[le-1][0]);return ue[le][1]*(1-ge)+ge*ue[le-1][1]}}return 1}(ee/255,H):Q[3];return ie<1&&(ne=!0),[Q[0],Q[1],Q[2],255*ie]})]);return p.divseq(q,255),this.hasAlphaScale=ne,q},D.isTransparent=function(){return this.opacity<1||this.hasAlphaScale},D.isOpaque=function(){return!this.isTransparent()},D.pickSlots=1,D.setPickBase=function(V){this.pickId=V};var O=[0,0,0],N={showSurface:!1,showContour:!1,projections:[S.slice(),S.slice(),S.slice()],clipBounds:[[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]]]};function B(V,H){var ne,q,Q,ee=H.axes&&H.axes.lastCubeProps.axis||O,ie=H.showSurface,ae=H.showContour;for(ne=0;ne<3;++ne)for(ie=ie||H.surfaceProject[ne],q=0;q<3;++q)ae=ae||H.contourProject[ne][q];for(ne=0;ne<3;++ne){var ue=N.projections[ne];for(q=0;q<16;++q)ue[q]=0;for(q=0;q<4;++q)ue[5*q]=1;ue[5*ne]=0,ue[12+ne]=H.axesBounds[+(ee[ne]>0)][ne],x(ue,V.model,ue);var le=N.clipBounds[ne];for(Q=0;Q<2;++Q)for(q=0;q<3;++q)le[Q][q]=V.clipBounds[Q][q];le[0][ne]=-1e8,le[1][ne]=1e8}return N.showSurface=ie,N.showContour=ae,N}var W={model:S,view:S,projection:S,inverseModel:S.slice(),lowerBound:[0,0,0],upperBound:[0,0,0],colorMap:0,clipBounds:[[0,0,0],[0,0,0]],height:0,contourTint:0,contourColor:[0,0,0,1],permutation:[1,0,0,0,1,0,0,0,1],zOffset:-1e-4,objectOffset:[0,0,0],kambient:1,kdiffuse:1,kspecular:1,lightPosition:[1e3,1e3,1e3],eyePosition:[0,0,0],roughness:1,fresnel:1,opacity:1,vertexColor:0},G=S.slice(),K=[1,0,0,0,1,0,0,0,1];function te(V,H){V=V||{};var ne=this.gl;ne.disable(ne.CULL_FACE),this._colorMap.bind(0);var q=W;q.model=V.model||S,q.view=V.view||S,q.projection=V.projection||S,q.lowerBound=[this.bounds[0][0],this.bounds[0][1],this.colorBounds[0]||this.bounds[0][2]],q.upperBound=[this.bounds[1][0],this.bounds[1][1],this.colorBounds[1]||this.bounds[1][2]],q.objectOffset=this.objectOffset,q.contourColor=this.contourColor[0],q.inverseModel=_(q.inverseModel,q.model);for(var Q=0;Q<2;++Q)for(var ee=q.clipBounds[Q],ie=0;ie<3;++ie)ee[ie]=Math.min(Math.max(this.clipBounds[Q][ie],-1e8),1e8);q.kambient=this.ambientLight,q.kdiffuse=this.diffuseLight,q.kspecular=this.specularLight,q.roughness=this.roughness,q.fresnel=this.fresnel,q.opacity=this.opacity,q.height=0,q.permutation=K,q.vertexColor=this.vertexColor;var ae=G;for(x(ae,q.view,q.model),x(ae,q.projection,ae),_(ae,ae),Q=0;Q<3;++Q)q.eyePosition[Q]=ae[12+Q]/ae[15];var ue=ae[15];for(Q=0;Q<3;++Q)ue+=this.lightPosition[Q]*ae[4*Q+3];for(Q=0;Q<3;++Q){var le=ae[12+Q];for(ie=0;ie<3;++ie)le+=ae[4*ie+Q]*this.lightPosition[ie];q.lightPosition[Q]=le/ue}var ge=B(q,this);if(ge.showSurface){for(this._shader.bind(),this._shader.uniforms=q,this._vao.bind(),this.showSurface&&this._vertexCount&&this._vao.draw(ne.TRIANGLES,this._vertexCount),Q=0;Q<3;++Q)this.surfaceProject[Q]&&this.vertexCount&&(this._shader.uniforms.model=ge.projections[Q],this._shader.uniforms.clipBounds=ge.clipBounds[Q],this._vao.draw(ne.TRIANGLES,this._vertexCount));this._vao.unbind()}if(ge.showContour){var fe=this._contourShader;q.kambient=1,q.kdiffuse=0,q.kspecular=0,q.opacity=1,fe.bind(),fe.uniforms=q;var me=this._contourVAO;for(me.bind(),Q=0;Q<3;++Q)for(fe.uniforms.permutation=L[Q],ne.lineWidth(this.contourWidth[Q]*this.pixelRatio),ie=0;ie>4)/16)/255,Q=Math.floor(q),ee=q-Q,ie=H[1]*(V.value[1]+(15&V.value[2])/16)/255,ae=Math.floor(ie),ue=ie-ae;Q+=1,ae+=1;var le=ne.position;le[0]=le[1]=le[2]=0;for(var ge=0;ge<2;++ge)for(var fe=ge?ee:1-ee,me=0;me<2;++me)for(var _e=Q+ge,Ae=ae+me,ke=fe*(me?ue:1-ue),Le=0;Le<3;++Le)le[Le]+=this._field[Le].get(_e,Ae)*ke;for(var de=this._pickResult.level,ve=0;ve<3;++ve)if(de[ve]=A.le(this.contourLevels[ve],le[ve]),de[ve]<0)this.contourLevels[ve].length>0&&(de[ve]=0);else if(de[ve]Math.abs(we-le[ve])&&(de[ve]+=1)}for(ne.index[0]=ee<.5?Q:Q+1,ne.index[1]=ue<.5?ae:ae+1,ne.uv[0]=q/H[0],ne.uv[1]=ie/H[1],Le=0;Le<3;++Le)ne.dataCoordinate[Le]=this._field[Le].get(ne.index[0],ne.index[1]);return ne},D.padField=function(V,H){var ne=H.shape.slice(),q=V.shape.slice();p.assign(V.lo(1,1).hi(ne[0],ne[1]),H),p.assign(V.lo(1).hi(ne[0],1),H.hi(ne[0],1)),p.assign(V.lo(1,q[1]-1).hi(ne[0],1),H.lo(0,ne[1]-1).hi(ne[0],1)),p.assign(V.lo(0,1).hi(1,ne[1]),H.hi(1)),p.assign(V.lo(q[0]-1,1).hi(1,ne[1]),H.lo(ne[0]-1)),V.set(0,0,H.get(0,0)),V.set(0,q[1]-1,H.get(0,ne[1]-1)),V.set(q[0]-1,0,H.get(ne[0]-1,0)),V.set(q[0]-1,q[1]-1,H.get(ne[0]-1,ne[1]-1))},D.update=function(V){V=V||{},this.objectOffset=V.objectOffset||this.objectOffset,this.dirty=!0,"contourWidth"in V&&(this.contourWidth=J(V.contourWidth,Number)),"showContour"in V&&(this.showContour=J(V.showContour,Boolean)),"showSurface"in V&&(this.showSurface=!!V.showSurface),"contourTint"in V&&(this.contourTint=J(V.contourTint,Boolean)),"contourColor"in V&&(this.contourColor=U(V.contourColor)),"contourProject"in V&&(this.contourProject=J(V.contourProject,function(Kt){return J(Kt,Boolean)})),"surfaceProject"in V&&(this.surfaceProject=V.surfaceProject),"dynamicColor"in V&&(this.dynamicColor=U(V.dynamicColor)),"dynamicTint"in V&&(this.dynamicTint=J(V.dynamicTint,Number)),"dynamicWidth"in V&&(this.dynamicWidth=J(V.dynamicWidth,Number)),"opacity"in V&&(this.opacity=V.opacity),"opacityscale"in V&&(this.opacityscale=V.opacityscale),"colorBounds"in V&&(this.colorBounds=V.colorBounds),"vertexColor"in V&&(this.vertexColor=V.vertexColor?1:0),"colormap"in V&&this._colorMap.setPixels(this.genColormap(V.colormap,this.opacityscale));var H=V.field||V.coords&&V.coords[2]||null,ne=!1;if(H||(H=this._field[2].shape[0]||this._field[2].shape[2]?this._field[2].lo(1,1).hi(this._field[2].shape[0]-2,this._field[2].shape[1]-2):this._field[2].hi(0,0)),"field"in V||"coords"in V){var q=(H.shape[0]+2)*(H.shape[1]+2);q>this._field[2].data.length&&(d.freeFloat(this._field[2].data),this._field[2].data=d.mallocFloat(i.nextPow2(q))),this._field[2]=y(this._field[2].data,[H.shape[0]+2,H.shape[1]+2]),this.padField(this._field[2],H),this.shape=H.shape.slice();for(var Q=this.shape,ee=0;ee<2;++ee)this._field[2].size>this._field[ee].data.length&&(d.freeFloat(this._field[ee].data),this._field[ee].data=d.mallocFloat(this._field[2].size)),this._field[ee]=y(this._field[ee].data,[Q[0]+2,Q[1]+2]);if(V.coords){var ie=V.coords;if(!Array.isArray(ie)||ie.length!==3)throw new Error("gl-surface: invalid coordinates for x/y");for(ee=0;ee<2;++ee){var ae=ie[ee];for(me=0;me<2;++me)if(ae.shape[me]!==Q[me])throw new Error("gl-surface: coords have incorrect shape");this.padField(this._field[ee],ae)}}else if(V.ticks){var ue=V.ticks;if(!Array.isArray(ue)||ue.length!==2)throw new Error("gl-surface: invalid ticks");for(ee=0;ee<2;++ee){var le=ue[ee];if((Array.isArray(le)||le.length)&&(le=y(le)),le.shape[0]!==Q[ee])throw new Error("gl-surface: invalid tick length");var ge=y(le.data,Q);ge.stride[ee]=le.stride[0],ge.stride[1^ee]=0,this.padField(this._field[ee],ge)}}else{for(ee=0;ee<2;++ee){var fe=[0,0];fe[ee]=1,this._field[ee]=y(this._field[ee].data,[Q[0]+2,Q[1]+2],fe,0)}this._field[0].set(0,0,0);for(var me=0;me0){for(var It=0;It<5;++It)Oe.pop();Ot-=1}continue e}Oe.push(rt[0],rt[1],At[0],At[1],rt[2]),Ot+=1}}qe.push(Ot)}this._contourOffsets[Ie]=Pe,this._contourCounts[Ie]=qe}var Zt=d.mallocFloat(Oe.length);for(ee=0;eeL||S<0||S>L)throw new Error("gl-texture2d: Invalid texture size");return T._shape=[E,S],T.bind(),P.texImage2D(P.TEXTURE_2D,0,T.format,E,S,0,T.format,T.type,null),T._mipLevels=[0],T}function x(T,E,S,P,L,R){this.gl=T,this.handle=E,this.format=L,this.type=R,this._shape=[S,P],this._mipLevels=[0],this._magFilter=T.NEAREST,this._minFilter=T.NEAREST,this._wrapS=T.CLAMP_TO_EDGE,this._wrapT=T.CLAMP_TO_EDGE,this._anisoSamples=1;var F=this,D=[this._wrapS,this._wrapT];Object.defineProperties(D,[{get:function(){return F._wrapS},set:function(N){return F.wrapS=N}},{get:function(){return F._wrapT},set:function(N){return F.wrapT=N}}]),this._wrapVector=D;var O=[this._shape[0],this._shape[1]];Object.defineProperties(O,[{get:function(){return F._shape[0]},set:function(N){return F.width=N}},{get:function(){return F._shape[1]},set:function(N){return F.height=N}}]),this._shapeVector=O}var _=x.prototype;function A(T,E){return T.length===3?E[2]===1&&E[1]===T[0]*T[2]&&E[0]===T[2]:E[0]===1&&E[1]===T[0]}function b(T){var E=T.createTexture();return T.bindTexture(T.TEXTURE_2D,E),T.texParameteri(T.TEXTURE_2D,T.TEXTURE_MIN_FILTER,T.NEAREST),T.texParameteri(T.TEXTURE_2D,T.TEXTURE_MAG_FILTER,T.NEAREST),T.texParameteri(T.TEXTURE_2D,T.TEXTURE_WRAP_S,T.CLAMP_TO_EDGE),T.texParameteri(T.TEXTURE_2D,T.TEXTURE_WRAP_T,T.CLAMP_TO_EDGE),E}function k(T,E,S,P,L){var R=T.getParameter(T.MAX_TEXTURE_SIZE);if(E<0||E>R||S<0||S>R)throw new Error("gl-texture2d: Invalid texture shape");if(L===T.FLOAT&&!T.getExtension("OES_texture_float"))throw new Error("gl-texture2d: Floating point textures not supported on this platform");var F=b(T);return T.texImage2D(T.TEXTURE_2D,0,P,E,S,0,P,L,null),new x(T,F,E,S,P,L)}function w(T,E,S,P,L,R){var F=b(T);return T.texImage2D(T.TEXTURE_2D,0,L,L,R,E),new x(T,F,S,P,L,R)}function M(T,E){var S=E.dtype,P=E.shape.slice(),L=T.getParameter(T.MAX_TEXTURE_SIZE);if(P[0]<0||P[0]>L||P[1]<0||P[1]>L)throw new Error("gl-texture2d: Invalid texture size");var R=A(P,E.stride.slice()),F=0;S==="float32"?F=T.FLOAT:S==="float64"?(F=T.FLOAT,R=!1,S="float32"):S==="uint8"?F=T.UNSIGNED_BYTE:(F=T.UNSIGNED_BYTE,R=!1,S="uint8");var D,O,N=0;if(P.length===2)N=T.LUMINANCE,P=[P[0],P[1],1],E=i(E.data,P,[E.stride[0],E.stride[1],1],E.offset);else{if(P.length!==3)throw new Error("gl-texture2d: Invalid shape for texture");if(P[2]===1)N=T.ALPHA;else if(P[2]===2)N=T.LUMINANCE_ALPHA;else if(P[2]===3)N=T.RGB;else{if(P[2]!==4)throw new Error("gl-texture2d: Invalid shape for pixel coords");N=T.RGBA}}F!==T.FLOAT||T.getExtension("OES_texture_float")||(F=T.UNSIGNED_BYTE,R=!1);var B=E.size;if(R)D=E.offset===0&&E.data.length===B?E.data:E.data.subarray(E.offset,E.offset+B);else{var W=[P[2],P[2]*P[0],1];O=u.malloc(B,S);var G=i(O,P,W,0);S!=="float32"&&S!=="float64"||F!==T.UNSIGNED_BYTE?s.assign(G,E):y(G,E),D=O.subarray(0,B)}var K=b(T);return T.texImage2D(T.TEXTURE_2D,0,N,P[0],P[1],0,N,F,D),R||u.free(O),new x(T,K,P[0],P[1],N,F)}Object.defineProperties(_,{minFilter:{get:function(){return this._minFilter},set:function(T){this.bind();var E=this.gl;if(this.type===E.FLOAT&&h.indexOf(T)>=0&&(E.getExtension("OES_texture_float_linear")||(T=E.NEAREST)),d.indexOf(T)<0)throw new Error("gl-texture2d: Unknown filter mode "+T);return E.texParameteri(E.TEXTURE_2D,E.TEXTURE_MIN_FILTER,T),this._minFilter=T}},magFilter:{get:function(){return this._magFilter},set:function(T){this.bind();var E=this.gl;if(this.type===E.FLOAT&&h.indexOf(T)>=0&&(E.getExtension("OES_texture_float_linear")||(T=E.NEAREST)),d.indexOf(T)<0)throw new Error("gl-texture2d: Unknown filter mode "+T);return E.texParameteri(E.TEXTURE_2D,E.TEXTURE_MAG_FILTER,T),this._magFilter=T}},mipSamples:{get:function(){return this._anisoSamples},set:function(T){var E=this._anisoSamples;if(this._anisoSamples=0|Math.max(T,1),E!==this._anisoSamples){var S=this.gl.getExtension("EXT_texture_filter_anisotropic");S&&this.gl.texParameterf(this.gl.TEXTURE_2D,S.TEXTURE_MAX_ANISOTROPY_EXT,this._anisoSamples)}return this._anisoSamples}},wrapS:{get:function(){return this._wrapS},set:function(T){if(this.bind(),m.indexOf(T)<0)throw new Error("gl-texture2d: Unknown wrap mode "+T);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,T),this._wrapS=T}},wrapT:{get:function(){return this._wrapT},set:function(T){if(this.bind(),m.indexOf(T)<0)throw new Error("gl-texture2d: Unknown wrap mode "+T);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,T),this._wrapT=T}},wrap:{get:function(){return this._wrapVector},set:function(T){if(Array.isArray(T)||(T=[T,T]),T.length!==2)throw new Error("gl-texture2d: Must specify wrap mode for rows and columns");for(var E=0;E<2;++E)if(m.indexOf(T[E])<0)throw new Error("gl-texture2d: Unknown wrap mode "+T);this._wrapS=T[0],this._wrapT=T[1];var S=this.gl;return this.bind(),S.texParameteri(S.TEXTURE_2D,S.TEXTURE_WRAP_S,this._wrapS),S.texParameteri(S.TEXTURE_2D,S.TEXTURE_WRAP_T,this._wrapT),T}},shape:{get:function(){return this._shapeVector},set:function(T){if(Array.isArray(T)){if(T.length!==2)throw new Error("gl-texture2d: Invalid texture shape")}else T=[0|T,0|T];return v(this,0|T[0],0|T[1]),[0|T[0],0|T[1]]}},width:{get:function(){return this._shape[0]},set:function(T){return v(this,T|=0,this._shape[1]),T}},height:{get:function(){return this._shape[1]},set:function(T){return T|=0,v(this,this._shape[0],T),T}}}),_.bind=function(T){var E=this.gl;return T!==void 0&&E.activeTexture(E.TEXTURE0+(0|T)),E.bindTexture(E.TEXTURE_2D,this.handle),T!==void 0?0|T:E.getParameter(E.ACTIVE_TEXTURE)-E.TEXTURE0},_.dispose=function(){this.gl.deleteTexture(this.handle)},_.generateMipmap=function(){this.bind(),this.gl.generateMipmap(this.gl.TEXTURE_2D);for(var T=Math.min(this._shape[0],this._shape[1]),E=0;T>0;++E,T>>>=1)this._mipLevels.indexOf(E)<0&&this._mipLevels.push(E)},_.setPixels=function(T,E,S,P){var L=this.gl;this.bind(),Array.isArray(E)?(P=S,S=0|E[1],E=0|E[0]):(E=E||0,S=S||0),P=P||0;var R=g(T)?T:T.raw;if(R)this._mipLevels.indexOf(P)<0?(L.texImage2D(L.TEXTURE_2D,0,this.format,this.format,this.type,R),this._mipLevels.push(P)):L.texSubImage2D(L.TEXTURE_2D,P,E,S,this.format,this.type,R);else{if(!(T.shape&&T.stride&&T.data))throw new Error("gl-texture2d: Unsupported data type");if(T.shape.length<2||E+T.shape[1]>this._shape[1]>>>P||S+T.shape[0]>this._shape[0]>>>P||E<0||S<0)throw new Error("gl-texture2d: Texture dimensions are out of bounds");(function(F,D,O,N,B,W,G,K){var te=K.dtype,Y=K.shape.slice();if(Y.length<2||Y.length>3)throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d");var J=0,re=0,U=A(Y,K.stride.slice());if(te==="float32"?J=F.FLOAT:te==="float64"?(J=F.FLOAT,U=!1,te="float32"):te==="uint8"?J=F.UNSIGNED_BYTE:(J=F.UNSIGNED_BYTE,U=!1,te="uint8"),Y.length===2)re=F.LUMINANCE,Y=[Y[0],Y[1],1],K=i(K.data,Y,[K.stride[0],K.stride[1],1],K.offset);else{if(Y.length!==3)throw new Error("gl-texture2d: Invalid shape for texture");if(Y[2]===1)re=F.ALPHA;else if(Y[2]===2)re=F.LUMINANCE_ALPHA;else if(Y[2]===3)re=F.RGB;else{if(Y[2]!==4)throw new Error("gl-texture2d: Invalid shape for pixel coords");re=F.RGBA}Y[2]}if(re!==F.LUMINANCE&&re!==F.ALPHA||B!==F.LUMINANCE&&B!==F.ALPHA||(re=B),re!==B)throw new Error("gl-texture2d: Incompatible texture format for setPixels");var V=K.size,H=G.indexOf(N)<0;if(H&&G.push(N),J===W&&U)K.offset===0&&K.data.length===V?H?F.texImage2D(F.TEXTURE_2D,N,B,Y[0],Y[1],0,B,W,K.data):F.texSubImage2D(F.TEXTURE_2D,N,D,O,Y[0],Y[1],B,W,K.data):H?F.texImage2D(F.TEXTURE_2D,N,B,Y[0],Y[1],0,B,W,K.data.subarray(K.offset,K.offset+V)):F.texSubImage2D(F.TEXTURE_2D,N,D,O,Y[0],Y[1],B,W,K.data.subarray(K.offset,K.offset+V));else{var ne;ne=W===F.FLOAT?u.mallocFloat32(V):u.mallocUint8(V);var q=i(ne,Y,[Y[2],Y[2]*Y[0],1]);J===F.FLOAT&&W===F.UNSIGNED_BYTE?y(q,K):s.assign(q,K),H?F.texImage2D(F.TEXTURE_2D,N,B,Y[0],Y[1],0,B,W,ne.subarray(0,V)):F.texSubImage2D(F.TEXTURE_2D,N,D,O,Y[0],Y[1],B,W,ne.subarray(0,V)),W===F.FLOAT?u.freeFloat32(ne):u.freeUint8(ne)}})(L,E,S,P,this.format,this.type,this._mipLevels,T)}}},{ndarray:259,"ndarray-ops":254,"typedarray-pool":308}],147:[function(a,l,c){l.exports=function(i,s,u){s?s.bind():i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,null);var h=0|i.getParameter(i.MAX_VERTEX_ATTRIBS);if(u){if(u.length>h)throw new Error("gl-vao: Too many vertex attributes");for(var d=0;d1?0:Math.acos(g)};var i=a("./fromValues"),s=a("./normalize"),u=a("./dot")},{"./dot":162,"./fromValues":168,"./normalize":179}],153:[function(a,l,c){l.exports=function(i,s){return i[0]=Math.ceil(s[0]),i[1]=Math.ceil(s[1]),i[2]=Math.ceil(s[2]),i}},{}],154:[function(a,l,c){l.exports=function(i){var s=new Float32Array(3);return s[0]=i[0],s[1]=i[1],s[2]=i[2],s}},{}],155:[function(a,l,c){l.exports=function(i,s){return i[0]=s[0],i[1]=s[1],i[2]=s[2],i}},{}],156:[function(a,l,c){l.exports=function(){var i=new Float32Array(3);return i[0]=0,i[1]=0,i[2]=0,i}},{}],157:[function(a,l,c){l.exports=function(i,s,u){var h=s[0],d=s[1],m=s[2],p=u[0],g=u[1],y=u[2];return i[0]=d*y-m*g,i[1]=m*p-h*y,i[2]=h*g-d*p,i}},{}],158:[function(a,l,c){l.exports=a("./distance")},{"./distance":159}],159:[function(a,l,c){l.exports=function(i,s){var u=s[0]-i[0],h=s[1]-i[1],d=s[2]-i[2];return Math.sqrt(u*u+h*h+d*d)}},{}],160:[function(a,l,c){l.exports=a("./divide")},{"./divide":161}],161:[function(a,l,c){l.exports=function(i,s,u){return i[0]=s[0]/u[0],i[1]=s[1]/u[1],i[2]=s[2]/u[2],i}},{}],162:[function(a,l,c){l.exports=function(i,s){return i[0]*s[0]+i[1]*s[1]+i[2]*s[2]}},{}],163:[function(a,l,c){l.exports=1e-6},{}],164:[function(a,l,c){l.exports=function(s,u){var h=s[0],d=s[1],m=s[2],p=u[0],g=u[1],y=u[2];return Math.abs(h-p)<=i*Math.max(1,Math.abs(h),Math.abs(p))&&Math.abs(d-g)<=i*Math.max(1,Math.abs(d),Math.abs(g))&&Math.abs(m-y)<=i*Math.max(1,Math.abs(m),Math.abs(y))};var i=a("./epsilon")},{"./epsilon":163}],165:[function(a,l,c){l.exports=function(i,s){return i[0]===s[0]&&i[1]===s[1]&&i[2]===s[2]}},{}],166:[function(a,l,c){l.exports=function(i,s){return i[0]=Math.floor(s[0]),i[1]=Math.floor(s[1]),i[2]=Math.floor(s[2]),i}},{}],167:[function(a,l,c){l.exports=function(s,u,h,d,m,p){var g,y;for(u||(u=3),h||(h=0),y=d?Math.min(d*u+h,s.length):s.length,g=h;g0&&(m=1/Math.sqrt(m),i[0]=s[0]*m,i[1]=s[1]*m,i[2]=s[2]*m),i}},{}],180:[function(a,l,c){l.exports=function(i,s){s=s||1;var u=2*Math.random()*Math.PI,h=2*Math.random()-1,d=Math.sqrt(1-h*h)*s;return i[0]=Math.cos(u)*d,i[1]=Math.sin(u)*d,i[2]=h*s,i}},{}],181:[function(a,l,c){l.exports=function(i,s,u,h){var d=u[1],m=u[2],p=s[1]-d,g=s[2]-m,y=Math.sin(h),v=Math.cos(h);return i[0]=s[0],i[1]=d+p*v-g*y,i[2]=m+p*y+g*v,i}},{}],182:[function(a,l,c){l.exports=function(i,s,u,h){var d=u[0],m=u[2],p=s[0]-d,g=s[2]-m,y=Math.sin(h),v=Math.cos(h);return i[0]=d+g*y+p*v,i[1]=s[1],i[2]=m+g*v-p*y,i}},{}],183:[function(a,l,c){l.exports=function(i,s,u,h){var d=u[0],m=u[1],p=s[0]-d,g=s[1]-m,y=Math.sin(h),v=Math.cos(h);return i[0]=d+p*v-g*y,i[1]=m+p*y+g*v,i[2]=s[2],i}},{}],184:[function(a,l,c){l.exports=function(i,s){return i[0]=Math.round(s[0]),i[1]=Math.round(s[1]),i[2]=Math.round(s[2]),i}},{}],185:[function(a,l,c){l.exports=function(i,s,u){return i[0]=s[0]*u,i[1]=s[1]*u,i[2]=s[2]*u,i}},{}],186:[function(a,l,c){l.exports=function(i,s,u,h){return i[0]=s[0]+u[0]*h,i[1]=s[1]+u[1]*h,i[2]=s[2]+u[2]*h,i}},{}],187:[function(a,l,c){l.exports=function(i,s,u,h){return i[0]=s,i[1]=u,i[2]=h,i}},{}],188:[function(a,l,c){l.exports=a("./squaredDistance")},{"./squaredDistance":190}],189:[function(a,l,c){l.exports=a("./squaredLength")},{"./squaredLength":191}],190:[function(a,l,c){l.exports=function(i,s){var u=s[0]-i[0],h=s[1]-i[1],d=s[2]-i[2];return u*u+h*h+d*d}},{}],191:[function(a,l,c){l.exports=function(i){var s=i[0],u=i[1],h=i[2];return s*s+u*u+h*h}},{}],192:[function(a,l,c){l.exports=a("./subtract")},{"./subtract":193}],193:[function(a,l,c){l.exports=function(i,s,u){return i[0]=s[0]-u[0],i[1]=s[1]-u[1],i[2]=s[2]-u[2],i}},{}],194:[function(a,l,c){l.exports=function(i,s,u){var h=s[0],d=s[1],m=s[2];return i[0]=h*u[0]+d*u[3]+m*u[6],i[1]=h*u[1]+d*u[4]+m*u[7],i[2]=h*u[2]+d*u[5]+m*u[8],i}},{}],195:[function(a,l,c){l.exports=function(i,s,u){var h=s[0],d=s[1],m=s[2],p=u[3]*h+u[7]*d+u[11]*m+u[15];return p=p||1,i[0]=(u[0]*h+u[4]*d+u[8]*m+u[12])/p,i[1]=(u[1]*h+u[5]*d+u[9]*m+u[13])/p,i[2]=(u[2]*h+u[6]*d+u[10]*m+u[14])/p,i}},{}],196:[function(a,l,c){l.exports=function(i,s,u){var h=s[0],d=s[1],m=s[2],p=u[0],g=u[1],y=u[2],v=u[3],x=v*h+g*m-y*d,_=v*d+y*h-p*m,A=v*m+p*d-g*h,b=-p*h-g*d-y*m;return i[0]=x*v+b*-p+_*-y-A*-g,i[1]=_*v+b*-g+A*-p-x*-y,i[2]=A*v+b*-y+x*-g-_*-p,i}},{}],197:[function(a,l,c){l.exports=function(i,s,u){return i[0]=s[0]+u[0],i[1]=s[1]+u[1],i[2]=s[2]+u[2],i[3]=s[3]+u[3],i}},{}],198:[function(a,l,c){l.exports=function(i){var s=new Float32Array(4);return s[0]=i[0],s[1]=i[1],s[2]=i[2],s[3]=i[3],s}},{}],199:[function(a,l,c){l.exports=function(i,s){return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i}},{}],200:[function(a,l,c){l.exports=function(){var i=new Float32Array(4);return i[0]=0,i[1]=0,i[2]=0,i[3]=0,i}},{}],201:[function(a,l,c){l.exports=function(i,s){var u=s[0]-i[0],h=s[1]-i[1],d=s[2]-i[2],m=s[3]-i[3];return Math.sqrt(u*u+h*h+d*d+m*m)}},{}],202:[function(a,l,c){l.exports=function(i,s,u){return i[0]=s[0]/u[0],i[1]=s[1]/u[1],i[2]=s[2]/u[2],i[3]=s[3]/u[3],i}},{}],203:[function(a,l,c){l.exports=function(i,s){return i[0]*s[0]+i[1]*s[1]+i[2]*s[2]+i[3]*s[3]}},{}],204:[function(a,l,c){l.exports=function(i,s,u,h){var d=new Float32Array(4);return d[0]=i,d[1]=s,d[2]=u,d[3]=h,d}},{}],205:[function(a,l,c){l.exports={create:a("./create"),clone:a("./clone"),fromValues:a("./fromValues"),copy:a("./copy"),set:a("./set"),add:a("./add"),subtract:a("./subtract"),multiply:a("./multiply"),divide:a("./divide"),min:a("./min"),max:a("./max"),scale:a("./scale"),scaleAndAdd:a("./scaleAndAdd"),distance:a("./distance"),squaredDistance:a("./squaredDistance"),length:a("./length"),squaredLength:a("./squaredLength"),negate:a("./negate"),inverse:a("./inverse"),normalize:a("./normalize"),dot:a("./dot"),lerp:a("./lerp"),random:a("./random"),transformMat4:a("./transformMat4"),transformQuat:a("./transformQuat")}},{"./add":197,"./clone":198,"./copy":199,"./create":200,"./distance":201,"./divide":202,"./dot":203,"./fromValues":204,"./inverse":206,"./length":207,"./lerp":208,"./max":209,"./min":210,"./multiply":211,"./negate":212,"./normalize":213,"./random":214,"./scale":215,"./scaleAndAdd":216,"./set":217,"./squaredDistance":218,"./squaredLength":219,"./subtract":220,"./transformMat4":221,"./transformQuat":222}],206:[function(a,l,c){l.exports=function(i,s){return i[0]=1/s[0],i[1]=1/s[1],i[2]=1/s[2],i[3]=1/s[3],i}},{}],207:[function(a,l,c){l.exports=function(i){var s=i[0],u=i[1],h=i[2],d=i[3];return Math.sqrt(s*s+u*u+h*h+d*d)}},{}],208:[function(a,l,c){l.exports=function(i,s,u,h){var d=s[0],m=s[1],p=s[2],g=s[3];return i[0]=d+h*(u[0]-d),i[1]=m+h*(u[1]-m),i[2]=p+h*(u[2]-p),i[3]=g+h*(u[3]-g),i}},{}],209:[function(a,l,c){l.exports=function(i,s,u){return i[0]=Math.max(s[0],u[0]),i[1]=Math.max(s[1],u[1]),i[2]=Math.max(s[2],u[2]),i[3]=Math.max(s[3],u[3]),i}},{}],210:[function(a,l,c){l.exports=function(i,s,u){return i[0]=Math.min(s[0],u[0]),i[1]=Math.min(s[1],u[1]),i[2]=Math.min(s[2],u[2]),i[3]=Math.min(s[3],u[3]),i}},{}],211:[function(a,l,c){l.exports=function(i,s,u){return i[0]=s[0]*u[0],i[1]=s[1]*u[1],i[2]=s[2]*u[2],i[3]=s[3]*u[3],i}},{}],212:[function(a,l,c){l.exports=function(i,s){return i[0]=-s[0],i[1]=-s[1],i[2]=-s[2],i[3]=-s[3],i}},{}],213:[function(a,l,c){l.exports=function(i,s){var u=s[0],h=s[1],d=s[2],m=s[3],p=u*u+h*h+d*d+m*m;return p>0&&(p=1/Math.sqrt(p),i[0]=u*p,i[1]=h*p,i[2]=d*p,i[3]=m*p),i}},{}],214:[function(a,l,c){var i=a("./normalize"),s=a("./scale");l.exports=function(u,h){return h=h||1,u[0]=Math.random(),u[1]=Math.random(),u[2]=Math.random(),u[3]=Math.random(),i(u,u),s(u,u,h),u}},{"./normalize":213,"./scale":215}],215:[function(a,l,c){l.exports=function(i,s,u){return i[0]=s[0]*u,i[1]=s[1]*u,i[2]=s[2]*u,i[3]=s[3]*u,i}},{}],216:[function(a,l,c){l.exports=function(i,s,u,h){return i[0]=s[0]+u[0]*h,i[1]=s[1]+u[1]*h,i[2]=s[2]+u[2]*h,i[3]=s[3]+u[3]*h,i}},{}],217:[function(a,l,c){l.exports=function(i,s,u,h,d){return i[0]=s,i[1]=u,i[2]=h,i[3]=d,i}},{}],218:[function(a,l,c){l.exports=function(i,s){var u=s[0]-i[0],h=s[1]-i[1],d=s[2]-i[2],m=s[3]-i[3];return u*u+h*h+d*d+m*m}},{}],219:[function(a,l,c){l.exports=function(i){var s=i[0],u=i[1],h=i[2],d=i[3];return s*s+u*u+h*h+d*d}},{}],220:[function(a,l,c){l.exports=function(i,s,u){return i[0]=s[0]-u[0],i[1]=s[1]-u[1],i[2]=s[2]-u[2],i[3]=s[3]-u[3],i}},{}],221:[function(a,l,c){l.exports=function(i,s,u){var h=s[0],d=s[1],m=s[2],p=s[3];return i[0]=u[0]*h+u[4]*d+u[8]*m+u[12]*p,i[1]=u[1]*h+u[5]*d+u[9]*m+u[13]*p,i[2]=u[2]*h+u[6]*d+u[10]*m+u[14]*p,i[3]=u[3]*h+u[7]*d+u[11]*m+u[15]*p,i}},{}],222:[function(a,l,c){l.exports=function(i,s,u){var h=s[0],d=s[1],m=s[2],p=u[0],g=u[1],y=u[2],v=u[3],x=v*h+g*m-y*d,_=v*d+y*h-p*m,A=v*m+p*d-g*h,b=-p*h-g*d-y*m;return i[0]=x*v+b*-p+_*-y-A*-g,i[1]=_*v+b*-g+A*-p-x*-y,i[2]=A*v+b*-y+x*-g-_*-p,i[3]=s[3],i}},{}],223:[function(a,l,c){var i=a("glsl-tokenizer"),s=a("atob-lite");l.exports=function(u){for(var h=Array.isArray(u)?u:i(u),d=0;d0)continue;ne=V.slice(0,1).join("")}return O(ne),T+=ne.length,(b=b.slice(ne.length)).length}}function Y(){return/[^a-fA-F0-9]/.test(g)?(O(b.join("")),A=999,x):(b.push(g),y=g,x+1)}function J(){return g==="."||/[eE]/.test(g)?(b.push(g),A=5,y=g,x+1):g==="x"&&b.length===1&&b[0]==="0"?(A=11,b.push(g),y=g,x+1):/[^\d]/.test(g)?(O(b.join("")),A=999,x):(b.push(g),y=g,x+1)}function re(){return g==="f"&&(b.push(g),y=g,x+=1),/[eE]/.test(g)?(b.push(g),y=g,x+1):(g!=="-"&&g!=="+"||!/[eE]/.test(y))&&/[^\d]/.test(g)?(O(b.join("")),A=999,x):(b.push(g),y=g,x+1)}function U(){if(/[^\d\w_]/.test(g)){var V=b.join("");return A=D[V]?8:F[V]?7:6,O(b.join("")),A=999,x}return b.push(g),y=g,x+1}};var i=a("./lib/literals"),s=a("./lib/operators"),u=a("./lib/builtins"),h=a("./lib/literals-300es"),d=a("./lib/builtins-300es"),m=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"]},{"./lib/builtins":226,"./lib/builtins-300es":225,"./lib/literals":228,"./lib/literals-300es":227,"./lib/operators":229}],225:[function(a,l,c){var i=a("./builtins");i=i.slice().filter(function(s){return!/^(gl\_|texture)/.test(s)}),l.exports=i.concat(["gl_VertexID","gl_InstanceID","gl_Position","gl_PointSize","gl_FragCoord","gl_FrontFacing","gl_FragDepth","gl_PointCoord","gl_MaxVertexAttribs","gl_MaxVertexUniformVectors","gl_MaxVertexOutputVectors","gl_MaxFragmentInputVectors","gl_MaxVertexTextureImageUnits","gl_MaxCombinedTextureImageUnits","gl_MaxTextureImageUnits","gl_MaxFragmentUniformVectors","gl_MaxDrawBuffers","gl_MinProgramTexelOffset","gl_MaxProgramTexelOffset","gl_DepthRangeParameters","gl_DepthRange","trunc","round","roundEven","isnan","isinf","floatBitsToInt","floatBitsToUint","intBitsToFloat","uintBitsToFloat","packSnorm2x16","unpackSnorm2x16","packUnorm2x16","unpackUnorm2x16","packHalf2x16","unpackHalf2x16","outerProduct","transpose","determinant","inverse","texture","textureSize","textureProj","textureLod","textureOffset","texelFetch","texelFetchOffset","textureProjOffset","textureLodOffset","textureProjLod","textureProjLodOffset","textureGrad","textureGradOffset","textureProjGrad","textureProjGradOffset"])},{"./builtins":226}],226:[function(a,l,c){l.exports=["abs","acos","all","any","asin","atan","ceil","clamp","cos","cross","dFdx","dFdy","degrees","distance","dot","equal","exp","exp2","faceforward","floor","fract","gl_BackColor","gl_BackLightModelProduct","gl_BackLightProduct","gl_BackMaterial","gl_BackSecondaryColor","gl_ClipPlane","gl_ClipVertex","gl_Color","gl_DepthRange","gl_DepthRangeParameters","gl_EyePlaneQ","gl_EyePlaneR","gl_EyePlaneS","gl_EyePlaneT","gl_Fog","gl_FogCoord","gl_FogFragCoord","gl_FogParameters","gl_FragColor","gl_FragCoord","gl_FragData","gl_FragDepth","gl_FragDepthEXT","gl_FrontColor","gl_FrontFacing","gl_FrontLightModelProduct","gl_FrontLightProduct","gl_FrontMaterial","gl_FrontSecondaryColor","gl_LightModel","gl_LightModelParameters","gl_LightModelProducts","gl_LightProducts","gl_LightSource","gl_LightSourceParameters","gl_MaterialParameters","gl_MaxClipPlanes","gl_MaxCombinedTextureImageUnits","gl_MaxDrawBuffers","gl_MaxFragmentUniformComponents","gl_MaxLights","gl_MaxTextureCoords","gl_MaxTextureImageUnits","gl_MaxTextureUnits","gl_MaxVaryingFloats","gl_MaxVertexAttribs","gl_MaxVertexTextureImageUnits","gl_MaxVertexUniformComponents","gl_ModelViewMatrix","gl_ModelViewMatrixInverse","gl_ModelViewMatrixInverseTranspose","gl_ModelViewMatrixTranspose","gl_ModelViewProjectionMatrix","gl_ModelViewProjectionMatrixInverse","gl_ModelViewProjectionMatrixInverseTranspose","gl_ModelViewProjectionMatrixTranspose","gl_MultiTexCoord0","gl_MultiTexCoord1","gl_MultiTexCoord2","gl_MultiTexCoord3","gl_MultiTexCoord4","gl_MultiTexCoord5","gl_MultiTexCoord6","gl_MultiTexCoord7","gl_Normal","gl_NormalMatrix","gl_NormalScale","gl_ObjectPlaneQ","gl_ObjectPlaneR","gl_ObjectPlaneS","gl_ObjectPlaneT","gl_Point","gl_PointCoord","gl_PointParameters","gl_PointSize","gl_Position","gl_ProjectionMatrix","gl_ProjectionMatrixInverse","gl_ProjectionMatrixInverseTranspose","gl_ProjectionMatrixTranspose","gl_SecondaryColor","gl_TexCoord","gl_TextureEnvColor","gl_TextureMatrix","gl_TextureMatrixInverse","gl_TextureMatrixInverseTranspose","gl_TextureMatrixTranspose","gl_Vertex","greaterThan","greaterThanEqual","inversesqrt","length","lessThan","lessThanEqual","log","log2","matrixCompMult","max","min","mix","mod","normalize","not","notEqual","pow","radians","reflect","refract","sign","sin","smoothstep","sqrt","step","tan","texture2D","texture2DLod","texture2DProj","texture2DProjLod","textureCube","textureCubeLod","texture2DLodEXT","texture2DProjLodEXT","textureCubeLodEXT","texture2DGradEXT","texture2DProjGradEXT","textureCubeGradEXT"]},{}],227:[function(a,l,c){var i=a("./literals");l.exports=i.slice().concat(["layout","centroid","smooth","case","mat2x2","mat2x3","mat2x4","mat3x2","mat3x3","mat3x4","mat4x2","mat4x3","mat4x4","uvec2","uvec3","uvec4","samplerCubeShadow","sampler2DArray","sampler2DArrayShadow","isampler2D","isampler3D","isamplerCube","isampler2DArray","usampler2D","usampler3D","usamplerCube","usampler2DArray","coherent","restrict","readonly","writeonly","resource","atomic_uint","noperspective","patch","sample","subroutine","common","partition","active","filter","image1D","image2D","image3D","imageCube","iimage1D","iimage2D","iimage3D","iimageCube","uimage1D","uimage2D","uimage3D","uimageCube","image1DArray","image2DArray","iimage1DArray","iimage2DArray","uimage1DArray","uimage2DArray","image1DShadow","image2DShadow","image1DArrayShadow","image2DArrayShadow","imageBuffer","iimageBuffer","uimageBuffer","sampler1DArray","sampler1DArrayShadow","isampler1D","isampler1DArray","usampler1D","usampler1DArray","isampler2DRect","usampler2DRect","samplerBuffer","isamplerBuffer","usamplerBuffer","sampler2DMS","isampler2DMS","usampler2DMS","sampler2DMSArray","isampler2DMSArray","usampler2DMSArray"])},{"./literals":228}],228:[function(a,l,c){l.exports=["precision","highp","mediump","lowp","attribute","const","uniform","varying","break","continue","do","for","while","if","else","in","out","inout","float","int","uint","void","bool","true","false","discard","return","mat2","mat3","mat4","vec2","vec3","vec4","ivec2","ivec3","ivec4","bvec2","bvec3","bvec4","sampler1D","sampler2D","sampler3D","samplerCube","sampler1DShadow","sampler2DShadow","struct","asm","class","union","enum","typedef","template","this","packed","goto","switch","default","inline","noinline","volatile","public","static","extern","external","interface","long","short","double","half","fixed","unsigned","input","output","hvec2","hvec3","hvec4","dvec2","dvec3","dvec4","fvec2","fvec3","fvec4","sampler2DRect","sampler3DRect","sampler2DRectShadow","sizeof","cast","namespace","using"]},{}],229:[function(a,l,c){l.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],230:[function(a,l,c){var i=a("./index");l.exports=function(s,u){var h=i(u),d=[];return d=(d=d.concat(h(s))).concat(h(null))}},{"./index":224}],231:[function(a,l,c){l.exports=function(i){typeof i=="string"&&(i=[i]);for(var s=[].slice.call(arguments,1),u=[],h=0;h0;)for(var w=(y=k.pop()).adjacent,M=0;M<=x;++M){var T=w[M];if(T.boundary&&!(T.lastVisited<=-_)){for(var E=T.vertices,S=0;S<=x;++S){var P=E[S];A[S]=P<0?v:b[P]}var L=this.orient();if(L>0)return T;T.lastVisited=-_,L===0&&k.push(T)}}return null},g.walk=function(y,v){var x=this.vertices.length-1,_=this.dimension,A=this.vertices,b=this.tuple,k=v?this.interior.length*Math.random()|0:this.interior.length-1,w=this.interior[k];e:for(;!w.boundary;){for(var M=w.vertices,T=w.adjacent,E=0;E<=_;++E)b[E]=A[M[E]];for(w.lastVisited=x,E=0;E<=_;++E){var S=T[E];if(!(S.lastVisited>=x)){var P=b[E];b[E]=y;var L=this.orient();if(b[E]=P,L<0){w=S;continue e}S.boundary?S.lastVisited=-x:S.lastVisited=x}}return}return w},g.addPeaks=function(y,v){var x=this.vertices.length-1,_=this.dimension,A=this.vertices,b=this.tuple,k=this.interior,w=this.simplices,M=[v];v.lastVisited=x,v.vertices[v.vertices.indexOf(-1)]=x,v.boundary=!1,k.push(v);for(var T=[];M.length>0;){var E=(v=M.pop()).vertices,S=v.adjacent,P=E.indexOf(x);if(!(P<0)){for(var L=0;L<=_;++L)if(L!==P){var R=S[L];if(R.boundary&&!(R.lastVisited>=x)){var F=R.vertices;if(R.lastVisited!==-x){for(var D=0,O=0;O<=_;++O)F[O]<0?(D=O,b[O]=y):b[O]=A[F[O]];if(this.orient()>0){F[D]=x,R.boundary=!1,k.push(R),M.push(R),R.lastVisited=x;continue}R.lastVisited=-x}var N=R.adjacent,B=E.slice(),W=S.slice(),G=new u(B,W,!0);w.push(G);var K=N.indexOf(v);if(!(K<0))for(N[K]=G,W[P]=R,B[L]=-1,W[L]=v,S[L]=G,G.flip(),O=0;O<=_;++O){var te=B[O];if(!(te<0||te===x)){for(var Y=new Array(_-1),J=0,re=0;re<=_;++re){var U=B[re];U<0||re===O||(Y[J++]=U)}T.push(new h(Y,G,O))}}}}}}for(T.sort(d),L=0;L+1=0?k[M++]=w[E]:T=1&E;if(T===(1&y)){var S=k[0];k[0]=k[1],k[1]=S}v.push(k)}}return v}},{"robust-orientation":284,"simplicial-complex":293}],234:[function(a,l,c){var i=a("binary-search-bounds");function s(M,T,E,S,P){this.mid=M,this.left=T,this.right=E,this.leftPoints=S,this.rightPoints=P,this.count=(T?T.count:0)+(E?E.count:0)+S.length}l.exports=function(M){return!M||M.length===0?new k(null):new k(b(M))};var u=s.prototype;function h(M,T){M.mid=T.mid,M.left=T.left,M.right=T.right,M.leftPoints=T.leftPoints,M.rightPoints=T.rightPoints,M.count=T.count}function d(M,T){var E=b(T);M.mid=E.mid,M.left=E.left,M.right=E.right,M.leftPoints=E.leftPoints,M.rightPoints=E.rightPoints,M.count=E.count}function m(M,T){var E=M.intervals([]);E.push(T),d(M,E)}function p(M,T){var E=M.intervals([]),S=E.indexOf(T);return S<0?0:(E.splice(S,1),d(M,E),1)}function g(M,T,E){for(var S=0;S=0&&M[S][1]>=T;--S){var P=E(M[S]);if(P)return P}}function v(M,T){for(var E=0;E>1],P=[],L=[],R=[];for(E=0;E3*(T+1)?m(this,M):this.left.insert(M):this.left=b([M]);else if(M[0]>this.mid)this.right?4*(this.right.count+1)>3*(T+1)?m(this,M):this.right.insert(M):this.right=b([M]);else{var E=i.ge(this.leftPoints,M,_),S=i.ge(this.rightPoints,M,A);this.leftPoints.splice(E,0,M),this.rightPoints.splice(S,0,M)}},u.remove=function(M){var T=this.count-this.leftPoints;if(M[1]3*(T-1)?p(this,M):(L=this.left.remove(M))===2?(this.left=null,this.count-=1,1):(L===1&&(this.count-=1),L):0;if(M[0]>this.mid)return this.right?4*(this.left?this.left.count:0)>3*(T-1)?p(this,M):(L=this.right.remove(M))===2?(this.right=null,this.count-=1,1):(L===1&&(this.count-=1),L):0;if(this.count===1)return this.leftPoints[0]===M?2:0;if(this.leftPoints.length===1&&this.leftPoints[0]===M){if(this.left&&this.right){for(var E=this,S=this.left;S.right;)E=S,S=S.right;if(E===this)S.right=this.right;else{var P=this.left,L=this.right;E.count-=S.count,E.right=S.left,S.left=P,S.right=L}h(this,S),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?h(this,this.left):h(this,this.right);return 1}for(P=i.ge(this.leftPoints,M,_);Pthis.mid){var E;return this.right&&(E=this.right.queryPoint(M,T))?E:y(this.rightPoints,M,T)}return v(this.leftPoints,T)},u.queryInterval=function(M,T,E){var S;return Mthis.mid&&this.right&&(S=this.right.queryInterval(M,T,E))?S:Tthis.mid?y(this.rightPoints,M,E):v(this.leftPoints,E)};var w=k.prototype;w.insert=function(M){this.root?this.root.insert(M):this.root=new s(M[0],null,null,[M],[M])},w.remove=function(M){if(this.root){var T=this.root.remove(M);return T===2&&(this.root=null),T!==0}return!1},w.queryPoint=function(M,T){if(this.root)return this.root.queryPoint(M,T)},w.queryInterval=function(M,T,E){if(M<=T&&this.root)return this.root.queryInterval(M,T,E)},Object.defineProperty(w,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(w,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":31}],235:[function(a,l,c){l.exports=function(i){for(var s=new Array(i),u=0;u - * @license MIT - */l.exports=function(s){return s!=null&&(i(s)||function(u){return typeof u.readFloatLE=="function"&&typeof u.slice=="function"&&i(u.slice(0,0))}(s)||!!s._isBuffer)}},{}],238:[function(a,l,c){l.exports=u,l.exports.isMobile=u,l.exports.default=u;var i=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,s=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino|android|ipad|playbook|silk/i;function u(h){h||(h={});var d=h.ua;if(d||typeof navigator>"u"||(d=navigator.userAgent),d&&d.headers&&typeof d.headers["user-agent"]=="string"&&(d=d.headers["user-agent"]),typeof d!="string")return!1;var m=h.tablet?s.test(d):i.test(d);return!m&&h.tablet&&h.featureDetect&&navigator&&navigator.maxTouchPoints>1&&d.indexOf("Macintosh")!==-1&&d.indexOf("Safari")!==-1&&(m=!0),m}},{}],239:[function(a,l,c){l.exports=function(i){for(var s,u=i.length,h=0;h13)&&s!==32&&s!==133&&s!==160&&s!==5760&&s!==6158&&(s<8192||s>8205)&&s!==8232&&s!==8233&&s!==8239&&s!==8287&&s!==8288&&s!==12288&&s!==65279)return!1;return!0}},{}],240:[function(a,l,c){l.exports=function(i,s,u){return i*(1-u)+s*u}},{}],241:[function(a,l,c){var i=a("./normalize"),s=a("gl-mat4/create"),u=a("gl-mat4/clone"),h=a("gl-mat4/determinant"),d=a("gl-mat4/invert"),m=a("gl-mat4/transpose"),p={length:a("gl-vec3/length"),normalize:a("gl-vec3/normalize"),dot:a("gl-vec3/dot"),cross:a("gl-vec3/cross")},g=s(),y=s(),v=[0,0,0,0],x=[[0,0,0],[0,0,0],[0,0,0]],_=[0,0,0];function A(b,k,w,M,T){b[0]=k[0]*M+w[0]*T,b[1]=k[1]*M+w[1]*T,b[2]=k[2]*M+w[2]*T}l.exports=function(b,k,w,M,T,E){if(k||(k=[0,0,0]),w||(w=[0,0,0]),M||(M=[0,0,0]),T||(T=[0,0,0,1]),E||(E=[0,0,0,1]),!i(g,b)||(u(y,g),y[3]=0,y[7]=0,y[11]=0,y[15]=1,Math.abs(h(y)<1e-8)))return!1;var S,P,L,R,F,D,O,N=g[3],B=g[7],W=g[11],G=g[12],K=g[13],te=g[14],Y=g[15];if(N!==0||B!==0||W!==0){if(v[0]=N,v[1]=B,v[2]=W,v[3]=Y,!d(y,y))return!1;m(y,y),S=T,L=y,R=(P=v)[0],F=P[1],D=P[2],O=P[3],S[0]=L[0]*R+L[4]*F+L[8]*D+L[12]*O,S[1]=L[1]*R+L[5]*F+L[9]*D+L[13]*O,S[2]=L[2]*R+L[6]*F+L[10]*D+L[14]*O,S[3]=L[3]*R+L[7]*F+L[11]*D+L[15]*O}else T[0]=T[1]=T[2]=0,T[3]=1;if(k[0]=G,k[1]=K,k[2]=te,function(re,U){re[0][0]=U[0],re[0][1]=U[1],re[0][2]=U[2],re[1][0]=U[4],re[1][1]=U[5],re[1][2]=U[6],re[2][0]=U[8],re[2][1]=U[9],re[2][2]=U[10]}(x,g),w[0]=p.length(x[0]),p.normalize(x[0],x[0]),M[0]=p.dot(x[0],x[1]),A(x[1],x[1],x[0],1,-M[0]),w[1]=p.length(x[1]),p.normalize(x[1],x[1]),M[0]/=w[1],M[1]=p.dot(x[0],x[2]),A(x[2],x[2],x[0],1,-M[1]),M[2]=p.dot(x[1],x[2]),A(x[2],x[2],x[1],1,-M[2]),w[2]=p.length(x[2]),p.normalize(x[2],x[2]),M[1]/=w[2],M[2]/=w[2],p.cross(_,x[1],x[2]),p.dot(x[0],_)<0)for(var J=0;J<3;J++)w[J]*=-1,x[J][0]*=-1,x[J][1]*=-1,x[J][2]*=-1;return E[0]=.5*Math.sqrt(Math.max(1+x[0][0]-x[1][1]-x[2][2],0)),E[1]=.5*Math.sqrt(Math.max(1-x[0][0]+x[1][1]-x[2][2],0)),E[2]=.5*Math.sqrt(Math.max(1-x[0][0]-x[1][1]+x[2][2],0)),E[3]=.5*Math.sqrt(Math.max(1+x[0][0]+x[1][1]+x[2][2],0)),x[2][1]>x[1][2]&&(E[0]=-E[0]),x[0][2]>x[2][0]&&(E[1]=-E[1]),x[1][0]>x[0][1]&&(E[2]=-E[2]),!0}},{"./normalize":242,"gl-mat4/clone":92,"gl-mat4/create":93,"gl-mat4/determinant":94,"gl-mat4/invert":98,"gl-mat4/transpose":109,"gl-vec3/cross":157,"gl-vec3/dot":162,"gl-vec3/length":172,"gl-vec3/normalize":179}],242:[function(a,l,c){l.exports=function(i,s){var u=s[15];if(u===0)return!1;for(var h=1/u,d=0;d<16;d++)i[d]=s[d]*h;return!0}},{}],243:[function(a,l,c){var i=a("gl-vec3/lerp"),s=a("mat4-recompose"),u=a("mat4-decompose"),h=a("gl-mat4/determinant"),d=a("quat-slerp"),m=y(),p=y(),g=y();function y(){return{translate:v(),scale:v(1),skew:v(),perspective:[0,0,0,1],quaternion:[0,0,0,1]}}function v(x){return[x||0,x||0,x||0]}l.exports=function(x,_,A,b){if(h(_)===0||h(A)===0)return!1;var k=u(_,m.translate,m.scale,m.skew,m.perspective,m.quaternion),w=u(A,p.translate,p.scale,p.skew,p.perspective,p.quaternion);return!(!k||!w)&&(i(g.translate,m.translate,p.translate,b),i(g.skew,m.skew,p.skew,b),i(g.scale,m.scale,p.scale,b),i(g.perspective,m.perspective,p.perspective,b),d(g.quaternion,m.quaternion,p.quaternion,b),s(x,g.translate,g.scale,g.skew,g.perspective,g.quaternion),!0)}},{"gl-mat4/determinant":94,"gl-vec3/lerp":173,"mat4-decompose":241,"mat4-recompose":244,"quat-slerp":271}],244:[function(a,l,c){var i={identity:a("gl-mat4/identity"),translate:a("gl-mat4/translate"),multiply:a("gl-mat4/multiply"),create:a("gl-mat4/create"),scale:a("gl-mat4/scale"),fromRotationTranslation:a("gl-mat4/fromRotationTranslation")},s=(i.create(),i.create());l.exports=function(u,h,d,m,p,g){return i.identity(u),i.fromRotationTranslation(u,g,h),u[3]=p[0],u[7]=p[1],u[11]=p[2],u[15]=p[3],i.identity(s),m[2]!==0&&(s[9]=m[2],i.multiply(u,u,s)),m[1]!==0&&(s[9]=0,s[8]=m[1],i.multiply(u,u,s)),m[0]!==0&&(s[8]=0,s[4]=m[0],i.multiply(u,u,s)),i.scale(u,u,d),u}},{"gl-mat4/create":93,"gl-mat4/fromRotationTranslation":96,"gl-mat4/identity":97,"gl-mat4/multiply":100,"gl-mat4/scale":107,"gl-mat4/translate":108}],245:[function(a,l,c){var i=a("binary-search-bounds"),s=a("mat4-interpolate"),u=a("gl-mat4/invert"),h=a("gl-mat4/rotateX"),d=a("gl-mat4/rotateY"),m=a("gl-mat4/rotateZ"),p=a("gl-mat4/lookAt"),g=a("gl-mat4/translate"),y=(a("gl-mat4/scale"),a("gl-vec3/normalize")),v=[0,0,0];function x(b){this._components=b.slice(),this._time=[0],this.prevMatrix=b.slice(),this.nextMatrix=b.slice(),this.computedMatrix=b.slice(),this.computedInverse=b.slice(),this.computedEye=[0,0,0],this.computedUp=[0,0,0],this.computedCenter=[0,0,0],this.computedRadius=[0],this._limits=[-1/0,1/0]}l.exports=function(b){return new x((b=b||{}).matrix||[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])};var _=x.prototype;_.recalcMatrix=function(b){var k=this._time,w=i.le(k,b),M=this.computedMatrix;if(!(w<0)){var T=this._components;if(w===k.length-1)for(var E=16*w,S=0;S<16;++S)M[S]=T[E++];else{var P=k[w+1]-k[w],L=(E=16*w,this.prevMatrix),R=!0;for(S=0;S<16;++S)L[S]=T[E++];var F=this.nextMatrix;for(S=0;S<16;++S)F[S]=T[E++],R=R&&L[S]===F[S];if(P<1e-6||R)for(S=0;S<16;++S)M[S]=L[S];else s(M,L,F,(b-k[w])/P)}var D=this.computedUp;D[0]=M[1],D[1]=M[5],D[2]=M[9],y(D,D);var O=this.computedInverse;u(O,M);var N=this.computedEye,B=O[15];N[0]=O[12]/B,N[1]=O[13]/B,N[2]=O[14]/B;var W=this.computedCenter,G=Math.exp(this.computedRadius[0]);for(S=0;S<3;++S)W[S]=N[S]-M[2+4*S]*G}},_.idle=function(b){if(!(b1&&i(s[p[x-2]],s[p[x-1]],v)<=0;)x-=1,p.pop();for(p.push(y),x=g.length;x>1&&i(s[g[x-2]],s[g[x-1]],v)>=0;)x-=1,g.pop();g.push(y)}h=new Array(g.length+p.length-2);for(var _=0,A=(d=0,p.length);d0;--b)h[_++]=g[b];return h};var i=a("robust-orientation")[3]},{"robust-orientation":284}],247:[function(a,l,c){l.exports=function(s,u){u||(u=s,s=window);var h=0,d=0,m=0,p={shift:!1,alt:!1,control:!1,meta:!1},g=!1;function y(E){var S=!1;return"altKey"in E&&(S=S||E.altKey!==p.alt,p.alt=!!E.altKey),"shiftKey"in E&&(S=S||E.shiftKey!==p.shift,p.shift=!!E.shiftKey),"ctrlKey"in E&&(S=S||E.ctrlKey!==p.control,p.control=!!E.ctrlKey),"metaKey"in E&&(S=S||E.metaKey!==p.meta,p.meta=!!E.metaKey),S}function v(E,S){var P=i.x(S),L=i.y(S);"buttons"in S&&(E=0|S.buttons),(E!==h||P!==d||L!==m||y(S))&&(h=0|E,d=P||0,m=L||0,u&&u(h,d,m,p))}function x(E){v(0,E)}function _(){(h||d||m||p.shift||p.alt||p.meta||p.control)&&(d=m=0,h=0,p.shift=p.alt=p.control=p.meta=!1,u&&u(0,0,0,p))}function A(E){y(E)&&u&&u(h,d,m,p)}function b(E){i.buttons(E)===0?v(0,E):v(h,E)}function k(E){v(h|i.buttons(E),E)}function w(E){v(h&~i.buttons(E),E)}function M(){g||(g=!0,s.addEventListener("mousemove",b),s.addEventListener("mousedown",k),s.addEventListener("mouseup",w),s.addEventListener("mouseleave",x),s.addEventListener("mouseenter",x),s.addEventListener("mouseout",x),s.addEventListener("mouseover",x),s.addEventListener("blur",_),s.addEventListener("keyup",A),s.addEventListener("keydown",A),s.addEventListener("keypress",A),s!==window&&(window.addEventListener("blur",_),window.addEventListener("keyup",A),window.addEventListener("keydown",A),window.addEventListener("keypress",A)))}M();var T={element:s};return Object.defineProperties(T,{enabled:{get:function(){return g},set:function(E){E?M():function(){g&&(g=!1,s.removeEventListener("mousemove",b),s.removeEventListener("mousedown",k),s.removeEventListener("mouseup",w),s.removeEventListener("mouseleave",x),s.removeEventListener("mouseenter",x),s.removeEventListener("mouseout",x),s.removeEventListener("mouseover",x),s.removeEventListener("blur",_),s.removeEventListener("keyup",A),s.removeEventListener("keydown",A),s.removeEventListener("keypress",A),s!==window&&(window.removeEventListener("blur",_),window.removeEventListener("keyup",A),window.removeEventListener("keydown",A),window.removeEventListener("keypress",A)))}()},enumerable:!0},buttons:{get:function(){return h},enumerable:!0},x:{get:function(){return d},enumerable:!0},y:{get:function(){return m},enumerable:!0},mods:{get:function(){return p},enumerable:!0}}),T};var i=a("mouse-event")},{"mouse-event":249}],248:[function(a,l,c){var i={left:0,top:0};l.exports=function(s,u,h){u=u||s.currentTarget||s.srcElement,Array.isArray(h)||(h=[0,0]);var d=s.clientX||0,m=s.clientY||0,p=(g=u,g===window||g===document||g===document.body?i:g.getBoundingClientRect()),g;return h[0]=d-p.left,h[1]=m-p.top,h}},{}],249:[function(a,l,c){function i(s){return s.target||s.srcElement||window}c.buttons=function(s){if(typeof s=="object"){if("buttons"in s)return s.buttons;if("which"in s){if((u=s.which)===2)return 4;if(u===3)return 2;if(u>0)return 1<=0)return 1< 0"),typeof u.vertex!="function"&&h("Must specify vertex creation function"),typeof u.cell!="function"&&h("Must specify cell creation function"),typeof u.phase!="function"&&h("Must specify phase function");for(var g=u.getters||[],y=new Array(m),v=0;v=0?y[v]=!0:y[v]=!1;return function(x,_,A,b,k,w){var M=[w,k].join(",");return(0,s[M])(x,_,A,i.mallocUint32,i.freeUint32)}(u.vertex,u.cell,u.phase,0,d,y)};var s={"false,0,1":function(u,h,d,m,p){return function(g,y,v,x){var _,A=0|g.shape[0],b=0|g.shape[1],k=g.data,w=0|g.offset,M=0|g.stride[0],T=0|g.stride[1],E=w,S=0|-M,P=0,L=0|-T,R=0,F=-M-T|0,D=0,O=0|M,N=T-M*A|0,B=0,W=0,G=0,K=2*A|0,te=m(K),Y=m(K),J=0,re=0,U=-1,V=-1,H=0,ne=0|-A,q=0|A,Q=0,ee=-A-1|0,ie=A-1|0,ae=0,ue=0,le=0;for(B=0;B0){if(W=1,te[J++]=d(k[E],y,v,x),E+=O,A>0)for(B=1,_=k[E],re=te[J]=d(_,y,v,x),H=te[J+U],Q=te[J+ne],ae=te[J+ee],re===H&&re===Q&&re===ae||(P=k[E+S],R=k[E+L],D=k[E+F],u(B,W,_,P,R,D,re,H,Q,ae,y,v,x),ue=Y[J]=G++),J+=1,E+=O,B=2;B0)for(B=1,_=k[E],re=te[J]=d(_,y,v,x),H=te[J+U],Q=te[J+ne],ae=te[J+ee],re===H&&re===Q&&re===ae||(P=k[E+S],R=k[E+L],D=k[E+F],u(B,W,_,P,R,D,re,H,Q,ae,y,v,x),ue=Y[J]=G++,ae!==Q&&h(Y[J+ne],ue,R,D,Q,ae,y,v,x)),J+=1,E+=O,B=2;B0){if(B=1,te[J++]=d(k[E],y,v,x),E+=O,b>0)for(W=1,_=k[E],re=te[J]=d(_,y,v,x),Q=te[J+ne],H=te[J+U],ae=te[J+ee],re===Q&&re===H&&re===ae||(P=k[E+S],R=k[E+L],D=k[E+F],u(B,W,_,P,R,D,re,Q,H,ae,y,v,x),ue=Y[J]=G++),J+=1,E+=O,W=2;W0)for(W=1,_=k[E],re=te[J]=d(_,y,v,x),Q=te[J+ne],H=te[J+U],ae=te[J+ee],re===Q&&re===H&&re===ae||(P=k[E+S],R=k[E+L],D=k[E+F],u(B,W,_,P,R,D,re,Q,H,ae,y,v,x),ue=Y[J]=G++,ae!==Q&&h(Y[J+ne],ue,D,P,ae,Q,y,v,x)),J+=1,E+=O,W=2;W2&&E[1]>2&&w(T.pick(-1,-1).lo(1,1).hi(E[0]-2,E[1]-2),M.pick(-1,-1,0).lo(1,1).hi(E[0]-2,E[1]-2),M.pick(-1,-1,1).lo(1,1).hi(E[0]-2,E[1]-2)),E[1]>2&&(k(T.pick(0,-1).lo(1).hi(E[1]-2),M.pick(0,-1,1).lo(1).hi(E[1]-2)),b(M.pick(0,-1,0).lo(1).hi(E[1]-2))),E[1]>2&&(k(T.pick(E[0]-1,-1).lo(1).hi(E[1]-2),M.pick(E[0]-1,-1,1).lo(1).hi(E[1]-2)),b(M.pick(E[0]-1,-1,0).lo(1).hi(E[1]-2))),E[0]>2&&(k(T.pick(-1,0).lo(1).hi(E[0]-2),M.pick(-1,0,0).lo(1).hi(E[0]-2)),b(M.pick(-1,0,1).lo(1).hi(E[0]-2))),E[0]>2&&(k(T.pick(-1,E[1]-1).lo(1).hi(E[0]-2),M.pick(-1,E[1]-1,0).lo(1).hi(E[0]-2)),b(M.pick(-1,E[1]-1,1).lo(1).hi(E[0]-2))),M.set(0,0,0,0),M.set(0,0,1,0),M.set(E[0]-1,0,0,0),M.set(E[0]-1,0,1,0),M.set(0,E[1]-1,0,0),M.set(0,E[1]-1,1,0),M.set(E[0]-1,E[1]-1,0,0),M.set(E[0]-1,E[1]-1,1,0),M}}l.exports=function(A,b,k){return Array.isArray(k)||(k=i(b.dimension,typeof k=="string"?k:"clamp")),b.size===0?A:b.dimension===0?(A.set(0),A):function(w){var M=w.join();if(P=g[M])return P;for(var T=w.length,E=[y,v],S=1;S<=T;++S)E.push(x(S));var P=_.apply(void 0,E);return g[M]=P,P}(k)(A,b)}},{dup:65}],253:[function(a,l,c){function i(d,m){var p=Math.floor(m),g=m-p,y=0<=p&&p0;){D<64?(b=D,D=0):(b=64,D-=64);for(var O=0|m[1];O>0;){O<64?(k=O,O=0):(k=64,O-=64),y=R+D*M+O*T,_=F+D*S+O*P;var N=0,B=0,W=0,G=E,K=M-w*E,te=T-b*M,Y=L,J=S-w*L,re=P-b*S;for(W=0;W0;){P<64?(b=P,P=0):(b=64,P-=64);for(var L=0|m[0];L>0;){L<64?(A=L,L=0):(A=64,L-=64),y=E+P*w+L*k,_=S+P*T+L*M;var R=0,F=0,D=w,O=k-b*w,N=T,B=M-b*T;for(F=0;F0;){F<64?(k=F,F=0):(k=64,F-=64);for(var D=0|m[0];D>0;){D<64?(A=D,D=0):(A=64,D-=64);for(var O=0|m[1];O>0;){O<64?(b=O,O=0):(b=64,O-=64),y=L+F*T+D*w+O*M,_=R+F*P+D*E+O*S;var N=0,B=0,W=0,G=T,K=w-k*T,te=M-A*w,Y=P,J=E-k*P,re=S-A*E;for(W=0;Wg;){R=0,F=P-_;t:for(L=0;LO)break t;F+=M,R+=T}for(R=P,F=P-_,L=0;L>1,_e=me-le,Ae=me+le,ke=ge,Le=_e,de=me,ve=Ae,Me=fe,we=v+1,Ce=x-1,Fe=!0,ze=0,$e=0,Ke=0,Re=M,Ve=p(Re),We=p(Re);K=b*ke,te=b*Le,ue=A;e:for(G=0;G0){L=ke,ke=Le,Le=L;break e}if(Ke<0)break e;ue+=E}K=b*ve,te=b*Me,ue=A;e:for(G=0;G0){L=ve,ve=Me,Me=L;break e}if(Ke<0)break e;ue+=E}K=b*ke,te=b*de,ue=A;e:for(G=0;G0){L=ke,ke=de,de=L;break e}if(Ke<0)break e;ue+=E}K=b*Le,te=b*de,ue=A;e:for(G=0;G0){L=Le,Le=de,de=L;break e}if(Ke<0)break e;ue+=E}K=b*ke,te=b*ve,ue=A;e:for(G=0;G0){L=ke,ke=ve,ve=L;break e}if(Ke<0)break e;ue+=E}K=b*de,te=b*ve,ue=A;e:for(G=0;G0){L=de,de=ve,ve=L;break e}if(Ke<0)break e;ue+=E}K=b*Le,te=b*Me,ue=A;e:for(G=0;G0){L=Le,Le=Me,Me=L;break e}if(Ke<0)break e;ue+=E}K=b*Le,te=b*de,ue=A;e:for(G=0;G0){L=Le,Le=de,de=L;break e}if(Ke<0)break e;ue+=E}K=b*ve,te=b*Me,ue=A;e:for(G=0;G0){L=ve,ve=Me,Me=L;break e}if(Ke<0)break e;ue+=E}for(K=b*ke,te=b*Le,Y=b*de,J=b*ve,re=b*Me,U=b*ge,V=b*me,H=b*fe,ae=0,ue=A,G=0;G0)){if(Ke<0){for(K=b*O,te=b*we,Y=b*Ce,ue=A,G=0;G0)for(;;){for(N=A+Ce*b,ae=0,G=0;G0)){for(N=A+Ce*b,ae=0,G=0;Gfe){e:for(;;){for(N=A+we*b,ae=0,ue=A,G=0;G1&&k?M(b,k[0],k[1]):M(b)}(m,p,v);return y(v,x)}},{"typedarray-pool":308}],258:[function(a,l,c){var i=a("./lib/compile_sort.js"),s={};l.exports=function(u){var h=u.order,d=u.dtype,m=[h,d].join(":"),p=s[m];return p||(s[m]=p=i(h,d)),p(u),u}},{"./lib/compile_sort.js":257}],259:[function(a,l,c){var i=a("is-buffer"),s=typeof Float64Array<"u";function u(g,y){return g[0]-y[0]}function h(){var g,y=this.stride,v=new Array(y.length);for(g=0;g=0&&(b+=M*(k=0|A),w-=k),new x(this.data,w,M,b)},_.step=function(A){var b=this.shape[0],k=this.stride[0],w=this.offset,M=0,T=Math.ceil;return typeof A=="number"&&((M=0|A)<0?(w+=k*(b-1),b=T(-b/M)):b=T(b/M),k*=M),new x(this.data,b,k,w)},_.transpose=function(A){A=A===void 0?0:0|A;var b=this.shape,k=this.stride;return new x(this.data,b[A],k[A],this.offset)},_.pick=function(A){var b=[],k=[],w=this.offset;return typeof A=="number"&&A>=0?w=w+this.stride[0]*A|0:(b.push(this.shape[0]),k.push(this.stride[0])),(0,y[b.length+1])(this.data,b,k,w)},function(A,b,k,w){return new x(A,b[0],k[0],w)}},2:function(g,y,v){function x(A,b,k,w,M,T){this.data=A,this.shape=[b,k],this.stride=[w,M],this.offset=0|T}var _=x.prototype;return _.dtype=g,_.dimension=2,Object.defineProperty(_,"size",{get:function(){return this.shape[0]*this.shape[1]}}),Object.defineProperty(_,"order",{get:function(){return Math.abs(this.stride[0])>Math.abs(this.stride[1])?[1,0]:[0,1]}}),_.set=function(A,b,k){return g==="generic"?this.data.set(this.offset+this.stride[0]*A+this.stride[1]*b,k):this.data[this.offset+this.stride[0]*A+this.stride[1]*b]=k},_.get=function(A,b){return g==="generic"?this.data.get(this.offset+this.stride[0]*A+this.stride[1]*b):this.data[this.offset+this.stride[0]*A+this.stride[1]*b]},_.index=function(A,b){return this.offset+this.stride[0]*A+this.stride[1]*b},_.hi=function(A,b){return new x(this.data,typeof A!="number"||A<0?this.shape[0]:0|A,typeof b!="number"||b<0?this.shape[1]:0|b,this.stride[0],this.stride[1],this.offset)},_.lo=function(A,b){var k=this.offset,w=0,M=this.shape[0],T=this.shape[1],E=this.stride[0],S=this.stride[1];return typeof A=="number"&&A>=0&&(k+=E*(w=0|A),M-=w),typeof b=="number"&&b>=0&&(k+=S*(w=0|b),T-=w),new x(this.data,M,T,E,S,k)},_.step=function(A,b){var k=this.shape[0],w=this.shape[1],M=this.stride[0],T=this.stride[1],E=this.offset,S=0,P=Math.ceil;return typeof A=="number"&&((S=0|A)<0?(E+=M*(k-1),k=P(-k/S)):k=P(k/S),M*=S),typeof b=="number"&&((S=0|b)<0?(E+=T*(w-1),w=P(-w/S)):w=P(w/S),T*=S),new x(this.data,k,w,M,T,E)},_.transpose=function(A,b){A=A===void 0?0:0|A,b=b===void 0?1:0|b;var k=this.shape,w=this.stride;return new x(this.data,k[A],k[b],w[A],w[b],this.offset)},_.pick=function(A,b){var k=[],w=[],M=this.offset;return typeof A=="number"&&A>=0?M=M+this.stride[0]*A|0:(k.push(this.shape[0]),w.push(this.stride[0])),typeof b=="number"&&b>=0?M=M+this.stride[1]*b|0:(k.push(this.shape[1]),w.push(this.stride[1])),(0,y[k.length+1])(this.data,k,w,M)},function(A,b,k,w){return new x(A,b[0],b[1],k[0],k[1],w)}},3:function(g,y,v){function x(A,b,k,w,M,T,E,S){this.data=A,this.shape=[b,k,w],this.stride=[M,T,E],this.offset=0|S}var _=x.prototype;return _.dtype=g,_.dimension=3,Object.defineProperty(_,"size",{get:function(){return this.shape[0]*this.shape[1]*this.shape[2]}}),Object.defineProperty(_,"order",{get:function(){var A=Math.abs(this.stride[0]),b=Math.abs(this.stride[1]),k=Math.abs(this.stride[2]);return A>b?b>k?[2,1,0]:A>k?[1,2,0]:[1,0,2]:A>k?[2,0,1]:k>b?[0,1,2]:[0,2,1]}}),_.set=function(A,b,k,w){return g==="generic"?this.data.set(this.offset+this.stride[0]*A+this.stride[1]*b+this.stride[2]*k,w):this.data[this.offset+this.stride[0]*A+this.stride[1]*b+this.stride[2]*k]=w},_.get=function(A,b,k){return g==="generic"?this.data.get(this.offset+this.stride[0]*A+this.stride[1]*b+this.stride[2]*k):this.data[this.offset+this.stride[0]*A+this.stride[1]*b+this.stride[2]*k]},_.index=function(A,b,k){return this.offset+this.stride[0]*A+this.stride[1]*b+this.stride[2]*k},_.hi=function(A,b,k){return new x(this.data,typeof A!="number"||A<0?this.shape[0]:0|A,typeof b!="number"||b<0?this.shape[1]:0|b,typeof k!="number"||k<0?this.shape[2]:0|k,this.stride[0],this.stride[1],this.stride[2],this.offset)},_.lo=function(A,b,k){var w=this.offset,M=0,T=this.shape[0],E=this.shape[1],S=this.shape[2],P=this.stride[0],L=this.stride[1],R=this.stride[2];return typeof A=="number"&&A>=0&&(w+=P*(M=0|A),T-=M),typeof b=="number"&&b>=0&&(w+=L*(M=0|b),E-=M),typeof k=="number"&&k>=0&&(w+=R*(M=0|k),S-=M),new x(this.data,T,E,S,P,L,R,w)},_.step=function(A,b,k){var w=this.shape[0],M=this.shape[1],T=this.shape[2],E=this.stride[0],S=this.stride[1],P=this.stride[2],L=this.offset,R=0,F=Math.ceil;return typeof A=="number"&&((R=0|A)<0?(L+=E*(w-1),w=F(-w/R)):w=F(w/R),E*=R),typeof b=="number"&&((R=0|b)<0?(L+=S*(M-1),M=F(-M/R)):M=F(M/R),S*=R),typeof k=="number"&&((R=0|k)<0?(L+=P*(T-1),T=F(-T/R)):T=F(T/R),P*=R),new x(this.data,w,M,T,E,S,P,L)},_.transpose=function(A,b,k){A=A===void 0?0:0|A,b=b===void 0?1:0|b,k=k===void 0?2:0|k;var w=this.shape,M=this.stride;return new x(this.data,w[A],w[b],w[k],M[A],M[b],M[k],this.offset)},_.pick=function(A,b,k){var w=[],M=[],T=this.offset;return typeof A=="number"&&A>=0?T=T+this.stride[0]*A|0:(w.push(this.shape[0]),M.push(this.stride[0])),typeof b=="number"&&b>=0?T=T+this.stride[1]*b|0:(w.push(this.shape[1]),M.push(this.stride[1])),typeof k=="number"&&k>=0?T=T+this.stride[2]*k|0:(w.push(this.shape[2]),M.push(this.stride[2])),(0,y[w.length+1])(this.data,w,M,T)},function(A,b,k,w){return new x(A,b[0],b[1],b[2],k[0],k[1],k[2],w)}},4:function(g,y,v){function x(A,b,k,w,M,T,E,S,P,L){this.data=A,this.shape=[b,k,w,M],this.stride=[T,E,S,P],this.offset=0|L}var _=x.prototype;return _.dtype=g,_.dimension=4,Object.defineProperty(_,"size",{get:function(){return this.shape[0]*this.shape[1]*this.shape[2]*this.shape[3]}}),Object.defineProperty(_,"order",{get:v}),_.set=function(A,b,k,w,M){return g==="generic"?this.data.set(this.offset+this.stride[0]*A+this.stride[1]*b+this.stride[2]*k+this.stride[3]*w,M):this.data[this.offset+this.stride[0]*A+this.stride[1]*b+this.stride[2]*k+this.stride[3]*w]=M},_.get=function(A,b,k,w){return g==="generic"?this.data.get(this.offset+this.stride[0]*A+this.stride[1]*b+this.stride[2]*k+this.stride[3]*w):this.data[this.offset+this.stride[0]*A+this.stride[1]*b+this.stride[2]*k+this.stride[3]*w]},_.index=function(A,b,k,w){return this.offset+this.stride[0]*A+this.stride[1]*b+this.stride[2]*k+this.stride[3]*w},_.hi=function(A,b,k,w){return new x(this.data,typeof A!="number"||A<0?this.shape[0]:0|A,typeof b!="number"||b<0?this.shape[1]:0|b,typeof k!="number"||k<0?this.shape[2]:0|k,typeof w!="number"||w<0?this.shape[3]:0|w,this.stride[0],this.stride[1],this.stride[2],this.stride[3],this.offset)},_.lo=function(A,b,k,w){var M=this.offset,T=0,E=this.shape[0],S=this.shape[1],P=this.shape[2],L=this.shape[3],R=this.stride[0],F=this.stride[1],D=this.stride[2],O=this.stride[3];return typeof A=="number"&&A>=0&&(M+=R*(T=0|A),E-=T),typeof b=="number"&&b>=0&&(M+=F*(T=0|b),S-=T),typeof k=="number"&&k>=0&&(M+=D*(T=0|k),P-=T),typeof w=="number"&&w>=0&&(M+=O*(T=0|w),L-=T),new x(this.data,E,S,P,L,R,F,D,O,M)},_.step=function(A,b,k,w){var M=this.shape[0],T=this.shape[1],E=this.shape[2],S=this.shape[3],P=this.stride[0],L=this.stride[1],R=this.stride[2],F=this.stride[3],D=this.offset,O=0,N=Math.ceil;return typeof A=="number"&&((O=0|A)<0?(D+=P*(M-1),M=N(-M/O)):M=N(M/O),P*=O),typeof b=="number"&&((O=0|b)<0?(D+=L*(T-1),T=N(-T/O)):T=N(T/O),L*=O),typeof k=="number"&&((O=0|k)<0?(D+=R*(E-1),E=N(-E/O)):E=N(E/O),R*=O),typeof w=="number"&&((O=0|w)<0?(D+=F*(S-1),S=N(-S/O)):S=N(S/O),F*=O),new x(this.data,M,T,E,S,P,L,R,F,D)},_.transpose=function(A,b,k,w){A=A===void 0?0:0|A,b=b===void 0?1:0|b,k=k===void 0?2:0|k,w=w===void 0?3:0|w;var M=this.shape,T=this.stride;return new x(this.data,M[A],M[b],M[k],M[w],T[A],T[b],T[k],T[w],this.offset)},_.pick=function(A,b,k,w){var M=[],T=[],E=this.offset;return typeof A=="number"&&A>=0?E=E+this.stride[0]*A|0:(M.push(this.shape[0]),T.push(this.stride[0])),typeof b=="number"&&b>=0?E=E+this.stride[1]*b|0:(M.push(this.shape[1]),T.push(this.stride[1])),typeof k=="number"&&k>=0?E=E+this.stride[2]*k|0:(M.push(this.shape[2]),T.push(this.stride[2])),typeof w=="number"&&w>=0?E=E+this.stride[3]*w|0:(M.push(this.shape[3]),T.push(this.stride[3])),(0,y[M.length+1])(this.data,M,T,E)},function(A,b,k,w){return new x(A,b[0],b[1],b[2],b[3],k[0],k[1],k[2],k[3],w)}},5:function(g,y,v){function x(A,b,k,w,M,T,E,S,P,L,R,F){this.data=A,this.shape=[b,k,w,M,T],this.stride=[E,S,P,L,R],this.offset=0|F}var _=x.prototype;return _.dtype=g,_.dimension=5,Object.defineProperty(_,"size",{get:function(){return this.shape[0]*this.shape[1]*this.shape[2]*this.shape[3]*this.shape[4]}}),Object.defineProperty(_,"order",{get:v}),_.set=function(A,b,k,w,M,T){return g==="generic"?this.data.set(this.offset+this.stride[0]*A+this.stride[1]*b+this.stride[2]*k+this.stride[3]*w+this.stride[4]*M,T):this.data[this.offset+this.stride[0]*A+this.stride[1]*b+this.stride[2]*k+this.stride[3]*w+this.stride[4]*M]=T},_.get=function(A,b,k,w,M){return g==="generic"?this.data.get(this.offset+this.stride[0]*A+this.stride[1]*b+this.stride[2]*k+this.stride[3]*w+this.stride[4]*M):this.data[this.offset+this.stride[0]*A+this.stride[1]*b+this.stride[2]*k+this.stride[3]*w+this.stride[4]*M]},_.index=function(A,b,k,w,M){return this.offset+this.stride[0]*A+this.stride[1]*b+this.stride[2]*k+this.stride[3]*w+this.stride[4]*M},_.hi=function(A,b,k,w,M){return new x(this.data,typeof A!="number"||A<0?this.shape[0]:0|A,typeof b!="number"||b<0?this.shape[1]:0|b,typeof k!="number"||k<0?this.shape[2]:0|k,typeof w!="number"||w<0?this.shape[3]:0|w,typeof M!="number"||M<0?this.shape[4]:0|M,this.stride[0],this.stride[1],this.stride[2],this.stride[3],this.stride[4],this.offset)},_.lo=function(A,b,k,w,M){var T=this.offset,E=0,S=this.shape[0],P=this.shape[1],L=this.shape[2],R=this.shape[3],F=this.shape[4],D=this.stride[0],O=this.stride[1],N=this.stride[2],B=this.stride[3],W=this.stride[4];return typeof A=="number"&&A>=0&&(T+=D*(E=0|A),S-=E),typeof b=="number"&&b>=0&&(T+=O*(E=0|b),P-=E),typeof k=="number"&&k>=0&&(T+=N*(E=0|k),L-=E),typeof w=="number"&&w>=0&&(T+=B*(E=0|w),R-=E),typeof M=="number"&&M>=0&&(T+=W*(E=0|M),F-=E),new x(this.data,S,P,L,R,F,D,O,N,B,W,T)},_.step=function(A,b,k,w,M){var T=this.shape[0],E=this.shape[1],S=this.shape[2],P=this.shape[3],L=this.shape[4],R=this.stride[0],F=this.stride[1],D=this.stride[2],O=this.stride[3],N=this.stride[4],B=this.offset,W=0,G=Math.ceil;return typeof A=="number"&&((W=0|A)<0?(B+=R*(T-1),T=G(-T/W)):T=G(T/W),R*=W),typeof b=="number"&&((W=0|b)<0?(B+=F*(E-1),E=G(-E/W)):E=G(E/W),F*=W),typeof k=="number"&&((W=0|k)<0?(B+=D*(S-1),S=G(-S/W)):S=G(S/W),D*=W),typeof w=="number"&&((W=0|w)<0?(B+=O*(P-1),P=G(-P/W)):P=G(P/W),O*=W),typeof M=="number"&&((W=0|M)<0?(B+=N*(L-1),L=G(-L/W)):L=G(L/W),N*=W),new x(this.data,T,E,S,P,L,R,F,D,O,N,B)},_.transpose=function(A,b,k,w,M){A=A===void 0?0:0|A,b=b===void 0?1:0|b,k=k===void 0?2:0|k,w=w===void 0?3:0|w,M=M===void 0?4:0|M;var T=this.shape,E=this.stride;return new x(this.data,T[A],T[b],T[k],T[w],T[M],E[A],E[b],E[k],E[w],E[M],this.offset)},_.pick=function(A,b,k,w,M){var T=[],E=[],S=this.offset;return typeof A=="number"&&A>=0?S=S+this.stride[0]*A|0:(T.push(this.shape[0]),E.push(this.stride[0])),typeof b=="number"&&b>=0?S=S+this.stride[1]*b|0:(T.push(this.shape[1]),E.push(this.stride[1])),typeof k=="number"&&k>=0?S=S+this.stride[2]*k|0:(T.push(this.shape[2]),E.push(this.stride[2])),typeof w=="number"&&w>=0?S=S+this.stride[3]*w|0:(T.push(this.shape[3]),E.push(this.stride[3])),typeof M=="number"&&M>=0?S=S+this.stride[4]*M|0:(T.push(this.shape[4]),E.push(this.stride[4])),(0,y[T.length+1])(this.data,T,E,S)},function(A,b,k,w){return new x(A,b[0],b[1],b[2],b[3],b[4],k[0],k[1],k[2],k[3],k[4],w)}}};function m(g,y){var v=y===-1?"T":String(y),x=d[v];return y===-1?x(g):y===0?x(g,p[g][0]):x(g,p[g],h)}var p={generic:[],buffer:[],array:[],float32:[],float64:[],int8:[],int16:[],int32:[],uint8_clamped:[],uint8:[],uint16:[],uint32:[],bigint64:[],biguint64:[]};l.exports=function(g,y,v,x){if(g===void 0)return(0,p.array[0])([]);typeof g=="number"&&(g=[g]),y===void 0&&(y=[g.length]);var _=y.length;if(v===void 0){v=new Array(_);for(var A=_-1,b=1;A>=0;--A)v[A]=b,b*=y[A]}if(x===void 0)for(x=0,A=0;A<_;++A)v[A]<0&&(x-=(y[A]-1)*v[A]);for(var k=function(M){if(i(M))return"buffer";if(s)switch(Object.prototype.toString.call(M)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8ClampedArray]":return"uint8_clamped";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object BigInt64Array]":return"bigint64";case"[object BigUint64Array]":return"biguint64"}return Array.isArray(M)?"array":"generic"}(g),w=p[k];w.length<=_+1;)w.push(m(k,w.length-1));return(0,w[_+1])(g,y,v,x)}},{"is-buffer":237}],260:[function(a,l,c){var i=a("double-bits"),s=Math.pow(2,-1074);l.exports=function(u,h){if(isNaN(u)||isNaN(h))return NaN;if(u===h)return u;if(u===0)return h<0?-s:s;var d=i.hi(u),m=i.lo(u);return h>u==u>0?m===-1>>>0?(d+=1,m=0):m+=1:m===0?(m=-1>>>0,d-=1):m-=1,i.pack(m,d)}},{"double-bits":64}],261:[function(a,l,c){c.vertexNormals=function(i,s,u){for(var h=s.length,d=new Array(h),m=u===void 0?1e-6:u,p=0;pm){var P=d[v],L=1/Math.sqrt(M*E);for(S=0;S<3;++S){var R=(S+1)%3,F=(S+2)%3;P[S]+=L*(T[R]*w[F]-T[F]*w[R])}}}for(p=0;pm)for(L=1/Math.sqrt(D),S=0;S<3;++S)P[S]*=L;else for(S=0;S<3;++S)P[S]=0}return d},c.faceNormals=function(i,s,u){for(var h=i.length,d=new Array(h),m=u===void 0?1e-6:u,p=0;pm?1/Math.sqrt(b):0,v=0;v<3;++v)A[v]*=b;d[p]=A}return d}},{}],262:[function(a,l,c){l.exports=function(i,s,u,h,d,m,p,g,y,v){var x=s+m+v;if(_>0){var _=Math.sqrt(x+1);i[0]=.5*(p-y)/_,i[1]=.5*(g-h)/_,i[2]=.5*(u-m)/_,i[3]=.5*_}else{var A=Math.max(s,m,v);_=Math.sqrt(2*A-x+1),s>=A?(i[0]=.5*_,i[1]=.5*(d+u)/_,i[2]=.5*(g+h)/_,i[3]=.5*(p-y)/_):m>=A?(i[0]=.5*(u+d)/_,i[1]=.5*_,i[2]=.5*(y+p)/_,i[3]=.5*(g-h)/_):(i[0]=.5*(h+g)/_,i[1]=.5*(p+y)/_,i[2]=.5*_,i[3]=.5*(u-d)/_)}return i}},{}],263:[function(a,l,c){l.exports=function(x){var _=(x=x||{}).center||[0,0,0],A=x.rotation||[0,0,0,1],b=x.radius||1;_=[].slice.call(_,0,3),g(A=[].slice.call(A,0,4),A);var k=new y(A,_,Math.log(b));return k.setDistanceLimits(x.zoomMin,x.zoomMax),("eye"in x||"up"in x)&&k.lookAt(0,x.eye,x.center,x.up),k};var i=a("filtered-vector"),s=a("gl-mat4/lookAt"),u=a("gl-mat4/fromQuat"),h=a("gl-mat4/invert"),d=a("./lib/quatFromFrame");function m(x,_,A){return Math.sqrt(Math.pow(x,2)+Math.pow(_,2)+Math.pow(A,2))}function p(x,_,A,b){return Math.sqrt(Math.pow(x,2)+Math.pow(_,2)+Math.pow(A,2)+Math.pow(b,2))}function g(x,_){var A=_[0],b=_[1],k=_[2],w=_[3],M=p(A,b,k,w);M>1e-6?(x[0]=A/M,x[1]=b/M,x[2]=k/M,x[3]=w/M):(x[0]=x[1]=x[2]=0,x[3]=1)}function y(x,_,A){this.radius=i([A]),this.center=i(_),this.rotation=i(x),this.computedRadius=this.radius.curve(0),this.computedCenter=this.center.curve(0),this.computedRotation=this.rotation.curve(0),this.computedUp=[.1,0,0],this.computedEye=[.1,0,0],this.computedMatrix=[.1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.recalcMatrix(0)}var v=y.prototype;v.lastT=function(){return Math.max(this.radius.lastT(),this.center.lastT(),this.rotation.lastT())},v.recalcMatrix=function(x){this.radius.curve(x),this.center.curve(x),this.rotation.curve(x);var _=this.computedRotation;g(_,_);var A=this.computedMatrix;u(A,_);var b=this.computedCenter,k=this.computedEye,w=this.computedUp,M=Math.exp(this.computedRadius[0]);k[0]=b[0]+M*A[2],k[1]=b[1]+M*A[6],k[2]=b[2]+M*A[10],w[0]=A[1],w[1]=A[5],w[2]=A[9];for(var T=0;T<3;++T){for(var E=0,S=0;S<3;++S)E+=A[T+4*S]*k[S];A[12+T]=-E}},v.getMatrix=function(x,_){this.recalcMatrix(x);var A=this.computedMatrix;if(_){for(var b=0;b<16;++b)_[b]=A[b];return _}return A},v.idle=function(x){this.center.idle(x),this.radius.idle(x),this.rotation.idle(x)},v.flush=function(x){this.center.flush(x),this.radius.flush(x),this.rotation.flush(x)},v.pan=function(x,_,A,b){_=_||0,A=A||0,b=b||0,this.recalcMatrix(x);var k=this.computedMatrix,w=k[1],M=k[5],T=k[9],E=m(w,M,T);w/=E,M/=E,T/=E;var S=k[0],P=k[4],L=k[8],R=S*w+P*M+L*T,F=m(S-=w*R,P-=M*R,L-=T*R);S/=F,P/=F,L/=F,k[2],k[6],k[10];var D=S*_+w*A,O=P*_+M*A,N=L*_+T*A;this.center.move(x,D,O,N);var B=Math.exp(this.computedRadius[0]);B=Math.max(1e-4,B+b),this.radius.set(x,Math.log(B))},v.rotate=function(x,_,A,b){this.recalcMatrix(x),_=_||0,A=A||0;var k=this.computedMatrix,w=k[0],M=k[4],T=k[8],E=k[1],S=k[5],P=k[9],L=k[2],R=k[6],F=k[10],D=_*w+A*E,O=_*M+A*S,N=_*T+A*P,B=-(R*N-F*O),W=-(F*D-L*N),G=-(L*O-R*D),K=Math.sqrt(Math.max(0,1-Math.pow(B,2)-Math.pow(W,2)-Math.pow(G,2))),te=p(B,W,G,K);te>1e-6?(B/=te,W/=te,G/=te,K/=te):(B=W=G=0,K=1);var Y=this.computedRotation,J=Y[0],re=Y[1],U=Y[2],V=Y[3],H=J*K+V*B+re*G-U*W,ne=re*K+V*W+U*B-J*G,q=U*K+V*G+J*W-re*B,Q=V*K-J*B-re*W-U*G;if(b){B=L,W=R,G=F;var ee=Math.sin(b)/m(B,W,G);B*=ee,W*=ee,G*=ee,Q=Q*(K=Math.cos(_))-(H=H*K+Q*B+ne*G-q*W)*B-(ne=ne*K+Q*W+q*B-H*G)*W-(q=q*K+Q*G+H*W-ne*B)*G}var ie=p(H,ne,q,Q);ie>1e-6?(H/=ie,ne/=ie,q/=ie,Q/=ie):(H=ne=q=0,Q=1),this.rotation.set(x,H,ne,q,Q)},v.lookAt=function(x,_,A,b){this.recalcMatrix(x),A=A||this.computedCenter,_=_||this.computedEye,b=b||this.computedUp;var k=this.computedMatrix;s(k,_,A,b);var w=this.computedRotation;d(w,k[0],k[1],k[2],k[4],k[5],k[6],k[8],k[9],k[10]),g(w,w),this.rotation.set(x,w[0],w[1],w[2],w[3]);for(var M=0,T=0;T<3;++T)M+=Math.pow(A[T]-_[T],2);this.radius.set(x,.5*Math.log(Math.max(M,1e-6))),this.center.set(x,A[0],A[1],A[2])},v.translate=function(x,_,A,b){this.center.move(x,_||0,A||0,b||0)},v.setMatrix=function(x,_){var A=this.computedRotation;d(A,_[0],_[1],_[2],_[4],_[5],_[6],_[8],_[9],_[10]),g(A,A),this.rotation.set(x,A[0],A[1],A[2],A[3]);var b=this.computedMatrix;h(b,_);var k=b[15];if(Math.abs(k)>1e-6){var w=b[12]/k,M=b[13]/k,T=b[14]/k;this.recalcMatrix(x);var E=Math.exp(this.computedRadius[0]);this.center.set(x,w-b[2]*E,M-b[6]*E,T-b[10]*E),this.radius.idle(x)}else this.center.idle(x),this.radius.idle(x)},v.setDistance=function(x,_){_>0&&this.radius.set(x,Math.log(_))},v.setDistanceLimits=function(x,_){x=x>0?Math.log(x):-1/0,_=_>0?Math.log(_):1/0,_=Math.max(_,x),this.radius.bounds[0][0]=x,this.radius.bounds[1][0]=_},v.getDistanceLimits=function(x){var _=this.radius.bounds;return x?(x[0]=Math.exp(_[0][0]),x[1]=Math.exp(_[1][0]),x):[Math.exp(_[0][0]),Math.exp(_[1][0])]},v.toJSON=function(){return this.recalcMatrix(this.lastT()),{center:this.computedCenter.slice(),rotation:this.computedRotation.slice(),distance:Math.log(this.computedRadius[0]),zoomMin:this.radius.bounds[0][0],zoomMax:this.radius.bounds[1][0]}},v.fromJSON=function(x){var _=this.lastT(),A=x.center;A&&this.center.set(_,A[0],A[1],A[2]);var b=x.rotation;b&&this.rotation.set(_,b[0],b[1],b[2],b[3]);var k=x.distance;k&&k>0&&this.radius.set(_,Math.log(k)),this.setDistanceLimits(x.zoomMin,x.zoomMax)}},{"./lib/quatFromFrame":262,"filtered-vector":68,"gl-mat4/fromQuat":95,"gl-mat4/invert":98,"gl-mat4/lookAt":99}],264:[function(a,l,c){var i=a("repeat-string");l.exports=function(s,u,h){return i(h=h!==void 0?h+"":" ",u)+s}},{"repeat-string":277}],265:[function(a,l,c){l.exports=function(i,s){s||(s=[0,""]),i=String(i);var u=parseFloat(i,10);return s[0]=u,s[1]=i.match(/[\d.\-\+]*\s*(.*)/)[1]||"",s}},{}],266:[function(a,l,c){l.exports=function(s,u){for(var h=0|u.length,d=s.length,m=[new Array(h),new Array(h)],p=0;p0){S=m[R][T][0],L=R;break}P=S[1^L];for(var F=0;F<2;++F)for(var D=m[F][T],O=0;O0&&(S=N,P=B,L=F)}return E||S&&v(S,L),P}function _(M,T){var E=m[T][M][0],S=[M];v(E,T);for(var P=E[1^T];;){for(;P!==M;)S.push(P),P=x(S[S.length-2],P,!1);if(m[0][M].length+m[1][M].length===0)break;var L=S[S.length-1],R=M,F=S[1],D=x(L,R,!0);if(i(u[L],u[R],u[F],u[D])<0)break;S.push(M),P=x(L,R)}return S}function A(M,T){return T[1]===T[T.length-1]}for(p=0;p0;){m[0][p].length;var w=_(p,b);A(0,w)?k.push.apply(k,w):(k.length>0&&y.push(k),k=w)}k.length>0&&y.push(k)}return y};var i=a("compare-angle")},{"compare-angle":54}],267:[function(a,l,c){l.exports=function(s,u){for(var h=i(s,u.length),d=new Array(u.length),m=new Array(u.length),p=[],g=0;g0;){var v=p.pop();d[v]=!1;var x=h[v];for(g=0;g0})).length,M=new Array(w),T=new Array(w);for(b=0;b0;){var ne=V.pop(),q=W[ne];m(q,function(le,ge){return le-ge});var Q,ee=q.length,ie=H[ne];if(ie===0){var ae=k[ne];Q=[ae]}for(b=0;b=0||(H[ue]=1^ie,V.push(ue),ie===0&&(U(ae=k[ue])||(ae.reverse(),Q.push(ae))))}ie===0&&x.push(Q)}return x};var i=a("edges-to-adjacency-list"),s=a("planar-dual"),u=a("point-in-big-polygon"),h=a("two-product"),d=a("robust-sum"),m=a("uniq"),p=a("./lib/trim-leaves");function g(y,v){for(var x=new Array(y),_=0;_0&&R[D]===F[0]))return 1;O=L[D-1]}for(var N=1;O;){var B=O.key,W=i(F,B[0],B[1]);if(B[0][0]0))return 0;N=-1,O=O.right}else if(W>0)O=O.left;else{if(!(W<0))return 0;N=1,O=O.right}}return N}}(S.slabs,S.coordinates);return x.length===0?P:function(L,R){return function(F){return L(F[0],F[1])?0:R(F)}}(m(x),P)};var i=a("robust-orientation")[3],s=a("slab-decomposition"),u=a("interval-tree-1d"),h=a("binary-search-bounds");function d(){return!0}function m(g){for(var y={},v=0;v=v?(D=1,E=v+2*A+k):E=A*(D=-A/v)+k):(D=0,b>=0?(O=0,E=k):-b>=_?(O=1,E=_+2*b+k):E=b*(O=-b/_)+k);else if(O<0)O=0,A>=0?(D=0,E=k):-A>=v?(D=1,E=v+2*A+k):E=A*(D=-A/v)+k;else{var N=1/F;E=(D*=N)*(v*D+x*(O*=N)+2*A)+O*(x*D+_*O+2*b)+k}else D<0?(P=_+b)>(S=x+A)?(L=P-S)>=(R=v-2*x+_)?(D=1,O=0,E=v+2*A+k):E=(D=L/R)*(v*D+x*(O=1-D)+2*A)+O*(x*D+_*O+2*b)+k:(D=0,P<=0?(O=1,E=_+2*b+k):b>=0?(O=0,E=k):E=b*(O=-b/_)+k):O<0?(P=v+A)>(S=x+b)?(L=P-S)>=(R=v-2*x+_)?(O=1,D=0,E=_+2*b+k):E=(D=1-(O=L/R))*(v*D+x*O+2*A)+O*(x*D+_*O+2*b)+k:(O=0,P<=0?(D=1,E=v+2*A+k):A>=0?(D=0,E=k):E=A*(D=-A/v)+k):(L=_+b-x-A)<=0?(D=0,O=1,E=_+2*b+k):L>=(R=v-2*x+_)?(D=1,O=0,E=v+2*A+k):E=(D=L/R)*(v*D+x*(O=1-D)+2*A)+O*(x*D+_*O+2*b)+k;var B=1-D-O;for(y=0;y0){var v=h[m-1];if(i(g,v)===0&&u(v)!==y){m-=1;continue}}h[m++]=g}}return h.length=m,h}},{"cell-orientation":47,"compare-cell":56,"compare-oriented-cell":57}],277:[function(a,l,c){var i,s="";l.exports=function(u,h){if(typeof u!="string")throw new TypeError("expected a string");if(h===1)return u;if(h===2)return u+u;var d=u.length*h;if(i!==u||i===void 0)i=u,s="";else if(s.length>=d)return s.substr(0,d);for(;d>s.length&&h>1;)1&h&&(s+=u),h>>=1,u+=u;return s=(s+=u).substr(0,d)}},{}],278:[function(a,l,c){(function(i){(function(){l.exports=i.performance&&i.performance.now?function(){return performance.now()}:Date.now||function(){return+new Date}}).call(this)}).call(this,r!==void 0?r:typeof self<"u"?self:typeof window<"u"?window:{})},{}],279:[function(a,l,c){l.exports=function(i){for(var s=i.length,u=i[i.length-1],h=s,d=s-2;d>=0;--d){var m=u,p=i[d];(y=p-((u=m+p)-m))&&(i[--h]=u,u=y)}var g=0;for(d=h;d0){if(E<=0)return S;M=T+E}else{if(!(T<0)||E>=0)return S;M=-(T+E)}var P=33306690738754716e-32*M;return S>=P||S<=-P?S:y(b,k,w)},function(b,k,w,M){var T=b[0]-M[0],E=k[0]-M[0],S=w[0]-M[0],P=b[1]-M[1],L=k[1]-M[1],R=w[1]-M[1],F=b[2]-M[2],D=k[2]-M[2],O=w[2]-M[2],N=E*R,B=S*L,W=S*P,G=T*R,K=T*L,te=E*P,Y=F*(N-B)+D*(W-G)+O*(K-te),J=7771561172376103e-31*((Math.abs(N)+Math.abs(B))*Math.abs(F)+(Math.abs(W)+Math.abs(G))*Math.abs(D)+(Math.abs(K)+Math.abs(te))*Math.abs(O));return Y>J||-Y>J?Y:v(b,k,w,M)}];function _(b){var k=x[b.length];return k||(k=x[b.length]=g(b.length)),k.apply(void 0,b)}function A(b,k,w,M,T,E,S){return function(P,L,R,F,D){switch(arguments.length){case 0:case 1:return 0;case 2:return M(P,L);case 3:return T(P,L,R);case 4:return E(P,L,R,F);case 5:return S(P,L,R,F,D)}for(var O=new Array(arguments.length),N=0;N0&&p>0||m<0&&p<0)return!1;var g=i(h,s,u),y=i(d,s,u);return g>0&&y>0||g<0&&y<0?!1:m===0&&p===0&&g===0&&y===0?function(v,x,_,A){for(var b=0;b<2;++b){var k=v[b],w=x[b],M=Math.min(k,w),T=Math.max(k,w),E=_[b],S=A[b],P=Math.min(E,S);if(Math.max(E,S)=h?(d=_,(y+=1)=h?(d=_,(y+=1)>1,_=h[2*x+1];if(_===g)return x;g<_?v=x:y=x+1}return y}return function(u,h,d,m){for(var p=u.length,g=[],y=0;y>1,_=h[2*x+1];if(_===g)return x;g<_?v=x:y=x+1}return y}return function(u,h,d,m){for(var p=u.length,g=[],y=0;y>1,_=h[2*x+1];if(_===g)return x;g<_?v=x:y=x+1}return y}return function(u,h,d,m){for(var p=u.length,g=[],y=0;y>1,w=u(v[k],x);w<=0?(w===0&&(b=k),_=k+1):w>0&&(A=k-1)}return b}function g(v,x){for(var _=new Array(v.length),A=0,b=_.length;A=v.length||u(v[R],k)!==0););}return _}function y(v,x){if(x<0)return[];for(var _=[],A=(1<>>E&1&&T.push(b[E]);x.push(T)}return d(x)},c.skeleton=y,c.boundary=function(v){for(var x=[],_=0,A=v.length;_>1:(te>>1)-1}function S(te){for(var Y=T(te);;){var J=Y,re=2*te+1,U=2*(te+1),V=te;if(re0;){var J=E(te);if(J>=0&&Y0){var te=D[0];return M(0,N-1),N-=1,S(0),te}return-1}function R(te,Y){var J=D[te];return v[J]===Y?te:(v[J]=-1/0,P(te),L(),v[J]=Y,P((N+=1)-1))}function F(te){if(!x[te]){x[te]=!0;var Y=g[te],J=y[te];g[J]>=0&&(g[J]=Y),y[Y]>=0&&(y[Y]=J),O[Y]>=0&&R(O[Y],w(Y)),O[J]>=0&&R(O[J],w(J))}}var D=[],O=new Array(m);for(_=0;_>1;_>=0;--_)S(_);for(;;){var B=L();if(B<0||v[B]>d)break;F(B)}var W=[];for(_=0;_=0&&J>=0&&Y!==J){var re=O[Y],U=O[J];re!==U&&K.push([re,U])}}),s.unique(s.normalize(K)),{positions:W,edges:K}};var i=a("robust-orientation"),s=a("simplicial-complex")},{"robust-orientation":284,"simplicial-complex":295}],298:[function(a,l,c){l.exports=function(u,h){var d,m,p,g;if(h[0][0]h[1][0]))return s(h,u);d=h[1],m=h[0]}if(u[0][0]u[1][0]))return-s(u,h);p=u[1],g=u[0]}var y=i(d,m,g),v=i(d,m,p);if(y<0){if(v<=0)return y}else if(y>0){if(v>=0)return y}else if(v)return v;if(y=i(g,p,m),v=i(g,p,d),y<0){if(v<=0)return y}else if(y>0){if(v>=0)return y}else if(v)return v;return m[0]-g[0]};var i=a("robust-orientation");function s(u,h){var d,m,p,g;if(h[0][0]h[1][0])){var y=Math.min(u[0][1],u[1][1]),v=Math.max(u[0][1],u[1][1]),x=Math.min(h[0][1],h[1][1]),_=Math.max(h[0][1],h[1][1]);return v_?y-_:v-_}d=h[1],m=h[0]}u[0][1]0)if(x[0]!==k[1][0])_=v,v=v.right;else{if(M=p(v.right,x))return M;v=v.left}else{if(x[0]!==k[1][0])return v;var M;if(M=p(v.right,x))return M;v=v.left}}return _}function g(v,x,_,A){this.y=v,this.index=x,this.start=_,this.closed=A}function y(v,x,_,A){this.x=v,this.segment=x,this.create=_,this.index=A}d.prototype.castUp=function(v){var x=i.le(this.coordinates,v[0]);if(x<0)return-1;this.slabs[x];var _=p(this.slabs[x],v),A=-1;if(_&&(A=_.value),this.coordinates[x]===v[0]){var b=null;if(_&&(b=_.key),x>0){var k=p(this.slabs[x-1],v);k&&(b?h(k.key,b)>0&&(b=k.key,A=k.value):(A=k.value,b=k.key))}var w=this.horizontal[x];if(w.length>0){var M=i.ge(w,v[1],m);if(M=w.length)return A;T=w[M]}}if(T.start)if(b){var E=u(b[0],b[1],[v[0],T.y]);b[0][0]>b[1][0]&&(E=-E),E>0&&(A=T.index)}else A=T.index;else T.y!==v[1]&&(A=T.index)}}}return A}},{"./lib/order-segments":298,"binary-search-bounds":31,"functional-red-black-tree":69,"robust-orientation":284}],300:[function(a,l,c){var i=a("robust-dot-product"),s=a("robust-sum");function u(d,m){var p=s(i(d,m),[m[m.length-1]]);return p[p.length-1]}function h(d,m,p,g){var y=-m/(g-m);y<0?y=0:y>1&&(y=1);for(var v=1-y,x=d.length,_=new Array(x),A=0;A0||y>0&&A<0){var b=h(v,A,x,y);p.push(b),g.push(b.slice())}A<0?g.push(x.slice()):A>0?p.push(x.slice()):(p.push(x.slice()),g.push(x.slice())),y=A}return{positive:p,negative:g}},l.exports.positive=function(d,m){for(var p=[],g=u(d[d.length-1],m),y=d[d.length-1],v=d[0],x=0;x0||g>0&&_<0)&&p.push(h(y,_,v,g)),_>=0&&p.push(v.slice()),g=_}return p},l.exports.negative=function(d,m){for(var p=[],g=u(d[d.length-1],m),y=d[d.length-1],v=d[0],x=0;x0||g>0&&_<0)&&p.push(h(y,_,v,g)),_<=0&&p.push(v.slice()),g=_}return p}},{"robust-dot-product":281,"robust-sum":289}],301:[function(a,l,c){(function(){var i={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function s(p){return h(m(p),arguments)}function u(p,g){return s.apply(null,[p].concat(g||[]))}function h(p,g){var y,v,x,_,A,b,k,w,M,T=1,E=p.length,S="";for(v=0;v=0),_.type){case"b":y=parseInt(y,10).toString(2);break;case"c":y=String.fromCharCode(parseInt(y,10));break;case"d":case"i":y=parseInt(y,10);break;case"j":y=JSON.stringify(y,null,_.width?parseInt(_.width):0);break;case"e":y=_.precision?parseFloat(y).toExponential(_.precision):parseFloat(y).toExponential();break;case"f":y=_.precision?parseFloat(y).toFixed(_.precision):parseFloat(y);break;case"g":y=_.precision?String(Number(y.toPrecision(_.precision))):parseFloat(y);break;case"o":y=(parseInt(y,10)>>>0).toString(8);break;case"s":y=String(y),y=_.precision?y.substring(0,_.precision):y;break;case"t":y=String(!!y),y=_.precision?y.substring(0,_.precision):y;break;case"T":y=Object.prototype.toString.call(y).slice(8,-1).toLowerCase(),y=_.precision?y.substring(0,_.precision):y;break;case"u":y=parseInt(y,10)>>>0;break;case"v":y=y.valueOf(),y=_.precision?y.substring(0,_.precision):y;break;case"x":y=(parseInt(y,10)>>>0).toString(16);break;case"X":y=(parseInt(y,10)>>>0).toString(16).toUpperCase()}i.json.test(_.type)?S+=y:(!i.number.test(_.type)||w&&!_.sign?M="":(M=w?"+":"-",y=y.toString().replace(i.sign,"")),b=_.pad_char?_.pad_char==="0"?"0":_.pad_char.charAt(1):" ",k=_.width-(M+y).length,A=_.width&&k>0?b.repeat(k):"",S+=_.align?M+y+A:b==="0"?M+A+y:A+M+y)}return S}var d=Object.create(null);function m(p){if(d[p])return d[p];for(var g,y=p,v=[],x=0;y;){if((g=i.text.exec(y))!==null)v.push(g[0]);else if((g=i.modulo.exec(y))!==null)v.push("%");else{if((g=i.placeholder.exec(y))===null)throw new SyntaxError("[sprintf] unexpected placeholder");if(g[2]){x|=1;var _=[],A=g[2],b=[];if((b=i.key.exec(A))===null)throw new SyntaxError("[sprintf] failed to parse named argument key");for(_.push(b[1]);(A=A.substring(b[0].length))!=="";)if((b=i.key_access.exec(A))!==null)_.push(b[1]);else{if((b=i.index_access.exec(A))===null)throw new SyntaxError("[sprintf] failed to parse named argument key");_.push(b[1])}g[2]=_}else x|=2;if(x===3)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");v.push({placeholder:g[0],param_no:g[1],keys:g[2],sign:g[3],pad_char:g[4],align:g[5],width:g[6],precision:g[7],type:g[8]})}y=y.substring(g[0].length)}return d[p]=v}c!==void 0&&(c.sprintf=s,c.vsprintf=u),typeof window<"u"&&(window.sprintf=s,window.vsprintf=u)})()},{}],302:[function(a,l,c){l.exports=function(d,m){if(d.dimension<=0)return{positions:[],cells:[]};if(d.dimension===1)return function(y,v){for(var x=s(y,v),_=x.length,A=new Array(_),b=new Array(_),k=0;k<_;++k)A[k]=[x[k]],b[k]=[k];return{positions:A,cells:b}}(d,m);var p=d.order.join()+"-"+d.dtype,g=h[p];return m=+m||0,g||(g=h[p]=function(y,v){var x=y.length+"d",_=u[x];if(_)return _(i,y,v)}(d.order,d.dtype)),g(d,m)};var i=a("ndarray-extract-contour"),s=a("zero-crossings"),u={"2d":function(d,m,p){var g=d({order:m,scalarArguments:3,getters:p==="generic"?[0]:void 0,phase:function(y,v,x,_){return y>_|0},vertex:function(y,v,x,_,A,b,k,w,M,T,E,S,P){var L=(k<<0)+(w<<1)+(M<<2)+(T<<3)|0;if(L!==0&&L!==15)switch(L){case 0:E.push([y-.5,v-.5]);break;case 1:E.push([y-.25-.25*(_+x-2*P)/(x-_),v-.25-.25*(A+x-2*P)/(x-A)]);break;case 2:E.push([y-.75-.25*(-_-x+2*P)/(_-x),v-.25-.25*(b+_-2*P)/(_-b)]);break;case 3:E.push([y-.5,v-.5-.5*(A+x+b+_-4*P)/(x-A+_-b)]);break;case 4:E.push([y-.25-.25*(b+A-2*P)/(A-b),v-.75-.25*(-A-x+2*P)/(A-x)]);break;case 5:E.push([y-.5-.5*(_+x+b+A-4*P)/(x-_+A-b),v-.5]);break;case 6:E.push([y-.5-.25*(-_-x+b+A)/(_-x+A-b),v-.5-.25*(-A-x+b+_)/(A-x+_-b)]);break;case 7:E.push([y-.75-.25*(b+A-2*P)/(A-b),v-.75-.25*(b+_-2*P)/(_-b)]);break;case 8:E.push([y-.75-.25*(-b-A+2*P)/(b-A),v-.75-.25*(-b-_+2*P)/(b-_)]);break;case 9:E.push([y-.5-.25*(_+x+-b-A)/(x-_+b-A),v-.5-.25*(A+x+-b-_)/(x-A+b-_)]);break;case 10:E.push([y-.5-.5*(-_-x-b-A+4*P)/(_-x+b-A),v-.5]);break;case 11:E.push([y-.25-.25*(-b-A+2*P)/(b-A),v-.75-.25*(A+x-2*P)/(x-A)]);break;case 12:E.push([y-.5,v-.5-.5*(-A-x-b-_+4*P)/(A-x+b-_)]);break;case 13:E.push([y-.75-.25*(_+x-2*P)/(x-_),v-.25-.25*(-b-_+2*P)/(b-_)]);break;case 14:E.push([y-.25-.25*(-_-x+2*P)/(_-x),v-.25-.25*(-A-x+2*P)/(A-x)]);break;case 15:E.push([y-.5,v-.5])}},cell:function(y,v,x,_,A,b,k,w,M){A?w.push([y,v]):w.push([v,y])}});return function(y,v){var x=[],_=[];return g(y,x,_,v),{positions:x,cells:_}}}},h={}},{"ndarray-extract-contour":251,"zero-crossings":318}],303:[function(a,l,c){(function(i){(function(){l.exports=function d(m,p,g){g=g||{};var y=h[m];y||(y=h[m]={" ":{data:new Float32Array(0),shape:.2}});var v=y[p];if(!v)if(p.length<=1||!/\d/.test(p))v=y[p]=function(P){for(var L=P.cells,R=P.positions,F=new Float32Array(6*L.length),D=0,O=0,N=0;N0&&(b+=.02);var w=new Float32Array(A),M=0,T=-.5*b;for(k=0;k<_.length;++k){for(var E=_[k].data,S=0;SMath.max(k,w)?M[2]=1:k>Math.max(b,w)?M[0]=1:M[1]=1;for(var T=0,E=0,S=0;S<3;++S)T+=A[S]*A[S],E+=M[S]*A[S];for(S=0;S<3;++S)M[S]-=E/T*A[S];return d(M,M),M}function v(A,b,k,w,M,T,E,S){this.center=i(k),this.up=i(w),this.right=i(M),this.radius=i([T]),this.angle=i([E,S]),this.angle.bounds=[[-1/0,-Math.PI/2],[1/0,Math.PI/2]],this.setDistanceLimits(A,b),this.computedCenter=this.center.curve(0),this.computedUp=this.up.curve(0),this.computedRight=this.right.curve(0),this.computedRadius=this.radius.curve(0),this.computedAngle=this.angle.curve(0),this.computedToward=[0,0,0],this.computedEye=[0,0,0],this.computedMatrix=new Array(16);for(var P=0;P<16;++P)this.computedMatrix[P]=.5;this.recalcMatrix(0)}var x=v.prototype;x.setDistanceLimits=function(A,b){A=A>0?Math.log(A):-1/0,b=b>0?Math.log(b):1/0,b=Math.max(b,A),this.radius.bounds[0][0]=A,this.radius.bounds[1][0]=b},x.getDistanceLimits=function(A){var b=this.radius.bounds[0];return A?(A[0]=Math.exp(b[0][0]),A[1]=Math.exp(b[1][0]),A):[Math.exp(b[0][0]),Math.exp(b[1][0])]},x.recalcMatrix=function(A){this.center.curve(A),this.up.curve(A),this.right.curve(A),this.radius.curve(A),this.angle.curve(A);for(var b=this.computedUp,k=this.computedRight,w=0,M=0,T=0;T<3;++T)M+=b[T]*k[T],w+=b[T]*b[T];var E=Math.sqrt(w),S=0;for(T=0;T<3;++T)k[T]-=b[T]*M/w,S+=k[T]*k[T],b[T]/=E;var P=Math.sqrt(S);for(T=0;T<3;++T)k[T]/=P;var L=this.computedToward;h(L,b,k),d(L,L);var R=Math.exp(this.computedRadius[0]),F=this.computedAngle[0],D=this.computedAngle[1],O=Math.cos(F),N=Math.sin(F),B=Math.cos(D),W=Math.sin(D),G=this.computedCenter,K=O*B,te=N*B,Y=W,J=-O*W,re=-N*W,U=B,V=this.computedEye,H=this.computedMatrix;for(T=0;T<3;++T){var ne=K*k[T]+te*L[T]+Y*b[T];H[4*T+1]=J*k[T]+re*L[T]+U*b[T],H[4*T+2]=ne,H[4*T+3]=0}var q=H[1],Q=H[5],ee=H[9],ie=H[2],ae=H[6],ue=H[10],le=Q*ue-ee*ae,ge=ee*ie-q*ue,fe=q*ae-Q*ie,me=p(le,ge,fe);for(le/=me,ge/=me,fe/=me,H[0]=le,H[4]=ge,H[8]=fe,T=0;T<3;++T)V[T]=G[T]+H[2+4*T]*R;for(T=0;T<3;++T){S=0;for(var _e=0;_e<3;++_e)S+=H[T+4*_e]*V[_e];H[12+T]=-S}H[15]=1},x.getMatrix=function(A,b){this.recalcMatrix(A);var k=this.computedMatrix;if(b){for(var w=0;w<16;++w)b[w]=k[w];return b}return k};var _=[0,0,0];x.rotate=function(A,b,k,w){if(this.angle.move(A,b,k),w){this.recalcMatrix(A);var M=this.computedMatrix;_[0]=M[2],_[1]=M[6],_[2]=M[10];for(var T=this.computedUp,E=this.computedRight,S=this.computedToward,P=0;P<3;++P)M[4*P]=T[P],M[4*P+1]=E[P],M[4*P+2]=S[P];for(u(M,M,w,_),P=0;P<3;++P)T[P]=M[4*P],E[P]=M[4*P+1];this.up.set(A,T[0],T[1],T[2]),this.right.set(A,E[0],E[1],E[2])}},x.pan=function(A,b,k,w){b=b||0,k=k||0,w=w||0,this.recalcMatrix(A);var M=this.computedMatrix,T=(Math.exp(this.computedRadius[0]),M[1]),E=M[5],S=M[9],P=p(T,E,S);T/=P,E/=P,S/=P;var L=M[0],R=M[4],F=M[8],D=L*T+R*E+F*S,O=p(L-=T*D,R-=E*D,F-=S*D),N=(L/=O)*b+T*k,B=(R/=O)*b+E*k,W=(F/=O)*b+S*k;this.center.move(A,N,B,W);var G=Math.exp(this.computedRadius[0]);G=Math.max(1e-4,G+w),this.radius.set(A,Math.log(G))},x.translate=function(A,b,k,w){this.center.move(A,b||0,k||0,w||0)},x.setMatrix=function(A,b,k,w){var M=1;typeof k=="number"&&(M=0|k),(M<0||M>3)&&(M=1);var T=(M+2)%3;b||(this.recalcMatrix(A),b=this.computedMatrix);var E=b[M],S=b[M+4],P=b[M+8];if(w){var L=Math.abs(E),R=Math.abs(S),F=Math.abs(P),D=Math.max(L,R,F);L===D?(E=E<0?-1:1,S=P=0):F===D?(P=P<0?-1:1,E=S=0):(S=S<0?-1:1,E=P=0)}else{var O=p(E,S,P);E/=O,S/=O,P/=O}var N,B,W=b[T],G=b[T+4],K=b[T+8],te=W*E+G*S+K*P,Y=p(W-=E*te,G-=S*te,K-=P*te),J=S*(K/=Y)-P*(G/=Y),re=P*(W/=Y)-E*K,U=E*G-S*W,V=p(J,re,U);if(J/=V,re/=V,U/=V,this.center.jump(A,de,ve,Me),this.radius.idle(A),this.up.jump(A,E,S,P),this.right.jump(A,W,G,K),M===2){var H=b[1],ne=b[5],q=b[9],Q=H*W+ne*G+q*K,ee=H*J+ne*re+q*U;N=le<0?-Math.PI/2:Math.PI/2,B=Math.atan2(ee,Q)}else{var ie=b[2],ae=b[6],ue=b[10],le=ie*E+ae*S+ue*P,ge=ie*W+ae*G+ue*K,fe=ie*J+ae*re+ue*U;N=Math.asin(g(le)),B=Math.atan2(fe,ge)}this.angle.jump(A,B,N),this.recalcMatrix(A);var me=b[2],_e=b[6],Ae=b[10],ke=this.computedMatrix;s(ke,b);var Le=ke[15],de=ke[12]/Le,ve=ke[13]/Le,Me=ke[14]/Le,we=Math.exp(this.computedRadius[0]);this.center.jump(A,de-me*we,ve-_e*we,Me-Ae*we)},x.lastT=function(){return Math.max(this.center.lastT(),this.up.lastT(),this.right.lastT(),this.radius.lastT(),this.angle.lastT())},x.idle=function(A){this.center.idle(A),this.up.idle(A),this.right.idle(A),this.radius.idle(A),this.angle.idle(A)},x.flush=function(A){this.center.flush(A),this.up.flush(A),this.right.flush(A),this.radius.flush(A),this.angle.flush(A)},x.setDistance=function(A,b){b>0&&this.radius.set(A,Math.log(b))},x.lookAt=function(A,b,k,w){this.recalcMatrix(A),b=b||this.computedEye,k=k||this.computedCenter;var M=(w=w||this.computedUp)[0],T=w[1],E=w[2],S=p(M,T,E);if(!(S<1e-6)){M/=S,T/=S,E/=S;var P=b[0]-k[0],L=b[1]-k[1],R=b[2]-k[2],F=p(P,L,R);if(!(F<1e-6)){P/=F,L/=F,R/=F;var D=this.computedRight,O=D[0],N=D[1],B=D[2],W=M*O+T*N+E*B,G=p(O-=W*M,N-=W*T,B-=W*E);if(!(G<.01&&(G=p(O=T*R-E*L,N=E*P-M*R,B=M*L-T*P))<1e-6)){O/=G,N/=G,B/=G,this.up.set(A,M,T,E),this.right.set(A,O,N,B),this.center.set(A,k[0],k[1],k[2]),this.radius.set(A,Math.log(F));var K=T*B-E*N,te=E*O-M*B,Y=M*N-T*O,J=p(K,te,Y),re=M*P+T*L+E*R,U=O*P+N*L+B*R,V=(K/=J)*P+(te/=J)*L+(Y/=J)*R,H=Math.asin(g(re)),ne=Math.atan2(V,U),q=this.angle._state,Q=q[q.length-1],ee=q[q.length-2];Q%=2*Math.PI;var ie=Math.abs(Q+2*Math.PI-ne),ae=Math.abs(Q-ne),ue=Math.abs(Q-2*Math.PI-ne);ie0?B.pop():new ArrayBuffer(O)}function A(O){return new Uint8Array(_(O),0,O)}function b(O){return new Uint16Array(_(2*O),0,O)}function k(O){return new Uint32Array(_(4*O),0,O)}function w(O){return new Int8Array(_(O),0,O)}function M(O){return new Int16Array(_(2*O),0,O)}function T(O){return new Int32Array(_(4*O),0,O)}function E(O){return new Float32Array(_(4*O),0,O)}function S(O){return new Float64Array(_(8*O),0,O)}function P(O){return d?new Uint8ClampedArray(_(O),0,O):A(O)}function L(O){return m?new BigUint64Array(_(8*O),0,O):null}function R(O){return p?new BigInt64Array(_(8*O),0,O):null}function F(O){return new DataView(_(O),0,O)}function D(O){O=s.nextPow2(O);var N=s.log2(O),B=v[N];return B.length>0?B.pop():new h(O)}c.free=function(O){if(h.isBuffer(O))v[s.log2(O.length)].push(O);else{if(Object.prototype.toString.call(O)!=="[object ArrayBuffer]"&&(O=O.buffer),!O)return;var N=O.length||O.byteLength,B=0|s.log2(N);y[B].push(O)}},c.freeUint8=c.freeUint16=c.freeUint32=c.freeBigUint64=c.freeInt8=c.freeInt16=c.freeInt32=c.freeBigInt64=c.freeFloat32=c.freeFloat=c.freeFloat64=c.freeDouble=c.freeUint8Clamped=c.freeDataView=function(O){x(O.buffer)},c.freeArrayBuffer=x,c.freeBuffer=function(O){v[s.log2(O.length)].push(O)},c.malloc=function(O,N){if(N===void 0||N==="arraybuffer")return _(O);switch(N){case"uint8":return A(O);case"uint16":return b(O);case"uint32":return k(O);case"int8":return w(O);case"int16":return M(O);case"int32":return T(O);case"float":case"float32":return E(O);case"double":case"float64":return S(O);case"uint8_clamped":return P(O);case"bigint64":return R(O);case"biguint64":return L(O);case"buffer":return D(O);case"data":case"dataview":return F(O);default:return null}return null},c.mallocArrayBuffer=_,c.mallocUint8=A,c.mallocUint16=b,c.mallocUint32=k,c.mallocInt8=w,c.mallocInt16=M,c.mallocInt32=T,c.mallocFloat32=c.mallocFloat=E,c.mallocFloat64=c.mallocDouble=S,c.mallocUint8Clamped=P,c.mallocBigUint64=L,c.mallocBigInt64=R,c.mallocDataView=F,c.mallocBuffer=D,c.clearCache=function(){for(var O=0;O<32;++O)g.UINT8[O].length=0,g.UINT16[O].length=0,g.UINT32[O].length=0,g.INT8[O].length=0,g.INT16[O].length=0,g.INT32[O].length=0,g.FLOAT[O].length=0,g.DOUBLE[O].length=0,g.BIGUINT64[O].length=0,g.BIGINT64[O].length=0,g.UINT8C[O].length=0,y[O].length=0,v[O].length=0}}).call(this)}).call(this,r!==void 0?r:typeof self<"u"?self:typeof window<"u"?window:{})},{"bit-twiddle":32,buffer:3,dup:65}],309:[function(a,l,c){function i(u){this.roots=new Array(u),this.ranks=new Array(u);for(var h=0;h0&&(k=b.size),b.lineSpacing&&b.lineSpacing>0&&(w=b.lineSpacing),b.styletags&&b.styletags.breaklines&&(M.breaklines=!!b.styletags.breaklines),b.styletags&&b.styletags.bolds&&(M.bolds=!!b.styletags.bolds),b.styletags&&b.styletags.italics&&(M.italics=!!b.styletags.italics),b.styletags&&b.styletags.subscripts&&(M.subscripts=!!b.styletags.subscripts),b.styletags&&b.styletags.superscripts&&(M.superscripts=!!b.styletags.superscripts)),A.font=[b.fontStyle,b.fontVariant,b.fontWeight,k+"px",b.font].filter(function(T){return T}).join(" "),A.textAlign="start",A.textBaseline="alphabetic",A.direction="ltr",v(function(T,E,S,P,L,R){S=S.replace(/\n/g,""),S=R.breaklines===!0?S.replace(/\/g,` -`):S.replace(/\/g," ");var F="",D=[];for(W=0;W-1?parseInt(_e[1+Le]):0,Me=de>-1?parseInt(Ae[1+de]):0;ve!==Me&&(ke=ke.replace(ie(),"?px "),te*=Math.pow(.75,Me-ve),ke=ke.replace("?px ",ie())),K+=.25*re*(Me-ve)}if(R.superscripts===!0){var we=_e.indexOf("+"),Ce=Ae.indexOf("+"),Fe=we>-1?parseInt(_e[1+we]):0,ze=Ce>-1?parseInt(Ae[1+Ce]):0;Fe!==ze&&(ke=ke.replace(ie(),"?px "),te*=Math.pow(.75,ze-Fe),ke=ke.replace("?px ",ie())),K-=.25*re*(ze-Fe)}if(R.bolds===!0){var $e=_e.indexOf("b|")>-1,Ke=Ae.indexOf("b|")>-1;!$e&&Ke&&(ke=Re?ke.replace("italic ","italic bold "):"bold "+ke),$e&&!Ke&&(ke=ke.replace("bold ",""))}if(R.italics===!0){var Re=_e.indexOf("i|")>-1,Ve=Ae.indexOf("i|")>-1;!Re&&Ve&&(ke="italic "+ke),Re&&!Ve&&(ke=ke.replace("italic ",""))}E.font=ke}for(B=0;B",w="",M=k.length,T=w.length,E=_[0]==="+"||_[0]==="-",S=0,P=-T;S>-1&&(S=A.indexOf(k,S))!==-1&&(P=A.indexOf(w,S+M))!==-1&&!(P<=S);){for(var L=S;L=P)b[L]=null,A=A.substr(0,L)+" "+A.substr(L+1);else if(b[L]!==null){var R=b[L].indexOf(_[0]);R===-1?b[L]+=_:E&&(b[L]=b[L].substr(0,R+1)+(1+parseInt(b[L][R+1]))+b[L].substr(R+2))}var F=S+M,D=A.substr(F,P-F).indexOf(k);S=D!==-1?D:P+T}return b}function g(x,_){var A=i(x,128);return _?u(A.cells,A.positions,.25):{edges:A.cells,positions:A.positions}}function y(x,_,A,b){var k=g(x,b),w=function(B,W,G){for(var K=W.textAlign||"start",te=W.textBaseline||"alphabetic",Y=[1<<30,1<<30],J=[0,0],re=B.length,U=0;U"u"||!ses.ok||ses.ok()){typeof ses<"u"&&(ses.weakMapPermitHostObjects=k);var i=!1;if(typeof WeakMap=="function"){var s=WeakMap;if(!(typeof navigator<"u"&&/Firefox/.test(navigator.userAgent))){var u=new s,h=Object.freeze({});if(u.set(h,1),u.get(h)===1)return void(l.exports=WeakMap);i=!0}}var d=Object.getOwnPropertyNames,m=Object.defineProperty,p=Object.isExtensible,g="weakmap:ident:"+Math.random()+"___";if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function"&&typeof ArrayBuffer=="function"&&typeof Uint8Array=="function"){var y=new ArrayBuffer(25),v=new Uint8Array(y);crypto.getRandomValues(v),g="weakmap:rand:"+Array.prototype.map.call(v,function(S){return(S%36).toString(36)}).join("")+"___"}if(m(Object,"getOwnPropertyNames",{value:function(S){return d(S).filter(w)}}),"getPropertyNames"in Object){var x=Object.getPropertyNames;m(Object,"getPropertyNames",{value:function(S){return x(S).filter(w)}})}(function(){var S=Object.freeze;m(Object,"freeze",{value:function(R){return M(R),S(R)}});var P=Object.seal;m(Object,"seal",{value:function(R){return M(R),P(R)}});var L=Object.preventExtensions;m(Object,"preventExtensions",{value:function(R){return M(R),L(R)}})})();var _=!1,A=0,b=function(){this instanceof b||E();var S=[],P=[],L=A++;return Object.create(b.prototype,{get___:{value:T(function(R,F){var D,O=M(R);return O?L in O?O[L]:F:(D=S.indexOf(R))>=0?P[D]:F})},has___:{value:T(function(R){var F=M(R);return F?L in F:S.indexOf(R)>=0})},set___:{value:T(function(R,F){var D,O=M(R);return O?O[L]=F:(D=S.indexOf(R))>=0?P[D]=F:(D=S.length,P[D]=F,S[D]=R),this})},delete___:{value:T(function(R){var F,D,O=M(R);return O?L in O&&delete O[L]:!((F=S.indexOf(R))<0)&&(D=S.length-1,S[F]=void 0,P[F]=P[D],S[F]=S[D],S.length=D,P.length=D,!0)})}})};b.prototype=Object.create(Object.prototype,{get:{value:function(S,P){return this.get___(S,P)},writable:!0,configurable:!0},has:{value:function(S){return this.has___(S)},writable:!0,configurable:!0},set:{value:function(S,P){return this.set___(S,P)},writable:!0,configurable:!0},delete:{value:function(S){return this.delete___(S)},writable:!0,configurable:!0}}),typeof s=="function"?function(){function S(){this instanceof b||E();var P,L=new s,R=void 0,F=!1;return P=i?function(D,O){return L.set(D,O),L.has(D)||(R||(R=new b),R.set(D,O)),this}:function(D,O){if(F)try{L.set(D,O)}catch{R||(R=new b),R.set___(D,O)}else L.set(D,O);return this},Object.create(b.prototype,{get___:{value:T(function(D,O){return R?L.has(D)?L.get(D):R.get___(D,O):L.get(D,O)})},has___:{value:T(function(D){return L.has(D)||!!R&&R.has___(D)})},set___:{value:T(P)},delete___:{value:T(function(D){var O=!!L.delete(D);return R&&R.delete___(D)||O})},permitHostObjects___:{value:T(function(D){if(D!==k)throw new Error("bogus call to permitHostObjects___");F=!0})}})}i&&typeof Proxy<"u"&&(Proxy=void 0),S.prototype=b.prototype,l.exports=S,Object.defineProperty(WeakMap.prototype,"constructor",{value:WeakMap,enumerable:!1,configurable:!0,writable:!0})}():(typeof Proxy<"u"&&(Proxy=void 0),l.exports=b)}function k(S){S.permitHostObjects___&&S.permitHostObjects___(k)}function w(S){return!(S.substr(0,8)=="weakmap:"&&S.substr(S.length-3)==="___")}function M(S){if(S!==Object(S))throw new TypeError("Not an object: "+S);var P=S[g];if(P&&P.key===S)return P;if(p(S)){P={key:S};try{return m(S,g,{value:P,writable:!1,enumerable:!1,configurable:!1}),P}catch{return}}}function T(S){return S.prototype=null,Object.freeze(S)}function E(){_||typeof console>"u"||(_=!0,console.warn("WeakMap should be invoked as new WeakMap(), not WeakMap(). This will be an error in the future."))}})()},{}],314:[function(a,l,c){var i=a("./hidden-store.js");l.exports=function(){var s={};return function(u){if((typeof u!="object"||u===null)&&typeof u!="function")throw new Error("Weakmap-shim: Key must be object");var h=u.valueOf(s);return h&&h.identity===s?h:i(u,s)}}},{"./hidden-store.js":315}],315:[function(a,l,c){l.exports=function(i,s){var u={identity:s},h=i.valueOf;return Object.defineProperty(i,"valueOf",{value:function(d){return d!==s?h.apply(this,arguments):u},writable:!0}),u}},{}],316:[function(a,l,c){var i=a("./create-store.js");l.exports=function(){var s=i();return{get:function(u,h){var d=s(u);return d.hasOwnProperty("value")?d.value:h},set:function(u,h){return s(u).value=h,this},has:function(u){return"value"in s(u)},delete:function(u){return delete s(u).value}}}},{"./create-store.js":314}],317:[function(a,l,c){var i,s=function(){return function(u,h,d,m,p,g){var y=u[0],v=d[0],x=[0],_=v;m|=0;var A=0,b=v;for(A=0;A=0!=w>=0&&p.push(x[0]+.5+.5*(k+w)/(k-w)),m+=b,++x[0]}}};l.exports=(i={funcName:"zeroCrossings"},function(u){var h={};return function(d,m,p){var g=d.dtype,y=d.order,v=[g,y.join()].join(),x=h[v];return x||(h[v]=x=u([g,y])),x(d.shape.slice(0),d.data,d.stride,0|d.offset,m,p)}}(s.bind(void 0,i)))},{}],318:[function(a,l,c){l.exports=function(s,u){var h=[];return u=+u||0,i(s.hi(s.shape[0]-1),h,u),h};var i=a("./lib/zc-core")},{"./lib/zc-core":317}]},{},[6])(6)})}).call(this)}).call(this,typeof jo<"u"?jo:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[27])(27)})})(SI);var MY=SI.exports;const EY=Wv(MY);/*! - * https://github.com/Starcounter-Jack/JSON-Patch - * (c) 2017-2022 Joachim Wester - * MIT licensed - */var SY=globalThis&&globalThis.__extends||function(){var e=function(n,t){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,f){o.__proto__=f}||function(o,f){for(var r in f)f.hasOwnProperty(r)&&(o[r]=f[r])},e(n,t)};return function(n,t){e(n,t);function o(){this.constructor=n}n.prototype=t===null?Object.create(t):(o.prototype=t.prototype,new o)}}(),CY=Object.prototype.hasOwnProperty;function NA(e,n){return CY.call(e,n)}function BA(e){if(Array.isArray(e)){for(var n=new Array(e.length),t=0;t=48&&o<=57){n++;continue}return!1}return!0}function a0(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function CI(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function UA(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var n=0,t=e.length;n0&&c[s-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(t&&h===void 0&&(i[d]===void 0?h=c.slice(0,s).join("/"):s==u-1&&(h=n.path),h!==void 0&&m(n,0,e,h)),s++,Array.isArray(i)){if(d==="-")d=i.length;else{if(t&&!jA(d))throw new ws("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",r,n,e);jA(d)&&(d=~~d)}if(s>=u){if(t&&n.op==="add"&&d>i.length)throw new ws("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",r,n,e);var a=DY[n.op].call(n,i,d,e);if(a.test===!1)throw new ws("Test operation failed","TEST_OPERATION_FAILED",r,n,e);return a}}else if(s>=u){var a=um[n.op].call(n,i,d,e);if(a.test===!1)throw new ws("Test operation failed","TEST_OPERATION_FAILED",r,n,e);return a}if(i=i[d],t&&s0)throw new ws('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",n,e,t);if((e.op==="move"||e.op==="copy")&&typeof e.from!="string")throw new ws("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",n,e,t);if((e.op==="add"||e.op==="replace"||e.op==="test")&&e.value===void 0)throw new ws("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",n,e,t);if((e.op==="add"||e.op==="replace"||e.op==="test")&&UA(e.value))throw new ws("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",n,e,t);if(t){if(e.op=="add"){var f=e.path.split("/").length,r=o.split("/").length;if(f!==r+1&&f!==r)throw new ws("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",n,e,t)}else if(e.op==="replace"||e.op==="remove"||e.op==="_get"){if(e.path!==o)throw new ws("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",n,e,t)}else if(e.op==="move"||e.op==="copy"){var a={op:"_get",path:e.from,value:void 0},l=DI([a],t);if(l&&l.name==="OPERATION_PATH_UNRESOLVABLE")throw new ws("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",n,e,t)}}}else throw new ws("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",n,e,t)}function DI(e,n,t){try{if(!Array.isArray(e))throw new ws("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(n)Aw(oc(n),oc(e),t||!0);else{t=t||R2;for(var o=0;o0&&(e.patches=[],e.callback&&e.callback(o)),o}function KT(e,n,t,o,f){if(n!==e){typeof n.toJSON=="function"&&(n=n.toJSON());for(var r=BA(n),a=BA(e),l=!1,c=a.length-1;c>=0;c--){var i=a[c],s=e[i];if(NA(n,i)&&!(n[i]===void 0&&s!==void 0&&Array.isArray(n)===!1)){var u=n[i];typeof s=="object"&&s!=null&&typeof u=="object"&&u!=null&&Array.isArray(s)===Array.isArray(u)?KT(s,u,t,o+"/"+a0(i),f):s!==u&&(f&&t.push({op:"test",path:o+"/"+a0(i),value:oc(s)}),t.push({op:"replace",path:o+"/"+a0(i),value:oc(u)}))}else Array.isArray(e)===Array.isArray(n)?(f&&t.push({op:"test",path:o+"/"+a0(i),value:oc(s)}),t.push({op:"remove",path:o+"/"+a0(i)}),l=!0):(f&&t.push({op:"test",path:o,value:e}),t.push({op:"replace",path:o,value:n}))}if(!(!l&&r.length==a.length))for(var c=0;c0)return[x,o+h.join(`, -`+y),s].join(` -`+c)}return _}(n,"",0)};const u4=Wv(qY);function od(e,n,t){return e.fields=n||[],e.fname=t,e}function HY(e){return e==null?null:e.fname}function OI(e){return e==null?null:e.fields}function PI(e){return e.length===1?GY(e[0]):WY(e)}const GY=e=>function(n){return n[e]},WY=e=>{const n=e.length;return function(t){for(let o=0;oa?i():a=l+1:c==="["?(l>a&&i(),f=a=l+1):c==="]"&&(f||l2("Access path missing open bracket: "+e),f>0&&i(),f=0,a=l+1)}return f&&l2("Access path missing closing bracket: "+e),o&&l2("Access path missing closing quote: "+e),l>a&&(l++,i()),n}function e6(e,n,t){const o=QT(e);return e=o.length===1?o[0]:e,od((t&&t.get||PI)(o),[e],n||e)}const YY=e6("id"),t6=od(e=>e,[],"identity"),XY=od(()=>0,[],"zero"),ZY=od(()=>1,[],"one"),JY=od(()=>!0,[],"true"),KY=od(()=>!1,[],"false");function QY(e,n,t){const o=[n].concat([].slice.call(t));console[e].apply(console,o)}const II=0,FI=1,RI=2,zI=3,NI=4;function eX(e,n,t=QY){let o=e||II;return{level(f){return arguments.length?(o=+f,this):o},error(){return o>=FI&&t(n||"error","ERROR",arguments),this},warn(){return o>=RI&&t(n||"warn","WARN",arguments),this},info(){return o>=zI&&t(n||"log","INFO",arguments),this},debug(){return o>=NI&&t(n||"log","DEBUG",arguments),this}}}var a1=Array.isArray;function rp(e){return e===Object(e)}const n7=e=>e!=="__proto__";function n6(...e){return e.reduce((n,t)=>{for(const o in t)if(o==="signals")n.signals=tX(n.signals,t.signals);else{const f=o==="legend"?{layout:1}:o==="style"?!0:null;Xv(n,o,t[o],f)}return n},{})}function Xv(e,n,t,o){if(!n7(n))return;let f,r;if(rp(t)&&!a1(t)){r=rp(e[n])?e[n]:e[n]={};for(f in t)o&&(o===!0||o[f])?Xv(r,f,t[f]):n7(f)&&(r[f]=t[f])}else e[n]=t}function tX(e,n){if(e==null)return n;const t={},o=[];function f(r){t[r.name]||(t[r.name]=1,o.push(r))}return n.forEach(f),e.forEach(f),o}function o1(e){return e[e.length-1]}function r6(e){return e==null||e===""?null:+e}const BI=e=>n=>e*Math.exp(n),jI=e=>n=>Math.log(e*n),UI=e=>n=>Math.sign(n)*Math.log1p(Math.abs(n/e)),$I=e=>n=>Math.sign(n)*Math.expm1(Math.abs(n))*e,z2=e=>n=>n<0?-Math.pow(-n,e):Math.pow(n,e);function kw(e,n,t,o){const f=t(e[0]),r=t(o1(e)),a=(r-f)*n;return[o(f-a),o(r-a)]}function nX(e,n){return kw(e,n,r6,t6)}function rX(e,n){var t=Math.sign(e[0]);return kw(e,n,jI(t),BI(t))}function iX(e,n,t){return kw(e,n,z2(t),z2(1/t))}function aX(e,n,t){return kw(e,n,UI(t),$I(t))}function Tw(e,n,t,o,f){const r=o(e[0]),a=o(o1(e)),l=n!=null?o(n):(r+a)/2;return[f(l+(r-l)*t),f(l+(a-l)*t)]}function oX(e,n,t){return Tw(e,n,t,r6,t6)}function sX(e,n,t){const o=Math.sign(e[0]);return Tw(e,n,t,jI(o),BI(o))}function lX(e,n,t,o){return Tw(e,n,t,z2(o),z2(1/o))}function uX(e,n,t,o){return Tw(e,n,t,UI(o),$I(o))}function cX(e){return 1+~~(new Date(e).getMonth()/3)}function fX(e){return 1+~~(new Date(e).getUTCMonth()/3)}function dv(e){return e!=null?a1(e)?e:[e]:[]}function hX(e,n,t){let o=e[0],f=e[1],r;return f=t-n?[n,t]:[o=Math.min(Math.max(o,n),t-r),o+r]}function Mw(e){return typeof e=="function"}const dX="descending";function pX(e,n,t){t=t||{},n=dv(n)||[];const o=[],f=[],r={},a=t.comparator||gX;return dv(e).forEach((l,c)=>{l!=null&&(o.push(n[c]===dX?-1:1),f.push(l=Mw(l)?l:e6(l,null,t)),(OI(l)||[]).forEach(i=>r[i]=1))}),f.length===0?null:od(a(f,o),Object.keys(r))}const i6=(e,n)=>(en||n==null)&&e!=null?1:(n=n instanceof Date?+n:n,(e=e instanceof Date?+e:e)!==e&&n===n?-1:n!==n&&e===e?1:0),gX=(e,n)=>e.length===1?mX(e[0],n[0]):yX(e,n,e.length),mX=(e,n)=>function(t,o){return i6(e(t),e(o))*n},yX=(e,n,t)=>(n.push(0),function(o,f){let r,a=0,l=-1;for(;a===0&&++le}function xX(e,n){let t;return o=>{t&&clearTimeout(t),t=setTimeout(()=>(n(o),t=null),e)}}function a6(e){for(let n,t,o=1,f=arguments.length;oa&&(a=f))}else{for(f=n(e[t]);ta&&(a=f))}return[r,a]}function _X(e,n){const t=e.length;let o=-1,f,r,a,l,c;if(n==null){for(;++o=r){f=a=r;break}if(o===t)return[-1,-1];for(l=c=o;++or&&(f=r,l=o),a=r){f=a=r;break}if(o===t)return[-1,-1];for(l=c=o;++or&&(f=r,l=o),a{f.set(r,e[r])}),f}function kX(e,n,t,o,f,r){if(!t&&t!==0)return r;const a=+t;let l=e[0],c=o1(e),i;cr&&(a=f,f=r,r=a),t=t===void 0||t,o=o===void 0||o,(t?f<=e:fl.replace(/\\(.)/g,"$1")):dv(e));const o=e&&e.length,f=t&&t.get||PI,r=l=>f(n?[l]:QT(l));let a;if(!o)a=function(){return""};else if(o===1){const l=r(e[0]);a=function(c){return""+l(c)}}else{const l=e.map(r);a=function(c){let i=""+l[0](c),s=0;for(;++s{n={},t={},o=0},r=(a,l)=>(++o>e&&(t=n,n={},o=1),n[a]=l);return f(),{clear:f,has:a=>l0(n,a)||l0(t,a),get:a=>l0(n,a)?n[a]:l0(t,a)?r(a,t[a]):void 0,set:(a,l)=>l0(n,a)?n[a]=l:r(a,l)}}function PX(e,n,t,o){const f=n.length,r=t.length;if(!r)return n;if(!f)return t;const a=o||new n.constructor(f+r);let l=0,c=0,i=0;for(;l0?t[c++]:n[l++];for(;l=0;)t+=e;return t}function IX(e,n,t,o){const f=t||" ",r=e+"",a=n-r.length;return a<=0?r:o==="left"?Ay(f,a)+r:o==="center"?Ay(f,~~(a/2))+r+Ay(f,Math.ceil(a/2)):r+Ay(f,a)}function FX(e){return e&&o1(e)-e[0]||0}function GI(e){return a1(e)?"["+e.map(GI)+"]":rp(e)||Qf(e)?JSON.stringify(e).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):e}function RX(e){return e==null||e===""?null:!e||e==="false"||e==="0"?!1:!!e}const zX=e=>HI(e)||qI(e)?e:Date.parse(e);function NX(e,n){return n=n||zX,e==null||e===""?null:n(e)}function BX(e){return e==null||e===""?null:e+""}function jX(e){const n={},t=e.length;for(let o=0;ofunction(n){return n[e]},qX=e=>{const n=e.length;return function(t){for(let o=0;oa?i():a=l+1:c==="["?(l>a&&i(),f=a=l+1):c==="]"&&(f||Pr("Access path missing open bracket: "+e),f>0&&i(),f=0,a=l+1)}return f&&Pr("Access path missing closing bracket: "+e),o&&Pr("Access path missing closing quote: "+e),l>a&&(l++,i()),n}function uc(e,n,t){const o=sd(e);return e=o.length===1?o[0]:e,gc((t&&t.get||WI)(o),[e],n||e)}const Ew=uc("id"),xu=gc(e=>e,[],"identity"),u0=gc(()=>0,[],"zero"),Zv=gc(()=>1,[],"one"),yf=gc(()=>!0,[],"true"),Gp=gc(()=>!1,[],"false");function HX(e,n,t){const o=[n].concat([].slice.call(t));console[e].apply(console,o)}const GX=0,YI=1,XI=2,WX=3,YX=4;function ZI(e,n){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:HX,o=e||GX;return{level(f){return arguments.length?(o=+f,this):o},error(){return o>=YI&&t(n||"error","ERROR",arguments),this},warn(){return o>=XI&&t(n||"warn","WARN",arguments),this},info(){return o>=WX&&t(n||"log","INFO",arguments),this},debug(){return o>=YX&&t(n||"log","DEBUG",arguments),this}}}var zr=Array.isArray;function Si(e){return e===Object(e)}const r7=e=>e!=="__proto__";function o6(){for(var e=arguments.length,n=new Array(e),t=0;t{for(const r in f)if(r==="signals")o.signals=XX(o.signals,f.signals);else{const a=r==="legend"?{layout:1}:r==="style"?!0:null;s6(o,r,f[r],a)}return o},{})}function s6(e,n,t,o){if(!r7(n))return;let f,r;if(Si(t)&&!zr(t)){r=Si(e[n])?e[n]:e[n]={};for(f in t)o&&(o===!0||o[f])?s6(r,f,t[f]):r7(f)&&(r[f]=t[f])}else e[n]=t}function XX(e,n){if(e==null)return n;const t={},o=[];function f(r){t[r.name]||(t[r.name]=1,o.push(r))}return n.forEach(f),e.forEach(f),o}function qa(e){return e[e.length-1]}function pu(e){return e==null||e===""?null:+e}const JI=e=>n=>e*Math.exp(n),KI=e=>n=>Math.log(e*n),QI=e=>n=>Math.sign(n)*Math.log1p(Math.abs(n/e)),eF=e=>n=>Math.sign(n)*Math.expm1(Math.abs(n))*e,N2=e=>n=>n<0?-Math.pow(-n,e):Math.pow(n,e);function Sw(e,n,t,o){const f=t(e[0]),r=t(qa(e)),a=(r-f)*n;return[o(f-a),o(r-a)]}function ZX(e,n){return Sw(e,n,pu,xu)}function JX(e,n){var t=Math.sign(e[0]);return Sw(e,n,KI(t),JI(t))}function KX(e,n,t){return Sw(e,n,N2(t),N2(1/t))}function QX(e,n,t){return Sw(e,n,QI(t),eF(t))}function Cw(e,n,t,o,f){const r=o(e[0]),a=o(qa(e)),l=n!=null?o(n):(r+a)/2;return[f(l+(r-l)*t),f(l+(a-l)*t)]}function tF(e,n,t){return Cw(e,n,t,pu,xu)}function nF(e,n,t){const o=Math.sign(e[0]);return Cw(e,n,t,KI(o),JI(o))}function VA(e,n,t,o){return Cw(e,n,t,N2(o),N2(1/o))}function rF(e,n,t,o){return Cw(e,n,t,QI(o),eF(o))}function eZ(e){return 1+~~(new Date(e).getMonth()/3)}function tZ(e){return 1+~~(new Date(e).getUTCMonth()/3)}function Ti(e){return e!=null?zr(e)?e:[e]:[]}function nZ(e,n,t){let o=e[0],f=e[1],r;return f=t-n?[n,t]:[o=Math.min(Math.max(o,n),t-r),o+r]}function xa(e){return typeof e=="function"}const rZ="descending";function iF(e,n,t){t=t||{},n=Ti(n)||[];const o=[],f=[],r={},a=t.comparator||iZ;return Ti(e).forEach((l,c)=>{l!=null&&(o.push(n[c]===rZ?-1:1),f.push(l=xa(l)?l:uc(l,null,t)),(mu(l)||[]).forEach(i=>r[i]=1))}),f.length===0?null:gc(a(f,o),Object.keys(r))}const l6=(e,n)=>(en||n==null)&&e!=null?1:(n=n instanceof Date?+n:n,(e=e instanceof Date?+e:e)!==e&&n===n?-1:n!==n&&e===e?1:0),iZ=(e,n)=>e.length===1?aZ(e[0],n[0]):oZ(e,n,e.length),aZ=(e,n)=>function(t,o){return l6(e(t),e(o))*n},oZ=(e,n,t)=>(n.push(0),function(o,f){let r,a=0,l=-1;for(;a===0&&++le}function aF(e,n){let t;return o=>{t&&clearTimeout(t),t=setTimeout(()=>(n(o),t=null),e)}}function Ea(e){for(let n,t,o=1,f=arguments.length;oa&&(a=f))}else{for(f=n(e[t]);ta&&(a=f))}return[r,a]}function sZ(e,n){const t=e.length;let o=-1,f,r,a,l,c;if(n==null){for(;++o=r){f=a=r;break}if(o===t)return[-1,-1];for(l=c=o;++or&&(f=r,l=o),a=r){f=a=r;break}if(o===t)return[-1,-1];for(l=c=o;++or&&(f=r,l=o),a{f.set(r,e[r])}),f}function uZ(e,n,t,o,f,r){if(!t&&t!==0)return r;const a=+t;let l=e[0],c=qa(e),i;cr&&(a=f,f=r,r=a),t=t===void 0||t,o=o===void 0||o,(t?f<=e:fl.replace(/\\(.)/g,"$1")):Ti(e));const o=e&&e.length,f=t&&t.get||WI,r=l=>f(n?[l]:sd(l));let a;if(!o)a=function(){return""};else if(o===1){const l=r(e[0]);a=function(c){return""+l(c)}}else{const l=e.map(r);a=function(c){let i=""+l[0](c),s=0;for(;++s{n={},t={},o=0},r=(a,l)=>(++o>e&&(t=n,n={},o=1),n[a]=l);return f(),{clear:f,has:a=>Yi(n,a)||Yi(t,a),get:a=>Yi(n,a)?n[a]:Yi(t,a)?r(a,t[a]):void 0,set:(a,l)=>Yi(n,a)?n[a]=l:r(a,l)}}function gZ(e,n,t,o){const f=n.length,r=t.length;if(!r)return n;if(!f)return t;const a=o||new n.constructor(f+r);let l=0,c=0,i=0;for(;l0?t[c++]:n[l++];for(;l=0;)t+=e;return t}function mZ(e,n,t,o){const f=t||" ",r=e+"",a=n-r.length;return a<=0?r:o==="left"?Tb(f,a)+r:o==="center"?Tb(f,~~(a/2))+r+Tb(f,Math.ceil(a/2)):r+Tb(f,a)}function Lw(e){return e&&qa(e)-e[0]||0}function ri(e){return zr(e)?"["+e.map(ri)+"]":Si(e)||Li(e)?JSON.stringify(e).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):e}function sF(e){return e==null||e===""?null:!e||e==="false"||e==="0"?!1:!!e}const yZ=e=>Eo(e)||_0(e)?e:Date.parse(e);function lF(e,n){return n=n||yZ,e==null||e===""?null:n(e)}function uF(e){return e==null||e===""?null:e+""}function sh(e){const n={},t=e.length;for(let o=0;o1)o=MZ(e,n,t);else for(f=0,o=new Array(r=e.arcs.length);f=a&&(o=a-f,f+=o/++t,r+=o*(a-f));else{let a=-1;for(let l of e)(l=n(l,++a,e))!=null&&(l=+l)>=l&&(o=l-f,f+=o/++t,r+=o*(l-f))}if(t>1)return r/(t-1)}function SZ(e,n){const t=EZ(e,n);return t&&Math.sqrt(t)}class yu{constructor(){this._partials=new Float64Array(32),this._n=0}add(n){const t=this._partials;let o=0;for(let f=0;f0){for(a=n[--t];t>0&&(o=a,f=n[--t],a=o+f,r=f-(a-o),!r););t>0&&(r<0&&n[t-1]<0||r>0&&n[t-1]>0)&&(f=r*2,o=a+f,f==o-a&&(a=o))}return a}}class a7 extends Map{constructor(n,t=dF){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),n!=null)for(const[o,f]of n)this.set(o,f)}get(n){return super.get(qA(this,n))}has(n){return super.has(qA(this,n))}set(n,t){return super.set(fF(this,n),t)}delete(n){return super.delete(hF(this,n))}}class B2 extends Set{constructor(n,t=dF){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),n!=null)for(const o of n)this.add(o)}has(n){return super.has(qA(this,n))}add(n){return super.add(fF(this,n))}delete(n){return super.delete(hF(this,n))}}function qA({_intern:e,_key:n},t){const o=n(t);return e.has(o)?e.get(o):t}function fF({_intern:e,_key:n},t){const o=n(t);return e.has(o)?e.get(o):(e.set(o,t),t)}function hF({_intern:e,_key:n},t){const o=n(t);return e.has(o)&&(t=e.get(o),e.delete(o)),t}function dF(e){return e!==null&&typeof e=="object"?e.valueOf():e}function CZ(e,n){return Array.from(n,t=>e[t])}function LZ(e=fv){if(e===fv)return pF;if(typeof e!="function")throw new TypeError("compare is not a function");return(n,t)=>{const o=e(n,t);return o||o===0?o:(e(t,t)===0)-(e(n,n)===0)}}function pF(e,n){return(e==null||!(e>=e))-(n==null||!(n>=n))||(en?1:0)}function w0(e,n){let t;if(n===void 0)for(const o of e)o!=null&&(t=o)&&(t=o);else{let o=-1;for(let f of e)(f=n(f,++o,e))!=null&&(t=f)&&(t=f)}return t}function HA(e,n){let t;if(n===void 0)for(const o of e)o!=null&&(t>o||t===void 0&&o>=o)&&(t=o);else{let o=-1;for(let f of e)(f=n(f,++o,e))!=null&&(t>f||t===void 0&&f>=f)&&(t=f)}return t}function gF(e,n,t=0,o=e.length-1,f){for(f=f===void 0?pF:LZ(f);o>t;){if(o-t>600){const c=o-t+1,i=n-t+1,s=Math.log(c),u=.5*Math.exp(2*s/3),h=.5*Math.sqrt(s*u*(c-u)/c)*(i-c/2<0?-1:1),d=Math.max(t,Math.floor(n-i*u/c+h)),m=Math.min(o,Math.floor(n+(c-i)*u/c+h));gF(e,n,d,m,f)}const r=e[n];let a=t,l=o;for(K1(e,t,n),f(e[o],r)>0&&K1(e,t,o);a0;)--l}f(e[t],r)===0?K1(e,t,l):(++l,K1(e,l,o)),l<=n&&(t=l+1),n<=l&&(o=l-1)}return e}function K1(e,n,t){const o=e[n];e[n]=e[t],e[t]=o}function GA(e,n,t){if(e=Float64Array.from(KW(e,t)),!!(o=e.length)){if((n=+n)<=0||o<2)return HA(e);if(n>=1)return w0(e);var o,f=(o-1)*n,r=Math.floor(f),a=w0(gF(e,r).subarray(0,r+1)),l=HA(e.subarray(r+1));return a+(l-a)*(f-r)}}function mF(e,n,t=QW){if(o=e.length){if((n=+n)<=0||o<2)return+t(e[0],0,e);if(n>=1)return+t(e[o-1],o-1,e);var o,f=(o-1)*n,r=Math.floor(f),a=+t(e[r],r,e),l=+t(e[r+1],r+1,e);return a+(l-a)*(f-r)}}function DZ(e,n){let t=0,o=0;if(n===void 0)for(let f of e)f!=null&&(f=+f)>=f&&(++t,o+=f);else{let f=-1;for(let r of e)(r=n(r,++f,e))!=null&&(r=+r)>=r&&(++t,o+=r)}if(t)return o/t}function yF(e,n){return GA(e,.5,n)}function*OZ(e){for(const n of e)yield*n}function vF(e){return Array.from(OZ(e))}function sc(e,n,t){e=+e,n=+n,t=(f=arguments.length)<2?(n=e,e=0,1):f<3?1:+t;for(var o=-1,f=Math.max(0,Math.ceil((n-e)/t))|0,r=new Array(f);++o0))return c;do c.push(i=new Date(+r)),n(r,l),e(r);while(i=a)for(;e(a),!r(a);)a.setTime(a-1)},function(a,l){if(a>=a)if(l<0)for(;++l<=0;)for(;n(a,-1),!r(a););else for(;--l>=0;)for(;n(a,1),!r(a););})},t&&(f.count=function(r,a){return c4.setTime(+r),f4.setTime(+a),e(c4),e(f4),Math.floor(t(c4,f4))},f.every=function(r){return r=Math.floor(r),!isFinite(r)||!(r>0)?null:r>1?f.filter(o?function(a){return o(a)%r===0}:function(a){return f.count(0,a)%r===0}):f}),f}var j2=yl(function(){},function(e,n){e.setTime(+e+n)},function(e,n){return n-e});j2.every=function(e){return e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?yl(function(n){n.setTime(Math.floor(n/e)*e)},function(n,t){n.setTime(+n+t*e)},function(n,t){return(t-n)/e}):j2};const u6=j2;j2.range;const qh=1e3,wc=qh*60,Hh=wc*60,O0=Hh*24,c6=O0*7,o7=O0*30,h4=O0*365;var bF=yl(function(e){e.setTime(e-e.getMilliseconds())},function(e,n){e.setTime(+e+n*qh)},function(e,n){return(n-e)/qh},function(e){return e.getUTCSeconds()});const zd=bF;bF.range;var _F=yl(function(e){e.setTime(e-e.getMilliseconds()-e.getSeconds()*qh)},function(e,n){e.setTime(+e+n*wc)},function(e,n){return(n-e)/wc},function(e){return e.getMinutes()});const f6=_F;_F.range;var wF=yl(function(e){e.setTime(e-e.getMilliseconds()-e.getSeconds()*qh-e.getMinutes()*wc)},function(e,n){e.setTime(+e+n*Hh)},function(e,n){return(n-e)/Hh},function(e){return e.getHours()});const h6=wF;wF.range;var AF=yl(e=>e.setHours(0,0,0,0),(e,n)=>e.setDate(e.getDate()+n),(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*wc)/O0,e=>e.getDate()-1);const Zd=AF;AF.range;function tg(e){return yl(function(n){n.setDate(n.getDate()-(n.getDay()+7-e)%7),n.setHours(0,0,0,0)},function(n,t){n.setDate(n.getDate()+t*7)},function(n,t){return(t-n-(t.getTimezoneOffset()-n.getTimezoneOffset())*wc)/c6})}var l1=tg(0),U2=tg(1),RZ=tg(2),zZ=tg(3),Tm=tg(4),NZ=tg(5),BZ=tg(6);l1.range;U2.range;RZ.range;zZ.range;Tm.range;NZ.range;BZ.range;var kF=yl(function(e){e.setDate(1),e.setHours(0,0,0,0)},function(e,n){e.setMonth(e.getMonth()+n)},function(e,n){return n.getMonth()-e.getMonth()+(n.getFullYear()-e.getFullYear())*12},function(e){return e.getMonth()});const $2=kF;kF.range;var d6=yl(function(e){e.setMonth(0,1),e.setHours(0,0,0,0)},function(e,n){e.setFullYear(e.getFullYear()+n)},function(e,n){return n.getFullYear()-e.getFullYear()},function(e){return e.getFullYear()});d6.every=function(e){return!isFinite(e=Math.floor(e))||!(e>0)?null:yl(function(n){n.setFullYear(Math.floor(n.getFullYear()/e)*e),n.setMonth(0,1),n.setHours(0,0,0,0)},function(n,t){n.setFullYear(n.getFullYear()+t*e)})};const ip=d6;d6.range;var TF=yl(function(e){e.setUTCSeconds(0,0)},function(e,n){e.setTime(+e+n*wc)},function(e,n){return(n-e)/wc},function(e){return e.getUTCMinutes()});const p6=TF;TF.range;var MF=yl(function(e){e.setUTCMinutes(0,0,0)},function(e,n){e.setTime(+e+n*Hh)},function(e,n){return(n-e)/Hh},function(e){return e.getUTCHours()});const g6=MF;MF.range;var EF=yl(function(e){e.setUTCHours(0,0,0,0)},function(e,n){e.setUTCDate(e.getUTCDate()+n)},function(e,n){return(n-e)/O0},function(e){return e.getUTCDate()-1});const Jd=EF;EF.range;function ng(e){return yl(function(n){n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+7-e)%7),n.setUTCHours(0,0,0,0)},function(n,t){n.setUTCDate(n.getUTCDate()+t*7)},function(n,t){return(t-n)/c6})}var u1=ng(0),V2=ng(1),jZ=ng(2),UZ=ng(3),Mm=ng(4),$Z=ng(5),VZ=ng(6);u1.range;V2.range;jZ.range;UZ.range;Mm.range;$Z.range;VZ.range;var SF=yl(function(e){e.setUTCDate(1),e.setUTCHours(0,0,0,0)},function(e,n){e.setUTCMonth(e.getUTCMonth()+n)},function(e,n){return n.getUTCMonth()-e.getUTCMonth()+(n.getUTCFullYear()-e.getUTCFullYear())*12},function(e){return e.getUTCMonth()});const q2=SF;SF.range;var m6=yl(function(e){e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},function(e,n){e.setUTCFullYear(e.getUTCFullYear()+n)},function(e,n){return n.getUTCFullYear()-e.getUTCFullYear()},function(e){return e.getUTCFullYear()});m6.every=function(e){return!isFinite(e=Math.floor(e))||!(e>0)?null:yl(function(n){n.setUTCFullYear(Math.floor(n.getUTCFullYear()/e)*e),n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)},function(n,t){n.setUTCFullYear(n.getUTCFullYear()+t*e)})};const ap=m6;m6.range;function CF(e,n,t,o,f,r){const a=[[zd,1,qh],[zd,5,5*qh],[zd,15,15*qh],[zd,30,30*qh],[r,1,wc],[r,5,5*wc],[r,15,15*wc],[r,30,30*wc],[f,1,Hh],[f,3,3*Hh],[f,6,6*Hh],[f,12,12*Hh],[o,1,O0],[o,2,2*O0],[t,1,c6],[n,1,o7],[n,3,3*o7],[e,1,h4]];function l(i,s,u){const h=sg).right(a,h);if(d===a.length)return e.every(D0(i/h4,s/h4,u));if(d===0)return u6.every(Math.max(D0(i,s,u),1));const[m,p]=a[h/a[d-1][2](e[n]=1+t,e),{});function v6(e){const n=Ti(e).slice(),t={};return n.length||Pr("Missing time unit."),n.forEach(f=>{Yi(d4,f)?t[f]=1:Pr("Invalid time unit: ".concat(f,"."))}),(t[Js]||t[Vl]?1:0)+(t[Vu]||t[Wl]||t[qu]?1:0)+(t[lh]?1:0)>1&&Pr("Incompatible time units: ".concat(e)),n.sort((f,r)=>d4[f]-d4[r]),n}const YZ={[Ll]:"%Y ",[Vu]:"Q%q ",[Wl]:"%b ",[qu]:"%d ",[Js]:"W%U ",[Vl]:"%a ",[lh]:"%j ",[cc]:"%H:00",[fc]:"00:%M",[Sc]:":%S",[vf]:".%L",["".concat(Ll,"-").concat(Wl)]:"%Y-%m ",["".concat(Ll,"-").concat(Wl,"-").concat(qu)]:"%Y-%m-%d ",["".concat(cc,"-").concat(fc)]:"%H:%M"};function LF(e,n){const t=Ea({},YZ,n),o=v6(e),f=o.length;let r="",a=0,l,c;for(a=0;aa;--l)if(c=o.slice(a,l).join("-"),t[c]!=null){r+=t[c],a=l;break}return r.trim()}const c0=new Date;function x6(e){return c0.setFullYear(e),c0.setMonth(0),c0.setDate(1),c0.setHours(0,0,0,0),c0}function DF(e){return PF(new Date(e))}function OF(e){return WA(new Date(e))}function PF(e){return Zd.count(x6(e.getFullYear())-1,e)}function WA(e){return l1.count(x6(e.getFullYear())-1,e)}function YA(e){return x6(e).getDay()}function XZ(e,n,t,o,f,r,a){if(0<=e&&e<100){const l=new Date(-1,n,t,o,f,r,a);return l.setFullYear(e),l}return new Date(e,n,t,o,f,r,a)}function IF(e){return RF(new Date(e))}function FF(e){return XA(new Date(e))}function RF(e){const n=Date.UTC(e.getUTCFullYear(),0,1);return Jd.count(n-1,e)}function XA(e){const n=Date.UTC(e.getUTCFullYear(),0,1);return u1.count(n-1,e)}function ZA(e){return c0.setTime(Date.UTC(e,0,1)),c0.getUTCDay()}function ZZ(e,n,t,o,f,r,a){if(0<=e&&e<100){const l=new Date(Date.UTC(-1,n,t,o,f,r,a));return l.setUTCFullYear(t.y),l}return new Date(Date.UTC(e,n,t,o,f,r,a))}function zF(e,n,t,o,f){const r=n||1,a=qa(e),l=(y,v,x)=>(x=x||y,JZ(t[x],o[x],y===a&&r,v)),c=new Date,i=sh(e),s=i[Ll]?l(Ll):bu(2012),u=i[Wl]?l(Wl):i[Vu]?l(Vu):u0,h=i[Js]&&i[Vl]?l(Vl,1,Js+Vl):i[Js]?l(Js,1):i[Vl]?l(Vl,1):i[qu]?l(qu,1):i[lh]?l(lh,1):Zv,d=i[cc]?l(cc):u0,m=i[fc]?l(fc):u0,p=i[Sc]?l(Sc):u0,g=i[vf]?l(vf):u0;return function(y){c.setTime(+y);const v=s(c);return f(v,u(c),h(c,v),d(c),m(c),p(c),g(c))}}function JZ(e,n,t,o){const f=t<=1?e:o?(r,a)=>o+t*Math.floor((e(r,a)-o)/t):(r,a)=>t*Math.floor(e(r,a)/t);return n?(r,a)=>n(f(r,a),a):f}function Em(e,n,t){return n+e*7-(t+6)%7}const KZ={[Ll]:e=>e.getFullYear(),[Vu]:e=>Math.floor(e.getMonth()/3),[Wl]:e=>e.getMonth(),[qu]:e=>e.getDate(),[cc]:e=>e.getHours(),[fc]:e=>e.getMinutes(),[Sc]:e=>e.getSeconds(),[vf]:e=>e.getMilliseconds(),[lh]:e=>PF(e),[Js]:e=>WA(e),[Js+Vl]:(e,n)=>Em(WA(e),e.getDay(),YA(n)),[Vl]:(e,n)=>Em(1,e.getDay(),YA(n))},QZ={[Vu]:e=>3*e,[Js]:(e,n)=>Em(e,0,YA(n))};function NF(e,n){return zF(e,n||1,KZ,QZ,XZ)}const eJ={[Ll]:e=>e.getUTCFullYear(),[Vu]:e=>Math.floor(e.getUTCMonth()/3),[Wl]:e=>e.getUTCMonth(),[qu]:e=>e.getUTCDate(),[cc]:e=>e.getUTCHours(),[fc]:e=>e.getUTCMinutes(),[Sc]:e=>e.getUTCSeconds(),[vf]:e=>e.getUTCMilliseconds(),[lh]:e=>RF(e),[Js]:e=>XA(e),[Vl]:(e,n)=>Em(1,e.getUTCDay(),ZA(n)),[Js+Vl]:(e,n)=>Em(XA(e),e.getUTCDay(),ZA(n))},tJ={[Vu]:e=>3*e,[Js]:(e,n)=>Em(e,0,ZA(n))};function BF(e,n){return zF(e,n||1,eJ,tJ,ZZ)}const nJ={[Ll]:ip,[Vu]:$2.every(3),[Wl]:$2,[Js]:l1,[qu]:Zd,[Vl]:Zd,[lh]:Zd,[cc]:h6,[fc]:f6,[Sc]:zd,[vf]:u6},rJ={[Ll]:ap,[Vu]:q2.every(3),[Wl]:q2,[Js]:u1,[qu]:Jd,[Vl]:Jd,[lh]:Jd,[cc]:g6,[fc]:p6,[Sc]:zd,[vf]:u6};function c1(e){return nJ[e]}function f1(e){return rJ[e]}function jF(e,n,t){return e?e.offset(n,t):void 0}function UF(e,n,t){return jF(c1(e),n,t)}function $F(e,n,t){return jF(f1(e),n,t)}function VF(e,n,t,o){return e?e.range(n,t,o):void 0}function qF(e,n,t,o){return VF(c1(e),n,t,o)}function HF(e,n,t,o){return VF(f1(e),n,t,o)}const Ty=1e3,My=Ty*60,Ey=My*60,Dw=Ey*24,iJ=Dw*7,s7=Dw*30,JA=Dw*365,GF=[Ll,Wl,qu,cc,fc,Sc,vf],Sy=GF.slice(0,-1),Cy=Sy.slice(0,-1),Ly=Cy.slice(0,-1),aJ=Ly.slice(0,-1),oJ=[Ll,Js],l7=[Ll,Wl],WF=[Ll],Q1=[[Sy,1,Ty],[Sy,5,5*Ty],[Sy,15,15*Ty],[Sy,30,30*Ty],[Cy,1,My],[Cy,5,5*My],[Cy,15,15*My],[Cy,30,30*My],[Ly,1,Ey],[Ly,3,3*Ey],[Ly,6,6*Ey],[Ly,12,12*Ey],[aJ,1,Dw],[oJ,1,iJ],[l7,1,s7],[l7,3,3*s7],[WF,1,JA]];function YF(e){const n=e.extent,t=e.maxbins||40,o=Math.abs(Lw(n))/t;let f=yw(l=>l[2]).right(Q1,o),r,a;return f===Q1.length?(r=WF,a=D0(n[0]/JA,n[1]/JA,t)):f?(f=Q1[o/Q1[f-1][2]53)return null;"w"in q||(q.w=1),"Z"in q?(ee=g4(ey(q.y,0,1)),ie=ee.getUTCDay(),ee=ie>4||ie===0?V2.ceil(ee):V2(ee),ee=Jd.offset(ee,(q.V-1)*7),q.y=ee.getUTCFullYear(),q.m=ee.getUTCMonth(),q.d=ee.getUTCDate()+(q.w+6)%7):(ee=p4(ey(q.y,0,1)),ie=ee.getDay(),ee=ie>4||ie===0?U2.ceil(ee):U2(ee),ee=Zd.offset(ee,(q.V-1)*7),q.y=ee.getFullYear(),q.m=ee.getMonth(),q.d=ee.getDate()+(q.w+6)%7)}else("W"in q||"U"in q)&&("w"in q||(q.w="u"in q?q.u%7:"W"in q?1:0),ie="Z"in q?g4(ey(q.y,0,1)).getUTCDay():p4(ey(q.y,0,1)).getDay(),q.m=0,q.d="W"in q?(q.w+6)%7+q.W*7-(ie+5)%7:q.w+q.U*7-(ie+6)%7);return"Z"in q?(q.H+=q.Z/100|0,q.M+=q.Z%100,g4(q)):p4(q)}}function w(V,H,ne,q){for(var Q=0,ee=H.length,ie=ne.length,ae,ue;Q=ie)return-1;if(ae=H.charCodeAt(Q++),ae===37){if(ae=H.charAt(Q++),ue=A[ae in u7?H.charAt(Q++):ae],!ue||(q=ue(V,ne,q))<0)return-1}else if(ae!=ne.charCodeAt(q++))return-1}return q}function M(V,H,ne){var q=i.exec(H.slice(ne));return q?(V.p=s.get(q[0].toLowerCase()),ne+q[0].length):-1}function T(V,H,ne){var q=d.exec(H.slice(ne));return q?(V.w=m.get(q[0].toLowerCase()),ne+q[0].length):-1}function E(V,H,ne){var q=u.exec(H.slice(ne));return q?(V.w=h.get(q[0].toLowerCase()),ne+q[0].length):-1}function S(V,H,ne){var q=y.exec(H.slice(ne));return q?(V.m=v.get(q[0].toLowerCase()),ne+q[0].length):-1}function P(V,H,ne){var q=p.exec(H.slice(ne));return q?(V.m=g.get(q[0].toLowerCase()),ne+q[0].length):-1}function L(V,H,ne){return w(V,n,H,ne)}function R(V,H,ne){return w(V,t,H,ne)}function F(V,H,ne){return w(V,o,H,ne)}function D(V){return a[V.getDay()]}function O(V){return r[V.getDay()]}function N(V){return c[V.getMonth()]}function B(V){return l[V.getMonth()]}function W(V){return f[+(V.getHours()>=12)]}function G(V){return 1+~~(V.getMonth()/3)}function K(V){return a[V.getUTCDay()]}function te(V){return r[V.getUTCDay()]}function Y(V){return c[V.getUTCMonth()]}function J(V){return l[V.getUTCMonth()]}function re(V){return f[+(V.getUTCHours()>=12)]}function U(V){return 1+~~(V.getUTCMonth()/3)}return{format:function(V){var H=b(V+="",x);return H.toString=function(){return V},H},parse:function(V){var H=k(V+="",!1);return H.toString=function(){return V},H},utcFormat:function(V){var H=b(V+="",_);return H.toString=function(){return V},H},utcParse:function(V){var H=k(V+="",!0);return H.toString=function(){return V},H}}}var u7={"-":"",_:" ",0:"0"},vl=/^\s*\d+/,sJ=/^%/,lJ=/[\\^$*+?|[\]().{}]/g;function Ja(e,n,t){var o=e<0?"-":"",f=(o?-e:e)+"",r=f.length;return o+(r[n.toLowerCase(),t]))}function cJ(e,n,t){var o=vl.exec(n.slice(t,t+1));return o?(e.w=+o[0],t+o[0].length):-1}function fJ(e,n,t){var o=vl.exec(n.slice(t,t+1));return o?(e.u=+o[0],t+o[0].length):-1}function hJ(e,n,t){var o=vl.exec(n.slice(t,t+2));return o?(e.U=+o[0],t+o[0].length):-1}function dJ(e,n,t){var o=vl.exec(n.slice(t,t+2));return o?(e.V=+o[0],t+o[0].length):-1}function pJ(e,n,t){var o=vl.exec(n.slice(t,t+2));return o?(e.W=+o[0],t+o[0].length):-1}function c7(e,n,t){var o=vl.exec(n.slice(t,t+4));return o?(e.y=+o[0],t+o[0].length):-1}function f7(e,n,t){var o=vl.exec(n.slice(t,t+2));return o?(e.y=+o[0]+(+o[0]>68?1900:2e3),t+o[0].length):-1}function gJ(e,n,t){var o=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(n.slice(t,t+6));return o?(e.Z=o[1]?0:-(o[2]+(o[3]||"00")),t+o[0].length):-1}function mJ(e,n,t){var o=vl.exec(n.slice(t,t+1));return o?(e.q=o[0]*3-3,t+o[0].length):-1}function yJ(e,n,t){var o=vl.exec(n.slice(t,t+2));return o?(e.m=o[0]-1,t+o[0].length):-1}function h7(e,n,t){var o=vl.exec(n.slice(t,t+2));return o?(e.d=+o[0],t+o[0].length):-1}function vJ(e,n,t){var o=vl.exec(n.slice(t,t+3));return o?(e.m=0,e.d=+o[0],t+o[0].length):-1}function d7(e,n,t){var o=vl.exec(n.slice(t,t+2));return o?(e.H=+o[0],t+o[0].length):-1}function xJ(e,n,t){var o=vl.exec(n.slice(t,t+2));return o?(e.M=+o[0],t+o[0].length):-1}function bJ(e,n,t){var o=vl.exec(n.slice(t,t+2));return o?(e.S=+o[0],t+o[0].length):-1}function _J(e,n,t){var o=vl.exec(n.slice(t,t+3));return o?(e.L=+o[0],t+o[0].length):-1}function wJ(e,n,t){var o=vl.exec(n.slice(t,t+6));return o?(e.L=Math.floor(o[0]/1e3),t+o[0].length):-1}function AJ(e,n,t){var o=sJ.exec(n.slice(t,t+1));return o?t+o[0].length:-1}function kJ(e,n,t){var o=vl.exec(n.slice(t));return o?(e.Q=+o[0],t+o[0].length):-1}function TJ(e,n,t){var o=vl.exec(n.slice(t));return o?(e.s=+o[0],t+o[0].length):-1}function p7(e,n){return Ja(e.getDate(),n,2)}function MJ(e,n){return Ja(e.getHours(),n,2)}function EJ(e,n){return Ja(e.getHours()%12||12,n,2)}function SJ(e,n){return Ja(1+Zd.count(ip(e),e),n,3)}function ZF(e,n){return Ja(e.getMilliseconds(),n,3)}function CJ(e,n){return ZF(e,n)+"000"}function LJ(e,n){return Ja(e.getMonth()+1,n,2)}function DJ(e,n){return Ja(e.getMinutes(),n,2)}function OJ(e,n){return Ja(e.getSeconds(),n,2)}function PJ(e){var n=e.getDay();return n===0?7:n}function IJ(e,n){return Ja(l1.count(ip(e)-1,e),n,2)}function JF(e){var n=e.getDay();return n>=4||n===0?Tm(e):Tm.ceil(e)}function FJ(e,n){return e=JF(e),Ja(Tm.count(ip(e),e)+(ip(e).getDay()===4),n,2)}function RJ(e){return e.getDay()}function zJ(e,n){return Ja(U2.count(ip(e)-1,e),n,2)}function NJ(e,n){return Ja(e.getFullYear()%100,n,2)}function BJ(e,n){return e=JF(e),Ja(e.getFullYear()%100,n,2)}function jJ(e,n){return Ja(e.getFullYear()%1e4,n,4)}function UJ(e,n){var t=e.getDay();return e=t>=4||t===0?Tm(e):Tm.ceil(e),Ja(e.getFullYear()%1e4,n,4)}function $J(e){var n=e.getTimezoneOffset();return(n>0?"-":(n*=-1,"+"))+Ja(n/60|0,"0",2)+Ja(n%60,"0",2)}function g7(e,n){return Ja(e.getUTCDate(),n,2)}function VJ(e,n){return Ja(e.getUTCHours(),n,2)}function qJ(e,n){return Ja(e.getUTCHours()%12||12,n,2)}function HJ(e,n){return Ja(1+Jd.count(ap(e),e),n,3)}function KF(e,n){return Ja(e.getUTCMilliseconds(),n,3)}function GJ(e,n){return KF(e,n)+"000"}function WJ(e,n){return Ja(e.getUTCMonth()+1,n,2)}function YJ(e,n){return Ja(e.getUTCMinutes(),n,2)}function XJ(e,n){return Ja(e.getUTCSeconds(),n,2)}function ZJ(e){var n=e.getUTCDay();return n===0?7:n}function JJ(e,n){return Ja(u1.count(ap(e)-1,e),n,2)}function QF(e){var n=e.getUTCDay();return n>=4||n===0?Mm(e):Mm.ceil(e)}function KJ(e,n){return e=QF(e),Ja(Mm.count(ap(e),e)+(ap(e).getUTCDay()===4),n,2)}function QJ(e){return e.getUTCDay()}function eK(e,n){return Ja(V2.count(ap(e)-1,e),n,2)}function tK(e,n){return Ja(e.getUTCFullYear()%100,n,2)}function nK(e,n){return e=QF(e),Ja(e.getUTCFullYear()%100,n,2)}function rK(e,n){return Ja(e.getUTCFullYear()%1e4,n,4)}function iK(e,n){var t=e.getUTCDay();return e=t>=4||t===0?Mm(e):Mm.ceil(e),Ja(e.getUTCFullYear()%1e4,n,4)}function aK(){return"+0000"}function m7(){return"%"}function y7(e){return+e}function v7(e){return Math.floor(+e/1e3)}var Hg,b6,eR,_6,tR;oK({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function oK(e){return Hg=XF(e),b6=Hg.format,eR=Hg.parse,_6=Hg.utcFormat,tR=Hg.utcParse,Hg}function Dy(e){const n={};return t=>n[t]||(n[t]=e(t))}function sK(e,n){return t=>{const o=e(t),f=o.indexOf(n);if(f<0)return o;let r=lK(o,f);const a=rf;)if(o[r]!=="0"){++r;break}return o.slice(0,r)+a}}function lK(e,n){let t=e.lastIndexOf("e"),o;if(t>0)return t;for(t=e.length;--t>n;)if(o=e.charCodeAt(t),o>=48&&o<=57)return t+1}function nR(e){const n=Dy(e.format),t=e.formatPrefix;return{format:n,formatPrefix:t,formatFloat(o){const f=FA(o||",");if(f.precision==null){switch(f.precision=12,f.type){case"%":f.precision-=2;break;case"e":f.precision-=1;break}return sK(n(f),n(".1f")(1)[1])}else return n(f)},formatSpan(o,f,r,a){a=FA(a??",f");const l=D0(o,f,r),c=Math.max(Math.abs(o),Math.abs(f));let i;if(a.precision==null)switch(a.type){case"s":return isNaN(i=nY(l,c))||(a.precision=i),t(a,c);case"":case"e":case"g":case"p":case"r":{isNaN(i=tY(l,c))||(a.precision=i-(a.type==="e"));break}case"f":case"%":{isNaN(i=eY(l))||(a.precision=i-(a.type==="%")*2);break}}return n(a)}}}let KA;rR();function rR(){return KA=nR({format:AI,formatPrefix:rY})}function iR(e){return nR(iY(e))}function H2(e){return arguments.length?KA=iR(e):KA}function x7(e,n,t){t=t||{},Si(t)||Pr("Invalid time multi-format specifier: ".concat(t));const o=n(Sc),f=n(fc),r=n(cc),a=n(qu),l=n(Js),c=n(Wl),i=n(Vu),s=n(Ll),u=e(t[vf]||".%L"),h=e(t[Sc]||":%S"),d=e(t[fc]||"%I:%M"),m=e(t[cc]||"%I %p"),p=e(t[qu]||t[Vl]||"%a %d"),g=e(t[Js]||"%b %d"),y=e(t[Wl]||"%B"),v=e(t[Vu]||"%B"),x=e(t[Ll]||"%Y");return _=>(o(_)<_?u:f(_)<_?h:r(_)<_?d:a(_)<_?m:c(_)<_?l(_)<_?p:g:s(_)<_?i(_)<_?y:v:x)(_)}function aR(e){const n=Dy(e.format),t=Dy(e.utcFormat);return{timeFormat:o=>Li(o)?n(o):x7(n,c1,o),utcFormat:o=>Li(o)?t(o):x7(t,f1,o),timeParse:Dy(e.parse),utcParse:Dy(e.utcParse)}}let QA;oR();function oR(){return QA=aR({format:b6,parse:eR,utcFormat:_6,utcParse:tR})}function sR(e){return aR(XF(e))}function pv(e){return arguments.length?QA=sR(e):QA}const ek=(e,n)=>Ea({},e,n);function lR(e,n){const t=e?iR(e):H2(),o=n?sR(n):pv();return ek(t,o)}function w6(e,n){const t=arguments.length;return t&&t!==2&&Pr("defaultLocale expects either zero or two arguments."),t?ek(H2(e),pv(n)):ek(H2(),pv())}function uK(){return rR(),oR(),w6()}const cK=/^(data:|([A-Za-z]+:)?\/\/)/,fK=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,hK=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,b7="file://";function dK(e,n){return t=>({options:t||{},sanitize:gK,load:pK,fileAccess:!!n,file:mK(n),http:vK(e)})}async function pK(e,n){const t=await this.sanitize(e,n),o=t.href;return t.localFile?this.file(o):this.http(o,n)}async function gK(e,n){n=Ea({},this.options,n);const t=this.fileAccess,o={href:null};let f,r,a;const l=fK.test(e.replace(hK,""));(e==null||typeof e!="string"||!l)&&Pr("Sanitize failure, invalid URI: "+ri(e));const c=cK.test(e);return(a=n.baseURL)&&!c&&(!e.startsWith("/")&&!a.endsWith("/")&&(e="/"+e),e=a+e),r=(f=e.startsWith(b7))||n.mode==="file"||n.mode!=="http"&&!c&&t,f?e=e.slice(b7.length):e.startsWith("//")&&(n.defaultProtocol==="file"?(e=e.slice(2),r=!0):e=(n.defaultProtocol||"http")+":"+e),Object.defineProperty(o,"localFile",{value:!!r}),o.href=e,n.target&&(o.target=n.target+""),n.rel&&(o.rel=n.rel+""),n.context==="image"&&n.crossOrigin&&(o.crossOrigin=n.crossOrigin+""),o}function mK(e){return e?n=>new Promise((t,o)=>{e.readFile(n,(f,r)=>{f?o(f):t(r)})}):yK}async function yK(){Pr("No file system access.")}function vK(e){return e?async function(n,t){const o=Ea({},this.options.http,t),f=t&&t.response,r=await e(n,o);return r.ok?xa(r[f])?r[f]():r.text():Pr(r.status+""+r.statusText)}:xK}async function xK(){Pr("No HTTP fetch method available.")}const bK=e=>e!=null&&e===e,_K=e=>e==="true"||e==="false"||e===!0||e===!1,wK=e=>!Number.isNaN(Date.parse(e)),uR=e=>!Number.isNaN(+e)&&!(e instanceof Date),AK=e=>uR(e)&&Number.isInteger(+e),tk={boolean:sF,integer:pu,number:pu,date:lF,string:uF,unknown:xu},Mb=[_K,AK,uR,wK],kK=["boolean","integer","number","date"];function cR(e,n){if(!e||!e.length)return"unknown";const t=e.length,o=Mb.length,f=Mb.map((r,a)=>a+1);for(let r=0,a=0,l,c;rr===0?a:r,0)-1]}function fR(e,n){return n.reduce((t,o)=>(t[o]=cR(e,o),t),{})}function _7(e){const n=function(t,o){const f={delimiter:e};return A6(t,o?Ea(o,f):f)};return n.responseType="text",n}function A6(e,n){return n.header&&(e=n.header.map(ri).join(n.delimiter)+` -`+e),wY(n.delimiter).parse(e+"")}A6.responseType="text";function TK(e){return typeof Buffer=="function"&&xa(Buffer.isBuffer)?Buffer.isBuffer(e):!1}function k6(e,n){const t=n&&n.property?uc(n.property):xu;return Si(e)&&!TK(e)?MK(t(e),n):t(JSON.parse(e))}k6.responseType="json";function MK(e,n){return!zr(e)&&cZ(e)&&(e=[...e]),n&&n.copy?JSON.parse(JSON.stringify(e)):e}const EK={interior:(e,n)=>e!==n,exterior:(e,n)=>e===n};function hR(e,n){let t,o,f,r;return e=k6(e,n),n&&n.feature?(t=wZ,f=n.feature):n&&n.mesh?(t=kZ,f=n.mesh,r=EK[n.filter]):Pr("Missing TopoJSON feature or mesh parameter."),o=(o=e.objects[f])?t(e,o,r):Pr("Invalid TopoJSON object: "+f),o&&o.features||[o]}hR.responseType="json";const u2={dsv:A6,csv:_7(","),tsv:_7(" "),json:k6,topojson:hR};function T6(e,n){return arguments.length>1?(u2[e]=n,this):Yi(u2,e)?u2[e]:null}function dR(e){const n=T6(e);return n&&n.responseType||"text"}function pR(e,n,t,o){n=n||{};const f=T6(n.type||"json");return f||Pr("Unknown data format type: "+n.type),e=f(e,n),n.parse&&SK(e,n.parse,t,o),Yi(e,"columns")&&delete e.columns,e}function SK(e,n,t,o){if(!e.length)return;const f=pv();t=t||f.timeParse,o=o||f.utcParse;let r=e.columns||Object.keys(e[0]),a,l,c,i,s,u;n==="auto"&&(n=fR(e,r)),r=Object.keys(n);const h=r.map(d=>{const m=n[d];let p,g;if(m&&(m.startsWith("date:")||m.startsWith("utc:")))return p=m.split(/:(.+)?/,2),g=p[1],(g[0]==="'"&&g[g.length-1]==="'"||g[0]==='"'&&g[g.length-1]==='"')&&(g=g.slice(1,-1)),(p[0]==="utc"?o:t)(g);if(!tk[m])throw Error("Illegal format pattern: "+d+":"+m);return tk[m]});for(c=0,s=e.length,u=r.length;c{const r=n(f);return o[r]||(o[r]=1,t.push(f)),t},t.remove=f=>{const r=n(f);if(o[r]){o[r]=0;const a=t.indexOf(f);a>=0&&t.splice(a,1)}return t},t}async function c2(e,n){try{await n(e)}catch(t){e.error(t)}}const gR=Symbol("vega_id");let CK=1;function Iw(e){return!!(e&&Gi(e))}function Gi(e){return e[gR]}function mR(e,n){return e[gR]=n,e}function oo(e){const n=e===Object(e)?e:{data:e};return Gi(n)?n:mR(n,CK++)}function M6(e){return Fw(e,oo({}))}function Fw(e,n){for(const t in e)n[t]=e[t];return n}function yR(e,n){return mR(n,Gi(e))}function rg(e,n){return e?n?(t,o)=>e(t,o)||Gi(n(t))-Gi(n(o)):(t,o)=>e(t,o)||Gi(t)-Gi(o):null}function vR(e){return e&&e.constructor===ig}function ig(){const e=[],n=[],t=[],o=[],f=[];let r=null,a=!1;return{constructor:ig,insert(l){const c=Ti(l),i=c.length;for(let s=0;s{m(v)&&(i[Gi(v)]=-1)});for(u=0,h=e.length;u0&&(y(p,m,d.value),l.modifies(m));for(u=0,h=f.length;u{m(v)&&i[Gi(v)]>0&&y(v,d.field,d.value)}),l.modifies(d.field);if(a)l.mod=n.length||o.length?c.filter(v=>i[Gi(v)]>0):c.slice();else for(g in s)l.mod.push(s[g]);return(r||r==null&&(n.length||o.length))&&l.clean(!0),l}}}const f2="_:mod:_";function Rw(){Object.defineProperty(this,f2,{writable:!0,value:{}})}Rw.prototype={set(e,n,t,o){const f=this,r=f[e],a=f[f2];return n!=null&&n>=0?(r[n]!==t||o)&&(r[n]=t,a[n+":"+e]=-1,a[e]=-1):(r!==t||o)&&(f[e]=t,a[e]=zr(t)?1+t.length:-1),f},modified(e,n){const t=this[f2];if(arguments.length){if(zr(e)){for(let o=0;o=0?n+1{d instanceof Po?(d!==this&&(n&&d.targets().add(this),r.push(d)),f.push({op:d,name:u,index:h})):o.set(u,h,d)};for(a in e)if(l=e[a],a===DK)Ti(l).forEach(u=>{u instanceof Po?u!==this&&(u.targets().add(this),r.push(u)):Pr("Pulse parameters must be operator instances.")}),this.source=l;else if(zr(l))for(o.set(a,-1,Array(c=l.length)),i=0;i{const t=Date.now();return t-n>e?(n=t,1):0})},debounce(e){const n=Cd();return this.targets().add(Cd(null,null,aF(e,t=>{const o=t.dataflow;n.receive(t),o&&o.run&&o.run()}))),n},between(e,n){let t=!1;return e.targets().add(Cd(null,null,()=>t=!0)),n.targets().add(Cd(null,null,()=>t=!1)),this.filter(()=>t)},detach(){this._filter=yf,this._targets=null}};function NK(e,n,t,o){const f=this,r=Cd(t,o),a=function(i){i.dataflow=f;try{r.receive(i)}catch(s){f.error(s)}finally{f.run()}};let l;typeof e=="string"&&typeof document<"u"?l=document.querySelectorAll(e):l=Ti(e);const c=l.length;for(let i=0;in=o);return t.requests=0,t.done=()=>{--t.requests===0&&(e._pending=null,n(e))},e._pending=t}const qK={skip:!0};function HK(e,n,t,o,f){return(e instanceof Po?WK:GK)(this,e,n,t,o,f),this}function GK(e,n,t,o,f,r){const a=Ea({},r,qK);let l,c;xa(t)||(t=bu(t)),o===void 0?l=i=>e.touch(t(i)):xa(o)?(c=new Po(null,o,f,!1),l=i=>{c.evaluate(i);const s=t(i),u=c.value;vR(u)?e.pulse(s,u,r):e.update(s,u,a)}):l=i=>e.update(t(i),o,a),n.apply(l)}function WK(e,n,t,o,f,r){if(o===void 0)n.targets().add(t);else{const a=r||{},l=new Po(null,YK(t,o),f,!1);l.modified(a.force),l.rank=n.rank,n.targets().add(l),t&&(l.skip(!0),l.value=t.value,l.targets().add(t),e.connect(t,[l]))}}function YK(e,n){return n=xa(n)?n:bu(n),e?function(t,o){const f=n(t,o);return e.skip()||(e.skip(f!==this.value).value=f),f}:n}function XK(e){e.rank=++this._rank}function ZK(e){const n=[e];let t,o,f;for(;n.length;)if(this.rank(t=n.pop()),o=t._targets)for(f=o.length;--f>=0;)n.push(t=o[f]),t===e&&Pr("Cycle detected in dataflow graph.")}const G2={},Vf=1<<0,Dd=1<<1,Rh=1<<2,JK=Vf|Dd,A7=Vf|Rh,Gg=Vf|Dd|Rh,k7=1<<3,ry=1<<4,T7=1<<5,M7=1<<6;function Kd(e,n,t){this.dataflow=e,this.stamp=n??-1,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=t||null}function m4(e,n){const t=[];return o0(e,n,o=>t.push(o)),t}function E7(e,n){const t={};return e.visit(n,o=>{t[Gi(o)]=1}),o=>t[Gi(o)]?null:o}function Eb(e,n){return e?(t,o)=>e(t,o)&&n(t,o):n}Kd.prototype={StopPropagation:G2,ADD:Vf,REM:Dd,MOD:Rh,ADD_REM:JK,ADD_MOD:A7,ALL:Gg,REFLOW:k7,SOURCE:ry,NO_SOURCE:T7,NO_FIELDS:M7,fork(e){return new Kd(this.dataflow).init(this,e)},clone(){const e=this.fork(Gg);return e.add=e.add.slice(),e.rem=e.rem.slice(),e.mod=e.mod.slice(),e.source&&(e.source=e.source.slice()),e.materialize(Gg|ry)},addAll(){let e=this;return!e.source||e.add===e.rem||!e.rem.length&&e.source.length===e.add.length||(e=new Kd(this.dataflow).init(this),e.add=e.source,e.rem=[]),e},init(e,n){const t=this;return t.stamp=e.stamp,t.encode=e.encode,e.fields&&!(n&M7)&&(t.fields=e.fields),n&Vf?(t.addF=e.addF,t.add=e.add):(t.addF=null,t.add=[]),n&Dd?(t.remF=e.remF,t.rem=e.rem):(t.remF=null,t.rem=[]),n&Rh?(t.modF=e.modF,t.mod=e.mod):(t.modF=null,t.mod=[]),n&T7?(t.srcF=null,t.source=null):(t.srcF=e.srcF,t.source=e.source,e.cleans&&(t.cleans=e.cleans)),t},runAfter(e){this.dataflow.runAfter(e)},changed(e){const n=e||Gg;return n&Vf&&this.add.length||n&Dd&&this.rem.length||n&Rh&&this.mod.length},reflow(e){if(e)return this.fork(Gg).reflow();const n=this.add.length,t=this.source&&this.source.length;return t&&t!==n&&(this.mod=this.source,n&&this.filter(Rh,E7(this,Vf))),this},clean(e){return arguments.length?(this.cleans=!!e,this):this.cleans},modifies(e){const n=this.fields||(this.fields={});return zr(e)?e.forEach(t=>n[t]=!0):n[e]=!0,this},modified(e,n){const t=this.fields;return(n||this.mod.length)&&t?arguments.length?zr(e)?e.some(o=>t[o]):t[e]:!!t:!1},filter(e,n){const t=this;return e&Vf&&(t.addF=Eb(t.addF,n)),e&Dd&&(t.remF=Eb(t.remF,n)),e&Rh&&(t.modF=Eb(t.modF,n)),e&ry&&(t.srcF=Eb(t.srcF,n)),t},materialize(e){e=e||Gg;const n=this;return e&Vf&&n.addF&&(n.add=m4(n.add,n.addF),n.addF=null),e&Dd&&n.remF&&(n.rem=m4(n.rem,n.remF),n.remF=null),e&Rh&&n.modF&&(n.mod=m4(n.mod,n.modF),n.modF=null),e&ry&&n.srcF&&(n.source=n.source.filter(n.srcF),n.srcF=null),n},visit(e,n){const t=this,o=n;if(e&ry)return o0(t.source,t.srcF,o),t;e&Vf&&o0(t.add,t.addF,o),e&Dd&&o0(t.rem,t.remF,o),e&Rh&&o0(t.mod,t.modF,o);const f=t.source;if(e&k7&&f){const r=t.add.length+t.mod.length;r===f.length||(r?o0(f,E7(t,A7),o):o0(f,t.srcF,o))}return t}};function E6(e,n,t,o){const f=this,r=t.length;let a=0;this.dataflow=e,this.stamp=n,this.fields=null,this.encode=o||null,this.pulses=t;for(let l=0;ln.add.push(t)),e&n.REM&&this.visit(n.REM,t=>n.rem.push(t)),e&n.MOD&&this.visit(n.MOD,t=>n.mod.push(t))),n},changed(e){return this.changes&e},modified(e){const n=this,t=n.fields;return t&&n.changes&n.MOD?zr(e)?e.some(o=>t[o]):t[e]:0},filter(){Pr("MultiPulse does not support filtering.")},materialize(){Pr("MultiPulse does not support materialization.")},visit(e,n){const t=this,o=t.pulses,f=o.length;let r=0;if(e&t.SOURCE)for(;ro._enqueue(s,!0)),o._touched=Pw(Ew);let a=0,l,c,i;try{for(;o._heap.size()>0;){if(l=o._heap.pop(),l.rank!==l.qrank){o._enqueue(l,!0);continue}c=l.run(o._getPulse(l,e)),c.then?c=await c:c.async&&(f.push(c.async),c=G2),c!==G2&&l._targets&&l._targets.forEach(s=>o._enqueue(s)),++a}}catch(s){o._heap.clear(),i=s}if(o._input={},o._pulse=null,o.debug(`Pulse ${r}: ${a} operators`),i&&(o._postrun=[],o.error(i)),o._postrun.length){const s=o._postrun.sort((u,h)=>h.priority-u.priority);o._postrun=[];for(let u=0;uo.runAsync(null,()=>{s.forEach(u=>{try{u(o)}catch(h){o.error(h)}})})),o}async function QK(e,n,t){for(;this._running;)await this._running;const o=()=>this._running=null;return(this._running=this.evaluate(e,n,t)).then(o,o),this._running}function eQ(e,n,t){return this._pulse?xR(this):(this.evaluate(e,n,t),this)}function tQ(e,n,t){if(this._pulse||n)this._postrun.push({priority:t||0,callback:e});else try{e(this)}catch(o){this.error(o)}}function xR(e){return e.error("Dataflow already running. Use runAsync() to chain invocations."),e}function nQ(e,n){const t=e.stampf.pulse),n):this._input[e.id]||iQ(this._pulse,t&&t.pulse)}function iQ(e,n){return n&&n.stamp===e.stamp?n:(e=e.fork(),n&&n!==G2&&(e.source=n.source),e)}const S6={skip:!1,force:!1};function aQ(e,n){const t=n||S6;return this._pulse?this._enqueue(e):this._touched.add(e),t.skip&&e.skip(!0),this}function oQ(e,n,t){const o=t||S6;return(e.set(n)||o.force)&&this.touch(e,o),this}function sQ(e,n,t){this.touch(e,t||S6);const o=new Kd(this,this._clock+(this._pulse?0:1)),f=e.pulse&&e.pulse.source||[];return o.target=e,this._input[e.id]=n.pulse(o,f),this}function lQ(e){let n=[];return{clear:()=>n=[],size:()=>n.length,peek:()=>n[0],push:t=>(n.push(t),bR(n,0,n.length-1,e)),pop:()=>{const t=n.pop();let o;return n.length?(o=n[0],n[0]=t,uQ(n,0,e)):o=t,o}}}function bR(e,n,t,o){let f,r;const a=e[t];for(;t>n;){if(r=t-1>>1,f=e[r],o(a,f)<0){e[t]=f,t=r;continue}break}return e[t]=a}function uQ(e,n,t){const o=n,f=e.length,r=e[n];let a=(n<<1)+1,l;for(;a=0&&(a=l),e[n]=e[a],n=a,a=(n<<1)+1;return e[n]=r,bR(e,o,n,t)}function gm(){this.logger(ZI()),this.logLevel(YI),this._clock=0,this._rank=0,this._locale=w6();try{this._loader=Ow()}catch{}this._touched=Pw(Ew),this._input={},this._pulse=null,this._heap=lQ((e,n)=>e.qrank-n.qrank),this._postrun=[]}function iy(e){return function(){return this._log[e].apply(this,arguments)}}gm.prototype={stamp(){return this._clock},loader(e){return arguments.length?(this._loader=e,this):this._loader},locale(e){return arguments.length?(this._locale=e,this):this._locale},logger(e){return arguments.length?(this._log=e,this):this._log},error:iy("error"),warn:iy("warn"),info:iy("info"),debug:iy("debug"),logLevel:iy("level"),cleanThreshold:1e4,add:FK,connect:RK,rank:XK,rerank:ZK,pulse:sQ,touch:aQ,update:oQ,changeset:ig,ingest:jK,parse:BK,preload:$K,request:UK,events:NK,on:HK,evaluate:KK,run:eQ,runAsync:QK,runAfter:tQ,_enqueue:nQ,_getPulse:rQ};function _r(e,n){Po.call(this,e,null,n)}ii(_r,Po,{run(e){if(e.stampthis.pulse=t):n!==e.StopPropagation&&(this.pulse=n),n},evaluate(e){const n=this.marshall(e.stamp),t=this.transform(n,e);return n.clear(),t},transform(){}});const Sm={};function _R(e){const n=wR(e);return n&&n.Definition||null}function wR(e){return e=e&&e.toLowerCase(),Yi(Sm,e)?Sm[e]:null}function*AR(e,n){if(n==null)for(let t of e)t!=null&&t!==""&&(t=+t)>=t&&(yield t);else{let t=-1;for(let o of e)o=n(o,++t,e),o!=null&&o!==""&&(o=+o)>=o&&(yield o)}}function C6(e,n,t){const o=Float64Array.from(AR(e,t));return o.sort(fv),n.map(f=>mF(o,f))}function L6(e,n){return C6(e,[.25,.5,.75],n)}function D6(e,n){const t=e.length,o=SZ(e,n),f=L6(e,n),r=(f[2]-f[0])/1.34;return 1.06*(Math.min(o,r)||o||Math.abs(f[0])||1)*Math.pow(t,-.2)}function kR(e){const n=e.maxbins||20,t=e.base||10,o=Math.log(t),f=e.divide||[5,2];let r=e.extent[0],a=e.extent[1],l,c,i,s,u,h;const d=e.span||a-r||Math.abs(r)||1;if(e.step)l=e.step;else if(e.steps){for(s=d/n,u=0,h=e.steps.length;un;)l*=t;for(u=0,h=f.length;u=i&&d/s<=n&&(l=s)}s=Math.log(l);const m=s>=0?0:~~(-s/o)+1,p=Math.pow(t,-m-1);return(e.nice||e.nice===void 0)&&(s=Math.floor(r/l+p)*l,r=rh);const f=e.length,r=new Float64Array(f);let a=0,l=1,c=o(e[0]),i=c,s=c+n,u;for(;l=s){for(i=(c+i)/2;a>1);af;)e[a--]=e[o]}o=f,f=r}return e}function hQ(e){return function(){return e=(1103515245*e+12345)%2147483647,e/2147483647}}function dQ(e,n){n==null&&(n=e,e=0);let t,o,f;const r={min(a){return arguments.length?(t=a||0,f=o-t,r):t},max(a){return arguments.length?(o=a||0,f=o-t,r):o},sample(){return t+Math.floor(f*Cc())},pdf(a){return a===Math.floor(a)&&a>=t&&a=o?1:(l-t+1)/f},icdf(a){return a>=0&&a<=1?t-1+Math.floor(a*f):NaN}};return r.min(e).max(n)}const ER=Math.sqrt(2*Math.PI),pQ=Math.SQRT2;let ay=NaN;function Nw(e,n){e=e||0,n=n??1;let t=0,o=0,f,r;if(ay===ay)t=ay,ay=NaN;else{do t=Cc()*2-1,o=Cc()*2-1,f=t*t+o*o;while(f===0||f>1);r=Math.sqrt(-2*Math.log(f)/f),t*=r,ay=o*r}return e+t*n}function O6(e,n,t){t=t??1;const o=(e-(n||0))/t;return Math.exp(-.5*o*o)/(t*ER)}function Bw(e,n,t){n=n||0,t=t??1;const o=(e-n)/t,f=Math.abs(o);let r;if(f>37)r=0;else{const a=Math.exp(-f*f/2);let l;f<7.07106781186547?(l=.0352624965998911*f+.700383064443688,l=l*f+6.37396220353165,l=l*f+33.912866078383,l=l*f+112.079291497871,l=l*f+221.213596169931,l=l*f+220.206867912376,r=a*l,l=.0883883476483184*f+1.75566716318264,l=l*f+16.064177579207,l=l*f+86.7807322029461,l=l*f+296.564248779674,l=l*f+637.333633378831,l=l*f+793.826512519948,l=l*f+440.413735824752,r=r/l):(l=f+.65,l=f+4/l,l=f+3/l,l=f+2/l,l=f+1/l,r=a/l/2.506628274631)}return o>0?1-r:r}function jw(e,n,t){return e<0||e>1?NaN:(n||0)+(t??1)*pQ*gQ(2*e-1)}function gQ(e){let n=-Math.log((1-e)*(1+e)),t;return n<6.25?(n-=3.125,t=-364441206401782e-35,t=-16850591381820166e-35+t*n,t=128584807152564e-32+t*n,t=11157877678025181e-33+t*n,t=-1333171662854621e-31+t*n,t=20972767875968562e-33+t*n,t=6637638134358324e-30+t*n,t=-4054566272975207e-29+t*n,t=-8151934197605472e-29+t*n,t=26335093153082323e-28+t*n,t=-12975133253453532e-27+t*n,t=-5415412054294628e-26+t*n,t=10512122733215323e-25+t*n,t=-4112633980346984e-24+t*n,t=-29070369957882005e-24+t*n,t=42347877827932404e-23+t*n,t=-13654692000834679e-22+t*n,t=-13882523362786469e-21+t*n,t=.00018673420803405714+t*n,t=-.000740702534166267+t*n,t=-.006033670871430149+t*n,t=.24015818242558962+t*n,t=1.6536545626831027+t*n):n<16?(n=Math.sqrt(n)-3.25,t=22137376921775787e-25,t=9075656193888539e-23+t*n,t=-27517406297064545e-23+t*n,t=18239629214389228e-24+t*n,t=15027403968909828e-22+t*n,t=-4013867526981546e-21+t*n,t=29234449089955446e-22+t*n,t=12475304481671779e-21+t*n,t=-47318229009055734e-21+t*n,t=6828485145957318e-20+t*n,t=24031110387097894e-21+t*n,t=-.0003550375203628475+t*n,t=.0009532893797373805+t*n,t=-.0016882755560235047+t*n,t=.002491442096107851+t*n,t=-.003751208507569241+t*n,t=.005370914553590064+t*n,t=1.0052589676941592+t*n,t=3.0838856104922208+t*n):Number.isFinite(n)?(n=Math.sqrt(n)-5,t=-27109920616438573e-27,t=-2555641816996525e-25+t*n,t=15076572693500548e-25+t*n,t=-3789465440126737e-24+t*n,t=761570120807834e-23+t*n,t=-1496002662714924e-23+t*n,t=2914795345090108e-23+t*n,t=-6771199775845234e-23+t*n,t=22900482228026655e-23+t*n,t=-99298272942317e-20+t*n,t=4526062597223154e-21+t*n,t=-1968177810553167e-20+t*n,t=7599527703001776e-20+t*n,t=-.00021503011930044477+t*n,t=-.00013871931833623122+t*n,t=1.0103004648645344+t*n,t=4.849906401408584+t*n):t=1/0,t*e}function P6(e,n){let t,o;const f={mean(r){return arguments.length?(t=r||0,f):t},stdev(r){return arguments.length?(o=r??1,f):o},sample:()=>Nw(t,o),pdf:r=>O6(r,t,o),cdf:r=>Bw(r,t,o),icdf:r=>jw(r,t,o)};return f.mean(e).stdev(n)}function I6(e,n){const t=P6();let o=0;const f={data(r){return arguments.length?(e=r,o=r?r.length:0,f.bandwidth(n)):e},bandwidth(r){return arguments.length?(n=r,!n&&e&&(n=D6(e)),f):n},sample(){return e[~~(Cc()*o)]+n*t.sample()},pdf(r){let a=0,l=0;for(;lF6(t,o),pdf:r=>R6(r,t,o),cdf:r=>z6(r,t,o),icdf:r=>N6(r,t,o)};return f.mean(e).stdev(n)}function CR(e,n){let t=0,o;function f(a){const l=[];let c=0,i;for(i=0;i=n&&e<=t?1/(t-n):0}function U6(e,n,t){return t==null&&(t=n??1,n=0),et?1:(e-n)/(t-n)}function $6(e,n,t){return t==null&&(t=n??1,n=0),e>=0&&e<=1?n+e*(t-n):NaN}function LR(e,n){let t,o;const f={min(r){return arguments.length?(t=r||0,f):t},max(r){return arguments.length?(o=r??1,f):o},sample:()=>B6(t,o),pdf:r=>j6(r,t,o),cdf:r=>U6(r,t,o),icdf:r=>$6(r,t,o)};return n==null&&(n=e??1,e=0),f.min(e).max(n)}function Kv(e,n,t,o){const f=o-e*e,r=Math.abs(f)<1e-24?0:(t-e*n)/f;return[n-r*e,r]}function Uw(e,n,t,o){e=e.filter(d=>{let m=n(d),p=t(d);return m!=null&&(m=+m)>=m&&p!=null&&(p=+p)>=p}),o&&e.sort((d,m)=>n(d)-n(m));const f=e.length,r=new Float64Array(f),a=new Float64Array(f);let l=0,c=0,i=0,s,u,h;for(h of e)r[l]=s=+n(h),a[l]=u=+t(h),++l,c+=(s-c)/l,i+=(u-i)/l;for(l=0;l=r&&a!=null&&(a=+a)>=a&&o(r,a,++f)}function h1(e,n,t,o,f){let r=0,a=0;return Qv(e,n,t,(l,c)=>{const i=c-f(l),s=c-o;r+=i*i,a+=s*s}),1-r/a}function V6(e,n,t){let o=0,f=0,r=0,a=0,l=0;Qv(e,n,t,(s,u)=>{++l,o+=(s-o)/l,f+=(u-f)/l,r+=(s*u-r)/l,a+=(s*s-a)/l});const c=Kv(o,f,r,a),i=s=>c[0]+c[1]*s;return{coef:c,predict:i,rSquared:h1(e,n,t,f,i)}}function DR(e,n,t){let o=0,f=0,r=0,a=0,l=0;Qv(e,n,t,(s,u)=>{++l,s=Math.log(s),o+=(s-o)/l,f+=(u-f)/l,r+=(s*u-r)/l,a+=(s*s-a)/l});const c=Kv(o,f,r,a),i=s=>c[0]+c[1]*Math.log(s);return{coef:c,predict:i,rSquared:h1(e,n,t,f,i)}}function OR(e,n,t){const[o,f,r,a]=Uw(e,n,t);let l=0,c=0,i=0,s=0,u=0,h,d,m;Qv(e,n,t,(v,x)=>{h=o[u++],d=Math.log(x),m=h*x,l+=(x*d-l)/u,c+=(m-c)/u,i+=(m*d-i)/u,s+=(h*m-s)/u});const[p,g]=Kv(c/a,l/a,i/a,s/a),y=v=>Math.exp(p+g*(v-r));return{coef:[Math.exp(p-g*r),g],predict:y,rSquared:h1(e,n,t,a,y)}}function PR(e,n,t){let o=0,f=0,r=0,a=0,l=0,c=0;Qv(e,n,t,(u,h)=>{const d=Math.log(u),m=Math.log(h);++c,o+=(d-o)/c,f+=(m-f)/c,r+=(d*m-r)/c,a+=(d*d-a)/c,l+=(h-l)/c});const i=Kv(o,f,r,a),s=u=>i[0]*Math.pow(u,i[1]);return i[0]=Math.exp(i[0]),{coef:i,predict:s,rSquared:h1(e,n,t,l,s)}}function q6(e,n,t){const[o,f,r,a]=Uw(e,n,t),l=o.length;let c=0,i=0,s=0,u=0,h=0,d,m,p,g;for(d=0;d(k=k-r,x*k*k+_*k+A+a);return{coef:[A-_*r+x*r*r+a,_-2*x*r,x],predict:b,rSquared:h1(e,n,t,a,b)}}function IR(e,n,t,o){if(o===1)return V6(e,n,t);if(o===2)return q6(e,n,t);const[f,r,a,l]=Uw(e,n,t),c=f.length,i=[],s=[],u=o+1;let h,d,m,p,g;for(h=0;h{x-=a;let _=l+y[0]+y[1]*x+y[2]*x*x;for(h=3;h=0;--r)for(l=n[r],c=1,f[r]+=l,a=1;a<=r;++a)c*=(r+1-a)/a,f[r-a]+=l*Math.pow(t,a)*c;return f[0]+=o,f}function yQ(e){const n=e.length-1,t=[];let o,f,r,a,l;for(o=0;oMath.abs(e[o][a])&&(a=f);for(r=o;r=o;r--)e[r][f]-=e[r][o]*e[o][f]/e[o][o]}for(f=n-1;f>=0;--f){for(l=0,r=f+1;rf[x]-y?v:x;let A=0,b=0,k=0,w=0,M=0;const T=1/Math.abs(f[_]-y||1);for(let P=v;P<=x;++P){const L=f[P],R=r[P],F=vQ(Math.abs(y-L)*T)*h[P],D=L*F;A+=F,b+=D,k+=R*F,w+=R*D,M+=L*D}const[E,S]=Kv(b/A,k/A,w/A,M/A);s[g]=E+S*y,u[g]=Math.abs(r[g]-s[g]),xQ(f,g+1,m)}if(d===S7)break;const p=yF(u);if(Math.abs(p)=1?C7:(v=1-y*y)*v}return bQ(f,s,a,l)}function vQ(e){return(e=1-e*e*e)*e*e}function xQ(e,n,t){const o=e[n];let f=t[0],r=t[1]+1;if(!(r>=e.length))for(;n>f&&e[r]-o<=o-e[f];)t[0]=++f,t[1]=r,++r}function bQ(e,n,t,o){const f=e.length,r=[];let a=0,l=0,c=[],i;for(;a[p,e(p)],r=n[0],a=n[1],l=a-r,c=l/o,i=[f(r)],s=[];if(t===o){for(let p=1;p0;)s.push(f(r+p/t*l))}let u=i[0],h=s[s.length-1];const d=1/l,m=wQ(u[1],s);for(;h;){const p=f((u[0]+h[0])/2);p[0]-u[0]>=c&&AQ(u,p,h,d,m)>_Q?s.push(p):(u=h,i.push(h),s.pop()),h=s[s.length-1]}return i}function wQ(e,n){let t=e,o=e;const f=n.length;for(let r=0;ro&&(o=a)}return 1/(o-t)}function AQ(e,n,t,o,f){const r=Math.atan2(f*(t[1]-e[1]),o*(t[0]-e[0])),a=Math.atan2(f*(n[1]-e[1]),o*(n[0]-e[0]));return Math.abs(r-a)}function kQ(e){return n=>{const t=e.length;let o=1,f=String(e[0](n));for(;o{},TQ={init:y4,add:y4,rem:y4,idx:0},gv={values:{init:e=>e.cell.store=!0,value:e=>e.cell.data.values(),idx:-1},count:{value:e=>e.cell.num},__count__:{value:e=>e.missing+e.valid},missing:{value:e=>e.missing},valid:{value:e=>e.valid},sum:{init:e=>e.sum=0,value:e=>e.sum,add:(e,n)=>e.sum+=+n,rem:(e,n)=>e.sum-=n},product:{init:e=>e.product=1,value:e=>e.valid?e.product:void 0,add:(e,n)=>e.product*=n,rem:(e,n)=>e.product/=n},mean:{init:e=>e.mean=0,value:e=>e.valid?e.mean:void 0,add:(e,n)=>(e.mean_d=n-e.mean,e.mean+=e.mean_d/e.valid),rem:(e,n)=>(e.mean_d=n-e.mean,e.mean-=e.valid?e.mean_d/e.valid:e.mean)},average:{value:e=>e.valid?e.mean:void 0,req:["mean"],idx:1},variance:{init:e=>e.dev=0,value:e=>e.valid>1?e.dev/(e.valid-1):void 0,add:(e,n)=>e.dev+=e.mean_d*(n-e.mean),rem:(e,n)=>e.dev-=e.mean_d*(n-e.mean),req:["mean"],idx:1},variancep:{value:e=>e.valid>1?e.dev/e.valid:void 0,req:["variance"],idx:2},stdev:{value:e=>e.valid>1?Math.sqrt(e.dev/(e.valid-1)):void 0,req:["variance"],idx:2},stdevp:{value:e=>e.valid>1?Math.sqrt(e.dev/e.valid):void 0,req:["variance"],idx:2},stderr:{value:e=>e.valid>1?Math.sqrt(e.dev/(e.valid*(e.valid-1))):void 0,req:["variance"],idx:2},distinct:{value:e=>e.cell.data.distinct(e.get),req:["values"],idx:3},ci0:{value:e=>e.cell.data.ci0(e.get),req:["values"],idx:3},ci1:{value:e=>e.cell.data.ci1(e.get),req:["values"],idx:3},median:{value:e=>e.cell.data.q2(e.get),req:["values"],idx:3},q1:{value:e=>e.cell.data.q1(e.get),req:["values"],idx:3},q3:{value:e=>e.cell.data.q3(e.get),req:["values"],idx:3},min:{init:e=>e.min=void 0,value:e=>e.min=Number.isNaN(e.min)?e.cell.data.min(e.get):e.min,add:(e,n)=>{(n{n<=e.min&&(e.min=NaN)},req:["values"],idx:4},max:{init:e=>e.max=void 0,value:e=>e.max=Number.isNaN(e.max)?e.cell.data.max(e.get):e.max,add:(e,n)=>{(n>e.max||e.max===void 0)&&(e.max=n)},rem:(e,n)=>{n>=e.max&&(e.max=NaN)},req:["values"],idx:4},argmin:{init:e=>e.argmin=void 0,value:e=>e.argmin||e.cell.data.argmin(e.get),add:(e,n,t)=>{n{n<=e.min&&(e.argmin=void 0)},req:["min","values"],idx:3},argmax:{init:e=>e.argmax=void 0,value:e=>e.argmax||e.cell.data.argmax(e.get),add:(e,n,t)=>{n>e.max&&(e.argmax=t)},rem:(e,n)=>{n>=e.max&&(e.argmax=void 0)},req:["max","values"],idx:3}},ex=Object.keys(gv);function MQ(e,n){return t=>Ea({name:e,out:t||e},TQ,n)}ex.forEach(e=>{gv[e]=MQ(e,gv[e])});function zR(e,n){return gv[e](n)}function NR(e,n){return e.idx-n.idx}function EQ(e){const n={};e.forEach(o=>n[o.name]=o);const t=o=>{o.req&&o.req.forEach(f=>{n[f]||t(n[f]=gv[f]())})};return e.forEach(t),Object.values(n).sort(NR)}function SQ(){this.valid=0,this.missing=0,this._ops.forEach(e=>e.init(this))}function CQ(e,n){if(e==null||e===""){++this.missing;return}e===e&&(++this.valid,this._ops.forEach(t=>t.add(this,e,n)))}function LQ(e,n){if(e==null||e===""){--this.missing;return}e===e&&(--this.valid,this._ops.forEach(t=>t.rem(this,e,n)))}function DQ(e){return this._out.forEach(n=>e[n.out]=n.value(this)),e}function BR(e,n){const t=n||xu,o=EQ(e),f=e.slice().sort(NR);function r(a){this._ops=o,this._out=f,this.cell=a,this.init()}return r.prototype.init=SQ,r.prototype.add=CQ,r.prototype.rem=LQ,r.prototype.set=DQ,r.prototype.get=t,r.fields=e.map(a=>a.out),r}function H6(e){this._key=e?uc(e):Gi,this.reset()}const Pl=H6.prototype;Pl.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null};Pl.add=function(e){this._add.push(e)};Pl.rem=function(e){this._rem.push(e)};Pl.values=function(){if(this._get=null,this._rem.length===0)return this._add;const e=this._add,n=this._rem,t=this._key,o=e.length,f=n.length,r=Array(o-f),a={};let l,c,i;for(l=0;l=0;)r=e(n[o])+"",Yi(t,r)||(t[r]=1,++f);return f};Pl.extent=function(e){if(this._get!==e||!this._ext){const n=this.values(),t=sZ(n,e);this._ext=[n[t[0]],n[t[1]]],this._get=e}return this._ext};Pl.argmin=function(e){return this.extent(e)[0]||{}};Pl.argmax=function(e){return this.extent(e)[1]||{}};Pl.min=function(e){const n=this.extent(e)[0];return n!=null?e(n):void 0};Pl.max=function(e){const n=this.extent(e)[1];return n!=null?e(n):void 0};Pl.quartile=function(e){return(this._get!==e||!this._q)&&(this._q=L6(this.values(),e),this._get=e),this._q};Pl.q1=function(e){return this.quartile(e)[0]};Pl.q2=function(e){return this.quartile(e)[1]};Pl.q3=function(e){return this.quartile(e)[2]};Pl.ci=function(e){return(this._get!==e||!this._ci)&&(this._ci=TR(this.values(),1e3,.05,e),this._get=e),this._ci};Pl.ci0=function(e){return this.ci(e)[0]};Pl.ci1=function(e){return this.ci(e)[1]};function op(e){_r.call(this,null,e),this._adds=[],this._mods=[],this._alen=0,this._mlen=0,this._drop=!0,this._cross=!1,this._dims=[],this._dnames=[],this._measures=[],this._countOnly=!1,this._counts=null,this._prev=null,this._inputs=null,this._outputs=null}op.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:ex},{name:"fields",type:"field",null:!0,array:!0},{name:"as",type:"string",null:!0,array:!0},{name:"drop",type:"boolean",default:!0},{name:"cross",type:"boolean",default:!1},{name:"key",type:"field"}]};ii(op,_r,{transform(e,n){const t=this,o=n.fork(n.NO_SOURCE|n.NO_FIELDS),f=e.modified();return t.stamp=o.stamp,t.value&&(f||n.modified(t._inputs,!0))?(t._prev=t.value,t.value=f?t.init(e):{},n.visit(n.SOURCE,r=>t.add(r))):(t.value=t.value||t.init(e),n.visit(n.REM,r=>t.rem(r)),n.visit(n.ADD,r=>t.add(r))),o.modifies(t._outputs),t._drop=e.drop!==!1,e.cross&&t._dims.length>1&&(t._drop=!1,t.cross()),n.clean()&&t._drop&&o.clean(!0).runAfter(()=>this.clean()),t.changes(o)},cross(){const e=this,n=e.value,t=e._dnames,o=t.map(()=>({})),f=t.length;function r(l){let c,i,s,u;for(c in l)for(s=l[c].tuple,i=0;i{const y=Rs(g);return f(g),t.push(y),y}),this.cellkey=e.key?e.key:nk(this._dims),this._countOnly=!0,this._counts=[],this._measures=[];const r=e.fields||[null],a=e.ops||["count"],l=e.as||[],c=r.length,i={};let s,u,h,d,m,p;for(c!==a.length&&Pr("Unmatched number of fields and aggregate ops."),p=0;pBR(g,g.field)),{}},cellkey:nk(),cell(e,n){let t=this.value[e];return t?t.num===0&&this._drop&&t.stamp{const u=o(s);s[l]=u,s[c]=u==null?null:f+r*(1+(u-f)/r)}:s=>s[l]=o(s)),n.modifies(t?a:l)},_bins(e){if(this.value&&!e.modified())return this.value;const n=e.field,t=kR(e),o=t.step;let f=t.start,r=f+Math.ceil((t.stop-f)/o)*o,a,l;(a=e.anchor)!=null&&(l=a-(f+o*Math.floor((a-f)/o)),f+=l,r+=l);const c=function(i){let s=pu(n(i));return s==null?null:sr?1/0:(s=Math.max(f,Math.min(s,r-o)),f+o*Math.floor(OQ+(s-f)/o))};return c.start=f,c.stop=t.stop,c.step=o,this.value=gc(c,mu(n),e.name||"bin_"+Rs(n))}});function jR(e,n,t){const o=e;let f=n||[],r=t||[],a={},l=0;return{add:c=>r.push(c),remove:c=>a[o(c)]=++l,size:()=>f.length,data:(c,i)=>(l&&(f=f.filter(s=>!a[o(s)]),a={},l=0),i&&c&&f.sort(c),r.length&&(f=c?gZ(c,f,r.sort(c)):f.concat(r),r=[]),f)}}function W6(e){_r.call(this,[],e)}W6.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]};ii(W6,_r,{transform(e,n){const t=n.fork(n.ALL),o=jR(Gi,this.value,t.materialize(t.ADD).add),f=e.sort,r=n.changed()||f&&(e.modified("sort")||n.modified(f.fields));return t.visit(t.REM,o.remove),this.modified(r),this.value=t.source=o.data(rg(f),r),n.source&&n.source.root&&(this.value.root=n.source.root),t}});function UR(e){Po.call(this,null,PQ,e)}ii(UR,Po);function PQ(e){return this.value&&!e.modified()?this.value:iF(e.fields,e.orders)}function Y6(e){_r.call(this,null,e)}Y6.Definition={type:"CountPattern",metadata:{generates:!0,changes:!0},params:[{name:"field",type:"field",required:!0},{name:"case",type:"enum",values:["upper","lower","mixed"],default:"mixed"},{name:"pattern",type:"string",default:'[\\w"]+'},{name:"stopwords",type:"string",default:""},{name:"as",type:"string",array:!0,length:2,default:["text","count"]}]};function IQ(e,n,t){switch(n){case"upper":e=e.toUpperCase();break;case"lower":e=e.toLowerCase();break}return e.match(t)}ii(Y6,_r,{transform(e,n){const t=u=>h=>{for(var d=IQ(l(h),e.case,r)||[],m,p=0,g=d.length;pf[u]=1+(f[u]||0)),s=t(u=>f[u]-=1);return o?n.visit(n.SOURCE,i):(n.visit(n.ADD,i),n.visit(n.REM,s)),this._finish(n,c)},_parameterCheck(e,n){let t=!1;return(e.modified("stopwords")||!this._stop)&&(this._stop=new RegExp("^"+(e.stopwords||"")+"$","i"),t=!0),(e.modified("pattern")||!this._match)&&(this._match=new RegExp(e.pattern||"[\\w']+","g"),t=!0),(e.modified("field")||n.modified(e.field.fields))&&(t=!0),t&&(this._counts={}),t},_finish(e,n){const t=this._counts,o=this._tuples||(this._tuples={}),f=n[0],r=n[1],a=e.fork(e.NO_SOURCE|e.NO_FIELDS);let l,c,i;for(l in t)c=o[l],i=t[l]||0,!c&&i?(o[l]=c=oo({}),c[f]=l,c[r]=i,a.add.push(c)):i===0?(c&&a.rem.push(c),t[l]=null,o[l]=null):c[r]!==i&&(c[r]=i,a.mod.push(c));return a.modifies(n)}});function X6(e){_r.call(this,null,e)}X6.Definition={type:"Cross",metadata:{generates:!0},params:[{name:"filter",type:"expr"},{name:"as",type:"string",array:!0,length:2,default:["a","b"]}]};ii(X6,_r,{transform(e,n){const t=n.fork(n.NO_SOURCE),o=e.as||["a","b"],f=o[0],r=o[1],a=!this.value||n.changed(n.ADD_REM)||e.modified("as")||e.modified("filter");let l=this.value;return a?(l&&(t.rem=l),l=n.materialize(n.SOURCE).source,t.add=this.value=FQ(l,f,r,e.filter||yf)):t.mod=l,t.source=this.value,t.modifies(o)}});function FQ(e,n,t,o){for(var f=[],r={},a=e.length,l=0,c,i;l$R(r,n))):typeof o[f]===D7&&o[f](e[f]);return o}function Z6(e){_r.call(this,null,e)}const VR=[{key:{function:"normal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"lognormal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"uniform"},params:[{name:"min",type:"number",default:0},{name:"max",type:"number",default:1}]},{key:{function:"kde"},params:[{name:"field",type:"field",required:!0},{name:"from",type:"data"},{name:"bandwidth",type:"number",default:0}]}],NQ={key:{function:"mixture"},params:[{name:"distributions",type:"param",array:!0,params:VR},{name:"weights",type:"number",array:!0}]};Z6.Definition={type:"Density",metadata:{generates:!0},params:[{name:"extent",type:"number",array:!0,length:2},{name:"steps",type:"number"},{name:"minsteps",type:"number",default:25},{name:"maxsteps",type:"number",default:200},{name:"method",type:"string",default:"pdf",values:["pdf","cdf"]},{name:"distribution",type:"param",params:VR.concat(NQ)},{name:"as",type:"string",array:!0,default:["value","density"]}]};ii(Z6,_r,{transform(e,n){const t=n.fork(n.NO_SOURCE|n.NO_FIELDS);if(!this.value||n.changed()||e.modified()){const o=$R(e.distribution,BQ(n)),f=e.steps||e.minsteps||25,r=e.steps||e.maxsteps||200;let a=e.method||"pdf";a!=="pdf"&&a!=="cdf"&&Pr("Invalid density method: "+a),!e.extent&&!o.data&&Pr("Missing density extent parameter."),a=o[a];const l=e.as||["value","density"],c=e.extent||ed(o.data()),i=$w(a,c,f,r).map(s=>{const u={};return u[l[0]]=s[0],u[l[1]]=s[1],oo(u)});this.value&&(t.rem=this.value),this.value=t.add=t.source=i}return t}});function BQ(e){return()=>e.materialize(e.SOURCE).source}function qR(e,n){return e?e.map((t,o)=>n[o]||Rs(t)):null}function J6(e,n,t){const o=[],f=u=>u(c);let r,a,l,c,i,s;if(n==null)o.push(e.map(t));else for(r={},a=0,l=e.length;aLw(ed(e,n))/30;ii(K6,_r,{transform(e,n){if(this.value&&!(e.modified()||n.changed()))return n;const t=n.materialize(n.SOURCE).source,o=J6(n.source,e.groupby,xu),f=e.smooth||!1,r=e.field,a=e.step||jQ(t,r),l=rg((m,p)=>r(m)-r(p)),c=e.as||HR,i=o.length;let s=1/0,u=-1/0,h=0,d;for(;hu&&(u=p),m[++d][c]=p}return this.value={start:s,stop:u,step:a},n.reflow(!0).modifies(c)}});function GR(e){Po.call(this,null,UQ,e),this.modified(!0)}ii(GR,Po);function UQ(e){const n=e.expr;return this.value&&!e.modified("expr")?this.value:gc(t=>n(t,e),mu(n),Rs(n))}function Q6(e){_r.call(this,[void 0,void 0],e)}Q6.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]};ii(Q6,_r,{transform(e,n){const t=this.value,o=e.field,f=n.changed()||n.modified(o.fields)||e.modified("field");let r=t[0],a=t[1];if((f||r==null)&&(r=1/0,a=-1/0),n.visit(f?n.SOURCE:n.ADD,l=>{const c=pu(o(l));c!=null&&(ca&&(a=c))}),!Number.isFinite(r)||!Number.isFinite(a)){let l=Rs(o);l&&(l=' for field "'.concat(l,'"')),n.dataflow.warn("Infinite extent".concat(l,": [").concat(r,", ").concat(a,"]")),r=a=void 0}this.value=[r,a]}});function eM(e,n){Po.call(this,e),this.parent=n,this.count=0}ii(eM,Po,{connect(e){return this.detachSubflow=e.detachSubflow,this.targets().add(e),e.source=this},add(e){this.count+=1,this.value.add.push(e)},rem(e){this.count-=1,this.value.rem.push(e)},mod(e){this.value.mod.push(e)},init(e){this.value.init(e,e.NO_SOURCE)},evaluate(){return this.value}});function Vw(e){_r.call(this,{},e),this._keys=Jv();const n=this._targets=[];n.active=0,n.forEach=t=>{for(let o=0,f=n.active;oo&&o.count>0);this.initTargets(t)}},initTargets(e){const n=this._targets,t=n.length,o=e?e.length:0;let f=0;for(;fthis.subflow(c,f,n);return this._group=e.group||{},this.initTargets(),n.visit(n.REM,c=>{const i=Gi(c),s=r.get(i);s!==void 0&&(r.delete(i),l(s).rem(c))}),n.visit(n.ADD,c=>{const i=o(c);r.set(Gi(c),i),l(i).add(c)}),a||n.modified(o.fields)?n.visit(n.MOD,c=>{const i=Gi(c),s=r.get(i),u=o(c);s===u?l(u).mod(c):(r.set(i,u),l(s).rem(c),l(u).add(c))}):n.changed(n.MOD)&&n.visit(n.MOD,c=>{l(r.get(Gi(c))).mod(c)}),a&&n.visit(n.REFLOW,c=>{const i=Gi(c),s=r.get(i),u=o(c);s!==u&&(r.set(i,u),l(s).rem(c),l(u).add(c))}),n.clean()?t.runAfter(()=>{this.clean(),r.clean()}):r.empty>t.cleanThreshold&&t.runAfter(r.clean),n}});function WR(e){Po.call(this,null,$Q,e)}ii(WR,Po);function $Q(e){return this.value&&!e.modified()?this.value:zr(e.name)?Ti(e.name).map(n=>uc(n)):uc(e.name,e.as)}function tM(e){_r.call(this,Jv(),e)}tM.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]};ii(tM,_r,{transform(e,n){const t=n.dataflow,o=this.value,f=n.fork(),r=f.add,a=f.rem,l=f.mod,c=e.expr;let i=!0;n.visit(n.REM,u=>{const h=Gi(u);o.has(h)?o.delete(h):a.push(u)}),n.visit(n.ADD,u=>{c(u,e)?r.push(u):o.set(Gi(u),1)});function s(u){const h=Gi(u),d=c(u,e),m=o.get(h);d&&m?(o.delete(h),r.push(u)):!d&&!m?(o.set(h,1),a.push(u)):i&&d&&!m&&l.push(u)}return n.visit(n.MOD,s),e.modified()&&(i=!1,n.visit(n.REFLOW,s)),o.empty>t.cleanThreshold&&t.runAfter(o.clean),f}});function nM(e){_r.call(this,[],e)}nM.Definition={type:"Flatten",metadata:{generates:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"index",type:"string"},{name:"as",type:"string",array:!0}]};ii(nM,_r,{transform(e,n){const t=n.fork(n.NO_SOURCE),o=e.fields,f=qR(o,e.as||[]),r=e.index||null,a=f.length;return t.rem=this.value,n.visit(n.SOURCE,l=>{const c=o.map(m=>m(l)),i=c.reduce((m,p)=>Math.max(m,p.length),0);let s=0,u,h,d;for(;s{for(let s=0,u;sa[o]=t(a,e))}});function YR(e){_r.call(this,[],e)}ii(YR,_r,{transform(e,n){const t=n.fork(n.ALL),o=e.generator;let f=this.value,r=e.size-f.length,a,l,c;if(r>0){for(a=[];--r>=0;)a.push(c=oo(o(e))),f.push(c);t.add=t.add.length?t.materialize(t.ADD).add.concat(a):a}else l=f.slice(0,-r),t.rem=t.rem.length?t.materialize(t.REM).rem.concat(l):l,f=f.slice(-r);return t.source=this.value=f,t}});const Sb={value:"value",median:yF,mean:DZ,min:HA,max:w0},VQ=[];function aM(e){_r.call(this,[],e)}aM.Definition={type:"Impute",metadata:{changes:!0},params:[{name:"field",type:"field",required:!0},{name:"key",type:"field",required:!0},{name:"keyvals",array:!0},{name:"groupby",type:"field",array:!0},{name:"method",type:"enum",default:"value",values:["value","mean","median","max","min"]},{name:"value",default:0}]};function qQ(e){var n=e.method||Sb.value,t;if(Sb[n]==null)Pr("Unrecognized imputation method: "+n);else return n===Sb.value?(t=e.value!==void 0?e.value:0,()=>t):Sb[n]}function HQ(e){const n=e.field;return t=>t?n(t):NaN}ii(aM,_r,{transform(e,n){var t=n.fork(n.ALL),o=qQ(e),f=HQ(e),r=Rs(e.field),a=Rs(e.key),l=(e.groupby||[]).map(Rs),c=GQ(n.source,e.groupby,e.key,e.keyvals),i=[],s=this.value,u=c.domain.length,h,d,m,p,g,y,v,x,_,A;for(g=0,x=c.length;gy(g),r=[],a=o?o.slice():[],l={},c={},i,s,u,h,d,m,p,g;for(a.forEach((y,v)=>l[y]=v+1),h=0,p=e.length;ht.add(r))):(f=t.value=t.value||this.init(e),n.visit(n.REM,r=>t.rem(r)),n.visit(n.ADD,r=>t.add(r))),t.changes(),n.visit(n.SOURCE,r=>{Ea(r,f[t.cellkey(r)].tuple)}),n.reflow(o).modifies(this._outputs)},changes(){const e=this._adds,n=this._mods;let t,o;for(t=0,o=this._alen;t{const m=I6(d,a)[l],p=e.counts?d.length:1,g=s||ed(d);$w(m,g,u,h).forEach(y=>{const v={};for(let x=0;x(this._pending=Ti(f.data),r=>r.touch(this)))}:t.request(e.url,e.format).then(o=>v4(this,n,Ti(o.data)))}});function YQ(e){return e.modified("async")&&!(e.modified("values")||e.modified("url")||e.modified("format"))}function v4(e,n,t){t.forEach(oo);const o=n.fork(n.NO_FIELDS&n.NO_SOURCE);return o.rem=e.value,e.value=o.source=o.add=t,e._pending=null,o.rem.length&&o.clean(!0),o}function lM(e){_r.call(this,{},e)}lM.Definition={type:"Lookup",metadata:{modifies:!0},params:[{name:"index",type:"index",params:[{name:"from",type:"data",required:!0},{name:"key",type:"field",required:!0}]},{name:"values",type:"field",array:!0},{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0},{name:"default",default:null}]};ii(lM,_r,{transform(e,n){const t=e.fields,o=e.index,f=e.values,r=e.default==null?null:e.default,a=e.modified(),l=t.length;let c=a?n.SOURCE:n.ADD,i=n,s=e.as,u,h,d;return f?(h=f.length,l>1&&!s&&Pr('Multi-field lookup requires explicit "as" parameter.'),s&&s.length!==l*h&&Pr('The "as" parameter has too few output field names.'),s=s||f.map(Rs),u=function(m){for(var p=0,g=0,y,v;pn.modified(m.fields)),c|=d?n.MOD:0),n.visit(c,u),i.modifies(s)}});function JR(e){Po.call(this,null,XQ,e)}ii(JR,Po);function XQ(e){if(this.value&&!e.modified())return this.value;const n=e.extents,t=n.length;let o=1/0,f=-1/0,r,a;for(r=0;rf&&(f=a[1]);return[o,f]}function KR(e){Po.call(this,null,ZQ,e)}ii(KR,Po);function ZQ(e){return this.value&&!e.modified()?this.value:e.values.reduce((n,t)=>n.concat(t),[])}function QR(e){_r.call(this,null,e)}ii(QR,_r,{transform(e,n){return this.modified(e.modified()),this.value=e,n.fork(n.NO_SOURCE|n.NO_FIELDS)}});function uM(e){op.call(this,e)}uM.Definition={type:"Pivot",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"value",type:"field",required:!0},{name:"op",type:"enum",values:ex,default:"sum"},{name:"limit",type:"number",default:0},{name:"key",type:"field"}]};ii(uM,op,{_transform:op.prototype.transform,transform(e,n){return this._transform(JQ(e,n),n)}});function JQ(e,n){const t=e.field,o=e.value,f=(e.op==="count"?"__count__":e.op)||"sum",r=mu(t).concat(mu(o)),a=QQ(t,e.limit||0,n);return n.changed()&&e.set("__pivot__",null,null,!0),{key:e.key,groupby:e.groupby,ops:a.map(()=>f),fields:a.map(l=>KQ(l,t,o,r)),as:a.map(l=>l+""),modified:e.modified.bind(e)}}function KQ(e,n,t,o){return gc(f=>n(f)===e?t(f):NaN,o,e+"")}function QQ(e,n,t){const o={},f=[];return t.visit(t.SOURCE,r=>{const a=e(r);o[a]||(o[a]=1,f.push(a))}),f.sort(l6),n?f.slice(0,n):f}function ez(e){Vw.call(this,e)}ii(ez,Vw,{transform(e,n){const t=e.subflow,o=e.field,f=r=>this.subflow(Gi(r),t,n,r);return(e.modified("field")||o&&n.modified(mu(o)))&&Pr("PreFacet does not support field modification."),this.initTargets(),o?(n.visit(n.MOD,r=>{const a=f(r);o(r).forEach(l=>a.mod(l))}),n.visit(n.ADD,r=>{const a=f(r);o(r).forEach(l=>a.add(oo(l)))}),n.visit(n.REM,r=>{const a=f(r);o(r).forEach(l=>a.rem(l))})):(n.visit(n.MOD,r=>f(r).mod(r)),n.visit(n.ADD,r=>f(r).add(r)),n.visit(n.REM,r=>f(r).rem(r))),n.clean()&&n.runAfter(()=>this.clean()),n}});function cM(e){_r.call(this,null,e)}cM.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]};ii(cM,_r,{transform(e,n){const t=n.fork(n.NO_SOURCE),o=e.fields,f=qR(e.fields,e.as||[]),r=o?(l,c)=>eee(l,c,o,f):Fw;let a;return this.value?a=this.value:(n=n.addAll(),a=this.value={}),n.visit(n.REM,l=>{const c=Gi(l);t.rem.push(a[c]),a[c]=null}),n.visit(n.ADD,l=>{const c=r(l,oo({}));a[Gi(l)]=c,t.add.push(c)}),n.visit(n.MOD,l=>{t.mod.push(r(l,a[Gi(l)]))}),t}});function eee(e,n,t,o){for(let f=0,r=t.length;f{const h=C6(u,i);for(let d=0;d{const r=Gi(f);t.rem.push(o[r]),o[r]=null}),n.visit(n.ADD,f=>{const r=M6(f);o[Gi(f)]=r,t.add.push(r)}),n.visit(n.MOD,f=>{const r=o[Gi(f)];for(const a in f)r[a]=f[a],t.modifies(a);t.mod.push(r)})),t}});function hM(e){_r.call(this,[],e),this.count=0}hM.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]};ii(hM,_r,{transform(e,n){const t=n.fork(n.NO_SOURCE),o=e.modified("size"),f=e.size,r=this.value.reduce((s,u)=>(s[Gi(u)]=1,s),{});let a=this.value,l=this.count,c=0;function i(s){let u,h;a.length=c&&(u=a[h],r[Gi(u)]&&t.rem.push(u),a[h]=s)),++l}if(n.rem.length&&(n.visit(n.REM,s=>{const u=Gi(s);r[u]&&(r[u]=-1,t.rem.push(s)),--l}),a=a.filter(s=>r[Gi(s)]!==-1)),(n.rem.length||o)&&a.length{r[Gi(s)]||i(s)}),c=-1),o&&a.length>f){const s=a.length-f;for(let u=0;u{r[Gi(s)]&&t.mod.push(s)}),n.add.length&&n.visit(n.ADD,i),(n.add.length||c<0)&&(t.add=a.filter(s=>!r[Gi(s)])),this.count=l,this.value=t.source=a,t}});function dM(e){_r.call(this,null,e)}dM.Definition={type:"Sequence",metadata:{generates:!0,changes:!0},params:[{name:"start",type:"number",required:!0},{name:"stop",type:"number",required:!0},{name:"step",type:"number",default:1},{name:"as",type:"string",default:"data"}]};ii(dM,_r,{transform(e,n){if(this.value&&!e.modified())return;const t=n.materialize().fork(n.MOD),o=e.as||"data";return t.rem=this.value?n.rem.concat(this.value):n.rem,this.value=sc(e.start,e.stop,e.step||1).map(f=>{const r={};return r[o]=f,oo(r)}),t.add=n.add.concat(this.value),t}});function rz(e){_r.call(this,null,e),this.modified(!0)}ii(rz,_r,{transform(e,n){return this.value=n.source,n.changed()?n.fork(n.NO_SOURCE|n.NO_FIELDS):n.StopPropagation}});function pM(e){_r.call(this,null,e)}const iz=["unit0","unit1"];pM.Definition={type:"TimeUnit",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"units",type:"enum",values:y6,array:!0},{name:"step",type:"number",default:1},{name:"maxbins",type:"number",default:40},{name:"extent",type:"date",array:!0},{name:"timezone",type:"enum",default:"local",values:["local","utc"]},{name:"as",type:"string",array:!0,length:2,default:iz}]};ii(pM,_r,{transform(e,n){const t=e.field,o=e.interval!==!1,f=e.timezone==="utc",r=this._floor(e,n),a=(f?f1:c1)(r.unit).offset,l=e.as||iz,c=l[0],i=l[1],s=r.step;let u=r.start||1/0,h=r.stop||-1/0,d=n.ADD;return(e.modified()||n.changed(n.REM)||n.modified(mu(t)))&&(n=n.reflow(!0),d=n.SOURCE,u=1/0,h=-1/0),n.visit(d,m=>{const p=t(m);let g,y;p==null?(m[c]=null,o&&(m[i]=null)):(m[c]=g=y=r(p),o&&(m[i]=y=a(g,s)),gh&&(h=y))}),r.start=u,r.stop=h,n.modifies(o?l:c)},_floor(e,n){const t=e.timezone==="utc",{units:o,step:f}=e.units?{units:e.units,step:e.step||1}:YF({extent:e.extent||ed(n.materialize(n.SOURCE).source,e.field),maxbins:e.maxbins}),r=v6(o),a=this.value||{},l=(t?BF:NF)(r,f);return l.unit=qa(r),l.units=r,l.step=f,l.start=a.start,l.stop=a.stop,this.value=l}});function az(e){_r.call(this,Jv(),e)}ii(az,_r,{transform(e,n){const t=n.dataflow,o=e.field,f=this.value,r=l=>f.set(o(l),l);let a=!0;return e.modified("field")||n.modified(o.fields)?(f.clear(),n.visit(n.SOURCE,r)):n.changed()?(n.visit(n.REM,l=>f.delete(o(l))),n.visit(n.ADD,r)):a=!1,this.modified(a),f.empty>t.cleanThreshold&&t.runAfter(f.clean),n.fork()}});function oz(e){_r.call(this,null,e)}ii(oz,_r,{transform(e,n){(!this.value||e.modified("field")||e.modified("sort")||n.changed()||e.sort&&n.modified(e.sort.fields))&&(this.value=(e.sort?n.source.slice().sort(rg(e.sort)):n.source).map(e.field))}});function nee(e,n,t,o){const f=mv[e](n,t);return{init:f.init||u0,update:function(r,a){a[o]=f.next(r)}}}const mv={row_number:function(){return{next:e=>e.index+1}},rank:function(){let e;return{init:()=>e=1,next:n=>{const t=n.index,o=n.data;return t&&n.compare(o[t-1],o[t])?e=t+1:e}}},dense_rank:function(){let e;return{init:()=>e=1,next:n=>{const t=n.index,o=n.data;return t&&n.compare(o[t-1],o[t])?++e:e}}},percent_rank:function(){const e=mv.rank(),n=e.next;return{init:e.init,next:t=>(n(t)-1)/(t.data.length-1)}},cume_dist:function(){let e;return{init:()=>e=0,next:n=>{const t=n.data,o=n.compare;let f=n.index;if(e0||Pr("ntile num must be greater than zero.");const t=mv.cume_dist(),o=t.next;return{init:t.init,next:f=>Math.ceil(n*o(f))}},lag:function(e,n){return n=+n||1,{next:t=>{const o=t.index-n;return o>=0?e(t.data[o]):null}}},lead:function(e,n){return n=+n||1,{next:t=>{const o=t.index+n,f=t.data;return oe(n.data[n.i0])}},last_value:function(e){return{next:n=>e(n.data[n.i1-1])}},nth_value:function(e,n){return n=+n,n>0||Pr("nth_value nth must be greater than zero."),{next:t=>{const o=t.i0+(n-1);return on=null,next:t=>{const o=e(t.data[t.index]);return o!=null?n=o:n}}},next_value:function(e){let n,t;return{init:()=>(n=null,t=-1),next:o=>{const f=o.data;return o.index<=t?n:(t=ree(e,f,o.index))<0?(t=f.length,n=null):n=e(f[t])}}}};function ree(e,n,t){for(let o=n.length;tl[m]=1)}h(e.sort),n.forEach((d,m)=>{const p=t[m],g=Rs(p),y=RR(d,g,f[m]);if(h(p),r.push(y),Yi(mv,d))a.push(nee(d,t[m],o[m],y));else{if(p==null&&d!=="count"&&Pr("Null aggregate field specified."),d==="count"){i.push(y);return}u=!1;let v=c[g];v||(v=c[g]=[],v.field=p,s.push(v)),v.push(zR(d,y))}}),(i.length||s.length)&&(this.cell=aee(s,i,u)),this.inputs=Object.keys(l)}const lz=sz.prototype;lz.init=function(){this.windows.forEach(e=>e.init()),this.cell&&this.cell.init()};lz.update=function(e,n){const t=this.cell,o=this.windows,f=e.data,r=o&&o.length;let a;if(t){for(a=e.p0;aBR(c,c.field));const o={num:0,agg:null,store:!1,count:n};if(!t)for(var f=e.length,r=o.agg=Array(f),a=0;athis.group(f(l));let a=this.state;(!a||t)&&(a=this.state=new sz(e)),t||n.modified(a.inputs)?(this.value={},n.visit(n.SOURCE,l=>r(l).add(l))):(n.visit(n.REM,l=>r(l).remove(l)),n.visit(n.ADD,l=>r(l).add(l)));for(let l=0,c=this._mlen;l0&&!f(r[t],r[t-1])&&(e.i0=n.left(r,r[t])),o1?0:e<-1?Cm:Math.acos(e)}function P7(e){return e>=1?W2:e<=-1?-W2:Math.asin(e)}function hee(e){return e.innerRadius}function dee(e){return e.outerRadius}function pee(e){return e.startAngle}function gee(e){return e.endAngle}function mee(e){return e&&e.padAngle}function yee(e,n,t,o,f,r,a,l){var c=t-e,i=o-n,s=a-f,u=l-r,h=u*c-s*i;if(!(h*hL*L+R*R&&(w=T,M=E),{cx:w,cy:M,x01:-s,y01:-u,x11:w*(f/A-1),y11:M*(f/A-1)}}function vee(){var e=hee,n=dee,t=Qo(0),o=null,f=pee,r=gee,a=mee,l=null;function c(){var i,s,u=+e.apply(this,arguments),h=+n.apply(this,arguments),d=f.apply(this,arguments)-W2,m=r.apply(this,arguments)-W2,p=O7(m-d),g=m>d;if(l||(l=i=r1()),hjl))l.moveTo(0,0);else if(p>uz-jl)l.moveTo(h*Wp(d),h*Bf(d)),l.arc(0,0,h,d,m,!g),u>jl&&(l.moveTo(u*Wp(m),u*Bf(m)),l.arc(0,0,u,m,d,g));else{var y=d,v=m,x=d,_=m,A=p,b=p,k=a.apply(this,arguments)/2,w=k>jl&&(o?+o.apply(this,arguments):m0(u*u+h*h)),M=x4(O7(h-u)/2,+t.apply(this,arguments)),T=M,E=M,S,P;if(w>jl){var L=P7(w/u*Bf(k)),R=P7(w/h*Bf(k));(A-=L*2)>jl?(L*=g?1:-1,x+=L,_-=L):(A=0,x=_=(d+m)/2),(b-=R*2)>jl?(R*=g?1:-1,y+=R,v-=R):(b=0,y=v=(d+m)/2)}var F=h*Wp(y),D=h*Bf(y),O=u*Wp(_),N=u*Bf(_);if(M>jl){var B=h*Wp(v),W=h*Bf(v),G=u*Wp(x),K=u*Bf(x),te;if(pjl?E>jl?(S=Cb(G,K,F,D,h,E,g),P=Cb(B,W,O,N,h,E,g),l.moveTo(S.cx+S.x01,S.cy+S.y01),Ejl)||!(A>jl)?l.lineTo(O,N):T>jl?(S=Cb(O,N,B,W,u,-T,g),P=Cb(F,D,G,K,u,-T,g),l.lineTo(S.cx+S.x01,S.cy+S.y01),T=h;--d)l.point(v[d],x[d]);l.lineEnd(),l.areaEnd()}g&&(v[u]=+e(p,u,s),x[u]=+n(p,u,s),l.point(o?+o(p,u,s):v[u],t?+t(p,u,s):x[u]))}if(y)return l=null,y+""||null}function i(){return TI().defined(f).curve(a).context(r)}return c.x=function(s){return arguments.length?(e=typeof s=="function"?s:Qo(+s),o=null,c):e},c.x0=function(s){return arguments.length?(e=typeof s=="function"?s:Qo(+s),c):e},c.x1=function(s){return arguments.length?(o=s==null?null:typeof s=="function"?s:Qo(+s),c):o},c.y=function(s){return arguments.length?(n=typeof s=="function"?s:Qo(+s),t=null,c):n},c.y0=function(s){return arguments.length?(n=typeof s=="function"?s:Qo(+s),c):n},c.y1=function(s){return arguments.length?(t=s==null?null:typeof s=="function"?s:Qo(+s),c):t},c.lineX0=c.lineY0=function(){return i().x(e).y(n)},c.lineY1=function(){return i().x(e).y(t)},c.lineX1=function(){return i().x(o).y(n)},c.defined=function(s){return arguments.length?(f=typeof s=="function"?s:Qo(!!s),c):f},c.curve=function(s){return arguments.length?(a=s,r!=null&&(l=a(r)),c):a},c.context=function(s){return arguments.length?(s==null?r=l=null:l=a(r=s),c):r},c}const xee={draw(e,n){const t=m0(n/Cm);e.moveTo(t,0),e.arc(0,0,t,0,uz)}};function bee(e,n){let t=null;e=typeof e=="function"?e:Qo(e||xee),n=typeof n=="function"?n:Qo(n===void 0?64:+n);function o(){let f;if(t||(t=f=r1()),e.apply(this,arguments).draw(t,+n.apply(this,arguments)),f)return t=null,f+""||null}return o.type=function(f){return arguments.length?(e=typeof f=="function"?f:Qo(f),o):e},o.size=function(f){return arguments.length?(n=typeof f=="function"?f:Qo(+f),o):n},o.context=function(f){return arguments.length?(t=f??null,o):t},o}function sp(){}function Y2(e,n,t){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+n)/6,(e._y0+4*e._y1+t)/6)}function qw(e){this._context=e}qw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Y2(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,n){switch(e=+e,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Y2(this,e,n);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=n}};function _ee(e){return new qw(e)}function fz(e){this._context=e}fz.prototype={areaStart:sp,areaEnd:sp,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,n){switch(e=+e,n=+n,this._point){case 0:this._point=1,this._x2=e,this._y2=n;break;case 1:this._point=2,this._x3=e,this._y3=n;break;case 2:this._point=3,this._x4=e,this._y4=n,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+n)/6);break;default:Y2(this,e,n);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=n}};function wee(e){return new fz(e)}function hz(e){this._context=e}hz.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,n){switch(e=+e,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var t=(this._x0+4*this._x1+e)/6,o=(this._y0+4*this._y1+n)/6;this._line?this._context.lineTo(t,o):this._context.moveTo(t,o);break;case 3:this._point=4;default:Y2(this,e,n);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=n}};function Aee(e){return new hz(e)}function dz(e,n){this._basis=new qw(e),this._beta=n}dz.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,n=this._y,t=e.length-1;if(t>0)for(var o=e[0],f=n[0],r=e[t]-o,a=n[t]-f,l=-1,c;++l<=t;)c=l/t,this._basis.point(this._beta*e[l]+(1-this._beta)*(o+c*r),this._beta*n[l]+(1-this._beta)*(f+c*a));this._x=this._y=null,this._basis.lineEnd()},point:function(e,n){this._x.push(+e),this._y.push(+n)}};const kee=function e(n){function t(o){return n===1?new qw(o):new dz(o,n)}return t.beta=function(o){return e(+o)},t}(.85);function X2(e,n,t){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-n),e._y2+e._k*(e._y1-t),e._x2,e._y2)}function mM(e,n){this._context=e,this._k=(1-n)/6}mM.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:X2(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,n){switch(e=+e,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break;case 1:this._point=2,this._x1=e,this._y1=n;break;case 2:this._point=3;default:X2(this,e,n);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=n}};const Tee=function e(n){function t(o){return new mM(o,n)}return t.tension=function(o){return e(+o)},t}(0);function yM(e,n){this._context=e,this._k=(1-n)/6}yM.prototype={areaStart:sp,areaEnd:sp,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,n){switch(e=+e,n=+n,this._point){case 0:this._point=1,this._x3=e,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=n);break;case 2:this._point=3,this._x5=e,this._y5=n;break;default:X2(this,e,n);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=n}};const Mee=function e(n){function t(o){return new yM(o,n)}return t.tension=function(o){return e(+o)},t}(0);function vM(e,n){this._context=e,this._k=(1-n)/6}vM.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,n){switch(e=+e,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:X2(this,e,n);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=n}};const Eee=function e(n){function t(o){return new vM(o,n)}return t.tension=function(o){return e(+o)},t}(0);function xM(e,n,t){var o=e._x1,f=e._y1,r=e._x2,a=e._y2;if(e._l01_a>jl){var l=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,c=3*e._l01_a*(e._l01_a+e._l12_a);o=(o*l-e._x0*e._l12_2a+e._x2*e._l01_2a)/c,f=(f*l-e._y0*e._l12_2a+e._y2*e._l01_2a)/c}if(e._l23_a>jl){var i=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,s=3*e._l23_a*(e._l23_a+e._l12_a);r=(r*i+e._x1*e._l23_2a-n*e._l12_2a)/s,a=(a*i+e._y1*e._l23_2a-t*e._l12_2a)/s}e._context.bezierCurveTo(o,f,r,a,e._x2,e._y2)}function pz(e,n){this._context=e,this._alpha=n}pz.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,n){if(e=+e,n=+n,this._point){var t=this._x2-e,o=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+o*o,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break;case 1:this._point=2;break;case 2:this._point=3;default:xM(this,e,n);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=n}};const See=function e(n){function t(o){return n?new pz(o,n):new mM(o,0)}return t.alpha=function(o){return e(+o)},t}(.5);function gz(e,n){this._context=e,this._alpha=n}gz.prototype={areaStart:sp,areaEnd:sp,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,n){if(e=+e,n=+n,this._point){var t=this._x2-e,o=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+o*o,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=n);break;case 2:this._point=3,this._x5=e,this._y5=n;break;default:xM(this,e,n);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=n}};const Cee=function e(n){function t(o){return n?new gz(o,n):new yM(o,0)}return t.alpha=function(o){return e(+o)},t}(.5);function mz(e,n){this._context=e,this._alpha=n}mz.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,n){if(e=+e,n=+n,this._point){var t=this._x2-e,o=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+o*o,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:xM(this,e,n);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=n}};const Lee=function e(n){function t(o){return n?new mz(o,n):new vM(o,0)}return t.alpha=function(o){return e(+o)},t}(.5);function yz(e){this._context=e}yz.prototype={areaStart:sp,areaEnd:sp,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,n){e=+e,n=+n,this._point?this._context.lineTo(e,n):(this._point=1,this._context.moveTo(e,n))}};function Dee(e){return new yz(e)}function I7(e){return e<0?-1:1}function F7(e,n,t){var o=e._x1-e._x0,f=n-e._x1,r=(e._y1-e._y0)/(o||f<0&&-0),a=(t-e._y1)/(f||o<0&&-0),l=(r*f+a*o)/(o+f);return(I7(r)+I7(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(l))||0}function R7(e,n){var t=e._x1-e._x0;return t?(3*(e._y1-e._y0)/t-n)/2:n}function b4(e,n,t){var o=e._x0,f=e._y0,r=e._x1,a=e._y1,l=(r-o)/3;e._context.bezierCurveTo(o+l,f+l*n,r-l,a-l*t,r,a)}function Z2(e){this._context=e}Z2.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:b4(this,this._t0,R7(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,n){var t=NaN;if(e=+e,n=+n,!(e===this._x1&&n===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break;case 1:this._point=2;break;case 2:this._point=3,b4(this,R7(this,t=F7(this,e,n)),t);break;default:b4(this,this._t0,t=F7(this,e,n));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=n,this._t0=t}}};function vz(e){this._context=new xz(e)}(vz.prototype=Object.create(Z2.prototype)).point=function(e,n){Z2.prototype.point.call(this,n,e)};function xz(e){this._context=e}xz.prototype={moveTo:function(e,n){this._context.moveTo(n,e)},closePath:function(){this._context.closePath()},lineTo:function(e,n){this._context.lineTo(n,e)},bezierCurveTo:function(e,n,t,o,f,r){this._context.bezierCurveTo(n,e,o,t,r,f)}};function Oee(e){return new Z2(e)}function Pee(e){return new vz(e)}function bz(e){this._context=e}bz.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,n=this._y,t=e.length;if(t)if(this._line?this._context.lineTo(e[0],n[0]):this._context.moveTo(e[0],n[0]),t===2)this._context.lineTo(e[1],n[1]);else for(var o=z7(e),f=z7(n),r=0,a=1;a=0;--n)f[n]=(a[n]-f[n+1])/r[n];for(r[t-1]=(e[t]+f[t-1])/2,n=0;n=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,n){switch(e=+e,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,n),this._context.lineTo(e,n);else{var t=this._x*(1-this._t)+e*this._t;this._context.lineTo(t,this._y),this._context.lineTo(t,n)}break}}this._x=e,this._y=n}};function Fee(e){return new Hw(e,.5)}function Ree(e){return new Hw(e,0)}function zee(e){return new Hw(e,1)}function Qd(e,n){if(typeof document<"u"&&document.createElement){const t=document.createElement("canvas");if(t&&t.getContext)return t.width=e,t.height=n,t}return null}const Nee=()=>typeof Image<"u"?Image:null,rk=Symbol("implicit");function bM(){var e=new a7,n=[],t=[],o=rk;function f(r){let a=e.get(r);if(a===void 0){if(o!==rk)return o;e.set(r,a=n.push(r)-1)}return t[a%t.length]}return f.domain=function(r){if(!arguments.length)return n.slice();n=[],e=new a7;for(const a of r)e.has(a)||e.set(a,n.push(a)-1);return f},f.range=function(r){return arguments.length?(t=Array.from(r),f):t.slice()},f.unknown=function(r){return arguments.length?(o=r,f):o},f.copy=function(){return bM(n,t).unknown(o)},ad.apply(f,arguments),f}const _z=Math.PI/180,wz=180/Math.PI,J2=18,Az=.96422,kz=1,Tz=.82521,Mz=4/29,mm=6/29,Ez=3*mm*mm,Bee=mm*mm*mm;function Sz(e){if(e instanceof eh)return new eh(e.l,e.a,e.b,e.opacity);if(e instanceof Gh)return Cz(e);e instanceof vw||(e=MI(e));var n=k4(e.r),t=k4(e.g),o=k4(e.b),f=_4((.2225045*n+.7168786*t+.0606169*o)/kz),r,a;return n===t&&t===o?r=a=f:(r=_4((.4360747*n+.3850649*t+.1430804*o)/Az),a=_4((.0139322*n+.0971045*t+.7141733*o)/Tz)),new eh(116*f-16,500*(r-f),200*(f-a),e.opacity)}function K2(e,n,t,o){return arguments.length===1?Sz(e):new eh(e,n,t,o??1)}function eh(e,n,t,o){this.l=+e,this.a=+n,this.b=+t,this.opacity=+o}WT(eh,K2,YT(XT,{brighter:function(e){return new eh(this.l+J2*(e??1),this.a,this.b,this.opacity)},darker:function(e){return new eh(this.l-J2*(e??1),this.a,this.b,this.opacity)},rgb:function(){var e=(this.l+16)/116,n=isNaN(this.a)?e:e+this.a/500,t=isNaN(this.b)?e:e-this.b/200;return n=Az*w4(n),e=kz*w4(e),t=Tz*w4(t),new vw(A4(3.1338561*n-1.6168667*e-.4906146*t),A4(-.9787684*n+1.9161415*e+.033454*t),A4(.0719453*n-.2289914*e+1.4052427*t),this.opacity)}}));function _4(e){return e>Bee?Math.pow(e,1/3):e/Ez+Mz}function w4(e){return e>mm?e*e*e:Ez*(e-Mz)}function A4(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function k4(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function jee(e){if(e instanceof Gh)return new Gh(e.h,e.c,e.l,e.opacity);if(e instanceof eh||(e=Sz(e)),e.a===0&&e.b===0)return new Gh(NaN,0180?s+=360:s-i>180&&(i+=360),h.push({i:u.push(f(u)+"rotate(",null,o)-2,x:i0(i,s)})):s&&u.push(f(u)+"rotate("+s+o)}function l(i,s,u,h){i!==s?h.push({i:u.push(f(u)+"skewX(",null,o)-2,x:i0(i,s)}):s&&u.push(f(u)+"skewX("+s+o)}function c(i,s,u,h,d,m){if(i!==u||s!==h){var p=d.push(f(d)+"scale(",null,",",null,")");m.push({i:p-4,x:i0(i,u)},{i:p-2,x:i0(s,h)})}else(u!==1||h!==1)&&d.push(f(d)+"scale("+u+","+h+")")}return function(i,s){var u=[],h=[];return i=e(i),s=e(s),r(i.translateX,i.translateY,s.translateX,s.translateY,u,h),a(i.rotate,s.rotate,u,h),l(i.skewX,s.skewX,u,h),c(i.scaleX,i.scaleY,s.scaleX,s.scaleY,u,h),i=s=null,function(d){for(var m=-1,p=h.length,g;++mMath.pow(e,n)}function fte(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),n=>Math.log(n)/e)}function H7(e){return(n,t)=>-e(-n,t)}function kM(e){const n=e(V7,q7),t=n.domain;let o=10,f,r;function a(){return f=fte(o),r=cte(o),t()[0]<0?(f=H7(f),r=H7(r),e(ste,lte)):e(V7,q7),n}return n.base=function(l){return arguments.length?(o=+l,a()):o},n.domain=function(l){return arguments.length?(t(l),a()):t()},n.ticks=l=>{const c=t();let i=c[0],s=c[c.length-1];const u=s0){for(;h<=d;++h)for(m=1;ms)break;y.push(p)}}else for(;h<=d;++h)for(m=o-1;m>=1;--m)if(p=h>0?m/r(-h):m*r(h),!(ps)break;y.push(p)}y.length*2{if(l==null&&(l=10),c==null&&(c=o===10?"s":","),typeof c!="function"&&(!(o%1)&&(c=FA(c)).precision==null&&(c.trim=!0),c=AI(c)),l===1/0)return c;const i=Math.max(1,o*l/n.ticks().length);return s=>{let u=s/r(Math.round(f(s)));return u*ot(zz(t(),{floor:l=>r(Math.floor(f(l))),ceil:l=>r(Math.ceil(f(l)))})),n}function Nz(){const e=kM(ZT()).domain([1,10]);return e.copy=()=>_w(e,Nz()).base(e.base()),ad.apply(e,arguments),e}function G7(e){return function(n){return Math.sign(n)*Math.log1p(Math.abs(n/e))}}function W7(e){return function(n){return Math.sign(n)*Math.expm1(Math.abs(n))*e}}function TM(e){var n=1,t=e(G7(n),W7(n));return t.constant=function(o){return arguments.length?e(G7(n=+o),W7(n)):n},i1(t)}function Bz(){var e=TM(ZT());return e.copy=function(){return _w(e,Bz()).constant(e.constant())},ad.apply(e,arguments)}function Y7(e){return function(n){return n<0?-Math.pow(-n,e):Math.pow(n,e)}}function hte(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function dte(e){return e<0?-e*e:e*e}function MM(e){var n=e(Rd,Rd),t=1;function o(){return t===1?e(Rd,Rd):t===.5?e(hte,dte):e(Y7(t),Y7(1/t))}return n.exponent=function(f){return arguments.length?(t=+f,o()):t},i1(n)}function EM(){var e=MM(ZT());return e.copy=function(){return _w(e,EM()).exponent(e.exponent())},ad.apply(e,arguments),e}function pte(){return EM.apply(null,arguments).exponent(.5)}function jz(){var e=[],n=[],t=[],o;function f(){var a=0,l=Math.max(1,n.length);for(t=new Array(l-1);++a0?t[l-1]:e[0],l=t?[o[t-1],n]:[o[i-1],o[i]]},a.unknown=function(c){return arguments.length&&(r=c),a},a.thresholds=function(){return o.slice()},a.copy=function(){return Uz().domain([e,n]).range(f).unknown(r)},ad.apply(i1(a),arguments)}function $z(){var e=[.5],n=[0,1],t,o=1;function f(r){return r!=null&&r<=r?n[ww(e,r,0,o)]:t}return f.domain=function(r){return arguments.length?(e=Array.from(r),o=Math.min(e.length,n.length-1),f):e.slice()},f.range=function(r){return arguments.length?(n=Array.from(r),o=Math.min(e.length,n.length-1),f):n.slice()},f.invertExtent=function(r){var a=n.indexOf(r);return[e[a-1],e[a]]},f.unknown=function(r){return arguments.length?(t=r,f):t},f.copy=function(){return $z().domain(e).range(n).unknown(t)},ad.apply(f,arguments)}function gte(e){return new Date(e)}function mte(e){return e instanceof Date?+e:+new Date(+e)}function SM(e,n,t,o,f,r,a,l,c,i){var s=vY(),u=s.invert,h=s.domain,d=i(".%L"),m=i(":%S"),p=i("%I:%M"),g=i("%I %p"),y=i("%a %d"),v=i("%b %d"),x=i("%B"),_=i("%Y");function A(b){return(c(b)0?o:1:0}const _te="identity",Lm="linear",td="log",tx="pow",nx="sqrt",Xw="symlog",P0="time",I0="utc",th="sequential",d1="diverging",Dm="quantile",Zw="quantize",Jw="threshold",PM="ordinal",ok="point",Yz="band",IM="bin-ordinal",el="continuous",rx="discrete",ix="discretizing",Pc="interpolating",FM="temporal";function wte(e){return function(n){let t=n[0],o=n[1],f;return o=o&&t[c]<=f&&(r<0&&(r=c),a=c);if(!(r<0))return o=e.invertExtent(t[r]),f=e.invertExtent(t[a]),[o[0]===void 0?o[1]:o[0],f[1]===void 0?f[0]:f[1]]}}function RM(){const e=bM().unknown(void 0),n=e.domain,t=e.range;let o=[0,1],f,r,a=!1,l=0,c=0,i=.5;delete e.unknown;function s(){const u=n().length,h=o[1]p+f*y);return t(h?g.reverse():g)}return e.domain=function(u){return arguments.length?(n(u),s()):n()},e.range=function(u){return arguments.length?(o=[+u[0],+u[1]],s()):o.slice()},e.rangeRound=function(u){return o=[+u[0],+u[1]],a=!0,s()},e.bandwidth=function(){return r},e.step=function(){return f},e.round=function(u){return arguments.length?(a=!!u,s()):a},e.padding=function(u){return arguments.length?(c=Math.max(0,Math.min(1,u)),l=c,s()):l},e.paddingInner=function(u){return arguments.length?(l=Math.max(0,Math.min(1,u)),s()):l},e.paddingOuter=function(u){return arguments.length?(c=Math.max(0,Math.min(1,u)),s()):c},e.align=function(u){return arguments.length?(i=Math.max(0,Math.min(1,u)),s()):i},e.invertRange=function(u){if(u[0]==null||u[1]==null)return;const h=o[1]o[1-h])))return y=Math.max(0,zA(d,p)-1),v=p===g?y:zA(d,g)-1,p-d[y]>r+1e-10&&++y,h&&(x=y,y=m-v,v=m-x),y>v?void 0:n().slice(y,v+1)},e.invert=function(u){const h=e.invertRange([u,u]);return h&&h[0]},e.copy=function(){return RM().domain(n()).range(o).round(a).paddingInner(l).paddingOuter(c).align(i)},s()}function Xz(e){const n=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,e.copy=function(){return Xz(n())},e}function kte(){return Xz(RM().paddingInner(1))}var Tte=Array.prototype.map;function Mte(e){return Tte.call(e,pu)}const Ete=Array.prototype.slice;function Zz(){let e=[],n=[];function t(o){return o==null||o!==o?void 0:n[(ww(e,o)-1)%n.length]}return t.domain=function(o){return arguments.length?(e=Mte(o),t):e.slice()},t.range=function(o){return arguments.length?(n=Ete.call(o),t):n.slice()},t.tickFormat=function(o,f){return bY(e[0],qa(e),o??10,f)},t.copy=function(){return Zz().domain(t.domain()).range(t.range())},t}const e_={};function Ste(e,n,t){const o=function(){const r=n();return r.invertRange||(r.invertRange=r.invert?wte(r):r.invertExtent?Ate(r):void 0),r.type=e,r};return o.metadata=sh(Ti(t)),o}function Ka(e,n,t){return arguments.length>1?(e_[e]=Ste(e,n,t),this):Jz(e)?e_[e]:void 0}Ka(_te,Rz);Ka(Lm,xY,el);Ka(td,Nz,[el,td]);Ka(tx,EM,el);Ka(nx,pte,el);Ka(Xw,Bz,el);Ka(P0,yte,[el,FM]);Ka(I0,vte,[el,FM]);Ka(th,CM,[el,Pc]);Ka("".concat(th,"-").concat(Lm),CM,[el,Pc]);Ka("".concat(th,"-").concat(td),Vz,[el,Pc,td]);Ka("".concat(th,"-").concat(tx),LM,[el,Pc]);Ka("".concat(th,"-").concat(nx),xte,[el,Pc]);Ka("".concat(th,"-").concat(Xw),qz,[el,Pc]);Ka("".concat(d1,"-").concat(Lm),Hz,[el,Pc]);Ka("".concat(d1,"-").concat(td),Gz,[el,Pc,td]);Ka("".concat(d1,"-").concat(tx),DM,[el,Pc]);Ka("".concat(d1,"-").concat(nx),bte,[el,Pc]);Ka("".concat(d1,"-").concat(Xw),Wz,[el,Pc]);Ka(Dm,jz,[ix,Dm]);Ka(Zw,Uz,ix);Ka(Jw,$z,ix);Ka(IM,Zz,[rx,ix]);Ka(PM,bM,rx);Ka(Yz,RM,rx);Ka(ok,kte,rx);function Jz(e){return Yi(e_,e)}function ag(e,n){const t=e_[e];return t&&t.metadata[n]}function zM(e){return ag(e,el)}function Om(e){return ag(e,rx)}function sk(e){return ag(e,ix)}function Kz(e){return ag(e,td)}function Cte(e){return ag(e,FM)}function Qz(e){return ag(e,Pc)}function eN(e){return ag(e,Dm)}const Lte=["clamp","base","constant","exponent"];function tN(e,n){const t=n[0],o=qa(n)-t;return function(f){return e(t+f*o)}}function Kw(e,n,t){return AM(NM(n||"rgb",t),e)}function nN(e,n){const t=new Array(n),o=n+1;for(let f=0;fe[l]?a[l](e[l]()):0),a)}function NM(e,n){const t=ote[Dte(e)];return n!=null&&t&&t.gamma?t.gamma(n):t}function Dte(e){return"interpolate"+e.toLowerCase().split("-").map(n=>n[0].toUpperCase()+n.slice(1)).join("")}const Ote={blues:"cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90",greens:"d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429",greys:"e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e",oranges:"fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303",purples:"e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c",reds:"fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13",blueGreen:"d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429",bluePurple:"ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71",greenBlue:"d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1",orangeRed:"fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403",purpleBlue:"dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281",purpleBlueGreen:"dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353",purpleRed:"dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a",redPurple:"fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174",yellowGreen:"e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034",yellowOrangeBrown:"feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204",yellowOrangeRed:"fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225",blueOrange:"134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07",brownBlueGreen:"704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147",purpleGreen:"5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29",purpleOrange:"4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07",redBlue:"8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85",redGrey:"8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434",yellowGreenBlue:"eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185",redYellowBlue:"a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695",redYellowGreen:"a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837",pinkYellowGreen:"8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419",spectral:"9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2",viridis:"440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725",magma:"0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf",inferno:"0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4",plasma:"0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921",cividis:"00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647",rainbow:"6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa",sinebow:"ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040",turbo:"23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00",browns:"eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632",tealBlues:"bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985",teals:"bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667",warmGreys:"dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e",goldGreen:"f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36",goldOrange:"f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26",goldRed:"f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e",lightGreyRed:"efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b",lightGreyTeal:"e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc",lightMulti:"e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c",lightOrange:"f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b",lightTealBlue:"e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988",darkBlue:"3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff",darkGold:"3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff",darkGreen:"3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa",darkMulti:"3737371f5287197d8c29a86995ce3fffe800ffffff",darkRed:"3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c"},Pte={category10:"1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf",category20:"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5",category20b:"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6",category20c:"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9",tableau10:"4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac",tableau20:"4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5",accent:"7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666",dark2:"1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666",paired:"a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928",pastel1:"fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2",pastel2:"b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc",set1:"e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999",set2:"66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3",set3:"8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"};function iN(e){const n=e.length/6|0,t=new Array(n);for(let o=0;oKw(iN(e)));function BM(e,n){return e=e&&e.toLowerCase(),arguments.length>1?(X7[e]=n,this):X7[e]}const h2="symbol",Ite="discrete",Fte="gradient",Rte=e=>zr(e)?e.map(n=>String(n)):String(e),zte=(e,n)=>e[1]-n[1],Nte=(e,n)=>n[1]-e[1];function jM(e,n,t){let o;return Eo(n)&&(e.bins&&(n=Math.max(n,e.bins.length)),t!=null&&(n=Math.min(n,Math.floor(Lw(e.domain())/t||1)))),Si(n)&&(o=n.step,n=n.interval),Li(n)&&(n=e.type===P0?c1(n):e.type==I0?f1(n):Pr("Only time and utc scales accept interval strings."),o&&(n=n.every(o))),n}function oN(e,n,t){let o=e.range(),f=o[0],r=qa(o),a=zte;if(f>r&&(o=r,r=f,f=o,a=Nte),f=Math.floor(f),r=Math.ceil(r),n=n.map(l=>[l,e(l)]).filter(l=>f<=l[1]&&l[1]<=r).sort(a).map(l=>l[0]),t>0&&n.length>1){const l=[n[0],qa(n)];for(;n.length>t&&n.length>=3;)n=n.filter((c,i)=>!(i%2));n.length<3&&(n=l)}return n}function UM(e,n){return e.bins?oN(e,e.bins):e.ticks?e.ticks(n):e.domain()}function sN(e,n,t,o,f,r){const a=n.type;let l=Rte;if(a===P0||f===P0)l=e.timeFormat(o);else if(a===I0||f===I0)l=e.utcFormat(o);else if(Kz(a)){const c=e.formatFloat(o);if(r||n.bins)l=c;else{const i=lN(n,t,!1);l=s=>i(s)?c(s):""}}else if(n.tickFormat){const c=n.domain();l=e.formatSpan(c[0],c[c.length-1],t,o)}else o&&(l=e.format(o));return l}function lN(e,n,t){const o=UM(e,n),f=e.base(),r=Math.log(f),a=Math.max(1,f*n/o.length),l=c=>{let i=c/Math.pow(f,Math.round(Math.log(c)/r));return i*f1?o[1]-o[0]:o[0],a;for(a=1;alk[e.type]||e.bins;function fN(e,n,t,o,f,r,a){const l=uN[n.type]&&r!==P0&&r!==I0?Bte(e,n,f):sN(e,n,t,f,r,a);return o===h2&&$te(n)?Vte(l):o===Ite?qte(l):Hte(l)}const Vte=e=>(n,t,o)=>{const f=Z7(o[t+1],Z7(o.max,1/0)),r=J7(n,e),a=J7(f,e);return r&&a?r+" – "+a:a?"< "+a:"≥ "+r},Z7=(e,n)=>e??n,qte=e=>(n,t)=>t?e(n):null,Hte=e=>n=>e(n),J7=(e,n)=>Number.isFinite(e)?n(e):null;function Gte(e){const n=e.domain(),t=n.length-1;let o=+n[0],f=+qa(n),r=f-o;if(e.type===Jw){const a=t?r/t:.1;o-=a,f+=a,r=f-o}return a=>(a-o)/r}function Wte(e,n,t,o){const f=o||n.type;return Li(t)&&Cte(f)&&(t=t.replace(/%a/g,"%A").replace(/%b/g,"%B")),!t&&f===P0?e.timeFormat("%A, %d %B %Y, %X"):!t&&f===I0?e.utcFormat("%A, %d %B %Y, %X UTC"):fN(e,n,5,null,t,o,!0)}function hN(e,n,t){t=t||{};const o=Math.max(3,t.maxlen||7),f=Wte(e,n,t.format,t.formatType);if(sk(n.type)){const r=cN(n).slice(1).map(f),a=r.length;return"".concat(a," boundar").concat(a===1?"y":"ies",": ").concat(r.join(", "))}else if(Om(n.type)){const r=n.domain(),a=r.length,l=a>o?r.slice(0,o-2).map(f).join(", ")+", ending with "+r.slice(-1).map(f):r.map(f).join(", ");return"".concat(a," value").concat(a===1?"":"s",": ").concat(l)}else{const r=n.domain();return"values from ".concat(f(r[0])," to ").concat(f(qa(r)))}}let dN=0;function Yte(){dN=0}const t_="p_";function $M(e){return e&&e.gradient}function pN(e,n,t){const o=e.gradient;let f=e.id,r=o==="radial"?t_:"";return f||(f=e.id="gradient_"+dN++,o==="radial"?(e.x1=jf(e.x1,.5),e.y1=jf(e.y1,.5),e.r1=jf(e.r1,0),e.x2=jf(e.x2,.5),e.y2=jf(e.y2,.5),e.r2=jf(e.r2,.5),r=t_):(e.x1=jf(e.x1,0),e.y1=jf(e.y1,0),e.x2=jf(e.x2,1),e.y2=jf(e.y2,0))),n[f]=e,"url("+(t||"")+"#"+r+f+")"}function jf(e,n){return e??n}function gN(e,n){var t=[],o;return o={gradient:"linear",x1:e?e[0]:0,y1:e?e[1]:0,x2:n?n[0]:1,y2:n?n[1]:0,stops:t,stop:function(f,r){return t.push({offset:f,color:r}),o}}}const K7={basis:{curve:_ee},"basis-closed":{curve:wee},"basis-open":{curve:Aee},bundle:{curve:kee,tension:"beta",value:.85},cardinal:{curve:Tee,tension:"tension",value:0},"cardinal-open":{curve:Eee,tension:"tension",value:0},"cardinal-closed":{curve:Mee,tension:"tension",value:0},"catmull-rom":{curve:See,tension:"alpha",value:.5},"catmull-rom-closed":{curve:Cee,tension:"alpha",value:.5},"catmull-rom-open":{curve:Lee,tension:"alpha",value:.5},linear:{curve:kI},"linear-closed":{curve:Dee},monotone:{horizontal:Pee,vertical:Oee},natural:{curve:Iee},step:{curve:Fee},"step-after":{curve:zee},"step-before":{curve:Ree}};function VM(e,n,t){var o=Yi(K7,e)&&K7[e],f=null;return o&&(f=o.curve||o[n||"vertical"],o.tension&&t!=null&&(f=f[o.tension](t))),f}const Xte={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7},Zte=/[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi,Jte=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,Kte=/^((\s+,?\s*)|(,\s*))/,Qte=/^[01]/;function Pm(e){const n=[];return(e.match(Zte)||[]).forEach(o=>{let f=o[0];const r=f.toLowerCase(),a=Xte[r],l=ene(r,a,o.slice(1).trim()),c=l.length;if(c1&&(p=Math.sqrt(p),t*=p,o*=p);const g=h/t,y=u/t,v=-u/o,x=h/o,_=g*l+y*c,A=v*l+x*c,b=g*e+y*n,k=v*e+x*n;let M=1/((b-_)*(b-_)+(k-A)*(k-A))-.25;M<0&&(M=0);let T=Math.sqrt(M);r==f&&(T=-T);const E=.5*(_+b)-T*(k-A),S=.5*(A+k)+T*(b-_),P=Math.atan2(A-S,_-E);let R=Math.atan2(k-S,b-E)-P;R<0&&r===1?R+=Gf:R>0&&r===0&&(R-=Gf);const F=Math.ceil(Math.abs(R/(f0+.001))),D=[];for(let O=0;O+e}function Db(e,n,t){return Math.max(n,Math.min(e,t))}function vN(){var e=one,n=sne,t=lne,o=une,f=Oh(0),r=f,a=f,l=f,c=null;function i(s,u,h){var d,m=u??+e.call(this,s),p=h??+n.call(this,s),g=+t.call(this,s),y=+o.call(this,s),v=Math.min(g,y)/2,x=Db(+f.call(this,s),0,v),_=Db(+r.call(this,s),0,v),A=Db(+a.call(this,s),0,v),b=Db(+l.call(this,s),0,v);if(c||(c=d=r1()),x<=0&&_<=0&&A<=0&&b<=0)c.rect(m,p,g,y);else{var k=m+g,w=p+y;c.moveTo(m+x,p),c.lineTo(k-_,p),c.bezierCurveTo(k-Sd*_,p,k,p+Sd*_,k,p+_),c.lineTo(k,w-b),c.bezierCurveTo(k,w-Sd*b,k-Sd*b,w,k-b,w),c.lineTo(m+A,w),c.bezierCurveTo(m+Sd*A,w,m,w-Sd*A,m,w-A),c.lineTo(m,p+x),c.bezierCurveTo(m,p+Sd*x,m+Sd*x,p,m+x,p),c.closePath()}if(d)return c=null,d+""||null}return i.x=function(s){return arguments.length?(e=Oh(s),i):e},i.y=function(s){return arguments.length?(n=Oh(s),i):n},i.width=function(s){return arguments.length?(t=Oh(s),i):t},i.height=function(s){return arguments.length?(o=Oh(s),i):o},i.cornerRadius=function(s,u,h,d){return arguments.length?(f=Oh(s),r=u!=null?Oh(u):f,l=h!=null?Oh(h):f,a=d!=null?Oh(d):r,i):f},i.context=function(s){return arguments.length?(c=s??null,i):c},i}function xN(){var e,n,t,o,f=null,r,a,l,c;function i(u,h,d){const m=d/2;if(r){var p=l-h,g=u-a;if(p||g){var y=Math.sqrt(p*p+g*g),v=(p/=y)*c,x=(g/=y)*c,_=Math.atan2(g,p);f.moveTo(a-v,l-x),f.lineTo(u-p*m,h-g*m),f.arc(u,h,m,_-Math.PI,_),f.lineTo(a+v,l+x),f.arc(a,l,c,_,_+Math.PI)}else f.arc(u,h,m,0,Gf);f.closePath()}else r=1;a=u,l=h,c=m}function s(u){var h,d=u.length,m,p=!1,g;for(f==null&&(f=g=r1()),h=0;h<=d;++h)!(he.x||0,sx=e=>e.y||0,cne=e=>e.width||0,fne=e=>e.height||0,hne=e=>(e.x||0)+(e.width||0),dne=e=>(e.y||0)+(e.height||0),pne=e=>e.startAngle||0,gne=e=>e.endAngle||0,mne=e=>e.padAngle||0,yne=e=>e.innerRadius||0,vne=e=>e.outerRadius||0,xne=e=>e.cornerRadius||0,bne=e=>ax(e.cornerRadiusTopLeft,e.cornerRadius)||0,_ne=e=>ax(e.cornerRadiusTopRight,e.cornerRadius)||0,wne=e=>ax(e.cornerRadiusBottomRight,e.cornerRadius)||0,Ane=e=>ax(e.cornerRadiusBottomLeft,e.cornerRadius)||0,kne=e=>ax(e.size,64),Tne=e=>e.size||1,Qw=e=>e.defined!==!1,Mne=e=>yN(e.shape||"circle"),Ene=vee().startAngle(pne).endAngle(gne).padAngle(mne).innerRadius(yne).outerRadius(vne).cornerRadius(xne),Sne=cz().x(ox).y1(sx).y0(dne).defined(Qw),Cne=cz().y(sx).x1(ox).x0(hne).defined(Qw),Lne=TI().x(ox).y(sx).defined(Qw),Dne=vN().x(ox).y(sx).width(cne).height(fne).cornerRadius(bne,_ne,wne,Ane),One=bee().type(Mne).size(kne),Pne=xN().x(ox).y(sx).defined(Qw).size(Tne);function qM(e){return e.cornerRadius||e.cornerRadiusTopLeft||e.cornerRadiusTopRight||e.cornerRadiusBottomRight||e.cornerRadiusBottomLeft}function Ine(e,n){return Ene.context(e)(n)}function Fne(e,n){const t=n[0],o=t.interpolate||"linear";return(t.orient==="horizontal"?Cne:Sne).curve(VM(o,t.orient,t.tension)).context(e)(n)}function Rne(e,n){const t=n[0],o=t.interpolate||"linear";return Lne.curve(VM(o,t.orient,t.tension)).context(e)(n)}function p1(e,n,t,o){return Dne.context(e)(n,t,o)}function zne(e,n){return(n.mark.shape||n.shape).context(e)(n)}function Nne(e,n){return One.context(e)(n)}function Bne(e,n){return Pne.context(e)(n)}var bN=1;function _N(){bN=1}function HM(e,n,t){var o=n.clip,f=e._defs,r=n.clip_id||(n.clip_id="clip"+bN++),a=f.clipping[r]||(f.clipping[r]={id:r});return xa(o)?a.path=o(null):qM(t)?a.path=p1(null,t,0,0):(a.width=t.width||0,a.height=t.height||0),"url(#"+r+")"}function Us(e){this.clear(),e&&this.union(e)}Us.prototype={clone(){return new Us(this)},clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this},empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE},equals(e){return this.x1===e.x1&&this.y1===e.y1&&this.x2===e.x2&&this.y2===e.y2},set(e,n,t,o){return tthis.x2&&(this.x2=e),n>this.y2&&(this.y2=n),this},expand(e){return this.x1-=e,this.y1-=e,this.x2+=e,this.y2+=e,this},round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this},scale(e){return this.x1*=e,this.y1*=e,this.x2*=e,this.y2*=e,this},translate(e,n){return this.x1+=e,this.x2+=e,this.y1+=n,this.y2+=n,this},rotate(e,n,t){const o=this.rotatedPoints(e,n,t);return this.clear().add(o[0],o[1]).add(o[2],o[3]).add(o[4],o[5]).add(o[6],o[7])},rotatedPoints(e,n,t){var{x1:o,y1:f,x2:r,y2:a}=this,l=Math.cos(e),c=Math.sin(e),i=n-n*l+t*c,s=t-n*c-t*l;return[l*o-c*f+i,c*o+l*f+s,l*o-c*a+i,c*o+l*a+s,l*r-c*f+i,c*r+l*f+s,l*r-c*a+i,c*r+l*a+s]},union(e){return e.x1this.x2&&(this.x2=e.x2),e.y2>this.y2&&(this.y2=e.y2),this},intersect(e){return e.x1>this.x1&&(this.x1=e.x1),e.y1>this.y1&&(this.y1=e.y1),e.x2=e.x2&&this.y1<=e.y1&&this.y2>=e.y2},alignsWith(e){return e&&(this.x1==e.x1||this.x2==e.x2||this.y1==e.y1||this.y2==e.y2)},intersects(e){return e&&!(this.x2e.x2||this.y2e.y2)},contains(e,n){return!(ethis.x2||nthis.y2)},width(){return this.x2-this.x1},height(){return this.y2-this.y1}};function e3(e){this.mark=e,this.bounds=this.bounds||new Us}function t3(e){e3.call(this,e),this.items=this.items||[]}ii(t3,e3);function GM(e){this._pending=0,this._loader=e||Ow()}function nL(e){e._pending+=1}function oy(e){e._pending-=1}GM.prototype={pending(){return this._pending},sanitizeURL(e){const n=this;return nL(n),n._loader.sanitize(e,{context:"href"}).then(t=>(oy(n),t)).catch(()=>(oy(n),null))},loadImage(e){const n=this,t=Nee();return nL(n),n._loader.sanitize(e,{context:"image"}).then(o=>{const f=o.href;if(!f||!t)throw{url:f};const r=new t,a=Yi(o,"crossOrigin")?o.crossOrigin:"anonymous";return a!=null&&(r.crossOrigin=a),r.onload=()=>oy(n),r.onerror=()=>oy(n),r.src=f,r}).catch(o=>(oy(n),{complete:!1,width:0,height:0,src:o&&o.url||""}))},ready(){const e=this;return new Promise(n=>{function t(o){e.pending()?setTimeout(()=>{t(!0)},10):n(o)}t(!1)})}};function ld(e,n,t){if(n.stroke&&n.opacity!==0&&n.strokeOpacity!==0){const o=n.strokeWidth!=null?+n.strokeWidth:1;e.expand(o+(t?jne(n,o):0))}return e}function jne(e,n){return e.strokeJoin&&e.strokeJoin!=="miter"?0:n}const Une=Gf-1e-8;let n3,d2,p2,y0,uk,g2,ck,fk;const Nd=(e,n)=>n3.add(e,n),m2=(e,n)=>Nd(d2=e,p2=n),rL=e=>Nd(e,n3.y1),iL=e=>Nd(n3.x1,e),h0=(e,n)=>uk*e+ck*n,d0=(e,n)=>g2*e+fk*n,S4=(e,n)=>Nd(h0(e,n),d0(e,n)),C4=(e,n)=>m2(h0(e,n),d0(e,n));function lx(e,n){return n3=e,n?(y0=n*lp,uk=fk=Math.cos(y0),g2=Math.sin(y0),ck=-g2):(uk=fk=1,y0=g2=ck=0),$ne}const $ne={beginPath(){},closePath(){},moveTo:C4,lineTo:C4,rect(e,n,t,o){y0?(S4(e+t,n),S4(e+t,n+o),S4(e,n+o),C4(e,n)):(Nd(e+t,n+o),m2(e,n))},quadraticCurveTo(e,n,t,o){const f=h0(e,n),r=d0(e,n),a=h0(t,o),l=d0(t,o);aL(d2,f,a,rL),aL(p2,r,l,iL),m2(a,l)},bezierCurveTo(e,n,t,o,f,r){const a=h0(e,n),l=d0(e,n),c=h0(t,o),i=d0(t,o),s=h0(f,r),u=d0(f,r);oL(d2,a,c,s,rL),oL(p2,l,i,u,iL),m2(s,u)},arc(e,n,t,o,f,r){if(o+=y0,f+=y0,d2=t*Math.cos(f)+e,p2=t*Math.sin(f)+n,Math.abs(f-o)>Une)Nd(e-t,n-t),Nd(e+t,n+t);else{const a=i=>Nd(t*Math.cos(i)+e,t*Math.sin(i)+n);let l,c;if(a(o),a(f),f!==o)if(o=o%Gf,o<0&&(o+=Gf),f=f%Gf,f<0&&(f+=Gf),ff;++c,l-=f0)a(l);else for(l=o-o%f0+f0,c=0;c<4&&ltne?(s=a*a+l*r,s>=0&&(s=Math.sqrt(s),c=(-a+s)/r,i=(-a-s)/r)):c=.5*l/a,0h)return!1;p>u&&(u=p)}else if(d>0){if(p0?(e.globalAlpha=t,e.fillStyle=kN(e,n,n.fill),!0):!1}var qne=[];function Fm(e,n,t){var o=(o=n.strokeWidth)!=null?o:1;return o<=0?!1:(t*=n.strokeOpacity==null?1:n.strokeOpacity,t>0?(e.globalAlpha=t,e.strokeStyle=kN(e,n,n.stroke),e.lineWidth=o,e.lineCap=n.strokeCap||"butt",e.lineJoin=n.strokeJoin||"miter",e.miterLimit=n.strokeMiterLimit||10,e.setLineDash&&(e.setLineDash(n.strokeDash||qne),e.lineDashOffset=n.strokeDashOffset||0),!0):!1)}function Hne(e,n){return e.zindex-n.zindex||e.index-n.index}function XM(e){if(!e.zdirty)return e.zitems;var n=e.items,t=[],o,f,r;for(f=0,r=n.length;f=0;)if(o=n(t[f]))return o;if(t===r){for(t=e.items,f=t.length;--f>=0;)if(!t[f].zindex&&(o=n(t[f])))return o}return null}function ZM(e){return function(n,t,o){xf(t,f=>{(!o||o.intersects(f.bounds))&&TN(e,n,f,f)})}}function Gne(e){return function(n,t,o){t.items.length&&(!o||o.intersects(t.bounds))&&TN(e,n,t.items[0],t.items)}}function TN(e,n,t,o){var f=t.opacity==null?1:t.opacity;f!==0&&(e(n,o)||(Im(n,t),t.fill&&n_(n,t,f)&&n.fill(),t.stroke&&Fm(n,t,f)&&n.stroke()))}function r3(e){return e=e||yf,function(n,t,o,f,r,a){return o*=n.pixelRatio,f*=n.pixelRatio,r_(t,l=>{const c=l.bounds;if(!(c&&!c.contains(r,a)||!c)&&e(n,l,o,f,r,a))return l})}}function ux(e,n){return function(t,o,f,r){var a=Array.isArray(o)?o[0]:o,l=n??a.fill,c=a.stroke&&t.isPointInStroke,i,s;return c&&(i=a.strokeWidth,s=a.strokeCap,t.lineWidth=i??1,t.lineCap=s??"butt"),e(t,o)?!1:l&&t.isPointInPath(f,r)||c&&t.isPointInStroke(f,r)}}function JM(e){return r3(ux(e))}function k0(e,n){return"translate("+e+","+n+")"}function KM(e){return"rotate("+e+")"}function Wne(e,n){return"scale("+e+","+n+")"}function MN(e){return k0(e.x||0,e.y||0)}function Yne(e){return k0(e.x||0,e.y||0)+(e.angle?" "+KM(e.angle):"")}function Xne(e){return k0(e.x||0,e.y||0)+(e.angle?" "+KM(e.angle):"")+(e.scaleX||e.scaleY?" "+Wne(e.scaleX||1,e.scaleY||1):"")}function QM(e,n,t){function o(a,l){a("transform",Yne(l)),a("d",n(null,l))}function f(a,l){return n(lx(a,l.angle),l),ld(a,l).translate(l.x||0,l.y||0)}function r(a,l){var c=l.x||0,i=l.y||0,s=l.angle||0;a.translate(c,i),s&&a.rotate(s*=lp),a.beginPath(),n(a,l),s&&a.rotate(-s),a.translate(-c,-i)}return{type:e,tag:"path",nested:!1,attr:o,bound:f,draw:ZM(r),pick:JM(r),isect:t||WM(r)}}var Zne=QM("arc",Ine);function Jne(e,n){for(var t=e[0].orient==="horizontal"?n[1]:n[0],o=e[0].orient==="horizontal"?"y":"x",f=e.length,r=1/0,a,l;--f>=0;)e[f].defined!==!1&&(l=Math.abs(e[f][o]-t),l=0;)if(e[o].defined!==!1&&(f=e[o].x-n[0],r=e[o].y-n[1],a=f*f+r*r,a=0;)if(e[t].defined!==!1&&(o=e[t].x-n[0],f=e[t].y-n[1],r=o*o+f*f,o=e[t].size||1,r.5&&n<1.5?.5-Math.abs(n-1):0}function nre(e,n){e("transform",MN(n))}function CN(e,n){const t=SN(n);e("d",p1(null,n,t,t))}function rre(e,n){e("class","background"),e("aria-hidden",!0),CN(e,n)}function ire(e,n){e("class","foreground"),e("aria-hidden",!0),n.strokeForeground?CN(e,n):e("d","")}function are(e,n,t){const o=n.clip?HM(t,n,n):null;e("clip-path",o)}function ore(e,n){if(!n.clip&&n.items){const t=n.items,o=t.length;for(let f=0;f{const f=o.x||0,r=o.y||0,a=o.strokeForeground,l=o.opacity==null?1:o.opacity;(o.stroke||o.fill)&&l&&(xv(e,o,f,r),Im(e,o),o.fill&&n_(e,o,l)&&e.fill(),o.stroke&&!a&&Fm(e,o,l)&&e.stroke()),e.save(),e.translate(f,r),o.clip&&EN(e,o),t&&t.translate(-f,-r),xf(o,c=>{this.draw(e,c,t)}),t&&t.translate(f,r),e.restore(),a&&o.stroke&&l&&(xv(e,o,f,r),Im(e,o),Fm(e,o,l)&&e.stroke())})}function fre(e,n,t,o,f,r){if(n.bounds&&!n.bounds.contains(f,r)||!n.items)return null;const a=t*e.pixelRatio,l=o*e.pixelRatio;return r_(n,c=>{let i,s,u;const h=c.bounds;if(h&&!h.contains(f,r))return;s=c.x||0,u=c.y||0;const d=s+(c.width||0),m=u+(c.height||0),p=c.clip;if(p&&(fd||rm))return;if(e.save(),e.translate(s,u),s=f-s,u=r-u,p&&qM(c)&&!ure(e,c,a,l))return e.restore(),null;const g=c.strokeForeground,y=n.interactive!==!1;return y&&g&&c.stroke&&lre(e,c,a,l)?(e.restore(),c):(i=r_(c,v=>hre(v,s,u)?this.pick(v,t,o,s,u):null),!i&&y&&(c.fill||!g&&c.stroke)&&sre(e,c,a,l)&&(i=c),e.restore(),i||null)})}function hre(e,n,t){return(e.interactive!==!1||e.marktype==="group")&&e.bounds&&e.bounds.contains(n,t)}var dre={type:"group",tag:"g",nested:!1,attr:nre,bound:ore,draw:cre,pick:fre,isect:wN,content:are,background:rre,foreground:ire},bv={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"};function tE(e,n){var t=e.image;return(!t||e.url&&e.url!==t.url)&&(t={complete:!1,width:0,height:0},n.loadImage(e.url).then(o=>{e.image=o,e.image.url=e.url})),t}function nE(e,n){return e.width!=null?e.width:!n||!n.width?0:e.aspect!==!1&&e.height?e.height*n.width/n.height:n.width}function rE(e,n){return e.height!=null?e.height:!n||!n.height?0:e.aspect!==!1&&e.width?e.width*n.height/n.width:n.height}function i3(e,n){return e==="center"?n/2:e==="right"?n:0}function a3(e,n){return e==="middle"?n/2:e==="bottom"?n:0}function pre(e,n,t){const o=tE(n,t),f=nE(n,o),r=rE(n,o),a=(n.x||0)-i3(n.align,f),l=(n.y||0)-a3(n.baseline,r),c=!o.src&&o.toDataURL?o.toDataURL():o.src||"";e("href",c,bv["xmlns:xlink"],"xlink:href"),e("transform",k0(a,l)),e("width",f),e("height",r),e("preserveAspectRatio",n.aspect===!1?"none":"xMidYMid")}function gre(e,n){const t=n.image,o=nE(n,t),f=rE(n,t),r=(n.x||0)-i3(n.align,o),a=(n.y||0)-a3(n.baseline,f);return e.set(r,a,r+o,a+f)}function mre(e,n,t){xf(n,o=>{if(t&&!t.intersects(o.bounds))return;const f=tE(o,this);let r=nE(o,f),a=rE(o,f);if(r===0||a===0)return;let l=(o.x||0)-i3(o.align,r),c=(o.y||0)-a3(o.baseline,a),i,s,u,h;o.aspect!==!1&&(s=f.width/f.height,u=o.width/o.height,s===s&&u===u&&s!==u&&(u{if(!(t&&!t.intersects(o.bounds))){var f=o.opacity==null?1:o.opacity;f&&LN(e,o,f)&&(Im(e,o),e.stroke())}})}function Sre(e,n,t,o){return e.isPointInStroke?LN(e,n,1)&&e.isPointInStroke(t,o):!1}var Cre={type:"rule",tag:"line",nested:!1,attr:Tre,bound:Mre,draw:Ere,pick:r3(Sre),isect:AN},Lre=QM("shape",zne),Dre=QM("symbol",Nne,YM);const cL=pZ();var df={height:ph,measureWidth:iE,estimateWidth:dk,width:dk,canvas:DN};DN(!0);function DN(e){df.width=e&&ep?iE:dk}function dk(e,n){return ON(cp(e,n),ph(e))}function ON(e,n){return~~(.8*e.length*n)}function iE(e,n){return ph(e)<=0||!(n=cp(e,n))?0:PN(n,o3(e))}function PN(e,n){const t="(".concat(n,") ").concat(e);let o=cL.get(t);return o===void 0&&(ep.font=n,o=ep.measureText(e).width,cL.set(t,o)),o}function ph(e){return e.fontSize!=null?+e.fontSize||0:11}function up(e){return e.lineHeight!=null?e.lineHeight:ph(e)+2}function Ore(e){return zr(e)?e.length>1?e:e[0]:e}function cx(e){return Ore(e.lineBreak&&e.text&&!zr(e.text)?e.text.split(e.lineBreak):e.text)}function aE(e){const n=cx(e);return(zr(n)?n.length-1:0)*up(e)}function cp(e,n){const t=n==null?"":(n+"").trim();return e.limit>0&&t.length?Ire(e,t):t}function Pre(e){if(df.width===iE){const n=o3(e);return t=>PN(t,n)}else{const n=ph(e);return t=>ON(t,n)}}function Ire(e,n){var t=+e.limit,o=Pre(e);if(o(n)>>1,o(n.slice(c))>t?a=c+1:l=c;return f+n.slice(a)}else{for(;a>>1),o(n.slice(0,c))Math.max(h,df.width(n,d)),0)):u=df.width(n,s),f==="center"?c-=u/2:f==="right"&&(c-=u),e.set(c+=a,i+=l,c+u,i+o),n.angle&&!t)e.rotate(n.angle*lp,a,l);else if(t===2)return e.rotatedPoints(n.angle*lp,a,l);return e}function zre(e,n,t){xf(n,o=>{var f=o.opacity==null?1:o.opacity,r,a,l,c,i,s,u;if(!(t&&!t.intersects(o.bounds)||f===0||o.fontSize<=0||o.text==null||o.text.length===0)){if(e.font=o3(o),e.textAlign=o.align||"left",r=s3(o),a=r.x1,l=r.y1,o.angle&&(e.save(),e.translate(a,l),e.rotate(o.angle*lp),a=l=0),a+=o.dx||0,l+=(o.dy||0)+oE(o),s=cx(o),Im(e,o),zr(s))for(i=up(o),c=0;cn;)e.removeChild(t[--o]);return e}function BN(e){return"mark-"+e.marktype+(e.role?" role-"+e.role:"")+(e.name?" "+e.name:"")}function l3(e,n){const t=n.getBoundingClientRect();return[e.clientX-t.left-(n.clientLeft||0),e.clientY-t.top-(n.clientTop||0)]}function Vre(e,n,t,o){var f=e&&e.mark,r,a;if(f&&(r=hc[f.marktype]).tip){for(a=l3(n,t),a[0]-=o[0],a[1]-=o[1];e=e.mark.group;)a[0]-=e.x||0,a[1]-=e.y||0;e=r.tip(f.items,a)}return e}function fp(e,n){this._active=null,this._handlers={},this._loader=e||Ow(),this._tooltip=n||qre}function qre(e,n,t,o){e.element().setAttribute("title",o||"")}fp.prototype={initialize(e,n,t){return this._el=e,this._obj=t||null,this.origin(n)},element(){return this._el},canvas(){return this._el&&this._el.firstChild},origin(e){return arguments.length?(this._origin=e||[0,0],this):this._origin.slice()},scene(e){return arguments.length?(this._scene=e,this):this._scene},on(){},off(){},_handlerIndex(e,n,t){for(let o=e?e.length:0;--o>=0;)if(e[o].type===n&&(!t||e[o].handler===t))return o;return-1},handlers(e){const n=this._handlers,t=[];if(e)t.push(...n[this.eventName(e)]);else for(const o in n)t.push(...n[o]);return t},eventName(e){const n=e.indexOf(".");return n<0?e:e.slice(0,n)},handleHref(e,n,t){this._loader.sanitize(t,{context:"href"}).then(o=>{const f=new MouseEvent(e.type,e),r=Bd(null,"a");for(const a in o)r.setAttribute(a,o[a]);r.dispatchEvent(f)}).catch(()=>{})},handleTooltip(e,n,t){if(n&&n.tooltip!=null){n=Vre(n,e,this.canvas(),this._origin);const o=t&&n&&n.tooltip||null;this._tooltip.call(this._obj,this,e,n,o)}},getItemBoundingClientRect(e){const n=this.canvas();if(!n)return;const t=n.getBoundingClientRect(),o=this._origin,f=e.bounds,r=f.width(),a=f.height();let l=f.x1+o[0]+t.left,c=f.y1+o[1]+t.top;for(;e.mark&&(e=e.mark.group);)l+=e.x||0,c+=e.y||0;return{x:l,y:c,width:r,height:a,left:l,top:c,right:l+r,bottom:c+a}}};function gh(e){this._el=null,this._bgcolor=null,this._loader=new GM(e)}gh.prototype={initialize(e,n,t,o,f){return this._el=e,this.resize(n,t,o,f)},element(){return this._el},canvas(){return this._el&&this._el.firstChild},background(e){return arguments.length===0?this._bgcolor:(this._bgcolor=e,this)},resize(e,n,t,o){return this._width=e,this._height=n,this._origin=t||[0,0],this._scale=o||1,this},dirty(){},render(e){const n=this;return n._call=function(){n._render(e)},n._call(),n._call=null,n},_render(){},renderAsync(e){const n=this.render(e);return this._ready?this._ready.then(()=>n):Promise.resolve(n)},_load(e,n){var t=this,o=t._loader[e](n);if(!t._ready){const f=t._call;t._ready=t._loader.ready().then(r=>{r&&f(),t._ready=null})}return o},sanitizeURL(e){return this._load("sanitizeURL",e)},loadImage(e){return this._load("loadImage",e)}};const Hre="keydown",Gre="keypress",Wre="keyup",jN="dragenter",v2="dragleave",UN="dragover",gk="mousedown",Yre="mouseup",i_="mousemove",Xy="mouseout",$N="mouseover",a_="click",Xre="dblclick",Zre="wheel",VN="mousewheel",o_="touchstart",s_="touchmove",l_="touchend",Jre=[Hre,Gre,Wre,jN,v2,UN,gk,Yre,i_,Xy,$N,a_,Xre,Zre,VN,o_,s_,l_],mk=i_,_v=Xy,yk=a_;function hx(e,n){fp.call(this,e,n),this._down=null,this._touch=null,this._first=!0,this._events={}}const Kre=e=>e===o_||e===s_||e===l_?[o_,s_,l_]:[e];function hL(e,n){Kre(n).forEach(t=>Qre(e,t))}function Qre(e,n){const t=e.canvas();t&&!e._events[n]&&(e._events[n]=1,t.addEventListener(n,e[n]?o=>e[n](o):o=>e.fire(n,o)))}function dL(e,n,t){return function(o){const f=this._active,r=this.pickEvent(o);r===f?this.fire(e,o):((!f||!f.exit)&&this.fire(t,o),this._active=r,this.fire(n,o),this.fire(e,o))}}function pL(e){return function(n){this.fire(e,n),this._active=null}}ii(hx,fp,{initialize(e,n,t){return this._canvas=e&&uE(e,"canvas"),[a_,gk,i_,Xy,v2].forEach(o=>hL(this,o)),fp.prototype.initialize.call(this,e,n,t)},canvas(){return this._canvas},context(){return this._canvas.getContext("2d")},events:Jre,DOMMouseScroll(e){this.fire(VN,e)},mousemove:dL(i_,$N,Xy),dragover:dL(UN,jN,v2),mouseout:pL(Xy),dragleave:pL(v2),mousedown(e){this._down=this._active,this.fire(gk,e)},click(e){this._down===this._active&&(this.fire(a_,e),this._down=null)},touchstart(e){this._touch=this.pickEvent(e.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire(o_,e,!0)},touchmove(e){this.fire(s_,e,!0)},touchend(e){this.fire(l_,e,!0),this._touch=null},fire(e,n,t){const o=t?this._touch:this._active,f=this._handlers[e];if(n.vegaType=e,e===yk&&o&&o.href?this.handleHref(n,o,o.href):(e===mk||e===_v)&&this.handleTooltip(n,o,e!==_v),f)for(let r=0,a=f.length;r=0&&o.splice(f,1),this},pickEvent(e){const n=l3(e,this._canvas),t=this._origin;return this.pick(this._scene,n[0],n[1],n[0]-t[0],n[1]-t[1])},pick(e,n,t,o,f){const r=this.context();return hc[e.marktype].pick.call(this,r,e,n,t,o,f)}});function eie(){return typeof window<"u"&&window.devicePixelRatio||1}var tie=eie();function nie(e,n,t,o,f,r){const a=typeof HTMLElement<"u"&&e instanceof HTMLElement&&e.parentNode!=null,l=e.getContext("2d"),c=a?tie:f;e.width=n*c,e.height=t*c;for(const i in r)l[i]=r[i];return a&&c!==1&&(e.style.width=n+"px",e.style.height=t+"px"),l.pixelRatio=c,l.setTransform(c,0,0,c,c*o[0],c*o[1]),e}function u_(e){gh.call(this,e),this._options={},this._redraw=!1,this._dirty=new Us,this._tempb=new Us}const gL=gh.prototype,rie=(e,n,t)=>new Us().set(0,0,n,t).translate(-e[0],-e[1]);function iie(e,n,t){return n.expand(1).round(),e.pixelRatio%1&&n.scale(e.pixelRatio).round().scale(1/e.pixelRatio),n.translate(-(t[0]%1),-(t[1]%1)),e.beginPath(),e.rect(n.x1,n.y1,n.width(),n.height()),e.clip(),n}ii(u_,gh,{initialize(e,n,t,o,f,r){return this._options=r||{},this._canvas=this._options.externalContext?null:Qd(1,1,this._options.type),e&&this._canvas&&(af(e,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),gL.initialize.call(this,e,n,t,o,f)},resize(e,n,t,o){if(gL.resize.call(this,e,n,t,o),this._canvas)nie(this._canvas,this._width,this._height,this._origin,this._scale,this._options.context);else{const f=this._options.externalContext;f||Pr("CanvasRenderer is missing a valid canvas or context"),f.scale(this._scale,this._scale),f.translate(this._origin[0],this._origin[1])}return this._redraw=!0,this},canvas(){return this._canvas},context(){return this._options.externalContext||(this._canvas?this._canvas.getContext("2d"):null)},dirty(e){const n=this._tempb.clear().union(e.bounds);let t=e.mark.group;for(;t;)n.translate(t.x||0,t.y||0),t=t.mark.group;this._dirty.union(n)},_render(e){const n=this.context(),t=this._origin,o=this._width,f=this._height,r=this._dirty,a=rie(t,o,f);n.save();const l=this._redraw||r.empty()?(this._redraw=!1,a.expand(1)):iie(n,a.intersect(r),t);return this.clear(-t[0],-t[1],o,f),this.draw(n,e,l),n.restore(),r.clear(),this},draw(e,n,t){const o=hc[n.marktype];n.clip&&tre(e,n),o.draw.call(this,e,n,t),n.clip&&e.restore()},clear(e,n,t,o){const f=this._options,r=this.context();f.type!=="pdf"&&!f.externalContext&&r.clearRect(e,n,t,o),this._bgcolor!=null&&(r.fillStyle=this._bgcolor,r.fillRect(e,n,t,o))}});function cE(e,n){fp.call(this,e,n);const t=this;t._hrefHandler=vk(t,(o,f)=>{f&&f.href&&t.handleHref(o,f,f.href)}),t._tooltipHandler=vk(t,(o,f)=>{t.handleTooltip(o,f,o.type!==_v)})}const vk=(e,n)=>t=>{let o=t.target.__data__;o=Array.isArray(o)?o[0]:o,t.vegaType=t.type,n.call(e._obj,t,o)};ii(cE,fp,{initialize(e,n,t){let o=this._svg;return o&&(o.removeEventListener(yk,this._hrefHandler),o.removeEventListener(mk,this._tooltipHandler),o.removeEventListener(_v,this._tooltipHandler)),this._svg=o=e&&uE(e,"svg"),o&&(o.addEventListener(yk,this._hrefHandler),o.addEventListener(mk,this._tooltipHandler),o.addEventListener(_v,this._tooltipHandler)),fp.prototype.initialize.call(this,e,n,t)},canvas(){return this._svg},on(e,n){const t=this.eventName(e),o=this._handlers;if(this._handlerIndex(o[t],e,n)<0){const r={type:e,handler:n,listener:vk(this,n)};(o[t]||(o[t]=[])).push(r),this._svg&&this._svg.addEventListener(t,r.listener)}return this},off(e,n){const t=this.eventName(e),o=this._handlers[t],f=this._handlerIndex(o,e,n);return f>=0&&(this._svg&&this._svg.removeEventListener(t,o[f].listener),o.splice(f,1)),this}});const qN="aria-hidden",fE="aria-label",hE="role",dE="aria-roledescription",HN="graphics-object",pE="graphics-symbol",GN=(e,n,t)=>({[hE]:e,[dE]:n,[fE]:t||void 0}),aie=sh(["axis-domain","axis-grid","axis-label","axis-tick","axis-title","legend-band","legend-entry","legend-gradient","legend-label","legend-title","legend-symbol","title"]),mL={axis:{desc:"axis",caption:lie},legend:{desc:"legend",caption:uie},"title-text":{desc:"title",caption:e=>"Title text '".concat(vL(e),"'")},"title-subtitle":{desc:"subtitle",caption:e=>"Subtitle text '".concat(vL(e),"'")}},yL={ariaRole:hE,ariaRoleDescription:dE,description:fE};function WN(e,n){const t=n.aria===!1;if(e(qN,t||void 0),t||n.description==null)for(const o in yL)e(yL[o],void 0);else{const o=n.mark.marktype;e(fE,n.description),e(hE,n.ariaRole||(o==="group"?HN:pE)),e(dE,n.ariaRoleDescription||"".concat(o," mark"))}}function YN(e){return e.aria===!1?{[qN]:!0}:aie[e.role]?null:mL[e.role]?sie(e,mL[e.role]):oie(e)}function oie(e){const n=e.marktype,t=n==="group"||n==="text"||e.items.some(o=>o.description!=null&&o.aria!==!1);return GN(t?HN:pE,"".concat(n," mark container"),e.description)}function sie(e,n){try{const t=e.items[0],o=n.caption||(()=>"");return GN(n.role||pE,n.desc,t.description||o(t))}catch{return null}}function vL(e){return Ti(e.text).join(" ")}function lie(e){const n=e.datum,t=e.orient,o=n.title?XN(e):null,f=e.context,r=f.scales[n.scale].value,a=f.dataflow.locale(),l=r.type,c=t==="left"||t==="right"?"Y":"X";return"".concat(c,"-axis")+(o?" titled '".concat(o,"'"):"")+" for a ".concat(Om(l)?"discrete":l," scale")+" with ".concat(hN(a,r,e))}function uie(e){const n=e.datum,t=n.title?XN(e):null,o="".concat(n.type||""," legend").trim(),f=n.scales,r=Object.keys(f),a=e.context,l=a.scales[f[r[0]]].value,c=a.dataflow.locale();return fie(o)+(t?" titled '".concat(t,"'"):"")+" for ".concat(cie(r))+" with ".concat(hN(c,l,e))}function XN(e){try{return Ti(qa(e.items).items[0].text).join(" ")}catch{return null}}function cie(e){return e=e.map(n=>n+(n==="fill"||n==="stroke"?" color":"")),e.length<2?e[0]:e.slice(0,-1).join(", ")+" and "+qa(e)}function fie(e){return e.length?e[0].toUpperCase()+e.slice(1):e}const ZN=e=>(e+"").replace(/&/g,"&").replace(//g,">"),hie=e=>ZN(e).replace(/"/g,""").replace(/\t/g," ").replace(/\n/g," ").replace(/\r/g," ");function gE(){let e="",n="",t="";const o=[],f=()=>n=t="",r=c=>{n&&(e+="".concat(n,">").concat(t),f()),o.push(c)},a=(c,i)=>(i!=null&&(n+=" ".concat(c,'="').concat(hie(i),'"')),l),l={open(c){r(c),n="<"+c;for(var i=arguments.length,s=new Array(i>1?i-1:0),u=1;u".concat(t,""):"/>"):e+=""),f(),l},attr:a,text:c=>(t+=ZN(c),l),toString:()=>e};return l}const JN=e=>KN(gE(),e)+"";function KN(e,n){if(e.open(n.tagName),n.hasAttributes()){const t=n.attributes,o=t.length;for(let f=0;f{i.dirty=n})),!o.zdirty){if(t.exit){r.nested&&o.items.length?(c=o.items[0],c._svg&&this._update(r,c._svg,c)):t._svg&&(c=t._svg.parentNode,c&&c.removeChild(t._svg)),t._svg=null;continue}t=r.nested?o.items[0]:t,t._update!==n&&(!t._svg||!t._svg.ownerSVGElement?(this._dirtyAll=!1,bL(t,n)):this._update(r,t._svg,t),t._update=n)}return!this._dirtyAll},mark(e,n,t){if(!this.isDirty(n))return n._svg;const o=this._svg,f=hc[n.marktype],r=n.interactive===!1?"none":null,a=f.tag==="g",l=_L(n,e,t,"g",o);l.setAttribute("class",BN(n));const c=YN(n);for(const h in c)lu(l,h,c[h]);a||lu(l,"pointer-events",r),lu(l,"clip-path",n.clip?HM(this,n,n.group):null);let i=null,s=0;const u=h=>{const d=this.isDirty(h),m=_L(h,l,i,f.tag,o);d&&(this._update(f,m,h),a&&gie(this,m,h)),i=m,++s};return f.nested?n.items.length&&u(n.items[0]):xf(n,u),af(l,s),l},_update(e,n,t){Wh=n,$l=n.__values__,WN(Zy,t),e.attr(Zy,t,this);const o=yie[e.type];o&&o.call(this,e,n,t),Wh&&this.style(Wh,t)},style(e,n){if(n!=null){for(const t in c_){let o=t==="font"?fx(n):n[t];if(o===$l[t])continue;const f=c_[t];o==null?e.removeAttribute(f):($M(o)&&(o=pN(o,this._defs.gradient,eB())),e.setAttribute(f,o+"")),$l[t]=o}for(const t in f_)x2(e,f_[t],n[t])}},defs(){const e=this._svg,n=this._defs;let t=n.el,o=0;for(const f in n.gradient)t||(n.el=t=Fu(e,sy+1,"defs",Zs)),o=die(t,n.gradient[f],o);for(const f in n.clipping)t||(n.el=t=Fu(e,sy+1,"defs",Zs)),o=pie(t,n.clipping[f],o);t&&(o===0?(e.removeChild(t),n.el=null):af(t,o))},_clearDefs(){const e=this._defs;e.gradient={},e.clipping={}}});function bL(e,n){for(;e&&e.dirty!==n;e=e.mark.group)if(e.dirty=n,e.mark&&e.mark.dirty!==n)e.mark.dirty=n;else return}function die(e,n,t){let o,f,r;if(n.gradient==="radial"){let a=Fu(e,t++,"pattern",Zs);jd(a,{id:t_+n.id,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),a=Fu(a,0,"rect",Zs),jd(a,{width:1,height:1,fill:"url(".concat(eB(),"#").concat(n.id,")")}),e=Fu(e,t++,"radialGradient",Zs),jd(e,{id:n.id,fx:n.x1,fy:n.y1,fr:n.r1,cx:n.x2,cy:n.y2,r:n.r2})}else e=Fu(e,t++,"linearGradient",Zs),jd(e,{id:n.id,x1:n.x1,x2:n.x2,y1:n.y1,y2:n.y2});for(o=0,f=n.stops.length;o{o=e.mark(n,r,o),++f}),af(n,1+f)}function _L(e,n,t,o,f){let r=e._svg,a;if(!r&&(a=n.ownerDocument,r=Bd(a,o,Zs),e._svg=r,e.mark&&(r.__data__=e,r.__values__={fill:"default"},o==="g"))){const l=Bd(a,"path",Zs);r.appendChild(l),l.__data__=e;const c=Bd(a,"g",Zs);r.appendChild(c),c.__data__=e;const i=Bd(a,"path",Zs);r.appendChild(i),i.__data__=e,i.__values__={fill:"default"}}return(r.ownerSVGElement!==f||mie(r,t))&&n.insertBefore(r,t?t.nextSibling:n.firstChild),r}function mie(e,n){return e.parentNode&&e.parentNode.childNodes.length>1&&e.previousSibling!=n}let Wh=null,$l=null;const yie={group(e,n,t){const o=Wh=n.childNodes[2];$l=o.__values__,e.foreground(Zy,t,this),$l=n.__values__,Wh=n.childNodes[1],e.content(Zy,t,this);const f=Wh=n.childNodes[0];e.background(Zy,t,this);const r=t.mark.interactive===!1?"none":null;if(r!==$l.events&&(lu(o,"pointer-events",r),lu(f,"pointer-events",r),$l.events=r),t.strokeForeground&&t.stroke){const a=t.fill;lu(o,"display",null),this.style(f,t),lu(f,"stroke",null),a&&(t.fill=null),$l=o.__values__,this.style(o,t),a&&(t.fill=a),Wh=null}else lu(o,"display","none")},image(e,n,t){t.smooth===!1?(x2(n,"image-rendering","optimizeSpeed"),x2(n,"image-rendering","pixelated")):x2(n,"image-rendering",null)},text(e,n,t){const o=cx(t);let f,r,a,l;zr(o)?(r=o.map(c=>cp(t,c)),f=r.join(` -`),f!==$l.text&&(af(n,0),a=n.ownerDocument,l=up(t),r.forEach((c,i)=>{const s=Bd(a,"tspan",Zs);s.__data__=t,s.textContent=c,i&&(s.setAttribute("x",0),s.setAttribute("dy",l)),n.appendChild(s)}),$l.text=f)):(r=cp(t,o),r!==$l.text&&(n.textContent=r,$l.text=r)),lu(n,"font-family",fx(t)),lu(n,"font-size",ph(t)+"px"),lu(n,"font-style",t.fontStyle),lu(n,"font-variant",t.fontVariant),lu(n,"font-weight",t.fontWeight)}};function Zy(e,n,t){n!==$l[e]&&(t?vie(Wh,e,n,t):lu(Wh,e,n),$l[e]=n)}function x2(e,n,t){t!==$l[n]&&(t==null?e.style.removeProperty(n):e.style.setProperty(n,t+""),$l[n]=t)}function jd(e,n){for(const t in n)lu(e,t,n[t])}function lu(e,n,t){t!=null?e.setAttribute(n,t):e.removeAttribute(n)}function vie(e,n,t,o){t!=null?e.setAttributeNS(o,n,t):e.removeAttributeNS(o,n)}function eB(){let e;return typeof window>"u"?"":(e=window.location).hash?e.href.slice(0,-e.hash.length):e.href}function yE(e){gh.call(this,e),this._text=null,this._defs={gradient:{},clipping:{}}}ii(yE,gh,{svg(){return this._text},_render(e){const n=gE();n.open("svg",Ea({},bv,{class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:"0 0 ".concat(this._width," ").concat(this._height)}));const t=this._bgcolor;return t&&t!=="transparent"&&t!=="none"&&n.open("rect",{width:this._width,height:this._height,fill:t}).close(),n.open("g",QN,{transform:"translate("+this._origin+")"}),this.mark(n,e),n.close(),this.defs(n),this._text=n.close()+"",this},mark(e,n){const t=hc[n.marktype],o=t.tag,f=[WN,t.attr];e.open("g",{class:BN(n),"clip-path":n.clip?HM(this,n,n.group):null},YN(n),{"pointer-events":o!=="g"&&n.interactive===!1?"none":null});const r=a=>{const l=this.href(a);if(l&&e.open("a",l),e.open(o,this.attr(n,a,f,o!=="g"?o:null)),o==="text"){const c=cx(a);if(zr(c)){const i={x:0,dy:up(a)};for(let s=0;sthis.mark(e,u)),e.close(),c&&s?(i&&(a.fill=null),a.stroke=s,e.open("path",this.attr(n,a,t.foreground,"bgrect")).close(),i&&(a.fill=i)):e.open("path",this.attr(n,a,t.foreground,"bgfore")).close()}e.close(),l&&e.close()};return t.nested?n.items&&n.items.length&&r(n.items[0]):xf(n,r),e.close()},href(e){const n=e.href;let t;if(n){if(t=this._hrefs&&this._hrefs[n])return t;this.sanitizeURL(n).then(o=>{o["xlink:href"]=o.href,o.href=null,(this._hrefs||(this._hrefs={}))[n]=o})}return null},attr(e,n,t,o){const f={},r=(a,l,c,i)=>{f[i||a]=l};return Array.isArray(t)?t.forEach(a=>a(r,n,this)):t(r,n,this),o&&xie(f,n,e,o,this._defs),f},defs(e){const n=this._defs.gradient,t=this._defs.clipping;if(Object.keys(n).length+Object.keys(t).length!==0){e.open("defs");for(const f in n){const r=n[f],a=r.stops;r.gradient==="radial"?(e.open("pattern",{id:t_+f,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),e.open("rect",{width:"1",height:"1",fill:"url(#"+f+")"}).close(),e.close(),e.open("radialGradient",{id:f,fx:r.x1,fy:r.y1,fr:r.r1,cx:r.x2,cy:r.y2,r:r.r2})):e.open("linearGradient",{id:f,x1:r.x1,x2:r.x2,y1:r.y1,y2:r.y2});for(let l=0;l1?(Rm[e]=n,this):Rm[e]}function aB(e,n,t){const o=[],f=new Us().union(n),r=e.marktype;return r?oB(e,f,t,o):r==="group"?sB(e,f,t,o):Pr("Intersect scene must be mark node or group item.")}function oB(e,n,t,o){if(bie(e,n,t)){const f=e.items,r=e.marktype,a=f.length;let l=0;if(r==="group")for(;l=0;r--)if(t[r]!=o[r])return!1;for(r=t.length-1;r>=0;r--)if(f=t[r],!vE(e[f],n[f],f))return!1;return typeof e==typeof n}function Aie(){_N(),Yte()}const zm="top",of="left",lf="right",hp="bottom",kie="top-left",Tie="top-right",Mie="bottom-left",Eie="bottom-right",xE="start",xk="middle",uu="end",Sie="x",Cie="y",c3="group",bE="axis",_E="title",Lie="frame",Die="scope",wE="legend",fB="row-header",hB="row-footer",dB="row-title",pB="column-header",gB="column-footer",mB="column-title",Oie="padding",Pie="symbol",yB="fit",Iie="fit-x",Fie="fit-y",Rie="pad",AE="none",Ob="all",bk="each",kE="flush",$d="column",Vd="row";function vB(e){_r.call(this,null,e)}ii(vB,_r,{transform(e,n){const t=n.dataflow,o=e.mark,f=o.marktype,r=hc[f],a=r.bound;let l=o.bounds,c;if(r.nested)o.items.length&&t.dirty(o.items[0]),l=Pb(o,a),o.items.forEach(i=>{i.bounds.clear().union(l)});else if(f===c3||e.modified())switch(n.visit(n.MOD,i=>t.dirty(i)),l.clear(),o.items.forEach(i=>l.union(Pb(i,a))),o.role){case bE:case wE:case _E:n.reflow()}else c=n.changed(n.REM),n.visit(n.ADD,i=>{l.union(Pb(i,a))}),n.visit(n.MOD,i=>{c=c||l.alignsWith(i.bounds),t.dirty(i),l.union(Pb(i,a))}),c&&(l.clear(),o.items.forEach(i=>l.union(i.bounds)));return uB(o),n.modifies("bounds")}});function Pb(e,n,t){return n(e.bounds.clear(),e,t)}const wL=":vega_identifier:";function TE(e){_r.call(this,0,e)}TE.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]};ii(TE,_r,{transform(e,n){const t=zie(n.dataflow),o=e.as;let f=t.value;return n.visit(n.ADD,r=>r[o]=r[o]||++f),t.set(this.value=f),n}});function zie(e){return e._signals[wL]||(e._signals[wL]=e.add(0))}function xB(e){_r.call(this,null,e)}ii(xB,_r,{transform(e,n){let t=this.value;t||(t=n.dataflow.scenegraph().mark(e.markdef,Nie(e),e.index),t.group.context=e.context,e.context.group||(e.context.group=t.group),t.source=this.source,t.clip=e.clip,t.interactive=e.interactive,this.value=t);const o=t.marktype===c3?t3:e3;return n.visit(n.ADD,f=>o.call(f,t)),(e.modified("clip")||e.modified("interactive"))&&(t.clip=e.clip,t.interactive=!!e.interactive,t.zdirty=!0,n.reflow()),t.items=n.source,n}});function Nie(e){const n=e.groups,t=e.parent;return n&&n.size===1?n.get(Object.keys(n.object)[0]):n&&t?n.lookup(t):null}function bB(e){_r.call(this,null,e)}const AL={parity:e=>e.filter((n,t)=>t%2?n.opacity=0:1),greedy:(e,n)=>{let t;return e.filter((o,f)=>!f||!_B(t.bounds,o.bounds,n)?(t=o,1):o.opacity=0)}},_B=(e,n,t)=>t>Math.max(n.x1-e.x2,e.x1-n.x2,n.y1-e.y2,e.y1-n.y2),kL=(e,n)=>{for(var t=1,o=e.length,f=e[0].bounds,r;t{const n=e.bounds;return n.width()>1&&n.height()>1},jie=(e,n,t)=>{var o=e.range(),f=new Us;return n===zm||n===hp?f.set(o[0],-1/0,o[1],1/0):f.set(-1/0,o[0],1/0,o[1]),f.expand(t||1),r=>f.encloses(r.bounds)},TL=e=>(e.forEach(n=>n.opacity=1),e),ML=(e,n)=>e.reflow(n.modified()).modifies("opacity");ii(bB,_r,{transform(e,n){const t=AL[e.method]||AL.parity,o=e.separation||0;let f=n.materialize(n.SOURCE).source,r,a;if(!f||!f.length)return;if(!e.method)return e.modified("method")&&(TL(f),n=ML(n,e)),n;if(f=f.filter(Bie),!f.length)return;if(e.sort&&(f=f.slice().sort(e.sort)),r=TL(f),n=ML(n,e),r.length>=3&&kL(r,o)){do r=t(r,o);while(r.length>=3&&kL(r,o));r.length<3&&!qa(f).opacity&&(r.length>1&&(qa(r).opacity=0),qa(f).opacity=1)}e.boundScale&&e.boundTolerance>=0&&(a=jie(e.boundScale,e.boundOrient,+e.boundTolerance),f.forEach(c=>{a(c)||(c.opacity=0)}));const l=r[0].mark.bounds.clear();return f.forEach(c=>{c.opacity&&l.union(c.bounds)}),n}});function wB(e){_r.call(this,null,e)}ii(wB,_r,{transform(e,n){const t=n.dataflow;if(n.visit(n.ALL,o=>t.dirty(o)),n.fields&&n.fields.zindex){const o=n.source&&n.source[0];o&&(o.mark.zdirty=!0)}}});const Ul=new Us;function fm(e,n,t){return e[n]===t?0:(e[n]=t,1)}function Uie(e){var n=e.items[0].orient;return n===of||n===lf}function $ie(e){let n=+e.grid;return[e.ticks?n++:-1,e.labels?n++:-1,n+ +e.domain]}function Vie(e,n,t,o){var f=n.items[0],r=f.datum,a=f.translate!=null?f.translate:.5,l=f.orient,c=$ie(r),i=f.range,s=f.offset,u=f.position,h=f.minExtent,d=f.maxExtent,m=r.title&&f.items[c[2]].items[0],p=f.titlePadding,g=f.bounds,y=m&&aE(m),v=0,x=0,_,A;switch(Ul.clear().union(g),g.clear(),(_=c[0])>-1&&g.union(f.items[_].bounds),(_=c[1])>-1&&g.union(f.items[_].bounds),l){case zm:v=u||0,x=-s,A=Math.max(h,Math.min(d,-g.y1)),g.add(0,-A).add(i,0),m&&Ib(e,m,A,p,y,0,-1,g);break;case of:v=-s,x=u||0,A=Math.max(h,Math.min(d,-g.x1)),g.add(-A,0).add(0,i),m&&Ib(e,m,A,p,y,1,-1,g);break;case lf:v=t+s,x=u||0,A=Math.max(h,Math.min(d,g.x2)),g.add(0,0).add(A,i),m&&Ib(e,m,A,p,y,1,1,g);break;case hp:v=u||0,x=o+s,A=Math.max(h,Math.min(d,g.y2)),g.add(0,0).add(i,A),m&&Ib(e,m,A,p,0,0,1,g);break;default:v=f.x,x=f.y}return ld(g.translate(v,x),f),fm(f,"x",v+a)|fm(f,"y",x+a)&&(f.bounds=Ul,e.dirty(f),f.bounds=g,e.dirty(f)),f.mark.bounds.clear().union(g)}function Ib(e,n,t,o,f,r,a,l){const c=n.bounds;if(n.auto){const i=a*(t+f+o);let s=0,u=0;e.dirty(n),r?s=(n.x||0)-(n.x=i):u=(n.y||0)-(n.y=i),n.mark.bounds.clear().union(c.translate(-s,-u)),e.dirty(n)}l.union(c)}const EL=(e,n)=>Math.floor(Math.min(e,n)),SL=(e,n)=>Math.ceil(Math.max(e,n));function qie(e){var n=e.items,t=n.length,o=0,f,r;const a={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};for(;o1)for(k=0;k0&&(x[k]+=L/2);if(l&&Ko(t.center,Vd)&&s!==1)for(k=0;k0&&(_[k]+=R/2);for(k=0;kf&&(e.warn("Grid headers exceed limit: "+f),n=n.slice(0,f)),p+=r,v=0,_=n.length;v<_;++v)e.dirty(n[v]),n[v].mark.bounds.clear();for(y=s,v=0,_=n.length;v<_;++v,y+=u){for(b=n[v],A=b.mark.bounds,x=y;x>=0&&(k=t[x])==null;x-=h);l?(w=d==null?k.x:Math.round(k.bounds.x1+d*k.bounds.width()),M=p):(w=p,M=d==null?k.y:Math.round(k.bounds.y1+d*k.bounds.height())),A.union(b.bounds.translate(w-(b.x||0),M-(b.y||0))),b.x=w,b.y=M,e.dirty(b),g=a(g,A[i])}return g}function LL(e,n,t,o,f,r){if(n){e.dirty(n);var a=t,l=t;o?a=Math.round(f.x1+r*f.width()):l=Math.round(f.y1+r*f.height()),n.bounds.translate(a-(n.x||0),l-(n.y||0)),n.mark.bounds.clear().union(n.bounds),n.x=a,n.y=l,e.dirty(n)}}function Zie(e,n){const t=e[n]||{};return(o,f)=>t[o]!=null?t[o]:e[o]!=null?e[o]:f}function Jie(e,n){let t=-1/0;return e.forEach(o=>{o.offset!=null&&(t=Math.max(t,o.offset))}),t>-1/0?t:n}function Kie(e,n,t,o,f,r,a){const l=Zie(t,n),c=Jie(e,l("offset",0)),i=l("anchor",xE),s=i===uu?1:i===xk?.5:0,u={align:bk,bounds:l("bounds",kE),columns:l("direction")==="vertical"?1:e.length,padding:l("margin",8),center:l("center"),nodirty:!0};switch(n){case of:u.anchor={x:Math.floor(o.x1)-c,column:uu,y:s*(a||o.height()+2*o.y1),row:i};break;case lf:u.anchor={x:Math.ceil(o.x2)+c,y:s*(a||o.height()+2*o.y1),row:i};break;case zm:u.anchor={y:Math.floor(f.y1)-c,row:uu,x:s*(r||f.width()+2*f.x1),column:i};break;case hp:u.anchor={y:Math.ceil(f.y2)+c,x:s*(r||f.width()+2*f.x1),column:i};break;case kie:u.anchor={x:c,y:c};break;case Tie:u.anchor={x:r-c,y:c,column:uu};break;case Mie:u.anchor={x:c,y:a-c,row:uu};break;case Eie:u.anchor={x:r-c,y:a-c,column:uu,row:uu};break}return u}function Qie(e,n){var t=n.items[0],o=t.datum,f=t.orient,r=t.bounds,a=t.x,l=t.y,c,i;return t._bounds?t._bounds.clear().union(r):t._bounds=r.clone(),r.clear(),tae(e,t,t.items[0].items[0]),r=eae(t,r),c=2*t.padding,i=2*t.padding,r.empty()||(c=Math.ceil(r.width()+c),i=Math.ceil(r.height()+i)),o.type===Pie&&nae(t.items[0].items[0].items[0].items),f!==AE&&(t.x=a=0,t.y=l=0),t.width=c,t.height=i,ld(r.set(a,l,a+c,l+i),t),t.mark.bounds.clear().union(r),t}function eae(e,n){return e.items.forEach(t=>n.union(t.bounds)),n.x1=e.padding,n.y1=e.padding,n}function tae(e,n,t){var o=n.padding,f=o-t.x,r=o-t.y;if(!n.datum.title)(f||r)&&ly(e,t,f,r);else{var a=n.items[1].items[0],l=a.anchor,c=n.titlePadding||0,i=o-a.x,s=o-a.y;switch(a.orient){case of:f+=Math.ceil(a.bounds.width())+c;break;case lf:case hp:break;default:r+=a.bounds.height()+c}switch((f||r)&&ly(e,t,f,r),a.orient){case of:s+=Yg(n,t,a,l,1,1);break;case lf:i+=Yg(n,t,a,uu,0,0)+c,s+=Yg(n,t,a,l,1,1);break;case hp:i+=Yg(n,t,a,l,0,0),s+=Yg(n,t,a,uu,-1,0,1)+c;break;default:i+=Yg(n,t,a,l,0,0)}(i||s)&&ly(e,a,i,s),(i=Math.round(a.bounds.x1-o))<0&&(ly(e,t,-i,0),ly(e,a,-i,0))}}function Yg(e,n,t,o,f,r,a){const l=e.datum.type!=="symbol",c=t.datum.vgrad,i=l&&(r||!c)&&!a?n.items[0]:n,s=i.bounds[f?"y2":"x2"]-e.padding,u=c&&r?s:0,h=c&&r?0:s,d=f<=0?0:aE(t);return Math.round(o===xE?u:o===uu?h-d:.5*(s-d))}function ly(e,n,t,o){n.x+=t,n.y+=o,n.bounds.translate(t,o),n.mark.bounds.translate(t,o),e.dirty(n)}function nae(e){const n=e.reduce((t,o)=>(t[o.column]=Math.max(o.bounds.x2-o.x,t[o.column]||0),t),{});e.forEach(t=>{t.width=n[t.column],t.height=t.bounds.y2-t.y})}function rae(e,n,t,o,f){var r=n.items[0],a=r.frame,l=r.orient,c=r.anchor,i=r.offset,s=r.padding,u=r.items[0].items[0],h=r.items[1]&&r.items[1].items[0],d=l===of||l===lf?o:t,m=0,p=0,g=0,y=0,v=0,x;if(a!==c3?l===of?(m=f.y2,d=f.y1):l===lf?(m=f.y1,d=f.y2):(m=f.x1,d=f.x2):l===of&&(m=o,d=0),x=c===xE?m:c===uu?d:(m+d)/2,h&&h.text){switch(l){case zm:case hp:v=u.bounds.height()+s;break;case of:y=u.bounds.width()+s;break;case lf:y=-u.bounds.width()-s;break}Ul.clear().union(h.bounds),Ul.translate(y-(h.x||0),v-(h.y||0)),fm(h,"x",y)|fm(h,"y",v)&&(e.dirty(h),h.bounds.clear().union(Ul),h.mark.bounds.clear().union(Ul),e.dirty(h)),Ul.clear().union(h.bounds)}else Ul.clear();switch(Ul.union(u.bounds),l){case zm:p=x,g=f.y1-Ul.height()-i;break;case of:p=f.x1-Ul.width()-i,g=x;break;case lf:p=f.x2+Ul.width()+i,g=x;break;case hp:p=x,g=f.y2+i;break;default:p=r.x,g=r.y}return fm(r,"x",p)|fm(r,"y",g)&&(Ul.translate(p,g),e.dirty(r),r.bounds.clear().union(Ul),n.bounds.clear().union(Ul),e.dirty(r)),r.bounds}function kB(e){_r.call(this,null,e)}ii(kB,_r,{transform(e,n){const t=n.dataflow;return e.mark.items.forEach(o=>{e.layout&&Wie(t,o,e.layout),aae(t,o,e)}),iae(e.mark.group)?n.reflow():n}});function iae(e){return e&&e.mark.role!=="legend-entry"}function aae(e,n,t){var o=n.items,f=Math.max(0,n.width||0),r=Math.max(0,n.height||0),a=new Us().set(0,0,f,r),l=a.clone(),c=a.clone(),i=[],s,u,h,d,m,p;for(m=0,p=o.length;m{h=y.orient||lf,h!==AE&&(g[h]||(g[h]=[])).push(y)});for(const y in g){const v=g[y];AB(e,v,Kie(v,y,t.legends,l,c,f,r))}i.forEach(y=>{const v=y.bounds;if(v.equals(y._bounds)||(y.bounds=y._bounds,e.dirty(y),y.bounds=v,e.dirty(y)),t.autosize&&t.autosize.type===yB)switch(y.orient){case of:case lf:a.add(v.x1,0).add(v.x2,0);break;case zm:case hp:a.add(0,v.y1).add(0,v.y2)}else a.union(v)})}a.union(l).union(c),s&&a.union(rae(e,s,f,r,a)),n.clip&&a.set(0,0,n.width||0,n.height||0),oae(e,n,a,t)}function oae(e,n,t,o){const f=o.autosize||{},r=f.type;if(e._autosize<1||!r)return;let a=e._width,l=e._height,c=Math.max(0,n.width||0),i=Math.max(0,Math.ceil(-t.x1)),s=Math.max(0,n.height||0),u=Math.max(0,Math.ceil(-t.y1));const h=Math.max(0,Math.ceil(t.x2-c)),d=Math.max(0,Math.ceil(t.y2-s));if(f.contains===Oie){const m=e.padding();a-=m.left+m.right,l-=m.top+m.bottom}r===AE?(i=0,u=0,c=a,s=l):r===yB?(c=Math.max(0,a-i-h),s=Math.max(0,l-u-d)):r===Iie?(c=Math.max(0,a-i-h),l=s+u+d):r===Fie?(a=c+i+h,s=Math.max(0,l-u-d)):r===Rie&&(a=c+i+h,l=s+u+d),e._resizeView(a,l,c,s,[i,u],f.resize)}const sae=Object.freeze(Object.defineProperty({__proto__:null,bound:vB,identifier:TE,mark:xB,overlap:bB,render:wB,viewlayout:kB},Symbol.toStringTag,{value:"Module"}));function TB(e){_r.call(this,null,e)}ii(TB,_r,{transform(e,n){if(this.value&&!e.modified())return n.StopPropagation;var t=n.dataflow.locale(),o=n.fork(n.NO_SOURCE|n.NO_FIELDS),f=this.value,r=e.scale,a=e.count==null?e.values?e.values.length:10:e.count,l=jM(r,a,e.minstep),c=e.format||sN(t,r,l,e.formatSpecifier,e.formatType,!!e.values),i=e.values?oN(r,e.values,l):UM(r,l);return f&&(o.rem=f),f=i.map((s,u)=>oo({index:u/(i.length-1||1),value:s,label:c(s)})),e.extra&&f.length&&f.push(oo({index:-1,extra:{value:f[0].value},label:""})),o.source=f,o.add=f,this.value=f,o}});function MB(e){_r.call(this,null,e)}function lae(){return oo({})}function uae(e){const n=Jv().test(t=>t.exit);return n.lookup=t=>n.get(e(t)),n}ii(MB,_r,{transform(e,n){var t=n.dataflow,o=n.fork(n.NO_SOURCE|n.NO_FIELDS),f=e.item||lae,r=e.key||Gi,a=this.value;return zr(o.encode)&&(o.encode=null),a&&(e.modified("key")||n.modified(r))&&Pr("DataJoin does not support modified key function or fields."),a||(n=n.addAll(),this.value=a=uae(r)),n.visit(n.ADD,l=>{const c=r(l);let i=a.get(c);i?i.exit?(a.empty--,o.add.push(i)):o.mod.push(i):(i=f(l),a.set(c,i),o.add.push(i)),i.datum=l,i.exit=!1}),n.visit(n.MOD,l=>{const c=r(l),i=a.get(c);i&&(i.datum=l,o.mod.push(i))}),n.visit(n.REM,l=>{const c=r(l),i=a.get(c);l===i.datum&&!i.exit&&(o.rem.push(i),i.exit=!0,++a.empty)}),n.changed(n.ADD_MOD)&&o.modifies("datum"),(n.clean()||e.clean&&a.empty>t.cleanThreshold)&&t.runAfter(a.clean),o}});function EB(e){_r.call(this,null,e)}ii(EB,_r,{transform(e,n){var t=n.fork(n.ADD_REM),o=e.mod||!1,f=e.encoders,r=n.encode;if(zr(r))if(t.changed()||r.every(u=>f[u]))r=r[0],t.encode=null;else return n.StopPropagation;var a=r==="enter",l=f.update||Gp,c=f.enter||Gp,i=f.exit||Gp,s=(r&&!a?f[r]:l)||Gp;if(n.changed(n.ADD)&&(n.visit(n.ADD,u=>{c(u,e),l(u,e)}),t.modifies(c.output),t.modifies(l.output),s!==Gp&&s!==l&&(n.visit(n.ADD,u=>{s(u,e)}),t.modifies(s.output))),n.changed(n.REM)&&i!==Gp&&(n.visit(n.REM,u=>{i(u,e)}),t.modifies(i.output)),a||s!==Gp){const u=n.MOD|(e.modified()?n.REFLOW:0);a?(n.visit(u,h=>{const d=c(h,e)||o;(s(h,e)||d)&&t.mod.push(h)}),t.mod.length&&t.modifies(c.output)):n.visit(u,h=>{(s(h,e)||o)&&t.mod.push(h)}),t.mod.length&&t.modifies(s.output)}return t.changed()?t:n.StopPropagation}});function SB(e){_r.call(this,[],e)}ii(SB,_r,{transform(e,n){if(this.value!=null&&!e.modified())return n.StopPropagation;var t=n.dataflow.locale(),o=n.fork(n.NO_SOURCE|n.NO_FIELDS),f=this.value,r=e.type||h2,a=e.scale,l=+e.limit,c=jM(a,e.count==null?5:e.count,e.minstep),i=!!e.values||r===h2,s=e.format||fN(t,a,c,r,e.formatSpecifier,e.formatType,i),u=e.values||cN(a,c),h,d,m,p,g;return f&&(o.rem=f),r===h2?(l&&u.length>l?(n.dataflow.warn("Symbol legend count exceeds limit, filtering items."),f=u.slice(0,l-1),g=!0):f=u,xa(m=e.size)?(!e.values&&a(f[0])===0&&(f=f.slice(1)),p=f.reduce((y,v)=>Math.max(y,m(v,e)),0)):m=bu(p=m||8),f=f.map((y,v)=>oo({index:v,label:s(y,v,f),value:y,offset:p,size:m(y,e)})),g&&(g=u[f.length],f.push(oo({index:f.length,label:"…".concat(u.length-f.length," entries"),value:g,offset:p,size:m(g,e)})))):r===Fte?(h=a.domain(),d=rN(a,h[0],qa(h)),u.length<3&&!e.values&&h[0]!==qa(h)&&(u=[h[0],qa(h)]),f=u.map((y,v)=>oo({index:v,label:s(y,v,u),value:y,perc:d(y)}))):(m=u.length-1,d=Gte(a),f=u.map((y,v)=>oo({index:v,label:s(y,v,u),value:y,perc:v?d(y):0,perc2:v===m?1:d(u[v+1])}))),o.source=f,o.add=f,this.value=f,o}});const cae=e=>e.source.x,fae=e=>e.source.y,hae=e=>e.target.x,dae=e=>e.target.y;function ME(e){_r.call(this,{},e)}ME.Definition={type:"LinkPath",metadata:{modifies:!0},params:[{name:"sourceX",type:"field",default:"source.x"},{name:"sourceY",type:"field",default:"source.y"},{name:"targetX",type:"field",default:"target.x"},{name:"targetY",type:"field",default:"target.y"},{name:"orient",type:"enum",default:"vertical",values:["horizontal","vertical","radial"]},{name:"shape",type:"enum",default:"line",values:["line","arc","curve","diagonal","orthogonal"]},{name:"require",type:"signal"},{name:"as",type:"string",default:"path"}]};ii(ME,_r,{transform(e,n){var t=e.sourceX||cae,o=e.sourceY||fae,f=e.targetX||hae,r=e.targetY||dae,a=e.as||"path",l=e.orient||"vertical",c=e.shape||"line",i=DL.get(c+"-"+l)||DL.get(c);return i||Pr("LinkPath unsupported type: "+e.shape+(e.orient?"-"+e.orient:"")),n.visit(n.SOURCE,s=>{s[a]=i(t(s),o(s),f(s),r(s))}),n.reflow(e.modified()).modifies(a)}});const CB=(e,n,t,o)=>"M"+e+","+n+"L"+t+","+o,pae=(e,n,t,o)=>CB(n*Math.cos(e),n*Math.sin(e),o*Math.cos(t),o*Math.sin(t)),LB=(e,n,t,o)=>{var f=t-e,r=o-n,a=Math.sqrt(f*f+r*r)/2,l=180*Math.atan2(r,f)/Math.PI;return"M"+e+","+n+"A"+a+","+a+" "+l+" 0 1 "+t+","+o},gae=(e,n,t,o)=>LB(n*Math.cos(e),n*Math.sin(e),o*Math.cos(t),o*Math.sin(t)),DB=(e,n,t,o)=>{const f=t-e,r=o-n,a=.2*(f+r),l=.2*(r-f);return"M"+e+","+n+"C"+(e+a)+","+(n+l)+" "+(t+l)+","+(o-a)+" "+t+","+o},mae=(e,n,t,o)=>DB(n*Math.cos(e),n*Math.sin(e),o*Math.cos(t),o*Math.sin(t)),yae=(e,n,t,o)=>"M"+e+","+n+"V"+o+"H"+t,vae=(e,n,t,o)=>"M"+e+","+n+"H"+t+"V"+o,xae=(e,n,t,o)=>{const f=Math.cos(e),r=Math.sin(e),a=Math.cos(t),l=Math.sin(t),c=Math.abs(t-e)>Math.PI?t<=e:t>e;return"M"+n*f+","+n*r+"A"+n+","+n+" 0 0,"+(c?1:0)+" "+n*a+","+n*l+"L"+o*a+","+o*l},bae=(e,n,t,o)=>{const f=(e+t)/2;return"M"+e+","+n+"C"+f+","+n+" "+f+","+o+" "+t+","+o},_ae=(e,n,t,o)=>{const f=(n+o)/2;return"M"+e+","+n+"C"+e+","+f+" "+t+","+f+" "+t+","+o},wae=(e,n,t,o)=>{const f=Math.cos(e),r=Math.sin(e),a=Math.cos(t),l=Math.sin(t),c=(n+o)/2;return"M"+n*f+","+n*r+"C"+c*f+","+c*r+" "+c*a+","+c*l+" "+o*a+","+o*l},DL=Jv({line:CB,"line-radial":pae,arc:LB,"arc-radial":gae,curve:DB,"curve-radial":mae,"orthogonal-horizontal":yae,"orthogonal-vertical":vae,"orthogonal-radial":xae,"diagonal-horizontal":bae,"diagonal-vertical":_ae,"diagonal-radial":wae});function EE(e){_r.call(this,null,e)}EE.Definition={type:"Pie",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"startAngle",type:"number",default:0},{name:"endAngle",type:"number",default:6.283185307179586},{name:"sort",type:"boolean",default:!1},{name:"as",type:"string",array:!0,length:2,default:["startAngle","endAngle"]}]};ii(EE,_r,{transform(e,n){var t=e.as||["startAngle","endAngle"],o=t[0],f=t[1],r=e.field||Zv,a=e.startAngle||0,l=e.endAngle!=null?e.endAngle:2*Math.PI,c=n.source,i=c.map(r),s=i.length,u=a,h=(l-a)/xF(i),d=sc(s),m,p,g;for(e.sort&&d.sort((y,v)=>i[y]-i[v]),m=0;m-1)return o;var f=n.domain,r=e.type,a=n.zero||n.zero===void 0&&kae(e),l,c;if(!f)return 0;if(OB(r)&&n.padding&&f[0]!==qa(f)&&(f=Lae(r,f,n.range,n.padding,n.exponent,n.constant)),(a||n.domainMin!=null||n.domainMax!=null||n.domainMid!=null)&&(l=(f=f.slice()).length-1||1,a&&(f[0]>0&&(f[0]=0),f[l]<0&&(f[l]=0)),n.domainMin!=null&&(f[0]=n.domainMin),n.domainMax!=null&&(f[l]=n.domainMax),n.domainMid!=null)){c=n.domainMid;const i=c>f[l]?l+1:cf+(r<0?-1:r>0?1:0),0));o!==n.length&&t.warn("Log scale domain includes zero: "+ri(n))}return n}function Dae(e,n,t){let o=n.bins;if(o&&!zr(o)){const f=e.domain(),r=f[0],a=qa(f),l=o.step;let c=o.start==null?r:o.start,i=o.stop==null?a:o.stop;l||Pr("Scale bins parameter missing step property."),ca&&(i=l*Math.floor(a/l)),o=sc(c,i+l/2,l)}return o?e.bins=o:e.bins&&delete e.bins,e.type===IM&&(o?!n.domain&&!n.domainRaw&&(e.domain(o),t=o.length):e.bins=e.domain()),t}function Oae(e,n,t){var o=e.type,f=n.round||!1,r=n.range;if(n.rangeStep!=null)r=Pae(o,n,t);else if(n.scheme&&(r=Iae(o,n,t),xa(r))){if(e.interpolator)return e.interpolator(r);Pr("Scale type ".concat(o," does not support interpolating color schemes."))}if(r&&Qz(o))return e.interpolator(Kw(_k(r,n.reverse),n.interpolate,n.interpolateGamma));r&&n.interpolate&&e.interpolate?e.interpolate(NM(n.interpolate,n.interpolateGamma)):xa(e.round)?e.round(f):xa(e.rangeRound)&&e.interpolate(f?bw:Yv),r&&e.range(_k(r,n.reverse))}function Pae(e,n,t){e!==Yz&&e!==ok&&Pr("Only band and point scales support rangeStep.");var o=(n.paddingOuter!=null?n.paddingOuter:n.padding)||0,f=e===ok?1:(n.paddingInner!=null?n.paddingInner:n.padding)||0;return[0,n.rangeStep*OM(t,f,o)]}function Iae(e,n,t){var o=n.schemeExtent,f,r;return zr(n.scheme)?r=Kw(n.scheme,n.interpolate,n.interpolateGamma):(f=n.scheme.toLowerCase(),r=BM(f),r||Pr("Unrecognized scheme name: ".concat(n.scheme))),t=e===Jw?t+1:e===IM?t-1:e===Dm||e===Zw?+n.schemeCount||Aae:t,Qz(e)?OL(r,o,n.reverse):xa(r)?nN(OL(r,o),t):e===PM?r:r.slice(0,t)}function OL(e,n,t){return xa(e)&&(n||t)?tN(e,_k(n||[0,1],t)):e}function _k(e,n){return n?e.slice().reverse():e}function FB(e){_r.call(this,null,e)}ii(FB,_r,{transform(e,n){const t=e.modified("sort")||n.changed(n.ADD)||n.modified(e.sort.fields)||n.modified("datum");return t&&n.source.sort(rg(e.sort)),this.modified(t),n}});const PL="zero",RB="center",zB="normalize",NB=["y0","y1"];function SE(e){_r.call(this,null,e)}SE.Definition={type:"Stack",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"groupby",type:"field",array:!0},{name:"sort",type:"compare"},{name:"offset",type:"enum",default:PL,values:[PL,RB,zB]},{name:"as",type:"string",array:!0,length:2,default:NB}]};ii(SE,_r,{transform(e,n){var t=e.as||NB,o=t[0],f=t[1],r=rg(e.sort),a=e.field||Zv,l=e.offset===RB?Fae:e.offset===zB?Rae:zae,c,i,s,u;for(c=Nae(n.source,e.groupby,r,a),i=0,s=c.length,u=c.max;ip(s),a,l,c,i,s,u,h,d,m;if(n==null)f.push(e.slice());else for(a={},l=0,c=e.length;lm&&(m=d),t&&h.sort(t)}return f.max=m,f}const Bae=Object.freeze(Object.defineProperty({__proto__:null,axisticks:TB,datajoin:MB,encode:EB,legendentries:SB,linkpath:ME,pie:EE,scale:PB,sortitems:FB,stack:SE},Symbol.toStringTag,{value:"Module"}));var Ji=1e-6,h_=1e-12,Ca=Math.PI,ks=Ca/2,d_=Ca/4,_u=Ca*2,Fs=180/Ca,La=Ca/180,Va=Math.abs,g1=Math.atan,Lc=Math.atan2,Ki=Math.cos,Rb=Math.ceil,BB=Math.exp,wk=Math.hypot,p_=Math.log,O4=Math.pow,Wi=Math.sin,Ac=Math.sign||function(e){return e>0?1:e<0?-1:0},wu=Math.sqrt,CE=Math.tan;function jB(e){return e>1?0:e<-1?Ca:Math.acos(e)}function Hu(e){return e>1?ks:e<-1?-ks:Math.asin(e)}function El(){}function g_(e,n){e&&FL.hasOwnProperty(e.type)&&FL[e.type](e,n)}var IL={Feature:function(e,n){g_(e.geometry,n)},FeatureCollection:function(e,n){for(var t=e.features,o=-1,f=t.length;++o=0?1:-1,f=o*t,r=Ki(n),a=Wi(n),l=Mk*a,c=Tk*r+l*Ki(f),i=l*o*Wi(f);m_.add(Lc(i,c)),kk=e,Tk=r,Mk=a}function Vae(e){return y_=new yu,Vh(e,uh),y_*2}function v_(e){return[Lc(e[1],e[0]),Hu(e[2])]}function F0(e){var n=e[0],t=e[1],o=Ki(t);return[o*Ki(n),o*Wi(n),Wi(t)]}function zb(e,n){return e[0]*n[0]+e[1]*n[1]+e[2]*n[2]}function Nm(e,n){return[e[1]*n[2]-e[2]*n[1],e[2]*n[0]-e[0]*n[2],e[0]*n[1]-e[1]*n[0]]}function P4(e,n){e[0]+=n[0],e[1]+=n[1],e[2]+=n[2]}function Nb(e,n){return[e[0]*n,e[1]*n,e[2]*n]}function x_(e){var n=wu(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=n,e[1]/=n,e[2]/=n}var gs,Pu,_s,ic,s0,qB,HB,ym,Jy,Od,nd,Bh={point:Ek,lineStart:zL,lineEnd:NL,polygonStart:function(){Bh.point=WB,Bh.lineStart=qae,Bh.lineEnd=Hae,Jy=new yu,uh.polygonStart()},polygonEnd:function(){uh.polygonEnd(),Bh.point=Ek,Bh.lineStart=zL,Bh.lineEnd=NL,m_<0?(gs=-(_s=180),Pu=-(ic=90)):Jy>Ji?ic=90:Jy<-Ji&&(Pu=-90),nd[0]=gs,nd[1]=_s},sphere:function(){gs=-(_s=180),Pu=-(ic=90)}};function Ek(e,n){Od.push(nd=[gs=e,_s=e]),nic&&(ic=n)}function GB(e,n){var t=F0([e*La,n*La]);if(ym){var o=Nm(ym,t),f=[o[1],-o[0],0],r=Nm(f,o);x_(r),r=v_(r);var a=e-s0,l=a>0?1:-1,c=r[0]*Fs*l,i,s=Va(a)>180;s^(l*s0ic&&(ic=i)):(c=(c+360)%360-180,s^(l*s0ic&&(ic=n))),s?erc(gs,_s)&&(_s=e):rc(e,_s)>rc(gs,_s)&&(gs=e):_s>=gs?(e_s&&(_s=e)):e>s0?rc(gs,e)>rc(gs,_s)&&(_s=e):rc(e,_s)>rc(gs,_s)&&(gs=e)}else Od.push(nd=[gs=e,_s=e]);nic&&(ic=n),ym=t,s0=e}function zL(){Bh.point=GB}function NL(){nd[0]=gs,nd[1]=_s,Bh.point=Ek,ym=null}function WB(e,n){if(ym){var t=e-s0;Jy.add(Va(t)>180?t+(t>0?360:-360):t)}else qB=e,HB=n;uh.point(e,n),GB(e,n)}function qae(){uh.lineStart()}function Hae(){WB(qB,HB),uh.lineEnd(),Va(Jy)>Ji&&(gs=-(_s=180)),nd[0]=gs,nd[1]=_s,ym=null}function rc(e,n){return(n-=e)<0?n+360:n}function Gae(e,n){return e[0]-n[0]}function BL(e,n){return e[0]<=e[1]?e[0]<=n&&n<=e[1]:nrc(o[0],o[1])&&(o[1]=f[1]),rc(f[0],o[1])>rc(o[0],o[1])&&(o[0]=f[0])):r.push(o=f);for(a=-1/0,t=r.length-1,n=0,o=r[t];n<=t;o=f,++n)f=r[n],(l=rc(o[1],f[0]))>a&&(a=l,gs=f[0],_s=o[1])}return Od=nd=null,gs===1/0||Pu===1/0?[[NaN,NaN],[NaN,NaN]]:[[gs,Pu],[_s,ic]]}var Oy,b_,__,w_,A_,k_,T_,M_,Sk,Ck,Lk,YB,XB,cu,fu,hu,uf={sphere:El,point:LE,lineStart:jL,lineEnd:UL,polygonStart:function(){uf.lineStart=Zae,uf.lineEnd=Jae},polygonEnd:function(){uf.lineStart=jL,uf.lineEnd=UL}};function LE(e,n){e*=La,n*=La;var t=Ki(n);dx(t*Ki(e),t*Wi(e),Wi(n))}function dx(e,n,t){++Oy,__+=(e-__)/Oy,w_+=(n-w_)/Oy,A_+=(t-A_)/Oy}function jL(){uf.point=Yae}function Yae(e,n){e*=La,n*=La;var t=Ki(n);cu=t*Ki(e),fu=t*Wi(e),hu=Wi(n),uf.point=Xae,dx(cu,fu,hu)}function Xae(e,n){e*=La,n*=La;var t=Ki(n),o=t*Ki(e),f=t*Wi(e),r=Wi(n),a=Lc(wu((a=fu*r-hu*f)*a+(a=hu*o-cu*r)*a+(a=cu*f-fu*o)*a),cu*o+fu*f+hu*r);b_+=a,k_+=a*(cu+(cu=o)),T_+=a*(fu+(fu=f)),M_+=a*(hu+(hu=r)),dx(cu,fu,hu)}function UL(){uf.point=LE}function Zae(){uf.point=Kae}function Jae(){ZB(YB,XB),uf.point=LE}function Kae(e,n){YB=e,XB=n,e*=La,n*=La,uf.point=ZB;var t=Ki(n);cu=t*Ki(e),fu=t*Wi(e),hu=Wi(n),dx(cu,fu,hu)}function ZB(e,n){e*=La,n*=La;var t=Ki(n),o=t*Ki(e),f=t*Wi(e),r=Wi(n),a=fu*r-hu*f,l=hu*o-cu*r,c=cu*f-fu*o,i=wk(a,l,c),s=Hu(i),u=i&&-s/i;Sk.add(u*a),Ck.add(u*l),Lk.add(u*c),b_+=s,k_+=s*(cu+(cu=o)),T_+=s*(fu+(fu=f)),M_+=s*(hu+(hu=r)),dx(cu,fu,hu)}function Qae(e){Oy=b_=__=w_=A_=k_=T_=M_=0,Sk=new yu,Ck=new yu,Lk=new yu,Vh(e,uf);var n=+Sk,t=+Ck,o=+Lk,f=wk(n,t,o);return fCa?e+Math.round(-e/_u)*_u:e,n]}Ok.invert=Ok;function JB(e,n,t){return(e%=_u)?n||t?Dk(VL(e),qL(n,t)):VL(e):n||t?qL(n,t):Ok}function $L(e){return function(n,t){return n+=e,[n>Ca?n-_u:n<-Ca?n+_u:n,t]}}function VL(e){var n=$L(e);return n.invert=$L(-e),n}function qL(e,n){var t=Ki(e),o=Wi(e),f=Ki(n),r=Wi(n);function a(l,c){var i=Ki(c),s=Ki(l)*i,u=Wi(l)*i,h=Wi(c),d=h*t+s*o;return[Lc(u*f-d*r,s*t-h*o),Hu(d*f+u*r)]}return a.invert=function(l,c){var i=Ki(c),s=Ki(l)*i,u=Wi(l)*i,h=Wi(c),d=h*f-u*r;return[Lc(u*f+h*r,s*t+d*o),Hu(d*t-s*o)]},a}function eoe(e){e=JB(e[0]*La,e[1]*La,e.length>2?e[2]*La:0);function n(t){return t=e(t[0]*La,t[1]*La),t[0]*=Fs,t[1]*=Fs,t}return n.invert=function(t){return t=e.invert(t[0]*La,t[1]*La),t[0]*=Fs,t[1]*=Fs,t},n}function toe(e,n,t,o,f,r){if(t){var a=Ki(n),l=Wi(n),c=o*t;f==null?(f=n+o*_u,r=n-c/2):(f=HL(a,f),r=HL(a,r),(o>0?fr)&&(f+=o*_u));for(var i,s=f;o>0?s>r:s1&&e.push(e.pop().concat(e.shift()))},result:function(){var t=e;return e=[],n=null,t}}}function b2(e,n){return Va(e[0]-n[0])=0;--l)f.point((u=s[l])[0],u[1]);else o(h.x,h.p.x,-1,f);h=h.p}h=h.o,s=h.z,d=!d}while(!h.v);f.lineEnd()}}}function GL(e){if(n=e.length){for(var n,t=0,o=e[0],f;++t=0?1:-1,T=M*w,E=T>Ca,S=g*b;if(c.add(Lc(S*M*Wi(T),y*k+S*Ki(T))),a+=E?w+M*_u:w,E^m>=t^_>=t){var P=Nm(F0(d),F0(x));x_(P);var L=Nm(r,P);x_(L);var R=(E^w>=0?-1:1)*Hu(L[2]);(o>R||o===R&&(P[0]||P[1]))&&(l+=E^w>=0?1:-1)}}return(a<-Ji||a0){for(c||(f.polygonStart(),c=!0),f.lineStart(),b=0;b1&&_&2&&A.push(A.pop().concat(A.shift())),s.push(A.filter(roe))}}return h}}function roe(e){return e.length>1}function ioe(e,n){return((e=e.x)[0]<0?e[1]-ks-Ji:ks-e[1])-((n=n.x)[0]<0?n[1]-ks-Ji:ks-n[1])}const WL=ej(function(){return!0},aoe,soe,[-Ca,-ks]);function aoe(e){var n=NaN,t=NaN,o=NaN,f;return{lineStart:function(){e.lineStart(),f=1},point:function(r,a){var l=r>0?Ca:-Ca,c=Va(r-n);Va(c-Ca)0?ks:-ks),e.point(o,t),e.lineEnd(),e.lineStart(),e.point(l,t),e.point(r,t),f=0):o!==l&&c>=Ca&&(Va(n-o)Ji?g1((Wi(n)*(r=Ki(o))*Wi(t)-Wi(o)*(f=Ki(n))*Wi(e))/(f*r*a)):(n+o)/2}function soe(e,n,t,o){var f;if(e==null)f=t*ks,o.point(-Ca,f),o.point(0,f),o.point(Ca,f),o.point(Ca,0),o.point(Ca,-f),o.point(0,-f),o.point(-Ca,-f),o.point(-Ca,0),o.point(-Ca,f);else if(Va(e[0]-n[0])>Ji){var r=e[0]0,f=Va(n)>Ji;function r(s,u,h,d){toe(d,e,t,h,s,u)}function a(s,u){return Ki(s)*Ki(u)>n}function l(s){var u,h,d,m,p;return{lineStart:function(){m=d=!1,p=1},point:function(g,y){var v=[g,y],x,_=a(g,y),A=o?_?0:i(g,y):_?i(g+(g<0?Ca:-Ca),y):0;if(!u&&(m=d=_)&&s.lineStart(),_!==d&&(x=c(u,v),(!x||b2(u,x)||b2(v,x))&&(v[2]=1)),_!==d)p=0,_?(s.lineStart(),x=c(v,u),s.point(x[0],x[1])):(x=c(u,v),s.point(x[0],x[1],2),s.lineEnd()),u=x;else if(f&&u&&o^_){var b;!(A&h)&&(b=c(v,u,!0))&&(p=0,o?(s.lineStart(),s.point(b[0][0],b[0][1]),s.point(b[1][0],b[1][1]),s.lineEnd()):(s.point(b[1][0],b[1][1]),s.lineEnd(),s.lineStart(),s.point(b[0][0],b[0][1],3)))}_&&(!u||!b2(u,v))&&s.point(v[0],v[1]),u=v,d=_,h=A},lineEnd:function(){d&&s.lineEnd(),u=null},clean:function(){return p|(m&&d)<<1}}}function c(s,u,h){var d=F0(s),m=F0(u),p=[1,0,0],g=Nm(d,m),y=zb(g,g),v=g[0],x=y-v*v;if(!x)return!h&&s;var _=n*y/x,A=-n*v/x,b=Nm(p,g),k=Nb(p,_),w=Nb(g,A);P4(k,w);var M=b,T=zb(k,M),E=zb(M,M),S=T*T-E*(zb(k,k)-1);if(!(S<0)){var P=wu(S),L=Nb(M,(-T-P)/E);if(P4(L,k),L=v_(L),!h)return L;var R=s[0],F=u[0],D=s[1],O=u[1],N;F0^L[1]<(Va(L[0]-R)Ca^(R<=L[0]&&L[0]<=F)){var K=Nb(M,(-T+P)/E);return P4(K,k),[L,v_(K)]}}}function i(s,u){var h=o?e:Ca-e,d=0;return s<-h?d|=1:s>h&&(d|=2),u<-h?d|=4:u>h&&(d|=8),d}return ej(a,l,r,o?[0,-e]:[-Ca,e-Ca])}function uoe(e,n,t,o,f,r){var a=e[0],l=e[1],c=n[0],i=n[1],s=0,u=1,h=c-a,d=i-l,m;if(m=t-a,!(!h&&m>0)){if(m/=h,h<0){if(m0){if(m>u)return;m>s&&(s=m)}if(m=f-a,!(!h&&m<0)){if(m/=h,h<0){if(m>u)return;m>s&&(s=m)}else if(h>0){if(m0)){if(m/=d,d<0){if(m0){if(m>u)return;m>s&&(s=m)}if(m=r-l,!(!d&&m<0)){if(m/=d,d<0){if(m>u)return;m>s&&(s=m)}else if(d>0){if(m0&&(e[0]=a+s*h,e[1]=l+s*d),u<1&&(n[0]=a+u*h,n[1]=l+u*d),!0}}}}}var Py=1e9,jb=-Py;function tj(e,n,t,o){function f(i,s){return e<=i&&i<=t&&n<=s&&s<=o}function r(i,s,u,h){var d=0,m=0;if(i==null||(d=a(i,u))!==(m=a(s,u))||c(i,s)<0^u>0)do h.point(d===0||d===3?e:t,d>1?o:n);while((d=(d+u+4)%4)!==m);else h.point(s[0],s[1])}function a(i,s){return Va(i[0]-e)0?0:3:Va(i[0]-t)0?2:1:Va(i[1]-n)0?1:0:s>0?3:2}function l(i,s){return c(i.x,s.x)}function c(i,s){var u=a(i,1),h=a(s,1);return u!==h?u-h:u===0?s[1]-i[1]:u===1?i[0]-s[0]:u===2?i[1]-s[1]:s[0]-i[0]}return function(i){var s=i,u=KB(),h,d,m,p,g,y,v,x,_,A,b,k={point:w,lineStart:S,lineEnd:P,polygonStart:T,polygonEnd:E};function w(R,F){f(R,F)&&s.point(R,F)}function M(){for(var R=0,F=0,D=d.length;Fo&&(te-G)*(o-K)>(Y-K)*(e-G)&&++R:Y<=o&&(te-G)*(o-K)<(Y-K)*(e-G)&&--R;return R}function T(){s=u,h=[],d=[],b=!0}function E(){var R=M(),F=b&&R,D=(h=vF(h)).length;(F||D)&&(i.polygonStart(),F&&(i.lineStart(),r(null,null,1,i),i.lineEnd()),D&&QB(h,l,R,r,i),i.polygonEnd()),s=i,h=d=m=null}function S(){k.point=L,d&&d.push(m=[]),A=!0,_=!1,v=x=NaN}function P(){h&&(L(p,g),y&&_&&u.rejoin(),h.push(u.result())),k.point=w,_&&s.lineEnd()}function L(R,F){var D=f(R,F);if(d&&m.push([R,F]),A)p=R,g=F,y=D,A=!1,D&&(s.lineStart(),s.point(R,F));else if(D&&_)s.point(R,F);else{var O=[v=Math.max(jb,Math.min(Py,v)),x=Math.max(jb,Math.min(Py,x))],N=[R=Math.max(jb,Math.min(Py,R)),F=Math.max(jb,Math.min(Py,F))];uoe(O,N,e,n,t,o)?(_||(s.lineStart(),s.point(O[0],O[1])),s.point(N[0],N[1]),D||s.lineEnd(),b=!1):D&&(s.lineStart(),s.point(R,F),b=!1)}v=R,x=F,_=D}return k}}function YL(e,n,t){var o=sc(e,n-Ji,t).concat(n);return function(f){return o.map(function(r){return[f,r]})}}function XL(e,n,t){var o=sc(e,n-Ji,t).concat(n);return function(f){return o.map(function(r){return[r,f]})}}function coe(){var e,n,t,o,f,r,a,l,c=10,i=c,s=90,u=360,h,d,m,p,g=2.5;function y(){return{type:"MultiLineString",coordinates:v()}}function v(){return sc(Rb(o/s)*s,t,s).map(m).concat(sc(Rb(l/u)*u,a,u).map(p)).concat(sc(Rb(n/c)*c,e,c).filter(function(x){return Va(x%s)>Ji}).map(h)).concat(sc(Rb(r/i)*i,f,i).filter(function(x){return Va(x%u)>Ji}).map(d))}return y.lines=function(){return v().map(function(x){return{type:"LineString",coordinates:x}})},y.outline=function(){return{type:"Polygon",coordinates:[m(o).concat(p(a).slice(1),m(t).reverse().slice(1),p(l).reverse().slice(1))]}},y.extent=function(x){return arguments.length?y.extentMajor(x).extentMinor(x):y.extentMinor()},y.extentMajor=function(x){return arguments.length?(o=+x[0][0],t=+x[1][0],l=+x[0][1],a=+x[1][1],o>t&&(x=o,o=t,t=x),l>a&&(x=l,l=a,a=x),y.precision(g)):[[o,l],[t,a]]},y.extentMinor=function(x){return arguments.length?(n=+x[0][0],e=+x[1][0],r=+x[0][1],f=+x[1][1],n>e&&(x=n,n=e,e=x),r>f&&(x=r,r=f,f=x),y.precision(g)):[[n,r],[e,f]]},y.step=function(x){return arguments.length?y.stepMajor(x).stepMinor(x):y.stepMinor()},y.stepMajor=function(x){return arguments.length?(s=+x[0],u=+x[1],y):[s,u]},y.stepMinor=function(x){return arguments.length?(c=+x[0],i=+x[1],y):[c,i]},y.precision=function(x){return arguments.length?(g=+x,h=YL(r,f,90),d=XL(n,e,g),m=YL(l,a,90),p=XL(o,t,g),y):g},y.extentMajor([[-180,-90+Ji],[180,90-Ji]]).extentMinor([[-180,-80-Ji],[180,80+Ji]])}const wv=e=>e;var F4=new yu,Pk=new yu,nj,rj,Ik,Fk,Fd={point:El,lineStart:El,lineEnd:El,polygonStart:function(){Fd.lineStart=foe,Fd.lineEnd=doe},polygonEnd:function(){Fd.lineStart=Fd.lineEnd=Fd.point=El,F4.add(Va(Pk)),Pk=new yu},result:function(){var e=F4/2;return F4=new yu,e}};function foe(){Fd.point=hoe}function hoe(e,n){Fd.point=ij,nj=Ik=e,rj=Fk=n}function ij(e,n){Pk.add(Fk*e-Ik*n),Ik=e,Fk=n}function doe(){ij(nj,rj)}const ZL=Fd;var Bm=1/0,E_=Bm,Av=-Bm,S_=Av,poe={point:goe,lineStart:El,lineEnd:El,polygonStart:El,polygonEnd:El,result:function(){var e=[[Bm,E_],[Av,S_]];return Av=S_=-(E_=Bm=1/0),e}};function goe(e,n){eAv&&(Av=e),nS_&&(S_=n)}const C_=poe;var Rk=0,zk=0,Iy=0,L_=0,D_=0,hm=0,Nk=0,Bk=0,Fy=0,aj,oj,Wf,Yf,sf={point:R0,lineStart:JL,lineEnd:KL,polygonStart:function(){sf.lineStart=voe,sf.lineEnd=xoe},polygonEnd:function(){sf.point=R0,sf.lineStart=JL,sf.lineEnd=KL},result:function(){var e=Fy?[Nk/Fy,Bk/Fy]:hm?[L_/hm,D_/hm]:Iy?[Rk/Iy,zk/Iy]:[NaN,NaN];return Rk=zk=Iy=L_=D_=hm=Nk=Bk=Fy=0,e}};function R0(e,n){Rk+=e,zk+=n,++Iy}function JL(){sf.point=moe}function moe(e,n){sf.point=yoe,R0(Wf=e,Yf=n)}function yoe(e,n){var t=e-Wf,o=n-Yf,f=wu(t*t+o*o);L_+=f*(Wf+e)/2,D_+=f*(Yf+n)/2,hm+=f,R0(Wf=e,Yf=n)}function KL(){sf.point=R0}function voe(){sf.point=boe}function xoe(){sj(aj,oj)}function boe(e,n){sf.point=sj,R0(aj=Wf=e,oj=Yf=n)}function sj(e,n){var t=e-Wf,o=n-Yf,f=wu(t*t+o*o);L_+=f*(Wf+e)/2,D_+=f*(Yf+n)/2,hm+=f,f=Yf*e-Wf*n,Nk+=f*(Wf+e),Bk+=f*(Yf+n),Fy+=f*3,R0(Wf=e,Yf=n)}const QL=sf;function lj(e){this._context=e}lj.prototype={_radius:4.5,pointRadius:function(e){return this._radius=e,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(e,n){switch(this._point){case 0:{this._context.moveTo(e,n),this._point=1;break}case 1:{this._context.lineTo(e,n);break}default:{this._context.moveTo(e+this._radius,n),this._context.arc(e,n,this._radius,0,_u);break}}},result:El};var jk=new yu,R4,uj,cj,Ry,zy,O_={point:El,lineStart:function(){O_.point=_oe},lineEnd:function(){R4&&fj(uj,cj),O_.point=El},polygonStart:function(){R4=!0},polygonEnd:function(){R4=null},result:function(){var e=+jk;return jk=new yu,e}};function _oe(e,n){O_.point=fj,uj=Ry=e,cj=zy=n}function fj(e,n){Ry-=e,zy-=n,jk.add(wu(Ry*Ry+zy*zy)),Ry=e,zy=n}const eD=O_;function hj(){this._string=[]}hj.prototype={_radius:4.5,_circle:tD(4.5),pointRadius:function(e){return(e=+e)!==this._radius&&(this._radius=e,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._string.push("Z"),this._point=NaN},point:function(e,n){switch(this._point){case 0:{this._string.push("M",e,",",n),this._point=1;break}case 1:{this._string.push("L",e,",",n);break}default:{this._circle==null&&(this._circle=tD(this._radius)),this._string.push("M",e,",",n,this._circle);break}}},result:function(){if(this._string.length){var e=this._string.join("");return this._string=[],e}else return null}};function tD(e){return"m0,"+e+"a"+e+","+e+" 0 1,1 0,"+-2*e+"a"+e+","+e+" 0 1,1 0,"+2*e+"z"}function dj(e,n){var t=4.5,o,f;function r(a){return a&&(typeof t=="function"&&f.pointRadius(+t.apply(this,arguments)),Vh(a,o(f))),f.result()}return r.area=function(a){return Vh(a,o(ZL)),ZL.result()},r.measure=function(a){return Vh(a,o(eD)),eD.result()},r.bounds=function(a){return Vh(a,o(C_)),C_.result()},r.centroid=function(a){return Vh(a,o(QL)),QL.result()},r.projection=function(a){return arguments.length?(o=a==null?(e=null,wv):(e=a).stream,r):e},r.context=function(a){return arguments.length?(f=a==null?(n=null,new hj):new lj(n=a),typeof t!="function"&&f.pointRadius(t),r):n},r.pointRadius=function(a){return arguments.length?(t=typeof a=="function"?a:(f.pointRadius(+a),+a),r):t},r.projection(e).context(n)}function f3(e){return function(n){var t=new Uk;for(var o in e)t[o]=e[o];return t.stream=n,t}}function Uk(){}Uk.prototype={constructor:Uk,point:function(e,n){this.stream.point(e,n)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function DE(e,n,t){var o=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),o!=null&&e.clipExtent(null),Vh(t,e.stream(C_)),n(C_.result()),o!=null&&e.clipExtent(o),e}function h3(e,n,t){return DE(e,function(o){var f=n[1][0]-n[0][0],r=n[1][1]-n[0][1],a=Math.min(f/(o[1][0]-o[0][0]),r/(o[1][1]-o[0][1])),l=+n[0][0]+(f-a*(o[1][0]+o[0][0]))/2,c=+n[0][1]+(r-a*(o[1][1]+o[0][1]))/2;e.scale(150*a).translate([l,c])},t)}function OE(e,n,t){return h3(e,[[0,0],n],t)}function PE(e,n,t){return DE(e,function(o){var f=+n,r=f/(o[1][0]-o[0][0]),a=(f-r*(o[1][0]+o[0][0]))/2,l=-r*o[0][1];e.scale(150*r).translate([a,l])},t)}function IE(e,n,t){return DE(e,function(o){var f=+n,r=f/(o[1][1]-o[0][1]),a=-r*o[0][0],l=(f-r*(o[1][1]+o[0][1]))/2;e.scale(150*r).translate([a,l])},t)}var nD=16,woe=Ki(30*La);function rD(e,n){return+n?koe(e,n):Aoe(e)}function Aoe(e){return f3({point:function(n,t){n=e(n,t),this.stream.point(n[0],n[1])}})}function koe(e,n){function t(o,f,r,a,l,c,i,s,u,h,d,m,p,g){var y=i-o,v=s-f,x=y*y+v*v;if(x>4*n&&p--){var _=a+h,A=l+d,b=c+m,k=wu(_*_+A*A+b*b),w=Hu(b/=k),M=Va(Va(b)-1)n||Va((y*P+v*L)/x-.5)>.3||a*h+l*d+c*m2?R[2]%360*La:0,P()):[l*Fs,c*Fs,i*Fs]},E.angle=function(R){return arguments.length?(u=R%360*La,P()):u*Fs},E.reflectX=function(R){return arguments.length?(h=R?-1:1,P()):h<0},E.reflectY=function(R){return arguments.length?(d=R?-1:1,P()):d<0},E.precision=function(R){return arguments.length?(b=rD(k,A=R*R),L()):wu(A)},E.fitExtent=function(R,F){return h3(E,R,F)},E.fitSize=function(R,F){return OE(E,R,F)},E.fitWidth=function(R,F){return PE(E,R,F)},E.fitHeight=function(R,F){return IE(E,R,F)};function P(){var R=iD(t,0,0,h,d,u).apply(null,n(r,a)),F=iD(t,o-R[0],f-R[1],h,d,u);return s=JB(l,c,i),k=Dk(n,F),w=Dk(s,k),b=rD(k,A),L()}function L(){return M=T=null,E}return function(){return n=e.apply(this,arguments),E.invert=n.invert&&S,P()}}function FE(e){var n=0,t=Ca/3,o=pj(e),f=o(n,t);return f.parallels=function(r){return arguments.length?o(n=r[0]*La,t=r[1]*La):[n*Fs,t*Fs]},f}function Soe(e){var n=Ki(e);function t(o,f){return[o*n,Wi(f)/n]}return t.invert=function(o,f){return[o/n,Hu(f*n)]},t}function Coe(e,n){var t=Wi(e),o=(t+Wi(n))/2;if(Va(o)=.12&&g<.234&&p>=-.425&&p<-.214?f:g>=.166&&g<.234&&p>=-.214&&p<-.115?a:t).invert(h)},s.stream=function(h){return e&&n===h?e:e=Loe([t.stream(n=h),f.stream(h),a.stream(h)])},s.precision=function(h){return arguments.length?(t.precision(h),f.precision(h),a.precision(h),u()):t.precision()},s.scale=function(h){return arguments.length?(t.scale(h),f.scale(h*.35),a.scale(h),s.translate(t.translate())):t.scale()},s.translate=function(h){if(!arguments.length)return t.translate();var d=t.scale(),m=+h[0],p=+h[1];return o=t.translate(h).clipExtent([[m-.455*d,p-.238*d],[m+.455*d,p+.238*d]]).stream(i),r=f.translate([m-.307*d,p+.201*d]).clipExtent([[m-.425*d+Ji,p+.12*d+Ji],[m-.214*d-Ji,p+.234*d-Ji]]).stream(i),l=a.translate([m-.205*d,p+.212*d]).clipExtent([[m-.214*d+Ji,p+.166*d+Ji],[m-.115*d-Ji,p+.234*d-Ji]]).stream(i),u()},s.fitExtent=function(h,d){return h3(s,h,d)},s.fitSize=function(h,d){return OE(s,h,d)},s.fitWidth=function(h,d){return PE(s,h,d)},s.fitHeight=function(h,d){return IE(s,h,d)};function u(){return e=n=null,s}return s.scale(1070)}function mj(e){return function(n,t){var o=Ki(n),f=Ki(t),r=e(o*f);return r===1/0?[2,0]:[r*f*Wi(n),r*Wi(t)]}}function px(e){return function(n,t){var o=wu(n*n+t*t),f=e(o),r=Wi(f),a=Ki(f);return[Lc(n*r,o*a),Hu(o&&t*r/o)]}}var yj=mj(function(e){return wu(2/(1+e))});yj.invert=px(function(e){return 2*Hu(e/2)});function Ooe(){return mh(yj).scale(124.75).clipAngle(180-.001)}var vj=mj(function(e){return(e=jB(e))&&e/Wi(e)});vj.invert=px(function(e){return e});function Poe(){return mh(vj).scale(79.4188).clipAngle(180-.001)}function d3(e,n){return[e,p_(CE((ks+n)/2))]}d3.invert=function(e,n){return[e,2*g1(BB(n))-ks]};function Ioe(){return xj(d3).scale(961/_u)}function xj(e){var n=mh(e),t=n.center,o=n.scale,f=n.translate,r=n.clipExtent,a=null,l,c,i;n.scale=function(u){return arguments.length?(o(u),s()):o()},n.translate=function(u){return arguments.length?(f(u),s()):f()},n.center=function(u){return arguments.length?(t(u),s()):t()},n.clipExtent=function(u){return arguments.length?(u==null?a=l=c=i=null:(a=+u[0][0],l=+u[0][1],c=+u[1][0],i=+u[1][1]),s()):a==null?null:[[a,l],[c,i]]};function s(){var u=Ca*o(),h=n(eoe(n.rotate()).invert([0,0]));return r(a==null?[[h[0]-u,h[1]-u],[h[0]+u,h[1]+u]]:e===d3?[[Math.max(h[0]-u,a),l],[Math.min(h[0]+u,c),i]]:[[a,Math.max(h[1]-u,l)],[c,Math.min(h[1]+u,i)]])}return s()}function Ub(e){return CE((ks+e)/2)}function Foe(e,n){var t=Ki(e),o=e===n?Wi(e):p_(t/Ki(n))/p_(Ub(n)/Ub(e)),f=t*O4(Ub(e),o)/o;if(!o)return d3;function r(a,l){f>0?l<-ks+Ji&&(l=-ks+Ji):l>ks-Ji&&(l=ks-Ji);var c=f/O4(Ub(l),o);return[c*Wi(o*a),f-c*Ki(o*a)]}return r.invert=function(a,l){var c=f-l,i=Ac(o)*wu(a*a+c*c),s=Lc(a,Va(c))*Ac(c);return c*o<0&&(s-=Ca*Ac(a)*Ac(c)),[s/o,2*g1(O4(f/i,1/o))-ks]},r}function Roe(){return FE(Foe).scale(109.5).parallels([30,30])}function I_(e,n){return[e,n]}I_.invert=I_;function zoe(){return mh(I_).scale(152.63)}function Noe(e,n){var t=Ki(e),o=e===n?Wi(e):(t-Ki(n))/(n-e),f=t/o+e;if(Va(o)Ji&&--o>0);return[e/(.8707+(r=t*t)*(-.131979+r*(-.013791+r*r*r*(.003971-.001529*r)))),t]};function qoe(){return mh(wj).scale(175.295)}function Aj(e,n){return[Ki(n)*Wi(e),Wi(n)]}Aj.invert=px(Hu);function Hoe(){return mh(Aj).scale(249.5).clipAngle(90+Ji)}function kj(e,n){var t=Ki(n),o=1+Ki(e)*t;return[t*Wi(e)/o,Wi(n)/o]}kj.invert=px(function(e){return 2*g1(e)});function Goe(){return mh(kj).scale(250).clipAngle(142)}function Tj(e,n){return[p_(CE((ks+n)/2)),-e]}Tj.invert=function(e,n){return[-n,2*g1(BB(e))-ks]};function Woe(){var e=xj(Tj),n=e.center,t=e.rotate;return e.center=function(o){return arguments.length?n([-o[1],o[0]]):(o=n(),[o[1],-o[0]])},e.rotate=function(o){return arguments.length?t([o[0],o[1],o.length>2?o[2]+90:90]):(o=t(),[o[0],o[1],o[2]-90])},t([0,0,90]).scale(159.155)}var Yoe=Math.abs,$k=Math.cos,R_=Math.sin,Xoe=1e-6,Mj=Math.PI,Vk=Mj/2,aD=Zoe(2);function oD(e){return e>1?Vk:e<-1?-Vk:Math.asin(e)}function Zoe(e){return e>0?Math.sqrt(e):0}function Joe(e,n){var t=e*R_(n),o=30,f;do n-=f=(n+R_(n)-t)/(1+$k(n));while(Yoe(f)>Xoe&&--o>0);return n/2}function Koe(e,n,t){function o(f,r){return[e*f*$k(r=Joe(t,r)),n*R_(r)]}return o.invert=function(f,r){return r=oD(r/n),[f/(e*$k(r)),oD((2*r+R_(2*r))/t)]},o}var Qoe=Koe(aD/Vk,aD,Mj);function ese(){return mh(Qoe).scale(169.529)}const tse=dj(),qk=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function nse(e,n){return function t(){const o=n();return o.type=e,o.path=dj().projection(o),o.copy=o.copy||function(){const f=t();return qk.forEach(r=>{o[r]&&f[r](o[r]())}),f.path.pointRadius(o.path.pointRadius()),f},o}}function RE(e,n){if(!e||typeof e!="string")throw new Error("Projection type must be a name string.");return e=e.toLowerCase(),arguments.length>1?(z_[e]=nse(e,n),this):z_[e]||null}function Ej(e){return e&&e.path||tse}const z_={albers:gj,albersusa:Doe,azimuthalequalarea:Ooe,azimuthalequidistant:Poe,conicconformal:Roe,conicequalarea:P_,conicequidistant:Boe,equalEarth:Uoe,equirectangular:zoe,gnomonic:$oe,identity:Voe,mercator:Ioe,mollweide:ese,naturalEarth1:qoe,orthographic:Hoe,stereographic:Goe,transversemercator:Woe};for(const e in z_)RE(e,z_[e]);function rse(){}const Ph=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function Sj(){var e=1,n=1,t=l;function o(c,i){return i.map(s=>f(c,s))}function f(c,i){var s=[],u=[];return r(c,i,h=>{t(h,c,i),ise(h)>0?s.push([h]):u.push(h)}),u.forEach(h=>{for(var d=0,m=s.length,p;d=i,Ph[g<<1].forEach(x);++d=i,Ph[p|g<<1].forEach(x);for(Ph[g<<0].forEach(x);++m=i,y=c[m*e]>=i,Ph[g<<1|y<<2].forEach(x);++d=i,v=y,y=c[m*e+d+1]>=i,Ph[p|g<<1|y<<2|v<<3].forEach(x);Ph[g|y<<3].forEach(x)}for(d=-1,y=c[m*e]>=i,Ph[y<<2].forEach(x);++d=i,Ph[y<<2|v<<3].forEach(x);Ph[y<<3].forEach(x);function x(_){var A=[_[0][0]+d,_[0][1]+m],b=[_[1][0]+d,_[1][1]+m],k=a(A),w=a(b),M,T;(M=h[k])?(T=u[w])?(delete h[M.end],delete u[T.start],M===T?(M.ring.push(b),s(M.ring)):u[M.start]=h[T.end]={start:M.start,end:T.end,ring:M.ring.concat(T.ring)}):(delete h[M.end],M.ring.push(b),h[M.end=w]=M):(M=u[w])?(T=h[k])?(delete u[M.start],delete h[T.end],M===T?(M.ring.push(b),s(M.ring)):u[T.start]=h[M.end]={start:T.start,end:M.end,ring:T.ring.concat(M.ring)}):(delete u[M.start],M.ring.unshift(A),u[M.start=k]=M):u[k]=h[w]={start:k,end:w,ring:[A,b]}}}function a(c){return c[0]*2+c[1]*(e+1)*4}function l(c,i,s){c.forEach(u=>{var h=u[0],d=u[1],m=h|0,p=d|0,g,y=i[p*e+m];h>0&&h0&&d=0&&s>=0||Pr("invalid size"),e=i,n=s,o},o.smooth=function(c){return arguments.length?(t=c?l:rse,o):t===l},o}function ise(e){for(var n=0,t=e.length,o=e[t-1][1]*e[0][0]-e[t-1][0]*e[0][1];++no!=d>o&&t<(h-i)*(o-s)/(d-s)+i&&(f=-f)}return f}function sse(e,n,t){var o;return lse(e,n,t)&&use(e[o=+(e[0]===n[0])],t[o],n[o])}function lse(e,n,t){return(n[0]-e[0])*(t[1]-e[1])===(t[0]-e[0])*(n[1]-e[1])}function use(e,n,t){return e<=n&&n<=t||t<=n&&n<=e}function Cj(e,n,t){return function(o){var f=ed(o),r=t?Math.min(f[0],0):f[0],a=f[1],l=a-r,c=n?D0(r,a,e):l/(e+1);return sc(r+c,a,c)}}function zE(e){_r.call(this,null,e)}zE.Definition={type:"Isocontour",metadata:{generates:!0},params:[{name:"field",type:"field"},{name:"thresholds",type:"number",array:!0},{name:"levels",type:"number"},{name:"nice",type:"boolean",default:!1},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"zero",type:"boolean",default:!0},{name:"smooth",type:"boolean",default:!0},{name:"scale",type:"number",expr:!0},{name:"translate",type:"number",array:!0,expr:!0},{name:"as",type:"string",null:!0,default:"contour"}]};ii(zE,_r,{transform(e,n){if(this.value&&!n.changed()&&!e.modified())return n.StopPropagation;var t=n.fork(n.NO_SOURCE|n.NO_FIELDS),o=n.materialize(n.SOURCE).source,f=e.field||xu,r=Sj().smooth(e.smooth!==!1),a=e.thresholds||cse(o,f,e),l=e.as===null?null:e.as||"contour",c=[];return o.forEach(i=>{const s=f(i),u=r.size([s.width,s.height])(s.values,zr(a)?a:a(s.values));fse(u,s,i,e),u.forEach(h=>{c.push(Fw(i,oo(l!=null?{[l]:h}:h)))})}),this.value&&(t.rem=this.value),this.value=t.source=t.add=c,t}});function cse(e,n,t){const o=Cj(t.levels||10,t.nice,t.zero!==!1);return t.resolve!=="shared"?o:o(e.map(f=>w0(n(f).values)))}function fse(e,n,t,o){let f=o.scale||n.scale,r=o.translate||n.translate;if(xa(f)&&(f=f(t,o)),xa(r)&&(r=r(t,o)),(f===1||f==null)&&!r)return;const a=(Eo(f)?f:f[0])||1,l=(Eo(f)?f:f[1])||1,c=r&&r[0]||0,i=r&&r[1]||0;e.forEach(Lj(n,a,l,c,i))}function Lj(e,n,t,o,f){const r=e.x1||0,a=e.y1||0,l=n*t<0;function c(u){u.forEach(i)}function i(u){l&&u.reverse(),u.forEach(s)}function s(u){u[0]=(u[0]-r)*n+o,u[1]=(u[1]-a)*t+f}return function(u){return u.coordinates.forEach(c),u}}function sD(e,n,t){const o=e>=0?e:D6(n,t);return Math.round((Math.sqrt(4*o*o+1)-1)/2)}function z4(e){return xa(e)?e:bu(+e)}function Dj(){var e=c=>c[0],n=c=>c[1],t=Zv,o=[-1,-1],f=960,r=500,a=2;function l(c,i){const s=sD(o[0],c,e)>>a,u=sD(o[1],c,n)>>a,h=s?s+2:0,d=u?u+2:0,m=2*h+(f>>a),p=2*d+(r>>a),g=new Float32Array(m*p),y=new Float32Array(m*p);let v=g;c.forEach(_=>{const A=h+(+e(_)>>a),b=d+(+n(_)>>a);A>=0&&A=0&&b0&&u>0?(Xg(m,p,g,y,s),Zg(m,p,y,g,u),Xg(m,p,g,y,s),Zg(m,p,y,g,u),Xg(m,p,g,y,s),Zg(m,p,y,g,u)):s>0?(Xg(m,p,g,y,s),Xg(m,p,y,g,s),Xg(m,p,g,y,s),v=y):u>0&&(Zg(m,p,g,y,u),Zg(m,p,y,g,u),Zg(m,p,g,y,u),v=y);const x=i?Math.pow(2,-2*a):1/xF(v);for(let _=0,A=m*p;_>a),y2:d+(r>>a)}}return l.x=function(c){return arguments.length?(e=z4(c),l):e},l.y=function(c){return arguments.length?(n=z4(c),l):n},l.weight=function(c){return arguments.length?(t=z4(c),l):t},l.size=function(c){if(!arguments.length)return[f,r];var i=+c[0],s=+c[1];return i>=0&&s>=0||Pr("invalid size"),f=i,r=s,l},l.cellSize=function(c){return arguments.length?((c=+c)>=1||Pr("invalid cell size"),a=Math.floor(Math.log(c)/Math.LN2),l):1<=f&&(l>=r&&(c-=t[l-r+a*e]),o[l-f+a*e]=c/Math.min(l+1,e-1+r-l,r))}function Zg(e,n,t,o,f){const r=(f<<1)+1;for(let a=0;a=f&&(l>=r&&(c-=t[a+(l-r)*e]),o[a+(l-f)*e]=c/Math.min(l+1,n-1+r-l,r))}function NE(e){_r.call(this,null,e)}NE.Definition={type:"KDE2D",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"weight",type:"field"},{name:"groupby",type:"field",array:!0},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number",array:!0,length:2},{name:"counts",type:"boolean",default:!1},{name:"as",type:"string",default:"grid"}]};const hse=["x","y","weight","size","cellSize","bandwidth"];function Oj(e,n){return hse.forEach(t=>n[t]!=null?e[t](n[t]):0),e}ii(NE,_r,{transform(e,n){if(this.value&&!n.changed()&&!e.modified())return n.StopPropagation;var t=n.fork(n.NO_SOURCE|n.NO_FIELDS),o=n.materialize(n.SOURCE).source,f=dse(o,e.groupby),r=(e.groupby||[]).map(Rs),a=Oj(Dj(),e),l=e.as||"grid",c=[];function i(s,u){for(let h=0;hoo(i({[l]:a(s,e.counts)},s.dims))),this.value&&(t.rem=this.value),this.value=t.source=t.add=c,t}});function dse(e,n){var t=[],o=s=>s(l),f,r,a,l,c,i;if(n==null)t.push(e);else for(f={},r=0,a=e.length;rt.push(l(s))),r&&a&&(n.visit(c,s=>{var u=r(s),h=a(s);u!=null&&h!=null&&(u=+u)===u&&(h=+h)===h&&o.push([u,h])}),t=t.concat({type:Hk,geometry:{type:pse,coordinates:o}})),this.value={type:jE,features:t}}});function $E(e){_r.call(this,null,e)}$E.Definition={type:"GeoPath",metadata:{modifies:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"path"}]};ii($E,_r,{transform(e,n){var t=n.fork(n.ALL),o=this.value,f=e.field||xu,r=e.as||"path",a=t.SOURCE;!o||e.modified()?(this.value=o=Ej(e.projection),t.materialize().reflow()):a=f===xu||n.modified(f.fields)?t.ADD_MOD:t.ADD;const l=gse(o,e.pointRadius);return t.visit(a,c=>c[r]=o(f(c))),o.pointRadius(l),t.modifies(r)}});function gse(e,n){const t=e.pointRadius();return e.context(null),n!=null&&e.pointRadius(n),t}function VE(e){_r.call(this,null,e)}VE.Definition={type:"GeoPoint",metadata:{modifies:!0},params:[{name:"projection",type:"projection",required:!0},{name:"fields",type:"field",array:!0,required:!0,length:2},{name:"as",type:"string",array:!0,length:2,default:["x","y"]}]};ii(VE,_r,{transform(e,n){var t=e.projection,o=e.fields[0],f=e.fields[1],r=e.as||["x","y"],a=r[0],l=r[1],c;function i(s){const u=t([o(s),f(s)]);u?(s[a]=u[0],s[l]=u[1]):(s[a]=void 0,s[l]=void 0)}return e.modified()?n=n.materialize().reflow(!0).visit(n.SOURCE,i):(c=n.modified(o.fields)||n.modified(f.fields),n.visit(c?n.ADD_MOD:n.ADD,i)),n.modifies(r)}});function qE(e){_r.call(this,null,e)}qE.Definition={type:"GeoShape",metadata:{modifies:!0,nomod:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field",default:"datum"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"shape"}]};ii(qE,_r,{transform(e,n){var t=n.fork(n.ALL),o=this.value,f=e.as||"shape",r=t.ADD;return(!o||e.modified())&&(this.value=o=mse(Ej(e.projection),e.field||uc("datum"),e.pointRadius),t.materialize().reflow(),r=t.SOURCE),t.visit(r,a=>a[f]=o),t.modifies(f)}});function mse(e,n,t){const o=t==null?f=>e(n(f)):f=>{var r=e.pointRadius(),a=e.pointRadius(t)(n(f));return e.pointRadius(r),a};return o.context=f=>(e.context(f),o),o}function HE(e){_r.call(this,[],e),this.generator=coe()}HE.Definition={type:"Graticule",metadata:{changes:!0,generates:!0},params:[{name:"extent",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMajor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMinor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"step",type:"number",array:!0,length:2},{name:"stepMajor",type:"number",array:!0,length:2,default:[90,360]},{name:"stepMinor",type:"number",array:!0,length:2,default:[10,10]},{name:"precision",type:"number",default:2.5}]};ii(HE,_r,{transform(e,n){var t=this.value,o=this.generator,f;if(!t.length||e.modified())for(const r in e)xa(o[r])&&o[r](e[r]);return f=o(),t.length?n.mod.push(yR(t[0],f)):n.add.push(oo(f)),t[0]=f,n}});function GE(e){_r.call(this,null,e)}GE.Definition={type:"heatmap",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"color",type:"string",expr:!0},{name:"opacity",type:"number",expr:!0},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"as",type:"string",default:"image"}]};ii(GE,_r,{transform(e,n){if(!n.changed()&&!e.modified())return n.StopPropagation;var t=n.materialize(n.SOURCE).source,o=e.resolve==="shared",f=e.field||xu,r=vse(e.opacity,e),a=yse(e.color,e),l=e.as||"image",c={$x:0,$y:0,$value:0,$max:o?w0(t.map(i=>w0(f(i).values))):0};return t.forEach(i=>{const s=f(i),u=Ea({},i,c);o||(u.$max=w0(s.values||[])),i[l]=xse(s,u,a.dep?a:bu(a(u)),r.dep?r:bu(r(u)))}),n.reflow(!0).modifies(l)}});function yse(e,n){let t;return xa(e)?(t=o=>I2(e(o,n)),t.dep=Pj(e)):t=bu(I2(e||"#888")),t}function vse(e,n){let t;return xa(e)?(t=o=>e(o,n),t.dep=Pj(e)):e?t=bu(e):(t=o=>o.$value/o.$max||0,t.dep=!0),t}function Pj(e){if(!xa(e))return!1;const n=sh(mu(e));return n.$x||n.$y||n.$value||n.$max}function xse(e,n,t,o){const f=e.width,r=e.height,a=e.x1||0,l=e.y1||0,c=e.x2||f,i=e.y2||r,s=e.values,u=s?g=>s[g]:u0,h=Qd(c-a,i-l),d=h.getContext("2d"),m=d.getImageData(0,0,c-a,i-l),p=m.data;for(let g=l,y=0;g{e[o]!=null&&lD(t,o,e[o])})):qk.forEach(o=>{e.modified(o)&&lD(t,o,e[o])}),e.pointRadius!=null&&t.path.pointRadius(e.pointRadius),e.fit&&bse(t,e),n.fork(n.NO_SOURCE|n.NO_FIELDS)}});function bse(e,n){const t=wse(n.fit);n.extent?e.fitExtent(n.extent,t):n.size&&e.fitSize(n.size,t)}function _se(e){const n=RE((e||"mercator").toLowerCase());return n||Pr("Unrecognized projection type: "+e),n()}function lD(e,n,t){xa(e[n])&&e[n](t)}function wse(e){return e=Ti(e),e.length===1?e[0]:{type:jE,features:e.reduce((n,t)=>n.concat(Ase(t)),[])}}function Ase(e){return e.type===jE?e.features:Ti(e).filter(n=>n!=null).map(n=>n.type===Hk?n:{type:Hk,geometry:n})}const kse=Object.freeze(Object.defineProperty({__proto__:null,contour:BE,geojson:UE,geopath:$E,geopoint:VE,geoshape:qE,graticule:HE,heatmap:GE,isocontour:zE,kde2d:NE,projection:Ij},Symbol.toStringTag,{value:"Module"}));function Tse(e,n){var t,o=1;e==null&&(e=0),n==null&&(n=0);function f(){var r,a=t.length,l,c=0,i=0;for(r=0;r=(u=(l+i)/2))?l=u:i=u,(g=t>=(h=(c+s)/2))?c=h:s=h,f=r,!(r=r[y=g<<1|p]))return f[y]=a,e;if(d=+e._x.call(null,r.data),m=+e._y.call(null,r.data),n===d&&t===m)return a.next=r,f?f[y]=a:e._root=a,e;do f=f?f[y]=new Array(4):e._root=new Array(4),(p=n>=(u=(l+i)/2))?l=u:i=u,(g=t>=(h=(c+s)/2))?c=h:s=h;while((y=g<<1|p)===(v=(m>=h)<<1|d>=u));return f[v]=r,f[y]=a,e}function Ese(e){var n,t,o=e.length,f,r,a=new Array(o),l=new Array(o),c=1/0,i=1/0,s=-1/0,u=-1/0;for(t=0;ts&&(s=f),ru&&(u=r));if(c>s||i>u)return this;for(this.cover(c,i).cover(s,u),t=0;te||e>=f||o>n||n>=r;)switch(i=(ns||(l=m.y0)>u||(c=m.x1)=y)<<1|e>=g)&&(m=h[h.length-1],h[h.length-1]=h[h.length-1-p],h[h.length-1-p]=m)}else{var v=e-+this._x.call(null,d.data),x=n-+this._y.call(null,d.data),_=v*v+x*x;if(_=(h=(a+c)/2))?a=h:c=h,(p=u>=(d=(l+i)/2))?l=d:i=d,n=t,!(t=t[g=p<<1|m]))return this;if(!t.length)break;(n[g+1&3]||n[g+2&3]||n[g+3&3])&&(o=n,y=g)}for(;t.data!==e;)if(f=t,!(t=t.next))return this;return(r=t.next)&&delete t.next,f?(r?f.next=r:delete f.next,this):n?(r?n[g]=r:delete n[g],(t=n[0]||n[1]||n[2]||n[3])&&t===(n[3]||n[2]||n[1]||n[0])&&!t.length&&(o?o[y]=t:this._root=t),this):(this._root=r,this)}function Pse(e){for(var n=0,t=e.length;nh.index){var E=d-w.x-w.vx,S=m-w.y-w.vy,P=E*E+S*S;Pd+T||bm+T||ki.r&&(i.r=i[s].r)}function c(){if(n){var i,s=n.length,u;for(t=new Array(s),i=0;i[n(A,b,a),A])),_;for(g=0,l=new Array(y);g{}};function Rj(){for(var e=0,n=arguments.length,t={},o;e=0&&(o=t.slice(f+1),t=t.slice(0,f)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:o}})}_2.prototype=Rj.prototype={constructor:_2,on:function(e,n){var t=this._,o=Yse(e+"",t),f,r=-1,a=o.length;if(arguments.length<2){for(;++r0)for(var t=new Array(f),o=0,f,r;o=0&&e._call.call(void 0,n),e=e._next;--jm}function hD(){z0=(B_=kv.now())+p3,jm=Ny=0;try{Jse()}finally{jm=0,Qse(),z0=0}}function Kse(){var e=kv.now(),n=e-B_;n>zj&&(p3-=n,B_=e)}function Qse(){for(var e,n=N_,t,o=1/0;n;)n._call?(o>n._time&&(o=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:N_=t);By=e,Gk(o)}function Gk(e){if(!jm){Ny&&(Ny=clearTimeout(Ny));var n=e-z0;n>24?(e<1/0&&(Ny=setTimeout(hD,e-kv.now()-p3)),uy&&(uy=clearInterval(uy))):(uy||(B_=kv.now(),uy=setInterval(Kse,zj)),jm=1,Nj(hD))}}function ele(e,n,t){var o=new j_,f=n;return n==null?(o.restart(e,n,t),o):(o._restart=o.restart,o.restart=function(r,a,l){a=+a,l=l==null?XE():+l,o._restart(function c(i){i+=f,o._restart(c,f+=a,l),r(i)},a,l)},o.restart(e,n,t),o)}const tle=1664525,nle=1013904223,dD=4294967296;function rle(){let e=1;return()=>(e=(tle*e+nle)%dD)/dD}function ile(e){return e.x}function ale(e){return e.y}var ole=10,sle=Math.PI*(3-Math.sqrt(5));function lle(e){var n,t=1,o=.001,f=1-Math.pow(o,1/300),r=0,a=.6,l=new Map,c=Bj(u),i=Rj("tick","end"),s=rle();e==null&&(e=[]);function u(){h(),i.call("tick",n),t1?(g==null?l.delete(p):l.set(p,m(g)),n):l.get(p)},find:function(p,g,y){var v=0,x=e.length,_,A,b,k,w;for(y==null?y=1/0:y*=y,v=0;v1?(i.on(p,g),n):i.on(p)}}}function ule(){var e,n,t,o,f=gu(-30),r,a=1,l=1/0,c=.81;function i(d){var m,p=e.length,g=WE(e,ile,ale).visitAfter(u);for(o=d,m=0;m=l)return;(d.data!==n||d.next)&&(y===0&&(y=qd(t),_+=y*y),v===0&&(v=qd(t),_+=v*v),_=0;)t.tick();else if(t.stopped()&&t.restart(),!o)return n.StopPropagation}return this.finish(e,n)},finish(e,n){const t=n.dataflow;for(let l=this._argops,c=0,i=l.length,s;ce.touch(n).run()}function ple(e,n){const t=lle(e),o=t.stop,f=t.restart;let r=!1;return t.stopped=()=>r,t.restart=()=>(r=!1,f()),t.stop=()=>(r=!0,o()),Uj(t,n,!0).on("end",()=>r=!0)}function Uj(e,n,t,o){var f=Ti(n.forces),r,a,l,c;for(r=0,a=Wk.length;rn(o,t):n)}const vle=Object.freeze(Object.defineProperty({__proto__:null,force:ZE},Symbol.toStringTag,{value:"Module"}));function xle(e,n){return e.parent===n.parent?1:2}function ble(e){return e.reduce(_le,0)/e.length}function _le(e,n){return e+n.x}function wle(e){return 1+e.reduce(Ale,0)}function Ale(e,n){return Math.max(e,n.y)}function kle(e){for(var n;n=e.children;)e=n[0];return e}function Tle(e){for(var n;n=e.children;)e=n[n.length-1];return e}function Mle(){var e=xle,n=1,t=1,o=!1;function f(r){var a,l=0;r.eachAfter(function(h){var d=h.children;d?(h.x=ble(d),h.y=wle(d)):(h.x=a?l+=e(h,a):0,h.y=0,a=h)});var c=kle(r),i=Tle(r),s=c.x-e(c,i)/2,u=i.x+e(i,c)/2;return r.eachAfter(o?function(h){h.x=(h.x-r.x)*n,h.y=(r.y-h.y)*t}:function(h){h.x=(h.x-s)/(u-s)*n,h.y=(1-(r.y?h.y/r.y:1))*t})}return f.separation=function(r){return arguments.length?(e=r,f):e},f.size=function(r){return arguments.length?(o=!1,n=+r[0],t=+r[1],f):o?null:[n,t]},f.nodeSize=function(r){return arguments.length?(o=!0,n=+r[0],t=+r[1],f):o?[n,t]:null},f}function Ele(e){var n=0,t=e.children,o=t&&t.length;if(!o)n=1;else for(;--o>=0;)n+=t[o].value;e.value=n}function Sle(){return this.eachAfter(Ele)}function Cle(e,n){let t=-1;for(const o of this)e.call(n,o,++t,this);return this}function Lle(e,n){for(var t=this,o=[t],f,r,a=-1;t=o.pop();)if(e.call(n,t,++a,this),f=t.children)for(r=f.length-1;r>=0;--r)o.push(f[r]);return this}function Dle(e,n){for(var t=this,o=[t],f=[],r,a,l,c=-1;t=o.pop();)if(f.push(t),r=t.children)for(a=0,l=r.length;a=0;)t+=o[f].value;n.value=t})}function Ile(e){return this.eachBefore(function(n){n.children&&n.children.sort(e)})}function Fle(e){for(var n=this,t=Rle(n,e),o=[n];n!==t;)n=n.parent,o.push(n);for(var f=o.length;e!==t;)o.splice(f,0,e),e=e.parent;return o}function Rle(e,n){if(e===n)return e;var t=e.ancestors(),o=n.ancestors(),f=null;for(e=t.pop(),n=o.pop();e===n;)f=e,e=t.pop(),n=o.pop();return f}function zle(){for(var e=this,n=[e];e=e.parent;)n.push(e);return n}function Nle(){return Array.from(this)}function Ble(){var e=[];return this.eachBefore(function(n){n.children||e.push(n)}),e}function jle(){var e=this,n=[];return e.each(function(t){t!==e&&n.push({source:t.parent,target:t})}),n}function*Ule(){var e=this,n,t=[e],o,f,r;do for(n=t.reverse(),t=[];e=n.pop();)if(yield e,o=e.children)for(f=0,r=o.length;f=0;--l)f.push(r=a[l]=new Um(a[l])),r.parent=o,r.depth=o.depth+1;return t.eachBefore($j)}function $le(){return JE(this).eachBefore(Hle)}function Vle(e){return e.children}function qle(e){return Array.isArray(e)?e[1]:null}function Hle(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function $j(e){var n=0;do e.height=n;while((e=e.parent)&&e.height<++n)}function Um(e){this.data=e,this.depth=this.height=0,this.parent=null}Um.prototype=JE.prototype={constructor:Um,count:Sle,each:Cle,eachAfter:Dle,eachBefore:Lle,find:Ole,sum:Ple,sort:Ile,path:Fle,ancestors:zle,descendants:Nle,leaves:Ble,links:jle,copy:$le,[Symbol.iterator]:Ule};function w2(e){return e==null?null:Vj(e)}function Vj(e){if(typeof e!="function")throw new Error;return e}function p0(){return 0}function am(e){return function(){return e}}const Gle=1664525,Wle=1013904223,gD=4294967296;function Yle(){let e=1;return()=>(e=(Gle*e+Wle)%gD)/gD}function Xle(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Zle(e,n){let t=e.length,o,f;for(;t;)f=n()*t--|0,o=e[t],e[t]=e[f],e[f]=o;return e}function Jle(e,n){for(var t=0,o=(e=Zle(Array.from(e),n)).length,f=[],r,a;t0&&t*t>o*o+f*f}function N4(e,n){for(var t=0;t1e-6?(E+Math.sqrt(E*E-4*T*S))/(2*T):S/E);return{x:o+b+k*P,y:f+w+M*P,r:P}}function mD(e,n,t){var o=e.x-n.x,f,r,a=e.y-n.y,l,c,i=o*o+a*a;i?(r=n.r+t.r,r*=r,c=e.r+t.r,c*=c,r>c?(f=(i+c-r)/(2*i),l=Math.sqrt(Math.max(0,c/i-f*f)),t.x=e.x-f*o-l*a,t.y=e.y-f*a+l*o):(f=(i+r-c)/(2*i),l=Math.sqrt(Math.max(0,r/i-f*f)),t.x=n.x+f*o-l*a,t.y=n.y+f*a+l*o)):(t.x=n.x+t.r,t.y=n.y)}function yD(e,n){var t=e.r+n.r-1e-6,o=n.x-e.x,f=n.y-e.y;return t>0&&t*t>o*o+f*f}function vD(e){var n=e._,t=e.next._,o=n.r+t.r,f=(n.x*t.r+t.x*n.r)/o,r=(n.y*t.r+t.y*n.r)/o;return f*f+r*r}function Vb(e){this._=e,this.next=null,this.previous=null}function tue(e,n){if(!(r=(e=Xle(e)).length))return 0;var t,o,f,r,a,l,c,i,s,u,h;if(t=e[0],t.x=0,t.y=0,!(r>1))return t.r;if(o=e[1],t.x=-o.r,o.x=t.r,o.y=0,!(r>2))return t.r+o.r;mD(o,t,f=e[2]),t=new Vb(t),o=new Vb(o),f=new Vb(f),t.next=f.previous=o,o.next=t.previous=f,f.next=o.previous=t;e:for(c=3;clue(t(_,A,f))),v=y.map(AD),x=new Set(y).add("");for(const _ of v)x.has(_)||(x.add(_),y.push(_),v.push(AD(_)),r.push(j4));a=(_,A)=>y[A],l=(_,A)=>v[A]}for(s=0,c=r.length;s=0&&(d=r[y],d.data===j4);--y)d.data=null}if(u.parent=aue,u.eachBefore(function(y){y.depth=y.parent.depth+1,--c}).eachBefore($j),u.parent=null,c>0)throw new Error("cycle");return u}return o.id=function(f){return arguments.length?(e=w2(f),o):e},o.parentId=function(f){return arguments.length?(n=w2(f),o):n},o.path=function(f){return arguments.length?(t=w2(f),o):t},o}function lue(e){e=`${e}`;let n=e.length;return Yk(e,n-1)&&!Yk(e,n-2)&&(e=e.slice(0,-1)),e[0]==="/"?e:`/${e}`}function AD(e){let n=e.length;if(n<2)return"";for(;--n>1&&!Yk(e,n););return e.slice(0,n)}function Yk(e,n){if(e[n]==="/"){let t=0;for(;n>0&&e[--n]==="\\";)++t;if(!(t&1))return!0}return!1}function uue(e,n){return e.parent===n.parent?1:2}function U4(e){var n=e.children;return n?n[0]:e.t}function $4(e){var n=e.children;return n?n[n.length-1]:e.t}function cue(e,n,t){var o=t/(n.i-e.i);n.c-=o,n.s+=t,e.c+=o,n.z+=t,n.m+=t}function fue(e){for(var n=0,t=0,o=e.children,f=o.length,r;--f>=0;)r=o[f],r.z+=n,r.m+=n,n+=r.s+(t+=r.c)}function hue(e,n,t){return e.a.parent===n.parent?e.a:t}function A2(e,n){this._=e,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=n}A2.prototype=Object.create(Um.prototype);function due(e){for(var n=new A2(e,0),t,o=[n],f,r,a,l;t=o.pop();)if(r=t._.children)for(t.children=new Array(l=r.length),a=l-1;a>=0;--a)o.push(f=t.children[a]=new A2(r[a],a)),f.parent=t;return(n.parent=new A2(null,0)).children=[n],n}function pue(){var e=uue,n=1,t=1,o=null;function f(i){var s=due(i);if(s.eachAfter(r),s.parent.m=-s.z,s.eachBefore(a),o)i.eachBefore(c);else{var u=i,h=i,d=i;i.eachBefore(function(v){v.xh.x&&(h=v),v.depth>d.depth&&(d=v)});var m=u===h?1:e(u,h)/2,p=m-u.x,g=n/(h.x+m+p),y=t/(d.depth||1);i.eachBefore(function(v){v.x=(v.x+p)*g,v.y=v.depth*y})}return i}function r(i){var s=i.children,u=i.parent.children,h=i.i?u[i.i-1]:null;if(s){fue(i);var d=(s[0].z+s[s.length-1].z)/2;h?(i.z=h.z+e(i._,h._),i.m=i.z-d):i.z=d}else h&&(i.z=h.z+e(i._,h._));i.parent.A=l(i,h,i.parent.A||u[0])}function a(i){i._.x=i.z+i.parent.m,i.m+=i.parent.m}function l(i,s,u){if(s){for(var h=i,d=i,m=s,p=h.parent.children[0],g=h.m,y=d.m,v=m.m,x=p.m,_;m=$4(m),h=U4(h),m&&h;)p=U4(p),d=$4(d),d.a=i,_=m.z+v-h.z-g+e(m._,h._),_>0&&(cue(hue(m,i,u),i,_),g+=_,y+=_),v+=m.m,g+=h.m,x+=p.m,y+=d.m;m&&!$4(d)&&(d.t=m,d.m+=v-y),h&&!U4(p)&&(p.t=h,p.m+=g-x,u=i)}return u}function c(i){i.x*=n,i.y=i.depth*t}return f.separation=function(i){return arguments.length?(e=i,f):e},f.size=function(i){return arguments.length?(o=!1,n=+i[0],t=+i[1],f):o?null:[n,t]},f.nodeSize=function(i){return arguments.length?(o=!0,n=+i[0],t=+i[1],f):o?[n,t]:null},f}function g3(e,n,t,o,f){for(var r=e.children,a,l=-1,c=r.length,i=e.value&&(f-t)/e.value;++lv&&(v=i),b=g*g*A,x=Math.max(v/b,b/y),x>_){g-=i;break}_=x}a.push(c={value:g,dice:d1?o:1)},t}(Wj);function gue(){var e=Xj,n=!1,t=1,o=1,f=[0],r=p0,a=p0,l=p0,c=p0,i=p0;function s(h){return h.x0=h.y0=0,h.x1=t,h.y1=o,h.eachBefore(u),f=[0],n&&h.eachBefore(Gj),h}function u(h){var d=f[h.depth],m=h.x0+d,p=h.y0+d,g=h.x1-d,y=h.y1-d;g=h-1){var v=r[u];v.x0=m,v.y0=p,v.x1=g,v.y1=y;return}for(var x=i[u],_=d/2+x,A=u+1,b=h-1;A>>1;i[k]<_?A=k+1:b=k}_-i[A-1]y-p){var T=d?(m*M+g*w)/d:g;s(u,A,w,m,p,T,y),s(A,h,M,T,p,g,y)}else{var E=d?(p*M+y*w)/d:y;s(u,A,w,m,p,g,E),s(A,h,M,m,E,g,y)}}}function yue(e,n,t,o,f){(e.depth&1?g3:gx)(e,n,t,o,f)}const vue=function e(n){function t(o,f,r,a,l){if((c=o._squarify)&&c.ratio===n)for(var c,i,s,u,h=-1,d,m=c.length,p=o.value;++h1?o:1)},t}(Wj);function Xk(e,n,t){const o={};return e.each(f=>{const r=f.data;t(r)&&(o[n(r)]=f)}),e.lookup=o,e}function KE(e){_r.call(this,null,e)}KE.Definition={type:"Nest",metadata:{treesource:!0,changes:!0},params:[{name:"keys",type:"field",array:!0},{name:"generate",type:"boolean"}]};const xue=e=>e.values;ii(KE,_r,{transform(e,n){n.source||Pr("Nest transform requires an upstream data source.");var t=e.generate,o=e.modified(),f=n.clone(),r=this.value;return(!r||o||n.changed())&&(r&&r.each(a=>{a.children&&Iw(a.data)&&f.rem.push(a.data)}),this.value=r=JE({values:Ti(e.keys).reduce((a,l)=>(a.key(l),a),bue()).entries(f.source)},xue),t&&r.each(a=>{a.children&&(a=oo(a.data),f.add.push(a),f.source.push(a))}),Xk(r,Gi,Gi)),f.source.root=r,f}});function bue(){const e=[],n={entries:f=>o(t(f,0),0),key:f=>(e.push(f),n)};function t(f,r){if(r>=e.length)return f;const a=f.length,l=e[r++],c={},i={};let s=-1,u,h,d;for(;++se.length)return f;const a=[];for(const l in f)a.push({key:l,values:o(f[l],r)});return a}return n}function ud(e){_r.call(this,null,e)}const _ue=(e,n)=>e.parent===n.parent?1:2;ii(ud,_r,{transform(e,n){(!n.source||!n.source.root)&&Pr(this.constructor.name+" transform requires a backing tree data source.");const t=this.layout(e.method),o=this.fields,f=n.source.root,r=e.as||o;e.field?f.sum(e.field):f.count(),e.sort&&f.sort(rg(e.sort,a=>a.data)),wue(t,this.params,e),t.separation&&t.separation(e.separation!==!1?_ue:Zv);try{this.value=t(f)}catch(a){Pr(a)}return f.each(a=>Aue(a,o,r)),n.reflow(e.modified()).modifies(r).modifies("leaf")}});function wue(e,n,t){for(let o,f=0,r=n.length;fr[Gi(a)]=1),o.each(a=>{const l=a.data,c=a.parent&&a.parent.data;c&&r[Gi(l)]&&r[Gi(c)]&&f.add.push(oo({source:c,target:l}))}),this.value=f.add):n.changed(n.MOD)&&(n.visit(n.MOD,a=>r[Gi(a)]=1),t.forEach(a=>{(r[Gi(a.source)]||r[Gi(a.target)])&&f.mod.push(a)})),f}});const TD={binary:mue,dice:gx,slice:g3,slicedice:yue,squarify:Xj,resquarify:vue},Qk=["x0","y0","x1","y1","depth","children"];function iS(e){ud.call(this,e)}iS.Definition={type:"Treemap",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"squarify",values:["squarify","resquarify","binary","dice","slice","slicedice"]},{name:"padding",type:"number",default:0},{name:"paddingInner",type:"number",default:0},{name:"paddingOuter",type:"number",default:0},{name:"paddingTop",type:"number",default:0},{name:"paddingRight",type:"number",default:0},{name:"paddingBottom",type:"number",default:0},{name:"paddingLeft",type:"number",default:0},{name:"ratio",type:"number",default:1.618033988749895},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:Qk.length,default:Qk}]};ii(iS,ud,{layout(){const e=gue();return e.ratio=n=>{const t=e.tile();t.ratio&&e.tile(t.ratio(n))},e.method=n=>{Yi(TD,n)?e.tile(TD[n]):Pr("Unrecognized Treemap layout method: "+n)},e},params:["method","ratio","size","round","padding","paddingInner","paddingOuter","paddingTop","paddingRight","paddingBottom","paddingLeft"],fields:Qk});const kue=Object.freeze(Object.defineProperty({__proto__:null,nest:KE,pack:QE,partition:eS,stratify:tS,tree:nS,treelinks:rS,treemap:iS},Symbol.toStringTag,{value:"Module"})),V4=4278190080;function Tue(e,n){const t=e.bitmap();return(n||[]).forEach(o=>t.set(e(o.boundary[0]),e(o.boundary[3]))),[t,void 0]}function Mue(e,n,t,o,f){const r=e.width,a=e.height,l=o||f,c=Qd(r,a).getContext("2d"),i=Qd(r,a).getContext("2d"),s=l&&Qd(r,a).getContext("2d");t.forEach(w=>k2(c,w,!1)),k2(i,n,!1),l&&k2(s,n,!0);const u=q4(c,r,a),h=q4(i,r,a),d=l&&q4(s,r,a),m=e.bitmap(),p=l&&e.bitmap();let g,y,v,x,_,A,b,k;for(y=0;y{f.items.forEach(r=>k2(e,r.items,t))}):hc[o].draw(e,{items:t?n.map(Eue):n})}function Eue(e){const n=Fw(e,{});return n.stroke&&n.strokeOpacity!==0||n.fill&&n.fillOpacity!==0?{...n,strokeOpacity:1,stroke:"#000",fillOpacity:0}:n}const Ih=5,ou=31,Tv=32,Pd=new Uint32Array(Tv+1),rf=new Uint32Array(Tv+1);rf[0]=0;Pd[0]=~rf[0];for(let e=1;e<=Tv;++e)rf[e]=rf[e-1]<<1|1,Pd[e]=~rf[e];function Sue(e,n){const t=new Uint32Array(~~((e*n+Tv)/Tv));function o(r,a){t[r]|=a}function f(r,a){t[r]&=a}return{array:t,get:(r,a)=>{const l=a*e+r;return t[l>>>Ih]&1<<(l&ou)},set:(r,a)=>{const l=a*e+r;o(l>>>Ih,1<<(l&ou))},clear:(r,a)=>{const l=a*e+r;f(l>>>Ih,~(1<<(l&ou)))},getRange:(r,a,l,c)=>{let i=c,s,u,h,d;for(;i>=a;--i)if(s=i*e+r,u=i*e+l,h=s>>>Ih,d=u>>>Ih,h===d){if(t[h]&Pd[s&ou]&rf[(u&ou)+1])return!0}else{if(t[h]&Pd[s&ou]||t[d]&rf[(u&ou)+1])return!0;for(let m=h+1;m{let i,s,u,h,d;for(;a<=c;++a)if(i=a*e+r,s=a*e+l,u=i>>>Ih,h=s>>>Ih,u===h)o(u,Pd[i&ou]&rf[(s&ou)+1]);else for(o(u,Pd[i&ou]),o(h,rf[(s&ou)+1]),d=u+1;d{let i,s,u,h,d;for(;a<=c;++a)if(i=a*e+r,s=a*e+l,u=i>>>Ih,h=s>>>Ih,u===h)f(u,rf[i&ou]|Pd[(s&ou)+1]);else for(f(u,rf[i&ou]),f(h,Pd[(s&ou)+1]),d=u+1;dr<0||a<0||c>=n||l>=e}}function Cue(e,n,t){const o=Math.max(1,Math.sqrt(e*n/1e6)),f=~~((e+2*t+o)/o),r=~~((n+2*t+o)/o),a=l=>~~((l+t)/o);return a.invert=l=>l*o-t,a.bitmap=()=>Sue(f,r),a.ratio=o,a.padding=t,a.width=e,a.height=n,a}function Lue(e,n,t,o){const f=e.width,r=e.height;return function(a){const l=a.datum.datum.items[o].items,c=l.length,i=a.datum.fontSize,s=df.width(a.datum,a.datum.text);let u=0,h,d,m,p,g,y,v;for(let x=0;x=u&&(u=v,a.x=g,a.y=y);return g=s/2,y=i/2,h=a.x-g,d=a.x+g,m=a.y-y,p=a.y+y,a.align="center",h<0&&d<=f?a.align="left":0<=h&&ff||n-(a=o/2)<0||n+a>r}function Hd(e,n,t,o,f,r,a,l){const c=f*r/(o*2),i=e(n-c),s=e(n+c),u=e(t-(r=r/2)),h=e(t+r);return a.outOfBounds(i,u,s,h)||a.getRange(i,u,s,h)||l&&l.getRange(i,u,s,h)}function Due(e,n,t,o){const f=e.width,r=e.height,a=n[0],l=n[1];function c(i,s,u,h,d){const m=e.invert(i),p=e.invert(s);let g=u,y=r,v;if(!U_(m,p,h,d,f,r)&&!Hd(e,m,p,d,h,g,a,l)&&!Hd(e,m,p,d,h,d,a,null)){for(;y-g>=1;)v=(g+y)/2,Hd(e,m,p,d,h,v,a,l)?y=v:g=v;if(g>u)return[m,p,g,!0]}}return function(i){const s=i.datum.datum.items[o].items,u=s.length,h=i.datum.fontSize,d=df.width(i.datum,i.datum.text);let m=t?h:0,p=!1,g=!1,y=0,v,x,_,A,b,k,w,M,T,E,S,P,L,R,F,D,O;for(let N=0;Nx&&(O=v,v=x,x=O),_>A&&(O=_,_=A,A=O),T=e(v),S=e(x),E=~~((T+S)/2),P=e(_),R=e(A),L=~~((P+R)/2),w=E;w>=T;--w)for(M=L;M>=P;--M)D=c(w,M,m,d,h),D&&([i.x,i.y,m,p]=D);for(w=E;w<=S;++w)for(M=L;M<=R;++M)D=c(w,M,m,d,h),D&&([i.x,i.y,m,p]=D);!p&&!t&&(F=Math.abs(x-v+A-_),b=(v+x)/2,k=(_+A)/2,F>=y&&!U_(b,k,d,h,f,r)&&!Hd(e,b,k,h,d,h,a,null)&&(y=F,i.x=b,i.y=k,g=!0))}return p||g?(b=d/2,k=h/2,a.setRange(e(i.x-b),e(i.y-k),e(i.x+b),e(i.y+k)),i.align="center",i.baseline="middle",!0):!1}}const Oue=[-1,-1,1,1],Pue=[-1,1,-1,1];function Iue(e,n,t,o){const f=e.width,r=e.height,a=n[0],l=n[1],c=e.bitmap();return function(i){const s=i.datum.datum.items[o].items,u=s.length,h=i.datum.fontSize,d=df.width(i.datum,i.datum.text),m=[];let p=t?h:0,g=!1,y=!1,v=0,x,_,A,b,k,w,M,T,E,S,P,L;for(let R=0;R=1;)P=(E+S)/2,Hd(e,k,w,h,d,P,a,l)?S=P:E=P;E>p&&(i.x=k,i.y=w,p=E,g=!0)}}!g&&!t&&(L=Math.abs(_-x+b-A),k=(x+_)/2,w=(A+b)/2,L>=v&&!U_(k,w,d,h,f,r)&&!Hd(e,k,w,h,d,h,a,null)&&(v=L,i.x=k,i.y=w,y=!0))}return g||y?(k=d/2,w=h/2,a.setRange(e(i.x-k),e(i.y-w),e(i.x+k),e(i.y+w)),i.align="center",i.baseline="middle",!0):!1}}const Fue=["right","center","left"],Rue=["bottom","middle","top"];function zue(e,n,t,o){const f=e.width,r=e.height,a=n[0],l=n[1],c=o.length;return function(i){var s;const u=i.boundary,h=i.datum.fontSize;if(u[2]<0||u[5]<0||u[0]>f||u[3]>r)return!1;let d=(s=i.textWidth)!==null&&s!==void 0?s:0,m,p,g,y,v,x,_,A,b,k,w,M,T,E,S;for(let P=0;P>>2&3)-1,g=m===0&&p===0||o[P]<0,y=m&&p?Math.SQRT1_2:1,v=o[P]<0?-1:1,x=u[1+m]+o[P]*m*y,w=u[4+p]+v*h*p/2+o[P]*p*y,A=w-h/2,b=w+h/2,M=e(x),E=e(A),S=e(b),!d)if(MD(M,M,E,S,a,l,x,x,A,b,u,g))d=df.width(i.datum,i.datum.text);else continue;if(k=x+v*d*m/2,x=k-d/2,_=k+d/2,M=e(x),T=e(_),MD(M,T,E,S,a,l,x,_,A,b,u,g))return i.x=m?m*v<0?_:x:k,i.y=p?p*v<0?b:A:w,i.align=Fue[m*v+1],i.baseline=Rue[p*v+1],a.setRange(M,E,T,S),!0}return!1}}function MD(e,n,t,o,f,r,a,l,c,i,s,u){return!(f.outOfBounds(e,t,n,o)||(u&&r||f).getRange(e,t,n,o))}const H4=0,G4=4,W4=8,Y4=0,X4=1,Z4=2,Nue={"top-left":H4+Y4,top:H4+X4,"top-right":H4+Z4,left:G4+Y4,middle:G4+X4,right:G4+Z4,"bottom-left":W4+Y4,bottom:W4+X4,"bottom-right":W4+Z4},Bue={naive:Lue,"reduced-search":Due,floodfill:Iue};function jue(e,n,t,o,f,r,a,l,c,i,s){if(!e.length)return e;const u=Math.max(o.length,f.length),h=Uue(o,u),d=$ue(f,u),m=Vue(e[0].datum),p=m==="group"&&e[0].datum.items[c].marktype,g=p==="area",y=que(m,p,l,c),v=i===null||i===1/0,x=g&&s==="naive";let _=-1,A=-1;const b=e.map(T=>{const E=v?df.width(T,T.text):void 0;return _=Math.max(_,E),A=Math.max(A,T.fontSize),{datum:T,opacity:0,x:void 0,y:void 0,align:void 0,baseline:void 0,boundary:y(T),textWidth:E}});i=i===null||i===1/0?Math.max(_,A)+Math.max(...o):i;const k=Cue(n[0],n[1],i);let w;if(!x){t&&b.sort((S,P)=>t(S.datum,P.datum));let T=!1;for(let S=0;SS.datum);w=r.length||E?Mue(k,E||[],r,T,g):Tue(k,a&&b)}const M=g?Bue[s](k,w,a,c):zue(k,w,d,h);return b.forEach(T=>T.opacity=+M(T)),b}function Uue(e,n){const t=new Float64Array(n),o=e.length;for(let f=0;f[r.x,r.x,r.x,r.y,r.y,r.y];return e?e==="line"||e==="area"?r=>f(r.datum):n==="line"?r=>{const a=r.datum.items[o].items;return f(a.length?a[t==="start"?0:a.length-1]:{x:NaN,y:NaN})}:r=>{const a=r.datum.bounds;return[a.x1,(a.x1+a.x2)/2,a.x2,a.y1,(a.y1+a.y2)/2,a.y2]}:f}const eT=["x","y","opacity","align","baseline"],Zj=["top-left","left","bottom-left","top","bottom","top-right","right","bottom-right"];function aS(e){_r.call(this,null,e)}aS.Definition={type:"Label",metadata:{modifies:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"sort",type:"compare"},{name:"anchor",type:"string",array:!0,default:Zj},{name:"offset",type:"number",array:!0,default:[1]},{name:"padding",type:"number",default:0,null:!0},{name:"lineAnchor",type:"string",values:["start","end"],default:"end"},{name:"markIndex",type:"number",default:0},{name:"avoidBaseMark",type:"boolean",default:!0},{name:"avoidMarks",type:"data",array:!0},{name:"method",type:"string",default:"naive"},{name:"as",type:"string",array:!0,length:eT.length,default:eT}]};ii(aS,_r,{transform(e,n){function t(r){const a=e[r];return xa(a)&&n.modified(a.fields)}const o=e.modified();if(!(o||n.changed(n.ADD_REM)||t("sort")))return;(!e.size||e.size.length!==2)&&Pr("Size parameter should be specified as a [width, height] array.");const f=e.as||eT;return jue(n.materialize(n.SOURCE).source||[],e.size,e.sort,Ti(e.offset==null?1:e.offset),Ti(e.anchor||Zj),e.avoidMarks||[],e.avoidBaseMark!==!1,e.lineAnchor||"end",e.markIndex||0,e.padding===void 0?0:e.padding,e.method||"naive").forEach(r=>{const a=r.datum;a[f[0]]=r.x,a[f[1]]=r.y,a[f[2]]=r.opacity,a[f[3]]=r.align,a[f[4]]=r.baseline}),n.reflow(o).modifies(f)}});const Hue=Object.freeze(Object.defineProperty({__proto__:null,label:aS},Symbol.toStringTag,{value:"Module"}));function Jj(e,n){var t=[],o=function(s){return s(l)},f,r,a,l,c,i;if(n==null)t.push(e);else for(f={},r=0,a=e.length;r{FR(i,e.x,e.y,e.bandwidth||.3).forEach(s=>{const u={};for(let h=0;he==="poly"?n:e==="quad"?2:1;function sS(e){_r.call(this,null,e)}sS.Definition={type:"Regression",metadata:{generates:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"method",type:"string",default:"linear",values:Object.keys(tT)},{name:"order",type:"number",default:3},{name:"extent",type:"number",array:!0,length:2},{name:"params",type:"boolean",default:!1},{name:"as",type:"string",array:!0}]};ii(sS,_r,{transform(e,n){const t=n.fork(n.NO_SOURCE|n.NO_FIELDS);if(!this.value||n.changed()||e.modified()){const o=n.materialize(n.SOURCE).source,f=Jj(o,e.groupby),r=(e.groupby||[]).map(Rs),a=e.method||"linear",l=e.order||3,c=Gue(a,l),i=e.as||[Rs(e.x),Rs(e.y)],s=tT[a],u=[];let h=e.extent;Yi(tT,a)||Pr("Invalid regression method: "+a),h!=null&&a==="log"&&h[0]<=0&&(n.dataflow.warn("Ignoring extent with values <= 0 for log regression."),h=null),f.forEach(d=>{if(d.length<=c){n.dataflow.warn("Skipping regression with more parameters than data points.");return}const p=s(d,e.x,e.y,l);if(e.params){u.push(oo({keys:d.dims,coef:p.coef,rSquared:p.rSquared}));return}const g=h||ed(d,e.x),y=v=>{const x={};for(let _=0;_y([v,p.predict(v)])):$w(p.predict,g,25,200).forEach(y)}),this.value&&(t.rem=this.value),this.value=t.add=t.source=u}return t}});const Wue=Object.freeze(Object.defineProperty({__proto__:null,loess:oS,regression:sS},Symbol.toStringTag,{value:"Module"})),Xh=11102230246251565e-32,Bl=134217729,Yue=(3+8*Xh)*Xh;function J4(e,n,t,o,f){let r,a,l,c,i=n[0],s=o[0],u=0,h=0;s>i==s>-i?(r=i,i=n[++u]):(r=s,s=o[++h]);let d=0;if(ui==s>-i?(a=i+r,l=r-(a-i),i=n[++u]):(a=s+r,l=r-(a-s),s=o[++h]),r=a,l!==0&&(f[d++]=l);ui==s>-i?(a=r+i,c=a-r,l=r-(a-c)+(i-c),i=n[++u]):(a=r+s,c=a-r,l=r-(a-c)+(s-c),s=o[++h]),r=a,l!==0&&(f[d++]=l);for(;u=L||-P>=L||(u=e-M,l=e-(M+u)+(u-f),u=t-T,i=t-(T+u)+(u-f),u=n-E,c=n-(E+u)+(u-r),u=o-S,s=o-(S+u)+(u-r),l===0&&c===0&&i===0&&s===0)||(L=Kue*a+Yue*Math.abs(P),P+=M*s+S*l-(E*i+T*c),P>=L||-P>=L))return P;_=l*S,h=Bl*l,d=h-(h-l),m=l-d,h=Bl*S,p=h-(h-S),g=S-p,A=m*g-(_-d*p-m*p-d*g),b=c*T,h=Bl*c,d=h-(h-c),m=c-d,h=Bl*T,p=h-(h-T),g=T-p,k=m*g-(b-d*p-m*p-d*g),y=A-k,u=A-y,su[0]=A-(y+u)+(u-k),v=_+y,u=v-_,x=_-(v-u)+(y-u),y=x-b,u=x-y,su[1]=x-(y+u)+(u-b),w=v+y,u=w-v,su[2]=v-(w-u)+(y-u),su[3]=w;const R=J4(4,Jg,4,su,ED);_=M*s,h=Bl*M,d=h-(h-M),m=M-d,h=Bl*s,p=h-(h-s),g=s-p,A=m*g-(_-d*p-m*p-d*g),b=E*i,h=Bl*E,d=h-(h-E),m=E-d,h=Bl*i,p=h-(h-i),g=i-p,k=m*g-(b-d*p-m*p-d*g),y=A-k,u=A-y,su[0]=A-(y+u)+(u-k),v=_+y,u=v-_,x=_-(v-u)+(y-u),y=x-b,u=x-y,su[1]=x-(y+u)+(u-b),w=v+y,u=w-v,su[2]=v-(w-u)+(y-u),su[3]=w;const F=J4(R,ED,4,su,SD);_=l*s,h=Bl*l,d=h-(h-l),m=l-d,h=Bl*s,p=h-(h-s),g=s-p,A=m*g-(_-d*p-m*p-d*g),b=c*i,h=Bl*c,d=h-(h-c),m=c-d,h=Bl*i,p=h-(h-i),g=i-p,k=m*g-(b-d*p-m*p-d*g),y=A-k,u=A-y,su[0]=A-(y+u)+(u-k),v=_+y,u=v-_,x=_-(v-u)+(y-u),y=x-b,u=x-y,su[1]=x-(y+u)+(u-b),w=v+y,u=w-v,su[2]=v-(w-u)+(y-u),su[3]=w;const D=J4(F,SD,4,su,CD);return CD[D-1]}function qb(e,n,t,o,f,r){const a=(n-r)*(t-f),l=(e-f)*(o-r),c=a-l;if(a===0||l===0||a>0!=l>0)return c;const i=Math.abs(a+l);return Math.abs(c)>=Zue*i?c:-Que(e,n,t,o,f,r,i)}const LD=Math.pow(2,-52),Hb=new Uint32Array(512);class $_{static from(n,t=ice,o=ace){const f=n.length,r=new Float64Array(f*2);for(let a=0;a>1;if(t>0&&typeof n[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=n;const o=Math.max(2*t-5,0);this._triangles=new Uint32Array(o*3),this._halfedges=new Int32Array(o*3),this._hashSize=Math.ceil(Math.sqrt(t)),this._hullPrev=new Uint32Array(t),this._hullNext=new Uint32Array(t),this._hullTri=new Uint32Array(t),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(t),this._dists=new Float64Array(t),this.update()}update(){const{coords:n,_hullPrev:t,_hullNext:o,_hullTri:f,_hullHash:r}=this,a=n.length>>1;let l=1/0,c=1/0,i=-1/0,s=-1/0;for(let T=0;Ti&&(i=E),S>s&&(s=S),this._ids[T]=T}const u=(l+i)/2,h=(c+s)/2;let d=1/0,m,p,g;for(let T=0;T0&&(p=T,d=E)}let x=n[2*p],_=n[2*p+1],A=1/0;for(let T=0;TP&&(T[E++]=L,P=this._dists[L])}this.hull=T.subarray(0,E),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(qb(y,v,x,_,b,k)<0){const T=p,E=x,S=_;p=g,x=b,_=k,g=T,b=E,k=S}const w=rce(y,v,x,_,b,k);this._cx=w.x,this._cy=w.y;for(let T=0;T0&&Math.abs(L-E)<=LD&&Math.abs(R-S)<=LD||(E=L,S=R,P===m||P===p||P===g))continue;let F=0;for(let W=0,G=this._hashKey(L,R);W=0;)if(D=O,D===F){D=-1;break}if(D===-1)continue;let N=this._addTriangle(D,P,o[D],-1,-1,f[D]);f[P]=this._legalize(N+2),f[D]=N,M++;let B=o[D];for(;O=o[B],qb(L,R,n[2*B],n[2*B+1],n[2*O],n[2*O+1])<0;)N=this._addTriangle(B,P,O,f[P],-1,f[B]),f[P]=this._legalize(N+2),o[B]=B,M--,B=O;if(D===F)for(;O=t[D],qb(L,R,n[2*O],n[2*O+1],n[2*D],n[2*D+1])<0;)N=this._addTriangle(O,P,D,-1,f[D],f[O]),this._legalize(N+2),f[O]=N,o[D]=D,M--,D=O;this._hullStart=t[P]=D,o[D]=t[B]=P,o[P]=B,r[this._hashKey(L,R)]=P,r[this._hashKey(n[2*D],n[2*D+1])]=D}this.hull=new Uint32Array(M);for(let T=0,E=this._hullStart;T0?3-t:1+t)/4}function K4(e,n,t,o){const f=e-t,r=n-o;return f*f+r*r}function tce(e,n,t,o,f,r,a,l){const c=e-a,i=n-l,s=t-a,u=o-l,h=f-a,d=r-l,m=c*c+i*i,p=s*s+u*u,g=h*h+d*d;return c*(u*g-p*d)-i*(s*g-p*h)+m*(s*d-u*h)<0}function nce(e,n,t,o,f,r){const a=t-e,l=o-n,c=f-e,i=r-n,s=a*a+l*l,u=c*c+i*i,h=.5/(a*i-l*c),d=(i*s-l*u)*h,m=(a*u-c*s)*h;return d*d+m*m}function rce(e,n,t,o,f,r){const a=t-e,l=o-n,c=f-e,i=r-n,s=a*a+l*l,u=c*c+i*i,h=.5/(a*i-l*c),d=e+(i*s-l*u)*h,m=n+(a*u-c*s)*h;return{x:d,y:m}}function dm(e,n,t,o){if(o-t<=20)for(let f=t+1;f<=o;f++){const r=e[f],a=n[r];let l=f-1;for(;l>=t&&n[e[l]]>a;)e[l+1]=e[l--];e[l+1]=r}else{const f=t+o>>1;let r=t+1,a=o;cy(e,f,r),n[e[t]]>n[e[o]]&&cy(e,t,o),n[e[r]]>n[e[o]]&&cy(e,r,o),n[e[t]]>n[e[r]]&&cy(e,t,r);const l=e[r],c=n[l];for(;;){do r++;while(n[e[r]]c);if(a=a-t?(dm(e,n,r,o),dm(e,n,t,a-1)):(dm(e,n,t,a-1),dm(e,n,r,o))}}function cy(e,n,t){const o=e[n];e[n]=e[t],e[t]=o}function ice(e){return e[0]}function ace(e){return e[1]}const DD=1e-6;class v0{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(n,t){this._+=`M${this._x0=this._x1=+n},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(n,t){this._+=`L${this._x1=+n},${this._y1=+t}`}arc(n,t,o){n=+n,t=+t,o=+o;const f=n+o,r=t;if(o<0)throw new Error("negative radius");this._x1===null?this._+=`M${f},${r}`:(Math.abs(this._x1-f)>DD||Math.abs(this._y1-r)>DD)&&(this._+="L"+f+","+r),o&&(this._+=`A${o},${o},0,1,1,${n-o},${t}A${o},${o},0,1,1,${this._x1=f},${this._y1=r}`)}rect(n,t,o,f){this._+=`M${this._x0=this._x1=+n},${this._y0=this._y1=+t}h${+o}v${+f}h${-o}Z`}value(){return this._||null}}class nT{constructor(){this._=[]}moveTo(n,t){this._.push([n,t])}closePath(){this._.push(this._[0].slice())}lineTo(n,t){this._.push([n,t])}value(){return this._.length?this._:null}}let oce=class{constructor(n,[t,o,f,r]=[0,0,960,500]){if(!((f=+f)>=(t=+t))||!((r=+r)>=(o=+o)))throw new Error("invalid bounds");this.delaunay=n,this._circumcenters=new Float64Array(n.points.length*2),this.vectors=new Float64Array(n.points.length*2),this.xmax=f,this.xmin=t,this.ymax=r,this.ymin=o,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:n,hull:t,triangles:o},vectors:f}=this,r=this.circumcenters=this._circumcenters.subarray(0,o.length/3*2);for(let d=0,m=0,p=o.length,g,y;d1;)r-=2;for(let a=2;a4)for(let a=0;a0){if(t>=this.ymax)return null;(a=(this.ymax-t)/f)0){if(n>=this.xmax)return null;(a=(this.xmax-n)/o)this.xmax?2:0)|(tthis.ymax?8:0)}};const sce=2*Math.PI,Kg=Math.pow;function lce(e){return e[0]}function uce(e){return e[1]}function cce(e){const{triangles:n,coords:t}=e;for(let o=0;o1e-10)return!1}return!0}function fce(e,n,t){return[e+Math.sin(e+n)*t,n+Math.cos(e-n)*t]}class lS{static from(n,t=lce,o=uce,f){return new lS("length"in n?hce(n,t,o,f):Float64Array.from(dce(n,t,o,f)))}constructor(n){this._delaunator=new $_(n),this.inedges=new Int32Array(n.length/2),this._hullIndex=new Int32Array(n.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){const n=this._delaunator,t=this.points;if(n.hull&&n.hull.length>2&&cce(n)){this.collinear=Int32Array.from({length:t.length/2},(h,d)=>d).sort((h,d)=>t[2*h]-t[2*d]||t[2*h+1]-t[2*d+1]);const c=this.collinear[0],i=this.collinear[this.collinear.length-1],s=[t[2*c],t[2*c+1],t[2*i],t[2*i+1]],u=1e-8*Math.hypot(s[3]-s[1],s[2]-s[0]);for(let h=0,d=t.length/2;h0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=f[0],a[f[0]]=1,f.length===2&&(a[f[1]]=0,this.triangles[1]=f[1],this.triangles[2]=f[1]))}voronoi(n){return new oce(this,n)}*neighbors(n){const{inedges:t,hull:o,_hullIndex:f,halfedges:r,triangles:a,collinear:l}=this;if(l){const u=l.indexOf(n);u>0&&(yield l[u-1]),u=0&&r!==o&&r!==f;)o=r;return r}_step(n,t,o){const{inedges:f,hull:r,_hullIndex:a,halfedges:l,triangles:c,points:i}=this;if(f[n]===-1||!i.length)return(n+1)%(i.length>>1);let s=n,u=Kg(t-i[n*2],2)+Kg(o-i[n*2+1],2);const h=f[n];let d=h;do{let m=c[d];const p=Kg(t-i[m*2],2)+Kg(o-i[m*2+1],2);if(p>5,T2=1<<11;function yce(){var e=[256,256],n,t,o,f,r,a,l,c=Kj,i=[],s=Math.random,u={};u.layout=function(){for(var m=h(Qd()),p=Ace((e[0]>>5)*e[1]),g=null,y=i.length,v=-1,x=[],_=i.map(b=>({text:n(b),font:t(b),style:f(b),weight:r(b),rotate:a(b),size:~~(o(b)+1e-14),padding:l(b),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:b})).sort((b,k)=>k.size-b.size);++v>1,A.y=e[1]*(s()+.5)>>1,vce(m,A,_,v),A.hasText&&d(p,A,g)&&(x.push(A),g?bce(g,A):g=[{x:A.x+A.x0,y:A.y+A.y0},{x:A.x+A.x1,y:A.y+A.y1}],A.x-=e[0]>>1,A.y-=e[1]>>1)}return x};function h(m){m.width=m.height=1;var p=Math.sqrt(m.getContext("2d").getImageData(0,0,1,1).data.length>>2);m.width=($y<<5)/p,m.height=T2/p;var g=m.getContext("2d");return g.fillStyle=g.strokeStyle="red",g.textAlign="center",{context:g,ratio:p}}function d(m,p,g){for(var y=p.x,v=p.y,x=Math.sqrt(e[0]*e[0]+e[1]*e[1]),_=c(e),A=s()<.5?1:-1,b=-A,k,w,M;(k=_(b+=A))&&(w=~~k[0],M=~~k[1],!(Math.min(Math.abs(w),Math.abs(M))>=x));)if(p.x=y+w,p.y=v+M,!(p.x+p.x0<0||p.y+p.y0<0||p.x+p.x1>e[0]||p.y+p.y1>e[1])&&(!g||!xce(p,m,e[0]))&&(!g||_ce(p,g))){for(var T=p.sprite,E=p.width>>5,S=e[0]>>5,P=p.x-(E<<4),L=P&127,R=32-L,F=p.y1-p.y0,D=(p.y+p.y0)*S+(P>>5),O,N=0;N>>L:0);D+=S}return p.sprite=null,!0}return!1}return u.words=function(m){return arguments.length?(i=m,u):i},u.size=function(m){return arguments.length?(e=[+m[0],+m[1]],u):e},u.font=function(m){return arguments.length?(t=Yp(m),u):t},u.fontStyle=function(m){return arguments.length?(f=Yp(m),u):f},u.fontWeight=function(m){return arguments.length?(r=Yp(m),u):r},u.rotate=function(m){return arguments.length?(a=Yp(m),u):a},u.text=function(m){return arguments.length?(n=Yp(m),u):n},u.spiral=function(m){return arguments.length?(c=kce[m]||m,u):c},u.fontSize=function(m){return arguments.length?(o=Yp(m),u):o},u.padding=function(m){return arguments.length?(l=Yp(m),u):l},u.random=function(m){return arguments.length?(s=m,u):s},u}function vce(e,n,t,o){if(!n.sprite){var f=e.context,r=e.ratio;f.clearRect(0,0,($y<<5)/r,T2/r);var a=0,l=0,c=0,i=t.length,s,u,h,d,m;for(--o;++o>5<<5,h=~~Math.max(Math.abs(v+x),Math.abs(v-x))}else s=s+31>>5<<5;if(h>c&&(c=h),a+s>=$y<<5&&(a=0,l+=c,c=0),l+h>=T2)break;f.translate((a+(s>>1))/r,(l+(h>>1))/r),n.rotate&&f.rotate(n.rotate*Q4),f.fillText(n.text,0,0),n.padding&&(f.lineWidth=2*n.padding,f.strokeText(n.text,0,0)),f.restore(),n.width=s,n.height=h,n.xoff=a,n.yoff=l,n.x1=s>>1,n.y1=h>>1,n.x0=-n.x1,n.y0=-n.y1,n.hasText=!0,a+=s}for(var A=f.getImageData(0,0,($y<<5)/r,T2/r).data,b=[];--o>=0;)if(n=t[o],!!n.hasText){for(s=n.width,u=s>>5,h=n.y1-n.y0,d=0;d>5),T=A[(l+m)*($y<<5)+(a+d)<<2]?1<<31-d%32:0;b[M]|=T,k|=T}k?w=m:(n.y0++,h--,m--,l++)}n.y1=n.y0+w,n.sprite=b.slice(0,(n.y1-n.y0)*u)}}}function xce(e,n,t){t>>=5;for(var o=e.sprite,f=e.width>>5,r=e.x-(f<<4),a=r&127,l=32-a,c=e.y1-e.y0,i=(e.y+e.y0)*t+(r>>5),s,u=0;u>>a:0))&n[i+h])return!0;i+=t}return!1}function bce(e,n){var t=e[0],o=e[1];n.x+n.x0o.x&&(o.x=n.x+n.x1),n.y+n.y1>o.y&&(o.y=n.y+n.y1)}function _ce(e,n){return e.x+e.x1>n[0].x&&e.x+e.x0n[0].y&&e.y+e.y0p(m(g))}f.forEach(m=>{m[a[0]]=NaN,m[a[1]]=NaN,m[a[3]]=0});const i=r.words(f).text(e.text).size(e.size||[500,500]).padding(e.padding||1).spiral(e.spiral||"archimedean").rotate(e.rotate||0).font(e.font||"sans-serif").fontStyle(e.fontStyle||"normal").fontWeight(e.fontWeight||"normal").fontSize(l).random(Cc).layout(),s=r.size(),u=s[0]>>1,h=s[1]>>1,d=i.length;for(let m=0,p,g;mnew Uint8Array(e),Sce=e=>new Uint16Array(e),nv=e=>new Uint32Array(e);function Cce(){let e=8,n=[],t=nv(0),o=Gb(0,e),f=Gb(0,e);return{data:()=>n,seen:()=>t=Lce(t,n.length),add(r){for(let a=0,l=n.length,c=r.length,i;an.length,curr:()=>o,prev:()=>f,reset:r=>f[r]=o[r],all:()=>e<257?255:e<65537?65535:4294967295,set(r,a){o[r]|=a},clear(r,a){o[r]&=~a},resize(r,a){const l=o.length;(r>l||a>e)&&(e=Math.max(a,e),o=Gb(r,e,o),f=Gb(r,e))}}}function Lce(e,n,t){return e.length>=n?e:(t=t||new e.constructor(n),t.set(e),t)}function Gb(e,n,t){const o=(n<257?Ece:n<65537?Sce:nv)(e);return t&&o.set(t),o}function OD(e,n,t){const o=1<0)for(g=0;ge,size:()=>t}}function Dce(e,n){return e.sort.call(n,(t,o)=>{const f=e[t],r=e[o];return fr?1:0}),CZ(e,n)}function Oce(e,n,t,o,f,r,a,l,c){let i=0,s=0,u;for(u=0;in.modified(o.fields));return t?this.reinit(e,n):this.eval(e,n)}else return this.init(e,n)},init(e,n){const t=e.fields,o=e.query,f=this._indices={},r=this._dims=[],a=o.length;let l=0,c,i;for(;l{const r=f.remove(n,t);for(const a in o)o[a].reindex(r)})},update(e,n,t){const o=this._dims,f=e.query,r=n.stamp,a=o.length;let l=0,c,i;for(t.filters=0,i=0;id)for(g=d,y=Math.min(u,m);gm)for(g=Math.max(u,m),y=h;gu)for(m=u,p=Math.min(i,h);mh)for(m=Math.max(i,h),p=s;ml[s]&t?null:a[s];return r.filter(r.MOD,i),f&f-1?(r.filter(r.ADD,s=>{const u=l[s]&t;return!u&&u^c[s]&t?a[s]:null}),r.filter(r.REM,s=>{const u=l[s]&t;return u&&!(u^(u^c[s]&t))?a[s]:null})):(r.filter(r.ADD,i),r.filter(r.REM,s=>(l[s]&t)===f?a[s]:null)),r.filter(r.SOURCE,s=>i(s._index))}});const Pce=Object.freeze(Object.defineProperty({__proto__:null,crossfilter:fS,resolvefilter:hS},Symbol.toStringTag,{value:"Module"})),Ice="RawCode",N0="Literal",Fce="Property",Rce="Identifier",zce="ArrayExpression",Nce="BinaryExpression",eU="CallExpression",Bce="ConditionalExpression",jce="LogicalExpression",Uce="MemberExpression",$ce="ObjectExpression",Vce="UnaryExpression";function wf(e){this.type=e}wf.prototype.visit=function(e){let n,t,o;if(e(this))return 1;for(n=qce(this),t=0,o=n.length;t";yh[B0]="Identifier";yh[wp]="Keyword";yh[y3]="Null";yh[og]="Numeric";yh[Du]="Punctuator";yh[vx]="String";yh[Hce]="RegularExpression";var Gce="ArrayExpression",Wce="BinaryExpression",Yce="CallExpression",Xce="ConditionalExpression",tU="Identifier",Zce="Literal",Jce="LogicalExpression",Kce="MemberExpression",Qce="ObjectExpression",efe="Property",tfe="UnaryExpression",ll="Unexpected token %0",nfe="Unexpected number",rfe="Unexpected string",ife="Unexpected identifier",afe="Unexpected reserved word",ofe="Unexpected end of input",rT="Invalid regular expression",eA="Invalid regular expression: missing /",nU="Octal literals are not allowed in strict mode.",sfe="Duplicate data property in object literal not allowed in strict mode",Sl="ILLEGAL",Mv="Disabled.",lfe=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"),ufe=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]");function v3(e,n){if(!e)throw new Error("ASSERT: "+n)}function jh(e){return e>=48&&e<=57}function dS(e){return"0123456789abcdefABCDEF".indexOf(e)>=0}function rv(e){return"01234567".indexOf(e)>=0}function cfe(e){return e===32||e===9||e===11||e===12||e===160||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(e)>=0}function Ev(e){return e===10||e===13||e===8232||e===8233}function xx(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e===92||e>=128&&lfe.test(String.fromCharCode(e))}function V_(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===92||e>=128&&ufe.test(String.fromCharCode(e))}const ffe={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1};function rU(){for(;Cr1114111||e!=="}")&&Xa({},ll,Sl),n<=65535?String.fromCharCode(n):(t=(n-65536>>10)+55296,o=(n-65536&1023)+56320,String.fromCharCode(t,o))}function iU(){var e,n;for(e=Fi.charCodeAt(Cr++),n=String.fromCharCode(e),e===92&&(Fi.charCodeAt(Cr)!==117&&Xa({},ll,Sl),++Cr,e=iT("u"),(!e||e==="\\"||!xx(e.charCodeAt(0)))&&Xa({},ll,Sl),n=e);Cr>>=")return Cr+=4,{type:Du,value:a,start:e,end:Cr};if(r=a.substr(0,3),r===">>>"||r==="<<="||r===">>=")return Cr+=3,{type:Du,value:r,start:e,end:Cr};if(f=r.substr(0,2),o===f[1]&&"+-<>&|".indexOf(o)>=0||f==="=>")return Cr+=2,{type:Du,value:f,start:e,end:Cr};if(f==="//"&&Xa({},ll,Sl),"<>=!+-*%&|^/".indexOf(o)>=0)return++Cr,{type:Du,value:o,start:e,end:Cr};Xa({},ll,Sl)}function gfe(e){let n="";for(;Cr=0&&Cr=0&&(t=t.replace(/\\u\{([0-9a-fA-F]+)\}/g,(o,f)=>{if(parseInt(f,16)<=1114111)return"x";Xa({},rT)}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(t)}catch{Xa({},rT)}try{return new RegExp(e,n)}catch{return null}}function xfe(){var e,n,t,o,f;for(e=Fi[Cr],v3(e==="/","Regular expression literal must start with a slash"),n=Fi[Cr++],t=!1,o=!1;Cr=0&&Xa({},rT,t),{value:t,literal:n}}function _fe(){var e,n,t,o;return bo=null,rU(),e=Cr,n=xfe(),t=bfe(),o=vfe(n.value,t.value),{literal:n.literal+t.literal,value:o,regex:{pattern:n.value,flags:t.value},start:e,end:Cr}}function wfe(e){return e.type===B0||e.type===wp||e.type===m3||e.type===y3}function aU(){if(rU(),Cr>=Yl)return{type:yx,start:Cr,end:Cr};const e=Fi.charCodeAt(Cr);return xx(e)?pfe():e===40||e===41||e===59?tA():e===39||e===34?yfe():e===46?jh(Fi.charCodeAt(Cr+1))?ID():tA():jh(e)?ID():tA()}function Ru(){const e=bo;return Cr=e.end,bo=aU(),Cr=e.end,e}function oU(){const e=Cr;bo=aU(),Cr=e}function Afe(e){const n=new wf(Gce);return n.elements=e,n}function FD(e,n,t){const o=new wf(e==="||"||e==="&&"?Jce:Wce);return o.operator=e,o.left=n,o.right=t,o}function kfe(e,n){const t=new wf(Yce);return t.callee=e,t.arguments=n,t}function Tfe(e,n,t){const o=new wf(Xce);return o.test=e,o.consequent=n,o.alternate=t,o}function pS(e){const n=new wf(tU);return n.name=e,n}function Vy(e){const n=new wf(Zce);return n.value=e.value,n.raw=Fi.slice(e.start,e.end),e.regex&&(n.raw==="//"&&(n.raw="/(?:)/"),n.regex=e.regex),n}function RD(e,n,t){const o=new wf(Kce);return o.computed=e==="[",o.object=n,o.property=t,o.computed||(t.member=!0),o}function Mfe(e){const n=new wf(Qce);return n.properties=e,n}function zD(e,n,t){const o=new wf(efe);return o.key=n,o.value=t,o.kind=e,o}function Efe(e,n){const t=new wf(tfe);return t.operator=e,t.argument=n,t.prefix=!0,t}function Xa(e,n){var t,o=Array.prototype.slice.call(arguments,2),f=n.replace(/%(\d)/g,(r,a)=>(v3(a":case"<=":case">=":case"instanceof":case"in":n=7;break;case"<<":case">>":case">>>":n=8;break;case"+":case"-":n=9;break;case"*":case"/":case"%":n=11;break}return n}function Bfe(){var e,n,t,o,f,r,a,l,c,i;if(e=bo,c=M2(),o=bo,f=jD(o),f===0)return c;for(o.prec=f,Ru(),n=[e,bo],a=M2(),r=[c,o,a];(f=jD(bo))>0;){for(;r.length>2&&f<=r[r.length-2].prec;)a=r.pop(),l=r.pop().value,c=r.pop(),n.pop(),t=FD(l,c,a),r.push(t);o=Ru(),o.prec=f,r.push(o),n.push(bo),t=M2(),r.push(t)}for(i=r.length-1,t=r[i],n.pop();i>1;)n.pop(),t=FD(r[i-1].value,r[i-2],t),i-=2;return t}function j0(){var e,n,t;return e=Bfe(),Wo("?")&&(Ru(),n=j0(),Xl(":"),t=j0(),e=Tfe(e,n,t)),e}function gS(){const e=j0();if(Wo(","))throw new Error(Mv);return e}function sU(e){Fi=e,Cr=0,Yl=Fi.length,bo=null,oU();const n=gS();if(bo.type!==yx)throw new Error("Unexpect token after expression.");return n}var lU={NaN:"NaN",E:"Math.E",LN2:"Math.LN2",LN10:"Math.LN10",LOG2E:"Math.LOG2E",LOG10E:"Math.LOG10E",PI:"Math.PI",SQRT1_2:"Math.SQRT1_2",SQRT2:"Math.SQRT2",MIN_VALUE:"Number.MIN_VALUE",MAX_VALUE:"Number.MAX_VALUE"};function uU(e){function n(a,l,c,i){let s=e(l[0]);return c&&(s=c+"("+s+")",c.lastIndexOf("new ",0)===0&&(s="("+s+")")),s+"."+a+(i<0?"":i===0?"()":"("+l.slice(1).map(e).join(",")+")")}function t(a,l,c){return i=>n(a,i,l,c)}const o="new Date",f="String",r="RegExp";return{isNaN:"Number.isNaN",isFinite:"Number.isFinite",abs:"Math.abs",acos:"Math.acos",asin:"Math.asin",atan:"Math.atan",atan2:"Math.atan2",ceil:"Math.ceil",cos:"Math.cos",exp:"Math.exp",floor:"Math.floor",log:"Math.log",max:"Math.max",min:"Math.min",pow:"Math.pow",random:"Math.random",round:"Math.round",sin:"Math.sin",sqrt:"Math.sqrt",tan:"Math.tan",clamp:function(a){a.length<3&&Pr("Missing arguments to clamp function."),a.length>3&&Pr("Too many arguments to clamp function.");const l=a.map(e);return"Math.max("+l[1]+", Math.min("+l[2]+","+l[0]+"))"},now:"Date.now",utc:"Date.UTC",datetime:o,date:t("getDate",o,0),day:t("getDay",o,0),year:t("getFullYear",o,0),month:t("getMonth",o,0),hours:t("getHours",o,0),minutes:t("getMinutes",o,0),seconds:t("getSeconds",o,0),milliseconds:t("getMilliseconds",o,0),time:t("getTime",o,0),timezoneoffset:t("getTimezoneOffset",o,0),utcdate:t("getUTCDate",o,0),utcday:t("getUTCDay",o,0),utcyear:t("getUTCFullYear",o,0),utcmonth:t("getUTCMonth",o,0),utchours:t("getUTCHours",o,0),utcminutes:t("getUTCMinutes",o,0),utcseconds:t("getUTCSeconds",o,0),utcmilliseconds:t("getUTCMilliseconds",o,0),length:t("length",null,-1),parseFloat:"parseFloat",parseInt:"parseInt",upper:t("toUpperCase",f,0),lower:t("toLowerCase",f,0),substring:t("substring",f),split:t("split",f),trim:t("trim",f,0),regexp:r,test:t("test",r),if:function(a){a.length<3&&Pr("Missing arguments to if function."),a.length>3&&Pr("Too many arguments to if function.");const l=a.map(e);return"("+l[0]+"?"+l[1]+":"+l[2]+")"}}}function jfe(e){const n=e&&e.length-1;return n&&(e[0]==='"'&&e[n]==='"'||e[0]==="'"&&e[n]==="'")?e.slice(1,-1):e}function cU(e){e=e||{};const n=e.allowed?sh(e.allowed):{},t=e.forbidden?sh(e.forbidden):{},o=e.constants||lU,f=(e.functions||uU)(u),r=e.globalvar,a=e.fieldvar,l=xa(r)?r:m=>`${r}["${m}"]`;let c={},i={},s=0;function u(m){if(Li(m))return m;const p=h[m.type];return p==null&&Pr("Unsupported type: "+m.type),p(m)}const h={Literal:m=>m.raw,Identifier:m=>{const p=m.name;return s>0?p:Yi(t,p)?Pr("Illegal identifier: "+p):Yi(o,p)?o[p]:Yi(n,p)?p:(c[p]=1,l(p))},MemberExpression:m=>{const p=!m.computed,g=u(m.object);p&&(s+=1);const y=u(m.property);return g===a&&(i[jfe(y)]=1),p&&(s-=1),g+(p?"."+y:"["+y+"]")},CallExpression:m=>{m.callee.type!=="Identifier"&&Pr("Illegal callee type: "+m.callee.type);const p=m.callee.name,g=m.arguments,y=Yi(f,p)&&f[p];return y||Pr("Unrecognized function: "+p),xa(y)?y(g):y+"("+g.map(u).join(",")+")"},ArrayExpression:m=>"["+m.elements.map(u).join(",")+"]",BinaryExpression:m=>"("+u(m.left)+" "+m.operator+" "+u(m.right)+")",UnaryExpression:m=>"("+m.operator+u(m.argument)+")",ConditionalExpression:m=>"("+u(m.test)+"?"+u(m.consequent)+":"+u(m.alternate)+")",LogicalExpression:m=>"("+u(m.left)+m.operator+u(m.right)+")",ObjectExpression:m=>"{"+m.properties.map(u).join(",")+"}",Property:m=>{s+=1;const p=u(m.key);return s-=1,p+":"+u(m.value)}};function d(m){const p={code:u(m),globals:Object.keys(c),fields:Object.keys(i)};return c={},i={},p}return d.functions=f,d.constants=o,d}const mS="intersect",UD="union",Ufe="vlMulti",$fe="vlPoint",$D="or",Vfe="and",Hf="_vgsid_",Sv=uc(Hf),qfe="E",Hfe="R",Gfe="R-E",Wfe="R-LE",Yfe="R-RE",q_="index:unit";function VD(e,n){for(var t=n.fields,o=n.values,f=t.length,r=0,a,l;rEa(n.fields?{values:n.fields.map(o=>(o.getter||(o.getter=uc(o.field)))(t.datum))}:{[Hf]:Sv(t.datum)},n))}function ehe(e,n,t,o){for(var f=this.context.data[e],r=f?f.values.value:[],a={},l={},c={},i,s,u,h,d,m,p,g,y,v,x=r.length,_=0,A,b;_(k[s[M].field]=w,k),{})))}else d=Hf,m=Sv(i),p=a[d]||(a[d]={}),g=p[h]||(p[h]=[]),g.push(m),t&&(g=l[h]||(l[h]=[]),g.push({[Hf]:m}));if(n=n||UD,a[Hf]?a[Hf]=rA["".concat(Hf,"_").concat(n)](...Object.values(a[Hf])):Object.keys(a).forEach(k=>{a[k]=Object.keys(a[k]).map(w=>a[k][w]).reduce((w,M)=>w===void 0?M:rA["".concat(c[k],"_").concat(n)](w,M))}),r=Object.keys(l),t&&r.length){const k=o?$fe:Ufe;a[k]=n===UD?{[$D]:r.reduce((w,M)=>(w.push(...l[M]),w),[])}:{[Vfe]:r.map(w=>({[$D]:l[w]}))}}return a}var rA={["".concat(Hf,"_union")]:FZ,["".concat(Hf,"_intersect")]:PZ,E_union:function(e,n){if(!e.length)return n;for(var t=0,o=n.length;tn.indexOf(t)>=0):n},R_union:function(e,n){var t=pu(n[0]),o=pu(n[1]);return t>o&&(t=n[1],o=n[0]),e.length?(e[0]>t&&(e[0]=t),e[1]o&&(t=n[1],o=n[0]),e.length?oo&&(e[1]=o),e):[t,o]}};const the=":",nhe="@";function yS(e,n,t,o){n[0].type!==N0&&Pr("First argument to selection functions must be a string literal.");const f=n[0].value,r=n.length>=2&&qa(n).value,a="unit",l=nhe+a,c=the+f;r===mS&&!Yi(o,l)&&(o[l]=t.getData(f).indataRef(t,a)),Yi(o,c)||(o[c]=t.getData(f).tuplesRef())}function hU(e){const n=this.context.data[e];return n?n.values.value:[]}function rhe(e,n,t){const o=this.context.data[e]["index:"+n],f=o?o.value.get(t):void 0;return f&&f.count}function ihe(e,n){const t=this.context.dataflow,o=this.context.data[e],f=o.input;return t.pulse(f,t.changeset().remove(yf).insert(n)),1}function ahe(e,n,t){if(e){const o=this.context.dataflow,f=e.mark.source;o.pulse(f,o.changeset().encode(e,n))}return t!==void 0?t:e}const bx=e=>function(n,t){return this.context.dataflow.locale()[e](t)(n)},ohe=bx("format"),dU=bx("timeFormat"),she=bx("utcFormat"),lhe=bx("timeParse"),uhe=bx("utcParse"),Wb=new Date(2e3,0,1);function b3(e,n,t){return!Number.isInteger(e)||!Number.isInteger(n)?"":(Wb.setYear(2e3),Wb.setMonth(e),Wb.setDate(n),dU.call(this,Wb,t))}function che(e){return b3.call(this,e,1,"%B")}function fhe(e){return b3.call(this,e,1,"%b")}function hhe(e){return b3.call(this,0,2+e,"%A")}function dhe(e){return b3.call(this,0,2+e,"%a")}const phe=":",ghe="@",aT="%",pU="$";function vS(e,n,t,o){n[0].type!==N0&&Pr("First argument to data functions must be a string literal.");const f=n[0].value,r=phe+f;if(!Yi(r,o))try{o[r]=t.getData(f).tuplesRef()}catch{}}function mhe(e,n,t,o){n[0].type!==N0&&Pr("First argument to indata must be a string literal."),n[1].type!==N0&&Pr("Second argument to indata must be a string literal.");const f=n[0].value,r=n[1].value,a=ghe+r;Yi(a,o)||(o[a]=t.getData(f).indataRef(t,r))}function Bu(e,n,t,o){if(n[0].type===N0)qD(t,o,n[0].value);else for(e in t.scales)qD(t,o,e)}function qD(e,n,t){const o=aT+t;if(!Yi(n,o))try{n[o]=e.scaleRef(t)}catch{}}function cd(e,n){let t;return xa(e)?e:Li(e)?(t=n.scales[e])&&t.value:void 0}function yhe(e,n,t){n.__bandwidth=f=>f&&f.bandwidth?f.bandwidth():0,t._bandwidth=Bu,t._range=Bu,t._scale=Bu;const o=f=>"_["+(f.type===N0?ri(aT+f.value):ri(aT)+"+"+e(f))+"]";return{_bandwidth:f=>"this.__bandwidth(".concat(o(f[0]),")"),_range:f=>"".concat(o(f[0]),".range()"),_scale:f=>"".concat(o(f[0]),"(").concat(e(f[1]),")")}}function xS(e,n){return function(t,o,f){if(t){const r=cd(t,(f||this).context);return r&&r.path[e](o)}else return n(o)}}const vhe=xS("area",Vae),xhe=xS("bounds",Wae),bhe=xS("centroid",Qae);function _he(e){const n=this.context.group;let t=!1;if(n)for(;e;){if(e===n){t=!0;break}e=e.mark.group}return t}function bS(e,n,t){try{e[n].apply(e,["EXPRESSION"].concat([].slice.call(t)))}catch(o){e.warn(o)}return t[t.length-1]}function whe(){return bS(this.context.dataflow,"warn",arguments)}function Ahe(){return bS(this.context.dataflow,"info",arguments)}function khe(){return bS(this.context.dataflow,"debug",arguments)}function iA(e){const n=e/255;return n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4)}function oT(e){const n=I2(e),t=iA(n.r),o=iA(n.g),f=iA(n.b);return .2126*t+.7152*o+.0722*f}function The(e,n){const t=oT(e),o=oT(n),f=Math.max(t,o),r=Math.min(t,o);return(f+.05)/(r+.05)}function Mhe(){const e=[].slice.call(arguments);return e.unshift({}),Ea(...e)}function gU(e,n){return e===n||e!==e&&n!==n?!0:zr(e)?zr(n)&&e.length===n.length?Ehe(e,n):!1:Si(e)&&Si(n)?mU(e,n):!1}function Ehe(e,n){for(let t=0,o=e.length;tmU(e,n)}function She(e,n,t,o,f,r){const a=this.context.dataflow,l=this.context.data[e],c=l.input,i=a.stamp();let s=l.changes,u,h;if(a._trigger===!1||!(c.value.length||n||o))return 0;if((!s||s.stamp{l.modified=!0,a.pulse(c,s).run()},!0,1)),t&&(u=t===!0?yf:zr(t)||Iw(t)?t:HD(t),s.remove(u)),n&&s.insert(n),o&&(u=HD(o),c.value.some(u)?s.remove(u):s.insert(o)),f)for(h in r)s.modify(f,h,r[h]);return 1}function Che(e){const n=e.touches,t=n[0].clientX-n[1].clientX,o=n[0].clientY-n[1].clientY;return Math.sqrt(t*t+o*o)}function Lhe(e){const n=e.touches;return Math.atan2(n[0].clientY-n[1].clientY,n[0].clientX-n[1].clientX)}const GD={};function Dhe(e,n){const t=GD[n]||(GD[n]=uc(n));return zr(e)?e.map(t):t(e)}function _S(e){return zr(e)||ArrayBuffer.isView(e)?e:null}function wS(e){return _S(e)||(Li(e)?e:null)}function Ohe(e){for(var n=arguments.length,t=new Array(n>1?n-1:0),o=1;o1?n-1:0),o=1;o1?n-1:0),o=1;o1?n-1:0),o=1;or.stop(i(s),e(s))),r}function Ghe(e,n,t){const o=cd(e,(t||this).context);return function(f){return o?o.path.context(f)(n):""}}function Whe(e){let n=null;return function(t){return t?vv(t,n=n||Pm(e)):e}}const yU=e=>e.data;function vU(e,n){const t=hU.call(n,e);return t.root&&t.root.lookup||{}}function Yhe(e,n,t){const o=vU(e,this),f=o[n],r=o[t];return f&&r?f.path(r).map(yU):void 0}function Xhe(e,n){const t=vU(e,this)[n];return t?t.ancestors().map(yU):void 0}const xU=()=>typeof window<"u"&&window||null;function Zhe(){const e=xU();return e?e.screen:{}}function Jhe(){const e=xU();return e?[e.innerWidth,e.innerHeight]:[void 0,void 0]}function Khe(){const e=this.context.dataflow,n=e.container&&e.container();return n?[n.clientWidth,n.clientHeight]:[void 0,void 0]}function bU(e,n,t){if(!e)return[];const[o,f]=e,r=new Us().set(o[0],o[1],f[0],f[1]),a=t||this.context.dataflow.scenegraph().root;return aB(a,r,Qhe(n))}function Qhe(e){let n=null;if(e){const t=Ti(e.marktype),o=Ti(e.markname);n=f=>(!t.length||t.some(r=>f.marktype===r))&&(!o.length||o.some(r=>f.name===r))}return n}function ede(e,n,t){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:5;const f=e[e.length-1];return f===void 0||Math.sqrt((f[0]-n)**2+(f[1]-t)**2)>o?(e.push([n,t]),[...e]):e}function tde(e){return(e??[]).reduce((n,t,o)=>{let[f,r]=t;return n+=o==0?"M ".concat(f,",").concat(r," "):o===e.length-1?" Z":"L ".concat(f,",").concat(r," ")},"")}function nde(e,n,t){const{x:o,y:f,mark:r}=t,a=new Us().set(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER);for(const[c,i]of n)ca.x2&&(a.x2=c),ia.y2&&(a.y2=i);return a.translate(o,f),bU([[a.x1,a.y1],[a.x2,a.y2]],e,r).filter(c=>rde(c.x,c.y,n))}function rde(e,n,t){let o=0;for(let f=0,r=t.length-1;fn!=l>n&&e<(a-c)*(n-i)/(l-i)+c&&o++}return o&1}const Cv={random(){return Cc()},cumulativeNormal:Bw,cumulativeLogNormal:z6,cumulativeUniform:U6,densityNormal:O6,densityLogNormal:R6,densityUniform:j6,quantileNormal:jw,quantileLogNormal:N6,quantileUniform:$6,sampleNormal:Nw,sampleLogNormal:F6,sampleUniform:B6,isArray:zr,isBoolean:s1,isDate:_0,isDefined(e){return e!==void 0},isNumber:Eo,isObject:Si,isRegExp:fZ,isString:Li,isTuple:Iw,isValid(e){return e!=null&&e===e},toBoolean:sF,toDate(e){return lF(e)},toNumber:pu,toString:uF,indexof:Phe,join:Ohe,lastindexof:Ihe,replace:Rhe,reverse:zhe,slice:Fhe,flush:uZ,lerp:hZ,merge:Mhe,pad:mZ,peek:qa,pluck:Dhe,span:Lw,inrange:ky,truncate:vZ,rgb:I2,lab:K2,hcl:Q2,hsl:RA,luminance:oT,contrast:The,sequence:sc,format:ohe,utcFormat:she,utcParse:uhe,utcOffset:$F,utcSequence:HF,timeFormat:dU,timeParse:lhe,timeOffset:UF,timeSequence:qF,timeUnitSpecifier:LF,monthFormat:che,monthAbbrevFormat:fhe,dayFormat:hhe,dayAbbrevFormat:dhe,quarter:eZ,utcquarter:tZ,week:OF,utcweek:FF,dayofyear:DF,utcdayofyear:IF,warn:whe,info:Ahe,debug:khe,extent(e){return ed(e)},inScope:_he,intersect:bU,clampRange:nZ,pinchDistance:Che,pinchAngle:Lhe,screen:Zhe,containerSize:Khe,windowSize:Jhe,bandspace:Nhe,setdata:ihe,pathShape:Whe,panLinear:ZX,panLog:JX,panPow:KX,panSymlog:QX,zoomLinear:tF,zoomLog:nF,zoomPow:VA,zoomSymlog:rF,encode:ahe,modify:She,lassoAppend:ede,lassoPath:tde,intersectLasso:nde},ide=["view","item","group","xy","x","y"],ade="event.vega.",_U="this.",AS={},wU={forbidden:["_"],allowed:["datum","event","item"],fieldvar:"datum",globalvar:e=>"_[".concat(ri(pU+e),"]"),functions:ode,constants:lU,visitors:AS},sT=cU(wU);function ode(e){const n=uU(e);ide.forEach(t=>n[t]=ade+t);for(const t in Cv)n[t]=_U+t;return Ea(n,yhe(e,Cv,AS)),n}function $s(e,n,t){return arguments.length===1?Cv[e]:(Cv[e]=n,t&&(AS[e]=t),sT&&(sT.functions[e]=_U+e),this)}$s("bandwidth",Bhe,Bu);$s("copy",jhe,Bu);$s("domain",Uhe,Bu);$s("range",Vhe,Bu);$s("invert",$he,Bu);$s("scale",qhe,Bu);$s("gradient",Hhe,Bu);$s("geoArea",vhe,Bu);$s("geoBounds",xhe,Bu);$s("geoCentroid",bhe,Bu);$s("geoShape",Ghe,Bu);$s("indata",rhe,mhe);$s("data",hU,vS);$s("treePath",Yhe,vS);$s("treeAncestors",Xhe,vS);$s("vlSelectionTest",Xfe,yS);$s("vlSelectionIdTest",Kfe,yS);$s("vlSelectionResolve",ehe,yS);$s("vlSelectionTuples",Qfe);function ch(e,n){const t={};let o;try{e=Li(e)?e:ri(e)+"",o=sU(e)}catch{Pr("Expression parse error: "+e)}o.visit(r=>{if(r.type!==eU)return;const a=r.callee.name,l=wU.visitors[a];l&&l(a,r.arguments,n,t)});const f=sT(o);return f.globals.forEach(r=>{const a=pU+r;!Yi(t,a)&&n.getSignal(r)&&(t[a]=n.signalRef(r))}),{$expr:Ea({code:f.code},n.options.ast?{ast:o}:null),$fields:f.fields,$params:t}}function sde(e){const n=this,t=e.operators||[];return e.background&&(n.background=e.background),e.eventConfig&&(n.eventConfig=e.eventConfig),e.locale&&(n.locale=e.locale),t.forEach(o=>n.parseOperator(o)),t.forEach(o=>n.parseOperatorParameters(o)),(e.streams||[]).forEach(o=>n.parseStream(o)),(e.updates||[]).forEach(o=>n.parseUpdate(o)),n.resolve()}const lde=sh(["rule"]),WD=sh(["group","image","rect"]);function ude(e,n){let t="";return lde[n]||(e.x2&&(e.x?(WD[n]&&(t+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),t+="o.width=o.x2-o.x;"):t+="o.x=o.x2-(o.width||0);"),e.xc&&(t+="o.x=o.xc-(o.width||0)/2;"),e.y2&&(e.y?(WD[n]&&(t+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),t+="o.height=o.y2-o.y;"):t+="o.y=o.y2-(o.height||0);"),e.yc&&(t+="o.y=o.yc-(o.height||0)/2;")),t}function kS(e){return(e+"").toLowerCase()}function cde(e){return kS(e)==="operator"}function fde(e){return kS(e)==="collect"}function fy(e,n,t){t[t.length-1]!==";"&&(t="return("+t+");");const o=Function(...n.concat(t));return e&&e.functions?o.bind(e.functions):o}function hde(e,n,t,o){return"((u = ".concat(e,") < (v = ").concat(n,") || u == null) && v != null ? ").concat(t,` - : (u > v || v == null) && u != null ? `).concat(o,` - : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? `).concat(t,` - : v !== v && u === u ? `).concat(o," : ")}var dde={operator:(e,n)=>fy(e,["_"],n.code),parameter:(e,n)=>fy(e,["datum","_"],n.code),event:(e,n)=>fy(e,["event"],n.code),handler:(e,n)=>{const t="var datum=event.item&&event.item.datum;return ".concat(n.code,";");return fy(e,["_","event"],t)},encode:(e,n)=>{const{marktype:t,channels:o}=n;let f="var o=item,datum=o.datum,m=0,$;";for(const r in o){const a="o["+ri(r)+"]";f+="$=".concat(o[r].code,";if(").concat(a,"!==$)").concat(a,"=$,m=1;")}return f+=ude(o,t),f+="return m;",fy(e,["item","_"],f)},codegen:{get(e){const n="[".concat(e.map(ri).join("]["),"]"),t=Function("_","return _".concat(n,";"));return t.path=n,t},comparator(e,n){let t;const o=(r,a)=>{const l=n[a];let c,i;return r.path?(c="a".concat(r.path),i="b".concat(r.path)):((t=t||{})["f"+a]=r,c="this.f".concat(a,"(a)"),i="this.f".concat(a,"(b)")),hde(c,i,-l,l)},f=Function("a","b","var u, v; return "+e.map(o).join("")+"0;");return t?f.bind(t):f}}};function pde(e){const n=this;cde(e.type)||!e.type?n.operator(e,e.update?n.operatorExpression(e.update):null):n.transform(e,e.type)}function gde(e){const n=this;if(e.params){const t=n.get(e.id);t||Pr("Invalid operator id: "+e.id),n.dataflow.connect(t,t.parameters(n.parseParameters(e.params),e.react,e.initonly))}}function mde(e,n){n=n||{};const t=this;for(const o in e){const f=e[o];n[o]=zr(f)?f.map(r=>YD(r,t,n)):YD(f,t,n)}return n}function YD(e,n,t){if(!e||!Si(e))return e;for(let o=0,f=XD.length,r;of&&f.$tupleid?Gi:f);return n.fn[t]||(n.fn[t]=iF(o,e.$order,n.expr.codegen))}function wde(e,n){const t=e.$encode,o={};for(const f in t){const r=t[f];o[f]=gc(n.encodeExpression(r.$expr),r.$fields),o[f].output=r.$output}return o}function Ade(e,n){return n}function kde(e,n){const t=e.$subflow;return function(o,f,r){const a=n.fork().parse(t),l=a.get(t.operators[0].id),c=a.signals.parent;return c&&c.set(r),l.detachSubflow=()=>n.detach(a),l}}function Tde(){return Gi}function Mde(e){var n=this,t=e.filter!=null?n.eventExpression(e.filter):void 0,o=e.stream!=null?n.get(e.stream):void 0,f;e.source?o=n.events(e.source,e.type,t):e.merge&&(f=e.merge.map(r=>n.get(r)),o=f[0].merge.apply(f[0],f.slice(1))),e.between&&(f=e.between.map(r=>n.get(r)),o=o.between(f[0],f[1])),e.filter&&(o=o.filter(t)),e.throttle!=null&&(o=o.throttle(+e.throttle)),e.debounce!=null&&(o=o.debounce(+e.debounce)),o==null&&Pr("Invalid stream definition: "+JSON.stringify(e)),e.consume&&o.consume(!0),n.stream(e,o)}function Ede(e){var n=this,t=Si(t=e.source)?t.$ref:t,o=n.get(t),f=null,r=e.update,a=void 0;o||Pr("Source not defined: "+e.source),f=e.target&&e.target.$expr?n.eventExpression(e.target.$expr):n.get(e.target),r&&r.$expr&&(r.$params&&(a=n.parseParameters(r.$params)),r=n.handlerExpression(r.$expr)),n.update(e,o,f,r,a)}const Sde={skip:!0};function Cde(e){var n=this,t={};if(e.signals){var o=t.signals={};Object.keys(n.signals).forEach(r=>{const a=n.signals[r];e.signals(r,a)&&(o[r]=a.value)})}if(e.data){var f=t.data={};Object.keys(n.data).forEach(r=>{const a=n.data[r];e.data(r,a)&&(f[r]=a.input.value)})}return n.subcontext&&e.recurse!==!1&&(t.subcontext=n.subcontext.map(r=>r.getState(e))),t}function Lde(e){var n=this,t=n.dataflow,o=e.data,f=e.signals;Object.keys(f||{}).forEach(r=>{t.update(n.signals[r],f[r],Sde)}),Object.keys(o||{}).forEach(r=>{t.pulse(n.data[r].input,t.changeset().remove(yf).insert(o[r]))}),(e.subcontext||[]).forEach((r,a)=>{const l=n.subcontext[a];l&&l.setState(r)})}function AU(e,n,t,o){return new kU(e,n,t,o)}function kU(e,n,t,o){this.dataflow=e,this.transforms=n,this.events=e.events.bind(e),this.expr=o||dde,this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},t&&(this.functions=Object.create(t),this.functions.context=this)}function ZD(e){this.dataflow=e.dataflow,this.transforms=e.transforms,this.events=e.events,this.expr=e.expr,this.signals=Object.create(e.signals),this.scales=Object.create(e.scales),this.nodes=Object.create(e.nodes),this.data=Object.create(e.data),this.fn=Object.create(e.fn),e.functions&&(this.functions=Object.create(e.functions),this.functions.context=this)}kU.prototype=ZD.prototype={fork(){const e=new ZD(this);return(this.subcontext||(this.subcontext=[])).push(e),e},detach(e){this.subcontext=this.subcontext.filter(t=>t!==e);const n=Object.keys(e.nodes);for(const t of n)e.nodes[t]._targets=null;for(const t of n)e.nodes[t].detach();e.nodes=null},get(e){return this.nodes[e]},set(e,n){return this.nodes[e]=n},add(e,n){const t=this,o=t.dataflow,f=e.value;if(t.set(e.id,n),fde(e.type)&&f&&(f.$ingest?o.ingest(n,f.$ingest,f.$format):f.$request?o.preload(n,f.$request,f.$format):o.pulse(n,o.changeset().insert(f))),e.root&&(t.root=n),e.parent){let r=t.get(e.parent.$ref);r?(o.connect(r,[n]),n.targets().add(r)):(t.unresolved=t.unresolved||[]).push(()=>{r=t.get(e.parent.$ref),o.connect(r,[n]),n.targets().add(r)})}if(e.signal&&(t.signals[e.signal]=n),e.scale&&(t.scales[e.scale]=n),e.data)for(const r in e.data){const a=t.data[r]||(t.data[r]={});e.data[r].forEach(l=>a[l]=n)}},resolve(){return(this.unresolved||[]).forEach(e=>e()),delete this.unresolved,this},operator(e,n){this.add(e,this.dataflow.add(e.value,n))},transform(e,n){this.add(e,this.dataflow.add(this.transforms[kS(n)]))},stream(e,n){this.set(e.id,n)},update(e,n,t,o,f){this.dataflow.on(n,t,o,f,e.options)},operatorExpression(e){return this.expr.operator(this,e)},parameterExpression(e){return this.expr.parameter(this,e)},eventExpression(e){return this.expr.event(this,e)},handlerExpression(e){return this.expr.handler(this,e)},encodeExpression(e){return this.expr.encode(this,e)},parse:sde,parseOperator:pde,parseOperatorParameters:gde,parseParameters:mde,parseStream:Mde,parseUpdate:Ede,getState:Cde,setState:Lde};function Dde(e){const n=e.container();n&&(n.setAttribute("role","graphics-document"),n.setAttribute("aria-roleDescription","visualization"),TU(n,e.description()))}function TU(e,n){e&&(n==null?e.removeAttribute("aria-label"):e.setAttribute("aria-label",n))}function Ode(e){e.add(null,n=>(e._background=n.bg,e._resize=1,n.bg),{bg:e._signals.background})}const aA="default";function Pde(e){const n=e._signals.cursor||(e._signals.cursor=e.add({user:aA,item:null}));e.on(e.events("view","mousemove"),n,(t,o)=>{const f=n.value,r=f?Li(f)?f:f.user:aA,a=o.item&&o.item.cursor||null;return f&&r===f.user&&a==f.item?f:{user:r,item:a}}),e.add(null,function(t){let o=t.cursor,f=this.value;return Li(o)||(f=o.item,o=o.user),lT(e,o&&o!==aA?o:f||o),f},{cursor:n})}function lT(e,n){const t=e.globalCursor()?typeof document<"u"&&document.body:e.container();if(t)return n==null?t.style.removeProperty("cursor"):t.style.cursor=n}function H_(e,n){var t=e._runtime.data;return Yi(t,n)||Pr("Unrecognized data set: "+n),t[n]}function Ide(e,n){return arguments.length<2?H_(this,e).values.value:_3.call(this,e,ig().remove(yf).insert(n))}function _3(e,n){vR(n)||Pr("Second argument to changes must be a changeset.");const t=H_(this,e);return t.modified=!0,this.pulse(t.input,n)}function Fde(e,n){return _3.call(this,e,ig().insert(n))}function Rde(e,n){return _3.call(this,e,ig().remove(n))}function MU(e){var n=e.padding();return Math.max(0,e._viewWidth+n.left+n.right)}function EU(e){var n=e.padding();return Math.max(0,e._viewHeight+n.top+n.bottom)}function w3(e){var n=e.padding(),t=e._origin;return[n.left+t[0],n.top+t[1]]}function zde(e){var n=w3(e),t=MU(e),o=EU(e);e._renderer.background(e.background()),e._renderer.resize(t,o,n),e._handler.origin(n),e._resizeListeners.forEach(f=>{try{f(t,o)}catch(r){e.error(r)}})}function Nde(e,n,t){var o=e._renderer,f=o&&o.canvas(),r,a,l;return f&&(l=w3(e),a=n.changedTouches?n.changedTouches[0]:n,r=l3(a,f),r[0]-=l[0],r[1]-=l[1]),n.dataflow=e,n.item=t,n.vega=Bde(e,t,r),n}function Bde(e,n,t){const o=n?n.mark.marktype==="group"?n:n.mark.group:null;function f(a){var l=o,c;if(a){for(c=n;c;c=c.mark.group)if(c.mark.name===a){l=c;break}}return l&&l.mark&&l.mark.interactive?l:{}}function r(a){if(!a)return t;Li(a)&&(a=f(a));const l=t.slice();for(;a;)l[0]-=a.x||0,l[1]-=a.y||0,a=a.mark&&a.mark.group;return l}return{view:bu(e),item:bu(n||{}),group:f,xy:r,x:a=>r(a)[0],y:a=>r(a)[1]}}const JD="view",jde="timer",Ude="window",$de={trap:!1};function Vde(e){const n=Ea({defaults:{}},e),t=(o,f)=>{f.forEach(r=>{zr(o[r])&&(o[r]=sh(o[r]))})};return t(n.defaults,["prevent","allow"]),t(n,["view","window","selector"]),n}function SU(e,n,t,o){e._eventListeners.push({type:t,sources:Ti(n),handler:o})}function qde(e,n){var t=e._eventConfig.defaults,o=t.prevent,f=t.allow;return o===!1||f===!0?!1:o===!0||f===!1?!0:o?o[n]:f?!f[n]:e.preventDefault()}function Yb(e,n,t){const o=e._eventConfig&&e._eventConfig[n];return o===!1||Si(o)&&!o[t]?(e.warn("Blocked ".concat(n," ").concat(t," event listener.")),!1):!0}function Hde(e,n,t){var o=this,f=new zw(t),r=function(i,s){o.runAsync(null,()=>{e===JD&&qde(o,n)&&i.preventDefault(),f.receive(Nde(o,i,s))})},a;if(e===jde)Yb(o,"timer",n)&&o.timer(r,n);else if(e===JD)Yb(o,"view",n)&&o.addEventListener(n,r,$de);else if(e===Ude?Yb(o,"window",n)&&typeof window<"u"&&(a=[window]):typeof document<"u"&&Yb(o,"selector",n)&&(a=document.querySelectorAll(e)),!a)o.warn("Can not resolve event source: "+e);else{for(var l=0,c=a.length;l=0;)n[o].stop();for(o=t.length;--o>=0;)for(r=t[o],f=r.sources.length;--f>=0;)r.sources[f].removeEventListener(r.type,r.handler);return e&&e.call(this,this._handler,null,null,null),this}function lc(e,n,t){const o=document.createElement(e);for(const f in n)o.setAttribute(f,n[f]);return t!=null&&(o.textContent=t),o}const Yde="vega-bind",Xde="vega-bind-name",Zde="vega-bind-radio";function Jde(e,n,t){if(!n)return;const o=t.param;let f=t.state;return f||(f=t.state={elements:null,active:!1,set:null,update:a=>{a!=e.signal(o.signal)&&e.runAsync(null,()=>{f.source=!0,e.signal(o.signal,a)})}},o.debounce&&(f.update=aF(o.debounce,f.update))),(o.input==null&&o.element?Kde:epe)(f,n,o,e),f.active||(e.on(e._signals[o.signal],null,()=>{f.source?f.source=!1:f.set(e.signal(o.signal))}),f.active=!0),f}function Kde(e,n,t,o){const f=t.event||"input",r=()=>e.update(n.value);o.signal(t.signal,n.value),n.addEventListener(f,r),SU(o,n,f,r),e.set=a=>{n.value=a,n.dispatchEvent(Qde(f))}}function Qde(e){return typeof Event<"u"?new Event(e):{type:e}}function epe(e,n,t,o){const f=o.signal(t.signal),r=lc("div",{class:Yde}),a=t.input==="radio"?r:r.appendChild(lc("label"));a.appendChild(lc("span",{class:Xde},t.name||t.signal)),n.appendChild(r);let l=tpe;switch(t.input){case"checkbox":l=npe;break;case"select":l=rpe;break;case"radio":l=ipe;break;case"range":l=ape;break}l(e,a,t,f)}function tpe(e,n,t,o){const f=lc("input");for(const r in t)r!=="signal"&&r!=="element"&&f.setAttribute(r==="input"?"type":r,t[r]);f.setAttribute("name",t.signal),f.value=o,n.appendChild(f),f.addEventListener("input",()=>e.update(f.value)),e.elements=[f],e.set=r=>f.value=r}function npe(e,n,t,o){const f={type:"checkbox",name:t.signal};o&&(f.checked=!0);const r=lc("input",f);n.appendChild(r),r.addEventListener("change",()=>e.update(r.checked)),e.elements=[r],e.set=a=>r.checked=!!a||null}function rpe(e,n,t,o){const f=lc("select",{name:t.signal}),r=t.labels||[];t.options.forEach((a,l)=>{const c={value:a};G_(a,o)&&(c.selected=!0),f.appendChild(lc("option",c,(r[l]||a)+""))}),n.appendChild(f),f.addEventListener("change",()=>{e.update(t.options[f.selectedIndex])}),e.elements=[f],e.set=a=>{for(let l=0,c=t.options.length;l{const c={type:"radio",name:t.signal,value:a};G_(a,o)&&(c.checked=!0);const i=lc("input",c);i.addEventListener("change",()=>e.update(a));const s=lc("label",{},(r[l]||a)+"");return s.prepend(i),f.appendChild(s),i}),e.set=a=>{const l=e.elements,c=l.length;for(let i=0;i{c.textContent=l.value,e.update(+l.value)};l.addEventListener("input",i),l.addEventListener("change",i),e.elements=[l],e.set=s=>{l.value=s,c.textContent=s}}function G_(e,n){return e===n||e+""==n+""}function CU(e,n,t,o,f,r){return n=n||new o(e.loader()),n.initialize(t,MU(e),EU(e),w3(e),f,r).background(e.background())}function TS(e,n){return n?function(){try{n.apply(this,arguments)}catch(t){e.error(t)}}:null}function ope(e,n,t,o){const f=new o(e.loader(),TS(e,e.tooltip())).scene(e.scenegraph().root).initialize(t,w3(e),e);return n&&n.handlers().forEach(r=>{f.on(r.type,r.handler)}),f}function spe(e,n){const t=this,o=t._renderType,f=t._eventConfig.bind,r=u3(o);e=t._el=e?oA(t,e,!0):null,Dde(t),r||t.error("Unrecognized renderer type: "+o);const a=r.handler||hx,l=e?r.renderer:r.headless;return t._renderer=l?CU(t,t._renderer,e,l):null,t._handler=ope(t,t._handler,e,a),t._redraw=!0,e&&f!=="none"&&(n=n?t._elBind=oA(t,n,!0):e.appendChild(lc("form",{class:"vega-bindings"})),t._bind.forEach(c=>{c.param.element&&f!=="container"&&(c.element=oA(t,c.param.element,!!c.param.input))}),t._bind.forEach(c=>{Jde(t,c.element||n,c)})),t}function oA(e,n,t){if(typeof n=="string")if(typeof document<"u"){if(n=document.querySelector(n),!n)return e.error("Signal bind element not found: "+n),null}else return e.error("DOM document instance not found."),null;if(n&&t)try{n.textContent=""}catch(o){n=null,e.error(o)}return n}const hy=e=>+e||0,lpe=e=>({top:e,bottom:e,left:e,right:e});function tO(e){return Si(e)?{top:hy(e.top),bottom:hy(e.bottom),left:hy(e.left),right:hy(e.right)}:lpe(hy(e))}async function MS(e,n,t,o){const f=u3(n),r=f&&f.headless;return r||Pr("Unrecognized renderer type: "+n),await e.runAsync(),CU(e,null,null,r,t,o).renderAsync(e._scenegraph.root)}async function upe(e,n){e!==Ud.Canvas&&e!==Ud.SVG&&e!==Ud.PNG&&Pr("Unrecognized image type: "+e);const t=await MS(this,e,n);return e===Ud.SVG?cpe(t.svg(),"image/svg+xml"):t.canvas().toDataURL("image/png")}function cpe(e,n){const t=new Blob([e],{type:n});return window.URL.createObjectURL(t)}async function fpe(e,n){return(await MS(this,Ud.Canvas,e,n)).canvas()}async function hpe(e){return(await MS(this,Ud.SVG,e)).svg()}function dpe(e,n,t){return AU(e,Sm,Cv,t).parse(n)}function ppe(e){var n=this._runtime.scales;return Yi(n,e)||Pr("Unrecognized scale or projection: "+e),n[e].value}var LU="width",DU="height",ES="padding",nO={skip:!0};function OU(e,n){var t=e.autosize(),o=e.padding();return n-(t&&t.contains===ES?o.left+o.right:0)}function PU(e,n){var t=e.autosize(),o=e.padding();return n-(t&&t.contains===ES?o.top+o.bottom:0)}function gpe(e){var n=e._signals,t=n[LU],o=n[DU],f=n[ES];function r(){e._autosize=e._resize=1}e._resizeWidth=e.add(null,l=>{e._width=l.size,e._viewWidth=OU(e,l.size),r()},{size:t}),e._resizeHeight=e.add(null,l=>{e._height=l.size,e._viewHeight=PU(e,l.size),r()},{size:o});const a=e.add(null,r,{pad:f});e._resizeWidth.rank=t.rank+1,e._resizeHeight.rank=o.rank+1,a.rank=f.rank+1}function mpe(e,n,t,o,f,r){this.runAfter(a=>{let l=0;a._autosize=0,a.width()!==t&&(l=1,a.signal(LU,t,nO),a._resizeWidth.skip(!0)),a.height()!==o&&(l=1,a.signal(DU,o,nO),a._resizeHeight.skip(!0)),a._viewWidth!==e&&(a._resize=1,a._viewWidth=e),a._viewHeight!==n&&(a._resize=1,a._viewHeight=n),(a._origin[0]!==f[0]||a._origin[1]!==f[1])&&(a._resize=1,a._origin=f),l&&a.run("enter"),r&&a.runAfter(c=>c.resize())},!1,1)}function ype(e){return this._runtime.getState(e||{data:vpe,signals:xpe,recurse:!0})}function vpe(e,n){return n.modified&&zr(n.input.value)&&e.indexOf("_:vega:_")}function xpe(e,n){return!(e==="parent"||n instanceof Sm.proxy)}function bpe(e){return this.runAsync(null,n=>{n._trigger=!1,n._runtime.setState(e)},n=>{n._trigger=!0}),this}function _pe(e,n){function t(o){e({timestamp:Date.now(),elapsed:o})}this._timers.push(ele(t,n))}function wpe(e,n,t,o){const f=e.element();f&&f.setAttribute("title",Ape(o))}function Ape(e){return e==null?"":zr(e)?IU(e):Si(e)&&!_0(e)?kpe(e):e+""}function kpe(e){return Object.keys(e).map(n=>{const t=e[n];return n+": "+(zr(t)?IU(t):FU(t))}).join(` -`)}function IU(e){return"["+e.map(FU).join(", ")+"]"}function FU(e){return zr(e)?"[…]":Si(e)&&!_0(e)?"{…}":e}function RU(e,n){const t=this;if(n=n||{},gm.call(t),n.loader&&t.loader(n.loader),n.logger&&t.logger(n.logger),n.logLevel!=null&&t.logLevel(n.logLevel),n.locale||e.locale){const r=Ea({},e.locale,n.locale);t.locale(lR(r.number,r.time))}t._el=null,t._elBind=null,t._renderType=n.renderer||Ud.Canvas,t._scenegraph=new lE;const o=t._scenegraph.root;t._renderer=null,t._tooltip=n.tooltip||wpe,t._redraw=!0,t._handler=new hx().scene(o),t._globalCursor=!1,t._preventDefault=!1,t._timers=[],t._eventListeners=[],t._resizeListeners=[],t._eventConfig=Vde(e.eventConfig),t.globalCursor(t._eventConfig.globalCursor);const f=dpe(t,e,n.expr);t._runtime=f,t._signals=f.signals,t._bind=(e.bindings||[]).map(r=>({state:null,param:Ea({},r)})),f.root&&f.root.set(o),o.source=f.data.root.input,t.pulse(f.data.root.input,t.changeset().insert(o.items)),t._width=t.width(),t._height=t.height(),t._viewWidth=OU(t,t._width),t._viewHeight=PU(t,t._height),t._origin=[0,0],t._resize=0,t._autosize=1,gpe(t),Ode(t),Pde(t),t.description(e.description),n.hover&&t.hover(),n.container&&t.initialize(n.container,n.bind)}function Xb(e,n){return Yi(e._signals,n)?e._signals[n]:Pr("Unrecognized signal name: "+ri(n))}function zU(e,n){const t=(e._targets||[]).filter(o=>o._update&&o._update.handler===n);return t.length?t[0]:null}function rO(e,n,t,o){let f=zU(t,o);return f||(f=TS(e,()=>o(n,t.value)),f.handler=o,e.on(t,null,f)),e}function iO(e,n,t){const o=zU(n,t);return o&&n._targets.remove(o),e}ii(RU,gm,{async evaluate(e,n,t){if(await gm.prototype.evaluate.call(this,e,n),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,zde(this)),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(o){this.error(o)}return t&&c2(this,t),this},dirty(e){this._redraw=!0,this._renderer&&this._renderer.dirty(e)},description(e){if(arguments.length){const n=e!=null?e+"":null;return n!==this._desc&&TU(this._el,this._desc=n),this}return this._desc},container(){return this._el},scenegraph(){return this._scenegraph},origin(){return this._origin.slice()},signal(e,n,t){const o=Xb(this,e);return arguments.length===1?o.value:this.update(o,n,t)},width(e){return arguments.length?this.signal("width",e):this.signal("width")},height(e){return arguments.length?this.signal("height",e):this.signal("height")},padding(e){return arguments.length?this.signal("padding",tO(e)):tO(this.signal("padding"))},autosize(e){return arguments.length?this.signal("autosize",e):this.signal("autosize")},background(e){return arguments.length?this.signal("background",e):this.signal("background")},renderer(e){return arguments.length?(u3(e)||Pr("Unrecognized renderer type: "+e),e!==this._renderType&&(this._renderType=e,this._resetRenderer()),this):this._renderType},tooltip(e){return arguments.length?(e!==this._tooltip&&(this._tooltip=e,this._resetRenderer()),this):this._tooltip},loader(e){return arguments.length?(e!==this._loader&&(gm.prototype.loader.call(this,e),this._resetRenderer()),this):this._loader},resize(){return this._autosize=1,this.touch(Xb(this,"autosize"))},_resetRenderer(){this._renderer&&(this._renderer=null,this.initialize(this._el,this._elBind))},_resizeView:mpe,addEventListener(e,n,t){let o=n;return t&&t.trap===!1||(o=TS(this,n),o.raw=n),this._handler.on(e,o),this},removeEventListener(e,n){for(var t=this._handler.handlers(e),o=t.length,f,r;--o>=0;)if(r=t[o].type,f=t[o].handler,e===r&&(n===f||n===f.raw)){this._handler.off(r,f);break}return this},addResizeListener(e){const n=this._resizeListeners;return n.indexOf(e)<0&&n.push(e),this},removeResizeListener(e){var n=this._resizeListeners,t=n.indexOf(e);return t>=0&&n.splice(t,1),this},addSignalListener(e,n){return rO(this,e,Xb(this,e),n)},removeSignalListener(e,n){return iO(this,Xb(this,e),n)},addDataListener(e,n){return rO(this,e,H_(this,e).values,n)},removeDataListener(e,n){return iO(this,H_(this,e).values,n)},globalCursor(e){if(arguments.length){if(this._globalCursor!==!!e){const n=lT(this,null);this._globalCursor=!!e,n&&lT(this,n)}return this}else return this._globalCursor},preventDefault(e){return arguments.length?(this._preventDefault=e,this):this._preventDefault},timer:_pe,events:Hde,finalize:Wde,hover:Gde,data:Ide,change:_3,insert:Fde,remove:Rde,scale:ppe,initialize:spe,toImageURL:upe,toCanvas:fpe,toSVG:hpe,getState:ype,setState:bpe});const Tpe="view",W_="[",Y_="]",NU="{",BU="}",Mpe=":",jU=",",Epe="@",Spe=">",Cpe=/[[\]{}]/,Lpe={"*":1,arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1};let UU,$U;function VU(e,n,t){return UU=n||Tpe,$U=t||Lpe,qU(e.trim()).map(uT)}function Dpe(e){return $U[e]}function iv(e,n,t,o,f){const r=e.length;let a=0,l;for(;n=0?--a:o&&o.indexOf(l)>=0&&++a}return n}function qU(e){const n=[],t=e.length;let o=0,f=0;for(;f' after between selector: "+e;o=o.map(uT);const f=uT(e.slice(1).trim());return f.between?{between:o,stream:f}:(f.between=o,f)}function Ppe(e){const n={source:UU},t=[];let o=[0,0],f=0,r=0,a=e.length,l=0,c,i;if(e[a-1]===BU){if(l=e.lastIndexOf(NU),l>=0){try{o=Ipe(e.substring(l+1,a-1))}catch{throw"Invalid throttle specification: "+e}e=e.slice(0,l).trim(),a=e.length}else throw"Unmatched right brace: "+e;l=0}if(!a)throw e;if(e[0]===Epe&&(f=++l),c=iv(e,l,Mpe),c1?(n.type=t[1],f?n.markname=t[0].slice(1):Dpe(t[0])?n.marktype=t[0]:n.source=t[0]):n.type=t[0],n.type.slice(-1)==="!"&&(n.consume=!0,n.type=n.type.slice(0,-1)),i!=null&&(n.filter=i),o[0]&&(n.throttle=o[0]),o[1]&&(n.debounce=o[1]),n}function Ipe(e){const n=e.split(jU);if(!e.length||n.length>2)throw e;return n.map(t=>{const o=+t;if(o!==o)throw e;return o})}function Fpe(e){return Si(e)?e:{type:e||"pad"}}const dy=e=>+e||0,Rpe=e=>({top:e,bottom:e,left:e,right:e});function zpe(e){return Si(e)?e.signal?e:{top:dy(e.top),bottom:dy(e.bottom),left:dy(e.left),right:dy(e.right)}:Rpe(dy(e))}const ul=e=>Si(e)&&!zr(e)?Ea({},e):{value:e};function aO(e,n,t,o){return t!=null?(Si(t)&&!zr(t)||zr(t)&&t.length&&Si(t[0])?e.update[n]=t:e[o||"enter"][n]={value:t},1):0}function Ol(e,n,t){for(const o in n)aO(e,o,n[o]);for(const o in t)aO(e,o,t[o],"update")}function m1(e,n,t){for(const o in n)t&&Yi(t,o)||(e[o]=Ea(e[o]||{},n[o]));return e}function om(e,n){return n&&(n.enter&&n.enter[e]||n.update&&n.update[e])}const SS="mark",CS="frame",LS="scope",Npe="axis",Bpe="axis-domain",jpe="axis-grid",Upe="axis-label",$pe="axis-tick",Vpe="axis-title",qpe="legend",Hpe="legend-band",Gpe="legend-entry",Wpe="legend-gradient",HU="legend-label",Ype="legend-symbol",Xpe="legend-title",Zpe="title",Jpe="title-text",Kpe="title-subtitle";function Qpe(e,n,t,o,f){const r={},a={};let l,c,i,s;c="lineBreak",n==="text"&&f[c]!=null&&!om(c,e)&&sA(r,c,f[c]),(t=="legend"||String(t).startsWith("axis"))&&(t=null),s=t===CS?f.group:t===SS?Ea({},f.mark,f[n]):null;for(c in s)i=om(c,e)||(c==="fill"||c==="stroke")&&(om("fill",e)||om("stroke",e)),i||sA(r,c,s[c]);Ti(o).forEach(u=>{const h=f.style&&f.style[u];for(const d in h)om(d,e)||sA(r,d,h[d])}),e=Ea({},e);for(c in r)s=r[c],s.signal?(l=l||{})[c]=s:a[c]=s;return e.enter=Ea(a,e.enter),l&&(e.update=Ea(l,e.update)),e}function sA(e,n,t){e[n]=t&&t.signal?{signal:t.signal}:{value:t}}const GU=e=>Li(e)?ri(e):e.signal?`(${e.signal})`:WU(e);function A3(e){if(e.gradient!=null)return t0e(e);let n=e.signal?`(${e.signal})`:e.color?e0e(e.color):e.field!=null?WU(e.field):e.value!==void 0?ri(e.value):void 0;return e.scale!=null&&(n=n0e(e,n)),n===void 0&&(n=null),e.exponent!=null&&(n=`pow(${n},${E2(e.exponent)})`),e.mult!=null&&(n+=`*${E2(e.mult)}`),e.offset!=null&&(n+=`+${E2(e.offset)}`),e.round&&(n=`round(${n})`),n}const Zb=(e,n,t,o)=>`(${e}(${[n,t,o].map(A3).join(",")})+'')`;function e0e(e){return e.c?Zb("hcl",e.h,e.c,e.l):e.h||e.s?Zb("hsl",e.h,e.s,e.l):e.l||e.a?Zb("lab",e.l,e.a,e.b):e.r||e.g||e.b?Zb("rgb",e.r,e.g,e.b):null}function t0e(e){const n=[e.start,e.stop,e.count].map(t=>t==null?null:ri(t));for(;n.length&&qa(n)==null;)n.pop();return n.unshift(GU(e.gradient)),`gradient(${n.join(",")})`}function E2(e){return Si(e)?"("+A3(e)+")":e}function WU(e){return YU(Si(e)?e:{datum:e})}function YU(e){let n,t,o;if(e.signal)n="datum",o=e.signal;else if(e.group||e.parent){for(t=Math.max(1,e.level||1),n="item";t-- >0;)n+=".mark.group";e.parent?(o=e.parent,n+=".datum"):o=e.group}else e.datum?(n="datum",o=e.datum):Pr("Invalid field reference: "+ri(e));return e.signal||(o=Li(o)?sd(o).map(ri).join("]["):YU(o)),n+"["+o+"]"}function n0e(e,n){const t=GU(e.scale);return e.range!=null?n=`lerp(_range(${t}), ${+e.range})`:(n!==void 0&&(n=`_scale(${t}, ${n})`),e.band&&(n=(n?n+"+":"")+`_bandwidth(${t})`+(+e.band==1?"":"*"+E2(e.band)),e.extra&&(n=`(datum.extra ? _scale(${t}, datum.extra.value) : ${n})`)),n==null&&(n="0")),n}function r0e(e){let n="";return e.forEach(t=>{const o=A3(t);n+=t.test?`(${t.test})?${o}:`:o}),qa(n)===":"&&(n+="null"),n}function XU(e,n,t,o,f,r){const a={};r=r||{},r.encoders={$encode:a},e=Qpe(e,n,t,o,f.config);for(const l in e)a[l]=i0e(e[l],n,r,f);return r}function i0e(e,n,t,o){const f={},r={};for(const a in e)e[a]!=null&&(f[a]=o0e(a0e(e[a]),o,t,r));return{$expr:{marktype:n,channels:f},$fields:Object.keys(r),$output:Object.keys(e)}}function a0e(e){return zr(e)?r0e(e):A3(e)}function o0e(e,n,t,o){const f=ch(e,n);return f.$fields.forEach(r=>o[r]=1),Ea(t,f.$params),f.$expr}const s0e="outer",l0e=["value","update","init","react","bind"];function oO(e,n){Pr(e+' for "outer" push: '+ri(n))}function ZU(e,n){const t=e.name;if(e.push===s0e)n.signals[t]||oO("No prior signal definition",t),l0e.forEach(o=>{e[o]!==void 0&&oO("Invalid property ",o)});else{const o=n.addSignal(t,e.value);e.react===!1&&(o.react=!1),e.bind&&n.addBinding(t,e.bind)}}function cT(e,n,t,o){this.id=-1,this.type=e,this.value=n,this.params=t,o&&(this.parent=o)}function k3(e,n,t,o){return new cT(e,n,t,o)}function X_(e,n){return k3("operator",e,n)}function Hi(e){const n={$ref:e.id};return e.id<0&&(e.refs=e.refs||[]).push(n),n}function Lv(e,n){return n?{$field:e,$name:n}:{$field:e}}const fT=Lv("key");function sO(e,n){return{$compare:e,$order:n}}function u0e(e,n){const t={$key:e};return n&&(t.$flat=!0),t}const c0e="ascending",f0e="descending";function h0e(e){return Si(e)?(e.order===f0e?"-":"+")+T3(e.op,e.field):""}function T3(e,n){return(e&&e.signal?"$"+e.signal:e||"")+(e&&n?"_":"")+(n&&n.signal?"$"+n.signal:n||"")}const DS="scope",hT="view";function Qs(e){return e&&e.signal}function d0e(e){return e&&e.expr}function S2(e){if(Qs(e))return!0;if(Si(e)){for(const n in e)if(S2(e[n]))return!0}return!1}function nf(e,n){return e??n}function T0(e){return e&&e.signal||e}const lO="timer";function Dv(e,n){return(e.merge?g0e:e.stream?m0e:e.type?y0e:Pr("Invalid stream specification: "+ri(e)))(e,n)}function p0e(e){return e===DS?hT:e||hT}function g0e(e,n){const t=e.merge.map(f=>Dv(f,n)),o=OS({merge:t},e,n);return n.addStream(o).id}function m0e(e,n){const t=Dv(e.stream,n),o=OS({stream:t},e,n);return n.addStream(o).id}function y0e(e,n){let t;e.type===lO?(t=n.event(lO,e.throttle),e={between:e.between,filter:e.filter}):t=n.event(p0e(e.source),e.type);const o=OS({stream:t},e,n);return Object.keys(o).length===1?t:n.addStream(o).id}function OS(e,n,t){let o=n.between;return o&&(o.length!==2&&Pr('Stream "between" parameter must have 2 entries: '+ri(n)),e.between=[Dv(o[0],t),Dv(o[1],t)]),o=n.filter?[].concat(n.filter):[],(n.marktype||n.markname||n.markrole)&&o.push(v0e(n.marktype,n.markname,n.markrole)),n.source===DS&&o.push("inScope(event.item)"),o.length&&(e.filter=ch("("+o.join(")&&(")+")",t).$expr),(o=n.throttle)!=null&&(e.throttle=+o),(o=n.debounce)!=null&&(e.debounce=+o),n.consume&&(e.consume=!0),e}function v0e(e,n,t){const o="event.item";return o+(e&&e!=="*"?"&&"+o+".mark.marktype==='"+e+"'":"")+(t?"&&"+o+".mark.role==='"+t+"'":"")+(n?"&&"+o+".mark.name==='"+n+"'":"")}const x0e={code:"_.$value",ast:{type:"Identifier",value:"value"}};function b0e(e,n,t){const o=e.encode,f={target:t};let r=e.events,a=e.update,l=[];r||Pr("Signal update missing events specification."),Li(r)&&(r=VU(r,n.isSubscope()?DS:hT)),r=Ti(r).filter(c=>c.signal||c.scale?(l.push(c),0):1),l.length>1&&(l=[w0e(l)]),r.length&&l.push(r.length>1?{merge:r}:r[0]),o!=null&&(a&&Pr("Signal encode and update are mutually exclusive."),a="encode(item(),"+ri(o)+")"),f.update=Li(a)?ch(a,n):a.expr!=null?ch(a.expr,n):a.value!=null?a.value:a.signal!=null?{$expr:x0e,$params:{$value:n.signalRef(a.signal)}}:Pr("Invalid signal update specification."),e.force&&(f.options={force:!0}),l.forEach(c=>n.addUpdate(Ea(_0e(c,n),f)))}function _0e(e,n){return{source:e.signal?n.signalRef(e.signal):e.scale?n.scaleRef(e.scale):Dv(e,n)}}function w0e(e){return{signal:"["+e.map(n=>n.scale?'scale("'+n.scale+'")':n.signal)+"]"}}function A0e(e,n){const t=n.getSignal(e.name);let o=e.update;e.init&&(o?Pr("Signals can not include both init and update expressions."):(o=e.init,t.initonly=!0)),o&&(o=ch(o,n),t.update=o.$expr,t.params=o.$params),e.on&&e.on.forEach(f=>b0e(f,n,t.id))}const So=e=>(n,t,o)=>k3(e,t,n||void 0,o),JU=So("aggregate"),k0e=So("axisticks"),KU=So("bound"),Af=So("collect"),uO=So("compare"),T0e=So("datajoin"),QU=So("encode"),M0e=So("expression"),E0e=So("facet"),S0e=So("field"),C0e=So("key"),L0e=So("legendentries"),D0e=So("load"),O0e=So("mark"),P0e=So("multiextent"),I0e=So("multivalues"),F0e=So("overlap"),R0e=So("params"),e$=So("prefacet"),z0e=So("projection"),N0e=So("proxy"),B0e=So("relay"),t$=So("render"),j0e=So("scale"),sg=So("sieve"),U0e=So("sortitems"),n$=So("viewlayout"),$0e=So("values");let V0e=0;const r$={min:"min",max:"max",count:"sum"};function q0e(e,n){const t=e.type||"linear";Jz(t)||Pr("Unrecognized scale type: "+ri(t)),n.addScale(e.name,{type:t,domain:void 0})}function H0e(e,n){const t=n.getScale(e.name).params;let o;t.domain=i$(e.domain,e,n),e.range!=null&&(t.range=o$(e,n,t)),e.interpolate!=null&&tge(e.interpolate,t),e.nice!=null&&(t.nice=ege(e.nice)),e.bins!=null&&(t.bins=Q0e(e.bins,n));for(o in e)Yi(t,o)||o==="name"||(t[o]=kc(e[o],n))}function kc(e,n){return Si(e)?e.signal?n.signalRef(e.signal):Pr("Unsupported object: "+ri(e)):e}function C2(e,n){return e.signal?n.signalRef(e.signal):e.map(t=>kc(t,n))}function M3(e){Pr("Can not find data set: "+ri(e))}function i$(e,n,t){if(!e){(n.domainMin!=null||n.domainMax!=null)&&Pr("No scale domain defined for domainMin/domainMax to override.");return}return e.signal?t.signalRef(e.signal):(zr(e)?G0e:e.fields?Y0e:W0e)(e,n,t)}function G0e(e,n,t){return e.map(o=>kc(o,t))}function W0e(e,n,t){const o=t.getData(e.data);return o||M3(e.data),Om(n.type)?o.valuesRef(t,e.field,a$(e.sort,!1)):eN(n.type)?o.domainRef(t,e.field):o.extentRef(t,e.field)}function Y0e(e,n,t){const o=e.data,f=e.fields.reduce((r,a)=>(a=Li(a)?{data:o,field:a}:zr(a)||a.signal?X0e(a,t):a,r.push(a),r),[]);return(Om(n.type)?Z0e:eN(n.type)?J0e:K0e)(e,t,f)}function X0e(e,n){const t="_:vega:_"+V0e++,o=Af({});if(zr(e))o.value={$ingest:e};else if(e.signal){const f="setdata("+ri(t)+","+e.signal+")";o.params.input=n.signalRef(f)}return n.addDataPipeline(t,[o,sg({})]),{data:t,field:"data"}}function Z0e(e,n,t){const o=a$(e.sort,!0);let f,r;const a=t.map(i=>{const s=n.getData(i.data);return s||M3(i.data),s.countsRef(n,i.field,o)}),l={groupby:fT,pulse:a};o&&(f=o.op||"count",r=o.field?T3(f,o.field):"count",l.ops=[r$[f]],l.fields=[n.fieldRef(r)],l.as=[r]),f=n.add(JU(l));const c=n.add(Af({pulse:Hi(f)}));return r=n.add($0e({field:fT,sort:n.sortRef(o),pulse:Hi(c)})),Hi(r)}function a$(e,n){return e&&(!e.field&&!e.op?Si(e)?e.field="key":e={field:"key"}:!e.field&&e.op!=="count"?Pr("No field provided for sort aggregate op: "+e.op):n&&e.field&&e.op&&!r$[e.op]&&Pr("Multiple domain scales can not be sorted using "+e.op)),e}function J0e(e,n,t){const o=t.map(f=>{const r=n.getData(f.data);return r||M3(f.data),r.domainRef(n,f.field)});return Hi(n.add(I0e({values:o})))}function K0e(e,n,t){const o=t.map(f=>{const r=n.getData(f.data);return r||M3(f.data),r.extentRef(n,f.field)});return Hi(n.add(P0e({extents:o})))}function Q0e(e,n){return e.signal||zr(e)?C2(e,n):n.objectProperty(e)}function ege(e){return Si(e)?{interval:kc(e.interval),step:kc(e.step)}:kc(e)}function tge(e,n){n.interpolate=kc(e.type||e),e.gamma!=null&&(n.interpolateGamma=kc(e.gamma))}function o$(e,n,t){const o=n.config.range;let f=e.range;if(f.signal)return n.signalRef(f.signal);if(Li(f)){if(o&&Yi(o,f))return e=Ea({},e,{range:o[f]}),o$(e,n,t);f==="width"?f=[0,{signal:"width"}]:f==="height"?f=Om(e.type)?[0,{signal:"height"}]:[{signal:"height"},0]:Pr("Unrecognized scale range value: "+ri(f))}else if(f.scheme){t.scheme=zr(f.scheme)?C2(f.scheme,n):kc(f.scheme,n),f.extent&&(t.schemeExtent=C2(f.extent,n)),f.count&&(t.schemeCount=kc(f.count,n));return}else if(f.step){t.rangeStep=kc(f.step,n);return}else{if(Om(e.type)&&!zr(f))return i$(f,e,n);zr(f)||Pr("Unsupported range type: "+ri(f))}return f.map(r=>(zr(r)?C2:kc)(r,n))}function nge(e,n){const t=n.config.projection||{},o={};for(const f in e)f!=="name"&&(o[f]=dT(e[f],f,n));for(const f in t)o[f]==null&&(o[f]=dT(t[f],f,n));n.addProjection(e.name,o)}function dT(e,n,t){return zr(e)?e.map(o=>dT(o,n,t)):Si(e)?e.signal?t.signalRef(e.signal):n==="fit"?e:Pr("Unsupported parameter object: "+ri(e)):e}const kf="top",y1="left",v1="right",dp="bottom",s$="center",rge="vertical",ige="start",age="middle",oge="end",pT="index",PS="label",sge="offset",$m="perc",lge="perc2",Mc="value",_x="guide-label",IS="guide-title",uge="group-title",cge="group-subtitle",cO="symbol",L2="gradient",gT="discrete",mT="size",fge="shape",hge="fill",dge="stroke",pge="strokeWidth",gge="strokeDash",mge="opacity",FS=[mT,fge,hge,dge,pge,gge,mge],wx={name:1,style:1,interactive:1},$a={value:0},Ec={value:1},E3="group",l$="rect",RS="rule",yge="symbol",lg="text";function Ov(e){return e.type=E3,e.interactive=e.interactive||!1,e}function Xu(e,n){const t=(o,f)=>nf(e[o],nf(n[o],f));return t.isVertical=o=>rge===nf(e.direction,n.direction||(o?n.symbolDirection:n.gradientDirection)),t.gradientLength=()=>nf(e.gradientLength,n.gradientLength||n.gradientWidth),t.gradientThickness=()=>nf(e.gradientThickness,n.gradientThickness||n.gradientHeight),t.entryColumns=()=>nf(e.columns,nf(n.columns,+t.isVertical(!0))),t}function u$(e,n){const t=n&&(n.update&&n.update[e]||n.enter&&n.enter[e]);return t&&t.signal?t:t?t.value:null}function vge(e,n,t){const o=n.config.style[t];return o&&o[e]}function S3(e,n,t){return`item.anchor === '${ige}' ? ${e} : item.anchor === '${oge}' ? ${n} : ${t}`}const zS=S3(ri(y1),ri(v1),ri(s$));function xge(e){const n=e("tickBand");let t=e("tickOffset"),o,f;return n?n.signal?(o={signal:`(${n.signal}) === 'extent' ? 1 : 0.5`},f={signal:`(${n.signal}) === 'extent'`},Si(t)||(t={signal:`(${n.signal}) === 'extent' ? 0 : ${t}`})):n==="extent"?(o=1,f=!0,t=0):(o=.5,f=!1):(o=e("bandPosition"),f=e("tickExtra")),{extra:f,band:o,offset:t}}function c$(e,n){return n?e?Si(e)?Object.assign({},e,{offset:c$(e.offset,n)}):{value:e,offset:n}:n:e}function dc(e,n){return n?(e.name=n.name,e.style=n.style||e.style,e.interactive=!!n.interactive,e.encode=m1(e.encode,n,wx)):e.interactive=!1,e}function bge(e,n,t,o){const f=Xu(e,t),r=f.isVertical(),a=f.gradientThickness(),l=f.gradientLength();let c,i,s,u,h;r?(i=[0,1],s=[0,0],u=a,h=l):(i=[0,0],s=[1,0],u=l,h=a);const d={enter:c={opacity:$a,x:$a,y:$a,width:ul(u),height:ul(h)},update:Ea({},c,{opacity:Ec,fill:{gradient:n,start:i,stop:s}}),exit:{opacity:$a}};return Ol(d,{stroke:f("gradientStrokeColor"),strokeWidth:f("gradientStrokeWidth")},{opacity:f("gradientOpacity")}),dc({type:l$,role:Wpe,encode:d},o)}function _ge(e,n,t,o,f){const r=Xu(e,t),a=r.isVertical(),l=r.gradientThickness(),c=r.gradientLength();let i,s,u,h,d="";a?(i="y",u="y2",s="x",h="width",d="1-"):(i="x",u="x2",s="y",h="height");const m={opacity:$a,fill:{scale:n,field:Mc}};m[i]={signal:d+"datum."+$m,mult:c},m[s]=$a,m[u]={signal:d+"datum."+lge,mult:c},m[h]=ul(l);const p={enter:m,update:Ea({},m,{opacity:Ec}),exit:{opacity:$a}};return Ol(p,{stroke:r("gradientStrokeColor"),strokeWidth:r("gradientStrokeWidth")},{opacity:r("gradientOpacity")}),dc({type:l$,role:Hpe,key:Mc,from:f,encode:p},o)}const wge=`datum.${$m}<=0?"${y1}":datum.${$m}>=1?"${v1}":"${s$}"`,Age=`datum.${$m}<=0?"${dp}":datum.${$m}>=1?"${kf}":"${age}"`;function fO(e,n,t,o){const f=Xu(e,n),r=f.isVertical(),a=ul(f.gradientThickness()),l=f.gradientLength();let c=f("labelOverlap"),i,s,u,h,d="";const m={enter:i={opacity:$a},update:s={opacity:Ec,text:{field:PS}},exit:{opacity:$a}};return Ol(m,{fill:f("labelColor"),fillOpacity:f("labelOpacity"),font:f("labelFont"),fontSize:f("labelFontSize"),fontStyle:f("labelFontStyle"),fontWeight:f("labelFontWeight"),limit:nf(e.labelLimit,n.gradientLabelLimit)}),r?(i.align={value:"left"},i.baseline=s.baseline={signal:Age},u="y",h="x",d="1-"):(i.align=s.align={signal:wge},i.baseline={value:"top"},u="x",h="y"),i[u]=s[u]={signal:d+"datum."+$m,mult:l},i[h]=s[h]=a,a.offset=nf(e.labelOffset,n.gradientLabelOffset)||0,c=c?{separation:f("labelSeparation"),method:c,order:"datum."+pT}:void 0,dc({type:lg,role:HU,style:_x,key:Mc,from:o,encode:m,overlap:c},t)}function kge(e,n,t,o,f){const r=Xu(e,n),a=t.entries,l=!!(a&&a.interactive),c=a?a.name:void 0,i=r("clipHeight"),s=r("symbolOffset"),u={data:"value"},h=`(${f}) ? datum.${sge} : datum.${mT}`,d=i?ul(i):{field:mT},m=`datum.${pT}`,p=`max(1, ${f})`;let g,y,v,x,_;d.mult=.5,g={enter:y={opacity:$a,x:{signal:h,mult:.5,offset:s},y:d},update:v={opacity:Ec,x:y.x,y:y.y},exit:{opacity:$a}};let A=null,b=null;e.fill||(A=n.symbolBaseFillColor,b=n.symbolBaseStrokeColor),Ol(g,{fill:r("symbolFillColor",A),shape:r("symbolType"),size:r("symbolSize"),stroke:r("symbolStrokeColor",b),strokeDash:r("symbolDash"),strokeDashOffset:r("symbolDashOffset"),strokeWidth:r("symbolStrokeWidth")},{opacity:r("symbolOpacity")}),FS.forEach(T=>{e[T]&&(v[T]=y[T]={scale:e[T],field:Mc})});const k=dc({type:yge,role:Ype,key:Mc,from:u,clip:i?!0:void 0,encode:g},t.symbols),w=ul(s);w.offset=r("labelOffset"),g={enter:y={opacity:$a,x:{signal:h,offset:w},y:d},update:v={opacity:Ec,text:{field:PS},x:y.x,y:y.y},exit:{opacity:$a}},Ol(g,{align:r("labelAlign"),baseline:r("labelBaseline"),fill:r("labelColor"),fillOpacity:r("labelOpacity"),font:r("labelFont"),fontSize:r("labelFontSize"),fontStyle:r("labelFontStyle"),fontWeight:r("labelFontWeight"),limit:r("labelLimit")});const M=dc({type:lg,role:HU,style:_x,key:Mc,from:u,encode:g},t.labels);return g={enter:{noBound:{value:!i},width:$a,height:i?ul(i):$a,opacity:$a},exit:{opacity:$a},update:v={opacity:Ec,row:{signal:null},column:{signal:null}}},r.isVertical(!0)?(x=`ceil(item.mark.items.length / ${p})`,v.row.signal=`${m}%${x}`,v.column.signal=`floor(${m} / ${x})`,_={field:["row",m]}):(v.row.signal=`floor(${m} / ${p})`,v.column.signal=`${m} % ${p}`,_={field:m}),v.column.signal=`(${f})?${v.column.signal}:${m}`,o={facet:{data:o,name:"value",groupby:pT}},Ov({role:LS,from:o,encode:m1(g,a,wx),marks:[k,M],name:c,interactive:l,sort:_})}function Tge(e,n){const t=Xu(e,n);return{align:t("gridAlign"),columns:t.entryColumns(),center:{row:!0,column:!1},padding:{row:t("rowPadding"),column:t("columnPadding")}}}const NS='item.orient === "left"',BS='item.orient === "right"',C3=`(${NS} || ${BS})`,Mge=`datum.vgrad && ${C3}`,Ege=S3('"top"','"bottom"','"middle"'),Sge=S3('"right"','"left"','"center"'),Cge=`datum.vgrad && ${BS} ? (${Sge}) : (${C3} && !(datum.vgrad && ${NS})) ? "left" : ${zS}`,Lge=`item._anchor || (${C3} ? "middle" : "start")`,Dge=`${Mge} ? (${NS} ? -90 : 90) : 0`,Oge=`${C3} ? (datum.vgrad ? (${BS} ? "bottom" : "top") : ${Ege}) : "top"`;function Pge(e,n,t,o){const f=Xu(e,n),r={enter:{opacity:$a},update:{opacity:Ec,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:$a}};return Ol(r,{orient:f("titleOrient"),_anchor:f("titleAnchor"),anchor:{signal:Lge},angle:{signal:Dge},align:{signal:Cge},baseline:{signal:Oge},text:e.title,fill:f("titleColor"),fillOpacity:f("titleOpacity"),font:f("titleFont"),fontSize:f("titleFontSize"),fontStyle:f("titleFontStyle"),fontWeight:f("titleFontWeight"),limit:f("titleLimit"),lineHeight:f("titleLineHeight")},{align:f("titleAlign"),baseline:f("titleBaseline")}),dc({type:lg,role:Xpe,style:IS,from:o,encode:r},t)}function Ige(e,n){let t;return Si(e)&&(e.signal?t=e.signal:e.path?t="pathShape("+hO(e.path)+")":e.sphere&&(t="geoShape("+hO(e.sphere)+', {type: "Sphere"})')),t?n.signalRef(t):!!e}function hO(e){return Si(e)&&e.signal?e.signal:ri(e)}function f$(e){const n=e.role||"";return!n.indexOf("axis")||!n.indexOf("legend")||!n.indexOf("title")?n:e.type===E3?LS:n||SS}function Fge(e){return{marktype:e.type,name:e.name||void 0,role:e.role||f$(e),zindex:+e.zindex||void 0,aria:e.aria,description:e.description}}function Rge(e,n){return e&&e.signal?n.signalRef(e.signal):e!==!1}function jS(e,n){const t=_R(e.type);t||Pr("Unrecognized transform type: "+ri(e.type));const o=k3(t.type.toLowerCase(),null,h$(t,e,n));return e.signal&&n.addSignal(e.signal,n.proxy(o)),o.metadata=t.metadata||{},o}function h$(e,n,t){const o={},f=e.params.length;for(let r=0;rdO(e,r,t)):dO(e,f,t)}function dO(e,n,t){const o=e.type;if(Qs(n))return gO(o)?Pr("Expression references can not be signals."):lA(o)?t.fieldRef(n):mO(o)?t.compareRef(n):t.signalRef(n.signal);{const f=e.expr||lA(o);return f&&jge(n)?t.exprRef(n.expr,n.as):f&&Uge(n)?Lv(n.field,n.as):gO(o)?ch(n,t):$ge(o)?Hi(t.getData(n).values):lA(o)?Lv(n):mO(o)?t.compareRef(n):n}}function Nge(e,n,t){return Li(n.from)||Pr('Lookup "from" parameter must be a string literal.'),t.getData(n.from).lookupRef(t,n.key)}function Bge(e,n,t){const o=n[e.name];return e.array?(zr(o)||Pr("Expected an array of sub-parameters. Instead: "+ri(o)),o.map(f=>pO(e,f,t))):pO(e,o,t)}function pO(e,n,t){const o=e.params.length;let f;for(let a=0;ae&&e.expr,Uge=e=>e&&e.field,$ge=e=>e==="data",gO=e=>e==="expr",lA=e=>e==="field",mO=e=>e==="compare";function Vge(e,n,t){let o,f,r,a,l;return e?(o=e.facet)&&(n||Pr("Only group marks can be faceted."),o.field!=null?a=l=D2(o,t):(e.data?l=Hi(t.getData(e.data).aggregate):(r=jS(Ea({type:"aggregate",groupby:Ti(o.groupby)},o.aggregate),t),r.params.key=t.keyRef(o.groupby),r.params.pulse=D2(o,t),a=l=Hi(t.add(r))),f=t.keyRef(o.groupby,!0))):a=Hi(t.add(Af(null,[{}]))),a||(a=D2(e,t)),{key:f,pulse:a,parent:l}}function D2(e,n){return e.$ref?e:e.data&&e.data.$ref?e.data:Hi(n.getData(e.data).output)}function U0(e,n,t,o,f){this.scope=e,this.input=n,this.output=t,this.values=o,this.aggregate=f,this.index={}}U0.fromEntries=function(e,n){const t=n.length,o=n[t-1],f=n[t-2];let r=n[0],a=null,l=1;for(r&&r.type==="load"&&(r=n[1]),e.add(n[0]);lu??"null").join(",")+"),0)",s=ch(i,n);c.update=s.$expr,c.params=s.$params}function L3(e,n){const t=f$(e),o=e.type===E3,f=e.from&&e.from.facet,r=e.overlap;let a=e.layout||t===LS||t===CS,l,c,i,s,u,h,d;const m=t===SS||a||f,p=Vge(e.from,o,n);c=n.add(T0e({key:p.key||(e.key?Lv(e.key):void 0),pulse:p.pulse,clean:!o}));const g=Hi(c);c=i=n.add(Af({pulse:g})),c=n.add(O0e({markdef:Fge(e),interactive:Rge(e.interactive,n),clip:Ige(e.clip,n),context:{$context:!0},groups:n.lookup(),parent:n.signals.parent?n.signalRef("parent"):null,index:n.markpath(),pulse:Hi(c)}));const y=Hi(c);c=s=n.add(QU(XU(e.encode,e.type,t,e.style,n,{mod:!1,pulse:y}))),c.params.parent=n.encode(),e.transform&&e.transform.forEach(b=>{const k=jS(b,n),w=k.metadata;(w.generates||w.changes)&&Pr("Mark transforms should not generate new data."),w.nomod||(s.params.mod=!0),k.params.pulse=Hi(c),n.add(c=k)}),e.sort&&(c=n.add(U0e({sort:n.compareRef(e.sort),pulse:Hi(c)})));const v=Hi(c);(f||a)&&(a=n.add(n$({layout:n.objectProperty(e.layout),legends:n.legends,mark:y,pulse:v})),h=Hi(a));const x=n.add(KU({mark:y,pulse:h||v}));d=Hi(x),o&&(m&&(l=n.operators,l.pop(),a&&l.pop()),n.pushState(v,h||d,g),f?qge(e,n,p):m?Hge(e,n,p):n.parse(e),n.popState(),m&&(a&&l.push(a),l.push(x))),r&&(d=Gge(r,d,n));const _=n.add(t$({pulse:d})),A=n.add(sg({pulse:Hi(_)},void 0,n.parent()));e.name!=null&&(u=e.name,n.addData(u,new U0(n,i,_,A)),e.on&&e.on.forEach(b=>{(b.insert||b.remove||b.toggle)&&Pr("Marks only support modify triggers."),p$(b,n,u)}))}function Gge(e,n,t){const o=e.method,f=e.bound,r=e.separation,a={separation:Qs(r)?t.signalRef(r.signal):r,method:Qs(o)?t.signalRef(o.signal):o,pulse:n};if(e.order&&(a.sort=t.compareRef({field:e.order})),f){const l=f.tolerance;a.boundTolerance=Qs(l)?t.signalRef(l.signal):+l,a.boundScale=t.scaleRef(f.scale),a.boundOrient=f.orient}return Hi(t.add(F0e(a)))}function Wge(e,n){const t=n.config.legend,o=e.encode||{},f=Xu(e,t),r=o.legend||{},a=r.name||void 0,l=r.interactive,c=r.style,i={};let s=0,u,h,d;FS.forEach(x=>e[x]?(i[x]=e[x],s=s||e[x]):0),s||Pr("Missing valid scale for legend.");const m=Yge(e,n.scaleType(s)),p={title:e.title!=null,scales:i,type:m,vgrad:m!=="symbol"&&f.isVertical()},g=Hi(n.add(Af(null,[p]))),y={enter:{x:{value:0},y:{value:0}}},v=Hi(n.add(L0e(h={type:m,scale:n.scaleRef(s),count:n.objectProperty(f("tickCount")),limit:n.property(f("symbolLimit")),values:n.objectProperty(e.values),minstep:n.property(e.tickMinStep),formatType:n.property(e.formatType),formatSpecifier:n.property(e.format)})));return m===L2?(d=[bge(e,s,t,o.gradient),fO(e,t,o.labels,v)],h.count=h.count||n.signalRef(`max(2,2*floor((${T0(f.gradientLength())})/100))`)):m===gT?d=[_ge(e,s,t,o.gradient,v),fO(e,t,o.labels,v)]:(u=Tge(e,t),d=[kge(e,t,o,v,T0(u.columns))],h.size=Jge(e,n,d[0].marks)),d=[Ov({role:Gpe,from:g,encode:y,marks:d,layout:u,interactive:l})],p.title&&d.push(Pge(e,t,o.title,g)),L3(Ov({role:qpe,from:g,encode:m1(Zge(f,e,t),r,wx),marks:d,aria:f("aria"),description:f("description"),zindex:f("zindex"),name:a,interactive:l,style:c}),n)}function Yge(e,n){let t=e.type||cO;return!e.type&&Xge(e)===1&&(e.fill||e.stroke)&&(t=zM(n)?L2:sk(n)?gT:cO),t!==L2?t:sk(n)?gT:L2}function Xge(e){return FS.reduce((n,t)=>n+(e[t]?1:0),0)}function Zge(e,n,t){const o={enter:{},update:{}};return Ol(o,{orient:e("orient"),offset:e("offset"),padding:e("padding"),titlePadding:e("titlePadding"),cornerRadius:e("cornerRadius"),fill:e("fillColor"),stroke:e("strokeColor"),strokeWidth:t.strokeWidth,strokeDash:t.strokeDash,x:e("legendX"),y:e("legendY"),format:n.format,formatType:n.formatType}),o}function Jge(e,n,t){const o=T0(vO("size",e,t)),f=T0(vO("strokeWidth",e,t)),r=T0(Kge(t[1].encode,n,_x));return ch(`max(ceil(sqrt(${o})+${f}),${r})`,n)}function vO(e,n,t){return n[e]?`scale("${n[e]}",datum)`:u$(e,t[0].encode)}function Kge(e,n,t){return u$("fontSize",e)||vge("fontSize",n,t)}const Qge=`item.orient==="${y1}"?-90:item.orient==="${v1}"?90:0`;function eme(e,n){e=Li(e)?{text:e}:e;const t=Xu(e,n.config.title),o=e.encode||{},f=o.group||{},r=f.name||void 0,a=f.interactive,l=f.style,c=[],i={},s=Hi(n.add(Af(null,[i])));return c.push(rme(e,t,tme(e),s)),e.subtitle&&c.push(ime(e,t,o.subtitle,s)),L3(Ov({role:Zpe,from:s,encode:nme(t,f),marks:c,aria:t("aria"),description:t("description"),zindex:t("zindex"),name:r,interactive:a,style:l}),n)}function tme(e){const n=e.encode;return n&&n.title||Ea({name:e.name,interactive:e.interactive,style:e.style},n)}function nme(e,n){const t={enter:{},update:{}};return Ol(t,{orient:e("orient"),anchor:e("anchor"),align:{signal:zS},angle:{signal:Qge},limit:e("limit"),frame:e("frame"),offset:e("offset")||0,padding:e("subtitlePadding")}),m1(t,n,wx)}function rme(e,n,t,o){const f={value:0},r=e.text,a={enter:{opacity:f},update:{opacity:{value:1}},exit:{opacity:f}};return Ol(a,{text:r,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:n("dx"),dy:n("dy"),fill:n("color"),font:n("font"),fontSize:n("fontSize"),fontStyle:n("fontStyle"),fontWeight:n("fontWeight"),lineHeight:n("lineHeight")},{align:n("align"),angle:n("angle"),baseline:n("baseline")}),dc({type:lg,role:Jpe,style:uge,from:o,encode:a},t)}function ime(e,n,t,o){const f={value:0},r=e.subtitle,a={enter:{opacity:f},update:{opacity:{value:1}},exit:{opacity:f}};return Ol(a,{text:r,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:n("dx"),dy:n("dy"),fill:n("subtitleColor"),font:n("subtitleFont"),fontSize:n("subtitleFontSize"),fontStyle:n("subtitleFontStyle"),fontWeight:n("subtitleFontWeight"),lineHeight:n("subtitleLineHeight")},{align:n("align"),angle:n("angle"),baseline:n("baseline")}),dc({type:lg,role:Kpe,style:cge,from:o,encode:a},t)}function ame(e,n){const t=[];e.transform&&e.transform.forEach(o=>{t.push(jS(o,n))}),e.on&&e.on.forEach(o=>{p$(o,n,e.name)}),n.addDataPipeline(e.name,ome(e,n,t))}function ome(e,n,t){const o=[];let f=null,r=!1,a=!1,l,c,i,s,u;for(e.values?Qs(e.values)||S2(e.format)?(o.push(xO(n,e)),o.push(f=Xp())):o.push(f=Xp({$ingest:e.values,$format:e.format})):e.url?S2(e.url)||S2(e.format)?(o.push(xO(n,e)),o.push(f=Xp())):o.push(f=Xp({$request:e.url,$format:e.format})):e.source&&(f=l=Ti(e.source).map(h=>Hi(n.getData(h).output)),o.push(null)),c=0,i=t.length;ce===dp||e===kf,D3=(e,n,t)=>Qs(e)?cme(e.signal,n,t):e===y1||e===kf?n:t,cl=(e,n,t)=>Qs(e)?lme(e.signal,n,t):g$(e)?n:t,pf=(e,n,t)=>Qs(e)?ume(e.signal,n,t):g$(e)?t:n,m$=(e,n,t)=>Qs(e)?fme(e.signal,n,t):e===kf?{value:n}:{value:t},sme=(e,n,t)=>Qs(e)?hme(e.signal,n,t):e===v1?{value:n}:{value:t},lme=(e,n,t)=>y$(`${e} === '${kf}' || ${e} === '${dp}'`,n,t),ume=(e,n,t)=>y$(`${e} !== '${kf}' && ${e} !== '${dp}'`,n,t),cme=(e,n,t)=>US(`${e} === '${y1}' || ${e} === '${kf}'`,n,t),fme=(e,n,t)=>US(`${e} === '${kf}'`,n,t),hme=(e,n,t)=>US(`${e} === '${v1}'`,n,t),y$=(e,n,t)=>(n=n!=null?ul(n):n,t=t!=null?ul(t):t,bO(n)&&bO(t)?(n=n?n.signal||ri(n.value):null,t=t?t.signal||ri(t.value):null,{signal:`${e} ? (${n}) : (${t})`}):[Ea({test:e},n)].concat(t||[])),bO=e=>e==null||Object.keys(e).length===1,US=(e,n,t)=>({signal:`${e} ? (${pm(n)}) : (${pm(t)})`}),dme=(e,n,t,o,f)=>({signal:(o!=null?`${e} === '${y1}' ? (${pm(o)}) : `:"")+(t!=null?`${e} === '${dp}' ? (${pm(t)}) : `:"")+(f!=null?`${e} === '${v1}' ? (${pm(f)}) : `:"")+(n!=null?`${e} === '${kf}' ? (${pm(n)}) : `:"")+"(null)"}),pm=e=>Qs(e)?e.signal:e==null?null:ri(e),pme=(e,n)=>n===0?0:Qs(e)?{signal:`(${e.signal}) * ${n}`}:{value:e*n},vm=(e,n)=>{const t=e.signal;return t&&t.endsWith("(null)")?{signal:t.slice(0,-6)+n.signal}:e};function Qg(e,n,t,o){let f;if(n&&Yi(n,e))return n[e];if(Yi(t,e))return t[e];if(e.startsWith("title")){switch(e){case"titleColor":f="fill";break;case"titleFont":case"titleFontSize":case"titleFontWeight":f=e[5].toLowerCase()+e.slice(6)}return o[IS][f]}else if(e.startsWith("label")){switch(e){case"labelColor":f="fill";break;case"labelFont":case"labelFontSize":f=e[5].toLowerCase()+e.slice(6)}return o[_x][f]}return null}function _O(e){const n={};for(const t of e)if(t)for(const o in t)n[o]=1;return Object.keys(n)}function gme(e,n){var t=n.config,o=t.style,f=t.axis,r=n.scaleType(e.scale)==="band"&&t.axisBand,a=e.orient,l,c,i;if(Qs(a)){const u=_O([t.axisX,t.axisY]),h=_O([t.axisTop,t.axisBottom,t.axisLeft,t.axisRight]);l={};for(i of u)l[i]=cl(a,Qg(i,t.axisX,f,o),Qg(i,t.axisY,f,o));c={};for(i of h)c[i]=dme(a.signal,Qg(i,t.axisTop,f,o),Qg(i,t.axisBottom,f,o),Qg(i,t.axisLeft,f,o),Qg(i,t.axisRight,f,o))}else l=a===kf||a===dp?t.axisX:t.axisY,c=t["axis"+a[0].toUpperCase()+a.slice(1)];return l||c||r?Ea({},f,l,c,r):f}function mme(e,n,t,o){const f=Xu(e,n),r=e.orient;let a,l;const c={enter:a={opacity:$a},update:l={opacity:Ec},exit:{opacity:$a}};Ol(c,{stroke:f("domainColor"),strokeCap:f("domainCap"),strokeDash:f("domainDash"),strokeDashOffset:f("domainDashOffset"),strokeWidth:f("domainWidth"),strokeOpacity:f("domainOpacity")});const i=wO(e,0),s=wO(e,1);return a.x=l.x=cl(r,i,$a),a.x2=l.x2=cl(r,s),a.y=l.y=pf(r,i,$a),a.y2=l.y2=pf(r,s),dc({type:RS,role:Bpe,from:o,encode:c},t)}function wO(e,n){return{scale:e.scale,range:n}}function yme(e,n,t,o,f){const r=Xu(e,n),a=e.orient,l=e.gridScale,c=D3(a,1,-1),i=vme(e.offset,c);let s,u,h;const d={enter:s={opacity:$a},update:h={opacity:Ec},exit:u={opacity:$a}};Ol(d,{stroke:r("gridColor"),strokeCap:r("gridCap"),strokeDash:r("gridDash"),strokeDashOffset:r("gridDashOffset"),strokeOpacity:r("gridOpacity"),strokeWidth:r("gridWidth")});const m={scale:e.scale,field:Mc,band:f.band,extra:f.extra,offset:f.offset,round:r("tickRound")},p=cl(a,{signal:"height"},{signal:"width"}),g=l?{scale:l,range:0,mult:c,offset:i}:{value:0,offset:i},y=l?{scale:l,range:1,mult:c,offset:i}:Ea(p,{mult:c,offset:i});return s.x=h.x=cl(a,m,g),s.y=h.y=pf(a,m,g),s.x2=h.x2=pf(a,y),s.y2=h.y2=cl(a,y),u.x=cl(a,m),u.y=pf(a,m),dc({type:RS,role:jpe,key:Mc,from:o,encode:d},t)}function vme(e,n){if(n!==1)if(!Si(e))e=Qs(n)?{signal:`(${n.signal}) * (${e||0})`}:n*(e||0);else{let t=e=Ea({},e);for(;t.mult!=null;)if(Si(t.mult))t=t.mult=Ea({},t.mult);else return t.mult=Qs(n)?{signal:`(${t.mult}) * (${n.signal})`}:t.mult*n,e;t.mult=n}return e}function xme(e,n,t,o,f,r){const a=Xu(e,n),l=e.orient,c=D3(l,-1,1);let i,s,u;const h={enter:i={opacity:$a},update:u={opacity:Ec},exit:s={opacity:$a}};Ol(h,{stroke:a("tickColor"),strokeCap:a("tickCap"),strokeDash:a("tickDash"),strokeDashOffset:a("tickDashOffset"),strokeOpacity:a("tickOpacity"),strokeWidth:a("tickWidth")});const d=ul(f);d.mult=c;const m={scale:e.scale,field:Mc,band:r.band,extra:r.extra,offset:r.offset,round:a("tickRound")};return u.y=i.y=cl(l,$a,m),u.y2=i.y2=cl(l,d),s.x=cl(l,m),u.x=i.x=pf(l,$a,m),u.x2=i.x2=pf(l,d),s.y=pf(l,m),dc({type:RS,role:$pe,key:Mc,from:o,encode:h},t)}function uA(e,n,t,o,f){return{signal:'flush(range("'+e+'"), scale("'+e+'", datum.value), '+n+","+t+","+o+","+f+")"}}function bme(e,n,t,o,f,r){const a=Xu(e,n),l=e.orient,c=e.scale,i=D3(l,-1,1),s=T0(a("labelFlush")),u=T0(a("labelFlushOffset")),h=a("labelAlign"),d=a("labelBaseline");let m=s===0||!!s,p;const g=ul(f);g.mult=i,g.offset=ul(a("labelPadding")||0),g.offset.mult=i;const y={scale:c,field:Mc,band:.5,offset:c$(r.offset,a("labelOffset"))},v=cl(l,m?uA(c,s,'"left"','"right"','"center"'):{value:"center"},sme(l,"left","right")),x=cl(l,m$(l,"bottom","top"),m?uA(c,s,'"top"','"bottom"','"middle"'):{value:"middle"}),_=uA(c,s,`-(${u})`,u,0);m=m&&u;const A={opacity:$a,x:cl(l,y,g),y:pf(l,y,g)},b={enter:A,update:p={opacity:Ec,text:{field:PS},x:A.x,y:A.y,align:v,baseline:x},exit:{opacity:$a,x:A.x,y:A.y}};Ol(b,{dx:!h&&m?cl(l,_):null,dy:!d&&m?pf(l,_):null}),Ol(b,{angle:a("labelAngle"),fill:a("labelColor"),fillOpacity:a("labelOpacity"),font:a("labelFont"),fontSize:a("labelFontSize"),fontWeight:a("labelFontWeight"),fontStyle:a("labelFontStyle"),limit:a("labelLimit"),lineHeight:a("labelLineHeight")},{align:h,baseline:d});const k=a("labelBound");let w=a("labelOverlap");return w=w||k?{separation:a("labelSeparation"),method:w,order:"datum.index",bound:k?{scale:c,orient:l,tolerance:k}:null}:void 0,p.align!==v&&(p.align=vm(p.align,v)),p.baseline!==x&&(p.baseline=vm(p.baseline,x)),dc({type:lg,role:Upe,style:_x,key:Mc,from:o,encode:b,overlap:w},t)}function _me(e,n,t,o){const f=Xu(e,n),r=e.orient,a=D3(r,-1,1);let l,c;const i={enter:l={opacity:$a,anchor:ul(f("titleAnchor",null)),align:{signal:zS}},update:c=Ea({},l,{opacity:Ec,text:ul(e.title)}),exit:{opacity:$a}},s={signal:`lerp(range("${e.scale}"), ${S3(0,1,.5)})`};return c.x=cl(r,s),c.y=pf(r,s),l.angle=cl(r,$a,pme(a,90)),l.baseline=cl(r,m$(r,dp,kf),{value:dp}),c.angle=l.angle,c.baseline=l.baseline,Ol(i,{fill:f("titleColor"),fillOpacity:f("titleOpacity"),font:f("titleFont"),fontSize:f("titleFontSize"),fontStyle:f("titleFontStyle"),fontWeight:f("titleFontWeight"),limit:f("titleLimit"),lineHeight:f("titleLineHeight")},{align:f("titleAlign"),angle:f("titleAngle"),baseline:f("titleBaseline")}),wme(f,r,i,t),i.update.align=vm(i.update.align,l.align),i.update.angle=vm(i.update.angle,l.angle),i.update.baseline=vm(i.update.baseline,l.baseline),dc({type:lg,role:Vpe,style:IS,from:o,encode:i},t)}function wme(e,n,t,o){const f=(l,c)=>l!=null?(t.update[c]=vm(ul(l),t.update[c]),!1):!om(c,o),r=f(e("titleX"),"x"),a=f(e("titleY"),"y");t.enter.auto=a===r?ul(a):cl(n,ul(a),ul(r))}function Ame(e,n){const t=gme(e,n),o=e.encode||{},f=o.axis||{},r=f.name||void 0,a=f.interactive,l=f.style,c=Xu(e,t),i=xge(c),s={scale:e.scale,ticks:!!c("ticks"),labels:!!c("labels"),grid:!!c("grid"),domain:!!c("domain"),title:e.title!=null},u=Hi(n.add(Af({},[s]))),h=Hi(n.add(k0e({scale:n.scaleRef(e.scale),extra:n.property(i.extra),count:n.objectProperty(e.tickCount),values:n.objectProperty(e.values),minstep:n.property(e.tickMinStep),formatType:n.property(e.formatType),formatSpecifier:n.property(e.format)}))),d=[];let m;return s.grid&&d.push(yme(e,t,o.grid,h,i)),s.ticks&&(m=c("tickSize"),d.push(xme(e,t,o.ticks,h,m,i))),s.labels&&(m=s.ticks?m:0,d.push(bme(e,t,o.labels,h,m,i))),s.domain&&d.push(mme(e,t,o.domain,u)),s.title&&d.push(_me(e,t,o.title,u)),L3(Ov({role:Npe,from:u,encode:m1(kme(c,e),f,wx),marks:d,aria:c("aria"),description:c("description"),zindex:c("zindex"),name:r,interactive:a,style:l}),n)}function kme(e,n){const t={enter:{},update:{}};return Ol(t,{orient:e("orient"),offset:e("offset")||0,position:nf(n.position,0),titlePadding:e("titlePadding"),minExtent:e("minExtent"),maxExtent:e("maxExtent"),range:{signal:`abs(span(range("${n.scale}")))`},translate:e("translate"),format:n.format,formatType:n.formatType}),t}function v$(e,n,t){const o=Ti(e.signals),f=Ti(e.scales);return t||o.forEach(r=>ZU(r,n)),Ti(e.projections).forEach(r=>nge(r,n)),f.forEach(r=>q0e(r,n)),Ti(e.data).forEach(r=>ame(r,n)),f.forEach(r=>H0e(r,n)),(t||o).forEach(r=>A0e(r,n)),Ti(e.axes).forEach(r=>Ame(r,n)),Ti(e.marks).forEach(r=>L3(r,n)),Ti(e.legends).forEach(r=>Wge(r,n)),e.title&&eme(e.title,n),n.parseLambdas(),n}const Tme=e=>m1({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},e);function Mme(e,n){const t=n.config,o=Hi(n.root=n.add(X_())),f=Eme(e,t);f.forEach(i=>ZU(i,n)),n.description=e.description||t.description,n.eventConfig=t.events,n.legends=n.objectProperty(t.legend&&t.legend.layout),n.locale=t.locale;const r=n.add(Af()),a=n.add(QU(XU(Tme(e.encode),E3,CS,e.style,n,{pulse:Hi(r)}))),l=n.add(n$({layout:n.objectProperty(e.layout),legends:n.legends,autosize:n.signalRef("autosize"),mark:o,pulse:Hi(a)}));n.operators.pop(),n.pushState(Hi(a),Hi(l),null),v$(e,n,f),n.operators.push(l);let c=n.add(KU({mark:o,pulse:Hi(l)}));return c=n.add(t$({pulse:Hi(c)})),c=n.add(sg({pulse:Hi(c)})),n.addData("root",new U0(n,r,r,c)),n}function gy(e,n){return n&&n.signal?{name:e,update:n.signal}:{name:e,value:n}}function Eme(e,n){const t=a=>nf(e[a],n[a]),o=[gy("background",t("background")),gy("autosize",Fpe(t("autosize"))),gy("padding",zpe(t("padding"))),gy("width",t("width")||0),gy("height",t("height")||0)],f=o.reduce((a,l)=>(a[l.name]=l,a),{}),r={};return Ti(e.signals).forEach(a=>{Yi(f,a.name)?a=Ea(f[a.name],a):o.push(a),r[a.name]=a}),Ti(n.signals).forEach(a=>{!Yi(r,a.name)&&!Yi(f,a.name)&&o.push(a)}),o}function x$(e,n){this.config=e||{},this.options=n||{},this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.eventConfig=null,this.locale=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function AO(e){this.config=e.config,this.options=e.options,this.legends=e.legends,this.field=Object.create(e.field),this.signals=Object.create(e.signals),this.lambdas=Object.create(e.lambdas),this.scales=Object.create(e.scales),this.events=Object.create(e.events),this.data=Object.create(e.data),this.streams=[],this.updates=[],this.operators=[],this._id=0,this._subid=++e._nextsub[0],this._nextsub=e._nextsub,this._parent=e._parent.slice(),this._encode=e._encode.slice(),this._lookup=e._lookup.slice(),this._markpath=e._markpath}x$.prototype=AO.prototype={parse(e){return v$(e,this)},fork(){return new AO(this)},isSubscope(){return this._subid>0},toRuntime(){return this.finish(),{description:this.description,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig,locale:this.locale}},id(){return(this._subid?this._subid+":":0)+this._id++},add(e){return this.operators.push(e),e.id=this.id(),e.refs&&(e.refs.forEach(n=>{n.$ref=e.id}),e.refs=null),e},proxy(e){const n=e instanceof cT?Hi(e):e;return this.add(N0e({value:n}))},addStream(e){return this.streams.push(e),e.id=this.id(),e},addUpdate(e){return this.updates.push(e),e},finish(){let e,n;this.root&&(this.root.root=!0);for(e in this.signals)this.signals[e].signal=e;for(e in this.scales)this.scales[e].scale=e;function t(o,f,r){let a,l;o&&(a=o.data||(o.data={}),l=a[f]||(a[f]=[]),l.push(r))}for(e in this.data){n=this.data[e],t(n.input,e,"input"),t(n.output,e,"output"),t(n.values,e,"values");for(const o in n.index)t(n.index[o],e,"index:"+o)}return this},pushState(e,n,t){this._encode.push(Hi(this.add(sg({pulse:e})))),this._parent.push(n),this._lookup.push(t?Hi(this.proxy(t)):null),this._markpath.push(-1)},popState(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},parent(){return qa(this._parent)},encode(){return qa(this._encode)},lookup(){return qa(this._lookup)},markpath(){const e=this._markpath;return++e[e.length-1]},fieldRef(e,n){if(Li(e))return Lv(e,n);e.signal||Pr("Unsupported field reference: "+ri(e));const t=e.signal;let o=this.field[t];if(!o){const f={name:this.signalRef(t)};n&&(f.as=n),this.field[t]=o=Hi(this.add(S0e(f)))}return o},compareRef(e){let n=!1;const t=r=>Qs(r)?(n=!0,this.signalRef(r.signal)):d0e(r)?(n=!0,this.exprRef(r.expr)):r,o=Ti(e.field).map(t),f=Ti(e.order).map(t);return n?Hi(this.add(uO({fields:o,orders:f}))):sO(o,f)},keyRef(e,n){let t=!1;const o=r=>Qs(r)?(t=!0,Hi(f[r.signal])):r,f=this.signals;return e=Ti(e).map(o),t?Hi(this.add(C0e({fields:e,flat:n}))):u0e(e,n)},sortRef(e){if(!e)return e;const n=T3(e.op,e.field),t=e.order||c0e;return t.signal?Hi(this.add(uO({fields:n,orders:this.signalRef(t.signal)}))):sO(n,t)},event(e,n){const t=e+":"+n;if(!this.events[t]){const o=this.id();this.streams.push({id:o,source:e,type:n}),this.events[t]=o}return this.events[t]},hasOwnSignal(e){return Yi(this.signals,e)},addSignal(e,n){this.hasOwnSignal(e)&&Pr("Duplicate signal name: "+ri(e));const t=n instanceof cT?n:this.add(X_(n));return this.signals[e]=t},getSignal(e){return this.signals[e]||Pr("Unrecognized signal name: "+ri(e)),this.signals[e]},signalRef(e){return this.signals[e]?Hi(this.signals[e]):(Yi(this.lambdas,e)||(this.lambdas[e]=this.add(X_(null))),Hi(this.lambdas[e]))},parseLambdas(){const e=Object.keys(this.lambdas);for(let n=0,t=e.length;n0?",":"")+(Si(f)?f.signal||$S(f):ri(f))}return t+"]"}function Cme(e){let n="{",t=0,o,f;for(o in e)f=e[o],n+=(++t>1?",":"")+ri(o)+":"+(Si(f)?f.signal||$S(f):ri(f));return n+"}"}function Lme(){const e="sans-serif",o="#4c78a8",f="#000",r="#888",a="#ddd";return{description:"Vega visualization",padding:0,autosize:"pad",background:null,events:{defaults:{allow:["wheel"]}},group:null,mark:null,arc:{fill:o},area:{fill:o},image:null,line:{stroke:o,strokeWidth:2},path:{stroke:o},rect:{fill:o},rule:{stroke:f},shape:{stroke:o},symbol:{fill:o,size:64},text:{fill:f,font:e,fontSize:11},trail:{fill:o,size:2},style:{"guide-label":{fill:f,font:e,fontSize:10},"guide-title":{fill:f,font:e,fontSize:11,fontWeight:"bold"},"group-title":{fill:f,font:e,fontSize:13,fontWeight:"bold"},"group-subtitle":{fill:f,font:e,fontSize:12},point:{size:30,strokeWidth:2,shape:"circle"},circle:{size:30,strokeWidth:2},square:{size:30,strokeWidth:2,shape:"square"},cell:{fill:"transparent",stroke:a}},title:{orient:"top",anchor:"middle",offset:4,subtitlePadding:3},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domain:!0,domainWidth:1,domainColor:r,grid:!1,gridWidth:1,gridColor:a,labels:!0,labelAngle:0,labelLimit:180,labelOffset:0,labelPadding:2,ticks:!0,tickColor:r,tickOffset:0,tickRound:!0,tickSize:5,tickWidth:1,titlePadding:4},axisBand:{tickOffset:-.5},projection:{type:"mercator"},legend:{orient:"right",padding:0,gridAlign:"each",columnPadding:10,rowPadding:2,symbolDirection:"vertical",gradientDirection:"vertical",gradientLength:200,gradientThickness:16,gradientStrokeColor:a,gradientStrokeWidth:0,gradientLabelOffset:2,labelAlign:"left",labelBaseline:"middle",labelLimit:160,labelOffset:4,labelOverlap:!0,symbolLimit:30,symbolType:"circle",symbolSize:100,symbolOffset:0,symbolStrokeWidth:1.5,symbolBaseFillColor:"transparent",symbolBaseStrokeColor:r,titleLimit:180,titleOrient:"top",titlePadding:5,layout:{offset:18,direction:"horizontal",left:{direction:"vertical"},right:{direction:"vertical"}}},range:{category:{scheme:"tableau10"},ordinal:{scheme:"blues"},heatmap:{scheme:"yellowgreenblue"},ramp:{scheme:"blues"},diverging:{scheme:"blueorange",extent:[1,0]},symbol:["circle","square","triangle-up","cross","diamond","triangle-right","triangle-down","triangle-left"]}}}function Dme(e,n,t){return Si(e)||Pr("Input Vega specification must be an object."),n=o6(Lme(),n,e.config),Mme(e,new x$(n,t)).toRuntime()}var Ome="5.22.1";a6(Sm,uee,sae,Bae,kse,vle,Hue,kue,Wue,mce,Mce,Pce);const Pme=Object.freeze(Object.defineProperty({__proto__:null,Bounds:Us,CanvasHandler:hx,CanvasRenderer:u_,DATE:qu,DAY:Vl,DAYOFYEAR:lh,Dataflow:gm,Debug:NI,Error:FI,EventStream:zw,Gradient:gN,GroupItem:t3,HOURS:cc,Handler:fp,Info:zI,Item:e3,MILLISECONDS:vf,MINUTES:fc,MONTH:Wl,Marks:hc,MultiPulse:E6,None:II,Operator:Po,Parameters:Rw,Pulse:Kd,QUARTER:Vu,RenderType:Ud,Renderer:gh,ResourceLoader:GM,SECONDS:Sc,SVGHandler:cE,SVGRenderer:mE,SVGStringRenderer:yE,Scenegraph:lE,TIME_UNITS:y6,Transform:_r,View:RU,WEEK:Js,Warn:RI,YEAR:Ll,accessor:od,accessorFields:OI,accessorName:HY,array:dv,ascending:i6,bandwidthNRD:D6,bin:kR,bootstrapCI:TR,boundClip:uB,boundContext:lx,boundItem:pk,boundMark:IN,boundStroke:ld,changeset:ig,clampRange:hX,codegenExpression:cU,compare:pX,constant:vX,cumulativeLogNormal:z6,cumulativeNormal:Bw,cumulativeUniform:U6,dayofyear:DF,debounce:xX,defaultLocale:w6,definition:_R,densityLogNormal:R6,densityNormal:O6,densityUniform:j6,domChild:Fu,domClear:af,domCreate:Bd,domFind:uE,dotbin:MR,error:l2,expressionFunction:$s,extend:a6,extent:bX,extentIndex:_X,falsy:KY,fastmap:AX,field:e6,flush:kX,font:o3,fontFamily:fx,fontSize:ph,format:u2,formatLocale:H2,formats:T6,hasOwnProperty:l0,id:YY,identity:t6,inferType:cR,inferTypes:fR,ingest:oo,inherits:TX,inrange:MX,interpolate:NM,interpolateColors:Kw,interpolateRange:tN,intersect:aB,intersectBoxLine:cm,intersectPath:WM,intersectPoint:YM,intersectRule:AN,isArray:a1,isBoolean:VI,isDate:qI,isFunction:Mw,isIterable:EX,isNumber:HI,isObject:rp,isRegExp:SX,isString:Qf,isTuple:Iw,key:CX,lerp:LX,lineHeight:up,loader:Ow,locale:lR,logger:eX,lruCache:OX,markup:gE,merge:PX,mergeConfig:n6,multiLineOffset:aE,one:ZY,pad:IX,panLinear:nX,panLog:rX,panPow:iX,panSymlog:aX,parse:Dme,parseExpression:sU,parseSelector:VU,path:r1,pathCurves:VM,pathEqual:cB,pathParse:Pm,pathRectangle:vN,pathRender:vv,pathSymbols:yN,pathTrail:xN,peek:o1,point:l3,projection:RE,quantileLogNormal:N6,quantileNormal:jw,quantileUniform:$6,quantiles:C6,quantizeInterpolator:nN,quarter:cX,quartiles:L6,get random(){return Cc},randomInteger:dQ,randomKDE:I6,randomLCG:hQ,randomLogNormal:SR,randomMixture:CR,randomNormal:P6,randomUniform:LR,read:pR,regressionExp:OR,regressionLinear:V6,regressionLoess:FR,regressionLog:DR,regressionPoly:IR,regressionPow:PR,regressionQuad:q6,renderModule:u3,repeat:Ay,resetDefaultLocale:uK,resetSVGClipId:_N,resetSVGDefIds:Aie,responseType:dR,runtimeContext:AU,sampleCurve:$w,sampleLogNormal:F6,sampleNormal:Nw,sampleUniform:B6,scale:Ka,sceneEqual:vE,sceneFromJSON:RN,scenePickVisit:r_,sceneToJSON:FN,sceneVisit:xf,sceneZOrder:XM,scheme:BM,serializeXML:JN,setRandom:cQ,span:FX,splitAccessPath:QT,stringValue:GI,textMetrics:df,timeBin:YF,timeFloor:NF,timeFormatLocale:pv,timeInterval:c1,timeOffset:UF,timeSequence:qF,timeUnitSpecifier:LF,timeUnits:v6,toBoolean:RX,toDate:NX,toNumber:r6,toSet:jX,toString:BX,transform:wR,transforms:Sm,truncate:UX,truthy:JY,tupleid:Gi,typeParsers:tk,utcFloor:BF,utcInterval:f1,utcOffset:$F,utcSequence:HF,utcdayofyear:IF,utcquarter:fX,utcweek:FF,version:Ome,visitArray:$X,week:OF,writeConfig:Xv,zero:XY,zoomLinear:oX,zoomLog:sX,zoomPow:lX,zoomSymlog:uX},Symbol.toStringTag,{value:"Module"}));function Ime(e,n,t){let o;n.x2&&(n.x?(t&&e.x>e.x2&&(o=e.x,e.x=e.x2,e.x2=o),e.width=e.x2-e.x):e.x=e.x2-(e.width||0)),n.xc&&(e.x=e.xc-(e.width||0)/2),n.y2&&(n.y?(t&&e.y>e.y2&&(o=e.y,e.y=e.y2,e.y2=o),e.height=e.y2-e.y):e.y=e.y2-(e.height||0)),n.yc&&(e.y=e.yc-(e.height||0)/2)}var Fme={NaN:NaN,E:Math.E,LN2:Math.LN2,LN10:Math.LN10,LOG2E:Math.LOG2E,LOG10E:Math.LOG10E,PI:Math.PI,SQRT1_2:Math.SQRT1_2,SQRT2:Math.SQRT2,MIN_VALUE:Number.MIN_VALUE,MAX_VALUE:Number.MAX_VALUE},Rme={"*":(e,n)=>e*n,"+":(e,n)=>e+n,"-":(e,n)=>e-n,"/":(e,n)=>e/n,"%":(e,n)=>e%n,">":(e,n)=>e>n,"<":(e,n)=>ee<=n,">=":(e,n)=>e>=n,"==":(e,n)=>e==n,"!=":(e,n)=>e!=n,"===":(e,n)=>e===n,"!==":(e,n)=>e!==n,"&":(e,n)=>e&n,"|":(e,n)=>e|n,"^":(e,n)=>e^n,"<<":(e,n)=>e<>":(e,n)=>e>>n,">>>":(e,n)=>e>>>n},zme={"+":e=>+e,"-":e=>-e,"~":e=>~e,"!":e=>!e};const Nme=Array.prototype.slice,Zp=(e,n,t)=>{const o=t?t(n[0]):n[0];return o[e].apply(o,Nme.call(n,1))},Bme=(e,n,t,o,f,r,a)=>new Date(e,n||0,t??1,o||0,f||0,r||0,a||0);var jme={isNaN:Number.isNaN,isFinite:Number.isFinite,abs:Math.abs,acos:Math.acos,asin:Math.asin,atan:Math.atan,atan2:Math.atan2,ceil:Math.ceil,cos:Math.cos,exp:Math.exp,floor:Math.floor,log:Math.log,max:Math.max,min:Math.min,pow:Math.pow,random:Math.random,round:Math.round,sin:Math.sin,sqrt:Math.sqrt,tan:Math.tan,clamp:(e,n,t)=>Math.max(n,Math.min(t,e)),now:Date.now,utc:Date.UTC,datetime:Bme,date:e=>new Date(e).getDate(),day:e=>new Date(e).getDay(),year:e=>new Date(e).getFullYear(),month:e=>new Date(e).getMonth(),hours:e=>new Date(e).getHours(),minutes:e=>new Date(e).getMinutes(),seconds:e=>new Date(e).getSeconds(),milliseconds:e=>new Date(e).getMilliseconds(),time:e=>new Date(e).getTime(),timezoneoffset:e=>new Date(e).getTimezoneOffset(),utcdate:e=>new Date(e).getUTCDate(),utcday:e=>new Date(e).getUTCDay(),utcyear:e=>new Date(e).getUTCFullYear(),utcmonth:e=>new Date(e).getUTCMonth(),utchours:e=>new Date(e).getUTCHours(),utcminutes:e=>new Date(e).getUTCMinutes(),utcseconds:e=>new Date(e).getUTCSeconds(),utcmilliseconds:e=>new Date(e).getUTCMilliseconds(),length:e=>e.length,join:function(){return Zp("join",arguments)},indexof:function(){return Zp("indexOf",arguments)},lastindexof:function(){return Zp("lastIndexOf",arguments)},slice:function(){return Zp("slice",arguments)},reverse:e=>e.slice().reverse(),parseFloat,parseInt,upper:e=>String(e).toUpperCase(),lower:e=>String(e).toLowerCase(),substring:function(){return Zp("substring",arguments,String)},split:function(){return Zp("split",arguments,String)},replace:function(){return Zp("replace",arguments,String)},trim:e=>String(e).trim(),regexp:RegExp,test:(e,n)=>RegExp(e).test(n)};const Ume=["view","item","group","xy","x","y"],yT=new Set([Function,eval,setTimeout,setInterval]);typeof setImmediate=="function"&&yT.add(setImmediate);const $me={Literal:(e,n)=>n.value,Identifier:(e,n)=>{const t=n.name;return e.memberDepth>0?t:t==="datum"?e.datum:t==="event"?e.event:t==="item"?e.item:Fme[t]||e.params["$"+t]},MemberExpression:(e,n)=>{const t=!n.computed,o=e(n.object);t&&(e.memberDepth+=1);const f=e(n.property);if(t&&(e.memberDepth-=1),yT.has(o[f])){console.error(`Prevented interpretation of member "${f}" which could lead to insecure code execution`);return}return o[f]},CallExpression:(e,n)=>{const t=n.arguments;let o=n.callee.name;return o.startsWith("_")&&(o=o.slice(1)),o==="if"?e(t[0])?e(t[1]):e(t[2]):(e.fn[o]||jme[o]).apply(e.fn,t.map(e))},ArrayExpression:(e,n)=>n.elements.map(e),BinaryExpression:(e,n)=>Rme[n.operator](e(n.left),e(n.right)),UnaryExpression:(e,n)=>zme[n.operator](e(n.argument)),ConditionalExpression:(e,n)=>e(n.test)?e(n.consequent):e(n.alternate),LogicalExpression:(e,n)=>n.operator==="&&"?e(n.left)&&e(n.right):e(n.left)||e(n.right),ObjectExpression:(e,n)=>n.properties.reduce((t,o)=>{e.memberDepth+=1;const f=e(o.key);return e.memberDepth-=1,yT.has(e(o.value))?console.error(`Prevented interpretation of property "${f}" which could lead to insecure code execution`):t[f]=e(o.value),t},{})};function my(e,n,t,o,f,r){const a=l=>$me[l.type](a,l);return a.memberDepth=0,a.fn=Object.create(n),a.params=t,a.datum=o,a.event=f,a.item=r,Ume.forEach(l=>a.fn[l]=function(){return f.vega[l](...arguments)}),a(e)}var Vme={operator(e,n){const t=n.ast,o=e.functions;return f=>my(t,o,f)},parameter(e,n){const t=n.ast,o=e.functions;return(f,r)=>my(t,o,r,f)},event(e,n){const t=n.ast,o=e.functions;return f=>my(t,o,void 0,void 0,f)},handler(e,n){const t=n.ast,o=e.functions;return(f,r)=>{const a=r.item&&r.item.datum;return my(t,o,f,a,r)}},encode(e,n){const{marktype:t,channels:o}=n,f=e.functions,r=t==="group"||t==="image"||t==="rect";return(a,l)=>{const c=a.datum;let i=0,s;for(const u in o)s=my(o[u].ast,f,l,c,void 0,a),a[u]!==s&&(a[u]=s,i=1);return t!=="rule"&&Ime(a,o,r),i}}};const qme="vega-lite",Hme='Dominik Moritz, Kanit "Ham" Wongsuphasawat, Arvind Satyanarayan, Jeffrey Heer',Gme="5.12.0",Wme=["Kanit Wongsuphasawat (http://kanitw.yellowpigz.com)","Dominik Moritz (https://www.domoritz.de)","Arvind Satyanarayan (https://arvindsatya.com)","Jeffrey Heer (https://jheer.org)"],Yme="https://vega.github.io/vega-lite/",Xme="Vega-Lite is a concise high-level language for interactive visualization.",Zme=["vega","chart","visualization"],Jme="build/vega-lite.js",Kme="build/vega-lite.min.js",Qme="build/vega-lite.min.js",e1e="build/src/index",t1e="build/src/index.d.ts",n1e={vl2pdf:"./bin/vl2pdf",vl2png:"./bin/vl2png",vl2svg:"./bin/vl2svg",vl2vg:"./bin/vl2vg"},r1e=["bin","build","src","vega-lite*","tsconfig.json"],i1e={changelog:"conventional-changelog -p angular -r 2",prebuild:"yarn clean:build",build:"yarn build:only","build:only":"tsc -p tsconfig.build.json && rollup -c","prebuild:examples":"yarn build:only","build:examples":"yarn data && TZ=America/Los_Angeles scripts/build-examples.sh","prebuild:examples-full":"yarn build:only","build:examples-full":"TZ=America/Los_Angeles scripts/build-examples.sh 1","build:example":"TZ=America/Los_Angeles scripts/build-example.sh","build:toc":"yarn build:jekyll && scripts/generate-toc","build:site":"rollup -c site/rollup.config.mjs","build:jekyll":"pushd site && bundle exec jekyll build -q && popd","build:versions":"scripts/update-version.sh",clean:"yarn clean:build && del-cli 'site/data/*' 'examples/compiled/*.png' && find site/examples ! -name 'index.md' ! -name 'data' -type f -delete","clean:build":"del-cli 'build/*' !build/vega-lite-schema.json",data:"rsync -r node_modules/vega-datasets/data/* site/data",schema:"mkdir -p build && ts-json-schema-generator -f tsconfig.json -p src/index.ts -t TopLevelSpec --no-type-check --no-ref-encode > build/vega-lite-schema.json && yarn renameschema && cp build/vega-lite-schema.json site/_data/",renameschema:"scripts/rename-schema.sh",presite:"yarn data && yarn schema && yarn build:site && yarn build:versions && scripts/create-example-pages.sh",site:"yarn site:only","site:only":"pushd site && bundle exec jekyll serve -I -l && popd",prettierbase:"prettier '**/*.{md,css,yml}'",format:"eslint . --fix && yarn prettierbase --write",lint:"eslint . && yarn prettierbase --check",jest:"NODE_OPTIONS=--experimental-vm-modules npx jest",test:"yarn jest test/ && yarn lint && yarn schema && yarn jest examples/ && yarn test:runtime","test:cover":"yarn jest --collectCoverage test/","test:inspect":"node --inspect-brk --experimental-vm-modules ./node_modules/.bin/jest --runInBand test","test:runtime":"NODE_OPTIONS=--experimental-vm-modules TZ=America/Los_Angeles npx jest test-runtime/ --config test-runtime/jest-config.json","test:runtime:generate":"yarn build:only && del-cli test-runtime/resources && VL_GENERATE_TESTS=true yarn test:runtime",watch:"tsc -p tsconfig.build.json -w","watch:site":"yarn build:site -w","watch:test":"yarn jest --watch test/","watch:test:runtime":"NODE_OPTIONS=--experimental-vm-modules TZ=America/Los_Angeles npx jest --watch test-runtime/ --config test-runtime/jest-config.json",release:"release-it"},a1e={type:"git",url:"https://github.com/vega/vega-lite.git"},o1e="BSD-3-Clause",s1e={url:"https://github.com/vega/vega-lite/issues"},l1e={"@babel/core":"^7.21.8","@babel/plugin-proposal-class-properties":"^7.18.6","@babel/preset-env":"^7.21.5","@babel/preset-typescript":"^7.21.5","@release-it/conventional-changelog":"^5.1.1","@rollup/plugin-alias":"^5.0.0","@rollup/plugin-babel":"^6.0.3","@rollup/plugin-commonjs":"^25.0.0","@rollup/plugin-json":"^6.0.0","@rollup/plugin-node-resolve":"^15.0.2","@rollup/plugin-terser":"^0.4.1","@types/chai":"^4.3.5","@types/d3":"^7.4.0","@types/jest":"^27.4.1","@types/pako":"^2.0.0","@typescript-eslint/eslint-plugin":"^5.59.5","@typescript-eslint/parser":"^5.59.5",ajv:"^8.12.0","ajv-formats":"^2.1.1",chai:"^4.3.7",cheerio:"^1.0.0-rc.12","conventional-changelog-cli":"^3.0.0",d3:"^7.8.4","del-cli":"^5.0.0",eslint:"^8.40.0","eslint-config-prettier":"^8.8.0","eslint-plugin-jest":"^27.2.1","eslint-plugin-prettier":"^4.2.1","highlight.js":"^11.8.0",jest:"^27.5.1","jest-dev-server":"^6.1.1",mkdirp:"^3.0.1",pako:"^2.1.0",prettier:"^2.8.8",puppeteer:"^15.0.0","release-it":"^15.10.3",rollup:"^3.21.6","rollup-plugin-bundle-size":"^1.0.3","rollup-plugin-sourcemaps":"^0.6.3",serve:"^14.2.0",terser:"^5.17.3","ts-jest":"^29.1.0","ts-json-schema-generator":"^1.2.0",typescript:"~4.9.5","vega-cli":"^5.25.0","vega-datasets":"^2.7.0","vega-embed":"^6.22.1","vega-tooltip":"^0.32.0","yaml-front-matter":"^4.1.1"},u1e={"@types/clone":"~2.1.1",clone:"~2.1.2","fast-deep-equal":"~3.1.3","fast-json-stable-stringify":"~2.1.0","json-stringify-pretty-compact":"~3.0.0",tslib:"~2.5.0","vega-event-selector":"~3.0.1","vega-expression":"~5.1.0","vega-util":"~1.17.2",yargs:"~17.7.2"},c1e={vega:"^5.24.0"},f1e={node:">=16"},h1e={name:qme,author:Hme,version:Gme,collaborators:Wme,homepage:Yme,description:Xme,keywords:Zme,main:Jme,unpkg:Kme,jsdelivr:Qme,module:e1e,types:t1e,bin:n1e,files:r1e,scripts:i1e,repository:a1e,license:o1e,bugs:s1e,devDependencies:l1e,dependencies:u1e,peerDependencies:c1e,engines:f1e};var b$={exports:{}};(function(e){var n=function(){function t(h,d){return d!=null&&h instanceof d}var o;try{o=Map}catch{o=function(){}}var f;try{f=Set}catch{f=function(){}}var r;try{r=Promise}catch{r=function(){}}function a(h,d,m,p,g){typeof d=="object"&&(m=d.depth,p=d.prototype,g=d.includeNonEnumerable,d=d.circular);var y=[],v=[],x=typeof Buffer<"u";typeof d>"u"&&(d=!0),typeof m>"u"&&(m=1/0);function _(A,b){if(A===null)return null;if(b===0)return A;var k,w;if(typeof A!="object")return A;if(t(A,o))k=new o;else if(t(A,f))k=new f;else if(t(A,r))k=new r(function(D,O){A.then(function(N){D(_(N,b-1))},function(N){O(_(N,b-1))})});else if(a.__isArray(A))k=[];else if(a.__isRegExp(A))k=new RegExp(A.source,u(A)),A.lastIndex&&(k.lastIndex=A.lastIndex);else if(a.__isDate(A))k=new Date(A.getTime());else{if(x&&Buffer.isBuffer(A))return Buffer.allocUnsafe?k=Buffer.allocUnsafe(A.length):k=new Buffer(A.length),A.copy(k),k;t(A,Error)?k=Object.create(A):typeof p>"u"?(w=Object.getPrototypeOf(A),k=Object.create(w)):(k=Object.create(p),w=p)}if(d){var M=y.indexOf(A);if(M!=-1)return v[M];y.push(A),v.push(k)}t(A,o)&&A.forEach(function(D,O){var N=_(O,b-1),B=_(D,b-1);k.set(N,B)}),t(A,f)&&A.forEach(function(D){var O=_(D,b-1);k.add(O)});for(var T in A){var E;w&&(E=Object.getOwnPropertyDescriptor(w,T)),!(E&&E.set==null)&&(k[T]=_(A[T],b-1))}if(Object.getOwnPropertySymbols)for(var S=Object.getOwnPropertySymbols(A),T=0;Txm(t,n))}:qS(e)?{or:e.or.map(t=>xm(t,n))}:n(e)}const Xf=_$,la=p1e;function w$(e){throw new Error(e)}function Vm(e,n){const t={};for(const o of n)Yi(e,o)&&(t[o]=e[o]);return t}function ju(e,n){const t={...e};for(const o of n)delete t[o];return t}Set.prototype.toJSON=function(){return`Set(${[...this].map(e=>VS(e)).join(",")})`};const $o=VS;function Ba(e){if(Eo(e))return e;const n=Li(e)?e:VS(e);if(n.length<250)return n;let t=0;for(let o=0;ol===0?a:`[${a}]`),r=f.map((a,l)=>f.slice(0,l+1).join(""));for(const a of r)n.add(a)}return n}function XS(e,n){return e===void 0||n===void 0?!0:YS(xT(e),xT(n))}function Mo(e){return Zr(e).length===0}const Zr=Object.keys,Dl=Object.values,pp=Object.entries;function Pv(e){return e===!0||e===!1}function es(e){const n=e.replace(/\W/g,"_");return(e.match(/^\d+/)?"_":"")+n}function av(e,n){return GS(e)?`!(${av(e.not,n)})`:HS(e)?`(${e.and.map(t=>av(t,n)).join(") && (")})`:qS(e)?`(${e.or.map(t=>av(t,n)).join(") || (")})`:n(e)}function Z_(e,n){if(n.length===0)return!0;const t=n.shift();return t in e&&Z_(e[t],n)&&delete e[t],Mo(e)}function Ax(e){return e.charAt(0).toUpperCase()+e.substr(1)}function ZS(e,n="datum"){const t=sd(e),o=[];for(let f=1;f<=t.length;f++){const r=`[${t.slice(0,f).map(ri).join("][")}]`;o.push(`${n}${r}`)}return o.join(" && ")}function T$(e,n="datum"){return`${n}[${ri(sd(e).join("."))}]`}function x1e(e){return e.replace(/(\[|\]|\.|'|")/g,"\\$1")}function Dc(e){return`${sd(e).map(x1e).join("\\.")}`}function V0(e,n,t){return e.replace(new RegExp(n.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"g"),t)}function JS(e){return`${sd(e).join(".")}`}function qm(e){return e?sd(e).length:0}function zs(...e){for(const n of e)if(n!==void 0)return n}let M$=42;function E$(e){const n=++M$;return e?String(e)+n:n}function b1e(){M$=42}function S$(e){return C$(e)?e:`__${e}`}function C$(e){return e.startsWith("__")}function Iv(e){if(e!==void 0)return(e%360+360)%360}function O3(e){return Eo(e)?!0:!isNaN(e)&&!isNaN(parseFloat(e))}const Zh="row",Jh="column",P3="facet",ts="x",dl="y",Tf="x2",vh="y2",Ap="xOffset",x1="yOffset",Mf="radius",fd="radius2",Ic="theta",hd="theta2",Ef="latitude",Sf="longitude",Cf="latitude2",Oc="longitude2",Gu="color",xh="fill",bh="stroke",Wu="shape",dd="size",ug="angle",pd="opacity",kp="fillOpacity",Tp="strokeOpacity",Mp="strokeWidth",Ep="strokeDash",kx="text",Hm="order",Tx="detail",I3="key",q0="tooltip",F3="href",R3="url",z3="description",_1e={x:1,y:1,x2:1,y2:1},L$={theta:1,theta2:1,radius:1,radius2:1};function D$(e){return e in L$}const KS={longitude:1,longitude2:1,latitude:1,latitude2:1};function O$(e){switch(e){case Ef:return"y";case Cf:return"y2";case Sf:return"x";case Oc:return"x2"}}function P$(e){return e in KS}const w1e=Zr(KS),QS={..._1e,...L$,...KS,xOffset:1,yOffset:1,color:1,fill:1,stroke:1,opacity:1,fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeDash:1,size:1,angle:1,shape:1,order:1,text:1,detail:1,key:1,tooltip:1,href:1,url:1,description:1};function bm(e){return e===Gu||e===xh||e===bh}const I$={row:1,column:1,facet:1},Tc=Zr(I$),e8={...QS,...I$},A1e=Zr(e8),{order:yTe,detail:vTe,tooltip:xTe,...k1e}=e8,{row:bTe,column:_Te,facet:wTe,...T1e}=k1e;function M1e(e){return!!T1e[e]}function F$(e){return!!e8[e]}const E1e=[Tf,vh,Cf,Oc,hd,fd];function R$(e){return cg(e)!==e}function cg(e){switch(e){case Tf:return ts;case vh:return dl;case Cf:return Ef;case Oc:return Sf;case hd:return Ic;case fd:return Mf}return e}function gp(e){if(D$(e))switch(e){case Ic:return"startAngle";case hd:return"endAngle";case Mf:return"outerRadius";case fd:return"innerRadius"}return e}function _h(e){switch(e){case ts:return Tf;case dl:return vh;case Ef:return Cf;case Sf:return Oc;case Ic:return hd;case Mf:return fd}}function Yu(e){switch(e){case ts:case Tf:return"width";case dl:case vh:return"height"}}function z$(e){switch(e){case ts:return"xOffset";case dl:return"yOffset";case Tf:return"x2Offset";case vh:return"y2Offset";case Ic:return"thetaOffset";case Mf:return"radiusOffset";case hd:return"theta2Offset";case fd:return"radius2Offset"}}function t8(e){switch(e){case ts:return"xOffset";case dl:return"yOffset"}}function N$(e){switch(e){case"xOffset":return"x";case"yOffset":return"y"}}const S1e=Zr(QS),{x:ATe,y:kTe,x2:TTe,y2:MTe,xOffset:ETe,yOffset:STe,latitude:CTe,longitude:LTe,latitude2:DTe,longitude2:OTe,theta:PTe,theta2:ITe,radius:FTe,radius2:RTe,...n8}=QS,C1e=Zr(n8),r8={x:1,y:1},wh=Zr(r8);function pl(e){return e in r8}const i8={theta:1,radius:1},L1e=Zr(i8);function N3(e){return e==="width"?ts:dl}const B$={xOffset:1,yOffset:1};function b1(e){return e in B$}const{text:zTe,tooltip:NTe,href:BTe,url:jTe,description:UTe,detail:$Te,key:VTe,order:qTe,...j$}=n8,D1e=Zr(j$);function O1e(e){return!!n8[e]}function P1e(e){switch(e){case Gu:case xh:case bh:case dd:case Wu:case pd:case Mp:case Ep:return!0;case kp:case Tp:case ug:return!1}}const U$={...r8,...i8,...B$,...j$},B3=Zr(U$);function gd(e){return!!U$[e]}function I1e(e,n){return R1e(e)[n]}const $$={arc:"always",area:"always",bar:"always",circle:"always",geoshape:"always",image:"always",line:"always",rule:"always",point:"always",rect:"always",square:"always",trail:"always",text:"always",tick:"always"},{geoshape:HTe,...F1e}=$$;function R1e(e){switch(e){case Gu:case xh:case bh:case z3:case Tx:case I3:case q0:case F3:case Hm:case pd:case kp:case Tp:case Mp:case P3:case Zh:case Jh:return $$;case ts:case dl:case Ap:case x1:case Ef:case Sf:return F1e;case Tf:case vh:case Cf:case Oc:return{area:"always",bar:"always",image:"always",rect:"always",rule:"always",circle:"binned",point:"binned",square:"binned",tick:"binned",line:"binned",trail:"binned"};case dd:return{point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",text:"always",line:"always",trail:"always"};case Ep:return{line:"always",point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",geoshape:"always"};case Wu:return{point:"always",geoshape:"always"};case kx:return{text:"always"};case ug:return{point:"always",square:"always",text:"always"};case R3:return{image:"always"};case Ic:return{text:"always",arc:"always"};case Mf:return{text:"always",arc:"always"};case hd:case fd:return{arc:"always"}}}function cA(e){switch(e){case ts:case dl:case Ic:case Mf:case Ap:case x1:case dd:case ug:case Mp:case pd:case kp:case Tp:case Tf:case vh:case hd:case fd:return;case P3:case Zh:case Jh:case Wu:case Ep:case kx:case q0:case F3:case R3:case z3:return"discrete";case Gu:case xh:case bh:return"flexible";case Ef:case Sf:case Cf:case Oc:case Tx:case I3:case Hm:return}}const z1e={argmax:1,argmin:1,average:1,count:1,distinct:1,product:1,max:1,mean:1,median:1,min:1,missing:1,q1:1,q3:1,ci0:1,ci1:1,stderr:1,stdev:1,stdevp:1,sum:1,valid:1,values:1,variance:1,variancep:1},N1e={count:1,min:1,max:1};function rd(e){return!!e&&!!e.argmin}function Sp(e){return!!e&&!!e.argmax}function a8(e){return Li(e)&&!!z1e[e]}const B1e=new Set(["count","valid","missing","distinct"]);function V$(e){return Li(e)&&B1e.has(e)}function j1e(e){return Li(e)&&ja(["min","max"],e)}const U1e=new Set(["count","sum","distinct","valid","missing"]),$1e=new Set(["mean","average","median","q1","q3","min","max"]);function q$(e){return s1(e)&&(e=J3(e,void 0)),"bin"+Zr(e).map(n=>j3(e[n])?es(`_${n}_${pp(e[n])}`):es(`_${n}_${e[n]}`)).join("")}function Vo(e){return e===!0||fg(e)&&!e.binned}function Ml(e){return e==="binned"||fg(e)&&e.binned===!0}function fg(e){return Si(e)}function j3(e){return e?.param}function kO(e){switch(e){case Zh:case Jh:case dd:case Gu:case xh:case bh:case Mp:case pd:case kp:case Tp:case Wu:return 6;case Ep:return 4;default:return 10}}function Mx(e){return!!e?.expr}function Iu(e){const n=Zr(e||{}),t={};for(const o of n)t[o]=ac(e[o]);return t}function H$(e){const{anchor:n,frame:t,offset:o,orient:f,angle:r,limit:a,color:l,subtitleColor:c,subtitleFont:i,subtitleFontSize:s,subtitleFontStyle:u,subtitleFontWeight:h,subtitleLineHeight:d,subtitlePadding:m,...p}=e,g={...p,...l?{fill:l}:{}},y={...n?{anchor:n}:{},...t?{frame:t}:{},...o?{offset:o}:{},...f?{orient:f}:{},...r!==void 0?{angle:r}:{},...a!==void 0?{limit:a}:{}},v={...c?{subtitleColor:c}:{},...i?{subtitleFont:i}:{},...s?{subtitleFontSize:s}:{},...u?{subtitleFontStyle:u}:{},...h?{subtitleFontWeight:h}:{},...d?{subtitleLineHeight:d}:{},...m?{subtitlePadding:m}:{}},x=Vm(e,["align","baseline","dx","dy","limit"]);return{titleMarkConfig:g,subtitleMarkConfig:x,nonMarkTitleProperties:y,subtitle:v}}function Id(e){return Li(e)||zr(e)&&Li(e[0])}function ji(e){return!!e?.signal}function Cp(e){return!!e.step}function V1e(e){return zr(e)?!1:"fields"in e&&!("data"in e)}function q1e(e){return zr(e)?!1:"fields"in e&&"data"in e}function Yh(e){return zr(e)?!1:"field"in e&&"data"in e}const H1e={aria:1,description:1,ariaRole:1,ariaRoleDescription:1,blend:1,opacity:1,fill:1,fillOpacity:1,stroke:1,strokeCap:1,strokeWidth:1,strokeOpacity:1,strokeDash:1,strokeDashOffset:1,strokeJoin:1,strokeOffset:1,strokeMiterLimit:1,startAngle:1,endAngle:1,padAngle:1,innerRadius:1,outerRadius:1,size:1,shape:1,interpolate:1,tension:1,orient:1,align:1,baseline:1,text:1,dir:1,dx:1,dy:1,ellipsis:1,limit:1,radius:1,theta:1,angle:1,font:1,fontSize:1,fontWeight:1,fontStyle:1,lineBreak:1,lineHeight:1,cursor:1,href:1,tooltip:1,cornerRadius:1,cornerRadiusTopLeft:1,cornerRadiusTopRight:1,cornerRadiusBottomLeft:1,cornerRadiusBottomRight:1,aspect:1,width:1,height:1,url:1,smooth:1},G1e=Zr(H1e),W1e={arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1},bT=["cornerRadius","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight"];function G$(e){const n=zr(e.condition)?e.condition.map(TO):TO(e.condition);return{...ac(e),condition:n}}function ac(e){if(Mx(e)){const{expr:n,...t}=e;return{signal:n,...t}}return e}function TO(e){if(Mx(e)){const{expr:n,...t}=e;return{signal:n,...t}}return e}function Yo(e){if(Mx(e)){const{expr:n,...t}=e;return{signal:n,...t}}return ji(e)?e:e!==void 0?{value:e}:void 0}function Y1e(e){return ji(e)?e.signal:ri(e)}function MO(e){return ji(e)?e.signal:ri(e.value)}function cf(e){return ji(e)?e.signal:e==null?null:ri(e)}function X1e(e,n,t){for(const o of t){const f=id(o,n.markDef,n.config);f!==void 0&&(e[o]=Yo(f))}return e}function W$(e){return[].concat(e.type,e.style??[])}function uo(e,n,t,o={}){const{vgChannel:f,ignoreVgConfig:r}=o;return f&&n[f]!==void 0?n[f]:n[e]!==void 0?n[e]:r&&(!f||f===e)?void 0:id(e,n,t,o)}function id(e,n,t,{vgChannel:o}={}){return zs(o?J_(e,n,t.style):void 0,J_(e,n,t.style),o?t[n.type][o]:void 0,t[n.type][e],o?t.mark[o]:t.mark[e])}function J_(e,n,t){return Y$(e,W$(n),t)}function Y$(e,n,t){n=Ti(n);let o;for(const f of n){const r=t[f];r&&r[e]!==void 0&&(o=r[e])}return o}function X$(e,n){return Ti(e).reduce((t,o)=>(t.field.push(hi(o,n)),t.order.push(o.sort??"ascending"),t),{field:[],order:[]})}function Z$(e,n){const t=[...e];return n.forEach(o=>{for(const f of t)if(Xf(f,o))return;t.push(o)}),t}function J$(e,n){return Xf(e,n)||!n?e:e?[...Ti(e),...Ti(n)].join(", "):n}function K$(e,n){const t=e.value,o=n.value;if(t==null||o===null)return{explicit:e.explicit,value:null};if((Id(t)||ji(t))&&(Id(o)||ji(o)))return{explicit:e.explicit,value:J$(t,o)};if(Id(t)||ji(t))return{explicit:e.explicit,value:t};if(Id(o)||ji(o))return{explicit:e.explicit,value:o};if(!Id(t)&&!ji(t)&&!Id(o)&&!ji(o))return{explicit:e.explicit,value:Z$(t,o)};throw new Error("It should never reach here")}function o8(e){return`Invalid specification ${$o(e)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`}const Z1e='Autosize "fit" only works for single views and layered views.';function EO(e){return`${e=="width"?"Width":"Height"} "container" only works for single views and layered views.`}function SO(e){const n=e=="width"?"Width":"Height",t=e=="width"?"x":"y";return`${n} "container" only works well with autosize "fit" or "fit-${t}".`}function CO(e){return e?`Dropping "fit-${e}" because spec has discrete ${Yu(e)}.`:'Dropping "fit" because spec has discrete size.'}function s8(e){return`Unknown field for ${e}. Cannot calculate view size.`}function LO(e){return`Cannot project a selection on encoding channel "${e}", which has no field.`}function J1e(e,n){return`Cannot project a selection on encoding channel "${e}" as it uses an aggregate function ("${n}").`}function K1e(e){return`The "nearest" transform is not supported for ${e} marks.`}function Q$(e){return`Selection not supported for ${e} yet.`}function Q1e(e){return`Cannot find a selection named "${e}".`}const eye="Scale bindings are currently only supported for scales with unbinned, continuous domains.",tye="Legend bindings are only supported for selections over an individual field or encoding channel.";function nye(e){return`Lookups can only be performed on selection parameters. "${e}" is a variable parameter.`}function rye(e){return`Cannot define and lookup the "${e}" selection in the same view. Try moving the lookup into a second, layered view?`}const iye="The same selection must be used to override scale domains in a layered view.",aye='Interval selections should be initialized using "x", "y", "longitude", or "latitude" keys.';function oye(e){return`Unknown repeated value "${e}".`}function DO(e){return`The "columns" property cannot be used when "${e}" has nested row/column.`}const sye="Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415).";function lye(e){return`Unrecognized parse "${e}".`}function OO(e,n,t){return`An ancestor parsed field "${e}" as ${t} but a child wants to parse the field as ${n}.`}const uye="Attempt to add the same child twice.";function cye(e){return`Ignoring an invalid transform: ${$o(e)}.`}const fye='If "from.fields" is not specified, "as" has to be a string that specifies the key to be used for the data from the secondary source.';function PO(e){return`Config.customFormatTypes is not true, thus custom format type and format for channel ${e} are dropped.`}function hye(e){const{parentProjection:n,projection:t}=e;return`Layer's shared projection ${$o(n)} is overridden by a child projection ${$o(t)}.`}const dye="Arc marks uses theta channel rather than angle, replacing angle with theta.";function pye(e){return`${e}Offset dropped because ${e} is continuous`}function gye(e){return`There is no ${e} encoding. Replacing ${e}Offset encoding as ${e}.`}function mye(e,n,t){return`Channel ${e} is a ${n}. Converted to {value: ${$o(t)}}.`}function eV(e){return`Invalid field type "${e}".`}function yye(e,n){return`Invalid field type "${e}" for aggregate: "${n}", using "quantitative" instead.`}function vye(e){return`Invalid aggregation operator "${e}".`}function tV(e,n){const{fill:t,stroke:o}=n;return`Dropping color ${e} as the plot also has ${t&&o?"fill and stroke":t?"fill":"stroke"}.`}function xye(e){return`Position range does not support relative band size for ${e}.`}function _T(e,n){return`Dropping ${$o(e)} from channel "${n}" since it does not contain any data field, datum, value, or signal.`}const bye="Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.";function U3(e,n,t){return`${e} dropped as it is incompatible with "${n}"${t?` when ${t}`:""}.`}function _ye(e){return`${e} encoding has no scale, so specified scale is ignored.`}function wye(e){return`${e}-encoding is dropped as ${e} is not a valid encoding channel.`}function Aye(e){return`${e} encoding should be discrete (ordinal / nominal / binned).`}function kye(e){return`${e} encoding should be discrete (ordinal / nominal / binned) or use a discretizing scale (e.g. threshold).`}function Tye(e){return`Facet encoding dropped as ${e.join(" and ")} ${e.length>1?"are":"is"} also specified.`}function fA(e,n){return`Using discrete channel "${e}" to encode "${n}" field can be misleading as it does not encode ${n==="ordinal"?"order":"magnitude"}.`}function Mye(e){return`The ${e} for range marks cannot be an expression`}function Eye(e,n){return`Line mark is for continuous lines and thus cannot be used with ${e&&n?"x2 and y2":e?"x2":"y2"}. We will use the rule mark (line segments) instead.`}function Sye(e,n){return`Specified orient "${e}" overridden with "${n}".`}function Cye(e){return`Cannot use the scale property "${e}" with non-color channel.`}function Lye(e){return`Cannot use the relative band size with ${e} scale.`}function Dye(e){return`Using unaggregated domain with raw field has no effect (${$o(e)}).`}function Oye(e){return`Unaggregated domain not applicable for "${e}" since it produces values outside the origin domain of the source data.`}function Pye(e){return`Unaggregated domain is currently unsupported for log scale (${$o(e)}).`}function Iye(e){return`Cannot apply size to non-oriented mark "${e}".`}function Fye(e,n,t){return`Channel "${e}" does not work with "${n}" scale. We are using "${t}" scale instead.`}function Rye(e,n){return`FieldDef does not work with "${e}" scale. We are using "${n}" scale instead.`}function nV(e,n,t){return`${t}-scale's "${n}" is dropped as it does not work with ${e} scale.`}function rV(e){return`The step for "${e}" is dropped because the ${e==="width"?"x":"y"} is continuous.`}function zye(e,n,t,o){return`Conflicting ${n.toString()} property "${e.toString()}" (${$o(t)} and ${$o(o)}). Using ${$o(t)}.`}function Nye(e,n,t,o){return`Conflicting ${n.toString()} property "${e.toString()}" (${$o(t)} and ${$o(o)}). Using the union of the two domains.`}function Bye(e){return`Setting the scale to be independent for "${e}" means we also have to set the guide (axis or legend) to be independent.`}function jye(e){return`Dropping sort property ${$o(e)} as unioned domains only support boolean or op "count", "min", and "max".`}const IO="Domains that should be unioned has conflicting sort properties. Sort will be set to true.",Uye="Detected faceted independent scales that union domain of multiple fields from different data sources. We will use the first field. The result view size may be incorrect.",$ye="Detected faceted independent scales that union domain of the same fields from different source. We will assume that this is the same field from a different fork of the same data source. However, if this is not the case, the result view size may be incorrect.",Vye="Detected faceted independent scales that union domain of multiple fields from the same data source. We will use the first field. The result view size may be incorrect.";function qye(e){return`Cannot stack "${e}" if there is already "${e}2".`}function Hye(e){return`Cannot stack non-linear scale (${e}).`}function Gye(e){return`Stacking is applied even though the aggregate function is non-summative ("${e}").`}function K_(e,n){return`Invalid ${e}: ${$o(n)}.`}function Wye(e){return`Dropping day from datetime ${$o(e)} as day cannot be combined with other units.`}function Yye(e,n){return`${n?"extent ":""}${n&&e?"and ":""}${e?"center ":""}${n&&e?"are ":"is "}not needed when data are aggregated.`}function Xye(e,n,t){return`${e} is not usually used with ${n} for ${t}.`}function Zye(e,n){return`Continuous axis should not have customized aggregation function ${e}; ${n} already agregates the axis.`}function FO(e){return`1D error band does not support ${e}.`}function iV(e){return`Channel ${e} is required for "binned" bin.`}function Jye(e){return`Channel ${e} should not be used with "binned" bin.`}function Kye(e){return`Domain for ${e} is required for threshold scale.`}globalThis&&globalThis.__classPrivateFieldSet;globalThis&&globalThis.__classPrivateFieldGet;const aV=ZI(XI);let Gm=aV;function Qye(e){return Gm=e,Gm}function eve(){return Gm=aV,Gm}function ei(...e){Gm.warn(...e)}function tve(...e){Gm.debug(...e)}function hg(e){if(e&&Si(e)){for(const n of u8)if(n in e)return!0}return!1}const oV=["january","february","march","april","may","june","july","august","september","october","november","december"],nve=oV.map(e=>e.substr(0,3)),sV=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],rve=sV.map(e=>e.substr(0,3));function ive(e){if(O3(e)&&(e=+e),Eo(e))return e>4&&ei(K_("quarter",e)),e-1;throw new Error(K_("quarter",e))}function ave(e){if(O3(e)&&(e=+e),Eo(e))return e-1;{const n=e.toLowerCase(),t=oV.indexOf(n);if(t!==-1)return t;const o=n.substr(0,3),f=nve.indexOf(o);if(f!==-1)return f;throw new Error(K_("month",e))}}function ove(e){if(O3(e)&&(e=+e),Eo(e))return e%7;{const n=e.toLowerCase(),t=sV.indexOf(n);if(t!==-1)return t;const o=n.substr(0,3),f=rve.indexOf(o);if(f!==-1)return f;throw new Error(K_("day",e))}}function l8(e,n){const t=[];if(n&&e.day!==void 0&&Zr(e).length>1&&(ei(Wye(e)),e=la(e),delete e.day),e.year!==void 0?t.push(e.year):t.push(2012),e.month!==void 0){const o=n?ave(e.month):e.month;t.push(o)}else if(e.quarter!==void 0){const o=n?ive(e.quarter):e.quarter;t.push(Eo(o)?o*3:`${o}*3`)}else t.push(0);if(e.date!==void 0)t.push(e.date);else if(e.day!==void 0){const o=n?ove(e.day):e.day;t.push(Eo(o)?o+1:`${o}+1`)}else t.push(1);for(const o of["hours","minutes","seconds","milliseconds"]){const f=e[o];t.push(typeof f>"u"?0:f)}return t}function H0(e){const t=l8(e,!0).join(", ");return e.utc?`utc(${t})`:`datetime(${t})`}function sve(e){const t=l8(e,!1).join(", ");return e.utc?`utc(${t})`:`datetime(${t})`}function lve(e){const n=l8(e,!0);return e.utc?+new Date(Date.UTC(...n)):+new Date(...n)}const lV={year:1,quarter:1,month:1,week:1,day:1,dayofyear:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},u8=Zr(lV);function uve(e){return!!lV[e]}function dg(e){return Si(e)?e.binned:uV(e)}function uV(e){return e&&e.startsWith("binned")}function c8(e){return e.startsWith("utc")}function cve(e){return e.substring(3)}const fve={"year-month":"%b %Y ","year-month-date":"%b %d, %Y "};function $3(e){return u8.filter(n=>fV(e,n))}function cV(e){const n=$3(e);return n[n.length-1]}function fV(e,n){const t=e.indexOf(n);return!(t<0||t>0&&n==="seconds"&&e.charAt(t-1)==="i"||e.length>t+3&&n==="day"&&e.charAt(t+3)==="o"||t>0&&n==="year"&&e.charAt(t-1)==="f")}function hve(e,n,{end:t}={end:!1}){const o=ZS(n),f=c8(e)?"utc":"";function r(c){return c==="quarter"?`(${f}quarter(${o})-1)`:`${f}${c}(${o})`}let a;const l={};for(const c of u8)fV(e,c)&&(l[c]=r(c),a=c);return t&&(l[a]+="+1"),sve(l)}function hV(e){if(!e)return;const n=$3(e);return`timeUnitSpecifier(${$o(n)}, ${$o(fve)})`}function dve(e,n,t){if(!e)return;const o=hV(e);return`${t||c8(e)?"utc":"time"}Format(${n}, ${o})`}function hl(e){if(!e)return;let n;return Li(e)?uV(e)?n={unit:e.substring(6),binned:!0}:n={unit:e}:Si(e)&&(n={...e,...e.unit?{unit:e.unit}:{}}),c8(n.unit)&&(n.utc=!0,n.unit=cve(n.unit)),n}function pve(e){const{utc:n,...t}=hl(e);return t.unit?(n?"utc":"")+Zr(t).map(o=>es(`${o==="unit"?"":`_${o}_`}${t[o]}`)).join(""):(n?"utc":"")+"timeunit"+Zr(t).map(o=>es(`_${o}_${t[o]}`)).join("")}function dV(e,n=t=>t){const t=hl(e),o=cV(t.unit);if(o&&o!=="day"){const f={year:2001,month:1,date:1,hours:0,minutes:0,seconds:0,milliseconds:0},{step:r,part:a}=pV(o,t.step),l={...f,[a]:+f[a]+r};return`${n(H0(l))} - ${n(H0(f))}`}}const gve={year:1,month:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1};function mve(e){return!!gve[e]}function pV(e,n=1){if(mve(e))return{part:e,step:n};switch(e){case"day":case"dayofyear":return{part:"date",step:n};case"quarter":return{part:"month",step:n*3};case"week":return{part:"date",step:n*7}}}function yve(e){return e?.param}function f8(e){return!!e?.field&&e.equal!==void 0}function h8(e){return!!e?.field&&e.lt!==void 0}function d8(e){return!!e?.field&&e.lte!==void 0}function p8(e){return!!e?.field&&e.gt!==void 0}function g8(e){return!!e?.field&&e.gte!==void 0}function m8(e){if(e?.field){if(zr(e.range)&&e.range.length===2)return!0;if(ji(e.range))return!0}return!1}function y8(e){return!!e?.field&&(zr(e.oneOf)||zr(e.in))}function vve(e){return!!e?.field&&e.valid!==void 0}function gV(e){return y8(e)||f8(e)||m8(e)||h8(e)||p8(e)||d8(e)||g8(e)}function Uf(e,n){return K3(e,{timeUnit:n,wrapTime:!0})}function xve(e,n){return e.map(t=>Uf(t,n))}function mV(e,n=!0){const{field:t}=e,o=hl(e.timeUnit),{unit:f,binned:r}=o||{},a=hi(e,{expr:"datum"}),l=f?`time(${r?a:hve(f,t)})`:a;if(f8(e))return`${l}===${Uf(e.equal,f)}`;if(h8(e)){const c=e.lt;return`${l}<${Uf(c,f)}`}else if(p8(e)){const c=e.gt;return`${l}>${Uf(c,f)}`}else if(d8(e)){const c=e.lte;return`${l}<=${Uf(c,f)}`}else if(g8(e)){const c=e.gte;return`${l}>=${Uf(c,f)}`}else{if(y8(e))return`indexof([${xve(e.oneOf,f).join(",")}], ${l}) !== -1`;if(vve(e))return v8(l,e.valid);if(m8(e)){const{range:c}=e,i=ji(c)?{signal:`${c.signal}[0]`}:c[0],s=ji(c)?{signal:`${c.signal}[1]`}:c[1];if(i!==null&&s!==null&&n)return"inrange("+l+", ["+Uf(i,f)+", "+Uf(s,f)+"])";const u=[];return i!==null&&u.push(`${l} >= ${Uf(i,f)}`),s!==null&&u.push(`${l} <= ${Uf(s,f)}`),u.length>0?u.join(" && "):"true"}}throw new Error(`Invalid field predicate: ${$o(e)}`)}function v8(e,n=!0){return n?`isValid(${e}) && isFinite(+${e})`:`!isValid(${e}) || !isFinite(+${e})`}function bve(e){return gV(e)&&e.timeUnit?{...e,timeUnit:hl(e.timeUnit)}:e}const Ex={quantitative:"quantitative",ordinal:"ordinal",temporal:"temporal",nominal:"nominal",geojson:"geojson"};function _ve(e){return e==="quantitative"||e==="temporal"}function yV(e){return e==="ordinal"||e==="nominal"}const G0=Ex.quantitative,x8=Ex.ordinal,Wm=Ex.temporal,b8=Ex.nominal,_1=Ex.geojson;function wve(e){if(e)switch(e=e.toLowerCase(),e){case"q":case G0:return"quantitative";case"t":case Wm:return"temporal";case"o":case x8:return"ordinal";case"n":case b8:return"nominal";case _1:return"geojson"}}const Uu={LINEAR:"linear",LOG:"log",POW:"pow",SQRT:"sqrt",SYMLOG:"symlog",IDENTITY:"identity",SEQUENTIAL:"sequential",TIME:"time",UTC:"utc",QUANTILE:"quantile",QUANTIZE:"quantize",THRESHOLD:"threshold",BIN_ORDINAL:"bin-ordinal",ORDINAL:"ordinal",POINT:"point",BAND:"band"},wT={linear:"numeric",log:"numeric",pow:"numeric",sqrt:"numeric",symlog:"numeric",identity:"numeric",sequential:"numeric",time:"time",utc:"time",ordinal:"ordinal","bin-ordinal":"bin-ordinal",point:"ordinal-position",band:"ordinal-position",quantile:"discretizing",quantize:"discretizing",threshold:"discretizing"};function Ave(e,n){const t=wT[e],o=wT[n];return t===o||t==="ordinal-position"&&o==="time"||o==="ordinal-position"&&t==="time"}const kve={linear:0,log:1,pow:1,sqrt:1,symlog:1,identity:1,sequential:1,time:0,utc:0,point:10,band:11,ordinal:0,"bin-ordinal":0,quantile:0,quantize:0,threshold:0};function RO(e){return kve[e]}const vV=new Set(["linear","log","pow","sqrt","symlog"]),xV=new Set([...vV,"time","utc"]);function bV(e){return vV.has(e)}const _V=new Set(["quantile","quantize","threshold"]),Tve=new Set([...xV,..._V,"sequential","identity"]),Mve=new Set(["ordinal","bin-ordinal","point","band"]);function ml(e){return Mve.has(e)}function pc(e){return Tve.has(e)}function ff(e){return xV.has(e)}function Ym(e){return _V.has(e)}const Eve={pointPadding:.5,barBandPaddingInner:.1,rectBandPaddingInner:0,bandWithNestedOffsetPaddingInner:.2,bandWithNestedOffsetPaddingOuter:.2,minBandSize:2,minFontSize:8,maxFontSize:40,minOpacity:.3,maxOpacity:.8,minSize:9,minStrokeWidth:1,maxStrokeWidth:4,quantileCount:4,quantizeCount:4,zero:!0};function Sve(e){return!Li(e)&&!!e.name}function wV(e){return e?.param}function Cve(e){return e?.unionWith}function Lve(e){return rp(e)&&"field"in e}const Dve={type:1,domain:1,domainMax:1,domainMin:1,domainMid:1,align:1,range:1,rangeMax:1,rangeMin:1,scheme:1,bins:1,reverse:1,round:1,clamp:1,nice:1,base:1,exponent:1,constant:1,interpolate:1,zero:1,padding:1,paddingInner:1,paddingOuter:1},{type:GTe,domain:WTe,range:YTe,rangeMax:XTe,rangeMin:ZTe,scheme:JTe,...Ove}=Dve,Pve=Zr(Ove);function AT(e,n){switch(n){case"type":case"domain":case"reverse":case"range":return!0;case"scheme":case"interpolate":return!["point","band","identity"].includes(e);case"bins":return!["point","band","identity","ordinal"].includes(e);case"round":return ff(e)||e==="band"||e==="point";case"padding":case"rangeMin":case"rangeMax":return ff(e)||["point","band"].includes(e);case"paddingOuter":case"align":return["point","band"].includes(e);case"paddingInner":return e==="band";case"domainMax":case"domainMid":case"domainMin":case"clamp":return ff(e);case"nice":return ff(e)||e==="quantize"||e==="threshold";case"exponent":return e==="pow";case"base":return e==="log";case"constant":return e==="symlog";case"zero":return pc(e)&&!ja(["log","time","utc","threshold","quantile"],e)}}function AV(e,n){switch(n){case"interpolate":case"scheme":case"domainMid":return bm(e)?void 0:Cye(n);case"align":case"type":case"bins":case"domain":case"domainMax":case"domainMin":case"range":case"base":case"exponent":case"constant":case"nice":case"padding":case"paddingInner":case"paddingOuter":case"rangeMax":case"rangeMin":case"reverse":case"round":case"clamp":case"zero":return}}function Ive(e,n){return ja([x8,b8],n)?e===void 0||ml(e):n===Wm?ja([Uu.TIME,Uu.UTC,void 0],e):n===G0?bV(e)||Ym(e)||e===void 0:!0}function Fve(e,n,t=!1){if(!gd(e))return!1;switch(e){case ts:case dl:case Ap:case x1:case Ic:case Mf:return ff(n)||n==="band"?!0:n==="point"?!t:!1;case dd:case Mp:case pd:case kp:case Tp:case ug:return ff(n)||Ym(n)||ja(["band","point","ordinal"],n);case Gu:case xh:case bh:return n!=="band";case Ep:case Wu:return n==="ordinal"||Ym(n)}}const Tu={arc:"arc",area:"area",bar:"bar",image:"image",line:"line",point:"point",rect:"rect",rule:"rule",text:"text",tick:"tick",trail:"trail",circle:"circle",square:"square",geoshape:"geoshape"},kV=Tu.arc,V3=Tu.area,q3=Tu.bar,Rve=Tu.image,H3=Tu.line,G3=Tu.point,zve=Tu.rect,Q_=Tu.rule,TV=Tu.text,_8=Tu.tick,Nve=Tu.trail,w8=Tu.circle,A8=Tu.square,MV=Tu.geoshape;function Lp(e){return["line","area","trail"].includes(e)}function k8(e){return["rect","bar","image","arc"].includes(e)}const Bve=new Set(Zr(Tu));function fh(e){return e.type}const jve=["stroke","strokeWidth","strokeDash","strokeDashOffset","strokeOpacity","strokeJoin","strokeMiterLimit"],Uve=["fill","fillOpacity"],$ve=[...jve,...Uve],Vve={color:1,filled:1,invalid:1,order:1,radius2:1,theta2:1,timeUnitBandSize:1,timeUnitBandPosition:1},zO=Zr(Vve),qve={area:["line","point"],bar:["binSpacing","continuousBandSize","discreteBandSize","minBandSize"],rect:["binSpacing","continuousBandSize","discreteBandSize","minBandSize"],line:["point"],tick:["bandSize","thickness"]},Hve={color:"#4c78a8",invalid:"filter",timeUnitBandSize:1},Gve={mark:1,arc:1,area:1,bar:1,circle:1,image:1,line:1,point:1,rect:1,rule:1,square:1,text:1,tick:1,trail:1,geoshape:1},EV=Zr(Gve);function W0(e){return e&&e.band!=null}const Wve={horizontal:["cornerRadiusTopRight","cornerRadiusBottomRight"],vertical:["cornerRadiusTopLeft","cornerRadiusTopRight"]},SV=5,Yve={binSpacing:1,continuousBandSize:SV,minBandSize:.25,timeUnitBandPosition:.5},Xve={binSpacing:0,continuousBandSize:SV,minBandSize:.25,timeUnitBandPosition:.5},Zve={thickness:1};function Jve(e){return fh(e)?e.type:e}function T8(e){const{channel:n,channelDef:t,markDef:o,scale:f,config:r}=e,a=E8(e);return ni(t)&&!V$(t.aggregate)&&f&&ff(f.get("type"))?Kve({fieldDef:t,channel:n,markDef:o,ref:a,config:r}):a}function Kve({fieldDef:e,channel:n,markDef:t,ref:o,config:f}){return Lp(t.type)?o:uo("invalid",t,f)===null?[Qve(e,n),o]:o}function Qve(e,n){const t=M8(e,!0),f=cg(n)==="y"?{field:{group:"height"}}:{value:0};return{test:t,...f}}function M8(e,n=!0){return v8(Li(e)?e:hi(e,{expr:"datum"}),!n)}function exe(e){const{datum:n}=e;return hg(n)?H0(n):`${$o(n)}`}function M0(e,n,t,o){const f={};if(n&&(f.scale=n),Ah(e)){const{datum:r}=e;hg(r)?f.signal=H0(r):ji(r)?f.signal=r.signal:Mx(r)?f.signal=r.expr:f.value=r}else f.field=hi(e,t);if(o){const{offset:r,band:a}=o;r&&(f.offset=r),a&&(f.band=a)}return f}function ew({scaleName:e,fieldOrDatumDef:n,fieldOrDatumDef2:t,offset:o,startSuffix:f,bandPosition:r=.5}){const a=0{switch(n.fieldTitle){case"plain":return e.field;case"functional":return pxe(e);default:return dxe(e,n)}};let VV=$V;function qV(e){VV=e}function gxe(){qV($V)}function _m(e,n,{allowDisabling:t,includeDefault:o=!0}){const f=D8(e)?.title;if(!ni(e))return f??e.title;const r=e,a=o?O8(r,n):void 0;return t?zs(f,r.title,a):f??r.title??a}function D8(e){if(Zm(e)&&e.axis)return e.axis;if(jV(e)&&e.legend)return e.legend;if(C8(e)&&e.header)return e.header}function O8(e,n){return VV(e,n)}function rw(e){if(UV(e)){const{format:n,formatType:t}=e;return{format:n,formatType:t}}else{const n=D8(e)??{},{format:t,formatType:o}=n;return{format:t,formatType:o}}}function mxe(e,n){switch(n){case"latitude":case"longitude":return"quantitative";case"row":case"column":case"facet":case"shape":case"strokeDash":return"nominal";case"order":return"ordinal"}if(L8(e)&&zr(e.sort))return"ordinal";const{aggregate:t,bin:o,timeUnit:f}=e;if(f)return"temporal";if(o||t&&!Sp(t)&&!rd(t))return"quantitative";if(pg(e)&&e.scale?.type)switch(wT[e.scale.type]){case"numeric":case"discretizing":return"quantitative";case"time":return"temporal"}return"nominal"}function hh(e){if(ni(e))return e;if(Z3(e))return e.condition}function Ks(e){if(fa(e))return e;if(Lx(e))return e.condition}function HV(e,n,t,o={}){if(Li(e)||Eo(e)||s1(e)){const f=Li(e)?"string":Eo(e)?"number":"boolean";return ei(mye(n,f,e)),{value:e}}return fa(e)?iw(e,n,t,o):Lx(e)?{...e,condition:iw(e.condition,n,t,o)}:e}function iw(e,n,t,o){if(UV(e)){const{format:f,formatType:r,...a}=e;if(Y0(r)&&!t.customFormatTypes)return ei(PO(n)),iw(a,n,t,o)}else{const f=Zm(e)?"axis":jV(e)?"legend":C8(e)?"header":null;if(f&&e[f]){const{format:r,formatType:a,...l}=e[f];if(Y0(a)&&!t.customFormatTypes)return ei(PO(n)),iw({...e,[f]:l},n,t,o)}}return ni(e)?P8(e,n,o):yxe(e)}function yxe(e){let n=e.type;if(n)return e;const{datum:t}=e;return n=Eo(t)?"quantitative":Li(t)?"nominal":hg(t)?"temporal":void 0,{...e,type:n}}function P8(e,n,{compositeMark:t=!1}={}){const{aggregate:o,timeUnit:f,bin:r,field:a}=e,l={...e};if(!t&&o&&!a8(o)&&!Sp(o)&&!rd(o)&&(ei(vye(o)),delete l.aggregate),f&&(l.timeUnit=hl(f)),a&&(l.field=`${a}`),Vo(r)&&(l.bin=J3(r,n)),Ml(r)&&!pl(n)&&ei(Jye(n)),Au(l)){const{type:c}=l,i=wve(c);c!==i&&(l.type=i),c!=="quantitative"&&V$(o)&&(ei(yye(c,o)),l.type="quantitative")}else if(!R$(n)){const c=mxe(l,n);l.type=c}if(Au(l)){const{compatible:c,warning:i}=vxe(l,n)||{};c===!1&&ei(i)}if(L8(l)&&Li(l.sort)){const{sort:c}=l;if(BO(c))return{...l,sort:{encoding:c}};const i=c.substr(1);if(c.charAt(0)==="-"&&BO(i))return{...l,sort:{encoding:i,order:"descending"}}}if(C8(l)){const{header:c}=l;if(c){const{orient:i,...s}=c;if(i)return{...l,header:{...s,labelOrient:c.labelOrient||i,titleOrient:c.titleOrient||i}}}}return l}function J3(e,n){return s1(e)?{maxbins:kO(n)}:e==="binned"?{binned:!0}:!e.maxbins&&!e.step?{...e,maxbins:kO(n)}:e}const em={compatible:!0};function vxe(e,n){const t=e.type;if(t==="geojson"&&n!=="shape")return{compatible:!1,warning:`Channel ${n} should not be used with a geojson data.`};switch(n){case Zh:case Jh:case P3:return nw(e)?em:{compatible:!1,warning:Aye(n)};case ts:case dl:case Ap:case x1:case Gu:case xh:case bh:case kx:case Tx:case I3:case q0:case F3:case R3:case ug:case Ic:case Mf:case z3:return em;case Sf:case Oc:case Ef:case Cf:return t!==G0?{compatible:!1,warning:`Channel ${n} should be used with a quantitative field only, not ${e.type} field.`}:em;case pd:case kp:case Tp:case Mp:case dd:case hd:case fd:case Tf:case vh:return t==="nominal"&&!e.sort?{compatible:!1,warning:`Channel ${n} should not be used with an unsorted discrete field.`}:em;case Wu:case Ep:return!nw(e)&&!fxe(e)?{compatible:!1,warning:kye(n)}:em;case Hm:return e.type==="nominal"&&!("sort"in e)?{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}:em}}function Jm(e){const{formatType:n}=rw(e);return n==="time"||!n&&xxe(e)}function xxe(e){return e&&(e.type==="temporal"||ni(e)&&!!e.timeUnit)}function K3(e,{timeUnit:n,type:t,wrapTime:o,undefinedIfExprNotRequired:f}){const r=n&&hl(n)?.unit;let a=r||t==="temporal",l;return Mx(e)?l=e.expr:ji(e)?l=e.signal:hg(e)?(a=!0,l=H0(e)):(Li(e)||Eo(e))&&a&&(l=`datetime(${$o(e)})`,uve(r)&&(Eo(e)&&e<1e4||Li(e)&&isNaN(Date.parse(e)))&&(l=H0({[r]:e}))),l?o&&a?`time(${l})`:l:f?void 0:$o(e)}function GV(e,n){const{type:t}=e;return n.map(o=>{const f=ni(e)&&!dg(e.timeUnit)?e.timeUnit:void 0,r=K3(o,{timeUnit:f,type:t,undefinedIfExprNotRequired:!0});return r!==void 0?{signal:r}:o})}function Dx(e,n){return Vo(e.bin)?gd(n)&&["ordinal","nominal"].includes(e.type):(console.warn("Only call this method for binned field defs."),!1)}const $O={labelAlign:{part:"labels",vgProp:"align"},labelBaseline:{part:"labels",vgProp:"baseline"},labelColor:{part:"labels",vgProp:"fill"},labelFont:{part:"labels",vgProp:"font"},labelFontSize:{part:"labels",vgProp:"fontSize"},labelFontStyle:{part:"labels",vgProp:"fontStyle"},labelFontWeight:{part:"labels",vgProp:"fontWeight"},labelOpacity:{part:"labels",vgProp:"opacity"},labelOffset:null,labelPadding:null,gridColor:{part:"grid",vgProp:"stroke"},gridDash:{part:"grid",vgProp:"strokeDash"},gridDashOffset:{part:"grid",vgProp:"strokeDashOffset"},gridOpacity:{part:"grid",vgProp:"opacity"},gridWidth:{part:"grid",vgProp:"strokeWidth"},tickColor:{part:"ticks",vgProp:"stroke"},tickDash:{part:"ticks",vgProp:"strokeDash"},tickDashOffset:{part:"ticks",vgProp:"strokeDashOffset"},tickOpacity:{part:"ticks",vgProp:"opacity"},tickSize:null,tickWidth:{part:"ticks",vgProp:"strokeWidth"}};function Ox(e){return e?.condition}const WV=["domain","grid","labels","ticks","title"],bxe={grid:"grid",gridCap:"grid",gridColor:"grid",gridDash:"grid",gridDashOffset:"grid",gridOpacity:"grid",gridScale:"grid",gridWidth:"grid",orient:"main",bandPosition:"both",aria:"main",description:"main",domain:"main",domainCap:"main",domainColor:"main",domainDash:"main",domainDashOffset:"main",domainOpacity:"main",domainWidth:"main",format:"main",formatType:"main",labelAlign:"main",labelAngle:"main",labelBaseline:"main",labelBound:"main",labelColor:"main",labelFlush:"main",labelFlushOffset:"main",labelFont:"main",labelFontSize:"main",labelFontStyle:"main",labelFontWeight:"main",labelLimit:"main",labelLineHeight:"main",labelOffset:"main",labelOpacity:"main",labelOverlap:"main",labelPadding:"main",labels:"main",labelSeparation:"main",maxExtent:"main",minExtent:"main",offset:"both",position:"main",tickCap:"main",tickColor:"main",tickDash:"main",tickDashOffset:"main",tickMinStep:"both",tickOffset:"both",tickOpacity:"main",tickRound:"both",ticks:"main",tickSize:"main",tickWidth:"both",title:"main",titleAlign:"main",titleAnchor:"main",titleAngle:"main",titleBaseline:"main",titleColor:"main",titleFont:"main",titleFontSize:"main",titleFontStyle:"main",titleFontWeight:"main",titleLimit:"main",titleLineHeight:"main",titleOpacity:"main",titlePadding:"main",titleX:"main",titleY:"main",encode:"both",scale:"both",tickBand:"both",tickCount:"both",tickExtra:"both",translate:"both",values:"both",zindex:"both"},YV={orient:1,aria:1,bandPosition:1,description:1,domain:1,domainCap:1,domainColor:1,domainDash:1,domainDashOffset:1,domainOpacity:1,domainWidth:1,format:1,formatType:1,grid:1,gridCap:1,gridColor:1,gridDash:1,gridDashOffset:1,gridOpacity:1,gridWidth:1,labelAlign:1,labelAngle:1,labelBaseline:1,labelBound:1,labelColor:1,labelFlush:1,labelFlushOffset:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelLineHeight:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labels:1,labelSeparation:1,maxExtent:1,minExtent:1,offset:1,position:1,tickBand:1,tickCap:1,tickColor:1,tickCount:1,tickDash:1,tickDashOffset:1,tickExtra:1,tickMinStep:1,tickOffset:1,tickOpacity:1,tickRound:1,ticks:1,tickSize:1,tickWidth:1,title:1,titleAlign:1,titleAnchor:1,titleAngle:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titlePadding:1,titleX:1,titleY:1,translate:1,values:1,zindex:1},_xe={...YV,style:1,labelExpr:1,encoding:1};function VO(e){return!!_xe[e]}const wxe={axis:1,axisBand:1,axisBottom:1,axisDiscrete:1,axisLeft:1,axisPoint:1,axisQuantitative:1,axisRight:1,axisTemporal:1,axisTop:1,axisX:1,axisXBand:1,axisXDiscrete:1,axisXPoint:1,axisXQuantitative:1,axisXTemporal:1,axisY:1,axisYBand:1,axisYDiscrete:1,axisYPoint:1,axisYQuantitative:1,axisYTemporal:1},XV=Zr(wxe);function md(e){return"mark"in e}class Q3{constructor(n,t){this.name=n,this.run=t}hasMatchingType(n){return md(n)?Jve(n.mark)===this.name:!1}}function E0(e,n){const t=e&&e[n];return t?zr(t)?$0(t,o=>!!o.field):ni(t)||Z3(t):!1}function ZV(e,n){const t=e&&e[n];return t?zr(t)?$0(t,o=>!!o.field):ni(t)||Ah(t)||Lx(t):!1}function TT(e,n){if(pl(n)){const t=e[n];if((ni(t)||Ah(t))&&(yV(t.type)||ni(t)&&t.timeUnit)){const o=t8(n);return ZV(e,o)}}return!1}function I8(e){return $0(A1e,n=>{if(E0(e,n)){const t=e[n];if(zr(t))return $0(t,o=>!!o.aggregate);{const o=hh(t);return o&&!!o.aggregate}}return!1})}function JV(e,n){const t=[],o=[],f=[],r=[],a={};return F8(e,(l,c)=>{if(ni(l)){const{field:i,aggregate:s,bin:u,timeUnit:h,...d}=l;if(s||h||u){const p=D8(l)?.title;let g=hi(l,{forAs:!0});const y={...p?[]:{title:_m(l,n,{allowDisabling:!0})},...d,field:g};if(s){let v;if(Sp(s)?(v="argmax",g=hi({op:"argmax",field:s.argmax},{forAs:!0}),y.field=`${g}.${i}`):rd(s)?(v="argmin",g=hi({op:"argmin",field:s.argmin},{forAs:!0}),y.field=`${g}.${i}`):s!=="boxplot"&&s!=="errorbar"&&s!=="errorband"&&(v=s),v){const x={op:v,as:g};i&&(x.field=i),r.push(x)}}else if(t.push(g),Au(l)&&Vo(u)){if(o.push({bin:u,field:i,as:g}),t.push(hi(l,{binSuffix:"end"})),Dx(l,c)&&t.push(hi(l,{binSuffix:"range"})),pl(c)){const v={field:`${g}_end`};a[`${c}2`]=v}y.bin="binned",R$(c)||(y.type=G0)}else if(h&&!dg(h)){f.push({timeUnit:h,field:i,as:g});const v=Au(l)&&l.type!==Wm&&"time";v&&(c===kx||c===q0?y.formatType=v:O1e(c)?y.legend={formatType:v,...y.legend}:pl(c)&&(y.axis={formatType:v,...y.axis}))}a[c]=y}else t.push(i),a[c]=e[c]}else a[c]=e[c]}),{bins:o,timeUnits:f,aggregate:r,groupby:t,encoding:a}}function Axe(e,n,t){const o=I1e(n,t);if(o){if(o==="binned"){const f=e[n===Tf?ts:dl];return!!(ni(f)&&ni(e[n])&&Ml(f.bin))}}else return!1;return!0}function kxe(e,n,t,o){const f={};for(const r of Zr(e))F$(r)||ei(wye(r));for(let r of S1e){if(!e[r])continue;const a=e[r];if(b1(r)){const l=N$(r),c=f[l];if(ni(c)){if(_ve(c.type)&&ni(a)&&!c.timeUnit){ei(pye(l));continue}}else r=l,ei(gye(l))}if(r==="angle"&&n==="arc"&&!e.theta&&(ei(dye),r=Ic),!Axe(e,r,n)){ei(U3(r,n));continue}if(r===dd&&n==="line"&&hh(e[r])?.aggregate){ei(bye);continue}if(r===Gu&&(t?"fill"in e:"stroke"in e)){ei(tV("encoding",{fill:"fill"in e,stroke:"stroke"in e}));continue}if(r===Tx||r===Hm&&!zr(a)&&!bf(a)||r===q0&&zr(a)){if(a){if(r===Hm){const l=e[r];if(BV(l)){f[r]=l;continue}}f[r]=Ti(a).reduce((l,c)=>(ni(c)?l.push(P8(c,r)):ei(_T(c,r)),l),[])}}else{if(r===q0&&a===null)f[r]=null;else if(!ni(a)&&!Ah(a)&&!bf(a)&&!X3(a)&&!ji(a)){ei(_T(a,r));continue}f[r]=HV(a,r,o)}}return f}function e5(e,n){const t={};for(const o of Zr(e)){const f=HV(e[o],o,n,{compositeMark:!0});t[o]=f}return t}function Txe(e){const n=[];for(const t of Zr(e))if(E0(e,t)){const o=e[t],f=Ti(o);for(const r of f)ni(r)?n.push(r):Z3(r)&&n.push(r.condition)}return n}function F8(e,n,t){if(e)for(const o of Zr(e)){const f=e[o];if(zr(f))for(const r of f)n.call(t,r,o);else n.call(t,f,o)}}function Mxe(e,n,t,o){return e?Zr(e).reduce((f,r)=>{const a=e[r];return zr(a)?a.reduce((l,c)=>n.call(o,l,c,r),f):n.call(o,f,a,r)},t):t}function KV(e,n){return Zr(n).reduce((t,o)=>{switch(o){case ts:case dl:case F3:case z3:case R3:case Tf:case vh:case Ap:case x1:case Ic:case hd:case Mf:case fd:case Ef:case Sf:case Cf:case Oc:case kx:case Wu:case ug:case q0:return t;case Hm:if(e==="line"||e==="trail")return t;case Tx:case I3:{const f=n[o];if(zr(f)||ni(f))for(const r of Ti(f))r.aggregate||t.push(hi(r,{}));return t}case dd:if(e==="trail")return t;case Gu:case xh:case bh:case pd:case kp:case Tp:case Ep:case Mp:{const f=hh(n[o]);return f&&!f.aggregate&&t.push(hi(f,{})),t}}},[])}function Exe(e){const{tooltip:n,...t}=e;if(!n)return{filteredEncoding:t};let o,f;if(zr(n)){for(const r of n)r.aggregate?(o||(o=[]),o.push(r)):(f||(f=[]),f.push(r));o&&(t.tooltip=o)}else n.aggregate?t.tooltip=n:f=n;return zr(f)&&f.length===1&&(f=f[0]),{customTooltipWithoutAggregatedField:f,filteredEncoding:t}}function MT(e,n,t,o=!0){if("tooltip"in t)return{tooltip:t.tooltip};const f=e.map(({fieldPrefix:a,titlePrefix:l})=>{const c=o?` of ${R8(n)}`:"";return{field:a+n.field,type:n.type,title:ji(l)?{signal:`${l}"${escape(c)}"`}:l+c}}),r=Txe(t).map(uxe);return{tooltip:[...f,...Zf(r,Ba)]}}function R8(e){const{title:n,field:t}=e;return zs(n,t)}function z8(e,n,t,o,f){const{scale:r,axis:a}=t;return({partName:l,mark:c,positionPrefix:i,endPositionPrefix:s=void 0,extraEncoding:u={}})=>{const h=R8(t);return QV(e,l,f,{mark:c,encoding:{[n]:{field:`${i}_${t.field}`,type:t.type,...h!==void 0?{title:h}:{},...r!==void 0?{scale:r}:{},...a!==void 0?{axis:a}:{}},...Li(s)?{[`${n}2`]:{field:`${s}_${t.field}`}}:{},...o,...u}})}}function QV(e,n,t,o){const{clip:f,color:r,opacity:a}=e,l=e.type;return e[n]||e[n]===void 0&&t[n]?[{...o,mark:{...t[n],...f?{clip:f}:{},...r?{color:r}:{},...a?{opacity:a}:{},...fh(o.mark)?o.mark:{type:o.mark},style:`${l}-${String(n)}`,...s1(e[n])?{}:e[n]}}]:[]}function eq(e,n,t){const{encoding:o}=e,f=n==="vertical"?"y":"x",r=o[f],a=o[`${f}2`],l=o[`${f}Error`],c=o[`${f}Error2`];return{continuousAxisChannelDef:Jb(r,t),continuousAxisChannelDef2:Jb(a,t),continuousAxisChannelDefError:Jb(l,t),continuousAxisChannelDefError2:Jb(c,t),continuousAxis:f}}function Jb(e,n){if(e?.aggregate){const{aggregate:t,...o}=e;return t!==n&&ei(Zye(t,n)),o}else return e}function tq(e,n){const{mark:t,encoding:o}=e,{x:f,y:r}=o;if(fh(t)&&t.orient)return t.orient;if(Gd(f)){if(Gd(r)){const a=ni(f)&&f.aggregate,l=ni(r)&&r.aggregate;if(!a&&l===n)return"vertical";if(!l&&a===n)return"horizontal";if(a===n&&l===n)throw new Error("Both x and y cannot have aggregate");return Jm(r)&&!Jm(f)?"horizontal":"vertical"}return"horizontal"}else{if(Gd(r))return"vertical";throw new Error(`Need a valid continuous axis for ${n}s`)}}const aw="boxplot",Sxe=["box","median","outliers","rule","ticks"],Cxe=new Q3(aw,rq);function nq(e){return Eo(e)?"tukey":e}function rq(e,{config:n}){e={...e,encoding:e5(e.encoding,n)};const{mark:t,encoding:o,params:f,projection:r,...a}=e,l=fh(t)?t:{type:t};f&&ei(Q$("boxplot"));const c=l.extent??n.boxplot.extent,i=uo("size",l,n),s=l.invalid,u=nq(c),{bins:h,timeUnits:d,transform:m,continuousAxisChannelDef:p,continuousAxis:g,groupby:y,aggregate:v,encodingWithoutContinuousAxis:x,ticksOrient:_,boxOrient:A,customTooltipWithoutAggregatedField:b}=Lxe(e,c,n),{color:k,size:w,...M}=x,T=ae=>z8(l,g,p,ae,n.boxplot),E=T(M),S=T(x),P=T({...M,...w?{size:w}:{}}),L=MT([{fieldPrefix:u==="min-max"?"upper_whisker_":"max_",titlePrefix:"Max"},{fieldPrefix:"upper_box_",titlePrefix:"Q3"},{fieldPrefix:"mid_box_",titlePrefix:"Median"},{fieldPrefix:"lower_box_",titlePrefix:"Q1"},{fieldPrefix:u==="min-max"?"lower_whisker_":"min_",titlePrefix:"Min"}],p,x),R={type:"tick",color:"black",opacity:1,orient:_,invalid:s,aria:!1},F=u==="min-max"?L:MT([{fieldPrefix:"upper_whisker_",titlePrefix:"Upper Whisker"},{fieldPrefix:"lower_whisker_",titlePrefix:"Lower Whisker"}],p,x),D=[...E({partName:"rule",mark:{type:"rule",invalid:s,aria:!1},positionPrefix:"lower_whisker",endPositionPrefix:"lower_box",extraEncoding:F}),...E({partName:"rule",mark:{type:"rule",invalid:s,aria:!1},positionPrefix:"upper_box",endPositionPrefix:"upper_whisker",extraEncoding:F}),...E({partName:"ticks",mark:R,positionPrefix:"lower_whisker",extraEncoding:F}),...E({partName:"ticks",mark:R,positionPrefix:"upper_whisker",extraEncoding:F})],O=[...u!=="tukey"?D:[],...S({partName:"box",mark:{type:"bar",...i?{size:i}:{},orient:A,invalid:s,ariaRoleDescription:"box"},positionPrefix:"lower_box",endPositionPrefix:"upper_box",extraEncoding:L}),...P({partName:"median",mark:{type:"tick",invalid:s,...Si(n.boxplot.median)&&n.boxplot.median.color?{color:n.boxplot.median.color}:{},...i?{size:i}:{},orient:_,aria:!1},positionPrefix:"mid_box",extraEncoding:L})];if(u==="min-max")return{...a,transform:(a.transform??[]).concat(m),layer:O};const N=`datum["lower_box_${p.field}"]`,B=`datum["upper_box_${p.field}"]`,W=`(${B} - ${N})`,G=`${N} - ${c} * ${W}`,K=`${B} + ${c} * ${W}`,te=`datum["${p.field}"]`,Y={joinaggregate:iq(p.field),groupby:y},J={transform:[{filter:`(${G} <= ${te}) && (${te} <= ${K})`},{aggregate:[{op:"min",field:p.field,as:`lower_whisker_${p.field}`},{op:"max",field:p.field,as:`upper_whisker_${p.field}`},{op:"min",field:`lower_box_${p.field}`,as:`lower_box_${p.field}`},{op:"max",field:`upper_box_${p.field}`,as:`upper_box_${p.field}`},...v],groupby:y}],layer:D},{tooltip:re,...U}=M,{scale:V,axis:H}=p,ne=R8(p),q=ju(H,["title"]),Q=QV(l,"outliers",n.boxplot,{transform:[{filter:`(${te} < ${G}) || (${te} > ${K})`}],mark:"point",encoding:{[g]:{field:p.field,type:p.type,...ne!==void 0?{title:ne}:{},...V!==void 0?{scale:V}:{},...Mo(q)?{}:{axis:q}},...U,...k?{color:k}:{},...b?{tooltip:b}:{}}})[0];let ee;const ie=[...h,...d,Y];return Q?ee={transform:ie,layer:[Q,J]}:(ee=J,ee.transform.unshift(...ie)),{...a,layer:[ee,{transform:m,layer:O}]}}function iq(e){return[{op:"q1",field:e,as:`lower_box_${e}`},{op:"q3",field:e,as:`upper_box_${e}`}]}function Lxe(e,n,t){const o=tq(e,aw),{continuousAxisChannelDef:f,continuousAxis:r}=eq(e,o,aw),a=f.field,l=nq(n),c=[...iq(a),{op:"median",field:a,as:`mid_box_${a}`},{op:"min",field:a,as:(l==="min-max"?"lower_whisker_":"min_")+a},{op:"max",field:a,as:(l==="min-max"?"upper_whisker_":"max_")+a}],i=l==="min-max"||l==="tukey"?[]:[{calculate:`datum["upper_box_${a}"] - datum["lower_box_${a}"]`,as:`iqr_${a}`},{calculate:`min(datum["upper_box_${a}"] + datum["iqr_${a}"] * ${n}, datum["max_${a}"])`,as:`upper_whisker_${a}`},{calculate:`max(datum["lower_box_${a}"] - datum["iqr_${a}"] * ${n}, datum["min_${a}"])`,as:`lower_whisker_${a}`}],{[r]:s,...u}=e.encoding,{customTooltipWithoutAggregatedField:h,filteredEncoding:d}=Exe(u),{bins:m,timeUnits:p,aggregate:g,groupby:y,encoding:v}=JV(d,t),x=o==="vertical"?"horizontal":"vertical",_=o,A=[...m,...p,{aggregate:[...g,...c],groupby:y},...i];return{bins:m,timeUnits:p,transform:A,groupby:y,aggregate:g,continuousAxisChannelDef:f,continuousAxis:r,encodingWithoutContinuousAxis:v,ticksOrient:x,boxOrient:_,customTooltipWithoutAggregatedField:h}}const N8="errorbar",Dxe=["ticks","rule"],Oxe=new Q3(N8,aq);function aq(e,{config:n}){e={...e,encoding:e5(e.encoding,n)};const{transform:t,continuousAxisChannelDef:o,continuousAxis:f,encodingWithoutContinuousAxis:r,ticksOrient:a,markDef:l,outerSpec:c,tooltipEncoding:i}=oq(e,N8,n);delete r.size;const s=z8(l,f,o,r,n.errorbar),u=l.thickness,h=l.size,d={type:"tick",orient:a,aria:!1,...u!==void 0?{thickness:u}:{},...h!==void 0?{size:h}:{}},m=[...s({partName:"ticks",mark:d,positionPrefix:"lower",extraEncoding:i}),...s({partName:"ticks",mark:d,positionPrefix:"upper",extraEncoding:i}),...s({partName:"rule",mark:{type:"rule",ariaRoleDescription:"errorbar",...u!==void 0?{size:u}:{}},positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:i})];return{...c,transform:t,...m.length>1?{layer:m}:{...m[0]}}}function Pxe(e,n){const{encoding:t}=e;if(Ixe(t))return{orient:tq(e,n),inputType:"raw"};const o=Fxe(t),f=Rxe(t),r=t.x,a=t.y;if(o){if(f)throw new Error(`${n} cannot be both type aggregated-upper-lower and aggregated-error`);const l=t.x2,c=t.y2;if(fa(l)&&fa(c))throw new Error(`${n} cannot have both x2 and y2`);if(fa(l)){if(Gd(r))return{orient:"horizontal",inputType:"aggregated-upper-lower"};throw new Error(`Both x and x2 have to be quantitative in ${n}`)}else if(fa(c)){if(Gd(a))return{orient:"vertical",inputType:"aggregated-upper-lower"};throw new Error(`Both y and y2 have to be quantitative in ${n}`)}throw new Error("No ranged axis")}else{const l=t.xError,c=t.xError2,i=t.yError,s=t.yError2;if(fa(c)&&!fa(l))throw new Error(`${n} cannot have xError2 without xError`);if(fa(s)&&!fa(i))throw new Error(`${n} cannot have yError2 without yError`);if(fa(l)&&fa(i))throw new Error(`${n} cannot have both xError and yError with both are quantiative`);if(fa(l)){if(Gd(r))return{orient:"horizontal",inputType:"aggregated-error"};throw new Error("All x, xError, and xError2 (if exist) have to be quantitative")}else if(fa(i)){if(Gd(a))return{orient:"vertical",inputType:"aggregated-error"};throw new Error("All y, yError, and yError2 (if exist) have to be quantitative")}throw new Error("No ranged axis")}}function Ixe(e){return(fa(e.x)||fa(e.y))&&!fa(e.x2)&&!fa(e.y2)&&!fa(e.xError)&&!fa(e.xError2)&&!fa(e.yError)&&!fa(e.yError2)}function Fxe(e){return fa(e.x2)||fa(e.y2)}function Rxe(e){return fa(e.xError)||fa(e.xError2)||fa(e.yError)||fa(e.yError2)}function oq(e,n,t){const{mark:o,encoding:f,params:r,projection:a,...l}=e,c=fh(o)?o:{type:o};r&&ei(Q$(n));const{orient:i,inputType:s}=Pxe(e,n),{continuousAxisChannelDef:u,continuousAxisChannelDef2:h,continuousAxisChannelDefError:d,continuousAxisChannelDefError2:m,continuousAxis:p}=eq(e,i,n),{errorBarSpecificAggregate:g,postAggregateCalculates:y,tooltipSummary:v,tooltipTitleWithFieldName:x}=zxe(c,u,h,d,m,s,n,t),{[p]:_,[p==="x"?"x2":"y2"]:A,[p==="x"?"xError":"yError"]:b,[p==="x"?"xError2":"yError2"]:k,...w}=f,{bins:M,timeUnits:T,aggregate:E,groupby:S,encoding:P}=JV(w,t),L=[...E,...g],R=s!=="raw"?[]:S,F=MT(v,u,P,x);return{transform:[...l.transform??[],...M,...T,...L.length===0?[]:[{aggregate:L,groupby:R}],...y],groupby:R,continuousAxisChannelDef:u,continuousAxis:p,encodingWithoutContinuousAxis:P,ticksOrient:i==="vertical"?"horizontal":"vertical",markDef:c,outerSpec:l,tooltipEncoding:F}}function zxe(e,n,t,o,f,r,a,l){let c=[],i=[];const s=n.field;let u,h=!1;if(r==="raw"){const d=e.center?e.center:e.extent?e.extent==="iqr"?"median":"mean":l.errorbar.center,m=e.extent?e.extent:d==="mean"?"stderr":"iqr";if(d==="median"!=(m==="iqr")&&ei(Xye(d,m,a)),m==="stderr"||m==="stdev")c=[{op:m,field:s,as:`extent_${s}`},{op:d,field:s,as:`center_${s}`}],i=[{calculate:`datum["center_${s}"] + datum["extent_${s}"]`,as:`upper_${s}`},{calculate:`datum["center_${s}"] - datum["extent_${s}"]`,as:`lower_${s}`}],u=[{fieldPrefix:"center_",titlePrefix:Ax(d)},{fieldPrefix:"upper_",titlePrefix:qO(d,m,"+")},{fieldPrefix:"lower_",titlePrefix:qO(d,m,"-")}],h=!0;else{let p,g,y;m==="ci"?(p="mean",g="ci0",y="ci1"):(p="median",g="q1",y="q3"),c=[{op:g,field:s,as:`lower_${s}`},{op:y,field:s,as:`upper_${s}`},{op:p,field:s,as:`center_${s}`}],u=[{fieldPrefix:"upper_",titlePrefix:_m({field:s,aggregate:y,type:"quantitative"},l,{allowDisabling:!1})},{fieldPrefix:"lower_",titlePrefix:_m({field:s,aggregate:g,type:"quantitative"},l,{allowDisabling:!1})},{fieldPrefix:"center_",titlePrefix:_m({field:s,aggregate:p,type:"quantitative"},l,{allowDisabling:!1})}]}}else{(e.center||e.extent)&&ei(Yye(e.center,e.extent)),r==="aggregated-upper-lower"?(u=[],i=[{calculate:`datum["${t.field}"]`,as:`upper_${s}`},{calculate:`datum["${s}"]`,as:`lower_${s}`}]):r==="aggregated-error"&&(u=[{fieldPrefix:"",titlePrefix:s}],i=[{calculate:`datum["${s}"] + datum["${o.field}"]`,as:`upper_${s}`}],f?i.push({calculate:`datum["${s}"] + datum["${f.field}"]`,as:`lower_${s}`}):i.push({calculate:`datum["${s}"] - datum["${o.field}"]`,as:`lower_${s}`}));for(const d of i)u.push({fieldPrefix:d.as.substring(0,6),titlePrefix:V0(V0(d.calculate,'datum["',""),'"]',"")})}return{postAggregateCalculates:i,errorBarSpecificAggregate:c,tooltipSummary:u,tooltipTitleWithFieldName:h}}function qO(e,n,t){return`${Ax(e)} ${t} ${n}`}const B8="errorband",Nxe=["band","borders"],Bxe=new Q3(B8,sq);function sq(e,{config:n}){e={...e,encoding:e5(e.encoding,n)};const{transform:t,continuousAxisChannelDef:o,continuousAxis:f,encodingWithoutContinuousAxis:r,markDef:a,outerSpec:l,tooltipEncoding:c}=oq(e,B8,n),i=a,s=z8(i,f,o,r,n.errorband),u=e.encoding.x!==void 0&&e.encoding.y!==void 0;let h={type:u?"area":"rect"},d={type:u?"line":"rule"};const m={...i.interpolate?{interpolate:i.interpolate}:{},...i.tension&&i.interpolate?{tension:i.tension}:{}};return u?(h={...h,...m,ariaRoleDescription:"errorband"},d={...d,...m,aria:!1}):i.interpolate?ei(FO("interpolate")):i.tension&&ei(FO("tension")),{...l,transform:t,layer:[...s({partName:"band",mark:h,positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:c}),...s({partName:"borders",mark:d,positionPrefix:"lower",extraEncoding:c}),...s({partName:"borders",mark:d,positionPrefix:"upper",extraEncoding:c})]}}const lq={};function j8(e,n,t){const o=new Q3(e,n);lq[e]={normalizer:o,parts:t}}function jxe(){return Zr(lq)}j8(aw,rq,Sxe);j8(N8,aq,Dxe);j8(B8,sq,Nxe);const Uxe=["gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity"],uq={titleAlign:"align",titleAnchor:"anchor",titleAngle:"angle",titleBaseline:"baseline",titleColor:"color",titleFont:"font",titleFontSize:"fontSize",titleFontStyle:"fontStyle",titleFontWeight:"fontWeight",titleLimit:"limit",titleLineHeight:"lineHeight",titleOrient:"orient",titlePadding:"offset"},cq={labelAlign:"align",labelAnchor:"anchor",labelAngle:"angle",labelBaseline:"baseline",labelColor:"color",labelFont:"font",labelFontSize:"fontSize",labelFontStyle:"fontStyle",labelFontWeight:"fontWeight",labelLimit:"limit",labelLineHeight:"lineHeight",labelOrient:"orient",labelPadding:"offset"},$xe=Zr(uq),Vxe=Zr(cq),qxe={header:1,headerRow:1,headerColumn:1,headerFacet:1},fq=Zr(qxe),hq=["size","shape","fill","stroke","strokeDash","strokeWidth","opacity"],Hxe={gradientHorizontalMaxLength:200,gradientHorizontalMinLength:100,gradientVerticalMaxLength:200,gradientVerticalMinLength:64,unselectedOpacity:.35},Gxe={aria:1,clipHeight:1,columnPadding:1,columns:1,cornerRadius:1,description:1,direction:1,fillColor:1,format:1,formatType:1,gradientLength:1,gradientOpacity:1,gradientStrokeColor:1,gradientStrokeWidth:1,gradientThickness:1,gridAlign:1,labelAlign:1,labelBaseline:1,labelColor:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labelSeparation:1,legendX:1,legendY:1,offset:1,orient:1,padding:1,rowPadding:1,strokeColor:1,symbolDash:1,symbolDashOffset:1,symbolFillColor:1,symbolLimit:1,symbolOffset:1,symbolOpacity:1,symbolSize:1,symbolStrokeColor:1,symbolStrokeWidth:1,symbolType:1,tickCount:1,tickMinStep:1,title:1,titleAlign:1,titleAnchor:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titleOrient:1,titlePadding:1,type:1,values:1,zindex:1},_f="_vgsid_",Wxe={point:{on:"click",fields:[_f],toggle:"event.shiftKey",resolve:"global",clear:"dblclick"},interval:{on:"[mousedown, window:mouseup] > window:mousemove!",encodings:["x","y"],translate:"[mousedown, window:mouseup] > window:mousemove!",zoom:"wheel!",mark:{fill:"#333",fillOpacity:.125,stroke:"white"},resolve:"global",clear:"dblclick"}};function U8(e){return e==="legend"||!!e?.legend}function hA(e){return U8(e)&&Si(e)}function $8(e){return!!e?.select}function dq(e){const n=[];for(const t of e||[]){if($8(t))continue;const{expr:o,bind:f,...r}=t;if(f&&o){const a={...r,bind:f,init:o};n.push(a)}else{const a={...r,...o?{update:o}:{},...f?{bind:f}:{}};n.push(a)}}return n}function Yxe(e){return t5(e)||q8(e)||V8(e)}function V8(e){return"concat"in e}function t5(e){return"vconcat"in e}function q8(e){return"hconcat"in e}function pq({step:e,offsetIsDiscrete:n}){return n?e.for??"offset":"position"}function dh(e){return Si(e)&&e.step!==void 0}function HO(e){return e.view||e.width||e.height}const GO=20,Xxe={align:1,bounds:1,center:1,columns:1,spacing:1},Zxe=Zr(Xxe);function Jxe(e,n,t){const o=t[n],f={},{spacing:r,columns:a}=o;r!==void 0&&(f.spacing=r),a!==void 0&&(Y3(e)&&!Cx(e.facet)||V8(e))&&(f.columns=a),t5(e)&&(f.columns=1);for(const l of Zxe)if(e[l]!==void 0)if(l==="spacing"){const c=e[l];f[l]=Eo(c)?c:{row:c.row??r,column:c.column??r}}else f[l]=e[l];return f}function ET(e,n){return e[n]??e[n==="width"?"continuousWidth":"continuousHeight"]}function ow(e,n){const t=sw(e,n);return dh(t)?t.step:gq}function sw(e,n){const t=e[n]??e[n==="width"?"discreteWidth":"discreteHeight"];return zs(t,{step:e.step})}const gq=20,Kxe={continuousWidth:200,continuousHeight:200,step:gq},Qxe={background:"white",padding:5,timeFormat:"%b %d, %Y",countTitle:"Count of Records",view:Kxe,mark:Hve,arc:{},area:{},bar:Yve,circle:{},geoshape:{},image:{},line:{},point:{},rect:Xve,rule:{color:"black"},square:{},text:{color:"black"},tick:Zve,trail:{},boxplot:{size:14,extent:1.5,box:{},median:{color:"white"},outliers:{},rule:{},ticks:null},errorbar:{center:"mean",rule:!0,ticks:!1},errorband:{band:{opacity:.3},borders:!1},scale:Eve,projection:{},legend:Hxe,header:{titlePadding:10,labelPadding:10},headerColumn:{},headerRow:{},headerFacet:{},selection:Wxe,style:{},title:{},facet:{spacing:GO},concat:{spacing:GO},normalizedNumberFormat:".0%"},Fh=["#4c78a8","#f58518","#e45756","#72b7b2","#54a24b","#eeca3b","#b279a2","#ff9da6","#9d755d","#bab0ac"],WO={text:11,guideLabel:10,guideTitle:11,groupTitle:13,groupSubtitle:12},YO={blue:Fh[0],orange:Fh[1],red:Fh[2],teal:Fh[3],green:Fh[4],yellow:Fh[5],purple:Fh[6],pink:Fh[7],brown:Fh[8],gray0:"#000",gray1:"#111",gray2:"#222",gray3:"#333",gray4:"#444",gray5:"#555",gray6:"#666",gray7:"#777",gray8:"#888",gray9:"#999",gray10:"#aaa",gray11:"#bbb",gray12:"#ccc",gray13:"#ddd",gray14:"#eee",gray15:"#fff"};function ebe(e={}){return{signals:[{name:"color",value:Si(e)?{...YO,...e}:YO}],mark:{color:{signal:"color.blue"}},rule:{color:{signal:"color.gray0"}},text:{color:{signal:"color.gray0"}},style:{"guide-label":{fill:{signal:"color.gray0"}},"guide-title":{fill:{signal:"color.gray0"}},"group-title":{fill:{signal:"color.gray0"}},"group-subtitle":{fill:{signal:"color.gray0"}},cell:{stroke:{signal:"color.gray8"}}},axis:{domainColor:{signal:"color.gray13"},gridColor:{signal:"color.gray8"},tickColor:{signal:"color.gray13"}},range:{category:[{signal:"color.blue"},{signal:"color.orange"},{signal:"color.red"},{signal:"color.teal"},{signal:"color.green"},{signal:"color.yellow"},{signal:"color.purple"},{signal:"color.pink"},{signal:"color.brown"},{signal:"color.grey8"}]}}}function tbe(e){return{signals:[{name:"fontSize",value:Si(e)?{...WO,...e}:WO}],text:{fontSize:{signal:"fontSize.text"}},style:{"guide-label":{fontSize:{signal:"fontSize.guideLabel"}},"guide-title":{fontSize:{signal:"fontSize.guideTitle"}},"group-title":{fontSize:{signal:"fontSize.groupTitle"}},"group-subtitle":{fontSize:{signal:"fontSize.groupSubtitle"}}}}}function nbe(e){return{text:{font:e},style:{"guide-label":{font:e},"guide-title":{font:e},"group-title":{font:e},"group-subtitle":{font:e}}}}function mq(e){const n=Zr(e||{}),t={};for(const o of n){const f=e[o];t[o]=Ox(f)?G$(f):ac(f)}return t}function rbe(e){const n=Zr(e),t={};for(const o of n)t[o]=mq(e[o]);return t}const ibe=[...EV,...XV,...fq,"background","padding","legend","lineBreak","scale","style","title","view"];function yq(e={}){const{color:n,font:t,fontSize:o,selection:f,...r}=e,a=o6({},la(Qxe),t?nbe(t):{},n?ebe(n):{},o?tbe(o):{},r||{});f&&Xv(a,"selection",f,!0);const l=ju(a,ibe);for(const c of["background","lineBreak","padding"])a[c]&&(l[c]=ac(a[c]));for(const c of EV)a[c]&&(l[c]=Iu(a[c]));for(const c of XV)a[c]&&(l[c]=mq(a[c]));for(const c of fq)a[c]&&(l[c]=Iu(a[c]));return a.legend&&(l.legend=Iu(a.legend)),a.scale&&(l.scale=Iu(a.scale)),a.style&&(l.style=rbe(a.style)),a.title&&(l.title=Iu(a.title)),a.view&&(l.view=Iu(a.view)),l}const abe=new Set(["view",...Bve]),obe=["color","fontSize","background","padding","facet","concat","numberFormat","numberFormatType","normalizedNumberFormat","normalizedNumberFormatType","timeFormat","countTitle","header","axisQuantitative","axisTemporal","axisDiscrete","axisPoint","axisXBand","axisXPoint","axisXDiscrete","axisXQuantitative","axisXTemporal","axisYBand","axisYPoint","axisYDiscrete","axisYQuantitative","axisYTemporal","scale","selection","overlay"],sbe={view:["continuousWidth","continuousHeight","discreteWidth","discreteHeight","step"],...qve};function lbe(e){e=la(e);for(const n of obe)delete e[n];if(e.axis)for(const n in e.axis)Ox(e.axis[n])&&delete e.axis[n];if(e.legend)for(const n of Uxe)delete e.legend[n];if(e.mark){for(const n of zO)delete e.mark[n];e.mark.tooltip&&Si(e.mark.tooltip)&&delete e.mark.tooltip}e.params&&(e.signals=(e.signals||[]).concat(dq(e.params)),delete e.params);for(const n of abe){for(const o of zO)delete e[n][o];const t=sbe[n];if(t)for(const o of t)delete e[n][o];cbe(e,n)}for(const n of jxe())delete e[n];ube(e);for(const n in e)Si(e[n])&&Mo(e[n])&&delete e[n];return Mo(e)?void 0:e}function ube(e){const{titleMarkConfig:n,subtitleMarkConfig:t,subtitle:o}=H$(e.title);Mo(n)||(e.style["group-title"]={...e.style["group-title"],...n}),Mo(t)||(e.style["group-subtitle"]={...e.style["group-subtitle"],...t}),Mo(o)?delete e.title:e.title=o}function cbe(e,n,t,o){const f=o?e[n][o]:e[n];n==="view"&&(t="cell");const r={...f,...e.style[t??n]};Mo(r)||(e.style[t??n]=r),o||delete e[n]}function n5(e){return"layer"in e}function fbe(e){return"repeat"in e}function hbe(e){return!zr(e.repeat)&&e.repeat.layer}class H8{map(n,t){return Y3(n)?this.mapFacet(n,t):fbe(n)?this.mapRepeat(n,t):q8(n)?this.mapHConcat(n,t):t5(n)?this.mapVConcat(n,t):V8(n)?this.mapConcat(n,t):this.mapLayerOrUnit(n,t)}mapLayerOrUnit(n,t){if(n5(n))return this.mapLayer(n,t);if(md(n))return this.mapUnit(n,t);throw new Error(o8(n))}mapLayer(n,t){return{...n,layer:n.layer.map(o=>this.mapLayerOrUnit(o,t))}}mapHConcat(n,t){return{...n,hconcat:n.hconcat.map(o=>this.map(o,t))}}mapVConcat(n,t){return{...n,vconcat:n.vconcat.map(o=>this.map(o,t))}}mapConcat(n,t){const{concat:o,...f}=n;return{...f,concat:o.map(r=>this.map(r,t))}}mapFacet(n,t){return{...n,spec:this.map(n.spec,t)}}mapRepeat(n,t){return{...n,spec:this.map(n.spec,t)}}}const dbe={zero:1,center:1,normalize:1};function pbe(e){return e in dbe}const gbe=new Set([kV,q3,V3,Q_,G3,w8,A8,H3,TV,_8]),mbe=new Set([q3,V3,kV]);function tm(e){return ni(e)&&Xm(e)==="quantitative"&&!e.bin}function XO(e,n,{orient:t,type:o}){const f=n==="x"?"y":"radius",r=n==="x",a=e[n],l=e[f];if(ni(a)&&ni(l))if(tm(a)&&tm(l)){if(a.stack)return n;if(l.stack)return f;const c=ni(a)&&!!a.aggregate,i=ni(l)&&!!l.aggregate;if(c!==i)return c?n:f;if(r&&o==="bar"){if(t==="vertical")return f;if(t==="horizontal")return n}}else{if(tm(a))return n;if(tm(l))return f}else{if(tm(a))return n;if(tm(l))return f}}function ybe(e){switch(e){case"x":return"y";case"y":return"x";case"theta":return"radius";case"radius":return"theta"}}function vq(e,n){const t=fh(e)?e:{type:e},o=t.type;if(!gbe.has(o))return null;const f=XO(n,"x",t)||XO(n,"theta",t);if(!f)return null;const r=n[f],a=ni(r)?hi(r,{}):void 0,l=ybe(f),c=[],i=new Set;if(n[l]){const h=n[l],d=ni(h)?hi(h,{}):void 0;d&&d!==a&&(c.push(l),i.add(d));const m=l==="x"?"xOffset":"yOffset",p=n[m],g=ni(p)?hi(p,{}):void 0;g&&g!==a&&(c.push(m),i.add(g))}const s=C1e.reduce((h,d)=>{if(d!=="tooltip"&&E0(n,d)){const m=n[d];for(const p of Ti(m)){const g=hh(p);if(g.aggregate)continue;const y=hi(g,{});(!y||!i.has(y))&&h.push({channel:d,fieldDef:g})}}return h},[]);let u;return r.stack!==void 0?s1(r.stack)?u=r.stack?"zero":null:u=r.stack:mbe.has(o)&&(u="zero"),!u||!pbe(u)||I8(n)&&s.length===0?null:r?.scale?.type&&r?.scale?.type!==Uu.LINEAR?(r?.stack&&ei(Hye(r.scale.type)),null):fa(n[_h(f)])?(r.stack!==void 0&&ei(qye(f)),null):(ni(r)&&r.aggregate&&!U1e.has(r.aggregate)&&ei(Gye(r.aggregate)),{groupbyChannels:c,groupbyFields:i,fieldChannel:f,impute:r.impute===null?!1:Lp(o),stackBy:s,offset:u})}function vbe(e){const{point:n,line:t,...o}=e;return Zr(o).length>1?o:o.type}function xbe(e){for(const n of["line","area","rule","trail"])e[n]&&(e={...e,[n]:ju(e[n],["point","line"])});return e}function dA(e,n={},t){return e.point==="transparent"?{opacity:0}:e.point?Si(e.point)?e.point:{}:e.point!==void 0?null:n.point||t.shape?Si(n.point)?n.point:{}:void 0}function ZO(e,n={}){return e.line?e.line===!0?{}:e.line:e.line!==void 0?null:n.line?n.line===!0?{}:n.line:void 0}class bbe{constructor(){this.name="path-overlay"}hasMatchingType(n,t){if(md(n)){const{mark:o,encoding:f}=n,r=fh(o)?o:{type:o};switch(r.type){case"line":case"rule":case"trail":return!!dA(r,t[r.type],f);case"area":return!!dA(r,t[r.type],f)||!!ZO(r,t[r.type])}}return!1}run(n,t,o){const{config:f}=t,{params:r,projection:a,mark:l,name:c,encoding:i,...s}=n,u=e5(i,f),h=fh(l)?l:{type:l},d=dA(h,f[h.type],u),m=h.type==="area"&&ZO(h,f[h.type]),p=[{name:c,...r?{params:r}:{},mark:vbe({...h.type==="area"&&h.opacity===void 0&&h.fillOpacity===void 0?{opacity:.7}:{},...h}),encoding:ju(u,["shape"])}],g=vq(h,u);let y=u;if(g){const{fieldChannel:v,offset:x}=g;y={...u,[v]:{...u[v],...x?{stack:x}:{}}}}return y=ju(y,["y2","x2"]),m&&p.push({...a?{projection:a}:{},mark:{type:"line",...Vm(h,["clip","interpolate","tension","tooltip"]),...m},encoding:y}),d&&p.push({...a?{projection:a}:{},mark:{type:"point",opacity:1,filled:!0,...Vm(h,["clip","tooltip"]),...d},encoding:y}),o({...s,layer:p},{...t,config:xbe(f)})}}function _be(e,n){return n?Cx(e)?bq(e,n):xq(e,n):e}function pA(e,n){return n?bq(e,n):e}function ST(e,n,t){const o=n[e];if(sxe(o)){if(o.repeat in t)return{...n,[e]:t[o.repeat]};ei(oye(o.repeat));return}return n}function xq(e,n){if(e=ST("field",e,n),e!==void 0){if(e===null)return null;if(L8(e)&&nh(e.sort)){const t=ST("field",e.sort,n);e={...e,...t?{sort:t}:{}}}return e}}function JO(e,n){if(ni(e))return xq(e,n);{const t=ST("datum",e,n);return t!==e&&!t.type&&(t.type="nominal"),t}}function KO(e,n){if(fa(e)){const t=JO(e,n);if(t)return t;if(X3(e))return{condition:e.condition}}else{if(Lx(e)){const t=JO(e.condition,n);if(t)return{...e,condition:t};{const{condition:o,...f}=e;return f}}return e}}function bq(e,n){const t={};for(const o in e)if(Yi(e,o)){const f=e[o];if(zr(f))t[o]=f.map(r=>KO(r,n)).filter(r=>r);else{const r=KO(f,n);r!==void 0&&(t[o]=r)}}return t}class wbe{constructor(){this.name="RuleForRangedLine"}hasMatchingType(n){if(md(n)){const{encoding:t,mark:o}=n;if(o==="line"||fh(o)&&o.type==="line")for(const f of E1e){const r=cg(f),a=t[r];if(t[f]&&(ni(a)&&!Ml(a.bin)||Ah(a)))return!0}}return!1}run(n,t,o){const{encoding:f,mark:r}=n;return ei(Eye(!!f.x2,!!f.y2)),o({...n,mark:Si(r)?{...r,type:"rule"}:"rule"},t)}}class Abe extends H8{constructor(){super(...arguments),this.nonFacetUnitNormalizers=[Cxe,Oxe,Bxe,new bbe,new wbe]}map(n,t){if(md(n)){const o=E0(n.encoding,Zh),f=E0(n.encoding,Jh),r=E0(n.encoding,P3);if(o||f||r)return this.mapFacetedUnit(n,t)}return super.map(n,t)}mapUnit(n,t){const{parentEncoding:o,parentProjection:f}=t,r=pA(n.encoding,t.repeater),a={...n,...n.name?{name:[t.repeaterPrefix,n.name].filter(c=>c).join("_")}:{},...r?{encoding:r}:{}};if(o||f)return this.mapUnitWithParentEncodingOrProjection(a,t);const l=this.mapLayerOrUnit.bind(this);for(const c of this.nonFacetUnitNormalizers)if(c.hasMatchingType(a,t.config))return c.run(a,t,l);return a}mapRepeat(n,t){return hbe(n)?this.mapLayerRepeat(n,t):this.mapNonLayerRepeat(n,t)}mapLayerRepeat(n,t){const{repeat:o,spec:f,...r}=n,{row:a,column:l,layer:c}=o,{repeater:i={},repeaterPrefix:s=""}=t;return a||l?this.mapRepeat({...n,repeat:{...a?{row:a}:{},...l?{column:l}:{}},spec:{repeat:{layer:c},spec:f}},t):{...r,layer:c.map(u=>{const h={...i,layer:u},d=`${(f.name?`${f.name}_`:"")+s}child__layer_${es(u)}`,m=this.mapLayerOrUnit(f,{...t,repeater:h,repeaterPrefix:d});return m.name=d,m})}}mapNonLayerRepeat(n,t){const{repeat:o,spec:f,data:r,...a}=n;!zr(o)&&n.columns&&(n=ju(n,["columns"]),ei(DO("repeat")));const l=[],{repeater:c={},repeaterPrefix:i=""}=t,s=!zr(o)&&o.row||[c?c.row:null],u=!zr(o)&&o.column||[c?c.column:null],h=zr(o)&&o||[c?c.repeat:null];for(const m of h)for(const p of s)for(const g of u){const y={repeat:m,row:p,column:g,layer:c.layer},v=(f.name?`${f.name}_`:"")+i+"child__"+(zr(o)?`${es(m)}`:(o.row?`row_${es(p)}`:"")+(o.column?`column_${es(g)}`:"")),x=this.map(f,{...t,repeater:y,repeaterPrefix:v});x.name=v,l.push(ju(x,["data"]))}const d=zr(o)?n.columns:o.column?o.column.length:1;return{data:f.data??r,align:"all",...a,columns:d,concat:l}}mapFacet(n,t){const{facet:o}=n;return Cx(o)&&n.columns&&(n=ju(n,["columns"]),ei(DO("facet"))),super.mapFacet(n,t)}mapUnitWithParentEncodingOrProjection(n,t){const{encoding:o,projection:f}=n,{parentEncoding:r,parentProjection:a,config:l}=t,c=eP({parentProjection:a,projection:f}),i=QO({parentEncoding:r,encoding:pA(o,t.repeater)});return this.mapUnit({...n,...c?{projection:c}:{},...i?{encoding:i}:{}},{config:l})}mapFacetedUnit(n,t){const{row:o,column:f,facet:r,...a}=n.encoding,{mark:l,width:c,projection:i,height:s,view:u,params:h,encoding:d,...m}=n,{facetMapping:p,layout:g}=this.getFacetMappingAndLayout({row:o,column:f,facet:r},t),y=pA(a,t.repeater);return this.mapFacet({...m,...g,facet:p,spec:{...c?{width:c}:{},...s?{height:s}:{},...u?{view:u}:{},...i?{projection:i}:{},mark:l,encoding:y,...h?{params:h}:{}}},t)}getFacetMappingAndLayout(n,t){const{row:o,column:f,facet:r}=n;if(o||f){r&&ei(Tye([...o?[Zh]:[],...f?[Jh]:[]]));const a={},l={};for(const c of[Zh,Jh]){const i=n[c];if(i){const{align:s,center:u,spacing:h,columns:d,...m}=i;a[c]=m;for(const p of["align","center","spacing"])i[p]!==void 0&&(l[p]??(l[p]={}),l[p][c]=i[p])}}return{facetMapping:a,layout:l}}else{const{align:a,center:l,spacing:c,columns:i,...s}=r;return{facetMapping:_be(s,t.repeater),layout:{...a?{align:a}:{},...l?{center:l}:{},...c?{spacing:c}:{},...i?{columns:i}:{}}}}}mapLayer(n,{parentEncoding:t,parentProjection:o,...f}){const{encoding:r,projection:a,...l}=n,c={...f,parentEncoding:QO({parentEncoding:t,encoding:r,layer:!0}),parentProjection:eP({parentProjection:o,projection:a})};return super.mapLayer({...l,...n.name?{name:[c.repeaterPrefix,n.name].filter(i=>i).join("_")}:{}},c)}}function QO({parentEncoding:e,encoding:n={},layer:t}){let o={};if(e){const f=new Set([...Zr(e),...Zr(n)]);for(const r of f){const a=n[r],l=e[r];if(fa(a)){const c={...l,...a};o[r]=c}else Lx(a)?o[r]={...a,condition:{...l,...a.condition}}:a||a===null?o[r]=a:(t||bf(l)||ji(l)||fa(l)||zr(l))&&(o[r]=l)}}else o=n;return!o||Mo(o)?void 0:o}function eP(e){const{parentProjection:n,projection:t}=e;return n&&t&&ei(hye({parentProjection:n,projection:t})),t??n}function G8(e){return"filter"in e}function kbe(e){return e?.stop!==void 0}function _q(e){return"lookup"in e}function Tbe(e){return"data"in e}function Mbe(e){return"param"in e}function Ebe(e){return"pivot"in e}function Sbe(e){return"density"in e}function Cbe(e){return"quantile"in e}function Lbe(e){return"regression"in e}function Dbe(e){return"loess"in e}function Obe(e){return"sample"in e}function Pbe(e){return"window"in e}function Ibe(e){return"joinaggregate"in e}function Fbe(e){return"flatten"in e}function Rbe(e){return"calculate"in e}function wq(e){return"bin"in e}function zbe(e){return"impute"in e}function Nbe(e){return"timeUnit"in e}function Bbe(e){return"aggregate"in e}function jbe(e){return"stack"in e}function Ube(e){return"fold"in e}function $be(e){return"extent"in e&&!("density"in e)}function Vbe(e){return e.map(n=>G8(n)?{filter:xm(n.filter,bve)}:n)}class qbe extends H8{map(n,t){return t.emptySelections??(t.emptySelections={}),t.selectionPredicates??(t.selectionPredicates={}),n=tP(n,t),super.map(n,t)}mapLayerOrUnit(n,t){if(n=tP(n,t),n.encoding){const o={};for(const[f,r]of pp(n.encoding))o[f]=Aq(r,t);n={...n,encoding:o}}return super.mapLayerOrUnit(n,t)}mapUnit(n,t){const{selection:o,...f}=n;return o?{...f,params:pp(o).map(([r,a])=>{const{init:l,bind:c,empty:i,...s}=a;s.type==="single"?(s.type="point",s.toggle=!1):s.type==="multi"&&(s.type="point"),t.emptySelections[r]=i!=="none";for(const u of Dl(t.selectionPredicates[r]??{}))u.empty=i!=="none";return{name:r,value:l,select:s,bind:c}})}:n}}function tP(e,n){const{transform:t,...o}=e;if(t){const f=t.map(r=>{if(G8(r))return{filter:CT(r,n)};if(wq(r)&&fg(r.bin))return{...r,bin:kq(r.bin)};if(_q(r)){const{selection:a,...l}=r.from;return a?{...r,from:{param:a,...l}}:r}return r});return{...o,transform:f}}return e}function Aq(e,n){const t=la(e);if(ni(t)&&fg(t.bin)&&(t.bin=kq(t.bin)),pg(t)&&t.scale?.domain?.selection){const{selection:o,...f}=t.scale.domain;t.scale.domain={...f,...o?{param:o}:{}}}if(X3(t))if(a1(t.condition))t.condition=t.condition.map(o=>{const{selection:f,param:r,test:a,...l}=o;return r?o:{...l,test:CT(o,n)}});else{const{selection:o,param:f,test:r,...a}=Aq(t.condition,n);t.condition=f?t.condition:{...a,test:CT(t.condition,n)}}return t}function kq(e){const n=e.extent;if(n?.selection){const{selection:t,...o}=n;return{...e,extent:{...o,param:t}}}return e}function CT(e,n){const t=o=>xm(o,f=>{var r;const a=n.emptySelections[f]??!0,l={param:f,empty:a};return(r=n.selectionPredicates)[f]??(r[f]=[]),n.selectionPredicates[f].push(l),l});return e.selection?t(e.selection):xm(e.test||e.filter,o=>o.selection?t(o.selection):o)}class LT extends H8{map(n,t){const o=t.selections??[];if(n.params&&!md(n)){const f=[];for(const r of n.params)$8(r)?o.push(r):f.push(r);n.params=f}return t.selections=o,super.map(n,t)}mapUnit(n,t){const o=t.selections;if(!o||!o.length)return n;const f=(t.path??[]).concat(n.name),r=[];for(const a of o)if(!a.views||!a.views.length)r.push(a);else for(const l of a.views)(Qf(l)&&(l===n.name||f.includes(l))||a1(l)&&l.map(c=>f.indexOf(c)).every((c,i,s)=>c!==-1&&(i===0||c>s[i-1])))&&r.push(a);return r.length&&(n.params=r),n}}for(const e of["mapFacet","mapRepeat","mapHConcat","mapVConcat","mapLayer"]){const n=LT.prototype[e];LT.prototype[e]=function(t,o){return n.call(this,t,Hbe(t,o))}}function Hbe(e,n){return e.name?{...n,path:(n.path??[]).concat(e.name)}:n}function Tq(e,n){n===void 0&&(n=yq(e.config));const t=Xbe(e,n),{width:o,height:f}=e,r=Zbe(t,{width:o,height:f,autosize:e.autosize},n);return{...t,...r?{autosize:r}:{}}}const Gbe=new Abe,Wbe=new qbe,Ybe=new LT;function Xbe(e,n={}){const t={config:n};return Ybe.map(Gbe.map(Wbe.map(e,t),t),t)}function nP(e){return Li(e)?{type:e}:e??{}}function Zbe(e,n,t){let{width:o,height:f}=n;const r=md(e)||n5(e),a={};r?o=="container"&&f=="container"?(a.type="fit",a.contains="padding"):o=="container"?(a.type="fit-x",a.contains="padding"):f=="container"&&(a.type="fit-y",a.contains="padding"):(o=="container"&&(ei(EO("width")),o=void 0),f=="container"&&(ei(EO("height")),f=void 0));const l={type:"pad",...a,...t?nP(t.autosize):{},...nP(e.autosize)};if(l.type==="fit"&&!r&&(ei(Z1e),l.type="pad"),o=="container"&&!(l.type=="fit"||l.type=="fit-x")&&ei(SO("width")),f=="container"&&!(l.type=="fit"||l.type=="fit-y")&&ei(SO("height")),!Xf(l,{type:"pad"}))return l}function Jbe(e){return e==="fit"||e==="fit-x"||e==="fit-y"}function Kbe(e){return e?`fit-${N3(e)}`:"fit"}const Qbe=["background","padding"];function rP(e,n){const t={};for(const o of Qbe)e&&e[o]!==void 0&&(t[o]=ac(e[o]));return n&&(t.params=e.params),t}class yd{constructor(n={},t={}){this.explicit=n,this.implicit=t}clone(){return new yd(la(this.explicit),la(this.implicit))}combine(){return{...this.explicit,...this.implicit}}get(n){return zs(this.explicit[n],this.implicit[n])}getWithExplicit(n){return this.explicit[n]!==void 0?{explicit:!0,value:this.explicit[n]}:this.implicit[n]!==void 0?{explicit:!1,value:this.implicit[n]}:{explicit:!1,value:void 0}}setWithExplicit(n,{value:t,explicit:o}){t!==void 0&&this.set(n,t,o)}set(n,t,o){return delete this[o?"implicit":"explicit"][n],this[o?"explicit":"implicit"][n]=t,this}copyKeyFromSplit(n,{explicit:t,implicit:o}){t[n]!==void 0?this.set(n,t[n],!0):o[n]!==void 0&&this.set(n,o[n],!1)}copyKeyFromObject(n,t){t[n]!==void 0&&this.set(n,t[n],!0)}copyAll(n){for(const t of Zr(n.combine())){const o=n.getWithExplicit(t);this.setWithExplicit(t,o)}}}function qf(e){return{explicit:!0,value:e}}function nc(e){return{explicit:!1,value:e}}function Mq(e){return(n,t,o,f)=>{const r=e(n.value,t.value);return r>0?n:r<0?t:r5(n,t,o,f)}}function r5(e,n,t,o){return e.explicit&&n.explicit&&ei(zye(t,o,e.value,n.value)),e}function mp(e,n,t,o,f=r5){return e===void 0||e.value===void 0?n:e.explicit&&!n.explicit?e:n.explicit&&!e.explicit?n:Xf(e.value,n.value)?e:f(e,n,t,o)}class e2e extends yd{constructor(n={},t={},o=!1){super(n,t),this.explicit=n,this.implicit=t,this.parseNothing=o}clone(){const n=super.clone();return n.parseNothing=this.parseNothing,n}}function Km(e){return"url"in e}function Fv(e){return"values"in e}function Eq(e){return"name"in e&&!Km(e)&&!Fv(e)&&!tp(e)}function tp(e){return e&&(Sq(e)||Cq(e)||W8(e))}function Sq(e){return"sequence"in e}function Cq(e){return"sphere"in e}function W8(e){return"graticule"in e}var Uo;(function(e){e[e.Raw=0]="Raw",e[e.Main=1]="Main",e[e.Row=2]="Row",e[e.Column=3]="Column",e[e.Lookup=4]="Lookup"})(Uo||(Uo={}));const t2e="view",lw="[",uw="]",Lq="{",Dq="}",n2e=":",Oq=",",r2e="@",i2e=">",a2e=/[[\]{}]/,o2e={"*":1,arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1};let Pq,Iq;function w1(e,n,t){return Pq=n||t2e,Iq=t||o2e,Fq(e.trim()).map(DT)}function s2e(e){return Iq[e]}function sv(e,n,t,o,f){const r=e.length;let a=0,l;for(;n=0?--a:o&&o.indexOf(l)>=0&&++a}return n}function Fq(e){const n=[],t=e.length;let o=0,f=0;for(;f' after between selector: "+e;o=o.map(DT);const f=DT(e.slice(1).trim());return f.between?{between:o,stream:f}:(f.between=o,f)}function u2e(e){const n={source:Pq},t=[];let o=[0,0],f=0,r=0,a=e.length,l=0,c,i;if(e[a-1]===Dq){if(l=e.lastIndexOf(Lq),l>=0){try{o=c2e(e.substring(l+1,a-1))}catch{throw"Invalid throttle specification: "+e}e=e.slice(0,l).trim(),a=e.length}else throw"Unmatched right brace: "+e;l=0}if(!a)throw e;if(e[0]===r2e&&(f=++l),c=sv(e,l,n2e),c1?(n.type=t[1],f?n.markname=t[0].slice(1):s2e(t[0])?n.marktype=t[0]:n.source=t[0]):n.type=t[0],n.type.slice(-1)==="!"&&(n.consume=!0,n.type=n.type.slice(0,-1)),i!=null&&(n.filter=i),o[0]&&(n.throttle=o[0]),o[1]&&(n.debounce=o[1]),n}function c2e(e){const n=e.split(Oq);if(!e.length||n.length>2)throw e;return n.map(t=>{const o=+t;if(o!==o)throw e;return o})}function Rq(e){const{signals:n,hasLegend:t,index:o,...f}=e;return f.field=Dc(f.field),f}function X0(e,n=!0,t=xu){if(zr(e)){const o=e.map(f=>X0(f,n,t));return n?`[${o.join(", ")}]`:o}else if(hg(e))return t(n?H0(e):lve(e));return n?t($o(e)):e}function f2e(e,n){for(const t of Dl(e.component.selection??{})){const o=t.name;let f=`${o}${vp}, ${t.resolve==="global"?"true":`{unit: ${S0(e)}}`}`;for(const r of a5)r.defined(t)&&(r.signals&&(n=r.signals(e,t,n)),r.modifyExpr&&(f=r.modifyExpr(e,t,f)));n.push({name:o+V2e,on:[{events:{signal:t.name+vp},update:`modify(${ri(t.name+Z0)}, ${f})`}]})}return Y8(n)}function h2e(e,n){if(e.component.selection&&Zr(e.component.selection).length){const t=ri(e.getName("cell"));n.unshift({name:"facet",value:{},on:[{events:w1("mousemove","scope"),update:`isTuple(facet) ? facet : group(${t}).datum`}]})}return Y8(n)}function d2e(e,n){let t=!1;for(const o of Dl(e.component.selection??{})){const f=o.name,r=ri(f+Z0);if(n.filter(l=>l.name===f).length===0){const l=o.resolve==="global"?"union":o.resolve,c=o.type==="point"?", true, true)":")";n.push({name:o.name,update:`${Qq}(${r}, ${ri(l)}${c}`})}t=!0;for(const l of a5)l.defined(o)&&l.topLevelSignals&&(n=l.topLevelSignals(e,o,n))}return t&&n.filter(f=>f.name==="unit").length===0&&n.unshift({name:"unit",value:{},on:[{events:"mousemove",update:"isTuple(group()) ? group() : unit"}]}),Y8(n)}function p2e(e,n){const t=[...n],o=S0(e,{escape:!1});for(const f of Dl(e.component.selection??{})){const r={name:f.name+Z0};if(f.project.hasSelectionId&&(r.transform=[{type:"collect",sort:{field:_f}}]),f.init){const l=f.project.items.map(Rq);r.values=f.project.hasSelectionId?f.init.map(c=>({unit:o,[_f]:X0(c,!1)[0]})):f.init.map(c=>({unit:o,fields:l,values:X0(c,!1)}))}t.filter(l=>l.name===f.name+Z0).length||t.push(r)}return t}function zq(e,n){for(const t of Dl(e.component.selection??{}))for(const o of a5)o.defined(t)&&o.marks&&(n=o.marks(e,t,n));return n}function g2e(e,n){for(const t of e.children)As(t)&&(n=zq(t,n));return n}function m2e(e,n,t,o){const f=cH(e,n.param,n);return{signal:pc(t.get("type"))&&zr(o)&&o[0]>o[1]?`isValid(${f}) && reverse(${f})`:f}}function Y8(e){return e.map(n=>(n.on&&!n.on.length&&delete n.on,n))}class wo{constructor(n,t){this.debugName=t,this._children=[],this._parent=null,n&&(this.parent=n)}clone(){throw new Error("Cannot clone node")}get parent(){return this._parent}set parent(n){this._parent=n,n&&n.addChild(this)}get children(){return this._children}numChildren(){return this._children.length}addChild(n,t){if(this._children.includes(n)){ei(uye);return}t!==void 0?this._children.splice(t,0,n):this._children.push(n)}removeChild(n){const t=this._children.indexOf(n);return this._children.splice(t,1),t}remove(){let n=this._parent.removeChild(this);for(const t of this._children)t._parent=this._parent,this._parent.addChild(t,n++)}insertAsParentOf(n){const t=n.parent;t.removeChild(this),this.parent=t,n.parent=this}swapWithParent(){const n=this._parent,t=n.parent;for(const f of this._children)f.parent=n;this._children=[],n.removeChild(this);const o=n.parent.removeChild(n);this._parent=t,t.addChild(this,o),n.parent=this}}class vu extends wo{clone(){const n=new this.constructor;return n.debugName=`clone_${this.debugName}`,n._source=this._source,n._name=`clone_${this._name}`,n.type=this.type,n.refCounts=this.refCounts,n.refCounts[n._name]=0,n}constructor(n,t,o,f){super(n,t),this.type=o,this.refCounts=f,this._source=this._name=t,this.refCounts&&!(this._name in this.refCounts)&&(this.refCounts[this._name]=0)}dependentFields(){return new Set}producedFields(){return new Set}hash(){return this._hash===void 0&&(this._hash=`Output ${E$()}`),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(n){this._source=n}}function gA(e){return e.as!==void 0}function iP(e){return`${e}_end`}class rh extends wo{clone(){return new rh(null,la(this.formula))}constructor(n,t){super(n),this.formula=t}static makeFromEncoding(n,t){const o=t.reduceFieldDef((f,r)=>{const{field:a,timeUnit:l}=r;if(l){let c;if(dg(l)){if(As(t)){const{mark:i}=t;(k8(i)||r.bandPosition)&&(c={timeUnit:hl(l),field:a})}}else c={as:hi(r,{forAs:!0}),field:a,timeUnit:l};c&&(f[Ba(c)]=c)}return f},{});return Mo(o)?null:new rh(n,o)}static makeFromTransform(n,t){const{timeUnit:o,...f}={...t},r=hl(o),a={...f,timeUnit:r};return new rh(n,{[Ba(a)]:a})}merge(n){this.formula={...this.formula};for(const t in n.formula)this.formula[t]||(this.formula[t]=n.formula[t]);for(const t of n.children)n.removeChild(t),t.parent=this;n.remove()}removeFormulas(n){const t={};for(const[o,f]of pp(this.formula)){const r=gA(f)?f.as:`${f.field}_end`;n.has(r)||(t[o]=f)}this.formula=t}producedFields(){return new Set(Dl(this.formula).map(n=>gA(n)?n.as:iP(n.field)))}dependentFields(){return new Set(Dl(this.formula).map(n=>n.field))}hash(){return`TimeUnit ${Ba(this.formula)}`}assemble(){const n=[];for(const t of Dl(this.formula))if(gA(t)){const{field:o,as:f,timeUnit:r}=t,{unit:a,utc:l,...c}=hl(r);n.push({field:Dc(o),type:"timeunit",...a?{units:$3(a)}:{},...l?{timezone:"utc"}:{},...c,as:[f,`${f}_end`]})}else if(t){const{field:o,timeUnit:f}=t,r=cV(f?.unit),{part:a,step:l}=pV(r,f.step);n.push({type:"formula",expr:`timeOffset('${a}', datum['${o}'], ${l})`,as:iP(o)})}return n}}const Px="_tuple_fields";class y2e{constructor(...n){this.items=n,this.hasChannel={},this.hasField={},this.hasSelectionId=!1}}const v2e={defined:()=>!0,parse:(e,n,t)=>{const o=n.name,f=n.project??(n.project=new y2e),r={},a={},l=new Set,c=(m,p)=>{const g=p==="visual"?m.channel:m.field;let y=es(`${o}_${g}`);for(let v=1;l.has(y);v++)y=es(`${o}_${g}_${v}`);return l.add(y),{[p]:y}},i=n.type,s=e.config.selection[i],u=t.value!==void 0?Ti(t.value):null;let{fields:h,encodings:d}=Si(t.select)?t.select:{};if(!h&&!d&&u){for(const m of u)if(Si(m))for(const p of Zr(m))M1e(p)?(d||(d=[])).push(p):i==="interval"?(ei(aye),d=s.encodings):(h??(h=[])).push(p)}!h&&!d&&(d=s.encodings,"fields"in s&&(h=s.fields));for(const m of d??[]){const p=e.fieldDef(m);if(p){let g=p.field;if(p.aggregate){ei(J1e(m,p.aggregate));continue}else if(!g){ei(LO(m));continue}if(p.timeUnit&&!dg(p.timeUnit)){g=e.vgField(m);const y={timeUnit:p.timeUnit,as:g,field:p.field};a[Ba(y)]=y}if(!r[g]){const y=i==="interval"&&gd(m)&&pc(e.getScaleComponent(m).get("type"))?"R":p.bin?"R-RE":"E",v={field:g,channel:m,type:y,index:f.items.length};v.signals={...c(v,"data"),...c(v,"visual")},f.items.push(r[g]=v),f.hasField[g]=r[g],f.hasSelectionId=f.hasSelectionId||g===_f,P$(m)?(v.geoChannel=m,v.channel=O$(m),f.hasChannel[v.channel]=r[g]):f.hasChannel[m]=r[g]}}else ei(LO(m))}for(const m of h??[]){if(f.hasField[m])continue;const p={type:"E",field:m,index:f.items.length};p.signals={...c(p,"data")},f.items.push(p),f.hasField[m]=p,f.hasSelectionId=f.hasSelectionId||m===_f}u&&(n.init=u.map(m=>f.items.map(p=>Si(m)?m[p.geoChannel||p.channel]!==void 0?m[p.geoChannel||p.channel]:m[p.field]:m))),Mo(a)||(f.timeUnit=new rh(null,a))},signals:(e,n,t)=>{const o=n.name+Px;return t.filter(r=>r.name===o).length>0||n.project.hasSelectionId?t:t.concat({name:o,value:n.project.items.map(Rq)})}},Kh={defined:e=>e.type==="interval"&&e.resolve==="global"&&e.bind&&e.bind==="scales",parse:(e,n)=>{const t=n.scales=[];for(const o of n.project.items){const f=o.channel;if(!gd(f))continue;const r=e.getScaleComponent(f),a=r?r.get("type"):void 0;if(!r||!pc(a)){ei(eye);continue}r.set("selectionExtent",{param:n.name,field:o.field},!0),t.push(o)}},topLevelSignals:(e,n,t)=>{const o=n.scales.filter(a=>t.filter(l=>l.name===a.signals.data).length===0);if(!e.parent||aP(e)||o.length===0)return t;const f=t.filter(a=>a.name===n.name)[0];let r=f.update;if(r.indexOf(Qq)>=0)f.update=`{${o.map(a=>`${ri(Dc(a.field))}: ${a.signals.data}`).join(", ")}}`;else{for(const a of o){const l=`${ri(Dc(a.field))}: ${a.signals.data}`;r.includes(l)||(r=`${r.substring(0,r.length-1)}, ${l}}`)}f.update=r}return t.concat(o.map(a=>({name:a.signals.data})))},signals:(e,n,t)=>{if(e.parent&&!aP(e))for(const o of n.scales){const f=t.filter(r=>r.name===o.signals.data)[0];f.push="outer",delete f.value,delete f.update}return t}};function OT(e,n){return`domain(${ri(e.scaleName(n))})`}function aP(e){return e.parent&&E1(e.parent)&&!e.parent.parent}const wm="_brush",Nq="_scale_trigger",yy="geo_interval_init_tick",Bq="_init",x2e="_center",b2e={defined:e=>e.type==="interval",parse:(e,n,t)=>{var o;if(e.hasProjection){const f={...rp(t.select)?t.select:{}};f.fields=[_f],f.encodings||(f.encodings=t.value?Zr(t.value):[Sf,Ef]),t.select={type:"interval",...f}}if(n.translate&&!Kh.defined(n)){const f=`!event.item || event.item.mark.name !== ${ri(n.name+wm)}`;for(const r of n.events){if(!r.between){ei(`${r} is not an ordered event stream for interval selections.`);continue}const a=Ti((o=r.between[0]).filter??(o.filter=[]));a.indexOf(f)<0&&a.push(f)}}},signals:(e,n,t)=>{const o=n.name,f=o+vp,r=Dl(n.project.hasChannel).filter(l=>l.channel===ts||l.channel===dl),a=n.init?n.init[0]:null;if(t.push(...r.reduce((l,c)=>l.concat(_2e(e,n,c,a&&a[c.index])),[])),e.hasProjection){const l=ri(e.projectionName()),c=e.projectionName()+x2e,{x:i,y:s}=n.project.hasChannel,u=i&&i.signals.visual,h=s&&s.signals.visual,d=i?a&&a[i.index]:`${c}[0]`,m=s?a&&a[s.index]:`${c}[1]`,p=A=>e.getSizeSignalRef(A).signal,g=`[[${u?u+"[0]":"0"}, ${h?h+"[0]":"0"}],[${u?u+"[1]":p("width")}, ${h?h+"[1]":p("height")}]]`;a&&(t.unshift({name:o+Bq,init:`[scale(${l}, [${i?d[0]:d}, ${s?m[0]:m}]), scale(${l}, [${i?d[1]:d}, ${s?m[1]:m}])]`}),(!i||!s)&&(t.find(b=>b.name===c)||t.unshift({name:c,update:`invert(${l}, [${p("width")}/2, ${p("height")}/2])`})));const y=`intersect(${g}, {markname: ${ri(e.getName("marks"))}}, unit.mark)`,v=`{unit: ${S0(e)}}`,x=`vlSelectionTuples(${y}, ${v})`,_=r.map(A=>A.signals.visual);return t.concat({name:f,on:[{events:[..._.length?[{signal:_.join(" || ")}]:[],...a?[{signal:yy}]:[]],update:x}]})}else{if(!Kh.defined(n)){const i=o+Nq,s=r.map(u=>{const h=u.channel,{data:d,visual:m}=u.signals,p=ri(e.scaleName(h)),g=e.getScaleComponent(h).get("type"),y=pc(g)?"+":"";return`(!isArray(${d}) || (${y}invert(${p}, ${m})[0] === ${y}${d}[0] && ${y}invert(${p}, ${m})[1] === ${y}${d}[1]))`});s.length&&t.push({name:i,value:{},on:[{events:r.map(u=>({scale:e.scaleName(u.channel)})),update:s.join(" && ")+` ? ${i} : {}`}]})}const l=r.map(i=>i.signals.data),c=`unit: ${S0(e)}, fields: ${o+Px}, values`;return t.concat({name:f,...a?{init:`{${c}: ${X0(a)}}`}:{},...l.length?{on:[{events:[{signal:l.join(" || ")}],update:`${l.join(" && ")} ? {${c}: [${l}]} : null`}]}:{}})}},topLevelSignals:(e,n,t)=>(As(e)&&e.hasProjection&&n.init&&(t.filter(f=>f.name===yy).length||t.unshift({name:yy,value:null,on:[{events:"timer{1}",update:`${yy} === null ? {} : ${yy}`}]})),t),marks:(e,n,t)=>{const o=n.name,{x:f,y:r}=n.project.hasChannel,a=f?.signals.visual,l=r?.signals.visual,c=`data(${ri(n.name+Z0)})`;if(Kh.defined(n)||!f&&!r)return t;const i={x:f!==void 0?{signal:`${a}[0]`}:{value:0},y:r!==void 0?{signal:`${l}[0]`}:{value:0},x2:f!==void 0?{signal:`${a}[1]`}:{field:{group:"width"}},y2:r!==void 0?{signal:`${l}[1]`}:{field:{group:"height"}}};if(n.resolve==="global")for(const p of Zr(i))i[p]=[{test:`${c}.length && ${c}[0].unit === ${S0(e)}`,...i[p]},{value:0}];const{fill:s,fillOpacity:u,cursor:h,...d}=n.mark,m=Zr(d).reduce((p,g)=>(p[g]=[{test:[f!==void 0&&`${a}[0] !== ${a}[1]`,r!==void 0&&`${l}[0] !== ${l}[1]`].filter(y=>y).join(" && "),value:d[g]},{value:null}],p),{});return[{name:`${o+wm}_bg`,type:"rect",clip:!0,encode:{enter:{fill:{value:s},fillOpacity:{value:u}},update:i}},...t,{name:o+wm,type:"rect",clip:!0,encode:{enter:{...h?{cursor:{value:h}}:{},fill:{value:"transparent"}},update:{...i,...m}}}]}};function _2e(e,n,t,o){const f=!e.hasProjection,r=t.channel,a=t.signals.visual,l=ri(f?e.scaleName(r):e.projectionName()),c=h=>`scale(${l}, ${h})`,i=e.getSizeSignalRef(r===ts?"width":"height").signal,s=`${r}(unit)`,u=n.events.reduce((h,d)=>[...h,{events:d.between[0],update:`[${s}, ${s}]`},{events:d,update:`[${a}[0], clamp(${s}, 0, ${i})]`}],[]);if(f){const h=t.signals.data,d=Kh.defined(n),m=e.getScaleComponent(r),p=m?m.get("type"):void 0,g=o?{init:X0(o,!0,c)}:{value:[]};return u.push({events:{signal:n.name+Nq},update:pc(p)?`[${c(`${h}[0]`)}, ${c(`${h}[1]`)}]`:"[0, 0]"}),d?[{name:h,on:[]}]:[{name:a,...g,on:u},{name:h,...o?{init:X0(o)}:{},on:[{events:{signal:a},update:`${a}[0] === ${a}[1] ? null : invert(${l}, ${a})`}]}]}else{const h=r===ts?0:1,d=n.name+Bq,m=o?{init:`[${d}[0][${h}], ${d}[1][${h}]]`}:{value:[]};return[{name:a,...m,on:u}]}}const w2e={defined:e=>e.type==="point",signals:(e,n,t)=>{const o=n.name,f=o+Px,r=n.project,a="(item().isVoronoi ? datum.datum : datum)",l=Dl(e.component.selection??{}).reduce((u,h)=>h.type==="interval"?u.concat(h.name+wm):u,[]).map(u=>`indexof(item().mark.name, '${u}') < 0`).join(" && "),c=`datum && item().mark.marktype !== 'group' && indexof(item().mark.role, 'legend') < 0${l?` && ${l}`:""}`;let i=`unit: ${S0(e)}, `;if(n.project.hasSelectionId)i+=`${_f}: ${a}[${ri(_f)}]`;else{const u=r.items.map(h=>e.fieldDef(h.channel)?.bin?`[${a}[${ri(e.vgField(h.channel,{}))}], ${a}[${ri(e.vgField(h.channel,{binSuffix:"end"}))}]]`:`${a}[${ri(h.field)}]`).join(", ");i+=`fields: ${f}, values: [${u}]`}const s=n.events;return t.concat([{name:o+vp,on:s?[{events:s,update:`${c} ? {${i}} : null`,force:!0}]:[]}])}};function A1(e,n,t,o){const f=X3(n)&&n.condition,r=o(n);if(f){const l=Ti(f).map(c=>{const i=o(c);if(oxe(c)){const{param:s,empty:u}=c;return{test:uH(e,{param:s,empty:u}),...i}}else return{test:dw(e,c.test),...i}});return{[t]:[...l,...r!==void 0?[r]:[]]}}else return r!==void 0?{[t]:r}:{}}function X8(e,n="text"){const t=e.encoding[n];return A1(e,t,n,o=>i5(o,e.config))}function i5(e,n,t="datum"){if(e){if(bf(e))return Yo(e.value);if(fa(e)){const{format:o,formatType:f}=rw(e);return S8({fieldOrDatumDef:e,format:o,formatType:f,expr:t,config:n})}}}function jq(e,n={}){const{encoding:t,markDef:o,config:f,stack:r}=e,a=t.tooltip;if(zr(a))return{tooltip:oP({tooltip:a},r,f,n)};{const l=n.reactiveGeom?"datum.datum":"datum";return A1(e,a,"tooltip",c=>{const i=i5(c,f,l);if(i)return i;if(c===null)return;let s=uo("tooltip",o,f);if(s===!0&&(s={content:"encoding"}),Li(s))return{value:s};if(Si(s))return ji(s)?s:s.content==="encoding"?oP(t,r,f,n):{signal:l}})}}function Uq(e,n,t,{reactiveGeom:o}={}){const f={...t,...t.tooltipFormat},r={},a=o?"datum.datum":"datum",l=[];function c(s,u){const h=cg(u),d=Au(s)?s:{...s,type:e[h].type},m=d.title||O8(d,f),p=Ti(m).join(", ");let g;if(pl(u)){const y=u==="x"?"x2":"y2",v=hh(e[y]);if(Ml(d.bin)&&v){const x=hi(d,{expr:a}),_=hi(v,{expr:a}),{format:A,formatType:b}=rw(d);g=Sx(x,_,A,b,f),r[y]=!0}}if((pl(u)||u===Ic||u===Mf)&&n&&n.fieldChannel===u&&n.offset==="normalize"){const{format:y,formatType:v}=rw(d);g=S8({fieldOrDatumDef:d,format:y,formatType:v,expr:a,config:f,normalizeStack:!0}).signal}g??(g=i5(d,f,a).signal),l.push({channel:u,key:p,value:g})}F8(e,(s,u)=>{ni(s)?c(s,u):Z3(s)&&c(s.condition,u)});const i={};for(const{channel:s,key:u,value:h}of l)!r[s]&&!i[u]&&(i[u]=h);return i}function oP(e,n,t,{reactiveGeom:o}={}){const f=Uq(e,n,t,{reactiveGeom:o}),r=pp(f).map(([a,l])=>`"${a}": ${l}`);return r.length>0?{signal:`{${r.join(", ")}}`}:void 0}function A2e(e){const{markDef:n,config:t}=e,o=uo("aria",n,t);return o===!1?{}:{...o?{aria:o}:{},...k2e(e),...T2e(e)}}function k2e(e){const{mark:n,markDef:t,config:o}=e;if(o.aria===!1)return{};const f=uo("ariaRoleDescription",t,o);return f!=null?{ariaRoleDescription:{value:f}}:n in W1e?{}:{ariaRoleDescription:{value:n}}}function T2e(e){const{encoding:n,markDef:t,config:o,stack:f}=e,r=n.description;if(r)return A1(e,r,"description",c=>i5(c,e.config));const a=uo("description",t,o);if(a!=null)return{description:Yo(a)};if(o.aria===!1)return{};const l=Uq(n,f,o);if(!Mo(l))return{description:{signal:pp(l).map(([c,i],s)=>`"${s>0?"; ":""}${c}: " + (${i})`).join(" + ")}}}function sl(e,n,t={}){const{markDef:o,encoding:f,config:r}=n,{vgChannel:a}=t;let{defaultRef:l,defaultValue:c}=t;l===void 0&&(c??(c=uo(e,o,r,{vgChannel:a,ignoreVgConfig:!0})),c!==void 0&&(l=Yo(c)));const i=f[e];return A1(n,i,a??e,s=>E8({channel:e,channelDef:s,markDef:o,config:r,scaleName:n.scaleName(e),scale:n.getScaleComponent(e),stack:null,defaultRef:l}))}function $q(e,n={filled:void 0}){const{markDef:t,encoding:o,config:f}=e,{type:r}=t,a=n.filled??uo("filled",t,f),l=ja(["bar","point","circle","square","geoshape"],r)?"transparent":void 0,c=uo(a===!0?"color":void 0,t,f,{vgChannel:"fill"})??f.mark[a===!0&&"color"]??l,i=uo(a===!1?"color":void 0,t,f,{vgChannel:"stroke"})??f.mark[a===!1&&"color"],s=a?"fill":"stroke",u={...c?{fill:Yo(c)}:{},...i?{stroke:Yo(i)}:{}};return t.color&&(a?t.fill:t.stroke)&&ei(tV("property",{fill:"fill"in t,stroke:"stroke"in t})),{...u,...sl("color",e,{vgChannel:s,defaultValue:a?c:i}),...sl("fill",e,{defaultValue:o.fill?c:void 0}),...sl("stroke",e,{defaultValue:o.stroke?i:void 0})}}function M2e(e){const{encoding:n,mark:t}=e,o=n.order;return!Lp(t)&&bf(o)?A1(e,o,"zindex",f=>Yo(f.value)):{}}function Qm({channel:e,markDef:n,encoding:t={},model:o,bandPosition:f}){const r=`${e}Offset`,a=n[r],l=t[r];if((r==="xOffset"||r==="yOffset")&&l)return{offsetType:"encoding",offset:E8({channel:r,channelDef:l,markDef:n,config:o?.config,scaleName:o.scaleName(r),scale:o.getScaleComponent(r),stack:null,defaultRef:Yo(a),bandPosition:f})};const c=n[r];return c?{offsetType:"visual",offset:c}:{}}function Hl(e,n,{defaultPos:t,vgChannel:o}){const{encoding:f,markDef:r,config:a,stack:l}=n,c=f[e],i=f[_h(e)],s=n.scaleName(e),u=n.getScaleComponent(e),{offset:h,offsetType:d}=Qm({channel:e,markDef:r,encoding:f,model:n,bandPosition:.5}),m=Z8({model:n,defaultPos:t,channel:e,scaleName:s,scale:u}),p=!c&&pl(e)&&(f.latitude||f.longitude)?{field:n.getName(e)}:E2e({channel:e,channelDef:c,channel2Def:i,markDef:r,config:a,scaleName:s,scale:u,stack:l,offset:h,defaultRef:m,bandPosition:d==="encoding"?0:void 0});return p?{[o||e]:p}:void 0}function E2e(e){const{channel:n,channelDef:t,scaleName:o,stack:f,offset:r,markDef:a}=e;if(fa(t)&&f&&n===f.fieldChannel){if(ni(t)){let l=t.bandPosition;if(l===void 0&&a.type==="text"&&(n==="radius"||n==="theta")&&(l=.5),l!==void 0)return ew({scaleName:o,fieldOrDatumDef:t,startSuffix:"start",bandPosition:l,offset:r})}return M0(t,o,{suffix:"end"},{offset:r})}return T8(e)}function Z8({model:e,defaultPos:n,channel:t,scaleName:o,scale:f}){const{markDef:r,config:a}=e;return()=>{const l=cg(t),c=gp(t),i=uo(t,r,a,{vgChannel:c});if(i!==void 0)return ov(t,i);switch(n){case"zeroOrMin":case"zeroOrMax":if(o){const s=f.get("type");if(!ja([Uu.LOG,Uu.TIME,Uu.UTC],s)){if(f.domainDefinitelyIncludesZero())return{scale:o,value:0}}}if(n==="zeroOrMin")return l==="y"?{field:{group:"height"}}:{value:0};switch(l){case"radius":return{signal:`min(${e.width.signal},${e.height.signal})/2`};case"theta":return{signal:"2*PI"};case"x":return{field:{group:"width"}};case"y":return{value:0}}break;case"mid":return{...e[Yu(t)],mult:.5}}}}const S2e={left:"x",center:"xc",right:"x2"},C2e={top:"y",middle:"yc",bottom:"y2"};function Vq(e,n,t,o="middle"){if(e==="radius"||e==="theta")return gp(e);const f=e==="x"?"align":"baseline",r=uo(f,n,t);let a;return ji(r)?(ei(Mye(f)),a=void 0):a=r,e==="x"?S2e[a||(o==="top"?"left":"center")]:C2e[a||o]}function cw(e,n,{defaultPos:t,defaultPos2:o,range:f}){return f?qq(e,n,{defaultPos:t,defaultPos2:o}):Hl(e,n,{defaultPos:t})}function qq(e,n,{defaultPos:t,defaultPos2:o}){const{markDef:f,config:r}=n,a=_h(e),l=Yu(e),c=L2e(n,o,a),i=c[l]?Vq(e,f,r):gp(e);return{...Hl(e,n,{defaultPos:t,vgChannel:i}),...c}}function L2e(e,n,t){const{encoding:o,mark:f,markDef:r,stack:a,config:l}=e,c=cg(t),i=Yu(t),s=gp(t),u=o[c],h=e.scaleName(c),d=e.getScaleComponent(c),{offset:m}=t in o||t in r?Qm({channel:t,markDef:r,encoding:o,model:e}):Qm({channel:c,markDef:r,encoding:o,model:e});if(!u&&(t==="x2"||t==="y2")&&(o.latitude||o.longitude)){const g=Yu(t),y=e.markDef[g];return y!=null?{[g]:{value:y}}:{[s]:{field:e.getName(t)}}}const p=D2e({channel:t,channelDef:u,channel2Def:o[t],markDef:r,config:l,scaleName:h,scale:d,stack:a,offset:m,defaultRef:void 0});return p!==void 0?{[s]:p}:Kb(t,r)||Kb(t,{[t]:J_(t,r,l.style),[i]:J_(i,r,l.style)})||Kb(t,l[f])||Kb(t,l.mark)||{[s]:Z8({model:e,defaultPos:n,channel:t,scaleName:h,scale:d})()}}function D2e({channel:e,channelDef:n,channel2Def:t,markDef:o,config:f,scaleName:r,scale:a,stack:l,offset:c,defaultRef:i}){return fa(n)&&l&&e.charAt(0)===l.fieldChannel.charAt(0)?M0(n,r,{suffix:"start"},{offset:c}):T8({channel:e,channelDef:t,scaleName:r,scale:a,stack:l,markDef:o,config:f,offset:c,defaultRef:i})}function Kb(e,n){const t=Yu(e),o=gp(e);if(n[o]!==void 0)return{[o]:ov(e,n[o])};if(n[e]!==void 0)return{[o]:ov(e,n[e])};if(n[t]){const f=n[t];if(W0(f))ei(xye(t));else return{[t]:ov(e,f)}}}function yp(e,n){const{config:t,encoding:o,markDef:f}=e,r=f.type,a=_h(n),l=Yu(n),c=o[n],i=o[a],s=e.getScaleComponent(n),u=s?s.get("type"):void 0,h=f.orient,d=o[l]??o.size??uo("size",f,t,{vgChannel:l}),m=z$(n),p=r==="bar"&&(n==="x"?h==="vertical":h==="horizontal");return ni(c)&&(Vo(c.bin)||Ml(c.bin)||c.timeUnit&&!i)&&!(d&&!W0(d))&&!o[m]&&!ml(u)?I2e({fieldDef:c,fieldDef2:i,channel:n,model:e}):(fa(c)&&ml(u)||p)&&!i?P2e(c,n,e):qq(n,e,{defaultPos:"zeroOrMax",defaultPos2:"zeroOrMin"})}function O2e(e,n,t,o,f,r,a){if(W0(f))if(t){const c=t.get("type");if(c==="band"){let i=`bandwidth('${n}')`;f.band!==1&&(i=`${f.band} * ${i}`);const s=id("minBandSize",{type:a},o);return{signal:s?`max(${cf(s)}, ${i})`:i}}else f.band!==1&&(ei(Lye(c)),f=void 0)}else return{mult:f.band,field:{group:e}};else{if(ji(f))return f;if(f)return{value:f}}if(t){const c=t.get("range");if(Cp(c)&&Eo(c.step))return{value:c.step-2}}if(!r){const{bandPaddingInner:c,barBandPaddingInner:i,rectBandPaddingInner:s}=o.scale,u=zs(c,a==="bar"?i:s);if(ji(u))return{signal:`(1 - (${u.signal})) * ${e}`};if(Eo(u))return{signal:`${1-u} * ${e}`}}return{value:ow(o.view,e)-2}}function P2e(e,n,t){const{markDef:o,encoding:f,config:r,stack:a}=t,l=o.orient,c=t.scaleName(n),i=t.getScaleComponent(n),s=Yu(n),u=_h(n),h=z$(n),d=t.scaleName(h),m=t.getScaleComponent(t8(n)),p=l==="horizontal"&&n==="y"||l==="vertical"&&n==="x";let g;(f.size||o.size)&&(p?g=sl("size",t,{vgChannel:s,defaultRef:Yo(o.size)}):ei(Iye(o.type)));const y=!!g,v=zV({channel:n,fieldDef:e,markDef:o,config:r,scaleType:i?.get("type"),useVlSizeChannel:p});g=g||{[s]:O2e(s,d||c,m||i,r,v,!!e,o.type)};const x=i?.get("type")==="band"&&W0(v)&&!y?"top":"middle",_=Vq(n,o,r,x),A=_==="xc"||_==="yc",{offset:b,offsetType:k}=Qm({channel:n,markDef:o,encoding:f,model:t,bandPosition:A?.5:0}),w=T8({channel:n,channelDef:e,markDef:o,config:r,scaleName:c,scale:i,stack:a,offset:b,defaultRef:Z8({model:t,defaultPos:"mid",channel:n,scaleName:c,scale:i}),bandPosition:A?k==="encoding"?0:.5:ji(v)?{signal:`(1-${v})/2`}:W0(v)?(1-v.band)/2:0});if(s)return{[_]:w,...g};{const M=gp(u),T=g[s],E=b?{...T,offset:b}:T;return{[_]:w,[M]:zr(w)?[w[0],{...w[1],offset:E}]:{...w,offset:E}}}}function sP(e,n,t,o,f,r,a){if(D$(e))return 0;const l=e==="x"||e==="y2",c=l?-n/2:n/2;if(ji(t)||ji(f)||ji(o)||r){const i=cf(t),s=cf(f),u=cf(o),h=cf(r),m=r?`(${a} < ${h} ? ${l?"":"-"}0.5 * (${h} - (${a})) : ${c})`:c,p=u?`${u} + `:"",g=i?`(${i} ? -1 : 1) * `:"",y=s?`(${s} + ${m})`:m;return{signal:p+g+y}}else return f=f||0,o+(t?-f-c:+f+c)}function I2e({fieldDef:e,fieldDef2:n,channel:t,model:o}){const{config:f,markDef:r,encoding:a}=o,l=o.getScaleComponent(t),c=o.scaleName(t),i=l?l.get("type"):void 0,s=l.get("reverse"),u=zV({channel:t,fieldDef:e,markDef:r,config:f,scaleType:i}),d=o.component.axes[t]?.[0]?.get("translate")??.5,m=pl(t)?uo("binSpacing",r,f)??0:0,p=_h(t),g=gp(t),y=gp(p),v=id("minBandSize",r,f),{offset:x}=Qm({channel:t,markDef:r,encoding:a,model:o,bandPosition:0}),{offset:_}=Qm({channel:p,markDef:r,encoding:a,model:o,bandPosition:0}),A=txe({fieldDef:e,scaleName:c}),b=sP(t,m,s,d,x,v,A),k=sP(p,m,s,d,_??x,v,A),w=ji(u)?{signal:`(1-${u.signal})/2`}:W0(u)?(1-u.band)/2:.5;if(Vo(e.bin)||e.timeUnit)return{[y]:lP({fieldDef:e,scaleName:c,bandPosition:w,offset:k}),[g]:lP({fieldDef:e,scaleName:c,bandPosition:ji(w)?{signal:`1-${w.signal}`}:1-w,offset:b})};if(Ml(e.bin)){const M=M0(e,c,{},{offset:k});if(ni(n))return{[y]:M,[g]:M0(n,c,{},{offset:b})};if(fg(e.bin)&&e.bin.step)return{[y]:M,[g]:{signal:`scale("${c}", ${hi(e,{expr:"datum"})} + ${e.bin.step})`,offset:b}}}ei(iV(p))}function lP({fieldDef:e,scaleName:n,bandPosition:t,offset:o}){return ew({scaleName:n,fieldOrDatumDef:e,bandPosition:t,offset:o})}const F2e=new Set(["aria","width","height"]);function Fc(e,n){const{fill:t=void 0,stroke:o=void 0}=n.color==="include"?$q(e):{};return{...R2e(e.markDef,n),...uP(e,"fill",t),...uP(e,"stroke",o),...sl("opacity",e),...sl("fillOpacity",e),...sl("strokeOpacity",e),...sl("strokeWidth",e),...sl("strokeDash",e),...M2e(e),...jq(e),...X8(e,"href"),...A2e(e)}}function uP(e,n,t){const{config:o,mark:f,markDef:r}=e;if(uo("invalid",r,o)==="hide"&&t&&!Lp(f)){const l=z2e(e,{invalid:!0,channels:B3});if(l)return{[n]:[{test:l,value:null},...Ti(t)]}}return t?{[n]:t}:{}}function R2e(e,n){return G1e.reduce((t,o)=>(!F2e.has(o)&&e[o]!==void 0&&n[o]!=="ignore"&&(t[o]=Yo(e[o])),t),{})}function z2e(e,{invalid:n=!1,channels:t}){const o=t.reduce((r,a)=>{const l=e.getScaleComponent(a);if(l){const c=l.get("type"),i=e.vgField(a,{expr:"datum"});i&&pc(c)&&(r[i]=!0)}return r},{}),f=Zr(o);if(f.length>0){const r=n?"||":"&&";return f.map(a=>M8(a,n)).join(` ${r} `)}}function J8(e){const{config:n,markDef:t}=e;if(uo("invalid",t,n)){const f=N2e(e,{channels:wh});if(f)return{defined:{signal:f}}}return{}}function N2e(e,{invalid:n=!1,channels:t}){const o=t.reduce((r,a)=>{const l=e.getScaleComponent(a);if(l){const c=l.get("type"),i=e.vgField(a,{expr:"datum",binSuffix:e.stack?.impute?"mid":void 0});i&&pc(c)&&(r[i]=!0)}return r},{}),f=Zr(o);if(f.length>0){const r=n?"||":"&&";return f.map(a=>M8(a,n)).join(` ${r} `)}}function cP(e,n){if(n!==void 0)return{[e]:Yo(n)}}const mA="voronoi",Hq={defined:e=>e.type==="point"&&e.nearest,parse:(e,n)=>{if(n.events)for(const t of n.events)t.markname=e.getName(mA)},marks:(e,n,t)=>{const{x:o,y:f}=n.project.hasChannel,r=e.mark;if(Lp(r))return ei(K1e(r)),t;const a={name:e.getName(mA),type:"path",interactive:!0,from:{data:e.getName("marks")},encode:{update:{fill:{value:"transparent"},strokeWidth:{value:.35},stroke:{value:"transparent"},isVoronoi:{value:!0},...jq(e,{reactiveGeom:!0})}},transform:[{type:"voronoi",x:{expr:o||!f?"datum.datum.x || 0":"0"},y:{expr:f||!o?"datum.datum.y || 0":"0"},size:[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]}]};let l=0,c=!1;return t.forEach((i,s)=>{const u=i.name??"";u===e.component.mark[0].name?l=s:u.indexOf(mA)>=0&&(c=!0)}),c||t.splice(l+1,0,a),t}},Gq={defined:e=>e.type==="point"&&e.resolve==="global"&&e.bind&&e.bind!=="scales"&&!U8(e.bind),parse:(e,n,t)=>eH(n,t),topLevelSignals:(e,n,t)=>{const o=n.name,f=n.project,r=n.bind,a=n.init&&n.init[0],l=Hq.defined(n)?"(item().isVoronoi ? datum.datum : datum)":"datum";return f.items.forEach((c,i)=>{const s=es(`${o}_${c.field}`);t.filter(h=>h.name===s).length||t.unshift({name:s,...a?{init:X0(a[i])}:{value:null},on:n.events?[{events:n.events,update:`datum && item().mark.marktype !== 'group' ? ${l}[${ri(c.field)}] : null`}]:[],bind:r[c.field]??r[c.channel]??r})}),t},signals:(e,n,t)=>{const o=n.name,f=n.project,r=t.filter(i=>i.name===o+vp)[0],a=o+Px,l=f.items.map(i=>es(`${o}_${i.field}`)),c=l.map(i=>`${i} !== null`).join(" && ");return l.length&&(r.update=`${c} ? {fields: ${a}, values: [${l.join(", ")}]} : null`),delete r.value,delete r.on,t}},fw="_toggle",Wq={defined:e=>e.type==="point"&&!!e.toggle,signals:(e,n,t)=>t.concat({name:n.name+fw,value:!1,on:[{events:n.events,update:n.toggle}]}),modifyExpr:(e,n)=>{const t=n.name+vp,o=n.name+fw;return`${o} ? null : ${t}, `+(n.resolve==="global"?`${o} ? null : true, `:`${o} ? null : {unit: ${S0(e)}}, `)+`${o} ? ${t} : null`}},B2e={defined:e=>e.clear!==void 0&&e.clear!==!1,parse:(e,n)=>{n.clear&&(n.clear=Li(n.clear)?w1(n.clear,"view"):n.clear)},topLevelSignals:(e,n,t)=>{if(Gq.defined(n))for(const o of n.project.items){const f=t.findIndex(r=>r.name===es(`${n.name}_${o.field}`));f!==-1&&t[f].on.push({events:n.clear,update:"null"})}return t},signals:(e,n,t)=>{function o(f,r){f!==-1&&t[f].on&&t[f].on.push({events:n.clear,update:r})}if(n.type==="interval")for(const f of n.project.items){const r=t.findIndex(a=>a.name===f.signals.visual);if(o(r,"[0, 0]"),r===-1){const a=t.findIndex(l=>l.name===f.signals.data);o(a,"null")}}else{let f=t.findIndex(r=>r.name===n.name+vp);o(f,"null"),Wq.defined(n)&&(f=t.findIndex(r=>r.name===n.name+fw),o(f,"false"))}return t}},Yq={defined:e=>{const n=e.resolve==="global"&&e.bind&&U8(e.bind),t=e.project.items.length===1&&e.project.items[0].field!==_f;return n&&!t&&ei(tye),n&&t},parse:(e,n,t)=>{const o=la(t);if(o.select=Li(o.select)?{type:o.select,toggle:n.toggle}:{...o.select,toggle:n.toggle},eH(n,o),rp(t.select)&&(t.select.on||t.select.clear)){const a='event.item && indexof(event.item.mark.role, "legend") < 0';for(const l of n.events)l.filter=Ti(l.filter??[]),l.filter.includes(a)||l.filter.push(a)}const f=hA(n.bind)?n.bind.legend:"click",r=Li(f)?w1(f,"view"):Ti(f);n.bind={legend:{merge:r}}},topLevelSignals:(e,n,t)=>{const o=n.name,f=hA(n.bind)&&n.bind.legend,r=a=>l=>{const c=la(l);return c.markname=a,c};for(const a of n.project.items){if(!a.hasLegend)continue;const l=`${es(a.field)}_legend`,c=`${o}_${l}`;if(t.filter(s=>s.name===c).length===0){const s=f.merge.map(r(`${l}_symbols`)).concat(f.merge.map(r(`${l}_labels`))).concat(f.merge.map(r(`${l}_entries`)));t.unshift({name:c,...n.init?{}:{value:null},on:[{events:s,update:"isDefined(datum.value) ? datum.value : item().items[0].items[0].datum.value",force:!0},{events:f.merge,update:`!event.item || !datum ? null : ${c}`,force:!0}]})}}return t},signals:(e,n,t)=>{const o=n.name,f=n.project,r=t.find(h=>h.name===o+vp),a=o+Px,l=f.items.filter(h=>h.hasLegend).map(h=>es(`${o}_${es(h.field)}_legend`)),i=`${l.map(h=>`${h} !== null`).join(" && ")} ? {fields: ${a}, values: [${l.join(", ")}]} : null`;n.events&&l.length>0?r.on.push({events:l.map(h=>({signal:h})),update:i}):l.length>0&&(r.update=i,delete r.value,delete r.on);const s=t.find(h=>h.name===o+fw),u=hA(n.bind)&&n.bind.legend;return s&&(n.events?s.on.push({...s.on[0],events:u}):s.on[0].events=u),t}};function j2e(e,n,t){const o=e.fieldDef(n)?.field;for(const f of Dl(e.component.selection??{})){const r=f.project.hasField[o]??f.project.hasChannel[n];if(r&&Yq.defined(f)){const a=t.get("selections")??[];a.push(f.name),t.set("selections",a,!1),r.hasLegend=!0}}}const Xq="_translate_anchor",Zq="_translate_delta",U2e={defined:e=>e.type==="interval"&&e.translate,signals:(e,n,t)=>{const o=n.name,f=Kh.defined(n),r=o+Xq,{x:a,y:l}=n.project.hasChannel;let c=w1(n.translate,"scope");return f||(c=c.map(i=>(i.between[0].markname=o+wm,i))),t.push({name:r,value:{},on:[{events:c.map(i=>i.between[0]),update:"{x: x(unit), y: y(unit)"+(a!==void 0?`, extent_x: ${f?OT(e,ts):`slice(${a.signals.visual})`}`:"")+(l!==void 0?`, extent_y: ${f?OT(e,dl):`slice(${l.signals.visual})`}`:"")+"}"}]},{name:o+Zq,value:{},on:[{events:c,update:`{x: ${r}.x - x(unit), y: ${r}.y - y(unit)}`}]}),a!==void 0&&fP(e,n,a,"width",t),l!==void 0&&fP(e,n,l,"height",t),t}};function fP(e,n,t,o,f){const r=n.name,a=r+Xq,l=r+Zq,c=t.channel,i=Kh.defined(n),s=f.filter(A=>A.name===t.signals[i?"data":"visual"])[0],u=e.getSizeSignalRef(o).signal,h=e.getScaleComponent(c),d=h&&h.get("type"),m=h&&h.get("reverse"),p=i?c===ts?m?"":"-":m?"-":"":"",g=`${a}.extent_${c}`,y=`${p}${l}.${c} / ${i?`${u}`:`span(${g})`}`,v=!i||!h?"panLinear":d==="log"?"panLog":d==="symlog"?"panSymlog":d==="pow"?"panPow":"panLinear",x=i?d==="pow"?`, ${h.get("exponent")??1}`:d==="symlog"?`, ${h.get("constant")??1}`:"":"",_=`${v}(${g}, ${y}${x})`;s.on.push({events:{signal:l},update:i?_:`clampRange(${_}, 0, ${u})`})}const Jq="_zoom_anchor",Kq="_zoom_delta",$2e={defined:e=>e.type==="interval"&&e.zoom,signals:(e,n,t)=>{const o=n.name,f=Kh.defined(n),r=o+Kq,{x:a,y:l}=n.project.hasChannel,c=ri(e.scaleName(ts)),i=ri(e.scaleName(dl));let s=w1(n.zoom,"scope");return f||(s=s.map(u=>(u.markname=o+wm,u))),t.push({name:o+Jq,on:[{events:s,update:f?"{"+[c?`x: invert(${c}, x(unit))`:"",i?`y: invert(${i}, y(unit))`:""].filter(u=>u).join(", ")+"}":"{x: x(unit), y: y(unit)}"}]},{name:r,on:[{events:s,force:!0,update:"pow(1.001, event.deltaY * pow(16, event.deltaMode))"}]}),a!==void 0&&hP(e,n,a,"width",t),l!==void 0&&hP(e,n,l,"height",t),t}};function hP(e,n,t,o,f){const r=n.name,a=t.channel,l=Kh.defined(n),c=f.filter(v=>v.name===t.signals[l?"data":"visual"])[0],i=e.getSizeSignalRef(o).signal,s=e.getScaleComponent(a),u=s&&s.get("type"),h=l?OT(e,a):c.name,d=r+Kq,m=`${r}${Jq}.${a}`,p=!l||!s?"zoomLinear":u==="log"?"zoomLog":u==="symlog"?"zoomSymlog":u==="pow"?"zoomPow":"zoomLinear",g=l?u==="pow"?`, ${s.get("exponent")??1}`:u==="symlog"?`, ${s.get("constant")??1}`:"":"",y=`${p}(${h}, ${m}, ${d}${g})`;c.on.push({events:{signal:d},update:l?y:`clampRange(${y}, 0, ${i})`})}const Z0="_store",vp="_tuple",V2e="_modify",Qq="vlSelectionResolve",a5=[w2e,b2e,v2e,Wq,Gq,Kh,Yq,B2e,U2e,$2e,Hq];function q2e(e){let n=e.parent;for(;n&&!mf(n);)n=n.parent;return n}function S0(e,{escape:n}={escape:!0}){let t=n?ri(e.name):e.name;const o=q2e(e);if(o){const{facet:f}=o;for(const r of Tc)f[r]&&(t+=` + '__facet_${r}_' + (facet[${ri(o.vgField(r))}])`)}return t}function K8(e){return Dl(e.component.selection??{}).reduce((n,t)=>n||t.project.hasSelectionId,!1)}function eH(e,n){(Qf(n.select)||!n.select.on)&&delete e.events,(Qf(n.select)||!n.select.clear)&&delete e.clear,(Qf(n.select)||!n.select.toggle)&&delete e.toggle}const H2e="RawCode",G2e="Literal",W2e="Property",Y2e="Identifier",X2e="ArrayExpression",Z2e="BinaryExpression",J2e="CallExpression",K2e="ConditionalExpression",Q2e="LogicalExpression",e_e="MemberExpression",t_e="ObjectExpression",n_e="UnaryExpression";function Lf(e){this.type=e}Lf.prototype.visit=function(e){let n,t,o;if(e(this))return 1;for(n=r_e(this),t=0,o=n.length;t";kh[J0]="Identifier";kh[Dp]="Keyword";kh[s5]="Null";kh[gg]="Numeric";kh[Ou]="Punctuator";kh[Fx]="String";kh[i_e]="RegularExpression";var a_e="ArrayExpression",o_e="BinaryExpression",s_e="CallExpression",l_e="ConditionalExpression",tH="Identifier",u_e="Literal",c_e="LogicalExpression",f_e="MemberExpression",h_e="ObjectExpression",d_e="Property",p_e="UnaryExpression",fl="Unexpected token %0",g_e="Unexpected number",m_e="Unexpected string",y_e="Unexpected identifier",v_e="Unexpected reserved word",x_e="Unexpected end of input",PT="Invalid regular expression",yA="Invalid regular expression: missing /",nH="Octal literals are not allowed in strict mode.",b_e="Duplicate data property in object literal not allowed in strict mode",Cl="ILLEGAL",Rv="Disabled.",__e=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"),w_e=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]");function l5(e,n){if(!e)throw new Error("ASSERT: "+n)}function Uh(e){return e>=48&&e<=57}function Q8(e){return"0123456789abcdefABCDEF".indexOf(e)>=0}function lv(e){return"01234567".indexOf(e)>=0}function A_e(e){return e===32||e===9||e===11||e===12||e===160||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(e)>=0}function zv(e){return e===10||e===13||e===8232||e===8233}function Rx(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e===92||e>=128&&__e.test(String.fromCharCode(e))}function hw(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===92||e>=128&&w_e.test(String.fromCharCode(e))}const k_e={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1};function rH(){for(;Lr1114111||e!=="}")&&Za({},fl,Cl),n<=65535?String.fromCharCode(n):(t=(n-65536>>10)+55296,o=(n-65536&1023)+56320,String.fromCharCode(t,o))}function iH(){var e,n;for(e=Ri.charCodeAt(Lr++),n=String.fromCharCode(e),e===92&&(Ri.charCodeAt(Lr)!==117&&Za({},fl,Cl),++Lr,e=IT("u"),(!e||e==="\\"||!Rx(e.charCodeAt(0)))&&Za({},fl,Cl),n=e);Lr>>=")return Lr+=4,{type:Ou,value:a,start:e,end:Lr};if(r=a.substr(0,3),r===">>>"||r==="<<="||r===">>=")return Lr+=3,{type:Ou,value:r,start:e,end:Lr};if(f=r.substr(0,2),o===f[1]&&"+-<>&|".indexOf(o)>=0||f==="=>")return Lr+=2,{type:Ou,value:f,start:e,end:Lr};if(f==="//"&&Za({},fl,Cl),"<>=!+-*%&|^/".indexOf(o)>=0)return++Lr,{type:Ou,value:o,start:e,end:Lr};Za({},fl,Cl)}function S_e(e){let n="";for(;Lr=0&&Lr=0&&(t=t.replace(/\\u\{([0-9a-fA-F]+)\}/g,(o,f)=>{if(parseInt(f,16)<=1114111)return"x";Za({},PT)}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(t)}catch{Za({},PT)}try{return new RegExp(e,n)}catch{return null}}function O_e(){var e,n,t,o,f;for(e=Ri[Lr],l5(e==="/","Regular expression literal must start with a slash"),n=Ri[Lr++],t=!1,o=!1;Lr=0&&Za({},PT,t),{value:t,literal:n}}function I_e(){var e,n,t,o;return _o=null,rH(),e=Lr,n=O_e(),t=P_e(),o=D_e(n.value,t.value),{literal:n.literal+t.literal,value:o,regex:{pattern:n.value,flags:t.value},start:e,end:Lr}}function F_e(e){return e.type===J0||e.type===Dp||e.type===o5||e.type===s5}function aH(){if(rH(),Lr>=Zl)return{type:Ix,start:Lr,end:Lr};const e=Ri.charCodeAt(Lr);return Rx(e)?E_e():e===40||e===41||e===59?vA():e===39||e===34?L_e():e===46?Uh(Ri.charCodeAt(Lr+1))?dP():vA():Uh(e)?dP():vA()}function zu(){const e=_o;return Lr=e.end,_o=aH(),Lr=e.end,e}function oH(){const e=Lr;_o=aH(),Lr=e}function R_e(e){const n=new Lf(a_e);return n.elements=e,n}function pP(e,n,t){const o=new Lf(e==="||"||e==="&&"?c_e:o_e);return o.operator=e,o.left=n,o.right=t,o}function z_e(e,n){const t=new Lf(s_e);return t.callee=e,t.arguments=n,t}function N_e(e,n,t){const o=new Lf(l_e);return o.test=e,o.consequent=n,o.alternate=t,o}function eC(e){const n=new Lf(tH);return n.name=e,n}function qy(e){const n=new Lf(u_e);return n.value=e.value,n.raw=Ri.slice(e.start,e.end),e.regex&&(n.raw==="//"&&(n.raw="/(?:)/"),n.regex=e.regex),n}function gP(e,n,t){const o=new Lf(f_e);return o.computed=e==="[",o.object=n,o.property=t,o.computed||(t.member=!0),o}function B_e(e){const n=new Lf(h_e);return n.properties=e,n}function mP(e,n,t){const o=new Lf(d_e);return o.key=n,o.value=t,o.kind=e,o}function j_e(e,n){const t=new Lf(p_e);return t.operator=e,t.argument=n,t.prefix=!0,t}function Za(e,n){var t,o=Array.prototype.slice.call(arguments,2),f=n.replace(/%(\d)/g,(r,a)=>(l5(a":case"<=":case">=":case"instanceof":case"in":n=7;break;case"<<":case">>":case">>>":n=8;break;case"+":case"-":n=9;break;case"*":case"/":case"%":n=11;break}return n}function K_e(){var e,n,t,o,f,r,a,l,c,i;if(e=_o,c=P2(),o=_o,f=xP(o),f===0)return c;for(o.prec=f,zu(),n=[e,_o],a=P2(),r=[c,o,a];(f=xP(_o))>0;){for(;r.length>2&&f<=r[r.length-2].prec;)a=r.pop(),l=r.pop().value,c=r.pop(),n.pop(),t=pP(l,c,a),r.push(t);o=zu(),o.prec=f,r.push(o),n.push(_o),t=P2(),r.push(t)}for(i=r.length-1,t=r[i],n.pop();i>1;)n.pop(),t=pP(r[i-1].value,r[i-2],t),i-=2;return t}function K0(){var e,n,t;return e=K_e(),Xo("?")&&(zu(),n=K0(),Jl(":"),t=K0(),e=N_e(e,n,t)),e}function tC(){const e=K0();if(Xo(","))throw new Error(Rv);return e}function Q_e(e){Ri=e,Lr=0,Zl=Ri.length,_o=null,oH();const n=tC();if(_o.type!==Ix)throw new Error("Unexpect token after expression.");return n}function FT(e){const n=[];return e.type==="Identifier"?[e.name]:e.type==="Literal"?[e.value]:(e.type==="MemberExpression"&&(n.push(...FT(e.object)),n.push(...FT(e.property))),n)}function sH(e){return e.object.type==="MemberExpression"?sH(e.object):e.object.name==="datum"}function lH(e){const n=Q_e(e),t=new Set;return n.visit(o=>{o.type==="MemberExpression"&&sH(o)&&t.add(FT(o).slice(1).join("."))}),t}class k1 extends wo{clone(){return new k1(null,this.model,la(this.filter))}constructor(n,t,o){super(n),this.model=t,this.filter=o,this.expr=dw(this.model,this.filter,this),this._dependentFields=lH(this.expr)}dependentFields(){return this._dependentFields}producedFields(){return new Set}assemble(){return{type:"filter",expr:this.expr}}hash(){return`Filter ${this.expr}`}}function ewe(e,n){const t={},o=e.config.selection;if(!n||!n.length)return t;for(const f of n){const r=es(f.name),a=f.select,l=Li(a)?a:a.type,c=Si(a)?la(a):{type:l},i=o[l];for(const h in i)h==="fields"||h==="encodings"||(h==="mark"&&(c[h]={...i[h],...c[h]}),(c[h]===void 0||c[h]===!0)&&(c[h]=la(i[h]??c[h])));const s=t[r]={...c,name:r,type:l,init:f.value,bind:f.bind,events:Li(c.on)?w1(c.on,"scope"):Ti(la(c.on))},u=la(f);for(const h of a5)h.defined(s)&&h.parse&&h.parse(e,s,u)}return t}function uH(e,n,t,o="datum"){const f=Li(n)?n:n.param,r=es(f),a=ri(r+Z0);let l;try{l=e.getSelectionComponent(r,f)}catch{return`!!${r}`}if(l.project.timeUnit){const h=t??e.component.data.raw,d=l.project.timeUnit.clone();h.parent?d.insertAsParentOf(h):h.parent=d}const c=l.project.hasSelectionId?"vlSelectionIdTest(":"vlSelectionTest(",i=l.resolve==="global"?")":`, ${ri(l.resolve)})`,s=`${c}${a}, ${o}${i}`,u=`length(data(${a}))`;return n.empty===!1?`${u} && ${s}`:`!${u} || ${s}`}function cH(e,n,t){const o=es(n),f=t.encoding;let r=t.field,a;try{a=e.getSelectionComponent(o,n)}catch{return o}if(!f&&!r)r=a.project.items[0].field,a.project.items.length>1&&ei(`A "field" or "encoding" must be specified when using a selection as a scale domain. Using "field": ${ri(r)}.`);else if(f&&!r){const l=a.project.items.filter(c=>c.channel===f);!l.length||l.length>1?(r=a.project.items[0].field,ei((l.length?"Multiple ":"No ")+`matching ${ri(f)} encoding found for selection ${ri(t.param)}. Using "field": ${ri(r)}.`)):r=l[0].field}return`${a.name}[${ri(Dc(r))}]`}function twe(e,n){for(const[t,o]of pp(e.component.selection??{})){const f=e.getName(`lookup_${t}`);e.component.data.outputNodes[f]=o.materialized=new vu(new k1(n,e,{param:t}),f,Uo.Lookup,e.component.data.outputNodeRefCounts)}}function dw(e,n,t){return av(n,o=>Li(o)?o:yve(o)?uH(e,o,t):mV(o))}function nwe(e,n){if(e)return zr(e)&&!Id(e)?e.map(t=>O8(t,n)).join(", "):e}function bA(e,n,t,o){var f,r;e.encode??(e.encode={}),(f=e.encode)[n]??(f[n]={}),(r=e.encode[n]).update??(r.update={}),e.encode[n].update[t]=o}function Hy(e,n,t,o={header:!1}){const{disable:f,orient:r,scale:a,labelExpr:l,title:c,zindex:i,...s}=e.combine();if(!f){for(const u in s){const h=bxe[u],d=s[u];if(h&&h!==n&&h!=="both")delete s[u];else if(Ox(d)){const{condition:m,...p}=d,g=Ti(m),y=$O[u];if(y){const{vgProp:v,part:x}=y,_=[...g.map(A=>{const{test:b,...k}=A;return{test:dw(null,b),...k}}),p];bA(s,x,v,_),delete s[u]}else if(y===null){const v={signal:g.map(x=>{const{test:_,...A}=x;return`${dw(null,_)} ? ${MO(A)} : `}).join("")+MO(p)};s[u]=v}}else if(ji(d)){const m=$O[u];if(m){const{vgProp:p,part:g}=m;bA(s,g,p,d),delete s[u]}}ja(["labelAlign","labelBaseline"],u)&&s[u]===null&&delete s[u]}if(n==="grid"){if(!s.grid)return;if(s.encode){const{grid:u}=s.encode;s.encode={...u?{grid:u}:{}},Mo(s.encode)&&delete s.encode}return{scale:a,orient:r,...s,domain:!1,labels:!1,aria:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:zs(i,0)}}else{if(!o.header&&e.mainExtracted)return;if(l!==void 0){let h=l;s.encode?.labels?.update&&ji(s.encode.labels.update.text)&&(h=V0(l,"datum.label",s.encode.labels.update.text.signal)),bA(s,"labels","text",{signal:h})}if(s.labelAlign===null&&delete s.labelAlign,s.encode){for(const h of WV)e.hasAxisPart(h)||delete s.encode[h];Mo(s.encode)&&delete s.encode}const u=nwe(c,t);return{scale:a,orient:r,grid:!1,...u?{title:u}:{},...s,...t.aria===!1?{aria:!1}:{},zindex:zs(i,0)}}}}function fH(e){const{axes:n}=e.component,t=[];for(const o of wh)if(n[o]){for(const f of n[o])if(!f.get("disable")&&!f.get("gridScale")){const r=o==="x"?"height":"width",a=e.getSizeSignalRef(r).signal;r!==a&&t.push({name:r,update:a})}}return t}function rwe(e,n){const{x:t=[],y:o=[]}=e;return[...t.map(f=>Hy(f,"grid",n)),...o.map(f=>Hy(f,"grid",n)),...t.map(f=>Hy(f,"main",n)),...o.map(f=>Hy(f,"main",n))].filter(f=>f)}function bP(e,n,t,o){return Object.assign.apply(null,[{},...e.map(f=>{if(f==="axisOrient"){const r=t==="x"?"bottom":"left",a=n[t==="x"?"axisBottom":"axisLeft"]||{},l=n[t==="x"?"axisTop":"axisRight"]||{},c=new Set([...Zr(a),...Zr(l)]),i={};for(const s of c.values())i[s]={signal:`${o.signal} === "${r}" ? ${cf(a[s])} : ${cf(l[s])}`};return i}return n[f]})])}function iwe(e,n,t,o){const f=n==="band"?["axisDiscrete","axisBand"]:n==="point"?["axisDiscrete","axisPoint"]:bV(n)?["axisQuantitative"]:n==="time"||n==="utc"?["axisTemporal"]:[],r=e==="x"?"axisX":"axisY",a=ji(t)?"axisOrient":`axis${Ax(t)}`,l=[...f,...f.map(i=>r+i.substr(4))],c=["axis",a,r];return{vlOnlyAxisConfig:bP(l,o,e,t),vgAxisConfig:bP(c,o,e,t),axisConfigStyle:awe([...c,...l],o)}}function awe(e,n){const t=[{}];for(const o of e){let f=n[o]?.style;if(f){f=Ti(f);for(const r of f)t.push(n.style[r])}}return Object.assign.apply(null,t)}function RT(e,n,t,o={}){const f=Y$(e,t,n);if(f!==void 0)return{configFrom:"style",configValue:f};for(const r of["vlOnlyAxisConfig","vgAxisConfig","axisConfigStyle"])if(o[r]?.[e]!==void 0)return{configFrom:r,configValue:o[r][e]};return{}}const _P={scale:({model:e,channel:n})=>e.scaleName(n),format:({format:e})=>e,formatType:({formatType:e})=>e,grid:({fieldOrDatumDef:e,axis:n,scaleType:t})=>n.grid??owe(t,e),gridScale:({model:e,channel:n})=>swe(e,n),labelAlign:({axis:e,labelAngle:n,orient:t,channel:o})=>e.labelAlign||dH(n,t,o),labelAngle:({labelAngle:e})=>e,labelBaseline:({axis:e,labelAngle:n,orient:t,channel:o})=>e.labelBaseline||hH(n,t,o),labelFlush:({axis:e,fieldOrDatumDef:n,channel:t})=>e.labelFlush??uwe(n.type,t),labelOverlap:({axis:e,fieldOrDatumDef:n,scaleType:t})=>e.labelOverlap??cwe(n.type,t,ni(n)&&!!n.timeUnit,ni(n)?n.sort:void 0),orient:({orient:e})=>e,tickCount:({channel:e,model:n,axis:t,fieldOrDatumDef:o,scaleType:f})=>{const r=e==="x"?"width":e==="y"?"height":void 0,a=r?n.getSizeSignalRef(r):void 0;return t.tickCount??hwe({fieldOrDatumDef:o,scaleType:f,size:a,values:t.values})},tickMinStep:dwe,title:({axis:e,model:n,channel:t})=>{if(e.title!==void 0)return e.title;const o=pH(n,t);if(o!==void 0)return o;const f=n.typedFieldDef(t),r=t==="x"?"x2":"y2",a=n.fieldDef(r);return Z$(f?[jO(f)]:[],ni(a)?[jO(a)]:[])},values:({axis:e,fieldOrDatumDef:n})=>pwe(e,n),zindex:({axis:e,fieldOrDatumDef:n,mark:t})=>e.zindex??gwe(t,n)};function owe(e,n){return!ml(e)&&ni(n)&&!Vo(n?.bin)&&!Ml(n?.bin)}function swe(e,n){const t=n==="x"?"y":"x";if(e.getScaleComponent(t))return e.scaleName(t)}function lwe(e,n,t,o,f){const r=n?.labelAngle;if(r!==void 0)return ji(r)?r:Iv(r);{const{configValue:a}=RT("labelAngle",o,n?.style,f);return a!==void 0?Iv(a):t===ts&&ja([b8,x8],e.type)&&!(ni(e)&&e.timeUnit)?270:void 0}}function zT(e){return`(((${e.signal} % 360) + 360) % 360)`}function hH(e,n,t,o){if(e!==void 0)if(t==="x"){if(ji(e)){const f=zT(e),r=ji(n)?`(${n.signal} === "top")`:n==="top";return{signal:`(45 < ${f} && ${f} < 135) || (225 < ${f} && ${f} < 315) ? "middle" :(${f} <= 45 || 315 <= ${f}) === ${r} ? "bottom" : "top"`}}if(45{if(pg(o)&&FV(o.sort)){const{field:r,timeUnit:a}=o,l=o.sort,c=l.map((i,s)=>`${mV({field:r,timeUnit:a,equal:i})} ? ${s} : `).join("")+l.length;n=new e1(n,{calculate:c,as:t1(o,f,{forAs:!0})})}}),n}producedFields(){return new Set([this.transform.as])}dependentFields(){return this._dependentFields}assemble(){return{type:"formula",expr:this.transform.calculate,as:this.transform.as}}hash(){return`Calculate ${Ba(this.transform)}`}}function t1(e,n,t){return hi(e,{prefix:n,suffix:"sort_index",...t??{}})}function c5(e,n){return ja(["top","bottom"],n)?"column":ja(["left","right"],n)||e==="row"?"row":"column"}function n1(e,n,t,o){const f=o==="row"?t.headerRow:o==="column"?t.headerColumn:t.headerFacet;return zs((n||{})[e],f[e],t.header[e])}function f5(e,n,t,o){const f={};for(const r of e){const a=n1(r,n||{},t,o);a!==void 0&&(f[r]=a)}return f}const nC=["row","column"],rC=["header","footer"];function mwe(e,n){const t=e.component.layoutHeaders[n].title,o=e.config?e.config:void 0,f=e.component.layoutHeaders[n].facetFieldDef?e.component.layoutHeaders[n].facetFieldDef:void 0,{titleAnchor:r,titleAngle:a,titleOrient:l}=f5(["titleAnchor","titleAngle","titleOrient"],f.header,o,n),c=c5(n,l),i=Iv(a);return{name:`${n}-title`,type:"group",role:`${c}-title`,title:{text:t,...n==="row"?{orient:"left"}:{},style:"guide-title",...mH(i,c),...gH(c,i,r),...yH(o,f,n,$xe,uq)}}}function gH(e,n,t="middle"){switch(t){case"start":return{align:"left"};case"end":return{align:"right"}}const o=dH(n,e==="row"?"left":"top",e==="row"?"y":"x");return o?{align:o}:{}}function mH(e,n){const t=hH(e,n==="row"?"left":"top",n==="row"?"y":"x",!0);return t?{baseline:t}:{}}function ywe(e,n){const t=e.component.layoutHeaders[n],o=[];for(const f of rC)if(t[f])for(const r of t[f]){const a=xwe(e,n,f,t,r);a!=null&&o.push(a)}return o}function vwe(e,n){const{sort:t}=e;return nh(t)?{field:hi(t,{expr:"datum"}),order:t.order??"ascending"}:zr(t)?{field:t1(e,n,{expr:"datum"}),order:"ascending"}:{field:hi(e,{expr:"datum"}),order:t??"ascending"}}function NT(e,n,t){const{format:o,formatType:f,labelAngle:r,labelAnchor:a,labelOrient:l,labelExpr:c}=f5(["format","formatType","labelAngle","labelAnchor","labelOrient","labelExpr"],e.header,t,n),i=S8({fieldOrDatumDef:e,format:o,formatType:f,expr:"parent",config:t}).signal,s=c5(n,l);return{text:{signal:c?V0(V0(c,"datum.label",i),"datum.value",hi(e,{expr:"parent"})):i},...n==="row"?{orient:"left"}:{},style:"guide-label",frame:"group",...mH(r,s),...gH(s,r,a),...yH(t,e,n,Vxe,cq)}}function xwe(e,n,t,o,f){if(f){let r=null;const{facetFieldDef:a}=o,l=e.config?e.config:void 0;if(a&&f.labels){const{labelOrient:u}=f5(["labelOrient"],a.header,l,n);(n==="row"&&!ja(["top","bottom"],u)||n==="column"&&!ja(["left","right"],u))&&(r=NT(a,n,l))}const c=mf(e)&&!Cx(e.facet),i=f.axes,s=i?.length>0;if(r||s){const u=n==="row"?"height":"width";return{name:e.getName(`${n}_${t}`),type:"group",role:`${n}-${t}`,...o.facetFieldDef?{from:{data:e.getName(`${n}_domain`)},sort:vwe(a,n)}:{},...s&&c?{from:{data:e.getName(`facet_domain_${n}`)}}:{},...r?{title:r}:{},...f.sizeSignal?{encode:{update:{[u]:f.sizeSignal}}}:{},...s?{axes:i}:{}}}}return null}const bwe={column:{start:0,end:1},row:{start:1,end:0}};function _we(e,n){return bwe[n][e]}function wwe(e,n){const t={};for(const o of Tc){const f=e[o];if(f?.facetFieldDef){const{titleAnchor:r,titleOrient:a}=f5(["titleAnchor","titleOrient"],f.facetFieldDef.header,n,o),l=c5(o,a),c=_we(r,l);c!==void 0&&(t[l]=c)}}return Mo(t)?void 0:t}function yH(e,n,t,o,f){const r={};for(const a of o){if(!f[a])continue;const l=n1(a,n?.header,e,t);l!==void 0&&(r[f[a]]=l)}return r}function iC(e){return[...Qb(e,"width"),...Qb(e,"height"),...Qb(e,"childWidth"),...Qb(e,"childHeight")]}function Qb(e,n){const t=n==="width"?"x":"y",o=e.component.layoutSize.get(n);if(!o||o==="merged")return[];const f=e.getSizeSignalRef(n).signal;if(o==="step"){const r=e.getScaleComponent(t);if(r){const a=r.get("type"),l=r.get("range");if(ml(a)&&Cp(l)){const c=e.scaleName(t);return mf(e.parent)&&e.parent.component.resolve.scale[t]==="independent"?[wP(c,l)]:[wP(c,l),{name:f,update:vH(c,r,`domain('${c}').length`)}]}}throw new Error("layout size is step although width/height is not step.")}else if(o=="container"){const r=f.endsWith("width"),a=r?"containerSize()[0]":"containerSize()[1]",l=ET(e.config.view,r?"width":"height"),c=`isFinite(${a}) ? ${a} : ${l}`;return[{name:f,init:c,on:[{update:c,events:"window:resize"}]}]}else return[{name:f,value:o}]}function wP(e,n){const t=`${e}_step`;return ji(n.step)?{name:t,update:n.step.signal}:{name:t,value:n.step}}function vH(e,n,t){const o=n.get("type"),f=n.get("padding"),r=zs(n.get("paddingOuter"),f);let a=n.get("paddingInner");return a=o==="band"?a!==void 0?a:f:1,`bandspace(${t}, ${cf(a)}, ${cf(r)}) * ${e}_step`}function xH(e){return e==="childWidth"?"width":e==="childHeight"?"height":e}function bH(e,n){return Zr(e).reduce((t,o)=>{const f=e[o];return{...t,...A1(n,f,o,r=>Yo(r.value))}},{})}function _H(e,n){if(mf(n))return e==="theta"?"independent":"shared";if(E1(n))return"shared";if(fC(n))return pl(e)||e==="theta"||e==="radius"?"independent":"shared";throw new Error("invalid model type for resolve")}function aC(e,n){const t=e.scale[n],o=pl(n)?"axis":"legend";return t==="independent"?(e[o][n]==="shared"&&ei(Bye(n)),"independent"):e[o][n]||"shared"}const Awe={...Gxe,disable:1,labelExpr:1,selections:1,opacity:1,shape:1,stroke:1,fill:1,size:1,strokeWidth:1,strokeDash:1,encode:1},wH=Zr(Awe);class kwe extends yd{}const AP={symbols:Twe,gradient:Mwe,labels:Ewe,entries:Swe};function Twe(e,{fieldOrDatumDef:n,model:t,channel:o,legendCmpt:f,legendType:r}){if(r!=="symbol")return;const{markDef:a,encoding:l,config:c,mark:i}=t,s=a.filled&&i!=="trail";let u={...X1e({},t,$ve),...$q(t,{filled:s})};const h=f.get("symbolOpacity")??c.legend.symbolOpacity,d=f.get("symbolFillColor")??c.legend.symbolFillColor,m=f.get("symbolStrokeColor")??c.legend.symbolStrokeColor,p=h===void 0?AH(l.opacity)??a.opacity:void 0;if(u.fill){if(o==="fill"||s&&o===Gu)delete u.fill;else if(u.fill.field)d?delete u.fill:(u.fill=Yo(c.legend.symbolBaseFillColor??"black"),u.fillOpacity=Yo(p??1));else if(zr(u.fill)){const g=BT(l.fill??l.color)??a.fill??(s&&a.color);g&&(u.fill=Yo(g))}}if(u.stroke){if(o==="stroke"||!s&&o===Gu)delete u.stroke;else if(u.stroke.field||m)delete u.stroke;else if(zr(u.stroke)){const g=zs(BT(l.stroke||l.color),a.stroke,s?a.color:void 0);g&&(u.stroke={value:g})}}if(o!==pd){const g=ni(n)&&TH(t,f,n);g?u.opacity=[{test:g,...Yo(p??1)},Yo(c.legend.unselectedOpacity)]:p&&(u.opacity=Yo(p))}return u={...u,...e},Mo(u)?void 0:u}function Mwe(e,{model:n,legendType:t,legendCmpt:o}){if(t!=="gradient")return;const{config:f,markDef:r,encoding:a}=n;let l={};const i=(o.get("gradientOpacity")??f.legend.gradientOpacity)===void 0?AH(a.opacity)||r.opacity:void 0;return i&&(l.opacity=Yo(i)),l={...l,...e},Mo(l)?void 0:l}function Ewe(e,{fieldOrDatumDef:n,model:t,channel:o,legendCmpt:f}){const r=t.legend(o)||{},a=t.config,l=ni(n)?TH(t,f,n):void 0,c=l?[{test:l,value:1},{value:a.legend.unselectedOpacity}]:void 0,{format:i,formatType:s}=r;let u;Y0(s)?u=hf({fieldOrDatumDef:n,field:"datum.value",format:i,formatType:s,config:a}):i===void 0&&s===void 0&&a.customFormatTypes&&(n.type==="quantitative"&&a.numberFormatType?u=hf({fieldOrDatumDef:n,field:"datum.value",format:a.numberFormat,formatType:a.numberFormatType,config:a}):n.type==="temporal"&&a.timeFormatType&&ni(n)&&n.timeUnit===void 0&&(u=hf({fieldOrDatumDef:n,field:"datum.value",format:a.timeFormat,formatType:a.timeFormatType,config:a})));const h={...c?{opacity:c}:{},...u?{text:u}:{},...e};return Mo(h)?void 0:h}function Swe(e,{legendCmpt:n}){return n.get("selections")?.length?{...e,fill:{value:"transparent"}}:e}function AH(e){return kH(e,(n,t)=>Math.max(n,t.value))}function BT(e){return kH(e,(n,t)=>zs(n,t.value))}function kH(e,n){if(lxe(e))return Ti(e.condition).reduce(n,e.value);if(bf(e))return e.value}function TH(e,n,t){const o=n.get("selections");if(!o?.length)return;const f=ri(t.field);return o.map(r=>`(!length(data(${ri(es(r)+Z0)})) || (${r}[${f}] && indexof(${r}[${f}], datum.value) >= 0))`).join(" || ")}const kP={direction:({direction:e})=>e,format:({fieldOrDatumDef:e,legend:n,config:t})=>{const{format:o,formatType:f}=n;return DV(e,e.type,o,f,t,!1)},formatType:({legend:e,fieldOrDatumDef:n,scaleType:t})=>{const{formatType:o}=e;return OV(o,n,t)},gradientLength:e=>{const{legend:n,legendConfig:t}=e;return n.gradientLength??t.gradientLength??Fwe(e)},labelOverlap:({legend:e,legendConfig:n,scaleType:t})=>e.labelOverlap??n.labelOverlap??Rwe(t),symbolType:({legend:e,markDef:n,channel:t,encoding:o})=>e.symbolType??Lwe(n.type,t,o.shape,n.shape),title:({fieldOrDatumDef:e,config:n})=>_m(e,n,{allowDisabling:!0}),type:({legendType:e,scaleType:n,channel:t})=>{if(bm(t)&&ff(n)){if(e==="gradient")return}else if(e==="symbol")return;return e},values:({fieldOrDatumDef:e,legend:n})=>Cwe(n,e)};function Cwe(e,n){const t=e.values;if(zr(t))return GV(n,t);if(ji(t))return t}function Lwe(e,n,t,o){if(n!=="shape"){const f=BT(t)??o;if(f)return f}switch(e){case"bar":case"rect":case"image":case"square":return"square";case"line":case"trail":case"rule":return"stroke";case"arc":case"point":case"circle":case"tick":case"geoshape":case"area":case"text":return"circle"}}function Dwe(e){const{legend:n}=e;return zs(n.type,Owe(e))}function Owe({channel:e,timeUnit:n,scaleType:t}){if(bm(e)){if(ja(["quarter","month","day"],n))return"symbol";if(ff(t))return"gradient"}return"symbol"}function Pwe({legendConfig:e,legendType:n,orient:t,legend:o}){return o.direction??e[n?"gradientDirection":"symbolDirection"]??Iwe(t,n)}function Iwe(e,n){switch(e){case"top":case"bottom":return"horizontal";case"left":case"right":case"none":case void 0:return;default:return n==="gradient"?"horizontal":void 0}}function Fwe({legendConfig:e,model:n,direction:t,orient:o,scaleType:f}){const{gradientHorizontalMaxLength:r,gradientHorizontalMinLength:a,gradientVerticalMaxLength:l,gradientVerticalMinLength:c}=e;if(ff(f))return t==="horizontal"?o==="top"||o==="bottom"?TP(n,"width",a,r):a:TP(n,"height",c,l)}function TP(e,n,t,o){return{signal:`clamp(${e.getSizeSignalRef(n).signal}, ${t}, ${o})`}}function Rwe(e){if(ja(["quantile","threshold","log","symlog"],e))return"greedy"}function MH(e){const n=As(e)?zwe(e):Uwe(e);return e.component.legends=n,n}function zwe(e){const{encoding:n}=e,t={};for(const o of[Gu,...hq]){const f=Ks(n[o]);!f||!e.getScaleComponent(o)||o===Wu&&ni(f)&&f.type===_1||(t[o]=jwe(e,o))}return t}function Nwe(e,n){const t=e.scaleName(n);if(e.mark==="trail"){if(n==="color")return{stroke:t};if(n==="size")return{strokeWidth:t}}return n==="color"?e.markDef.filled?{fill:t}:{stroke:t}:{[n]:t}}function Bwe(e,n,t,o){switch(n){case"disable":return t!==void 0;case"values":return!!t?.values;case"title":if(n==="title"&&e===o?.title)return!0}return e===(t||{})[n]}function jwe(e,n){let t=e.legend(n);const{markDef:o,encoding:f,config:r}=e,a=r.legend,l=new kwe({},Nwe(e,n));j2e(e,n,l);const c=t!==void 0?!t:a.disable;if(l.set("disable",c,t!==void 0),c)return l;t=t||{};const i=e.getScaleComponent(n).get("type"),s=Ks(f[n]),u=ni(s)?hl(s.timeUnit)?.unit:void 0,h=t.orient||r.legend.orient||"right",d=Dwe({legend:t,channel:n,timeUnit:u,scaleType:i}),m=Pwe({legend:t,legendType:d,orient:h,legendConfig:a}),p={legend:t,channel:n,model:e,markDef:o,encoding:f,fieldOrDatumDef:s,legendConfig:a,config:r,scaleType:i,orient:h,legendType:d,direction:m};for(const _ of wH){if(d==="gradient"&&_.startsWith("symbol")||d==="symbol"&&_.startsWith("gradient"))continue;const A=_ in kP?kP[_](p):t[_];if(A!==void 0){const b=Bwe(A,_,t,e.fieldDef(n));(b||r.legend[_]===void 0)&&l.set(_,A,b)}}const g=t?.encoding??{},y=l.get("selections"),v={},x={fieldOrDatumDef:s,model:e,channel:n,legendCmpt:l,legendType:d};for(const _ of["labels","legend","title","symbols","gradient","entries"]){const A=bH(g[_]??{},e),b=_ in AP?AP[_](A,x):A;b!==void 0&&!Mo(b)&&(v[_]={...y?.length&&ni(s)?{name:`${es(s.field)}_legend_${_}`}:{},...y?.length?{interactive:!!y}:{},update:b})}return Mo(v)||l.set("encode",v,!!t?.encoding),l}function Uwe(e){const{legends:n,resolve:t}=e.component;for(const o of e.children){MH(o);for(const f of Zr(o.component.legends))t.legend[f]=aC(e.component.resolve,f),t.legend[f]==="shared"&&(n[f]=EH(n[f],o.component.legends[f]),n[f]||(t.legend[f]="independent",delete n[f]))}for(const o of Zr(n))for(const f of e.children)f.component.legends[o]&&t.legend[o]==="shared"&&delete f.component.legends[o];return n}function EH(e,n){if(!e)return n.clone();const t=e.getWithExplicit("orient"),o=n.getWithExplicit("orient");if(t.explicit&&o.explicit&&t.value!==o.value)return;let f=!1;for(const r of wH){const a=mp(e.getWithExplicit(r),n.getWithExplicit(r),r,"legend",(l,c)=>{switch(r){case"symbolType":return $we(l,c);case"title":return K$(l,c);case"type":return f=!0,nc("symbol")}return r5(l,c,r,"legend")});e.setWithExplicit(r,a)}return f&&(e.implicit?.encode?.gradient&&Z_(e.implicit,["encode","gradient"]),e.explicit?.encode?.gradient&&Z_(e.explicit,["encode","gradient"])),e}function $we(e,n){return n.value==="circle"?n:e}function Vwe(e,n,t,o){var f,r;e.encode??(e.encode={}),(f=e.encode)[n]??(f[n]={}),(r=e.encode[n]).update??(r.update={}),e.encode[n].update[t]=o}function SH(e){const n=e.component.legends,t={};for(const f of Zr(n)){const r=e.getScaleComponent(f),a=$o(r.get("domains"));if(t[a])for(const l of t[a])EH(l,n[f])||t[a].push(n[f]);else t[a]=[n[f].clone()]}return Dl(t).flat().map(f=>qwe(f,e.config)).filter(f=>f!==void 0)}function qwe(e,n){const{disable:t,labelExpr:o,selections:f,...r}=e.combine();if(!t){if(n.aria===!1&&r.aria==null&&(r.aria=!1),r.encode?.symbols){const a=r.encode.symbols.update;a.fill&&a.fill.value!=="transparent"&&!a.stroke&&!r.stroke&&(a.stroke={value:"transparent"});for(const l of hq)r[l]&&delete a[l]}if(r.title||delete r.title,o!==void 0){let a=o;r.encode?.labels?.update&&ji(r.encode.labels.update.text)&&(a=V0(o,"datum.label",r.encode.labels.update.text.signal)),Vwe(r,"labels","text",{signal:a})}return r}}function Hwe(e){return E1(e)||fC(e)?Gwe(e):CH(e)}function Gwe(e){return e.children.reduce((n,t)=>n.concat(t.assembleProjections()),CH(e))}function CH(e){const n=e.component.projection;if(!n||n.merged)return[];const t=n.combine(),{name:o}=t;if(n.data){const f={signal:`[${n.size.map(a=>a.signal).join(", ")}]`},r=n.data.reduce((a,l)=>{const c=ji(l)?l.signal:`data('${e.lookupDataSource(l)}')`;return ja(a,c)||a.push(c),a},[]);if(r.length<=0)throw new Error("Projection's fit didn't find any data sources");return[{name:o,size:f,fit:{signal:r.length>1?`[${r.join(", ")}]`:r[0]},...t}]}else return[{name:o,translate:{signal:"[width / 2, height / 2]"},...t}]}const Wwe=["type","clipAngle","clipExtent","center","rotate","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];class LH extends yd{constructor(n,t,o,f){super({...t},{name:n}),this.specifiedProjection=t,this.size=o,this.data=f,this.merged=!1}get isFit(){return!!this.data}}function DH(e){e.component.projection=As(e)?Ywe(e):Jwe(e)}function Ywe(e){if(e.hasProjection){const n=Iu(e.specifiedProjection),t=!(n&&(n.scale!=null||n.translate!=null)),o=t?[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]:void 0,f=t?Xwe(e):void 0,r=new LH(e.projectionName(!0),{...Iu(e.config.projection)??{},...n??{}},o,f);return r.get("type")||r.set("type","equalEarth",!1),r}}function Xwe(e){const n=[],{encoding:t}=e;for(const o of[[Sf,Ef],[Oc,Cf]])(Ks(t[o[0]])||Ks(t[o[1]]))&&n.push({signal:e.getName(`geojson_${n.length}`)});return e.channelHasField(Wu)&&e.typedFieldDef(Wu).type===_1&&n.push({signal:e.getName(`geojson_${n.length}`)}),n.length===0&&n.push(e.requestDataName(Uo.Main)),n}function Zwe(e,n){const t=WS(Wwe,f=>!!(!Yi(e.explicit,f)&&!Yi(n.explicit,f)||Yi(e.explicit,f)&&Yi(n.explicit,f)&&Xf(e.get(f),n.get(f))));if(Xf(e.size,n.size)){if(t)return e;if(Xf(e.explicit,{}))return n;if(Xf(n.explicit,{}))return e}return null}function Jwe(e){if(e.children.length===0)return;let n;for(const o of e.children)DH(o);const t=WS(e.children,o=>{const f=o.component.projection;if(f)if(n){const r=Zwe(n,f);return r&&(n=r),!!r}else return n=f,!0;else return!0});if(n&&t){const o=e.projectionName(!0),f=new LH(o,n.specifiedProjection,n.size,la(n.data));for(const r of e.children){const a=r.component.projection;a&&(a.isFit&&f.data.push(...r.component.projection.data),r.renameProjection(a.get("name"),o),a.merged=!0)}return f}}function Kwe(e,n,t,o){if(Dx(n,t)){const f=As(e)?e.axis(t)??e.legend(t)??{}:{},r=hi(n,{expr:"datum"}),a=hi(n,{expr:"datum",binSuffix:"end"});return{formulaAs:hi(n,{binSuffix:"range",forAs:!0}),formula:Sx(r,a,f.format,f.formatType,o)}}return{}}function OH(e,n){return`${q$(e)}_${n}`}function Qwe(e,n){return{signal:e.getName(`${n}_bins`),extentSignal:e.getName(`${n}_extent`)}}function oC(e,n,t){const o=J3(t,void 0)??{},f=OH(o,n);return e.getName(`${f}_bins`)}function e3e(e){return"as"in e}function MP(e,n,t){let o,f;e3e(e)?o=Li(e.as)?[e.as,`${e.as}_end`]:[e.as[0],e.as[1]]:o=[hi(e,{forAs:!0}),hi(e,{binSuffix:"end",forAs:!0})];const r={...J3(n,void 0)},a=OH(r,e.field),{signal:l,extentSignal:c}=Qwe(t,a);if(j3(r.extent)){const s=r.extent;f=cH(t,s.param,s),delete r.extent}const i={bin:r,field:e.field,as:[o],...l?{signal:l}:{},...c?{extentSignal:c}:{},...f?{span:f}:{}};return{key:a,binComponent:i}}class ih extends wo{clone(){return new ih(null,la(this.bins))}constructor(n,t){super(n),this.bins=t}static makeFromEncoding(n,t){const o=t.reduceFieldDef((f,r,a)=>{if(Au(r)&&Vo(r.bin)){const{key:l,binComponent:c}=MP(r,r.bin,t);f[l]={...c,...f[l],...Kwe(t,r,a,t.config)}}return f},{});return Mo(o)?null:new ih(n,o)}static makeFromTransform(n,t,o){const{key:f,binComponent:r}=MP(t,t.bin,o);return new ih(n,{[f]:r})}merge(n,t){for(const o of Zr(n.bins))o in this.bins?(t(n.bins[o].signal,this.bins[o].signal),this.bins[o].as=Zf([...this.bins[o].as,...n.bins[o].as],Ba)):this.bins[o]=n.bins[o];for(const o of n.children)n.removeChild(o),o.parent=this;n.remove()}producedFields(){return new Set(Dl(this.bins).map(n=>n.as).flat(2))}dependentFields(){return new Set(Dl(this.bins).map(n=>n.field))}hash(){return`Bin ${Ba(this.bins)}`}assemble(){return Dl(this.bins).flatMap(n=>{const t=[],[o,...f]=n.as,{extent:r,...a}=n.bin,l={type:"bin",field:Dc(n.field),as:o,signal:n.signal,...j3(r)?{extent:null}:{extent:r},...n.span?{span:{signal:`span(${n.span})`}}:{},...a};!r&&n.extentSignal&&(t.push({type:"extent",field:Dc(n.field),signal:n.extentSignal}),l.extent={signal:n.extentSignal}),t.push(l);for(const c of f)for(let i=0;i<2;i++)t.push({type:"formula",expr:hi({field:o[i]},{expr:"datum"}),as:c[i]});return n.formula&&t.push({type:"formula",expr:n.formula,as:n.formulaAs}),t})}}function t3e(e,n,t,o){const f=As(o)?o.encoding[_h(n)]:void 0;if(Au(t)&&As(o)&&NV(t,f,o.markDef,o.config))e.add(hi(t,{})),e.add(hi(t,{suffix:"end"})),t.bin&&Dx(t,n)&&e.add(hi(t,{binSuffix:"range"}));else if(P$(n)){const r=O$(n);e.add(o.getName(r))}else e.add(hi(t));return pg(t)&&Lve(t.scale?.range)&&e.add(t.scale.range.field),e}function n3e(e,n){for(const t of Zr(n)){const o=n[t];for(const f of Zr(o))t in e?e[t][f]=new Set([...e[t][f]??[],...o[f]]):e[t]={[f]:o[f]}}}class gf extends wo{clone(){return new gf(null,new Set(this.dimensions),la(this.measures))}constructor(n,t,o){super(n),this.dimensions=t,this.measures=o}get groupBy(){return this.dimensions}static makeFromEncoding(n,t){let o=!1;t.forEachFieldDef(a=>{a.aggregate&&(o=!0)});const f={},r=new Set;return!o||(t.forEachFieldDef((a,l)=>{const{aggregate:c,field:i}=a;if(c)if(c==="count")f["*"]??(f["*"]={}),f["*"].count=new Set([hi(a,{forAs:!0})]);else{if(rd(c)||Sp(c)){const s=rd(c)?"argmin":"argmax",u=c[s];f[u]??(f[u]={}),f[u][s]=new Set([hi({op:s,field:u},{forAs:!0})])}else f[i]??(f[i]={}),f[i][c]=new Set([hi(a,{forAs:!0})]);gd(l)&&t.scaleDomain(l)==="unaggregated"&&(f[i]??(f[i]={}),f[i].min=new Set([hi({field:i,aggregate:"min"},{forAs:!0})]),f[i].max=new Set([hi({field:i,aggregate:"max"},{forAs:!0})]))}else t3e(r,l,a,t)}),r.size+Zr(f).length===0)?null:new gf(n,r,f)}static makeFromTransform(n,t){const o=new Set,f={};for(const r of t.aggregate){const{op:a,field:l,as:c}=r;a&&(a==="count"?(f["*"]??(f["*"]={}),f["*"].count=new Set([c||hi(r,{forAs:!0})])):(f[l]??(f[l]={}),f[l][a]=new Set([c||hi(r,{forAs:!0})])))}for(const r of t.groupby??[])o.add(r);return o.size+Zr(f).length===0?null:new gf(n,o,f)}merge(n){return k$(this.dimensions,n.dimensions)?(n3e(this.measures,n.measures),!0):(tve("different dimensions, cannot merge"),!1)}addDimensions(n){n.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...Zr(this.measures)])}producedFields(){const n=new Set;for(const t of Zr(this.measures))for(const o of Zr(this.measures[t])){const f=this.measures[t][o];f.size===0?n.add(`${o}_${t}`):f.forEach(n.add,n)}return n}hash(){return`Aggregate ${Ba({dimensions:this.dimensions,measures:this.measures})}`}assemble(){const n=[],t=[],o=[];for(const r of Zr(this.measures))for(const a of Zr(this.measures[r]))for(const l of this.measures[r][a])o.push(l),n.push(a),t.push(r==="*"?null:Dc(r));return{type:"aggregate",groupby:[...this.dimensions].map(Dc),ops:n,fields:t,as:o}}}class T1 extends wo{constructor(n,t,o,f){super(n),this.model=t,this.name=o,this.data=f;for(const r of Tc){const a=t.facet[r];if(a){const{bin:l,sort:c}=a;this[r]={name:t.getName(`${r}_domain`),fields:[hi(a),...Vo(l)?[hi(a,{binSuffix:"end"})]:[]],...nh(c)?{sortField:c}:zr(c)?{sortIndexField:t1(a,r)}:{}}}}this.childModel=t.child}hash(){let n="Facet";for(const t of Tc)this[t]&&(n+=` ${t.charAt(0)}:${Ba(this[t])}`);return n}get fields(){const n=[];for(const t of Tc)this[t]?.fields&&n.push(...this[t].fields);return n}dependentFields(){const n=new Set(this.fields);for(const t of Tc)this[t]&&(this[t].sortField&&n.add(this[t].sortField.field),this[t].sortIndexField&&n.add(this[t].sortIndexField));return n}producedFields(){return new Set}getSource(){return this.name}getChildIndependentFieldsWithStep(){const n={};for(const t of wh){const o=this.childModel.component.scales[t];if(o&&!o.merged){const f=o.get("type"),r=o.get("range");if(ml(f)&&Cp(r)){const a=h5(this.childModel,t),l=cC(a);l?n[t]=l:ei(s8(t))}}}return n}assembleRowColumnHeaderData(n,t,o){const f={row:"y",column:"x",facet:void 0}[n],r=[],a=[],l=[];f&&o&&o[f]&&(t?(r.push(`distinct_${o[f]}`),a.push("max")):(r.push(o[f]),a.push("distinct")),l.push(`distinct_${o[f]}`));const{sortField:c,sortIndexField:i}=this[n];if(c){const{op:s=W3,field:u}=c;r.push(u),a.push(s),l.push(hi(c,{forAs:!0}))}else i&&(r.push(i),a.push("max"),l.push(i));return{name:this[n].name,source:t??this.data,transform:[{type:"aggregate",groupby:this[n].fields,...r.length?{fields:r,ops:a,as:l}:{}}]}}assembleFacetHeaderData(n){const{columns:t}=this.model.layout,{layoutHeaders:o}=this.model.component,f=[],r={};for(const c of nC){for(const i of rC){const s=(o[c]&&o[c][i])??[];for(const u of s)if(u.axes?.length>0){r[c]=!0;break}}if(r[c]){const i=`length(data("${this.facet.name}"))`,s=c==="row"?t?{signal:`ceil(${i} / ${t})`}:1:t?{signal:`min(${i}, ${t})`}:{signal:i};f.push({name:`${this.facet.name}_${c}`,transform:[{type:"sequence",start:0,stop:s}]})}}const{row:a,column:l}=r;return(a||l)&&f.unshift(this.assembleRowColumnHeaderData("facet",null,n)),f}assemble(){const n=[];let t=null;const o=this.getChildIndependentFieldsWithStep(),{column:f,row:r,facet:a}=this;if(f&&r&&(o.x||o.y)){t=`cross_${this.column.name}_${this.row.name}`;const l=[].concat(o.x??[],o.y??[]),c=l.map(()=>"distinct");n.push({name:t,source:this.data,transform:[{type:"aggregate",groupby:this.fields,fields:l,ops:c}]})}for(const l of[Jh,Zh])this[l]&&n.push(this.assembleRowColumnHeaderData(l,t,o));if(a){const l=this.assembleFacetHeaderData(o);l&&n.push(...l)}return n}}function EP(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function r3e(e,n){const t=ZS(e);if(n==="number")return`toNumber(${t})`;if(n==="boolean")return`toBoolean(${t})`;if(n==="string")return`toString(${t})`;if(n==="date")return`toDate(${t})`;if(n==="flatten")return t;if(n.startsWith("date:")){const o=EP(n.slice(5,n.length));return`timeParse(${t},'${o}')`}else if(n.startsWith("utc:")){const o=EP(n.slice(4,n.length));return`utcParse(${t},'${o}')`}else return ei(lye(n)),null}function i3e(e){const n={};return O2(e.filter,t=>{if(gV(t)){let o=null;f8(t)?o=ac(t.equal):d8(t)?o=ac(t.lte):h8(t)?o=ac(t.lt):p8(t)?o=ac(t.gt):g8(t)?o=ac(t.gte):m8(t)?o=t.range[0]:y8(t)&&(o=(t.oneOf??t.in)[0]),o&&(hg(o)?n[t.field]="date":Eo(o)?n[t.field]="number":Li(o)&&(n[t.field]="string")),t.timeUnit&&(n[t.field]="date")}}),n}function a3e(e){const n={};function t(o){Jm(o)?n[o.field]="date":o.type==="quantitative"&&j1e(o.aggregate)?n[o.field]="number":qm(o.field)>1?o.field in n||(n[o.field]="flatten"):pg(o)&&nh(o.sort)&&qm(o.sort.field)>1&&(o.sort.field in n||(n[o.sort.field]="flatten"))}if((As(e)||mf(e))&&e.forEachFieldDef((o,f)=>{if(Au(o))t(o);else{const r=cg(f),a=e.fieldDef(r);t({...o,type:a.type})}}),As(e)){const{mark:o,markDef:f,encoding:r}=e;if(Lp(o)&&!e.encoding.order){const a=f.orient==="horizontal"?"y":"x",l=r[a];ni(l)&&l.type==="quantitative"&&!(l.field in n)&&(n[l.field]="number")}}return n}function o3e(e){const n={};if(As(e)&&e.component.selection)for(const t of Zr(e.component.selection)){const o=e.component.selection[t];for(const f of o.project.items)!f.channel&&qm(f.field)>1&&(n[f.field]="flatten")}return n}class Gl extends wo{clone(){return new Gl(null,la(this._parse))}constructor(n,t){super(n),this._parse=t}hash(){return`Parse ${Ba(this._parse)}`}static makeExplicit(n,t,o){let f={};const r=t.data;return!tp(r)&&r?.format?.parse&&(f=r.format.parse),this.makeWithAncestors(n,f,{},o)}static makeWithAncestors(n,t,o,f){for(const l of Zr(o)){const c=f.getWithExplicit(l);c.value!==void 0&&(c.explicit||c.value===o[l]||c.value==="derived"||o[l]==="flatten"?delete o[l]:ei(OO(l,o[l],c.value)))}for(const l of Zr(t)){const c=f.get(l);c!==void 0&&(c===t[l]?delete t[l]:ei(OO(l,t[l],c)))}const r=new yd(t,o);f.copyAll(r);const a={};for(const l of Zr(r.combine())){const c=r.get(l);c!==null&&(a[l]=c)}return Zr(a).length===0||f.parseNothing?null:new Gl(n,a)}get parse(){return this._parse}merge(n){this._parse={...this._parse,...n.parse},n.remove()}assembleFormatParse(){const n={};for(const t of Zr(this._parse)){const o=this._parse[t];qm(t)===1&&(n[t]=o)}return n}producedFields(){return new Set(Zr(this._parse))}dependentFields(){return new Set(Zr(this._parse))}assembleTransforms(n=!1){return Zr(this._parse).filter(t=>n?qm(t)>1:!0).map(t=>{const o=r3e(t,this._parse[t]);return o?{type:"formula",expr:o,as:JS(t)}:null}).filter(t=>t!==null)}}class xp extends wo{clone(){return new xp(null)}constructor(n){super(n)}dependentFields(){return new Set}producedFields(){return new Set([_f])}hash(){return"Identifier"}assemble(){return{type:"identifier",as:_f}}}class zx extends wo{clone(){return new zx(null,this.params)}constructor(n,t){super(n),this.params=t}dependentFields(){return new Set}producedFields(){}hash(){return`Graticule ${Ba(this.params)}`}assemble(){return{type:"graticule",...this.params===!0?{}:this.params}}}class Nx extends wo{clone(){return new Nx(null,this.params)}constructor(n,t){super(n),this.params=t}dependentFields(){return new Set}producedFields(){return new Set([this.params.as??"data"])}hash(){return`Hash ${Ba(this.params)}`}assemble(){return{type:"sequence",...this.params}}}class Q0 extends wo{constructor(n){super(null),n??(n={name:"source"});let t;if(tp(n)||(t=n.format?{...ju(n.format,["parse"])}:{}),Fv(n))this._data={values:n.values};else if(Km(n)){if(this._data={url:n.url},!t.type){let o=/(?:\.([^.]+))?$/.exec(n.url)[1];ja(["json","csv","tsv","dsv","topojson"],o)||(o="json"),t.type=o}}else Cq(n)?this._data={values:[{type:"Sphere"}]}:(Eq(n)||tp(n))&&(this._data={});this._generator=tp(n),n.name&&(this._name=n.name),t&&!Mo(t)&&(this._data.format=t)}dependentFields(){return new Set}producedFields(){}get data(){return this._data}hasName(){return!!this._name}get isGenerator(){return this._generator}get dataName(){return this._name}set dataName(n){this._name=n}set parent(n){throw new Error("Source nodes have to be roots.")}remove(){throw new Error("Source nodes are roots and cannot be removed.")}hash(){throw new Error("Cannot hash sources")}assemble(){return{name:this._name,...this._data,transform:[]}}}var SP=globalThis&&globalThis.__classPrivateFieldSet||function(e,n,t,o,f){if(o==="m")throw new TypeError("Private method is not writable");if(o==="a"&&!f)throw new TypeError("Private accessor was defined without a setter");if(typeof n=="function"?e!==n||!f:!n.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?f.call(e,t):f?f.value=t:n.set(e,t),t},s3e=globalThis&&globalThis.__classPrivateFieldGet||function(e,n,t,o){if(t==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof n=="function"?e!==n||!o:!n.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?o:t==="a"?o.call(e):o?o.value:n.get(e)},Gy;function sC(e){return e instanceof Q0||e instanceof zx||e instanceof Nx}class lC{constructor(){Gy.set(this,void 0),SP(this,Gy,!1,"f")}setModified(){SP(this,Gy,!0,"f")}get modifiedFlag(){return s3e(this,Gy,"f")}}Gy=new WeakMap;class mg extends lC{getNodeDepths(n,t,o){o.set(n,t);for(const f of n.children)this.getNodeDepths(f,t+1,o);return o}optimize(n){const o=[...this.getNodeDepths(n,0,new Map).entries()].sort((f,r)=>r[1]-f[1]);for(const f of o)this.run(f[0]);return this.modifiedFlag}}class uC extends lC{optimize(n){this.run(n);for(const t of n.children)this.optimize(t);return this.modifiedFlag}}class l3e extends uC{mergeNodes(n,t){const o=t.shift();for(const f of t)n.removeChild(f),f.parent=o,f.remove()}run(n){const t=n.children.map(f=>f.hash()),o={};for(let f=0;f1&&(this.setModified(),this.mergeNodes(n,o[f]))}}class u3e extends uC{constructor(n){super(),this.requiresSelectionId=n&&K8(n)}run(n){n instanceof xp&&(this.requiresSelectionId&&(sC(n.parent)||n.parent instanceof gf||n.parent instanceof Gl)||(this.setModified(),n.remove()))}}class c3e extends lC{optimize(n){return this.run(n,new Set),this.modifiedFlag}run(n,t){let o=new Set;n instanceof rh&&(o=n.producedFields(),YS(o,t)&&(this.setModified(),n.removeFormulas(t),n.producedFields.length===0&&n.remove()));for(const f of n.children)this.run(f,new Set([...t,...o]))}}class f3e extends uC{constructor(){super()}run(n){n instanceof vu&&!n.isRequired()&&(this.setModified(),n.remove())}}class h3e extends mg{run(n){if(!sC(n)&&!(n.numChildren()>1)){for(const t of n.children)if(t instanceof Gl)if(n instanceof Gl)this.setModified(),n.merge(t);else{if(XS(n.producedFields(),t.dependentFields()))continue;this.setModified(),t.swapWithParent()}}}}class d3e extends mg{run(n){const t=[...n.children],o=n.children.filter(f=>f instanceof Gl);if(n.numChildren()>1&&o.length>=1){const f={},r=new Set;for(const a of o){const l=a.parse;for(const c of Zr(l))c in f?f[c]!==l[c]&&r.add(c):f[c]=l[c]}for(const a of r)delete f[a];if(!Mo(f)){this.setModified();const a=new Gl(n,f);for(const l of t){if(l instanceof Gl)for(const c of Zr(f))delete l.parse[c];n.removeChild(l),l.parent=a,l instanceof Gl&&Zr(l.parse).length===0&&l.remove()}}}}}class p3e extends mg{run(n){n instanceof vu||n.numChildren()>0||n instanceof T1||n instanceof Q0||(this.setModified(),n.remove())}}class g3e extends mg{run(n){const t=n.children.filter(f=>f instanceof rh),o=t.pop();for(const f of t)this.setModified(),o.merge(f)}}class m3e extends mg{run(n){const t=n.children.filter(f=>f instanceof gf),o={};for(const f of t){const r=Ba(f.groupBy);r in o||(o[r]=[]),o[r].push(f)}for(const f of Zr(o)){const r=o[f];if(r.length>1){const a=r.pop();for(const l of r)a.merge(l)&&(n.removeChild(l),l.parent=a,l.remove(),this.setModified())}}}}class y3e extends mg{constructor(n){super(),this.model=n}run(n){const t=!(sC(n)||n instanceof k1||n instanceof Gl||n instanceof xp),o=[],f=[];for(const r of n.children)r instanceof ih&&(t&&!XS(n.producedFields(),r.dependentFields())?o.push(r):f.push(r));if(o.length>0){const r=o.pop();for(const a of o)r.merge(a,this.model.renameSignal.bind(this.model));this.setModified(),n instanceof ih?n.merge(r,this.model.renameSignal.bind(this.model)):r.swapWithParent()}if(f.length>1){const r=f.pop();for(const a of f)r.merge(a,this.model.renameSignal.bind(this.model));this.setModified()}}}class v3e extends mg{run(n){const t=[...n.children];if(!$0(t,a=>a instanceof vu)||n.numChildren()<=1)return;const f=[];let r;for(const a of t)if(a instanceof vu){let l=a;for(;l.numChildren()===1;){const[c]=l.children;if(c instanceof vu)l=c;else break}f.push(...l.children),r?(n.removeChild(a),a.parent=r.parent,r.parent.removeChild(r),r.parent=l,this.setModified()):r=l}else f.push(a);if(f.length){this.setModified();for(const a of f)a.parent.removeChild(a),a.parent=r}}}class yg extends wo{clone(){return new yg(null,la(this.transform))}constructor(n,t){super(n),this.transform=t}addDimensions(n){this.transform.groupby=Zf(this.transform.groupby.concat(n),t=>t)}dependentFields(){const n=new Set;return this.transform.groupby&&this.transform.groupby.forEach(n.add,n),this.transform.joinaggregate.map(t=>t.field).filter(t=>t!==void 0).forEach(n.add,n),n}producedFields(){return new Set(this.transform.joinaggregate.map(this.getDefaultName))}getDefaultName(n){return n.as??hi(n)}hash(){return`JoinAggregateTransform ${Ba(this.transform)}`}assemble(){const n=[],t=[],o=[];for(const r of this.transform.joinaggregate)t.push(r.op),o.push(this.getDefaultName(r)),n.push(r.field===void 0?null:r.field);const f=this.transform.groupby;return{type:"joinaggregate",as:o,ops:t,fields:n,...f!==void 0?{groupby:f}:{}}}}function x3e(e){return e.stack.stackBy.reduce((n,t)=>{const o=t.fieldDef,f=hi(o);return f&&n.push(f),n},[])}function b3e(e){return zr(e)&&e.every(n=>Li(n))&&e.length>1}class Qh extends wo{clone(){return new Qh(null,la(this._stack))}constructor(n,t){super(n),this._stack=t}static makeFromTransform(n,t){const{stack:o,groupby:f,as:r,offset:a="zero"}=t,l=[],c=[];if(t.sort!==void 0)for(const u of t.sort)l.push(u.field),c.push(zs(u.order,"ascending"));const i={field:l,order:c};let s;return b3e(r)?s=r:Li(r)?s=[r,`${r}_end`]:s=[`${t.stack}_start`,`${t.stack}_end`],new Qh(n,{dimensionFieldDefs:[],stackField:o,groupby:f,offset:a,sort:i,facetby:[],as:s})}static makeFromEncoding(n,t){const o=t.stack,{encoding:f}=t;if(!o)return null;const{groupbyChannels:r,fieldChannel:a,offset:l,impute:c}=o,i=r.map(d=>{const m=f[d];return hh(m)}).filter(d=>!!d),s=x3e(t),u=t.encoding.order;let h;if(zr(u)||ni(u))h=X$(u);else{const d=BV(u)?u.sort:a==="y"?"descending":"ascending";h=s.reduce((m,p)=>(m.field.push(p),m.order.push(d),m),{field:[],order:[]})}return new Qh(n,{dimensionFieldDefs:i,stackField:t.vgField(a),facetby:[],stackby:s,sort:h,offset:l,impute:c,as:[t.vgField(a,{suffix:"start",forAs:!0}),t.vgField(a,{suffix:"end",forAs:!0})]})}get stack(){return this._stack}addDimensions(n){this._stack.facetby.push(...n)}dependentFields(){const n=new Set;return n.add(this._stack.stackField),this.getGroupbyFields().forEach(n.add,n),this._stack.facetby.forEach(n.add,n),this._stack.sort.field.forEach(n.add,n),n}producedFields(){return new Set(this._stack.as)}hash(){return`Stack ${Ba(this._stack)}`}getGroupbyFields(){const{dimensionFieldDefs:n,impute:t,groupby:o}=this._stack;return n.length>0?n.map(f=>f.bin?t?[hi(f,{binSuffix:"mid"})]:[hi(f,{}),hi(f,{binSuffix:"end"})]:[hi(f)]).flat():o??[]}assemble(){const n=[],{facetby:t,dimensionFieldDefs:o,stackField:f,stackby:r,sort:a,offset:l,impute:c,as:i}=this._stack;if(c)for(const s of o){const{bandPosition:u=.5,bin:h}=s;if(h){const d=hi(s,{expr:"datum"}),m=hi(s,{expr:"datum",binSuffix:"end"});n.push({type:"formula",expr:`${u}*${d}+${1-u}*${m}`,as:hi(s,{binSuffix:"mid",forAs:!0})})}n.push({type:"impute",field:f,groupby:[...r,...t],key:hi(s,{binSuffix:"mid"}),method:"value",value:0})}return n.push({type:"stack",groupby:[...this.getGroupbyFields(),...t],field:f,sort:a,as:i,offset:l}),n}}class M1 extends wo{clone(){return new M1(null,la(this.transform))}constructor(n,t){super(n),this.transform=t}addDimensions(n){this.transform.groupby=Zf(this.transform.groupby.concat(n),t=>t)}dependentFields(){const n=new Set;return(this.transform.groupby??[]).forEach(n.add,n),(this.transform.sort??[]).forEach(t=>n.add(t.field)),this.transform.window.map(t=>t.field).filter(t=>t!==void 0).forEach(n.add,n),n}producedFields(){return new Set(this.transform.window.map(this.getDefaultName))}getDefaultName(n){return n.as??hi(n)}hash(){return`WindowTransform ${Ba(this.transform)}`}assemble(){const n=[],t=[],o=[],f=[];for(const u of this.transform.window)t.push(u.op),o.push(this.getDefaultName(u)),f.push(u.param===void 0?null:u.param),n.push(u.field===void 0?null:u.field);const r=this.transform.frame,a=this.transform.groupby;if(r&&r[0]===null&&r[1]===null&&t.every(u=>a8(u)))return{type:"joinaggregate",as:o,ops:t,fields:n,...a!==void 0?{groupby:a}:{}};const l=[],c=[];if(this.transform.sort!==void 0)for(const u of this.transform.sort)l.push(u.field),c.push(u.order??"ascending");const i={field:l,order:c},s=this.transform.ignorePeers;return{type:"window",params:f,as:o,ops:t,fields:n,sort:i,...s!==void 0?{ignorePeers:s}:{},...a!==void 0?{groupby:a}:{},...r!==void 0?{frame:r}:{}}}}function _3e(e){function n(t){if(!(t instanceof T1)){const o=t.clone();if(o instanceof vu){const f=UT+o.getSource();o.setSource(f),e.model.component.data.outputNodes[f]=o}else(o instanceof gf||o instanceof Qh||o instanceof M1||o instanceof yg)&&o.addDimensions(e.fields);for(const f of t.children.flatMap(n))f.parent=o;return[o]}return t.children.flatMap(n)}return n}function jT(e){if(e instanceof T1)if(e.numChildren()===1&&!(e.children[0]instanceof vu)){const n=e.children[0];(n instanceof gf||n instanceof Qh||n instanceof M1||n instanceof yg)&&n.addDimensions(e.fields),n.swapWithParent(),jT(e)}else{const n=e.model.component.data.main;PH(n);const t=_3e(e),o=e.children.map(t).flat();for(const f of o)f.parent=n}else e.children.map(jT)}function PH(e){if(e instanceof vu&&e.type===Uo.Main&&e.numChildren()===1){const n=e.children[0];n instanceof T1||(n.swapWithParent(),PH(e))}}const UT="scale_",e2=5;function $T(e){for(const n of e){for(const t of n.children)if(t.parent!==n)return!1;if(!$T(n.children))return!1}return!0}function Jc(e,n){let t=!1;for(const o of n)t=e.optimize(o)||t;return t}function CP(e,n,t){let o=e.sources,f=!1;return f=Jc(new f3e,o)||f,f=Jc(new u3e(n),o)||f,o=o.filter(r=>r.numChildren()>0),f=Jc(new p3e,o)||f,o=o.filter(r=>r.numChildren()>0),t||(f=Jc(new h3e,o)||f,f=Jc(new y3e(n),o)||f,f=Jc(new c3e,o)||f,f=Jc(new d3e,o)||f,f=Jc(new m3e,o)||f,f=Jc(new g3e,o)||f,f=Jc(new l3e,o)||f,f=Jc(new v3e,o)||f),e.sources=o,f}function w3e(e,n){$T(e.sources);let t=0,o=0;for(let f=0;fn(t))}}function IH(e){As(e)?A3e(e):k3e(e)}function A3e(e){const n=e.component.scales;for(const t of Zr(n)){const o=M3e(e,t);if(n[t].setWithExplicit("domains",o),S3e(e,t),e.component.data.isFaceted){let r=e;for(;!mf(r)&&r.parent;)r=r.parent;if(r.component.resolve.scale[t]==="shared")for(const l of o.value)Yh(l)&&(l.data=UT+l.data.replace(UT,""))}}}function k3e(e){for(const t of e.children)IH(t);const n=e.component.scales;for(const t of Zr(n)){let o,f=null;for(const r of e.children){const a=r.component.scales[t];if(a){o===void 0?o=a.getWithExplicit("domains"):o=mp(o,a.getWithExplicit("domains"),"domains","scale",VT);const l=a.get("selectionExtent");f&&l&&f.param!==l.param&&ei(iye),f=l}}n[t].setWithExplicit("domains",o),f&&n[t].set("selectionExtent",f,!0)}}function T3e(e,n,t,o){if(e==="unaggregated"){const{valid:f,reason:r}=LP(n,t);if(!f){ei(r);return}}else if(e===void 0&&o.useUnaggregatedDomain){const{valid:f}=LP(n,t);if(f)return"unaggregated"}return e}function M3e(e,n){const t=e.getScaleComponent(n).get("type"),{encoding:o}=e,f=T3e(e.scaleDomain(n),e.typedFieldDef(n),t,e.config.scale);return f!==e.scaleDomain(n)&&(e.specifiedScales[n]={...e.specifiedScales[n],domain:f}),n==="x"&&Ks(o.x2)?Ks(o.x)?mp(Ld(t,f,e,"x"),Ld(t,f,e,"x2"),"domain","scale",VT):Ld(t,f,e,"x2"):n==="y"&&Ks(o.y2)?Ks(o.y)?mp(Ld(t,f,e,"y"),Ld(t,f,e,"y2"),"domain","scale",VT):Ld(t,f,e,"y2"):Ld(t,f,e,n)}function E3e(e,n,t){return e.map(o=>({signal:`{data: ${K3(o,{timeUnit:t,type:n})}}`}))}function _A(e,n,t){const o=hl(t)?.unit;return n==="temporal"||o?E3e(e,n,o):[e]}function Ld(e,n,t,o){const{encoding:f}=t,r=Ks(f[o]),{type:a}=r,l=r.timeUnit;if(Cve(n)){const u=Ld(e,void 0,t,o),h=_A(n.unionWith,a,l);return qf([...h,...u.value])}else{if(ji(n))return qf([n]);if(n&&n!=="unaggregated"&&!wV(n))return qf(_A(n,a,l))}const c=t.stack;if(c&&o===c.fieldChannel){if(c.offset==="normalize")return nc([[0,1]]);const u=t.requestDataName(Uo.Main);return nc([{data:u,field:t.vgField(o,{suffix:"start"})},{data:u,field:t.vgField(o,{suffix:"end"})}])}const i=gd(o)&&ni(r)?C3e(t,o,e):void 0;if(Ah(r)){const u=_A([r.datum],a,l);return nc(u)}const s=r;if(n==="unaggregated"){const u=t.requestDataName(Uo.Main),{field:h}=r;return nc([{data:u,field:hi({field:h,aggregate:"min"})},{data:u,field:hi({field:h,aggregate:"max"})}])}else if(Vo(s.bin)){if(ml(e))return nc(e==="bin-ordinal"?[]:[{data:Pv(i)?t.requestDataName(Uo.Main):t.requestDataName(Uo.Raw),field:t.vgField(o,Dx(s,o)?{binSuffix:"range"}:{}),sort:i===!0||!Si(i)?{field:t.vgField(o,{}),op:"min"}:i}]);{const{bin:u}=s;if(Vo(u)){const h=oC(t,s.field,u);return nc([new $u(()=>{const d=t.getSignalName(h);return`[${d}.start, ${d}.stop]`})])}else return nc([{data:t.requestDataName(Uo.Main),field:t.vgField(o,{})}])}}else if(s.timeUnit&&ja(["time","utc"],e)&&NV(s,As(t)?t.encoding[_h(o)]:void 0,t.markDef,t.config)){const u=t.requestDataName(Uo.Main);return nc([{data:u,field:t.vgField(o)},{data:u,field:t.vgField(o,{suffix:"end"})}])}else return nc(i?[{data:Pv(i)?t.requestDataName(Uo.Main):t.requestDataName(Uo.Raw),field:t.vgField(o),sort:i}]:[{data:t.requestDataName(Uo.Main),field:t.vgField(o)}])}function wA(e,n){const{op:t,field:o,order:f}=e;return{op:t??(n?"sum":W3),...o?{field:Dc(o)}:{},...f?{order:f}:{}}}function S3e(e,n){const t=e.component.scales[n],o=e.specifiedScales[n].domain,f=e.fieldDef(n)?.bin,r=wV(o)&&o,a=fg(f)&&j3(f.extent)&&f.extent;(r||a)&&t.set("selectionExtent",r??a,!0)}function C3e(e,n,t){if(!ml(t))return;const o=e.fieldDef(n),f=o.sort;if(FV(f))return{op:"min",field:t1(o,n),order:"ascending"};const{stack:r}=e,a=r?new Set([...r.groupbyFields,...r.stackBy.map(l=>l.fieldDef.field)]):void 0;if(nh(f)){const l=r&&!a.has(f.field);return wA(f,l)}else if(IV(f)){const{encoding:l,order:c}=f,i=e.fieldDef(l),{aggregate:s,field:u}=i,h=r&&!a.has(u);if(rd(s)||Sp(s))return wA({field:hi(i),order:c},h);if(a8(s)||!s)return wA({op:s,field:u,order:c},h)}else{if(f==="descending")return{op:"min",field:e.vgField(n),order:"descending"};if(ja(["ascending",void 0],f))return!0}}function LP(e,n){const{aggregate:t,type:o}=e;return t?Li(t)&&!$1e.has(t)?{valid:!1,reason:Oye(t)}:o==="quantitative"&&n==="log"?{valid:!1,reason:Pye(e)}:{valid:!0}:{valid:!1,reason:Dye(e)}}function VT(e,n,t,o){return e.explicit&&n.explicit&&ei(Nye(t,o,e.value,n.value)),{explicit:e.explicit,value:[...e.value,...n.value]}}function L3e(e){const n=Zf(e.map(a=>{if(Yh(a)){const{sort:l,...c}=a;return c}return a}),Ba),t=Zf(e.map(a=>{if(Yh(a)){const l=a.sort;return l!==void 0&&!Pv(l)&&("op"in l&&l.op==="count"&&delete l.field,l.order==="ascending"&&delete l.order),l}}).filter(a=>a!==void 0),Ba);if(n.length===0)return;if(n.length===1){const a=e[0];if(Yh(a)&&t.length>0){let l=t[0];if(t.length>1){ei(IO);const c=t.filter(i=>Si(i)&&"op"in i&&i.op!=="min");t.every(i=>Si(i)&&"op"in i)&&c.length===1?l=c[0]:l=!0}else if(Si(l)&&"field"in l){const c=l.field;a.field===c&&(l=l.order?{order:l.order}:!0)}return{...a,sort:l}}return a}const o=Zf(t.map(a=>Pv(a)||!("op"in a)||Li(a.op)&&a.op in N1e?a:(ei(jye(a)),!0)),Ba);let f;o.length===1?f=o[0]:o.length>1&&(ei(IO),f=!0);const r=Zf(e.map(a=>Yh(a)?a.data:null),a=>a);return r.length===1&&r[0]!==null?{data:r[0],fields:n.map(l=>l.field),...f?{sort:f}:{}}:{fields:n,...f?{sort:f}:{}}}function cC(e){if(Yh(e)&&Li(e.field))return e.field;if(V1e(e)){let n;for(const t of e.fields)if(Yh(t)&&Li(t.field)){if(!n)n=t.field;else if(n!==t.field)return ei(Uye),n}return ei($ye),n}else if(q1e(e)){ei(Vye);const n=e.fields[0];return Li(n)?n:void 0}}function h5(e,n){const o=e.component.scales[n].get("domains").map(f=>(Yh(f)&&(f.data=e.lookupDataSource(f.data)),f));return L3e(o)}function FH(e){return E1(e)||fC(e)?e.children.reduce((n,t)=>n.concat(FH(t)),DP(e)):DP(e)}function DP(e){return Zr(e.component.scales).reduce((n,t)=>{const o=e.component.scales[t];if(o.merged)return n;const f=o.combine(),{name:r,type:a,selectionExtent:l,domains:c,range:i,reverse:s,...u}=f,h=D3e(f.range,r,t,e),d=h5(e,t),m=l?m2e(e,l,o,d):null;return n.push({name:r,type:a,...d?{domain:d}:{},...m?{domainRaw:m}:{},range:h,...s!==void 0?{reverse:s}:{},...u}),n},[])}function D3e(e,n,t,o){if(pl(t)){if(Cp(e))return{step:{signal:`${n}_step`}}}else if(Si(e)&&Yh(e))return{...e,data:o.lookupDataSource(e.data)};return e}class RH extends yd{constructor(n,t){super({},{name:n}),this.merged=!1,this.setWithExplicit("type",t)}domainDefinitelyIncludesZero(){return this.get("zero")!==!1?!0:$0(this.get("domains"),n=>zr(n)&&n.length===2&&n[0]<=0&&n[1]>=0)}}const O3e=["range","scheme"];function P3e(e){const n=e.component.scales;for(const t of B3){const o=n[t];if(!o)continue;const f=I3e(t,e);o.setWithExplicit("range",f)}}function OP(e,n){const t=e.fieldDef(n);if(t?.bin){const{bin:o,field:f}=t,r=Yu(n),a=e.getName(r);if(Si(o)&&o.binned&&o.step!==void 0)return new $u(()=>{const l=e.scaleName(n),c=`(domain("${l}")[1] - domain("${l}")[0]) / ${o.step}`;return`${e.getSignalName(a)} / (${c})`});if(Vo(o)){const l=oC(e,f,o);return new $u(()=>{const c=e.getSignalName(l),i=`(${c}.stop - ${c}.start) / ${c}.step`;return`${e.getSignalName(a)} / (${i})`})}}}function I3e(e,n){const t=n.specifiedScales[e],{size:o}=n,r=n.getScaleComponent(e).get("type");for(const u of O3e)if(t[u]!==void 0){const h=AT(r,u),d=AV(e,u);if(!h)ei(nV(r,u,e));else if(d)ei(d);else switch(u){case"range":{const m=t.range;if(zr(m)){if(pl(e))return qf(m.map(p=>{if(p==="width"||p==="height"){const g=n.getName(p),y=n.getSignalName.bind(n);return $u.fromName(y,g)}return p}))}else if(Si(m))return qf({data:n.requestDataName(Uo.Main),field:m.field,sort:{op:"min",field:n.vgField(e)}});return qf(m)}case"scheme":return qf(F3e(t[u]))}}const a=e===ts||e==="xOffset"?"width":"height",l=o[a];if(dh(l)){if(pl(e))if(ml(r)){const u=zH(l,n,e);if(u)return qf({step:u})}else ei(rV(a));else if(b1(e)){const u=e===Ap?"x":"y";if(n.getScaleComponent(u).get("type")==="band"){const m=NH(l,r);if(m)return qf(m)}}}const{rangeMin:c,rangeMax:i}=t,s=R3e(e,n);return(c!==void 0||i!==void 0)&&AT(r,"rangeMin")&&zr(s)&&s.length===2?qf([c??s[0],i??s[1]]):nc(s)}function F3e(e){return Sve(e)?{scheme:e.name,...ju(e,["name"])}:{scheme:e}}function R3e(e,n){const{size:t,config:o,mark:f,encoding:r}=n,a=n.getSignalName.bind(n),{type:l}=Ks(r[e]),i=n.getScaleComponent(e).get("type"),{domain:s,domainMid:u}=n.specifiedScales[e];switch(e){case ts:case dl:{if(ja(["point","band"],i)){const m=BH(e,t,o.view);if(dh(m))return{step:zH(m,n,e)}}const h=Yu(e),d=n.getName(h);return e===dl&&pc(i)?[$u.fromName(a,d),0]:[0,$u.fromName(a,d)]}case Ap:case x1:return z3e(e,n,i);case dd:{const h=n.component.scales[e].get("zero"),d=jH(f,h,o),m=j3e(f,t,n,o);return Ym(i)?B3e(d,m,N3e(i,o,s,e)):[d,m]}case Ic:return[0,Math.PI*2];case ug:return[0,360];case Mf:return[0,new $u(()=>{const h=n.getSignalName("width"),d=n.getSignalName("height");return`min(${h},${d})/2`})];case Mp:return[o.scale.minStrokeWidth,o.scale.maxStrokeWidth];case Ep:return[[1,0],[4,2],[2,1],[1,1],[1,2,4,2]];case Wu:return"symbol";case Gu:case xh:case bh:return i==="ordinal"?l==="nominal"?"category":"ordinal":u!==void 0?"diverging":f==="rect"||f==="geoshape"?"heatmap":"ramp";case pd:case kp:case Tp:return[o.scale.minOpacity,o.scale.maxOpacity]}}function zH(e,n,t){const{encoding:o}=n,f=n.getScaleComponent(t),r=t8(t),a=o[r];if(pq({step:e,offsetIsDiscrete:fa(a)&&yV(a.type)})==="offset"&&ZV(o,r)){const c=n.getScaleComponent(r);let s=`domain('${n.scaleName(r)}').length`;if(c.get("type")==="band"){const h=c.get("paddingInner")??c.get("padding")??0,d=c.get("paddingOuter")??c.get("padding")??0;s=`bandspace(${s}, ${h}, ${d})`}const u=f.get("paddingInner")??f.get("padding");return{signal:`${e.step} * ${s} / (1-${Y1e(u)})`}}else return e.step}function NH(e,n){if(pq({step:e,offsetIsDiscrete:ml(n)})==="offset")return{step:e.step}}function z3e(e,n,t){const o=e===Ap?"x":"y",r=n.getScaleComponent(o).get("type"),a=n.scaleName(o);if(r==="band"){const l=BH(o,n.size,n.config.view);if(dh(l)){const c=NH(l,t);if(c)return c}return[0,{signal:`bandwidth('${a}')`}]}else{const l=n.encoding[o];if(ni(l)&&l.timeUnit){const c=dV(l.timeUnit,s=>`scale('${a}', ${s})`),i=n.config.scale.bandWithNestedOffsetPaddingInner;if(i){const s=ji(i)?`${i.signal}/2`:`${i/2}`,u=ji(i)?`(1 - ${i.signal}/2)`:`${1-i/2}`;return[{signal:`${s} * (${c})`},{signal:`${u} * (${c})`}]}return[0,{signal:c}]}return w$(`Cannot use ${e} scale if ${o} scale is not discrete.`)}}function BH(e,n,t){const o=e===ts?"width":"height",f=n[o];return f||sw(t,o)}function N3e(e,n,t,o){switch(e){case"quantile":return n.scale.quantileCount;case"quantize":return n.scale.quantizeCount;case"threshold":return t!==void 0&&zr(t)?t.length+1:(ei(Kye(o)),3)}}function B3e(e,n,t){const o=()=>{const f=cf(n),r=cf(e),a=`(${f} - ${r}) / (${t} - 1)`;return`sequence(${r}, ${f} + ${a}, ${a})`};return ji(n)?new $u(o):{signal:o()}}function jH(e,n,t){if(n)return ji(n)?{signal:`${n.signal} ? 0 : ${jH(e,!1,t)}`}:0;switch(e){case"bar":case"tick":return t.scale.minBandSize;case"line":case"trail":case"rule":return t.scale.minStrokeWidth;case"text":return t.scale.minFontSize;case"point":case"square":case"circle":return t.scale.minSize}throw new Error(U3("size",e))}const PP=.95;function j3e(e,n,t,o){const f={x:OP(t,"x"),y:OP(t,"y")};switch(e){case"bar":case"tick":{if(o.scale.maxBandSize!==void 0)return o.scale.maxBandSize;const r=IP(n,f,o.view);return Eo(r)?r-1:new $u(()=>`${r.signal} - 1`)}case"line":case"trail":case"rule":return o.scale.maxStrokeWidth;case"text":return o.scale.maxFontSize;case"point":case"square":case"circle":{if(o.scale.maxSize)return o.scale.maxSize;const r=IP(n,f,o.view);return Eo(r)?Math.pow(PP*r,2):new $u(()=>`pow(${PP} * ${r.signal}, 2)`)}}throw new Error(U3("size",e))}function IP(e,n,t){const o=dh(e.width)?e.width.step:ow(t,"width"),f=dh(e.height)?e.height.step:ow(t,"height");return n.x||n.y?new $u(()=>`min(${[n.x?n.x.signal:o,n.y?n.y.signal:f].join(", ")})`):Math.min(o,f)}function UH(e,n){As(e)?U3e(e,n):VH(e,n)}function U3e(e,n){const t=e.component.scales,{config:o,encoding:f,markDef:r,specifiedScales:a}=e;for(const l of Zr(t)){const c=a[l],i=t[l],s=e.getScaleComponent(l),u=Ks(f[l]),h=c[n],d=s.get("type"),m=s.get("padding"),p=s.get("paddingInner"),g=AT(d,n),y=AV(l,n);if(h!==void 0&&(g?y&&ei(y):ei(nV(d,n,l))),g&&y===void 0)if(h!==void 0){const v=u.timeUnit,x=u.type;switch(n){case"domainMax":case"domainMin":hg(c[n])||x==="temporal"||v?i.set(n,{signal:K3(c[n],{type:x,timeUnit:v})},!0):i.set(n,c[n],!0);break;default:i.copyKeyFromObject(n,c)}}else{const v=n in FP?FP[n]({model:e,channel:l,fieldOrDatumDef:u,scaleType:d,scalePadding:m,scalePaddingInner:p,domain:c.domain,domainMin:c.domainMin,domainMax:c.domainMax,markDef:r,config:o,hasNestedOffsetScale:TT(f,l),hasSecondaryRangeChannel:!!f[_h(l)]}):o.scale[n];v!==void 0&&i.set(n,v,!1)}}}const FP={bins:({model:e,fieldOrDatumDef:n})=>ni(n)?$3e(e,n):void 0,interpolate:({channel:e,fieldOrDatumDef:n})=>V3e(e,n.type),nice:({scaleType:e,channel:n,domain:t,domainMin:o,domainMax:f,fieldOrDatumDef:r})=>q3e(e,n,t,o,f,r),padding:({channel:e,scaleType:n,fieldOrDatumDef:t,markDef:o,config:f})=>H3e(e,n,f.scale,t,o,f.bar),paddingInner:({scalePadding:e,channel:n,markDef:t,scaleType:o,config:f,hasNestedOffsetScale:r})=>G3e(e,n,t.type,o,f.scale,r),paddingOuter:({scalePadding:e,channel:n,scaleType:t,scalePaddingInner:o,config:f,hasNestedOffsetScale:r})=>W3e(e,n,t,o,f.scale,r),reverse:({fieldOrDatumDef:e,scaleType:n,channel:t,config:o})=>{const f=ni(e)?e.sort:void 0;return Y3e(n,f,t,o.scale)},zero:({channel:e,fieldOrDatumDef:n,domain:t,markDef:o,scaleType:f,config:r,hasSecondaryRangeChannel:a})=>X3e(e,n,t,o,f,r.scale,a)};function $H(e){As(e)?P3e(e):VH(e,"range")}function VH(e,n){const t=e.component.scales;for(const o of e.children)n==="range"?$H(o):UH(o,n);for(const o of Zr(t)){let f;for(const r of e.children){const a=r.component.scales[o];if(a){const l=a.getWithExplicit(n);f=mp(f,l,n,"scale",Mq((c,i)=>{switch(n){case"range":return c.step&&i.step?c.step-i.step:0}return 0}))}}t[o].setWithExplicit(n,f)}}function $3e(e,n){const t=n.bin;if(Vo(t)){const o=oC(e,n.field,t);return new $u(()=>e.getSignalName(o))}else if(Ml(t)&&fg(t)&&t.step!==void 0)return{step:t.step}}function V3e(e,n){if(ja([Gu,xh,bh],e)&&n!=="nominal")return"hcl"}function q3e(e,n,t,o,f,r){if(!(hh(r)?.bin||zr(t)||f!=null||o!=null||ja([Uu.TIME,Uu.UTC],e)))return pl(n)?!0:void 0}function H3e(e,n,t,o,f,r){if(pl(e)){if(ff(n)){if(t.continuousPadding!==void 0)return t.continuousPadding;const{type:a,orient:l}=f;if(a==="bar"&&!(ni(o)&&(o.bin||o.timeUnit))&&(l==="vertical"&&e==="x"||l==="horizontal"&&e==="y"))return r.continuousBandSize}if(n===Uu.POINT)return t.pointPadding}}function G3e(e,n,t,o,f,r=!1){if(e===void 0){if(pl(n)){const{bandPaddingInner:a,barBandPaddingInner:l,rectBandPaddingInner:c,bandWithNestedOffsetPaddingInner:i}=f;return r?i:zs(a,t==="bar"?l:c)}else if(b1(n)&&o===Uu.BAND)return f.offsetBandPaddingInner}}function W3e(e,n,t,o,f,r=!1){if(e===void 0){if(pl(n)){const{bandPaddingOuter:a,bandWithNestedOffsetPaddingOuter:l}=f;if(r)return l;if(t===Uu.BAND)return zs(a,ji(o)?{signal:`${o.signal}/2`}:o/2)}else if(b1(n)){if(t===Uu.POINT)return .5;if(t===Uu.BAND)return f.offsetBandPaddingOuter}}}function Y3e(e,n,t,o){if(t==="x"&&o.xReverse!==void 0)return pc(e)&&n==="descending"?ji(o.xReverse)?{signal:`!${o.xReverse.signal}`}:!o.xReverse:o.xReverse;if(pc(e)&&n==="descending")return!0}function X3e(e,n,t,o,f,r,a){if(!!t&&t!=="unaggregated"&&pc(f)){if(zr(t)){const c=t[0],i=t[t.length-1];if(c<=0&&i>=0)return!0}return!1}if(e==="size"&&n.type==="quantitative"&&!Ym(f))return!0;if(!(ni(n)&&n.bin)&&ja([...wh,...L1e],e)){const{orient:c,type:i}=o;return ja(["bar","area","line","trail"],i)&&(c==="horizontal"&&e==="y"||c==="vertical"&&e==="x")?!1:ja(["bar","area"],i)&&!a?!0:r?.zero}return!1}function Z3e(e,n,t,o,f=!1){const r=J3e(n,t,o,f),{type:a}=e;return gd(n)?a!==void 0?Fve(n,a)?ni(t)&&!Ive(a,t.type)?(ei(Rye(a,r)),r):a:(ei(Fye(n,a,r)),r):r:null}function J3e(e,n,t,o){switch(n.type){case"nominal":case"ordinal":{if(bm(e)||cA(e)==="discrete")return e==="shape"&&n.type==="ordinal"&&ei(fA(e,"ordinal")),"ordinal";if(pl(e)||b1(e)){if(ja(["rect","bar","image","rule"],t.type)||o)return"band"}else if(t.type==="arc"&&e in i8)return"band";const f=t[Yu(e)];return W0(f)||Zm(n)&&n.axis?.tickBand?"band":"point"}case"temporal":return bm(e)?"time":cA(e)==="discrete"?(ei(fA(e,"temporal")),"ordinal"):ni(n)&&n.timeUnit&&hl(n.timeUnit).utc?"utc":"time";case"quantitative":return bm(e)?ni(n)&&Vo(n.bin)?"bin-ordinal":"linear":cA(e)==="discrete"?(ei(fA(e,"quantitative")),"ordinal"):"linear";case"geojson":return}throw new Error(eV(n.type))}function K3e(e,{ignoreRange:n}={}){qH(e),IH(e);for(const t of Pve)UH(e,t);n||$H(e)}function qH(e){As(e)?e.component.scales=Q3e(e):e.component.scales=t5e(e)}function Q3e(e){const{encoding:n,mark:t,markDef:o}=e,f={};for(const r of B3){const a=Ks(n[r]);if(a&&t===MV&&r===Wu&&a.type===_1)continue;let l=a&&a.scale;if(b1(r)){const c=N$(r);if(!TT(n,c)){l&&ei(_ye(r));continue}}if(a&&l!==null&&l!==!1){l??(l={});const c=TT(n,r),i=Z3e(l,r,a,o,c);f[r]=new RH(e.scaleName(`${r}`,!0),{value:i,explicit:l.type===i})}}return f}const e5e=Mq((e,n)=>RO(e)-RO(n));function t5e(e){var n;const t=e.component.scales={},o={},f=e.component.resolve;for(const r of e.children){qH(r);for(const a of Zr(r.component.scales))if((n=f.scale)[a]??(n[a]=_H(a,e)),f.scale[a]==="shared"){const l=o[a],c=r.component.scales[a].getWithExplicit("type");l?Ave(l.value,c.value)?o[a]=mp(l,c,"type","scale",e5e):(f.scale[a]="independent",delete o[a]):o[a]=c}}for(const r of Zr(o)){const a=e.scaleName(r,!0),l=o[r];t[r]=new RH(a,l);for(const c of e.children){const i=c.component.scales[r];i&&(c.renameScale(i.get("name"),a),i.merged=!0)}}return t}class AA{constructor(){this.nameMap={}}rename(n,t){this.nameMap[n]=t}has(n){return this.nameMap[n]!==void 0}get(n){for(;this.nameMap[n]&&n!==this.nameMap[n];)n=this.nameMap[n];return n}}function As(e){return e?.type==="unit"}function mf(e){return e?.type==="facet"}function fC(e){return e?.type==="concat"}function E1(e){return e?.type==="layer"}class hC{constructor(n,t,o,f,r,a,l){this.type=t,this.parent=o,this.config=r,this.correctDataNames=c=>(c.from?.data&&(c.from.data=this.lookupDataSource(c.from.data)),c.from?.facet?.data&&(c.from.facet.data=this.lookupDataSource(c.from.facet.data)),c),this.parent=o,this.config=r,this.view=Iu(l),this.name=n.name??f,this.title=Id(n.title)?{text:n.title}:n.title?Iu(n.title):void 0,this.scaleNameMap=o?o.scaleNameMap:new AA,this.projectionNameMap=o?o.projectionNameMap:new AA,this.signalNameMap=o?o.signalNameMap:new AA,this.data=n.data,this.description=n.description,this.transforms=Vbe(n.transform??[]),this.layout=t==="layer"||t==="unit"?{}:Jxe(n,t,r),this.component={data:{sources:o?o.component.data.sources:[],outputNodes:o?o.component.data.outputNodes:{},outputNodeRefCounts:o?o.component.data.outputNodeRefCounts:{},isFaceted:Y3(n)||o?.component.data.isFaceted&&n.data===void 0},layoutSize:new yd,layoutHeaders:{row:{},column:{},facet:{}},mark:null,resolve:{scale:{},axis:{},legend:{},...a?la(a):{}},selection:null,scales:null,projection:null,axes:{},legends:{}}}get width(){return this.getSizeSignalRef("width")}get height(){return this.getSizeSignalRef("height")}parse(){this.parseScale(),this.parseLayoutSize(),this.renameTopLevelLayoutSizeSignal(),this.parseSelections(),this.parseProjection(),this.parseData(),this.parseAxesAndHeaders(),this.parseLegends(),this.parseMarkGroup()}parseScale(){K3e(this)}parseProjection(){DH(this)}renameTopLevelLayoutSizeSignal(){this.getName("width")!=="width"&&this.renameSignal(this.getName("width"),"width"),this.getName("height")!=="height"&&this.renameSignal(this.getName("height"),"height")}parseLegends(){MH(this)}assembleEncodeFromView(n){const{style:t,...o}=n,f={};for(const r of Zr(o)){const a=o[r];a!==void 0&&(f[r]=Yo(a))}return f}assembleGroupEncodeEntry(n){let t={};return this.view&&(t=this.assembleEncodeFromView(this.view)),!n&&(this.description&&(t.description=Yo(this.description)),this.type==="unit"||this.type==="layer")?{width:this.getSizeSignalRef("width"),height:this.getSizeSignalRef("height"),...t??{}}:Mo(t)?void 0:t}assembleLayout(){if(!this.layout)return;const{spacing:n,...t}=this.layout,{component:o,config:f}=this,r=wwe(o.layoutHeaders,f);return{padding:n,...this.assembleDefaultLayout(),...t,...r?{titleBand:r}:{}}}assembleDefaultLayout(){return{}}assembleHeaderMarks(){const{layoutHeaders:n}=this.component;let t=[];for(const o of Tc)n[o].title&&t.push(mwe(this,o));for(const o of nC)t=t.concat(ywe(this,o));return t}assembleAxes(){return rwe(this.component.axes,this.config)}assembleLegends(){return SH(this)}assembleProjections(){return Hwe(this)}assembleTitle(){const{encoding:n,...t}=this.title??{},o={...H$(this.config.title).nonMarkTitleProperties,...t,...n?{encode:{update:n}}:{}};if(o.text)return ja(["unit","layer"],this.type)?ja(["middle",void 0],o.anchor)&&(o.frame??(o.frame="group")):o.anchor??(o.anchor="start"),Mo(o)?void 0:o}assembleGroup(n=[]){const t={};n=n.concat(this.assembleSignals()),n.length>0&&(t.signals=n);const o=this.assembleLayout();o&&(t.layout=o),t.marks=[].concat(this.assembleHeaderMarks(),this.assembleMarks());const f=!this.parent||mf(this.parent)?FH(this):[];f.length>0&&(t.scales=f);const r=this.assembleAxes();r.length>0&&(t.axes=r);const a=this.assembleLegends();return a.length>0&&(t.legends=a),t}getName(n){return es((this.name?`${this.name}_`:"")+n)}getDataName(n){return this.getName(Uo[n].toLowerCase())}requestDataName(n){const t=this.getDataName(n),o=this.component.data.outputNodeRefCounts;return o[t]=(o[t]||0)+1,t}getSizeSignalRef(n){if(mf(this.parent)){const t=xH(n),o=N3(t),f=this.component.scales[o];if(f&&!f.merged){const r=f.get("type"),a=f.get("range");if(ml(r)&&Cp(a)){const l=f.get("name"),c=h5(this,o),i=cC(c);if(i){const s=hi({aggregate:"distinct",field:i},{expr:"datum"});return{signal:vH(l,f,s)}}else return ei(s8(o)),null}}}return{signal:this.signalNameMap.get(this.getName(n))}}lookupDataSource(n){const t=this.component.data.outputNodes[n];return t?t.getSource():n}getSignalName(n){return this.signalNameMap.get(n)}renameSignal(n,t){this.signalNameMap.rename(n,t)}renameScale(n,t){this.scaleNameMap.rename(n,t)}renameProjection(n,t){this.projectionNameMap.rename(n,t)}scaleName(n,t){if(t)return this.getName(n);if(F$(n)&&gd(n)&&this.component.scales[n]||this.scaleNameMap.has(this.getName(n)))return this.scaleNameMap.get(this.getName(n))}projectionName(n){if(n)return this.getName("projection");if(this.component.projection&&!this.component.projection.merged||this.projectionNameMap.has(this.getName("projection")))return this.projectionNameMap.get(this.getName("projection"))}getScaleComponent(n){if(!this.component.scales)throw new Error("getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().");const t=this.component.scales[n];return t&&!t.merged?t:this.parent?this.parent.getScaleComponent(n):void 0}getSelectionComponent(n,t){let o=this.component.selection[n];if(!o&&this.parent&&(o=this.parent.getSelectionComponent(n,t)),!o)throw new Error(Q1e(t));return o}hasAxisOrientSignalRef(){return this.component.axes.x?.some(n=>n.hasOrientSignalRef())||this.component.axes.y?.some(n=>n.hasOrientSignalRef())}}class HH extends hC{vgField(n,t={}){const o=this.fieldDef(n);if(o)return hi(o,t)}reduceFieldDef(n,t){return Mxe(this.getMapping(),(o,f,r)=>{const a=hh(f);return a?n(o,a,r):o},t)}forEachFieldDef(n,t){F8(this.getMapping(),(o,f)=>{const r=hh(o);r&&n(r,f)},t)}}class d5 extends wo{clone(){return new d5(null,la(this.transform))}constructor(n,t){super(n),this.transform=t,this.transform=la(t);const o=this.transform.as??[void 0,void 0];this.transform.as=[o[0]??"value",o[1]??"density"],t.groupby&&t.minsteps==null&&t.maxsteps==null&&t.steps==null&&(this.transform.steps=200)}dependentFields(){return new Set([this.transform.density,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`DensityTransform ${Ba(this.transform)}`}assemble(){const{density:n,...t}=this.transform;return{type:"kde",field:n,...t}}}class p5 extends wo{clone(){return new p5(null,la(this.transform))}constructor(n,t){super(n),this.transform=t,this.transform=la(t)}dependentFields(){return new Set([this.transform.extent])}producedFields(){return new Set([])}hash(){return`ExtentTransform ${Ba(this.transform)}`}assemble(){const{extent:n,param:t}=this.transform;return{type:"extent",field:n,signal:t}}}class Nv extends wo{clone(){return new Nv(null,{...this.filter})}constructor(n,t){super(n),this.filter=t}static make(n,t){const{config:o,mark:f,markDef:r}=t;if(uo("invalid",r,o)!=="filter")return null;const l=t.reduceFieldDef((c,i,s)=>{const u=gd(s)&&t.getScaleComponent(s);if(u){const h=u.get("type");pc(h)&&i.aggregate!=="count"&&!Lp(f)&&(c[i.field]=i)}return c},{});return Zr(l).length?new Nv(n,l):null}dependentFields(){return new Set(Zr(this.filter))}producedFields(){return new Set}hash(){return`FilterInvalid ${Ba(this.filter)}`}assemble(){const n=Zr(this.filter).reduce((t,o)=>{const f=this.filter[o],r=hi(f,{expr:"datum"});return f!==null&&(f.type==="temporal"?t.push(`(isDate(${r}) || (isValid(${r}) && isFinite(+${r})))`):f.type==="quantitative"&&(t.push(`isValid(${r})`),t.push(`isFinite(+${r})`))),t},[]);return n.length>0?{type:"filter",expr:n.join(" && ")}:null}}class g5 extends wo{clone(){return new g5(this.parent,la(this.transform))}constructor(n,t){super(n),this.transform=t,this.transform=la(t);const{flatten:o,as:f=[]}=this.transform;this.transform.as=o.map((r,a)=>f[a]??r)}dependentFields(){return new Set(this.transform.flatten)}producedFields(){return new Set(this.transform.as)}hash(){return`FlattenTransform ${Ba(this.transform)}`}assemble(){const{flatten:n,as:t}=this.transform;return{type:"flatten",fields:n,as:t}}}class m5 extends wo{clone(){return new m5(null,la(this.transform))}constructor(n,t){super(n),this.transform=t,this.transform=la(t);const o=this.transform.as??[void 0,void 0];this.transform.as=[o[0]??"key",o[1]??"value"]}dependentFields(){return new Set(this.transform.fold)}producedFields(){return new Set(this.transform.as)}hash(){return`FoldTransform ${Ba(this.transform)}`}assemble(){const{fold:n,as:t}=this.transform;return{type:"fold",fields:n,as:t}}}class Am extends wo{clone(){return new Am(null,la(this.fields),this.geojson,this.signal)}static parseAll(n,t){if(t.component.projection&&!t.component.projection.isFit)return n;let o=0;for(const f of[[Sf,Ef],[Oc,Cf]]){const r=f.map(a=>{const l=Ks(t.encoding[a]);return ni(l)?l.field:Ah(l)?{expr:`${l.datum}`}:bf(l)?{expr:`${l.value}`}:void 0});(r[0]||r[1])&&(n=new Am(n,r,null,t.getName(`geojson_${o++}`)))}if(t.channelHasField(Wu)){const f=t.typedFieldDef(Wu);f.type===_1&&(n=new Am(n,null,f.field,t.getName(`geojson_${o++}`)))}return n}constructor(n,t,o,f){super(n),this.fields=t,this.geojson=o,this.signal=f}dependentFields(){const n=(this.fields??[]).filter(Li);return new Set([...this.geojson?[this.geojson]:[],...n])}producedFields(){return new Set}hash(){return`GeoJSON ${this.geojson} ${this.signal} ${Ba(this.fields)}`}assemble(){return[...this.geojson?[{type:"filter",expr:`isValid(datum["${this.geojson}"])`}]:[],{type:"geojson",...this.fields?{fields:this.fields}:{},...this.geojson?{geojson:this.geojson}:{},signal:this.signal}]}}class Bv extends wo{clone(){return new Bv(null,this.projection,la(this.fields),la(this.as))}constructor(n,t,o,f){super(n),this.projection=t,this.fields=o,this.as=f}static parseAll(n,t){if(!t.projectionName())return n;for(const o of[[Sf,Ef],[Oc,Cf]]){const f=o.map(a=>{const l=Ks(t.encoding[a]);return ni(l)?l.field:Ah(l)?{expr:`${l.datum}`}:bf(l)?{expr:`${l.value}`}:void 0}),r=o[0]===Oc?"2":"";(f[0]||f[1])&&(n=new Bv(n,t.projectionName(),f,[t.getName(`x${r}`),t.getName(`y${r}`)]))}return n}dependentFields(){return new Set(this.fields.filter(Li))}producedFields(){return new Set(this.as)}hash(){return`Geopoint ${this.projection} ${Ba(this.fields)} ${Ba(this.as)}`}assemble(){return{type:"geopoint",projection:this.projection,fields:this.fields,as:this.as}}}class C0 extends wo{clone(){return new C0(null,la(this.transform))}constructor(n,t){super(n),this.transform=t}dependentFields(){return new Set([this.transform.impute,this.transform.key,...this.transform.groupby??[]])}producedFields(){return new Set([this.transform.impute])}processSequence(n){const{start:t=0,stop:o,step:f}=n;return{signal:`sequence(${[t,o,...f?[f]:[]].join(",")})`}}static makeFromTransform(n,t){return new C0(n,t)}static makeFromEncoding(n,t){const o=t.encoding,f=o.x,r=o.y;if(ni(f)&&ni(r)){const a=f.impute?f:r.impute?r:void 0;if(a===void 0)return;const l=f.impute?r:r.impute?f:void 0,{method:c,value:i,frame:s,keyvals:u}=a.impute,h=KV(t.mark,o);return new C0(n,{impute:a.field,key:l.field,...c?{method:c}:{},...i!==void 0?{value:i}:{},...s?{frame:s}:{},...u!==void 0?{keyvals:u}:{},...h.length?{groupby:h}:{}})}return null}hash(){return`Impute ${Ba(this.transform)}`}assemble(){const{impute:n,key:t,keyvals:o,method:f,groupby:r,value:a,frame:l=[null,null]}=this.transform,c={type:"impute",field:n,key:t,...o?{keyvals:kbe(o)?this.processSequence(o):o}:{},method:"value",...r?{groupby:r}:{},value:!f||f==="value"?a:null};if(f&&f!=="value"){const i={type:"window",as:[`imputed_${n}_value`],ops:[f],fields:[n],frame:l,ignorePeers:!1,...r?{groupby:r}:{}},s={type:"formula",expr:`datum.${n} === null ? datum.imputed_${n}_value : datum.${n}`,as:n};return[c,i,s]}else return[c]}}class y5 extends wo{clone(){return new y5(null,la(this.transform))}constructor(n,t){super(n),this.transform=t,this.transform=la(t);const o=this.transform.as??[void 0,void 0];this.transform.as=[o[0]??t.on,o[1]??t.loess]}dependentFields(){return new Set([this.transform.loess,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`LoessTransform ${Ba(this.transform)}`}assemble(){const{loess:n,on:t,...o}=this.transform;return{type:"loess",x:t,y:n,...o}}}class jv extends wo{clone(){return new jv(null,la(this.transform),this.secondary)}constructor(n,t,o){super(n),this.transform=t,this.secondary=o}static make(n,t,o,f){const r=t.component.data.sources,{from:a}=o;let l=null;if(Tbe(a)){let c=YH(a.data,r);c||(c=new Q0(a.data),r.push(c));const i=t.getName(`lookup_${f}`);l=new vu(c,i,Uo.Lookup,t.component.data.outputNodeRefCounts),t.component.data.outputNodes[i]=l}else if(Mbe(a)){const c=a.param;o={as:c,...o};let i;try{i=t.getSelectionComponent(es(c),c)}catch{throw new Error(nye(c))}if(l=i.materialized,!l)throw new Error(rye(c))}return new jv(n,o,l.getSource())}dependentFields(){return new Set([this.transform.lookup])}producedFields(){return new Set(this.transform.as?Ti(this.transform.as):this.transform.from.fields)}hash(){return`Lookup ${Ba({transform:this.transform,secondary:this.secondary})}`}assemble(){let n;if(this.transform.from.fields)n={values:this.transform.from.fields,...this.transform.as?{as:Ti(this.transform.as)}:{}};else{let t=this.transform.as;Li(t)||(ei(fye),t="_lookup"),n={as:[t]}}return{type:"lookup",from:this.secondary,key:this.transform.from.key,fields:[this.transform.lookup],...n,...this.transform.default?{default:this.transform.default}:{}}}}class v5 extends wo{clone(){return new v5(null,la(this.transform))}constructor(n,t){super(n),this.transform=t,this.transform=la(t);const o=this.transform.as??[void 0,void 0];this.transform.as=[o[0]??"prob",o[1]??"value"]}dependentFields(){return new Set([this.transform.quantile,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`QuantileTransform ${Ba(this.transform)}`}assemble(){const{quantile:n,...t}=this.transform;return{type:"quantile",field:n,...t}}}class x5 extends wo{clone(){return new x5(null,la(this.transform))}constructor(n,t){super(n),this.transform=t,this.transform=la(t);const o=this.transform.as??[void 0,void 0];this.transform.as=[o[0]??t.on,o[1]??t.regression]}dependentFields(){return new Set([this.transform.regression,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`RegressionTransform ${Ba(this.transform)}`}assemble(){const{regression:n,on:t,...o}=this.transform;return{type:"regression",x:t,y:n,...o}}}class b5 extends wo{clone(){return new b5(null,la(this.transform))}constructor(n,t){super(n),this.transform=t}addDimensions(n){this.transform.groupby=Zf((this.transform.groupby??[]).concat(n),t=>t)}producedFields(){}dependentFields(){return new Set([this.transform.pivot,this.transform.value,...this.transform.groupby??[]])}hash(){return`PivotTransform ${Ba(this.transform)}`}assemble(){const{pivot:n,value:t,groupby:o,limit:f,op:r}=this.transform;return{type:"pivot",field:n,value:t,...f!==void 0?{limit:f}:{},...r!==void 0?{op:r}:{},...o!==void 0?{groupby:o}:{}}}}class _5 extends wo{clone(){return new _5(null,la(this.transform))}constructor(n,t){super(n),this.transform=t}dependentFields(){return new Set}producedFields(){return new Set}hash(){return`SampleTransform ${Ba(this.transform)}`}assemble(){return{type:"sample",size:this.transform.sample}}}function GH(e){let n=0;function t(o,f){if(o instanceof Q0&&!o.isGenerator&&!Km(o.data)&&(e.push(f),f={name:null,source:f.name,transform:[]}),o instanceof Gl&&(o.parent instanceof Q0&&!f.source?(f.format={...f.format??{},parse:o.assembleFormatParse()},f.transform.push(...o.assembleTransforms(!0))):f.transform.push(...o.assembleTransforms())),o instanceof T1){f.name||(f.name=`data_${n++}`),!f.source||f.transform.length>0?(e.push(f),o.data=f.name):o.data=f.source,e.push(...o.assemble());return}switch((o instanceof zx||o instanceof Nx||o instanceof Nv||o instanceof k1||o instanceof e1||o instanceof Bv||o instanceof gf||o instanceof jv||o instanceof M1||o instanceof yg||o instanceof m5||o instanceof g5||o instanceof d5||o instanceof y5||o instanceof v5||o instanceof x5||o instanceof xp||o instanceof _5||o instanceof b5||o instanceof p5)&&f.transform.push(o.assemble()),(o instanceof ih||o instanceof rh||o instanceof C0||o instanceof Qh||o instanceof Am)&&f.transform.push(...o.assemble()),o instanceof vu&&(f.source&&f.transform.length===0?o.setSource(f.source):o.parent instanceof vu?o.setSource(f.name):(f.name||(f.name=`data_${n++}`),o.setSource(f.name),o.numChildren()===1&&(e.push(f),f={name:null,source:f.name,transform:[]}))),o.numChildren()){case 0:o instanceof vu&&(!f.source||f.transform.length>0)&&e.push(f);break;case 1:t(o.children[0],f);break;default:{f.name||(f.name=`data_${n++}`);let r=f.name;!f.source||f.transform.length>0?e.push(f):r=f.source;for(const a of o.children)t(a,{name:null,source:r,transform:[]});break}}}return t}function n5e(e){const n=[],t=GH(n);for(const o of e.children)t(o,{source:e.name,name:null,transform:[]});return n}function r5e(e,n){const t=[],o=GH(t);let f=0;for(const a of e.sources){a.hasName()||(a.dataName=`source_${f++}`);const l=a.assemble();o(a,l)}for(const a of t)a.transform.length===0&&delete a.transform;let r=0;for(const[a,l]of t.entries())(l.transform??[]).length===0&&!l.source&&t.splice(r++,0,t.splice(a,1)[0]);for(const a of t)for(const l of a.transform??[])l.type==="lookup"&&(l.from=e.outputNodes[l.from].getSource());for(const a of t)a.name in n&&(a.values=n[a.name]);return t}function i5e(e){return e==="top"||e==="left"||ji(e)?"header":"footer"}function a5e(e){for(const n of Tc)o5e(e,n);RP(e,"x"),RP(e,"y")}function o5e(e,n){const{facet:t,config:o,child:f,component:r}=e;if(e.channelHasField(n)){const a=t[n],l=n1("title",null,o,n);let c=_m(a,o,{allowDisabling:!0,includeDefault:l===void 0||!!l});f.component.layoutHeaders[n].title&&(c=zr(c)?c.join(", "):c,c+=` / ${f.component.layoutHeaders[n].title}`,f.component.layoutHeaders[n].title=null);const i=n1("labelOrient",a.header,o,n),s=a.header!==null?zs(a.header?.labels,o.header.labels,!0):!1,u=ja(["bottom","right"],i)?"footer":"header";r.layoutHeaders[n]={title:a.header!==null?c:null,facetFieldDef:a,[u]:n==="facet"?[]:[WH(e,n,s)]}}}function WH(e,n,t){const o=n==="row"?"height":"width";return{labels:t,sizeSignal:e.child.component.layoutSize.get(o)?e.child.getSizeSignalRef(o):void 0,axes:[]}}function RP(e,n){const{child:t}=e;if(t.component.axes[n]){const{layoutHeaders:o,resolve:f}=e.component;if(f.axis[n]=aC(f,n),f.axis[n]==="shared"){const r=n==="x"?"column":"row",a=o[r];for(const l of t.component.axes[n]){const c=i5e(l.get("orient"));a[c]??(a[c]=[WH(e,r,!1)]);const i=Hy(l,"main",e.config,{header:!0});i&&a[c][0].axes.push(i),l.mainExtracted=!0}}}}function s5e(e){dC(e),pw(e,"width"),pw(e,"height")}function l5e(e){dC(e);const n=e.layout.columns===1?"width":"childWidth",t=e.layout.columns===void 0?"height":"childHeight";pw(e,n),pw(e,t)}function dC(e){for(const n of e.children)n.parseLayoutSize()}function pw(e,n){const t=xH(n),o=N3(t),f=e.component.resolve,r=e.component.layoutSize;let a;for(const l of e.children){const c=l.component.layoutSize.getWithExplicit(t),i=f.scale[o]??_H(o,e);if(i==="independent"&&c.value==="step"){a=void 0;break}if(a){if(i==="independent"&&a.value!==c.value){a=void 0;break}a=mp(a,c,t,"")}else a=c}if(a){for(const l of e.children)e.renameSignal(l.getName(t),e.getName(n)),l.component.layoutSize.set(t,"merged",!1);r.setWithExplicit(n,a)}else r.setWithExplicit(n,{explicit:!1,value:void 0})}function u5e(e){const{size:n,component:t}=e;for(const o of wh){const f=Yu(o);if(n[f]){const r=n[f];t.layoutSize.set(f,dh(r)?"step":r,!0)}else{const r=c5e(e,f);t.layoutSize.set(f,r,!1)}}}function c5e(e,n){const t=n==="width"?"x":"y",o=e.config,f=e.getScaleComponent(t);if(f){const r=f.get("type"),a=f.get("range");if(ml(r)){const l=sw(o.view,n);return Cp(a)||dh(l)?"step":l}else return ET(o.view,n)}else{if(e.hasProjection||e.mark==="arc")return ET(o.view,n);{const r=sw(o.view,n);return dh(r)?r.step:r}}}function qT(e,n,t){return hi(n,{suffix:`by_${hi(e)}`,...t??{}})}class uv extends HH{constructor(n,t,o,f){super(n,"facet",t,o,f,n.resolve),this.child=vC(n.spec,this,this.getName("child"),void 0,f),this.children=[this.child],this.facet=this.initFacet(n.facet)}initFacet(n){if(!Cx(n))return{facet:this.initFacetFieldDef(n,"facet")};const t=Zr(n),o={};for(const f of t){if(![Zh,Jh].includes(f)){ei(U3(f,"facet"));break}const r=n[f];if(r.field===void 0){ei(_T(r,f));break}o[f]=this.initFacetFieldDef(r,f)}return o}initFacetFieldDef(n,t){const o=P8(n,t);return o.header?o.header=Iu(o.header):o.header===null&&(o.header=null),o}channelHasField(n){return!!this.facet[n]}fieldDef(n){return this.facet[n]}parseData(){this.component.data=w5(this),this.child.parseData()}parseLayoutSize(){dC(this)}parseSelections(){this.child.parseSelections(),this.component.selection=this.child.component.selection}parseMarkGroup(){this.child.parseMarkGroup()}parseAxesAndHeaders(){this.child.parseAxesAndHeaders(),a5e(this)}assembleSelectionTopLevelSignals(n){return this.child.assembleSelectionTopLevelSignals(n)}assembleSignals(){return this.child.assembleSignals(),[]}assembleSelectionData(n){return this.child.assembleSelectionData(n)}getHeaderLayoutMixins(){const n={};for(const t of Tc)for(const o of rC){const f=this.component.layoutHeaders[t],r=f[o],{facetFieldDef:a}=f;if(a){const l=n1("titleOrient",a.header,this.config,t);if(["right","bottom"].includes(l)){const c=c5(t,l);n.titleAnchor??(n.titleAnchor={}),n.titleAnchor[c]="end"}}if(r?.[0]){const l=t==="row"?"height":"width",c=o==="header"?"headerBand":"footerBand";t!=="facet"&&!this.child.component.layoutSize.get(l)&&(n[c]??(n[c]={}),n[c][t]=.5),f.title&&(n.offset??(n.offset={}),n.offset[t==="row"?"rowTitle":"columnTitle"]=10)}}return n}assembleDefaultLayout(){const{column:n,row:t}=this.facet,o=n?this.columnDistinctSignal():t?1:void 0;let f="all";return(!t&&this.component.resolve.scale.x==="independent"||!n&&this.component.resolve.scale.y==="independent")&&(f="none"),{...this.getHeaderLayoutMixins(),...o?{columns:o}:{},bounds:"full",align:f}}assembleLayoutSignals(){return this.child.assembleLayoutSignals()}columnDistinctSignal(){if(!(this.parent&&this.parent instanceof uv))return{signal:`length(data('${this.getName("column_domain")}'))`}}assembleGroupStyle(){}assembleGroup(n){return this.parent&&this.parent instanceof uv?{...this.channelHasField("column")?{encode:{update:{columns:{field:hi(this.facet.column,{prefix:"distinct"})}}}}:{},...super.assembleGroup(n)}:super.assembleGroup(n)}getCardinalityAggregateForChild(){const n=[],t=[],o=[];if(this.child instanceof uv){if(this.child.channelHasField("column")){const f=hi(this.child.facet.column);n.push(f),t.push("distinct"),o.push(`distinct_${f}`)}}else for(const f of wh){const r=this.child.component.scales[f];if(r&&!r.merged){const a=r.get("type"),l=r.get("range");if(ml(a)&&Cp(l)){const c=h5(this.child,f),i=cC(c);i?(n.push(i),t.push("distinct"),o.push(`distinct_${i}`)):ei(s8(f))}}}return{fields:n,ops:t,as:o}}assembleFacet(){const{name:n,data:t}=this.component.data.facetRoot,{row:o,column:f}=this.facet,{fields:r,ops:a,as:l}=this.getCardinalityAggregateForChild(),c=[];for(const s of Tc){const u=this.facet[s];if(u){c.push(hi(u));const{bin:h,sort:d}=u;if(Vo(h)&&c.push(hi(u,{binSuffix:"end"})),nh(d)){const{field:m,op:p=W3}=d,g=qT(u,d);o&&f?(r.push(g),a.push("max"),l.push(g)):(r.push(m),a.push(p),l.push(g))}else if(zr(d)){const m=t1(u,s);r.push(m),a.push("max"),l.push(m)}}}const i=!!o&&!!f;return{name:n,data:t,groupby:c,...i||r.length>0?{aggregate:{...i?{cross:i}:{},...r.length?{fields:r,ops:a,as:l}:{}}}:{}}}facetSortFields(n){const{facet:t}=this,o=t[n];return o?nh(o.sort)?[qT(o,o.sort,{expr:"datum"})]:zr(o.sort)?[t1(o,n,{expr:"datum"})]:[hi(o,{expr:"datum"})]:[]}facetSortOrder(n){const{facet:t}=this,o=t[n];if(o){const{sort:f}=o;return[(nh(f)?f.order:!zr(f)&&f)||"ascending"]}return[]}assembleLabelTitle(){const{facet:n,config:t}=this;if(n.facet)return NT(n.facet,"facet",t);const o={row:["top","bottom"],column:["left","right"]};for(const f of nC)if(n[f]){const r=n1("labelOrient",n[f]?.header,t,f);if(o[f].includes(r))return NT(n[f],f,t)}}assembleMarks(){const{child:n}=this,t=this.component.data.facetRoot,o=n5e(t),f=n.assembleGroupEncodeEntry(!1),r=this.assembleLabelTitle()||n.assembleTitle(),a=n.assembleGroupStyle();return[{name:this.getName("cell"),type:"group",...r?{title:r}:{},...a?{style:a}:{},from:{facet:this.assembleFacet()},sort:{field:Tc.map(c=>this.facetSortFields(c)).flat(),order:Tc.map(c=>this.facetSortOrder(c)).flat()},...o.length>0?{data:o}:{},...f?{encode:{update:f}}:{},...n.assembleGroup(h2e(this,[]))}]}getMapping(){return this.facet}}function f5e(e,n){const{row:t,column:o}=n;if(t&&o){let f=null;for(const r of[t,o])if(nh(r.sort)){const{field:a,op:l=W3}=r.sort;e=f=new yg(e,{joinaggregate:[{op:l,field:a,as:qT(r,r.sort,{forAs:!0})}],groupby:[hi(r)]})}return f}return null}function YH(e,n){for(const t of n){const o=t.data;if(e.name&&t.hasName()&&e.name!==t.dataName)continue;const f=e.format?.mesh,r=o.format?.feature;if(f&&r)continue;const a=e.format?.feature;if((a||r)&&a!==r)continue;const l=o.format?.mesh;if(!((f||l)&&f!==l)){if(Fv(e)&&Fv(o)){if(Xf(e.values,o.values))return t}else if(Km(e)&&Km(o)){if(e.url===o.url)return t}else if(Eq(e)&&e.name===t.dataName)return t}}return null}function h5e(e,n){if(e.data||!e.parent){if(e.data===null){const o=new Q0({values:[]});return n.push(o),o}const t=YH(e.data,n);if(t)return tp(e.data)||(t.data.format=A$({},e.data.format,t.data.format)),!t.hasName()&&e.data.name&&(t.dataName=e.data.name),t;{const o=new Q0(e.data);return n.push(o),o}}else return e.parent.component.data.facetRoot?e.parent.component.data.facetRoot:e.parent.component.data.main}function d5e(e,n,t){let o=0;for(const f of n.transforms){let r,a;if(Rbe(f))a=e=new e1(e,f),r="derived";else if(G8(f)){const l=i3e(f);a=e=Gl.makeWithAncestors(e,{},l,t)??e,e=new k1(e,n,f.filter)}else if(wq(f))a=e=ih.makeFromTransform(e,f,n),r="number";else if(Nbe(f))r="date",t.getWithExplicit(f.field).value===void 0&&(e=new Gl(e,{[f.field]:r}),t.set(f.field,r,!1)),a=e=rh.makeFromTransform(e,f);else if(Bbe(f))a=e=gf.makeFromTransform(e,f),r="number",K8(n)&&(e=new xp(e));else if(_q(f))a=e=jv.make(e,n,f,o++),r="derived";else if(Pbe(f))a=e=new M1(e,f),r="number";else if(Ibe(f))a=e=new yg(e,f),r="number";else if(jbe(f))a=e=Qh.makeFromTransform(e,f),r="derived";else if(Ube(f))a=e=new m5(e,f),r="derived";else if($be(f))a=e=new p5(e,f),r="derived";else if(Fbe(f))a=e=new g5(e,f),r="derived";else if(Ebe(f))a=e=new b5(e,f),r="derived";else if(Obe(f))e=new _5(e,f);else if(zbe(f))a=e=C0.makeFromTransform(e,f),r="derived";else if(Sbe(f))a=e=new d5(e,f),r="derived";else if(Cbe(f))a=e=new v5(e,f),r="derived";else if(Lbe(f))a=e=new x5(e,f),r="derived";else if(Dbe(f))a=e=new y5(e,f),r="derived";else{ei(cye(f));continue}if(a&&r!==void 0)for(const l of a.producedFields()??[])t.set(l,r,!1)}return e}function w5(e){let n=h5e(e,e.component.data.sources);const{outputNodes:t,outputNodeRefCounts:o}=e.component.data,f=e.data,a=!(f&&(tp(f)||Km(f)||Fv(f)))&&e.parent?e.parent.component.data.ancestorParse.clone():new e2e;tp(f)?(Sq(f)?n=new Nx(n,f.sequence):W8(f)&&(n=new zx(n,f.graticule)),a.parseNothing=!0):f?.format?.parse===null&&(a.parseNothing=!0),n=Gl.makeExplicit(n,e,a)??n,n=new xp(n);const l=e.parent&&E1(e.parent);(As(e)||mf(e))&&l&&(n=ih.makeFromEncoding(n,e)??n),e.transforms.length>0&&(n=d5e(n,e,a));const c=o3e(e),i=a3e(e);n=Gl.makeWithAncestors(n,{},{...c,...i},a)??n,As(e)&&(n=Am.parseAll(n,e),n=Bv.parseAll(n,e)),(As(e)||mf(e))&&(l||(n=ih.makeFromEncoding(n,e)??n),n=rh.makeFromEncoding(n,e)??n,n=e1.parseAllForSortIndex(n,e));const s=e.getDataName(Uo.Raw),u=new vu(n,s,Uo.Raw,o);if(t[s]=u,n=u,As(e)){const p=gf.makeFromEncoding(n,e);p&&(n=p,K8(e)&&(n=new xp(n))),n=C0.makeFromEncoding(n,e)??n,n=Qh.makeFromEncoding(n,e)??n}As(e)&&(n=Nv.make(n,e)??n);const h=e.getDataName(Uo.Main),d=new vu(n,h,Uo.Main,o);t[h]=d,n=d,As(e)&&twe(e,d);let m=null;if(mf(e)){const p=e.getName("facet");n=f5e(n,e.facet)??n,m=new T1(n,e,p,d.getSource()),t[p]=m}return{...e.component.data,outputNodes:t,outputNodeRefCounts:o,raw:u,main:d,facetRoot:m,ancestorParse:a}}class p5e extends hC{constructor(n,t,o,f){super(n,"concat",t,o,f,n.resolve),(n.resolve?.axis?.x==="shared"||n.resolve?.axis?.y==="shared")&&ei(sye),this.children=this.getChildren(n).map((r,a)=>vC(r,this,this.getName(`concat_${a}`),void 0,f))}parseData(){this.component.data=w5(this);for(const n of this.children)n.parseData()}parseSelections(){this.component.selection={};for(const n of this.children){n.parseSelections();for(const t of Zr(n.component.selection))this.component.selection[t]=n.component.selection[t]}}parseMarkGroup(){for(const n of this.children)n.parseMarkGroup()}parseAxesAndHeaders(){for(const n of this.children)n.parseAxesAndHeaders()}getChildren(n){return t5(n)?n.vconcat:q8(n)?n.hconcat:n.concat}parseLayoutSize(){l5e(this)}parseAxisGroup(){return null}assembleSelectionTopLevelSignals(n){return this.children.reduce((t,o)=>o.assembleSelectionTopLevelSignals(t),n)}assembleSignals(){return this.children.forEach(n=>n.assembleSignals()),[]}assembleLayoutSignals(){const n=iC(this);for(const t of this.children)n.push(...t.assembleLayoutSignals());return n}assembleSelectionData(n){return this.children.reduce((t,o)=>o.assembleSelectionData(t),n)}assembleMarks(){return this.children.map(n=>{const t=n.assembleTitle(),o=n.assembleGroupStyle(),f=n.assembleGroupEncodeEntry(!1);return{type:"group",name:n.getName("group"),...t?{title:t}:{},...o?{style:o}:{},...f?{encode:{update:f}}:{},...n.assembleGroup()}})}assembleGroupStyle(){}assembleDefaultLayout(){const n=this.layout.columns;return{...n!=null?{columns:n}:{},bounds:"full",align:"each"}}}function g5e(e){return e===!1||e===null}const m5e={disable:1,gridScale:1,scale:1,...YV,labelExpr:1,encode:1},XH=Zr(m5e);class pC extends yd{constructor(n={},t={},o=!1){super(),this.explicit=n,this.implicit=t,this.mainExtracted=o}clone(){return new pC(la(this.explicit),la(this.implicit),this.mainExtracted)}hasAxisPart(n){return n==="axis"?!0:n==="grid"||n==="title"?!!this.get(n):!g5e(this.get(n))}hasOrientSignalRef(){return ji(this.explicit.orient)}}function y5e(e,n,t){const{encoding:o,config:f}=e,r=Ks(o[n])??Ks(o[_h(n)]),a=e.axis(n)||{},{format:l,formatType:c}=a;if(Y0(c))return{text:hf({fieldOrDatumDef:r,field:"datum.value",format:l,formatType:c,config:f}),...t};if(l===void 0&&c===void 0&&f.customFormatTypes){if(Xm(r)==="quantitative"){if(Zm(r)&&r.stack==="normalize"&&f.normalizedNumberFormatType)return{text:hf({fieldOrDatumDef:r,field:"datum.value",format:f.normalizedNumberFormat,formatType:f.normalizedNumberFormatType,config:f}),...t};if(f.numberFormatType)return{text:hf({fieldOrDatumDef:r,field:"datum.value",format:f.numberFormat,formatType:f.numberFormatType,config:f}),...t}}if(Xm(r)==="temporal"&&f.timeFormatType&&ni(r)&&!r.timeUnit)return{text:hf({fieldOrDatumDef:r,field:"datum.value",format:f.timeFormat,formatType:f.timeFormatType,config:f}),...t}}return t}function v5e(e){return wh.reduce((n,t)=>(e.component.scales[t]&&(n[t]=[T5e(t,e)]),n),{})}const x5e={bottom:"top",top:"bottom",left:"right",right:"left"};function b5e(e){const{axes:n,resolve:t}=e.component,o={top:0,bottom:0,right:0,left:0};for(const f of e.children){f.parseAxesAndHeaders();for(const r of Zr(f.component.axes))t.axis[r]=aC(e.component.resolve,r),t.axis[r]==="shared"&&(n[r]=_5e(n[r],f.component.axes[r]),n[r]||(t.axis[r]="independent",delete n[r]))}for(const f of wh){for(const r of e.children)if(r.component.axes[f]){if(t.axis[f]==="independent"){n[f]=(n[f]??[]).concat(r.component.axes[f]);for(const a of r.component.axes[f]){const{value:l,explicit:c}=a.getWithExplicit("orient");if(!ji(l)){if(o[l]>0&&!c){const i=x5e[l];o[l]>o[i]&&a.set("orient",i,!1)}o[l]++}}}delete r.component.axes[f]}if(t.axis[f]==="independent"&&n[f]&&n[f].length>1)for(const[r,a]of(n[f]||[]).entries())r>0&&a.get("grid")&&!a.explicit.grid&&(a.implicit.grid=!1)}}function _5e(e,n){if(e){if(e.length!==n.length)return;const t=e.length;for(let o=0;ot.clone());return e}function w5e(e,n){for(const t of XH){const o=mp(e.getWithExplicit(t),n.getWithExplicit(t),t,"axis",(f,r)=>{switch(t){case"title":return K$(f,r);case"gridScale":return{explicit:f.explicit,value:zs(f.value,r.value)}}return r5(f,r,t,"axis")});e.setWithExplicit(t,o)}return e}function A5e(e,n,t,o,f){if(n==="disable")return t!==void 0;switch(t=t||{},n){case"titleAngle":case"labelAngle":return e===(ji(t.labelAngle)?t.labelAngle:Iv(t.labelAngle));case"values":return!!t.values;case"encode":return!!t.encoding||!!t.labelAngle;case"title":if(e===pH(o,f))return!0}return e===t[n]}const k5e=new Set(["grid","translate","format","formatType","orient","labelExpr","tickCount","position","tickMinStep"]);function T5e(e,n){let t=n.axis(e);const o=new pC,f=Ks(n.encoding[e]),{mark:r,config:a}=n,l=t?.orient||a[e==="x"?"axisX":"axisY"]?.orient||a.axis?.orient||fwe(e),c=n.getScaleComponent(e).get("type"),i=iwe(e,c,l,n.config),s=t!==void 0?!t:RT("disable",a.style,t?.style,i).configValue;if(o.set("disable",s,t!==void 0),s)return o;t=t||{};const u=lwe(f,t,e,a.style,i),h=OV(t.formatType,f,c),d=DV(f,f.type,t.format,t.formatType,a,!0),m={fieldOrDatumDef:f,axis:t,channel:e,model:n,scaleType:c,orient:l,labelAngle:u,format:d,formatType:h,mark:r,config:a};for(const y of XH){const v=y in _P?_P[y](m):VO(y)?t[y]:void 0,x=v!==void 0,_=A5e(v,y,t,n,e);if(x&&_)o.set(y,v,_);else{const{configValue:A=void 0,configFrom:b=void 0}=VO(y)&&y!=="values"?RT(y,a.style,t.style,i):{},k=A!==void 0;x&&!k?o.set(y,v,_):(b!=="vgAxisConfig"||k5e.has(y)&&k||Ox(A)||ji(A))&&o.set(y,A,!1)}}const p=t.encoding??{},g=WV.reduce((y,v)=>{if(!o.hasAxisPart(v))return y;const x=bH(p[v]??{},n),_=v==="labels"?y5e(n,e,x):x;return _!==void 0&&!Mo(_)&&(y[v]={update:_}),y},{});return Mo(g)||o.set("encode",g,!!t.encoding||t.labelAngle!==void 0),o}function M5e({encoding:e,size:n}){for(const t of wh){const o=Yu(t);dh(n[o])&&Gd(e[t])&&(delete n[o],ei(rV(o)))}return n}function E5e(e,n,t){const o=Iu(e),f=uo("orient",o,t);if(o.orient=D5e(o.type,n,f),f!==void 0&&f!==o.orient&&ei(Sye(o.orient,f)),o.type==="bar"&&o.orient){const l=uo("cornerRadiusEnd",o,t);if(l!==void 0){const c=o.orient==="horizontal"&&n.x2||o.orient==="vertical"&&n.y2?["cornerRadius"]:Wve[o.orient];for(const i of c)o[i]=l;o.cornerRadiusEnd!==void 0&&delete o.cornerRadiusEnd}}return uo("opacity",o,t)===void 0&&(o.opacity=C5e(o.type,n)),uo("cursor",o,t)===void 0&&(o.cursor=S5e(o,n,t)),o}function S5e(e,n,t){return n.href||e.href||uo("href",e,t)?"pointer":e.cursor}function C5e(e,n){if(ja([G3,_8,w8,A8],e)&&!I8(n))return .7}function L5e(e,n,{graticule:t}){if(t)return!1;const o=id("filled",e,n),f=e.type;return zs(o,f!==G3&&f!==H3&&f!==Q_)}function D5e(e,n,t){switch(e){case G3:case w8:case A8:case TV:case zve:case Rve:return}const{x:o,y:f,x2:r,y2:a}=n;switch(e){case q3:if(ni(o)&&(Ml(o.bin)||ni(f)&&f.aggregate&&!o.aggregate))return"vertical";if(ni(f)&&(Ml(f.bin)||ni(o)&&o.aggregate&&!f.aggregate))return"horizontal";if(a||r){if(t)return t;if(!r)return(ni(o)&&o.type===G0&&!Vo(o.bin)||tw(o))&&ni(f)&&Ml(f.bin)?"horizontal":"vertical";if(!a)return(ni(f)&&f.type===G0&&!Vo(f.bin)||tw(f))&&ni(o)&&Ml(o.bin)?"vertical":"horizontal"}case Q_:if(r&&!(ni(o)&&Ml(o.bin))&&a&&!(ni(f)&&Ml(f.bin)))return;case V3:if(a)return ni(f)&&Ml(f.bin)?"horizontal":"vertical";if(r)return ni(o)&&Ml(o.bin)?"vertical":"horizontal";if(e===Q_){if(o&&!f)return"vertical";if(f&&!o)return"horizontal"}case H3:case _8:{const l=UO(o),c=UO(f);if(t)return t;if(l&&!c)return e!=="tick"?"horizontal":"vertical";if(!l&&c)return e!=="tick"?"vertical":"horizontal";if(l&&c)return"vertical";{const i=Au(o)&&o.type===Wm,s=Au(f)&&f.type===Wm;if(i&&!s)return"vertical";if(!i&&s)return"horizontal"}return}}return"vertical"}const O5e={vgMark:"arc",encodeEntry:e=>({...Fc(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...Hl("x",e,{defaultPos:"mid"}),...Hl("y",e,{defaultPos:"mid"}),...yp(e,"radius"),...yp(e,"theta")})},P5e={vgMark:"area",encodeEntry:e=>({...Fc(e,{align:"ignore",baseline:"ignore",color:"include",orient:"include",size:"ignore",theta:"ignore"}),...cw("x",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:e.markDef.orient==="horizontal"}),...cw("y",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:e.markDef.orient==="vertical"}),...J8(e)})},I5e={vgMark:"rect",encodeEntry:e=>({...Fc(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...yp(e,"x"),...yp(e,"y")})},F5e={vgMark:"shape",encodeEntry:e=>({...Fc(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"})}),postEncodingTransform:e=>{const{encoding:n}=e,t=n.shape;return[{type:"geoshape",projection:e.projectionName(),...t&&ni(t)&&t.type===_1?{field:hi(t,{expr:"datum"})}:{}}]}},R5e={vgMark:"image",encodeEntry:e=>({...Fc(e,{align:"ignore",baseline:"ignore",color:"ignore",orient:"ignore",size:"ignore",theta:"ignore"}),...yp(e,"x"),...yp(e,"y"),...X8(e,"url")})},z5e={vgMark:"line",encodeEntry:e=>({...Fc(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...Hl("x",e,{defaultPos:"mid"}),...Hl("y",e,{defaultPos:"mid"}),...sl("size",e,{vgChannel:"strokeWidth"}),...J8(e)})},N5e={vgMark:"trail",encodeEntry:e=>({...Fc(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...Hl("x",e,{defaultPos:"mid"}),...Hl("y",e,{defaultPos:"mid"}),...sl("size",e),...J8(e)})};function gC(e,n){const{config:t}=e;return{...Fc(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...Hl("x",e,{defaultPos:"mid"}),...Hl("y",e,{defaultPos:"mid"}),...sl("size",e),...sl("angle",e),...B5e(e,t,n)}}function B5e(e,n,t){return t?{shape:{value:t}}:sl("shape",e)}const j5e={vgMark:"symbol",encodeEntry:e=>gC(e)},U5e={vgMark:"symbol",encodeEntry:e=>gC(e,"circle")},$5e={vgMark:"symbol",encodeEntry:e=>gC(e,"square")},V5e={vgMark:"rect",encodeEntry:e=>({...Fc(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...yp(e,"x"),...yp(e,"y")})},q5e={vgMark:"rule",encodeEntry:e=>{const{markDef:n}=e,t=n.orient;return!e.encoding.x&&!e.encoding.y&&!e.encoding.latitude&&!e.encoding.longitude?{}:{...Fc(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...cw("x",e,{defaultPos:t==="horizontal"?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:t!=="vertical"}),...cw("y",e,{defaultPos:t==="vertical"?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:t!=="horizontal"}),...sl("size",e,{vgChannel:"strokeWidth"})}}},H5e={vgMark:"text",encodeEntry:e=>{const{config:n,encoding:t}=e;return{...Fc(e,{align:"include",baseline:"include",color:"include",size:"ignore",orient:"ignore",theta:"include"}),...Hl("x",e,{defaultPos:"mid"}),...Hl("y",e,{defaultPos:"mid"}),...X8(e),...sl("size",e,{vgChannel:"fontSize"}),...sl("angle",e),...cP("align",G5e(e.markDef,t,n)),...cP("baseline",W5e(e.markDef,t,n)),...Hl("radius",e,{defaultPos:null}),...Hl("theta",e,{defaultPos:null})}}};function G5e(e,n,t){if(uo("align",e,t)===void 0)return"center"}function W5e(e,n,t){if(uo("baseline",e,t)===void 0)return"middle"}const Y5e={vgMark:"rect",encodeEntry:e=>{const{config:n,markDef:t}=e,o=t.orient,f=o==="horizontal"?"width":"height",r=o==="horizontal"?"height":"width";return{...Fc(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...Hl("x",e,{defaultPos:"mid",vgChannel:"xc"}),...Hl("y",e,{defaultPos:"mid",vgChannel:"yc"}),...sl("size",e,{defaultValue:X5e(e),vgChannel:f}),[r]:Yo(uo("thickness",t,n))}}};function X5e(e){const{config:n,markDef:t}=e,{orient:o}=t,f=o==="horizontal"?"width":"height",r=e.getScaleComponent(o==="horizontal"?"x":"y"),a=uo("size",t,n,{vgChannel:f})??n.tick.bandSize;if(a!==void 0)return a;{const l=r?r.get("range"):void 0;return l&&Cp(l)&&Eo(l.step)?l.step*3/4:ow(n.view,f)*3/4}}const t2={arc:O5e,area:P5e,bar:I5e,circle:U5e,geoshape:F5e,image:R5e,line:z5e,point:j5e,rect:V5e,rule:q5e,square:$5e,text:H5e,tick:Y5e,trail:N5e};function Z5e(e){if(ja([H3,V3,Nve],e.mark)){const n=KV(e.mark,e.encoding);if(n.length>0)return J5e(e,n)}else if(e.mark===q3){const n=bT.some(t=>uo(t,e.markDef,e.config));if(e.stack&&!e.fieldDef("size")&&n)return K5e(e)}return mC(e)}const zP="faceted_path_";function J5e(e,n){return[{name:e.getName("pathgroup"),type:"group",from:{facet:{name:zP+e.requestDataName(Uo.Main),data:e.requestDataName(Uo.Main),groupby:n}},encode:{update:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:mC(e,{fromPrefix:zP})}]}const NP="stack_group_";function K5e(e){const[n]=mC(e,{fromPrefix:NP}),t=e.scaleName(e.stack.fieldChannel),o=(i={})=>e.vgField(e.stack.fieldChannel,i),f=(i,s)=>{const u=[o({prefix:"min",suffix:"start",expr:s}),o({prefix:"max",suffix:"start",expr:s}),o({prefix:"min",suffix:"end",expr:s}),o({prefix:"max",suffix:"end",expr:s})];return`${i}(${u.map(h=>`scale('${t}',${h})`).join(",")})`};let r,a;e.stack.fieldChannel==="x"?(r={...Vm(n.encode.update,["y","yc","y2","height",...bT]),x:{signal:f("min","datum")},x2:{signal:f("max","datum")},clip:{value:!0}},a={x:{field:{group:"x"},mult:-1},height:{field:{group:"height"}}},n.encode.update={...ju(n.encode.update,["y","yc","y2"]),height:{field:{group:"height"}}}):(r={...Vm(n.encode.update,["x","xc","x2","width"]),y:{signal:f("min","datum")},y2:{signal:f("max","datum")},clip:{value:!0}},a={y:{field:{group:"y"},mult:-1},width:{field:{group:"width"}}},n.encode.update={...ju(n.encode.update,["x","xc","x2"]),width:{field:{group:"width"}}});for(const i of bT){const s=id(i,e.markDef,e.config);n.encode.update[i]?(r[i]=n.encode.update[i],delete n.encode.update[i]):s&&(r[i]=Yo(s)),s&&(n.encode.update[i]={value:0})}const l=[];if(e.stack.groupbyChannels?.length>0)for(const i of e.stack.groupbyChannels){const s=e.fieldDef(i),u=hi(s);u&&l.push(u),(s?.bin||s?.timeUnit)&&l.push(hi(s,{binSuffix:"end"}))}return r=["stroke","strokeWidth","strokeJoin","strokeCap","strokeDash","strokeDashOffset","strokeMiterLimit","strokeOpacity"].reduce((i,s)=>{if(n.encode.update[s])return{...i,[s]:n.encode.update[s]};{const u=id(s,e.markDef,e.config);return u!==void 0?{...i,[s]:Yo(u)}:i}},r),r.stroke&&(r.strokeForeground={value:!0},r.strokeOffset={value:0}),[{type:"group",from:{facet:{data:e.requestDataName(Uo.Main),name:NP+e.requestDataName(Uo.Main),groupby:l,aggregate:{fields:[o({suffix:"start"}),o({suffix:"start"}),o({suffix:"end"}),o({suffix:"end"})],ops:["min","max","min","max"]}}},encode:{update:r},marks:[{type:"group",encode:{update:a},marks:[n]}]}]}function Q5e(e){const{encoding:n,stack:t,mark:o,markDef:f,config:r}=e,a=n.order;if(!(!zr(a)&&bf(a)&&vT(a.value)||!a&&vT(uo("order",f,r)))){if((zr(a)||ni(a))&&!t)return X$(a,{expr:"datum"});if(Lp(o)){const l=f.orient==="horizontal"?"y":"x",c=n[l];if(ni(c)){const i=c.sort;if(zr(i))return{field:hi(c,{prefix:l,suffix:"sort_index",expr:"datum"})};if(nh(i))return{field:hi({aggregate:I8(e.encoding)?i.op:void 0,field:i.field},{expr:"datum"})};if(IV(i)){const s=e.fieldDef(i.encoding);return{field:hi(s,{expr:"datum"}),order:i.order}}else return i===null?void 0:{field:hi(c,{binSuffix:e.stack?.impute?"mid":void 0,expr:"datum"})}}return}}}function mC(e,n={fromPrefix:""}){const{mark:t,markDef:o,encoding:f,config:r}=e,a=zs(o.clip,e4e(e),t4e(e)),l=W$(o),c=f.key,i=Q5e(e),s=n4e(e),u=uo("aria",o,r),h=t2[t].postEncodingTransform?t2[t].postEncodingTransform(e):null;return[{name:e.getName("marks"),type:t2[t].vgMark,...a?{clip:!0}:{},...l?{style:l}:{},...c?{key:c.field}:{},...i?{sort:i}:{},...s||{},...u===!1?{aria:u}:{},from:{data:n.fromPrefix+e.requestDataName(Uo.Main)},encode:{update:t2[t].encodeEntry(e)},...h?{transform:h}:{}}]}function e4e(e){const n=e.getScaleComponent("x"),t=e.getScaleComponent("y");return n?.get("selectionExtent")||t?.get("selectionExtent")?!0:void 0}function t4e(e){const n=e.component.projection;return n&&!n.isFit?!0:void 0}function n4e(e){if(!e.component.selection)return null;const n=Zr(e.component.selection).length;let t=n,o=e.parent;for(;o&&t===0;)t=Zr(o.component.selection).length,o=o.parent;return t?{interactive:n>0||e.mark==="geoshape"||!!e.encoding.tooltip}:null}class ZH extends HH{constructor(n,t,o,f={},r){super(n,"unit",t,o,r,void 0,HO(n)?n.view:void 0),this.specifiedScales={},this.specifiedAxes={},this.specifiedLegends={},this.specifiedProjection={},this.selection=[],this.children=[];const a=fh(n.mark)?{...n.mark}:{type:n.mark},l=a.type;a.filled===void 0&&(a.filled=L5e(a,r,{graticule:n.data&&W8(n.data)}));const c=this.encoding=kxe(n.encoding||{},l,a.filled,r);this.markDef=E5e(a,c,r),this.size=M5e({encoding:c,size:HO(n)?{...f,...n.width?{width:n.width}:{},...n.height?{height:n.height}:{}}:f}),this.stack=vq(this.markDef,c),this.specifiedScales=this.initScales(l,c),this.specifiedAxes=this.initAxes(c),this.specifiedLegends=this.initLegends(c),this.specifiedProjection=n.projection,this.selection=(n.params??[]).filter(i=>$8(i))}get hasProjection(){const{encoding:n}=this,t=this.mark===MV,o=n&&w1e.some(f=>fa(n[f]));return t||o}scaleDomain(n){const t=this.specifiedScales[n];return t?t.domain:void 0}axis(n){return this.specifiedAxes[n]}legend(n){return this.specifiedLegends[n]}initScales(n,t){return B3.reduce((o,f)=>{const r=Ks(t[f]);return r&&(o[f]=this.initScale(r.scale??{})),o},{})}initScale(n){const{domain:t,range:o}=n,f=Iu(n);return zr(t)&&(f.domain=t.map(ac)),zr(o)&&(f.range=o.map(ac)),f}initAxes(n){return wh.reduce((t,o)=>{const f=n[o];if(fa(f)||o===ts&&fa(n.x2)||o===dl&&fa(n.y2)){const r=fa(f)?f.axis:void 0;t[o]=r&&this.initAxis({...r})}return t},{})}initAxis(n){const t=Zr(n),o={};for(const f of t){const r=n[f];o[f]=Ox(r)?G$(r):ac(r)}return o}initLegends(n){return D1e.reduce((t,o)=>{const f=Ks(n[o]);if(f&&P1e(o)){const r=f.legend;t[o]=r&&Iu(r)}return t},{})}parseData(){this.component.data=w5(this)}parseLayoutSize(){u5e(this)}parseSelections(){this.component.selection=ewe(this,this.selection)}parseMarkGroup(){this.component.mark=Z5e(this)}parseAxesAndHeaders(){this.component.axes=v5e(this)}assembleSelectionTopLevelSignals(n){return d2e(this,n)}assembleSignals(){return[...fH(this),...f2e(this,[])]}assembleSelectionData(n){return p2e(this,n)}assembleLayout(){return null}assembleLayoutSignals(){return iC(this)}assembleMarks(){let n=this.component.mark??[];return(!this.parent||!E1(this.parent))&&(n=zq(this,n)),n.map(this.correctDataNames)}assembleGroupStyle(){const{style:n}=this.view||{};return n!==void 0?n:this.encoding.x||this.encoding.y?"cell":"view"}getMapping(){return this.encoding}get mark(){return this.markDef.type}channelHasField(n){return E0(this.encoding,n)}fieldDef(n){const t=this.encoding[n];return hh(t)}typedFieldDef(n){const t=this.fieldDef(n);return Au(t)?t:null}}class yC extends hC{constructor(n,t,o,f,r){super(n,"layer",t,o,r,n.resolve,n.view);const a={...f,...n.width?{width:n.width}:{},...n.height?{height:n.height}:{}};this.children=n.layer.map((l,c)=>{if(n5(l))return new yC(l,this,this.getName(`layer_${c}`),a,r);if(md(l))return new ZH(l,this,this.getName(`layer_${c}`),a,r);throw new Error(o8(l))})}parseData(){this.component.data=w5(this);for(const n of this.children)n.parseData()}parseLayoutSize(){s5e(this)}parseSelections(){this.component.selection={};for(const n of this.children){n.parseSelections();for(const t of Zr(n.component.selection))this.component.selection[t]=n.component.selection[t]}}parseMarkGroup(){for(const n of this.children)n.parseMarkGroup()}parseAxesAndHeaders(){b5e(this)}assembleSelectionTopLevelSignals(n){return this.children.reduce((t,o)=>o.assembleSelectionTopLevelSignals(t),n)}assembleSignals(){return this.children.reduce((n,t)=>n.concat(t.assembleSignals()),fH(this))}assembleLayoutSignals(){return this.children.reduce((n,t)=>n.concat(t.assembleLayoutSignals()),iC(this))}assembleSelectionData(n){return this.children.reduce((t,o)=>o.assembleSelectionData(t),n)}assembleGroupStyle(){const n=new Set;for(const o of this.children)for(const f of Ti(o.assembleGroupStyle()))n.add(f);const t=Array.from(n);return t.length>1?t:t.length===1?t[0]:void 0}assembleTitle(){let n=super.assembleTitle();if(n)return n;for(const t of this.children)if(n=t.assembleTitle(),n)return n}assembleLayout(){return null}assembleMarks(){return g2e(this,this.children.flatMap(n=>n.assembleMarks()))}assembleLegends(){return this.children.reduce((n,t)=>n.concat(t.assembleLegends()),SH(this))}}function vC(e,n,t,o,f){if(Y3(e))return new uv(e,n,t,f);if(n5(e))return new yC(e,n,t,o,f);if(md(e))return new ZH(e,n,t,o,f);if(Yxe(e))return new p5e(e,n,t,f);throw new Error(o8(e))}function r4e(e,n={}){n.logger&&Qye(n.logger),n.fieldTitle&&qV(n.fieldTitle);try{const t=yq(o6(n.config,e.config)),o=Tq(e,t),f=vC(o,null,"",void 0,t);return f.parse(),w3e(f.component.data,f),{spec:a4e(f,i4e(e,o.autosize,t,f),e.datasets,e.usermeta),normalized:o}}finally{n.logger&&eve(),n.fieldTitle&&gxe()}}function i4e(e,n,t,o){const f=o.component.layoutSize.get("width"),r=o.component.layoutSize.get("height");if(n===void 0?(n={type:"pad"},o.hasAxisOrientSignalRef()&&(n.resize=!0)):Li(n)&&(n={type:n}),f&&r&&Jbe(n.type)){if(f==="step"&&r==="step")ei(CO()),n.type="pad";else if(f==="step"||r==="step"){const a=f==="step"?"width":"height";ei(CO(N3(a)));const l=a==="width"?"height":"width";n.type=Kbe(l)}}return{...Zr(n).length===1&&n.type?n.type==="pad"?{}:{autosize:n.type}:{autosize:n},...rP(t,!1),...rP(e,!0)}}function a4e(e,n,t={},o){const f=e.config?lbe(e.config):void 0,r=[].concat(e.assembleSelectionData([]),r5e(e.component.data,t)),a=e.assembleProjections(),l=e.assembleTitle(),c=e.assembleGroupStyle(),i=e.assembleGroupEncodeEntry(!0);let s=e.assembleLayoutSignals();s=s.filter(d=>(d.name==="width"||d.name==="height")&&d.value!==void 0?(n[d.name]=+d.value,!1):!0);const{params:u,...h}=n;return{$schema:"https://vega.github.io/schema/vega/v5.json",...e.description?{description:e.description}:{},...h,...l?{title:l}:{},...c?{style:c}:{},...i?{encode:{update:i}}:{},data:r,...a.length>0?{projections:a}:{},...e.assembleGroup([...s,...e.assembleSelectionTopLevelSignals([]),...dq(u)]),...f?{config:f}:{},...o?{usermeta:o}:{}}}const o4e=h1e.version,s4e=Object.freeze(Object.defineProperty({__proto__:null,accessPathDepth:qm,accessPathWithDatum:ZS,compile:r4e,contains:ja,deepEqual:Xf,deleteNestedProperty:Z_,duplicate:la,entries:pp,every:WS,fieldIntersection:XS,flatAccessWithDatum:T$,getFirstDefined:zs,hasIntersection:YS,hash:Ba,internalField:S$,isBoolean:Pv,isEmpty:Mo,isEqual:v1e,isInternalField:C$,isNullOrFalse:vT,isNumeric:O3,keys:Zr,logicalExpr:av,mergeDeep:A$,never:w$,normalize:Tq,normalizeAngle:Iv,omit:ju,pick:Vm,prefixGenerator:xT,removePathFromField:JS,replaceAll:V0,replacePathInField:Dc,resetIdCounter:b1e,setEqual:k$,some:$0,stringify:$o,titleCase:Ax,unique:Zf,uniqueId:E$,vals:Dl,varName:es,version:o4e},Symbol.toStringTag,{value:"Module"}));function JH(e){const[n,t]=/schema\/([\w-]+)\/([\w\.\-]+)\.json$/g.exec(e).slice(1,3);return{library:n,version:t}}var l4e="vega-themes",u4e="2.13.0",c4e="Themes for stylized Vega and Vega-Lite visualizations.",f4e=["vega","vega-lite","themes","style"],h4e="BSD-3-Clause",d4e={name:"UW Interactive Data Lab",url:"https://idl.cs.washington.edu"},p4e=[{name:"Emily Gu",url:"https://github.com/emilygu"},{name:"Arvind Satyanarayan",url:"http://arvindsatya.com"},{name:"Jeffrey Heer",url:"https://idl.cs.washington.edu"},{name:"Dominik Moritz",url:"https://www.domoritz.de"}],g4e="build/vega-themes.js",m4e="build/vega-themes.module.js",y4e="build/vega-themes.min.js",v4e="build/vega-themes.min.js",x4e="build/vega-themes.module.d.ts",b4e={type:"git",url:"https://github.com/vega/vega-themes.git"},_4e=["src","build"],w4e={prebuild:"yarn clean",build:"rollup -c",clean:"rimraf build && rimraf examples/build","copy:data":"rsync -r node_modules/vega-datasets/data/* examples/data","copy:build":"rsync -r build/* examples/build","deploy:gh":"yarn build && mkdir -p examples/build && rsync -r build/* examples/build && gh-pages -d examples",preversion:"yarn lint",serve:"browser-sync start -s -f build examples --serveStatic examples",start:"yarn build && concurrently --kill-others -n Server,Rollup 'yarn serve' 'rollup -c -w'",format:"eslint . --fix",lint:"eslint .",release:"release-it"},A4e={"@babel/core":"^7.21.4","@babel/plugin-transform-runtime":"^7.21.4","@babel/preset-env":"^7.21.4","@babel/preset-typescript":"^7.21.4","@release-it/conventional-changelog":"^5.1.1","@rollup/plugin-json":"^6.0.0","@rollup/plugin-node-resolve":"^15.0.2","@rollup/plugin-terser":"^0.4.1","@typescript-eslint/eslint-plugin":"^5.59.0","@typescript-eslint/parser":"^5.59.0","browser-sync":"^2.29.1",concurrently:"^8.0.1",eslint:"^8.38.0","eslint-config-prettier":"^8.8.0","eslint-plugin-prettier":"^4.2.1","gh-pages":"^5.0.0",prettier:"^2.8.7","release-it":"^15.10.1",rollup:"^3.20.6","rollup-plugin-bundle-size":"^1.0.3","rollup-plugin-ts":"^3.2.0",typescript:"^5.0.4",vega:"^5.24.0","vega-lite":"^5.7.1"},k4e={vega:"*","vega-lite":"*"},T4e={},M4e={name:l4e,version:u4e,description:c4e,keywords:f4e,license:h4e,author:d4e,contributors:p4e,main:g4e,module:m4e,unpkg:y4e,jsdelivr:v4e,types:x4e,repository:b4e,files:_4e,scripts:w4e,devDependencies:A4e,peerDependencies:k4e,dependencies:T4e};const nm="#fff",BP="#888",E4e={background:"#333",view:{stroke:BP},title:{color:nm,subtitleColor:nm},style:{"guide-label":{fill:nm},"guide-title":{fill:nm}},axis:{domainColor:nm,gridColor:BP,tickColor:nm}},Jp="#4572a7",S4e={background:"#fff",arc:{fill:Jp},area:{fill:Jp},line:{stroke:Jp,strokeWidth:2},path:{stroke:Jp},rect:{fill:Jp},shape:{stroke:Jp},symbol:{fill:Jp,strokeWidth:1.5,size:50},axis:{bandPosition:.5,grid:!0,gridColor:"#000000",gridOpacity:1,gridWidth:.5,labelPadding:10,tickSize:5,tickWidth:.5},axisBand:{grid:!1,tickExtra:!0},legend:{labelBaseline:"middle",labelFontSize:11,symbolSize:50,symbolType:"square"},range:{category:["#4572a7","#aa4643","#8aa453","#71598e","#4598ae","#d98445","#94aace","#d09393","#b9cc98","#a99cbc"]}},Kp="#30a2da",kA="#cbcbcb",C4e="#999",L4e="#333",jP="#f0f0f0",UP="#333",D4e={arc:{fill:Kp},area:{fill:Kp},axis:{domainColor:kA,grid:!0,gridColor:kA,gridWidth:1,labelColor:C4e,labelFontSize:10,titleColor:L4e,tickColor:kA,tickSize:10,titleFontSize:14,titlePadding:10,labelPadding:4},axisBand:{grid:!1},background:jP,group:{fill:jP},legend:{labelColor:UP,labelFontSize:11,padding:1,symbolSize:30,symbolType:"square",titleColor:UP,titleFontSize:14,titlePadding:10},line:{stroke:Kp,strokeWidth:2},path:{stroke:Kp,strokeWidth:.5},rect:{fill:Kp},range:{category:["#30a2da","#fc4f30","#e5ae38","#6d904f","#8b8b8b","#b96db8","#ff9e27","#56cc60","#52d2ca","#52689e","#545454","#9fe4f8"],diverging:["#cc0020","#e77866","#f6e7e1","#d6e8ed","#91bfd9","#1d78b5"],heatmap:["#d6e8ed","#cee0e5","#91bfd9","#549cc6","#1d78b5"]},point:{filled:!0,shape:"circle"},shape:{stroke:Kp},bar:{binSpacing:2,fill:Kp,stroke:null},title:{anchor:"start",fontSize:24,fontWeight:600,offset:20}},Qp="#000",O4e={group:{fill:"#e5e5e5"},arc:{fill:Qp},area:{fill:Qp},line:{stroke:Qp},path:{stroke:Qp},rect:{fill:Qp},shape:{stroke:Qp},symbol:{fill:Qp,size:40},axis:{domain:!1,grid:!0,gridColor:"#FFFFFF",gridOpacity:1,labelColor:"#7F7F7F",labelPadding:4,tickColor:"#7F7F7F",tickSize:5.67,titleFontSize:16,titleFontWeight:"normal"},legend:{labelBaseline:"middle",labelFontSize:11,symbolSize:40},range:{category:["#000000","#7F7F7F","#1A1A1A","#999999","#333333","#B0B0B0","#4D4D4D","#C9C9C9","#666666","#DCDCDC"]}},P4e=22,I4e="normal",$P="Benton Gothic, sans-serif",VP=11.5,F4e="normal",e0="#82c6df",TA="Benton Gothic Bold, sans-serif",qP="normal",HP=13,vy={"category-6":["#ec8431","#829eb1","#c89d29","#3580b1","#adc839","#ab7fb4"],"fire-7":["#fbf2c7","#f9e39c","#f8d36e","#f4bb6a","#e68a4f","#d15a40","#ab4232"],"fireandice-6":["#e68a4f","#f4bb6a","#f9e39c","#dadfe2","#a6b7c6","#849eae"],"ice-7":["#edefee","#dadfe2","#c4ccd2","#a6b7c6","#849eae","#607785","#47525d"]},R4e={background:"#ffffff",title:{anchor:"start",color:"#000000",font:TA,fontSize:P4e,fontWeight:I4e},arc:{fill:e0},area:{fill:e0},line:{stroke:e0,strokeWidth:2},path:{stroke:e0},rect:{fill:e0},shape:{stroke:e0},symbol:{fill:e0,size:30},axis:{labelFont:$P,labelFontSize:VP,labelFontWeight:F4e,titleFont:TA,titleFontSize:HP,titleFontWeight:qP},axisX:{labelAngle:0,labelPadding:4,tickSize:3},axisY:{labelBaseline:"middle",maxExtent:45,minExtent:45,tickSize:2,titleAlign:"left",titleAngle:0,titleX:-45,titleY:-11},legend:{labelFont:$P,labelFontSize:VP,symbolType:"square",titleFont:TA,titleFontSize:HP,titleFontWeight:qP},range:{category:vy["category-6"],diverging:vy["fireandice-6"],heatmap:vy["fire-7"],ordinal:vy["fire-7"],ramp:vy["fire-7"]}},t0="#ab5787",n2="#979797",z4e={background:"#f9f9f9",arc:{fill:t0},area:{fill:t0},line:{stroke:t0},path:{stroke:t0},rect:{fill:t0},shape:{stroke:t0},symbol:{fill:t0,size:30},axis:{domainColor:n2,domainWidth:.5,gridWidth:.2,labelColor:n2,tickColor:n2,tickWidth:.2,titleColor:n2},axisBand:{grid:!1},axisX:{grid:!0,tickSize:10},axisY:{domain:!1,grid:!0,tickSize:0},legend:{labelFontSize:11,padding:1,symbolSize:30,symbolType:"square"},range:{category:["#ab5787","#51b2e5","#703c5c","#168dd9","#d190b6","#00609f","#d365ba","#154866","#666666","#c4c4c4"]}},n0="#3e5c69",N4e={background:"#fff",arc:{fill:n0},area:{fill:n0},line:{stroke:n0},path:{stroke:n0},rect:{fill:n0},shape:{stroke:n0},symbol:{fill:n0},axis:{domainWidth:.5,grid:!0,labelPadding:2,tickSize:5,tickWidth:.5,titleFontWeight:"normal"},axisBand:{grid:!1},axisX:{gridWidth:.2},axisY:{gridDash:[3],gridWidth:.4},legend:{labelFontSize:11,padding:1,symbolType:"square"},range:{category:["#3e5c69","#6793a6","#182429","#0570b0","#3690c0","#74a9cf","#a6bddb","#e2ddf2"]}},_c="#1696d2",GP="#000000",B4e="#FFFFFF",r2="Lato",MA="Lato",j4e="Lato",U4e="#DEDDDD",$4e=18,xy={"main-colors":["#1696d2","#d2d2d2","#000000","#fdbf11","#ec008b","#55b748","#5c5859","#db2b27"],"shades-blue":["#CFE8F3","#A2D4EC","#73BFE2","#46ABDB","#1696D2","#12719E","#0A4C6A","#062635"],"shades-gray":["#F5F5F5","#ECECEC","#E3E3E3","#DCDBDB","#D2D2D2","#9D9D9D","#696969","#353535"],"shades-yellow":["#FFF2CF","#FCE39E","#FDD870","#FCCB41","#FDBF11","#E88E2D","#CA5800","#843215"],"shades-magenta":["#F5CBDF","#EB99C2","#E46AA7","#E54096","#EC008B","#AF1F6B","#761548","#351123"],"shades-green":["#DCEDD9","#BCDEB4","#98CF90","#78C26D","#55B748","#408941","#2C5C2D","#1A2E19"],"shades-black":["#D5D5D4","#ADABAC","#848081","#5C5859","#332D2F","#262223","#1A1717","#0E0C0D"],"shades-red":["#F8D5D4","#F1AAA9","#E9807D","#E25552","#DB2B27","#A4201D","#6E1614","#370B0A"],"one-group":["#1696d2","#000000"],"two-groups-cat-1":["#1696d2","#000000"],"two-groups-cat-2":["#1696d2","#fdbf11"],"two-groups-cat-3":["#1696d2","#db2b27"],"two-groups-seq":["#a2d4ec","#1696d2"],"three-groups-cat":["#1696d2","#fdbf11","#000000"],"three-groups-seq":["#a2d4ec","#1696d2","#0a4c6a"],"four-groups-cat-1":["#000000","#d2d2d2","#fdbf11","#1696d2"],"four-groups-cat-2":["#1696d2","#ec0008b","#fdbf11","#5c5859"],"four-groups-seq":["#cfe8f3","#73bf42","#1696d2","#0a4c6a"],"five-groups-cat-1":["#1696d2","#fdbf11","#d2d2d2","#ec008b","#000000"],"five-groups-cat-2":["#1696d2","#0a4c6a","#d2d2d2","#fdbf11","#332d2f"],"five-groups-seq":["#cfe8f3","#73bf42","#1696d2","#0a4c6a","#000000"],"six-groups-cat-1":["#1696d2","#ec008b","#fdbf11","#000000","#d2d2d2","#55b748"],"six-groups-cat-2":["#1696d2","#d2d2d2","#ec008b","#fdbf11","#332d2f","#0a4c6a"],"six-groups-seq":["#cfe8f3","#a2d4ec","#73bfe2","#46abdb","#1696d2","#12719e"],"diverging-colors":["#ca5800","#fdbf11","#fdd870","#fff2cf","#cfe8f3","#73bfe2","#1696d2","#0a4c6a"]},V4e={background:B4e,title:{anchor:"start",fontSize:$4e,font:r2},axisX:{domain:!0,domainColor:GP,domainWidth:1,grid:!1,labelFontSize:12,labelFont:MA,labelAngle:0,tickColor:GP,tickSize:5,titleFontSize:12,titlePadding:10,titleFont:r2},axisY:{domain:!1,domainWidth:1,grid:!0,gridColor:U4e,gridWidth:1,labelFontSize:12,labelFont:MA,labelPadding:8,ticks:!1,titleFontSize:12,titlePadding:10,titleFont:r2,titleAngle:0,titleY:-10,titleX:18},legend:{labelFontSize:12,labelFont:MA,symbolSize:100,titleFontSize:12,titlePadding:10,titleFont:r2,orient:"right",offset:10},view:{stroke:"transparent"},range:{category:xy["six-groups-cat-1"],diverging:xy["diverging-colors"],heatmap:xy["diverging-colors"],ordinal:xy["six-groups-seq"],ramp:xy["shades-blue"]},area:{fill:_c},rect:{fill:_c},line:{color:_c,stroke:_c,strokeWidth:5},trail:{color:_c,stroke:_c,strokeWidth:0,size:1},path:{stroke:_c,strokeWidth:.5},point:{filled:!0},text:{font:j4e,color:_c,fontSize:11,align:"center",fontWeight:400,size:11},style:{bar:{fill:_c,stroke:null}},arc:{fill:_c},shape:{stroke:_c},symbol:{fill:_c,size:30}},r0="#3366CC",WP="#ccc",i2="Arial, sans-serif",q4e={arc:{fill:r0},area:{fill:r0},path:{stroke:r0},rect:{fill:r0},shape:{stroke:r0},symbol:{stroke:r0},circle:{fill:r0},background:"#fff",padding:{top:10,right:10,bottom:10,left:10},style:{"guide-label":{font:i2,fontSize:12},"guide-title":{font:i2,fontSize:12},"group-title":{font:i2,fontSize:12}},title:{font:i2,fontSize:14,fontWeight:"bold",dy:-3,anchor:"start"},axis:{gridColor:WP,tickColor:WP,domain:!1,grid:!0},range:{category:["#4285F4","#DB4437","#F4B400","#0F9D58","#AB47BC","#00ACC1","#FF7043","#9E9D24","#5C6BC0","#F06292","#00796B","#C2185B"],heatmap:["#c6dafc","#5e97f6","#2a56c6"]}},xC=e=>e*(1/3+1),YP=xC(9),XP=xC(10),ZP=xC(12),by="Segoe UI",JP="wf_standard-font, helvetica, arial, sans-serif",KP="#252423",_y="#605E5C",QP="transparent",H4e="#C8C6C4",Qc="#118DFF",G4e="#12239E",W4e="#E66C37",Y4e="#6B007B",X4e="#E044A7",Z4e="#744EC2",J4e="#D9B300",K4e="#D64550",KH=Qc,QH="#DEEFFF",eI=[QH,KH],Q4e=[QH,"#c7e4ff","#b0d9ff","#9aceff","#83c3ff","#6cb9ff","#55aeff","#3fa3ff","#2898ff",KH],eAe={view:{stroke:QP},background:QP,font:by,header:{titleFont:JP,titleFontSize:ZP,titleColor:KP,labelFont:by,labelFontSize:XP,labelColor:_y},axis:{ticks:!1,grid:!1,domain:!1,labelColor:_y,labelFontSize:YP,titleFont:JP,titleColor:KP,titleFontSize:ZP,titleFontWeight:"normal"},axisQuantitative:{tickCount:3,grid:!0,gridColor:H4e,gridDash:[1,5],labelFlush:!1},axisBand:{tickExtra:!0},axisX:{labelPadding:5},axisY:{labelPadding:10},bar:{fill:Qc},line:{stroke:Qc,strokeWidth:3,strokeCap:"round",strokeJoin:"round"},text:{font:by,fontSize:YP,fill:_y},arc:{fill:Qc},area:{fill:Qc,line:!0,opacity:.6},path:{stroke:Qc},rect:{fill:Qc},point:{fill:Qc,filled:!0,size:75},shape:{stroke:Qc},symbol:{fill:Qc,strokeWidth:1.5,size:50},legend:{titleFont:by,titleFontWeight:"bold",titleColor:_y,labelFont:by,labelFontSize:XP,labelColor:_y,symbolType:"circle",symbolSize:75},range:{category:[Qc,G4e,W4e,Y4e,X4e,Z4e,J4e,K4e],diverging:eI,heatmap:eI,ordinal:Q4e}},tAe=M4e.version,nAe=Object.freeze(Object.defineProperty({__proto__:null,dark:E4e,excel:S4e,fivethirtyeight:D4e,ggplot2:O4e,googlecharts:q4e,latimes:R4e,powerbi:eAe,quartz:z4e,urbaninstitute:V4e,version:tAe,vox:N4e},Symbol.toStringTag,{value:"Module"}));function Uv(e){return Uv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Uv(e)}function rAe(e,n){if(Uv(e)!=="object"||e===null)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var o=t.call(e,n||"default");if(Uv(o)!=="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function iAe(e){var n=rAe(e,"string");return Uv(n)==="symbol"?n:String(n)}function aAe(e,n,t){return n=iAe(n),n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function oAe(e,n){if(e==null)return{};var t={},o=Object.keys(e),f,r;for(r=0;r=0)&&(t[f]=e[f]);return t}function sAe(e,n){if(e==null)return{};var t=oAe(e,n),o,f;if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(f=0;f=0)&&Object.prototype.propertyIsEnumerable.call(e,o)&&(t[o]=e[o])}return t}const lAe=["title","image"];function uAe(e,n,t){if(zr(e))return`[${e.map(o=>n(Li(o)?o:tI(o,t))).join(", ")}]`;if(Si(e)){let o="";const f=e,{title:r,image:a}=f,l=sAe(f,lAe);r&&(o+=`

    ${n(r)}

    `),a&&(o+=``);const c=Object.keys(l);if(c.length>0){o+="";for(const i of c){let s=l[i];s!==void 0&&(Si(s)&&(s=tI(s,t)),o+=``)}o+="
    ${n(i)}:${n(s)}
    "}return o||"{}"}return n(e)}function cAe(e){const n=[];return function(t,o){if(typeof o!="object"||o===null)return o;const f=n.indexOf(this)+1;return n.length=f,n.length>e?"[Object]":n.indexOf(o)>=0?"[Circular]":(n.push(o),o)}}function tI(e,n){return JSON.stringify(e,cAe(n))}var fAe=`#vg-tooltip-element { - visibility: hidden; - padding: 8px; - position: fixed; - z-index: 1000; - font-family: sans-serif; - font-size: 11px; - border-radius: 3px; - box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1); - /* The default theme is the light theme. */ - background-color: rgba(255, 255, 255, 0.95); - border: 1px solid #d9d9d9; - color: black; -} -#vg-tooltip-element.visible { - visibility: visible; -} -#vg-tooltip-element h2 { - margin-top: 0; - margin-bottom: 10px; - font-size: 13px; -} -#vg-tooltip-element table { - border-spacing: 0; -} -#vg-tooltip-element table tr { - border: none; -} -#vg-tooltip-element table tr td { - overflow: hidden; - text-overflow: ellipsis; - padding-top: 2px; - padding-bottom: 2px; -} -#vg-tooltip-element table tr td.key { - color: #808080; - max-width: 150px; - text-align: right; - padding-right: 4px; -} -#vg-tooltip-element table tr td.value { - display: block; - max-width: 300px; - max-height: 7em; - text-align: left; -} -#vg-tooltip-element.dark-theme { - background-color: rgba(32, 32, 32, 0.9); - border: 1px solid #f5f5f5; - color: white; -} -#vg-tooltip-element.dark-theme td.key { - color: #bfbfbf; -} -`;const eG="vg-tooltip-element",hAe={offsetX:10,offsetY:10,id:eG,styleId:"vega-tooltip-style",theme:"light",disableDefaultStyle:!1,sanitize:dAe,maxDepth:2,formatTooltip:uAe};function dAe(e){return String(e).replace(/&/g,"&").replace(/window.innerWidth&&(f=+e.clientX-t-n.width);let r=e.clientY+o;return r+n.height>window.innerHeight&&(r=+e.clientY-o-n.height),{x:f,y:r}}function nI(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter(function(f){return Object.getOwnPropertyDescriptor(e,f).enumerable})),t.push.apply(t,o)}return t}function rI(e){for(var n=1;n0?f.insertBefore(o,f.childNodes[0]):f.appendChild(o)}}tooltipHandler(n,t,o,f){if(this.el=document.getElementById(this.options.id),this.el||(this.el=document.createElement("div"),this.el.setAttribute("id",this.options.id),this.el.classList.add("vg-tooltip"),(document.fullscreenElement??document.body).appendChild(this.el)),f==null||f===""){this.el.classList.remove("visible",`${this.options.theme}-theme`);return}this.el.innerHTML=this.options.formatTooltip(f,this.options.sanitize,this.options.maxDepth),this.el.classList.add("visible",`${this.options.theme}-theme`);const{x:r,y:a}=gAe(t,this.el.getBoundingClientRect(),this.options.offsetX,this.options.offsetY);this.el.style.top=`${a}px`,this.el.style.left=`${r}px`}}function $v(e){return $v=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},$v(e)}function yAe(e,n){if($v(e)!=="object"||e===null)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var o=t.call(e,n||"default");if($v(o)!=="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function vAe(e){var n=yAe(e,"string");return $v(n)==="symbol"?n:String(n)}function xAe(e,n,t){return n=vAe(n),n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function bAe(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var EA,iI;function _Ae(){return iI||(iI=1,EA=function(e){e.prototype[Symbol.iterator]=function*(){for(let n=this.head;n;n=n.next)yield n.value}}),EA}var wAe=Qa;Qa.Node=eg;Qa.create=Qa;function Qa(e){var n=this;if(n instanceof Qa||(n=new Qa),n.tail=null,n.head=null,n.length=0,e&&typeof e.forEach=="function")e.forEach(function(f){n.push(f)});else if(arguments.length>0)for(var t=0,o=arguments.length;t1)t=n;else if(this.head)o=this.head.next,t=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var f=0;o!==null;f++)t=e(t,o.value,f),o=o.next;return t};Qa.prototype.reduceReverse=function(e,n){var t,o=this.tail;if(arguments.length>1)t=n;else if(this.tail)o=this.tail.prev,t=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var f=this.length-1;o!==null;f--)t=e(t,o.value,f),o=o.prev;return t};Qa.prototype.toArray=function(){for(var e=new Array(this.length),n=0,t=this.head;t!==null;n++)e[n]=t.value,t=t.next;return e};Qa.prototype.toArrayReverse=function(){for(var e=new Array(this.length),n=0,t=this.tail;t!==null;n++)e[n]=t.value,t=t.prev;return e};Qa.prototype.slice=function(e,n){n=n||this.length,n<0&&(n+=this.length),e=e||0,e<0&&(e+=this.length);var t=new Qa;if(nthis.length&&(n=this.length);for(var o=0,f=this.head;f!==null&&othis.length&&(n=this.length);for(var o=this.length,f=this.tail;f!==null&&o>n;o--)f=f.prev;for(;f!==null&&o>e;o--,f=f.prev)t.push(f.value);return t};Qa.prototype.splice=function(e,n,...t){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var o=0,f=this.head;f!==null&&o1;class EAe{constructor(n){if(typeof n=="number"&&(n={max:n}),n||(n={}),n.max&&(typeof n.max!="number"||n.max<0))throw new TypeError("max must be a non-negative number");this[g0]=n.max||1/0;const t=n.length||SA;if(this[rm]=typeof t!="function"?SA:t,this[cv]=n.stale||!1,n.maxAge&&typeof n.maxAge!="number")throw new TypeError("maxAge must be a number");this[x0]=n.maxAge||0,this[zh]=n.dispose,this[aI]=n.noDisposeOnSet||!1,this[tG]=n.updateAgeOnGet||!1,this.reset()}set max(n){if(typeof n!="number"||n<0)throw new TypeError("max must be a non-negative number");this[g0]=n||1/0,wy(this)}get max(){return this[g0]}set allowStale(n){this[cv]=!!n}get allowStale(){return this[cv]}set maxAge(n){if(typeof n!="number")throw new TypeError("maxAge must be a non-negative number");this[x0]=n,wy(this)}get maxAge(){return this[x0]}set lengthCalculator(n){typeof n!="function"&&(n=SA),n!==this[rm]&&(this[rm]=n,this[$h]=0,this[ol].forEach(t=>{t.length=this[rm](t.value,t.key),this[$h]+=t.length})),wy(this)}get lengthCalculator(){return this[rm]}get length(){return this[$h]}get itemCount(){return this[ol].length}rforEach(n,t){t=t||this;for(let o=this[ol].tail;o!==null;){const f=o.prev;oI(this,n,o,t),o=f}}forEach(n,t){t=t||this;for(let o=this[ol].head;o!==null;){const f=o.next;oI(this,n,o,t),o=f}}keys(){return this[ol].toArray().map(n=>n.key)}values(){return this[ol].toArray().map(n=>n.value)}reset(){this[zh]&&this[ol]&&this[ol].length&&this[ol].forEach(n=>this[zh](n.key,n.value)),this[ef]=new Map,this[ol]=new MAe,this[$h]=0}dump(){return this[ol].map(n=>gw(this,n)?!1:{k:n.key,v:n.value,e:n.now+(n.maxAge||0)}).toArray().filter(n=>n)}dumpLru(){return this[ol]}set(n,t,o){if(o=o||this[x0],o&&typeof o!="number")throw new TypeError("maxAge must be a number");const f=o?Date.now():0,r=this[rm](t,n);if(this[ef].has(n)){if(r>this[g0])return km(this,this[ef].get(n)),!1;const c=this[ef].get(n).value;return this[zh]&&(this[aI]||this[zh](n,c.value)),c.now=f,c.maxAge=o,c.value=t,this[$h]+=r-c.length,c.length=r,this.get(n),wy(this),!0}const a=new SAe(n,t,r,f,o);return a.length>this[g0]?(this[zh]&&this[zh](n,t),!1):(this[$h]+=a.length,this[ol].unshift(a),this[ef].set(n,this[ol].head),wy(this),!0)}has(n){if(!this[ef].has(n))return!1;const t=this[ef].get(n).value;return!gw(this,t)}get(n){return CA(this,n,!0)}peek(n){return CA(this,n,!1)}pop(){const n=this[ol].tail;return n?(km(this,n),n.value):null}del(n){km(this,this[ef].get(n))}load(n){this.reset();const t=Date.now();for(let o=n.length-1;o>=0;o--){const f=n[o],r=f.e||0;if(r===0)this.set(f.k,f.v);else{const a=r-t;a>0&&this.set(f.k,f.v,a)}}}prune(){this[ef].forEach((n,t)=>CA(this,t,!1))}}const CA=(e,n,t)=>{const o=e[ef].get(n);if(o){const f=o.value;if(gw(e,f)){if(km(e,o),!e[cv])return}else t&&(e[tG]&&(o.value.now=Date.now()),e[ol].unshiftNode(o));return f.value}},gw=(e,n)=>{if(!n||!n.maxAge&&!e[x0])return!1;const t=Date.now()-n.now;return n.maxAge?t>n.maxAge:e[x0]&&t>e[x0]},wy=e=>{if(e[$h]>e[g0])for(let n=e[ol].tail;e[$h]>e[g0]&&n!==null;){const t=n.prev;km(e,n),n=t}},km=(e,n)=>{if(n){const t=n.value;e[zh]&&e[zh](t.key,t.value),e[$h]-=t.length,e[ef].delete(t.key),e[ol].removeNode(n)}};class SAe{constructor(n,t,o,f,r){this.key=n,this.value=t,this.length=o,this.now=f,this.maxAge=r||0}}const oI=(e,n,t,o)=>{let f=t.value;gw(e,f)&&(km(e,t),e[cv]||(f=void 0)),f&&n.call(o,f.value,f.key,e)};var CAe=EAe;const LAe=Object.freeze({loose:!0}),DAe=Object.freeze({}),OAe=e=>e?typeof e!="object"?LAe:e:DAe;var bC=OAe,HT={exports:{}};const PAe="2.0.0",IAe=256,FAe=Number.MAX_SAFE_INTEGER||9007199254740991,RAe=16,zAe=["major","premajor","minor","preminor","patch","prepatch","prerelease"];var _C={MAX_LENGTH:IAe,MAX_SAFE_COMPONENT_LENGTH:RAe,MAX_SAFE_INTEGER:FAe,RELEASE_TYPES:zAe,SEMVER_SPEC_VERSION:PAe,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2};const NAe=typeof process=="object"&&process.env&&{}.NODE_DEBUG&&/\bsemver\b/i.test({}.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};var A5=NAe;(function(e,n){const{MAX_SAFE_COMPONENT_LENGTH:t}=_C,o=A5;n=e.exports={};const f=n.re=[],r=n.src=[],a=n.t={};let l=0;const c=(i,s,u)=>{const h=l++;o(i,h,s),a[i]=h,r[h]=s,f[h]=new RegExp(s,u?"g":void 0)};c("NUMERICIDENTIFIER","0|[1-9]\\d*"),c("NUMERICIDENTIFIERLOOSE","[0-9]+"),c("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*"),c("MAINVERSION",`(${r[a.NUMERICIDENTIFIER]})\\.(${r[a.NUMERICIDENTIFIER]})\\.(${r[a.NUMERICIDENTIFIER]})`),c("MAINVERSIONLOOSE",`(${r[a.NUMERICIDENTIFIERLOOSE]})\\.(${r[a.NUMERICIDENTIFIERLOOSE]})\\.(${r[a.NUMERICIDENTIFIERLOOSE]})`),c("PRERELEASEIDENTIFIER",`(?:${r[a.NUMERICIDENTIFIER]}|${r[a.NONNUMERICIDENTIFIER]})`),c("PRERELEASEIDENTIFIERLOOSE",`(?:${r[a.NUMERICIDENTIFIERLOOSE]}|${r[a.NONNUMERICIDENTIFIER]})`),c("PRERELEASE",`(?:-(${r[a.PRERELEASEIDENTIFIER]}(?:\\.${r[a.PRERELEASEIDENTIFIER]})*))`),c("PRERELEASELOOSE",`(?:-?(${r[a.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${r[a.PRERELEASEIDENTIFIERLOOSE]})*))`),c("BUILDIDENTIFIER","[0-9A-Za-z-]+"),c("BUILD",`(?:\\+(${r[a.BUILDIDENTIFIER]}(?:\\.${r[a.BUILDIDENTIFIER]})*))`),c("FULLPLAIN",`v?${r[a.MAINVERSION]}${r[a.PRERELEASE]}?${r[a.BUILD]}?`),c("FULL",`^${r[a.FULLPLAIN]}$`),c("LOOSEPLAIN",`[v=\\s]*${r[a.MAINVERSIONLOOSE]}${r[a.PRERELEASELOOSE]}?${r[a.BUILD]}?`),c("LOOSE",`^${r[a.LOOSEPLAIN]}$`),c("GTLT","((?:<|>)?=?)"),c("XRANGEIDENTIFIERLOOSE",`${r[a.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),c("XRANGEIDENTIFIER",`${r[a.NUMERICIDENTIFIER]}|x|X|\\*`),c("XRANGEPLAIN",`[v=\\s]*(${r[a.XRANGEIDENTIFIER]})(?:\\.(${r[a.XRANGEIDENTIFIER]})(?:\\.(${r[a.XRANGEIDENTIFIER]})(?:${r[a.PRERELEASE]})?${r[a.BUILD]}?)?)?`),c("XRANGEPLAINLOOSE",`[v=\\s]*(${r[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${r[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${r[a.XRANGEIDENTIFIERLOOSE]})(?:${r[a.PRERELEASELOOSE]})?${r[a.BUILD]}?)?)?`),c("XRANGE",`^${r[a.GTLT]}\\s*${r[a.XRANGEPLAIN]}$`),c("XRANGELOOSE",`^${r[a.GTLT]}\\s*${r[a.XRANGEPLAINLOOSE]}$`),c("COERCE",`(^|[^\\d])(\\d{1,${t}})(?:\\.(\\d{1,${t}}))?(?:\\.(\\d{1,${t}}))?(?:$|[^\\d])`),c("COERCERTL",r[a.COERCE],!0),c("LONETILDE","(?:~>?)"),c("TILDETRIM",`(\\s*)${r[a.LONETILDE]}\\s+`,!0),n.tildeTrimReplace="$1~",c("TILDE",`^${r[a.LONETILDE]}${r[a.XRANGEPLAIN]}$`),c("TILDELOOSE",`^${r[a.LONETILDE]}${r[a.XRANGEPLAINLOOSE]}$`),c("LONECARET","(?:\\^)"),c("CARETTRIM",`(\\s*)${r[a.LONECARET]}\\s+`,!0),n.caretTrimReplace="$1^",c("CARET",`^${r[a.LONECARET]}${r[a.XRANGEPLAIN]}$`),c("CARETLOOSE",`^${r[a.LONECARET]}${r[a.XRANGEPLAINLOOSE]}$`),c("COMPARATORLOOSE",`^${r[a.GTLT]}\\s*(${r[a.LOOSEPLAIN]})$|^$`),c("COMPARATOR",`^${r[a.GTLT]}\\s*(${r[a.FULLPLAIN]})$|^$`),c("COMPARATORTRIM",`(\\s*)${r[a.GTLT]}\\s*(${r[a.LOOSEPLAIN]}|${r[a.XRANGEPLAIN]})`,!0),n.comparatorTrimReplace="$1$2$3",c("HYPHENRANGE",`^\\s*(${r[a.XRANGEPLAIN]})\\s+-\\s+(${r[a.XRANGEPLAIN]})\\s*$`),c("HYPHENRANGELOOSE",`^\\s*(${r[a.XRANGEPLAINLOOSE]})\\s+-\\s+(${r[a.XRANGEPLAINLOOSE]})\\s*$`),c("STAR","(<|>)?=?\\s*\\*"),c("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),c("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(HT,HT.exports);var wC=HT.exports;const sI=/^[0-9]+$/,nG=(e,n)=>{const t=sI.test(e),o=sI.test(n);return t&&o&&(e=+e,n=+n),e===n?0:t&&!o?-1:o&&!t?1:enG(n,e);var jAe={compareIdentifiers:nG,rcompareIdentifiers:BAe};const a2=A5,{MAX_LENGTH:lI,MAX_SAFE_INTEGER:o2}=_C,{re:uI,t:cI}=wC,UAe=bC,{compareIdentifiers:im}=jAe;let $Ae=class $f{constructor(n,t){if(t=UAe(t),n instanceof $f){if(n.loose===!!t.loose&&n.includePrerelease===!!t.includePrerelease)return n;n=n.version}else if(typeof n!="string")throw new TypeError(`Invalid Version: ${n}`);if(n.length>lI)throw new TypeError(`version is longer than ${lI} characters`);a2("SemVer",n,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;const o=n.trim().match(t.loose?uI[cI.LOOSE]:uI[cI.FULL]);if(!o)throw new TypeError(`Invalid Version: ${n}`);if(this.raw=n,this.major=+o[1],this.minor=+o[2],this.patch=+o[3],this.major>o2||this.major<0)throw new TypeError("Invalid major version");if(this.minor>o2||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>o2||this.patch<0)throw new TypeError("Invalid patch version");o[4]?this.prerelease=o[4].split(".").map(f=>{if(/^[0-9]+$/.test(f)){const r=+f;if(r>=0&&r=0;)typeof this.prerelease[f]=="number"&&(this.prerelease[f]++,f=-2);f===-1&&this.prerelease.push(0)}if(t){const f=Number(o)?1:0;im(this.prerelease[0],t)===0?isNaN(this.prerelease[1])&&(this.prerelease=[t,f]):this.prerelease=[t,f]}break;default:throw new Error(`invalid increment argument: ${n}`)}return this.format(),this.raw=this.version,this}};var AC=$Ae;const fI=AC,VAe=(e,n,t)=>new fI(e,t).compare(new fI(n,t));var S1=VAe;const qAe=S1,HAe=(e,n,t)=>qAe(e,n,t)===0;var GAe=HAe;const WAe=S1,YAe=(e,n,t)=>WAe(e,n,t)!==0;var XAe=YAe;const ZAe=S1,JAe=(e,n,t)=>ZAe(e,n,t)>0;var KAe=JAe;const QAe=S1,eke=(e,n,t)=>QAe(e,n,t)>=0;var tke=eke;const nke=S1,rke=(e,n,t)=>nke(e,n,t)<0;var ike=rke;const ake=S1,oke=(e,n,t)=>ake(e,n,t)<=0;var ske=oke;const lke=GAe,uke=XAe,cke=KAe,fke=tke,hke=ike,dke=ske,pke=(e,n,t,o)=>{switch(n){case"===":return typeof e=="object"&&(e=e.version),typeof t=="object"&&(t=t.version),e===t;case"!==":return typeof e=="object"&&(e=e.version),typeof t=="object"&&(t=t.version),e!==t;case"":case"=":case"==":return lke(e,t,o);case"!=":return uke(e,t,o);case">":return cke(e,t,o);case">=":return fke(e,t,o);case"<":return hke(e,t,o);case"<=":return dke(e,t,o);default:throw new TypeError(`Invalid operator: ${n}`)}};var gke=pke,LA,hI;function mke(){if(hI)return LA;hI=1;const e=Symbol("SemVer ANY");class n{static get ANY(){return e}constructor(s,u){if(u=t(u),s instanceof n){if(s.loose===!!u.loose)return s;s=s.value}a("comparator",s,u),this.options=u,this.loose=!!u.loose,this.parse(s),this.semver===e?this.value="":this.value=this.operator+this.semver.version,a("comp",this)}parse(s){const u=this.options.loose?o[f.COMPARATORLOOSE]:o[f.COMPARATOR],h=s.match(u);if(!h)throw new TypeError(`Invalid comparator: ${s}`);this.operator=h[1]!==void 0?h[1]:"",this.operator==="="&&(this.operator=""),h[2]?this.semver=new l(h[2],this.options.loose):this.semver=e}toString(){return this.value}test(s){if(a("Comparator.test",s,this.options.loose),this.semver===e||s===e)return!0;if(typeof s=="string")try{s=new l(s,this.options)}catch{return!1}return r(s,this.operator,this.semver,this.options)}intersects(s,u){if(!(s instanceof n))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new c(s.value,u).test(this.value):s.operator===""?s.value===""?!0:new c(this.value,u).test(s.semver):(u=t(u),u.includePrerelease&&(this.value==="<0.0.0-0"||s.value==="<0.0.0-0")||!u.includePrerelease&&(this.value.startsWith("<0.0.0")||s.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&s.operator.startsWith(">")||this.operator.startsWith("<")&&s.operator.startsWith("<")||this.semver.version===s.semver.version&&this.operator.includes("=")&&s.operator.includes("=")||r(this.semver,"<",s.semver,u)&&this.operator.startsWith(">")&&s.operator.startsWith("<")||r(this.semver,">",s.semver,u)&&this.operator.startsWith("<")&&s.operator.startsWith(">")))}}LA=n;const t=bC,{re:o,t:f}=wC,r=gke,a=A5,l=AC,c=rG();return LA}var DA,dI;function rG(){if(dI)return DA;dI=1;class e{constructor(L,R){if(R=o(R),L instanceof e)return L.loose===!!R.loose&&L.includePrerelease===!!R.includePrerelease?L:new e(L.raw,R);if(L instanceof f)return this.raw=L.value,this.set=[[L]],this.format(),this;if(this.options=R,this.loose=!!R.loose,this.includePrerelease=!!R.includePrerelease,this.raw=L,this.set=L.split("||").map(F=>this.parseRange(F.trim())).filter(F=>F.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${L}`);if(this.set.length>1){const F=this.set[0];if(this.set=this.set.filter(D=>!m(D[0])),this.set.length===0)this.set=[F];else if(this.set.length>1){for(const D of this.set)if(D.length===1&&p(D[0])){this.set=[D];break}}}this.format()}format(){return this.range=this.set.map(L=>L.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(L){L=L.trim();const F=((this.options.includePrerelease&&h)|(this.options.loose&&d))+":"+L,D=t.get(F);if(D)return D;const O=this.options.loose,N=O?l[c.HYPHENRANGELOOSE]:l[c.HYPHENRANGE];L=L.replace(N,E(this.options.includePrerelease)),r("hyphen replace",L),L=L.replace(l[c.COMPARATORTRIM],i),r("comparator trim",L),L=L.replace(l[c.TILDETRIM],s),L=L.replace(l[c.CARETTRIM],u),L=L.split(/\s+/).join(" ");let B=L.split(" ").map(te=>y(te,this.options)).join(" ").split(/\s+/).map(te=>T(te,this.options));O&&(B=B.filter(te=>(r("loose invalid filter",te,this.options),!!te.match(l[c.COMPARATORLOOSE])))),r("range list",B);const W=new Map,G=B.map(te=>new f(te,this.options));for(const te of G){if(m(te))return[te];W.set(te.value,te)}W.size>1&&W.has("")&&W.delete("");const K=[...W.values()];return t.set(F,K),K}intersects(L,R){if(!(L instanceof e))throw new TypeError("a Range is required");return this.set.some(F=>g(F,R)&&L.set.some(D=>g(D,R)&&F.every(O=>D.every(N=>O.intersects(N,R)))))}test(L){if(!L)return!1;if(typeof L=="string")try{L=new a(L,this.options)}catch{return!1}for(let R=0;RP.value==="<0.0.0-0",p=P=>P.value==="",g=(P,L)=>{let R=!0;const F=P.slice();let D=F.pop();for(;R&&F.length;)R=F.every(O=>D.intersects(O,L)),D=F.pop();return R},y=(P,L)=>(r("comp",P,L),P=A(P,L),r("caret",P),P=x(P,L),r("tildes",P),P=k(P,L),r("xrange",P),P=M(P,L),r("stars",P),P),v=P=>!P||P.toLowerCase()==="x"||P==="*",x=(P,L)=>P.trim().split(/\s+/).map(R=>_(R,L)).join(" "),_=(P,L)=>{const R=L.loose?l[c.TILDELOOSE]:l[c.TILDE];return P.replace(R,(F,D,O,N,B)=>{r("tilde",P,F,D,O,N,B);let W;return v(D)?W="":v(O)?W=`>=${D}.0.0 <${+D+1}.0.0-0`:v(N)?W=`>=${D}.${O}.0 <${D}.${+O+1}.0-0`:B?(r("replaceTilde pr",B),W=`>=${D}.${O}.${N}-${B} <${D}.${+O+1}.0-0`):W=`>=${D}.${O}.${N} <${D}.${+O+1}.0-0`,r("tilde return",W),W})},A=(P,L)=>P.trim().split(/\s+/).map(R=>b(R,L)).join(" "),b=(P,L)=>{r("caret",P,L);const R=L.loose?l[c.CARETLOOSE]:l[c.CARET],F=L.includePrerelease?"-0":"";return P.replace(R,(D,O,N,B,W)=>{r("caret",P,D,O,N,B,W);let G;return v(O)?G="":v(N)?G=`>=${O}.0.0${F} <${+O+1}.0.0-0`:v(B)?O==="0"?G=`>=${O}.${N}.0${F} <${O}.${+N+1}.0-0`:G=`>=${O}.${N}.0${F} <${+O+1}.0.0-0`:W?(r("replaceCaret pr",W),O==="0"?N==="0"?G=`>=${O}.${N}.${B}-${W} <${O}.${N}.${+B+1}-0`:G=`>=${O}.${N}.${B}-${W} <${O}.${+N+1}.0-0`:G=`>=${O}.${N}.${B}-${W} <${+O+1}.0.0-0`):(r("no pr"),O==="0"?N==="0"?G=`>=${O}.${N}.${B}${F} <${O}.${N}.${+B+1}-0`:G=`>=${O}.${N}.${B}${F} <${O}.${+N+1}.0-0`:G=`>=${O}.${N}.${B} <${+O+1}.0.0-0`),r("caret return",G),G})},k=(P,L)=>(r("replaceXRanges",P,L),P.split(/\s+/).map(R=>w(R,L)).join(" ")),w=(P,L)=>{P=P.trim();const R=L.loose?l[c.XRANGELOOSE]:l[c.XRANGE];return P.replace(R,(F,D,O,N,B,W)=>{r("xRange",P,F,D,O,N,B,W);const G=v(O),K=G||v(N),te=K||v(B),Y=te;return D==="="&&Y&&(D=""),W=L.includePrerelease?"-0":"",G?D===">"||D==="<"?F="<0.0.0-0":F="*":D&&Y?(K&&(N=0),B=0,D===">"?(D=">=",K?(O=+O+1,N=0,B=0):(N=+N+1,B=0)):D==="<="&&(D="<",K?O=+O+1:N=+N+1),D==="<"&&(W="-0"),F=`${D+O}.${N}.${B}${W}`):K?F=`>=${O}.0.0${W} <${+O+1}.0.0-0`:te&&(F=`>=${O}.${N}.0${W} <${O}.${+N+1}.0-0`),r("xRange return",F),F})},M=(P,L)=>(r("replaceStars",P,L),P.trim().replace(l[c.STAR],"")),T=(P,L)=>(r("replaceGTE0",P,L),P.trim().replace(l[L.includePrerelease?c.GTE0PRE:c.GTE0],"")),E=P=>(L,R,F,D,O,N,B,W,G,K,te,Y,J)=>(v(F)?R="":v(D)?R=`>=${F}.0.0${P?"-0":""}`:v(O)?R=`>=${F}.${D}.0${P?"-0":""}`:N?R=`>=${R}`:R=`>=${R}${P?"-0":""}`,v(G)?W="":v(K)?W=`<${+G+1}.0.0-0`:v(te)?W=`<${G}.${+K+1}.0-0`:Y?W=`<=${G}.${K}.${te}-${Y}`:P?W=`<${G}.${K}.${+te+1}-0`:W=`<=${W}`,`${R} ${W}`.trim()),S=(P,L,R)=>{for(let F=0;F0){const D=P[F].semver;if(D.major===L.major&&D.minor===L.minor&&D.patch===L.patch)return!0}return!1}return!0};return DA}const yke=rG(),vke=(e,n,t)=>{try{n=new yke(n,t)}catch{return!1}return n.test(e)};var xke=vke,iG=bAe(xke);function bke(e,n,t){const o=e.open(n),f=1e4,r=250,{origin:a}=new URL(n);let l=~~(f/r);function c(s){s.source===o&&(l=0,e.removeEventListener("message",c,!1))}e.addEventListener("message",c,!1);function i(){l<=0||(o.postMessage(t,a),setTimeout(i,r),l-=1)}setTimeout(i,r)}var _ke=`.vega-embed { - position: relative; - display: inline-block; - box-sizing: border-box; -} -.vega-embed.has-actions { - padding-right: 38px; -} -.vega-embed details:not([open]) > :not(summary) { - display: none !important; -} -.vega-embed summary { - list-style: none; - position: absolute; - top: 0; - right: 0; - padding: 6px; - z-index: 1000; - background: white; - box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1); - color: #1b1e23; - border: 1px solid #aaa; - border-radius: 999px; - opacity: 0.2; - transition: opacity 0.4s ease-in; - cursor: pointer; - line-height: 0px; -} -.vega-embed summary::-webkit-details-marker { - display: none; -} -.vega-embed summary:active { - box-shadow: #aaa 0px 0px 0px 1px inset; -} -.vega-embed summary svg { - width: 14px; - height: 14px; -} -.vega-embed details[open] summary { - opacity: 0.7; -} -.vega-embed:hover summary, .vega-embed:focus-within summary { - opacity: 1 !important; - transition: opacity 0.2s ease; -} -.vega-embed .vega-actions { - position: absolute; - z-index: 1001; - top: 35px; - right: -9px; - display: flex; - flex-direction: column; - padding-bottom: 8px; - padding-top: 8px; - border-radius: 4px; - box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.2); - border: 1px solid #d9d9d9; - background: white; - animation-duration: 0.15s; - animation-name: scale-in; - animation-timing-function: cubic-bezier(0.2, 0, 0.13, 1.5); - text-align: left; -} -.vega-embed .vega-actions a { - padding: 8px 16px; - font-family: sans-serif; - font-size: 14px; - font-weight: 600; - white-space: nowrap; - color: #434a56; - text-decoration: none; -} -.vega-embed .vega-actions a:hover, .vega-embed .vega-actions a:focus { - background-color: #f7f7f9; - color: black; -} -.vega-embed .vega-actions::before, .vega-embed .vega-actions::after { - content: ""; - display: inline-block; - position: absolute; -} -.vega-embed .vega-actions::before { - left: auto; - right: 14px; - top: -16px; - border: 8px solid rgba(0, 0, 0, 0); - border-bottom-color: #d9d9d9; -} -.vega-embed .vega-actions::after { - left: auto; - right: 15px; - top: -14px; - border: 7px solid rgba(0, 0, 0, 0); - border-bottom-color: #fff; -} -.vega-embed .chart-wrapper.fit-x { - width: 100%; -} -.vega-embed .chart-wrapper.fit-y { - height: 100%; -} - -.vega-embed-wrapper { - max-width: 100%; - overflow: auto; - padding-right: 14px; -} - -@keyframes scale-in { - from { - opacity: 0; - transform: scale(0.6); - } - to { - opacity: 1; - transform: scale(1); - } -} -`;function aG(e,...n){for(const t of n)wke(e,t);return e}function wke(e,n){for(const t of Object.keys(n))Xv(e,t,n[t],!0)}function pI(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter(function(f){return Object.getOwnPropertyDescriptor(e,f).enumerable})),t.push.apply(t,o)}return t}function np(e){for(var n=1;ne,"vega-lite":(e,n)=>Vv.compile(e,{config:n}).spec},Mke=` - - - - -`,Eke="chart-wrapper";function Ske(e){return typeof e=="function"}function mI(e,n,t,o){const f=`${n}
    `,r=`
    ${t}`,a=window.open("");a.document.write(f+e+r),a.document.title=`${Wy[o]} JSON Source`}function Cke(e,n){if(e.$schema){const t=JH(e.$schema);n&&n!==t.library&&console.warn(`The given visualization spec is written in ${Wy[t.library]}, but mode argument sets ${Wy[n]??n}.`);const o=t.library;return iG(mw[o],`^${t.version.slice(1)}`)||console.warn(`The input spec uses ${Wy[o]} ${t.version}, but the current version of ${Wy[o]} is v${mw[o]}.`),o}return"mark"in e||"encoding"in e||"layer"in e||"hconcat"in e||"vconcat"in e||"facet"in e||"repeat"in e?"vega-lite":"marks"in e||"signals"in e||"scales"in e||"axes"in e?"vega":n??"vega"}function Lke(e){return!!(e&&"load"in e)}function yI(e){return Lke(e)?e:tf.loader(e)}function Dke(e){const n=e.usermeta?.embedOptions??{};return Qf(n.defaultStyle)&&(n.defaultStyle=!1),n}async function Oke(e,n,t={}){let o,f;Qf(n)?(f=yI(t.loader),o=JSON.parse(await f.load(n))):o=n;const r=Dke(o),a=r.loader;(!f||a)&&(f=yI(t.loader??a));const l=await vI(r,f),c=await vI(t,f),i=np(np({},aG(c,l)),{},{config:n6(c.config??{},l.config??{})});return await Ike(e,o,i,f)}async function vI(e,n){const t=Qf(e.config)?JSON.parse(await n.load(e.config)):e.config??{},o=Qf(e.patch)?JSON.parse(await n.load(e.patch)):e.patch;return np(np(np({},e),o?{patch:o}:{}),t?{config:t}:{})}function Pke(e){const n=e.getRootNode?e.getRootNode():document;return n instanceof ShadowRoot?{root:n,rootContainer:n}:{root:document,rootContainer:document.head??document.body}}async function Ike(e,n,t={},o){const f=t.theme?n6(nAe[t.theme],t.config??{}):t.config,r=VI(t.actions)?t.actions:aG({},Ake,t.actions??{}),a=np(np({},kke),t.i18n),l=t.renderer??"canvas",c=t.logLevel??tf.Warn,i=t.downloadFileName??"visualization",s=typeof e=="string"?document.querySelector(e):e;if(!s)throw new Error(`${e} does not exist`);if(t.defaultStyle!==!1){const A="vega-embed-style",{root:b,rootContainer:k}=Pke(s);if(!b.getElementById(A)){const w=document.createElement("style");w.id=A,w.innerHTML=t.defaultStyle===void 0||t.defaultStyle===!0?_ke.toString():t.defaultStyle,k.appendChild(w)}}const u=Cke(n,t.mode);let h=Tke[u](n,f);if(u==="vega-lite"&&h.$schema){const A=JH(h.$schema);iG(mw.vega,`^${A.version.slice(1)}`)||console.warn(`The compiled spec uses Vega ${A.version}, but current version is v${mw.vega}.`)}s.classList.add("vega-embed"),r&&s.classList.add("has-actions"),s.innerHTML="";let d=s;if(r){const A=document.createElement("div");A.classList.add(Eke),s.appendChild(A),d=A}const m=t.patch;if(m&&(h=m instanceof Function?m(h):Aw(h,m,!0,!1).newDocument),t.formatLocale&&tf.formatLocale(t.formatLocale),t.timeFormatLocale&&tf.timeFormatLocale(t.timeFormatLocale),t.expressionFunctions)for(const A in t.expressionFunctions){const b=t.expressionFunctions[A];"fn"in b?tf.expressionFunction(A,b.fn,b.visitor):b instanceof Function&&tf.expressionFunction(A,b)}const{ast:p}=t,g=tf.parse(h,u==="vega-lite"?{}:f,{ast:p}),y=new(t.viewClass||tf.View)(g,np({loader:o,logLevel:c,renderer:l},p?{expr:tf.expressionInterpreter??t.expr??Vme}:{}));if(y.addSignalListener("autosize",(A,b)=>{const{type:k}=b;k=="fit-x"?(d.classList.add("fit-x"),d.classList.remove("fit-y")):k=="fit-y"?(d.classList.remove("fit-x"),d.classList.add("fit-y")):k=="fit"?d.classList.add("fit-x","fit-y"):d.classList.remove("fit-x","fit-y")}),t.tooltip!==!1){const A=Ske(t.tooltip)?t.tooltip:new mAe(t.tooltip===!0?{}:t.tooltip).call;y.tooltip(A)}let{hover:v}=t;if(v===void 0&&(v=u==="vega"),v){const{hoverSet:A,updateSet:b}=typeof v=="boolean"?{}:v;y.hover(A,b)}t&&(t.width!=null&&y.width(t.width),t.height!=null&&y.height(t.height),t.padding!=null&&y.padding(t.padding)),await y.initialize(d,t.bind).runAsync();let x;if(r!==!1){let A=s;if(t.defaultStyle!==!1){const k=document.createElement("details");k.title=a.CLICK_TO_VIEW_ACTIONS,s.append(k),A=k;const w=document.createElement("summary");w.innerHTML=Mke,k.append(w),x=M=>{k.contains(M.target)||k.removeAttribute("open")},document.addEventListener("click",x)}const b=document.createElement("div");if(A.append(b),b.classList.add("vega-actions"),r===!0||r.export!==!1){for(const k of["svg","png"])if(r===!0||r.export===!0||r.export[k]){const w=a[`${k.toUpperCase()}_ACTION`],M=document.createElement("a"),T=rp(t.scaleFactor)?t.scaleFactor[k]:t.scaleFactor;M.text=w,M.href="#",M.target="_blank",M.download=`${i}.${k}`,M.addEventListener("mousedown",async function(E){E.preventDefault();const S=await y.toImageURL(k,T);this.href=S}),b.append(M)}}if(r===!0||r.source!==!1){const k=document.createElement("a");k.text=a.SOURCE_ACTION,k.href="#",k.addEventListener("click",function(w){mI(u4(n),t.sourceHeader??"",t.sourceFooter??"",u),w.preventDefault()}),b.append(k)}if(u==="vega-lite"&&(r===!0||r.compiled!==!1)){const k=document.createElement("a");k.text=a.COMPILED_ACTION,k.href="#",k.addEventListener("click",function(w){mI(u4(h),t.sourceHeader??"",t.sourceFooter??"","vega"),w.preventDefault()}),b.append(k)}if(r===!0||r.editor!==!1){const k=t.editorUrl??"https://vega.github.io/editor/",w=document.createElement("a");w.text=a.EDITOR_ACTION,w.href="#",w.addEventListener("click",function(M){bke(window,k,{config:f,mode:u,renderer:l,spec:u4(n)}),M.preventDefault()}),b.append(w)}}function _(){x&&document.removeEventListener("click",x),y.finalize()}return{view:y,spec:n,vgSpec:h,finalize:_,embedOptions:t}}const Fke=new Set(["width","height"]);function Rke(e,n){for(const[t,o]of Object.entries(n))o&&(o&&{}.toString.call(o)==="[object Function]"?o(e.data(t)):e.change(t,tf.changeset().remove(()=>!0).insert(o)))}function s2(e={},n={},t=new Set){const o=Object.keys(e),f=Object.keys(n);return e===n||o.length===f.length&&o.filter(r=>!t.has(r)).every(r=>e[r]===n[r])}function xI(e,n){const t=Object.keys(n);for(const o of t)try{e.removeSignalListener(o,n[o])}catch(f){console.warn("Cannot remove invalid signal listener.",f)}return t.length>0}function OA(e,n){const t=Object.keys(n);for(const o of t)try{e.addSignalListener(o,n[o])}catch(f){console.warn("Cannot add invalid signal listener.",f)}return t.length>0}function zke(e){return new Set(e.flatMap(n=>Object.keys(n)))}function Nke(e,n){if(e===n)return!1;const t={width:!1,height:!1,isExpensive:!1},o="width"in e||"width"in n,f="height"in e||"height"in n;return o&&(!("width"in e)||!("width"in n)||e.width!==n.width)&&("width"in e&&typeof e.width=="number"?t.width=e.width:t.isExpensive=!0),f&&(!("height"in e)||!("height"in n)||e.height!==n.height)&&("height"in e&&typeof e.height=="number"?t.height=e.height:t.isExpensive=!0),[...zke([e,n])].filter(a=>a!=="width"&&a!=="height").some(a=>!(a in e)||!(a in n)||!_$(e[a],n[a]))&&(t.isExpensive=!0),t.width!==!1||t.height!==!1||t.isExpensive?t:!1}function bI(e,n){const{width:t,height:o}=n;return typeof t<"u"&&typeof o<"u"?{...e,width:t,height:o}:typeof t<"u"?{...e,width:t}:typeof o<"u"?{...e,height:o}:e}function Bke(e){let n;return{c(){n=L0("div")},m(t,o){ah(t,n,o),e[11](n)},p:Nu,i:Nu,o:Nu,d(t){t&&oh(n),e[11](null)}}}function jke(e,n,t){let{options:o}=n,{spec:f}=n,{view:r}=n,{signalListeners:a={}}=n,{data:l={}}=n;const c=zW();let i,s={},u={},h={},d={},m;wI(()=>{g()});async function p(){g();try{t(6,i=await Oke(m,f,o)),t(1,r=i.view),OA(r,a)&&r.runAsync(),v(r)}catch(A){y(A)}}function g(){i&&(i.finalize(),t(6,i=void 0),t(1,r=void 0))}function y(A){c("onError",{error:A}),console.warn(A)}function v(A){x(),c("onNewView",{view:A})}async function x(){l&&Object.keys(l).length>0&&i!==void 0&&(t(1,r=i.view),Rke(r,l),await r.resize().runAsync())}function _(A){GT[A?"unshift":"push"](()=>{m=A,t(0,m)})}return e.$$set=A=>{"options"in A&&t(2,o=A.options),"spec"in A&&t(3,f=A.spec),"view"in A&&t(1,r=A.view),"signalListeners"in A&&t(4,a=A.signalListeners),"data"in A&&t(5,l=A.data)},e.$$.update=()=>{if(e.$$.dirty&1056&&(s2(l,d)||x(),t(10,d=l)),e.$$.dirty&991&&m!==void 0){if(!s2(o,s,Fke))p();else{const A=Nke(bI(f,o),bI(h,s)),b=a,k=u;if(A){if(A.isExpensive)p();else if(i!==void 0){const w=!s2(b,k);t(1,r=i.view),A.width!==!1&&r.width(A.width),A.height!==!1&&r.height(A.height),w&&(k&&xI(r,k),b&&OA(r,b)),r.runAsync()}}else!s2(b,k)&&i!==void 0&&(t(1,r=i.view),k&&xI(r,k),b&&OA(r,b),r.runAsync())}t(7,s=o),t(8,u=a),t(9,h=f)}},[m,r,o,f,a,l,i,s,u,h,d,_]}class Uke extends qv{constructor(n){super(),Hv(this,n,jke,Bke,Gv,{options:2,spec:3,view:1,signalListeners:4,data:5})}}function $ke(e){let n,t,o;function f(a){e[6](a)}let r={spec:e[1],data:e[2],signalListeners:e[3],options:e[4]};return e[0]!==void 0&&(r.view=e[0]),n=new Uke({props:r}),GT.push(()=>NW(n,"view",f)),n.$on("onNewView",e[7]),n.$on("onError",e[8]),{c(){Wd(n.$$.fragment)},m(a,l){Yd(n,a,l),o=!0},p(a,[l]){const c={};l&2&&(c.spec=a[1]),l&4&&(c.data=a[2]),l&8&&(c.signalListeners=a[3]),l&16&&(c.options=a[4]),!t&&l&1&&(t=!0,c.view=a[0],BW(()=>t=!1)),n.$set(c)},i(a){o||(Jf(n.$$.fragment,a),o=!0)},o(a){Kf(n.$$.fragment,a),o=!1},d(a){Xd(n,a)}}}const Vke="vega";function qke(e,n,t){let o,{spec:f}=n,{options:r={}}=n,{data:a={}}=n,{signalListeners:l={}}=n,{view:c=void 0}=n;function i(h){c=h,t(0,c)}function s(h){PA.call(this,e,h)}function u(h){PA.call(this,e,h)}return e.$$set=h=>{"spec"in h&&t(1,f=h.spec),"options"in h&&t(5,r=h.options),"data"in h&&t(2,a=h.data),"signalListeners"in h&&t(3,l=h.signalListeners),"view"in h&&t(0,c=h.view)},e.$$.update=()=>{e.$$.dirty&32&&t(4,o={...r,mode:Vke})},[c,f,a,l,o,r,i,s,u]}class Hke extends qv{constructor(n){super(),Hv(this,n,qke,$ke,Gv,{spec:1,options:5,data:2,signalListeners:3,view:0})}}const sm="#e2e8f0",lm="#111827";function Gke(e){return{axis:{labelFont:"sans-serif",labelColor:e?sm:lm,titleFont:"sans-serif",titleColor:e?sm:lm,tickColor:"#aaa",gridColor:"#aaa",titleFontWeight:"normal",labelFontWeight:"normal"},legend:{labelColor:e?sm:lm,labelFont:"sans-serif",titleColor:e?sm:lm,titleFont:"sans-serif",titleFontWeight:"normal",labelFontWeight:"normal"},title:{color:e?sm:lm,font:"sans-serif",fontWeight:"normal",anchor:"middle"}}}function Wke(e){return{labelFont:"sans-serif",labelColor:e?sm:lm}}function Yke(e){let n,t;return n=new AY({props:{unpadded_box:!0,size:"large",$$slots:{default:[Qke]},$$scope:{ctx:e}}}),{c(){Wd(n.$$.fragment)},m(o,f){Yd(n,o,f),t=!0},p(o,f){const r={};f&268435456&&(r.$$scope={dirty:f,ctx:o}),n.$set(r)},i(o){t||(Jf(n.$$.fragment,o),t=!0)},o(o){Kf(n.$$.fragment,o),t=!1},d(o){Xd(n,o)}}}function Xke(e){let n,t,o;return{c(){n=L0("div"),t=L0("img"),Z9(t.src,o=e[3])||ga(t,"src",o),ga(t,"class","svelte-1fe5ixn"),ga(n,"data-testid","matplotlib"),ga(n,"class","matplotlib layout svelte-1fe5ixn")},m(f,r){ah(f,n,r),Nh(n,t)},p(f,r){r&8&&!Z9(t.src,o=f[3])&&ga(t,"src",o)},i:Nu,o:Nu,d(f){f&&oh(n)}}}function Zke(e){let n,t,o,f;t=new Hke({props:{spec:e[2]}});let r=e[1]&&_I(e);return{c(){n=L0("div"),Wd(t.$$.fragment),o=IA(),r&&r.c(),ga(n,"data-testid","altair"),ga(n,"class","altair layout svelte-1fe5ixn")},m(a,l){ah(a,n,l),Yd(t,n,null),Nh(n,o),r&&r.m(n,null),f=!0},p(a,l){const c={};l&4&&(c.spec=a[2]),t.$set(c),a[1]?r?r.p(a,l):(r=_I(a),r.c(),r.m(n,null)):r&&(r.d(1),r=null)},i(a){f||(Jf(t.$$.fragment,a),f=!0)},o(a){Kf(t.$$.fragment,a),f=!1},d(a){a&&oh(n),Xd(t),r&&r.d()}}}function Jke(e){let n;return{c(){n=L0("div"),ga(n,"data-testid","bokeh"),ga(n,"id",e[6]),ga(n,"class","gradio-bokeh svelte-1fe5ixn")},m(t,o){ah(t,n,o)},p:Nu,i:Nu,o:Nu,d(t){t&&oh(n)}}}function Kke(e){let n;return{c(){n=L0("div"),ga(n,"data-testid","plotly")},m(t,o){ah(t,n,o),e[13](n)},p:Nu,i:Nu,o:Nu,d(t){t&&oh(n),e[13](null)}}}function Qke(e){let n,t;return n=new EI({}),{c(){Wd(n.$$.fragment)},m(o,f){Yd(n,o,f),t=!0},i(o){t||(Jf(n.$$.fragment,o),t=!0)},o(o){Kf(n.$$.fragment,o),t=!1},d(o){Xd(n,o)}}}function _I(e){let n,t;return{c(){n=L0("div"),t=qW(e[1]),ga(n,"class","caption layout svelte-1fe5ixn")},m(o,f){ah(o,n,f),Nh(n,t)},p(o,f){f&2&&HW(t,o[1])},d(o){o&&oh(n)}}}function eTe(e){let n,t,o,f;const r=[Kke,Jke,Zke,Xke,Yke],a=[];function l(c,i){return c[0]&&c[4]=="plotly"?0:c[4]=="bokeh"?1:c[4]=="altair"?2:c[4]=="matplotlib"?3:4}return n=l(e),t=a[n]=r[n](e),{c(){t.c(),o=jW()},m(c,i){a[n].m(c,i),ah(c,o,i),f=!0},p(c,[i]){let s=n;n=l(c),n===s?a[n].p(c,i):(UW(),Kf(a[s],1,1,()=>{a[s]=null}),$W(),t=a[n],t?t.p(c,i):(t=a[n]=r[n](c),t.c()),Jf(t,1),t.m(o.parentNode,o))},i(c){f||(Jf(t),f=!0)},o(c){Kf(t),f=!1},d(c){c&&oh(o),a[n].d(c)}}}function tTe(e,n,t){let o,f,r,a,{value:l}=n,{target:c}=n,i=null,{colors:s=[]}=n,{theme_mode:u}=n,{caption:h}=n,{bokeh_version:d}=n;const m=`bokehDiv-${Math.random().toString(5).substring(2)}`;function p(L){let R=s[L%s.length];return R&&R in l4?l4[R]?.primary:R||l4[JW(L)].primary}function g(L,R,F){if(document&&document.getElementById(m)&&(document.getElementById(m).innerHTML=""),R=="bokeh"&&window.Bokeh){F||(b(),F=!0);let D=JSON.parse(L);window.Bokeh.embed.embed_item(D,m)}}let y,v;const x=`https://cdn.bokeh.org/bokeh/release/bokeh-${d}.min.js`,_=[`https://cdn.pydata.org/bokeh/release/bokeh-widgets-${d}.min.js`,`https://cdn.pydata.org/bokeh/release/bokeh-tables-${d}.min.js`,`https://cdn.pydata.org/bokeh/release/bokeh-gl-${d}.min.js`,`https://cdn.pydata.org/bokeh/release/bokeh-api-${d}.min.js`];function A(){return _.map((L,R)=>{const F=document.createElement("script");return F.onload=()=>E(R+1),F.src=L,document.head.appendChild(F),F})}function b(){const L=document.createElement("script");return L.onload=S,L.src=x,document.head.appendChild(L),t(11,a=!0),L}function k(){if(!v){v=document.getElementById("plotly.js-style-global");const L=v.cloneNode();c.appendChild(L);for(const R of v.sheet.cssRules)L.sheet.insertRule(R.cssText)}}const w=d?b():null;let M=[];const T=[],E=L=>{r=="bokeh"&&T[L]()};function S(){E(0),M=A()}VW(()=>{if(r=="plotly"){k();let L=JSON.parse(f);L.layout.title?L.layout.margin={autoexpand:!0}:L.layout.margin={l:0,r:0,b:0,t:0},EY.react(y,L)}}),wI(()=>{w in document.children&&(document.removeChild(w),M.forEach(L=>document.removeChild(L)))});function P(L){GT[L?"unshift":"push"](()=>{y=L,t(5,y)})}return e.$$set=L=>{"value"in L&&t(0,l=L.value),"target"in L&&t(7,c=L.target),"colors"in L&&t(8,s=L.colors),"theme_mode"in L&&t(9,u=L.theme_mode),"caption"in L&&t(1,h=L.caption),"bokeh_version"in L&&t(10,d=L.bokeh_version)},e.$$.update=()=>{if(e.$$.dirty&512&&t(12,o=u=="dark"),e.$$.dirty&1&&t(3,f=l?.plot),e.$$.dirty&1&&t(4,r=l?.type),e.$$.dirty&2072&&g(f,r,a),e.$$.dirty&4125&&r=="altair"){if(t(2,i=JSON.parse(f)),l.chart){const L=Gke(o);t(2,i.config=L,i)}switch(l.chart||""){case"scatter":i.encoding.color&&i.encoding.color.type=="nominal"?t(2,i.encoding.color.scale.range=i.encoding.color.scale.range.map((L,R)=>p(R)),i):i.encoding.color&&i.encoding.color.type=="quantitative"&&(t(2,i.encoding.color.scale.range=["#eff6ff","#1e3a8a"],i),t(2,i.encoding.color.scale.range.interpolate="hsl",i));break;case"line":i.layer.forEach(L=>{L.encoding.color&&(L.encoding.color.scale.range=L.encoding.color.scale.range.map((R,F)=>p(F)))});break;case"bar":i.encoding.color&&t(2,i.encoding.color.scale.range=i.encoding.color.scale.range.map((L,R)=>p(R)),i),t(2,i.config.header=Wke(o),i);break}}},t(11,a=window.Bokeh===void 0),[l,h,i,f,r,y,m,c,s,u,d,a,o,P]}class nTe extends qv{constructor(n){super(),Hv(this,n,tTe,eTe,Gv,{value:0,target:7,colors:8,theme_mode:9,caption:1,bokeh_version:10})}}function rTe(e){let n,t,o,f,r,a;n=new kY({props:{show_label:e[6],label:e[5]||"Plot",Icon:EI}});const l=[e[4]];let c={};for(let i=0;i{"value"in v&&t(0,o=v.value),"elem_id"in v&&t(1,f=v.elem_id),"elem_classes"in v&&t(2,r=v.elem_classes),"visible"in v&&t(3,a=v.visible),"loading_status"in v&&t(4,l=v.loading_status),"label"in v&&t(5,c=v.label),"show_label"in v&&t(6,i=v.show_label),"target"in v&&t(7,s=v.target),"container"in v&&t(8,u=v.container),"scale"in v&&t(9,h=v.scale),"min_width"in v&&t(10,d=v.min_width),"theme_mode"in v&&t(11,m=v.theme_mode),"caption"in v&&t(12,p=v.caption),"bokeh_version"in v&&t(13,g=v.bokeh_version)},[o,f,r,a,l,c,i,s,u,h,d,m,p,g,y]}class oTe extends qv{constructor(n){super(),Hv(this,n,aTe,iTe,Gv,{value:0,elem_id:1,elem_classes:2,visible:3,loading_status:4,label:5,show_label:6,target:7,container:8,scale:9,min_width:10,theme_mode:11,caption:12,bokeh_version:13})}}const KTe=oTe,QTe=["static"];export{KTe as Component,QTe as modes}; -//# sourceMappingURL=index-1cf9680f.js.map diff --git a/spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/httpcore/__init__.py b/spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/httpcore/__init__.py deleted file mode 100644 index da95f8d0bb6bf7c91713dddc9615873d5bf268bc..0000000000000000000000000000000000000000 --- a/spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/httpcore/__init__.py +++ /dev/null @@ -1,139 +0,0 @@ -from ._api import request, stream -from ._async import ( - AsyncConnectionInterface, - AsyncConnectionPool, - AsyncHTTP2Connection, - AsyncHTTP11Connection, - AsyncHTTPConnection, - AsyncHTTPProxy, - AsyncSOCKSProxy, -) -from ._backends.base import ( - SOCKET_OPTION, - AsyncNetworkBackend, - AsyncNetworkStream, - NetworkBackend, - NetworkStream, -) -from ._backends.mock import AsyncMockBackend, AsyncMockStream, MockBackend, MockStream -from ._backends.sync import SyncBackend -from ._exceptions import ( - ConnectError, - ConnectionNotAvailable, - ConnectTimeout, - LocalProtocolError, - NetworkError, - PoolTimeout, - ProtocolError, - ProxyError, - ReadError, - ReadTimeout, - RemoteProtocolError, - TimeoutException, - UnsupportedProtocol, - WriteError, - WriteTimeout, -) -from ._models import URL, Origin, Request, Response -from ._ssl import default_ssl_context -from ._sync import ( - ConnectionInterface, - ConnectionPool, - HTTP2Connection, - HTTP11Connection, - HTTPConnection, - HTTPProxy, - SOCKSProxy, -) - -# The 'httpcore.AnyIOBackend' class is conditional on 'anyio' being installed. -try: - from ._backends.anyio import AnyIOBackend -except ImportError: # pragma: nocover - - class AnyIOBackend: # type: ignore - def __init__(self, *args, **kwargs): # type: ignore - msg = ( - "Attempted to use 'httpcore.AnyIOBackend' but 'anyio' is not installed." - ) - raise RuntimeError(msg) - - -# The 'httpcore.TrioBackend' class is conditional on 'trio' being installed. -try: - from ._backends.trio import TrioBackend -except ImportError: # pragma: nocover - - class TrioBackend: # type: ignore - def __init__(self, *args, **kwargs): # type: ignore - msg = "Attempted to use 'httpcore.TrioBackend' but 'trio' is not installed." - raise RuntimeError(msg) - - -__all__ = [ - # top-level requests - "request", - "stream", - # models - "Origin", - "URL", - "Request", - "Response", - # async - "AsyncHTTPConnection", - "AsyncConnectionPool", - "AsyncHTTPProxy", - "AsyncHTTP11Connection", - "AsyncHTTP2Connection", - "AsyncConnectionInterface", - "AsyncSOCKSProxy", - # sync - "HTTPConnection", - "ConnectionPool", - "HTTPProxy", - "HTTP11Connection", - "HTTP2Connection", - "ConnectionInterface", - "SOCKSProxy", - # network backends, implementations - "SyncBackend", - "AnyIOBackend", - "TrioBackend", - # network backends, mock implementations - "AsyncMockBackend", - "AsyncMockStream", - "MockBackend", - "MockStream", - # network backends, interface - "AsyncNetworkStream", - "AsyncNetworkBackend", - "NetworkStream", - "NetworkBackend", - # util - "default_ssl_context", - "SOCKET_OPTION", - # exceptions - "ConnectionNotAvailable", - "ProxyError", - "ProtocolError", - "LocalProtocolError", - "RemoteProtocolError", - "UnsupportedProtocol", - "TimeoutException", - "PoolTimeout", - "ConnectTimeout", - "ReadTimeout", - "WriteTimeout", - "NetworkError", - "ConnectError", - "ReadError", - "WriteError", -] - -__version__ = "0.17.3" - - -__locals = locals() -for __name in __all__: - if not __name.startswith("__"): - setattr(__locals[__name], "__module__", "httpcore") # noqa diff --git a/spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/huggingface_hub/commands/_cli_utils.py b/spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/huggingface_hub/commands/_cli_utils.py deleted file mode 100644 index bbf17e887e901e58461b09e6648d614bb2caabbb..0000000000000000000000000000000000000000 --- a/spaces/DQChoi/gpt-demo/venv/lib/python3.11/site-packages/huggingface_hub/commands/_cli_utils.py +++ /dev/null @@ -1,63 +0,0 @@ -# Copyright 2022 The HuggingFace Team. All rights reserved. -# -# 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. -"""Contains a utility for good-looking prints.""" -import os -from typing import List, Union - - -class ANSI: - """ - Helper for en.wikipedia.org/wiki/ANSI_escape_code - """ - - _bold = "\u001b[1m" - _gray = "\u001b[90m" - _red = "\u001b[31m" - _reset = "\u001b[0m" - - @classmethod - def bold(cls, s: str) -> str: - return cls._format(s, cls._bold) - - @classmethod - def gray(cls, s: str) -> str: - return cls._format(s, cls._gray) - - @classmethod - def red(cls, s: str) -> str: - return cls._format(s, cls._bold + cls._red) - - @classmethod - def _format(cls, s: str, code: str) -> str: - if os.environ.get("NO_COLOR"): - # See https://no-color.org/ - return s - return f"{code}{s}{cls._reset}" - - -def tabulate(rows: List[List[Union[str, int]]], headers: List[str]) -> str: - """ - Inspired by: - - - stackoverflow.com/a/8356620/593036 - - stackoverflow.com/questions/9535954/printing-lists-as-tabular-data - """ - col_widths = [max(len(str(x)) for x in col) for col in zip(*rows, headers)] - row_format = ("{{:{}}} " * len(headers)).format(*col_widths) - lines = [] - lines.append(row_format.format(*headers)) - lines.append(row_format.format(*["-" * w for w in col_widths])) - for row in rows: - lines.append(row_format.format(*row)) - return "\n".join(lines) diff --git a/spaces/DaFujaTyping/hf-Chat-ui/postcss.config.js b/spaces/DaFujaTyping/hf-Chat-ui/postcss.config.js deleted file mode 100644 index 7b75c83aff1c05e0e0e315638e07a22314603d4d..0000000000000000000000000000000000000000 --- a/spaces/DaFujaTyping/hf-Chat-ui/postcss.config.js +++ /dev/null @@ -1,6 +0,0 @@ -export default { - plugins: { - tailwindcss: {}, - autoprefixer: {}, - }, -}; diff --git a/spaces/Dacoolkid/Sleek/app.py b/spaces/Dacoolkid/Sleek/app.py deleted file mode 100644 index 97cd0ba226f2114ea2ed3ae9c062164387965195..0000000000000000000000000000000000000000 --- a/spaces/Dacoolkid/Sleek/app.py +++ /dev/null @@ -1,20 +0,0 @@ -import openai -import gradio as gr - -openai.api_key = "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" - -messages = [{"role": "system", "content": "You are a chatai"}] - -def CustomChatGPT(user_input): - messages.append({"role": "user", "content": user_input}) - response = openai.ChatCompletion.create( - model = "gpt-3.5-turbo", - messages = messages - ) - ChatGPT_reply = response["choices"][0]["message"]["content"] - messages.append({"role": "assistant", "content": ChatGPT_reply}) - return ChatGPT_reply - -demo = gr.Interface(fn=CustomChatGPT, inputs = "text", outputs = "text", title = "ai") - -demo.launch() \ No newline at end of file diff --git a/spaces/DaleChen/AutoGPT/autogpt/prompt.py b/spaces/DaleChen/AutoGPT/autogpt/prompt.py deleted file mode 100644 index 03c132acdf26d08deeee119e41a561f430957806..0000000000000000000000000000000000000000 --- a/spaces/DaleChen/AutoGPT/autogpt/prompt.py +++ /dev/null @@ -1,204 +0,0 @@ -from colorama import Fore - -from autogpt.config import Config -from autogpt.config.ai_config import AIConfig -from autogpt.config.config import Config -from autogpt.logs import logger -from autogpt.promptgenerator import PromptGenerator -from autogpt.setup import prompt_user -from autogpt.utils import clean_input - -CFG = Config() - - -def get_prompt() -> str: - """ - This function generates a prompt string that includes various constraints, - commands, resources, and performance evaluations. - - Returns: - str: The generated prompt string. - """ - - # Initialize the Config object - cfg = Config() - - # Initialize the PromptGenerator object - prompt_generator = PromptGenerator() - - # Add constraints to the PromptGenerator object - prompt_generator.add_constraint( - "~4000 word limit for short term memory. Your short term memory is short, so" - " immediately save important information to files." - ) - prompt_generator.add_constraint( - "If you are unsure how you previously did something or want to recall past" - " events, thinking about similar events will help you remember." - ) - prompt_generator.add_constraint("No user assistance") - prompt_generator.add_constraint( - 'Exclusively use the commands listed in double quotes e.g. "command name"' - ) - prompt_generator.add_constraint( - "Use subprocesses for commands that will not terminate within a few minutes" - ) - - # Define the command list - commands = [ - ("Google Search", "google", {"input": ""}), - ( - "Browse Website", - "browse_website", - {"url": "", "question": ""}, - ), - ( - "Start GPT Agent", - "start_agent", - {"name": "", "task": "", "prompt": ""}, - ), - ( - "Message GPT Agent", - "message_agent", - {"key": "", "message": ""}, - ), - ("List GPT Agents", "list_agents", {}), - ("Delete GPT Agent", "delete_agent", {"key": ""}), - ( - "Clone Repository", - "clone_repository", - {"repository_url": "", "clone_path": ""}, - ), - ("Write to file", "write_to_file", {"file": "", "text": ""}), - ("Read file", "read_file", {"file": ""}), - ("Append to file", "append_to_file", {"file": "", "text": ""}), - ("Delete file", "delete_file", {"file": ""}), - ("Search Files", "search_files", {"directory": ""}), - ("Analyze Code", "analyze_code", {"code": ""}), - ( - "Get Improved Code", - "improve_code", - {"suggestions": "", "code": ""}, - ), - ( - "Write Tests", - "write_tests", - {"code": "", "focus": ""}, - ), - ("Execute Python File", "execute_python_file", {"file": ""}), - ("Task Complete (Shutdown)", "task_complete", {"reason": ""}), - ("Generate Image", "generate_image", {"prompt": ""}), - ("Send Tweet", "send_tweet", {"text": ""}), - ] - - # Only add the audio to text command if the model is specified - if cfg.huggingface_audio_to_text_model: - commands.append( - ("Convert Audio to text", "read_audio_from_file", {"file": ""}), - ) - - # Only add shell command to the prompt if the AI is allowed to execute it - if cfg.execute_local_commands: - commands.append( - ( - "Execute Shell Command, non-interactive commands only", - "execute_shell", - {"command_line": ""}, - ), - ) - commands.append( - ( - "Execute Shell Command Popen, non-interactive commands only", - "execute_shell_popen", - {"command_line": ""}, - ), - ) - - # Only add the download file command if the AI is allowed to execute it - if cfg.allow_downloads: - commands.append( - ( - "Downloads a file from the internet, and stores it locally", - "download_file", - {"url": "", "file": ""}, - ), - ) - - # Add these command last. - commands.append( - ("Do Nothing", "do_nothing", {}), - ) - commands.append( - ("Task Complete (Shutdown)", "task_complete", {"reason": ""}), - ) - - # Add commands to the PromptGenerator object - for command_label, command_name, args in commands: - prompt_generator.add_command(command_label, command_name, args) - - # Add resources to the PromptGenerator object - prompt_generator.add_resource( - "Internet access for searches and information gathering." - ) - prompt_generator.add_resource("Long Term memory management.") - prompt_generator.add_resource( - "GPT-3.5 powered Agents for delegation of simple tasks." - ) - prompt_generator.add_resource("File output.") - - # Add performance evaluations to the PromptGenerator object - prompt_generator.add_performance_evaluation( - "Continuously review and analyze your actions to ensure you are performing to" - " the best of your abilities." - ) - prompt_generator.add_performance_evaluation( - "Constructively self-criticize your big-picture behavior constantly." - ) - prompt_generator.add_performance_evaluation( - "Reflect on past decisions and strategies to refine your approach." - ) - prompt_generator.add_performance_evaluation( - "Every command has a cost, so be smart and efficient. Aim to complete tasks in" - " the least number of steps." - ) - - # Generate the prompt string - return prompt_generator.generate_prompt_string() - - -def construct_prompt() -> str: - """Construct the prompt for the AI to respond to - - Returns: - str: The prompt string - """ - config = AIConfig.load(CFG.ai_settings_file) - if CFG.skip_reprompt and config.ai_name: - logger.typewriter_log("Name :", Fore.GREEN, config.ai_name) - logger.typewriter_log("Role :", Fore.GREEN, config.ai_role) - logger.typewriter_log("Goals:", Fore.GREEN, f"{config.ai_goals}") - elif config.ai_name: - logger.typewriter_log( - "Welcome back! ", - Fore.GREEN, - f"Would you like me to return to being {config.ai_name}?", - speak_text=True, - ) - should_continue = clean_input( - f"""Continue with the last settings? -Name: {config.ai_name} -Role: {config.ai_role} -Goals: {config.ai_goals} -Continue (y/n): """ - ) - if should_continue.lower() == "n": - config = AIConfig() - - if not config.ai_name: - config = prompt_user() - config.save(CFG.ai_settings_file) - - # Get rid of this global: - global ai_name - ai_name = config.ai_name - - return config.construct_full_prompt() diff --git a/spaces/DeepLearning101/Speech-Quality-Inspection_Meta-Denoiser/denoiser/utils.py b/spaces/DeepLearning101/Speech-Quality-Inspection_Meta-Denoiser/denoiser/utils.py deleted file mode 100644 index cca6ad431b2c667f11033fa00f5fe7363be78535..0000000000000000000000000000000000000000 --- a/spaces/DeepLearning101/Speech-Quality-Inspection_Meta-Denoiser/denoiser/utils.py +++ /dev/null @@ -1,165 +0,0 @@ -# Copyright (c) Facebook, Inc. and its affiliates. -# All rights reserved. -# -# This source code is licensed under the license found in the -# LICENSE file in the root directory of this source tree. -# author: adefossez - -import functools -import logging -from contextlib import contextmanager -import inspect -import time - -logger = logging.getLogger(__name__) - - -def capture_init(init): - """capture_init. - - Decorate `__init__` with this, and you can then - recover the *args and **kwargs passed to it in `self._init_args_kwargs` - """ - @functools.wraps(init) - def __init__(self, *args, **kwargs): - self._init_args_kwargs = (args, kwargs) - init(self, *args, **kwargs) - - return __init__ - - -def deserialize_model(package, strict=False): - """deserialize_model. - - """ - klass = package['class'] - if strict: - model = klass(*package['args'], **package['kwargs']) - else: - sig = inspect.signature(klass) - kw = package['kwargs'] - for key in list(kw): - if key not in sig.parameters: - logger.warning("Dropping inexistant parameter %s", key) - del kw[key] - model = klass(*package['args'], **kw) - model.load_state_dict(package['state']) - return model - - -def copy_state(state): - return {k: v.cpu().clone() for k, v in state.items()} - - -def serialize_model(model): - args, kwargs = model._init_args_kwargs - state = copy_state(model.state_dict()) - return {"class": model.__class__, "args": args, "kwargs": kwargs, "state": state} - - -@contextmanager -def swap_state(model, state): - """ - Context manager that swaps the state of a model, e.g: - - # model is in old state - with swap_state(model, new_state): - # model in new state - # model back to old state - """ - old_state = copy_state(model.state_dict()) - model.load_state_dict(state) - try: - yield - finally: - model.load_state_dict(old_state) - - -def pull_metric(history, name): - out = [] - for metrics in history: - if name in metrics: - out.append(metrics[name]) - return out - - -class LogProgress: - """ - Sort of like tqdm but using log lines and not as real time. - Args: - - logger: logger obtained from `logging.getLogger`, - - iterable: iterable object to wrap - - updates (int): number of lines that will be printed, e.g. - if `updates=5`, log every 1/5th of the total length. - - total (int): length of the iterable, in case it does not support - `len`. - - name (str): prefix to use in the log. - - level: logging level (like `logging.INFO`). - """ - def __init__(self, - logger, - iterable, - updates=5, - total=None, - name="LogProgress", - level=logging.INFO): - self.iterable = iterable - self.total = total or len(iterable) - self.updates = updates - self.name = name - self.logger = logger - self.level = level - - def update(self, **infos): - self._infos = infos - - def __iter__(self): - self._iterator = iter(self.iterable) - self._index = -1 - self._infos = {} - self._begin = time.time() - return self - - def __next__(self): - self._index += 1 - try: - value = next(self._iterator) - except StopIteration: - raise - else: - return value - finally: - log_every = max(1, self.total // self.updates) - # logging is delayed by 1 it, in order to have the metrics from update - if self._index >= 1 and self._index % log_every == 0: - self._log() - - def _log(self): - self._speed = (1 + self._index) / (time.time() - self._begin) - infos = " | ".join(f"{k.capitalize()} {v}" for k, v in self._infos.items()) - if self._speed < 1e-4: - speed = "oo sec/it" - elif self._speed < 0.1: - speed = f"{1/self._speed:.1f} sec/it" - else: - speed = f"{self._speed:.1f} it/sec" - out = f"{self.name} | {self._index}/{self.total} | {speed}" - if infos: - out += " | " + infos - self.logger.log(self.level, out) - - -def colorize(text, color): - """ - Display text with some ANSI color in the terminal. - """ - code = f"\033[{color}m" - restore = "\033[0m" - return "".join([code, text, restore]) - - -def bold(text): - """ - Display text in bold in the terminal. - """ - return colorize(text, "1") diff --git a/spaces/Detomo/ai-comic-generation/src/app/engine/presets.ts b/spaces/Detomo/ai-comic-generation/src/app/engine/presets.ts deleted file mode 100644 index c564f6e51737e25fa208e2d133ccd5185390eb69..0000000000000000000000000000000000000000 --- a/spaces/Detomo/ai-comic-generation/src/app/engine/presets.ts +++ /dev/null @@ -1,583 +0,0 @@ -import { FontName, actionman, komika, vtc } from "@/lib/fonts" -import { pick } from "@/lib/pick" -import { NextFontWithVariable } from "next/dist/compiled/@next/font" - -export type ComicFamily = - | "american" - | "asian" - | "european" - -export type ComicColor = - | "color" - | "grayscale" - | "monochrome" - -export interface Preset { - id: string - label: string - family: ComicFamily - color: ComicColor - font: FontName - llmPrompt: string - imagePrompt: (prompt: string) => string[] - negativePrompt: (prompt: string) => string[] -} - -// ATTENTION!! negative prompts are not supported by the VideoChain API yet - -export const presets: Record = { - random: { - id: "random", - label: "Random style", - family: "european", - color: "color", - font: "actionman", - llmPrompt: "", - imagePrompt: (prompt: string) => [], - negativePrompt: () => [], - }, - japanese_manga: { - id: "japanese_manga", - label: "Japanese", - family: "asian", - color: "grayscale", - font: "actionman", - llmPrompt: "japanese manga", - imagePrompt: (prompt: string) => [ - `japanese manga about ${prompt}`, - "single panel", - "manga", - "japanese", - "grayscale", - "intricate", - "detailed", - // "drawing" - ], - negativePrompt: () => [ - "franco-belgian comic", - "color album", - "color", - "american comic", - "photo", - "painting", - "3D render" - ], - }, - nihonga: { - id: "nihonga", - label: "Nihonga", - family: "asian", - color: "color", - font: "actionman", - llmPrompt: "japanese manga", - imagePrompt: (prompt: string) => [ - `japanese nihonga painting about ${prompt}`, - "Nihonga", - "ancient japanese painting", - "intricate", - "detailed", - // "drawing" - ], - negativePrompt: () => [ - "franco-belgian comic", - "color album", - "color", - "manga", - "comic", - "american comic", - "photo", - "painting", - "3D render" - ], - }, - franco_belgian: { - id: "franco_belgian", - label: "Franco-Belgian", - family: "european", - color: "color", - font: "actionman", - llmPrompt: "Franco-Belgian comic (a \"bande dessinée\"), in the style of Franquin, Moebius etc", - imagePrompt: (prompt: string) => [ - `franco-belgian color comic about ${prompt}`, - "bande dessinée", - "franco-belgian comic", - "comic album", - // "color drawing" - ], - negativePrompt: () => [ - "manga", - "anime", - "american comic", - "grayscale", - "monochrome", - "photo", - "painting", - "3D render" - ], - }, - american_comic_90: { - id: "american_comic_90", - label: "American (modern)", - family: "american", - color: "color", - font: "actionman", - llmPrompt: "american comic", - imagePrompt: (prompt: string) => [ - `modern american comic about ${prompt}`, - //"single panel", - "digital color comicbook style", - // "2010s", - // "digital print", - // "color comicbook", - // "color drawing" - ], - negativePrompt: () => [ - "manga", - "anime", - "american comic", - "action", - "grayscale", - "monochrome", - "photo", - "painting", - "3D render" - ], - }, - - /* - american_comic_40: { - label: "American (1940)", - family: "american", - color: "color", - font: "actionman", - llmPrompt: "american comic", - imagePrompt: (prompt: string) => [ - `american comic about ${prompt}`, - "single panel", - "american comic", - "comicbook style", - "1940", - "40s", - "color comicbook", - "color drawing" - ], - negativePrompt: () => [ - "manga", - "anime", - "american comic", - "action", - "grayscale", - "monochrome", - "photo", - "painting", - "3D render" - ], - }, - */ - american_comic_50: { - id: "american_comic_50", - label: "American (1950)", - family: "american", - color: "color", - font: "actionman", - llmPrompt: "american comic", - imagePrompt: (prompt: string) => [ - `vintage american color comic about ${prompt}`, - // "single panel", - // "comicbook style", - "1950", - "50s", - // "color comicbook", - // "color drawing" - ], - negativePrompt: () => [ - "manga", - "anime", - "american comic", - "action", - "grayscale", - "monochrome", - "photo", - "painting", - "3D render" - ], - }, - /* - american_comic_60: { - label: "American (1960)", - family: "american", - color: "color", - font: "actionman", - llmPrompt: "american comic", - imagePrompt: (prompt: string) => [ - `american comic about ${prompt}`, - "single panel", - "american comic", - "comicbook style", - "1960", - "60s", - "color comicbook", - "color drawing" - ], - negativePrompt: () => [ - "manga", - "anime", - "american comic", - "action", - "grayscale", - "monochrome", - "photo", - "painting", - "3D render" - ], - }, - */ - - - flying_saucer: { - id: "flying_saucer", - label: "Flying saucer", - family: "european", - color: "color", - font: "actionman", - llmPrompt: "new pulp science fiction", - imagePrompt: (prompt: string) => [ - `vintage color pulp comic panel`, - `${prompt}`, - "40s", - "1940", - "vintage science fiction", - // "single panel", - // "comic album" - ], - negativePrompt: () => [ - "manga", - "anime", - "american comic", - "grayscale", - "monochrome", - "photo", - "painting", - "3D render" - ], - }, - - humanoid: { - id: "humanoid", - label: "Humanoid", - family: "european", - color: "color", - font: "actionman", - llmPrompt: "comic books by Moebius", - imagePrompt: (prompt: string) => [ - `color comic panel`, - `${prompt}`, - "style of Moebius", - "by Moebius", - "french comic panel", - "franco-belgian style", - "bande dessinée", - "single panel", - // "comic album" - ], - negativePrompt: () => [ - "manga", - "anime", - "american comic", - "grayscale", - "monochrome", - "photo", - "painting", - "3D render" - ], - }, - haddock: { - id: "haddock", - label: "Haddock", - family: "european", - color: "color", - font: "actionman", - llmPrompt: "writing Tintin comic books", - imagePrompt: (prompt: string) => [ - `color comic panel`, - `${prompt}`, - "style of Hergé", - "by Hergé", - "tintin style", - "french comic panel", - "franco-belgian style", - // "color panel", - // "bande dessinée", - // "single panel", - // "comic album" - ], - negativePrompt: () => [ - "manga", - "anime", - "american comic", - "grayscale", - "monochrome", - "photo", - "painting", - "3D render" - ], - }, - /* - lurid: { - id: "lurid", - label: "Lurid", - family: "american", - color: "color", - font: "actionman", - llmPrompt: "1970s satirical and alternative underground comics", - imagePrompt: (prompt: string) => [ - `satirical color comic`, - `underground comix`, - `1970`, - `${prompt}`, - ], - negativePrompt: () => [ - "manga", - "anime", - "american comic", - "grayscale", - "monochrome", - "painting" - ], - }, - */ - armorican: { - id: "armorican", - label: "Armorican", - family: "european", - color: "monochrome", - font: "actionman", - llmPrompt: "french style comic books set in ancient Rome and Gaul", - imagePrompt: (prompt: string) => [ - `color comic panel`, - `about ${prompt}`, - "romans", - "gauls", - "french comic panel", - "franco-belgian style", - "bande dessinée", - "single panel", - // "comical", - // "comic album", - // "color drawing" - ], - negativePrompt: () => [ - "manga", - "anime", - "american comic", - "grayscale", - "monochrome", - "photo", - "painting", - "3D render" - ], - }, - render: { - id: "render", - label: "3D Render", - family: "european", - color: "color", - font: "actionman", - llmPrompt: "new movie", - imagePrompt: (prompt: string) => [ - `3D render`, - `Blender`, - `3D animation`, - `Unreal engine`, - `${prompt}`, - ], - negativePrompt: () => [ - "manga", - "anime", - "american comic", - "grayscale", - "monochrome", - "painting" - ], - }, - klimt: { - id: "klimt", - label: "Klimt", - family: "european", - color: "color", - font: "actionman", - llmPrompt: "Gustav Klimt art pieces.", - imagePrompt: (prompt: string) => [ - `golden`, - `patchwork`, - `style of Gustav Klimt`, - `Gustav Klimt painting`, - `${prompt}`, - ], - negativePrompt: () => [ - "manga", - "anime", - "american comic", - "grayscale", - "monochrome", - "painting" - ], - }, - medieval: { - id: "medieval", - label: "Medieval", - family: "european", - color: "color", - font: "actionman", - llmPrompt: "medieval story (write in this style)", - imagePrompt: (prompt: string) => [ - `medieval illuminated manuscript`, - `illuminated manuscript of`, - // `medieval color engraving`, - `${prompt}`, - `medieval` - ], - negativePrompt: () => [ - "manga", - "anime", - "american comic", - "grayscale", - "monochrome", - "painting" - ], - }, - /* - glass: { - id: "glass", - label: "Glass", - family: "european", - color: "color", - font: "actionman", - llmPrompt: "new movie", - imagePrompt: (prompt: string) => [ - `stained glass`, - `vitrail`, - `stained glass`, - // `medieval color engraving`, - `${prompt}`, - `medieval`, - ], - negativePrompt: () => [ - "manga", - "anime", - "american comic", - "grayscale", - "monochrome", - "painting" - ], - }, - */ - /* - voynich: { - id: "voynich", - label: "Voynich", - family: "european", - color: "color", - font: "actionman", - llmPrompt: "new movie", - imagePrompt: (prompt: string) => [ - `voynich`, - `voynich page`, - // `medieval color engraving`, - `${prompt}`, - `medieval`, - ], - negativePrompt: () => [ - "manga", - "anime", - "american comic", - "grayscale", - "monochrome", - "painting" - ], - }, - */ - egyptian: { - id: "egyptian", - label: "Egyptian", - family: "european", - color: "color", - font: "actionman", - llmPrompt: "ancient egyptian stories.", - imagePrompt: (prompt: string) => [ - `ancient egyptian wall painting`, - // `medieval color engraving`, - `${prompt}`, - `ancient egypt`, - ], - negativePrompt: () => [ - "manga", - "anime", - "american comic", - "grayscale", - "monochrome", - "painting" - ], - }, - /* - psx: { - label: "PSX", - family: "european", - color: "color", - font: "actionman", - llmPrompt: "new movie", - imagePrompt: (prompt: string) => [ - `videogame screenshot`, - `3dfx`, - `3D dos game`, - `software rendering`, - `${prompt}`, - ], - negativePrompt: () => [ - "manga", - "anime", - "american comic", - "grayscale", - "monochrome", - "painting" - ], - }, - */ - /* - pixel: { - label: "Pixel", - family: "european", - color: "color", - font: "actionman", - llmPrompt: "new movie", - imagePrompt: (prompt: string) => [ - `pixelart`, - `isometric`, - `pixelated`, - `low res`, - `${prompt}`, - ], - negativePrompt: () => [ - "manga", - "anime", - "american comic", - "grayscale", - "monochrome", - "painting" - ], - }, - */ -} - -export type PresetName = keyof typeof presets - -export const defaultPreset: PresetName = "american_comic_90" - -export const nonRandomPresets = Object.keys(presets).filter(p => p !== "random") - -export const getPreset = (preset?: PresetName): Preset => presets[preset || defaultPreset] || presets[defaultPreset] - -export const getRandomPreset = (): Preset => { - const presetName = pick(Object.keys(presets).filter(preset => preset !== "random")) as PresetName - return getPreset(presetName) -} \ No newline at end of file diff --git a/spaces/DmitriiKhizbullin/camel-data-explorer/README.md b/spaces/DmitriiKhizbullin/camel-data-explorer/README.md deleted file mode 100644 index 24e9ae6d6b9bf4d36a5257313336b774bd1f4e4e..0000000000000000000000000000000000000000 --- a/spaces/DmitriiKhizbullin/camel-data-explorer/README.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: Camel Data Explorer -emoji: 🦀 -colorFrom: indigo -colorTo: pink -sdk: gradio -sdk_version: 3.27.0 -app_file: app.py -pinned: false -license: apache-2.0 ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/DpNaze/webui-docker/README.md b/spaces/DpNaze/webui-docker/README.md deleted file mode 100644 index d22e8f8da9454d6a294f591d8caf3d35e74c2acf..0000000000000000000000000000000000000000 --- a/spaces/DpNaze/webui-docker/README.md +++ /dev/null @@ -1,96 +0,0 @@ ---- -title: SD WebUI Plus Basics -emoji: 🐠 -colorFrom: gray -colorTo: blue -sdk: docker -pinned: true -duplicated_from: MiroCollas/SD_WebUI_Plus_Basics ---- - -This is a modified version of the Space here: https://huggingface.co/spaces/Xenos14/XenoEngine-SD-webui - -The original readme from that space follows my own comments. - -I adapted that space in order to use the current release of SD WebUI, as well as current extensions. The original was pulling old versions, for some reason. I also removed all the female-centric embeds, and made a few fixes. Some extensions have also been disabled, since they are less suitable for a public space. Removing them also makes the UI moer responsive (the more extensions, the slower it is, I have found). - -Added bug fix for https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/6840 - -If you like this space, duplicate it and customise it as you wish. - ---- - -This is a modified version of the Space here: carloscar/stable-diffusion-webui-controlnet-docker - -While it should still work fine with GPU upgrades (though untested), it has been optimized and set up with usage for a "no GPU" environment. I've removed a few extensions which won't work without a GPU and added a few more that help either performance or output quality in an environment without a GPU. - - -### Setup on Hugging Face - -1. Duplicate this space to your Hugging Face account or clone this repo to your account. -2. The [`on_start.sh`](./on_start.sh) file will be run when the container is started, right before the WebUI is initiated. This is where you can install any additional extensions or models you may need. Make sure the env value `IS_SHARED_UI` is set to `0` or is unset for your space, or else only the lightweight model installation will run and some features will be disabled. - ---- - -### Relevant links for more information - -#### Repo for this builder - -This repo, containing the `Dockerfile`, etc. for building the image can originally be found on both [`🤗 Hugging Face ➔ carloscar/stable-diffusion-webui-controlnet-docker`](https://huggingface.co/spaces/carloscar/stable-diffusion-webui-controlnet-docker) and [`🐙 GitHub ➔ kalaspuff/stable-diffusion-webui-controlnet-docker`](https://github.com/kalaspuff/stable-diffusion-webui-controlnet-docker). - -#### Stable Diffusion Web UI - -* Source Code: [https://github.com/AUTOMATIC1111/stable-diffusion-webui](https://github.com/AUTOMATIC1111/stable-diffusion-webui) -* Documentation: [https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki) - -#### WebUI extension for ControlNet - -* Source Code: [https://github.com/Mikubill/sd-webui-controlnet](https://github.com/Mikubill/sd-webui-controlnet) - -#### ControlNet models - -* Trained models: [https://github.com/lllyasviel/ControlNet](https://github.com/lllyasviel/ControlNet) -* Pre-extracted models: [https://huggingface.co/webui/ControlNet-modules-safetensors/tree/main](https://huggingface.co/webui/ControlNet-modules-safetensors/tree/main) - -#### Licenses for using Stable Diffusion models and ControlNet models - -* [https://huggingface.co/stabilityai/stable-diffusion-2/blob/main/LICENSE-MODEL](https://huggingface.co/stabilityai/stable-diffusion-2/blob/main/LICENSE-MODEL) -* [https://huggingface.co/spaces/CompVis/stable-diffusion-license](https://huggingface.co/spaces/CompVis/stable-diffusion-license) -* [https://github.com/lllyasviel/ControlNet/blob/main/LICENSE](https://github.com/lllyasviel/ControlNet/blob/main/LICENSE) - -### Enable additional models (checkpoints, LoRA, VAE, etc.) - -Enable the models you want to use on the bottom of the [`on_start.sh`](./on_start.sh) file. This is also the place to add any additional models you may want to install when starting your space. - -```bash -## Checkpoint · Example: -download-model --checkpoint "FILENAME" "URL" - -## LORA (low-rank adaptation) · Example: -download-model --lora "FILENAME" "URL" - -## VAE (variational autoencoder) · Example: -download-model --vae "FILENAME" "URL" -``` - -#### Some examples of additional (optional) models - -Some models such as additional checkpoints, VAE, LoRA, etc. may already be present in the [`on_start.sh`](./on_start.sh) file. You can enable them by removing the `#` in front of their respective line or disable them by removing the line or adding a leading `#` before `download-model`. - -* [Checkpoint · Dreamlike Diffusion 1.0](https://huggingface.co/dreamlike-art/dreamlike-diffusion-1.0) ([license](https://huggingface.co/dreamlike-art/dreamlike-diffusion-1.0/blob/main/LICENSE.md)) -* [Checkpoint · Dreamshaper 3.31](https://huggingface.co/Lykon/DreamShaper) -* [Checkpoint · The Ally's Mix III: Revolutions](https://civitai.com/models/10752/the-allys-mix-iii-revolutions) -* [Checkpoint · Deliberate v2](https://civitai.com/models/4823/deliberate) -* [Checkpoint · dalcefo_painting](https://civitai.com/models/5396/dalcefopainting) -* [Checkpoint · RPG v4](https://huggingface.co/Anashel/rpg) -* [Checkpoint · A to Zovya RPG Artist's Tools (1.5 & 2.1)](https://civitai.com/models/8124/a-to-zovya-rpg-artists-tools-15-and-21) -* [LoRA · epi_noiseoffset v2](https://civitai.com/models/13941/epinoiseoffset) -* [VAE · sd-vae-ft-mse-original](https://huggingface.co/stabilityai/sd-vae-ft-mse-original) -* [Embedding · bad_prompt_version2](https://huggingface.co/datasets/Nerfgun3/bad_prompt) -* See [https://huggingface.co/models?filter=stable-diffusion](https://huggingface.co/models?filter=stable-diffusion) and [https://civitai.com/](https://civitai.com/) for more. - -Visit the individual model pages for more information on the models and their licenses. - -### Additional acknowledgements - -A lot of inspiration for this Docker build comes from [GitHub ➔ camenduru](https://github.com/camenduru). Amazing things! 🙏 \ No newline at end of file diff --git a/spaces/Dusan/clickbaitonator/fudge/eval_poetry_metrics.py b/spaces/Dusan/clickbaitonator/fudge/eval_poetry_metrics.py deleted file mode 100644 index 8ab7874bf3bf27b118ee6760fd7073aa83eecd4c..0000000000000000000000000000000000000000 --- a/spaces/Dusan/clickbaitonator/fudge/eval_poetry_metrics.py +++ /dev/null @@ -1,135 +0,0 @@ -from argparse import ArgumentParser -import math -import string - -from tqdm import tqdm -import numpy as np -import torch -import torch.nn.functional as F -from transformers import AutoTokenizer, AutoModelWithLMHead, AutoModelForSequenceClassification - -from poetry_util import is_iambic, perfect_rhyme_end, count_syllables -from constants import * - - -def conditional_perplexity(prefix, pred, tokenizer, model, device='cuda', sep_losses=False): - # calculate perplexity on pred only, conditioned on prefix - sentence = prefix + pred - sos_token = tokenizer.decode([0]) - prefix_tensor_input = tokenizer.encode(sos_token + prefix.replace(EOT_TOKEN, ' ').strip(), return_tensors='pt').to(device) - full_tensor_input = tokenizer.encode(sos_token + sentence.replace(EOT_TOKEN, ' ').strip(), return_tensors='pt').to(device) - if sep_losses: - prefix_loss = model(prefix_tensor_input, labels=prefix_tensor_input)[0].sum() - full_loss = model(full_tensor_input, labels=full_tensor_input)[0].sum() - else: - prefix_loss = model(prefix_tensor_input, labels=prefix_tensor_input)[0] * (prefix_tensor_input.shape[1]-1) # neg log prob of prefix - full_loss = model(full_tensor_input, labels=full_tensor_input)[0] * (full_tensor_input.shape[1]-1) # neg log prob of full seq - pred_loss = full_loss - prefix_loss # neg log prob of preds given prefix - avg_pred_loss = pred_loss / (full_tensor_input.shape[1] - prefix_tensor_input.shape[1]) - return math.exp(avg_pred_loss.item()) - - -def grammaticality(sentences, tokenizer, model, device='cuda'): - with torch.no_grad(): - total_good = 0 - for sent in tqdm(sentences, total=len(sentences)): - good_prob = F.softmax(model(tokenizer.encode(sent, return_tensors='pt').to(device))[0].flatten(), dim=0)[1] - total_good += good_prob - return total_good / len(sentences) # avg probability of grammaticality according to model - - -def distinctness(sentences): - d1 = set() - d2 = set() - d3 = set() - total_words = 0 - for sentence in sentences: - o = sentence.split(' ') - total_words += len(o) - d1.update(o) - for i in range(len(o) - 1): - d2.add(o[i] + '_' + o[i+1]) - for i in range(len(o) - 2): - d3.add(o[i] + '_' + o[i+1] + '_' + o[i+2]) - return len(d1) / total_words, len(d2) / total_words, len(d3) / total_words - - -if __name__=='__main__': - parser = ArgumentParser() - parser.add_argument('--pred_file', type=str) - parser.add_argument('--prefix_file', type=str) - parser.add_argument('--device', type=str, default='cuda', choices=['cpu', 'cuda']) - args = parser.parse_args() - - preds = [] - with open(args.pred_file, 'r') as rf: - for line in rf: - preds.append(line[:-1]) # drop \n but not beginning spaces if any - prefixes = [] - with open(args.prefix_file, 'r') as rf: - for line in rf: - prefixes.append(line.strip()) - assert len(prefixes) == len(preds) - rhymes = 0 - iambic = 0 - ten_syllables = 0 - end = 0 - diff_rhymes = 0 - all_success = 0 - total = len(prefixes) - for prefix, pred in zip(prefixes, preds): - if is_iambic(pred): - iambic += 1 - if perfect_rhyme_end(prefix, pred): - rhymes += 1 - if prefix.split()[-1].strip(string.punctuation) != pred.split()[-1].strip(string.punctuation): - diff_rhymes += 1 - if count_syllables(pred) == 10: - ten_syllables += 1 - if pred.strip()[-1] in PHRASE_ENDS: - end += 1 - if is_iambic(pred) and perfect_rhyme_end(prefix, pred) and count_syllables(pred) == 10 and pred.strip()[-1] in PHRASE_ENDS: - all_success += 1 - print('iambic', iambic, 'out of', total, ', frac', iambic / total) - print('rhymes', rhymes, 'out of', total, ', frac', rhymes / total) - print('end sentence', end, 'out of', total, ', frac', end / total) - print('10 syllables', ten_syllables, 'out of', total, ', frac', ten_syllables / total) - print('all success', all_success, 'out of', total, ', frac', all_success / total) - print('rhymes with diff word', diff_rhymes, 'out of', total, ', frac', diff_rhymes / total) - - print('distinctness', distinctness(preds)) - - grammar_tokenizer = AutoTokenizer.from_pretrained('textattack/roberta-base-CoLA') - grammar_model = AutoModelForSequenceClassification.from_pretrained('textattack/roberta-base-CoLA').to(args.device) - grammar_model.eval() - print('grammaticality', grammaticality(preds, grammar_tokenizer, grammar_model, device=args.device)) - - perplexities = [] - eval_tokenizer = AutoTokenizer.from_pretrained('transfo-xl-wt103') - eval_model = AutoModelWithLMHead.from_pretrained('transfo-xl-wt103').to(args.device) - eval_model.eval() - for prefix, pred in zip(prefixes, preds): - perplexities.append(conditional_perplexity(prefix, pred, eval_tokenizer, eval_model, device=args.device, sep_losses=True)) - print('transformer xl perplexity', np.mean(perplexities), '+/-', np.std(perplexities)) - - perplexities = [] - eval_tokenizer = AutoTokenizer.from_pretrained('openai-gpt') - eval_model = AutoModelWithLMHead.from_pretrained('openai-gpt').to(args.device) - eval_model.eval() - for prefix, pred in zip(prefixes, preds): - perplexities.append(conditional_perplexity(prefix, pred, eval_tokenizer, eval_model, device=args.device)) - print('gpt perplexity', np.mean(perplexities), '+/-', np.std(perplexities)) - - # NOTE: uncomment this section with the path to the Shakespeare-finetuned GPT to evaluate this metric. it's in ckpt/poetry/gpt_finetune_shakespeare.pth.tar. - # eval_tokenizer = AutoTokenizer.from_pretrained('openai-gpt') - # eval_model = AutoModelWithLMHead.from_pretrained('openai-gpt').to(args.device) - # checkpoint = torch.load('***PATH_TO_SHAKESPEARE_FINETUNED_GPT***', map_location=args.device) - # mod_dict = {} - # for key in checkpoint['state_dict']: - # mod_dict[key.replace('classifier.', '')] = checkpoint['state_dict'][key] - # eval_model.load_state_dict(mod_dict) - # eval_model.eval() - # perplexities = [] - # for prefix, pred in zip(prefixes, preds): - # perplexities.append(conditional_perplexity(prefix, pred, eval_tokenizer, eval_model, device=args.device)) - # print('shakespeare finetuned perplexity', np.mean(perplexities), '+/-', np.std(perplexities)) diff --git a/spaces/Eddycrack864/Applio-Inference/rvc_for_realtime.py b/spaces/Eddycrack864/Applio-Inference/rvc_for_realtime.py deleted file mode 100644 index 55070f668c385ba0a9ba50989b282448cd75e59b..0000000000000000000000000000000000000000 --- a/spaces/Eddycrack864/Applio-Inference/rvc_for_realtime.py +++ /dev/null @@ -1,297 +0,0 @@ -import faiss, torch, traceback, parselmouth, numpy as np, torchcrepe, torch.nn as nn, pyworld -from fairseq import checkpoint_utils -from lib.infer_pack.models import ( - SynthesizerTrnMs256NSFsid, - SynthesizerTrnMs256NSFsid_nono, - SynthesizerTrnMs768NSFsid, - SynthesizerTrnMs768NSFsid_nono, -) -import os, sys -from time import time as ttime -import torch.nn.functional as F -import scipy.signal as signal - -now_dir = os.getcwd() -sys.path.append(now_dir) -from configs.config import Config -from multiprocessing import Manager as M - -mm = M() -config = Config() - - -class RVC: - def __init__( - self, key, pth_path, index_path, index_rate, n_cpu, inp_q, opt_q, device - ) -> None: - """ - 初始化 - """ - try: - global config - self.inp_q = inp_q - self.opt_q = opt_q - self.device = device - self.f0_up_key = key - self.time_step = 160 / 16000 * 1000 - self.f0_min = 50 - self.f0_max = 1100 - self.f0_mel_min = 1127 * np.log(1 + self.f0_min / 700) - self.f0_mel_max = 1127 * np.log(1 + self.f0_max / 700) - self.sr = 16000 - self.window = 160 - self.n_cpu = n_cpu - if index_rate != 0: - self.index = faiss.read_index(index_path) - self.big_npy = self.index.reconstruct_n(0, self.index.ntotal) - print("index search enabled") - self.index_rate = index_rate - models, _, _ = checkpoint_utils.load_model_ensemble_and_task( - ["hubert_base.pt"], - suffix="", - ) - hubert_model = models[0] - hubert_model = hubert_model.to(config.device) - if config.is_half: - hubert_model = hubert_model.half() - else: - hubert_model = hubert_model.float() - hubert_model.eval() - self.model = hubert_model - cpt = torch.load(pth_path, map_location="cpu") - self.tgt_sr = cpt["config"][-1] - cpt["config"][-3] = cpt["weight"]["emb_g.weight"].shape[0] - self.if_f0 = cpt.get("f0", 1) - self.version = cpt.get("version", "v1") - if self.version == "v1": - if self.if_f0 == 1: - self.net_g = SynthesizerTrnMs256NSFsid( - *cpt["config"], is_half=config.is_half - ) - else: - self.net_g = SynthesizerTrnMs256NSFsid_nono(*cpt["config"]) - elif self.version == "v2": - if self.if_f0 == 1: - self.net_g = SynthesizerTrnMs768NSFsid( - *cpt["config"], is_half=config.is_half - ) - else: - self.net_g = SynthesizerTrnMs768NSFsid_nono(*cpt["config"]) - del self.net_g.enc_q - print(self.net_g.load_state_dict(cpt["weight"], strict=False)) - self.net_g.eval().to(device) - if config.is_half: - self.net_g = self.net_g.half() - else: - self.net_g = self.net_g.float() - self.is_half = config.is_half - except: - print(traceback.format_exc()) - - def get_f0_post(self, f0): - f0_min = self.f0_min - f0_max = self.f0_max - f0_mel_min = 1127 * np.log(1 + f0_min / 700) - f0_mel_max = 1127 * np.log(1 + f0_max / 700) - f0bak = f0.copy() - f0_mel = 1127 * np.log(1 + f0 / 700) - f0_mel[f0_mel > 0] = (f0_mel[f0_mel > 0] - f0_mel_min) * 254 / ( - f0_mel_max - f0_mel_min - ) + 1 - f0_mel[f0_mel <= 1] = 1 - f0_mel[f0_mel > 255] = 255 - f0_coarse = np.rint(f0_mel).astype(np.int_) - return f0_coarse, f0bak - - def get_f0(self, x, f0_up_key, n_cpu, method="harvest"): - n_cpu = int(n_cpu) - if method == "crepe": - return self.get_f0_crepe(x, f0_up_key) - if method == "rmvpe": - return self.get_f0_rmvpe(x, f0_up_key) - if method == "pm": - p_len = x.shape[0] // 160 - f0 = ( - parselmouth.Sound(x, 16000) - .to_pitch_ac( - time_step=0.01, - voicing_threshold=0.6, - pitch_floor=50, - pitch_ceiling=1100, - ) - .selected_array["frequency"] - ) - - pad_size = (p_len - len(f0) + 1) // 2 - if pad_size > 0 or p_len - len(f0) - pad_size > 0: - print(pad_size, p_len - len(f0) - pad_size) - f0 = np.pad( - f0, [[pad_size, p_len - len(f0) - pad_size]], mode="constant" - ) - - f0 *= pow(2, f0_up_key / 12) - return self.get_f0_post(f0) - if n_cpu == 1: - f0, t = pyworld.harvest( - x.astype(np.double), - fs=16000, - f0_ceil=1100, - f0_floor=50, - frame_period=10, - ) - f0 = signal.medfilt(f0, 3) - f0 *= pow(2, f0_up_key / 12) - return self.get_f0_post(f0) - f0bak = np.zeros(x.shape[0] // 160, dtype=np.float64) - length = len(x) - part_length = int(length / n_cpu / 160) * 160 - ts = ttime() - res_f0 = mm.dict() - for idx in range(n_cpu): - tail = part_length * (idx + 1) + 320 - if idx == 0: - self.inp_q.put((idx, x[:tail], res_f0, n_cpu, ts)) - else: - self.inp_q.put( - (idx, x[part_length * idx - 320 : tail], res_f0, n_cpu, ts) - ) - while 1: - res_ts = self.opt_q.get() - if res_ts == ts: - break - f0s = [i[1] for i in sorted(res_f0.items(), key=lambda x: x[0])] - for idx, f0 in enumerate(f0s): - if idx == 0: - f0 = f0[:-3] - elif idx != n_cpu - 1: - f0 = f0[2:-3] - else: - f0 = f0[2:-1] - f0bak[ - part_length * idx // 160 : part_length * idx // 160 + f0.shape[0] - ] = f0 - f0bak = signal.medfilt(f0bak, 3) - f0bak *= pow(2, f0_up_key / 12) - return self.get_f0_post(f0bak) - - def get_f0_crepe(self, x, f0_up_key): - audio = torch.tensor(np.copy(x))[None].float() - f0, pd = torchcrepe.predict( - audio, - self.sr, - 160, - self.f0_min, - self.f0_max, - "full", - batch_size=512, - device=self.device, - return_periodicity=True, - ) - pd = torchcrepe.filter.median(pd, 3) - f0 = torchcrepe.filter.mean(f0, 3) - f0[pd < 0.1] = 0 - f0 = f0[0].cpu().numpy() - f0 *= pow(2, f0_up_key / 12) - return self.get_f0_post(f0) - - def get_f0_rmvpe(self, x, f0_up_key): - if hasattr(self, "model_rmvpe") == False: - from infer.lib.rmvpe import RMVPE - - print("loading rmvpe model") - self.model_rmvpe = RMVPE( - "rmvpe.pt", is_half=self.is_half, device=self.device - ) - # self.model_rmvpe = RMVPE("aug2_58000_half.pt", is_half=self.is_half, device=self.device) - f0 = self.model_rmvpe.infer_from_audio(x, thred=0.03) - f0 *= pow(2, f0_up_key / 12) - return self.get_f0_post(f0) - - def infer( - self, - feats: torch.Tensor, - indata: np.ndarray, - rate1, - rate2, - cache_pitch, - cache_pitchf, - f0method, - ) -> np.ndarray: - feats = feats.view(1, -1) - if config.is_half: - feats = feats.half() - else: - feats = feats.float() - feats = feats.to(self.device) - t1 = ttime() - with torch.no_grad(): - padding_mask = torch.BoolTensor(feats.shape).to(self.device).fill_(False) - inputs = { - "source": feats, - "padding_mask": padding_mask, - "output_layer": 9 if self.version == "v1" else 12, - } - logits = self.model.extract_features(**inputs) - feats = ( - self.model.final_proj(logits[0]) if self.version == "v1" else logits[0] - ) - t2 = ttime() - try: - if hasattr(self, "index") and self.index_rate != 0: - leng_replace_head = int(rate1 * feats[0].shape[0]) - npy = feats[0][-leng_replace_head:].cpu().numpy().astype("float32") - score, ix = self.index.search(npy, k=8) - weight = np.square(1 / score) - weight /= weight.sum(axis=1, keepdims=True) - npy = np.sum(self.big_npy[ix] * np.expand_dims(weight, axis=2), axis=1) - if config.is_half: - npy = npy.astype("float16") - feats[0][-leng_replace_head:] = ( - torch.from_numpy(npy).unsqueeze(0).to(self.device) * self.index_rate - + (1 - self.index_rate) * feats[0][-leng_replace_head:] - ) - else: - print("index search FAIL or disabled") - except: - traceback.print_exc() - print("index search FAIL") - feats = F.interpolate(feats.permute(0, 2, 1), scale_factor=2).permute(0, 2, 1) - t3 = ttime() - if self.if_f0 == 1: - pitch, pitchf = self.get_f0(indata, self.f0_up_key, self.n_cpu, f0method) - cache_pitch[:] = np.append(cache_pitch[pitch[:-1].shape[0] :], pitch[:-1]) - cache_pitchf[:] = np.append( - cache_pitchf[pitchf[:-1].shape[0] :], pitchf[:-1] - ) - p_len = min(feats.shape[1], 13000, cache_pitch.shape[0]) - else: - cache_pitch, cache_pitchf = None, None - p_len = min(feats.shape[1], 13000) - t4 = ttime() - feats = feats[:, :p_len, :] - if self.if_f0 == 1: - cache_pitch = cache_pitch[:p_len] - cache_pitchf = cache_pitchf[:p_len] - cache_pitch = torch.LongTensor(cache_pitch).unsqueeze(0).to(self.device) - cache_pitchf = torch.FloatTensor(cache_pitchf).unsqueeze(0).to(self.device) - p_len = torch.LongTensor([p_len]).to(self.device) - ii = 0 # sid - sid = torch.LongTensor([ii]).to(self.device) - with torch.no_grad(): - if self.if_f0 == 1: - infered_audio = ( - self.net_g.infer( - feats, p_len, cache_pitch, cache_pitchf, sid, rate2 - )[0][0, 0] - .data.cpu() - .float() - ) - else: - infered_audio = ( - self.net_g.infer(feats, p_len, sid, rate2)[0][0, 0] - .data.cpu() - .float() - ) - t5 = ttime() - print("time->fea-index-f0-model:", t2 - t1, t3 - t2, t4 - t3, t5 - t4) - return infered_audio diff --git a/spaces/Flux9665/IMS-Toucan/Layers/PostNet.py b/spaces/Flux9665/IMS-Toucan/Layers/PostNet.py deleted file mode 100644 index a4d7b4fe104e81af40ca888a6cc3a8dec5c2c980..0000000000000000000000000000000000000000 --- a/spaces/Flux9665/IMS-Toucan/Layers/PostNet.py +++ /dev/null @@ -1,74 +0,0 @@ -""" -Taken from ESPNet -""" - -import torch - - -class PostNet(torch.nn.Module): - """ - From Tacotron2 - - Postnet module for Spectrogram prediction network. - - This is a module of Postnet in Spectrogram prediction network, - which described in `Natural TTS Synthesis by - Conditioning WaveNet on Mel Spectrogram Predictions`_. - The Postnet refines the predicted - Mel-filterbank of the decoder, - which helps to compensate the detail sturcture of spectrogram. - - .. _`Natural TTS Synthesis by Conditioning WaveNet on Mel Spectrogram Predictions`: - https://arxiv.org/abs/1712.05884 - """ - - def __init__(self, idim, odim, n_layers=5, n_chans=512, n_filts=5, dropout_rate=0.5, use_batch_norm=True): - """ - Initialize postnet module. - - Args: - idim (int): Dimension of the inputs. - odim (int): Dimension of the outputs. - n_layers (int, optional): The number of layers. - n_filts (int, optional): The number of filter size. - n_units (int, optional): The number of filter channels. - use_batch_norm (bool, optional): Whether to use batch normalization.. - dropout_rate (float, optional): Dropout rate.. - """ - super(PostNet, self).__init__() - self.postnet = torch.nn.ModuleList() - for layer in range(n_layers - 1): - ichans = odim if layer == 0 else n_chans - ochans = odim if layer == n_layers - 1 else n_chans - if use_batch_norm: - self.postnet += [torch.nn.Sequential(torch.nn.Conv1d(ichans, ochans, n_filts, stride=1, padding=(n_filts - 1) // 2, bias=False, ), - torch.nn.GroupNorm(num_groups=32, num_channels=ochans), torch.nn.Tanh(), - torch.nn.Dropout(dropout_rate), )] - - else: - self.postnet += [ - torch.nn.Sequential(torch.nn.Conv1d(ichans, ochans, n_filts, stride=1, padding=(n_filts - 1) // 2, bias=False, ), torch.nn.Tanh(), - torch.nn.Dropout(dropout_rate), )] - ichans = n_chans if n_layers != 1 else odim - if use_batch_norm: - self.postnet += [torch.nn.Sequential(torch.nn.Conv1d(ichans, odim, n_filts, stride=1, padding=(n_filts - 1) // 2, bias=False, ), - torch.nn.GroupNorm(num_groups=20, num_channels=odim), - torch.nn.Dropout(dropout_rate), )] - - else: - self.postnet += [torch.nn.Sequential(torch.nn.Conv1d(ichans, odim, n_filts, stride=1, padding=(n_filts - 1) // 2, bias=False, ), - torch.nn.Dropout(dropout_rate), )] - - def forward(self, xs): - """ - Calculate forward propagation. - - Args: - xs (Tensor): Batch of the sequences of padded input tensors (B, idim, Tmax). - - Returns: - Tensor: Batch of padded output tensor. (B, odim, Tmax). - """ - for i in range(len(self.postnet)): - xs = self.postnet[i](xs) - return xs diff --git a/spaces/ForTheLoveOfML0/X-ray_Classifier/Utils/Pneumonia_Utils.py b/spaces/ForTheLoveOfML0/X-ray_Classifier/Utils/Pneumonia_Utils.py deleted file mode 100644 index b1cab1c98f460a7cc8731f120bc029e17bf2c5dc..0000000000000000000000000000000000000000 --- a/spaces/ForTheLoveOfML0/X-ray_Classifier/Utils/Pneumonia_Utils.py +++ /dev/null @@ -1,99 +0,0 @@ -import cv2 -from PIL import Image -import torch -import matplotlib.pyplot as plt -import torch.functional as F -import torch.nn as nn -import numpy as np -import torchvision -import torchvision.transforms as transform -# !pip install efficientnet_pytorch -q -from efficientnet_pytorch import EfficientNet - -if torch.cuda.is_available(): - device = torch.device("cuda") -else: - device = torch.device("cpu") - -val_transform = transform.Compose([transform.Resize(255), - transform.CenterCrop(224), - transform.ToTensor(), - ]) - -def transform_image(image, transforms): - # img = cv2.cvtColor(cv2.imread(image_path), cv2.COLOR_BGR2RGB) - img = transforms(image) - img = img.unsqueeze(0) - return img - -DenseNet = torchvision.models.densenet161(weights="DEFAULT") -for param in DenseNet.parameters(): - param.requires_grad = True -in_features = DenseNet.classifier.in_features -DenseNet.classifier = nn.Linear(in_features, 2) - - - -class ModelGradCam(nn.Module): - def __init__(self, base_model): - super(ModelGradCam, self).__init__() - - self.base_model = base_model - self.features_conv = self.base_model.features - self.pool = nn.AdaptiveAvgPool2d((1,1)) - self.classifier = self.base_model.classifier - self.gradients = None - - def activations_hook(self, grad): - self.gradients = grad - - def forward(self, x): - x = self.features_conv(x) - h = x.register_hook(self.activations_hook) - x = self.pool(x) - x = x.view(-1, 2208) - x = self.classifier(x) - return x - - def get_activations_gradient(self): - return self.gradients - - def get_activations(self, x): - return self.features_conv(x) - -def plot_grad_cam(model, x_ray_image, class_names, normalized=True): - - model.eval() - # fig, axs = plt.subplots(1, 2, figsize=(15, 10)) - - image = x_ray_image - outputs = torch.nn.functional.softmax(model(image), dim=1) - _, pred = torch.max(outputs, 1) - outputs[0][pred.detach().cpu().numpy()[0]].backward() - gradients = model.get_activations_gradient() - pooled_gradients = torch.mean(gradients, dim=[0, 2, 3]) - activations = model.get_activations(image).detach() - - activations *= pooled_gradients.unsqueeze(-1).unsqueeze(-1) - heatmap = torch.mean(activations, dim=1).squeeze() - heatmap = np.maximum(heatmap.cpu(), 0) - heatmap /= torch.max(heatmap) - - img = image.squeeze().permute(1, 2, 0).cpu().numpy() - img = img if normalized else img/255.0 - heatmap = cv2.resize(heatmap.numpy(), (img.shape[1], img.shape[0])) - heatmap = np.uint8(255 * heatmap) - heatmap = cv2.applyColorMap(heatmap, cv2.COLORMAP_JET) - - superimposed_img = heatmap * 0.0025 + img - outputs = outputs.tolist()[0] - output_dict = dict(zip(class_names, np.round(outputs,3))) - return superimposed_img, class_names[pred.item()], output_dict - # axs[0].imshow(img) - # axs[1].imshow(superimposed_img) - # axs[0].set_title(f'Predicted: {class_names[pred.item()]}\n Confidence: {conf.item():.2f}') - # axs[0].axis('off') - # axs[1].set_title(f'Predicted: {class_names[pred.item()]}\n Confidence: {conf.item():.2f}') - # axs[1].axis('off') - # plt.show() - diff --git a/spaces/FreeHamish/Manaforge/README.md b/spaces/FreeHamish/Manaforge/README.md deleted file mode 100644 index acf7fbe69d28b9a9b598d22c82603de8e1744d5c..0000000000000000000000000000000000000000 --- a/spaces/FreeHamish/Manaforge/README.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: AlfredPenny -emoji: 🏢 -colorFrom: gray -colorTo: purple -sdk: gradio -sdk_version: 3.29.0 -app_file: app.py -pinned: false ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/Frilles/FoodVision_Big/app.py b/spaces/Frilles/FoodVision_Big/app.py deleted file mode 100644 index b06159c343df9765ba52977ce58a0fc51b9c23b5..0000000000000000000000000000000000000000 --- a/spaces/Frilles/FoodVision_Big/app.py +++ /dev/null @@ -1,70 +0,0 @@ -### 1. Imports and class names setup ### -import gradio as gr -import os -import torch - -from model import create_effnetb2_model -from timeit import default_timer as timer -from typing import Tuple, Dict - -# Setup class names -with open("class_names.txt", "r") as f: - class_names = [food_name.strip() for food_name in f.readlines()] - -### 2. Model and transforms preparation ### -# Create model and transforms -effnetb2, effnetb2_transforms = create_effnetb2_model(num_classes=101) - -# Load saved weights -effnetb2.load_state_dict( - torch.load(f="09_pretrained_effnetb2_feature_extractor_food101_20_percent.pth", - map_location=torch.device("cpu")) # load to CPU -) - -### 3. Predict function ### - -def predict(img) -> Tuple[Dict, float]: - # Start a timer - start_time = timer() - - # Transform the input image for use with EffNetB2 - img = effnetb2_transforms(img).unsqueeze(0) # unsqueeze = add batch dimension on 0th index - - # Put model into eval mode, make prediction - effnetb2.eval() - with torch.inference_mode(): - # Pass transformed image through the model and turn the prediction logits into probaiblities - pred_probs = torch.softmax(effnetb2(img), dim=1) - - # Create a prediction label and prediction probability dictionary - pred_labels_and_probs = {class_names[i]: float(pred_probs[0][i]) for i in range(len(class_names))} - - # Calculate pred time - end_time = timer() - pred_time = round(end_time - start_time, 4) - - # Return pred dict and pred time - return pred_labels_and_probs, pred_time - -### 4. Gradio app ### - -# Create title, description and article -title = "AI FoodVision BIG 🍔👁💪 by RJ" -description = "Hello, welcome sa Hugging Face! Upload lang kayo ng image ng pagkain para tignan niyo kung makikilala at macaclassify ng AI ng tama ang Image nayon.\Pero kung hindi niya naclassify ng tama, I would like to hear your feedback on the matter so I might be able to improve and optimize the model. Regardless, I'm still trying my best to work on to improve this model. Salamat!!!" -article = "An [EfficientNetB2 feature extractor](https://pytorch.org/vision/stable/models/generated/torchvision.models.efficientnet_b2.html#torchvision.models.efficientnet_b2) computer vision model to classify images [101 classes of food from the Food101 dataset](https://github.com/mrdbourke/pytorch-deep-learning/blob/main/extras/food101_class_names.txt).\nCreated at [09. PyTorch Model Deployment](https://www.learnpytorch.io/09_pytorch_model_deployment/#11-turning-our-foodvision-big-model-into-a-deployable-app)." - -# Create example list -example_list = [["examples/" + example] for example in os.listdir("examples")] - -# Create the Gradio demo -demo = gr.Interface(fn=predict, # maps inputs to outputs - inputs=gr.Image(type="pil"), - outputs=[gr.Label(num_top_classes=5, label="Predictions"), - gr.Number(label="Prediction time (s)")], - examples=example_list, - title=title, - description=description, - article=article) - -# Launch the demo -demo.launch() \ No newline at end of file diff --git a/spaces/GPTMonster/KBprototype_first/polly_utils.py b/spaces/GPTMonster/KBprototype_first/polly_utils.py deleted file mode 100644 index 7cb38abff2aaac3c5b24f20914d464151173780d..0000000000000000000000000000000000000000 --- a/spaces/GPTMonster/KBprototype_first/polly_utils.py +++ /dev/null @@ -1,635 +0,0 @@ -# This class stores Polly voice data. Specifically, the class stores several records containing -# language, lang_code, gender, voice_id and engine. The class also has a method to return the -# voice_id, lang_code and engine given a language and gender. - -NEURAL_ENGINE = "neural" -STANDARD_ENGINE = "standard" - - -class PollyVoiceData: - def get_voice(self, language, gender): - for voice in self.voice_data: - if voice['language'] == language and voice['gender'] == gender: - if voice['neural'] == 'Yes': - return voice['voice_id'], voice['lang_code'], NEURAL_ENGINE - for voice in self.voice_data: - if voice['language'] == language and voice['gender'] == gender: - if voice['standard'] == 'Yes': - return voice['voice_id'], voice['lang_code'], STANDARD_ENGINE - return None, None, None - - def get_whisper_lang_code(self, language): - for voice in self.voice_data: - if voice['language'] == language: - return voice['whisper_lang_code'] - return "en" - - def __init__(self): - self.voice_data = [ - {'language': 'Arabic', - 'lang_code': 'arb', - 'whisper_lang_code': 'ar', - 'voice_id': 'Zeina', - 'gender': 'Female', - 'neural': 'No', - 'standard': 'Yes'}, - {'language': 'Arabic (Gulf)', - 'lang_code': 'ar-AE', - 'whisper_lang_code': 'ar', - 'voice_id': 'Hala', - 'gender': 'Female', - 'neural': 'Yes', - 'standard': 'No'}, - {'language': 'Catalan', - 'lang_code': 'ca-ES', - 'whisper_lang_code': 'ca', - 'voice_id': 'Arlet', - 'gender': 'Female', - 'neural': 'Yes', - 'standard': 'No'}, - {'language': 'Chinese (Cantonese)', - 'lang_code': 'yue-CN', - 'whisper_lang_code': 'zh', - 'voice_id': 'Hiujin', - 'gender': 'Female', - 'neural': 'Yes', - 'standard': 'No'}, - {'language': 'Chinese (Mandarin)', - 'lang_code': 'cmn-CN', - 'whisper_lang_code': 'zh', - 'voice_id': 'Zhiyu', - 'gender': 'Female', - 'neural': 'Yes', - 'standard': 'No'}, - {'language': 'Danish', - 'lang_code': 'da-DK', - 'whisper_lang_code': 'da', - 'voice_id': 'Naja', - 'gender': 'Female', - 'neural': 'No', - 'standard': 'Yes'}, - {'language': 'Danish', - 'lang_code': 'da-DK', - 'whisper_lang_code': 'da', - 'voice_id': 'Mads', - 'gender': 'Male', - 'neural': 'No', - 'standard': 'Yes'}, - {'language': 'Dutch', - 'lang_code': 'nl-NL', - 'whisper_lang_code': 'nl', - 'voice_id': 'Laura', - 'gender': 'Female', - 'neural': 'Yes', - 'standard': 'No'}, - {'language': 'Dutch', - 'lang_code': 'nl-NL', - 'whisper_lang_code': 'nl', - 'voice_id': 'Lotte', - 'gender': 'Female', - 'neural': 'No', - 'standard': 'Yes'}, - {'language': 'Dutch', - 'lang_code': 'nl-NL', - 'whisper_lang_code': 'nl', - 'voice_id': 'Ruben', - 'gender': 'Male', - 'neural': 'No', - 'standard': 'Yes'}, - {'language': 'English (Australian)', - 'lang_code': 'en-AU', - 'whisper_lang_code': 'en', - 'voice_id': 'Nicole', - 'gender': 'Female', - 'neural': 'No', - 'standard': 'Yes'}, - {'language': 'English (Australian)', - 'lang_code': 'en-AU', - 'whisper_lang_code': 'en', - 'voice_id': 'Olivia', - 'gender': 'Female', - 'neural': 'Yes', - 'standard': 'No'}, - {'language': 'English (Australian)', - 'lang_code': 'en-AU', - 'whisper_lang_code': 'en', - 'voice_id': 'Russell', - 'gender': 'Male', - 'neural': 'No', - 'standard': 'Yes'}, - {'language': 'English (British)', - 'lang_code': 'en-GB', - 'whisper_lang_code': 'en', - 'voice_id': 'Amy', - 'gender': 'Female', - 'neural': 'Yes', - 'standard': 'Yes'}, - {'language': 'English (British)', - 'lang_code': 'en-GB', - 'whisper_lang_code': 'en', - 'voice_id': 'Emma', - 'gender': 'Female', - 'neural': 'Yes', - 'standard': 'Yes'}, - {'language': 'English (British)', - 'lang_code': 'en-GB', - 'whisper_lang_code': 'en', - 'voice_id': 'Brian', - 'gender': 'Male', - 'neural': 'Yes', - 'standard': 'Yes'}, - {'language': 'English (British)', - 'lang_code': 'en-GB', - 'whisper_lang_code': 'en', - 'voice_id': 'Arthur', - 'gender': 'Male', - 'neural': 'Yes', - 'standard': 'No'}, - {'language': 'English (Indian)', - 'lang_code': 'en-IN', - 'whisper_lang_code': 'en', - 'voice_id': 'Aditi', - 'gender': 'Female', - 'neural': 'No', - 'standard': 'Yes'}, - {'language': 'English (Indian)', - 'lang_code': 'en-IN', - 'whisper_lang_code': 'en', - 'voice_id': 'Raveena', - 'gender': 'Female', - 'neural': 'No', - 'standard': 'Yes'}, - {'language': 'English (Indian)', - 'lang_code': 'en-IN', - 'whisper_lang_code': 'en', - 'voice_id': 'Kajal', - 'gender': 'Female', - 'neural': 'Yes', - 'standard': 'No'}, - {'language': 'English (New Zealand)', - 'lang_code': 'en-NZ', - 'whisper_lang_code': 'en', - 'voice_id': 'Aria', - 'gender': 'Female', - 'neural': 'Yes', - 'standard': 'No'}, - {'language': 'English (South African)', - 'lang_code': 'en-ZA', - 'whisper_lang_code': 'en', - 'voice_id': 'Ayanda', - 'gender': 'Female', - 'neural': 'Yes', - 'standard': 'No'}, - {'language': 'English (US)', - 'lang_code': 'en-US', - 'whisper_lang_code': 'en', - 'voice_id': 'Ivy', - 'gender': 'Female (child)', - 'neural': 'Yes', - 'standard': 'Yes'}, - {'language': 'English (US)', - 'lang_code': 'en-US', - 'whisper_lang_code': 'en', - 'voice_id': 'Joanna', - 'gender': 'Female', - 'neural': 'Yes', - 'standard': 'Yes'}, - {'language': 'English (US)', - 'lang_code': 'en-US', - 'whisper_lang_code': 'en', - 'voice_id': 'Kendra', - 'gender': 'Female', - 'neural': 'Yes', - 'standard': 'Yes'}, - {'language': 'English (US)', - 'lang_code': 'en-US', - 'whisper_lang_code': 'en', - 'voice_id': 'Kimberly', - 'gender': 'Female', - 'neural': 'Yes', - 'standard': 'Yes'}, - {'language': 'English (US)', - 'lang_code': 'en-US', - 'whisper_lang_code': 'en', - 'voice_id': 'Salli', - 'gender': 'Female', - 'neural': 'Yes', - 'standard': 'Yes'}, - {'language': 'English (US)', - 'lang_code': 'en-US', - 'whisper_lang_code': 'en', - 'voice_id': 'Joey', - 'gender': 'Male', - 'neural': 'Yes', - 'standard': 'Yes'}, - {'language': 'English (US)', - 'lang_code': 'en-US', - 'whisper_lang_code': 'en', - 'voice_id': 'Justin', - 'gender': 'Male (child)', - 'neural': 'Yes', - 'standard': 'Yes'}, - {'language': 'English (US)', - 'lang_code': 'en-US', - 'whisper_lang_code': 'en', - 'voice_id': 'Kevin', - 'gender': 'Male (child)', - 'neural': 'Yes', - 'standard': 'No'}, - {'language': 'English (US)', - 'lang_code': 'en-US', - 'whisper_lang_code': 'en', - 'voice_id': 'Matthew', - 'gender': 'Male', - 'neural': 'Yes', - 'standard': 'Yes'}, - {'language': 'English (Welsh)', - 'lang_code': 'en-GB-WLS', - 'whisper_lang_code': 'en', - 'voice_id': 'Geraint', - 'gender': 'Male', - 'neural': 'No', - 'standard': 'Yes'}, - {'language': 'Finnish', - 'lang_code': 'fi-FI', - 'whisper_lang_code': 'fi', - 'voice_id': 'Suvi', - 'gender': 'Female', - 'neural': 'Yes', - 'standard': 'No'}, - {'language': 'French', - 'lang_code': 'fr-FR', - 'whisper_lang_code': 'fr', - 'voice_id': 'Celine', - 'gender': 'Female', - 'neural': 'No', - 'standard': 'Yes'}, - {'language': 'French', - 'lang_code': 'fr-FR', - 'whisper_lang_code': 'fr', - 'voice_id': 'Lea', - 'gender': 'Female', - 'neural': 'Yes', - 'standard': 'Yes'}, - {'language': 'French', - 'lang_code': 'fr-FR', - 'whisper_lang_code': 'fr', - 'voice_id': 'Mathieu', - 'gender': 'Male', - 'neural': 'No', - 'standard': 'Yes'}, - {'language': 'French (Canadian)', - 'lang_code': 'fr-CA', - 'whisper_lang_code': 'fr', - 'voice_id': 'Chantal', - 'gender': 'Female', - 'neural': 'No', - 'standard': 'Yes'}, - {'language': 'French (Canadian)', - 'lang_code': 'fr-CA', - 'whisper_lang_code': 'fr', - 'voice_id': 'Gabrielle', - 'gender': 'Female', - 'neural': 'Yes', - 'standard': 'No'}, - {'language': 'French (Canadian)', - 'lang_code': 'fr-CA', - 'whisper_lang_code': 'fr', - 'voice_id': 'Liam', - 'gender': 'Male', - 'neural': 'Yes', - 'standard': 'No'}, - {'language': 'German', - 'lang_code': 'de-DE', - 'whisper_lang_code': 'de', - 'voice_id': 'Marlene', - 'gender': 'Female', - 'neural': 'No', - 'standard': 'Yes'}, - {'language': 'German', - 'lang_code': 'de-DE', - 'whisper_lang_code': 'de', - 'voice_id': 'Vicki', - 'gender': 'Female', - 'neural': 'Yes', - 'standard': 'Yes'}, - {'language': 'German', - 'lang_code': 'de-DE', - 'whisper_lang_code': 'de', - 'voice_id': 'Hans', - 'gender': 'Male', - 'neural': 'No', - 'standard': 'Yes'}, - {'language': 'German', - 'lang_code': 'de-DE', - 'whisper_lang_code': 'de', - 'voice_id': 'Daniel', - 'gender': 'Male', - 'neural': 'Yes', - 'standard': 'No'}, - {'language': 'German (Austrian)', - 'lang_code': 'de-AT', - 'whisper_lang_code': 'de', - 'voice_id': 'Hannah', - 'gender': 'Female', - 'neural': 'Yes', - 'standard': 'No'}, - {'language': 'Hindi', - 'lang_code': 'hi-IN', - 'whisper_lang_code': 'hi', - 'voice_id': 'Aditi', - 'gender': 'Female', - 'neural': 'No', - 'standard': 'Yes'}, - {'language': 'Hindi', - 'lang_code': 'hi-IN', - 'whisper_lang_code': 'hi', - 'voice_id': 'Kajal', - 'gender': 'Female', - 'neural': 'Yes', - 'standard': 'No'}, - {'language': 'Icelandic', - 'lang_code': 'is-IS', - 'whisper_lang_code': 'is', - 'voice_id': 'Dora', - 'gender': 'Female', - 'neural': 'No', - 'standard': 'Yes'}, - {'language': 'Icelandic', - 'lang_code': 'is-IS', - 'whisper_lang_code': 'is', - 'voice_id': 'Karl', - 'gender': 'Male', - 'neural': 'No', - 'standard': 'Yes'}, - {'language': 'Italian', - 'lang_code': 'it-IT', - 'whisper_lang_code': 'it', - 'voice_id': 'Carla', - 'gender': 'Female', - 'neural': 'No', - 'standard': 'Yes'}, - {'language': 'Italian', - 'lang_code': 'it-IT', - 'whisper_lang_code': 'it', - 'voice_id': 'Bianca', - 'gender': 'Female', - 'neural': 'Yes', - 'standard': 'Yes'}, - {'language': 'Japanese', - 'lang_code': 'ja-JP', - 'whisper_lang_code': 'ja', - 'voice_id': 'Mizuki', - 'gender': 'Female', - 'neural': 'No', - 'standard': 'Yes'}, - {'language': 'Japanese', - 'lang_code': 'ja-JP', - 'whisper_lang_code': 'ja', - 'voice_id': 'Takumi', - 'gender': 'Male', - 'neural': 'Yes', - 'standard': 'Yes'}, - {'language': 'Korean', - 'lang_code': 'ko-KR', - 'whisper_lang_code': 'ko', - 'voice_id': 'Seoyeon', - 'gender': 'Female', - 'neural': 'Yes', - 'standard': 'Yes'}, - {'language': 'Norwegian', - 'lang_code': 'nb-NO', - 'whisper_lang_code': 'no', - 'voice_id': 'Liv', - 'gender': 'Female', - 'neural': 'No', - 'standard': 'Yes'}, - {'language': 'Norwegian', - 'lang_code': 'nb-NO', - 'whisper_lang_code': 'no', - 'voice_id': 'Ida', - 'gender': 'Female', - 'neural': 'Yes', - 'standard': 'No'}, - {'language': 'Polish', - 'lang_code': 'pl-PL', - 'whisper_lang_code': 'pl', - 'voice_id': 'Ewa', - 'gender': 'Female', - 'neural': 'No', - 'standard': 'Yes'}, - {'language': 'Polish', - 'lang_code': 'pl-PL', - 'whisper_lang_code': 'pl', - 'voice_id': 'Maja', - 'gender': 'Female', - 'neural': 'No', - 'standard': 'Yes'}, - {'language': 'Polish', - 'lang_code': 'pl-PL', - 'whisper_lang_code': 'pl', - 'voice_id': 'Jacek', - 'gender': 'Male', - 'neural': 'No', - 'standard': 'Yes'}, - {'language': 'Polish', - 'lang_code': 'pl-PL', - 'whisper_lang_code': 'pl', - 'voice_id': 'Jan', - 'gender': 'Male', - 'neural': 'No', - 'standard': 'Yes'}, - {'language': 'Polish', - 'lang_code': 'pl-PL', - 'whisper_lang_code': 'pl', - 'voice_id': 'Ola', - 'gender': 'Female', - 'neural': 'Yes', - 'standard': 'No'}, - {'language': 'Portuguese (Brazilian)', - 'lang_code': 'pt-BR', - 'whisper_lang_code': 'pt', - 'voice_id': 'Camila', - 'gender': 'Female', - 'neural': 'Yes', - 'standard': 'Yes'}, - {'language': 'Portuguese (Brazilian)', - 'lang_code': 'pt-BR', - 'whisper_lang_code': 'pt', - 'voice_id': 'Vitoria', - 'gender': 'Female', - 'neural': 'Yes', - 'standard': 'Yes'}, - {'language': 'Portuguese (Brazilian)', - 'lang_code': 'pt-BR', - 'whisper_lang_code': 'pt', - 'voice_id': 'Ricardo', - 'gender': 'Male', - 'neural': 'No', - 'standard': 'Yes'}, - {'language': 'Portuguese (European)', - 'lang_code': 'pt-PT', - 'whisper_lang_code': 'pt', - 'voice_id': 'Ines', - 'gender': 'Female', - 'neural': 'Yes', - 'standard': 'Yes'}, - {'language': 'Portuguese (European)', - 'lang_code': 'pt-PT', - 'whisper_lang_code': 'pt', - 'voice_id': 'Cristiano', - 'gender': 'Male', - 'neural': 'No', - 'standard': 'Yes'}, - {'language': 'Romanian', - 'lang_code': 'ro-RO', - 'whisper_lang_code': 'ro', - 'voice_id': 'Carmen', - 'gender': 'Female', - 'neural': 'No', - 'standard': 'Yes'}, - {'language': 'Russian', - 'lang_code': 'ru-RU', - 'whisper_lang_code': 'ru', - 'voice_id': 'Tatyana', - 'gender': 'Female', - 'neural': 'No', - 'standard': 'Yes'}, - {'language': 'Russian', - 'lang_code': 'ru-RU', - 'whisper_lang_code': 'ru', - 'voice_id': 'Maxim', - 'gender': 'Male', - 'neural': 'No', - 'standard': 'Yes'}, - {'language': 'Spanish (European)', - 'lang_code': 'es-ES', - 'whisper_lang_code': 'es', - 'voice_id': 'Conchita', - 'gender': 'Female', - 'neural': 'No', - 'standard': 'Yes'}, - {'language': 'Spanish (European)', - 'lang_code': 'es-ES', - 'whisper_lang_code': 'es', - 'voice_id': 'Lucia', - 'gender': 'Female', - 'neural': 'Yes', - 'standard': 'Yes'}, - {'language': 'Spanish (European)', - 'lang_code': 'es-ES', - 'whisper_lang_code': 'es', - 'voice_id': 'Enrique', - 'gender': 'Male', - 'neural': 'No', - 'standard': 'Yes'}, - {'language': 'Spanish (Mexican)', - 'lang_code': 'es-MX', - 'whisper_lang_code': 'es', - 'voice_id': 'Mia', - 'gender': 'Female', - 'neural': 'Yes', - 'standard': 'Yes'}, - {'language': 'Spanish (US)', - 'lang_code': 'es-US', - 'whisper_lang_code': 'es', - 'voice_id': 'Lupe', - 'gender': 'Female', - 'neural': 'Yes', - 'standard': 'Yes'}, - {'language': 'Spanish (US)', - 'lang_code': 'es-US', - 'whisper_lang_code': 'es', - 'voice_id': 'Penelope', - 'gender': 'Female', - 'neural': 'No', - 'standard': 'Yes'}, - {'language': 'Spanish (US)', - 'lang_code': 'es-US', - 'whisper_lang_code': 'es', - 'voice_id': 'Miguel', - 'gender': 'Male', - 'neural': 'No', - 'standard': 'Yes'}, - {'language': 'Spanish (US)', - 'lang_code': 'es-US', - 'whisper_lang_code': 'es', - 'voice_id': 'Pedro', - 'gender': 'Male', - 'neural': 'Yes', - 'standard': 'No'}, - {'language': 'Swedish', - 'lang_code': 'sv-SE', - 'whisper_lang_code': 'sv', - 'voice_id': 'Astrid', - 'gender': 'Female', - 'neural': 'No', - 'standard': 'Yes'}, - {'language': 'Swedish', - 'lang_code': 'sv-SE', - 'whisper_lang_code': 'sv', - 'voice_id': 'Elin', - 'gender': 'Female', - 'neural': 'Yes', - 'standard': 'No'}, - {'language': 'Turkish', - 'lang_code': 'tr-TR', - 'whisper_lang_code': 'tr', - 'voice_id': 'Filiz', - 'gender': 'Female', - 'neural': 'No', - 'standard': 'Yes'}, - {'language': 'Welsh', - 'lang_code': 'cy-GB', - 'whisper_lang_code': 'cy', - 'voice_id': 'Gwyneth', - 'gender': 'Female', - 'neural': 'No', - 'standard': 'Yes'} - ] - - -# Run from the command-line -if __name__ == '__main__': - polly_voice_data = PollyVoiceData() - - voice_id, language_code, engine = polly_voice_data.get_voice('English (US)', 'Male') - print('English (US)', 'Male', voice_id, language_code, engine) - - voice_id, language_code, engine = polly_voice_data.get_voice('English (US)', 'Female') - print('English (US)', 'Female', voice_id, language_code, engine) - - voice_id, language_code, engine = polly_voice_data.get_voice('French', 'Female') - print('French', 'Female', voice_id, language_code, engine) - - voice_id, language_code, engine = polly_voice_data.get_voice('French', 'Male') - print('French', 'Male', voice_id, language_code, engine) - - voice_id, language_code, engine = polly_voice_data.get_voice('Japanese', 'Female') - print('Japanese', 'Female', voice_id, language_code, engine) - - voice_id, language_code, engine = polly_voice_data.get_voice('Japanese', 'Male') - print('Japanese', 'Male', voice_id, language_code, engine) - - voice_id, language_code, engine = polly_voice_data.get_voice('Hindi', 'Female') - print('Hindi', 'Female', voice_id, language_code, engine) - - voice_id, language_code, engine = polly_voice_data.get_voice('Hindi', 'Male') - print('Hindi', 'Male', voice_id, language_code, engine) - - whisper_lang_code = polly_voice_data.get_whisper_lang_code('English (US)') - print('English (US) whisper_lang_code:', whisper_lang_code) - - whisper_lang_code = polly_voice_data.get_whisper_lang_code('Chinese (Mandarin)') - print('Chinese (Mandarin) whisper_lang_code:', whisper_lang_code) - - whisper_lang_code = polly_voice_data.get_whisper_lang_code('Norwegian') - print('Norwegian whisper_lang_code:', whisper_lang_code) - - whisper_lang_code = polly_voice_data.get_whisper_lang_code('Dutch') - print('Dutch whisper_lang_code:', whisper_lang_code) - - whisper_lang_code = polly_voice_data.get_whisper_lang_code('Foo') - print('Foo whisper_lang_code:', whisper_lang_code) - - diff --git a/spaces/Gen-Sim/Gen-Sim/cliport/generated_tasks/color_sorted_container_stack.py b/spaces/Gen-Sim/Gen-Sim/cliport/generated_tasks/color_sorted_container_stack.py deleted file mode 100644 index 9fbe7c12f389a5a12edef8d930d6e4eaefb682a5..0000000000000000000000000000000000000000 --- a/spaces/Gen-Sim/Gen-Sim/cliport/generated_tasks/color_sorted_container_stack.py +++ /dev/null @@ -1,58 +0,0 @@ -import numpy as np -import os -import pybullet as p -import random -from cliport.tasks import primitives -from cliport.tasks.grippers import Spatula -from cliport.tasks.task import Task -from cliport.utils import utils -import numpy as np -from cliport.tasks.task import Task -from cliport.utils import utils - -class ColorSortedContainerStack(Task): - """Stack four differently colored blocks (red, blue, green, yellow) inside a container.""" - - def __init__(self): - super().__init__() - self.max_steps = 20 - self.lang_template = "stack the blocks in the container in the order: red, blue, green, then yellow" - self.task_completed_desc = "done stacking blocks." - self.additional_reset() - - def reset(self, env): - super().reset(env) - - # Add container. - # x, y, z dimensions for the asset size - container_size = (0.15, 0.15, 0.15) - container_pose = self.get_random_pose(env, container_size) - container_urdf = 'container/container-template.urdf' - replace = {'DIM': container_size, 'HALF': (container_size[0] / 2, container_size[1] / 2, container_size[2] / 2)} - container_urdf = self.fill_template(container_urdf, replace) - env.add_object(container_urdf, container_pose, 'fixed') - - # Add blocks. - # x, y, z dimensions for the asset size - block_size = (0.04, 0.04, 0.04) - block_urdf = 'block/block.urdf' - block_colors = [utils.COLORS['red'], utils.COLORS['blue'], utils.COLORS['green'], utils.COLORS['yellow']] - blocks = [] - for i in range(4): - block_pose = self.get_random_pose(env, block_size) - block_id = env.add_object(block_urdf, block_pose, color=block_colors[i]) - blocks.append(block_id) - - # Add bowls. - # x, y, z dimensions for the asset size - bowl_size = (0.12, 0.12, 0) - bowl_urdf = 'bowl/bowl.urdf' - for i in range(2): - bowl_pose = self.get_random_pose(env, bowl_size) - env.add_object(bowl_urdf, bowl_pose, 'fixed') - - # Goal: each block is stacked in the container in the order: red, blue, green, yellow. - for i in range(4): - self.add_goal(objs=[blocks[i]], matches=np.ones((1, 1)), targ_poses=[container_pose], replace=False, - rotations=True, metric='pose', params=None, step_max_reward=1 / 4, - language_goal=self.lang_template) \ No newline at end of file diff --git a/spaces/Godrose0728/Aisound02/mel_processing.py b/spaces/Godrose0728/Aisound02/mel_processing.py deleted file mode 100644 index 3e252e76320522a8a4195a60665168f22769aec2..0000000000000000000000000000000000000000 --- a/spaces/Godrose0728/Aisound02/mel_processing.py +++ /dev/null @@ -1,101 +0,0 @@ -import torch -import torch.utils.data -from librosa.filters import mel as librosa_mel_fn - -MAX_WAV_VALUE = 32768.0 - - -def dynamic_range_compression_torch(x, C=1, clip_val=1e-5): - """ - PARAMS - ------ - C: compression factor - """ - return torch.log(torch.clamp(x, min=clip_val) * C) - - -def dynamic_range_decompression_torch(x, C=1): - """ - PARAMS - ------ - C: compression factor used to compress - """ - return torch.exp(x) / C - - -def spectral_normalize_torch(magnitudes): - output = dynamic_range_compression_torch(magnitudes) - return output - - -def spectral_de_normalize_torch(magnitudes): - output = dynamic_range_decompression_torch(magnitudes) - return output - - -mel_basis = {} -hann_window = {} - - -def spectrogram_torch(y, n_fft, sampling_rate, hop_size, win_size, center=False): - if torch.min(y) < -1.: - print('min value is ', torch.min(y)) - if torch.max(y) > 1.: - print('max value is ', torch.max(y)) - - global hann_window - dtype_device = str(y.dtype) + '_' + str(y.device) - wnsize_dtype_device = str(win_size) + '_' + dtype_device - if wnsize_dtype_device not in hann_window: - hann_window[wnsize_dtype_device] = torch.hann_window(win_size).to(dtype=y.dtype, device=y.device) - - y = torch.nn.functional.pad(y.unsqueeze(1), (int((n_fft-hop_size)/2), int((n_fft-hop_size)/2)), mode='reflect') - y = y.squeeze(1) - - spec = torch.stft(y, n_fft, hop_length=hop_size, win_length=win_size, window=hann_window[wnsize_dtype_device], - center=center, pad_mode='reflect', normalized=False, onesided=True, return_complex=False) - - spec = torch.sqrt(spec.pow(2).sum(-1) + 1e-6) - return spec - - -def spec_to_mel_torch(spec, n_fft, num_mels, sampling_rate, fmin, fmax): - global mel_basis - dtype_device = str(spec.dtype) + '_' + str(spec.device) - fmax_dtype_device = str(fmax) + '_' + dtype_device - if fmax_dtype_device not in mel_basis: - mel = librosa_mel_fn(sampling_rate, n_fft, num_mels, fmin, fmax) - mel_basis[fmax_dtype_device] = torch.from_numpy(mel).to(dtype=spec.dtype, device=spec.device) - spec = torch.matmul(mel_basis[fmax_dtype_device], spec) - spec = spectral_normalize_torch(spec) - return spec - - -def mel_spectrogram_torch(y, n_fft, num_mels, sampling_rate, hop_size, win_size, fmin, fmax, center=False): - if torch.min(y) < -1.: - print('min value is ', torch.min(y)) - if torch.max(y) > 1.: - print('max value is ', torch.max(y)) - - global mel_basis, hann_window - dtype_device = str(y.dtype) + '_' + str(y.device) - fmax_dtype_device = str(fmax) + '_' + dtype_device - wnsize_dtype_device = str(win_size) + '_' + dtype_device - if fmax_dtype_device not in mel_basis: - mel = librosa_mel_fn(sampling_rate, n_fft, num_mels, fmin, fmax) - mel_basis[fmax_dtype_device] = torch.from_numpy(mel).to(dtype=y.dtype, device=y.device) - if wnsize_dtype_device not in hann_window: - hann_window[wnsize_dtype_device] = torch.hann_window(win_size).to(dtype=y.dtype, device=y.device) - - y = torch.nn.functional.pad(y.unsqueeze(1), (int((n_fft-hop_size)/2), int((n_fft-hop_size)/2)), mode='reflect') - y = y.squeeze(1) - - spec = torch.stft(y, n_fft, hop_length=hop_size, win_length=win_size, window=hann_window[wnsize_dtype_device], - center=center, pad_mode='reflect', normalized=False, onesided=True) - - spec = torch.sqrt(spec.pow(2).sum(-1) + 1e-6) - - spec = torch.matmul(mel_basis[fmax_dtype_device], spec) - spec = spectral_normalize_torch(spec) - - return spec diff --git a/spaces/Gradio-Blocks/uniformer_image_detection/configs/libra_rcnn/README.md b/spaces/Gradio-Blocks/uniformer_image_detection/configs/libra_rcnn/README.md deleted file mode 100644 index 1f28087f6ac6ac8ac1a32e5c165959e61fce7353..0000000000000000000000000000000000000000 --- a/spaces/Gradio-Blocks/uniformer_image_detection/configs/libra_rcnn/README.md +++ /dev/null @@ -1,28 +0,0 @@ -# Libra R-CNN: Towards Balanced Learning for Object Detection - -## Introduction - -[ALGORITHM] - -We provide config files to reproduce the results in the CVPR 2019 paper [Libra R-CNN](https://arxiv.org/pdf/1904.02701.pdf). - -``` -@inproceedings{pang2019libra, - title={Libra R-CNN: Towards Balanced Learning for Object Detection}, - author={Pang, Jiangmiao and Chen, Kai and Shi, Jianping and Feng, Huajun and Ouyang, Wanli and Dahua Lin}, - booktitle={IEEE Conference on Computer Vision and Pattern Recognition}, - year={2019} -} -``` - -## Results and models - -The results on COCO 2017val are shown in the below table. (results on test-dev are usually slightly higher than val) - -| Architecture | Backbone | Style | Lr schd | Mem (GB) | Inf time (fps) | box AP | Config | Download | -|:------------:|:---------------:|:-------:|:-------:|:--------:|:--------------:|:------:|:------:|:--------:| -| Faster R-CNN | R-50-FPN | pytorch | 1x | 4.6 | 19.0 | 38.3 | [config](https://github.com/open-mmlab/mmdetection/tree/master/configs/libra_rcnn/libra_faster_rcnn_r50_fpn_1x_coco.py) | [model](http://download.openmmlab.com/mmdetection/v2.0/libra_rcnn/libra_faster_rcnn_r50_fpn_1x_coco/libra_faster_rcnn_r50_fpn_1x_coco_20200130-3afee3a9.pth) | [log](http://download.openmmlab.com/mmdetection/v2.0/libra_rcnn/libra_faster_rcnn_r50_fpn_1x_coco/libra_faster_rcnn_r50_fpn_1x_coco_20200130_204655.log.json) | -| Fast R-CNN | R-50-FPN | pytorch | 1x | | | | | -| Faster R-CNN | R-101-FPN | pytorch | 1x | 6.5 | 14.4 | 40.1 | [config](https://github.com/open-mmlab/mmdetection/tree/master/configs/libra_rcnn/libra_faster_rcnn_r101_fpn_1x_coco.py) | [model](http://download.openmmlab.com/mmdetection/v2.0/libra_rcnn/libra_faster_rcnn_r101_fpn_1x_coco/libra_faster_rcnn_r101_fpn_1x_coco_20200203-8dba6a5a.pth) | [log](http://download.openmmlab.com/mmdetection/v2.0/libra_rcnn/libra_faster_rcnn_r101_fpn_1x_coco/libra_faster_rcnn_r101_fpn_1x_coco_20200203_001405.log.json) | -| Faster R-CNN | X-101-64x4d-FPN | pytorch | 1x | 10.8 | 8.5 | 42.7 | [config](https://github.com/open-mmlab/mmdetection/tree/master/configs/libra_rcnn/libra_faster_rcnn_x101_64x4d_fpn_1x_coco.py) | [model](http://download.openmmlab.com/mmdetection/v2.0/libra_rcnn/libra_faster_rcnn_x101_64x4d_fpn_1x_coco/libra_faster_rcnn_x101_64x4d_fpn_1x_coco_20200315-3a7d0488.pth) | [log](http://download.openmmlab.com/mmdetection/v2.0/libra_rcnn/libra_faster_rcnn_x101_64x4d_fpn_1x_coco/libra_faster_rcnn_x101_64x4d_fpn_1x_coco_20200315_231625.log.json) | -| RetinaNet | R-50-FPN | pytorch | 1x | 4.2 | 17.7 | 37.6 | [config](https://github.com/open-mmlab/mmdetection/tree/master/configs/libra_rcnn/libra_retinanet_r50_fpn_1x_coco.py) | [model](http://download.openmmlab.com/mmdetection/v2.0/libra_rcnn/libra_retinanet_r50_fpn_1x_coco/libra_retinanet_r50_fpn_1x_coco_20200205-804d94ce.pth) | [log](http://download.openmmlab.com/mmdetection/v2.0/libra_rcnn/libra_retinanet_r50_fpn_1x_coco/libra_retinanet_r50_fpn_1x_coco_20200205_112757.log.json) | diff --git a/spaces/Gradio-Blocks/uniformer_image_detection/mmdet/models/detectors/kd_one_stage.py b/spaces/Gradio-Blocks/uniformer_image_detection/mmdet/models/detectors/kd_one_stage.py deleted file mode 100644 index 671ec19015c87fefd065b84ae887147f90cc892b..0000000000000000000000000000000000000000 --- a/spaces/Gradio-Blocks/uniformer_image_detection/mmdet/models/detectors/kd_one_stage.py +++ /dev/null @@ -1,100 +0,0 @@ -import mmcv -import torch -from mmcv.runner import load_checkpoint - -from .. import build_detector -from ..builder import DETECTORS -from .single_stage import SingleStageDetector - - -@DETECTORS.register_module() -class KnowledgeDistillationSingleStageDetector(SingleStageDetector): - r"""Implementation of `Distilling the Knowledge in a Neural Network. - `_. - - Args: - teacher_config (str | dict): Config file path - or the config object of teacher model. - teacher_ckpt (str, optional): Checkpoint path of teacher model. - If left as None, the model will not load any weights. - """ - - def __init__(self, - backbone, - neck, - bbox_head, - teacher_config, - teacher_ckpt=None, - eval_teacher=True, - train_cfg=None, - test_cfg=None, - pretrained=None): - super().__init__(backbone, neck, bbox_head, train_cfg, test_cfg, - pretrained) - self.eval_teacher = eval_teacher - # Build teacher model - if isinstance(teacher_config, str): - teacher_config = mmcv.Config.fromfile(teacher_config) - self.teacher_model = build_detector(teacher_config['model']) - if teacher_ckpt is not None: - load_checkpoint( - self.teacher_model, teacher_ckpt, map_location='cpu') - - def forward_train(self, - img, - img_metas, - gt_bboxes, - gt_labels, - gt_bboxes_ignore=None): - """ - Args: - img (Tensor): Input images of shape (N, C, H, W). - Typically these should be mean centered and std scaled. - img_metas (list[dict]): A List of image info dict where each dict - has: 'img_shape', 'scale_factor', 'flip', and may also contain - 'filename', 'ori_shape', 'pad_shape', and 'img_norm_cfg'. - For details on the values of these keys see - :class:`mmdet.datasets.pipelines.Collect`. - gt_bboxes (list[Tensor]): Each item are the truth boxes for each - image in [tl_x, tl_y, br_x, br_y] format. - gt_labels (list[Tensor]): Class indices corresponding to each box - gt_bboxes_ignore (None | list[Tensor]): Specify which bounding - boxes can be ignored when computing the loss. - Returns: - dict[str, Tensor]: A dictionary of loss components. - """ - x = self.extract_feat(img) - with torch.no_grad(): - teacher_x = self.teacher_model.extract_feat(img) - out_teacher = self.teacher_model.bbox_head(teacher_x) - losses = self.bbox_head.forward_train(x, out_teacher, img_metas, - gt_bboxes, gt_labels, - gt_bboxes_ignore) - return losses - - def cuda(self, device=None): - """Since teacher_model is registered as a plain object, it is necessary - to put the teacher model to cuda when calling cuda function.""" - self.teacher_model.cuda(device=device) - return super().cuda(device=device) - - def train(self, mode=True): - """Set the same train mode for teacher and student model.""" - if self.eval_teacher: - self.teacher_model.train(False) - else: - self.teacher_model.train(mode) - super().train(mode) - - def __setattr__(self, name, value): - """Set attribute, i.e. self.name = value - - This reloading prevent the teacher model from being registered as a - nn.Module. The teacher module is registered as a plain object, so that - the teacher parameters will not show up when calling - ``self.parameters``, ``self.modules``, ``self.children`` methods. - """ - if name == 'teacher_model': - object.__setattr__(self, name, value) - else: - super().__setattr__(name, value) diff --git a/spaces/Gradio-Blocks/uniformer_image_segmentation/configs/hrnet/fcn_hr18_512x512_40k_voc12aug.py b/spaces/Gradio-Blocks/uniformer_image_segmentation/configs/hrnet/fcn_hr18_512x512_40k_voc12aug.py deleted file mode 100644 index d74e95943afca04ba4073e411e0b713985384129..0000000000000000000000000000000000000000 --- a/spaces/Gradio-Blocks/uniformer_image_segmentation/configs/hrnet/fcn_hr18_512x512_40k_voc12aug.py +++ /dev/null @@ -1,5 +0,0 @@ -_base_ = [ - '../_base_/models/fcn_hr18.py', '../_base_/datasets/pascal_voc12_aug.py', - '../_base_/default_runtime.py', '../_base_/schedules/schedule_40k.py' -] -model = dict(decode_head=dict(num_classes=21)) diff --git a/spaces/Grezz/generate_human_motion/VQ-Trans/utils/eval_trans.py b/spaces/Grezz/generate_human_motion/VQ-Trans/utils/eval_trans.py deleted file mode 100644 index 8778bb8cb7e7a320e5f7f2f3b43c7ba0b4c285ab..0000000000000000000000000000000000000000 --- a/spaces/Grezz/generate_human_motion/VQ-Trans/utils/eval_trans.py +++ /dev/null @@ -1,580 +0,0 @@ -import os - -import clip -import numpy as np -import torch -from scipy import linalg - -import visualization.plot_3d_global as plot_3d -from utils.motion_process import recover_from_ric - - -def tensorborad_add_video_xyz(writer, xyz, nb_iter, tag, nb_vis=4, title_batch=None, outname=None): - xyz = xyz[:1] - bs, seq = xyz.shape[:2] - xyz = xyz.reshape(bs, seq, -1, 3) - plot_xyz = plot_3d.draw_to_batch(xyz.cpu().numpy(),title_batch, outname) - plot_xyz =np.transpose(plot_xyz, (0, 1, 4, 2, 3)) - writer.add_video(tag, plot_xyz, nb_iter, fps = 20) - -@torch.no_grad() -def evaluation_vqvae(out_dir, val_loader, net, logger, writer, nb_iter, best_fid, best_iter, best_div, best_top1, best_top2, best_top3, best_matching, eval_wrapper, draw = True, save = True, savegif=False, savenpy=False) : - net.eval() - nb_sample = 0 - - draw_org = [] - draw_pred = [] - draw_text = [] - - - motion_annotation_list = [] - motion_pred_list = [] - - R_precision_real = 0 - R_precision = 0 - - nb_sample = 0 - matching_score_real = 0 - matching_score_pred = 0 - for batch in val_loader: - word_embeddings, pos_one_hots, caption, sent_len, motion, m_length, token, name = batch - - motion = motion.cuda() - et, em = eval_wrapper.get_co_embeddings(word_embeddings, pos_one_hots, sent_len, motion, m_length) - bs, seq = motion.shape[0], motion.shape[1] - - num_joints = 21 if motion.shape[-1] == 251 else 22 - - pred_pose_eval = torch.zeros((bs, seq, motion.shape[-1])).cuda() - - for i in range(bs): - pose = val_loader.dataset.inv_transform(motion[i:i+1, :m_length[i], :].detach().cpu().numpy()) - pose_xyz = recover_from_ric(torch.from_numpy(pose).float().cuda(), num_joints) - - - pred_pose, loss_commit, perplexity = net(motion[i:i+1, :m_length[i]]) - pred_denorm = val_loader.dataset.inv_transform(pred_pose.detach().cpu().numpy()) - pred_xyz = recover_from_ric(torch.from_numpy(pred_denorm).float().cuda(), num_joints) - - if savenpy: - np.save(os.path.join(out_dir, name[i]+'_gt.npy'), pose_xyz[:, :m_length[i]].cpu().numpy()) - np.save(os.path.join(out_dir, name[i]+'_pred.npy'), pred_xyz.detach().cpu().numpy()) - - pred_pose_eval[i:i+1,:m_length[i],:] = pred_pose - - if i < min(4, bs): - draw_org.append(pose_xyz) - draw_pred.append(pred_xyz) - draw_text.append(caption[i]) - - et_pred, em_pred = eval_wrapper.get_co_embeddings(word_embeddings, pos_one_hots, sent_len, pred_pose_eval, m_length) - - motion_pred_list.append(em_pred) - motion_annotation_list.append(em) - - temp_R, temp_match = calculate_R_precision(et.cpu().numpy(), em.cpu().numpy(), top_k=3, sum_all=True) - R_precision_real += temp_R - matching_score_real += temp_match - temp_R, temp_match = calculate_R_precision(et_pred.cpu().numpy(), em_pred.cpu().numpy(), top_k=3, sum_all=True) - R_precision += temp_R - matching_score_pred += temp_match - - nb_sample += bs - - motion_annotation_np = torch.cat(motion_annotation_list, dim=0).cpu().numpy() - motion_pred_np = torch.cat(motion_pred_list, dim=0).cpu().numpy() - gt_mu, gt_cov = calculate_activation_statistics(motion_annotation_np) - mu, cov= calculate_activation_statistics(motion_pred_np) - - diversity_real = calculate_diversity(motion_annotation_np, 300 if nb_sample > 300 else 100) - diversity = calculate_diversity(motion_pred_np, 300 if nb_sample > 300 else 100) - - R_precision_real = R_precision_real / nb_sample - R_precision = R_precision / nb_sample - - matching_score_real = matching_score_real / nb_sample - matching_score_pred = matching_score_pred / nb_sample - - fid = calculate_frechet_distance(gt_mu, gt_cov, mu, cov) - - msg = f"--> \t Eva. Iter {nb_iter} :, FID. {fid:.4f}, Diversity Real. {diversity_real:.4f}, Diversity. {diversity:.4f}, R_precision_real. {R_precision_real}, R_precision. {R_precision}, matching_score_real. {matching_score_real}, matching_score_pred. {matching_score_pred}" - logger.info(msg) - - if draw: - writer.add_scalar('./Test/FID', fid, nb_iter) - writer.add_scalar('./Test/Diversity', diversity, nb_iter) - writer.add_scalar('./Test/top1', R_precision[0], nb_iter) - writer.add_scalar('./Test/top2', R_precision[1], nb_iter) - writer.add_scalar('./Test/top3', R_precision[2], nb_iter) - writer.add_scalar('./Test/matching_score', matching_score_pred, nb_iter) - - - if nb_iter % 5000 == 0 : - for ii in range(4): - tensorborad_add_video_xyz(writer, draw_org[ii], nb_iter, tag='./Vis/org_eval'+str(ii), nb_vis=1, title_batch=[draw_text[ii]], outname=[os.path.join(out_dir, 'gt'+str(ii)+'.gif')] if savegif else None) - - if nb_iter % 5000 == 0 : - for ii in range(4): - tensorborad_add_video_xyz(writer, draw_pred[ii], nb_iter, tag='./Vis/pred_eval'+str(ii), nb_vis=1, title_batch=[draw_text[ii]], outname=[os.path.join(out_dir, 'pred'+str(ii)+'.gif')] if savegif else None) - - - if fid < best_fid : - msg = f"--> --> \t FID Improved from {best_fid:.5f} to {fid:.5f} !!!" - logger.info(msg) - best_fid, best_iter = fid, nb_iter - if save: - torch.save({'net' : net.state_dict()}, os.path.join(out_dir, 'net_best_fid.pth')) - - if abs(diversity_real - diversity) < abs(diversity_real - best_div) : - msg = f"--> --> \t Diversity Improved from {best_div:.5f} to {diversity:.5f} !!!" - logger.info(msg) - best_div = diversity - if save: - torch.save({'net' : net.state_dict()}, os.path.join(out_dir, 'net_best_div.pth')) - - if R_precision[0] > best_top1 : - msg = f"--> --> \t Top1 Improved from {best_top1:.4f} to {R_precision[0]:.4f} !!!" - logger.info(msg) - best_top1 = R_precision[0] - if save: - torch.save({'net' : net.state_dict()}, os.path.join(out_dir, 'net_best_top1.pth')) - - if R_precision[1] > best_top2 : - msg = f"--> --> \t Top2 Improved from {best_top2:.4f} to {R_precision[1]:.4f} !!!" - logger.info(msg) - best_top2 = R_precision[1] - - if R_precision[2] > best_top3 : - msg = f"--> --> \t Top3 Improved from {best_top3:.4f} to {R_precision[2]:.4f} !!!" - logger.info(msg) - best_top3 = R_precision[2] - - if matching_score_pred < best_matching : - msg = f"--> --> \t matching_score Improved from {best_matching:.5f} to {matching_score_pred:.5f} !!!" - logger.info(msg) - best_matching = matching_score_pred - if save: - torch.save({'net' : net.state_dict()}, os.path.join(out_dir, 'net_best_matching.pth')) - - if save: - torch.save({'net' : net.state_dict()}, os.path.join(out_dir, 'net_last.pth')) - - net.train() - return best_fid, best_iter, best_div, best_top1, best_top2, best_top3, best_matching, writer, logger - - -@torch.no_grad() -def evaluation_transformer(out_dir, val_loader, net, trans, logger, writer, nb_iter, best_fid, best_iter, best_div, best_top1, best_top2, best_top3, best_matching, clip_model, eval_wrapper, draw = True, save = True, savegif=False) : - - trans.eval() - nb_sample = 0 - - draw_org = [] - draw_pred = [] - draw_text = [] - draw_text_pred = [] - - motion_annotation_list = [] - motion_pred_list = [] - R_precision_real = 0 - R_precision = 0 - matching_score_real = 0 - matching_score_pred = 0 - - nb_sample = 0 - for i in range(1): - for batch in val_loader: - word_embeddings, pos_one_hots, clip_text, sent_len, pose, m_length, token, name = batch - - bs, seq = pose.shape[:2] - num_joints = 21 if pose.shape[-1] == 251 else 22 - - text = clip.tokenize(clip_text, truncate=True).cuda() - - feat_clip_text = clip_model.encode_text(text).float() - pred_pose_eval = torch.zeros((bs, seq, pose.shape[-1])).cuda() - pred_len = torch.ones(bs).long() - - for k in range(bs): - try: - index_motion = trans.sample(feat_clip_text[k:k+1], False) - except: - index_motion = torch.ones(1,1).cuda().long() - - pred_pose = net.forward_decoder(index_motion) - cur_len = pred_pose.shape[1] - - pred_len[k] = min(cur_len, seq) - pred_pose_eval[k:k+1, :cur_len] = pred_pose[:, :seq] - - if draw: - pred_denorm = val_loader.dataset.inv_transform(pred_pose.detach().cpu().numpy()) - pred_xyz = recover_from_ric(torch.from_numpy(pred_denorm).float().cuda(), num_joints) - - if i == 0 and k < 4: - draw_pred.append(pred_xyz) - draw_text_pred.append(clip_text[k]) - - et_pred, em_pred = eval_wrapper.get_co_embeddings(word_embeddings, pos_one_hots, sent_len, pred_pose_eval, pred_len) - - if i == 0: - pose = pose.cuda().float() - - et, em = eval_wrapper.get_co_embeddings(word_embeddings, pos_one_hots, sent_len, pose, m_length) - motion_annotation_list.append(em) - motion_pred_list.append(em_pred) - - if draw: - pose = val_loader.dataset.inv_transform(pose.detach().cpu().numpy()) - pose_xyz = recover_from_ric(torch.from_numpy(pose).float().cuda(), num_joints) - - - for j in range(min(4, bs)): - draw_org.append(pose_xyz[j][:m_length[j]].unsqueeze(0)) - draw_text.append(clip_text[j]) - - temp_R, temp_match = calculate_R_precision(et.cpu().numpy(), em.cpu().numpy(), top_k=3, sum_all=True) - R_precision_real += temp_R - matching_score_real += temp_match - temp_R, temp_match = calculate_R_precision(et_pred.cpu().numpy(), em_pred.cpu().numpy(), top_k=3, sum_all=True) - R_precision += temp_R - matching_score_pred += temp_match - - nb_sample += bs - - motion_annotation_np = torch.cat(motion_annotation_list, dim=0).cpu().numpy() - motion_pred_np = torch.cat(motion_pred_list, dim=0).cpu().numpy() - gt_mu, gt_cov = calculate_activation_statistics(motion_annotation_np) - mu, cov= calculate_activation_statistics(motion_pred_np) - - diversity_real = calculate_diversity(motion_annotation_np, 300 if nb_sample > 300 else 100) - diversity = calculate_diversity(motion_pred_np, 300 if nb_sample > 300 else 100) - - R_precision_real = R_precision_real / nb_sample - R_precision = R_precision / nb_sample - - matching_score_real = matching_score_real / nb_sample - matching_score_pred = matching_score_pred / nb_sample - - - fid = calculate_frechet_distance(gt_mu, gt_cov, mu, cov) - - msg = f"--> \t Eva. Iter {nb_iter} :, FID. {fid:.4f}, Diversity Real. {diversity_real:.4f}, Diversity. {diversity:.4f}, R_precision_real. {R_precision_real}, R_precision. {R_precision}, matching_score_real. {matching_score_real}, matching_score_pred. {matching_score_pred}" - logger.info(msg) - - - if draw: - writer.add_scalar('./Test/FID', fid, nb_iter) - writer.add_scalar('./Test/Diversity', diversity, nb_iter) - writer.add_scalar('./Test/top1', R_precision[0], nb_iter) - writer.add_scalar('./Test/top2', R_precision[1], nb_iter) - writer.add_scalar('./Test/top3', R_precision[2], nb_iter) - writer.add_scalar('./Test/matching_score', matching_score_pred, nb_iter) - - - if nb_iter % 10000 == 0 : - for ii in range(4): - tensorborad_add_video_xyz(writer, draw_org[ii], nb_iter, tag='./Vis/org_eval'+str(ii), nb_vis=1, title_batch=[draw_text[ii]], outname=[os.path.join(out_dir, 'gt'+str(ii)+'.gif')] if savegif else None) - - if nb_iter % 10000 == 0 : - for ii in range(4): - tensorborad_add_video_xyz(writer, draw_pred[ii], nb_iter, tag='./Vis/pred_eval'+str(ii), nb_vis=1, title_batch=[draw_text_pred[ii]], outname=[os.path.join(out_dir, 'pred'+str(ii)+'.gif')] if savegif else None) - - - if fid < best_fid : - msg = f"--> --> \t FID Improved from {best_fid:.5f} to {fid:.5f} !!!" - logger.info(msg) - best_fid, best_iter = fid, nb_iter - if save: - torch.save({'trans' : trans.state_dict()}, os.path.join(out_dir, 'net_best_fid.pth')) - - if matching_score_pred < best_matching : - msg = f"--> --> \t matching_score Improved from {best_matching:.5f} to {matching_score_pred:.5f} !!!" - logger.info(msg) - best_matching = matching_score_pred - - if abs(diversity_real - diversity) < abs(diversity_real - best_div) : - msg = f"--> --> \t Diversity Improved from {best_div:.5f} to {diversity:.5f} !!!" - logger.info(msg) - best_div = diversity - - if R_precision[0] > best_top1 : - msg = f"--> --> \t Top1 Improved from {best_top1:.4f} to {R_precision[0]:.4f} !!!" - logger.info(msg) - best_top1 = R_precision[0] - - if R_precision[1] > best_top2 : - msg = f"--> --> \t Top2 Improved from {best_top2:.4f} to {R_precision[1]:.4f} !!!" - logger.info(msg) - best_top2 = R_precision[1] - - if R_precision[2] > best_top3 : - msg = f"--> --> \t Top3 Improved from {best_top3:.4f} to {R_precision[2]:.4f} !!!" - logger.info(msg) - best_top3 = R_precision[2] - - if save: - torch.save({'trans' : trans.state_dict()}, os.path.join(out_dir, 'net_last.pth')) - - trans.train() - return best_fid, best_iter, best_div, best_top1, best_top2, best_top3, best_matching, writer, logger - - -@torch.no_grad() -def evaluation_transformer_test(out_dir, val_loader, net, trans, logger, writer, nb_iter, best_fid, best_iter, best_div, best_top1, best_top2, best_top3, best_matching, best_multi, clip_model, eval_wrapper, draw = True, save = True, savegif=False, savenpy=False) : - - trans.eval() - nb_sample = 0 - - draw_org = [] - draw_pred = [] - draw_text = [] - draw_text_pred = [] - draw_name = [] - - motion_annotation_list = [] - motion_pred_list = [] - motion_multimodality = [] - R_precision_real = 0 - R_precision = 0 - matching_score_real = 0 - matching_score_pred = 0 - - nb_sample = 0 - - for batch in val_loader: - - word_embeddings, pos_one_hots, clip_text, sent_len, pose, m_length, token, name = batch - bs, seq = pose.shape[:2] - num_joints = 21 if pose.shape[-1] == 251 else 22 - - text = clip.tokenize(clip_text, truncate=True).cuda() - - feat_clip_text = clip_model.encode_text(text).float() - motion_multimodality_batch = [] - for i in range(30): - pred_pose_eval = torch.zeros((bs, seq, pose.shape[-1])).cuda() - pred_len = torch.ones(bs).long() - - for k in range(bs): - try: - index_motion = trans.sample(feat_clip_text[k:k+1], True) - except: - index_motion = torch.ones(1,1).cuda().long() - - pred_pose = net.forward_decoder(index_motion) - cur_len = pred_pose.shape[1] - - pred_len[k] = min(cur_len, seq) - pred_pose_eval[k:k+1, :cur_len] = pred_pose[:, :seq] - - if i == 0 and (draw or savenpy): - pred_denorm = val_loader.dataset.inv_transform(pred_pose.detach().cpu().numpy()) - pred_xyz = recover_from_ric(torch.from_numpy(pred_denorm).float().cuda(), num_joints) - - if savenpy: - np.save(os.path.join(out_dir, name[k]+'_pred.npy'), pred_xyz.detach().cpu().numpy()) - - if draw: - if i == 0: - draw_pred.append(pred_xyz) - draw_text_pred.append(clip_text[k]) - draw_name.append(name[k]) - - et_pred, em_pred = eval_wrapper.get_co_embeddings(word_embeddings, pos_one_hots, sent_len, pred_pose_eval, pred_len) - - motion_multimodality_batch.append(em_pred.reshape(bs, 1, -1)) - - if i == 0: - pose = pose.cuda().float() - - et, em = eval_wrapper.get_co_embeddings(word_embeddings, pos_one_hots, sent_len, pose, m_length) - motion_annotation_list.append(em) - motion_pred_list.append(em_pred) - - if draw or savenpy: - pose = val_loader.dataset.inv_transform(pose.detach().cpu().numpy()) - pose_xyz = recover_from_ric(torch.from_numpy(pose).float().cuda(), num_joints) - - if savenpy: - for j in range(bs): - np.save(os.path.join(out_dir, name[j]+'_gt.npy'), pose_xyz[j][:m_length[j]].unsqueeze(0).cpu().numpy()) - - if draw: - for j in range(bs): - draw_org.append(pose_xyz[j][:m_length[j]].unsqueeze(0)) - draw_text.append(clip_text[j]) - - temp_R, temp_match = calculate_R_precision(et.cpu().numpy(), em.cpu().numpy(), top_k=3, sum_all=True) - R_precision_real += temp_R - matching_score_real += temp_match - temp_R, temp_match = calculate_R_precision(et_pred.cpu().numpy(), em_pred.cpu().numpy(), top_k=3, sum_all=True) - R_precision += temp_R - matching_score_pred += temp_match - - nb_sample += bs - - motion_multimodality.append(torch.cat(motion_multimodality_batch, dim=1)) - - motion_annotation_np = torch.cat(motion_annotation_list, dim=0).cpu().numpy() - motion_pred_np = torch.cat(motion_pred_list, dim=0).cpu().numpy() - gt_mu, gt_cov = calculate_activation_statistics(motion_annotation_np) - mu, cov= calculate_activation_statistics(motion_pred_np) - - diversity_real = calculate_diversity(motion_annotation_np, 300 if nb_sample > 300 else 100) - diversity = calculate_diversity(motion_pred_np, 300 if nb_sample > 300 else 100) - - R_precision_real = R_precision_real / nb_sample - R_precision = R_precision / nb_sample - - matching_score_real = matching_score_real / nb_sample - matching_score_pred = matching_score_pred / nb_sample - - multimodality = 0 - motion_multimodality = torch.cat(motion_multimodality, dim=0).cpu().numpy() - multimodality = calculate_multimodality(motion_multimodality, 10) - - fid = calculate_frechet_distance(gt_mu, gt_cov, mu, cov) - - msg = f"--> \t Eva. Iter {nb_iter} :, FID. {fid:.4f}, Diversity Real. {diversity_real:.4f}, Diversity. {diversity:.4f}, R_precision_real. {R_precision_real}, R_precision. {R_precision}, matching_score_real. {matching_score_real}, matching_score_pred. {matching_score_pred}, multimodality. {multimodality:.4f}" - logger.info(msg) - - - if draw: - for ii in range(len(draw_org)): - tensorborad_add_video_xyz(writer, draw_org[ii], nb_iter, tag='./Vis/'+draw_name[ii]+'_org', nb_vis=1, title_batch=[draw_text[ii]], outname=[os.path.join(out_dir, draw_name[ii]+'_skel_gt.gif')] if savegif else None) - - tensorborad_add_video_xyz(writer, draw_pred[ii], nb_iter, tag='./Vis/'+draw_name[ii]+'_pred', nb_vis=1, title_batch=[draw_text_pred[ii]], outname=[os.path.join(out_dir, draw_name[ii]+'_skel_pred.gif')] if savegif else None) - - trans.train() - return fid, best_iter, diversity, R_precision[0], R_precision[1], R_precision[2], matching_score_pred, multimodality, writer, logger - -# (X - X_train)*(X - X_train) = -2X*X_train + X*X + X_train*X_train -def euclidean_distance_matrix(matrix1, matrix2): - """ - Params: - -- matrix1: N1 x D - -- matrix2: N2 x D - Returns: - -- dist: N1 x N2 - dist[i, j] == distance(matrix1[i], matrix2[j]) - """ - assert matrix1.shape[1] == matrix2.shape[1] - d1 = -2 * np.dot(matrix1, matrix2.T) # shape (num_test, num_train) - d2 = np.sum(np.square(matrix1), axis=1, keepdims=True) # shape (num_test, 1) - d3 = np.sum(np.square(matrix2), axis=1) # shape (num_train, ) - dists = np.sqrt(d1 + d2 + d3) # broadcasting - return dists - - - -def calculate_top_k(mat, top_k): - size = mat.shape[0] - gt_mat = np.expand_dims(np.arange(size), 1).repeat(size, 1) - bool_mat = (mat == gt_mat) - correct_vec = False - top_k_list = [] - for i in range(top_k): -# print(correct_vec, bool_mat[:, i]) - correct_vec = (correct_vec | bool_mat[:, i]) - # print(correct_vec) - top_k_list.append(correct_vec[:, None]) - top_k_mat = np.concatenate(top_k_list, axis=1) - return top_k_mat - - -def calculate_R_precision(embedding1, embedding2, top_k, sum_all=False): - dist_mat = euclidean_distance_matrix(embedding1, embedding2) - matching_score = dist_mat.trace() - argmax = np.argsort(dist_mat, axis=1) - top_k_mat = calculate_top_k(argmax, top_k) - if sum_all: - return top_k_mat.sum(axis=0), matching_score - else: - return top_k_mat, matching_score - -def calculate_multimodality(activation, multimodality_times): - assert len(activation.shape) == 3 - assert activation.shape[1] > multimodality_times - num_per_sent = activation.shape[1] - - first_dices = np.random.choice(num_per_sent, multimodality_times, replace=False) - second_dices = np.random.choice(num_per_sent, multimodality_times, replace=False) - dist = linalg.norm(activation[:, first_dices] - activation[:, second_dices], axis=2) - return dist.mean() - - -def calculate_diversity(activation, diversity_times): - assert len(activation.shape) == 2 - assert activation.shape[0] > diversity_times - num_samples = activation.shape[0] - - first_indices = np.random.choice(num_samples, diversity_times, replace=False) - second_indices = np.random.choice(num_samples, diversity_times, replace=False) - dist = linalg.norm(activation[first_indices] - activation[second_indices], axis=1) - return dist.mean() - - - -def calculate_frechet_distance(mu1, sigma1, mu2, sigma2, eps=1e-6): - - mu1 = np.atleast_1d(mu1) - mu2 = np.atleast_1d(mu2) - - sigma1 = np.atleast_2d(sigma1) - sigma2 = np.atleast_2d(sigma2) - - assert mu1.shape == mu2.shape, \ - 'Training and test mean vectors have different lengths' - assert sigma1.shape == sigma2.shape, \ - 'Training and test covariances have different dimensions' - - diff = mu1 - mu2 - - # Product might be almost singular - covmean, _ = linalg.sqrtm(sigma1.dot(sigma2), disp=False) - if not np.isfinite(covmean).all(): - msg = ('fid calculation produces singular product; ' - 'adding %s to diagonal of cov estimates') % eps - print(msg) - offset = np.eye(sigma1.shape[0]) * eps - covmean = linalg.sqrtm((sigma1 + offset).dot(sigma2 + offset)) - - # Numerical error might give slight imaginary component - if np.iscomplexobj(covmean): - if not np.allclose(np.diagonal(covmean).imag, 0, atol=1e-3): - m = np.max(np.abs(covmean.imag)) - raise ValueError('Imaginary component {}'.format(m)) - covmean = covmean.real - - tr_covmean = np.trace(covmean) - - return (diff.dot(diff) + np.trace(sigma1) - + np.trace(sigma2) - 2 * tr_covmean) - - - -def calculate_activation_statistics(activations): - - mu = np.mean(activations, axis=0) - cov = np.cov(activations, rowvar=False) - return mu, cov - - -def calculate_frechet_feature_distance(feature_list1, feature_list2): - feature_list1 = np.stack(feature_list1) - feature_list2 = np.stack(feature_list2) - - # normalize the scale - mean = np.mean(feature_list1, axis=0) - std = np.std(feature_list1, axis=0) + 1e-10 - feature_list1 = (feature_list1 - mean) / std - feature_list2 = (feature_list2 - mean) / std - - dist = calculate_frechet_distance( - mu1=np.mean(feature_list1, axis=0), - sigma1=np.cov(feature_list1, rowvar=False), - mu2=np.mean(feature_list2, axis=0), - sigma2=np.cov(feature_list2, rowvar=False), - ) - return dist \ No newline at end of file diff --git a/spaces/HarryLee/eCommerceImageCaptioning/fairseq/examples/nonautoregressive_translation/README.md b/spaces/HarryLee/eCommerceImageCaptioning/fairseq/examples/nonautoregressive_translation/README.md deleted file mode 100644 index 8793e225c99732c42c9c19e22075cde37c73341d..0000000000000000000000000000000000000000 --- a/spaces/HarryLee/eCommerceImageCaptioning/fairseq/examples/nonautoregressive_translation/README.md +++ /dev/null @@ -1,146 +0,0 @@ -# Non-autoregressive Neural Machine Translation (NAT) - -This page mainly includes instructions for reproducing results from the following papers -* [Levenshtein Transformer (Gu et al., 2019)](https://arxiv.org/abs/1905.11006). -* [Understanding Knowledge Distillation in Non-autoregressive Machine Translation (Zhou et al., 2019)](https://arxiv.org/abs/1911.02727). - -We also provided our own implementations for several popular non-autoregressive-based models as reference:
    -* [Non-Autoregressive Neural Machine Translation (Gu et al., 2017)](https://arxiv.org/abs/1711.02281)
    -* [Deterministic Non-Autoregressive Neural Sequence Modeling by Iterative Refinement (Lee et al., 2018)](https://arxiv.org/abs/1802.06901)
    -* [Insertion Transformer: Flexible Sequence Generation via Insertion Operations (Stern et al., 2019)](https://arxiv.org/abs/1902.03249)
    -* [Mask-Predict: Parallel Decoding of Conditional Masked Language Models (Ghazvininejad et al., 2019)](https://arxiv.org/abs/1904.09324v2)
    -* [Fast Structured Decoding for Sequence Models (Sun et al., 2019)](https://arxiv.org/abs/1910.11555) - -## Dataset - -First, follow the [instructions to download and preprocess the WMT'14 En-De dataset](../translation#wmt14-english-to-german-convolutional). -Make sure to learn a joint vocabulary by passing the `--joined-dictionary` option to `fairseq-preprocess`. - -### Knowledge Distillation -Following [Gu et al. 2019](https://arxiv.org/abs/1905.11006), [knowledge distillation](https://arxiv.org/abs/1606.07947) from an autoregressive model can effectively simplify the training data distribution, which is sometimes essential for NAT-based models to learn good translations. -The easiest way of performing distillation is to follow the [instructions of training a standard transformer model](../translation) on the same data, and then decode the training set to produce a distillation dataset for NAT. - -### Download -We also provided the preprocessed [original](http://dl.fbaipublicfiles.com/nat/original_dataset.zip) and [distillation](http://dl.fbaipublicfiles.com/nat/distill_dataset.zip) datasets. Please build the binarized dataset on your own. - - -## Train a model - -Then we can train a nonautoregressive model using the `translation_lev` task and a new criterion `nat_loss`. -Use the `--noise` flag to specify the input noise used on the target sentences. -In default, we run the task for *Levenshtein Transformer*, with `--noise='random_delete'`. Full scripts to run other models can also be found [here](./scripts.md). - -The following command will train a *Levenshtein Transformer* on the binarized dataset. - -```bash -fairseq-train \ - data-bin/wmt14_en_de_distill \ - --save-dir checkpoints \ - --ddp-backend=legacy_ddp \ - --task translation_lev \ - --criterion nat_loss \ - --arch levenshtein_transformer \ - --noise random_delete \ - --share-all-embeddings \ - --optimizer adam --adam-betas '(0.9,0.98)' \ - --lr 0.0005 --lr-scheduler inverse_sqrt \ - --stop-min-lr '1e-09' --warmup-updates 10000 \ - --warmup-init-lr '1e-07' --label-smoothing 0.1 \ - --dropout 0.3 --weight-decay 0.01 \ - --decoder-learned-pos \ - --encoder-learned-pos \ - --apply-bert-init \ - --log-format 'simple' --log-interval 100 \ - --fixed-validation-seed 7 \ - --max-tokens 8000 \ - --save-interval-updates 10000 \ - --max-update 300000 -``` - -## Translate - -Once a model is trained, we can generate translations using an `iterative_refinement_generator` which will based on the model's initial output and iteratively read and greedily refine the translation until (1) the model predicts the same translations for two consecutive iterations; or (2) the generator reaches the maximum iterations (`--iter-decode-max-iter`). Use `--print-step` to check the actual # of iteration for each sentence. - -For *Levenshtein Transformer*, it sometimes helps to apply a `--iter-decode-eos-penalty` (typically, 0~3) to penalize the model finishing generation too early and generating too short translations. - -For example, to generate with `--iter-decode-max-iter=9`: -```bash -fairseq-generate \ - data-bin/wmt14_en_de_distill \ - --gen-subset test \ - --task translation_lev \ - --path checkpoints/checkpoint_best.pt \ - --iter-decode-max-iter 9 \ - --iter-decode-eos-penalty 0 \ - --beam 1 --remove-bpe \ - --print-step \ - --batch-size 400 -``` -In the end of the generation, we can see the tokenized BLEU score for the translation. - -## Advanced Decoding Methods -### Ensemble -The NAT models use special implementations of [ensembling](https://github.com/fairinternal/fairseq-py/blob/b98d88da52f2f21f1b169bab8c70c1c4ca19a768/fairseq/sequence_generator.py#L522) to support iterative refinement and a variety of parallel operations in different models, while it shares the same API as standard autoregressive models as follows: -```bash -fairseq-generate \ - data-bin/wmt14_en_de_distill \ - --gen-subset test \ - --task translation_lev \ - --path checkpoint_1.pt:checkpoint_2.pt:checkpoint_3.pt \ - --iter-decode-max-iter 9 \ - --iter-decode-eos-penalty 0 \ - --beam 1 --remove-bpe \ - --print-step \ - --batch-size 400 -``` -We use ``:`` to split multiple models. Note that, not all NAT models support ensembling for now. - - -### Length-beam -For models that predict lengths before decoding (e.g. the vanilla NAT, Mask-Predict, etc), it is possible to improve the translation quality by varying the target lengths around the predicted value, and translating the same example multiple times in parallel. We can select the best translation with the highest scores defined by your model's output. - -Note that, not all models support length beams. For models which dynamically change the lengths (e.g. *Insertion Transformer*, *Levenshtein Transformer*), the same trick does not apply. - -### Re-ranking -If the model generates multiple translations with length beam, we can also introduce an autoregressive model to rerank the translations considering scoring from an autoregressive model is much faster than decoding from that. - -For example, to generate translations with length beam and reranking, -```bash -fairseq-generate \ - data-bin/wmt14_en_de_distill \ - --gen-subset test \ - --task translation_lev \ - --path checkpoints/checkpoint_best.pt:at_checkpoints/checkpoint_best.pt \ - --iter-decode-max-iter 9 \ - --iter-decode-eos-penalty 0 \ - --iter-decode-with-beam 9 \ - --iter-decode-with-external-reranker \ - --beam 1 --remove-bpe \ - --print-step \ - --batch-size 100 -``` -Note that we need to make sure the autoregressive model shares the same vocabulary as our target non-autoregressive model. - - -## Citation - -```bibtex -@incollection{NIPS2019_9297, - title = {Levenshtein Transformer}, - author = {Gu, Jiatao and Wang, Changhan and Zhao, Junbo}, - booktitle = {Advances in Neural Information Processing Systems 32}, - editor = {H. Wallach and H. Larochelle and A. Beygelzimer and F. d\textquotesingle Alch\'{e}-Buc and E. Fox and R. Garnett}, - pages = {11179--11189}, - year = {2019}, - publisher = {Curran Associates, Inc.}, - url = {http://papers.nips.cc/paper/9297-levenshtein-transformer.pdf} -} -``` -```bibtex -@article{zhou2019understanding, - title={Understanding Knowledge Distillation in Non-autoregressive Machine Translation}, - author={Zhou, Chunting and Neubig, Graham and Gu, Jiatao}, - journal={arXiv preprint arXiv:1911.02727}, - year={2019} -} -``` diff --git a/spaces/HarryLee/eCommerceImageCaptioning/fairseq/examples/pointer_generator/README.md b/spaces/HarryLee/eCommerceImageCaptioning/fairseq/examples/pointer_generator/README.md deleted file mode 100644 index 60965708254aae2174812ea6686a9807825b7fb6..0000000000000000000000000000000000000000 --- a/spaces/HarryLee/eCommerceImageCaptioning/fairseq/examples/pointer_generator/README.md +++ /dev/null @@ -1,82 +0,0 @@ -# Transformer with Pointer-Generator Network - -This page describes the `transformer_pointer_generator` model that incorporates -a pointing mechanism in the Transformer model that facilitates copying of input -words to the output. This architecture is described in [Enarvi et al. (2020)](https://www.aclweb.org/anthology/2020.nlpmc-1.4/). - -## Background - -The pointer-generator network was introduced in [See et al. (2017)](https://arxiv.org/abs/1704.04368) -for RNN encoder-decoder attention models. A similar mechanism can be -incorporated in a Transformer model by reusing one of the many attention -distributions for pointing. The attention distribution over the input words is -interpolated with the normal output distribution over the vocabulary words. This -allows the model to generate words that appear in the input, even if they don't -appear in the vocabulary, helping especially with small vocabularies. - -## Implementation - -The mechanism for copying out-of-vocabulary words from the input has been -implemented differently to See et al. In their [implementation](https://github.com/abisee/pointer-generator) -they convey the word identities through the model in order to be able to produce -words that appear in the input sequence but not in the vocabulary. A different -approach was taken in the Fairseq implementation to keep it self-contained in -the model file, avoiding any changes to the rest of the code base. Copying -out-of-vocabulary words is possible by pre-processing the input and -post-processing the output. This is described in detail in the next section. - -## Usage - -The training and evaluation procedure is outlined below. You can also find a -more detailed example for the XSum dataset on [this page](README.xsum.md). - -##### 1. Create a vocabulary and extend it with source position markers - -The pointing mechanism is especially helpful with small vocabularies, if we are -able to recover the identities of any out-of-vocabulary words that are copied -from the input. For this purpose, the model allows extending the vocabulary with -special tokens that can be used in place of `` tokens to identify different -input positions. For example, the user may add ``, ``, ``, -etc. to the end of the vocabulary, after the normal words. Below is an example -of how to create a vocabulary of 10000 most common words and add 1000 input -position markers. - -```bash -vocab_size=10000 -position_markers=1000 -export LC_ALL=C -cat train.src train.tgt | - tr -s '[:space:]' '\n' | - sort | - uniq -c | - sort -k1,1bnr -k2 | - head -n "$((vocab_size - 4))" | - awk '{ print $2 " " $1 }' >dict.pg.txt -python3 -c "[print(' 0'.format(n)) for n in range($position_markers)]" >>dict.pg.txt -``` - -##### 2. Preprocess the text data - -The idea is that any `` tokens in the text are replaced with `` if -it appears in the first input position, `` if it appears in the second -input position, and so on. This can be achieved using the `preprocess.py` script -that is provided in this directory. - -##### 3. Train a model - -The number of these special tokens is given to the model with the -`--source-position-markers` argument—the model simply maps all of these to the -same word embedding as ``. - -The attention distribution that is used for pointing is selected using the -`--alignment-heads` and `--alignment-layer` command-line arguments in the same -way as with the `transformer_align` model. - -##### 4. Generate text and postprocess it - -When using the model to generate text, you want to preprocess the input text in -the same way that training data was processed, replacing out-of-vocabulary words -with `` tokens. If any of these tokens are copied to the output, the -actual words can be retrieved from the unprocessed input text. Any `` -token should be replaced with the word at position N in the original input -sequence. This can be achieved using the `postprocess.py` script. diff --git a/spaces/HarryLee/eCommerceImageCaptioning/fairseq/fairseq/data/mask_tokens_dataset.py b/spaces/HarryLee/eCommerceImageCaptioning/fairseq/fairseq/data/mask_tokens_dataset.py deleted file mode 100644 index 9123235594c3977994a3ae8a03ab4c9e395cc5de..0000000000000000000000000000000000000000 --- a/spaces/HarryLee/eCommerceImageCaptioning/fairseq/fairseq/data/mask_tokens_dataset.py +++ /dev/null @@ -1,220 +0,0 @@ -# Copyright (c) Facebook, Inc. and its affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -from functools import lru_cache - -import numpy as np -import torch -from fairseq.data import Dictionary, data_utils - -from . import BaseWrapperDataset, LRUCacheDataset - - -class MaskTokensDataset(BaseWrapperDataset): - """ - A wrapper Dataset for masked language modeling. - - Input items are masked according to the specified masking probability. - - Args: - dataset: Dataset to wrap. - sizes: Sentence lengths - vocab: Dictionary with the vocabulary and special tokens. - pad_idx: Id of pad token in vocab - mask_idx: Id of mask token in vocab - return_masked_tokens: controls whether to return the non-masked tokens - (the default) or to return a tensor with the original masked token - IDs (and *pad_idx* elsewhere). The latter is useful as targets for - masked LM training. - seed: Seed for random number generator for reproducibility. - mask_prob: probability of replacing a token with *mask_idx*. - leave_unmasked_prob: probability that a masked token is unmasked. - random_token_prob: probability of replacing a masked token with a - random token from the vocabulary. - freq_weighted_replacement: sample random replacement words based on - word frequencies in the vocab. - mask_whole_words: only mask whole words. This should be a byte mask - over vocab indices, indicating whether it is the beginning of a - word. We will extend any mask to encompass the whole word. - bpe: BPE to use for whole-word masking. - mask_multiple_length : repeat each mask index multiple times. Default - value is 1. - mask_stdev : standard deviation of masks distribution in case of - multiple masking. Default value is 0. - """ - - @classmethod - def apply_mask(cls, dataset: torch.utils.data.Dataset, *args, **kwargs): - """Return the source and target datasets for masked LM training.""" - dataset = LRUCacheDataset(dataset) - return ( - LRUCacheDataset(cls(dataset, *args, **kwargs, return_masked_tokens=False)), - LRUCacheDataset(cls(dataset, *args, **kwargs, return_masked_tokens=True)), - ) - - def __init__( - self, - dataset: torch.utils.data.Dataset, - vocab: Dictionary, - pad_idx: int, - mask_idx: int, - return_masked_tokens: bool = False, - seed: int = 1, - mask_prob: float = 0.15, - leave_unmasked_prob: float = 0.1, - random_token_prob: float = 0.1, - freq_weighted_replacement: bool = False, - mask_whole_words: torch.Tensor = None, - mask_multiple_length: int = 1, - mask_stdev: float = 0.0, - ): - assert 0.0 < mask_prob < 1.0 - assert 0.0 <= random_token_prob <= 1.0 - assert 0.0 <= leave_unmasked_prob <= 1.0 - assert random_token_prob + leave_unmasked_prob <= 1.0 - assert mask_multiple_length >= 1 - assert mask_stdev >= 0.0 - - self.dataset = dataset - self.vocab = vocab - self.pad_idx = pad_idx - self.mask_idx = mask_idx - self.return_masked_tokens = return_masked_tokens - self.seed = seed - self.mask_prob = mask_prob - self.leave_unmasked_prob = leave_unmasked_prob - self.random_token_prob = random_token_prob - self.mask_whole_words = mask_whole_words - self.mask_multiple_length = mask_multiple_length - self.mask_stdev = mask_stdev - - if random_token_prob > 0.0: - if freq_weighted_replacement: - weights = np.array(self.vocab.count) - else: - weights = np.ones(len(self.vocab)) - weights[: self.vocab.nspecial] = 0 - self.weights = weights / weights.sum() - - self.epoch = 0 - - @property - def can_reuse_epoch_itr_across_epochs(self): - return True # only the noise changes, not item sizes - - def set_epoch(self, epoch, **unused): - super().set_epoch(epoch) - self.epoch = epoch - - def __getitem__(self, index: int): - return self.__getitem_cached__(self.seed, self.epoch, index) - - @lru_cache(maxsize=8) - def __getitem_cached__(self, seed: int, epoch: int, index: int): - with data_utils.numpy_seed(self.seed, self.epoch, index): - item = self.dataset[index] - sz = len(item) - - assert ( - self.mask_idx not in item - ), "Dataset contains mask_idx (={}), this is not expected!".format( - self.mask_idx, - ) - - if self.mask_whole_words is not None: - word_begins_mask = self.mask_whole_words.gather(0, item) - word_begins_idx = word_begins_mask.nonzero().view(-1) - sz = len(word_begins_idx) - words = np.split(word_begins_mask, word_begins_idx)[1:] - assert len(words) == sz - word_lens = list(map(len, words)) - - # decide elements to mask - mask = np.full(sz, False) - num_mask = int( - # add a random number for probabilistic rounding - self.mask_prob * sz / float(self.mask_multiple_length) - + np.random.rand() - ) - - # multiple masking as described in the vq-wav2vec paper (https://arxiv.org/abs/1910.05453) - mask_idc = np.random.choice(sz, num_mask, replace=False) - if self.mask_stdev > 0.0: - lengths = np.random.normal( - self.mask_multiple_length, self.mask_stdev, size=num_mask - ) - lengths = [max(0, int(round(x))) for x in lengths] - mask_idc = np.asarray( - [ - mask_idc[j] + offset - for j in range(len(mask_idc)) - for offset in range(lengths[j]) - ], - dtype=np.int64, - ) - else: - mask_idc = np.concatenate( - [mask_idc + i for i in range(self.mask_multiple_length)] - ) - mask_idc = mask_idc[mask_idc < len(mask)] - try: - mask[mask_idc] = True - except: # something wrong - print( - "Assigning mask indexes {} to mask {} failed!".format( - mask_idc, mask - ) - ) - raise - - if self.return_masked_tokens: - # exit early if we're just returning the masked tokens - # (i.e., the targets for masked LM training) - if self.mask_whole_words is not None: - mask = np.repeat(mask, word_lens) - new_item = np.full(len(mask), self.pad_idx) - new_item[mask] = item[torch.from_numpy(mask.astype(np.uint8)) == 1] - return torch.from_numpy(new_item) - - # decide unmasking and random replacement - rand_or_unmask_prob = self.random_token_prob + self.leave_unmasked_prob - if rand_or_unmask_prob > 0.0: - rand_or_unmask = mask & (np.random.rand(sz) < rand_or_unmask_prob) - if self.random_token_prob == 0.0: - unmask = rand_or_unmask - rand_mask = None - elif self.leave_unmasked_prob == 0.0: - unmask = None - rand_mask = rand_or_unmask - else: - unmask_prob = self.leave_unmasked_prob / rand_or_unmask_prob - decision = np.random.rand(sz) < unmask_prob - unmask = rand_or_unmask & decision - rand_mask = rand_or_unmask & (~decision) - else: - unmask = rand_mask = None - - if unmask is not None: - mask = mask ^ unmask - - if self.mask_whole_words is not None: - mask = np.repeat(mask, word_lens) - - new_item = np.copy(item) - new_item[mask] = self.mask_idx - if rand_mask is not None: - num_rand = rand_mask.sum() - if num_rand > 0: - if self.mask_whole_words is not None: - rand_mask = np.repeat(rand_mask, word_lens) - num_rand = rand_mask.sum() - - new_item[rand_mask] = np.random.choice( - len(self.vocab), - num_rand, - p=self.weights, - ) - - return torch.from_numpy(new_item) diff --git a/spaces/HarryLee/eCommerceImageCaptioning/fairseq/fairseq/data/nested_dictionary_dataset.py b/spaces/HarryLee/eCommerceImageCaptioning/fairseq/fairseq/data/nested_dictionary_dataset.py deleted file mode 100644 index 52e74abddacc923c5e29b0a0c41d7efc85482d3b..0000000000000000000000000000000000000000 --- a/spaces/HarryLee/eCommerceImageCaptioning/fairseq/fairseq/data/nested_dictionary_dataset.py +++ /dev/null @@ -1,125 +0,0 @@ -# Copyright (c) Facebook, Inc. and its affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -from collections import OrderedDict - -import torch -from torch.utils.data.dataloader import default_collate - -from . import FairseqDataset - - -def _flatten(dico, prefix=None): - """Flatten a nested dictionary.""" - new_dico = OrderedDict() - if isinstance(dico, dict): - prefix = prefix + "." if prefix is not None else "" - for k, v in dico.items(): - if v is None: - continue - new_dico.update(_flatten(v, prefix + k)) - elif isinstance(dico, list): - for i, v in enumerate(dico): - new_dico.update(_flatten(v, prefix + ".[" + str(i) + "]")) - else: - new_dico = OrderedDict({prefix: dico}) - return new_dico - - -def _unflatten(dico): - """Unflatten a flattened dictionary into a nested dictionary.""" - new_dico = OrderedDict() - for full_k, v in dico.items(): - full_k = full_k.split(".") - node = new_dico - for k in full_k[:-1]: - if k.startswith("[") and k.endswith("]"): - k = int(k[1:-1]) - if k not in node: - node[k] = OrderedDict() - node = node[k] - node[full_k[-1]] = v - return new_dico - - -class NestedDictionaryDataset(FairseqDataset): - def __init__(self, defn, sizes=None): - super().__init__() - self.defn = _flatten(defn) - self.sizes = [sizes] if not isinstance(sizes, (list, tuple)) else sizes - - first = None - for v in self.defn.values(): - if not isinstance( - v, - ( - FairseqDataset, - torch.utils.data.Dataset, - ), - ): - raise ValueError("Expected Dataset but found: {}".format(v.__class__)) - first = first or v - if len(v) > 0: - assert len(v) == len(first), "dataset lengths must match" - - self._len = len(first) - - def __getitem__(self, index): - return OrderedDict((k, ds[index]) for k, ds in self.defn.items()) - - def __len__(self): - return self._len - - def collater(self, samples): - """Merge a list of samples to form a mini-batch. - - Args: - samples (List[dict]): samples to collate - - Returns: - dict: a mini-batch suitable for forwarding with a Model - """ - if len(samples) == 0: - return {} - sample = OrderedDict() - for k, ds in self.defn.items(): - try: - sample[k] = ds.collater([s[k] for s in samples]) - except NotImplementedError: - sample[k] = default_collate([s[k] for s in samples]) - return _unflatten(sample) - - def num_tokens(self, index): - """Return the number of tokens in a sample. This value is used to - enforce ``--max-tokens`` during batching.""" - return max(s[index] for s in self.sizes) - - def size(self, index): - """Return an example's size as a float or tuple. This value is used when - filtering a dataset with ``--max-positions``.""" - if len(self.sizes) == 1: - return self.sizes[0][index] - else: - return (s[index] for s in self.sizes) - - @property - def supports_prefetch(self): - """Whether this dataset supports prefetching.""" - return any(ds.supports_prefetch for ds in self.defn.values()) - - def prefetch(self, indices): - """Prefetch the data required for this epoch.""" - for ds in self.defn.values(): - if getattr(ds, "supports_prefetch", False): - ds.prefetch(indices) - - @property - def can_reuse_epoch_itr_across_epochs(self): - return all(ds.can_reuse_epoch_itr_across_epochs for ds in self.defn.values()) - - def set_epoch(self, epoch): - super().set_epoch(epoch) - for ds in self.defn.values(): - ds.set_epoch(epoch) diff --git a/spaces/Hexamind/GDOC/config.py b/spaces/Hexamind/GDOC/config.py deleted file mode 100644 index 7c792060677e618ae2fc04f9a4d3132d2d046194..0000000000000000000000000000000000000000 --- a/spaces/Hexamind/GDOC/config.py +++ /dev/null @@ -1,28 +0,0 @@ -import os - -config = { - 'templates_path': 'data/templates', - 'these_docs_path': 'data/examples/', - 'new_docs_path': 'data/examples/', - 'default_template_index': 0, - 'styled_docs_path': 'temp/styles_files', - 'generated_docs_path': 'temp/generated_files', - 'options': ["Recentrer les tableaux", "Recentrer les images (sauf les flottantes)", "Ajouter le template avant", "Justifier le texte"], - 'max_styles': 300, - 'log_msg': { - 'options_applied': 'Les options suivantes ont été appliquées : \n', - 'suppressed_styles': 'Les styles suivants ont été supprimés : \n', - 'modified_styles': 'Les styles suivants ont été modifiés : \n', - 'added_styles': 'Les styles suivants ont été ajoutés :\n', - 'modified_style': ' - ', - 'color': ' la couleur,', - 'font size': ' la taille de la fonte,', - 'font': ' la fonte,', - 'all_caps': ' les majuscules,', - 'bold': 'le caractère gras', - 'document': '\n============================\n Sur le document : ', - }, -} - -templates = [t for t in os.listdir(config['templates_path']) if t.endswith((".docx",))] -config.update({'templates': templates}) diff --git a/spaces/HuggingFaceM4/IDEFICS_Data_Measurement_Tool/widgets/widget_base.py b/spaces/HuggingFaceM4/IDEFICS_Data_Measurement_Tool/widgets/widget_base.py deleted file mode 100644 index 79b7b6ffcbf80527eed34cc8fe33619e713de437..0000000000000000000000000000000000000000 --- a/spaces/HuggingFaceM4/IDEFICS_Data_Measurement_Tool/widgets/widget_base.py +++ /dev/null @@ -1,24 +0,0 @@ -from abc import ABC, abstractmethod - -import gradio as gr - -from data_measurements.dataset_statistics import DatasetStatisticsCacheClass as dmt_cls - - -class Widget(ABC): - @abstractmethod - def render(self): - pass - - @abstractmethod - def update(self, dstats: dmt_cls): - pass - - @property - @abstractmethod - def output_components(self): - pass - - @abstractmethod - def add_events(self, state: gr.State): - pass diff --git a/spaces/Hurtle/DeepDanbooru_string/app.py b/spaces/Hurtle/DeepDanbooru_string/app.py deleted file mode 100644 index 49019837c9207cc68cb37be0342f3bc44fd0decb..0000000000000000000000000000000000000000 --- a/spaces/Hurtle/DeepDanbooru_string/app.py +++ /dev/null @@ -1,185 +0,0 @@ -#!/usr/bin/env python - -from __future__ import annotations - -import argparse -import functools -import os -import html -import pathlib -import tarfile - -import deepdanbooru as dd -import gradio as gr -import huggingface_hub -import numpy as np -import PIL.Image -import tensorflow as tf -import piexif -import piexif.helper - -TITLE = 'DeepDanbooru String' - -TOKEN = os.environ['TOKEN'] -MODEL_REPO = 'CikeyQI/DeepDanbooru_string' -MODEL_FILENAME = 'model-resnet_custom_v3.h5' -LABEL_FILENAME = 'tags.txt' - - -def parse_args() -> argparse.Namespace: - parser = argparse.ArgumentParser() - parser.add_argument('--score-slider-step', type=float, default=0.05) - parser.add_argument('--score-threshold', type=float, default=0.5) - parser.add_argument('--theme', type=str, default='dark-grass') - parser.add_argument('--live', action='store_true') - parser.add_argument('--share', action='store_true') - parser.add_argument('--port', type=int) - parser.add_argument('--disable-queue', - dest='enable_queue', - action='store_false') - parser.add_argument('--allow-flagging', type=str, default='never') - return parser.parse_args() - - -def load_sample_image_paths() -> list[pathlib.Path]: - image_dir = pathlib.Path('images') - if not image_dir.exists(): - dataset_repo = 'hysts/sample-images-TADNE' - path = huggingface_hub.hf_hub_download(dataset_repo, - 'images.tar.gz', - repo_type='dataset', - use_auth_token=TOKEN) - with tarfile.open(path) as f: - f.extractall() - return sorted(image_dir.glob('*')) - - -def load_model() -> tf.keras.Model: - path = huggingface_hub.hf_hub_download(MODEL_REPO, - MODEL_FILENAME, - use_auth_token=TOKEN) - model = tf.keras.models.load_model(path) - return model - - -def load_labels() -> list[str]: - path = huggingface_hub.hf_hub_download(MODEL_REPO, - LABEL_FILENAME, - use_auth_token=TOKEN) - with open(path) as f: - labels = [line.strip() for line in f.readlines()] - return labels - -def plaintext_to_html(text): - text = "

    " + "
    \n".join([f"{html.escape(x)}" for x in text.split('\n')]) + "

    " - return text - -def predict(image: PIL.Image.Image, score_threshold: float, - model: tf.keras.Model, labels: list[str]) -> dict[str, float]: - rawimage = image - _, height, width, _ = model.input_shape - image = np.asarray(image) - image = tf.image.resize(image, - size=(height, width), - method=tf.image.ResizeMethod.AREA, - preserve_aspect_ratio=True) - image = image.numpy() - image = dd.image.transform_and_pad_image(image, width, height) - image = image / 255. - probs = model.predict(image[None, ...])[0] - probs = probs.astype(float) - res = dict() - for prob, label in zip(probs.tolist(), labels): - if prob < score_threshold: - continue - res[label] = prob - b = dict(sorted(res.items(),key=lambda item:item[1], reverse=True)) - a = ', '.join(list(b.keys())).replace('_',' ').replace('(','\(').replace(')','\)') - c = ', '.join(list(b.keys())) - - items = rawimage.info - geninfo = '' - - if "exif" in rawimage.info: - exif = piexif.load(rawimage.info["exif"]) - exif_comment = (exif or {}).get("Exif", {}).get(piexif.ExifIFD.UserComment, b'') - try: - exif_comment = piexif.helper.UserComment.load(exif_comment) - except ValueError: - exif_comment = exif_comment.decode('utf8', errors="ignore") - - items['exif comment'] = exif_comment - geninfo = exif_comment - - for field in ['jfif', 'jfif_version', 'jfif_unit', 'jfif_density', 'dpi', 'exif', - 'loop', 'background', 'timestamp', 'duration']: - items.pop(field, None) - - geninfo = items.get('parameters', geninfo) - - info = f""" -

    PNG Info

    -""" - for key, text in items.items(): - info += f""" -
    -

    {plaintext_to_html(str(key))}

    -

    {plaintext_to_html(str(text))}

    -
    -""".strip()+"\n" - - if len(info) == 0: - message = "Nothing found in the image." - info = f"

    {message}

    " - - return (a,c,res,info) - - -def main(): - args = parse_args() - model = load_model() - labels = load_labels() - - func = functools.partial(predict, model=model, labels=labels) - func = functools.update_wrapper(func, predict) - - gr.Interface( - func, - [ - gr.inputs.Image(type='pil', label='Input'), - gr.inputs.Slider(0, - 1, - step=args.score_slider_step, - default=args.score_threshold, - label='Score Threshold'), - ], - [ - gr.outputs.Textbox(label='Output (string)'), - gr.outputs.Textbox(label='Output (raw string)'), - gr.outputs.Label(label='Output (label)'), - gr.outputs.HTML() - ], - examples=[ - ['miku.jpg',0.5], - ['miku2.jpg',0.5] - ], - title=TITLE, - description=''' -Demo for [KichangKim/DeepDanbooru](https://github.com/KichangKim/DeepDanbooru) with "ready to copy" prompt and a prompt analyzer. - -Modified from [hysts/DeepDanbooru](https://huggingface.co/spaces/hysts/DeepDanbooru) - -PNG Info code forked from [AUTOMATIC1111/stable-diffusion-webui](https://github.com/AUTOMATIC1111/stable-diffusion-webui) - ''', - theme=args.theme, - allow_flagging=args.allow_flagging, - live=args.live, - ).launch( - enable_queue=args.enable_queue, - server_port=args.port, - share=args.share, - ) - - -if __name__ == '__main__': - main() diff --git a/spaces/ICML2022/OFA/fairseq/examples/multilingual/data_scripts/download_iwslt_and_extract.sh b/spaces/ICML2022/OFA/fairseq/examples/multilingual/data_scripts/download_iwslt_and_extract.sh deleted file mode 100644 index ca3591b3db1715f136773d62e4b9b9ede97d436c..0000000000000000000000000000000000000000 --- a/spaces/ICML2022/OFA/fairseq/examples/multilingual/data_scripts/download_iwslt_and_extract.sh +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/bash -# Copyright (c) Facebook, Inc. and its affiliates. -# All rights reserved. -# -# This source code is licensed under the license found in the -# LICENSE file in the root directory of this source tree. - -#echo 'Cloning Moses github repository (for tokenization scripts)...' -#git clone https://github.com/moses-smt/mosesdecoder.git - -if [ -z $WORKDIR_ROOT ] ; -then - echo "please specify your working directory root in environment variable WORKDIR_ROOT. Exitting..." - exit -fi - - - -data_root=${WORKDIR_ROOT}/iwsltv2 -DESTDIR=${WORKDIR_ROOT}/ML50/raw - - -langs="ar_AR it_IT nl_XX ko_KR vi_VN" -echo "data_root: $data_root" - -download_path=${data_root}/downloads -raw=${DESTDIR} -tmp=${data_root}/tmp -orig=${data_root}/orig - -mkdir -p $download_path $orig $raw $tmp -####################### -download_iwslt(){ - iwslt_key=$1 - src=$2 - tgt=$3 - save_prefix=$4 - pushd ${download_path} - if [[ ! -f ${save_prefix}$src-$tgt.tgz ]]; then - wget https://wit3.fbk.eu/archive/${iwslt_key}/texts/$src/$tgt/$src-$tgt.tgz -O ${save_prefix}$src-$tgt.tgz - [ $? -eq 0 ] && return 0 - fi - popd -} - -extract_iwslt(){ - src=$1 - tgt=$2 - prefix=$3 - pushd $orig - tar zxvf ${download_path}/${prefix}$src-${tgt}.tgz - popd -} - -generate_train(){ - lsrc=$1 - ltgt=$2 - src=${lsrc:0:2} - tgt=${ltgt:0:2} - for ll in $lsrc $ltgt; do - l=${ll:0:2} - f="$orig/*/train.tags.$src-$tgt.$l" - f_raw=$raw/train.$lsrc-$ltgt.$ll - cat $f \ - | grep -v '' \ - | grep -v '' \ - | grep -v '' \ - | grep -v '' \ - | grep -v '' \ - | sed -e 's///g' \ - | sed -e 's/<\/title>//g' \ - | sed -e 's/<description>//g' \ - | sed -e 's/<\/description>//g' \ - | sed 's/^\s*//g' \ - | sed 's/\s*$//g' \ - > $f_raw - [ $? -eq 0 ] && echo "extracted $f to $f_raw" - done - return 0 -} - -convert_valid_test(){ - src=$1 - tgt=$2 - for l in $src $tgt; do - echo "lang: ${l}" - for o in `ls $orig/*/IWSLT*.TED*.$src-$tgt.$l.xml`; do - fname=${o##*/} - f=$tmp/${fname%.*} - echo "$o => $f" - grep '<seg id' $o \ - | sed -e 's/<seg id="[0-9]*">\s*//g' \ - | sed -e 's/\s*<\/seg>\s*//g' \ - | sed -e "s/\’/\'/g" \ - > $f - echo "" - done - done -} - -generate_subset(){ - lsrc=$1 - ltgt=$2 - src=${lsrc:0:2} - tgt=${ltgt:0:2} - subset=$3 - prefix=$4 - for ll in $lsrc $ltgt; do - l=${ll:0:2} - f=$tmp/$prefix.${src}-${tgt}.$l - if [[ -f $f ]]; then - cp $f $raw/$subset.${lsrc}-$ltgt.${ll} - fi - done -} -################# - -echo "downloading iwslt training and dev data" -# using multilingual for it, nl -download_iwslt "2017-01-trnmted" DeEnItNlRo DeEnItNlRo -download_iwslt "2017-01-trnted" ar en -download_iwslt "2017-01-trnted" en ar -download_iwslt "2017-01-trnted" ko en -download_iwslt "2017-01-trnted" en ko -download_iwslt "2015-01" vi en -download_iwslt "2015-01" en vi - -echo "donwloading iwslt test data" -download_iwslt "2017-01-mted-test" it en "test." -download_iwslt "2017-01-mted-test" en it "test." -download_iwslt "2017-01-mted-test" nl en "test." -download_iwslt "2017-01-mted-test" en nl "test." - -download_iwslt "2017-01-ted-test" ar en "test." -download_iwslt "2017-01-ted-test" en ar "test." -download_iwslt "2017-01-ted-test" ko en "test." -download_iwslt "2017-01-ted-test" en ko "test." -download_iwslt "2015-01-test" vi en "test." -download_iwslt "2015-01-test" en vi "test." - -echo "extract training data tar balls" -extract_iwslt DeEnItNlRo DeEnItNlRo -extract_iwslt ar en -extract_iwslt en ar -extract_iwslt ko en -extract_iwslt en ko -extract_iwslt vi en -extract_iwslt en vi - - -echo "extracting iwslt test data" -for lang in $langs; do - l=${lang:0:2} - extract_iwslt $l en "test." - extract_iwslt en $l "test." -done - -echo "convert dev and test data" -for lang in $langs; do - s_lang=${lang:0:2} - convert_valid_test $s_lang en - convert_valid_test en $s_lang -done - - - -echo "creating training data into $raw" -for lang in $langs; do - generate_train $lang en_XX - generate_train en_XX $lang -done - -echo "creating iwslt dev data into raw" -generate_subset en_XX vi_VN valid "IWSLT15.TED.tst2013" -generate_subset vi_VN en_XX valid "IWSLT15.TED.tst2013" - -generate_subset en_XX ar_AR valid "IWSLT17.TED.tst2016" -generate_subset ar_AR en_XX valid "IWSLT17.TED.tst2016" -generate_subset en_XX ko_KR valid "IWSLT17.TED.tst2016" -generate_subset ko_KR en_XX valid "IWSLT17.TED.tst2016" - - -generate_subset en_XX it_IT valid "IWSLT17.TED.tst2010" -generate_subset it_IT en_XX valid "IWSLT17.TED.tst2010" -generate_subset en_XX nl_XX valid "IWSLT17.TED.tst2010" -generate_subset nl_XX en_XX valid "IWSLT17.TED.tst2010" - -echo "creating iswslt test data into raw" -generate_subset en_XX vi_VN test "IWSLT15.TED.tst2015" -generate_subset vi_VN en_XX test "IWSLT15.TED.tst2015" - -generate_subset en_XX ar_AR test "IWSLT17.TED.tst2017" -generate_subset ar_AR en_XX test "IWSLT17.TED.tst2017" -generate_subset en_XX ko_KR test "IWSLT17.TED.tst2017" -generate_subset ko_KR en_XX test "IWSLT17.TED.tst2017" - -generate_subset en_XX it_IT test "IWSLT17.TED.tst2017.mltlng" -generate_subset it_IT en_XX test "IWSLT17.TED.tst2017.mltlng" -generate_subset en_XX nl_XX test "IWSLT17.TED.tst2017.mltlng" -generate_subset nl_XX en_XX test "IWSLT17.TED.tst2017.mltlng" - -# normalze iwslt directions into x-en -pushd $raw -for lang in $langs; do - for split in test valid; do - x_en_f1=$split.$lang-en_XX.en_XX - x_en_f2=$split.$lang-en_XX.${lang} - - en_x_f1=$split.en_XX-$lang.en_XX - en_x_f2=$split.en_XX-$lang.${lang} - - if [ -f $en_x_f1 ] && [ ! -f $x_en_f1 ]; then - echo "cp $en_x_f1 $x_en_f1" - cp $en_x_f1 $x_en_f1 - fi - if [ -f $x_en_f2 ] && [ ! -f $x_en_f2 ]; then - echo "cp $en_x_f2 $x_en_f2" - cp $en_x_f2 $x_en_f2 - fi - done -done -popd \ No newline at end of file diff --git a/spaces/ICML2022/OFA/fairseq/examples/wav2vec/unsupervised/scripts/normalize_and_filter_text.py b/spaces/ICML2022/OFA/fairseq/examples/wav2vec/unsupervised/scripts/normalize_and_filter_text.py deleted file mode 100644 index c2bd16efb530af5af3f72ab0edb3044b4e9fcd5c..0000000000000000000000000000000000000000 --- a/spaces/ICML2022/OFA/fairseq/examples/wav2vec/unsupervised/scripts/normalize_and_filter_text.py +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env python3 -# Copyright (c) Facebook, Inc. and its affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -import argparse -import fasttext as ft -import os -import regex -import sys - - -def get_parser(): - parser = argparse.ArgumentParser( - description="reads text from stdin and outputs normalized, lid-filtered version to stdout" - ) - parser.add_argument( - "--fasttext-model", - help="path to fasttext model", - default="lid.187.bin", - ) - parser.add_argument("--lang", help="language id", required=True) - parser.add_argument( - "--lid-threshold", - type=float, - help="threshold for this lang id probability", - default=0.4, - ) - - return parser - - -def main(): - parser = get_parser() - args = parser.parse_args() - filter_r = regex.compile(r"[^\p{L}\p{N}\p{M}\' \-]") - - lg = args.lang.lower() - lg_label = f"__label__{lg}" - thresh = args.lid_threshold - - if os.path.exists(args.fasttext_model): - model = ft.load_model(args.fasttext_model) - else: - print( - f"fasttext language id model {args.fasttext_model} not found. Proceeding without language filtering. " - f"To enable language filtering, please download the latest language id model " - f"from https://fasttext.cc/docs/en/language-identification.html", - file=sys.stderr, - ) - model = None - - for line in sys.stdin: - line = line.strip() - line = filter_r.sub(" ", line) - line = " ".join(line.split()) - - if model is not None: - lid, prob = model.predict(line, k=100) - try: - target_idx = lid.index(lg_label) - except ValueError: - continue - if target_idx == 0 or prob[target_idx] >= thresh: - print(line) - else: - print(line) - - -if __name__ == "__main__": - main() diff --git a/spaces/ICML2022/OFA/fairseq/fairseq/data/add_target_dataset.py b/spaces/ICML2022/OFA/fairseq/fairseq/data/add_target_dataset.py deleted file mode 100644 index d8a08e746dedb8a5d9d9e4b9ad149e0da469d644..0000000000000000000000000000000000000000 --- a/spaces/ICML2022/OFA/fairseq/fairseq/data/add_target_dataset.py +++ /dev/null @@ -1,79 +0,0 @@ -# Copyright (c) Facebook, Inc. and its affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -import torch - -from . import BaseWrapperDataset, data_utils -from fairseq.data.text_compressor import TextCompressor, TextCompressionLevel - - -class AddTargetDataset(BaseWrapperDataset): - def __init__( - self, - dataset, - labels, - pad, - eos, - batch_targets, - process_label=None, - label_len_fn=None, - add_to_input=False, - text_compression_level=TextCompressionLevel.none - ): - super().__init__(dataset) - self.labels = labels - self.batch_targets = batch_targets - self.pad = pad - self.eos = eos - self.process_label = process_label - self.label_len_fn = label_len_fn - self.add_to_input = add_to_input - self.text_compressor = TextCompressor(level=text_compression_level) - - def get_label(self, index, process_fn=None): - lbl = self.labels[index] - lbl = self.text_compressor.decompress(lbl) - return lbl if process_fn is None else process_fn(lbl) - - def __getitem__(self, index): - item = self.dataset[index] - item["label"] = self.get_label(index, process_fn=self.process_label) - return item - - def size(self, index): - sz = self.dataset.size(index) - own_sz = self.label_len_fn(self.get_label(index)) - return sz, own_sz - - def collater(self, samples): - collated = self.dataset.collater(samples) - if len(collated) == 0: - return collated - indices = set(collated["id"].tolist()) - target = [s["label"] for s in samples if s["id"] in indices] - - if self.batch_targets: - collated["target_lengths"] = torch.LongTensor([len(t) for t in target]) - target = data_utils.collate_tokens(target, pad_idx=self.pad, left_pad=False) - collated["ntokens"] = collated["target_lengths"].sum().item() - else: - collated["ntokens"] = sum([len(t) for t in target]) - - collated["target"] = target - - if self.add_to_input: - eos = target.new_full((target.size(0), 1), self.eos) - collated["target"] = torch.cat([target, eos], dim=-1).long() - collated["net_input"]["prev_output_tokens"] = torch.cat( - [eos, target], dim=-1 - ).long() - collated["ntokens"] += target.size(0) - return collated - - def filter_indices_by_size(self, indices, max_sizes): - indices, ignored = data_utils._filter_by_size_dynamic( - indices, self.size, max_sizes - ) - return indices, ignored diff --git a/spaces/IDEA-Research/Grounded-SAM/GroundingDINO/demo/inference_on_a_image.py b/spaces/IDEA-Research/Grounded-SAM/GroundingDINO/demo/inference_on_a_image.py deleted file mode 100644 index 207227b7419df8db7a6f0206361670287cf4d9fa..0000000000000000000000000000000000000000 --- a/spaces/IDEA-Research/Grounded-SAM/GroundingDINO/demo/inference_on_a_image.py +++ /dev/null @@ -1,172 +0,0 @@ -import argparse -import os -import sys - -import numpy as np -import torch -from PIL import Image, ImageDraw, ImageFont - -import groundingdino.datasets.transforms as T -from groundingdino.models import build_model -from groundingdino.util import box_ops -from groundingdino.util.slconfig import SLConfig -from groundingdino.util.utils import clean_state_dict, get_phrases_from_posmap - - -def plot_boxes_to_image(image_pil, tgt): - H, W = tgt["size"] - boxes = tgt["boxes"] - labels = tgt["labels"] - assert len(boxes) == len(labels), "boxes and labels must have same length" - - draw = ImageDraw.Draw(image_pil) - mask = Image.new("L", image_pil.size, 0) - mask_draw = ImageDraw.Draw(mask) - - # draw boxes and masks - for box, label in zip(boxes, labels): - # from 0..1 to 0..W, 0..H - box = box * torch.Tensor([W, H, W, H]) - # from xywh to xyxy - box[:2] -= box[2:] / 2 - box[2:] += box[:2] - # random color - color = tuple(np.random.randint(0, 255, size=3).tolist()) - # draw - x0, y0, x1, y1 = box - x0, y0, x1, y1 = int(x0), int(y0), int(x1), int(y1) - - draw.rectangle([x0, y0, x1, y1], outline=color, width=6) - # draw.text((x0, y0), str(label), fill=color) - - font = ImageFont.load_default() - if hasattr(font, "getbbox"): - bbox = draw.textbbox((x0, y0), str(label), font) - else: - w, h = draw.textsize(str(label), font) - bbox = (x0, y0, w + x0, y0 + h) - # bbox = draw.textbbox((x0, y0), str(label)) - draw.rectangle(bbox, fill=color) - draw.text((x0, y0), str(label), fill="white") - - mask_draw.rectangle([x0, y0, x1, y1], fill=255, width=6) - - return image_pil, mask - - -def load_image(image_path): - # load image - image_pil = Image.open(image_path).convert("RGB") # load image - - transform = T.Compose( - [ - T.RandomResize([800], max_size=1333), - T.ToTensor(), - T.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225]), - ] - ) - image, _ = transform(image_pil, None) # 3, h, w - return image_pil, image - - -def load_model(model_config_path, model_checkpoint_path, cpu_only=False): - args = SLConfig.fromfile(model_config_path) - args.device = "cuda" if not cpu_only else "cpu" - model = build_model(args) - checkpoint = torch.load(model_checkpoint_path, map_location="cpu") - load_res = model.load_state_dict(clean_state_dict(checkpoint["model"]), strict=False) - print(load_res) - _ = model.eval() - return model - - -def get_grounding_output(model, image, caption, box_threshold, text_threshold, with_logits=True, cpu_only=False): - caption = caption.lower() - caption = caption.strip() - if not caption.endswith("."): - caption = caption + "." - device = "cuda" if not cpu_only else "cpu" - model = model.to(device) - image = image.to(device) - with torch.no_grad(): - outputs = model(image[None], captions=[caption]) - logits = outputs["pred_logits"].cpu().sigmoid()[0] # (nq, 256) - boxes = outputs["pred_boxes"].cpu()[0] # (nq, 4) - logits.shape[0] - - # filter output - logits_filt = logits.clone() - boxes_filt = boxes.clone() - filt_mask = logits_filt.max(dim=1)[0] > box_threshold - logits_filt = logits_filt[filt_mask] # num_filt, 256 - boxes_filt = boxes_filt[filt_mask] # num_filt, 4 - logits_filt.shape[0] - - # get phrase - tokenlizer = model.tokenizer - tokenized = tokenlizer(caption) - # build pred - pred_phrases = [] - for logit, box in zip(logits_filt, boxes_filt): - pred_phrase = get_phrases_from_posmap(logit > text_threshold, tokenized, tokenlizer) - if with_logits: - pred_phrases.append(pred_phrase + f"({str(logit.max().item())[:4]})") - else: - pred_phrases.append(pred_phrase) - - return boxes_filt, pred_phrases - - -if __name__ == "__main__": - - parser = argparse.ArgumentParser("Grounding DINO example", add_help=True) - parser.add_argument("--config_file", "-c", type=str, required=True, help="path to config file") - parser.add_argument( - "--checkpoint_path", "-p", type=str, required=True, help="path to checkpoint file" - ) - parser.add_argument("--image_path", "-i", type=str, required=True, help="path to image file") - parser.add_argument("--text_prompt", "-t", type=str, required=True, help="text prompt") - parser.add_argument( - "--output_dir", "-o", type=str, default="outputs", required=True, help="output directory" - ) - - parser.add_argument("--box_threshold", type=float, default=0.3, help="box threshold") - parser.add_argument("--text_threshold", type=float, default=0.25, help="text threshold") - - parser.add_argument("--cpu-only", action="store_true", help="running on cpu only!, default=False") - args = parser.parse_args() - - # cfg - config_file = args.config_file # change the path of the model config file - checkpoint_path = args.checkpoint_path # change the path of the model - image_path = args.image_path - text_prompt = args.text_prompt - output_dir = args.output_dir - box_threshold = args.box_threshold - text_threshold = args.text_threshold - - # make dir - os.makedirs(output_dir, exist_ok=True) - # load image - image_pil, image = load_image(image_path) - # load model - model = load_model(config_file, checkpoint_path, cpu_only=args.cpu_only) - - # visualize raw image - image_pil.save(os.path.join(output_dir, "raw_image.jpg")) - - # run model - boxes_filt, pred_phrases = get_grounding_output( - model, image, text_prompt, box_threshold, text_threshold, cpu_only=args.cpu_only - ) - - # visualize pred - size = image_pil.size - pred_dict = { - "boxes": boxes_filt, - "size": [size[1], size[0]], # H,W - "labels": pred_phrases, - } - # import ipdb; ipdb.set_trace() - image_with_box = plot_boxes_to_image(image_pil, pred_dict)[0] - image_with_box.save(os.path.join(output_dir, "pred.jpg")) diff --git a/spaces/Iceclear/StableSR/StableSR/clip/clip.py b/spaces/Iceclear/StableSR/StableSR/clip/clip.py deleted file mode 100644 index f7a5da5e69e0a3b41383734711ccfff1923a9ef9..0000000000000000000000000000000000000000 --- a/spaces/Iceclear/StableSR/StableSR/clip/clip.py +++ /dev/null @@ -1,245 +0,0 @@ -import hashlib -import os -import urllib -import warnings -from typing import Any, Union, List -from pkg_resources import packaging - -import torch -from PIL import Image -from torchvision.transforms import Compose, Resize, CenterCrop, ToTensor, Normalize -from tqdm import tqdm - -from .model import build_model -from .simple_tokenizer import SimpleTokenizer as _Tokenizer - -try: - from torchvision.transforms import InterpolationMode - BICUBIC = InterpolationMode.BICUBIC -except ImportError: - BICUBIC = Image.BICUBIC - - -if packaging.version.parse(torch.__version__) < packaging.version.parse("1.7.1"): - warnings.warn("PyTorch version 1.7.1 or higher is recommended") - - -__all__ = ["available_models", "load", "tokenize"] -_tokenizer = _Tokenizer() - -_MODELS = { - "RN50": "https://openaipublic.azureedge.net/clip/models/afeb0e10f9e5a86da6080e35cf09123aca3b358a0c3e3b6c78a7b63bc04b6762/RN50.pt", - "RN101": "https://openaipublic.azureedge.net/clip/models/8fa8567bab74a42d41c5915025a8e4538c3bdbe8804a470a72f30b0d94fab599/RN101.pt", - "RN50x4": "https://openaipublic.azureedge.net/clip/models/7e526bd135e493cef0776de27d5f42653e6b4c8bf9e0f653bb11773263205fdd/RN50x4.pt", - "RN50x16": "https://openaipublic.azureedge.net/clip/models/52378b407f34354e150460fe41077663dd5b39c54cd0bfd2b27167a4a06ec9aa/RN50x16.pt", - "RN50x64": "https://openaipublic.azureedge.net/clip/models/be1cfb55d75a9666199fb2206c106743da0f6468c9d327f3e0d0a543a9919d9c/RN50x64.pt", - "ViT-B/32": "https://openaipublic.azureedge.net/clip/models/40d365715913c9da98579312b702a82c18be219cc2a73407c4526f58eba950af/ViT-B-32.pt", - "ViT-B/16": "https://openaipublic.azureedge.net/clip/models/5806e77cd80f8b59890b7e101eabd078d9fb84e6937f9e85e4ecb61988df416f/ViT-B-16.pt", - "ViT-L/14": "https://openaipublic.azureedge.net/clip/models/b8cca3fd41ae0c99ba7e8951adf17d267cdb84cd88be6f7c2e0eca1737a03836/ViT-L-14.pt", - "ViT-L/14@336px": "https://openaipublic.azureedge.net/clip/models/3035c92b350959924f9f00213499208652fc7ea050643e8b385c2dac08641f02/ViT-L-14-336px.pt", -} - - -def _download(url: str, root: str): - os.makedirs(root, exist_ok=True) - filename = os.path.basename(url) - - expected_sha256 = url.split("/")[-2] - download_target = os.path.join(root, filename) - - if os.path.exists(download_target) and not os.path.isfile(download_target): - raise RuntimeError(f"{download_target} exists and is not a regular file") - - if os.path.isfile(download_target): - if hashlib.sha256(open(download_target, "rb").read()).hexdigest() == expected_sha256: - return download_target - else: - warnings.warn(f"{download_target} exists, but the SHA256 checksum does not match; re-downloading the file") - - with urllib.request.urlopen(url) as source, open(download_target, "wb") as output: - with tqdm(total=int(source.info().get("Content-Length")), ncols=80, unit='iB', unit_scale=True, unit_divisor=1024) as loop: - while True: - buffer = source.read(8192) - if not buffer: - break - - output.write(buffer) - loop.update(len(buffer)) - - if hashlib.sha256(open(download_target, "rb").read()).hexdigest() != expected_sha256: - raise RuntimeError("Model has been downloaded but the SHA256 checksum does not not match") - - return download_target - - -def _convert_image_to_rgb(image): - return image.convert("RGB") - - -def _transform(n_px): - return Compose([ - Resize(n_px, interpolation=BICUBIC), - CenterCrop(n_px), - _convert_image_to_rgb, - ToTensor(), - Normalize((0.48145466, 0.4578275, 0.40821073), (0.26862954, 0.26130258, 0.27577711)), - ]) - - -def available_models() -> List[str]: - """Returns the names of available CLIP models""" - return list(_MODELS.keys()) - - -def load(name: str, device: Union[str, torch.device] = "cuda" if torch.cuda.is_available() else "cpu", jit: bool = False, download_root: str = None): - """Load a CLIP model - - Parameters - ---------- - name : str - A model name listed by `clip.available_models()`, or the path to a model checkpoint containing the state_dict - - device : Union[str, torch.device] - The device to put the loaded model - - jit : bool - Whether to load the optimized JIT model or more hackable non-JIT model (default). - - download_root: str - path to download the model files; by default, it uses "~/.cache/clip" - - Returns - ------- - model : torch.nn.Module - The CLIP model - - preprocess : Callable[[PIL.Image], torch.Tensor] - A torchvision transform that converts a PIL image into a tensor that the returned model can take as its input - """ - if name in _MODELS: - model_path = _download(_MODELS[name], download_root or os.path.expanduser("~/.cache/clip")) - elif os.path.isfile(name): - model_path = name - else: - raise RuntimeError(f"Model {name} not found; available models = {available_models()}") - - with open(model_path, 'rb') as opened_file: - try: - # loading JIT archive - model = torch.jit.load(opened_file, map_location=device if jit else "cpu").eval() - state_dict = None - except RuntimeError: - # loading saved state dict - if jit: - warnings.warn(f"File {model_path} is not a JIT archive. Loading as a state dict instead") - jit = False - state_dict = torch.load(opened_file, map_location="cpu") - - if not jit: - model = build_model(state_dict or model.state_dict()).to(device) - if str(device) == "cpu": - model.float() - return model, _transform(model.visual.input_resolution) - - # patch the device names - device_holder = torch.jit.trace(lambda: torch.ones([]).to(torch.device(device)), example_inputs=[]) - device_node = [n for n in device_holder.graph.findAllNodes("prim::Constant") if "Device" in repr(n)][-1] - - def _node_get(node: torch._C.Node, key: str): - """Gets attributes of a node which is polymorphic over return type. - - From https://github.com/pytorch/pytorch/pull/82628 - """ - sel = node.kindOf(key) - return getattr(node, sel)(key) - - def patch_device(module): - try: - graphs = [module.graph] if hasattr(module, "graph") else [] - except RuntimeError: - graphs = [] - - if hasattr(module, "forward1"): - graphs.append(module.forward1.graph) - - for graph in graphs: - for node in graph.findAllNodes("prim::Constant"): - if "value" in node.attributeNames() and str(_node_get(node, "value")).startswith("cuda"): - node.copyAttributes(device_node) - - model.apply(patch_device) - patch_device(model.encode_image) - patch_device(model.encode_text) - - # patch dtype to float32 on CPU - if str(device) == "cpu": - float_holder = torch.jit.trace(lambda: torch.ones([]).float(), example_inputs=[]) - float_input = list(float_holder.graph.findNode("aten::to").inputs())[1] - float_node = float_input.node() - - def patch_float(module): - try: - graphs = [module.graph] if hasattr(module, "graph") else [] - except RuntimeError: - graphs = [] - - if hasattr(module, "forward1"): - graphs.append(module.forward1.graph) - - for graph in graphs: - for node in graph.findAllNodes("aten::to"): - inputs = list(node.inputs()) - for i in [1, 2]: # dtype can be the second or third argument to aten::to() - if _node_get(inputs[i].node(), "value") == 5: - inputs[i].node().copyAttributes(float_node) - - model.apply(patch_float) - patch_float(model.encode_image) - patch_float(model.encode_text) - - model.float() - - return model, _transform(model.input_resolution.item()) - - -def tokenize(texts: Union[str, List[str]], context_length: int = 77, truncate: bool = False) -> Union[torch.IntTensor, torch.LongTensor]: - """ - Returns the tokenized representation of given input string(s) - - Parameters - ---------- - texts : Union[str, List[str]] - An input string or a list of input strings to tokenize - - context_length : int - The context length to use; all CLIP models use 77 as the context length - - truncate: bool - Whether to truncate the text in case its encoding is longer than the context length - - Returns - ------- - A two-dimensional tensor containing the resulting tokens, shape = [number of input strings, context_length]. - We return LongTensor when torch version is <1.8.0, since older index_select requires indices to be long. - """ - if isinstance(texts, str): - texts = [texts] - - sot_token = _tokenizer.encoder["<|startoftext|>"] - eot_token = _tokenizer.encoder["<|endoftext|>"] - all_tokens = [[sot_token] + _tokenizer.encode(text) + [eot_token] for text in texts] - if packaging.version.parse(torch.__version__) < packaging.version.parse("1.8.0"): - result = torch.zeros(len(all_tokens), context_length, dtype=torch.long) - else: - result = torch.zeros(len(all_tokens), context_length, dtype=torch.int) - - for i, tokens in enumerate(all_tokens): - if len(tokens) > context_length: - if truncate: - tokens = tokens[:context_length] - tokens[-1] = eot_token - else: - raise RuntimeError(f"Input {texts[i]} is too long for context length {context_length}") - result[i, :len(tokens)] = torch.tensor(tokens) - - return result diff --git a/spaces/IlyasMoutawwakil/llm-bar-race/model_types.py b/spaces/IlyasMoutawwakil/llm-bar-race/model_types.py deleted file mode 100644 index eeaa761df67849361c20d2cd29c90e29a1b9268b..0000000000000000000000000000000000000000 --- a/spaces/IlyasMoutawwakil/llm-bar-race/model_types.py +++ /dev/null @@ -1,31 +0,0 @@ -import re -import requests -from enum import Enum -from dataclasses import dataclass - - -@dataclass -class ModelInfo: - name: str - symbol: str # emoji - - -class ModelType(Enum): - PT = ModelInfo(name="pretrained", symbol="🟢") - FT = ModelInfo(name="fine-tuned", symbol="🔶") - IFT = ModelInfo(name="instruction-tuned", symbol="⭕") - RL = ModelInfo(name="RL-tuned", symbol="🟦") - Unknown = ModelInfo(name="Unknown, add type to request file!", symbol="❓") - - def to_str(self, separator=" "): - return f"{self.value.symbol}{separator}{self.value.name}" - - -text = requests.get( - "https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard/raw/main/src/display_models/model_metadata_type.py" -).text - -dicts = re.findall(r"\{.*?\}", text, re.DOTALL) - -MODEL_TYPES = eval(max(dicts, key=len)) -MODEL_TYPES diff --git a/spaces/Ivanrs/image-matching-sift-orb/README.md b/spaces/Ivanrs/image-matching-sift-orb/README.md deleted file mode 100644 index e1df9e37c48452d050af25f2f895de19c1b24349..0000000000000000000000000000000000000000 --- a/spaces/Ivanrs/image-matching-sift-orb/README.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: Image Matching Sift Orb -emoji: 🐠 -colorFrom: green -colorTo: purple -sdk: gradio -sdk_version: 3.6 -app_file: app.py -pinned: false -license: mit ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/JSP/test4k/README.md b/spaces/JSP/test4k/README.md deleted file mode 100644 index 15fd6bf7861ab4a016366c18f034cf02f0416666..0000000000000000000000000000000000000000 --- a/spaces/JSP/test4k/README.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -title: Mistral-7B-OpenOrca-GGUF (Q4_K_M) -colorFrom: purple -colorTo: blue -sdk: docker -models: - - Open-Orca/Mistral-7B-OpenOrca - - TheBloke/Mistral-7B-OpenOrca-GGUF -tags: - - inference api - - openai-api compatible - - llama-cpp-python - - Mistral-7B-OpenOrca-GGUF - - gguf -pinned: false ---- - -# Mistral-7B-OpenOrca-GGUF (Q4_K_M) - -Please refer to the [index.html](index.html) for more information. diff --git a/spaces/Jeff2323/ai-comic-factory/src/lib/generateSeed.ts b/spaces/Jeff2323/ai-comic-factory/src/lib/generateSeed.ts deleted file mode 100644 index 563e25ec894ab5af54c5025a15a9b7a5918325de..0000000000000000000000000000000000000000 --- a/spaces/Jeff2323/ai-comic-factory/src/lib/generateSeed.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function generateSeed() { - return Math.floor(Math.random() * Math.pow(2, 31)); -} \ No newline at end of file diff --git a/spaces/Jose-Alonso26/API-Online/Dockerfile b/spaces/Jose-Alonso26/API-Online/Dockerfile deleted file mode 100644 index cb944748b71237e709ea24c97ded4a842b1132a9..0000000000000000000000000000000000000000 --- a/spaces/Jose-Alonso26/API-Online/Dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -# read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker -# you will also find guides on how best to write your Dockerfile - -FROM python:3.9 - -WORKDIR /code - -COPY ./requirements.txt /code/requirements.txt - -RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt - -COPY . . - -CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] \ No newline at end of file diff --git a/spaces/JustinLin610/ImageBind_zeroshot_demo/CODE_OF_CONDUCT.md b/spaces/JustinLin610/ImageBind_zeroshot_demo/CODE_OF_CONDUCT.md deleted file mode 100644 index f913b6a55a6c5ab6e1224e11fc039c3d4c3b6283..0000000000000000000000000000000000000000 --- a/spaces/JustinLin610/ImageBind_zeroshot_demo/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,80 +0,0 @@ -# Code of Conduct - -## Our Pledge - -In the interest of fostering an open and welcoming environment, we as -contributors and maintainers pledge to make participation in our project and -our community a harassment-free experience for everyone, regardless of age, body -size, disability, ethnicity, sex characteristics, gender identity and expression, -level of experience, education, socio-economic status, nationality, personal -appearance, race, religion, or sexual identity and orientation. - -## Our Standards - -Examples of behavior that contributes to creating a positive environment -include: - -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members - -Examples of unacceptable behavior by participants include: - -* The use of sexualized language or imagery and unwelcome sexual attention or -advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic -address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a -professional setting - -## Our Responsibilities - -Project maintainers are responsible for clarifying the standards of acceptable -behavior and are expected to take appropriate and fair corrective action in -response to any instances of unacceptable behavior. - -Project maintainers have the right and responsibility to remove, edit, or -reject comments, commits, code, wiki edits, issues, and other contributions -that are not aligned to this Code of Conduct, or to ban temporarily or -permanently any contributor for other behaviors that they deem inappropriate, -threatening, offensive, or harmful. - -## Scope - -This Code of Conduct applies within all project spaces, and it also applies when -an individual is representing the project or its community in public spaces. -Examples of representing a project or community include using an official -project e-mail address, posting via an official social media account, or acting -as an appointed representative at an online or offline event. Representation of -a project may be further defined and clarified by project maintainers. - -This Code of Conduct also applies outside the project spaces when there is a -reasonable belief that an individual's behavior may have a negative impact on -the project or its community. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the project team at <opensource-conduct@fb.com>. All -complaints will be reviewed and investigated and will result in a response that -is deemed necessary and appropriate to the circumstances. The project team is -obligated to maintain confidentiality with regard to the reporter of an incident. -Further details of specific enforcement policies may be posted separately. - -Project maintainers who do not follow or enforce the Code of Conduct in good -faith may face temporary or permanent repercussions as determined by other -members of the project's leadership. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, -available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html - -[homepage]: https://www.contributor-covenant.org - -For answers to common questions about this code of conduct, see -https://www.contributor-covenant.org/faq \ No newline at end of file diff --git a/spaces/Kangarroar/ApplioRVC-Inference/demucs/augment.py b/spaces/Kangarroar/ApplioRVC-Inference/demucs/augment.py deleted file mode 100644 index bb36d3298d89470f306316322e7587187819c94b..0000000000000000000000000000000000000000 --- a/spaces/Kangarroar/ApplioRVC-Inference/demucs/augment.py +++ /dev/null @@ -1,106 +0,0 @@ -# Copyright (c) Facebook, Inc. and its affiliates. -# All rights reserved. -# -# This source code is licensed under the license found in the -# LICENSE file in the root directory of this source tree. - -import random -import torch as th -from torch import nn - - -class Shift(nn.Module): - """ - Randomly shift audio in time by up to `shift` samples. - """ - def __init__(self, shift=8192): - super().__init__() - self.shift = shift - - def forward(self, wav): - batch, sources, channels, time = wav.size() - length = time - self.shift - if self.shift > 0: - if not self.training: - wav = wav[..., :length] - else: - offsets = th.randint(self.shift, [batch, sources, 1, 1], device=wav.device) - offsets = offsets.expand(-1, -1, channels, -1) - indexes = th.arange(length, device=wav.device) - wav = wav.gather(3, indexes + offsets) - return wav - - -class FlipChannels(nn.Module): - """ - Flip left-right channels. - """ - def forward(self, wav): - batch, sources, channels, time = wav.size() - if self.training and wav.size(2) == 2: - left = th.randint(2, (batch, sources, 1, 1), device=wav.device) - left = left.expand(-1, -1, -1, time) - right = 1 - left - wav = th.cat([wav.gather(2, left), wav.gather(2, right)], dim=2) - return wav - - -class FlipSign(nn.Module): - """ - Random sign flip. - """ - def forward(self, wav): - batch, sources, channels, time = wav.size() - if self.training: - signs = th.randint(2, (batch, sources, 1, 1), device=wav.device, dtype=th.float32) - wav = wav * (2 * signs - 1) - return wav - - -class Remix(nn.Module): - """ - Shuffle sources to make new mixes. - """ - def __init__(self, group_size=4): - """ - Shuffle sources within one batch. - Each batch is divided into groups of size `group_size` and shuffling is done within - each group separatly. This allow to keep the same probability distribution no matter - the number of GPUs. Without this grouping, using more GPUs would lead to a higher - probability of keeping two sources from the same track together which can impact - performance. - """ - super().__init__() - self.group_size = group_size - - def forward(self, wav): - batch, streams, channels, time = wav.size() - device = wav.device - - if self.training: - group_size = self.group_size or batch - if batch % group_size != 0: - raise ValueError(f"Batch size {batch} must be divisible by group size {group_size}") - groups = batch // group_size - wav = wav.view(groups, group_size, streams, channels, time) - permutations = th.argsort(th.rand(groups, group_size, streams, 1, 1, device=device), - dim=1) - wav = wav.gather(1, permutations.expand(-1, -1, -1, channels, time)) - wav = wav.view(batch, streams, channels, time) - return wav - - -class Scale(nn.Module): - def __init__(self, proba=1., min=0.25, max=1.25): - super().__init__() - self.proba = proba - self.min = min - self.max = max - - def forward(self, wav): - batch, streams, channels, time = wav.size() - device = wav.device - if self.training and random.random() < self.proba: - scales = th.empty(batch, streams, 1, 1, device=device).uniform_(self.min, self.max) - wav *= scales - return wav diff --git a/spaces/Kayson/InstructDiffusion/stable_diffusion/ldm/models/diffusion/ddpm.py b/spaces/Kayson/InstructDiffusion/stable_diffusion/ldm/models/diffusion/ddpm.py deleted file mode 100644 index bbedd04cfd6f736ac066434a75618b9ba5125be7..0000000000000000000000000000000000000000 --- a/spaces/Kayson/InstructDiffusion/stable_diffusion/ldm/models/diffusion/ddpm.py +++ /dev/null @@ -1,1445 +0,0 @@ -""" -wild mixture of -https://github.com/lucidrains/denoising-diffusion-pytorch/blob/7706bdfc6f527f58d33f84b7b522e61e6e3164b3/denoising_diffusion_pytorch/denoising_diffusion_pytorch.py -https://github.com/openai/improved-diffusion/blob/e94489283bb876ac1477d5dd7709bbbd2d9902ce/improved_diffusion/gaussian_diffusion.py -https://github.com/CompVis/taming-transformers --- merci -""" - -import torch -import torch.nn as nn -import numpy as np -import pytorch_lightning as pl -from torch.optim.lr_scheduler import LambdaLR -from einops import rearrange, repeat -from contextlib import contextmanager -from functools import partial -from tqdm import tqdm -from torchvision.utils import make_grid -from pytorch_lightning.utilities.distributed import rank_zero_only - -from ldm.util import log_txt_as_img, exists, default, ismap, isimage, mean_flat, count_params, instantiate_from_config -from ldm.modules.ema import LitEma -from ldm.modules.distributions.distributions import normal_kl, DiagonalGaussianDistribution -from ldm.models.autoencoder import VQModelInterface, IdentityFirstStage, AutoencoderKL -from ldm.modules.diffusionmodules.util import make_beta_schedule, extract_into_tensor, noise_like -from ldm.models.diffusion.ddim import DDIMSampler - - -__conditioning_keys__ = {'concat': 'c_concat', - 'crossattn': 'c_crossattn', - 'adm': 'y'} - - -def disabled_train(self, mode=True): - """Overwrite model.train with this function to make sure train/eval mode - does not change anymore.""" - return self - - -def uniform_on_device(r1, r2, shape, device): - return (r1 - r2) * torch.rand(*shape, device=device) + r2 - - -class DDPM(pl.LightningModule): - # classic DDPM with Gaussian diffusion, in image space - def __init__(self, - unet_config, - timesteps=1000, - beta_schedule="linear", - loss_type="l2", - ckpt_path=None, - ignore_keys=[], - load_only_unet=False, - monitor="val/loss", - use_ema=True, - first_stage_key="image", - image_size=256, - channels=3, - log_every_t=100, - clip_denoised=True, - linear_start=1e-4, - linear_end=2e-2, - cosine_s=8e-3, - given_betas=None, - original_elbo_weight=0., - v_posterior=0., # weight for choosing posterior variance as sigma = (1-v) * beta_tilde + v * beta - l_simple_weight=1., - conditioning_key=None, - parameterization="eps", # all assuming fixed variance schedules - scheduler_config=None, - use_positional_encodings=False, - learn_logvar=False, - logvar_init=0., - ): - super().__init__() - assert parameterization in ["eps", "x0"], 'currently only supporting "eps" and "x0"' - self.parameterization = parameterization - print(f"{self.__class__.__name__}: Running in {self.parameterization}-prediction mode") - self.cond_stage_model = None - self.clip_denoised = clip_denoised - self.log_every_t = log_every_t - self.first_stage_key = first_stage_key - self.image_size = image_size # try conv? - self.channels = channels - self.use_positional_encodings = use_positional_encodings - self.model = DiffusionWrapper(unet_config, conditioning_key) - count_params(self.model, verbose=True) - self.use_ema = use_ema - if self.use_ema: - self.model_ema = LitEma(self.model) - print(f"Keeping EMAs of {len(list(self.model_ema.buffers()))}.") - - self.use_scheduler = scheduler_config is not None - if self.use_scheduler: - self.scheduler_config = scheduler_config - - self.v_posterior = v_posterior - self.original_elbo_weight = original_elbo_weight - self.l_simple_weight = l_simple_weight - - if monitor is not None: - self.monitor = monitor - if ckpt_path is not None: - self.init_from_ckpt(ckpt_path, ignore_keys=ignore_keys, only_model=load_only_unet) - - self.register_schedule(given_betas=given_betas, beta_schedule=beta_schedule, timesteps=timesteps, - linear_start=linear_start, linear_end=linear_end, cosine_s=cosine_s) - - self.loss_type = loss_type - - self.learn_logvar = learn_logvar - self.logvar = torch.full(fill_value=logvar_init, size=(self.num_timesteps,)) - if self.learn_logvar: - self.logvar = nn.Parameter(self.logvar, requires_grad=True) - - - def register_schedule(self, given_betas=None, beta_schedule="linear", timesteps=1000, - linear_start=1e-4, linear_end=2e-2, cosine_s=8e-3): - if exists(given_betas): - betas = given_betas - else: - betas = make_beta_schedule(beta_schedule, timesteps, linear_start=linear_start, linear_end=linear_end, - cosine_s=cosine_s) - alphas = 1. - betas - alphas_cumprod = np.cumprod(alphas, axis=0) - alphas_cumprod_prev = np.append(1., alphas_cumprod[:-1]) - - timesteps, = betas.shape - self.num_timesteps = int(timesteps) - self.linear_start = linear_start - self.linear_end = linear_end - assert alphas_cumprod.shape[0] == self.num_timesteps, 'alphas have to be defined for each timestep' - - to_torch = partial(torch.tensor, dtype=torch.float32) - - self.register_buffer('betas', to_torch(betas)) - self.register_buffer('alphas_cumprod', to_torch(alphas_cumprod)) - self.register_buffer('alphas_cumprod_prev', to_torch(alphas_cumprod_prev)) - - # calculations for diffusion q(x_t | x_{t-1}) and others - self.register_buffer('sqrt_alphas_cumprod', to_torch(np.sqrt(alphas_cumprod))) - self.register_buffer('sqrt_one_minus_alphas_cumprod', to_torch(np.sqrt(1. - alphas_cumprod))) - self.register_buffer('log_one_minus_alphas_cumprod', to_torch(np.log(1. - alphas_cumprod))) - self.register_buffer('sqrt_recip_alphas_cumprod', to_torch(np.sqrt(1. / alphas_cumprod))) - self.register_buffer('sqrt_recipm1_alphas_cumprod', to_torch(np.sqrt(1. / alphas_cumprod - 1))) - - # calculations for posterior q(x_{t-1} | x_t, x_0) - posterior_variance = (1 - self.v_posterior) * betas * (1. - alphas_cumprod_prev) / ( - 1. - alphas_cumprod) + self.v_posterior * betas - # above: equal to 1. / (1. / (1. - alpha_cumprod_tm1) + alpha_t / beta_t) - self.register_buffer('posterior_variance', to_torch(posterior_variance)) - # below: log calculation clipped because the posterior variance is 0 at the beginning of the diffusion chain - self.register_buffer('posterior_log_variance_clipped', to_torch(np.log(np.maximum(posterior_variance, 1e-20)))) - self.register_buffer('posterior_mean_coef1', to_torch( - betas * np.sqrt(alphas_cumprod_prev) / (1. - alphas_cumprod))) - self.register_buffer('posterior_mean_coef2', to_torch( - (1. - alphas_cumprod_prev) * np.sqrt(alphas) / (1. - alphas_cumprod))) - - if self.parameterization == "eps": - lvlb_weights = self.betas ** 2 / ( - 2 * self.posterior_variance * to_torch(alphas) * (1 - self.alphas_cumprod)) - elif self.parameterization == "x0": - lvlb_weights = 0.5 * np.sqrt(torch.Tensor(alphas_cumprod)) / (2. * 1 - torch.Tensor(alphas_cumprod)) - else: - raise NotImplementedError("mu not supported") - # TODO how to choose this term - lvlb_weights[0] = lvlb_weights[1] - self.register_buffer('lvlb_weights', lvlb_weights, persistent=False) - assert not torch.isnan(self.lvlb_weights).all() - - @contextmanager - def ema_scope(self, context=None): - if self.use_ema: - self.model_ema.store(self.model.parameters()) - self.model_ema.copy_to(self.model) - if context is not None: - print(f"{context}: Switched to EMA weights") - try: - yield None - finally: - if self.use_ema: - self.model_ema.restore(self.model.parameters()) - if context is not None: - print(f"{context}: Restored training weights") - - def init_from_ckpt(self, path, ignore_keys=list(), only_model=False): - sd = torch.load(path, map_location="cpu") - if "state_dict" in list(sd.keys()): - sd = sd["state_dict"] - keys = list(sd.keys()) - for k in keys: - for ik in ignore_keys: - if k.startswith(ik): - print("Deleting key {} from state_dict.".format(k)) - del sd[k] - missing, unexpected = self.load_state_dict(sd, strict=False) if not only_model else self.model.load_state_dict( - sd, strict=False) - print(f"Restored from {path} with {len(missing)} missing and {len(unexpected)} unexpected keys") - if len(missing) > 0: - print(f"Missing Keys: {missing}") - if len(unexpected) > 0: - print(f"Unexpected Keys: {unexpected}") - - def q_mean_variance(self, x_start, t): - """ - Get the distribution q(x_t | x_0). - :param x_start: the [N x C x ...] tensor of noiseless inputs. - :param t: the number of diffusion steps (minus 1). Here, 0 means one step. - :return: A tuple (mean, variance, log_variance), all of x_start's shape. - """ - mean = (extract_into_tensor(self.sqrt_alphas_cumprod, t, x_start.shape) * x_start) - variance = extract_into_tensor(1.0 - self.alphas_cumprod, t, x_start.shape) - log_variance = extract_into_tensor(self.log_one_minus_alphas_cumprod, t, x_start.shape) - return mean, variance, log_variance - - def predict_start_from_noise(self, x_t, t, noise): - return ( - extract_into_tensor(self.sqrt_recip_alphas_cumprod, t, x_t.shape) * x_t - - extract_into_tensor(self.sqrt_recipm1_alphas_cumprod, t, x_t.shape) * noise - ) - - def q_posterior(self, x_start, x_t, t): - posterior_mean = ( - extract_into_tensor(self.posterior_mean_coef1, t, x_t.shape) * x_start + - extract_into_tensor(self.posterior_mean_coef2, t, x_t.shape) * x_t - ) - posterior_variance = extract_into_tensor(self.posterior_variance, t, x_t.shape) - posterior_log_variance_clipped = extract_into_tensor(self.posterior_log_variance_clipped, t, x_t.shape) - return posterior_mean, posterior_variance, posterior_log_variance_clipped - - def p_mean_variance(self, x, t, clip_denoised: bool): - model_out = self.model(x, t) - if self.parameterization == "eps": - x_recon = self.predict_start_from_noise(x, t=t, noise=model_out) - elif self.parameterization == "x0": - x_recon = model_out - if clip_denoised: - x_recon.clamp_(-1., 1.) - - model_mean, posterior_variance, posterior_log_variance = self.q_posterior(x_start=x_recon, x_t=x, t=t) - return model_mean, posterior_variance, posterior_log_variance - - @torch.no_grad() - def p_sample(self, x, t, clip_denoised=True, repeat_noise=False): - b, *_, device = *x.shape, x.device - model_mean, _, model_log_variance = self.p_mean_variance(x=x, t=t, clip_denoised=clip_denoised) - noise = noise_like(x.shape, device, repeat_noise) - # no noise when t == 0 - nonzero_mask = (1 - (t == 0).float()).reshape(b, *((1,) * (len(x.shape) - 1))) - return model_mean + nonzero_mask * (0.5 * model_log_variance).exp() * noise - - @torch.no_grad() - def p_sample_loop(self, shape, return_intermediates=False): - device = self.betas.device - b = shape[0] - img = torch.randn(shape, device=device) - intermediates = [img] - for i in tqdm(reversed(range(0, self.num_timesteps)), desc='Sampling t', total=self.num_timesteps): - img = self.p_sample(img, torch.full((b,), i, device=device, dtype=torch.long), - clip_denoised=self.clip_denoised) - if i % self.log_every_t == 0 or i == self.num_timesteps - 1: - intermediates.append(img) - if return_intermediates: - return img, intermediates - return img - - @torch.no_grad() - def sample(self, batch_size=16, return_intermediates=False): - image_size = self.image_size - channels = self.channels - return self.p_sample_loop((batch_size, channels, image_size, image_size), - return_intermediates=return_intermediates) - - def q_sample(self, x_start, t, noise=None): - noise = default(noise, lambda: torch.randn_like(x_start)) - return (extract_into_tensor(self.sqrt_alphas_cumprod, t, x_start.shape) * x_start + - extract_into_tensor(self.sqrt_one_minus_alphas_cumprod, t, x_start.shape) * noise) - - def get_loss(self, pred, target, mean=True): - if self.loss_type == 'l1': - loss = (target - pred).abs() - if mean: - loss = loss.mean() - elif self.loss_type == 'l2': - if mean: - loss = torch.nn.functional.mse_loss(target, pred) - else: - loss = torch.nn.functional.mse_loss(target, pred, reduction='none') - else: - raise NotImplementedError("unknown loss type '{loss_type}'") - - return loss - - def p_losses(self, x_start, t, noise=None): - noise = default(noise, lambda: torch.randn_like(x_start)) - x_noisy = self.q_sample(x_start=x_start, t=t, noise=noise) - model_out = self.model(x_noisy, t) - - loss_dict = {} - if self.parameterization == "eps": - target = noise - elif self.parameterization == "x0": - target = x_start - else: - raise NotImplementedError(f"Paramterization {self.parameterization} not yet supported") - - loss = self.get_loss(model_out, target, mean=False).mean(dim=[1, 2, 3]) - - log_prefix = 'train' if self.training else 'val' - - loss_dict.update({f'{log_prefix}/loss_simple': loss.mean()}) - loss_simple = loss.mean() * self.l_simple_weight - - loss_vlb = (self.lvlb_weights[t] * loss).mean() - loss_dict.update({f'{log_prefix}/loss_vlb': loss_vlb}) - - loss = loss_simple + self.original_elbo_weight * loss_vlb - - loss_dict.update({f'{log_prefix}/loss': loss}) - - return loss, loss_dict - - def forward(self, x, *args, **kwargs): - # b, c, h, w, device, img_size, = *x.shape, x.device, self.image_size - # assert h == img_size and w == img_size, f'height and width of image must be {img_size}' - t = torch.randint(0, self.num_timesteps, (x.shape[0],), device=self.device).long() - return self.p_losses(x, t, *args, **kwargs) - - def get_input(self, batch, k): - x = batch[k] - if len(x.shape) == 3: - x = x[..., None] - x = rearrange(x, 'b h w c -> b c h w') - x = x.to(memory_format=torch.contiguous_format).float() - return x - - def shared_step(self, batch): - x = self.get_input(batch, self.first_stage_key) - loss, loss_dict = self(x) - return loss, loss_dict - - def training_step(self, batch, batch_idx): - loss, loss_dict = self.shared_step(batch) - - self.log_dict(loss_dict, prog_bar=True, - logger=True, on_step=True, on_epoch=True) - - self.log("global_step", self.global_step, - prog_bar=True, logger=True, on_step=True, on_epoch=False) - - if self.use_scheduler: - lr = self.optimizers().param_groups[0]['lr'] - self.log('lr_abs', lr, prog_bar=True, logger=True, on_step=True, on_epoch=False) - - return loss - - @torch.no_grad() - def validation_step(self, batch, batch_idx): - _, loss_dict_no_ema = self.shared_step(batch) - with self.ema_scope(): - _, loss_dict_ema = self.shared_step(batch) - loss_dict_ema = {key + '_ema': loss_dict_ema[key] for key in loss_dict_ema} - self.log_dict(loss_dict_no_ema, prog_bar=False, logger=True, on_step=False, on_epoch=True) - self.log_dict(loss_dict_ema, prog_bar=False, logger=True, on_step=False, on_epoch=True) - - def on_train_batch_end(self, *args, **kwargs): - if self.use_ema: - self.model_ema(self.model) - - def _get_rows_from_list(self, samples): - n_imgs_per_row = len(samples) - denoise_grid = rearrange(samples, 'n b c h w -> b n c h w') - denoise_grid = rearrange(denoise_grid, 'b n c h w -> (b n) c h w') - denoise_grid = make_grid(denoise_grid, nrow=n_imgs_per_row) - return denoise_grid - - @torch.no_grad() - def log_images(self, batch, N=8, n_row=2, sample=True, return_keys=None, **kwargs): - log = dict() - x = self.get_input(batch, self.first_stage_key) - N = min(x.shape[0], N) - n_row = min(x.shape[0], n_row) - x = x.to(self.device)[:N] - log["inputs"] = x - - # get diffusion row - diffusion_row = list() - x_start = x[:n_row] - - for t in range(self.num_timesteps): - if t % self.log_every_t == 0 or t == self.num_timesteps - 1: - t = repeat(torch.tensor([t]), '1 -> b', b=n_row) - t = t.to(self.device).long() - noise = torch.randn_like(x_start) - x_noisy = self.q_sample(x_start=x_start, t=t, noise=noise) - diffusion_row.append(x_noisy) - - log["diffusion_row"] = self._get_rows_from_list(diffusion_row) - - if sample: - # get denoise row - with self.ema_scope("Plotting"): - samples, denoise_row = self.sample(batch_size=N, return_intermediates=True) - - log["samples"] = samples - log["denoise_row"] = self._get_rows_from_list(denoise_row) - - if return_keys: - if np.intersect1d(list(log.keys()), return_keys).shape[0] == 0: - return log - else: - return {key: log[key] for key in return_keys} - return log - - def configure_optimizers(self): - lr = self.learning_rate - params = list(self.model.parameters()) - if self.learn_logvar: - params = params + [self.logvar] - opt = torch.optim.AdamW(params, lr=lr) - return opt - - -class LatentDiffusion(DDPM): - """main class""" - def __init__(self, - first_stage_config, - cond_stage_config, - num_timesteps_cond=None, - cond_stage_key="image", - cond_stage_trainable=False, - concat_mode=True, - cond_stage_forward=None, - conditioning_key=None, - scale_factor=1.0, - scale_by_std=False, - *args, **kwargs): - self.num_timesteps_cond = default(num_timesteps_cond, 1) - self.scale_by_std = scale_by_std - assert self.num_timesteps_cond <= kwargs['timesteps'] - # for backwards compatibility after implementation of DiffusionWrapper - if conditioning_key is None: - conditioning_key = 'concat' if concat_mode else 'crossattn' - if cond_stage_config == '__is_unconditional__': - conditioning_key = None - ckpt_path = kwargs.pop("ckpt_path", None) - ignore_keys = kwargs.pop("ignore_keys", []) - super().__init__(conditioning_key=conditioning_key, *args, **kwargs) - self.concat_mode = concat_mode - self.cond_stage_trainable = cond_stage_trainable - self.cond_stage_key = cond_stage_key - try: - self.num_downs = len(first_stage_config.params.ddconfig.ch_mult) - 1 - except: - self.num_downs = 0 - if not scale_by_std: - self.scale_factor = scale_factor - else: - self.register_buffer('scale_factor', torch.tensor(scale_factor)) - self.instantiate_first_stage(first_stage_config) - self.instantiate_cond_stage(cond_stage_config) - self.cond_stage_forward = cond_stage_forward - self.clip_denoised = False - self.bbox_tokenizer = None - - self.restarted_from_ckpt = False - if ckpt_path is not None: - self.init_from_ckpt(ckpt_path, ignore_keys) - self.restarted_from_ckpt = True - - def make_cond_schedule(self, ): - self.cond_ids = torch.full(size=(self.num_timesteps,), fill_value=self.num_timesteps - 1, dtype=torch.long) - ids = torch.round(torch.linspace(0, self.num_timesteps - 1, self.num_timesteps_cond)).long() - self.cond_ids[:self.num_timesteps_cond] = ids - - @rank_zero_only - @torch.no_grad() - def on_train_batch_start(self, batch, batch_idx, dataloader_idx): - # only for very first batch - if self.scale_by_std and self.current_epoch == 0 and self.global_step == 0 and batch_idx == 0 and not self.restarted_from_ckpt: - assert self.scale_factor == 1., 'rather not use custom rescaling and std-rescaling simultaneously' - # set rescale weight to 1./std of encodings - print("### USING STD-RESCALING ###") - x = super().get_input(batch, self.first_stage_key) - x = x.to(self.device) - encoder_posterior = self.encode_first_stage(x) - z = self.get_first_stage_encoding(encoder_posterior).detach() - del self.scale_factor - self.register_buffer('scale_factor', 1. / z.flatten().std()) - print(f"setting self.scale_factor to {self.scale_factor}") - print("### USING STD-RESCALING ###") - - def register_schedule(self, - given_betas=None, beta_schedule="linear", timesteps=1000, - linear_start=1e-4, linear_end=2e-2, cosine_s=8e-3): - super().register_schedule(given_betas, beta_schedule, timesteps, linear_start, linear_end, cosine_s) - - self.shorten_cond_schedule = self.num_timesteps_cond > 1 - if self.shorten_cond_schedule: - self.make_cond_schedule() - - def instantiate_first_stage(self, config): - model = instantiate_from_config(config) - self.first_stage_model = model.eval() - self.first_stage_model.train = disabled_train - for param in self.first_stage_model.parameters(): - param.requires_grad = False - - def instantiate_cond_stage(self, config): - if not self.cond_stage_trainable: - if config == "__is_first_stage__": - print("Using first stage also as cond stage.") - self.cond_stage_model = self.first_stage_model - elif config == "__is_unconditional__": - print(f"Training {self.__class__.__name__} as an unconditional model.") - self.cond_stage_model = None - # self.be_unconditional = True - else: - model = instantiate_from_config(config) - self.cond_stage_model = model.eval() - self.cond_stage_model.train = disabled_train - for param in self.cond_stage_model.parameters(): - param.requires_grad = False - else: - assert config != '__is_first_stage__' - assert config != '__is_unconditional__' - model = instantiate_from_config(config) - self.cond_stage_model = model - - def _get_denoise_row_from_list(self, samples, desc='', force_no_decoder_quantization=False): - denoise_row = [] - for zd in tqdm(samples, desc=desc): - denoise_row.append(self.decode_first_stage(zd.to(self.device), - force_not_quantize=force_no_decoder_quantization)) - n_imgs_per_row = len(denoise_row) - denoise_row = torch.stack(denoise_row) # n_log_step, n_row, C, H, W - denoise_grid = rearrange(denoise_row, 'n b c h w -> b n c h w') - denoise_grid = rearrange(denoise_grid, 'b n c h w -> (b n) c h w') - denoise_grid = make_grid(denoise_grid, nrow=n_imgs_per_row) - return denoise_grid - - def get_first_stage_encoding(self, encoder_posterior): - if isinstance(encoder_posterior, DiagonalGaussianDistribution): - z = encoder_posterior.sample() - elif isinstance(encoder_posterior, torch.Tensor): - z = encoder_posterior - else: - raise NotImplementedError(f"encoder_posterior of type '{type(encoder_posterior)}' not yet implemented") - return self.scale_factor * z - - def get_learned_conditioning(self, c): - if self.cond_stage_forward is None: - if hasattr(self.cond_stage_model, 'encode') and callable(self.cond_stage_model.encode): - c = self.cond_stage_model.encode(c) - if isinstance(c, DiagonalGaussianDistribution): - c = c.mode() - else: - c = self.cond_stage_model(c) - else: - assert hasattr(self.cond_stage_model, self.cond_stage_forward) - c = getattr(self.cond_stage_model, self.cond_stage_forward)(c) - return c - - def meshgrid(self, h, w): - y = torch.arange(0, h).view(h, 1, 1).repeat(1, w, 1) - x = torch.arange(0, w).view(1, w, 1).repeat(h, 1, 1) - - arr = torch.cat([y, x], dim=-1) - return arr - - def delta_border(self, h, w): - """ - :param h: height - :param w: width - :return: normalized distance to image border, - wtith min distance = 0 at border and max dist = 0.5 at image center - """ - lower_right_corner = torch.tensor([h - 1, w - 1]).view(1, 1, 2) - arr = self.meshgrid(h, w) / lower_right_corner - dist_left_up = torch.min(arr, dim=-1, keepdims=True)[0] - dist_right_down = torch.min(1 - arr, dim=-1, keepdims=True)[0] - edge_dist = torch.min(torch.cat([dist_left_up, dist_right_down], dim=-1), dim=-1)[0] - return edge_dist - - def get_weighting(self, h, w, Ly, Lx, device): - weighting = self.delta_border(h, w) - weighting = torch.clip(weighting, self.split_input_params["clip_min_weight"], - self.split_input_params["clip_max_weight"], ) - weighting = weighting.view(1, h * w, 1).repeat(1, 1, Ly * Lx).to(device) - - if self.split_input_params["tie_braker"]: - L_weighting = self.delta_border(Ly, Lx) - L_weighting = torch.clip(L_weighting, - self.split_input_params["clip_min_tie_weight"], - self.split_input_params["clip_max_tie_weight"]) - - L_weighting = L_weighting.view(1, 1, Ly * Lx).to(device) - weighting = weighting * L_weighting - return weighting - - def get_fold_unfold(self, x, kernel_size, stride, uf=1, df=1): # todo load once not every time, shorten code - """ - :param x: img of size (bs, c, h, w) - :return: n img crops of size (n, bs, c, kernel_size[0], kernel_size[1]) - """ - bs, nc, h, w = x.shape - - # number of crops in image - Ly = (h - kernel_size[0]) // stride[0] + 1 - Lx = (w - kernel_size[1]) // stride[1] + 1 - - if uf == 1 and df == 1: - fold_params = dict(kernel_size=kernel_size, dilation=1, padding=0, stride=stride) - unfold = torch.nn.Unfold(**fold_params) - - fold = torch.nn.Fold(output_size=x.shape[2:], **fold_params) - - weighting = self.get_weighting(kernel_size[0], kernel_size[1], Ly, Lx, x.device).to(x.dtype) - normalization = fold(weighting).view(1, 1, h, w) # normalizes the overlap - weighting = weighting.view((1, 1, kernel_size[0], kernel_size[1], Ly * Lx)) - - elif uf > 1 and df == 1: - fold_params = dict(kernel_size=kernel_size, dilation=1, padding=0, stride=stride) - unfold = torch.nn.Unfold(**fold_params) - - fold_params2 = dict(kernel_size=(kernel_size[0] * uf, kernel_size[0] * uf), - dilation=1, padding=0, - stride=(stride[0] * uf, stride[1] * uf)) - fold = torch.nn.Fold(output_size=(x.shape[2] * uf, x.shape[3] * uf), **fold_params2) - - weighting = self.get_weighting(kernel_size[0] * uf, kernel_size[1] * uf, Ly, Lx, x.device).to(x.dtype) - normalization = fold(weighting).view(1, 1, h * uf, w * uf) # normalizes the overlap - weighting = weighting.view((1, 1, kernel_size[0] * uf, kernel_size[1] * uf, Ly * Lx)) - - elif df > 1 and uf == 1: - fold_params = dict(kernel_size=kernel_size, dilation=1, padding=0, stride=stride) - unfold = torch.nn.Unfold(**fold_params) - - fold_params2 = dict(kernel_size=(kernel_size[0] // df, kernel_size[0] // df), - dilation=1, padding=0, - stride=(stride[0] // df, stride[1] // df)) - fold = torch.nn.Fold(output_size=(x.shape[2] // df, x.shape[3] // df), **fold_params2) - - weighting = self.get_weighting(kernel_size[0] // df, kernel_size[1] // df, Ly, Lx, x.device).to(x.dtype) - normalization = fold(weighting).view(1, 1, h // df, w // df) # normalizes the overlap - weighting = weighting.view((1, 1, kernel_size[0] // df, kernel_size[1] // df, Ly * Lx)) - - else: - raise NotImplementedError - - return fold, unfold, normalization, weighting - - @torch.no_grad() - def get_input(self, batch, k, return_first_stage_outputs=False, force_c_encode=False, - cond_key=None, return_original_cond=False, bs=None): - x = super().get_input(batch, k) - if bs is not None: - x = x[:bs] - x = x.to(self.device) - encoder_posterior = self.encode_first_stage(x) - z = self.get_first_stage_encoding(encoder_posterior).detach() - - if self.model.conditioning_key is not None: - if cond_key is None: - cond_key = self.cond_stage_key - if cond_key != self.first_stage_key: - if cond_key in ['caption', 'coordinates_bbox']: - xc = batch[cond_key] - elif cond_key == 'class_label': - xc = batch - else: - xc = super().get_input(batch, cond_key).to(self.device) - else: - xc = x - if not self.cond_stage_trainable or force_c_encode: - if isinstance(xc, dict) or isinstance(xc, list): - # import pudb; pudb.set_trace() - c = self.get_learned_conditioning(xc) - else: - c = self.get_learned_conditioning(xc.to(self.device)) - else: - c = xc - if bs is not None: - c = c[:bs] - - if self.use_positional_encodings: - pos_x, pos_y = self.compute_latent_shifts(batch) - ckey = __conditioning_keys__[self.model.conditioning_key] - c = {ckey: c, 'pos_x': pos_x, 'pos_y': pos_y} - - else: - c = None - xc = None - if self.use_positional_encodings: - pos_x, pos_y = self.compute_latent_shifts(batch) - c = {'pos_x': pos_x, 'pos_y': pos_y} - out = [z, c] - if return_first_stage_outputs: - xrec = self.decode_first_stage(z) - out.extend([x, xrec]) - if return_original_cond: - out.append(xc) - return out - - @torch.no_grad() - def decode_first_stage(self, z, predict_cids=False, force_not_quantize=False): - if predict_cids: - if z.dim() == 4: - z = torch.argmax(z.exp(), dim=1).long() - z = self.first_stage_model.quantize.get_codebook_entry(z, shape=None) - z = rearrange(z, 'b h w c -> b c h w').contiguous() - - z = 1. / self.scale_factor * z - - if hasattr(self, "split_input_params"): - if self.split_input_params["patch_distributed_vq"]: - ks = self.split_input_params["ks"] # eg. (128, 128) - stride = self.split_input_params["stride"] # eg. (64, 64) - uf = self.split_input_params["vqf"] - bs, nc, h, w = z.shape - if ks[0] > h or ks[1] > w: - ks = (min(ks[0], h), min(ks[1], w)) - print("reducing Kernel") - - if stride[0] > h or stride[1] > w: - stride = (min(stride[0], h), min(stride[1], w)) - print("reducing stride") - - fold, unfold, normalization, weighting = self.get_fold_unfold(z, ks, stride, uf=uf) - - z = unfold(z) # (bn, nc * prod(**ks), L) - # 1. Reshape to img shape - z = z.view((z.shape[0], -1, ks[0], ks[1], z.shape[-1])) # (bn, nc, ks[0], ks[1], L ) - - # 2. apply model loop over last dim - if isinstance(self.first_stage_model, VQModelInterface): - output_list = [self.first_stage_model.decode(z[:, :, :, :, i], - force_not_quantize=predict_cids or force_not_quantize) - for i in range(z.shape[-1])] - else: - - output_list = [self.first_stage_model.decode(z[:, :, :, :, i]) - for i in range(z.shape[-1])] - - o = torch.stack(output_list, axis=-1) # # (bn, nc, ks[0], ks[1], L) - o = o * weighting - # Reverse 1. reshape to img shape - o = o.view((o.shape[0], -1, o.shape[-1])) # (bn, nc * ks[0] * ks[1], L) - # stitch crops together - decoded = fold(o) - decoded = decoded / normalization # norm is shape (1, 1, h, w) - return decoded - else: - if isinstance(self.first_stage_model, VQModelInterface): - return self.first_stage_model.decode(z, force_not_quantize=predict_cids or force_not_quantize) - else: - return self.first_stage_model.decode(z) - - else: - if isinstance(self.first_stage_model, VQModelInterface): - return self.first_stage_model.decode(z, force_not_quantize=predict_cids or force_not_quantize) - else: - return self.first_stage_model.decode(z) - - # same as above but without decorator - def differentiable_decode_first_stage(self, z, predict_cids=False, force_not_quantize=False): - if predict_cids: - if z.dim() == 4: - z = torch.argmax(z.exp(), dim=1).long() - z = self.first_stage_model.quantize.get_codebook_entry(z, shape=None) - z = rearrange(z, 'b h w c -> b c h w').contiguous() - - z = 1. / self.scale_factor * z - - if hasattr(self, "split_input_params"): - if self.split_input_params["patch_distributed_vq"]: - ks = self.split_input_params["ks"] # eg. (128, 128) - stride = self.split_input_params["stride"] # eg. (64, 64) - uf = self.split_input_params["vqf"] - bs, nc, h, w = z.shape - if ks[0] > h or ks[1] > w: - ks = (min(ks[0], h), min(ks[1], w)) - print("reducing Kernel") - - if stride[0] > h or stride[1] > w: - stride = (min(stride[0], h), min(stride[1], w)) - print("reducing stride") - - fold, unfold, normalization, weighting = self.get_fold_unfold(z, ks, stride, uf=uf) - - z = unfold(z) # (bn, nc * prod(**ks), L) - # 1. Reshape to img shape - z = z.view((z.shape[0], -1, ks[0], ks[1], z.shape[-1])) # (bn, nc, ks[0], ks[1], L ) - - # 2. apply model loop over last dim - if isinstance(self.first_stage_model, VQModelInterface): - output_list = [self.first_stage_model.decode(z[:, :, :, :, i], - force_not_quantize=predict_cids or force_not_quantize) - for i in range(z.shape[-1])] - else: - - output_list = [self.first_stage_model.decode(z[:, :, :, :, i]) - for i in range(z.shape[-1])] - - o = torch.stack(output_list, axis=-1) # # (bn, nc, ks[0], ks[1], L) - o = o * weighting - # Reverse 1. reshape to img shape - o = o.view((o.shape[0], -1, o.shape[-1])) # (bn, nc * ks[0] * ks[1], L) - # stitch crops together - decoded = fold(o) - decoded = decoded / normalization # norm is shape (1, 1, h, w) - return decoded - else: - if isinstance(self.first_stage_model, VQModelInterface): - return self.first_stage_model.decode(z, force_not_quantize=predict_cids or force_not_quantize) - else: - return self.first_stage_model.decode(z) - - else: - if isinstance(self.first_stage_model, VQModelInterface): - return self.first_stage_model.decode(z, force_not_quantize=predict_cids or force_not_quantize) - else: - return self.first_stage_model.decode(z) - - @torch.no_grad() - def encode_first_stage(self, x): - if hasattr(self, "split_input_params"): - if self.split_input_params["patch_distributed_vq"]: - ks = self.split_input_params["ks"] # eg. (128, 128) - stride = self.split_input_params["stride"] # eg. (64, 64) - df = self.split_input_params["vqf"] - self.split_input_params['original_image_size'] = x.shape[-2:] - bs, nc, h, w = x.shape - if ks[0] > h or ks[1] > w: - ks = (min(ks[0], h), min(ks[1], w)) - print("reducing Kernel") - - if stride[0] > h or stride[1] > w: - stride = (min(stride[0], h), min(stride[1], w)) - print("reducing stride") - - fold, unfold, normalization, weighting = self.get_fold_unfold(x, ks, stride, df=df) - z = unfold(x) # (bn, nc * prod(**ks), L) - # Reshape to img shape - z = z.view((z.shape[0], -1, ks[0], ks[1], z.shape[-1])) # (bn, nc, ks[0], ks[1], L ) - - output_list = [self.first_stage_model.encode(z[:, :, :, :, i]) - for i in range(z.shape[-1])] - - o = torch.stack(output_list, axis=-1) - o = o * weighting - - # Reverse reshape to img shape - o = o.view((o.shape[0], -1, o.shape[-1])) # (bn, nc * ks[0] * ks[1], L) - # stitch crops together - decoded = fold(o) - decoded = decoded / normalization - return decoded - - else: - return self.first_stage_model.encode(x) - else: - return self.first_stage_model.encode(x) - - def shared_step(self, batch, **kwargs): - x, c = self.get_input(batch, self.first_stage_key) - loss = self(x, c) - return loss - - def forward(self, x, c, *args, **kwargs): - t = torch.randint(0, self.num_timesteps, (x.shape[0],), device=self.device).long() - if self.model.conditioning_key is not None: - assert c is not None - if self.cond_stage_trainable: - c = self.get_learned_conditioning(c) - if self.shorten_cond_schedule: # TODO: drop this option - tc = self.cond_ids[t].to(self.device) - c = self.q_sample(x_start=c, t=tc, noise=torch.randn_like(c.float())) - return self.p_losses(x, c, t, *args, **kwargs) - - def _rescale_annotations(self, bboxes, crop_coordinates): # TODO: move to dataset - def rescale_bbox(bbox): - x0 = clamp((bbox[0] - crop_coordinates[0]) / crop_coordinates[2]) - y0 = clamp((bbox[1] - crop_coordinates[1]) / crop_coordinates[3]) - w = min(bbox[2] / crop_coordinates[2], 1 - x0) - h = min(bbox[3] / crop_coordinates[3], 1 - y0) - return x0, y0, w, h - - return [rescale_bbox(b) for b in bboxes] - - def apply_model(self, x_noisy, t, cond, return_ids=False): - - if isinstance(cond, dict): - # hybrid case, cond is exptected to be a dict - pass - else: - if not isinstance(cond, list): - cond = [cond] - key = 'c_concat' if self.model.conditioning_key == 'concat' else 'c_crossattn' - cond = {key: cond} - - if hasattr(self, "split_input_params"): - assert len(cond) == 1 # todo can only deal with one conditioning atm - assert not return_ids - ks = self.split_input_params["ks"] # eg. (128, 128) - stride = self.split_input_params["stride"] # eg. (64, 64) - - h, w = x_noisy.shape[-2:] - - fold, unfold, normalization, weighting = self.get_fold_unfold(x_noisy, ks, stride) - - z = unfold(x_noisy) # (bn, nc * prod(**ks), L) - # Reshape to img shape - z = z.view((z.shape[0], -1, ks[0], ks[1], z.shape[-1])) # (bn, nc, ks[0], ks[1], L ) - z_list = [z[:, :, :, :, i] for i in range(z.shape[-1])] - - if self.cond_stage_key in ["image", "LR_image", "segmentation", - 'bbox_img'] and self.model.conditioning_key: # todo check for completeness - c_key = next(iter(cond.keys())) # get key - c = next(iter(cond.values())) # get value - assert (len(c) == 1) # todo extend to list with more than one elem - c = c[0] # get element - - c = unfold(c) - c = c.view((c.shape[0], -1, ks[0], ks[1], c.shape[-1])) # (bn, nc, ks[0], ks[1], L ) - - cond_list = [{c_key: [c[:, :, :, :, i]]} for i in range(c.shape[-1])] - - elif self.cond_stage_key == 'coordinates_bbox': - assert 'original_image_size' in self.split_input_params, 'BoudingBoxRescaling is missing original_image_size' - - # assuming padding of unfold is always 0 and its dilation is always 1 - n_patches_per_row = int((w - ks[0]) / stride[0] + 1) - full_img_h, full_img_w = self.split_input_params['original_image_size'] - # as we are operating on latents, we need the factor from the original image size to the - # spatial latent size to properly rescale the crops for regenerating the bbox annotations - num_downs = self.first_stage_model.encoder.num_resolutions - 1 - rescale_latent = 2 ** (num_downs) - - # get top left postions of patches as conforming for the bbbox tokenizer, therefore we - # need to rescale the tl patch coordinates to be in between (0,1) - tl_patch_coordinates = [(rescale_latent * stride[0] * (patch_nr % n_patches_per_row) / full_img_w, - rescale_latent * stride[1] * (patch_nr // n_patches_per_row) / full_img_h) - for patch_nr in range(z.shape[-1])] - - # patch_limits are tl_coord, width and height coordinates as (x_tl, y_tl, h, w) - patch_limits = [(x_tl, y_tl, - rescale_latent * ks[0] / full_img_w, - rescale_latent * ks[1] / full_img_h) for x_tl, y_tl in tl_patch_coordinates] - # patch_values = [(np.arange(x_tl,min(x_tl+ks, 1.)),np.arange(y_tl,min(y_tl+ks, 1.))) for x_tl, y_tl in tl_patch_coordinates] - - # tokenize crop coordinates for the bounding boxes of the respective patches - patch_limits_tknzd = [torch.LongTensor(self.bbox_tokenizer._crop_encoder(bbox))[None].to(self.device) - for bbox in patch_limits] # list of length l with tensors of shape (1, 2) - print(patch_limits_tknzd[0].shape) - # cut tknzd crop position from conditioning - assert isinstance(cond, dict), 'cond must be dict to be fed into model' - cut_cond = cond['c_crossattn'][0][..., :-2].to(self.device) - print(cut_cond.shape) - - adapted_cond = torch.stack([torch.cat([cut_cond, p], dim=1) for p in patch_limits_tknzd]) - adapted_cond = rearrange(adapted_cond, 'l b n -> (l b) n') - print(adapted_cond.shape) - adapted_cond = self.get_learned_conditioning(adapted_cond) - print(adapted_cond.shape) - adapted_cond = rearrange(adapted_cond, '(l b) n d -> l b n d', l=z.shape[-1]) - print(adapted_cond.shape) - - cond_list = [{'c_crossattn': [e]} for e in adapted_cond] - - else: - cond_list = [cond for i in range(z.shape[-1])] # Todo make this more efficient - - # apply model by loop over crops - output_list = [self.model(z_list[i], t, **cond_list[i]) for i in range(z.shape[-1])] - assert not isinstance(output_list[0], - tuple) # todo cant deal with multiple model outputs check this never happens - - o = torch.stack(output_list, axis=-1) - o = o * weighting - # Reverse reshape to img shape - o = o.view((o.shape[0], -1, o.shape[-1])) # (bn, nc * ks[0] * ks[1], L) - # stitch crops together - x_recon = fold(o) / normalization - - else: - x_recon = self.model(x_noisy, t, **cond) - - if isinstance(x_recon, tuple) and not return_ids: - return x_recon[0] - else: - return x_recon - - def _predict_eps_from_xstart(self, x_t, t, pred_xstart): - return (extract_into_tensor(self.sqrt_recip_alphas_cumprod, t, x_t.shape) * x_t - pred_xstart) / \ - extract_into_tensor(self.sqrt_recipm1_alphas_cumprod, t, x_t.shape) - - def _prior_bpd(self, x_start): - """ - Get the prior KL term for the variational lower-bound, measured in - bits-per-dim. - This term can't be optimized, as it only depends on the encoder. - :param x_start: the [N x C x ...] tensor of inputs. - :return: a batch of [N] KL values (in bits), one per batch element. - """ - batch_size = x_start.shape[0] - t = torch.tensor([self.num_timesteps - 1] * batch_size, device=x_start.device) - qt_mean, _, qt_log_variance = self.q_mean_variance(x_start, t) - kl_prior = normal_kl(mean1=qt_mean, logvar1=qt_log_variance, mean2=0.0, logvar2=0.0) - return mean_flat(kl_prior) / np.log(2.0) - - def p_losses(self, x_start, cond, t, noise=None): - noise = default(noise, lambda: torch.randn_like(x_start)) - x_noisy = self.q_sample(x_start=x_start, t=t, noise=noise) - model_output = self.apply_model(x_noisy, t, cond) - - loss_dict = {} - prefix = 'train' if self.training else 'val' - - if self.parameterization == "x0": - target = x_start - elif self.parameterization == "eps": - target = noise - else: - raise NotImplementedError() - - loss_simple = self.get_loss(model_output, target, mean=False).mean([1, 2, 3]) - loss_dict.update({f'{prefix}/loss_simple': loss_simple.mean()}) - - logvar_t = self.logvar[t].to(self.device) - loss = loss_simple / torch.exp(logvar_t) + logvar_t - # loss = loss_simple / torch.exp(self.logvar) + self.logvar - if self.learn_logvar: - loss_dict.update({f'{prefix}/loss_gamma': loss.mean()}) - loss_dict.update({'logvar': self.logvar.data.mean()}) - - loss = self.l_simple_weight * loss.mean() - - loss_vlb = self.get_loss(model_output, target, mean=False).mean(dim=(1, 2, 3)) - loss_vlb = (self.lvlb_weights[t] * loss_vlb).mean() - loss_dict.update({f'{prefix}/loss_vlb': loss_vlb}) - loss += (self.original_elbo_weight * loss_vlb) - loss_dict.update({f'{prefix}/loss': loss}) - - return loss, loss_dict - - def p_mean_variance(self, x, c, t, clip_denoised: bool, return_codebook_ids=False, quantize_denoised=False, - return_x0=False, score_corrector=None, corrector_kwargs=None): - t_in = t - model_out = self.apply_model(x, t_in, c, return_ids=return_codebook_ids) - - if score_corrector is not None: - assert self.parameterization == "eps" - model_out = score_corrector.modify_score(self, model_out, x, t, c, **corrector_kwargs) - - if return_codebook_ids: - model_out, logits = model_out - - if self.parameterization == "eps": - x_recon = self.predict_start_from_noise(x, t=t, noise=model_out) - elif self.parameterization == "x0": - x_recon = model_out - else: - raise NotImplementedError() - - if clip_denoised: - x_recon.clamp_(-1., 1.) - if quantize_denoised: - x_recon, _, [_, _, indices] = self.first_stage_model.quantize(x_recon) - model_mean, posterior_variance, posterior_log_variance = self.q_posterior(x_start=x_recon, x_t=x, t=t) - if return_codebook_ids: - return model_mean, posterior_variance, posterior_log_variance, logits - elif return_x0: - return model_mean, posterior_variance, posterior_log_variance, x_recon - else: - return model_mean, posterior_variance, posterior_log_variance - - @torch.no_grad() - def p_sample(self, x, c, t, clip_denoised=False, repeat_noise=False, - return_codebook_ids=False, quantize_denoised=False, return_x0=False, - temperature=1., noise_dropout=0., score_corrector=None, corrector_kwargs=None): - b, *_, device = *x.shape, x.device - outputs = self.p_mean_variance(x=x, c=c, t=t, clip_denoised=clip_denoised, - return_codebook_ids=return_codebook_ids, - quantize_denoised=quantize_denoised, - return_x0=return_x0, - score_corrector=score_corrector, corrector_kwargs=corrector_kwargs) - if return_codebook_ids: - raise DeprecationWarning("Support dropped.") - model_mean, _, model_log_variance, logits = outputs - elif return_x0: - model_mean, _, model_log_variance, x0 = outputs - else: - model_mean, _, model_log_variance = outputs - - noise = noise_like(x.shape, device, repeat_noise) * temperature - if noise_dropout > 0.: - noise = torch.nn.functional.dropout(noise, p=noise_dropout) - # no noise when t == 0 - nonzero_mask = (1 - (t == 0).float()).reshape(b, *((1,) * (len(x.shape) - 1))) - - if return_codebook_ids: - return model_mean + nonzero_mask * (0.5 * model_log_variance).exp() * noise, logits.argmax(dim=1) - if return_x0: - return model_mean + nonzero_mask * (0.5 * model_log_variance).exp() * noise, x0 - else: - return model_mean + nonzero_mask * (0.5 * model_log_variance).exp() * noise - - @torch.no_grad() - def progressive_denoising(self, cond, shape, verbose=True, callback=None, quantize_denoised=False, - img_callback=None, mask=None, x0=None, temperature=1., noise_dropout=0., - score_corrector=None, corrector_kwargs=None, batch_size=None, x_T=None, start_T=None, - log_every_t=None): - if not log_every_t: - log_every_t = self.log_every_t - timesteps = self.num_timesteps - if batch_size is not None: - b = batch_size if batch_size is not None else shape[0] - shape = [batch_size] + list(shape) - else: - b = batch_size = shape[0] - if x_T is None: - img = torch.randn(shape, device=self.device) - else: - img = x_T - intermediates = [] - if cond is not None: - if isinstance(cond, dict): - cond = {key: cond[key][:batch_size] if not isinstance(cond[key], list) else - list(map(lambda x: x[:batch_size], cond[key])) for key in cond} - else: - cond = [c[:batch_size] for c in cond] if isinstance(cond, list) else cond[:batch_size] - - if start_T is not None: - timesteps = min(timesteps, start_T) - iterator = tqdm(reversed(range(0, timesteps)), desc='Progressive Generation', - total=timesteps) if verbose else reversed( - range(0, timesteps)) - if type(temperature) == float: - temperature = [temperature] * timesteps - - for i in iterator: - ts = torch.full((b,), i, device=self.device, dtype=torch.long) - if self.shorten_cond_schedule: - assert self.model.conditioning_key != 'hybrid' - tc = self.cond_ids[ts].to(cond.device) - cond = self.q_sample(x_start=cond, t=tc, noise=torch.randn_like(cond)) - - img, x0_partial = self.p_sample(img, cond, ts, - clip_denoised=self.clip_denoised, - quantize_denoised=quantize_denoised, return_x0=True, - temperature=temperature[i], noise_dropout=noise_dropout, - score_corrector=score_corrector, corrector_kwargs=corrector_kwargs) - if mask is not None: - assert x0 is not None - img_orig = self.q_sample(x0, ts) - img = img_orig * mask + (1. - mask) * img - - if i % log_every_t == 0 or i == timesteps - 1: - intermediates.append(x0_partial) - if callback: callback(i) - if img_callback: img_callback(img, i) - return img, intermediates - - @torch.no_grad() - def p_sample_loop(self, cond, shape, return_intermediates=False, - x_T=None, verbose=True, callback=None, timesteps=None, quantize_denoised=False, - mask=None, x0=None, img_callback=None, start_T=None, - log_every_t=None): - - if not log_every_t: - log_every_t = self.log_every_t - device = self.betas.device - b = shape[0] - if x_T is None: - img = torch.randn(shape, device=device) - else: - img = x_T - - intermediates = [img] - if timesteps is None: - timesteps = self.num_timesteps - - if start_T is not None: - timesteps = min(timesteps, start_T) - iterator = tqdm(reversed(range(0, timesteps)), desc='Sampling t', total=timesteps) if verbose else reversed( - range(0, timesteps)) - - if mask is not None: - assert x0 is not None - assert x0.shape[2:3] == mask.shape[2:3] # spatial size has to match - - for i in iterator: - ts = torch.full((b,), i, device=device, dtype=torch.long) - if self.shorten_cond_schedule: - assert self.model.conditioning_key != 'hybrid' - tc = self.cond_ids[ts].to(cond.device) - cond = self.q_sample(x_start=cond, t=tc, noise=torch.randn_like(cond)) - - img = self.p_sample(img, cond, ts, - clip_denoised=self.clip_denoised, - quantize_denoised=quantize_denoised) - if mask is not None: - img_orig = self.q_sample(x0, ts) - img = img_orig * mask + (1. - mask) * img - - if i % log_every_t == 0 or i == timesteps - 1: - intermediates.append(img) - if callback: callback(i) - if img_callback: img_callback(img, i) - - if return_intermediates: - return img, intermediates - return img - - @torch.no_grad() - def sample(self, cond, batch_size=16, return_intermediates=False, x_T=None, - verbose=True, timesteps=None, quantize_denoised=False, - mask=None, x0=None, shape=None,**kwargs): - if shape is None: - shape = (batch_size, self.channels, self.image_size, self.image_size) - if cond is not None: - if isinstance(cond, dict): - cond = {key: cond[key][:batch_size] if not isinstance(cond[key], list) else - list(map(lambda x: x[:batch_size], cond[key])) for key in cond} - else: - cond = [c[:batch_size] for c in cond] if isinstance(cond, list) else cond[:batch_size] - return self.p_sample_loop(cond, - shape, - return_intermediates=return_intermediates, x_T=x_T, - verbose=verbose, timesteps=timesteps, quantize_denoised=quantize_denoised, - mask=mask, x0=x0) - - @torch.no_grad() - def sample_log(self,cond,batch_size,ddim, ddim_steps,**kwargs): - - if ddim: - ddim_sampler = DDIMSampler(self) - shape = (self.channels, self.image_size, self.image_size) - samples, intermediates =ddim_sampler.sample(ddim_steps,batch_size, - shape,cond,verbose=False,**kwargs) - - else: - samples, intermediates = self.sample(cond=cond, batch_size=batch_size, - return_intermediates=True,**kwargs) - - return samples, intermediates - - - @torch.no_grad() - def log_images(self, batch, N=8, n_row=4, sample=True, ddim_steps=200, ddim_eta=1., return_keys=None, - quantize_denoised=True, inpaint=True, plot_denoise_rows=False, plot_progressive_rows=True, - plot_diffusion_rows=True, **kwargs): - - use_ddim = ddim_steps is not None - - log = dict() - z, c, x, xrec, xc = self.get_input(batch, self.first_stage_key, - return_first_stage_outputs=True, - force_c_encode=True, - return_original_cond=True, - bs=N) - N = min(x.shape[0], N) - n_row = min(x.shape[0], n_row) - log["inputs"] = x - log["reconstruction"] = xrec - if self.model.conditioning_key is not None: - if hasattr(self.cond_stage_model, "decode"): - xc = self.cond_stage_model.decode(c) - log["conditioning"] = xc - elif self.cond_stage_key in ["caption"]: - xc = log_txt_as_img((x.shape[2], x.shape[3]), batch["caption"]) - log["conditioning"] = xc - elif self.cond_stage_key == 'class_label': - xc = log_txt_as_img((x.shape[2], x.shape[3]), batch["human_label"]) - log['conditioning'] = xc - elif isimage(xc): - log["conditioning"] = xc - if ismap(xc): - log["original_conditioning"] = self.to_rgb(xc) - - if plot_diffusion_rows: - # get diffusion row - diffusion_row = list() - z_start = z[:n_row] - for t in range(self.num_timesteps): - if t % self.log_every_t == 0 or t == self.num_timesteps - 1: - t = repeat(torch.tensor([t]), '1 -> b', b=n_row) - t = t.to(self.device).long() - noise = torch.randn_like(z_start) - z_noisy = self.q_sample(x_start=z_start, t=t, noise=noise) - diffusion_row.append(self.decode_first_stage(z_noisy)) - - diffusion_row = torch.stack(diffusion_row) # n_log_step, n_row, C, H, W - diffusion_grid = rearrange(diffusion_row, 'n b c h w -> b n c h w') - diffusion_grid = rearrange(diffusion_grid, 'b n c h w -> (b n) c h w') - diffusion_grid = make_grid(diffusion_grid, nrow=diffusion_row.shape[0]) - log["diffusion_row"] = diffusion_grid - - if sample: - # get denoise row - with self.ema_scope("Plotting"): - samples, z_denoise_row = self.sample_log(cond=c,batch_size=N,ddim=use_ddim, - ddim_steps=ddim_steps,eta=ddim_eta) - # samples, z_denoise_row = self.sample(cond=c, batch_size=N, return_intermediates=True) - x_samples = self.decode_first_stage(samples) - log["samples"] = x_samples - if plot_denoise_rows: - denoise_grid = self._get_denoise_row_from_list(z_denoise_row) - log["denoise_row"] = denoise_grid - - if quantize_denoised and not isinstance(self.first_stage_model, AutoencoderKL) and not isinstance( - self.first_stage_model, IdentityFirstStage): - # also display when quantizing x0 while sampling - with self.ema_scope("Plotting Quantized Denoised"): - samples, z_denoise_row = self.sample_log(cond=c,batch_size=N,ddim=use_ddim, - ddim_steps=ddim_steps,eta=ddim_eta, - quantize_denoised=True) - # samples, z_denoise_row = self.sample(cond=c, batch_size=N, return_intermediates=True, - # quantize_denoised=True) - x_samples = self.decode_first_stage(samples.to(self.device)) - log["samples_x0_quantized"] = x_samples - - if inpaint: - # make a simple center square - b, h, w = z.shape[0], z.shape[2], z.shape[3] - mask = torch.ones(N, h, w).to(self.device) - # zeros will be filled in - mask[:, h // 4:3 * h // 4, w // 4:3 * w // 4] = 0. - mask = mask[:, None, ...] - with self.ema_scope("Plotting Inpaint"): - - samples, _ = self.sample_log(cond=c,batch_size=N,ddim=use_ddim, eta=ddim_eta, - ddim_steps=ddim_steps, x0=z[:N], mask=mask) - x_samples = self.decode_first_stage(samples.to(self.device)) - log["samples_inpainting"] = x_samples - log["mask"] = mask - - # outpaint - with self.ema_scope("Plotting Outpaint"): - samples, _ = self.sample_log(cond=c, batch_size=N, ddim=use_ddim,eta=ddim_eta, - ddim_steps=ddim_steps, x0=z[:N], mask=mask) - x_samples = self.decode_first_stage(samples.to(self.device)) - log["samples_outpainting"] = x_samples - - if plot_progressive_rows: - with self.ema_scope("Plotting Progressives"): - img, progressives = self.progressive_denoising(c, - shape=(self.channels, self.image_size, self.image_size), - batch_size=N) - prog_row = self._get_denoise_row_from_list(progressives, desc="Progressive Generation") - log["progressive_row"] = prog_row - - if return_keys: - if np.intersect1d(list(log.keys()), return_keys).shape[0] == 0: - return log - else: - return {key: log[key] for key in return_keys} - return log - - def configure_optimizers(self): - lr = self.learning_rate - params = list(self.model.parameters()) - if self.cond_stage_trainable: - print(f"{self.__class__.__name__}: Also optimizing conditioner params!") - params = params + list(self.cond_stage_model.parameters()) - if self.learn_logvar: - print('Diffusion model optimizing logvar') - params.append(self.logvar) - opt = torch.optim.AdamW(params, lr=lr) - if self.use_scheduler: - assert 'target' in self.scheduler_config - scheduler = instantiate_from_config(self.scheduler_config) - - print("Setting up LambdaLR scheduler...") - scheduler = [ - { - 'scheduler': LambdaLR(opt, lr_lambda=scheduler.schedule), - 'interval': 'step', - 'frequency': 1 - }] - return [opt], scheduler - return opt - - @torch.no_grad() - def to_rgb(self, x): - x = x.float() - if not hasattr(self, "colorize"): - self.colorize = torch.randn(3, x.shape[1], 1, 1).to(x) - x = nn.functional.conv2d(x, weight=self.colorize) - x = 2. * (x - x.min()) / (x.max() - x.min()) - 1. - return x - - -class DiffusionWrapper(pl.LightningModule): - def __init__(self, diff_model_config, conditioning_key): - super().__init__() - self.diffusion_model = instantiate_from_config(diff_model_config) - self.conditioning_key = conditioning_key - assert self.conditioning_key in [None, 'concat', 'crossattn', 'hybrid', 'adm'] - - def forward(self, x, t, c_concat: list = None, c_crossattn: list = None): - if self.conditioning_key is None: - out = self.diffusion_model(x, t) - elif self.conditioning_key == 'concat': - xc = torch.cat([x] + c_concat, dim=1) - out = self.diffusion_model(xc, t) - elif self.conditioning_key == 'crossattn': - cc = torch.cat(c_crossattn, 1) - out = self.diffusion_model(x, t, context=cc) - elif self.conditioning_key == 'hybrid': - xc = torch.cat([x] + c_concat, dim=1) - cc = torch.cat(c_crossattn, 1) - out = self.diffusion_model(xc, t, context=cc) - elif self.conditioning_key == 'adm': - cc = c_crossattn[0] - out = self.diffusion_model(x, t, y=cc) - else: - raise NotImplementedError() - - return out - - -class Layout2ImgDiffusion(LatentDiffusion): - # TODO: move all layout-specific hacks to this class - def __init__(self, cond_stage_key, *args, **kwargs): - assert cond_stage_key == 'coordinates_bbox', 'Layout2ImgDiffusion only for cond_stage_key="coordinates_bbox"' - super().__init__(cond_stage_key=cond_stage_key, *args, **kwargs) - - def log_images(self, batch, N=8, *args, **kwargs): - logs = super().log_images(batch=batch, N=N, *args, **kwargs) - - key = 'train' if self.training else 'validation' - dset = self.trainer.datamodule.datasets[key] - mapper = dset.conditional_builders[self.cond_stage_key] - - bbox_imgs = [] - map_fn = lambda catno: dset.get_textual_label(dset.get_category_id(catno)) - for tknzd_bbox in batch[self.cond_stage_key][:N]: - bboximg = mapper.plot(tknzd_bbox.detach().cpu(), map_fn, (256, 256)) - bbox_imgs.append(bboximg) - - cond_img = torch.stack(bbox_imgs, dim=0) - logs['bbox_image'] = cond_img - return logs diff --git a/spaces/Kellyasrfuhioj/stydbdcg/README.md b/spaces/Kellyasrfuhioj/stydbdcg/README.md deleted file mode 100644 index 8aa631186d5a86355cfb11b1bf7b6bd139bf754d..0000000000000000000000000000000000000000 --- a/spaces/Kellyasrfuhioj/stydbdcg/README.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: Stydbdcg -emoji: 🚀 -colorFrom: indigo -colorTo: blue -sdk: gradio -sdk_version: 3.12.0 -app_file: app.py -pinned: false ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/Kevin676/ChatGPT-with-Voice-Cloning-in-Chinese/ppg2mel/train.py b/spaces/Kevin676/ChatGPT-with-Voice-Cloning-in-Chinese/ppg2mel/train.py deleted file mode 100644 index d3ef729075a837a680175559ecbdde0b398a73a9..0000000000000000000000000000000000000000 --- a/spaces/Kevin676/ChatGPT-with-Voice-Cloning-in-Chinese/ppg2mel/train.py +++ /dev/null @@ -1,62 +0,0 @@ -import sys -import torch -import argparse -import numpy as np -from utils.load_yaml import HpsYaml -from ppg2mel.train.train_linglf02mel_seq2seq_oneshotvc import Solver - -# For reproducibility, comment these may speed up training -torch.backends.cudnn.deterministic = True -torch.backends.cudnn.benchmark = False - -def main(): - # Arguments - parser = argparse.ArgumentParser(description= - 'Training PPG2Mel VC model.') - parser.add_argument('--config', type=str, - help='Path to experiment config, e.g., config/vc.yaml') - parser.add_argument('--name', default=None, type=str, help='Name for logging.') - parser.add_argument('--logdir', default='log/', type=str, - help='Logging path.', required=False) - parser.add_argument('--ckpdir', default='ckpt/', type=str, - help='Checkpoint path.', required=False) - parser.add_argument('--outdir', default='result/', type=str, - help='Decode output path.', required=False) - parser.add_argument('--load', default=None, type=str, - help='Load pre-trained model (for training only)', required=False) - parser.add_argument('--warm_start', action='store_true', - help='Load model weights only, ignore specified layers.') - parser.add_argument('--seed', default=0, type=int, - help='Random seed for reproducable results.', required=False) - parser.add_argument('--njobs', default=8, type=int, - help='Number of threads for dataloader/decoding.', required=False) - parser.add_argument('--cpu', action='store_true', help='Disable GPU training.') - # parser.add_argument('--no-pin', action='store_true', - # help='Disable pin-memory for dataloader') - parser.add_argument('--no-msg', action='store_true', help='Hide all messages.') - - ### - - paras = parser.parse_args() - setattr(paras, 'gpu', not paras.cpu) - setattr(paras, 'pin_memory', not paras.no_pin) - setattr(paras, 'verbose', not paras.no_msg) - # Make the config dict dot visitable - config = HpsYaml(paras.config) - - np.random.seed(paras.seed) - torch.manual_seed(paras.seed) - if torch.cuda.is_available(): - torch.cuda.manual_seed_all(paras.seed) - - print(">>> OneShot VC training ...") - mode = "train" - solver = Solver(config, paras, mode) - solver.load_data() - solver.set_model() - solver.exec() - print(">>> Oneshot VC train finished!") - sys.exit(0) - -if __name__ == "__main__": - main() diff --git a/spaces/KevinQHLin/UniVTG/model/base_droppath_ablation.py b/spaces/KevinQHLin/UniVTG/model/base_droppath_ablation.py deleted file mode 100644 index a3fb06a293c0a7130715d53cecc9b98406d70fdf..0000000000000000000000000000000000000000 --- a/spaces/KevinQHLin/UniVTG/model/base_droppath_ablation.py +++ /dev/null @@ -1,474 +0,0 @@ -import pdb -import torch -import torch.nn.functional as F -from torch import nn -import numpy as np - -from model.transformer_encoder_droppath import build_transformer -from model.matcher import build_matcher -from model.position_encoding import build_position_encoding -from utils.span_utils import generalized_temporal_iou, span_cxw_to_xx - -def init_weights(module): - if isinstance(module, (nn.Linear, nn.Embedding)): - module.weight.data.normal_(mean=0.0, std=0.02) - elif isinstance(module, nn.LayerNorm): - module.bias.data.zero_() - module.weight.data.fill_(1.0) - - if isinstance(module, nn.Linear) and module.bias is not None: - module.bias.data.zero_() - -def mask_logits(inputs, mask, mask_value=-1e30): - mask = mask.type(torch.float32) - return inputs + (1.0 - mask) * mask_value - -def sim_matrix(a, b, eps=1e-8): - """ - added eps for numerical stability - """ - a_n, b_n = a.norm(dim=1)[:, None], b.norm(dim=1)[:, None] - a_norm = a / torch.max(a_n, eps * torch.ones_like(a_n)) - b_norm = b / torch.max(b_n, eps * torch.ones_like(b_n)) - sim_mt = torch.mm(a_norm, b_norm.transpose(0, 1)) - return sim_mt - -class WeightedPool(nn.Module): - def __init__(self, dim): - super(WeightedPool, self).__init__() - weight = torch.empty(dim, 1) - nn.init.xavier_uniform_(weight) - self.weight = nn.Parameter(weight, requires_grad=True) - - def forward(self, x, mask): - alpha = torch.tensordot(x, self.weight, dims=1) # shape = (batch_size, seq_length, 1) - alpha = mask_logits(alpha, mask=mask.unsqueeze(2)) - alphas = nn.Softmax(dim=1)(alpha) - pooled_x = torch.matmul(x.transpose(1, 2), alphas) # (batch_size, dim, 1) - pooled_x = pooled_x.squeeze(2) - return pooled_x - -class Model(nn.Module): - """ This is the UniVTG module that performs moment localization. """ - - def __init__(self, transformer, position_embed, txt_position_embed, txt_dim, vid_dim, - input_dropout, aux_loss=False, - max_v_l=75, span_loss_type="l1", use_txt_pos=False, n_input_proj=2): - """ Initializes the model. - Parameters: - transformer: torch module of the transformer architecture. See transformer.py - position_embed: torch module of the position_embedding, See position_encoding.py - txt_position_embed: position_embedding for text - txt_dim: int, text query input dimension - vid_dim: int, video feature input dimension - max_v_l: int, maximum #clips in videos - span_loss_type: str, one of [l1, ce] - l1: (center-x, width) regression. - ce: (st_idx, ed_idx) classification. - # foreground_thd: float, intersection over prediction >= foreground_thd: labeled as foreground - # background_thd: float, intersection over prediction <= background_thd: labeled background - """ - super().__init__() - self.transformer = transformer - self.position_embed = position_embed - self.txt_position_embed = txt_position_embed - hidden_dim = transformer.d_model - self.span_loss_type = span_loss_type - self.max_v_l = max_v_l - span_pred_dim = 2 if span_loss_type == "l1" else max_v_l * 2 - - self.token_type_embeddings = nn.Embedding(2, hidden_dim) - self.token_type_embeddings.apply(init_weights) - - # Conv projector - self.span_embed = Conv(hidden_dim, hidden_dim, span_pred_dim, 3, kernel_size=3) - self.class_embed = Conv(hidden_dim, hidden_dim, 1, 3, kernel_size=3) # 0: background, 1: foreground - - self.use_txt_pos = use_txt_pos - self.n_input_proj = n_input_proj - relu_args = [True] * 3 - relu_args[n_input_proj-1] = False - self.input_txt_proj = nn.Sequential(*[ - LinearLayer(txt_dim, hidden_dim, layer_norm=True, dropout=input_dropout, relu=relu_args[0]), - LinearLayer(hidden_dim, hidden_dim, layer_norm=True, dropout=input_dropout, relu=relu_args[1]), - LinearLayer(hidden_dim, hidden_dim, layer_norm=True, dropout=input_dropout, relu=relu_args[2]) - ][:n_input_proj]) - self.input_vid_proj = nn.Sequential(*[ - LinearLayer(vid_dim, hidden_dim, layer_norm=True, dropout=input_dropout, relu=relu_args[0]), - LinearLayer(hidden_dim, hidden_dim, layer_norm=True, dropout=input_dropout, relu=relu_args[1]), - LinearLayer(hidden_dim, hidden_dim, layer_norm=True, dropout=input_dropout, relu=relu_args[2]) - ][:n_input_proj]) - - # MLP Projector - self.weightedpool = WeightedPool(hidden_dim) - - def forward(self, src_txt, src_txt_mask, src_vid, src_vid_mask, src_cls=None, src_cls_mask=None): - bs = src_vid.shape[0] - src_vid = self.input_vid_proj(src_vid) - src_txt = self.input_txt_proj(src_txt) - if src_cls is not None: - src_cls = self.input_txt_proj(src_cls) - - # type token. - src_vid = src_vid + self.token_type_embeddings(torch.full_like(src_vid_mask.long(), 1)) - src_txt = src_txt + self.token_type_embeddings(torch.zeros_like(src_txt_mask.long())) - if src_cls is not None: - src_cls = src_cls + self.token_type_embeddings(torch.zeros_like(src_cls_mask.long())) - - src = torch.cat([src_vid, src_txt], dim=1) # (bsz, L_vid+L_txt, d) - mask = torch.cat([src_vid_mask, src_txt_mask], dim=1).bool() # (bsz, L_vid+L_txt) - - pos_vid = self.position_embed(src_vid, src_vid_mask) # (bsz, L_vid, d) - pos_txt = self.txt_position_embed(src_txt) if self.use_txt_pos else torch.zeros_like(src_txt) # (bsz, L_txt, d) - pos = torch.cat([pos_vid, pos_txt], dim=1) - - memory = self.transformer(src, ~mask, pos) - vid_mem = memory[:, :src_vid.shape[1], :] # (bsz, L_vid, d) - - outputs_class = self.class_embed(vid_mem).sigmoid() # (#layers, batch_size, #queries, #classes) - outputs_coord = self.span_embed(vid_mem) # (#layers, bsz, #queries, 2 or max_v_l * 2) - - if self.span_loss_type == "l1": - outputs_coord = outputs_coord.sigmoid() - idx_mask = torch.tensor((-1, 1)).unsqueeze(0).unsqueeze(0).cuda() - idx_mask = idx_mask.repeat(outputs_coord.shape[0], outputs_coord.shape[1], 1) - outputs_coord = outputs_coord * idx_mask - else: - raise NotImplementedError - - out = {'pred_logits': outputs_class, 'pred_spans': outputs_coord, - 'src_vid_mask': src_vid_mask} - - vid_mem_proj = src_vid - - # word-level -> sentence-level - txt_mem_proj = self.weightedpool(src_txt, src_txt_mask).unsqueeze(1) - sim = F.cosine_similarity(vid_mem_proj, txt_mem_proj, dim=-1) + (src_vid_mask + 1e-45).log() - - out["vid_mem_proj"] = vid_mem_proj - out["txt_mem_proj"] = txt_mem_proj - if src_cls is not None: - cls_mem_proj = self.weightedpool(src_cls, src_cls_mask) - out["cls_mem_proj"] = cls_mem_proj - out["saliency_scores"] = sim - return out - -class SetCriterion(nn.Module): - """ This class computes the loss for DETR. - The process happens in two steps: - 1) we compute hungarian assignment between ground truth boxes and the outputs of the model - 2) we supervise each pair of matched ground-truth / prediction (supervise class and box) - """ - - def __init__(self, matcher, weight_dict, eos_coef, losses, temperature, span_loss_type, max_v_l, - saliency_margin=1): - """ Create the criterion. - Parameters: - matcher: module able to compute a matching between targets and proposals - weight_dict: dict containing as key the names of the losses and as values their relative weight. - eos_coef: relative classification weight applied to the no-object category - losses: list of all the losses to be applied. See get_loss for list of available losses. - temperature: float, temperature for NCE loss - span_loss_type: str, [l1, ce] - max_v_l: int, - saliency_margin: float - """ - super().__init__() - self.matcher = matcher - self.weight_dict = weight_dict - self.losses = losses - self.temperature = temperature - self.span_loss_type = span_loss_type - self.max_v_l = max_v_l - self.saliency_margin = saliency_margin - self.temperature = 0.07 - - # foreground and background classification - self.foreground_label = 0 - self.background_label = 1 - self.eos_coef = eos_coef - empty_weight = torch.ones(2) - empty_weight[-1] = self.eos_coef # lower weight for background (index 1, foreground index 0) - self.register_buffer('empty_weight', empty_weight) - - def loss_spans(self, outputs, targets, indices): - assert 'pred_spans' in outputs - - start_spans = targets['timestamp'] - pred_spans = outputs['pred_spans'] - src_spans = start_spans + pred_spans - gt_spans = targets['span_labels_nn'] - - mask = targets['timestamp_mask'].bool() - mask_full = targets['timestamp_mask'].unsqueeze(2).repeat(1, 1, 2) - mask_valid = targets['timestamp_window'].bool() - mask_valid_full = targets['timestamp_window'].unsqueeze(2).repeat(1, 1, 2) - - weight_abalation_b = targets['weight_ablation'][:,0].unsqueeze(-1) - if weight_abalation_b.sum() == 0: - return {"loss_f": torch.tensor(0).cuda(), "loss_g": torch.tensor(0).cuda()} - - mask_valid = (mask_valid * weight_abalation_b).bool() - mask_valid_full = (mask_valid_full * weight_abalation_b.unsqueeze(-1)).bool() - - loss_span = F.smooth_l1_loss(src_spans, gt_spans, reduction='none') * mask_valid_full - loss_giou = 1 - torch.diag(generalized_temporal_iou(src_spans[mask_valid], gt_spans[mask_valid])) - - losses = {} - losses['loss_b'] = loss_span.sum() / mask_valid.sum() - losses['loss_g'] = loss_giou.mean() - return losses - - def loss_labels(self, outputs, targets, indices, log=True): - src_logits = outputs['pred_logits'].squeeze(-1) # (batch_size, #queries, #classes=2) - mask = targets['timestamp_mask'].bool() - mask_valid = targets['timestamp_window'].bool() - target_classes = torch.full(src_logits.shape[:2], 0, dtype=torch.int64, device=src_logits.device) # (batch_size, #queries) - target_classes[mask_valid] = 1 - # target_classes = targets['timestamp_window'] # soft cls. - target_classes.float() - # pdb.set_trace() - - weights = torch.zeros_like(target_classes).float() - weights[mask] = self.empty_weight[1] - weights[mask_valid] = self.empty_weight[0] - - loss_ce = F.binary_cross_entropy(src_logits, target_classes.float(), weight=weights, reduction="none") * mask - - weight_abalation_f = targets['weight_ablation'][:,2].unsqueeze(-1) - if weight_abalation_f.sum() == 0: - return {"loss_f": torch.tensor(0).cuda()} - - mask = mask * weight_abalation_f - loss_ce = loss_ce * weight_abalation_f - return {"loss_f": loss_ce.sum() / mask.sum()} - # return {"loss_f": loss_ce.sum() / (1 + mask_valid.sum())} - - def loss_saliency(self, outputs, targets, indices, log=True): - """higher scores for positive clips""" - if "saliency_pos_labels" not in targets: - return {"loss_s_inter": 0., "loss_s_intra": 0.} - saliency_scores = targets["saliency_scores"] - if saliency_scores.sum() == 0: - return {"loss_s_inter": 0., "loss_s_intra": 0.} - - # * inter-vid mode - vid_mem_proj = outputs["vid_mem_proj"] - pos_indices = targets["saliency_pos_labels"][:,0].long() # (N, #pairs) - batch_indices = torch.arange(len(vid_mem_proj)).to(vid_mem_proj.device) - - vid_feats = vid_mem_proj[batch_indices, pos_indices] - txt_feats = outputs["txt_mem_proj"].squeeze(1) - sim = sim_matrix(vid_feats, txt_feats) - - i_logsm = F.log_softmax(sim / self.temperature, dim=1) - j_logsm = F.log_softmax(sim.t() /self.temperature, dim=1) - - # sum over positives - idiag = torch.diag(i_logsm) - jdiag = torch.diag(j_logsm) - - weight_abalation_s = targets['weight_ablation'][:,3].bool() - if weight_abalation_s.sum() == 0: - return {"loss_s_inter": torch.tensor(0).cuda(), - "loss_s_intra": torch.tensor(0).cuda()} - - _idiag = idiag[weight_abalation_s] - _jdiag = jdiag[weight_abalation_s] - - loss_i = _idiag.sum() / len(_idiag) - loss_j = _jdiag.sum() / len(_jdiag) - - loss_saliency_inter = - loss_i - loss_j - - # * intra-vid mode - mask = targets['timestamp_mask'] - selected_scores = saliency_scores[batch_indices, pos_indices].unsqueeze(-1) - neg_indices_in = (saliency_scores < selected_scores) - neg_indices_in[batch_indices, pos_indices] = True - mask_invalid = neg_indices_in * mask.bool() - - sim_in = F.cosine_similarity(vid_mem_proj, txt_feats.unsqueeze(1), dim=-1) - sim_in = sim_in + (mask_invalid + 1e-45).log() - logsm_in_i = F.log_softmax(sim_in / self.temperature, dim=1) - logsm_in_j = F.log_softmax(sim_in.t() / self.temperature, dim=1) - - pos_logsm_in_i = logsm_in_i[batch_indices, pos_indices] - pos_logsm_in_j = logsm_in_j[pos_indices, batch_indices] - _pos_logsm_in_i = pos_logsm_in_i[weight_abalation_s] - _pos_logsm_in_j = pos_logsm_in_j[weight_abalation_s] - - loss_in_i = _pos_logsm_in_i.sum() / len(_pos_logsm_in_i) - loss_in_j = _pos_logsm_in_j.sum() / len(_pos_logsm_in_j) - - loss_saliency_intra = - loss_in_i - loss_in_j - - return {"loss_s_inter": loss_saliency_inter, "loss_s_intra": loss_saliency_intra} - - def loss_saliency_cls(self, outputs, targets, indices, log=True): - """higher scores for positive clips""" - if "saliency_pos_labels" not in targets: - return {"loss_s_inter": 0., "loss_s_intra": 0.} - saliency_scores = targets["saliency_scores"] - if saliency_scores.sum() == 0: - return {"loss_s_inter": 0., "loss_s_intra": 0.} - - # * inter-vid mode - vid_mem_proj = outputs["vid_mem_proj"] - pos_indices = targets["saliency_pos_labels"][:,0].long() # (N, #pairs) - batch_indices = torch.arange(len(vid_mem_proj)).to(vid_mem_proj.device) - - vid_feats = vid_mem_proj[batch_indices, pos_indices] - txt_feats = outputs["txt_mem_proj"].squeeze(1) - sim = sim_matrix(vid_feats, txt_feats) - - i_logsm = F.log_softmax(sim / self.temperature, dim=1) - j_logsm = F.log_softmax(sim.t() /self.temperature, dim=1) - - # sum over positives - idiag = torch.diag(i_logsm) - jdiag = torch.diag(j_logsm) - loss_i = idiag.sum() / len(idiag) - loss_j = jdiag.sum() / len(jdiag) - - loss_saliency_inter = - loss_i - loss_j - - # * intra-vid mode - if 'cls_idx' not in targets.keys(): # eval - return {"loss_s_inter": loss_saliency_inter} - - cls_indices = targets['cls_idx'].bool() - cls_feats = outputs["cls_mem_proj"].squeeze(1) - sim_cls = sim_matrix(vid_feats, cls_feats) - - i_logsm_cls = F.log_softmax(sim_cls / self.temperature, dim=1) - idiag_cls = i_logsm_cls[cls_indices] - loss_cls_i = idiag_cls.sum() / len(idiag_cls) - - loss_saliency_intra = - loss_cls_i - - return {"loss_s_inter": loss_saliency_inter, "loss_s_intra": loss_saliency_intra} - - def get_loss(self, loss, outputs, targets, indices, **kwargs): - loss_map = { - "spans": self.loss_spans, - "labels": self.loss_labels, - "saliency": self.loss_saliency, - "saliency_cls": self.loss_saliency_cls, - } - assert loss in loss_map, f'do you really want to compute {loss} loss?' - return loss_map[loss](outputs, targets, indices, **kwargs) - - def forward(self, outputs, targets, hl_only=False): - """ This performs the loss computation. - Parameters: - outputs: dict of tensors, see the output specification of the model for the format - targets: list of dicts, such that len(targets) == batch_size. - The expected keys in each dict depends on the losses applied, see each loss' doc - """ - indices = None - # Compute all the requested losses - losses = {} - for loss in self.losses: - losses.update(self.get_loss(loss, outputs, targets, indices)) - - return losses - -class MLP(nn.Module): - """ Very simple multi-layer perceptron (also called FFN)""" - - def __init__(self, input_dim, hidden_dim, output_dim, num_layers): - super().__init__() - self.num_layers = num_layers - h = [hidden_dim] * (num_layers - 1) - self.layers = nn.ModuleList(nn.Linear(n, k) for n, k in zip([input_dim] + h, h + [output_dim])) - - def forward(self, x): - for i, layer in enumerate(self.layers): - x = F.relu(layer(x)) if i < self.num_layers - 1 else layer(x) - return x - -class Conv(nn.Module): - """ Very simple multi-layer perceptron (also called FFN)""" - - def __init__(self, input_dim, hidden_dim, output_dim, num_layers, kernel_size): - super().__init__() - self.num_layers = num_layers - h = [hidden_dim] * (num_layers - 1) - # self.layers = nn.ModuleList(nn.Linear(n, k) for n, k in zip([input_dim] + h, h + [output_dim])) - self.layers = nn.ModuleList( - nn.Conv1d(n, k, kernel_size=kernel_size, stride=1, padding=kernel_size//2, dilation=1, groups=1, bias=True, padding_mode='zeros') - for n, k in zip([input_dim] + h, h + [output_dim])) - def forward(self, x): - x = x.permute(0,2,1) - for i, layer in enumerate(self.layers): - x = F.relu(layer(x)) if i < self.num_layers - 1 else layer(x) - return x.permute(0, 2, 1) - -class LinearLayer(nn.Module): - """linear layer configurable with layer normalization, dropout, ReLU.""" - - def __init__(self, in_hsz, out_hsz, layer_norm=True, dropout=0.1, relu=True): - super(LinearLayer, self).__init__() - self.relu = relu - self.layer_norm = layer_norm - if layer_norm: - self.LayerNorm = nn.LayerNorm(in_hsz) - layers = [ - nn.Dropout(dropout), - nn.Linear(in_hsz, out_hsz) - ] - self.net = nn.Sequential(*layers) - - def forward(self, x): - """(N, L, D)""" - if self.layer_norm: - x = self.LayerNorm(x) - x = self.net(x) - if self.relu: - x = F.relu(x, inplace=True) - return x # (N, L, D) - - -def build_model(args): - device = torch.device(args.device) - - transformer = build_transformer(args) - position_embedding, txt_position_embedding = build_position_encoding(args) - - model = Model( - transformer, - position_embedding, - txt_position_embedding, - txt_dim=args.t_feat_dim, - vid_dim=args.v_feat_dim, - input_dropout=args.input_dropout, - span_loss_type=args.span_loss_type, - use_txt_pos=args.use_txt_pos, - n_input_proj=args.n_input_proj, - ) - - matcher = build_matcher(args) - weight_dict = {"loss_b": args.b_loss_coef, - "loss_g": args.g_loss_coef, - "loss_f": args.f_loss_coef, - "loss_s_intra": args.s_loss_intra_coef, - "loss_s_inter": args.s_loss_inter_coef} - - if args.dset_type in ['mr', 'vlp']: - if 'tal' not in args.train_path: - losses = ['spans', 'labels', 'saliency'] - else: - losses = ['spans', 'labels', 'saliency_cls'] - elif args.dset_type in ['hl', 'vs']: - losses = ['labels', 'saliency'] - - criterion = SetCriterion( - matcher=matcher, - weight_dict=weight_dict, losses=losses, - eos_coef=args.eos_coef, temperature=args.temperature, - span_loss_type=args.span_loss_type, max_v_l=args.max_v_l, - saliency_margin=args.saliency_margin, - ) - criterion.to(device) - return model, criterion \ No newline at end of file diff --git a/spaces/Kimata/Sanskrit-TTS/indic_nlp_library/indicnlp/test/__init__.py b/spaces/Kimata/Sanskrit-TTS/indic_nlp_library/indicnlp/test/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/spaces/KyanChen/FunSR/models/cnn_models/srcnn.py b/spaces/KyanChen/FunSR/models/cnn_models/srcnn.py deleted file mode 100644 index 33fae3b3e6e62d632a28a026c2e3c50b2742dc74..0000000000000000000000000000000000000000 --- a/spaces/KyanChen/FunSR/models/cnn_models/srcnn.py +++ /dev/null @@ -1,60 +0,0 @@ -from argparse import Namespace -import torch.nn as nn -from models import register -import torch.nn.functional as F - - -def make_model(args, parent=False): - return SRCNN(args) - - -@register('SRCNN') -def SRCNN(scale_ratio=1, rgb_range=1): - args = Namespace() - args.scale = scale_ratio - args.rgb_range = rgb_range - args.n_colors = 3 - return SRCNN(args) - - -class SRCNN(nn.Module): - def __init__(self, args): - super(SRCNN, self).__init__() - self.conv1 = nn.Conv2d(args.n_colors, 64, kernel_size=9, padding=9 // 2) - self.conv2 = nn.Conv2d(64, 32, kernel_size=5, padding=5 // 2) - self.conv3 = nn.Conv2d(32, args.n_colors, kernel_size=5, padding=5 // 2) - self.relu = nn.ReLU(inplace=True) - self.scale = args.scale - - def forward(self, x, out_size): - x = F.interpolate(x, out_size, mode='bicubic') - x = self.relu(self.conv1(x)) - x = self.relu(self.conv2(x)) - x = self.conv3(x) - return x - - def load_state_dict(self, state_dict, strict=False): - own_state = self.state_dict() - for name, param in state_dict.items(): - if name in own_state: - if isinstance(param, nn.Parameter): - param = param.data - try: - own_state[name].copy_(param) - except Exception: - if name.find('tail') >= 0: - print('Replace pre-trained upsampler to new one...') - else: - raise RuntimeError('While copying the parameter named {}, ' - 'whose dimensions in the model are {} and ' - 'whose dimensions in the checkpoint are {}.' - .format(name, own_state[name].size(), param.size())) - elif strict: - if name.find('tail') == -1: - raise KeyError('unexpected key "{}" in state_dict' - .format(name)) - - if strict: - missing = set(own_state.keys()) - set(state_dict.keys()) - if len(missing) > 0: - raise KeyError('missing keys in state_dict: "{}"'.format(missing)) \ No newline at end of file diff --git a/spaces/KyanChen/RSPrompter/mmdet/models/layers/normed_predictor.py b/spaces/KyanChen/RSPrompter/mmdet/models/layers/normed_predictor.py deleted file mode 100644 index 9fb40c71c425ee1e01af255186be7517cd63552a..0000000000000000000000000000000000000000 --- a/spaces/KyanChen/RSPrompter/mmdet/models/layers/normed_predictor.py +++ /dev/null @@ -1,98 +0,0 @@ -# Copyright (c) OpenMMLab. All rights reserved. -import torch -import torch.nn as nn -import torch.nn.functional as F -from torch import Tensor - -from mmdet.registry import MODELS - -MODELS.register_module('Linear', module=nn.Linear) - - -@MODELS.register_module(name='NormedLinear') -class NormedLinear(nn.Linear): - """Normalized Linear Layer. - - Args: - tempeature (float, optional): Tempeature term. Defaults to 20. - power (int, optional): Power term. Defaults to 1.0. - eps (float, optional): The minimal value of divisor to - keep numerical stability. Defaults to 1e-6. - """ - - def __init__(self, - *args, - tempearture: float = 20, - power: int = 1.0, - eps: float = 1e-6, - **kwargs) -> None: - super().__init__(*args, **kwargs) - self.tempearture = tempearture - self.power = power - self.eps = eps - self.init_weights() - - def init_weights(self) -> None: - """Initialize the weights.""" - nn.init.normal_(self.weight, mean=0, std=0.01) - if self.bias is not None: - nn.init.constant_(self.bias, 0) - - def forward(self, x: Tensor) -> Tensor: - """Forward function for `NormedLinear`.""" - weight_ = self.weight / ( - self.weight.norm(dim=1, keepdim=True).pow(self.power) + self.eps) - x_ = x / (x.norm(dim=1, keepdim=True).pow(self.power) + self.eps) - x_ = x_ * self.tempearture - - return F.linear(x_, weight_, self.bias) - - -@MODELS.register_module(name='NormedConv2d') -class NormedConv2d(nn.Conv2d): - """Normalized Conv2d Layer. - - Args: - tempeature (float, optional): Tempeature term. Defaults to 20. - power (int, optional): Power term. Defaults to 1.0. - eps (float, optional): The minimal value of divisor to - keep numerical stability. Defaults to 1e-6. - norm_over_kernel (bool, optional): Normalize over kernel. - Defaults to False. - """ - - def __init__(self, - *args, - tempearture: float = 20, - power: int = 1.0, - eps: float = 1e-6, - norm_over_kernel: bool = False, - **kwargs) -> None: - super().__init__(*args, **kwargs) - self.tempearture = tempearture - self.power = power - self.norm_over_kernel = norm_over_kernel - self.eps = eps - - def forward(self, x: Tensor) -> Tensor: - """Forward function for `NormedConv2d`.""" - if not self.norm_over_kernel: - weight_ = self.weight / ( - self.weight.norm(dim=1, keepdim=True).pow(self.power) + - self.eps) - else: - weight_ = self.weight / ( - self.weight.view(self.weight.size(0), -1).norm( - dim=1, keepdim=True).pow(self.power)[..., None, None] + - self.eps) - x_ = x / (x.norm(dim=1, keepdim=True).pow(self.power) + self.eps) - x_ = x_ * self.tempearture - - if hasattr(self, 'conv2d_forward'): - x_ = self.conv2d_forward(x_, weight_) - else: - if torch.__version__ >= '1.8': - x_ = self._conv_forward(x_, weight_, self.bias) - else: - x_ = self._conv_forward(x_, weight_) - return x_ diff --git a/spaces/Laihiujin/OneFormer/oneformer/data/datasets/register_coco_panoptic2instance.py b/spaces/Laihiujin/OneFormer/oneformer/data/datasets/register_coco_panoptic2instance.py deleted file mode 100644 index 79e1a95c95b2ec9e39e0ca0750dc44bf19bba3a0..0000000000000000000000000000000000000000 --- a/spaces/Laihiujin/OneFormer/oneformer/data/datasets/register_coco_panoptic2instance.py +++ /dev/null @@ -1,44 +0,0 @@ -# ------------------------------------------------------------------------------ -# Reference: https://github.com/facebookresearch/detectron2/blob/main/detectron2/data/datasets/builtin.py -# Modified by Jitesh Jain (https://github.com/praeclarumjj3) -# ------------------------------------------------------------------------------ - - -""" -This file registers pre-defined datasets at hard-coded paths, and their metadata. - -We hard-code metadata for common datasets. This will enable: -1. Consistency check when loading the datasets -2. Use models on these standard datasets directly and run demos, - without having to download the dataset annotations - -We hard-code some paths to the dataset that's assumed to -exist in "./datasets/". - -Users SHOULD NOT use this file to create new dataset / metadata for new dataset. -To add new dataset, refer to the tutorial "docs/DATASETS.md". -""" - -import os -from detectron2.data.datasets.builtin_meta import _get_builtin_metadata -from detectron2.data.datasets.coco import register_coco_instances - - -_PREDEFINED_SPLITS_COCO = { - "coco_2017_val_panoptic2instance": ("coco/val2017", "coco/annotations/panoptic2instances_val2017.json"), -} - - -def register_panoptic2instances_coco(root): - for key, (image_root, json_file) in _PREDEFINED_SPLITS_COCO.items(): - # Assume pre-defined datasets live in `./datasets`. - register_coco_instances( - key, - _get_builtin_metadata("coco"), - os.path.join(root, json_file) if "://" not in json_file else json_file, - os.path.join(root, image_root), - ) - - -_root = os.path.expanduser(os.getenv("DETECTRON2_DATASETS", "datasets")) -register_panoptic2instances_coco(_root) \ No newline at end of file diff --git a/spaces/Lbin123/Lbingo/src/components/toaster.tsx b/spaces/Lbin123/Lbingo/src/components/toaster.tsx deleted file mode 100644 index 4d2693460b61307a1d4c127fd01df9bee16e59ff..0000000000000000000000000000000000000000 --- a/spaces/Lbin123/Lbingo/src/components/toaster.tsx +++ /dev/null @@ -1,3 +0,0 @@ -'use client' - -export { Toaster } from 'react-hot-toast' diff --git a/spaces/LightChen2333/OpenSLU/common/model_manager.py b/spaces/LightChen2333/OpenSLU/common/model_manager.py deleted file mode 100644 index c2969529bbccf0ee37ab24aff851e002ea5ba3bf..0000000000000000000000000000000000000000 --- a/spaces/LightChen2333/OpenSLU/common/model_manager.py +++ /dev/null @@ -1,419 +0,0 @@ -''' -Author: Qiguang Chen -Date: 2023-01-11 10:39:26 -LastEditors: Qiguang Chen -LastEditTime: 2023-02-19 18:50:11 -Description: manage all process of model training and prediction. - -''' -import math -import os -import queue -import random - -import numpy as np -import torch -from tqdm import tqdm - - -from common import utils -from common.loader import DataFactory -from common.logger import Logger -from common.metric import Evaluator -from common.saver import Saver -from common.tokenizer import get_tokenizer, get_tokenizer_class, load_embedding -from common.utils import InputData, instantiate -from common.utils import OutputData -from common.config import Config -import dill -from common import global_pool -from tools.load_from_hugging_face import PreTrainedTokenizerForSLU, PretrainedModelForSLU -# from tools.hugging_face_parser import load_model, load_tokenizer - - -class ModelManager(object): - def __init__(self, config: Config): - """create model manager by config - - Args: - config (Config): configuration to manage all process in OpenSLU - """ - # init config - global_pool._init() - self.config = config - self.__set_seed(self.config.base.get("seed")) - self.device = self.config.base.get("device") - self.load_dir = self.config.model_manager.get("load_dir") - if self.config.get("logger") and self.config["logger"].get("logger_type"): - logger_type = self.config["logger"].get("logger_type") - else: - logger_type = "wandb" - # enable accelerator - if "accelerator" in self.config and self.config["accelerator"].get("use_accelerator"): - from accelerate import Accelerator - self.accelerator = Accelerator(log_with=logger_type) - else: - self.accelerator = None - self.tokenizer = None - self.saver = Saver(self.config.model_manager, start_time=self.config.start_time) - if self.config.base.get("train"): - self.model = None - self.optimizer = None - self.total_step = None - self.lr_scheduler = None - self.init_step = 0 - self.best_metric = 0 - self.logger = Logger(logger_type=logger_type, - logger_name=self.config.base["name"], - start_time=self.config.start_time, - accelerator=self.accelerator) - global_pool.set_value("logger", self.logger) - - def init_model(self): - """init model, optimizer, lr_scheduler - - Args: - model (Any): pytorch model - """ - self.prepared = False - if self.load_dir is not None: - self.load() - self.config.set_vocab_size(self.tokenizer.vocab_size) - self.init_data() - if self.config.base.get("train") and self.config.model_manager.get("load_train_state"): - train_state = torch.load(os.path.join( - self.load_dir, "train_state.pkl"), pickle_module=dill) - self.optimizer = instantiate( - self.config["optimizer"])(self.model.parameters()) - self.lr_scheduler = instantiate(self.config["scheduler"])( - optimizer=self.optimizer, - num_training_steps=self.total_step - ) - self.optimizer.load_state_dict(train_state["optimizer"]) - self.optimizer.zero_grad() - self.lr_scheduler.load_state_dict(train_state["lr_scheduler"]) - self.init_step = train_state["step"] - self.best_metric = train_state["best_metric"] - elif self.config.model.get("_from_pretrained_") and self.config.tokenizer.get("_from_pretrained_"): - self.from_pretrained() - self.config.set_vocab_size(self.tokenizer.vocab_size) - self.init_data() - else: - self.tokenizer = get_tokenizer( - self.config.tokenizer.get("_tokenizer_name_")) - self.init_data() - self.model = instantiate(self.config.model) - self.model.to(self.device) - if self.config.base.get("train"): - self.optimizer = instantiate( - self.config["optimizer"])(self.model.parameters()) - self.lr_scheduler = instantiate(self.config["scheduler"])( - optimizer=self.optimizer, - num_training_steps=self.total_step - ) - - - def init_data(self): - self.data_factory = DataFactory(tokenizer=self.tokenizer, - use_multi_intent=self.config.base.get("multi_intent"), - to_lower_case=self.config.tokenizer.get("_to_lower_case_")) - batch_size = self.config.base["batch_size"] - # init tokenizer config and dataloaders - tokenizer_config = {key: self.config.tokenizer[key] - for key in self.config.tokenizer if key[0] != "_" and key[-1] != "_"} - - if self.config.base.get("train"): - # init dataloader & load data - - - train_dataset = self.data_factory.load_dataset(self.config.dataset, split="train") - - # update label and vocabulary (ONLY SUPPORT FOR "word_tokenizer") - self.data_factory.update_label_names(train_dataset) - self.data_factory.update_vocabulary(train_dataset) - - - self.train_dataloader = self.data_factory.get_data_loader(train_dataset, - batch_size, - shuffle=True, - device=self.device, - enable_label=True, - align_mode=self.config.tokenizer.get( - "_align_mode_"), - label2tensor=True, - **tokenizer_config) - self.total_step = int(self.config.base.get("epoch_num")) * len(self.train_dataloader) - dev_dataset = self.data_factory.load_dataset(self.config.dataset, split="validation") - self.dev_dataloader = self.data_factory.get_data_loader(dev_dataset, - batch_size, - shuffle=False, - device=self.device, - enable_label=True, - align_mode=self.config.tokenizer.get( - "_align_mode_"), - label2tensor=False, - **tokenizer_config) - self.data_factory.update_vocabulary(dev_dataset) - self.intent_list = None - self.intent_dict = None - self.slot_list = None - self.slot_dict = None - # add intent label num and slot label num to config - if self.config.model["decoder"].get("intent_classifier") and int(self.config.get_intent_label_num()) == 0: - self.intent_list = self.data_factory.intent_label_list - self.intent_dict = self.data_factory.intent_label_dict - self.config.set_intent_label_num(len(self.intent_list)) - if self.config.model["decoder"].get("slot_classifier") and int(self.config.get_slot_label_num()) == 0: - self.slot_list = self.data_factory.slot_label_list - self.slot_dict = self.data_factory.slot_label_dict - self.config.set_slot_label_num(len(self.slot_list)) - - - - # autoload embedding for non-pretrained encoder - if self.config["model"]["encoder"].get("embedding") and self.config["model"]["encoder"]["embedding"].get( - "load_embedding_name"): - self.config["model"]["encoder"]["embedding"]["embedding_matrix"] = load_embedding(self.tokenizer, - self.config["model"][ - "encoder"][ - "embedding"].get( - "load_embedding_name")) - # fill template in config - self.config.autoload_template() - # save config - self.logger.set_config(self.config) - self.saver.save_tokenizer(self.tokenizer) - self.saver.save_label(self.intent_list, self.slot_list) - self.config.set_vocab_size(self.tokenizer.vocab_size) - - if self.config.base.get("test"): - self.test_dataset = self.data_factory.load_dataset(self.config.dataset, split="test") - self.test_dataloader = self.data_factory.get_data_loader(self.test_dataset, - batch_size, - shuffle=False, - device=self.device, - enable_label=True, - align_mode=self.config.tokenizer.get( - "_align_mode_"), - label2tensor=False, - **tokenizer_config) - - def eval(self, step: int, best_metric: float) -> float: - """ evaluation models. - - Args: - step (int): which step the model has trained in - best_metric (float): last best metric value to judge whether to test or save model - - Returns: - float: updated best metric value - """ - # TODO: save dev - _, res = self.__evaluate(self.model, self.dev_dataloader, mode="dev") - self.logger.log_metric(res, metric_split="dev", step=step) - if res[self.config.evaluator.get("best_key")] > best_metric: - best_metric = res[self.config.evaluator.get("best_key")] - train_state = { - "step": step, - "best_metric": best_metric, - "optimizer": self.optimizer.state_dict(), - "lr_scheduler": self.lr_scheduler.state_dict() - } - self.saver.save_model(self.model, train_state, self.accelerator) - if self.config.base.get("test"): - outputs, test_res = self.__evaluate(self.model, self.test_dataloader, mode="test") - self.saver.save_output(outputs, self.test_dataset) - self.logger.log_metric(test_res, metric_split="test", step=step) - return best_metric - - def train(self) -> float: - """ train models. - - Returns: - float: updated best metric value - """ - self.model.train() - if self.accelerator is not None: - self.total_step = math.ceil(self.total_step / self.accelerator.num_processes) - if self.optimizer is None: - self.optimizer = instantiate(self.config["optimizer"])(self.model.parameters()) - if self.lr_scheduler is None: - self.lr_scheduler = instantiate(self.config["scheduler"])( - optimizer=self.optimizer, - num_training_steps=self.total_step - ) - if not self.prepared and self.accelerator is not None: - self.model, self.optimizer, self.train_dataloader, self.lr_scheduler = self.accelerator.prepare( - self.model, self.optimizer, self.train_dataloader, self.lr_scheduler) - step = self.init_step - progress_bar = tqdm(range(self.total_step)) - progress_bar.update(self.init_step) - self.optimizer.zero_grad() - for _ in range(int(self.config.base.get("epoch_num"))): - for data in self.train_dataloader: - if step == 0: - self.logger.info(data.get_item( - 0, tokenizer=self.tokenizer, intent_map=self.intent_list, slot_map=self.slot_list)) - output = self.model(data) - if self.accelerator is not None and hasattr(self.model, "module"): - loss, intent_loss, slot_loss = self.model.module.compute_loss( - pred=output, target=data) - else: - loss, intent_loss, slot_loss = self.model.compute_loss( - pred=output, target=data) - self.logger.log_loss(loss, "Loss", step=step) - self.logger.log_loss(intent_loss, "Intent Loss", step=step) - self.logger.log_loss(slot_loss, "Slot Loss", step=step) - self.optimizer.zero_grad() - - if self.accelerator is not None: - self.accelerator.backward(loss) - else: - loss.backward() - self.optimizer.step() - self.lr_scheduler.step() - train_state = { - "step": step, - "best_metric": self.best_metric, - "optimizer": self.optimizer.state_dict(), - "lr_scheduler": self.lr_scheduler.state_dict() - } - if not self.saver.auto_save_step(self.model, train_state, self.accelerator): - if not self.config.evaluator.get("eval_by_epoch") and step % self.config.evaluator.get("eval_step") == 0 and step != 0: - self.best_metric = self.eval(step, self.best_metric) - step += 1 - progress_bar.update(1) - if self.config.evaluator.get("eval_by_epoch"): - self.best_metric = self.eval(step, self.best_metric) - self.logger.finish() - return self.best_metric - - def test(self): - return self.__evaluate(self.model, self.test_dataloader, mode="test") - - def __set_seed(self, seed_value: int): - """Manually set random seeds. - - Args: - seed_value (int): random seed - """ - random.seed(seed_value) - np.random.seed(seed_value) - torch.manual_seed(seed_value) - torch.random.manual_seed(seed_value) - os.environ['PYTHONHASHSEED'] = str(seed_value) - if torch.cuda.is_available(): - torch.cuda.manual_seed(seed_value) - torch.cuda.manual_seed_all(seed_value) - torch.backends.cudnn.deterministic = True - torch.backends.cudnn.benchmark = True - return - - def __evaluate(self, model, dataloader, mode="dev"): - model.eval() - inps = InputData() - outputs = OutputData() - for data in dataloader: - torch.cuda.empty_cache() - output = model(data) - if self.accelerator is not None and hasattr(self.model, "module"): - decode_output = model.module.decode(output, data) - else: - decode_output = model.decode(output, data) - - decode_output.map_output(slot_map=self.slot_list, - intent_map=self.intent_list) - if self.config.model["decoder"].get("slot_classifier"): - data, decode_output = utils.remove_slot_ignore_index( - data, decode_output, ignore_index="#") - - inps.merge_input_data(data) - outputs.merge_output_data(decode_output) - if "metric" in self.config.evaluator: - res = Evaluator.compute_all_metric( - inps, outputs, intent_label_map=self.intent_dict, metric_list=self.config.evaluator["metric"]) - else: - res = Evaluator.compute_all_metric( - inps, outputs, intent_label_map=self.intent_dict) - self.logger.info(f"Best {mode} metric: "+str(res)) - model.train() - return outputs, res - - def load(self): - - if self.tokenizer is None: - with open(os.path.join(self.load_dir, "tokenizer.pkl"), 'rb') as f: - self.tokenizer = dill.load(f) - label = utils.load_json(os.path.join(self.load_dir, "label.json")) - if label["intent"] is None: - self.intent_list = None - self.intent_dict = None - else: - self.intent_list = label["intent"] - self.intent_dict = {x: i for i, x in enumerate(label["intent"])} - self.config.set_intent_label_num(len(self.intent_list)) - if label["slot"] is None: - self.slot_list = None - self.slot_dict = None - else: - self.slot_list = label["slot"] - self.slot_dict = {x: i for i, x in enumerate(label["slot"])} - self.config.set_slot_label_num(len(self.slot_list)) - self.config.set_vocab_size(self.tokenizer.vocab_size) - if self.accelerator is not None and self.load_dir is not None: - self.model = torch.load(os.path.join(self.load_dir, "model.pkl"), map_location=torch.device(self.device)) - self.prepared = True - self.accelerator.load_state(self.load_dir) - self.accelerator.prepare_model(self.model) - else: - self.model = torch.load(os.path.join( - self.load_dir, "model.pkl"), map_location=torch.device(self.device)) - # if self.config.tokenizer["_tokenizer_name_"] == "word_tokenizer": - # self.tokenizer = get_tokenizer_class(self.config.tokenizer["_tokenizer_name_"]).from_file(os.path.join(self.load_dir, "tokenizer.json")) - # else: - # self.tokenizer = get_tokenizer(self.config.tokenizer["_tokenizer_name_"]) - self.model.to(self.device) - - - def from_pretrained(self): - self.config.autoload_template() - model = PretrainedModelForSLU.from_pretrained(self.config.model["_from_pretrained_"]) - # model = load_model(self.config.model["_from_pretrained_"]) - self.model = model.model - if self.tokenizer is None: - self.tokenizer = PreTrainedTokenizerForSLU.from_pretrained( - self.config.tokenizer["_from_pretrained_"]) - self.config.tokenizer = model.config.tokenizer - # self.tokenizer = load_tokenizer(self.config.tokenizer["_from_pretrained_"]) - - self.model.to(self.device) - label = model.config._id2label - self.config.model = model.config.model - self.intent_list = label["intent"] - self.slot_list = label["slot"] - self.intent_dict = {x: i for i, x in enumerate(label["intent"])} - self.slot_dict = {x: i for i, x in enumerate(label["slot"])} - - def predict(self, text_data): - self.model.eval() - tokenizer_config = {key: self.config.tokenizer[key] - for key in self.config.tokenizer if key[0] != "_" and key[-1] != "_"} - align_mode = self.config.tokenizer.get("_align_mode_") - inputs = self.data_factory.batch_fn(batch=[{"text": text_data.split(" ")}], - device=self.device, - config=tokenizer_config, - enable_label=False, - align_mode=align_mode if align_mode is not None else "general", - label2tensor=False) - output = self.model(inputs) - decode_output = self.model.decode(output, inputs) - decode_output.map_output(slot_map=self.slot_list, - intent_map=self.intent_list) - if self.config.base.get("multi_intent"): - intent = decode_output.intent_ids[0] - else: - intent = [decode_output.intent_ids[0]] - input_ids = inputs.input_ids[0].tolist() - tokens = [self.tokenizer.decode(ids) for ids in input_ids] - slots = decode_output.slot_ids[0] - return {"intent": intent, "slot": slots, "text": tokens} diff --git a/spaces/ML701G7/taim-gan/src/config.py b/spaces/ML701G7/taim-gan/src/config.py deleted file mode 100644 index 3e62f69b18f24ea4126d62d5a593ccd49f62af91..0000000000000000000000000000000000000000 --- a/spaces/ML701G7/taim-gan/src/config.py +++ /dev/null @@ -1,47 +0,0 @@ -"""Configurations for the project.""" -from pathlib import Path -from typing import Any, Dict - -import torch - -device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu") - -repo_path = Path(__file__).parent.parent.absolute() -output_path = repo_path / "models" - -config_dict = { - "Ng": 32, - "D": 256, - "condition_dim": 100, - "noise_dim": 100, - "lr_config": { - "disc_lr": 2e-4, - "gen_lr": 2e-4, - "img_encoder_lr": 3e-3, - "text_encoder_lr": 3e-3, - }, - "batch_size": 64, - "device": device, - "epochs": 200, - "output_dir": output_path, - "snapshot": 5, - "const_dict": { - "smooth_val_gen": 0.999, - "lambda1": 1, - "lambda2": 1, - "lambda3": 1, - "lambda4": 1, - "gamma1": 4, - "gamma2": 5, - "gamma3": 10, - }, -} - - -def update_config(cfg_dict: Dict[str, Any], **kwargs: Any) -> Dict[str, Any]: - """ - Function to update the configuration dictionary. - """ - for key, value in kwargs.items(): - cfg_dict[key] = value - return cfg_dict diff --git a/spaces/MLVKU/Human_Object_Interaction/hotr/engine/__init__.py b/spaces/MLVKU/Human_Object_Interaction/hotr/engine/__init__.py deleted file mode 100644 index 2a12709af056e0ef9b0966aa7bc59da5912e799e..0000000000000000000000000000000000000000 --- a/spaces/MLVKU/Human_Object_Interaction/hotr/engine/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -from .evaluator_vcoco import vcoco_evaluate, vcoco_accumulate -from .evaluator_hico import hico_evaluate - -def hoi_evaluator(args, model, criterion, postprocessors, data_loader, device, thr=0): - if args.dataset_file == 'vcoco': - return vcoco_evaluate(model, criterion, postprocessors, data_loader, device, args.output_dir, thr,args=args) - elif args.dataset_file == 'hico-det': - return hico_evaluate(model, postprocessors, data_loader, device, thr,args=args) - else: raise NotImplementedError - -def hoi_accumulator(args, total_res, print_results=False, wandb=False): - if args.dataset_file == 'vcoco': - return vcoco_accumulate(total_res, args, print_results, wandb) - else: raise NotImplementedError \ No newline at end of file diff --git a/spaces/MLVKU/Human_Object_Interaction/tools/vis_tool.py b/spaces/MLVKU/Human_Object_Interaction/tools/vis_tool.py deleted file mode 100644 index 3140594a58b332fedf7189d1568ad3e7e4084d0c..0000000000000000000000000000000000000000 --- a/spaces/MLVKU/Human_Object_Interaction/tools/vis_tool.py +++ /dev/null @@ -1,96 +0,0 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -import numpy as np -import cv2 - - -vcoco_action_string = {2: 'hold', 3: 'stand', 4: 'sit', 5: 'ride', 6: 'walk',\ - 7: 'look', 8: 'hit_inst', 9: 'hit_obj', 10: 'eat_obj', \ - 11: 'eat_inst', 12: 'jump', 13: 'lay', 14: 'talk', 15: \ - 'carry', 16: 'throw', 17: 'catch', 18: 'cut_inst', 19:'cut_obj', \ - 20: 'run', 21: 'work_on_comp', 22: 'ski', 23: 'surf', 24: 'skateboard', \ - 25: 'smile', 26: 'drink', 27: 'kick', 28: 'point', 29: 'read', 30: 'snowboard'} -def draw_box_on_img(box, img,color=None): - - vis_img = img.copy() - box = [int(x) for x in box] - cv2.rectangle(vis_img, (box[0], box[1]), (box[2], box[3]), color, 2) - draw_point=[int((box[0]+box[2])*1.0/2),int((box[1]+box[3])*1.0/2)] - - return vis_img,color - - -def draw_line_on_img_vcoco(box,line, img, class_index,color): - - vis_img = img.copy() - font=cv2.FONT_HERSHEY_SIMPLEX - x=int(box[0])+2 - y=int(box[1])+2 - f=int(box[1])+2 - for i in range(len(class_index)): - - font_scale=1 - font_thickness=2 - - text_size, _ = cv2.getTextSize(vcoco_action_string[class_index[i]] , font, font_scale, font_thickness) - vis_img=cv2.rectangle(vis_img,(x,y),(x+text_size[0],y+text_size[1]+5),color[1],-1) - - - vis_img=cv2.putText(vis_img, vcoco_action_string[class_index[i]] ,(x,y + text_size[1] ),font,font_scale,[51,255,153],font_thickness) - y=y+text_size[1]+5 - - return vis_img,y - - -def draw_img_vcoco(img, output_i, top_k,threshold,color): - list_action = [] - for action in output_i['hoi_prediction']: - subject_id = action['subject_id'] - object_id = action['object_id'] - category_id = action['category_id'] - score = action['score'] - single_out = [subject_id,object_id,category_id,score] - list_action.append(single_out) - list_action = sorted(list_action, key=lambda x:x[-1], reverse=True) - action_dict = [] - action_cate = [] - action_color=[] - subj_box=[] - sb={} - sbj=[] - for action in list_action[:top_k]: - - subject_id,object_id,category_id,score = action - if score<threshold: - break - subject_obj = output_i['predictions'][subject_id] - subject_box = subject_obj['bbox'] - object_obj = output_i['predictions'][object_id] - object_box = object_obj['bbox'] - - point_1 = [int((subject_box[0]+subject_box[2])*1.0/2),int((subject_box[1]+subject_box[3])*1.0/2)] - point_2 = [int((object_box[0]+object_box[2])*1.0/2),int((object_box[1]+object_box[3])*1.0/2)] - - if [point_1,point_2] not in action_dict: - - img,color_hum = draw_box_on_img(subject_box, img, color[subject_obj['category_id']]['color']) - - img,color_obj = draw_box_on_img(object_box, img, color[object_obj['category_id']]['color']) - - action_dict.append([point_1,point_2]) - action_color.append([color_hum,color_obj]) - subj_box.append([int(subject_box[0]),int(subject_box[1])]) - - action_cate.append([]) - action_cate[action_dict.index([point_1,point_2])].append(category_id) - - for i,(action_item,clr) in enumerate(zip(action_dict,action_color)): - - img,offset = draw_line_on_img_vcoco(subj_box[i],action_item,img,action_cate[action_dict.index(action_item)],clr) - - for p in range(i+1,len(subj_box)): - if subj_box[p]==subj_box[i]: - subj_box[p][1]=offset - return img \ No newline at end of file diff --git a/spaces/Mahiruoshi/Lovelive-Nijigasaku-Chat-iSTFT-GPT3/app.py b/spaces/Mahiruoshi/Lovelive-Nijigasaku-Chat-iSTFT-GPT3/app.py deleted file mode 100644 index 443aa4223ecf2ce3be6dca35be383a5e7401a4fa..0000000000000000000000000000000000000000 --- a/spaces/Mahiruoshi/Lovelive-Nijigasaku-Chat-iSTFT-GPT3/app.py +++ /dev/null @@ -1,300 +0,0 @@ -import logging -logging.getLogger('numba').setLevel(logging.WARNING) -logging.getLogger('matplotlib').setLevel(logging.WARNING) -logging.getLogger('urllib3').setLevel(logging.WARNING) -import json -import re -import numpy as np -import IPython.display as ipd -import torch -import commons -import utils -from models import SynthesizerTrn -from text.symbols import symbols -from text import text_to_sequence -import gradio as gr -import time -import datetime -import os -import pickle -import openai -from scipy.io.wavfile import write -def is_japanese(string): - for ch in string: - if ord(ch) > 0x3040 and ord(ch) < 0x30FF: - return True - return False - -def is_english(string): - import re - pattern = re.compile('^[A-Za-z0-9.,:;!?()_*"\' ]+$') - if pattern.fullmatch(string): - return True - else: - return False - -def to_html(chat_history): - chat_html = "" - for item in chat_history: - if item['role'] == 'user': - chat_html += f""" - <div style="margin-bottom: 20px;"> - <div style="text-align: right; margin-right: 20px;"> - <span style="background-color: #4CAF50; color: black; padding: 10px; border-radius: 10px; display: inline-block; max-width: 80%; word-wrap: break-word;"> - {item['content']} - </span> - </div> - </div> - """ - else: - chat_html += f""" - <div style="margin-bottom: 20px;"> - <div style="text-align: left; margin-left: 20px;"> - <span style="background-color: white; color: black; padding: 10px; border-radius: 10px; display: inline-block; max-width: 80%; word-wrap: break-word;"> - {item['content']} - </span> - </div> - </div> - """ - output_html = f""" - <div style="height: 400px; overflow-y: scroll; padding: 10px;"> - {chat_html} - </div> - """ - return output_html - -def extrac(text): - text = re.sub("<[^>]*>","",text) - result_list = re.split(r'\n', text) - final_list = [] - for i in result_list: - if is_english(i): - i = romajitable.to_kana(i).katakana - i = i.replace('\n','').replace(' ','') - #Current length of single sentence: 20 - if len(i)>1: - if len(i) > 20: - try: - cur_list = re.split(r'。|!', i) - for i in cur_list: - if len(i)>1: - final_list.append(i+'。') - except: - pass - else: - final_list.append(i) - final_list = [x for x in final_list if x != ''] - print(final_list) - return final_list - -def to_numpy(tensor: torch.Tensor): - return tensor.detach().cpu().numpy() if tensor.requires_grad \ - else tensor.detach().numpy() - -def chatgpt(text): - messages = [] - try: - with open('log.pickle', 'rb') as f: - messages = pickle.load(f) - messages.append({"role": "user", "content": text},) - chat = openai.ChatCompletion.create(model="gpt-3.5-turbo", messages=messages) - reply = chat.choices[0].message.content - messages.append({"role": "assistant", "content": reply}) - print(messages[-1]) - if len(messages) == 12: - messages[6:10] = messages[8:] - del messages[-2:] - with open('log.pickle', 'wb') as f: - messages2 = [] - pickle.dump(messages2, f) - return reply,messages - except: - messages.append({"role": "user", "content": text},) - chat = openai.ChatCompletion.create(model="gpt-3.5-turbo", messages=messages) - reply = chat.choices[0].message.content - messages.append({"role": "assistant", "content": reply}) - print(messages[-1]) - if len(messages) == 12: - messages[6:10] = messages[8:] - del messages[-2:] - with open('log.pickle', 'wb') as f: - pickle.dump(messages, f) - return reply,messages - -def get_symbols_from_json(path): - assert os.path.isfile(path) - with open(path, 'r') as f: - data = json.load(f) - return data['symbols'] - -def sle(language,text): - text = text.replace('\n', ' ').replace('\r', '').replace(" ", "") - if language == "中文": - tts_input1 = "[ZH]" + text + "[ZH]" - return tts_input1 - elif language == "自动": - tts_input1 = f"[JA]{text}[JA]" if is_japanese(text) else f"[ZH]{text}[ZH]" - return tts_input1 - elif language == "日文": - tts_input1 = "[JA]" + text + "[JA]" - return tts_input1 - elif language == "英文": - tts_input1 = "[EN]" + text + "[EN]" - return tts_input1 - elif language == "手动": - return text - -def get_text(text,hps_ms): - text_norm = text_to_sequence(text,hps_ms.data.text_cleaners) - if hps_ms.data.add_blank: - text_norm = commons.intersperse(text_norm, 0) - text_norm = torch.LongTensor(text_norm) - return text_norm - -def create_tts_fn(net_g,hps,speaker_id): - speaker_id = int(speaker_id) - def tts_fn(is_gpt,api_key,is_audio,audiopath,repeat_time,text, language, extract, n_scale= 0.667,n_scale_w = 0.8, l_scale = 1 ): - repeat_ime = int(repeat_time) - if is_gpt: - openai.api_key = api_key - text,messages = chatgpt(text) - htm = to_html(messages) - else: - htm = '' - if not extract: - t1 = time.time() - stn_tst = get_text(sle(language,text),hps) - with torch.no_grad(): - x_tst = stn_tst.unsqueeze(0).to(dev) - x_tst_lengths = torch.LongTensor([stn_tst.size(0)]).to(dev) - sid = torch.LongTensor([speaker_id]).to(dev) - audio = net_g.infer(x_tst, x_tst_lengths, sid=sid, noise_scale=n_scale, noise_scale_w=n_scale_w, length_scale=l_scale)[0][0,0].data.cpu().float().numpy() - t2 = time.time() - spending_time = "推理时间为:"+str(t2-t1)+"s" - print(spending_time) - file_path = "subtitles.srt" - try: - write(audiopath + '.wav',22050,audio) - if is_audio: - for i in range(repeat_time): - cmd = 'ffmpeg -y -i ' + audiopath + '.wav' + ' -ar 44100 '+ audiopath.replace('temp','temp'+str(i)) - os.system(cmd) - except: - pass - return (hps.data.sampling_rate, audio),file_path,htm - else: - a = ['【','[','(','('] - b = ['】',']',')',')'] - for i in a: - text = text.replace(i,'<') - for i in b: - text = text.replace(i,'>') - final_list = extrac(text.replace('“','').replace('”','')) - audio_fin = [] - c = 0 - t = datetime.timedelta(seconds=0) - for sentence in final_list: - try: - f1 = open("subtitles.srt",'w',encoding='utf-8') - c +=1 - stn_tst = get_text(sle(language,sentence),hps) - with torch.no_grad(): - x_tst = stn_tst.unsqueeze(0).to(dev) - x_tst_lengths = torch.LongTensor([stn_tst.size(0)]).to(dev) - sid = torch.LongTensor([speaker_id]).to(dev) - t1 = time.time() - audio = net_g.infer(x_tst, x_tst_lengths, sid=sid, noise_scale=n_scale, noise_scale_w=n_scale_w, length_scale=l_scale)[0][0,0].data.cpu().float().numpy() - t2 = time.time() - spending_time = "第"+str(c)+"句的推理时间为:"+str(t2-t1)+"s" - print(spending_time) - time_start = str(t).split(".")[0] + "," + str(t.microseconds)[:3] - last_time = datetime.timedelta(seconds=len(audio)/float(22050)) - t+=last_time - time_end = str(t).split(".")[0] + "," + str(t.microseconds)[:3] - print(time_end) - f1.write(str(c-1)+'\n'+time_start+' --> '+time_end+'\n'+sentence+'\n\n') - audio_fin.append(audio) - except: - pass - try: - write(audiopath + '.wav',22050,np.concatenate(audio_fin)) - if is_audio: - for i in range(repeat_time): - cmd = 'ffmpeg -y -i ' + audiopath + '.wav' + ' -ar 44100 '+ audiopath.replace('temp','temp'+str(i)) - os.system(cmd) - - except: - pass - - file_path = "subtitles.srt" - return (hps.data.sampling_rate, np.concatenate(audio_fin)),file_path,htm - return tts_fn - -if __name__ == '__main__': - hps = utils.get_hparams_from_file('checkpoints/Nijigaku/config.json') - dev = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") - models = [] - schools = ["Nijigasaki High School"] - lan = ["中文","日文","自动","手动"] - with open("checkpoints/info.json", "r", encoding="utf-8") as f: - models_info = json.load(f) - net_g = SynthesizerTrn( - len(symbols), - hps.data.filter_length // 2 + 1, - hps.train.segment_size // hps.data.hop_length, - n_speakers=hps.data.n_speakers, - **hps.model).to(dev) - _ = net_g.eval() - _ = utils.load_checkpoint("checkpoints/Nijigaku/model.pth" , net_g) - for i in models_info: - school = models_info[i] - speakers = school["speakers"] - phone_dict = { - symbol: i for i, symbol in enumerate(symbols) - } - content = [] - for j in speakers: - sid = int(speakers[j]['sid']) - title = school - example = speakers[j]['speech'] - name = speakers[j]["name"] - content.append((sid, name, title, example, create_tts_fn(net_g,hps,sid))) - models.append(content) - - with gr.Blocks() as app: - with gr.Tabs(): - for i in schools: - with gr.TabItem(i): - for (sid, name, title, example, tts_fn) in models[schools.index(i)]: - with gr.TabItem(name): - with gr.Column(): - with gr.Row(): - with gr.Row(): - gr.Markdown( - '<div align="center">' - f'<img style="width:auto;height:400px;" src="file/image/{name}.png">' - '</div>' - ) - output_UI = gr.outputs.HTML() - with gr.Row(): - with gr.Column(scale=0.85): - input1 = gr.TextArea(label="Text", value=example,lines = 1) - with gr.Column(scale=0.15, min_width=0): - btnVC = gr.Button("Send") - output1 = gr.Audio(label="采样率22050") - with gr.Accordion(label="Setting(TTS)", open=False): - input2 = gr.Dropdown(label="Language", choices=lan, value="自动", interactive=True) - input4 = gr.Slider(minimum=0, maximum=1.0, label="更改噪声比例(noise scale),以控制情感", value=0.6) - input5 = gr.Slider(minimum=0, maximum=1.0, label="更改噪声偏差(noise scale w),以控制音素长短", value=0.668) - input6 = gr.Slider(minimum=0.1, maximum=10, label="duration", value=1) - with gr.Accordion(label="Advanced Setting(GPT3.5接口+长句子合成,建议克隆本仓库后运行main.py)", open=False): - input3 = gr.Checkbox(value=False, label="长句切割(小说合成)") - output2 = gr.outputs.File(label="字幕文件:subtitles.srt") - api_input1 = gr.Checkbox(value=False, label="接入chatgpt") - api_input2 = gr.TextArea(label="api-key",lines=1,value = '见 https://openai.com/blog/openai-api') - audio_input1 = gr.Checkbox(value=False, label="修改音频路径(live2d)") - audio_input2 = gr.TextArea(label="音频路径",lines=1,value = '#参考 D:/app_develop/live2d_whole/2010002/sounds/temp.wav') - audio_input3 = gr.Dropdown(label="重复生成次数", choices=list(range(101)), value='0', interactive=True) - btnVC.click(tts_fn, inputs=[api_input1,api_input2,audio_input1,audio_input2,audio_input3,input1,input2,input3,input4,input5,input6], outputs=[output1,output2,output_UI]) - - app.launch() \ No newline at end of file diff --git a/spaces/Make-A-Protagonist/Make-A-Protagonist-inference/Make-A-Protagonist/makeaprotagonist/pipelines/pipeline_stable_unclip_controlavideo.py b/spaces/Make-A-Protagonist/Make-A-Protagonist-inference/Make-A-Protagonist/makeaprotagonist/pipelines/pipeline_stable_unclip_controlavideo.py deleted file mode 100644 index 02c3e3ca996e227c5a7f7ad149250b47281abddc..0000000000000000000000000000000000000000 --- a/spaces/Make-A-Protagonist/Make-A-Protagonist-inference/Make-A-Protagonist/makeaprotagonist/pipelines/pipeline_stable_unclip_controlavideo.py +++ /dev/null @@ -1,1531 +0,0 @@ -# Copyright 2023 The HuggingFace Team. All rights reserved. -# -# 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. - -''' -NOTE This is with prior -When combined with an unCLIP prior, it can also be used for full text to image generation. - -NOTE this pipeline introduce controlnet into it -''' - -import inspect -from typing import Any, Callable, Dict, List, Optional, Union, Tuple - -import PIL -import torch -import torch.nn as nn -import numpy as np -from dataclasses import dataclass - -from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, CLIPVisionModelWithProjection, CLIPTextModelWithProjection -from transformers.models.clip.modeling_clip import CLIPTextModelOutput -from einops import rearrange - -from diffusers.utils.import_utils import is_accelerate_available - -from diffusers.loaders import TextualInversionLoaderMixin -from diffusers.models import AutoencoderKL, ControlNetModel, PriorTransformer -from diffusers.models.controlnet import ControlNetOutput -from diffusers.models.modeling_utils import ModelMixin -from diffusers.models.embeddings import get_timestep_embedding -from diffusers.schedulers import KarrasDiffusionSchedulers -from diffusers.utils import is_accelerate_version, logging, randn_tensor, replace_example_docstring, PIL_INTERPOLATION -from diffusers.pipeline_utils import DiffusionPipeline -from diffusers.pipelines.stable_diffusion.stable_unclip_image_normalizer import StableUnCLIPImageNormalizer - -from ..models.unet import UNet3DConditionModel -from diffusers.utils import deprecate, logging, BaseOutput -import ipdb -import warnings - -logger = logging.get_logger(__name__) # pylint: disable=invalid-name - -EXAMPLE_DOC_STRING = """ - Examples: - ```py - >>> import requests - >>> import torch - >>> from PIL import Image - >>> from io import BytesIO - - >>> from diffusers import StableUnCLIPImg2ImgPipeline - - >>> pipe = StableUnCLIPImg2ImgPipeline.from_pretrained( - ... "fusing/stable-unclip-2-1-l-img2img", torch_dtype=torch.float16 - ... ) # TODO update model path - >>> pipe = pipe.to("cuda") - - >>> url = "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/assets/stable-samples/img2img/sketch-mountains-input.jpg" - - >>> response = requests.get(url) - >>> init_image = Image.open(BytesIO(response.content)).convert("RGB") - >>> init_image = init_image.resize((768, 512)) - - >>> prompt = "A fantasy landscape, trending on artstation" - - >>> images = pipe(prompt, init_image).images - >>> images[0].save("fantasy_landscape.png") - ``` -""" - - -@dataclass -class TuneAVideoPipelineOutput(BaseOutput): - videos: Union[torch.Tensor, np.ndarray] - - - - -class MultiControlNetModel(ModelMixin): - r""" - Multiple `ControlNetModel` wrapper class for Multi-ControlNet - - This module is a wrapper for multiple instances of the `ControlNetModel`. The `forward()` API is designed to be - compatible with `ControlNetModel`. - - Args: - controlnets (`List[ControlNetModel]`): - Provides additional conditioning to the unet during the denoising process. You must set multiple - `ControlNetModel` as a list. - """ - - def __init__(self, controlnets: Union[List[ControlNetModel], Tuple[ControlNetModel]]): - super().__init__() - self.nets = nn.ModuleList(controlnets) - - def forward( - self, - sample: torch.FloatTensor, - timestep: Union[torch.Tensor, float, int], - encoder_hidden_states: torch.Tensor, - controlnet_cond: List[torch.tensor], - conditioning_scale: List[float], - class_labels: Optional[torch.Tensor] = None, - timestep_cond: Optional[torch.Tensor] = None, - attention_mask: Optional[torch.Tensor] = None, - cross_attention_kwargs: Optional[Dict[str, Any]] = None, - return_dict: bool = True, - ) -> Union[ControlNetOutput, Tuple]: - for i, (image, scale, controlnet) in enumerate(zip(controlnet_cond, conditioning_scale, self.nets)): - down_samples, mid_sample = controlnet( - sample, - timestep, - encoder_hidden_states, - image, - scale, - class_labels, - timestep_cond, - attention_mask, - cross_attention_kwargs, - return_dict, - ) - - # merge samples - if i == 0: - down_block_res_samples, mid_block_res_sample = down_samples, mid_sample - else: - down_block_res_samples = [ - samples_prev + samples_curr - for samples_prev, samples_curr in zip(down_block_res_samples, down_samples) - ] - mid_block_res_sample += mid_sample - - return down_block_res_samples, mid_block_res_sample - - - -class MakeAProtagonistStableUnCLIPPipeline(DiffusionPipeline, TextualInversionLoaderMixin): - """ - Pipeline for text-guided image to image generation using stable unCLIP. - - This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic methods the - library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.) - - Args: - feature_extractor ([`CLIPImageProcessor`]): - Feature extractor for image pre-processing before being encoded. - image_encoder ([`CLIPVisionModelWithProjection`]): - CLIP vision model for encoding images. - image_normalizer ([`StableUnCLIPImageNormalizer`]): - Used to normalize the predicted image embeddings before the noise is applied and un-normalize the image - embeddings after the noise has been applied. - image_noising_scheduler ([`KarrasDiffusionSchedulers`]): - Noise schedule for adding noise to the predicted image embeddings. The amount of noise to add is determined - by `noise_level` in `StableUnCLIPPipeline.__call__`. - tokenizer (`CLIPTokenizer`): - Tokenizer of class - [CLIPTokenizer](https://huggingface.co/docs/transformers/v4.21.0/en/model_doc/clip#transformers.CLIPTokenizer). - text_encoder ([`CLIPTextModel`]): - Frozen text-encoder. - unet ([`UNet2DConditionModel`]): Conditional U-Net architecture to denoise the encoded image latents. - scheduler ([`KarrasDiffusionSchedulers`]): - A scheduler to be used in combination with `unet` to denoise the encoded image latents. - vae ([`AutoencoderKL`]): - Variational Auto-Encoder (VAE) Model to encode and decode images to and from latent representations. - """ - - def __init__( - self, - # prior components - prior_tokenizer: CLIPTokenizer, - prior_text_encoder: CLIPTextModelWithProjection, - prior: PriorTransformer, - prior_scheduler: KarrasDiffusionSchedulers, - # image encoding components - feature_extractor: CLIPImageProcessor, - image_encoder: CLIPVisionModelWithProjection, - # image noising components - image_normalizer: StableUnCLIPImageNormalizer, - image_noising_scheduler: KarrasDiffusionSchedulers, - # regular denoising components - tokenizer: CLIPTokenizer, - text_encoder: CLIPTextModel, - unet: UNet3DConditionModel, - scheduler: KarrasDiffusionSchedulers, - controlnet: Union[ControlNetModel, List[ControlNetModel], Tuple[ControlNetModel], MultiControlNetModel], - # vae - vae: AutoencoderKL, - ): - super().__init__() - - if isinstance(controlnet, (list, tuple)): - controlnet = MultiControlNetModel(controlnet) - - self.register_modules( - prior_tokenizer=prior_tokenizer, - prior_text_encoder=prior_text_encoder, - prior=prior, - prior_scheduler=prior_scheduler, - feature_extractor=feature_extractor, - image_encoder=image_encoder, - image_normalizer=image_normalizer, - image_noising_scheduler=image_noising_scheduler, - tokenizer=tokenizer, - text_encoder=text_encoder, - unet=unet, - controlnet=controlnet, - scheduler=scheduler, - vae=vae, - ) - - self.vae_scale_factor = 2 ** (len(self.vae.config.block_out_channels) - 1) - - # Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.enable_vae_slicing - def enable_vae_slicing(self): - r""" - Enable sliced VAE decoding. - - When this option is enabled, the VAE will split the input tensor in slices to compute decoding in several - steps. This is useful to save some memory and allow larger batch sizes. - """ - self.vae.enable_slicing() - - # Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.disable_vae_slicing - def disable_vae_slicing(self): - r""" - Disable sliced VAE decoding. If `enable_vae_slicing` was previously invoked, this method will go back to - computing decoding in one step. - """ - self.vae.disable_slicing() - - def enable_sequential_cpu_offload(self, gpu_id=0): - r""" - Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, the pipeline's - models have their state dicts saved to CPU and then are moved to a `torch.device('meta') and loaded to GPU only - when their specific submodule has its `forward` method called. - """ - if is_accelerate_available(): - from accelerate import cpu_offload - else: - raise ImportError("Please install accelerate via `pip install accelerate`") - - device = torch.device(f"cuda:{gpu_id}") - - # TODO: self.image_normalizer.{scale,unscale} are not covered by the offload hooks, so they fails if added to the list - models = [ - self.image_encoder, - self.prior_text_encoder, - self.text_encoder, - self.unet, - self.vae, - self.controlnet, - ] - for cpu_offloaded_model in models: - if cpu_offloaded_model is not None: - cpu_offload(cpu_offloaded_model, device) - - def enable_model_cpu_offload(self, gpu_id=0): - r""" - Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared - to `enable_sequential_cpu_offload`, this method moves one whole model at a time to the GPU when its `forward` - method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with - `enable_sequential_cpu_offload`, but performance is much better due to the iterative execution of the `unet`. - """ - if is_accelerate_available() and is_accelerate_version(">=", "0.17.0.dev0"): - from accelerate import cpu_offload_with_hook - else: - raise ImportError("`enable_model_cpu_offload` requires `accelerate v0.17.0` or higher.") - - device = torch.device(f"cuda:{gpu_id}") - - if self.device.type != "cpu": - self.to("cpu", silence_dtype_warnings=True) - torch.cuda.empty_cache() # otherwise we don't see the memory savings (but they probably exist) - - hook = None - for cpu_offloaded_model in [self.text_encoder, self.prior_text_encoder, self.image_encoder, self.unet, self.vae, self.controlnet]: - _, hook = cpu_offload_with_hook(cpu_offloaded_model, device, prev_module_hook=hook) - - # We'll offload the last model manually. - self.final_offload_hook = hook - - @property - # Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline._execution_device - def _execution_device(self): - r""" - Returns the device on which the pipeline's models will be executed. After calling - `pipeline.enable_sequential_cpu_offload()` the execution device can only be inferred from Accelerate's module - hooks. - """ - if not hasattr(self.unet, "_hf_hook"): - return self.device - for module in self.unet.modules(): - if ( - hasattr(module, "_hf_hook") - and hasattr(module._hf_hook, "execution_device") - and module._hf_hook.execution_device is not None - ): - return torch.device(module._hf_hook.execution_device) - return self.device - - - # Copied from diffusers.pipelines.unclip.pipeline_unclip.UnCLIPPipeline._encode_prompt with _encode_prompt->_encode_prior_prompt, tokenizer->prior_tokenizer, text_encoder->prior_text_encoder - def _encode_prior_prompt( - self, - prompt, - device, - num_images_per_prompt, - do_classifier_free_guidance, - text_model_output: Optional[Union[CLIPTextModelOutput, Tuple]] = None, - text_attention_mask: Optional[torch.Tensor] = None, - ): - if text_model_output is None: - batch_size = len(prompt) if isinstance(prompt, list) else 1 - # get prompt text embeddings - text_inputs = self.prior_tokenizer( - prompt, - padding="max_length", - max_length=self.prior_tokenizer.model_max_length, - truncation=True, - return_tensors="pt", - ) - text_input_ids = text_inputs.input_ids - text_mask = text_inputs.attention_mask.bool().to(device) - - untruncated_ids = self.prior_tokenizer(prompt, padding="longest", return_tensors="pt").input_ids - - if untruncated_ids.shape[-1] >= text_input_ids.shape[-1] and not torch.equal( - text_input_ids, untruncated_ids - ): - removed_text = self.prior_tokenizer.batch_decode( - untruncated_ids[:, self.prior_tokenizer.model_max_length - 1 : -1] - ) - logger.warning( - "The following part of your input was truncated because CLIP can only handle sequences up to" - f" {self.prior_tokenizer.model_max_length} tokens: {removed_text}" - ) - text_input_ids = text_input_ids[:, : self.prior_tokenizer.model_max_length] - - prior_text_encoder_output = self.prior_text_encoder(text_input_ids.to(device)) - - prompt_embeds = prior_text_encoder_output.text_embeds - prior_text_encoder_hidden_states = prior_text_encoder_output.last_hidden_state - - else: - batch_size = text_model_output[0].shape[0] - prompt_embeds, prior_text_encoder_hidden_states = text_model_output[0], text_model_output[1] - text_mask = text_attention_mask - - prompt_embeds = prompt_embeds.repeat_interleave(num_images_per_prompt, dim=0) - prior_text_encoder_hidden_states = prior_text_encoder_hidden_states.repeat_interleave( - num_images_per_prompt, dim=0 - ) - text_mask = text_mask.repeat_interleave(num_images_per_prompt, dim=0) - - if do_classifier_free_guidance: - uncond_tokens = [""] * batch_size - - uncond_input = self.prior_tokenizer( - uncond_tokens, - padding="max_length", - max_length=self.prior_tokenizer.model_max_length, - truncation=True, - return_tensors="pt", - ) - uncond_text_mask = uncond_input.attention_mask.bool().to(device) - negative_prompt_embeds_prior_text_encoder_output = self.prior_text_encoder( - uncond_input.input_ids.to(device) - ) - - negative_prompt_embeds = negative_prompt_embeds_prior_text_encoder_output.text_embeds - uncond_prior_text_encoder_hidden_states = ( - negative_prompt_embeds_prior_text_encoder_output.last_hidden_state - ) - - # duplicate unconditional embeddings for each generation per prompt, using mps friendly method - - seq_len = negative_prompt_embeds.shape[1] - negative_prompt_embeds = negative_prompt_embeds.repeat(1, num_images_per_prompt) - negative_prompt_embeds = negative_prompt_embeds.view(batch_size * num_images_per_prompt, seq_len) - - seq_len = uncond_prior_text_encoder_hidden_states.shape[1] - uncond_prior_text_encoder_hidden_states = uncond_prior_text_encoder_hidden_states.repeat( - 1, num_images_per_prompt, 1 - ) - uncond_prior_text_encoder_hidden_states = uncond_prior_text_encoder_hidden_states.view( - batch_size * num_images_per_prompt, seq_len, -1 - ) - uncond_text_mask = uncond_text_mask.repeat_interleave(num_images_per_prompt, dim=0) - - # done duplicates - - # For classifier free guidance, we need to do two forward passes. - # Here we concatenate the unconditional and text embeddings into a single batch - # to avoid doing two forward passes - prompt_embeds = torch.cat([negative_prompt_embeds, prompt_embeds]) - prior_text_encoder_hidden_states = torch.cat( - [uncond_prior_text_encoder_hidden_states, prior_text_encoder_hidden_states] - ) - - text_mask = torch.cat([uncond_text_mask, text_mask]) - - return prompt_embeds, prior_text_encoder_hidden_states, text_mask - - - # Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline._encode_prompt - def _encode_prompt( - self, - prompt, - device, - num_videos_per_prompt, - do_classifier_free_guidance, - negative_prompt=None, - prompt_embeds: Optional[torch.FloatTensor] = None, - negative_prompt_embeds: Optional[torch.FloatTensor] = None, - ): - r""" - Encodes the prompt into text encoder hidden states. - - Args: - prompt (`str` or `List[str]`, *optional*): - prompt to be encoded - device: (`torch.device`): - torch device - num_videos_per_prompt (`int`): - number of images that should be generated per prompt - do_classifier_free_guidance (`bool`): - whether to use classifier free guidance or not - negative_prompt (`str` or `List[str]`, *optional*): - The prompt or prompts not to guide the image generation. If not defined, one has to pass - `negative_prompt_embeds` instead. Ignored when not using guidance (i.e., ignored if `guidance_scale` is - less than `1`). - prompt_embeds (`torch.FloatTensor`, *optional*): - Pre-generated text embeddings. Can be used to easily tweak text inputs, *e.g.* prompt weighting. If not - provided, text embeddings will be generated from `prompt` input argument. - negative_prompt_embeds (`torch.FloatTensor`, *optional*): - Pre-generated negative text embeddings. Can be used to easily tweak text inputs, *e.g.* prompt - weighting. If not provided, negative_prompt_embeds will be generated from `negative_prompt` input - argument. - """ - if prompt is not None and isinstance(prompt, str): - batch_size = 1 - elif prompt is not None and isinstance(prompt, list): - batch_size = len(prompt) - else: - batch_size = prompt_embeds.shape[0] - - if prompt_embeds is None: - # textual inversion: procecss multi-vector tokens if necessary - if isinstance(self, TextualInversionLoaderMixin): - prompt = self.maybe_convert_prompt(prompt, self.tokenizer) - - text_inputs = self.tokenizer( - prompt, - padding="max_length", - max_length=self.tokenizer.model_max_length, - truncation=True, - return_tensors="pt", - ) - text_input_ids = text_inputs.input_ids - untruncated_ids = self.tokenizer(prompt, padding="longest", return_tensors="pt").input_ids - - if untruncated_ids.shape[-1] >= text_input_ids.shape[-1] and not torch.equal( - text_input_ids, untruncated_ids - ): - removed_text = self.tokenizer.batch_decode( - untruncated_ids[:, self.tokenizer.model_max_length - 1 : -1] - ) - logger.warning( - "The following part of your input was truncated because CLIP can only handle sequences up to" - f" {self.tokenizer.model_max_length} tokens: {removed_text}" - ) - - if hasattr(self.text_encoder.config, "use_attention_mask") and self.text_encoder.config.use_attention_mask: - attention_mask = text_inputs.attention_mask.to(device) - else: - attention_mask = None - - prompt_embeds = self.text_encoder( - text_input_ids.to(device), - attention_mask=attention_mask, - ) - prompt_embeds = prompt_embeds[0] - - prompt_embeds = prompt_embeds.to(dtype=self.text_encoder.dtype, device=device) - - bs_embed, seq_len, _ = prompt_embeds.shape - # duplicate text embeddings for each generation per prompt, using mps friendly method - prompt_embeds = prompt_embeds.repeat(1, num_videos_per_prompt, 1) - prompt_embeds = prompt_embeds.view(bs_embed * num_videos_per_prompt, seq_len, -1) - - # get unconditional embeddings for classifier free guidance - if do_classifier_free_guidance and negative_prompt_embeds is None: - uncond_tokens: List[str] - if negative_prompt is None: - uncond_tokens = [""] * batch_size - elif type(prompt) is not type(negative_prompt): - raise TypeError( - f"`negative_prompt` should be the same type to `prompt`, but got {type(negative_prompt)} !=" - f" {type(prompt)}." - ) - elif isinstance(negative_prompt, str): - uncond_tokens = [negative_prompt] - elif batch_size != len(negative_prompt): - raise ValueError( - f"`negative_prompt`: {negative_prompt} has batch size {len(negative_prompt)}, but `prompt`:" - f" {prompt} has batch size {batch_size}. Please make sure that passed `negative_prompt` matches" - " the batch size of `prompt`." - ) - else: - uncond_tokens = negative_prompt - - # textual inversion: procecss multi-vector tokens if necessary - if isinstance(self, TextualInversionLoaderMixin): - uncond_tokens = self.maybe_convert_prompt(uncond_tokens, self.tokenizer) - - max_length = prompt_embeds.shape[1] - uncond_input = self.tokenizer( - uncond_tokens, - padding="max_length", - max_length=max_length, - truncation=True, - return_tensors="pt", - ) - - if hasattr(self.text_encoder.config, "use_attention_mask") and self.text_encoder.config.use_attention_mask: - attention_mask = uncond_input.attention_mask.to(device) - else: - attention_mask = None - - negative_prompt_embeds = self.text_encoder( - uncond_input.input_ids.to(device), - attention_mask=attention_mask, - ) - negative_prompt_embeds = negative_prompt_embeds[0] - - if do_classifier_free_guidance: - # duplicate unconditional embeddings for each generation per prompt, using mps friendly method - seq_len = negative_prompt_embeds.shape[1] - - negative_prompt_embeds = negative_prompt_embeds.to(dtype=self.text_encoder.dtype, device=device) - - negative_prompt_embeds = negative_prompt_embeds.repeat(1, num_videos_per_prompt, 1) - negative_prompt_embeds = negative_prompt_embeds.view(batch_size * num_videos_per_prompt, seq_len, -1) - - # For classifier free guidance, we need to do two forward passes. - # Here we concatenate the unconditional and text embeddings into a single batch - # to avoid doing two forward passes - prompt_embeds = torch.cat([negative_prompt_embeds, prompt_embeds]) - - return prompt_embeds - - def _encode_image( - self, - image, - device, - batch_size, - num_videos_per_prompt, - do_classifier_free_guidance, - noise_level, - generator, - image_embeds, - return_image_embeds=False - ): - dtype = next(self.image_encoder.parameters()).dtype - - if isinstance(image, PIL.Image.Image): - # the image embedding should repeated so it matches the total batch size of the prompt - repeat_by = batch_size - else: - # assume the image input is already properly batched and just needs to be repeated so - # it matches the num_videos_per_prompt. - # - # NOTE(will) this is probably missing a few number of side cases. I.e. batched/non-batched - # `image_embeds`. If those happen to be common use cases, let's think harder about - # what the expected dimensions of inputs should be and how we handle the encoding. - repeat_by = num_videos_per_prompt - - if image_embeds is None: - if not isinstance(image, torch.Tensor): - image = self.feature_extractor(images=image, return_tensors="pt").pixel_values - - image = image.to(device=device, dtype=dtype) - image_embeds = self.image_encoder(image).image_embeds - - if return_image_embeds: - return image_embeds - - image_embeds = self.noise_image_embeddings( - image_embeds=image_embeds, - noise_level=noise_level, - generator=generator, - ) - - # duplicate image embeddings for each generation per prompt, using mps friendly method - image_embeds = image_embeds.unsqueeze(1) - bs_embed, seq_len, _ = image_embeds.shape - image_embeds = image_embeds.repeat(1, repeat_by, 1) - image_embeds = image_embeds.view(bs_embed * repeat_by, seq_len, -1) - image_embeds = image_embeds.squeeze(1) - - if do_classifier_free_guidance: - negative_prompt_embeds = torch.zeros_like(image_embeds) - - # For classifier free guidance, we need to do two forward passes. - # Here we concatenate the unconditional and text embeddings into a single batch - # to avoid doing two forward passes - image_embeds = torch.cat([negative_prompt_embeds, image_embeds]) - - return image_embeds - - # Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.decode_latents - # def decode_latents(self, latents): - # latents = 1 / self.vae.config.scaling_factor * latents - # image = self.vae.decode(latents).sample - # image = (image / 2 + 0.5).clamp(0, 1) - # # we always cast to float32 as this does not cause significant overhead and is compatible with bfloat16 - # image = image.cpu().permute(0, 2, 3, 1).float().numpy() - # return image - - def decode_latents(self, latents): - latents = latents.to(self.vae.dtype) - video_length = latents.shape[2] - latents = 1 / self.vae.config.scaling_factor * latents - latents = rearrange(latents, "b c f h w -> (b f) c h w") - video = self.vae.decode(latents).sample - video = rearrange(video, "(b f) c h w -> b c f h w", f=video_length) - video = (video / 2 + 0.5).clamp(0, 1) - # we always cast to float32 as this does not cause significant overhead and is compatible with bfloa16 - video = video.cpu().float().numpy() - return video - - - # Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.prepare_extra_step_kwargs with prepare_extra_step_kwargs->prepare_prior_extra_step_kwargs, scheduler->prior_scheduler - def prepare_prior_extra_step_kwargs(self, generator, eta): - # prepare extra kwargs for the prior_scheduler step, since not all prior_schedulers have the same signature - # eta (η) is only used with the DDIMScheduler, it will be ignored for other prior_schedulers. - # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502 - # and should be between [0, 1] - - accepts_eta = "eta" in set(inspect.signature(self.prior_scheduler.step).parameters.keys()) - extra_step_kwargs = {} - if accepts_eta: - extra_step_kwargs["eta"] = eta - - # check if the prior_scheduler accepts generator - accepts_generator = "generator" in set(inspect.signature(self.prior_scheduler.step).parameters.keys()) - if accepts_generator: - extra_step_kwargs["generator"] = generator - return extra_step_kwargs - - # Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.prepare_extra_step_kwargs - def prepare_extra_step_kwargs(self, generator, eta): - # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature - # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers. - # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502 - # and should be between [0, 1] - - accepts_eta = "eta" in set(inspect.signature(self.scheduler.step).parameters.keys()) - extra_step_kwargs = {} - if accepts_eta: - extra_step_kwargs["eta"] = eta - - # check if the scheduler accepts generator - accepts_generator = "generator" in set(inspect.signature(self.scheduler.step).parameters.keys()) - if accepts_generator: - extra_step_kwargs["generator"] = generator - return extra_step_kwargs - - def check_inputs( - self, - prompt, - image, ## this is for image embedding - control_image, ## this is for controlnet # the shape should be B,F,C,H,W - height, - width, - callback_steps, - noise_level, - negative_prompt=None, - prompt_embeds=None, - negative_prompt_embeds=None, - image_embeds=None, - controlnet_conditioning_scale=1.0, - ): - if height % 8 != 0 or width % 8 != 0: - raise ValueError(f"`height` and `width` have to be divisible by 8 but are {height} and {width}.") - - if (callback_steps is None) or ( - callback_steps is not None and (not isinstance(callback_steps, int) or callback_steps <= 0) - ): - raise ValueError( - f"`callback_steps` has to be a positive integer but is {callback_steps} of type" - f" {type(callback_steps)}." - ) - - if prompt is not None and prompt_embeds is not None: - raise ValueError( - "Provide either `prompt` or `prompt_embeds`. Please make sure to define only one of the two." - ) - - if prompt is None and prompt_embeds is None: - raise ValueError( - "Provide either `prompt` or `prompt_embeds`. Cannot leave both `prompt` and `prompt_embeds` undefined." - ) - - if prompt is not None and (not isinstance(prompt, str) and not isinstance(prompt, list)): - raise ValueError(f"`prompt` has to be of type `str` or `list` but is {type(prompt)}") - - if negative_prompt is not None and negative_prompt_embeds is not None: - raise ValueError( - "Provide either `negative_prompt` or `negative_prompt_embeds`. Cannot leave both `negative_prompt` and `negative_prompt_embeds` undefined." - ) - - if prompt is not None and negative_prompt is not None: - if type(prompt) is not type(negative_prompt): - raise TypeError( - f"`negative_prompt` should be the same type to `prompt`, but got {type(negative_prompt)} !=" - f" {type(prompt)}." - ) - - if prompt_embeds is not None and negative_prompt_embeds is not None: - if prompt_embeds.shape != negative_prompt_embeds.shape: - raise ValueError( - "`prompt_embeds` and `negative_prompt_embeds` must have the same shape when passed directly, but" - f" got: `prompt_embeds` {prompt_embeds.shape} != `negative_prompt_embeds`" - f" {negative_prompt_embeds.shape}." - ) - - if noise_level < 0 or noise_level >= self.image_noising_scheduler.config.num_train_timesteps: - raise ValueError( - f"`noise_level` must be between 0 and {self.image_noising_scheduler.config.num_train_timesteps - 1}, inclusive." - ) - - if image is not None and image_embeds is not None: - raise ValueError( - "Provide either `image` or `image_embeds`. Please make sure to define only one of the two." - ) - - if image is None and image_embeds is None: - raise ValueError( - "Provide either `image` or `image_embeds`. Cannot leave both `image` and `image_embeds` undefined." - ) - - if image is not None: - if ( - not isinstance(image, torch.Tensor) - and not isinstance(image, PIL.Image.Image) - and not isinstance(image, list) - ): - raise ValueError( - "`image` has to be of type `torch.FloatTensor` or `PIL.Image.Image` or `List[PIL.Image.Image]` but is" - f" {type(image)}" - ) - - - # `prompt` needs more sophisticated handling when there are multiple - # conditionings. - if isinstance(self.controlnet, MultiControlNetModel): - if isinstance(prompt, list): - logger.warning( - f"You have {len(self.controlnet.nets)} ControlNets and you have passed {len(prompt)}" - " prompts. The conditionings will be fixed across the prompts." - ) - - # Check `image` - if isinstance(self.controlnet, ControlNetModel): - self.check_image(control_image, prompt, prompt_embeds) - elif isinstance(self.controlnet, MultiControlNetModel): - if not isinstance(control_image, list): - raise TypeError("For multiple controlnets: `image` must be type `list`") - - # When `image` is a nested list: - # (e.g. [[canny_image_1, pose_image_1], [canny_image_2, pose_image_2]]) - elif any(isinstance(i, list) for i in control_image): - raise ValueError("A single batch of multiple conditionings are supported at the moment.") - elif len(control_image) != len(self.controlnet.nets): - raise ValueError( - "For multiple controlnets: `image` must have the same length as the number of controlnets." - ) - - for image_ in control_image: - self.check_image(image_, prompt, prompt_embeds) - else: - assert False - - # Check `controlnet_conditioning_scale` - if isinstance(self.controlnet, ControlNetModel): - if not isinstance(controlnet_conditioning_scale, float): - raise TypeError("For single controlnet: `controlnet_conditioning_scale` must be type `float`.") - elif isinstance(self.controlnet, MultiControlNetModel): - if isinstance(controlnet_conditioning_scale, list): - if any(isinstance(i, list) for i in controlnet_conditioning_scale): - raise ValueError("A single batch of multiple conditionings are supported at the moment.") - elif isinstance(controlnet_conditioning_scale, list) and len(controlnet_conditioning_scale) != len( - self.controlnet.nets - ): - raise ValueError( - "For multiple controlnets: When `controlnet_conditioning_scale` is specified as `list`, it must have" - " the same length as the number of controlnets" - ) - else: - assert False - - - def check_image(self, image, prompt, prompt_embeds): - image_is_pil = isinstance(image, PIL.Image.Image) - image_is_tensor = isinstance(image, torch.Tensor) - image_is_pil_list = isinstance(image, list) and isinstance(image[0], PIL.Image.Image) - image_is_tensor_list = isinstance(image, list) and isinstance(image[0], torch.Tensor) - - if not image_is_pil and not image_is_tensor and not image_is_pil_list and not image_is_tensor_list: - raise TypeError( - "image must be passed and be one of PIL image, torch tensor, list of PIL images, or list of torch tensors" - ) - - if image_is_pil: - image_batch_size = 1 - elif image_is_tensor: - image_batch_size = image.shape[0] - elif image_is_pil_list: - image_batch_size = len(image) - elif image_is_tensor_list: - image_batch_size = len(image) - - if prompt is not None and isinstance(prompt, str): - prompt_batch_size = 1 - elif prompt is not None and isinstance(prompt, list): - prompt_batch_size = len(prompt) - elif prompt_embeds is not None: - prompt_batch_size = prompt_embeds.shape[0] - - if image_batch_size != 1 and image_batch_size != prompt_batch_size: - raise ValueError( - f"If image batch size is not 1, image batch size must be same as prompt batch size. image batch size: {image_batch_size}, prompt batch size: {prompt_batch_size}" - ) - - - def prepare_image( - self, image, width, height, batch_size, num_images_per_prompt, device, dtype, do_classifier_free_guidance - ): - ''' - image here should be batch wise video, B,F,C,H,W - ''' - if not isinstance(image, torch.Tensor): - if isinstance(image, PIL.Image.Image): - image = [image] - - if isinstance(image[0], PIL.Image.Image): - images = [] - - for image_ in image: - image_ = image_.convert("RGB") - image_ = image_.resize((width, height), resample=PIL_INTERPOLATION["lanczos"]) - image_ = np.array(image_) - image_ = image_[None, :] - images.append(image_) - - image = images - - image = np.concatenate(image, axis=0) - image = np.array(image).astype(np.float32) / 255.0 - image = image.transpose(0, 3, 1, 2) - image = torch.from_numpy(image) - elif isinstance(image[0], torch.Tensor): - image = torch.cat(image, dim=0) - - image_batch_size = image.shape[0] - - if image_batch_size == 1: - repeat_by = batch_size - else: - # image batch size is the same as prompt batch size - repeat_by = num_images_per_prompt - - image = image.repeat_interleave(repeat_by, dim=0) - - image = image.to(device=device, dtype=dtype) - - if do_classifier_free_guidance: - image = torch.cat([image] * 2) - - return image - - - - # Copied from diffusers.pipelines.unclip.pipeline_unclip.UnCLIPPipeline.prepare_latents - def prepare_latents_shape(self, shape, dtype, device, generator, latents, scheduler): - # ipdb.set_trace() - if latents is None: - latents = randn_tensor(shape, generator=generator, device=device, dtype=dtype) - else: - if latents.shape != shape: - raise ValueError(f"Unexpected latents shape, got {latents.shape}, expected {shape}") - latents = latents.to(device) - - latents = latents * scheduler.init_noise_sigma - return latents - - def prepare_latents(self, batch_size, num_channels_latents, video_length, height, width, dtype, device, generator, latents=None): - shape = (batch_size, num_channels_latents, video_length, height // self.vae_scale_factor, width // self.vae_scale_factor) - ## B,4,F,H,W - if isinstance(generator, list) and len(generator) != batch_size: - raise ValueError( - f"You have passed a list of generators of length {len(generator)}, but requested an effective batch" - f" size of {batch_size}. Make sure the batch size matches the length of the generators." - ) - - if latents is None: - latents = randn_tensor(shape, generator=generator, device=device, dtype=dtype) - else: - if latents.shape != shape: - raise ValueError(f"Unexpected latents shape, got {latents.shape}, expected {shape}") - - latents = latents.to(device) - - # scale the initial noise by the standard deviation required by the scheduler - latents = latents * self.scheduler.init_noise_sigma - return latents - - # Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_unclip.StableUnCLIPPipeline.noise_image_embeddings - def noise_image_embeddings( - self, - image_embeds: torch.Tensor, - noise_level: int, - noise: Optional[torch.FloatTensor] = None, - generator: Optional[torch.Generator] = None, - ): - """ - Add noise to the image embeddings. The amount of noise is controlled by a `noise_level` input. A higher - `noise_level` increases the variance in the final un-noised images. - - The noise is applied in two ways - 1. A noise schedule is applied directly to the embeddings - 2. A vector of sinusoidal time embeddings are appended to the output. - - In both cases, the amount of noise is controlled by the same `noise_level`. - - The embeddings are normalized before the noise is applied and un-normalized after the noise is applied. - """ - # ipdb.set_trace() - - if noise is None: - noise = randn_tensor( - image_embeds.shape, generator=generator, device=image_embeds.device, dtype=image_embeds.dtype - ) - - noise_level = torch.tensor([noise_level] * image_embeds.shape[0], device=image_embeds.device) - - self.image_normalizer.to(image_embeds.device) - image_embeds = self.image_normalizer.scale(image_embeds) - - image_embeds = self.image_noising_scheduler.add_noise(image_embeds, timesteps=noise_level, noise=noise) - - image_embeds = self.image_normalizer.unscale(image_embeds) - - noise_level = get_timestep_embedding( - timesteps=noise_level, embedding_dim=image_embeds.shape[-1], flip_sin_to_cos=True, downscale_freq_shift=0 - ) - - # `get_timestep_embeddings` does not contain any weights and will always return f32 tensors, - # but we might actually be running in fp16. so we need to cast here. - # there might be better ways to encapsulate this. - noise_level = noise_level.to(image_embeds.dtype) - - image_embeds = torch.cat((image_embeds, noise_level), 1) - - return image_embeds - - @torch.no_grad() - @replace_example_docstring(EXAMPLE_DOC_STRING) - def __call__( - self, - image: Union[torch.FloatTensor, PIL.Image.Image] = None, - prompt: Union[str, List[str]] = None, - control_image: Union[torch.FloatTensor, PIL.Image.Image, List[torch.FloatTensor], List[PIL.Image.Image]] = None, - video_length: Optional[int] = 1, - height: Optional[int] = None, - width: Optional[int] = None, - num_inference_steps: int = 50, # 20 in image unclip pipline - guidance_scale: float = 7.5, # 10 in image unclip pipline - negative_prompt: Optional[Union[str, List[str]]] = None, - num_videos_per_prompt: Optional[int] = 1, - eta: float = 0.0, - generator: Optional[torch.Generator] = None, - latents: Optional[torch.FloatTensor] = None, - prompt_embeds: Optional[torch.FloatTensor] = None, - negative_prompt_embeds: Optional[torch.FloatTensor] = None, - output_type: Optional[str] = "tensor", - return_dict: bool = True, - callback: Optional[Callable[[int, int, torch.FloatTensor], None]] = None, - callback_steps: int = 1, - cross_attention_kwargs: Optional[Dict[str, Any]] = None, - noise_level: int = 0, - image_embeds: Optional[torch.FloatTensor] = None, - adapter_features: Optional[torch.Tensor] = None, - controlnet_conditioning_scale: Union[float, List[float]] = 1.0, - controlnet_image_embeds_type: str = "empty", ## "image" for using image embedding for control net - ## text guidance - text_guidance_scale: float = 0, # NOTE CFG on no image embedding sample - # prior args - prior_num_inference_steps: int = 25, - prior_guidance_scale: float = 4.0, - prior_latents: Optional[torch.FloatTensor] = None, - interpolate_embed_weight: float = 1.0, - return_prior_embed: bool = False, ## return prior embedding for DDIM inv - prior_denoised_embeds: Optional[torch.FloatTensor] = None, ## the embedding used for the background, after denoising - - ## mask args - masks: Optional[torch.FloatTensor] = None, - inverse_mask: bool = False, ## inverse mask of image embedding and text - start_step: int = -1, ## start to use mask - end_step: int = 1000, ## end to use mask - mask_mode: str = 'all', - mask_latent_fuse_mode: str = 'all', - **kwargs, - ): - r""" - Function invoked when calling the pipeline for generation. - - Args: - prompt (`str` or `List[str]`, *optional*): - The prompt or prompts to guide the image generation. If not defined, either `prompt_embeds` will be - used or prompt is initialized to `""`. - image (`torch.FloatTensor` or `PIL.Image.Image`): - `Image`, or tensor representing an image batch. The image will be encoded to its CLIP embedding which - the unet will be conditioned on. Note that the image is _not_ encoded by the vae and then used as the - latents in the denoising process such as in the standard stable diffusion text guided image variation - process. - height (`int`, *optional*, defaults to self.unet.config.sample_size * self.vae_scale_factor): - The height in pixels of the generated image. - width (`int`, *optional*, defaults to self.unet.config.sample_size * self.vae_scale_factor): - The width in pixels of the generated image. - num_inference_steps (`int`, *optional*, defaults to 20): - The number of denoising steps. More denoising steps usually lead to a higher quality image at the - expense of slower inference. - guidance_scale (`float`, *optional*, defaults to 10.0): - Guidance scale as defined in [Classifier-Free Diffusion Guidance](https://arxiv.org/abs/2207.12598). - `guidance_scale` is defined as `w` of equation 2. of [Imagen - Paper](https://arxiv.org/pdf/2205.11487.pdf). Guidance scale is enabled by setting `guidance_scale > - 1`. Higher guidance scale encourages to generate images that are closely linked to the text `prompt`, - usually at the expense of lower image quality. - negative_prompt (`str` or `List[str]`, *optional*): - The prompt or prompts not to guide the image generation. If not defined, one has to pass - `negative_prompt_embeds` instead. Ignored when not using guidance (i.e., ignored if `guidance_scale` is - less than `1`). - num_videos_per_prompt (`int`, *optional*, defaults to 1): - The number of images to generate per prompt. - eta (`float`, *optional*, defaults to 0.0): - Corresponds to parameter eta (η) in the DDIM paper: https://arxiv.org/abs/2010.02502. Only applies to - [`schedulers.DDIMScheduler`], will be ignored for others. - generator (`torch.Generator` or `List[torch.Generator]`, *optional*): - One or a list of [torch generator(s)](https://pytorch.org/docs/stable/generated/torch.Generator.html) - to make generation deterministic. - latents (`torch.FloatTensor`, *optional*): - Pre-generated noisy latents, sampled from a Gaussian distribution, to be used as inputs for image - generation. Can be used to tweak the same generation with different prompts. If not provided, a latents - tensor will ge generated by sampling using the supplied random `generator`. - prompt_embeds (`torch.FloatTensor`, *optional*): - Pre-generated text embeddings. Can be used to easily tweak text inputs, *e.g.* prompt weighting. If not - provided, text embeddings will be generated from `prompt` input argument. - negative_prompt_embeds (`torch.FloatTensor`, *optional*): - Pre-generated negative text embeddings. Can be used to easily tweak text inputs, *e.g.* prompt - weighting. If not provided, negative_prompt_embeds will be generated from `negative_prompt` input - argument. - output_type (`str`, *optional*, defaults to `"pil"`): - The output format of the generate image. Choose between - [PIL](https://pillow.readthedocs.io/en/stable/): `PIL.Image.Image` or `np.array`. - return_dict (`bool`, *optional*, defaults to `True`): - Whether or not to return a [`~pipelines.stable_diffusion.StableDiffusionPipelineOutput`] instead of a - plain tuple. - callback (`Callable`, *optional*): - A function that will be called every `callback_steps` steps during inference. The function will be - called with the following arguments: `callback(step: int, timestep: int, latents: torch.FloatTensor)`. - callback_steps (`int`, *optional*, defaults to 1): - The frequency at which the `callback` function will be called. If not specified, the callback will be - called at every step. - cross_attention_kwargs (`dict`, *optional*): - A kwargs dictionary that if specified is passed along to the `AttentionProcessor` as defined under - `self.processor` in - [diffusers.cross_attention](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/cross_attention.py). - noise_level (`int`, *optional*, defaults to `0`): - The amount of noise to add to the image embeddings. A higher `noise_level` increases the variance in - the final un-noised images. See `StableUnCLIPPipeline.noise_image_embeddings` for details. - image_embeds (`torch.FloatTensor`, *optional*): - Pre-generated CLIP embeddings to condition the unet on. Note that these are not latents to be used in - the denoising process. If you want to provide pre-generated latents, pass them to `__call__` as - `latents`. - - prior_num_inference_steps (`int`, *optional*, defaults to 25): - The number of denoising steps in the prior denoising process. More denoising steps usually lead to a - higher quality image at the expense of slower inference. - prior_guidance_scale (`float`, *optional*, defaults to 4.0): - Guidance scale for the prior denoising process as defined in [Classifier-Free Diffusion - Guidance](https://arxiv.org/abs/2207.12598). `prior_guidance_scale` is defined as `w` of equation 2. of - [Imagen Paper](https://arxiv.org/pdf/2205.11487.pdf). Guidance scale is enabled by setting - `guidance_scale > 1`. Higher guidance scale encourages to generate images that are closely linked to - the text `prompt`, usually at the expense of lower image quality. - prior_latents (`torch.FloatTensor`, *optional*): - Pre-generated noisy latents, sampled from a Gaussian distribution, to be used as inputs for image - embedding generation in the prior denoising process. Can be used to tweak the same generation with - different prompts. If not provided, a latents tensor will ge generated by sampling using the supplied - random `generator`. - - Examples: - - Returns: - [`~pipelines.ImagePipelineOutput`] or `tuple`: [`~ pipeline_utils.ImagePipelineOutput`] if `return_dict` is - True, otherwise a `tuple`. When returning a tuple, the first element is a list with the generated images. - """ - # 0. Default height and width to unet - height = height or self.unet.config.sample_size * self.vae_scale_factor - width = width or self.unet.config.sample_size * self.vae_scale_factor - - if prompt is None and prompt_embeds is None: - prompt = len(image) * [""] if isinstance(image, list) else "" - - if isinstance(self.controlnet, MultiControlNetModel): - assert not isinstance(prompt, list) - ## NOTE only support one prompt here - - else: - if control_image.dim() == 5: - prompt_len = len(prompt) if isinstance(prompt, list) else 1 - control_image = control_image.repeat(prompt_len,1,1,1,1) # B,F,3,H,W - - if len(masks.unique()) == 1 and masks.unique()[0] == 1: ## if all ones, just ignore - masks = None - - if masks is not None: - if not interpolate_embed_weight: ## is 0 - warnings.warn( "Using mask should use image embedding combined with prior embedding. Now only prior embedding is used, the results should be the same with no mask") - # assert interpolate_embed_weight, "Using mask should use image embedding combined with prior embedding" - - # 1. Check inputs. Raise error if not correct - self.check_inputs( - prompt=prompt, - image=image, - control_image=control_image, - height=height, - width=width, - callback_steps=callback_steps, - noise_level=noise_level, - negative_prompt=negative_prompt, - prompt_embeds=prompt_embeds, - negative_prompt_embeds=negative_prompt_embeds, - image_embeds=image_embeds, - controlnet_conditioning_scale=controlnet_conditioning_scale, - ) - - # ipdb.set_trace() - # 2. Define call parameters - if prompt is not None and isinstance(prompt, str): - batch_size = 1 - elif prompt is not None and isinstance(prompt, list): - batch_size = len(prompt) - else: - batch_size = prompt_embeds.shape[0] - - batch_size = batch_size * num_videos_per_prompt - - device = self._execution_device - - ## NOTE using prior denoised latents from the source embedding for partially editing - - if prior_denoised_embeds is None: - # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2) - # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1` - # corresponds to doing no classifier free guidance. - prior_do_classifier_free_guidance = prior_guidance_scale > 1.0 - - # 3. Encode input prompt - prior_prompt_embeds, prior_text_encoder_hidden_states, prior_text_mask = self._encode_prior_prompt( - prompt=prompt, - device=device, - num_images_per_prompt=num_videos_per_prompt, - do_classifier_free_guidance=prior_do_classifier_free_guidance, - ) - ## prior_prompt_embeds: text embeds - ## prior_text_encoder_hidden_states: last hidden state - - # 4. Prepare prior timesteps - self.prior_scheduler.set_timesteps(prior_num_inference_steps, device=device) - prior_timesteps_tensor = self.prior_scheduler.timesteps - - # 5. Prepare prior latent variables - embedding_dim = self.prior.config.embedding_dim - - prior_latents = self.prepare_latents_shape( - (batch_size, embedding_dim), - prior_prompt_embeds.dtype, - device, - generator, - prior_latents, - self.prior_scheduler, - ) - # ipdb.set_trace() - - - # 6. Prepare extra step kwargs. TODO: Logic should ideally just be moved out of the pipeline - prior_extra_step_kwargs = self.prepare_prior_extra_step_kwargs(generator, eta) - - - # 7. Prior denoising loop - for i, t in enumerate(self.progress_bar(prior_timesteps_tensor)): - # expand the latents if we are doing classifier free guidance - latent_model_input = torch.cat([prior_latents] * 2) if prior_do_classifier_free_guidance else prior_latents - latent_model_input = self.prior_scheduler.scale_model_input(latent_model_input, t) - - predicted_image_embedding = self.prior( - latent_model_input, - timestep=t, - proj_embedding=prior_prompt_embeds, - encoder_hidden_states=prior_text_encoder_hidden_states, - attention_mask=prior_text_mask, - ).predicted_image_embedding - - if prior_do_classifier_free_guidance: - predicted_image_embedding_uncond, predicted_image_embedding_text = predicted_image_embedding.chunk(2) - predicted_image_embedding = predicted_image_embedding_uncond + prior_guidance_scale * ( - predicted_image_embedding_text - predicted_image_embedding_uncond - ) - - prior_latents = self.prior_scheduler.step( - predicted_image_embedding, - timestep=t, - sample=prior_latents, - **prior_extra_step_kwargs, - ).prev_sample - - if callback is not None and i % callback_steps == 0: - callback(i, t, prior_latents) - - prior_latents = self.prior.post_process_latents(prior_latents) - - if return_prior_embed: - return prior_latents - # done prior - else: - prior_latents = prior_denoised_embeds - - # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2) - # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1` - # corresponds to doing no classifier free guidance. - do_classifier_free_guidance = guidance_scale > 1.0 - - if isinstance(self.controlnet, MultiControlNetModel) and isinstance(controlnet_conditioning_scale, float): - controlnet_conditioning_scale = [controlnet_conditioning_scale] * len(self.controlnet.nets) - - # ipdb.set_trace() - # 3. Encode input prompt - prompt_embeds = self._encode_prompt( - prompt=prompt, - device=device, - num_videos_per_prompt=num_videos_per_prompt, - do_classifier_free_guidance=do_classifier_free_guidance, - negative_prompt=negative_prompt, - prompt_embeds=prompt_embeds, - negative_prompt_embeds=negative_prompt_embeds, - ) - - prompt_embeds_text, image_embeds_text = None, None - if text_guidance_scale: - prompt_embeds_text = prompt_embeds[prompt_embeds.size(0)//2:] ## with text - - # 4. Encoder input image - noise_level = torch.tensor([noise_level], device=device) - - if interpolate_embed_weight: - # assert image is not None, "interpolate image embedding with prior embedding requires the image" - image_embeds_given = self._encode_image( - image=image, - device=device, - batch_size=batch_size, - num_videos_per_prompt=num_videos_per_prompt, - do_classifier_free_guidance=do_classifier_free_guidance, - noise_level=noise_level, - generator=generator, - image_embeds=image_embeds, - return_image_embeds=True, - ) - image_embeds = interpolate_embed_weight * image_embeds_given + (1-interpolate_embed_weight) * prior_latents - else: - image_embeds = prior_latents - - image_embeds = self._encode_image( - image=image, - device=device, - batch_size=batch_size, - num_videos_per_prompt=num_videos_per_prompt, - do_classifier_free_guidance=do_classifier_free_guidance, - noise_level=noise_level, - generator=generator, - image_embeds=image_embeds, - ) # 2B,C - - aux_latents = None - if masks is not None: - ## NOTE encode prior latent - aux_latents = self._encode_image( - image=None, - device=device, - batch_size=batch_size, - num_videos_per_prompt=num_videos_per_prompt, - do_classifier_free_guidance=do_classifier_free_guidance, - noise_level=noise_level, - generator=generator, - image_embeds=prior_latents, - ) # 2B,C - - # - if text_guidance_scale: - image_embeds_text = image_embeds[:image_embeds.size(0)//2] # no image - - # 5. Prepare control image - ## control image shape B,F,C,H,W - - # assert control_image.dim() == 5 - if isinstance(self.controlnet, ControlNetModel): - control_image = self.prepare_image( - image=control_image, - width=width, - height=height, - batch_size=batch_size * num_videos_per_prompt, - num_images_per_prompt=num_videos_per_prompt, - device=device, - dtype=self.controlnet.dtype, - do_classifier_free_guidance=do_classifier_free_guidance, - ) - elif isinstance(self.controlnet, MultiControlNetModel): - images = [] - - for image_ in control_image: - image_ = self.prepare_image( - image=image_, - width=width, - height=height, - batch_size=batch_size * num_videos_per_prompt, - num_images_per_prompt=num_videos_per_prompt, - device=device, - dtype=self.controlnet.dtype, - do_classifier_free_guidance=do_classifier_free_guidance, - ) - - images.append(image_) - - control_image = images - else: - assert False - - # 6. Prepare timesteps - self.scheduler.set_timesteps(num_inference_steps, device=device) - timesteps = self.scheduler.timesteps - - # 7. Prepare latent variables - num_channels_latents = self.unet.in_channels - latents = self.prepare_latents( - batch_size=batch_size, - num_channels_latents=num_channels_latents, - video_length=video_length, - height=height, - width=width, - dtype=prompt_embeds.dtype, - device=device, - generator=generator, - latents=latents, - ) - - # 8. Prepare extra step kwargs. TODO: Logic should ideally just be moved out of the pipeline - extra_step_kwargs = self.prepare_extra_step_kwargs(generator, eta) - - # 9. Denoising loop - - ## control_image: B,F,C,H,W - if isinstance(control_image, list): - control_image = [rearrange(c_image, "b f c h w -> (b f) c h w").to(device=self.controlnet.device, dtype=self.controlnet.dtype) for c_image in control_image] - else: - control_image = rearrange(control_image, "b f c h w -> (b f) c h w").to(device=self.controlnet.device, dtype=self.controlnet.dtype) ## - # aux_latents = torch.zeros_like(image_embeds) - if masks is not None: - # ipdb.set_trace() - masks = rearrange(masks, "b f c h w -> b c f h w").to(device=self.unet.device, dtype=self.unet.dtype) - masks = torch.nn.functional.interpolate(masks, size=latents.size()[-3:], mode="nearest") - # ipdb.set_trace() - if inverse_mask: - masks = 1 - masks - image_embeds, aux_latents = aux_latents, image_embeds - - # ipdb.set_trace() - mask_mode_cfg = mask_mode ## mask_mode: emb / latent / all - mask_mode = mask_mode_cfg - mask_latent_fuse_mode = mask_latent_fuse_mode ## inverse or all - - for i, t in enumerate(self.progress_bar(timesteps)): - ## t is 1000 divided in to 50 steps - latent_model_input = torch.cat([latents] * 2) if do_classifier_free_guidance else latents - ## 2B,C,F,H,W - latent_model_input = self.scheduler.scale_model_input(latent_model_input, t) - # ipdb.set_trace() - # controlnet(s) inference - down_block_res_samples, mid_block_res_sample = None, None - - latent_model_input_control = rearrange(latent_model_input, "b c f h w -> (b f) c h w").to(dtype=self.controlnet.dtype) ## - - if controlnet_image_embeds_type == "image": - controlnet_image_embeds = image_embeds.repeat(video_length, 1) - else: - # controlnet_image_embeds = torch.zeros_like(image_embeds).repeat(video_length, 1) - # NOTE this is a support for frame wise image embedding - controlnet_image_embeds = torch.zeros_like(image_embeds[:latent_model_input.size(0)]).repeat(video_length, 1) - - controlnet_image_embeds = controlnet_image_embeds.to(self.controlnet.dtype) - # ipdb.set_trace() - down_block_res_samples, mid_block_res_sample = self.controlnet( - latent_model_input_control, - t, - class_labels=controlnet_image_embeds, - encoder_hidden_states=prompt_embeds.repeat(video_length, 1, 1), - controlnet_cond=control_image, - conditioning_scale=controlnet_conditioning_scale, - return_dict=False, - ) - down_block_res_samples = [rearrange(sample, "(b f) c h w -> b c f h w", f=video_length) for sample in down_block_res_samples] - mid_block_res_sample = rearrange(mid_block_res_sample, "(b f) c h w -> b c f h w", f=video_length) - - # ipdb.set_trace() - if i >= start_step and i < end_step: - _aux_latents = aux_latents - _masks = masks - ## NOTE this can use emb in some steps and use mask latent in other steps - mask_mode = mask_mode_cfg - else: - _aux_latents, _masks = None, None - mask_mode = "emb" - # predict the noise residual - - ## NOTE mask mode list, the first is for image content, using latent mask, the second is for text, no latent mask / inverse mask - value = torch.zeros_like(latents) - count = torch.zeros_like(latents) - - # ipdb.set_trace() - if mask_mode == "latent": - cls_labels = [image_embeds, _aux_latents] - cls_labels_aux = [None, None] - cls_masks = [None, None] - - if mask_latent_fuse_mode == "all": - latent_masks = [masks, torch.ones_like(masks)] # this is used for combining latents - else: - latent_masks = [masks, 1-masks] # this is used for combining latents - - elif mask_mode == "all": - cls_labels = [image_embeds, image_embeds] - cls_labels_aux = [None, _aux_latents] - cls_masks = [None, _masks] - - if mask_latent_fuse_mode == "all": - latent_masks = [_masks, torch.ones_like(_masks)] # this is used for combining latents - else: - latent_masks = [_masks, 1-_masks] # this is used for combining latents - - else: ## this is the original version - cls_labels = [image_embeds] - cls_labels_aux = [_aux_latents] - cls_masks = [_masks] - latent_masks = [ torch.ones_like(latents)] - - for _cls_labels, _cls_labels_aux, _cls_masks, _latent_masks in zip(cls_labels, cls_labels_aux, cls_masks, latent_masks): - - latent_view = latents - latent_model_input = torch.cat([latent_view] * 2) if do_classifier_free_guidance else latent_view - latent_model_input = self.scheduler.scale_model_input(latent_model_input, t) # (batch_size, 4, F, H, W) - # ipdb.set_trace() - ## if use all training embedding, _cls_labels: 2F,C -> reshape 2,F,C will get the correct result, - ## NOTE the batch size 0 is the unconditional - noise_pred = self.unet( - latent_model_input, - t, - encoder_hidden_states=prompt_embeds, - class_labels=_cls_labels, - class_labels_aux=_cls_labels_aux, - masks=_cls_masks, - adapter_features=adapter_features, - # cross_attention_kwargs=cross_attention_kwargs, - down_block_additional_residuals=down_block_res_samples, - mid_block_additional_residual=mid_block_res_sample, - ).sample - - - # perform guidance - if do_classifier_free_guidance: - noise_pred_uncond, noise_pred_text = noise_pred.chunk(2) - noise_pred = noise_pred_uncond + guidance_scale * (noise_pred_text - noise_pred_uncond) - - # compute the previous noisy sample x_t -> x_t-1 - latents_view_denoised = self.scheduler.step(noise_pred, t, latent_view, **extra_step_kwargs).prev_sample - - # ipdb.set_trace() - ## _latent_masks 1,1,F,H,W - value += latents_view_denoised * _latent_masks - count += _latent_masks - - assert (count > 0).all() - latents = torch.where(count > 0, value / count, value) - if callback is not None and i % callback_steps == 0: - callback(i, t, latents) - - # 9. Post-processing - video = self.decode_latents(latents) - - # Offload last model to CPU - if hasattr(self, "final_offload_hook") and self.final_offload_hook is not None: - self.final_offload_hook.offload() - - # Convert to tensor - if output_type == "tensor": - video = torch.from_numpy(video) - - if not return_dict: - return video - - return TuneAVideoPipelineOutput(videos=video) diff --git a/spaces/Makiing/coolb-in-gtest/src/components/ui/select.tsx b/spaces/Makiing/coolb-in-gtest/src/components/ui/select.tsx deleted file mode 100644 index 77f12c2996f541b97663de4c9e20ab34d4ec2fac..0000000000000000000000000000000000000000 --- a/spaces/Makiing/coolb-in-gtest/src/components/ui/select.tsx +++ /dev/null @@ -1,123 +0,0 @@ -'use client' - -import * as React from 'react' -import * as SelectPrimitive from '@radix-ui/react-select' - -import { cn } from '@/lib/utils' -import { - IconArrowDown, - IconCheck, - IconChevronUpDown -} from '@/components/ui/icons' - -const Select = SelectPrimitive.Root - -const SelectGroup = SelectPrimitive.Group - -const SelectValue = SelectPrimitive.Value - -const SelectTrigger = React.forwardRef< - React.ElementRef<typeof SelectPrimitive.Trigger>, - React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger> ->(({ className, children, ...props }, ref) => ( - <SelectPrimitive.Trigger - ref={ref} - className={cn( - 'flex h-9 w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50', - className - )} - {...props} - > - {children} - <SelectPrimitive.Icon asChild> - <IconChevronUpDown className="opacity-50" /> - </SelectPrimitive.Icon> - </SelectPrimitive.Trigger> -)) -SelectTrigger.displayName = SelectPrimitive.Trigger.displayName - -const SelectContent = React.forwardRef< - React.ElementRef<typeof SelectPrimitive.Content>, - React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content> ->(({ className, children, position = 'popper', ...props }, ref) => ( - <SelectPrimitive.Portal> - <SelectPrimitive.Content - ref={ref} - className={cn( - 'relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md animate-in fade-in-80', - position === 'popper' && 'translate-y-1', - className - )} - position={position} - {...props} - > - <SelectPrimitive.Viewport - className={cn( - 'p-1', - position === 'popper' && - 'h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]' - )} - > - {children} - </SelectPrimitive.Viewport> - </SelectPrimitive.Content> - </SelectPrimitive.Portal> -)) -SelectContent.displayName = SelectPrimitive.Content.displayName - -const SelectLabel = React.forwardRef< - React.ElementRef<typeof SelectPrimitive.Label>, - React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label> ->(({ className, ...props }, ref) => ( - <SelectPrimitive.Label - ref={ref} - className={cn('py-1.5 pl-8 pr-2 text-sm font-semibold', className)} - {...props} - /> -)) -SelectLabel.displayName = SelectPrimitive.Label.displayName - -const SelectItem = React.forwardRef< - React.ElementRef<typeof SelectPrimitive.Item>, - React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item> ->(({ className, children, ...props }, ref) => ( - <SelectPrimitive.Item - ref={ref} - className={cn( - 'relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50', - className - )} - {...props} - > - <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center"> - <SelectPrimitive.ItemIndicator> - <IconCheck className="h-4 w-4" /> - </SelectPrimitive.ItemIndicator> - </span> - <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText> - </SelectPrimitive.Item> -)) -SelectItem.displayName = SelectPrimitive.Item.displayName - -const SelectSeparator = React.forwardRef< - React.ElementRef<typeof SelectPrimitive.Separator>, - React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator> ->(({ className, ...props }, ref) => ( - <SelectPrimitive.Separator - ref={ref} - className={cn('-mx-1 my-1 h-px bg-muted', className)} - {...props} - /> -)) -SelectSeparator.displayName = SelectPrimitive.Separator.displayName - -export { - Select, - SelectGroup, - SelectValue, - SelectTrigger, - SelectContent, - SelectLabel, - SelectItem, - SelectSeparator -} diff --git a/spaces/Marshalls/testmtd/feature_extraction/madmom/features/onsets.py b/spaces/Marshalls/testmtd/feature_extraction/madmom/features/onsets.py deleted file mode 100644 index ec93ce847407d05fd66905ad8b3bf23f69b47988..0000000000000000000000000000000000000000 --- a/spaces/Marshalls/testmtd/feature_extraction/madmom/features/onsets.py +++ /dev/null @@ -1,1255 +0,0 @@ -# encoding: utf-8 -# pylint: disable=no-member -# pylint: disable=invalid-name -# pylint: disable=too-many-arguments -""" -This module contains onset detection related functionality. - -""" - -from __future__ import absolute_import, division, print_function - -import numpy as np -from scipy.ndimage import uniform_filter -from scipy.ndimage.filters import maximum_filter, minimum_filter - -from ..audio.signal import smooth as smooth_signal -from ..processors import (BufferProcessor, OnlineProcessor, ParallelProcessor, - Processor, SequentialProcessor, ) -from ..utils import combine_events - -EPSILON = np.spacing(1) - - -# onset detection helper functions -def wrap_to_pi(phase): - """ - Wrap the phase information to the range -π...π. - - Parameters - ---------- - phase : numpy array - Phase of the STFT. - - Returns - ------- - wrapped_phase : numpy array - Wrapped phase. - - """ - return np.mod(phase + np.pi, 2.0 * np.pi) - np.pi - - -def correlation_diff(spec, diff_frames=1, pos=False, diff_bins=1): - """ - Calculates the difference of the magnitude spectrogram relative to the - N-th previous frame shifted in frequency to achieve the highest - correlation between these two frames. - - Parameters - ---------- - spec : numpy array - Magnitude spectrogram. - diff_frames : int, optional - Calculate the difference to the `diff_frames`-th previous frame. - pos : bool, optional - Keep only positive values. - diff_bins : int, optional - Maximum number of bins shifted for correlation calculation. - - Returns - ------- - correlation_diff : numpy array - (Positive) magnitude spectrogram differences. - - Notes - ----- - This function is only because of completeness, it is not intended to be - actually used, since it is extremely slow. Please consider the superflux() - function, since if performs equally well but much faster. - - """ - # init diff matrix - diff_spec = np.zeros_like(spec) - if diff_frames < 1: - raise ValueError("number of `diff_frames` must be >= 1") - # calculate the diff - frames, bins = diff_spec.shape - corr = np.zeros((frames, diff_bins * 2 + 1)) - for f in range(diff_frames, frames): - # correlate the frame with the previous one - # resulting size = bins * 2 - 1 - c = np.correlate(spec[f], spec[f - diff_frames], mode='full') - # save the middle part - centre = len(c) / 2 - corr[f] = c[centre - diff_bins: centre + diff_bins + 1] - # shift the frame for difference calculation according to the - # highest peak in correlation - bin_offset = diff_bins - np.argmax(corr[f]) - bin_start = diff_bins + bin_offset - bin_stop = bins - 2 * diff_bins + bin_start - diff_spec[f, diff_bins:-diff_bins] = spec[f, diff_bins:-diff_bins] - \ - spec[f - diff_frames, bin_start:bin_stop] - # keep only positive values - if pos: - np.maximum(diff_spec, 0, diff_spec) - return np.asarray(diff_spec) - - -# onset detection functions pluggable into SpectralOnsetDetection -# Note: all functions here expect a Spectrogram object as their sole argument -# thus it is not enforced that the algorithm does exactly what it is -# supposed to do, but new configurations can be built easily -def high_frequency_content(spectrogram): - """ - High Frequency Content. - - Parameters - ---------- - spectrogram : :class:`Spectrogram` instance - Spectrogram instance. - - Returns - ------- - high_frequency_content : numpy array - High frequency content onset detection function. - - References - ---------- - .. [1] Paul Masri, - "Computer Modeling of Sound for Transformation and Synthesis of - Musical Signals", - PhD thesis, University of Bristol, 1996. - - """ - # HFC emphasizes high frequencies by weighting the magnitude spectrogram - # bins by their respective "number" (starting at low frequencies) - hfc = spectrogram * np.arange(spectrogram.num_bins) - return np.asarray(np.mean(hfc, axis=1)) - - -def spectral_diff(spectrogram, diff_frames=None): - """ - Spectral Diff. - - Parameters - ---------- - spectrogram : :class:`Spectrogram` instance - Spectrogram instance. - diff_frames : int, optional - Number of frames to calculate the diff to. - - Returns - ------- - spectral_diff : numpy array - Spectral diff onset detection function. - - References - ---------- - .. [1] Chris Duxbury, Mark Sandler and Matthew Davis, - "A hybrid approach to musical note onset detection", - Proceedings of the 5th International Conference on Digital Audio - Effects (DAFx), 2002. - - """ - from madmom.audio.spectrogram import SpectrogramDifference - # if the diff of a spectrogram is given, do not calculate the diff twice - if not isinstance(spectrogram, SpectrogramDifference): - spectrogram = spectrogram.diff(diff_frames=diff_frames, - positive_diffs=True) - # Spectral diff is the sum of all squared positive 1st order differences - return np.asarray(np.sum(spectrogram ** 2, axis=1)) - - -def spectral_flux(spectrogram, diff_frames=None): - """ - Spectral Flux. - - Parameters - ---------- - spectrogram : :class:`Spectrogram` instance - Spectrogram instance. - diff_frames : int, optional - Number of frames to calculate the diff to. - - Returns - ------- - spectral_flux : numpy array - Spectral flux onset detection function. - - References - ---------- - .. [1] Paul Masri, - "Computer Modeling of Sound for Transformation and Synthesis of - Musical Signals", - PhD thesis, University of Bristol, 1996. - - """ - from madmom.audio.spectrogram import SpectrogramDifference - # if the diff of a spectrogram is given, do not calculate the diff twice - if not isinstance(spectrogram, SpectrogramDifference): - spectrogram = spectrogram.diff(diff_frames=diff_frames, - positive_diffs=True) - # Spectral flux is the sum of all positive 1st order differences - return np.asarray(np.sum(spectrogram, axis=1)) - - -def superflux(spectrogram, diff_frames=None, diff_max_bins=3): - """ - SuperFlux method with a maximum filter vibrato suppression stage. - - Calculates the difference of bin k of the magnitude spectrogram relative to - the N-th previous frame with the maximum filtered spectrogram. - - Parameters - ---------- - spectrogram : :class:`Spectrogram` instance - Spectrogram instance. - diff_frames : int, optional - Number of frames to calculate the diff to. - diff_max_bins : int, optional - Number of bins used for maximum filter. - - Returns - ------- - superflux : numpy array - SuperFlux onset detection function. - - Notes - ----- - This method works only properly, if the spectrogram is filtered with a - filterbank of the right frequency spacing. Filter banks with 24 bands per - octave (i.e. quarter-tone resolution) usually yield good results. With - `max_bins` = 3, the maximum of the bins k-1, k, k+1 of the frame - `diff_frames` to the left is used for the calculation of the difference. - - References - ---------- - .. [1] Sebastian Böck and Gerhard Widmer, - "Maximum Filter Vibrato Suppression for Onset Detection", - Proceedings of the 16th International Conference on Digital Audio - Effects (DAFx), 2013. - - """ - from madmom.audio.spectrogram import SpectrogramDifference - # if the diff of a spectrogram is given, do not calculate the diff twice - if not isinstance(spectrogram, SpectrogramDifference): - spectrogram = spectrogram.diff(diff_frames=diff_frames, - diff_max_bins=diff_max_bins, - positive_diffs=True) - # SuperFlux is the sum of all positive 1st order max. filtered differences - return np.asarray(np.sum(spectrogram, axis=1)) - - -# TODO: should this be its own class so that we can set the filter -# sizes in seconds instead of frames? -def complex_flux(spectrogram, diff_frames=None, diff_max_bins=3, - temporal_filter=3, temporal_origin=0): - """ - ComplexFlux. - - ComplexFlux is based on the SuperFlux, but adds an additional local group - delay based tremolo suppression. - - Parameters - ---------- - spectrogram : :class:`Spectrogram` instance - :class:`Spectrogram` instance. - diff_frames : int, optional - Number of frames to calculate the diff to. - diff_max_bins : int, optional - Number of bins used for maximum filter. - temporal_filter : int, optional - Temporal maximum filtering of the local group delay [frames]. - temporal_origin : int, optional - Origin of the temporal maximum filter. - - Returns - ------- - complex_flux : numpy array - ComplexFlux onset detection function. - - References - ---------- - .. [1] Sebastian Böck and Gerhard Widmer, - "Local group delay based vibrato and tremolo suppression for onset - detection", - Proceedings of the 14th International Society for Music Information - Retrieval Conference (ISMIR), 2013. - - """ - # create a mask based on the local group delay information - # take only absolute values of the local group delay and normalize them - lgd = np.abs(spectrogram.stft.phase().lgd()) / np.pi - # maximum filter along the temporal axis - # TODO: use HPSS instead of simple temporal filtering - if temporal_filter > 0: - lgd = maximum_filter(lgd, size=[temporal_filter, 1], - origin=temporal_origin) - # lgd = uniform_filter(lgd, size=[1, 3]) # better for percussive onsets - # create the weighting mask - try: - # if the magnitude spectrogram was filtered, use the minimum local - # group delay value of each filterbank (expanded by one frequency - # bin in both directions) as the mask - mask = np.zeros_like(spectrogram) - num_bins = lgd.shape[1] - for b in range(mask.shape[1]): - # determine the corner bins for the mask - corner_bins = np.nonzero(spectrogram.filterbank[:, b])[0] - # always expand to the next neighbour - start_bin = corner_bins[0] - 1 - stop_bin = corner_bins[-1] + 2 - # constrain the range - if start_bin < 0: - start_bin = 0 - if stop_bin > num_bins: - stop_bin = num_bins - # set mask - mask[:, b] = np.amin(lgd[:, start_bin: stop_bin], axis=1) - except AttributeError: - # if the spectrogram is not filtered, use a simple minimum filter - # covering only the current bin and its neighbours - mask = minimum_filter(lgd, size=[1, 3]) - # sum all positive 1st order max. filtered and weighted differences - diff = spectrogram.diff(diff_frames=diff_frames, - diff_max_bins=diff_max_bins, - positive_diffs=True) - return np.asarray(np.sum(diff * mask, axis=1)) - - -def modified_kullback_leibler(spectrogram, diff_frames=1, epsilon=EPSILON): - """ - Modified Kullback-Leibler. - - Parameters - ---------- - spectrogram : :class:`Spectrogram` instance - :class:`Spectrogram` instance. - diff_frames : int, optional - Number of frames to calculate the diff to. - epsilon : float, optional - Add `epsilon` to the `spectrogram` avoid division by 0. - - Returns - ------- - modified_kullback_leibler : numpy array - MKL onset detection function. - - Notes - ----- - The implementation presented in [1]_ is used instead of the original work - presented in [2]_. - - References - ---------- - .. [1] Paul Brossier, - "Automatic Annotation of Musical Audio for Interactive - Applications", - PhD thesis, Queen Mary University of London, 2006. - .. [2] Stephen Hainsworth and Malcolm Macleod, - "Onset Detection in Musical Audio Signals", - Proceedings of the International Computer Music Conference (ICMC), - 2003. - - """ - if epsilon <= 0: - raise ValueError("a positive value must be added before division") - mkl = np.zeros_like(spectrogram) - mkl[diff_frames:] = (spectrogram[diff_frames:] / - (spectrogram[:-diff_frames] + epsilon)) - # note: the original MKL uses sum instead of mean, - # but the range of mean is much more suitable - return np.asarray(np.mean(np.log(1 + mkl), axis=1)) - - -def _phase_deviation(phase): - """ - Helper function used by phase_deviation() & weighted_phase_deviation(). - - Parameters - ---------- - phase : numpy array - Phase of the STFT. - - Returns - ------- - numpy array - Phase deviation. - - """ - pd = np.zeros_like(phase) - # instantaneous frequency is given by the first difference - # ψ′(n, k) = ψ(n, k) − ψ(n − 1, k) - # change in instantaneous frequency is given by the second order difference - # ψ′′(n, k) = ψ′(n, k) − ψ′(n − 1, k) - pd[2:] = phase[2:] - 2 * phase[1:-1] + phase[:-2] - # map to the range -pi..pi - return np.asarray(wrap_to_pi(pd)) - - -def phase_deviation(spectrogram): - """ - Phase Deviation. - - Parameters - ---------- - spectrogram : :class:`Spectrogram` instance - :class:`Spectrogram` instance. - - Returns - ------- - phase_deviation : numpy array - Phase deviation onset detection function. - - References - ---------- - .. [1] Juan Pablo Bello, Chris Duxbury, Matthew Davies and Mark Sandler, - "On the use of phase and energy for musical onset detection in the - complex domain", - IEEE Signal Processing Letters, Volume 11, Number 6, 2004. - - """ - # absolute phase changes in instantaneous frequency - pd = np.abs(_phase_deviation(spectrogram.stft.phase())) - return np.asarray(np.mean(pd, axis=1)) - - -def weighted_phase_deviation(spectrogram): - """ - Weighted Phase Deviation. - - Parameters - ---------- - spectrogram : :class:`Spectrogram` instance - :class:`Spectrogram` instance. - - Returns - ------- - weighted_phase_deviation : numpy array - Weighted phase deviation onset detection function. - - References - ---------- - .. [1] Simon Dixon, - "Onset Detection Revisited", - Proceedings of the 9th International Conference on Digital Audio - Effects (DAFx), 2006. - - """ - # cache phase - phase = spectrogram.stft.phase() - # make sure the spectrogram is not filtered before - if np.shape(phase) != np.shape(spectrogram): - raise ValueError('spectrogram and phase must be of same shape') - # weighted_phase_deviation = spectrogram * phase_deviation - wpd = np.abs(_phase_deviation(phase) * spectrogram) - return np.asarray(np.mean(wpd, axis=1)) - - -def normalized_weighted_phase_deviation(spectrogram, epsilon=EPSILON): - """ - Normalized Weighted Phase Deviation. - - Parameters - ---------- - spectrogram : :class:`Spectrogram` instance - :class:`Spectrogram` instance. - epsilon : float, optional - Add `epsilon` to the `spectrogram` avoid division by 0. - - Returns - ------- - normalized_weighted_phase_deviation : numpy array - Normalized weighted phase deviation onset detection function. - - References - ---------- - .. [1] Simon Dixon, - "Onset Detection Revisited", - Proceedings of the 9th International Conference on Digital Audio - Effects (DAFx), 2006. - - """ - if epsilon <= 0: - raise ValueError("a positive value must be added before division") - # normalize WPD by the sum of the spectrogram - # (add a small epsilon so that we don't divide by 0) - norm = np.add(np.mean(spectrogram, axis=1), epsilon) - return np.asarray(weighted_phase_deviation(spectrogram) / norm) - - -def _complex_domain(spectrogram): - """ - Helper method used by complex_domain() & rectified_complex_domain(). - - Parameters - ---------- - spectrogram : :class:`Spectrogram` instance - :class:`Spectrogram` instance. - - Returns - ------- - numpy array - Complex domain onset detection function. - - Notes - ----- - We use the simple implementation presented in [1]_. - - References - ---------- - .. [1] Simon Dixon, - "Onset Detection Revisited", - Proceedings of the 9th International Conference on Digital Audio - Effects (DAFx), 2006. - - """ - # cache phase - phase = spectrogram.stft.phase() - # make sure the spectrogram is not filtered before - if np.shape(phase) != np.shape(spectrogram): - raise ValueError('spectrogram and phase must be of same shape') - # expected spectrogram - cd_target = np.zeros_like(phase) - # assume constant phase change - cd_target[1:] = 2 * phase[1:] - phase[:-1] - # add magnitude - cd_target = spectrogram * np.exp(1j * cd_target) - # create complex spectrogram - cd = spectrogram * np.exp(1j * phase) - # subtract the target values - cd[1:] -= cd_target[:-1] - return np.asarray(cd) - - -def complex_domain(spectrogram): - """ - Complex Domain. - - Parameters - ---------- - spectrogram : :class:`Spectrogram` instance - :class:`Spectrogram` instance. - - Returns - ------- - complex_domain : numpy array - Complex domain onset detection function. - - References - ---------- - .. [1] Juan Pablo Bello, Chris Duxbury, Matthew Davies and Mark Sandler, - "On the use of phase and energy for musical onset detection in the - complex domain", - IEEE Signal Processing Letters, Volume 11, Number 6, 2004. - - """ - # take the sum of the absolute changes - return np.asarray(np.sum(np.abs(_complex_domain(spectrogram)), axis=1)) - - -def rectified_complex_domain(spectrogram, diff_frames=None): - """ - Rectified Complex Domain. - - Parameters - ---------- - spectrogram : :class:`Spectrogram` instance - :class:`Spectrogram` instance. - diff_frames : int, optional - Number of frames to calculate the diff to. - - Returns - ------- - rectified_complex_domain : numpy array - Rectified complex domain onset detection function. - - References - ---------- - .. [1] Simon Dixon, - "Onset Detection Revisited", - Proceedings of the 9th International Conference on Digital Audio - Effects (DAFx), 2006. - - """ - # rectified complex domain - rcd = _complex_domain(spectrogram) - # only keep values where the magnitude rises - pos_diff = spectrogram.diff(diff_frames=diff_frames, positive_diffs=True) - rcd *= pos_diff.astype(bool) - # take the sum of the absolute changes - return np.asarray(np.sum(np.abs(rcd), axis=1)) - - -class SpectralOnsetProcessor(SequentialProcessor): - """ - The SpectralOnsetProcessor class implements most of the common onset - detection functions based on the magnitude or phase information of a - spectrogram. - - Parameters - ---------- - onset_method : str, optional - Onset detection function. See `METHODS` for possible values. - kwargs : dict, optional - Keyword arguments passed to the pre-processing chain to obtain a - spectral representation of the signal. - - Notes - ----- - If the spectrogram should be filtered, the `filterbank` parameter must - contain a valid Filterbank, if it should be scaled logarithmically, `log` - must be set accordingly. - - References - ---------- - .. [1] Paul Masri, - "Computer Modeling of Sound for Transformation and Synthesis of - Musical Signals", - PhD thesis, University of Bristol, 1996. - .. [2] Sebastian Böck and Gerhard Widmer, - "Maximum Filter Vibrato Suppression for Onset Detection", - Proceedings of the 16th International Conference on Digital Audio - Effects (DAFx), 2013. - - Examples - -------- - - Create a SpectralOnsetProcessor and pass a file through the processor to - obtain an onset detection function. Per default the spectral flux [1]_ is - computed on a simple Spectrogram. - - >>> sodf = SpectralOnsetProcessor() - >>> sodf # doctest: +ELLIPSIS - <madmom.features.onsets.SpectralOnsetProcessor object at 0x...> - >>> sodf.processors[-1] # doctest: +ELLIPSIS - <function spectral_flux at 0x...> - >>> sodf('tests/data/audio/sample.wav') - ... # doctest: +NORMALIZE_WHITESPACE +ELLIPSIS - array([ 0. , 100.90121, ..., 26.30577, 20.94439], dtype=float32) - - The parameters passed to the signal pre-processing chain can be set when - creating the SpectralOnsetProcessor. E.g. to obtain the SuperFlux [2]_ - onset detection function set these parameters: - - >>> from madmom.audio.filters import LogarithmicFilterbank - >>> sodf = SpectralOnsetProcessor(onset_method='superflux', fps=200, - ... filterbank=LogarithmicFilterbank, - ... num_bands=24, log=np.log10) - >>> sodf('tests/data/audio/sample.wav') - ... # doctest: +NORMALIZE_WHITESPACE +ELLIPSIS - array([ 0. , 0. , 2.0868 , 1.02404, ..., 0.29888, 0.12122], dtype=float32) - - """ - - METHODS = ['superflux', 'complex_flux', 'high_frequency_content', - 'spectral_diff', 'spectral_flux', 'modified_kullback_leibler', - 'phase_deviation', 'weighted_phase_deviation', - 'normalized_weighted_phase_deviation', 'complex_domain', - 'rectified_complex_domain'] - - def __init__(self, onset_method='spectral_flux', **kwargs): - import inspect - from ..audio.signal import SignalProcessor, FramedSignalProcessor - from ..audio.stft import ShortTimeFourierTransformProcessor - from ..audio.spectrogram import (SpectrogramProcessor, - FilteredSpectrogramProcessor, - LogarithmicSpectrogramProcessor) - # for certain methods we need to circular shift the signal before STFT - if any(odf in onset_method for odf in ('phase', 'complex')): - kwargs['circular_shift'] = True - # always use mono signals - kwargs['num_channels'] = 1 - # define processing chain - sig = SignalProcessor(**kwargs) - frames = FramedSignalProcessor(**kwargs) - stft = ShortTimeFourierTransformProcessor(**kwargs) - spec = SpectrogramProcessor(**kwargs) - processors = [sig, frames, stft, spec] - # filtering needed? - if 'filterbank' in kwargs.keys() and kwargs['filterbank'] is not None: - processors.append(FilteredSpectrogramProcessor(**kwargs)) - # scaling needed? - if 'log' in kwargs.keys() and kwargs['log'] is not None: - processors.append(LogarithmicSpectrogramProcessor(**kwargs)) - # odf function - if not inspect.isfunction(onset_method): - try: - onset_method = globals()[onset_method] - except KeyError: - raise ValueError('%s not a valid onset detection function, ' - 'choose %s.' % (onset_method, self.METHODS)) - processors.append(onset_method) - # instantiate a SequentialProcessor - super(SpectralOnsetProcessor, self).__init__(processors) - - @classmethod - def add_arguments(cls, parser, onset_method=None): - """ - Add spectral onset detection arguments to an existing parser. - - Parameters - ---------- - parser : argparse parser instance - Existing argparse parser object. - onset_method : str, optional - Default onset detection method. - - Returns - ------- - parser_group : argparse argument group - Spectral onset detection argument parser group. - - """ - # add onset detection method arguments to the existing parser - g = parser.add_argument_group('spectral onset detection arguments') - if onset_method is not None: - g.add_argument('--odf', dest='onset_method', - default=onset_method, choices=cls.METHODS, - help='use this onset detection function ' - '[default=%(default)s]') - # return the argument group so it can be modified if needed - return g - - -# classes for detecting onsets with NNs -class RNNOnsetProcessor(SequentialProcessor): - """ - Processor to get a onset activation function from multiple RNNs. - - Parameters - ---------- - online : bool, optional - Choose networks suitable for online onset detection, i.e. use - unidirectional RNNs. - - Notes - ----- - This class uses either uni- or bi-directional RNNs. Contrary to [1], it - uses simple tanh units as in [2]. Also the input representations changed - to use logarithmically filtered and scaled spectrograms. - - References - ---------- - .. [1] "Universal Onset Detection with bidirectional Long Short-Term Memory - Neural Networks" - Florian Eyben, Sebastian Böck, Björn Schuller and Alex Graves. - Proceedings of the 11th International Society for Music Information - Retrieval Conference (ISMIR), 2010. - .. [2] "Online Real-time Onset Detection with Recurrent Neural Networks" - Sebastian Böck, Andreas Arzt, Florian Krebs and Markus Schedl. - Proceedings of the 15th International Conference on Digital Audio - Effects (DAFx), 2012. - - Examples - -------- - Create a RNNOnsetProcessor and pass a file through the processor to obtain - an onset detection function (sampled with 100 frames per second). - - >>> proc = RNNOnsetProcessor() - >>> proc # doctest: +ELLIPSIS - <madmom.features.onsets.RNNOnsetProcessor object at 0x...> - >>> proc('tests/data/audio/sample.wav') # doctest: +ELLIPSIS - array([0.08313, 0.0024 , ... 0.00527], dtype=float32) - - """ - - def __init__(self, **kwargs): - # pylint: disable=unused-argument - from ..audio.signal import SignalProcessor, FramedSignalProcessor - from ..audio.stft import ShortTimeFourierTransformProcessor - from ..audio.spectrogram import ( - FilteredSpectrogramProcessor, LogarithmicSpectrogramProcessor, - SpectrogramDifferenceProcessor) - from ..models import ONSETS_RNN, ONSETS_BRNN - from ..ml.nn import NeuralNetworkEnsemble - - # choose the appropriate models and set frame sizes accordingly - if kwargs.get('online'): - nn_files = ONSETS_RNN - frame_sizes = [512, 1024, 2048] - else: - nn_files = ONSETS_BRNN - frame_sizes = [1024, 2048, 4096] - - # define pre-processing chain - sig = SignalProcessor(num_channels=1, sample_rate=44100) - # process the multi-resolution spec & diff in parallel - multi = ParallelProcessor([]) - for frame_size in frame_sizes: - # pass **kwargs in order to be able to process in online mode - frames = FramedSignalProcessor(frame_size=frame_size, **kwargs) - stft = ShortTimeFourierTransformProcessor() # caching FFT window - filt = FilteredSpectrogramProcessor( - num_bands=6, fmin=30, fmax=17000, norm_filters=True) - spec = LogarithmicSpectrogramProcessor(mul=5, add=1) - diff = SpectrogramDifferenceProcessor( - diff_ratio=0.25, positive_diffs=True, stack_diffs=np.hstack) - # process each frame size with spec and diff sequentially - multi.append(SequentialProcessor((frames, stft, filt, spec, diff))) - # stack the features and processes everything sequentially - pre_processor = SequentialProcessor((sig, multi, np.hstack)) - - # process the pre-processed signal with a NN ensemble - nn = NeuralNetworkEnsemble.load(nn_files, **kwargs) - - # instantiate a SequentialProcessor - super(RNNOnsetProcessor, self).__init__((pre_processor, nn)) - - -# must be a top-level function to be pickle-able -def _cnn_onset_processor_pad(data): - """Pad the data by repeating the first and last frame 7 times.""" - pad_start = np.repeat(data[:1], 7, axis=0) - pad_stop = np.repeat(data[-1:], 7, axis=0) - return np.concatenate((pad_start, data, pad_stop)) - - -class CNNOnsetProcessor(SequentialProcessor): - """ - Processor to get a onset activation function from a CNN. - - References - ---------- - .. [1] "Musical Onset Detection with Convolutional Neural Networks" - Jan Schlüter and Sebastian Böck. - Proceedings of the 6th International Workshop on Machine Learning - and Music, 2013. - - Notes - ----- - The implementation follows as closely as possible the original one, but - part of the signal pre-processing differs in minor aspects, so results can - differ slightly, too. - - Examples - -------- - Create a CNNOnsetProcessor and pass a file through the processor to obtain - an onset detection function (sampled with 100 frames per second). - - >>> proc = CNNOnsetProcessor() - >>> proc # doctest: +ELLIPSIS - <madmom.features.onsets.CNNOnsetProcessor object at 0x...> - >>> proc('tests/data/audio/sample.wav') # doctest: +ELLIPSIS - array([0.05369, 0.04205, ... 0.00014], dtype=float32) - - """ - - def __init__(self, **kwargs): - # pylint: disable=unused-argument - from ..audio.signal import SignalProcessor, FramedSignalProcessor - from ..audio.stft import ShortTimeFourierTransformProcessor - from ..audio.filters import MelFilterbank - from ..audio.spectrogram import (FilteredSpectrogramProcessor, - LogarithmicSpectrogramProcessor) - from ..models import ONSETS_CNN - from ..ml.nn import NeuralNetwork - - # define pre-processing chain - sig = SignalProcessor(num_channels=1, sample_rate=44100) - # process the multi-resolution spec in parallel - multi = ParallelProcessor([]) - for frame_size in [2048, 1024, 4096]: - frames = FramedSignalProcessor(frame_size=frame_size, fps=100) - stft = ShortTimeFourierTransformProcessor() # caching FFT window - filt = FilteredSpectrogramProcessor( - filterbank=MelFilterbank, num_bands=80, fmin=27.5, fmax=16000, - norm_filters=True, unique_filters=False) - spec = LogarithmicSpectrogramProcessor(log=np.log, add=EPSILON) - # process each frame size with spec and diff sequentially - multi.append(SequentialProcessor((frames, stft, filt, spec))) - # stack the features (in depth) and pad at beginning and end - stack = np.dstack - pad = _cnn_onset_processor_pad - # pre-processes everything sequentially - pre_processor = SequentialProcessor((sig, multi, stack, pad)) - - # process the pre-processed signal with a NN ensemble - nn = NeuralNetwork.load(ONSETS_CNN[0]) - - # instantiate a SequentialProcessor - super(CNNOnsetProcessor, self).__init__((pre_processor, nn)) - - -# universal peak-picking method -def peak_picking(activations, threshold, smooth=None, pre_avg=0, post_avg=0, - pre_max=1, post_max=1): - """ - Perform thresholding and peak-picking on the given activation function. - - Parameters - ---------- - activations : numpy array - Activation function. - threshold : float - Threshold for peak-picking - smooth : int or numpy array, optional - Smooth the activation function with the kernel (size). - pre_avg : int, optional - Use `pre_avg` frames past information for moving average. - post_avg : int, optional - Use `post_avg` frames future information for moving average. - pre_max : int, optional - Use `pre_max` frames past information for moving maximum. - post_max : int, optional - Use `post_max` frames future information for moving maximum. - - Returns - ------- - peak_idx : numpy array - Indices of the detected peaks. - - See Also - -------- - :func:`smooth` - - Notes - ----- - If no moving average is needed (e.g. the activations are independent of - the signal's level as for neural network activations), set `pre_avg` and - `post_avg` to 0. - For peak picking of local maxima, set `pre_max` and `post_max` to 1. - For online peak picking, set all `post_` parameters to 0. - - References - ---------- - .. [1] Sebastian Böck, Florian Krebs and Markus Schedl, - "Evaluating the Online Capabilities of Onset Detection Methods", - Proceedings of the 13th International Society for Music Information - Retrieval Conference (ISMIR), 2012. - - """ - # smooth activations - activations = smooth_signal(activations, smooth) - # compute a moving average - avg_length = pre_avg + post_avg + 1 - if avg_length > 1: - # TODO: make the averaging function exchangeable (mean/median/etc.) - avg_origin = int(np.floor((pre_avg - post_avg) / 2)) - if activations.ndim == 1: - filter_size = avg_length - elif activations.ndim == 2: - filter_size = [avg_length, 1] - else: - raise ValueError('`activations` must be either 1D or 2D') - mov_avg = uniform_filter(activations, filter_size, mode='constant', - origin=avg_origin) - else: - # do not use a moving average - mov_avg = 0 - # detections are those activations above the moving average + the threshold - detections = activations * (activations >= mov_avg + threshold) - # peak-picking - max_length = pre_max + post_max + 1 - if max_length > 1: - # compute a moving maximum - max_origin = int(np.floor((pre_max - post_max) / 2)) - if activations.ndim == 1: - filter_size = max_length - elif activations.ndim == 2: - filter_size = [max_length, 1] - else: - raise ValueError('`activations` must be either 1D or 2D') - mov_max = maximum_filter(detections, filter_size, mode='constant', - origin=max_origin) - # detections are peak positions - detections *= (detections == mov_max) - # return indices - if activations.ndim == 1: - return np.nonzero(detections)[0] - elif activations.ndim == 2: - return np.nonzero(detections) - else: - raise ValueError('`activations` must be either 1D or 2D') - - -class OnsetPeakPickingProcessor(OnlineProcessor): - """ - This class implements the onset peak-picking functionality. - It transparently converts the chosen values from seconds to frames. - - Parameters - ---------- - threshold : float - Threshold for peak-picking. - smooth : float, optional - Smooth the activation function over `smooth` seconds. - pre_avg : float, optional - Use `pre_avg` seconds past information for moving average. - post_avg : float, optional - Use `post_avg` seconds future information for moving average. - pre_max : float, optional - Use `pre_max` seconds past information for moving maximum. - post_max : float, optional - Use `post_max` seconds future information for moving maximum. - combine : float, optional - Only report one onset within `combine` seconds. - delay : float, optional - Report the detected onsets `delay` seconds delayed. - online : bool, optional - Use online peak-picking, i.e. no future information. - fps : float, optional - Frames per second used for conversion of timings. - - Returns - ------- - onsets : numpy array - Detected onsets [seconds]. - - Notes - ----- - If no moving average is needed (e.g. the activations are independent of - the signal's level as for neural network activations), `pre_avg` and - `post_avg` should be set to 0. - For peak picking of local maxima, set `pre_max` >= 1. / `fps` and - `post_max` >= 1. / `fps`. - For online peak picking, all `post_` parameters are set to 0. - - References - ---------- - .. [1] Sebastian Böck, Florian Krebs and Markus Schedl, - "Evaluating the Online Capabilities of Onset Detection Methods", - Proceedings of the 13th International Society for Music Information - Retrieval Conference (ISMIR), 2012. - - Examples - -------- - Create a PeakPickingProcessor. The returned array represents the positions - of the onsets in seconds, thus the expected sampling rate has to be given. - - >>> proc = OnsetPeakPickingProcessor(fps=100) - >>> proc # doctest: +ELLIPSIS - <madmom.features.onsets.OnsetPeakPickingProcessor object at 0x...> - - Call this OnsetPeakPickingProcessor with the onset activation function from - an RNNOnsetProcessor to obtain the onset positions. - - >>> act = RNNOnsetProcessor()('tests/data/audio/sample.wav') - >>> proc(act) # doctest: +ELLIPSIS - array([0.09, 0.29, 0.45, ..., 2.34, 2.49, 2.67]) - - """ - FPS = 100 - THRESHOLD = 0.5 # binary threshold - SMOOTH = 0. - PRE_AVG = 0. - POST_AVG = 0. - PRE_MAX = 0. - POST_MAX = 0. - COMBINE = 0.03 - DELAY = 0. - ONLINE = False - - def __init__(self, threshold=THRESHOLD, smooth=SMOOTH, pre_avg=PRE_AVG, - post_avg=POST_AVG, pre_max=PRE_MAX, post_max=POST_MAX, - combine=COMBINE, delay=DELAY, online=ONLINE, fps=FPS, - **kwargs): - # pylint: disable=unused-argument - # instantiate OnlineProcessor - super(OnsetPeakPickingProcessor, self).__init__(online=online) - if self.online: - # set some parameters to 0 (i.e. no future information available) - smooth = 0 - post_avg = 0 - post_max = 0 - # init buffer - self.buffer = None - self.counter = 0 - self.last_onset = None - # save parameters - self.threshold = threshold - self.smooth = smooth - self.pre_avg = pre_avg - self.post_avg = post_avg - self.pre_max = pre_max - self.post_max = post_max - self.combine = combine - self.delay = delay - self.fps = fps - - def reset(self): - """Reset OnsetPeakPickingProcessor.""" - self.buffer = None - self.counter = 0 - self.last_onset = None - - def process_offline(self, activations, **kwargs): - """ - Detect the onsets in the given activation function. - - Parameters - ---------- - activations : numpy array - Onset activation function. - - Returns - ------- - onsets : numpy array - Detected onsets [seconds]. - - """ - # convert timing information to frames and set default values - # TODO: use at least 1 frame if any of these values are > 0? - timings = np.array([self.smooth, self.pre_avg, self.post_avg, - self.pre_max, self.post_max]) * self.fps - timings = np.round(timings).astype(int) - # detect the peaks (function returns int indices) - onsets = peak_picking(activations, self.threshold, *timings) - # convert to timestamps - onsets = onsets.astype(np.float) / self.fps - # shift if necessary - if self.delay: - onsets += self.delay - # combine onsets - if self.combine: - onsets = combine_events(onsets, self.combine, 'left') - # return the onsets - return np.asarray(onsets) - - def process_online(self, activations, reset=True, **kwargs): - """ - Detect the onsets in the given activation function. - - Parameters - ---------- - activations : numpy array - Onset activation function. - reset : bool, optional - Reset the processor to its initial state before processing. - - Returns - ------- - onsets : numpy array - Detected onsets [seconds]. - - """ - # buffer data - if self.buffer is None or reset: - # reset the processor - self.reset() - # put 0s in front (depending on context given by pre_max - init = np.zeros(int(np.round(self.pre_max * self.fps))) - buffer = np.insert(activations, 0, init, axis=0) - # offset the counter, because we buffer the activations - self.counter = -len(init) - # use the data for the buffer - self.buffer = BufferProcessor(init=buffer) - else: - buffer = self.buffer(activations) - # convert timing information to frames and set default values - # TODO: use at least 1 frame if any of these values are > 0? - timings = np.array([self.smooth, self.pre_avg, self.post_avg, - self.pre_max, self.post_max]) * self.fps - timings = np.round(timings).astype(int) - # detect the peaks (function returns int indices) - peaks = peak_picking(buffer, self.threshold, *timings) - # convert to onset timings - onsets = (self.counter + peaks) / float(self.fps) - # increase counter - self.counter += len(activations) - # shift if necessary - if self.delay: - raise ValueError('delay not supported yet in online mode') - # report only if there was no onset within the last combine seconds - if self.combine and onsets.any(): - # prepend the last onset to be able to combine them correctly - start = 0 - if self.last_onset is not None: - onsets = np.append(self.last_onset, onsets) - start = 1 - # combine the onsets - onsets = combine_events(onsets, self.combine, 'left') - # use only if the last onsets differ - if onsets[-1] != self.last_onset: - self.last_onset = onsets[-1] - # remove the first onset if we added it previously - onsets = onsets[start:] - else: - # don't report an onset - onsets = np.empty(0) - # return the onsets - return onsets - - process_sequence = process_offline - - @staticmethod - def add_arguments(parser, threshold=THRESHOLD, smooth=None, pre_avg=None, - post_avg=None, pre_max=None, post_max=None, - combine=COMBINE, delay=DELAY): - """ - Add onset peak-picking related arguments to an existing parser. - - Parameters - ---------- - parser : argparse parser instance - Existing argparse parser object. - threshold : float - Threshold for peak-picking. - smooth : float, optional - Smooth the activation function over `smooth` seconds. - pre_avg : float, optional - Use `pre_avg` seconds past information for moving average. - post_avg : float, optional - Use `post_avg` seconds future information for moving average. - pre_max : float, optional - Use `pre_max` seconds past information for moving maximum. - post_max : float, optional - Use `post_max` seconds future information for moving maximum. - combine : float, optional - Only report one onset within `combine` seconds. - delay : float, optional - Report the detected onsets `delay` seconds delayed. - - Returns - ------- - parser_group : argparse argument group - Onset peak-picking argument parser group. - - Notes - ----- - Parameters are included in the group only if they are not 'None'. - - """ - # add onset peak-picking related options to the existing parser - g = parser.add_argument_group('peak-picking arguments') - g.add_argument('-t', dest='threshold', action='store', type=float, - default=threshold, - help='detection threshold [default=%(default).2f]') - if smooth is not None: - g.add_argument('--smooth', action='store', type=float, - default=smooth, - help='smooth the activation function over N ' - 'seconds [default=%(default).2f]') - if pre_avg is not None: - g.add_argument('--pre_avg', action='store', type=float, - default=pre_avg, - help='build average over N previous seconds ' - '[default=%(default).2f]') - if post_avg is not None: - g.add_argument('--post_avg', action='store', type=float, - default=post_avg, - help='build average over N following seconds ' - '[default=%(default).2f]') - if pre_max is not None: - g.add_argument('--pre_max', action='store', type=float, - default=pre_max, - help='search maximum over N previous seconds ' - '[default=%(default).2f]') - if post_max is not None: - g.add_argument('--post_max', action='store', type=float, - default=post_max, - help='search maximum over N following seconds ' - '[default=%(default).2f]') - if combine is not None: - g.add_argument('--combine', action='store', type=float, - default=combine, - help='combine events within N seconds ' - '[default=%(default).2f]') - if delay is not None: - g.add_argument('--delay', action='store', type=float, - default=delay, - help='report the events N seconds delayed ' - '[default=%(default)i]') - # return the argument group so it can be modified if needed - return g diff --git a/spaces/MestikonAgency/README/README.md b/spaces/MestikonAgency/README/README.md deleted file mode 100644 index 7de8dff21de0e04808bb6c19ec2a2f258d001fb4..0000000000000000000000000000000000000000 --- a/spaces/MestikonAgency/README/README.md +++ /dev/null @@ -1,104 +0,0 @@ -# Llama 2 - -We are unlocking the power of large language models. Our latest version of Llama is now accessible to individuals, creators, researchers and businesses of all sizes so that they can experiment, innovate and scale their ideas responsibly. - -This release includes model weights and starting code for pretrained and fine-tuned Llama language models — ranging from 7B to 70B parameters. - -This repository is intended as a minimal example to load [Llama 2](https://ai.meta.com/research/publications/llama-2-open-foundation-and-fine-tuned-chat-models/) models and run inference. For more detailed examples leveraging Hugging Face, see [llama-recipes](https://github.com/facebookresearch/llama-recipes/). - -## Updates post-launch - -See [UPDATES.md](UPDATES.md). - -## Download - -⚠️ **7/18: We're aware of people encountering a number of download issues today. Anyone still encountering issues should remove all local files, re-clone the repository, and [request a new download link](https://ai.meta.com/resources/models-and-libraries/llama-downloads/). It's critical to do all of these in case you have local corrupt files.** - -In order to download the model weights and tokenizer, please visit the [Meta AI website](https://ai.meta.com/resources/models-and-libraries/llama-downloads/) and accept our License. - -Once your request is approved, you will receive a signed URL over email. Then run the download.sh script, passing the URL provided when prompted to start the download. - -Pre-requisites: Make sure you have `wget` and `md5sum` installed. Then to run the script: `./download.sh`. - -Keep in mind that the links expire after 24 hours and a certain amount of downloads. If you start seeing errors such as `403: Forbidden`, you can always re-request a link. - -### Access on Hugging Face - -We are also providing downloads on [Hugging Face](https://huggingface.co/meta-llama). You must first request a download from the Meta AI website using the same email address as your Hugging Face account. After doing so, you can request access to any of the models on Hugging Face and within 1-2 days your account will be granted access to all versions. - -## Setup - -In a conda env with PyTorch / CUDA available, clone the repo and run in the top-level directory: - -``` -pip install -e . -``` - -## Inference - -Different models require different model-parallel (MP) values: - -| Model | MP | -|--------|----| -| 7B | 1 | -| 13B | 2 | -| 70B | 8 | - -All models support sequence length up to 4096 tokens, but we pre-allocate the cache according to `max_seq_len` and `max_batch_size` values. So set those according to your hardware. - -### Pretrained Models - -These models are not finetuned for chat or Q&A. They should be prompted so that the expected answer is the natural continuation of the prompt. - -See `example_text_completion.py` for some examples. To illustrate, see the command below to run it with the llama-2-7b model (`nproc_per_node` needs to be set to the `MP` value): - -``` -torchrun --nproc_per_node 1 example_text_completion.py \ - --ckpt_dir llama-2-7b/ \ - --tokenizer_path tokenizer.model \ - --max_seq_len 128 --max_batch_size 4 -``` - -### Fine-tuned Chat Models - -The fine-tuned models were trained for dialogue applications. To get the expected features and performance for them, a specific formatting defined in [`chat_completion`](https://github.com/facebookresearch/llama/blob/main/llama/generation.py#L212) -needs to be followed, including the `INST` and `<<SYS>>` tags, `BOS` and `EOS` tokens, and the whitespaces and breaklines in between (we recommend calling `strip()` on inputs to avoid double-spaces). - -You can also deploy additional classifiers for filtering out inputs and outputs that are deemed unsafe. See the llama-recipes repo for [an example](https://github.com/facebookresearch/llama-recipes/blob/main/inference/inference.py) of how to add a safety checker to the inputs and outputs of your inference code. - -Examples using llama-2-7b-chat: - -``` -torchrun --nproc_per_node 1 example_chat_completion.py \ - --ckpt_dir llama-2-7b-chat/ \ - --tokenizer_path tokenizer.model \ - --max_seq_len 512 --max_batch_size 6 -``` - -Llama 2 is a new technology that carries potential risks with use. Testing conducted to date has not — and could not — cover all scenarios. -In order to help developers address these risks, we have created the [Responsible Use Guide](Responsible-Use-Guide.pdf). More details can be found in our research paper as well. - -## Issues - -Please report any software “bug,” or other problems with the models through one of the following means: -- Reporting issues with the model: [github.com/facebookresearch/llama](http://github.com/facebookresearch/llama) -- Reporting risky content generated by the model: [developers.facebook.com/llama_output_feedback](http://developers.facebook.com/llama_output_feedback) -- Reporting bugs and security concerns: [facebook.com/whitehat/info](http://facebook.com/whitehat/info) - -## Model Card -See [MODEL_CARD.md](MODEL_CARD.md). - -## License - -Our model and weights are licensed for both researchers and commercial entities, upholding the principles of openness. Our mission is to empower individuals, and industry through this opportunity, while fostering an environment of discovery and ethical AI advancements. - -See the [LICENSE](LICENSE) file, as well as our accompanying [Acceptable Use Policy](USE_POLICY.md) - -## References - -1. [Research Paper](https://ai.meta.com/research/publications/llama-2-open-foundation-and-fine-tuned-chat-models/) -2. [Llama 2 technical overview](https://ai.meta.com/resources/models-and-libraries/llama) -3. [Open Innovation AI Research Community](https://ai.meta.com/llama/open-innovation-ai-research-community/) - -## Original LLaMA -The repo for the original llama release is in the [`llama_v1`](https://github.com/facebookresearch/llama/tree/llama_v1) branch. diff --git a/spaces/Moses25/llama-7b-chatbot/README.md b/spaces/Moses25/llama-7b-chatbot/README.md deleted file mode 100644 index 8c325ff2786f6c2e9c84e80871c4b8cb8c74b1fb..0000000000000000000000000000000000000000 --- a/spaces/Moses25/llama-7b-chatbot/README.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -title: Llama 7b Chatbot -emoji: 🏃 -colorFrom: purple -colorTo: green -sdk: streamlit -sdk_version: 1.21.0 -app_file: app.py -pinned: false -license: apache-2.0 - ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/NAACL2022/CLIP-Caption-Reward/captioning/utils/rewards.py b/spaces/NAACL2022/CLIP-Caption-Reward/captioning/utils/rewards.py deleted file mode 100644 index 668b830cbdef05d6c3eab8d99a07918a325e9157..0000000000000000000000000000000000000000 --- a/spaces/NAACL2022/CLIP-Caption-Reward/captioning/utils/rewards.py +++ /dev/null @@ -1,392 +0,0 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -import numpy as np -import time -from collections import OrderedDict -import torch - -import sys -try: - sys.path.append("cider") - from pyciderevalcap.ciderD.ciderD import CiderD - from pyciderevalcap.cider.cider import Cider - sys.path.append("coco-caption") - from pycocoevalcap.bleu.bleu import Bleu -except: - print('cider or coco-caption missing') - -CiderD_scorer = None -Cider_scorer = None -Bleu_scorer = None -#CiderD_scorer = CiderD(df='corpus') - - -from .misc import decode_sequence - -def init_scorer(cached_tokens): - global CiderD_scorer - CiderD_scorer = CiderD_scorer or CiderD(df=cached_tokens) - global Cider_scorer - Cider_scorer = Cider_scorer or Cider(df=cached_tokens) - global Bleu_scorer - Bleu_scorer = Bleu_scorer or Bleu(4) - -def array_to_str(arr): - out = '' - for i in range(len(arr)): - out += str(arr[i]) + ' ' - if arr[i] == 0: - break - return out.strip() - -def get_self_critical_reward(greedy_res, data_gts, gen_result, opt): - batch_size = len(data_gts) - gen_result_size = gen_result.shape[0] - seq_per_img = gen_result_size // len(data_gts) # gen_result_size = batch_size * seq_per_img - assert greedy_res.shape[0] == batch_size - - res = OrderedDict() - gen_result = gen_result.data.cpu().numpy() - greedy_res = greedy_res.data.cpu().numpy() - for i in range(gen_result_size): - res[i] = [array_to_str(gen_result[i])] - for i in range(batch_size): - res[gen_result_size + i] = [array_to_str(greedy_res[i])] - - gts = OrderedDict() - for i in range(len(data_gts)): - gts[i] = [array_to_str(data_gts[i][j]) for j in range(len(data_gts[i]))] - - res_ = [{'image_id':i, 'caption': res[i]} for i in range(len(res))] - res__ = {i: res[i] for i in range(len(res_))} - gts_ = {i: gts[i // seq_per_img] for i in range(gen_result_size)} - gts_.update({i+gen_result_size: gts[i] for i in range(batch_size)}) - if opt.cider_reward_weight > 0: - _, cider_scores = CiderD_scorer.compute_score(gts_, res_) - if hasattr(opt, 'verbose') and not opt.verbose: - pass - else: - print('Cider scores:', _) - else: - cider_scores = 0 - if opt.bleu_reward_weight > 0: - _, bleu_scores = Bleu_scorer.compute_score(gts_, res__) - bleu_scores = np.array(bleu_scores[3]) - if hasattr(opt, 'verbose') and not opt.verbose: - pass - else: - print('Bleu scores:', _[3]) - else: - bleu_scores = 0 - scores = opt.cider_reward_weight * cider_scores + opt.bleu_reward_weight * bleu_scores - - unnormalized_reward_mean = scores[:gen_result_size].flatten().mean() - - scores = scores[:gen_result_size].reshape(batch_size, seq_per_img) - scores[-batch_size:][:, np.newaxis] - - scores = scores.reshape(gen_result_size) - - rewards = np.repeat(scores[:, np.newaxis], gen_result.shape[1], 1) - - return rewards, unnormalized_reward_mean - - -def get_self_critical_clipscore_reward(greedy_res, data_gts, gen_result, opt, clipscore_model, clip_vis_feats, vocab): - batch_size = len(data_gts) - gen_result_size = gen_result.shape[0] - seq_per_img = gen_result_size // len(data_gts) # gen_result_size = batch_size * seq_per_img - assert greedy_res.shape[0] == batch_size - - B = batch_size - K = seq_per_img - L = gen_result.shape[1] - assert gen_result.shape == (B*K , L) - - # res = OrderedDict() - # gen_result = gen_result.data.cpu().numpy() - # greedy_res = greedy_res.data.cpu().numpy() - # for i in range(gen_result_size): - # res[i] = [array_to_str(gen_result[i])] - # for i in range(batch_size): - # res[gen_result_size + i] = [array_to_str(greedy_res[i])] - - # gts = OrderedDict() - # for i in range(len(data_gts)): - # gts[i] = [array_to_str(data_gts[i][j]) for j in range(len(data_gts[i]))] - - # res_ = [{'image_id':i, 'caption': res[i]} for i in range(len(res))] - # res__ = {i: res[i] for i in range(len(res_))} - # gts_ = {i: gts[i // seq_per_img] for i in range(gen_result_size)} - # gts_.update({i+gen_result_size: gts[i] for i in range(batch_size)}) - - # res = [] - # gen_result = gen_result.data.cpu().numpy() - # greedy_res = greedy_res.data.cpu().numpy() - # # for i in range(gen_result_size): - # # res.append(array_to_str(gen_result[i])) - # res.extend(decode_sequence(vocab, gen_result)) - - - # # for i in range(batch_size): - # # res.append(array_to_str(greedy_res[i])) - # res.extend(decode_sequence(vocab, greedy_res)) - - if clipscore_model.mode == 'refclip_s': - gts = [] - gts_valid_mask = [] - max_n_refs = max([len(_gts) for _gts in data_gts]) - for i in range(len(data_gts)): - _gts = decode_sequence(vocab, data_gts[i]) - # pad references - n_ref = len(_gts) - _gts.extend([''] * (max_n_refs - n_ref)) - gts.extend(_gts) - gts_valid_mask.extend([1] * n_ref + [0] * (max_n_refs - n_ref)) - assert len(gts) == B * max_n_refs - assert len(gts_valid_mask) == B * max_n_refs - - # print(gts) - # print(gts_valid_mask) - # exit() - - - # assert len(res) == B * K + B, len(res) - - # print(res) - # exit() - - if opt.clipscore_reward_weight > 0: - with torch.no_grad(): - clipscore_model.eval() - - # 1) calculate reward - gen_result = gen_result.data.cpu().numpy() - res = decode_sequence(vocab, gen_result) - assert len(res) == B * K, len(res) - - # [B * K, dim) - if getattr(opt, 'use_grammar', False) and not getattr(opt, 'joint_out', False): - text_pre_feat = clipscore_model.text_extract(res, proj_norm=False) - - grammar_logit = clipscore_model.grammar_score_head(text_pre_feat.view(-1, 512)) - grammar_prob = torch.softmax(grammar_logit, dim=-1)[:, 1] - grammar_prob = grammar_prob.view(B*K).detach() - - text_feat = clipscore_model.clip_model.text_projection(text_pre_feat) - text_feat = text_feat / text_feat.norm(dim=-1, keepdim=True) - - else: - text_feat = clipscore_model.text_extract(res) - - - assert text_feat.size() == (B * K, 512), text_feat.size() - assert clip_vis_feats.size() == (B, 512), clip_vis_feats.size() - - # [B * K, dim] - vis_feat = clip_vis_feats.view(B, 1, -1).expand(-1, K, -1).contiguous().view(B * K, -1) - - clip_s = clipscore_model(text_feat=text_feat, img_feat=vis_feat, mode='clip_s') - clip_s = clip_s.view(B * K).detach() - - if clipscore_model.mode == 'refclip_s': - # [B * n_ref, dim] - ref_text_feat = clipscore_model.text_extract(gts) - ref_text_mask = torch.tensor(gts_valid_mask, dtype=ref_text_feat.dtype, device=ref_text_feat.device) - - assert ref_text_feat.size() == (B * max_n_refs, 512), ref_text_feat.size() - assert ref_text_mask.size() == (B * max_n_refs,), ref_text_mask.size() - - # [B * K] - refclip_s = clipscore_model.calc_refclip_s( - text_feat=text_feat, img_feat=vis_feat, - ref_text_feat=ref_text_feat.view(B, 1, max_n_refs, -1).expand(-1, K, -1, -1).contiguous().view(B * K * max_n_refs, -1), - ref_text_mask=ref_text_mask.view(B, 1, max_n_refs).expand(-1, K, -1).contiguous().view(B * K * max_n_refs), - clip_s=clip_s) - refclip_s = refclip_s.view(B * K).detach() - - # 2) calcualte reward for baseline (greedy) - greedy_res = greedy_res.data.cpu().numpy() - res = decode_sequence(vocab, greedy_res) - assert len(res) == B, len(res) - - # [B, dim) - - if getattr(opt, 'use_grammar', False) and getattr(opt, 'use_grammar_baseline', False) and not getattr(opt, 'joint_out', False): - text_pre_feat = clipscore_model.text_extract(res, proj_norm=False) - - grammar_logit = clipscore_model.grammar_score_head(text_pre_feat.view(-1, 512)) - grammar_prob_baseline = torch.softmax(grammar_logit, dim=-1)[:, 1] - grammar_prob_baseline = grammar_prob_baseline.view(B).detach() - - text_feat = clipscore_model.clip_model.text_projection(text_pre_feat) - text_feat = text_feat / text_feat.norm(dim=-1, keepdim=True) - else: - text_feat = clipscore_model.text_extract(res) - - assert text_feat.size() == (B, 512), text_feat.size() - assert clip_vis_feats.size() == (B, 512), clip_vis_feats.size() - - vis_feat = clip_vis_feats.view(B, 512) - - # [B] - clip_s_baseline = clipscore_model(text_feat=text_feat, img_feat=vis_feat, mode='clip_s') - clip_s_baseline = clip_s_baseline.view(B).detach() - - if clipscore_model.mode == 'refclip_s': - # # [B * n_ref] - # ref_text_feat = clipscore_model.text_extract(gts) - # ref_text_mask = torch.tensor(gts_valid_mask, dtype=ref_text_feat.dtype, device=ref_text_feat.device) - # assert ref_text_feat.size() == (B * max_n_refs, 512), ref_text_feat.size() - # assert ref_text_mask.size() == (B * max_n_refs), ref_text_mask.size() - - # [B] - refclip_s_baseline = clipscore_model.calc_refclip_s( - text_feat=text_feat, img_feat=vis_feat, - ref_text_feat=ref_text_feat, - ref_text_mask=ref_text_mask, - clip_s=clip_s_baseline) - refclip_s_baseline = refclip_s_baseline.view(B).detach() - - if clipscore_model.mode == 'clip_s': - rewards = clip_s - clip_s_baseline.view(B, 1).expand(-1, K).contiguous().flatten() - unnormalized_mean_reward = clip_s.mean() - elif clipscore_model.mode == 'refclip_s': - rewards = refclip_s - refclip_s_baseline.view(B, 1).expand(-1, K).contiguous().flatten() - unnormalized_mean_reward = refclip_s.mean() - - # # [B * K + B, dim) - # text_feat = clipscore_model.text_extract(res) - # assert text_feat.size() == (B * K + B, 512), text_feat.size() - - # assert clip_vis_feats.size() == (B, 512), clip_vis_feats.size() - - # # [B, dim] -> [B * K + B, dim] - # # vis_feat = clip_vis_feats.view(B, 1, -1).expand(-1, K + 1, -1).contiguous().view(B * (K + 1), -1) - # # vis_feat = clip_vis_feats.view(1, B, -1).expand(K + 1, -1, -1).contiguous().view((K + 1) * B, -1) - - # # [B * K, dim] - # gen_vis_feat = clip_vis_feats.view(B, 1, -1).expand(-1, K, -1).contiguous().view(B * K, -1) - # # [B, dim] - # greedy_vis_feat = clip_vis_feats - # # [B * K + B, dim] - # vis_feat = torch.cat([gen_vis_feat, greedy_vis_feat], dim=0) - - # # if clipscore_model.mode == 'clip_s': - # # [B * K + B, dim] - # clip_s = clipscore_model(text_feat=text_feat, img_feat=vis_feat) - # clip_s = clip_s.view(B * K + B).detach() - - - # if clipscore_model.mode == 'refclip_s': - # # [B * K, dim] - # ref_text_feat = clipscore_model.text_extract(gts) - - # clipscore_scores = clipscore_model.calc_refclip_s(text_feat=text_feat, img_feat=vis_feat, ref_text_feat=ref_text_feat, clip_s=clip_s) - # clipscore_scores = clipscore_scores.view(B * K + B).detach() - - if getattr(opt, 'use_grammar', False) and not getattr(opt, 'joint_out', False): - - if getattr(opt, 'use_grammar_baseline', False): - grammar_rewards = grammar_prob - grammar_prob_baseline.view(B, 1).expand(-1, K).contiguous().flatten() - else: - grammar_rewards = grammar_prob - else: - grammar_rewards = None - - - if hasattr(opt, 'verbose') and not opt.verbose: - pass - else: - if clipscore_model.mode == 'clip_s': - print('CLIP-S:', rewards) - elif clipscore_model.mode == 'refclip_s': - print('RefCLIP-S:', rewards) - else: - rewards = torch.zeros(B, L) - unnormalized_mean_reward = None - grammar_rewards = None - - - rewards = opt.clipscore_reward_weight * rewards - - - # scores = scores[:gen_result_size].reshape(batch_size, seq_per_img) - scores[-batch_size:][:, np.newaxis] - # scores = scores.reshape(gen_result_size) - # rewards = np.repeat(scores[:, np.newaxis], gen_result.shape[1], 1) - - # [B, K] - # scores = scores[:gen_result_size].reshape(B, K) - scores[-B:].unsqueeze(1) - - # [B*K, L] - # rewards = scores.view(-1, 1).expand(-1, L).contiguous() - rewards = rewards.view(-1, 1).expand(-1, L).contiguous() - - if getattr(opt, 'use_grammar', False) and not getattr(opt, 'joint_out', False): - grammar_rewards = grammar_rewards.view(-1, 1).expand(-1, L).contiguous() - - return rewards, unnormalized_mean_reward, grammar_rewards - -def get_scores(data_gts, gen_result, opt): - batch_size = gen_result.size(0)# batch_size = sample_size * seq_per_img - seq_per_img = batch_size // len(data_gts) - - res = OrderedDict() - - gen_result = gen_result.data.cpu().numpy() - for i in range(batch_size): - res[i] = [array_to_str(gen_result[i])] - - gts = OrderedDict() - for i in range(len(data_gts)): - gts[i] = [array_to_str(data_gts[i][j]) for j in range(len(data_gts[i]))] - - res_ = [{'image_id':i, 'caption': res[i]} for i in range(batch_size)] - res__ = {i: res[i] for i in range(batch_size)} - gts = {i: gts[i // seq_per_img] for i in range(batch_size)} - if opt.cider_reward_weight > 0: - _, cider_scores = CiderD_scorer.compute_score(gts, res_) - # print('Cider scores:', _) - if hasattr(opt, 'verbose') and not opt.verbose: - pass - else: - print('Cider scores:', _) - else: - cider_scores = 0 - if opt.bleu_reward_weight > 0: - _, bleu_scores = Bleu_scorer.compute_score(gts, res__) - bleu_scores = np.array(bleu_scores[3]) - # print('Bleu scores:', _[3]) - if hasattr(opt, 'verbose') and not opt.verbose: - pass - else: - print('Bleu scores:', _[3]) - else: - bleu_scores = 0 - - scores = opt.cider_reward_weight * cider_scores + opt.bleu_reward_weight * bleu_scores - - return scores - -def get_self_cider_scores(data_gts, gen_result, opt): - batch_size = gen_result.size(0)# batch_size = sample_size * seq_per_img - seq_per_img = batch_size // len(data_gts) - - res = [] - - gen_result = gen_result.data.cpu().numpy() - for i in range(batch_size): - res.append(array_to_str(gen_result[i])) - - scores = [] - for i in range(len(data_gts)): - tmp = Cider_scorer.my_self_cider([res[i*seq_per_img:(i+1)*seq_per_img]]) - def get_div(eigvals): - eigvals = np.clip(eigvals, 0, None) - return -np.log(np.sqrt(eigvals[-1]) / (np.sqrt(eigvals).sum())) / np.log(len(eigvals)) - scores.append(get_div(np.linalg.eigvalsh(tmp[0]/10))) - - scores = np.array(scores) - - return scores diff --git a/spaces/NATSpeech/PortaSpeech/utils/commons/ckpt_utils.py b/spaces/NATSpeech/PortaSpeech/utils/commons/ckpt_utils.py deleted file mode 100644 index 9c1006d5852c6cf57063ce64e773d3c40ae9500d..0000000000000000000000000000000000000000 --- a/spaces/NATSpeech/PortaSpeech/utils/commons/ckpt_utils.py +++ /dev/null @@ -1,66 +0,0 @@ -import glob -import os -import re -import torch - - -def get_last_checkpoint(work_dir, steps=None): - checkpoint = None - last_ckpt_path = None - ckpt_paths = get_all_ckpts(work_dir, steps) - if len(ckpt_paths) > 0: - last_ckpt_path = ckpt_paths[0] - checkpoint = torch.load(last_ckpt_path, map_location='cpu') - return checkpoint, last_ckpt_path - - -def get_all_ckpts(work_dir, steps=None): - if steps is None: - ckpt_path_pattern = f'{work_dir}/model_ckpt_steps_*.ckpt' - else: - ckpt_path_pattern = f'{work_dir}/model_ckpt_steps_{steps}.ckpt' - return sorted(glob.glob(ckpt_path_pattern), - key=lambda x: -int(re.findall('.*steps\_(\d+)\.ckpt', x)[0])) - - -def load_ckpt(cur_model, ckpt_base_dir, model_name='model', force=True, strict=True): - if os.path.isfile(ckpt_base_dir): - base_dir = os.path.dirname(ckpt_base_dir) - ckpt_path = ckpt_base_dir - checkpoint = torch.load(ckpt_base_dir, map_location='cpu') - else: - base_dir = ckpt_base_dir - checkpoint, ckpt_path = get_last_checkpoint(ckpt_base_dir) - if checkpoint is not None: - state_dict = checkpoint["state_dict"] - if len([k for k in state_dict.keys() if '.' in k]) > 0: - state_dict = {k[len(model_name) + 1:]: v for k, v in state_dict.items() - if k.startswith(f'{model_name}.')} - else: - if '.' not in model_name: - state_dict = state_dict[model_name] - else: - base_model_name = model_name.split('.')[0] - rest_model_name = model_name[len(base_model_name) + 1:] - state_dict = { - k[len(rest_model_name) + 1:]: v for k, v in state_dict[base_model_name].items() - if k.startswith(f'{rest_model_name}.')} - if not strict: - cur_model_state_dict = cur_model.state_dict() - unmatched_keys = [] - for key, param in state_dict.items(): - if key in cur_model_state_dict: - new_param = cur_model_state_dict[key] - if new_param.shape != param.shape: - unmatched_keys.append(key) - print("| Unmatched keys: ", key, new_param.shape, param.shape) - for key in unmatched_keys: - del state_dict[key] - cur_model.load_state_dict(state_dict, strict=strict) - print(f"| load '{model_name}' from '{ckpt_path}'.") - else: - e_msg = f"| ckpt not found in {base_dir}." - if force: - assert False, e_msg - else: - print(e_msg) diff --git a/spaces/NCTCMumbai/NCTC/models/official/nlp/bert/run_squad.py b/spaces/NCTCMumbai/NCTC/models/official/nlp/bert/run_squad.py deleted file mode 100644 index b12925cfaad2337c28483325c5f942df651add62..0000000000000000000000000000000000000000 --- a/spaces/NCTCMumbai/NCTC/models/official/nlp/bert/run_squad.py +++ /dev/null @@ -1,153 +0,0 @@ -# Copyright 2019 The TensorFlow Authors. All Rights Reserved. -# -# 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. -# ============================================================================== -"""Run BERT on SQuAD 1.1 and SQuAD 2.0 in TF 2.x.""" - -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -import json -import os -import time - -from absl import app -from absl import flags -from absl import logging -import gin -import tensorflow as tf - -from official.nlp.bert import configs as bert_configs -from official.nlp.bert import run_squad_helper -from official.nlp.bert import tokenization -from official.nlp.data import squad_lib as squad_lib_wp -from official.utils.misc import distribution_utils -from official.utils.misc import keras_utils - - -flags.DEFINE_string('vocab_file', None, - 'The vocabulary file that the BERT model was trained on.') - -# More flags can be found in run_squad_helper. -run_squad_helper.define_common_squad_flags() - -FLAGS = flags.FLAGS - - -def train_squad(strategy, - input_meta_data, - custom_callbacks=None, - run_eagerly=False, - init_checkpoint=None, - sub_model_export_name=None): - """Run bert squad training.""" - bert_config = bert_configs.BertConfig.from_json_file(FLAGS.bert_config_file) - init_checkpoint = init_checkpoint or FLAGS.init_checkpoint - run_squad_helper.train_squad(strategy, input_meta_data, bert_config, - custom_callbacks, run_eagerly, init_checkpoint, - sub_model_export_name=sub_model_export_name) - - -def predict_squad(strategy, input_meta_data): - """Makes predictions for the squad dataset.""" - bert_config = bert_configs.BertConfig.from_json_file(FLAGS.bert_config_file) - tokenizer = tokenization.FullTokenizer( - vocab_file=FLAGS.vocab_file, do_lower_case=FLAGS.do_lower_case) - run_squad_helper.predict_squad( - strategy, input_meta_data, tokenizer, bert_config, squad_lib_wp) - - -def eval_squad(strategy, input_meta_data): - """Evaluate on the squad dataset.""" - bert_config = bert_configs.BertConfig.from_json_file(FLAGS.bert_config_file) - tokenizer = tokenization.FullTokenizer( - vocab_file=FLAGS.vocab_file, do_lower_case=FLAGS.do_lower_case) - eval_metrics = run_squad_helper.eval_squad( - strategy, input_meta_data, tokenizer, bert_config, squad_lib_wp) - return eval_metrics - - -def export_squad(model_export_path, input_meta_data): - """Exports a trained model as a `SavedModel` for inference. - - Args: - model_export_path: a string specifying the path to the SavedModel directory. - input_meta_data: dictionary containing meta data about input and model. - - Raises: - Export path is not specified, got an empty string or None. - """ - bert_config = bert_configs.BertConfig.from_json_file(FLAGS.bert_config_file) - run_squad_helper.export_squad(model_export_path, input_meta_data, bert_config) - - -def main(_): - gin.parse_config_files_and_bindings(FLAGS.gin_file, FLAGS.gin_param) - - with tf.io.gfile.GFile(FLAGS.input_meta_data_path, 'rb') as reader: - input_meta_data = json.loads(reader.read().decode('utf-8')) - - if FLAGS.mode == 'export_only': - export_squad(FLAGS.model_export_path, input_meta_data) - return - - # Configures cluster spec for multi-worker distribution strategy. - if FLAGS.num_gpus > 0: - _ = distribution_utils.configure_cluster(FLAGS.worker_hosts, - FLAGS.task_index) - strategy = distribution_utils.get_distribution_strategy( - distribution_strategy=FLAGS.distribution_strategy, - num_gpus=FLAGS.num_gpus, - all_reduce_alg=FLAGS.all_reduce_alg, - tpu_address=FLAGS.tpu) - - if 'train' in FLAGS.mode: - if FLAGS.log_steps: - custom_callbacks = [keras_utils.TimeHistory( - batch_size=FLAGS.train_batch_size, - log_steps=FLAGS.log_steps, - logdir=FLAGS.model_dir, - )] - else: - custom_callbacks = None - - train_squad( - strategy, - input_meta_data, - custom_callbacks=custom_callbacks, - run_eagerly=FLAGS.run_eagerly, - sub_model_export_name=FLAGS.sub_model_export_name, - ) - if 'predict' in FLAGS.mode: - predict_squad(strategy, input_meta_data) - if 'eval' in FLAGS.mode: - eval_metrics = eval_squad(strategy, input_meta_data) - f1_score = eval_metrics['final_f1'] - logging.info('SQuAD eval F1-score: %f', f1_score) - summary_dir = os.path.join(FLAGS.model_dir, 'summaries', 'eval') - summary_writer = tf.summary.create_file_writer(summary_dir) - with summary_writer.as_default(): - # TODO(lehou): write to the correct step number. - tf.summary.scalar('F1-score', f1_score, step=0) - summary_writer.flush() - # Also write eval_metrics to json file. - squad_lib_wp.write_to_json_files( - eval_metrics, os.path.join(summary_dir, 'eval_metrics.json')) - time.sleep(60) - - -if __name__ == '__main__': - flags.mark_flag_as_required('bert_config_file') - flags.mark_flag_as_required('model_dir') - app.run(main) diff --git a/spaces/NCTCMumbai/NCTC/models/official/recommendation/create_ncf_data.py b/spaces/NCTCMumbai/NCTC/models/official/recommendation/create_ncf_data.py deleted file mode 100644 index 60267bcd5f77ec7cb2036cb2037efe9360d692ba..0000000000000000000000000000000000000000 --- a/spaces/NCTCMumbai/NCTC/models/official/recommendation/create_ncf_data.py +++ /dev/null @@ -1,117 +0,0 @@ -# Copyright 2019 The TensorFlow Authors. All Rights Reserved. -# -# 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. -# ============================================================================== -"""Binary to generate training/evaluation dataset for NCF model.""" - -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -import json - -# pylint: disable=g-bad-import-order -from absl import app -from absl import flags -import tensorflow.compat.v2 as tf -# pylint: enable=g-bad-import-order - -from official.recommendation import movielens -from official.recommendation import data_preprocessing - -flags.DEFINE_string( - "data_dir", None, - "The input data dir at which training and evaluation tf record files " - "will be saved.") -flags.DEFINE_string("meta_data_file_path", None, - "The path in which input meta data will be written.") -flags.DEFINE_enum("dataset", "ml-20m", ["ml-1m", "ml-20m"], - "Dataset to be trained/evaluated.") -flags.DEFINE_enum( - "constructor_type", "bisection", ["bisection", "materialized"], - "Strategy to use for generating false negatives. materialized has a " - "precompute that scales badly, but a faster per-epoch construction " - "time and can be faster on very large systems.") -flags.DEFINE_integer("num_train_epochs", 14, - "Total number of training epochs to generate.") -flags.DEFINE_integer( - "num_negative_samples", 4, - "Number of negative instances to pair with positive instance.") -flags.DEFINE_integer( - "train_prebatch_size", 99000, - "Batch size to be used for prebatching the dataset " - "for training.") -flags.DEFINE_integer( - "eval_prebatch_size", 99000, - "Batch size to be used for prebatching the dataset " - "for training.") - -FLAGS = flags.FLAGS - - -def prepare_raw_data(flag_obj): - """Downloads and prepares raw data for data generation.""" - movielens.download(flag_obj.dataset, flag_obj.data_dir) - - data_processing_params = { - "train_epochs": flag_obj.num_train_epochs, - "batch_size": flag_obj.train_prebatch_size, - "eval_batch_size": flag_obj.eval_prebatch_size, - "batches_per_step": 1, - "stream_files": True, - "num_neg": flag_obj.num_negative_samples, - } - - num_users, num_items, producer = data_preprocessing.instantiate_pipeline( - dataset=flag_obj.dataset, - data_dir=flag_obj.data_dir, - params=data_processing_params, - constructor_type=flag_obj.constructor_type, - epoch_dir=flag_obj.data_dir, - generate_data_offline=True) - - # pylint: disable=protected-access - input_metadata = { - "num_users": num_users, - "num_items": num_items, - "constructor_type": flag_obj.constructor_type, - "num_train_elements": producer._elements_in_epoch, - "num_eval_elements": producer._eval_elements_in_epoch, - "num_train_epochs": flag_obj.num_train_epochs, - "train_prebatch_size": flag_obj.train_prebatch_size, - "eval_prebatch_size": flag_obj.eval_prebatch_size, - "num_train_steps": producer.train_batches_per_epoch, - "num_eval_steps": producer.eval_batches_per_epoch, - } - # pylint: enable=protected-access - - return producer, input_metadata - - -def generate_data(): - """Creates NCF train/eval dataset and writes input metadata as a file.""" - producer, input_metadata = prepare_raw_data(FLAGS) - producer.run() - - with tf.io.gfile.GFile(FLAGS.meta_data_file_path, "w") as writer: - writer.write(json.dumps(input_metadata, indent=4) + "\n") - - -def main(_): - generate_data() - - -if __name__ == "__main__": - flags.mark_flag_as_required("data_dir") - flags.mark_flag_as_required("meta_data_file_path") - app.run(main) diff --git a/spaces/NKU-AMT/AMT/networks/__init__.py b/spaces/NKU-AMT/AMT/networks/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/spaces/NeuralInternet/Text-Generation_Playground/extensions/character_bias/script.py b/spaces/NeuralInternet/Text-Generation_Playground/extensions/character_bias/script.py deleted file mode 100644 index 35b38c0edcb38512f2472937578a363343a4468c..0000000000000000000000000000000000000000 --- a/spaces/NeuralInternet/Text-Generation_Playground/extensions/character_bias/script.py +++ /dev/null @@ -1,42 +0,0 @@ -import gradio as gr - -params = { - "activate": True, - "bias string": " *I am so happy*", -} - -def input_modifier(string): - """ - This function is applied to your text inputs before - they are fed into the model. - """ - - return string - -def output_modifier(string): - """ - This function is applied to the model outputs. - """ - - return string - -def bot_prefix_modifier(string): - """ - This function is only applied in chat mode. It modifies - the prefix text for the Bot and can be used to bias its - behavior. - """ - - if params['activate'] == True: - return f'{string} {params["bias string"].strip()} ' - else: - return string - -def ui(): - # Gradio elements - activate = gr.Checkbox(value=params['activate'], label='Activate character bias') - string = gr.Textbox(value=params["bias string"], label='Character bias') - - # Event functions to update the parameters in the backend - string.change(lambda x: params.update({"bias string": x}), string, None) - activate.change(lambda x: params.update({"activate": x}), activate, None) diff --git a/spaces/NeuroSenko/tts-silero/install.bat b/spaces/NeuroSenko/tts-silero/install.bat deleted file mode 100644 index bc4746cce31588cff41685e2a7047d2a3132bfb7..0000000000000000000000000000000000000000 --- a/spaces/NeuroSenko/tts-silero/install.bat +++ /dev/null @@ -1,3 +0,0 @@ -python -m venv ./venv -call .\venv\Scripts\activate.bat -pip install -r requirements.txt \ No newline at end of file diff --git a/spaces/Nick1/rvc-models/lib/infer_pack/attentions.py b/spaces/Nick1/rvc-models/lib/infer_pack/attentions.py deleted file mode 100644 index 05501be1871643f78dddbeaa529c96667031a8db..0000000000000000000000000000000000000000 --- a/spaces/Nick1/rvc-models/lib/infer_pack/attentions.py +++ /dev/null @@ -1,417 +0,0 @@ -import copy -import math -import numpy as np -import torch -from torch import nn -from torch.nn import functional as F - -from lib.infer_pack import commons -from lib.infer_pack import modules -from lib.infer_pack.modules import LayerNorm - - -class Encoder(nn.Module): - def __init__( - self, - hidden_channels, - filter_channels, - n_heads, - n_layers, - kernel_size=1, - p_dropout=0.0, - window_size=10, - **kwargs - ): - super().__init__() - self.hidden_channels = hidden_channels - self.filter_channels = filter_channels - self.n_heads = n_heads - self.n_layers = n_layers - self.kernel_size = kernel_size - self.p_dropout = p_dropout - self.window_size = window_size - - self.drop = nn.Dropout(p_dropout) - self.attn_layers = nn.ModuleList() - self.norm_layers_1 = nn.ModuleList() - self.ffn_layers = nn.ModuleList() - self.norm_layers_2 = nn.ModuleList() - for i in range(self.n_layers): - self.attn_layers.append( - MultiHeadAttention( - hidden_channels, - hidden_channels, - n_heads, - p_dropout=p_dropout, - window_size=window_size, - ) - ) - self.norm_layers_1.append(LayerNorm(hidden_channels)) - self.ffn_layers.append( - FFN( - hidden_channels, - hidden_channels, - filter_channels, - kernel_size, - p_dropout=p_dropout, - ) - ) - self.norm_layers_2.append(LayerNorm(hidden_channels)) - - def forward(self, x, x_mask): - attn_mask = x_mask.unsqueeze(2) * x_mask.unsqueeze(-1) - x = x * x_mask - for i in range(self.n_layers): - y = self.attn_layers[i](x, x, attn_mask) - y = self.drop(y) - x = self.norm_layers_1[i](x + y) - - y = self.ffn_layers[i](x, x_mask) - y = self.drop(y) - x = self.norm_layers_2[i](x + y) - x = x * x_mask - return x - - -class Decoder(nn.Module): - def __init__( - self, - hidden_channels, - filter_channels, - n_heads, - n_layers, - kernel_size=1, - p_dropout=0.0, - proximal_bias=False, - proximal_init=True, - **kwargs - ): - super().__init__() - self.hidden_channels = hidden_channels - self.filter_channels = filter_channels - self.n_heads = n_heads - self.n_layers = n_layers - self.kernel_size = kernel_size - self.p_dropout = p_dropout - self.proximal_bias = proximal_bias - self.proximal_init = proximal_init - - self.drop = nn.Dropout(p_dropout) - self.self_attn_layers = nn.ModuleList() - self.norm_layers_0 = nn.ModuleList() - self.encdec_attn_layers = nn.ModuleList() - self.norm_layers_1 = nn.ModuleList() - self.ffn_layers = nn.ModuleList() - self.norm_layers_2 = nn.ModuleList() - for i in range(self.n_layers): - self.self_attn_layers.append( - MultiHeadAttention( - hidden_channels, - hidden_channels, - n_heads, - p_dropout=p_dropout, - proximal_bias=proximal_bias, - proximal_init=proximal_init, - ) - ) - self.norm_layers_0.append(LayerNorm(hidden_channels)) - self.encdec_attn_layers.append( - MultiHeadAttention( - hidden_channels, hidden_channels, n_heads, p_dropout=p_dropout - ) - ) - self.norm_layers_1.append(LayerNorm(hidden_channels)) - self.ffn_layers.append( - FFN( - hidden_channels, - hidden_channels, - filter_channels, - kernel_size, - p_dropout=p_dropout, - causal=True, - ) - ) - self.norm_layers_2.append(LayerNorm(hidden_channels)) - - def forward(self, x, x_mask, h, h_mask): - """ - x: decoder input - h: encoder output - """ - self_attn_mask = commons.subsequent_mask(x_mask.size(2)).to( - device=x.device, dtype=x.dtype - ) - encdec_attn_mask = h_mask.unsqueeze(2) * x_mask.unsqueeze(-1) - x = x * x_mask - for i in range(self.n_layers): - y = self.self_attn_layers[i](x, x, self_attn_mask) - y = self.drop(y) - x = self.norm_layers_0[i](x + y) - - y = self.encdec_attn_layers[i](x, h, encdec_attn_mask) - y = self.drop(y) - x = self.norm_layers_1[i](x + y) - - y = self.ffn_layers[i](x, x_mask) - y = self.drop(y) - x = self.norm_layers_2[i](x + y) - x = x * x_mask - return x - - -class MultiHeadAttention(nn.Module): - def __init__( - self, - channels, - out_channels, - n_heads, - p_dropout=0.0, - window_size=None, - heads_share=True, - block_length=None, - proximal_bias=False, - proximal_init=False, - ): - super().__init__() - assert channels % n_heads == 0 - - self.channels = channels - self.out_channels = out_channels - self.n_heads = n_heads - self.p_dropout = p_dropout - self.window_size = window_size - self.heads_share = heads_share - self.block_length = block_length - self.proximal_bias = proximal_bias - self.proximal_init = proximal_init - self.attn = None - - self.k_channels = channels // n_heads - self.conv_q = nn.Conv1d(channels, channels, 1) - self.conv_k = nn.Conv1d(channels, channels, 1) - self.conv_v = nn.Conv1d(channels, channels, 1) - self.conv_o = nn.Conv1d(channels, out_channels, 1) - self.drop = nn.Dropout(p_dropout) - - if window_size is not None: - n_heads_rel = 1 if heads_share else n_heads - rel_stddev = self.k_channels**-0.5 - self.emb_rel_k = nn.Parameter( - torch.randn(n_heads_rel, window_size * 2 + 1, self.k_channels) - * rel_stddev - ) - self.emb_rel_v = nn.Parameter( - torch.randn(n_heads_rel, window_size * 2 + 1, self.k_channels) - * rel_stddev - ) - - nn.init.xavier_uniform_(self.conv_q.weight) - nn.init.xavier_uniform_(self.conv_k.weight) - nn.init.xavier_uniform_(self.conv_v.weight) - if proximal_init: - with torch.no_grad(): - self.conv_k.weight.copy_(self.conv_q.weight) - self.conv_k.bias.copy_(self.conv_q.bias) - - def forward(self, x, c, attn_mask=None): - q = self.conv_q(x) - k = self.conv_k(c) - v = self.conv_v(c) - - x, self.attn = self.attention(q, k, v, mask=attn_mask) - - x = self.conv_o(x) - return x - - def attention(self, query, key, value, mask=None): - # reshape [b, d, t] -> [b, n_h, t, d_k] - b, d, t_s, t_t = (*key.size(), query.size(2)) - query = query.view(b, self.n_heads, self.k_channels, t_t).transpose(2, 3) - key = key.view(b, self.n_heads, self.k_channels, t_s).transpose(2, 3) - value = value.view(b, self.n_heads, self.k_channels, t_s).transpose(2, 3) - - scores = torch.matmul(query / math.sqrt(self.k_channels), key.transpose(-2, -1)) - if self.window_size is not None: - assert ( - t_s == t_t - ), "Relative attention is only available for self-attention." - key_relative_embeddings = self._get_relative_embeddings(self.emb_rel_k, t_s) - rel_logits = self._matmul_with_relative_keys( - query / math.sqrt(self.k_channels), key_relative_embeddings - ) - scores_local = self._relative_position_to_absolute_position(rel_logits) - scores = scores + scores_local - if self.proximal_bias: - assert t_s == t_t, "Proximal bias is only available for self-attention." - scores = scores + self._attention_bias_proximal(t_s).to( - device=scores.device, dtype=scores.dtype - ) - if mask is not None: - scores = scores.masked_fill(mask == 0, -1e4) - if self.block_length is not None: - assert ( - t_s == t_t - ), "Local attention is only available for self-attention." - block_mask = ( - torch.ones_like(scores) - .triu(-self.block_length) - .tril(self.block_length) - ) - scores = scores.masked_fill(block_mask == 0, -1e4) - p_attn = F.softmax(scores, dim=-1) # [b, n_h, t_t, t_s] - p_attn = self.drop(p_attn) - output = torch.matmul(p_attn, value) - if self.window_size is not None: - relative_weights = self._absolute_position_to_relative_position(p_attn) - value_relative_embeddings = self._get_relative_embeddings( - self.emb_rel_v, t_s - ) - output = output + self._matmul_with_relative_values( - relative_weights, value_relative_embeddings - ) - output = ( - output.transpose(2, 3).contiguous().view(b, d, t_t) - ) # [b, n_h, t_t, d_k] -> [b, d, t_t] - return output, p_attn - - def _matmul_with_relative_values(self, x, y): - """ - x: [b, h, l, m] - y: [h or 1, m, d] - ret: [b, h, l, d] - """ - ret = torch.matmul(x, y.unsqueeze(0)) - return ret - - def _matmul_with_relative_keys(self, x, y): - """ - x: [b, h, l, d] - y: [h or 1, m, d] - ret: [b, h, l, m] - """ - ret = torch.matmul(x, y.unsqueeze(0).transpose(-2, -1)) - return ret - - def _get_relative_embeddings(self, relative_embeddings, length): - max_relative_position = 2 * self.window_size + 1 - # Pad first before slice to avoid using cond ops. - pad_length = max(length - (self.window_size + 1), 0) - slice_start_position = max((self.window_size + 1) - length, 0) - slice_end_position = slice_start_position + 2 * length - 1 - if pad_length > 0: - padded_relative_embeddings = F.pad( - relative_embeddings, - commons.convert_pad_shape([[0, 0], [pad_length, pad_length], [0, 0]]), - ) - else: - padded_relative_embeddings = relative_embeddings - used_relative_embeddings = padded_relative_embeddings[ - :, slice_start_position:slice_end_position - ] - return used_relative_embeddings - - def _relative_position_to_absolute_position(self, x): - """ - x: [b, h, l, 2*l-1] - ret: [b, h, l, l] - """ - batch, heads, length, _ = x.size() - # Concat columns of pad to shift from relative to absolute indexing. - x = F.pad(x, commons.convert_pad_shape([[0, 0], [0, 0], [0, 0], [0, 1]])) - - # Concat extra elements so to add up to shape (len+1, 2*len-1). - x_flat = x.view([batch, heads, length * 2 * length]) - x_flat = F.pad( - x_flat, commons.convert_pad_shape([[0, 0], [0, 0], [0, length - 1]]) - ) - - # Reshape and slice out the padded elements. - x_final = x_flat.view([batch, heads, length + 1, 2 * length - 1])[ - :, :, :length, length - 1 : - ] - return x_final - - def _absolute_position_to_relative_position(self, x): - """ - x: [b, h, l, l] - ret: [b, h, l, 2*l-1] - """ - batch, heads, length, _ = x.size() - # padd along column - x = F.pad( - x, commons.convert_pad_shape([[0, 0], [0, 0], [0, 0], [0, length - 1]]) - ) - x_flat = x.view([batch, heads, length**2 + length * (length - 1)]) - # add 0's in the beginning that will skew the elements after reshape - x_flat = F.pad(x_flat, commons.convert_pad_shape([[0, 0], [0, 0], [length, 0]])) - x_final = x_flat.view([batch, heads, length, 2 * length])[:, :, :, 1:] - return x_final - - def _attention_bias_proximal(self, length): - """Bias for self-attention to encourage attention to close positions. - Args: - length: an integer scalar. - Returns: - a Tensor with shape [1, 1, length, length] - """ - r = torch.arange(length, dtype=torch.float32) - diff = torch.unsqueeze(r, 0) - torch.unsqueeze(r, 1) - return torch.unsqueeze(torch.unsqueeze(-torch.log1p(torch.abs(diff)), 0), 0) - - -class FFN(nn.Module): - def __init__( - self, - in_channels, - out_channels, - filter_channels, - kernel_size, - p_dropout=0.0, - activation=None, - causal=False, - ): - super().__init__() - self.in_channels = in_channels - self.out_channels = out_channels - self.filter_channels = filter_channels - self.kernel_size = kernel_size - self.p_dropout = p_dropout - self.activation = activation - self.causal = causal - - if causal: - self.padding = self._causal_padding - else: - self.padding = self._same_padding - - self.conv_1 = nn.Conv1d(in_channels, filter_channels, kernel_size) - self.conv_2 = nn.Conv1d(filter_channels, out_channels, kernel_size) - self.drop = nn.Dropout(p_dropout) - - def forward(self, x, x_mask): - x = self.conv_1(self.padding(x * x_mask)) - if self.activation == "gelu": - x = x * torch.sigmoid(1.702 * x) - else: - x = torch.relu(x) - x = self.drop(x) - x = self.conv_2(self.padding(x * x_mask)) - return x * x_mask - - def _causal_padding(self, x): - if self.kernel_size == 1: - return x - pad_l = self.kernel_size - 1 - pad_r = 0 - padding = [[0, 0], [0, 0], [pad_l, pad_r]] - x = F.pad(x, commons.convert_pad_shape(padding)) - return x - - def _same_padding(self, x): - if self.kernel_size == 1: - return x - pad_l = (self.kernel_size - 1) // 2 - pad_r = self.kernel_size // 2 - padding = [[0, 0], [0, 0], [pad_l, pad_r]] - x = F.pad(x, commons.convert_pad_shape(padding)) - return x diff --git a/spaces/Not-Grim-Refer/Code-to-Detailed-English-Description/app.py b/spaces/Not-Grim-Refer/Code-to-Detailed-English-Description/app.py deleted file mode 100644 index c070ba967ac3633f389571bdc9b7160e037e80e2..0000000000000000000000000000000000000000 --- a/spaces/Not-Grim-Refer/Code-to-Detailed-English-Description/app.py +++ /dev/null @@ -1,14 +0,0 @@ -import gradio as gr -from transformers import AutoTokenizer, AutoModelForCausalLM - -tokenizer_code2desc = AutoTokenizer.from_pretrained("microsoft/codebert-base") -model_code2desc = AutoModelForCausalLM.from_pretrained("microsoft/codebert-base") - -def code_to_description(code: str) -> str: - inputs = tokenizer_code2desc.encode("summarize: " + code, return_tensors="pt", max_length=512, truncation=True) - outputs = model_code2desc.generate(inputs, max_length=150, num_return_sequences=1, no_repeat_ngram_size=2, do_sample=True, top_k=50, top_p=0.95, temperature=0.8) - description = tokenizer_code2desc.decode(outputs[0], skip_special_tokens=True, clean_up_tokenization_spaces=True) - return description - -iface = gr.Interface(fn=code_to_description, inputs="text", outputs="text", share=True) -iface.launch() diff --git a/spaces/Nultx/VITS-TTS/README.md b/spaces/Nultx/VITS-TTS/README.md deleted file mode 100644 index 1b24e6efdb04cb1460e4fe3257d2303677c5a0e1..0000000000000000000000000000000000000000 --- a/spaces/Nultx/VITS-TTS/README.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: Multilingual Anime TTS -emoji: 🎙🐴 -colorFrom: green -colorTo: gray -sdk: gradio -sdk_version: 3.7 -app_file: app.py -pinned: false -duplicated_from: Plachta/VITS-Umamusume-voice-synthesizer ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/OFA-Sys/OFA-Generic_Interface/fairseq/examples/roberta/preprocess_RACE.sh b/spaces/OFA-Sys/OFA-Generic_Interface/fairseq/examples/roberta/preprocess_RACE.sh deleted file mode 100644 index 932d2ab6e521fecc7d0297f26a8c43857541ef3b..0000000000000000000000000000000000000000 --- a/spaces/OFA-Sys/OFA-Generic_Interface/fairseq/examples/roberta/preprocess_RACE.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash -# Copyright (c) Facebook, Inc. and its affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - - -# data should be downloaded and processed with reprocess_RACE.py -if [[ $# -ne 2 ]]; then - echo "Run as following:" - echo "./examples/roberta/preprocess_RACE.sh <race_data_folder> <output_folder>" - exit 1 -fi - -RACE_DATA_FOLDER=$1 -OUT_DATA_FOLDER=$2 - -# download bpe encoder.json, vocabulary and fairseq dictionary -wget -N 'https://dl.fbaipublicfiles.com/fairseq/gpt2_bpe/encoder.json' -wget -N 'https://dl.fbaipublicfiles.com/fairseq/gpt2_bpe/vocab.bpe' -wget -N 'https://dl.fbaipublicfiles.com/fairseq/gpt2_bpe/dict.txt' - -SPLITS="train dev test-middle test-high" -INPUT_TYPES="input0 input1 input2 input3 input4" -for INPUT_TYPE in $INPUT_TYPES -do - for SPLIT in $SPLITS - do - echo "BPE encoding $SPLIT/$INPUT_TYPE" - python -m examples.roberta.multiprocessing_bpe_encoder \ - --encoder-json encoder.json \ - --vocab-bpe vocab.bpe \ - --inputs "$RACE_DATA_FOLDER/$SPLIT.$INPUT_TYPE" \ - --outputs "$RACE_DATA_FOLDER/$SPLIT.$INPUT_TYPE.bpe" \ - --workers 10 \ - --keep-empty; - - done -done - -for INPUT_TYPE in $INPUT_TYPES - do - LANG="input$INPUT_TYPE" - fairseq-preprocess \ - --only-source \ - --trainpref "$RACE_DATA_FOLDER/train.$INPUT_TYPE.bpe" \ - --validpref "$RACE_DATA_FOLDER/dev.$INPUT_TYPE.bpe" \ - --testpref "$RACE_DATA_FOLDER/test-middle.$INPUT_TYPE.bpe,$RACE_DATA_FOLDER/test-high.$INPUT_TYPE.bpe" \ - --destdir "$OUT_DATA_FOLDER/$INPUT_TYPE" \ - --workers 10 \ - --srcdict dict.txt; -done - -rm -rf "$OUT_DATA_FOLDER/label" -mkdir -p "$OUT_DATA_FOLDER/label" -cp "$RACE_DATA_FOLDER/train.label" "$OUT_DATA_FOLDER/label/" -cp "$RACE_DATA_FOLDER/dev.label" "$OUT_DATA_FOLDER/label/valid.label" -cp "$RACE_DATA_FOLDER/test-middle.label" "$OUT_DATA_FOLDER/label/test.label" -cp "$RACE_DATA_FOLDER/test-high.label" "$OUT_DATA_FOLDER/label/test1.label" diff --git a/spaces/OFA-Sys/OFA-Image_Caption/fairseq/examples/textless_nlp/gslm/unit2speech/tacotron2/stft.py b/spaces/OFA-Sys/OFA-Image_Caption/fairseq/examples/textless_nlp/gslm/unit2speech/tacotron2/stft.py deleted file mode 100644 index 63fcd431e2d7746b696aaa0d4172bc04ffb88efa..0000000000000000000000000000000000000000 --- a/spaces/OFA-Sys/OFA-Image_Caption/fairseq/examples/textless_nlp/gslm/unit2speech/tacotron2/stft.py +++ /dev/null @@ -1,141 +0,0 @@ -""" -BSD 3-Clause License - -Copyright (c) 2017, Prem Seetharaman -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 the copyright holder 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 HOLDER 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. -""" - -import torch -import numpy as np -import torch.nn.functional as F -from torch.autograd import Variable -from scipy.signal import get_window -from librosa.util import pad_center, tiny -from .audio_processing import window_sumsquare - - -class STFT(torch.nn.Module): - """adapted from Prem Seetharaman's https://github.com/pseeth/pytorch-stft""" - def __init__(self, filter_length=800, hop_length=200, win_length=800, - window='hann'): - super(STFT, self).__init__() - self.filter_length = filter_length - self.hop_length = hop_length - self.win_length = win_length - self.window = window - self.forward_transform = None - scale = self.filter_length / self.hop_length - fourier_basis = np.fft.fft(np.eye(self.filter_length)) - - cutoff = int((self.filter_length / 2 + 1)) - fourier_basis = np.vstack([np.real(fourier_basis[:cutoff, :]), - np.imag(fourier_basis[:cutoff, :])]) - - forward_basis = torch.FloatTensor(fourier_basis[:, None, :]) - inverse_basis = torch.FloatTensor( - np.linalg.pinv(scale * fourier_basis).T[:, None, :]) - - if window is not None: - assert(filter_length >= win_length) - # get window and zero center pad it to filter_length - fft_window = get_window(window, win_length, fftbins=True) - fft_window = pad_center(fft_window, filter_length) - fft_window = torch.from_numpy(fft_window).float() - - # window the bases - forward_basis *= fft_window - inverse_basis *= fft_window - - self.register_buffer('forward_basis', forward_basis.float()) - self.register_buffer('inverse_basis', inverse_basis.float()) - - def transform(self, input_data): - num_batches = input_data.size(0) - num_samples = input_data.size(1) - - self.num_samples = num_samples - - # similar to librosa, reflect-pad the input - input_data = input_data.view(num_batches, 1, num_samples) - input_data = F.pad( - input_data.unsqueeze(1), - (int(self.filter_length / 2), int(self.filter_length / 2), 0, 0), - mode='reflect') - input_data = input_data.squeeze(1) - - forward_transform = F.conv1d( - input_data, - Variable(self.forward_basis, requires_grad=False), - stride=self.hop_length, - padding=0) - - cutoff = int((self.filter_length / 2) + 1) - real_part = forward_transform[:, :cutoff, :] - imag_part = forward_transform[:, cutoff:, :] - - magnitude = torch.sqrt(real_part**2 + imag_part**2) - phase = torch.autograd.Variable( - torch.atan2(imag_part.data, real_part.data)) - - return magnitude, phase - - def inverse(self, magnitude, phase): - recombine_magnitude_phase = torch.cat( - [magnitude*torch.cos(phase), magnitude*torch.sin(phase)], dim=1) - - inverse_transform = F.conv_transpose1d( - recombine_magnitude_phase, - Variable(self.inverse_basis, requires_grad=False), - stride=self.hop_length, - padding=0) - - if self.window is not None: - window_sum = window_sumsquare( - self.window, magnitude.size(-1), hop_length=self.hop_length, - win_length=self.win_length, n_fft=self.filter_length, - dtype=np.float32) - # remove modulation effects - approx_nonzero_indices = torch.from_numpy( - np.where(window_sum > tiny(window_sum))[0]) - window_sum = torch.autograd.Variable( - torch.from_numpy(window_sum), requires_grad=False) - window_sum = window_sum.cuda() if magnitude.is_cuda else window_sum - inverse_transform[:, :, approx_nonzero_indices] /= window_sum[approx_nonzero_indices] - - # scale by hop ratio - inverse_transform *= float(self.filter_length) / self.hop_length - - inverse_transform = inverse_transform[:, :, int(self.filter_length/2):] - inverse_transform = inverse_transform[:, :, :-int(self.filter_length/2):] - - return inverse_transform - - def forward(self, input_data): - self.magnitude, self.phase = self.transform(input_data) - reconstruction = self.inverse(self.magnitude, self.phase) - return reconstruction diff --git a/spaces/OFA-Sys/OFA-Image_Caption/fairseq/fairseq/tasks/translation.py b/spaces/OFA-Sys/OFA-Image_Caption/fairseq/fairseq/tasks/translation.py deleted file mode 100644 index 86473608677c62b063cd9889ed29d59002523be7..0000000000000000000000000000000000000000 --- a/spaces/OFA-Sys/OFA-Image_Caption/fairseq/fairseq/tasks/translation.py +++ /dev/null @@ -1,493 +0,0 @@ -# Copyright (c) Facebook, Inc. and its affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -from dataclasses import dataclass, field -import itertools -import json -import logging -import os -from typing import Optional -from argparse import Namespace -from omegaconf import II - -import numpy as np -from fairseq import metrics, utils -from fairseq.data import ( - AppendTokenDataset, - ConcatDataset, - LanguagePairDataset, - PrependTokenDataset, - StripTokenDataset, - TruncateDataset, - data_utils, - encoders, - indexed_dataset, -) -from fairseq.data.indexed_dataset import get_available_dataset_impl -from fairseq.dataclass import ChoiceEnum, FairseqDataclass -from fairseq.tasks import FairseqTask, register_task - - -EVAL_BLEU_ORDER = 4 - - -logger = logging.getLogger(__name__) - - -def load_langpair_dataset( - data_path, - split, - src, - src_dict, - tgt, - tgt_dict, - combine, - dataset_impl, - upsample_primary, - left_pad_source, - left_pad_target, - max_source_positions, - max_target_positions, - prepend_bos=False, - load_alignments=False, - truncate_source=False, - append_source_id=False, - num_buckets=0, - shuffle=True, - pad_to_multiple=1, - prepend_bos_src=None, -): - def split_exists(split, src, tgt, lang, data_path): - filename = os.path.join(data_path, "{}.{}-{}.{}".format(split, src, tgt, lang)) - return indexed_dataset.dataset_exists(filename, impl=dataset_impl) - - src_datasets = [] - tgt_datasets = [] - - for k in itertools.count(): - split_k = split + (str(k) if k > 0 else "") - - # infer langcode - if split_exists(split_k, src, tgt, src, data_path): - prefix = os.path.join(data_path, "{}.{}-{}.".format(split_k, src, tgt)) - elif split_exists(split_k, tgt, src, src, data_path): - prefix = os.path.join(data_path, "{}.{}-{}.".format(split_k, tgt, src)) - else: - if k > 0: - break - else: - raise FileNotFoundError( - "Dataset not found: {} ({})".format(split, data_path) - ) - - src_dataset = data_utils.load_indexed_dataset( - prefix + src, src_dict, dataset_impl - ) - if truncate_source: - src_dataset = AppendTokenDataset( - TruncateDataset( - StripTokenDataset(src_dataset, src_dict.eos()), - max_source_positions - 1, - ), - src_dict.eos(), - ) - src_datasets.append(src_dataset) - - tgt_dataset = data_utils.load_indexed_dataset( - prefix + tgt, tgt_dict, dataset_impl - ) - if tgt_dataset is not None: - tgt_datasets.append(tgt_dataset) - - logger.info( - "{} {} {}-{} {} examples".format( - data_path, split_k, src, tgt, len(src_datasets[-1]) - ) - ) - - if not combine: - break - - assert len(src_datasets) == len(tgt_datasets) or len(tgt_datasets) == 0 - - if len(src_datasets) == 1: - src_dataset = src_datasets[0] - tgt_dataset = tgt_datasets[0] if len(tgt_datasets) > 0 else None - else: - sample_ratios = [1] * len(src_datasets) - sample_ratios[0] = upsample_primary - src_dataset = ConcatDataset(src_datasets, sample_ratios) - if len(tgt_datasets) > 0: - tgt_dataset = ConcatDataset(tgt_datasets, sample_ratios) - else: - tgt_dataset = None - - if prepend_bos: - assert hasattr(src_dict, "bos_index") and hasattr(tgt_dict, "bos_index") - src_dataset = PrependTokenDataset(src_dataset, src_dict.bos()) - if tgt_dataset is not None: - tgt_dataset = PrependTokenDataset(tgt_dataset, tgt_dict.bos()) - elif prepend_bos_src is not None: - logger.info(f"prepending src bos: {prepend_bos_src}") - src_dataset = PrependTokenDataset(src_dataset, prepend_bos_src) - - eos = None - if append_source_id: - src_dataset = AppendTokenDataset( - src_dataset, src_dict.index("[{}]".format(src)) - ) - if tgt_dataset is not None: - tgt_dataset = AppendTokenDataset( - tgt_dataset, tgt_dict.index("[{}]".format(tgt)) - ) - eos = tgt_dict.index("[{}]".format(tgt)) - - align_dataset = None - if load_alignments: - align_path = os.path.join(data_path, "{}.align.{}-{}".format(split, src, tgt)) - if indexed_dataset.dataset_exists(align_path, impl=dataset_impl): - align_dataset = data_utils.load_indexed_dataset( - align_path, None, dataset_impl - ) - - tgt_dataset_sizes = tgt_dataset.sizes if tgt_dataset is not None else None - return LanguagePairDataset( - src_dataset, - src_dataset.sizes, - src_dict, - tgt_dataset, - tgt_dataset_sizes, - tgt_dict, - left_pad_source=left_pad_source, - left_pad_target=left_pad_target, - align_dataset=align_dataset, - eos=eos, - num_buckets=num_buckets, - shuffle=shuffle, - pad_to_multiple=pad_to_multiple, - ) - - -@dataclass -class TranslationConfig(FairseqDataclass): - data: Optional[str] = field( - default=None, - metadata={ - "help": "colon separated path to data directories list, will be iterated upon during epochs " - "in round-robin manner; however, valid and test data are always in the first directory " - "to avoid the need for repeating them in all directories" - }, - ) - source_lang: Optional[str] = field( - default=None, - metadata={ - "help": "source language", - "argparse_alias": "-s", - }, - ) - target_lang: Optional[str] = field( - default=None, - metadata={ - "help": "target language", - "argparse_alias": "-t", - }, - ) - load_alignments: bool = field( - default=False, metadata={"help": "load the binarized alignments"} - ) - left_pad_source: bool = field( - default=True, metadata={"help": "pad the source on the left"} - ) - left_pad_target: bool = field( - default=False, metadata={"help": "pad the target on the left"} - ) - max_source_positions: int = field( - default=1024, metadata={"help": "max number of tokens in the source sequence"} - ) - max_target_positions: int = field( - default=1024, metadata={"help": "max number of tokens in the target sequence"} - ) - upsample_primary: int = field( - default=-1, metadata={"help": "the amount of upsample primary dataset"} - ) - truncate_source: bool = field( - default=False, metadata={"help": "truncate source to max-source-positions"} - ) - num_batch_buckets: int = field( - default=0, - metadata={ - "help": "if >0, then bucket source and target lengths into " - "N buckets and pad accordingly; this is useful on TPUs to minimize the number of compilations" - }, - ) - train_subset: str = II("dataset.train_subset") - dataset_impl: Optional[ChoiceEnum(get_available_dataset_impl())] = II( - "dataset.dataset_impl" - ) - required_seq_len_multiple: int = II("dataset.required_seq_len_multiple") - - # options for reporting BLEU during validation - eval_bleu: bool = field( - default=False, metadata={"help": "evaluation with BLEU scores"} - ) - eval_bleu_args: Optional[str] = field( - default="{}", - metadata={ - "help": 'generation args for BLUE scoring, e.g., \'{"beam": 4, "lenpen": 0.6}\', as JSON string' - }, - ) - eval_bleu_detok: str = field( - default="space", - metadata={ - "help": "detokenize before computing BLEU (e.g., 'moses'); required if using --eval-bleu; " - "use 'space' to disable detokenization; see fairseq.data.encoders for other options" - }, - ) - eval_bleu_detok_args: Optional[str] = field( - default="{}", - metadata={"help": "args for building the tokenizer, if needed, as JSON string"}, - ) - eval_tokenized_bleu: bool = field( - default=False, metadata={"help": "compute tokenized BLEU instead of sacrebleu"} - ) - eval_bleu_remove_bpe: Optional[str] = field( - default=None, - metadata={ - "help": "remove BPE before computing BLEU", - "argparse_const": "@@ ", - }, - ) - eval_bleu_print_samples: bool = field( - default=False, metadata={"help": "print sample generations during validation"} - ) - - -@register_task("translation", dataclass=TranslationConfig) -class TranslationTask(FairseqTask): - """ - Translate from one (source) language to another (target) language. - - Args: - src_dict (~fairseq.data.Dictionary): dictionary for the source language - tgt_dict (~fairseq.data.Dictionary): dictionary for the target language - - .. note:: - - The translation task is compatible with :mod:`fairseq-train`, - :mod:`fairseq-generate` and :mod:`fairseq-interactive`. - """ - - cfg: TranslationConfig - - def __init__(self, cfg: TranslationConfig, src_dict, tgt_dict): - super().__init__(cfg) - self.src_dict = src_dict - self.tgt_dict = tgt_dict - - @classmethod - def setup_task(cls, cfg: TranslationConfig, **kwargs): - """Setup the task (e.g., load dictionaries). - - Args: - args (argparse.Namespace): parsed command-line arguments - """ - - paths = utils.split_paths(cfg.data) - assert len(paths) > 0 - # find language pair automatically - if cfg.source_lang is None or cfg.target_lang is None: - cfg.source_lang, cfg.target_lang = data_utils.infer_language_pair(paths[0]) - if cfg.source_lang is None or cfg.target_lang is None: - raise Exception( - "Could not infer language pair, please provide it explicitly" - ) - - # load dictionaries - src_dict = cls.load_dictionary( - os.path.join(paths[0], "dict.{}.txt".format(cfg.source_lang)) - ) - tgt_dict = cls.load_dictionary( - os.path.join(paths[0], "dict.{}.txt".format(cfg.target_lang)) - ) - assert src_dict.pad() == tgt_dict.pad() - assert src_dict.eos() == tgt_dict.eos() - assert src_dict.unk() == tgt_dict.unk() - logger.info("[{}] dictionary: {} types".format(cfg.source_lang, len(src_dict))) - logger.info("[{}] dictionary: {} types".format(cfg.target_lang, len(tgt_dict))) - - return cls(cfg, src_dict, tgt_dict) - - def load_dataset(self, split, epoch=1, combine=False, **kwargs): - """Load a given dataset split. - - Args: - split (str): name of the split (e.g., train, valid, test) - """ - paths = utils.split_paths(self.cfg.data) - assert len(paths) > 0 - if split != self.cfg.train_subset: - # if not training data set, use the first shard for valid and test - paths = paths[:1] - data_path = paths[(epoch - 1) % len(paths)] - - # infer langcode - src, tgt = self.cfg.source_lang, self.cfg.target_lang - - self.datasets[split] = load_langpair_dataset( - data_path, - split, - src, - self.src_dict, - tgt, - self.tgt_dict, - combine=combine, - dataset_impl=self.cfg.dataset_impl, - upsample_primary=self.cfg.upsample_primary, - left_pad_source=self.cfg.left_pad_source, - left_pad_target=self.cfg.left_pad_target, - max_source_positions=self.cfg.max_source_positions, - max_target_positions=self.cfg.max_target_positions, - load_alignments=self.cfg.load_alignments, - truncate_source=self.cfg.truncate_source, - num_buckets=self.cfg.num_batch_buckets, - shuffle=(split != "test"), - pad_to_multiple=self.cfg.required_seq_len_multiple, - ) - - def build_dataset_for_inference(self, src_tokens, src_lengths, constraints=None): - return LanguagePairDataset( - src_tokens, - src_lengths, - self.source_dictionary, - tgt_dict=self.target_dictionary, - constraints=constraints, - ) - - def build_model(self, cfg): - model = super().build_model(cfg) - if self.cfg.eval_bleu: - detok_args = json.loads(self.cfg.eval_bleu_detok_args) - self.tokenizer = encoders.build_tokenizer( - Namespace(tokenizer=self.cfg.eval_bleu_detok, **detok_args) - ) - - gen_args = json.loads(self.cfg.eval_bleu_args) - self.sequence_generator = self.build_generator( - [model], Namespace(**gen_args) - ) - return model - - def valid_step(self, sample, model, criterion): - loss, sample_size, logging_output = super().valid_step(sample, model, criterion) - if self.cfg.eval_bleu: - bleu = self._inference_with_bleu(self.sequence_generator, sample, model) - logging_output["_bleu_sys_len"] = bleu.sys_len - logging_output["_bleu_ref_len"] = bleu.ref_len - # we split counts into separate entries so that they can be - # summed efficiently across workers using fast-stat-sync - assert len(bleu.counts) == EVAL_BLEU_ORDER - for i in range(EVAL_BLEU_ORDER): - logging_output["_bleu_counts_" + str(i)] = bleu.counts[i] - logging_output["_bleu_totals_" + str(i)] = bleu.totals[i] - return loss, sample_size, logging_output - - def reduce_metrics(self, logging_outputs, criterion): - super().reduce_metrics(logging_outputs, criterion) - if self.cfg.eval_bleu: - - def sum_logs(key): - import torch - result = sum(log.get(key, 0) for log in logging_outputs) - if torch.is_tensor(result): - result = result.cpu() - return result - - counts, totals = [], [] - for i in range(EVAL_BLEU_ORDER): - counts.append(sum_logs("_bleu_counts_" + str(i))) - totals.append(sum_logs("_bleu_totals_" + str(i))) - - if max(totals) > 0: - # log counts as numpy arrays -- log_scalar will sum them correctly - metrics.log_scalar("_bleu_counts", np.array(counts)) - metrics.log_scalar("_bleu_totals", np.array(totals)) - metrics.log_scalar("_bleu_sys_len", sum_logs("_bleu_sys_len")) - metrics.log_scalar("_bleu_ref_len", sum_logs("_bleu_ref_len")) - - def compute_bleu(meters): - import inspect - try: - from sacrebleu.metrics import BLEU - comp_bleu = BLEU.compute_bleu - except ImportError: - # compatibility API for sacrebleu 1.x - import sacrebleu - comp_bleu = sacrebleu.compute_bleu - - fn_sig = inspect.getfullargspec(comp_bleu)[0] - if "smooth_method" in fn_sig: - smooth = {"smooth_method": "exp"} - else: - smooth = {"smooth": "exp"} - bleu = comp_bleu( - correct=meters["_bleu_counts"].sum, - total=meters["_bleu_totals"].sum, - sys_len=meters["_bleu_sys_len"].sum, - ref_len=meters["_bleu_ref_len"].sum, - **smooth - ) - return round(bleu.score, 2) - - metrics.log_derived("bleu", compute_bleu) - - def max_positions(self): - """Return the max sentence length allowed by the task.""" - return (self.cfg.max_source_positions, self.cfg.max_target_positions) - - @property - def source_dictionary(self): - """Return the source :class:`~fairseq.data.Dictionary`.""" - return self.src_dict - - @property - def target_dictionary(self): - """Return the target :class:`~fairseq.data.Dictionary`.""" - return self.tgt_dict - - def _inference_with_bleu(self, generator, sample, model): - import sacrebleu - - def decode(toks, escape_unk=False): - s = self.tgt_dict.string( - toks.int().cpu(), - self.cfg.eval_bleu_remove_bpe, - # The default unknown string in fairseq is `<unk>`, but - # this is tokenized by sacrebleu as `< unk >`, inflating - # BLEU scores. Instead, we use a somewhat more verbose - # alternative that is unlikely to appear in the real - # reference, but doesn't get split into multiple tokens. - unk_string=("UNKNOWNTOKENINREF" if escape_unk else "UNKNOWNTOKENINHYP"), - ) - if self.tokenizer: - s = self.tokenizer.decode(s) - return s - - gen_out = self.inference_step(generator, [model], sample, prefix_tokens=None) - hyps, refs = [], [] - for i in range(len(gen_out)): - hyps.append(decode(gen_out[i][0]["tokens"])) - refs.append( - decode( - utils.strip_pad(sample["target"][i], self.tgt_dict.pad()), - escape_unk=True, # don't count <unk> as matches to the hypo - ) - ) - if self.cfg.eval_bleu_print_samples: - logger.info("example hypothesis: " + hyps[0]) - logger.info("example reference: " + refs[0]) - if self.cfg.eval_tokenized_bleu: - return sacrebleu.corpus_bleu(hyps, [refs], tokenize="none") - else: - return sacrebleu.corpus_bleu(hyps, [refs]) diff --git a/spaces/OFA-Sys/OFA-vqa/fairseq/fairseq/data/encoders/byte_utils.py b/spaces/OFA-Sys/OFA-vqa/fairseq/fairseq/data/encoders/byte_utils.py deleted file mode 100644 index a305c080926c2d094b7e8ae48f5331da82025a75..0000000000000000000000000000000000000000 --- a/spaces/OFA-Sys/OFA-vqa/fairseq/fairseq/data/encoders/byte_utils.py +++ /dev/null @@ -1,51 +0,0 @@ -# Copyright (c) Facebook, Inc. and its affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -import re - - -WHITESPACE_NORMALIZER = re.compile(r"\s+") -SPACE = chr(32) -SPACE_ESCAPE = chr(9601) -# excluding non-breaking space (160) here -PRINTABLE_LATIN = set( - list(range(32, 126 + 1)) + list(range(161, 172 + 1)) + list(range(174, 255 + 1)) -) -BYTE_TO_BCHAR = { - b: chr(b) if b in PRINTABLE_LATIN else chr(256 + b) for b in range(256) -} -BCHAR_TO_BYTE = {bc: b for b, bc in BYTE_TO_BCHAR.items()} - - -def byte_encode(x: str) -> str: - normalized = WHITESPACE_NORMALIZER.sub(SPACE, x) - return "".join([BYTE_TO_BCHAR[b] for b in normalized.encode("utf-8")]) - - -def byte_decode(x: str) -> str: - try: - return bytes([BCHAR_TO_BYTE[bc] for bc in x]).decode("utf-8") - except ValueError: - return "" - - -def smart_byte_decode(x: str) -> str: - output = byte_decode(x) - if output == "": - # DP the best recovery (max valid chars) if it's broken - n_bytes = len(x) - f = [0 for _ in range(n_bytes + 1)] - pt = [0 for _ in range(n_bytes + 1)] - for i in range(1, n_bytes + 1): - f[i], pt[i] = f[i - 1], i - 1 - for j in range(1, min(4, i) + 1): - if f[i - j] + 1 > f[i] and len(byte_decode(x[i - j : i])) > 0: - f[i], pt[i] = f[i - j] + 1, i - j - cur_pt = n_bytes - while cur_pt > 0: - if f[cur_pt] == f[pt[cur_pt]] + 1: - output = byte_decode(x[pt[cur_pt] : cur_pt]) + output - cur_pt = pt[cur_pt] - return output diff --git a/spaces/OFA-Sys/OFA-vqa/fairseq/fairseq/models/roberta/hub_interface.py b/spaces/OFA-Sys/OFA-vqa/fairseq/fairseq/models/roberta/hub_interface.py deleted file mode 100644 index ba298d63ba5da2a5b2f1a44d0384a6b249277ef4..0000000000000000000000000000000000000000 --- a/spaces/OFA-Sys/OFA-vqa/fairseq/fairseq/models/roberta/hub_interface.py +++ /dev/null @@ -1,235 +0,0 @@ -# Copyright (c) Facebook, Inc. and its affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -import numpy as np -import torch -import torch.nn as nn -import torch.nn.functional as F -from fairseq import utils -from fairseq.data import encoders - - -class RobertaHubInterface(nn.Module): - """A simple PyTorch Hub interface to RoBERTa. - - Usage: https://github.com/pytorch/fairseq/tree/main/examples/roberta - """ - - def __init__(self, cfg, task, model): - super().__init__() - self.cfg = cfg - self.task = task - self.model = model - - self.bpe = encoders.build_bpe(cfg.bpe) - - # this is useful for determining the device - self.register_buffer("_float_tensor", torch.tensor([0], dtype=torch.float)) - - @property - def device(self): - return self._float_tensor.device - - def encode( - self, sentence: str, *addl_sentences, no_separator=False - ) -> torch.LongTensor: - """ - BPE-encode a sentence (or multiple sentences). - - Every sequence begins with a beginning-of-sentence (`<s>`) symbol. - Every sentence ends with an end-of-sentence (`</s>`) and we use an - extra end-of-sentence (`</s>`) as a separator. - - Example (single sentence): `<s> a b c </s>` - Example (sentence pair): `<s> d e f </s> </s> 1 2 3 </s>` - - The BPE encoding follows GPT-2. One subtle detail is that the GPT-2 BPE - requires leading spaces. For example:: - - >>> roberta.encode('Hello world').tolist() - [0, 31414, 232, 2] - >>> roberta.encode(' world').tolist() - [0, 232, 2] - >>> roberta.encode('world').tolist() - [0, 8331, 2] - """ - bpe_sentence = "<s> " + self.bpe.encode(sentence) + " </s>" - for s in addl_sentences: - bpe_sentence += " </s>" if not no_separator else "" - bpe_sentence += " " + self.bpe.encode(s) + " </s>" - tokens = self.task.source_dictionary.encode_line( - bpe_sentence, append_eos=False, add_if_not_exist=False - ) - return tokens.long() - - def decode(self, tokens: torch.LongTensor): - assert tokens.dim() == 1 - tokens = tokens.numpy() - if tokens[0] == self.task.source_dictionary.bos(): - tokens = tokens[1:] # remove <s> - eos_mask = tokens == self.task.source_dictionary.eos() - doc_mask = eos_mask[1:] & eos_mask[:-1] - sentences = np.split(tokens, doc_mask.nonzero()[0] + 1) - sentences = [ - self.bpe.decode(self.task.source_dictionary.string(s)) for s in sentences - ] - if len(sentences) == 1: - return sentences[0] - return sentences - - def extract_features( - self, tokens: torch.LongTensor, return_all_hiddens: bool = False - ) -> torch.Tensor: - if tokens.dim() == 1: - tokens = tokens.unsqueeze(0) - if tokens.size(-1) > self.model.max_positions(): - raise ValueError( - "tokens exceeds maximum length: {} > {}".format( - tokens.size(-1), self.model.max_positions() - ) - ) - features, extra = self.model( - tokens.to(device=self.device), - features_only=True, - return_all_hiddens=return_all_hiddens, - ) - if return_all_hiddens: - # convert from T x B x C -> B x T x C - inner_states = extra["inner_states"] - return [inner_state.transpose(0, 1) for inner_state in inner_states] - else: - return features # just the last layer's features - - def register_classification_head( - self, name: str, num_classes: int = None, embedding_size: int = None, **kwargs - ): - self.model.register_classification_head( - name, num_classes=num_classes, embedding_size=embedding_size, **kwargs - ) - - def predict(self, head: str, tokens: torch.LongTensor, return_logits: bool = False): - features = self.extract_features(tokens.to(device=self.device)) - logits = self.model.classification_heads[head](features) - if return_logits: - return logits - return F.log_softmax(logits, dim=-1) - - def extract_features_aligned_to_words( - self, sentence: str, return_all_hiddens: bool = False - ) -> torch.Tensor: - """Extract RoBERTa features, aligned to spaCy's word-level tokenizer.""" - from fairseq.models.roberta import alignment_utils - from spacy.tokens import Doc - - nlp = alignment_utils.spacy_nlp() - tokenizer = alignment_utils.spacy_tokenizer() - - # tokenize both with GPT-2 BPE and spaCy - bpe_toks = self.encode(sentence) - spacy_toks = tokenizer(sentence) - spacy_toks_ws = [t.text_with_ws for t in tokenizer(sentence)] - alignment = alignment_utils.align_bpe_to_words(self, bpe_toks, spacy_toks_ws) - - # extract features and align them - features = self.extract_features( - bpe_toks, return_all_hiddens=return_all_hiddens - ) - features = features.squeeze(0) - aligned_feats = alignment_utils.align_features_to_words( - self, features, alignment - ) - - # wrap in spaCy Doc - doc = Doc( - nlp.vocab, - words=["<s>"] + [x.text for x in spacy_toks] + ["</s>"], - spaces=[True] - + [x.endswith(" ") for x in spacy_toks_ws[:-1]] - + [True, False], - ) - assert len(doc) == aligned_feats.size(0) - doc.user_token_hooks["vector"] = lambda token: aligned_feats[token.i] - return doc - - def fill_mask(self, masked_input: str, topk: int = 5): - masked_token = "<mask>" - assert ( - masked_token in masked_input and masked_input.count(masked_token) == 1 - ), "Please add one {0} token for the input, eg: 'He is a {0} guy'".format( - masked_token - ) - - text_spans = masked_input.split(masked_token) - text_spans_bpe = ( - (" {0} ".format(masked_token)) - .join([self.bpe.encode(text_span.rstrip()) for text_span in text_spans]) - .strip() - ) - tokens = self.task.source_dictionary.encode_line( - "<s> " + text_spans_bpe + " </s>", - append_eos=False, - add_if_not_exist=False, - ) - - masked_index = (tokens == self.task.mask_idx).nonzero(as_tuple=False) - if tokens.dim() == 1: - tokens = tokens.unsqueeze(0) - - with utils.model_eval(self.model): - features, extra = self.model( - tokens.long().to(device=self.device), - features_only=False, - return_all_hiddens=False, - ) - logits = features[0, masked_index, :].squeeze() - prob = logits.softmax(dim=0) - values, index = prob.topk(k=topk, dim=0) - topk_predicted_token_bpe = self.task.source_dictionary.string(index) - - topk_filled_outputs = [] - for index, predicted_token_bpe in enumerate( - topk_predicted_token_bpe.split(" ") - ): - predicted_token = self.bpe.decode(predicted_token_bpe) - # Quick hack to fix https://github.com/pytorch/fairseq/issues/1306 - if predicted_token_bpe.startswith("\u2581"): - predicted_token = " " + predicted_token - if " {0}".format(masked_token) in masked_input: - topk_filled_outputs.append( - ( - masked_input.replace( - " {0}".format(masked_token), predicted_token - ), - values[index].item(), - predicted_token, - ) - ) - else: - topk_filled_outputs.append( - ( - masked_input.replace(masked_token, predicted_token), - values[index].item(), - predicted_token, - ) - ) - return topk_filled_outputs - - def disambiguate_pronoun(self, sentence: str) -> bool: - """ - Usage:: - - >>> disambiguate_pronoun('The _trophy_ would not fit in the brown suitcase because [it] was too big.') - True - - >>> disambiguate_pronoun('The trophy would not fit in the brown suitcase because [it] was too big.') - 'The trophy' - """ - assert hasattr( - self.task, "disambiguate_pronoun" - ), "roberta.disambiguate_pronoun() requires a model trained with the WSC task." - with utils.model_eval(self.model): - return self.task.disambiguate_pronoun( - self.model, sentence, use_cuda=self.device.type == "cuda" - ) diff --git a/spaces/OFA-Sys/OFA-vqa/fairseq/fairseq/models/wav2vec/wav2vec2_asr.py b/spaces/OFA-Sys/OFA-vqa/fairseq/fairseq/models/wav2vec/wav2vec2_asr.py deleted file mode 100644 index eb5d819da5121a243e345b3812292ef0b13ccf98..0000000000000000000000000000000000000000 --- a/spaces/OFA-Sys/OFA-vqa/fairseq/fairseq/models/wav2vec/wav2vec2_asr.py +++ /dev/null @@ -1,664 +0,0 @@ -# Copyright (c) Facebook, Inc. and its affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -from argparse import Namespace -import contextlib -import copy -import math -import numpy as np -import torch -import torch.nn as nn -import torch.nn.functional as F -from dataclasses import dataclass, field -from omegaconf import MISSING, II, open_dict -from typing import Any, Optional - -from fairseq import checkpoint_utils, tasks, utils -from fairseq.dataclass import FairseqDataclass -from fairseq.dataclass.utils import convert_namespace_to_omegaconf -from fairseq.tasks import FairseqTask -from fairseq.models import ( - BaseFairseqModel, - FairseqEncoder, - FairseqEncoderDecoderModel, - FairseqIncrementalDecoder, - register_model, -) -from fairseq.models.wav2vec.wav2vec2 import MASKING_DISTRIBUTION_CHOICES -from fairseq.modules import ( - LayerNorm, - PositionalEmbedding, - TransformerDecoderLayer, -) - - -@dataclass -class Wav2Vec2AsrConfig(FairseqDataclass): - w2v_path: str = field( - default=MISSING, metadata={"help": "path to wav2vec 2.0 model"} - ) - no_pretrained_weights: bool = field( - default=False, metadata={"help": "if true, does not load pretrained weights"} - ) - dropout_input: float = field( - default=0.0, - metadata={"help": "dropout to apply to the input (after feat extr)"}, - ) - final_dropout: float = field( - default=0.0, - metadata={"help": "dropout after transformer and before final projection"}, - ) - dropout: float = field( - default=0.0, metadata={"help": "dropout probability inside wav2vec 2.0 model"} - ) - attention_dropout: float = field( - default=0.0, - metadata={ - "help": "dropout probability for attention weights inside wav2vec 2.0 model" - }, - ) - activation_dropout: float = field( - default=0.0, - metadata={ - "help": "dropout probability after activation in FFN inside wav2vec 2.0 model" - }, - ) - conv_feature_layers: Optional[str] = field( - default="[(512, 10, 5)] + [(512, 3, 2)] * 4 + [(512,2,2)] + [(512,2,2)]", - metadata={ - "help": ( - "string describing convolutional feature extraction " - "layers in form of a python list that contains " - "[(dim, kernel_size, stride), ...]" - ), - }, - ) - encoder_embed_dim: Optional[int] = field( - default=768, metadata={"help": "encoder embedding dimension"} - ) - - # masking - apply_mask: bool = field( - default=False, metadata={"help": "apply masking during fine-tuning"} - ) - mask_length: int = field( - default=10, metadata={"help": "repeat the mask indices multiple times"} - ) - mask_prob: float = field( - default=0.5, - metadata={ - "help": "probability of replacing a token with mask (normalized by length)" - }, - ) - mask_selection: MASKING_DISTRIBUTION_CHOICES = field( - default="static", metadata={"help": "how to choose masks"} - ) - mask_other: float = field( - default=0, - metadata={ - "help": "secondary mask argument (used for more complex distributions), " - "see help in compute_mask_indices" - }, - ) - no_mask_overlap: bool = field( - default=False, metadata={"help": "whether to allow masks to overlap"} - ) - mask_min_space: Optional[int] = field( - default=1, - metadata={"help": "min space between spans (if no overlap is enabled)"}, - ) - - # channel masking - mask_channel_length: int = field( - default=10, metadata={"help": "length of the mask for features (channels)"} - ) - mask_channel_prob: float = field( - default=0.0, metadata={"help": "probability of replacing a feature with 0"} - ) - mask_channel_selection: MASKING_DISTRIBUTION_CHOICES = field( - default="static", - metadata={"help": "how to choose mask length for channel masking"}, - ) - mask_channel_other: float = field( - default=0, - metadata={ - "help": "secondary mask argument (used for more complex distributions), " - "see help in compute_mask_indicesh" - }, - ) - no_mask_channel_overlap: bool = field( - default=False, metadata={"help": "whether to allow channel masks to overlap"} - ) - freeze_finetune_updates: int = field( - default=0, metadata={"help": "dont finetune wav2vec for this many updates"} - ) - feature_grad_mult: float = field( - default=0.0, metadata={"help": "reset feature grad mult in wav2vec 2.0 to this"} - ) - layerdrop: float = field( - default=0.0, metadata={"help": "probability of dropping a layer in wav2vec 2.0"} - ) - mask_channel_min_space: Optional[int] = field( - default=1, - metadata={"help": "min space between spans (if no overlap is enabled)"}, - ) - mask_channel_before: bool = False - normalize: bool = II("task.normalize") - data: str = II("task.data") - # this holds the loaded wav2vec args - w2v_args: Any = None - - -@dataclass -class Wav2Vec2CtcConfig(Wav2Vec2AsrConfig): - blank_weight: float = 0 - blank_mode: str = "add" - - -@register_model("wav2vec_ctc", dataclass=Wav2Vec2CtcConfig) -class Wav2VecCtc(BaseFairseqModel): - def __init__(self, cfg: Wav2Vec2CtcConfig, w2v_encoder: BaseFairseqModel): - super().__init__() - self.cfg = cfg - self.w2v_encoder = w2v_encoder - self.blank_weight = cfg.blank_weight - self.blank_mode = cfg.blank_mode - - def upgrade_state_dict_named(self, state_dict, name): - super().upgrade_state_dict_named(state_dict, name) - return state_dict - - @classmethod - def build_model(cls, cfg: Wav2Vec2CtcConfig, task: FairseqTask): - """Build a new model instance.""" - w2v_encoder = Wav2VecEncoder(cfg, len(task.target_dictionary)) - return cls(cfg, w2v_encoder) - - def get_logits(self, net_output, normalize=False): - logits = net_output["encoder_out"] - if self.blank_weight != 0: - if self.blank_mode == "add": - logits[..., 0] += self.blank_weight - elif self.blank_mode == "set": - logits[..., 0] = self.blank_weight - else: - raise Exception(f"invalid blank mode {self.blank_mode}") - - if net_output["padding_mask"] is not None and net_output["padding_mask"].any(): - logits[net_output["padding_mask"].T][..., 0] = float("inf") - logits[net_output["padding_mask"].T][..., 1:] = float("-inf") - - if normalize: - logits = utils.log_softmax(logits.float(), dim=-1) - - return logits - - def get_normalized_probs(self, net_output, log_probs): - """Get normalized probabilities (or log probs) from a net's output.""" - - logits = self.get_logits(net_output) - - if log_probs: - return utils.log_softmax(logits.float(), dim=-1) - else: - return utils.softmax(logits.float(), dim=-1) - - def forward(self, **kwargs): - x = self.w2v_encoder(**kwargs) - return x - - -@dataclass -class Wav2Vec2Seq2SeqConfig(Wav2Vec2AsrConfig): - decoder_embed_dim: int = field( - default=768, metadata={"help": "decoder embedding dimension"} - ) - decoder_ffn_embed_dim: int = field( - default=3072, metadata={"help": "decoder embedding dimension for FFN"} - ) - decoder_layers: int = field(default=6, metadata={"help": "num of decoder layers"}) - decoder_layerdrop: float = field( - default=0.0, metadata={"help": "decoder layerdrop chance"} - ) - decoder_attention_heads: int = field( - default=4, metadata={"help": "num decoder attention heads"} - ) - decoder_learned_pos: bool = field( - default=False, - metadata={"help": "use learned positional embeddings in the decoder"}, - ) - decoder_normalize_before: bool = field( - default=False, metadata={"help": "apply layernorm before each decoder block"} - ) - no_token_positional_embeddings: bool = field( - default=False, - metadata={ - "help": "if set, disables positional embeddings (outside self attention)" - }, - ) - decoder_dropout: float = field( - default=0.0, metadata={"help": "dropout probability in the decoder"} - ) - decoder_attention_dropout: float = field( - default=0.0, - metadata={ - "help": "dropout probability for attention weights inside the decoder" - }, - ) - decoder_activation_dropout: float = field( - default=0.0, - metadata={ - "help": "dropout probability after activation in FFN inside the decoder" - }, - ) - max_target_positions: int = field( - default=2048, metadata={"help": "max target positions"} - ) - share_decoder_input_output_embed: bool = field( - default=False, metadata={"help": "share decoder input and output embeddings"} - ) - autoregressive: bool = II("task.autoregressive") - - -@register_model("wav2vec_seq2seq", dataclass=Wav2Vec2Seq2SeqConfig) -class Wav2Vec2Seq2SeqModel(FairseqEncoderDecoderModel): - def __init__(self, encoder, decoder): - super().__init__(encoder, decoder) - - @classmethod - def build_model(cls, cfg: Wav2Vec2Seq2SeqConfig, task: FairseqTask): - """Build a new model instance.""" - - assert ( - cfg.autoregressive - ), "Please set task.autoregressive=true for seq2seq asr models" - - src_dict, tgt_dict = task.source_dictionary, task.target_dictionary - - def build_embedding(dictionary, embed_dim): - num_embeddings = len(dictionary) - padding_idx = dictionary.pad() - emb = Embedding(num_embeddings, embed_dim, padding_idx) - return emb - - decoder_embed_tokens = build_embedding(tgt_dict, cfg.decoder_embed_dim) - - encoder = cls.build_encoder(cfg) - decoder = cls.build_decoder(cfg, tgt_dict, decoder_embed_tokens) - - return Wav2Vec2Seq2SeqModel(encoder, decoder) - - @classmethod - def build_encoder(cls, cfg: Wav2Vec2AsrConfig): - return Wav2VecEncoder(cfg) - - @classmethod - def build_decoder(cls, cfg: Wav2Vec2Seq2SeqConfig, tgt_dict, embed_tokens): - return TransformerDecoder(cfg, tgt_dict, embed_tokens) - - def forward(self, **kwargs): - encoder_out = self.encoder(**kwargs) - decoder_out = self.decoder(encoder_out=encoder_out, **kwargs) - return decoder_out - - def upgrade_state_dict_named(self, state_dict, name): - super().upgrade_state_dict_named(state_dict, name) - return state_dict - - -class Wav2VecEncoder(FairseqEncoder): - def __init__(self, cfg: Wav2Vec2AsrConfig, output_size=None): - self.apply_mask = cfg.apply_mask - - arg_overrides = { - "dropout": cfg.dropout, - "activation_dropout": cfg.activation_dropout, - "dropout_input": cfg.dropout_input, - "attention_dropout": cfg.attention_dropout, - "mask_length": cfg.mask_length, - "mask_prob": cfg.mask_prob, - "mask_selection": cfg.mask_selection, - "mask_other": cfg.mask_other, - "no_mask_overlap": cfg.no_mask_overlap, - "mask_channel_length": cfg.mask_channel_length, - "mask_channel_prob": cfg.mask_channel_prob, - "mask_channel_before": cfg.mask_channel_before, - "mask_channel_selection": cfg.mask_channel_selection, - "mask_channel_other": cfg.mask_channel_other, - "no_mask_channel_overlap": cfg.no_mask_channel_overlap, - "encoder_layerdrop": cfg.layerdrop, - "feature_grad_mult": cfg.feature_grad_mult, - } - - if cfg.w2v_args is None: - state = checkpoint_utils.load_checkpoint_to_cpu(cfg.w2v_path, arg_overrides) - w2v_args = state.get("cfg", None) - if w2v_args is None: - w2v_args = convert_namespace_to_omegaconf(state["args"]) - w2v_args.criterion = None - w2v_args.lr_scheduler = None - cfg.w2v_args = w2v_args - else: - state = None - w2v_args = cfg.w2v_args - if isinstance(w2v_args, Namespace): - cfg.w2v_args = w2v_args = convert_namespace_to_omegaconf(w2v_args) - - assert cfg.normalize == w2v_args.task.normalize, ( - "Fine-tuning works best when data normalization is the same. " - "Please check that --normalize is set or unset for both pre-training and here" - ) - - w2v_args.task.data = cfg.data - task = tasks.setup_task(w2v_args.task) - model = task.build_model(w2v_args.model) - - if state is not None and not cfg.no_pretrained_weights: - model.load_state_dict(state["model"], strict=True) - - model.remove_pretraining_modules() - - super().__init__(task.source_dictionary) - - d = w2v_args.model.encoder_embed_dim - - self.w2v_model = model - - self.final_dropout = nn.Dropout(cfg.final_dropout) - self.freeze_finetune_updates = cfg.freeze_finetune_updates - self.num_updates = 0 - - targ_d = None - self.proj = None - - if output_size is not None: - targ_d = output_size - elif getattr(cfg, "decoder_embed_dim", d) != d: - targ_d = cfg.decoder_embed_dim - - if targ_d is not None: - self.proj = Linear(d, targ_d) - - def set_num_updates(self, num_updates): - """Set the number of parameters updates.""" - super().set_num_updates(num_updates) - self.num_updates = num_updates - - def forward(self, source, padding_mask, **kwargs): - - w2v_args = { - "source": source, - "padding_mask": padding_mask, - "mask": self.apply_mask and self.training, - } - - ft = self.freeze_finetune_updates <= self.num_updates - - with torch.no_grad() if not ft else contextlib.ExitStack(): - res = self.w2v_model.extract_features(**w2v_args) - - x = res["x"] - padding_mask = res["padding_mask"] - - # B x T x C -> T x B x C - x = x.transpose(0, 1) - - x = self.final_dropout(x) - - if self.proj: - x = self.proj(x) - - return { - "encoder_out": x, # T x B x C - "padding_mask": padding_mask, # B x T, - "layer_results": res["layer_results"], - } - - def forward_torchscript(self, net_input): - if torch.jit.is_scripting(): - return self.forward(net_input["source"], net_input["padding_mask"]) - else: - return self.forward_non_torchscript(net_input) - - def reorder_encoder_out(self, encoder_out, new_order): - if encoder_out["encoder_out"] is not None: - encoder_out["encoder_out"] = encoder_out["encoder_out"].index_select( - 1, new_order - ) - if encoder_out["padding_mask"] is not None: - encoder_out["padding_mask"] = encoder_out[ - "padding_mask" - ].index_select(0, new_order) - return encoder_out - - def max_positions(self): - """Maximum input length supported by the encoder.""" - return None - - def upgrade_state_dict_named(self, state_dict, name): - return state_dict - - -class TransformerDecoder(FairseqIncrementalDecoder): - """ - Transformer decoder consisting of *args.decoder_layers* layers. Each layer - is a :class:`TransformerDecoderLayer`. - - Args: - args (argparse.Namespace): parsed command-line arguments - dictionary (~fairseq.data.Dictionary): decoding dictionary - embed_tokens (torch.nn.Embedding): output embedding - no_encoder_attn (bool, optional): whether to attend to encoder outputs - (default: False). - """ - - def __init__( - self, - cfg: Wav2Vec2Seq2SeqConfig, - dictionary, - embed_tokens, - no_encoder_attn=False, - ): - super().__init__(dictionary) - - self.dropout = cfg.decoder_dropout - self.share_input_output_embed = cfg.share_decoder_input_output_embed - - input_embed_dim = embed_tokens.embedding_dim - embed_dim = cfg.decoder_embed_dim - self.output_embed_dim = cfg.decoder_embed_dim - - self.layerdrop = cfg.decoder_layerdrop - - self.padding_idx = embed_tokens.padding_idx - self.max_target_positions = cfg.max_target_positions - - self.embed_tokens = embed_tokens - self.embed_scale = math.sqrt(embed_dim) # todo: try with input_embed_dim - - self.project_in_dim = ( - Linear(input_embed_dim, embed_dim, bias=False) - if embed_dim != input_embed_dim - else None - ) - - self.embed_positions = ( - PositionalEmbedding( - cfg.max_target_positions, - embed_dim, - self.padding_idx, - learned=cfg.decoder_learned_pos, - ) - if not cfg.no_token_positional_embeddings - else None - ) - - # TODO: update this when transformer gets converted to dataclass configs - transformer_cfg = copy.deepcopy(cfg) - with open_dict(transformer_cfg): - transformer_cfg.dropout = transformer_cfg.decoder_dropout - transformer_cfg.attention_dropout = ( - transformer_cfg.decoder_attention_dropout - ) - transformer_cfg.activation_dropout = ( - transformer_cfg.decoder_activation_dropout - ) - - self.layers = nn.ModuleList([]) - self.layers.extend( - [ - TransformerDecoderLayer(transformer_cfg, no_encoder_attn) - for _ in range(transformer_cfg.decoder_layers) - ] - ) - - if not self.share_input_output_embed: - self.embed_out = nn.Parameter( - torch.Tensor(len(dictionary), self.output_embed_dim) - ) - nn.init.normal_(self.embed_out, mean=0, std=self.output_embed_dim ** -0.5) - - if transformer_cfg.decoder_normalize_before: - self.layer_norm = LayerNorm(embed_dim) - else: - self.layer_norm = None - - def forward( - self, prev_output_tokens, encoder_out=None, incremental_state=None, **unused - ): - """ - Args: - prev_output_tokens (LongTensor): previous decoder outputs of shape - `(batch, tgt_len)`, for teacher forcing - encoder_out (Tensor, optional): output from the encoder, used for - encoder-side attention - incremental_state (dict): dictionary used for storing state during - :ref:`Incremental decoding` - - Returns: - tuple: - - the decoder's output of shape `(batch, tgt_len, vocab)` - - a dictionary with any model-specific outputs - """ - prev_output_tokens = prev_output_tokens.long() - x, extra = self.extract_features( - prev_output_tokens, encoder_out, incremental_state - ) - x = self.output_layer(x) - return x, extra - - def extract_features( - self, prev_output_tokens, encoder_out=None, incremental_state=None, **unused - ): - """ - Similar to *forward* but only return features. - - Returns: - tuple: - - the decoder's features of shape `(batch, tgt_len, embed_dim)` - - a dictionary with any model-specific outputs - """ - - # embed positions - positions = ( - self.embed_positions( - prev_output_tokens, incremental_state=incremental_state - ) - if self.embed_positions is not None - else None - ) - - if incremental_state is not None: - prev_output_tokens = prev_output_tokens[:, -1:] - if positions is not None: - positions = positions[:, -1:] - - # embed tokens and positions - x = self.embed_scale * self.embed_tokens(prev_output_tokens) - - if self.project_in_dim is not None: - x = self.project_in_dim(x) - - if positions is not None: - x += positions - x = F.dropout(x, p=self.dropout, training=self.training) - - # B x T x C -> T x B x C - x = x.transpose(0, 1) - attn = None - - inner_states = [x] - - # decoder layers - self_attn_padding_mask = None - if prev_output_tokens.eq(self.padding_idx).any(): - self_attn_padding_mask = prev_output_tokens.eq(self.padding_idx) - for layer in self.layers: - dropout_probability = np.random.random() - if not self.training or (dropout_probability > self.layerdrop): - x, attn, _ = layer( - x, - encoder_out["encoder_out"] if encoder_out is not None else None, - encoder_out["padding_mask"] if encoder_out is not None else None, - incremental_state, - self_attn_mask=self.buffered_future_mask(x) - if incremental_state is None - else None, - self_attn_padding_mask=self_attn_padding_mask - ) - inner_states.append(x) - - if self.layer_norm: - x = self.layer_norm(x) - - # T x B x C -> B x T x C - x = x.transpose(0, 1) - - return x, {"attn": attn, "inner_states": inner_states} - - def output_layer(self, features, **kwargs): - """Project features to the vocabulary size.""" - # project back to size of vocabulary - if self.share_input_output_embed: - return F.linear(features, self.embed_tokens.weight) - else: - return F.linear(features, self.embed_out) - - def max_positions(self): - """Maximum output length supported by the decoder.""" - if self.embed_positions is None: - return self.max_target_positions - return min(self.max_target_positions, self.embed_positions.max_positions) - - def buffered_future_mask(self, tensor): - dim = tensor.size(0) - if ( - not hasattr(self, "_future_mask") - or self._future_mask is None - or self._future_mask.device != tensor.device - or self._future_mask.size(0) < dim - ): - self._future_mask = torch.triu( - utils.fill_with_neg_inf(tensor.new(dim, dim)), 1 - ) - return self._future_mask[:dim, :dim] - - def upgrade_state_dict_named(self, state_dict, name): - return state_dict - - -def Embedding(num_embeddings, embedding_dim, padding_idx): - m = nn.Embedding(num_embeddings, embedding_dim, padding_idx=padding_idx) - nn.init.normal_(m.weight, mean=0, std=embedding_dim ** -0.5) - nn.init.constant_(m.weight[padding_idx], 0) - return m - - -def Linear(in_features, out_features, bias=True): - m = nn.Linear(in_features, out_features, bias) - nn.init.xavier_uniform_(m.weight) - if bias: - nn.init.constant_(m.bias, 0.0) - return m diff --git a/spaces/OFA-Sys/OFA-vqa/fairseq/fairseq/tasks/sentence_prediction.py b/spaces/OFA-Sys/OFA-vqa/fairseq/fairseq/tasks/sentence_prediction.py deleted file mode 100644 index d5f9302c10b3410e7650433d54f70aad4fd1cfc4..0000000000000000000000000000000000000000 --- a/spaces/OFA-Sys/OFA-vqa/fairseq/fairseq/tasks/sentence_prediction.py +++ /dev/null @@ -1,286 +0,0 @@ -# Copyright (c) Facebook, Inc. and its affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -import logging -import os - -import contextlib -from dataclasses import dataclass, field -from typing import Optional -from omegaconf import MISSING, II, open_dict, OmegaConf - -import numpy as np -from fairseq.data import ( - ConcatSentencesDataset, - Dictionary, - IdDataset, - NestedDictionaryDataset, - NumelDataset, - NumSamplesDataset, - OffsetTokensDataset, - PrependTokenDataset, - RawLabelDataset, - RightPadDataset, - RollDataset, - SortDataset, - StripTokenDataset, - data_utils, -) -from fairseq.data.shorten_dataset import maybe_shorten_dataset -from fairseq.tasks import FairseqDataclass, FairseqTask, register_task -from fairseq.dataclass import ChoiceEnum - - -logger = logging.getLogger(__name__) -SHORTEN_METHOD_CHOICES = ChoiceEnum(["none", "truncate", "random_crop"]) - - -@dataclass -class SentencePredictionConfig(FairseqDataclass): - data: str = field(default=MISSING, metadata={"help": "path to data directory"}) - num_classes: int = field( - default=-1, - metadata={"help": "number of classes or regression targets"}, - ) - init_token: Optional[int] = field( - default=None, - metadata={"help": "add token at the beginning of each batch item"}, - ) - separator_token: Optional[int] = field( - default=None, - metadata={"help": "add separator token between inputs"}, - ) - no_shuffle: bool = field( - default=False, - ) - shorten_method: SHORTEN_METHOD_CHOICES = field( - default="none", - metadata={ - "help": "if not none, shorten sequences that exceed tokens_per_sample" - }, - ) - shorten_data_split_list: str = field( - default="", - metadata={ - "help": "comma-separated list of dataset splits to apply shortening to, " - 'e.g., "train,valid" (default: all dataset splits)' - }, - ) - add_prev_output_tokens: bool = field( - default=False, - metadata={ - "help": "add prev_output_tokens to sample, used for encoder-decoder arch" - }, - ) - max_positions: int = field( - default=512, - metadata={"help": "max tokens per example"}, - ) - - regression_target: bool = II("criterion.regression_target") - classification_head_name: str = II("criterion.classification_head_name") - seed: int = II("common.seed") - - -@register_task("sentence_prediction", dataclass=SentencePredictionConfig) -class SentencePredictionTask(FairseqTask): - """ - Sentence (or sentence pair) prediction (classification or regression) task. - - Args: - dictionary (Dictionary): the dictionary for the input of the task - """ - - def __init__(self, cfg, data_dictionary, label_dictionary): - super().__init__(cfg) - self.dictionary = data_dictionary - self._label_dictionary = label_dictionary - - @classmethod - def load_dictionary(cls, filename): - """Load the dictionary from the filename - - Args: - filename (str): the filename - """ - dictionary = Dictionary.load(filename) - dictionary.add_symbol("<mask>") - return dictionary - - @classmethod - def setup_task(cls, cfg, **kwargs): - assert cfg.num_classes > 0, "Must set task.num_classes" - - # load data dictionary - data_dict = cls.load_dictionary( - os.path.join(cfg.data, "input0", "dict.txt"), - ) - logger.info("[input] dictionary: {} types".format(len(data_dict))) - - # load label dictionary - if not cfg.regression_target: - label_dict = cls.load_dictionary( - os.path.join(cfg.data, "label", "dict.txt"), - ) - logger.info("[label] dictionary: {} types".format(len(label_dict))) - else: - label_dict = data_dict - return cls(cfg, data_dict, label_dict) - - def load_dataset(self, split, combine=False, **kwargs): - """Load a given dataset split (e.g., train, valid, test).""" - - def get_path(key, split): - return os.path.join(self.cfg.data, key, split) - - def make_dataset(key, dictionary): - split_path = get_path(key, split) - - try: - dataset = data_utils.load_indexed_dataset( - split_path, - dictionary, - combine=combine, - ) - except Exception as e: - if "StorageException: [404] Path not found" in str(e): - logger.warning(f"dataset {e} not found") - dataset = None - else: - raise e - return dataset - - input0 = make_dataset("input0", self.source_dictionary) - assert input0 is not None, "could not find dataset: {}".format( - get_path("input0", split) - ) - input1 = make_dataset("input1", self.source_dictionary) - - if self.cfg.init_token is not None: - input0 = PrependTokenDataset(input0, self.cfg.init_token) - - if input1 is None: - src_tokens = input0 - else: - if self.cfg.separator_token is not None: - input1 = PrependTokenDataset(input1, self.cfg.separator_token) - - src_tokens = ConcatSentencesDataset(input0, input1) - - with data_utils.numpy_seed(self.cfg.seed): - shuffle = np.random.permutation(len(src_tokens)) - - src_tokens = maybe_shorten_dataset( - src_tokens, - split, - self.cfg.shorten_data_split_list, - self.cfg.shorten_method, - self.max_positions(), - self.cfg.seed, - ) - - dataset = { - "id": IdDataset(), - "net_input": { - "src_tokens": RightPadDataset( - src_tokens, - pad_idx=self.source_dictionary.pad(), - ), - "src_lengths": NumelDataset(src_tokens, reduce=False), - }, - "nsentences": NumSamplesDataset(), - "ntokens": NumelDataset(src_tokens, reduce=True), - } - - if self.cfg.add_prev_output_tokens: - prev_tokens_dataset = RightPadDataset( - RollDataset(src_tokens, 1), - pad_idx=self.dictionary.pad(), - ) - dataset["net_input"].update( - prev_output_tokens=prev_tokens_dataset, - ) - - if not self.cfg.regression_target: - label_dataset = make_dataset("label", self.label_dictionary) - if label_dataset is not None: - dataset.update( - target=OffsetTokensDataset( - StripTokenDataset( - label_dataset, - id_to_strip=self.label_dictionary.eos(), - ), - offset=-self.label_dictionary.nspecial, - ) - ) - else: - label_path = "{0}.label".format(get_path("label", split)) - if os.path.exists(label_path): - - def parse_regression_target(i, line): - values = line.split() - assert ( - len(values) == self.cfg.num_classes - ), f'expected num_classes={self.cfg.num_classes} regression target values on line {i}, found: "{line}"' - return [float(x) for x in values] - - with open(label_path) as h: - dataset.update( - target=RawLabelDataset( - [ - parse_regression_target(i, line.strip()) - for i, line in enumerate(h.readlines()) - ] - ) - ) - - nested_dataset = NestedDictionaryDataset( - dataset, - sizes=[src_tokens.sizes], - ) - - if self.cfg.no_shuffle: - dataset = nested_dataset - else: - dataset = SortDataset( - nested_dataset, - # shuffle - sort_order=[shuffle], - ) - - logger.info("Loaded {0} with #samples: {1}".format(split, len(dataset))) - - self.datasets[split] = dataset - return self.datasets[split] - - def build_model(self, cfg): - from fairseq import models - - with open_dict(cfg) if OmegaConf.is_config(cfg) else contextlib.ExitStack(): - cfg.max_positions = self.cfg.max_positions - - model = models.build_model(cfg, self) - - model.register_classification_head( - self.cfg.classification_head_name, - num_classes=self.cfg.num_classes, - ) - - return model - - def max_positions(self): - return self.cfg.max_positions - - @property - def source_dictionary(self): - return self.dictionary - - @property - def target_dictionary(self): - return self.dictionary - - @property - def label_dictionary(self): - return self._label_dictionary diff --git a/spaces/OneAfterlife/MubertTTM/constants.py b/spaces/OneAfterlife/MubertTTM/constants.py deleted file mode 100644 index 62633e107d6ff9e39e65843c9ac805dcb194a965..0000000000000000000000000000000000000000 --- a/spaces/OneAfterlife/MubertTTM/constants.py +++ /dev/null @@ -1,7 +0,0 @@ -import numpy as np - -MUBERT_TAGS_STRING = 'tribal,action,kids,neo-classic,run 130,pumped,jazz / funk,ethnic,dubtechno,reggae,acid jazz,liquidfunk,funk,witch house,tech house,underground,artists,mystical,disco,sensorium,r&b,agender,psychedelic trance / psytrance,peaceful,run 140,piano,run 160,setting,meditation,christmas,ambient,horror,cinematic,electro house,idm,bass,minimal,underscore,drums,glitchy,beautiful,technology,tribal house,country pop,jazz & funk,documentary,space,classical,valentines,chillstep,experimental,trap,new jack swing,drama,post-rock,tense,corporate,neutral,happy,analog,funky,spiritual,sberzvuk special,chill hop,dramatic,catchy,holidays,fitness 90,optimistic,orchestra,acid techno,energizing,romantic,minimal house,breaks,hyper pop,warm up,dreamy,dark,urban,microfunk,dub,nu disco,vogue,keys,hardcore,aggressive,indie,electro funk,beauty,relaxing,trance,pop,hiphop,soft,acoustic,chillrave / ethno-house,deep techno,angry,dance,fun,dubstep,tropical,latin pop,heroic,world music,inspirational,uplifting,atmosphere,art,epic,advertising,chillout,scary,spooky,slow ballad,saxophone,summer,erotic,jazzy,energy 100,kara mar,xmas,atmospheric,indie pop,hip-hop,yoga,reggaeton,lounge,travel,running,folk,chillrave & ethno-house,detective,darkambient,chill,fantasy,minimal techno,special,night,tropical house,downtempo,lullaby,meditative,upbeat,glitch hop,fitness,neurofunk,sexual,indie rock,future pop,jazz,cyberpunk,melancholic,happy hardcore,family / kids,synths,electric guitar,comedy,psychedelic trance & psytrance,edm,psychedelic rock,calm,zen,bells,podcast,melodic house,ethnic percussion,nature,heavy,bassline,indie dance,techno,drumnbass,synth pop,vaporwave,sad,8-bit,chillgressive,deep,orchestral,futuristic,hardtechno,nostalgic,big room,sci-fi,tutorial,joyful,pads,minimal 170,drill,ethnic 108,amusing,sleepy ambient,psychill,italo disco,lofi,house,acoustic guitar,bassline house,rock,k-pop,synthwave,deep house,electronica,gabber,nightlife,sport & fitness,road trip,celebration,electro,disco house,electronic' -MUBERT_TAGS = np.array(MUBERT_TAGS_STRING.split(',')) -MUBERT_LICENSE = "ttmmubertlicense#f0acYBenRcfeFpNT4wpYGaTQIyDI4mJGv5MfIhBFz97NXDwDNFHmMRsBSzmGsJwbTpP1A6i07AXcIeAHo5" -MUBERT_MODE = "loop" -MUBERT_TOKEN = "4951f6428e83172a4f39de05d5b3ab10d58560b8" diff --git a/spaces/OpenGVLab/InternGPT/iGPT/models/grit_src/third_party/CenterNet2/detectron2/evaluation/testing.py b/spaces/OpenGVLab/InternGPT/iGPT/models/grit_src/third_party/CenterNet2/detectron2/evaluation/testing.py deleted file mode 100644 index 9e5ae625bb0593fc20739dd3ea549157e4df4f3d..0000000000000000000000000000000000000000 --- a/spaces/OpenGVLab/InternGPT/iGPT/models/grit_src/third_party/CenterNet2/detectron2/evaluation/testing.py +++ /dev/null @@ -1,85 +0,0 @@ -# Copyright (c) Facebook, Inc. and its affiliates. -import logging -import numpy as np -import pprint -import sys -from collections.abc import Mapping - - -def print_csv_format(results): - """ - Print main metrics in a format similar to Detectron, - so that they are easy to copypaste into a spreadsheet. - - Args: - results (OrderedDict[dict]): task_name -> {metric -> score} - unordered dict can also be printed, but in arbitrary order - """ - assert isinstance(results, Mapping) or not len(results), results - logger = logging.getLogger(__name__) - for task, res in results.items(): - if isinstance(res, Mapping): - # Don't print "AP-category" metrics since they are usually not tracked. - important_res = [(k, v) for k, v in res.items() if "-" not in k] - logger.info("copypaste: Task: {}".format(task)) - logger.info("copypaste: " + ",".join([k[0] for k in important_res])) - logger.info("copypaste: " + ",".join(["{0:.4f}".format(k[1]) for k in important_res])) - else: - logger.info(f"copypaste: {task}={res}") - - -def verify_results(cfg, results): - """ - Args: - results (OrderedDict[dict]): task_name -> {metric -> score} - - Returns: - bool: whether the verification succeeds or not - """ - expected_results = cfg.TEST.EXPECTED_RESULTS - if not len(expected_results): - return True - - ok = True - for task, metric, expected, tolerance in expected_results: - actual = results[task].get(metric, None) - if actual is None: - ok = False - continue - if not np.isfinite(actual): - ok = False - continue - diff = abs(actual - expected) - if diff > tolerance: - ok = False - - logger = logging.getLogger(__name__) - if not ok: - logger.error("Result verification failed!") - logger.error("Expected Results: " + str(expected_results)) - logger.error("Actual Results: " + pprint.pformat(results)) - - sys.exit(1) - else: - logger.info("Results verification passed.") - return ok - - -def flatten_results_dict(results): - """ - Expand a hierarchical dict of scalars into a flat dict of scalars. - If results[k1][k2][k3] = v, the returned dict will have the entry - {"k1/k2/k3": v}. - - Args: - results (dict): - """ - r = {} - for k, v in results.items(): - if isinstance(v, Mapping): - v = flatten_results_dict(v) - for kk, vv in v.items(): - r[k + "/" + kk] = vv - else: - r[k] = v - return r diff --git a/spaces/OpenGVLab/InternGPT/iGPT/models/grit_src/third_party/CenterNet2/detectron2/modeling/postprocessing.py b/spaces/OpenGVLab/InternGPT/iGPT/models/grit_src/third_party/CenterNet2/detectron2/modeling/postprocessing.py deleted file mode 100644 index 52f273bb5ee150ed7252207312320f0a9bdf0e65..0000000000000000000000000000000000000000 --- a/spaces/OpenGVLab/InternGPT/iGPT/models/grit_src/third_party/CenterNet2/detectron2/modeling/postprocessing.py +++ /dev/null @@ -1,101 +0,0 @@ -# Copyright (c) Facebook, Inc. and its affiliates. -import torch -from torch.nn import functional as F - -from detectron2.structures import Instances, ROIMasks - - -# perhaps should rename to "resize_instance" -def detector_postprocess( - results: Instances, output_height: int, output_width: int, mask_threshold: float = 0.5 -): - """ - Resize the output instances. - The input images are often resized when entering an object detector. - As a result, we often need the outputs of the detector in a different - resolution from its inputs. - - This function will resize the raw outputs of an R-CNN detector - to produce outputs according to the desired output resolution. - - Args: - results (Instances): the raw outputs from the detector. - `results.image_size` contains the input image resolution the detector sees. - This object might be modified in-place. - output_height, output_width: the desired output resolution. - - Returns: - Instances: the resized output from the model, based on the output resolution - """ - if isinstance(output_width, torch.Tensor): - # This shape might (but not necessarily) be tensors during tracing. - # Converts integer tensors to float temporaries to ensure true - # division is performed when computing scale_x and scale_y. - output_width_tmp = output_width.float() - output_height_tmp = output_height.float() - new_size = torch.stack([output_height, output_width]) - else: - new_size = (output_height, output_width) - output_width_tmp = output_width - output_height_tmp = output_height - - scale_x, scale_y = ( - output_width_tmp / results.image_size[1], - output_height_tmp / results.image_size[0], - ) - results = Instances(new_size, **results.get_fields()) - - if results.has("pred_boxes"): - output_boxes = results.pred_boxes - elif results.has("proposal_boxes"): - output_boxes = results.proposal_boxes - else: - output_boxes = None - assert output_boxes is not None, "Predictions must contain boxes!" - - output_boxes.scale(scale_x, scale_y) - output_boxes.clip(results.image_size) - - results = results[output_boxes.nonempty()] - - if results.has("pred_masks"): - if isinstance(results.pred_masks, ROIMasks): - roi_masks = results.pred_masks - else: - # pred_masks is a tensor of shape (N, 1, M, M) - roi_masks = ROIMasks(results.pred_masks[:, 0, :, :]) - results.pred_masks = roi_masks.to_bitmasks( - results.pred_boxes, output_height, output_width, mask_threshold - ).tensor # TODO return ROIMasks/BitMask object in the future - - if results.has("pred_keypoints"): - results.pred_keypoints[:, :, 0] *= scale_x - results.pred_keypoints[:, :, 1] *= scale_y - - return results - - -def sem_seg_postprocess(result, img_size, output_height, output_width): - """ - Return semantic segmentation predictions in the original resolution. - - The input images are often resized when entering semantic segmentor. Moreover, in same - cases, they also padded inside segmentor to be divisible by maximum network stride. - As a result, we often need the predictions of the segmentor in a different - resolution from its inputs. - - Args: - result (Tensor): semantic segmentation prediction logits. A tensor of shape (C, H, W), - where C is the number of classes, and H, W are the height and width of the prediction. - img_size (tuple): image size that segmentor is taking as input. - output_height, output_width: the desired output resolution. - - Returns: - semantic segmentation prediction (Tensor): A tensor of the shape - (C, output_height, output_width) that contains per-pixel soft predictions. - """ - result = result[:, : img_size[0], : img_size[1]].expand(1, -1, -1, -1) - result = F.interpolate( - result, size=(output_height, output_width), mode="bilinear", align_corners=False - )[0] - return result diff --git a/spaces/OpenGVLab/InternGPT/iGPT/models/inpainting_src/ldm_inpainting/ldm/modules/diffusionmodules/openaimodel.py b/spaces/OpenGVLab/InternGPT/iGPT/models/inpainting_src/ldm_inpainting/ldm/modules/diffusionmodules/openaimodel.py deleted file mode 100644 index fcf95d1ea8a078dd259915109203789f78f0643a..0000000000000000000000000000000000000000 --- a/spaces/OpenGVLab/InternGPT/iGPT/models/inpainting_src/ldm_inpainting/ldm/modules/diffusionmodules/openaimodel.py +++ /dev/null @@ -1,961 +0,0 @@ -from abc import abstractmethod -from functools import partial -import math -from typing import Iterable - -import numpy as np -import torch as th -import torch.nn as nn -import torch.nn.functional as F - -from ldm.modules.diffusionmodules.util import ( - checkpoint, - conv_nd, - linear, - avg_pool_nd, - zero_module, - normalization, - timestep_embedding, -) -from ldm.modules.attention import SpatialTransformer - - -# dummy replace -def convert_module_to_f16(x): - pass - -def convert_module_to_f32(x): - pass - - -## go -class AttentionPool2d(nn.Module): - """ - Adapted from CLIP: https://github.com/openai/CLIP/blob/main/clip/model.py - """ - - def __init__( - self, - spacial_dim: int, - embed_dim: int, - num_heads_channels: int, - output_dim: int = None, - ): - super().__init__() - self.positional_embedding = nn.Parameter(th.randn(embed_dim, spacial_dim ** 2 + 1) / embed_dim ** 0.5) - self.qkv_proj = conv_nd(1, embed_dim, 3 * embed_dim, 1) - self.c_proj = conv_nd(1, embed_dim, output_dim or embed_dim, 1) - self.num_heads = embed_dim // num_heads_channels - self.attention = QKVAttention(self.num_heads) - - def forward(self, x): - b, c, *_spatial = x.shape - x = x.reshape(b, c, -1) # NC(HW) - x = th.cat([x.mean(dim=-1, keepdim=True), x], dim=-1) # NC(HW+1) - x = x + self.positional_embedding[None, :, :].to(x.dtype) # NC(HW+1) - x = self.qkv_proj(x) - x = self.attention(x) - x = self.c_proj(x) - return x[:, :, 0] - - -class TimestepBlock(nn.Module): - """ - Any module where forward() takes timestep embeddings as a second argument. - """ - - @abstractmethod - def forward(self, x, emb): - """ - Apply the module to `x` given `emb` timestep embeddings. - """ - - -class TimestepEmbedSequential(nn.Sequential, TimestepBlock): - """ - A sequential module that passes timestep embeddings to the children that - support it as an extra input. - """ - - def forward(self, x, emb, context=None): - for layer in self: - if isinstance(layer, TimestepBlock): - x = layer(x, emb) - elif isinstance(layer, SpatialTransformer): - x = layer(x, context) - else: - x = layer(x) - return x - - -class Upsample(nn.Module): - """ - An upsampling layer with an optional convolution. - :param channels: channels in the inputs and outputs. - :param use_conv: a bool determining if a convolution is applied. - :param dims: determines if the signal is 1D, 2D, or 3D. If 3D, then - upsampling occurs in the inner-two dimensions. - """ - - def __init__(self, channels, use_conv, dims=2, out_channels=None, padding=1): - super().__init__() - self.channels = channels - self.out_channels = out_channels or channels - self.use_conv = use_conv - self.dims = dims - if use_conv: - self.conv = conv_nd(dims, self.channels, self.out_channels, 3, padding=padding) - - def forward(self, x): - assert x.shape[1] == self.channels - if self.dims == 3: - x = F.interpolate( - x, (x.shape[2], x.shape[3] * 2, x.shape[4] * 2), mode="nearest" - ) - else: - x = F.interpolate(x, scale_factor=2, mode="nearest") - if self.use_conv: - x = self.conv(x) - return x - -class TransposedUpsample(nn.Module): - 'Learned 2x upsampling without padding' - def __init__(self, channels, out_channels=None, ks=5): - super().__init__() - self.channels = channels - self.out_channels = out_channels or channels - - self.up = nn.ConvTranspose2d(self.channels,self.out_channels,kernel_size=ks,stride=2) - - def forward(self,x): - return self.up(x) - - -class Downsample(nn.Module): - """ - A downsampling layer with an optional convolution. - :param channels: channels in the inputs and outputs. - :param use_conv: a bool determining if a convolution is applied. - :param dims: determines if the signal is 1D, 2D, or 3D. If 3D, then - downsampling occurs in the inner-two dimensions. - """ - - def __init__(self, channels, use_conv, dims=2, out_channels=None,padding=1): - super().__init__() - self.channels = channels - self.out_channels = out_channels or channels - self.use_conv = use_conv - self.dims = dims - stride = 2 if dims != 3 else (1, 2, 2) - if use_conv: - self.op = conv_nd( - dims, self.channels, self.out_channels, 3, stride=stride, padding=padding - ) - else: - assert self.channels == self.out_channels - self.op = avg_pool_nd(dims, kernel_size=stride, stride=stride) - - def forward(self, x): - assert x.shape[1] == self.channels - return self.op(x) - - -class ResBlock(TimestepBlock): - """ - A residual block that can optionally change the number of channels. - :param channels: the number of input channels. - :param emb_channels: the number of timestep embedding channels. - :param dropout: the rate of dropout. - :param out_channels: if specified, the number of out channels. - :param use_conv: if True and out_channels is specified, use a spatial - convolution instead of a smaller 1x1 convolution to change the - channels in the skip connection. - :param dims: determines if the signal is 1D, 2D, or 3D. - :param use_checkpoint: if True, use gradient checkpointing on this module. - :param up: if True, use this block for upsampling. - :param down: if True, use this block for downsampling. - """ - - def __init__( - self, - channels, - emb_channels, - dropout, - out_channels=None, - use_conv=False, - use_scale_shift_norm=False, - dims=2, - use_checkpoint=False, - up=False, - down=False, - ): - super().__init__() - self.channels = channels - self.emb_channels = emb_channels - self.dropout = dropout - self.out_channels = out_channels or channels - self.use_conv = use_conv - self.use_checkpoint = use_checkpoint - self.use_scale_shift_norm = use_scale_shift_norm - - self.in_layers = nn.Sequential( - normalization(channels), - nn.SiLU(), - conv_nd(dims, channels, self.out_channels, 3, padding=1), - ) - - self.updown = up or down - - if up: - self.h_upd = Upsample(channels, False, dims) - self.x_upd = Upsample(channels, False, dims) - elif down: - self.h_upd = Downsample(channels, False, dims) - self.x_upd = Downsample(channels, False, dims) - else: - self.h_upd = self.x_upd = nn.Identity() - - self.emb_layers = nn.Sequential( - nn.SiLU(), - linear( - emb_channels, - 2 * self.out_channels if use_scale_shift_norm else self.out_channels, - ), - ) - self.out_layers = nn.Sequential( - normalization(self.out_channels), - nn.SiLU(), - nn.Dropout(p=dropout), - zero_module( - conv_nd(dims, self.out_channels, self.out_channels, 3, padding=1) - ), - ) - - if self.out_channels == channels: - self.skip_connection = nn.Identity() - elif use_conv: - self.skip_connection = conv_nd( - dims, channels, self.out_channels, 3, padding=1 - ) - else: - self.skip_connection = conv_nd(dims, channels, self.out_channels, 1) - - def forward(self, x, emb): - """ - Apply the block to a Tensor, conditioned on a timestep embedding. - :param x: an [N x C x ...] Tensor of features. - :param emb: an [N x emb_channels] Tensor of timestep embeddings. - :return: an [N x C x ...] Tensor of outputs. - """ - return checkpoint( - self._forward, (x, emb), self.parameters(), self.use_checkpoint - ) - - - def _forward(self, x, emb): - if self.updown: - in_rest, in_conv = self.in_layers[:-1], self.in_layers[-1] - h = in_rest(x) - h = self.h_upd(h) - x = self.x_upd(x) - h = in_conv(h) - else: - h = self.in_layers(x) - emb_out = self.emb_layers(emb).type(h.dtype) - while len(emb_out.shape) < len(h.shape): - emb_out = emb_out[..., None] - if self.use_scale_shift_norm: - out_norm, out_rest = self.out_layers[0], self.out_layers[1:] - scale, shift = th.chunk(emb_out, 2, dim=1) - h = out_norm(h) * (1 + scale) + shift - h = out_rest(h) - else: - h = h + emb_out - h = self.out_layers(h) - return self.skip_connection(x) + h - - -class AttentionBlock(nn.Module): - """ - An attention block that allows spatial positions to attend to each other. - Originally ported from here, but adapted to the N-d case. - https://github.com/hojonathanho/diffusion/blob/1e0dceb3b3495bbe19116a5e1b3596cd0706c543/diffusion_tf/models/unet.py#L66. - """ - - def __init__( - self, - channels, - num_heads=1, - num_head_channels=-1, - use_checkpoint=False, - use_new_attention_order=False, - ): - super().__init__() - self.channels = channels - if num_head_channels == -1: - self.num_heads = num_heads - else: - assert ( - channels % num_head_channels == 0 - ), f"q,k,v channels {channels} is not divisible by num_head_channels {num_head_channels}" - self.num_heads = channels // num_head_channels - self.use_checkpoint = use_checkpoint - self.norm = normalization(channels) - self.qkv = conv_nd(1, channels, channels * 3, 1) - if use_new_attention_order: - # split qkv before split heads - self.attention = QKVAttention(self.num_heads) - else: - # split heads before split qkv - self.attention = QKVAttentionLegacy(self.num_heads) - - self.proj_out = zero_module(conv_nd(1, channels, channels, 1)) - - def forward(self, x): - return checkpoint(self._forward, (x,), self.parameters(), True) # TODO: check checkpoint usage, is True # TODO: fix the .half call!!! - #return pt_checkpoint(self._forward, x) # pytorch - - def _forward(self, x): - b, c, *spatial = x.shape - x = x.reshape(b, c, -1) - qkv = self.qkv(self.norm(x)) - h = self.attention(qkv) - h = self.proj_out(h) - return (x + h).reshape(b, c, *spatial) - - -def count_flops_attn(model, _x, y): - """ - A counter for the `thop` package to count the operations in an - attention operation. - Meant to be used like: - macs, params = thop.profile( - model, - inputs=(inputs, timestamps), - custom_ops={QKVAttention: QKVAttention.count_flops}, - ) - """ - b, c, *spatial = y[0].shape - num_spatial = int(np.prod(spatial)) - # We perform two matmuls with the same number of ops. - # The first computes the weight matrix, the second computes - # the combination of the value vectors. - matmul_ops = 2 * b * (num_spatial ** 2) * c - model.total_ops += th.DoubleTensor([matmul_ops]) - - -class QKVAttentionLegacy(nn.Module): - """ - A module which performs QKV attention. Matches legacy QKVAttention + input/ouput heads shaping - """ - - def __init__(self, n_heads): - super().__init__() - self.n_heads = n_heads - - def forward(self, qkv): - """ - Apply QKV attention. - :param qkv: an [N x (H * 3 * C) x T] tensor of Qs, Ks, and Vs. - :return: an [N x (H * C) x T] tensor after attention. - """ - bs, width, length = qkv.shape - assert width % (3 * self.n_heads) == 0 - ch = width // (3 * self.n_heads) - q, k, v = qkv.reshape(bs * self.n_heads, ch * 3, length).split(ch, dim=1) - scale = 1 / math.sqrt(math.sqrt(ch)) - weight = th.einsum( - "bct,bcs->bts", q * scale, k * scale - ) # More stable with f16 than dividing afterwards - weight = th.softmax(weight.float(), dim=-1).type(weight.dtype) - a = th.einsum("bts,bcs->bct", weight, v) - return a.reshape(bs, -1, length) - - @staticmethod - def count_flops(model, _x, y): - return count_flops_attn(model, _x, y) - - -class QKVAttention(nn.Module): - """ - A module which performs QKV attention and splits in a different order. - """ - - def __init__(self, n_heads): - super().__init__() - self.n_heads = n_heads - - def forward(self, qkv): - """ - Apply QKV attention. - :param qkv: an [N x (3 * H * C) x T] tensor of Qs, Ks, and Vs. - :return: an [N x (H * C) x T] tensor after attention. - """ - bs, width, length = qkv.shape - assert width % (3 * self.n_heads) == 0 - ch = width // (3 * self.n_heads) - q, k, v = qkv.chunk(3, dim=1) - scale = 1 / math.sqrt(math.sqrt(ch)) - weight = th.einsum( - "bct,bcs->bts", - (q * scale).view(bs * self.n_heads, ch, length), - (k * scale).view(bs * self.n_heads, ch, length), - ) # More stable with f16 than dividing afterwards - weight = th.softmax(weight.float(), dim=-1).type(weight.dtype) - a = th.einsum("bts,bcs->bct", weight, v.reshape(bs * self.n_heads, ch, length)) - return a.reshape(bs, -1, length) - - @staticmethod - def count_flops(model, _x, y): - return count_flops_attn(model, _x, y) - - -class UNetModel(nn.Module): - """ - The full UNet model with attention and timestep embedding. - :param in_channels: channels in the input Tensor. - :param model_channels: base channel count for the model. - :param out_channels: channels in the output Tensor. - :param num_res_blocks: number of residual blocks per downsample. - :param attention_resolutions: a collection of downsample rates at which - attention will take place. May be a set, list, or tuple. - For example, if this contains 4, then at 4x downsampling, attention - will be used. - :param dropout: the dropout probability. - :param channel_mult: channel multiplier for each level of the UNet. - :param conv_resample: if True, use learned convolutions for upsampling and - downsampling. - :param dims: determines if the signal is 1D, 2D, or 3D. - :param num_classes: if specified (as an int), then this model will be - class-conditional with `num_classes` classes. - :param use_checkpoint: use gradient checkpointing to reduce memory usage. - :param num_heads: the number of attention heads in each attention layer. - :param num_heads_channels: if specified, ignore num_heads and instead use - a fixed channel width per attention head. - :param num_heads_upsample: works with num_heads to set a different number - of heads for upsampling. Deprecated. - :param use_scale_shift_norm: use a FiLM-like conditioning mechanism. - :param resblock_updown: use residual blocks for up/downsampling. - :param use_new_attention_order: use a different attention pattern for potentially - increased efficiency. - """ - - def __init__( - self, - image_size, - in_channels, - model_channels, - out_channels, - num_res_blocks, - attention_resolutions, - dropout=0, - channel_mult=(1, 2, 4, 8), - conv_resample=True, - dims=2, - num_classes=None, - use_checkpoint=False, - use_fp16=False, - num_heads=-1, - num_head_channels=-1, - num_heads_upsample=-1, - use_scale_shift_norm=False, - resblock_updown=False, - use_new_attention_order=False, - use_spatial_transformer=False, # custom transformer support - transformer_depth=1, # custom transformer support - context_dim=None, # custom transformer support - n_embed=None, # custom support for prediction of discrete ids into codebook of first stage vq model - legacy=True, - ): - super().__init__() - if use_spatial_transformer: - assert context_dim is not None, 'Fool!! You forgot to include the dimension of your cross-attention conditioning...' - - if context_dim is not None: - assert use_spatial_transformer, 'Fool!! You forgot to use the spatial transformer for your cross-attention conditioning...' - from omegaconf.listconfig import ListConfig - if type(context_dim) == ListConfig: - context_dim = list(context_dim) - - if num_heads_upsample == -1: - num_heads_upsample = num_heads - - if num_heads == -1: - assert num_head_channels != -1, 'Either num_heads or num_head_channels has to be set' - - if num_head_channels == -1: - assert num_heads != -1, 'Either num_heads or num_head_channels has to be set' - - self.image_size = image_size - self.in_channels = in_channels - self.model_channels = model_channels - self.out_channels = out_channels - self.num_res_blocks = num_res_blocks - self.attention_resolutions = attention_resolutions - self.dropout = dropout - self.channel_mult = channel_mult - self.conv_resample = conv_resample - self.num_classes = num_classes - self.use_checkpoint = use_checkpoint - self.dtype = th.float16 if use_fp16 else th.float32 - self.num_heads = num_heads - self.num_head_channels = num_head_channels - self.num_heads_upsample = num_heads_upsample - self.predict_codebook_ids = n_embed is not None - - time_embed_dim = model_channels * 4 - self.time_embed = nn.Sequential( - linear(model_channels, time_embed_dim), - nn.SiLU(), - linear(time_embed_dim, time_embed_dim), - ) - - if self.num_classes is not None: - self.label_emb = nn.Embedding(num_classes, time_embed_dim) - - self.input_blocks = nn.ModuleList( - [ - TimestepEmbedSequential( - conv_nd(dims, in_channels, model_channels, 3, padding=1) - ) - ] - ) - self._feature_size = model_channels - input_block_chans = [model_channels] - ch = model_channels - ds = 1 - for level, mult in enumerate(channel_mult): - for _ in range(num_res_blocks): - layers = [ - ResBlock( - ch, - time_embed_dim, - dropout, - out_channels=mult * model_channels, - dims=dims, - use_checkpoint=use_checkpoint, - use_scale_shift_norm=use_scale_shift_norm, - ) - ] - ch = mult * model_channels - if ds in attention_resolutions: - if num_head_channels == -1: - dim_head = ch // num_heads - else: - num_heads = ch // num_head_channels - dim_head = num_head_channels - if legacy: - #num_heads = 1 - dim_head = ch // num_heads if use_spatial_transformer else num_head_channels - layers.append( - AttentionBlock( - ch, - use_checkpoint=use_checkpoint, - num_heads=num_heads, - num_head_channels=dim_head, - use_new_attention_order=use_new_attention_order, - ) if not use_spatial_transformer else SpatialTransformer( - ch, num_heads, dim_head, depth=transformer_depth, context_dim=context_dim - ) - ) - self.input_blocks.append(TimestepEmbedSequential(*layers)) - self._feature_size += ch - input_block_chans.append(ch) - if level != len(channel_mult) - 1: - out_ch = ch - self.input_blocks.append( - TimestepEmbedSequential( - ResBlock( - ch, - time_embed_dim, - dropout, - out_channels=out_ch, - dims=dims, - use_checkpoint=use_checkpoint, - use_scale_shift_norm=use_scale_shift_norm, - down=True, - ) - if resblock_updown - else Downsample( - ch, conv_resample, dims=dims, out_channels=out_ch - ) - ) - ) - ch = out_ch - input_block_chans.append(ch) - ds *= 2 - self._feature_size += ch - - if num_head_channels == -1: - dim_head = ch // num_heads - else: - num_heads = ch // num_head_channels - dim_head = num_head_channels - if legacy: - #num_heads = 1 - dim_head = ch // num_heads if use_spatial_transformer else num_head_channels - self.middle_block = TimestepEmbedSequential( - ResBlock( - ch, - time_embed_dim, - dropout, - dims=dims, - use_checkpoint=use_checkpoint, - use_scale_shift_norm=use_scale_shift_norm, - ), - AttentionBlock( - ch, - use_checkpoint=use_checkpoint, - num_heads=num_heads, - num_head_channels=dim_head, - use_new_attention_order=use_new_attention_order, - ) if not use_spatial_transformer else SpatialTransformer( - ch, num_heads, dim_head, depth=transformer_depth, context_dim=context_dim - ), - ResBlock( - ch, - time_embed_dim, - dropout, - dims=dims, - use_checkpoint=use_checkpoint, - use_scale_shift_norm=use_scale_shift_norm, - ), - ) - self._feature_size += ch - - self.output_blocks = nn.ModuleList([]) - for level, mult in list(enumerate(channel_mult))[::-1]: - for i in range(num_res_blocks + 1): - ich = input_block_chans.pop() - layers = [ - ResBlock( - ch + ich, - time_embed_dim, - dropout, - out_channels=model_channels * mult, - dims=dims, - use_checkpoint=use_checkpoint, - use_scale_shift_norm=use_scale_shift_norm, - ) - ] - ch = model_channels * mult - if ds in attention_resolutions: - if num_head_channels == -1: - dim_head = ch // num_heads - else: - num_heads = ch // num_head_channels - dim_head = num_head_channels - if legacy: - #num_heads = 1 - dim_head = ch // num_heads if use_spatial_transformer else num_head_channels - layers.append( - AttentionBlock( - ch, - use_checkpoint=use_checkpoint, - num_heads=num_heads_upsample, - num_head_channels=dim_head, - use_new_attention_order=use_new_attention_order, - ) if not use_spatial_transformer else SpatialTransformer( - ch, num_heads, dim_head, depth=transformer_depth, context_dim=context_dim - ) - ) - if level and i == num_res_blocks: - out_ch = ch - layers.append( - ResBlock( - ch, - time_embed_dim, - dropout, - out_channels=out_ch, - dims=dims, - use_checkpoint=use_checkpoint, - use_scale_shift_norm=use_scale_shift_norm, - up=True, - ) - if resblock_updown - else Upsample(ch, conv_resample, dims=dims, out_channels=out_ch) - ) - ds //= 2 - self.output_blocks.append(TimestepEmbedSequential(*layers)) - self._feature_size += ch - - self.out = nn.Sequential( - normalization(ch), - nn.SiLU(), - zero_module(conv_nd(dims, model_channels, out_channels, 3, padding=1)), - ) - if self.predict_codebook_ids: - self.id_predictor = nn.Sequential( - normalization(ch), - conv_nd(dims, model_channels, n_embed, 1), - #nn.LogSoftmax(dim=1) # change to cross_entropy and produce non-normalized logits - ) - - def convert_to_fp16(self): - """ - Convert the torso of the model to float16. - """ - self.input_blocks.apply(convert_module_to_f16) - self.middle_block.apply(convert_module_to_f16) - self.output_blocks.apply(convert_module_to_f16) - - def convert_to_fp32(self): - """ - Convert the torso of the model to float32. - """ - self.input_blocks.apply(convert_module_to_f32) - self.middle_block.apply(convert_module_to_f32) - self.output_blocks.apply(convert_module_to_f32) - - def forward(self, x, timesteps=None, context=None, y=None,**kwargs): - """ - Apply the model to an input batch. - :param x: an [N x C x ...] Tensor of inputs. - :param timesteps: a 1-D batch of timesteps. - :param context: conditioning plugged in via crossattn - :param y: an [N] Tensor of labels, if class-conditional. - :return: an [N x C x ...] Tensor of outputs. - """ - assert (y is not None) == ( - self.num_classes is not None - ), "must specify y if and only if the model is class-conditional" - hs = [] - t_emb = timestep_embedding(timesteps, self.model_channels, repeat_only=False) - emb = self.time_embed(t_emb) - - if self.num_classes is not None: - assert y.shape == (x.shape[0],) - emb = emb + self.label_emb(y) - - h = x.type(self.dtype) - for module in self.input_blocks: - h = module(h, emb, context) - hs.append(h) - h = self.middle_block(h, emb, context) - for module in self.output_blocks: - h = th.cat([h, hs.pop()], dim=1) - h = module(h, emb, context) - h = h.type(x.dtype) - if self.predict_codebook_ids: - return self.id_predictor(h) - else: - return self.out(h) - - -class EncoderUNetModel(nn.Module): - """ - The half UNet model with attention and timestep embedding. - For usage, see UNet. - """ - - def __init__( - self, - image_size, - in_channels, - model_channels, - out_channels, - num_res_blocks, - attention_resolutions, - dropout=0, - channel_mult=(1, 2, 4, 8), - conv_resample=True, - dims=2, - use_checkpoint=False, - use_fp16=False, - num_heads=1, - num_head_channels=-1, - num_heads_upsample=-1, - use_scale_shift_norm=False, - resblock_updown=False, - use_new_attention_order=False, - pool="adaptive", - *args, - **kwargs - ): - super().__init__() - - if num_heads_upsample == -1: - num_heads_upsample = num_heads - - self.in_channels = in_channels - self.model_channels = model_channels - self.out_channels = out_channels - self.num_res_blocks = num_res_blocks - self.attention_resolutions = attention_resolutions - self.dropout = dropout - self.channel_mult = channel_mult - self.conv_resample = conv_resample - self.use_checkpoint = use_checkpoint - self.dtype = th.float16 if use_fp16 else th.float32 - self.num_heads = num_heads - self.num_head_channels = num_head_channels - self.num_heads_upsample = num_heads_upsample - - time_embed_dim = model_channels * 4 - self.time_embed = nn.Sequential( - linear(model_channels, time_embed_dim), - nn.SiLU(), - linear(time_embed_dim, time_embed_dim), - ) - - self.input_blocks = nn.ModuleList( - [ - TimestepEmbedSequential( - conv_nd(dims, in_channels, model_channels, 3, padding=1) - ) - ] - ) - self._feature_size = model_channels - input_block_chans = [model_channels] - ch = model_channels - ds = 1 - for level, mult in enumerate(channel_mult): - for _ in range(num_res_blocks): - layers = [ - ResBlock( - ch, - time_embed_dim, - dropout, - out_channels=mult * model_channels, - dims=dims, - use_checkpoint=use_checkpoint, - use_scale_shift_norm=use_scale_shift_norm, - ) - ] - ch = mult * model_channels - if ds in attention_resolutions: - layers.append( - AttentionBlock( - ch, - use_checkpoint=use_checkpoint, - num_heads=num_heads, - num_head_channels=num_head_channels, - use_new_attention_order=use_new_attention_order, - ) - ) - self.input_blocks.append(TimestepEmbedSequential(*layers)) - self._feature_size += ch - input_block_chans.append(ch) - if level != len(channel_mult) - 1: - out_ch = ch - self.input_blocks.append( - TimestepEmbedSequential( - ResBlock( - ch, - time_embed_dim, - dropout, - out_channels=out_ch, - dims=dims, - use_checkpoint=use_checkpoint, - use_scale_shift_norm=use_scale_shift_norm, - down=True, - ) - if resblock_updown - else Downsample( - ch, conv_resample, dims=dims, out_channels=out_ch - ) - ) - ) - ch = out_ch - input_block_chans.append(ch) - ds *= 2 - self._feature_size += ch - - self.middle_block = TimestepEmbedSequential( - ResBlock( - ch, - time_embed_dim, - dropout, - dims=dims, - use_checkpoint=use_checkpoint, - use_scale_shift_norm=use_scale_shift_norm, - ), - AttentionBlock( - ch, - use_checkpoint=use_checkpoint, - num_heads=num_heads, - num_head_channels=num_head_channels, - use_new_attention_order=use_new_attention_order, - ), - ResBlock( - ch, - time_embed_dim, - dropout, - dims=dims, - use_checkpoint=use_checkpoint, - use_scale_shift_norm=use_scale_shift_norm, - ), - ) - self._feature_size += ch - self.pool = pool - if pool == "adaptive": - self.out = nn.Sequential( - normalization(ch), - nn.SiLU(), - nn.AdaptiveAvgPool2d((1, 1)), - zero_module(conv_nd(dims, ch, out_channels, 1)), - nn.Flatten(), - ) - elif pool == "attention": - assert num_head_channels != -1 - self.out = nn.Sequential( - normalization(ch), - nn.SiLU(), - AttentionPool2d( - (image_size // ds), ch, num_head_channels, out_channels - ), - ) - elif pool == "spatial": - self.out = nn.Sequential( - nn.Linear(self._feature_size, 2048), - nn.ReLU(), - nn.Linear(2048, self.out_channels), - ) - elif pool == "spatial_v2": - self.out = nn.Sequential( - nn.Linear(self._feature_size, 2048), - normalization(2048), - nn.SiLU(), - nn.Linear(2048, self.out_channels), - ) - else: - raise NotImplementedError(f"Unexpected {pool} pooling") - - def convert_to_fp16(self): - """ - Convert the torso of the model to float16. - """ - self.input_blocks.apply(convert_module_to_f16) - self.middle_block.apply(convert_module_to_f16) - - def convert_to_fp32(self): - """ - Convert the torso of the model to float32. - """ - self.input_blocks.apply(convert_module_to_f32) - self.middle_block.apply(convert_module_to_f32) - - def forward(self, x, timesteps): - """ - Apply the model to an input batch. - :param x: an [N x C x ...] Tensor of inputs. - :param timesteps: a 1-D batch of timesteps. - :return: an [N x K] Tensor of outputs. - """ - emb = self.time_embed(timestep_embedding(timesteps, self.model_channels)) - - results = [] - h = x.type(self.dtype) - for module in self.input_blocks: - h = module(h, emb) - if self.pool.startswith("spatial"): - results.append(h.type(x.dtype).mean(dim=(2, 3))) - h = self.middle_block(h, emb) - if self.pool.startswith("spatial"): - results.append(h.type(x.dtype).mean(dim=(2, 3))) - h = th.cat(results, axis=-1) - return self.out(h) - else: - h = h.type(x.dtype) - return self.out(h) - diff --git a/spaces/OpenGVLab/InternGPT/third-party/lama/saicinpainting/training/modules/spatial_transform.py b/spaces/OpenGVLab/InternGPT/third-party/lama/saicinpainting/training/modules/spatial_transform.py deleted file mode 100644 index 2de024ba08c549605a08b64d096f1f0db7b7722a..0000000000000000000000000000000000000000 --- a/spaces/OpenGVLab/InternGPT/third-party/lama/saicinpainting/training/modules/spatial_transform.py +++ /dev/null @@ -1,49 +0,0 @@ -import torch -import torch.nn as nn -import torch.nn.functional as F -from kornia.geometry.transform import rotate - - -class LearnableSpatialTransformWrapper(nn.Module): - def __init__(self, impl, pad_coef=0.5, angle_init_range=80, train_angle=True): - super().__init__() - self.impl = impl - self.angle = torch.rand(1) * angle_init_range - if train_angle: - self.angle = nn.Parameter(self.angle, requires_grad=True) - self.pad_coef = pad_coef - - def forward(self, x): - if torch.is_tensor(x): - return self.inverse_transform(self.impl(self.transform(x)), x) - elif isinstance(x, tuple): - x_trans = tuple(self.transform(elem) for elem in x) - y_trans = self.impl(x_trans) - return tuple(self.inverse_transform(elem, orig_x) for elem, orig_x in zip(y_trans, x)) - else: - raise ValueError(f'Unexpected input type {type(x)}') - - def transform(self, x): - height, width = x.shape[2:] - pad_h, pad_w = int(height * self.pad_coef), int(width * self.pad_coef) - x_padded = F.pad(x, [pad_w, pad_w, pad_h, pad_h], mode='reflect') - x_padded_rotated = rotate(x_padded, angle=self.angle.to(x_padded)) - return x_padded_rotated - - def inverse_transform(self, y_padded_rotated, orig_x): - height, width = orig_x.shape[2:] - pad_h, pad_w = int(height * self.pad_coef), int(width * self.pad_coef) - - y_padded = rotate(y_padded_rotated, angle=-self.angle.to(y_padded_rotated)) - y_height, y_width = y_padded.shape[2:] - y = y_padded[:, :, pad_h : y_height - pad_h, pad_w : y_width - pad_w] - return y - - -if __name__ == '__main__': - layer = LearnableSpatialTransformWrapper(nn.Identity()) - x = torch.arange(2* 3 * 15 * 15).view(2, 3, 15, 15).float() - y = layer(x) - assert x.shape == y.shape - assert torch.allclose(x[:, :, 1:, 1:][:, :, :-1, :-1], y[:, :, 1:, 1:][:, :, :-1, :-1]) - print('all ok') diff --git a/spaces/OpenMotionLab/MotionGPT/pyrender/pyrender/light.py b/spaces/OpenMotionLab/MotionGPT/pyrender/pyrender/light.py deleted file mode 100644 index 333d9e4e553a245c259251a89b69cb46b73b1278..0000000000000000000000000000000000000000 --- a/spaces/OpenMotionLab/MotionGPT/pyrender/pyrender/light.py +++ /dev/null @@ -1,385 +0,0 @@ -"""Punctual light sources as defined by the glTF 2.0 KHR extension at -https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_lights_punctual - -Author: Matthew Matl -""" -import abc -import numpy as np -import six - -from OpenGL.GL import * - -from .utils import format_color_vector -from .texture import Texture -from .constants import SHADOW_TEX_SZ -from .camera import OrthographicCamera, PerspectiveCamera - - - -@six.add_metaclass(abc.ABCMeta) -class Light(object): - """Base class for all light objects. - - Parameters - ---------- - color : (3,) float - RGB value for the light's color in linear space. - intensity : float - Brightness of light. The units that this is defined in depend on the - type of light. Point and spot lights use luminous intensity in candela - (lm/sr), while directional lights use illuminance in lux (lm/m2). - name : str, optional - Name of the light. - """ - def __init__(self, - color=None, - intensity=None, - name=None): - - if color is None: - color = np.ones(3) - if intensity is None: - intensity = 1.0 - - self.name = name - self.color = color - self.intensity = intensity - self._shadow_camera = None - self._shadow_texture = None - - @property - def name(self): - """str : The user-defined name of this object. - """ - return self._name - - @name.setter - def name(self, value): - if value is not None: - value = str(value) - self._name = value - - @property - def color(self): - """(3,) float : The light's color. - """ - return self._color - - @color.setter - def color(self, value): - self._color = format_color_vector(value, 3) - - @property - def intensity(self): - """float : The light's intensity in candela or lux. - """ - return self._intensity - - @intensity.setter - def intensity(self, value): - self._intensity = float(value) - - @property - def shadow_texture(self): - """:class:`.Texture` : A texture used to hold shadow maps for this light. - """ - return self._shadow_texture - - @shadow_texture.setter - def shadow_texture(self, value): - if self._shadow_texture is not None: - if self._shadow_texture._in_context(): - self._shadow_texture.delete() - self._shadow_texture = value - - @abc.abstractmethod - def _generate_shadow_texture(self, size=None): - """Generate a shadow texture for this light. - - Parameters - ---------- - size : int, optional - Size of texture map. Must be a positive power of two. - """ - pass - - @abc.abstractmethod - def _get_shadow_camera(self, scene_scale): - """Generate and return a shadow mapping camera for this light. - - Parameters - ---------- - scene_scale : float - Length of scene's bounding box diagonal. - - Returns - ------- - camera : :class:`.Camera` - The camera used to render shadowmaps for this light. - """ - pass - - -class DirectionalLight(Light): - """Directional lights are light sources that act as though they are - infinitely far away and emit light in the direction of the local -z axis. - This light type inherits the orientation of the node that it belongs to; - position and scale are ignored except for their effect on the inherited - node orientation. Because it is at an infinite distance, the light is - not attenuated. Its intensity is defined in lumens per metre squared, - or lux (lm/m2). - - Parameters - ---------- - color : (3,) float, optional - RGB value for the light's color in linear space. Defaults to white - (i.e. [1.0, 1.0, 1.0]). - intensity : float, optional - Brightness of light, in lux (lm/m^2). Defaults to 1.0 - name : str, optional - Name of the light. - """ - - def __init__(self, - color=None, - intensity=None, - name=None): - super(DirectionalLight, self).__init__( - color=color, - intensity=intensity, - name=name, - ) - - def _generate_shadow_texture(self, size=None): - """Generate a shadow texture for this light. - - Parameters - ---------- - size : int, optional - Size of texture map. Must be a positive power of two. - """ - if size is None: - size = SHADOW_TEX_SZ - self.shadow_texture = Texture(width=size, height=size, - source_channels='D', data_format=GL_FLOAT) - - def _get_shadow_camera(self, scene_scale): - """Generate and return a shadow mapping camera for this light. - - Parameters - ---------- - scene_scale : float - Length of scene's bounding box diagonal. - - Returns - ------- - camera : :class:`.Camera` - The camera used to render shadowmaps for this light. - """ - return OrthographicCamera( - znear=0.01 * scene_scale, - zfar=10 * scene_scale, - xmag=scene_scale, - ymag=scene_scale - ) - - -class PointLight(Light): - """Point lights emit light in all directions from their position in space; - rotation and scale are ignored except for their effect on the inherited - node position. The brightness of the light attenuates in a physically - correct manner as distance increases from the light's position (i.e. - brightness goes like the inverse square of the distance). Point light - intensity is defined in candela, which is lumens per square radian (lm/sr). - - Parameters - ---------- - color : (3,) float - RGB value for the light's color in linear space. - intensity : float - Brightness of light in candela (lm/sr). - range : float - Cutoff distance at which light's intensity may be considered to - have reached zero. If None, the range is assumed to be infinite. - name : str, optional - Name of the light. - """ - - def __init__(self, - color=None, - intensity=None, - range=None, - name=None): - super(PointLight, self).__init__( - color=color, - intensity=intensity, - name=name, - ) - self.range = range - - @property - def range(self): - """float : The cutoff distance for the light. - """ - return self._range - - @range.setter - def range(self, value): - if value is not None: - value = float(value) - if value <= 0: - raise ValueError('Range must be > 0') - self._range = value - self._range = value - - def _generate_shadow_texture(self, size=None): - """Generate a shadow texture for this light. - - Parameters - ---------- - size : int, optional - Size of texture map. Must be a positive power of two. - """ - raise NotImplementedError('Shadows not implemented for point lights') - - def _get_shadow_camera(self, scene_scale): - """Generate and return a shadow mapping camera for this light. - - Parameters - ---------- - scene_scale : float - Length of scene's bounding box diagonal. - - Returns - ------- - camera : :class:`.Camera` - The camera used to render shadowmaps for this light. - """ - raise NotImplementedError('Shadows not implemented for point lights') - - -class SpotLight(Light): - """Spot lights emit light in a cone in the direction of the local -z axis. - The angle and falloff of the cone is defined using two numbers, the - ``innerConeAngle`` and ``outerConeAngle``. - As with point lights, the brightness - also attenuates in a physically correct manner as distance increases from - the light's position (i.e. brightness goes like the inverse square of the - distance). Spot light intensity refers to the brightness inside the - ``innerConeAngle`` (and at the location of the light) and is defined in - candela, which is lumens per square radian (lm/sr). A spot light's position - and orientation are inherited from its node transform. Inherited scale does - not affect cone shape, and is ignored except for its effect on position - and orientation. - - Parameters - ---------- - color : (3,) float - RGB value for the light's color in linear space. - intensity : float - Brightness of light in candela (lm/sr). - range : float - Cutoff distance at which light's intensity may be considered to - have reached zero. If None, the range is assumed to be infinite. - innerConeAngle : float - Angle, in radians, from centre of spotlight where falloff begins. - Must be greater than or equal to ``0`` and less - than ``outerConeAngle``. Defaults to ``0``. - outerConeAngle : float - Angle, in radians, from centre of spotlight where falloff ends. - Must be greater than ``innerConeAngle`` and less than or equal to - ``PI / 2.0``. Defaults to ``PI / 4.0``. - name : str, optional - Name of the light. - """ - - def __init__(self, - color=None, - intensity=None, - range=None, - innerConeAngle=0.0, - outerConeAngle=(np.pi / 4.0), - name=None): - super(SpotLight, self).__init__( - name=name, - color=color, - intensity=intensity, - ) - self.outerConeAngle = outerConeAngle - self.innerConeAngle = innerConeAngle - self.range = range - - @property - def innerConeAngle(self): - """float : The inner cone angle in radians. - """ - return self._innerConeAngle - - @innerConeAngle.setter - def innerConeAngle(self, value): - if value < 0.0 or value > self.outerConeAngle: - raise ValueError('Invalid value for inner cone angle') - self._innerConeAngle = float(value) - - @property - def outerConeAngle(self): - """float : The outer cone angle in radians. - """ - return self._outerConeAngle - - @outerConeAngle.setter - def outerConeAngle(self, value): - if value < 0.0 or value > np.pi / 2.0 + 1e-9: - raise ValueError('Invalid value for outer cone angle') - self._outerConeAngle = float(value) - - @property - def range(self): - """float : The cutoff distance for the light. - """ - return self._range - - @range.setter - def range(self, value): - if value is not None: - value = float(value) - if value <= 0: - raise ValueError('Range must be > 0') - self._range = value - self._range = value - - def _generate_shadow_texture(self, size=None): - """Generate a shadow texture for this light. - - Parameters - ---------- - size : int, optional - Size of texture map. Must be a positive power of two. - """ - if size is None: - size = SHADOW_TEX_SZ - self.shadow_texture = Texture(width=size, height=size, - source_channels='D', data_format=GL_FLOAT) - - def _get_shadow_camera(self, scene_scale): - """Generate and return a shadow mapping camera for this light. - - Parameters - ---------- - scene_scale : float - Length of scene's bounding box diagonal. - - Returns - ------- - camera : :class:`.Camera` - The camera used to render shadowmaps for this light. - """ - return PerspectiveCamera( - znear=0.01 * scene_scale, - zfar=10 * scene_scale, - yfov=np.clip(2 * self.outerConeAngle + np.pi / 16.0, 0.0, np.pi), - aspectRatio=1.0 - ) - - -__all__ = ['Light', 'DirectionalLight', 'SpotLight', 'PointLight'] diff --git a/spaces/PAIR/Text2Video-Zero/share.py b/spaces/PAIR/Text2Video-Zero/share.py deleted file mode 100644 index 463af08fb936d650b5dd2e66183661181c34a3d6..0000000000000000000000000000000000000000 --- a/spaces/PAIR/Text2Video-Zero/share.py +++ /dev/null @@ -1,8 +0,0 @@ -import config -from cldm.hack import disable_verbosity, enable_sliced_attention - - -disable_verbosity() - -if config.save_memory: - enable_sliced_attention() diff --git a/spaces/Pattr/DrumClassification/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/posix.go b/spaces/Pattr/DrumClassification/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/posix.go deleted file mode 100644 index 9aa6eb8fc07eb6bd1976474f9048a74f0b67c658..0000000000000000000000000000000000000000 Binary files a/spaces/Pattr/DrumClassification/lilypond-2.24.2/lib/guile/2.2/ccache/ice-9/posix.go and /dev/null differ diff --git a/spaces/PeepDaSlan9/De-limiter/solver_ddp.py b/spaces/PeepDaSlan9/De-limiter/solver_ddp.py deleted file mode 100644 index 77897f8cbc939395a2d13d6cee29e95a15ee7af6..0000000000000000000000000000000000000000 --- a/spaces/PeepDaSlan9/De-limiter/solver_ddp.py +++ /dev/null @@ -1,643 +0,0 @@ -import time -import json - -import torch -import torch.nn as nn -import wandb -import matplotlib - -matplotlib.use("Agg") -import matplotlib.pyplot as plt -import torch.distributed as dist -from torch.utils.data.distributed import DistributedSampler -from torch.nn.parallel.distributed import DistributedDataParallel as DDP -from asteroid.losses import ( - pairwise_neg_sisdr, - PairwiseNegSDR, -) -from einops import rearrange, reduce -from ema_pytorch import EMA - -from models import load_model_with_args -import utils -from dataloader import ( - MusdbTrainDataset, - MusdbValidDataset, - DelimitTrainDataset, - DelimitValidDataset, - OzoneTrainDataset, - OzoneValidDataset, - aug_from_str, - SingleTrackSet, -) - - -class Solver(object): - def __init__(self): - pass - - def set_gpu(self, args): - - if args.wandb_params.use_wandb and args.gpu == 0: - if args.wandb_params.sweep: - wandb.init( - entity=args.wandb_params.entity, - project=args.wandb_params.project, - config=args, - resume=True - if args.dir_params.resume != None and args.gpu == 0 - else False, - ) - else: - wandb.init( - entity=args.wandb_params.entity, - project=args.wandb_params.project, - name=f"{args.dir_params.exp_name}", - config=args, - resume="must" - if args.dir_params.resume != None - and not args.dir_params.continual_train - else False, - id=args.wandb_params.rerun_id - if args.wandb_params.rerun_id - else None, - settings=wandb.Settings(start_method="fork"), - ) - - ###################### Define Models ###################### - self.model = load_model_with_args(args) - - trainable_params = [] - trainable_params = trainable_params + list(self.model.parameters()) - - if args.hyperparams.optimizer == "sgd": - print("Use SGD optimizer.") - self.optimizer = torch.optim.SGD( - params=trainable_params, - lr=args.hyperparams.lr, - momentum=0.9, - weight_decay=args.hyperparams.weight_decay, - ) - elif args.hyperparams.optimizer == "adamw": - print("Use AdamW optimizer.") - self.optimizer = torch.optim.AdamW( - params=trainable_params, - lr=args.hyperparams.lr, - betas=(0.9, 0.999), - amsgrad=False, - weight_decay=args.hyperparams.weight_decay, - ) - elif args.hyperparams.optimizer == "radam": - print("Use RAdam optimizer.") - self.optimizer = torch.optim.RAdam( - params=trainable_params, - lr=args.hyperparams.lr, - betas=(0.9, 0.999), - eps=1e-08, - weight_decay=args.hyperparams.weight_decay, - ) - elif args.hyperparams.optimizer == "adam": - print("Use Adam optimizer.") - self.optimizer = torch.optim.Adam( - params=trainable_params, - lr=args.hyperparams.lr, - betas=(0.9, 0.999), - weight_decay=args.hyperparams.weight_decay, - ) - else: - print("no optimizer loaded") - raise NotImplementedError - - if args.hyperparams.lr_scheduler == "step_lr": - if args.model_loss_params.architecture == "umx": - self.scheduler = torch.optim.lr_scheduler.ReduceLROnPlateau( - self.optimizer, - mode="min", - factor=args.hyperparams.lr_decay_gamma, - patience=args.hyperparams.lr_decay_patience, - cooldown=10, - verbose=True, - ) - else: - self.scheduler = torch.optim.lr_scheduler.ReduceLROnPlateau( - self.optimizer, - mode="min", - factor=args.hyperparams.lr_decay_gamma, - patience=args.hyperparams.lr_decay_patience, - cooldown=0, - min_lr=5e-5, - verbose=True, - ) - elif args.hyperparams.lr_scheduler == "cos_warmup": - self.scheduler = utils.CosineAnnealingWarmUpRestarts( - self.optimizer, - T_0=40, - T_mult=1, - eta_max=args.hyperparams.lr, - T_up=10, - gamma=0.5, - ) - - torch.cuda.set_device(args.gpu) - - self.model = self.model.to(f"cuda:{args.gpu}") - - ############################################################ - # Define Losses - self.criterion = {} - - self.criterion["l1"] = nn.L1Loss().to(args.gpu) - self.criterion["mse"] = nn.MSELoss().to(args.gpu) - self.criterion["si_sdr"] = pairwise_neg_sisdr.to(args.gpu) - self.criterion["snr"] = PairwiseNegSDR("snr").to(args.gpu) - self.criterion["bcewithlogits"] = nn.BCEWithLogitsLoss().to(args.gpu) - self.criterion["bce"] = nn.BCELoss().to(args.gpu) - self.criterion["kl"] = nn.KLDivLoss(log_target=True).to(args.gpu) - - print("Loss functions we use in this training:") - print(args.model_loss_params.train_loss_func) - - # Early stopping utils - self.es = utils.EarlyStopping(patience=args.hyperparams.patience) - self.stop = False - - if args.wandb_params.use_wandb and args.gpu == 0: - wandb.watch(self.model, log="all") - - self.start_epoch = 1 - self.train_losses = [] - self.valid_losses = [] - self.train_times = [] - self.best_epoch = 0 - - if args.dir_params.resume and not args.hyperparams.ema: - self.resume(args) - - # Distribute models to machine - self.model = DDP( - self.model, - device_ids=[args.gpu], - output_device=args.gpu, - find_unused_parameters=True, - ) - - if args.hyperparams.ema: - self.model_ema = EMA( - self.model, - beta=0.999, - update_after_step=100, - update_every=10, - ) - - if args.resume and args.hyperparams.ema: - self.resume(args) - - ###################### Define data pipeline ###################### - args.hyperparams.batch_size = int( - args.hyperparams.batch_size / args.ngpus_per_node - ) - self.mp_context = torch.multiprocessing.get_context("fork") - - if args.task_params.dataset == "musdb": - self.train_dataset = MusdbTrainDataset( - target=args.task_params.target, - root=args.dir_params.root, - seq_duration=args.data_params.seq_dur, - samples_per_track=args.data_params.samples_per_track, - source_augmentations=aug_from_str( - ["gain", "channelswap"], - ), - sample_rate=args.data_params.sample_rate, - seed=args.sys_params.seed, - limitaug_method=args.data_params.limitaug_method, - limitaug_mode=args.data_params.limitaug_mode, - limitaug_custom_target_lufs=args.data_params.limitaug_custom_target_lufs, - limitaug_custom_target_lufs_std=args.data_params.limitaug_custom_target_lufs_std, - target_loudnorm_lufs=args.data_params.target_loudnorm_lufs, - custom_limiter_attack_range=args.data_params.custom_limiter_attack_range, - custom_limiter_release_range=args.data_params.custom_limiter_release_range, - ) - self.valid_dataset = MusdbValidDataset( - target=args.task_params.target, root=args.dir_params.root - ) - elif args.task_params.dataset == "delimit": - if args.data_params.limitaug_method == "ozone": - self.train_dataset = OzoneTrainDataset( - target=args.task_params.target, - root=args.dir_params.root, - ozone_root=args.dir_params.ozone_root, - use_fixed=args.data_params.use_fixed, - seq_duration=args.data_params.seq_dur, - samples_per_track=args.data_params.samples_per_track, - source_augmentations=aug_from_str( - ["gain", "channelswap"], - ), - sample_rate=args.data_params.sample_rate, - seed=args.sys_params.seed, - limitaug_method=args.data_params.limitaug_method, - limitaug_mode=args.data_params.limitaug_mode, - limitaug_custom_target_lufs=args.data_params.limitaug_custom_target_lufs, - limitaug_custom_target_lufs_std=args.data_params.limitaug_custom_target_lufs_std, - target_loudnorm_lufs=args.data_params.target_loudnorm_lufs, - target_limitaug_mode=args.data_params.target_limitaug_mode, - target_limitaug_custom_target_lufs=args.data_params.target_limitaug_custom_target_lufs, - target_limitaug_custom_target_lufs_std=args.data_params.target_limitaug_custom_target_lufs_std, - custom_limiter_attack_range=args.data_params.custom_limiter_attack_range, - custom_limiter_release_range=args.data_params.custom_limiter_release_range, - ) - self.valid_dataset = OzoneValidDataset( - target=args.task_params.target, - root=args.dir_params.root, - ozone_root=args.dir_params.ozone_root, - target_loudnorm_lufs=args.data_params.target_loudnorm_lufs, - ) - else: - self.train_dataset = DelimitTrainDataset( - target=args.task_params.target, - root=args.dir_params.root, - seq_duration=args.data_params.seq_dur, - samples_per_track=args.data_params.samples_per_track, - source_augmentations=aug_from_str( - ["gain", "channelswap"], - ), - sample_rate=args.data_params.sample_rate, - seed=args.sys_params.seed, - limitaug_method=args.data_params.limitaug_method, - limitaug_mode=args.data_params.limitaug_mode, - limitaug_custom_target_lufs=args.data_params.limitaug_custom_target_lufs, - limitaug_custom_target_lufs_std=args.data_params.limitaug_custom_target_lufs_std, - target_loudnorm_lufs=args.data_params.target_loudnorm_lufs, - target_limitaug_mode=args.data_params.target_limitaug_mode, - target_limitaug_custom_target_lufs=args.data_params.target_limitaug_custom_target_lufs, - target_limitaug_custom_target_lufs_std=args.data_params.target_limitaug_custom_target_lufs_std, - custom_limiter_attack_range=args.data_params.custom_limiter_attack_range, - custom_limiter_release_range=args.data_params.custom_limiter_release_range, - ) - self.valid_dataset = DelimitValidDataset( - target=args.task_params.target, - root=args.dir_params.root, - delimit_valid_root=args.dir_params.delimit_valid_root, - valid_target_lufs=args.data_params.valid_target_lufs, - target_loudnorm_lufs=args.data_params.target_loudnorm_lufs, - delimit_valid_L_root=args.dir_params.delimit_valid_L_root, - ) - - self.train_sampler = DistributedSampler( - self.train_dataset, shuffle=True, rank=args.gpu - ) - self.train_loader = torch.utils.data.DataLoader( - self.train_dataset, - batch_size=args.hyperparams.batch_size, - shuffle=False, - num_workers=args.sys_params.nb_workers, - multiprocessing_context=self.mp_context, - pin_memory=True, - sampler=self.train_sampler, - drop_last=False, - ) - - self.valid_sampler = DistributedSampler( - self.valid_dataset, shuffle=False, rank=args.gpu - ) - self.valid_loader = torch.utils.data.DataLoader( - self.valid_dataset, - batch_size=1, - shuffle=False, - num_workers=args.sys_params.nb_workers, - multiprocessing_context=self.mp_context, - pin_memory=False, - sampler=self.valid_sampler, - drop_last=False, - ) - - def train(self, args, epoch): - self.end = time.time() - self.model.train() - - # get current learning rate - for param_group in self.optimizer.param_groups: - current_lr = param_group["lr"] - - if ( - args.sys_params.rank % args.ngpus_per_node == 0 - ): # when the last rank process is finished - print(f"Epoch {epoch}, Learning rate: {current_lr}") - - losses = utils.AverageMeter() - loss_logger = {} - - loss_logger["train/train loss"] = 0 - # with torch.autograd.detect_anomaly(): # use this if you want to detect anomaly behavior while training. - for i, values in enumerate(self.train_loader): - mixture, clean, *train_vars = values - - mixture = mixture.cuda(args.gpu, non_blocking=True) - clean = clean.cuda(args.gpu, non_blocking=True) - target = clean # target_shape = [batch_size, n_srcs, nb_channels (if stereo: 2), wave_length] - loss_input = {} - - estimates, *estimates_vars = self.model(mixture) - # estimates = self.model(mixture) - - # loss = [] - dict_loss = {} - - if args.task_params.dataset == "delimit": - estimates = estimates_vars[0] - - for train_loss_idx, single_train_loss_func in enumerate( - args.model_loss_params.train_loss_func - ): - if self.model.module.use_encoder_to_target: - target_spec = self.model.module.encoder( - rearrange(target, "b s c t -> (b s) c t") - ) - target_spec = rearrange( - target_spec, - "(b s) c f t -> b s c f t", - s=args.task_params.bleeding_nsrcs, - ) - loss_else = self.criterion[single_train_loss_func]( - estimates, - target_spec - if self.model.module.use_encoder_to_target - else target, - ) - dict_loss[single_train_loss_func] = ( - loss_else.mean() - * args.model_loss_params.train_loss_scales[train_loss_idx] - ) - - loss = sum([value for key, value in dict_loss.items()]) - - ############################################################ - - #################### 5. Back propagation #################### - loss.backward() - if args.hyperparams.gradient_clip: - nn.utils.clip_grad_norm_( - self.model.parameters(), max_norm=args.hyperparams.gradient_clip - ) - - losses.update(loss.item(), clean.size(0)) - - loss_logger["train/train loss"] = losses.avg - for key, value in dict_loss.items(): - loss_logger[f"train/{key}"] = value.item() - - self.optimizer.step() - - self.model.zero_grad( - set_to_none=True - ) # set_to_none=True is for memory saving - - if args.hyperparams.ema: - self.model_ema.update() - ############################################################ - - # ###################### 6. Plot ###################### - - if i % 30 == 0: - # loss print for multiple loss function - multiple_score = torch.Tensor( - [value for key, value in loss_logger.items()] - ).to(args.gpu) - gathered_score_list = [ - torch.ones_like(multiple_score) - for _ in range(dist.get_world_size()) - ] - dist.all_gather(gathered_score_list, multiple_score) - gathered_score = torch.mean( - torch.stack(gathered_score_list, dim=0), dim=0 - ) - if args.gpu == 0: - print(f"Epoch {epoch}, step {i} / {len(self.train_loader)}") - temp_loss_logger = {} - for index, (key, value) in enumerate(loss_logger.items()): - temp_key = key.replace("train/", "iter-wise/") - temp_loss_logger[temp_key] = round( - gathered_score[index].item(), 6 - ) - print(f"{key} : {round(gathered_score[index].item(), 6)}") - - single_score = torch.Tensor([losses.avg]).to(args.gpu) - - gathered_score_list = [ - torch.ones_like(single_score) for _ in range(dist.get_world_size()) - ] - dist.all_gather(gathered_score_list, single_score) - gathered_score = torch.mean(torch.cat(gathered_score_list)).item() - if args.gpu == 0: - self.train_losses.append(gathered_score) - if args.wandb_params.use_wandb: - loss_logger["train/train loss"] = single_score - loss_logger["train/epoch"] = epoch - wandb.log(loss_logger) - ############################################################ - - def multi_validate(self, args, epoch): - if args.gpu == 0: - print(f"Epoch {epoch} Validation session!") - - losses = utils.AverageMeter() - - loss_logger = {} - - self.model.eval() - - with torch.no_grad(): - for i, values in enumerate(self.valid_loader, start=1): - mixture, clean, song_name, *valid_vars = values - - mixture = mixture.cuda(args.gpu, non_blocking=True) - clean = clean.cuda(args.gpu, non_blocking=True) - target = clean - - dict_loss = {} - if not args.data_params.singleset_num_frames: - if args.hyperparams.ema: - estimates, *estimates_vars = self.model_ema(mixture) - else: - estimates, *estimates_vars = self.model(mixture) - if args.task_params.dataset == "delimit": - estimates = estimates_vars[0] - - estimates = estimates[..., : clean.size(-1)] - - else: # use SingleTrackSet - db = SingleTrackSet( - mixture[0], - hop_length=args.data_params.nhop, - num_frame=args.data_params.singleset_num_frames, - target_name=args.task_params.target, - ) - separated = [] - - for item in db: - - if args.hyperparams.ema: - estimates, *estimates_vars = self.model_ema( - item.unsqueeze(0).to(args.gpu) - ) - else: - estimates, *estimates_vars = self.model( - item.unsqueeze(0).to(args.gpu) - ) - - if args.task_params.dataset == "delimit": - estimates = estimates_vars[0] - - separated.append( - estimates_vars[0][ - ..., db.trim_length : -db.trim_length - ].clone() - ) - - estimates = torch.cat(separated, dim=-1) - estimates = estimates[..., : target.shape[-1]] - - for valid_loss_idx, single_valid_loss_func in enumerate( - args.model_loss_params.valid_loss_func - ): - loss_else = self.criterion[single_valid_loss_func]( - estimates, - target, - ) - dict_loss[single_valid_loss_func] = ( - loss_else.mean() - * args.model_loss_params.valid_loss_scales[valid_loss_idx] - ) - - loss = sum([value for key, value in dict_loss.items()]) - - losses.update(loss.item(), clean.size(0)) - - list_sum_count = torch.Tensor([losses.sum, losses.count]).to(args.gpu) - list_gathered_sum_count = [ - torch.ones_like(list_sum_count) for _ in range(dist.get_world_size()) - ] - dist.all_gather(list_gathered_sum_count, list_sum_count) - gathered_score = reduce( - torch.stack(list_gathered_sum_count), "s c -> c", "sum" - ) # s: sum of losses.sum, c: sum of losses.count - gathered_score = (gathered_score[0] / gathered_score[1]).item() - - loss_logger["valid/valid loss"] = gathered_score - for key, value in dict_loss.items(): - loss_logger[f"valid/{key}"] = value.item() - - if args.hyperparams.lr_scheduler == "step_lr": - self.scheduler.step(gathered_score) - elif args.hyperparams.lr_scheduler == "cos_warmup": - self.scheduler.step(epoch) - else: - self.scheduler.step(gathered_score) - - if args.wandb_params.use_wandb and args.gpu == 0: - loss_logger["valid/epoch"] = epoch - wandb.log(loss_logger) - - if args.gpu == 0: - self.valid_losses.append(gathered_score) - - self.stop = self.es.step(gathered_score) - - print(f"Epoch {epoch}, validation loss : {round(gathered_score, 6)}") - - plt.plot(self.train_losses, label="train loss") - plt.plot(self.valid_losses, label="valid loss") - plt.legend(loc="upper right") - plt.savefig(f"{args.output}/loss_graph_{args.task_params.target}.png") - plt.close() - - save_states = { - "epoch": epoch, - "state_dict": self.model.module.state_dict() - if not args.hyperparams.ema - else self.model_ema.state_dict(), - "best_loss": self.es.best, - "optimizer": self.optimizer.state_dict(), - "scheduler": self.scheduler.state_dict(), - } - - utils.save_checkpoint( - save_states, - state_dict_only=gathered_score == self.es.best, - path=args.output, - target=args.task_params.target, - ) - - self.train_times.append(time.time() - self.end) - - if gathered_score == self.es.best: - self.best_epoch = epoch - - # save params - params = { - "epochs_trained": epoch, - "args": args.toDict(), - "best_loss": self.es.best, - "best_epoch": self.best_epoch, - "train_loss_history": self.train_losses, - "valid_loss_history": self.valid_losses, - "train_time_history": self.train_times, - "num_bad_epochs": self.es.num_bad_epochs, - } - - with open( - f"{args.output}/{args.task_params.target}.json", "w" - ) as outfile: - outfile.write(json.dumps(params, indent=4, sort_keys=True)) - - self.train_times.append(time.time() - self.end) - print( - f"Epoch {epoch} train completed. Took {round(self.train_times[-1], 3)} seconds" - ) - - def resume(self, args): - print(f"Resume checkpoint from: {args.dir_params.resume}:") - loc = f"cuda:{args.gpu}" - checkpoint_path = f"{args.dir_params.resume}/{args.task_params.target}" - with open(f"{checkpoint_path}.json", "r") as stream: - results = json.load(stream) - checkpoint = torch.load(f"{checkpoint_path}.chkpnt", map_location=loc) - - if args.hyperparams.ema: - self.model_ema.load_state_dict(checkpoint["state_dict"]) - else: - self.model.load_state_dict(checkpoint["state_dict"]) - self.optimizer.load_state_dict(checkpoint["optimizer"]) - - if ( - args.dir_params.continual_train - ): # we want to use a pre-trained model but not want to use lr_scheduler history. - for param_group in self.optimizer.param_groups: - param_group["lr"] = args.hyperparams.lr - else: - self.scheduler.load_state_dict(checkpoint["scheduler"]) - self.es.best = results["best_loss"] - self.es.num_bad_epochs = results["num_bad_epochs"] - - self.start_epoch = results["epochs_trained"] - self.train_losses = results["train_loss_history"] - self.valid_losses = results["valid_loss_history"] - self.train_times = results["train_time_history"] - self.best_epoch = results["best_epoch"] - if args.sys_params.rank % args.ngpus_per_node == 0: - print( - f"=> loaded checkpoint {checkpoint_path} (epoch {results['epochs_trained']})" - ) - - def cal_loss(self, args, loss_input): - loss_dict = {} - for key, value in loss_input.items(): - loss_dict[key] = self.criterion[key](*value) - - return loss_dict - - def cal_multiple_losses(self, args, dict_loss_name_input): - loss_dict = {} - for loss_name, loss_input in dict_loss_name_input.items(): - loss_dict[loss_name] = self.cal_loss(args, loss_input) - - return loss_dict diff --git a/spaces/Pie31415/control-animation/annotator/uniformer/configs/_base_/models/pspnet_r50-d8.py b/spaces/Pie31415/control-animation/annotator/uniformer/configs/_base_/models/pspnet_r50-d8.py deleted file mode 100644 index f451e08ad2eb0732dcb806b1851eb978d4acf136..0000000000000000000000000000000000000000 --- a/spaces/Pie31415/control-animation/annotator/uniformer/configs/_base_/models/pspnet_r50-d8.py +++ /dev/null @@ -1,44 +0,0 @@ -# model settings -norm_cfg = dict(type='SyncBN', requires_grad=True) -model = dict( - type='EncoderDecoder', - pretrained='open-mmlab://resnet50_v1c', - backbone=dict( - type='ResNetV1c', - depth=50, - num_stages=4, - out_indices=(0, 1, 2, 3), - dilations=(1, 1, 2, 4), - strides=(1, 2, 1, 1), - norm_cfg=norm_cfg, - norm_eval=False, - style='pytorch', - contract_dilation=True), - decode_head=dict( - type='PSPHead', - in_channels=2048, - in_index=3, - channels=512, - pool_scales=(1, 2, 3, 6), - dropout_ratio=0.1, - num_classes=19, - norm_cfg=norm_cfg, - align_corners=False, - loss_decode=dict( - type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)), - auxiliary_head=dict( - type='FCNHead', - in_channels=1024, - in_index=2, - channels=256, - num_convs=1, - concat_input=False, - dropout_ratio=0.1, - num_classes=19, - norm_cfg=norm_cfg, - align_corners=False, - loss_decode=dict( - type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)), - # model training and testing settings - train_cfg=dict(), - test_cfg=dict(mode='whole')) diff --git a/spaces/Politrees/RVC_V2_Huggingface_Version/lib/infer_pack/modules/F0Predictor/PMF0Predictor.py b/spaces/Politrees/RVC_V2_Huggingface_Version/lib/infer_pack/modules/F0Predictor/PMF0Predictor.py deleted file mode 100644 index b2c592527a5966e6f8e79e8c52dc5b414246dcc6..0000000000000000000000000000000000000000 --- a/spaces/Politrees/RVC_V2_Huggingface_Version/lib/infer_pack/modules/F0Predictor/PMF0Predictor.py +++ /dev/null @@ -1,97 +0,0 @@ -from lib.infer_pack.modules.F0Predictor.F0Predictor import F0Predictor -import parselmouth -import numpy as np - - -class PMF0Predictor(F0Predictor): - def __init__(self, hop_length=512, f0_min=50, f0_max=1100, sampling_rate=44100): - self.hop_length = hop_length - self.f0_min = f0_min - self.f0_max = f0_max - self.sampling_rate = sampling_rate - - def interpolate_f0(self, f0): - """ - 对F0进行插值处理 - """ - - data = np.reshape(f0, (f0.size, 1)) - - vuv_vector = np.zeros((data.size, 1), dtype=np.float32) - vuv_vector[data > 0.0] = 1.0 - vuv_vector[data <= 0.0] = 0.0 - - ip_data = data - - frame_number = data.size - last_value = 0.0 - for i in range(frame_number): - if data[i] <= 0.0: - j = i + 1 - for j in range(i + 1, frame_number): - if data[j] > 0.0: - break - if j < frame_number - 1: - if last_value > 0.0: - step = (data[j] - data[i - 1]) / float(j - i) - for k in range(i, j): - ip_data[k] = data[i - 1] + step * (k - i + 1) - else: - for k in range(i, j): - ip_data[k] = data[j] - else: - for k in range(i, frame_number): - ip_data[k] = last_value - else: - ip_data[i] = data[i] # 这里可能存在一个没有必要的拷贝 - last_value = data[i] - - return ip_data[:, 0], vuv_vector[:, 0] - - def compute_f0(self, wav, p_len=None): - x = wav - if p_len is None: - p_len = x.shape[0] // self.hop_length - else: - assert abs(p_len - x.shape[0] // self.hop_length) < 4, "pad length error" - time_step = self.hop_length / self.sampling_rate * 1000 - f0 = ( - parselmouth.Sound(x, self.sampling_rate) - .to_pitch_ac( - time_step=time_step / 1000, - voicing_threshold=0.6, - pitch_floor=self.f0_min, - pitch_ceiling=self.f0_max, - ) - .selected_array["frequency"] - ) - - pad_size = (p_len - len(f0) + 1) // 2 - if pad_size > 0 or p_len - len(f0) - pad_size > 0: - f0 = np.pad(f0, [[pad_size, p_len - len(f0) - pad_size]], mode="constant") - f0, uv = self.interpolate_f0(f0) - return f0 - - def compute_f0_uv(self, wav, p_len=None): - x = wav - if p_len is None: - p_len = x.shape[0] // self.hop_length - else: - assert abs(p_len - x.shape[0] // self.hop_length) < 4, "pad length error" - time_step = self.hop_length / self.sampling_rate * 1000 - f0 = ( - parselmouth.Sound(x, self.sampling_rate) - .to_pitch_ac( - time_step=time_step / 1000, - voicing_threshold=0.6, - pitch_floor=self.f0_min, - pitch_ceiling=self.f0_max, - ) - .selected_array["frequency"] - ) - - pad_size = (p_len - len(f0) + 1) // 2 - if pad_size > 0 or p_len - len(f0) - pad_size > 0: - f0 = np.pad(f0, [[pad_size, p_len - len(f0) - pad_size]], mode="constant") - f0, uv = self.interpolate_f0(f0) - return f0, uv diff --git a/spaces/Prof-Reza/Audiocraft_Music-Audio_Generation/audiocraft/modules/seanet.py b/spaces/Prof-Reza/Audiocraft_Music-Audio_Generation/audiocraft/modules/seanet.py deleted file mode 100644 index 3e5998e9153afb6e68ea410d565e00ea835db248..0000000000000000000000000000000000000000 --- a/spaces/Prof-Reza/Audiocraft_Music-Audio_Generation/audiocraft/modules/seanet.py +++ /dev/null @@ -1,258 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the license found in the -# LICENSE file in the root directory of this source tree. - -import typing as tp - -import numpy as np -import torch.nn as nn - -from .conv import StreamableConv1d, StreamableConvTranspose1d -from .lstm import StreamableLSTM - - -class SEANetResnetBlock(nn.Module): - """Residual block from SEANet model. - - Args: - dim (int): Dimension of the input/output. - kernel_sizes (list): List of kernel sizes for the convolutions. - dilations (list): List of dilations for the convolutions. - activation (str): Activation function. - activation_params (dict): Parameters to provide to the activation function. - norm (str): Normalization method. - norm_params (dict): Parameters to provide to the underlying normalization used along with the convolution. - causal (bool): Whether to use fully causal convolution. - pad_mode (str): Padding mode for the convolutions. - compress (int): Reduced dimensionality in residual branches (from Demucs v3). - true_skip (bool): Whether to use true skip connection or a simple - (streamable) convolution as the skip connection. - """ - def __init__(self, dim: int, kernel_sizes: tp.List[int] = [3, 1], dilations: tp.List[int] = [1, 1], - activation: str = 'ELU', activation_params: dict = {'alpha': 1.0}, - norm: str = 'none', norm_params: tp.Dict[str, tp.Any] = {}, causal: bool = False, - pad_mode: str = 'reflect', compress: int = 2, true_skip: bool = True): - super().__init__() - assert len(kernel_sizes) == len(dilations), 'Number of kernel sizes should match number of dilations' - act = getattr(nn, activation) - hidden = dim // compress - block = [] - for i, (kernel_size, dilation) in enumerate(zip(kernel_sizes, dilations)): - in_chs = dim if i == 0 else hidden - out_chs = dim if i == len(kernel_sizes) - 1 else hidden - block += [ - act(**activation_params), - StreamableConv1d(in_chs, out_chs, kernel_size=kernel_size, dilation=dilation, - norm=norm, norm_kwargs=norm_params, - causal=causal, pad_mode=pad_mode), - ] - self.block = nn.Sequential(*block) - self.shortcut: nn.Module - if true_skip: - self.shortcut = nn.Identity() - else: - self.shortcut = StreamableConv1d(dim, dim, kernel_size=1, norm=norm, norm_kwargs=norm_params, - causal=causal, pad_mode=pad_mode) - - def forward(self, x): - return self.shortcut(x) + self.block(x) - - -class SEANetEncoder(nn.Module): - """SEANet encoder. - - Args: - channels (int): Audio channels. - dimension (int): Intermediate representation dimension. - n_filters (int): Base width for the model. - n_residual_layers (int): nb of residual layers. - ratios (Sequence[int]): kernel size and stride ratios. The encoder uses downsampling ratios instead of - upsampling ratios, hence it will use the ratios in the reverse order to the ones specified here - that must match the decoder order. We use the decoder order as some models may only employ the decoder. - activation (str): Activation function. - activation_params (dict): Parameters to provide to the activation function. - norm (str): Normalization method. - norm_params (dict): Parameters to provide to the underlying normalization used along with the convolution. - kernel_size (int): Kernel size for the initial convolution. - last_kernel_size (int): Kernel size for the initial convolution. - residual_kernel_size (int): Kernel size for the residual layers. - dilation_base (int): How much to increase the dilation with each layer. - causal (bool): Whether to use fully causal convolution. - pad_mode (str): Padding mode for the convolutions. - true_skip (bool): Whether to use true skip connection or a simple - (streamable) convolution as the skip connection in the residual network blocks. - compress (int): Reduced dimensionality in residual branches (from Demucs v3). - lstm (int): Number of LSTM layers at the end of the encoder. - disable_norm_outer_blocks (int): Number of blocks for which we don't apply norm. - For the encoder, it corresponds to the N first blocks. - """ - def __init__(self, channels: int = 1, dimension: int = 128, n_filters: int = 32, n_residual_layers: int = 3, - ratios: tp.List[int] = [8, 5, 4, 2], activation: str = 'ELU', activation_params: dict = {'alpha': 1.0}, - norm: str = 'none', norm_params: tp.Dict[str, tp.Any] = {}, kernel_size: int = 7, - last_kernel_size: int = 7, residual_kernel_size: int = 3, dilation_base: int = 2, causal: bool = False, - pad_mode: str = 'reflect', true_skip: bool = True, compress: int = 2, lstm: int = 0, - disable_norm_outer_blocks: int = 0): - super().__init__() - self.channels = channels - self.dimension = dimension - self.n_filters = n_filters - self.ratios = list(reversed(ratios)) - del ratios - self.n_residual_layers = n_residual_layers - self.hop_length = np.prod(self.ratios) - self.n_blocks = len(self.ratios) + 2 # first and last conv + residual blocks - self.disable_norm_outer_blocks = disable_norm_outer_blocks - assert self.disable_norm_outer_blocks >= 0 and self.disable_norm_outer_blocks <= self.n_blocks, \ - "Number of blocks for which to disable norm is invalid." \ - "It should be lower or equal to the actual number of blocks in the network and greater or equal to 0." - - act = getattr(nn, activation) - mult = 1 - model: tp.List[nn.Module] = [ - StreamableConv1d(channels, mult * n_filters, kernel_size, - norm='none' if self.disable_norm_outer_blocks >= 1 else norm, - norm_kwargs=norm_params, causal=causal, pad_mode=pad_mode) - ] - # Downsample to raw audio scale - for i, ratio in enumerate(self.ratios): - block_norm = 'none' if self.disable_norm_outer_blocks >= i + 2 else norm - # Add residual layers - for j in range(n_residual_layers): - model += [ - SEANetResnetBlock(mult * n_filters, kernel_sizes=[residual_kernel_size, 1], - dilations=[dilation_base ** j, 1], - norm=block_norm, norm_params=norm_params, - activation=activation, activation_params=activation_params, - causal=causal, pad_mode=pad_mode, compress=compress, true_skip=true_skip)] - - # Add downsampling layers - model += [ - act(**activation_params), - StreamableConv1d(mult * n_filters, mult * n_filters * 2, - kernel_size=ratio * 2, stride=ratio, - norm=block_norm, norm_kwargs=norm_params, - causal=causal, pad_mode=pad_mode), - ] - mult *= 2 - - if lstm: - model += [StreamableLSTM(mult * n_filters, num_layers=lstm)] - - model += [ - act(**activation_params), - StreamableConv1d(mult * n_filters, dimension, last_kernel_size, - norm='none' if self.disable_norm_outer_blocks == self.n_blocks else norm, - norm_kwargs=norm_params, causal=causal, pad_mode=pad_mode) - ] - - self.model = nn.Sequential(*model) - - def forward(self, x): - return self.model(x) - - -class SEANetDecoder(nn.Module): - """SEANet decoder. - - Args: - channels (int): Audio channels. - dimension (int): Intermediate representation dimension. - n_filters (int): Base width for the model. - n_residual_layers (int): nb of residual layers. - ratios (Sequence[int]): kernel size and stride ratios. - activation (str): Activation function. - activation_params (dict): Parameters to provide to the activation function. - final_activation (str): Final activation function after all convolutions. - final_activation_params (dict): Parameters to provide to the activation function. - norm (str): Normalization method. - norm_params (dict): Parameters to provide to the underlying normalization used along with the convolution. - kernel_size (int): Kernel size for the initial convolution. - last_kernel_size (int): Kernel size for the initial convolution. - residual_kernel_size (int): Kernel size for the residual layers. - dilation_base (int): How much to increase the dilation with each layer. - causal (bool): Whether to use fully causal convolution. - pad_mode (str): Padding mode for the convolutions. - true_skip (bool): Whether to use true skip connection or a simple. - (streamable) convolution as the skip connection in the residual network blocks. - compress (int): Reduced dimensionality in residual branches (from Demucs v3). - lstm (int): Number of LSTM layers at the end of the encoder. - disable_norm_outer_blocks (int): Number of blocks for which we don't apply norm. - For the decoder, it corresponds to the N last blocks. - trim_right_ratio (float): Ratio for trimming at the right of the transposed convolution under the causal setup. - If equal to 1.0, it means that all the trimming is done at the right. - """ - def __init__(self, channels: int = 1, dimension: int = 128, n_filters: int = 32, n_residual_layers: int = 3, - ratios: tp.List[int] = [8, 5, 4, 2], activation: str = 'ELU', activation_params: dict = {'alpha': 1.0}, - final_activation: tp.Optional[str] = None, final_activation_params: tp.Optional[dict] = None, - norm: str = 'none', norm_params: tp.Dict[str, tp.Any] = {}, kernel_size: int = 7, - last_kernel_size: int = 7, residual_kernel_size: int = 3, dilation_base: int = 2, causal: bool = False, - pad_mode: str = 'reflect', true_skip: bool = True, compress: int = 2, lstm: int = 0, - disable_norm_outer_blocks: int = 0, trim_right_ratio: float = 1.0): - super().__init__() - self.dimension = dimension - self.channels = channels - self.n_filters = n_filters - self.ratios = ratios - del ratios - self.n_residual_layers = n_residual_layers - self.hop_length = np.prod(self.ratios) - self.n_blocks = len(self.ratios) + 2 # first and last conv + residual blocks - self.disable_norm_outer_blocks = disable_norm_outer_blocks - assert self.disable_norm_outer_blocks >= 0 and self.disable_norm_outer_blocks <= self.n_blocks, \ - "Number of blocks for which to disable norm is invalid." \ - "It should be lower or equal to the actual number of blocks in the network and greater or equal to 0." - - act = getattr(nn, activation) - mult = int(2 ** len(self.ratios)) - model: tp.List[nn.Module] = [ - StreamableConv1d(dimension, mult * n_filters, kernel_size, - norm='none' if self.disable_norm_outer_blocks == self.n_blocks else norm, - norm_kwargs=norm_params, causal=causal, pad_mode=pad_mode) - ] - - if lstm: - model += [StreamableLSTM(mult * n_filters, num_layers=lstm)] - - # Upsample to raw audio scale - for i, ratio in enumerate(self.ratios): - block_norm = 'none' if self.disable_norm_outer_blocks >= self.n_blocks - (i + 1) else norm - # Add upsampling layers - model += [ - act(**activation_params), - StreamableConvTranspose1d(mult * n_filters, mult * n_filters // 2, - kernel_size=ratio * 2, stride=ratio, - norm=block_norm, norm_kwargs=norm_params, - causal=causal, trim_right_ratio=trim_right_ratio), - ] - # Add residual layers - for j in range(n_residual_layers): - model += [ - SEANetResnetBlock(mult * n_filters // 2, kernel_sizes=[residual_kernel_size, 1], - dilations=[dilation_base ** j, 1], - activation=activation, activation_params=activation_params, - norm=block_norm, norm_params=norm_params, causal=causal, - pad_mode=pad_mode, compress=compress, true_skip=true_skip)] - - mult //= 2 - - # Add final layers - model += [ - act(**activation_params), - StreamableConv1d(n_filters, channels, last_kernel_size, - norm='none' if self.disable_norm_outer_blocks >= 1 else norm, - norm_kwargs=norm_params, causal=causal, pad_mode=pad_mode) - ] - # Add optional final activation to decoder (eg. tanh) - if final_activation is not None: - final_act = getattr(nn, final_activation) - final_activation_params = final_activation_params or {} - model += [ - final_act(**final_activation_params) - ] - self.model = nn.Sequential(*model) - - def forward(self, z): - y = self.model(z) - return y diff --git a/spaces/ProteinDesignLab/protpardelle/ProteinMPNN/examples/submit_example_6.sh b/spaces/ProteinDesignLab/protpardelle/ProteinMPNN/examples/submit_example_6.sh deleted file mode 100644 index e7580e271bbb7c8c61f557d5e16ad632111564bf..0000000000000000000000000000000000000000 --- a/spaces/ProteinDesignLab/protpardelle/ProteinMPNN/examples/submit_example_6.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -#SBATCH -p gpu -#SBATCH --mem=32g -#SBATCH --gres=gpu:rtx2080:1 -#SBATCH -c 3 -#SBATCH --output=example_6.out - -source activate mlfold - -folder_with_pdbs="../inputs/PDB_homooligomers/pdbs/" - -output_dir="../outputs/example_6_outputs" -if [ ! -d $output_dir ] -then - mkdir -p $output_dir -fi - - -path_for_parsed_chains=$output_dir"/parsed_pdbs.jsonl" -path_for_tied_positions=$output_dir"/tied_pdbs.jsonl" -path_for_designed_sequences=$output_dir"/temp_0.1" - -python ../helper_scripts/parse_multiple_chains.py --input_path=$folder_with_pdbs --output_path=$path_for_parsed_chains - -python ../helper_scripts/make_tied_positions_dict.py --input_path=$path_for_parsed_chains --output_path=$path_for_tied_positions --homooligomer 1 - -python ../protein_mpnn_run.py \ - --jsonl_path $path_for_parsed_chains \ - --tied_positions_jsonl $path_for_tied_positions \ - --out_folder $output_dir \ - --num_seq_per_target 2 \ - --sampling_temp "0.2" \ - --seed 37 \ - --batch_size 1 diff --git a/spaces/RamAnanth1/Pix2Struct/app.py b/spaces/RamAnanth1/Pix2Struct/app.py deleted file mode 100644 index af764b88a53044b44539c426b46f1e900328e173..0000000000000000000000000000000000000000 --- a/spaces/RamAnanth1/Pix2Struct/app.py +++ /dev/null @@ -1,43 +0,0 @@ -import gradio as gr -from transformers import Pix2StructForConditionalGeneration, Pix2StructProcessor - -model = Pix2StructForConditionalGeneration.from_pretrained("google/pix2struct-docvqa-large") -processor = Pix2StructProcessor.from_pretrained("google/pix2struct-docvqa-large") - -ai2d_model = Pix2StructForConditionalGeneration.from_pretrained("google/pix2struct-ai2d-base") -ai2d_processor = Pix2StructProcessor.from_pretrained("google/pix2struct-ai2d-base") - -task_list = [ - "DocVQA", - "Scientific diagram VQA" -] - - -def process_document(image, question, task): - # image = Image.open(image) - if task == task_list[0]: #DocVQA - inputs = processor(images=image, text=question, return_tensors="pt") - predictions = model.generate(**inputs) - result = processor.decode(predictions[0], skip_special_tokens=True) - else: - inputs = ai2d_processor(images=image, text=question, return_tensors="pt") - predictions = ai2d_model.generate(**inputs) - result = ai2d_processor.decode(predictions[0], skip_special_tokens=True) - return result - -description = "Unofficial Demo for Pix2Struct. To use it, simply upload your image and type a question and click 'submit', or click one of the examples to load them. Read more at the links below." -article = "<p style='text-align: center'><a href='https://arxiv.org/pdf/2210.03347.pdf' target='_blank'>PIX2STRUCT: SCREENSHOT PARSING AS PRETRAINING FOR VISUAL LANGUAGE UNDERSTANDING</a></p>" - -demo = gr.Interface( - fn=process_document, - inputs=[gr.Image(type="pil"), gr.Textbox(label="Question"), gr.Dropdown(choices=task_list, value=task_list[0], label='VQA Task')], - outputs="text", - title="Pix2Struct VQA for Scientific Diagrams and Documents", - description=description, - article=article, - enable_queue=True, - examples=[["example_1.png", "When is the coffee break?","DocVQA"]], - cache_examples=True -) - -demo.launch() \ No newline at end of file diff --git a/spaces/Raspberry-ai/main/.env/lib/python3.11/site-packages/pip/_internal/utils/misc.py b/spaces/Raspberry-ai/main/.env/lib/python3.11/site-packages/pip/_internal/utils/misc.py deleted file mode 100644 index a8f4cb5cf561c671674bcc10be18aae9121a4c8a..0000000000000000000000000000000000000000 --- a/spaces/Raspberry-ai/main/.env/lib/python3.11/site-packages/pip/_internal/utils/misc.py +++ /dev/null @@ -1,723 +0,0 @@ -# The following comment should be removed at some point in the future. -# mypy: strict-optional=False - -import contextlib -import errno -import getpass -import hashlib -import io -import logging -import os -import posixpath -import shutil -import stat -import sys -import urllib.parse -from io import StringIO -from itertools import filterfalse, tee, zip_longest -from types import TracebackType -from typing import ( - Any, - BinaryIO, - Callable, - ContextManager, - Dict, - Generator, - Iterable, - Iterator, - List, - Optional, - TextIO, - Tuple, - Type, - TypeVar, - cast, -) - -from pip._vendor.pep517 import Pep517HookCaller -from pip._vendor.tenacity import retry, stop_after_delay, wait_fixed - -from pip import __version__ -from pip._internal.exceptions import CommandError -from pip._internal.locations import get_major_minor_version -from pip._internal.utils.compat import WINDOWS -from pip._internal.utils.virtualenv import running_under_virtualenv - -__all__ = [ - "rmtree", - "display_path", - "backup_dir", - "ask", - "splitext", - "format_size", - "is_installable_dir", - "normalize_path", - "renames", - "get_prog", - "captured_stdout", - "ensure_dir", - "remove_auth_from_url", - "ConfiguredPep517HookCaller", -] - - -logger = logging.getLogger(__name__) - -T = TypeVar("T") -ExcInfo = Tuple[Type[BaseException], BaseException, TracebackType] -VersionInfo = Tuple[int, int, int] -NetlocTuple = Tuple[str, Tuple[Optional[str], Optional[str]]] - - -def get_pip_version() -> str: - pip_pkg_dir = os.path.join(os.path.dirname(__file__), "..", "..") - pip_pkg_dir = os.path.abspath(pip_pkg_dir) - - return "pip {} from {} (python {})".format( - __version__, - pip_pkg_dir, - get_major_minor_version(), - ) - - -def normalize_version_info(py_version_info: Tuple[int, ...]) -> Tuple[int, int, int]: - """ - Convert a tuple of ints representing a Python version to one of length - three. - - :param py_version_info: a tuple of ints representing a Python version, - or None to specify no version. The tuple can have any length. - - :return: a tuple of length three if `py_version_info` is non-None. - Otherwise, return `py_version_info` unchanged (i.e. None). - """ - if len(py_version_info) < 3: - py_version_info += (3 - len(py_version_info)) * (0,) - elif len(py_version_info) > 3: - py_version_info = py_version_info[:3] - - return cast("VersionInfo", py_version_info) - - -def ensure_dir(path: str) -> None: - """os.path.makedirs without EEXIST.""" - try: - os.makedirs(path) - except OSError as e: - # Windows can raise spurious ENOTEMPTY errors. See #6426. - if e.errno != errno.EEXIST and e.errno != errno.ENOTEMPTY: - raise - - -def get_prog() -> str: - try: - prog = os.path.basename(sys.argv[0]) - if prog in ("__main__.py", "-c"): - return f"{sys.executable} -m pip" - else: - return prog - except (AttributeError, TypeError, IndexError): - pass - return "pip" - - -# Retry every half second for up to 3 seconds -# Tenacity raises RetryError by default, explicitly raise the original exception -@retry(reraise=True, stop=stop_after_delay(3), wait=wait_fixed(0.5)) -def rmtree(dir: str, ignore_errors: bool = False) -> None: - shutil.rmtree(dir, ignore_errors=ignore_errors, onerror=rmtree_errorhandler) - - -def rmtree_errorhandler(func: Callable[..., Any], path: str, exc_info: ExcInfo) -> None: - """On Windows, the files in .svn are read-only, so when rmtree() tries to - remove them, an exception is thrown. We catch that here, remove the - read-only attribute, and hopefully continue without problems.""" - try: - has_attr_readonly = not (os.stat(path).st_mode & stat.S_IWRITE) - except OSError: - # it's equivalent to os.path.exists - return - - if has_attr_readonly: - # convert to read/write - os.chmod(path, stat.S_IWRITE) - # use the original function to repeat the operation - func(path) - return - else: - raise - - -def display_path(path: str) -> str: - """Gives the display value for a given path, making it relative to cwd - if possible.""" - path = os.path.normcase(os.path.abspath(path)) - if path.startswith(os.getcwd() + os.path.sep): - path = "." + path[len(os.getcwd()) :] - return path - - -def backup_dir(dir: str, ext: str = ".bak") -> str: - """Figure out the name of a directory to back up the given dir to - (adding .bak, .bak2, etc)""" - n = 1 - extension = ext - while os.path.exists(dir + extension): - n += 1 - extension = ext + str(n) - return dir + extension - - -def ask_path_exists(message: str, options: Iterable[str]) -> str: - for action in os.environ.get("PIP_EXISTS_ACTION", "").split(): - if action in options: - return action - return ask(message, options) - - -def _check_no_input(message: str) -> None: - """Raise an error if no input is allowed.""" - if os.environ.get("PIP_NO_INPUT"): - raise Exception( - f"No input was expected ($PIP_NO_INPUT set); question: {message}" - ) - - -def ask(message: str, options: Iterable[str]) -> str: - """Ask the message interactively, with the given possible responses""" - while 1: - _check_no_input(message) - response = input(message) - response = response.strip().lower() - if response not in options: - print( - "Your response ({!r}) was not one of the expected responses: " - "{}".format(response, ", ".join(options)) - ) - else: - return response - - -def ask_input(message: str) -> str: - """Ask for input interactively.""" - _check_no_input(message) - return input(message) - - -def ask_password(message: str) -> str: - """Ask for a password interactively.""" - _check_no_input(message) - return getpass.getpass(message) - - -def strtobool(val: str) -> int: - """Convert a string representation of truth to true (1) or false (0). - - True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values - are 'n', 'no', 'f', 'false', 'off', and '0'. Raises ValueError if - 'val' is anything else. - """ - val = val.lower() - if val in ("y", "yes", "t", "true", "on", "1"): - return 1 - elif val in ("n", "no", "f", "false", "off", "0"): - return 0 - else: - raise ValueError(f"invalid truth value {val!r}") - - -def format_size(bytes: float) -> str: - if bytes > 1000 * 1000: - return "{:.1f} MB".format(bytes / 1000.0 / 1000) - elif bytes > 10 * 1000: - return "{} kB".format(int(bytes / 1000)) - elif bytes > 1000: - return "{:.1f} kB".format(bytes / 1000.0) - else: - return "{} bytes".format(int(bytes)) - - -def tabulate(rows: Iterable[Iterable[Any]]) -> Tuple[List[str], List[int]]: - """Return a list of formatted rows and a list of column sizes. - - For example:: - - >>> tabulate([['foobar', 2000], [0xdeadbeef]]) - (['foobar 2000', '3735928559'], [10, 4]) - """ - rows = [tuple(map(str, row)) for row in rows] - sizes = [max(map(len, col)) for col in zip_longest(*rows, fillvalue="")] - table = [" ".join(map(str.ljust, row, sizes)).rstrip() for row in rows] - return table, sizes - - -def is_installable_dir(path: str) -> bool: - """Is path is a directory containing pyproject.toml or setup.py? - - If pyproject.toml exists, this is a PEP 517 project. Otherwise we look for - a legacy setuptools layout by identifying setup.py. We don't check for the - setup.cfg because using it without setup.py is only available for PEP 517 - projects, which are already covered by the pyproject.toml check. - """ - if not os.path.isdir(path): - return False - if os.path.isfile(os.path.join(path, "pyproject.toml")): - return True - if os.path.isfile(os.path.join(path, "setup.py")): - return True - return False - - -def read_chunks( - file: BinaryIO, size: int = io.DEFAULT_BUFFER_SIZE -) -> Generator[bytes, None, None]: - """Yield pieces of data from a file-like object until EOF.""" - while True: - chunk = file.read(size) - if not chunk: - break - yield chunk - - -def normalize_path(path: str, resolve_symlinks: bool = True) -> str: - """ - Convert a path to its canonical, case-normalized, absolute version. - - """ - path = os.path.expanduser(path) - if resolve_symlinks: - path = os.path.realpath(path) - else: - path = os.path.abspath(path) - return os.path.normcase(path) - - -def splitext(path: str) -> Tuple[str, str]: - """Like os.path.splitext, but take off .tar too""" - base, ext = posixpath.splitext(path) - if base.lower().endswith(".tar"): - ext = base[-4:] + ext - base = base[:-4] - return base, ext - - -def renames(old: str, new: str) -> None: - """Like os.renames(), but handles renaming across devices.""" - # Implementation borrowed from os.renames(). - head, tail = os.path.split(new) - if head and tail and not os.path.exists(head): - os.makedirs(head) - - shutil.move(old, new) - - head, tail = os.path.split(old) - if head and tail: - try: - os.removedirs(head) - except OSError: - pass - - -def is_local(path: str) -> bool: - """ - Return True if path is within sys.prefix, if we're running in a virtualenv. - - If we're not in a virtualenv, all paths are considered "local." - - Caution: this function assumes the head of path has been normalized - with normalize_path. - """ - if not running_under_virtualenv(): - return True - return path.startswith(normalize_path(sys.prefix)) - - -def write_output(msg: Any, *args: Any) -> None: - logger.info(msg, *args) - - -class StreamWrapper(StringIO): - orig_stream: TextIO = None - - @classmethod - def from_stream(cls, orig_stream: TextIO) -> "StreamWrapper": - cls.orig_stream = orig_stream - return cls() - - # compileall.compile_dir() needs stdout.encoding to print to stdout - # https://github.com/python/mypy/issues/4125 - @property - def encoding(self): # type: ignore - return self.orig_stream.encoding - - -@contextlib.contextmanager -def captured_output(stream_name: str) -> Generator[StreamWrapper, None, None]: - """Return a context manager used by captured_stdout/stdin/stderr - that temporarily replaces the sys stream *stream_name* with a StringIO. - - Taken from Lib/support/__init__.py in the CPython repo. - """ - orig_stdout = getattr(sys, stream_name) - setattr(sys, stream_name, StreamWrapper.from_stream(orig_stdout)) - try: - yield getattr(sys, stream_name) - finally: - setattr(sys, stream_name, orig_stdout) - - -def captured_stdout() -> ContextManager[StreamWrapper]: - """Capture the output of sys.stdout: - - with captured_stdout() as stdout: - print('hello') - self.assertEqual(stdout.getvalue(), 'hello\n') - - Taken from Lib/support/__init__.py in the CPython repo. - """ - return captured_output("stdout") - - -def captured_stderr() -> ContextManager[StreamWrapper]: - """ - See captured_stdout(). - """ - return captured_output("stderr") - - -# Simulates an enum -def enum(*sequential: Any, **named: Any) -> Type[Any]: - enums = dict(zip(sequential, range(len(sequential))), **named) - reverse = {value: key for key, value in enums.items()} - enums["reverse_mapping"] = reverse - return type("Enum", (), enums) - - -def build_netloc(host: str, port: Optional[int]) -> str: - """ - Build a netloc from a host-port pair - """ - if port is None: - return host - if ":" in host: - # Only wrap host with square brackets when it is IPv6 - host = f"[{host}]" - return f"{host}:{port}" - - -def build_url_from_netloc(netloc: str, scheme: str = "https") -> str: - """ - Build a full URL from a netloc. - """ - if netloc.count(":") >= 2 and "@" not in netloc and "[" not in netloc: - # It must be a bare IPv6 address, so wrap it with brackets. - netloc = f"[{netloc}]" - return f"{scheme}://{netloc}" - - -def parse_netloc(netloc: str) -> Tuple[str, Optional[int]]: - """ - Return the host-port pair from a netloc. - """ - url = build_url_from_netloc(netloc) - parsed = urllib.parse.urlparse(url) - return parsed.hostname, parsed.port - - -def split_auth_from_netloc(netloc: str) -> NetlocTuple: - """ - Parse out and remove the auth information from a netloc. - - Returns: (netloc, (username, password)). - """ - if "@" not in netloc: - return netloc, (None, None) - - # Split from the right because that's how urllib.parse.urlsplit() - # behaves if more than one @ is present (which can be checked using - # the password attribute of urlsplit()'s return value). - auth, netloc = netloc.rsplit("@", 1) - pw: Optional[str] = None - if ":" in auth: - # Split from the left because that's how urllib.parse.urlsplit() - # behaves if more than one : is present (which again can be checked - # using the password attribute of the return value) - user, pw = auth.split(":", 1) - else: - user, pw = auth, None - - user = urllib.parse.unquote(user) - if pw is not None: - pw = urllib.parse.unquote(pw) - - return netloc, (user, pw) - - -def redact_netloc(netloc: str) -> str: - """ - Replace the sensitive data in a netloc with "****", if it exists. - - For example: - - "user:pass@example.com" returns "user:****@example.com" - - "accesstoken@example.com" returns "****@example.com" - """ - netloc, (user, password) = split_auth_from_netloc(netloc) - if user is None: - return netloc - if password is None: - user = "****" - password = "" - else: - user = urllib.parse.quote(user) - password = ":****" - return "{user}{password}@{netloc}".format( - user=user, password=password, netloc=netloc - ) - - -def _transform_url( - url: str, transform_netloc: Callable[[str], Tuple[Any, ...]] -) -> Tuple[str, NetlocTuple]: - """Transform and replace netloc in a url. - - transform_netloc is a function taking the netloc and returning a - tuple. The first element of this tuple is the new netloc. The - entire tuple is returned. - - Returns a tuple containing the transformed url as item 0 and the - original tuple returned by transform_netloc as item 1. - """ - purl = urllib.parse.urlsplit(url) - netloc_tuple = transform_netloc(purl.netloc) - # stripped url - url_pieces = (purl.scheme, netloc_tuple[0], purl.path, purl.query, purl.fragment) - surl = urllib.parse.urlunsplit(url_pieces) - return surl, cast("NetlocTuple", netloc_tuple) - - -def _get_netloc(netloc: str) -> NetlocTuple: - return split_auth_from_netloc(netloc) - - -def _redact_netloc(netloc: str) -> Tuple[str]: - return (redact_netloc(netloc),) - - -def split_auth_netloc_from_url(url: str) -> Tuple[str, str, Tuple[str, str]]: - """ - Parse a url into separate netloc, auth, and url with no auth. - - Returns: (url_without_auth, netloc, (username, password)) - """ - url_without_auth, (netloc, auth) = _transform_url(url, _get_netloc) - return url_without_auth, netloc, auth - - -def remove_auth_from_url(url: str) -> str: - """Return a copy of url with 'username:password@' removed.""" - # username/pass params are passed to subversion through flags - # and are not recognized in the url. - return _transform_url(url, _get_netloc)[0] - - -def redact_auth_from_url(url: str) -> str: - """Replace the password in a given url with ****.""" - return _transform_url(url, _redact_netloc)[0] - - -class HiddenText: - def __init__(self, secret: str, redacted: str) -> None: - self.secret = secret - self.redacted = redacted - - def __repr__(self) -> str: - return "<HiddenText {!r}>".format(str(self)) - - def __str__(self) -> str: - return self.redacted - - # This is useful for testing. - def __eq__(self, other: Any) -> bool: - if type(self) != type(other): - return False - - # The string being used for redaction doesn't also have to match, - # just the raw, original string. - return self.secret == other.secret - - -def hide_value(value: str) -> HiddenText: - return HiddenText(value, redacted="****") - - -def hide_url(url: str) -> HiddenText: - redacted = redact_auth_from_url(url) - return HiddenText(url, redacted=redacted) - - -def protect_pip_from_modification_on_windows(modifying_pip: bool) -> None: - """Protection of pip.exe from modification on Windows - - On Windows, any operation modifying pip should be run as: - python -m pip ... - """ - pip_names = [ - "pip", - f"pip{sys.version_info.major}", - f"pip{sys.version_info.major}.{sys.version_info.minor}", - ] - - # See https://github.com/pypa/pip/issues/1299 for more discussion - should_show_use_python_msg = ( - modifying_pip and WINDOWS and os.path.basename(sys.argv[0]) in pip_names - ) - - if should_show_use_python_msg: - new_command = [sys.executable, "-m", "pip"] + sys.argv[1:] - raise CommandError( - "To modify pip, please run the following command:\n{}".format( - " ".join(new_command) - ) - ) - - -def is_console_interactive() -> bool: - """Is this console interactive?""" - return sys.stdin is not None and sys.stdin.isatty() - - -def hash_file(path: str, blocksize: int = 1 << 20) -> Tuple[Any, int]: - """Return (hash, length) for path using hashlib.sha256()""" - - h = hashlib.sha256() - length = 0 - with open(path, "rb") as f: - for block in read_chunks(f, size=blocksize): - length += len(block) - h.update(block) - return h, length - - -def is_wheel_installed() -> bool: - """ - Return whether the wheel package is installed. - """ - try: - import wheel # noqa: F401 - except ImportError: - return False - - return True - - -def pairwise(iterable: Iterable[Any]) -> Iterator[Tuple[Any, Any]]: - """ - Return paired elements. - - For example: - s -> (s0, s1), (s2, s3), (s4, s5), ... - """ - iterable = iter(iterable) - return zip_longest(iterable, iterable) - - -def partition( - pred: Callable[[T], bool], - iterable: Iterable[T], -) -> Tuple[Iterable[T], Iterable[T]]: - """ - Use a predicate to partition entries into false entries and true entries, - like - - partition(is_odd, range(10)) --> 0 2 4 6 8 and 1 3 5 7 9 - """ - t1, t2 = tee(iterable) - return filterfalse(pred, t1), filter(pred, t2) - - -class ConfiguredPep517HookCaller(Pep517HookCaller): - def __init__( - self, - config_holder: Any, - source_dir: str, - build_backend: str, - backend_path: Optional[str] = None, - runner: Optional[Callable[..., None]] = None, - python_executable: Optional[str] = None, - ): - super().__init__( - source_dir, build_backend, backend_path, runner, python_executable - ) - self.config_holder = config_holder - - def build_wheel( - self, - wheel_directory: str, - config_settings: Optional[Dict[str, str]] = None, - metadata_directory: Optional[str] = None, - ) -> str: - cs = self.config_holder.config_settings - return super().build_wheel( - wheel_directory, config_settings=cs, metadata_directory=metadata_directory - ) - - def build_sdist( - self, sdist_directory: str, config_settings: Optional[Dict[str, str]] = None - ) -> str: - cs = self.config_holder.config_settings - return super().build_sdist(sdist_directory, config_settings=cs) - - def build_editable( - self, - wheel_directory: str, - config_settings: Optional[Dict[str, str]] = None, - metadata_directory: Optional[str] = None, - ) -> str: - cs = self.config_holder.config_settings - return super().build_editable( - wheel_directory, config_settings=cs, metadata_directory=metadata_directory - ) - - def get_requires_for_build_wheel( - self, config_settings: Optional[Dict[str, str]] = None - ) -> List[str]: - cs = self.config_holder.config_settings - return super().get_requires_for_build_wheel(config_settings=cs) - - def get_requires_for_build_sdist( - self, config_settings: Optional[Dict[str, str]] = None - ) -> List[str]: - cs = self.config_holder.config_settings - return super().get_requires_for_build_sdist(config_settings=cs) - - def get_requires_for_build_editable( - self, config_settings: Optional[Dict[str, str]] = None - ) -> List[str]: - cs = self.config_holder.config_settings - return super().get_requires_for_build_editable(config_settings=cs) - - def prepare_metadata_for_build_wheel( - self, - metadata_directory: str, - config_settings: Optional[Dict[str, str]] = None, - _allow_fallback: bool = True, - ) -> str: - cs = self.config_holder.config_settings - return super().prepare_metadata_for_build_wheel( - metadata_directory=metadata_directory, - config_settings=cs, - _allow_fallback=_allow_fallback, - ) - - def prepare_metadata_for_build_editable( - self, - metadata_directory: str, - config_settings: Optional[Dict[str, str]] = None, - _allow_fallback: bool = True, - ) -> str: - cs = self.config_holder.config_settings - return super().prepare_metadata_for_build_editable( - metadata_directory=metadata_directory, - config_settings=cs, - _allow_fallback=_allow_fallback, - ) diff --git a/spaces/Razkaroth/incidencia-delictiva/app.py b/spaces/Razkaroth/incidencia-delictiva/app.py deleted file mode 100644 index 5e71a8faa589b0af7bc398ffdc360e1678a54dd8..0000000000000000000000000000000000000000 --- a/spaces/Razkaroth/incidencia-delictiva/app.py +++ /dev/null @@ -1,550 +0,0 @@ -import numpy as np -import streamlit as st -import requests -import pandas as pd -import pandas_profiling -from streamlit_pandas_profiling import st_profile_report -from cleaner.file_cleaner import file_cleaner_idm, int_to_month, month_to_num, file_cleaner_idvfc -import re - - -def offset_label(start, end): - end = end - pd.DateOffset(months=1) - if start.month == end.month: - return f'{int_to_month(start.month)} {start.year}' - return f'{int_to_month(start.month)} {start.year} - {int_to_month(end.month)} {end.year}' - - -@st.cache_data -def download_file_from_google_drive(id, destination): - URL = "https://docs.google.com/uc?export=download&confirm=1" - - session = requests.Session() - - response = session.get(URL, params={"id": id}, stream=True) - token = get_confirm_token(response) - - if token: - params = {"id": id, "confirm": token} - response = session.get(URL, params=params, stream=True) - - save_response_content(response, destination) - - -def get_confirm_token(response): - for key, value in response.cookies.items(): - if key.startswith("download_warning"): - return value - - return None - - -def save_response_content(response, destination): - CHUNK_SIZE = 32768 - with st.spinner("Descargando archivo"): - with open(destination, "wb") as f: - for chunk in response.iter_content(CHUNK_SIZE): - if chunk: # filter out keep-alive new chunks - f.write(chunk) - st.success("Archivo descargado") - - -@st.cache_data -def df_to_csv(df: pd.DataFrame, index=False): - return df.to_csv(index=index, encoding="latin") - - -@st.cache_data -def get_report(df: pd.DataFrame): - # duplicate rows using the 'N' column, remove the rows with N = 0 and then drop the 'N' column - df = df.loc[df.index.repeat(df['Total'])].drop('Total', axis=1) - return df.profile_report(title="Análisis exploratorio de datos") - - -sidebar = st.sidebar -sidebar.title("Instrucciones:") - -sidebar.markdown(""" - Entre a la siguiente liga para descargar los archivos del secretariado: - [Descarga de datos](https://www.gob.mx/sesnsp/acciones-y-programas/datos-abiertos-de-incidencia-delictiva) - - Copia la liga de uno de los siguientes archivos de la nueva metodología: - * Cifras de Incidencia Delictiva Municipal - * Cifras de Víctimas del Fuero Común - """) - - -def idm(): - st.title("Cifras de Incidencia Delictiva Municipal") - st.warning("Advertencia: Procesar todos los estados puede tardar mucho tiempo") - fileurl = st.text_input("Ingresa la URL del archivo en drive") - if fileurl: - file_id = fileurl.split("/")[-2] - destination = file_id + "idm.csv" - download_file_from_google_drive(file_id, destination) - df = pd.read_csv(destination, encoding="latin") - states = df['Entidad'].unique() - # haz una lista de selección para los estados - states_selected = st.multiselect("Selecciona los estados a procesar", states) - # filtra el dataframe por los estados seleccionados - df = df[df['Entidad'].isin(states_selected)] - - if states_selected: - st.success("Archivo cargado") - df = file_cleaner_idm(df) - # descarga de datos - """## Filtrado de datos""" - should_filter_by_crime_type = st.checkbox("Filtrar por tipo de delito") - if should_filter_by_crime_type: - tipos_de_delito = df['Tipo de delito'].unique() - # haz una lista de selección para los tipos de delito - tipos_de_delito_seleccionados = st.multiselect("Selecciona los tipos de delito a procesar", - tipos_de_delito) - - # filtra el dataframe por los tipos de delito seleccionados - df = df[df['Tipo de delito'].isin(tipos_de_delito_seleccionados)] - - subtipos_de_delito = df['Subtipo de delito'].unique() - # haz una lista de selección para los subtipos de delito - subtipos_de_delito_seleccionados = st.multiselect("Selecciona los subtipos de delito a procesar", - subtipos_de_delito) - - # filtra el dataframe por los subtipos de delito seleccionados - df = df[df['Subtipo de delito'].isin(subtipos_de_delito_seleccionados)] - - should_filter_by_municipality = st.checkbox("Filtrar por municipio") - - if should_filter_by_municipality: - municipios = df['Municipio'].unique() - municipios_seleccionados = st.multiselect("Selecciona los municipios a procesar", municipios) - df = df[df['Municipio'].isin(municipios_seleccionados)] - - # periodo de tiempo - - should_filter_by_time = st.checkbox("Filtrar por periodo de tiempo") - # haz una lista de selección para los años - if should_filter_by_time: - min_date = df['Fecha'].min() - min_date = pd.to_datetime(min_date).date() - max_date = df['Fecha'].max() - max_date = pd.to_datetime(max_date).date() - - st.write("Elige el periodo de tiempo a procesar") - start_date = st.date_input("Fecha de inicio", min_date) - end_date = st.date_input("Fecha de fin", max_date) - - st.write(df.head()) - st.write(df['Fecha'].min()) - - if start_date > end_date: - st.error("La fecha de inicio debe ser menor a la fecha de fin") - else: - # create timestamp objects from the dates - start_date_timestamp = pd.to_datetime(start_date) - end_date_timestamp = pd.to_datetime(end_date) - st.write(start_date_timestamp) - df = df[(df['Fecha-dt'] >= start_date) & (df['Fecha-dt'] <= end_date)] - - # descarga de datos - """#### Primeras 10 filas de datos filtrados""" - st.write(df.head(10)) - st.download_button("Descargar datos filtrados", data=df_to_csv(df), file_name="idm.csv", mime="text/csv") - - """## Análisis de datos""" - """### Análisis exploratorio de datos""" - show_report = st.checkbox("Mostrar reporte") - if show_report: - st_profile_report(get_report(df)) - - """### Datos a través del tiempo""" - should_show_data_through_time = st.checkbox("Habilitar sección") - if should_show_data_through_time: - dfg = df.copy() - dfg = dfg.loc[dfg.index.repeat(df['Total'])].drop('Total', axis=1) - - # agrupación de tiempo - """#### Agrupación de tiempo""" - time_grouping = st.selectbox("Selecciona el tipo de agrupación de tiempo", - ["1M", "3M", "6M", "12M", "1Y", "2Y", "3Y", "5Y"]) - - time_offset_amount = int(re.search(r'\d+', time_grouping).group()) - time_offset_unit = re.search(r'[A-Z]', time_grouping).group() - - if time_offset_unit == 'M': - offset = pd.DateOffset(months=time_offset_amount) - end_date_offset = pd.DateOffset(years=0) - elif time_offset_unit == 'Y': - offset = pd.DateOffset(years=time_offset_amount) - end_date_offset = pd.DateOffset(years=1) - - if time_grouping: - cm = pd.DataFrame() - cm['Cve. Municipio'] = df['Cve. Municipio'] - cm['Municipio'] = df['Municipio'] - cm.drop_duplicates(inplace=True) - cm.set_index('Municipio', inplace=True) - if not should_filter_by_time: - min_date = df['Fecha'].min() - start_date = pd.to_datetime(min_date).date() - max_date = df['Fecha'].max() - end_date = pd.to_datetime(max_date).date() - f"""Fecha de inicio: {start_date} - Fecha de fin: {end_date}""" - end_date = end_date + pd.DateOffset(days=2) - f"""Fecha de inicio: {start_date} - Fecha de fin: {end_date}""" - ranges = [] - masks = [] - date_range = list( - pd.date_range(start=start_date - pd.DateOffset(days=start_date.day + 1), - end=end_date + end_date_offset, freq=time_grouping)) - # add 1 day to each date - date_range = [date + pd.DateOffset(days=1) for date in date_range] - for i in range(len(date_range)): - if i == 0: - continue - previous_date = date_range[i - 1] - current_date = date_range[i] - - ranges.append((previous_date, current_date)) - - mask = (df['Fecha'] >= previous_date) & (df['Fecha'] < current_date) - # check if the mask is empty if date is june 2023 - masks.append(mask) - - di = {} - maxes = [] - start = ranges[0][0] - end = start + offset - first_period = offset_label(start, end) - st.write(first_period) - for mask in masks: - df_mask = df.loc[mask] - d = df_mask.groupby('Municipio').sum('Total').reset_index() - d.drop(['Cve. Municipio'], axis=1, inplace=True) - - d['Cve. Municipio'] = d['Municipio'].map(cm.to_dict()['Cve. Municipio']) - - d.sort_values(by='Cve. Municipio', inplace=True) - # end should be the start + the time grouping - - end = start + offset - - period = offset_label(start, end) - - di[period] = [] - municipality_added = False - - for row in d.to_dict('records'): - if period == first_period: - di[period].append({ - 'Municipio': row['Municipio'], - period: row['Total'], - }) - - else: - di[period].append({ - period: row['Total'], - }) - - # d.to_csv('output/municipios/municipios_' + str(y) + '.csv', index=False) - - m = d.groupby('Municipio').sum()['Total'].max() - maxes.append(m) - start = end - - # db6.loc[masks[0]].groupby('Municipio').sum().to_csv('municipios_2018.csv', index=False) - dfs = [] - for y in di.keys(): - df1 = pd.DataFrame(di[y]) - dfs.append(df1) - # di[y] = df1 - - # join all the dataframes - start = ranges[0][0] - # end should be the start + the time grouping - end = start + offset - period = offset_label(start, end) - - # dfj = di[period] - # for y in di.keys(): - # if y == period: - # continue - # dfj = dfj.join(di[y]) - # substitut join with concat - dfj = pd.concat(dfs, axis=1) - dfj['Total'] = dfj.sum(axis=1, numeric_only=True) - # set the index to the municipality - - dfj.set_index('Municipio', inplace=True) - dfj = dfj.sort_values(by=['Total'], ascending=False) - dfj - st.download_button("Descarga tabla como CSV", data=df_to_csv(dfj, True), file_name="idm-por-tiempo.csv", - mime="text/csv") - # plot the data - """#### Incidencia delictiva por municipio""" - st.bar_chart(dfj) - transposed = dfj.copy() - transposed = transposed.drop(['Total'], axis=1) - transposed = transposed.T - - # convert the index to a datetime index - transposed_index = transposed.index - new_index = [] - # index is in format 'Mes Año' - # convert to datetime - for index_date in transposed_index: - month = index_date.split(' ')[0] - year = index_date.split(' ')[1] - new_index.append(pd.to_datetime(f'{year}-{month_to_num[month]}-15')) - - transposed.index = new_index - - # plot the data - """#### Incidencia delictiva a través del tiempo""" - st.bar_chart(transposed) - - - - -def idvfc(): - st.title("Cifras de Víctimas del Fuero Común") - st.warning("Advertencia: Procesar todos los estados puede tardar mucho tiempo") - fileurl = st.text_input("Ingresa la URL del archivo en drive") - if fileurl: - file_id = fileurl.split("/")[-2] - destination = file_id + "idvfc.csv" - download_file_from_google_drive(file_id, destination) - df = pd.read_csv(destination, encoding="latin") - states = df['Entidad'].unique() - # haz una lista de selección para los estados - states_selected = st.multiselect("Selecciona los estados a procesar", states) - st.write(df.columns) - # filtra el dataframe por los estados seleccionados - df = df[df['Entidad'].isin(states_selected)] - - if states_selected: - st.success("Archivo cargado") - df = file_cleaner_idvfc(df) - # descarga de datos - """## Filtrado de datos""" - should_filter_by_crime_type = st.checkbox("Filtrar por tipo de delito") - if should_filter_by_crime_type: - tipos_de_delito = df['Tipo de delito'].unique() - # haz una lista de selección para los tipos de delito - tipos_de_delito_seleccionados = st.multiselect("Selecciona los tipos de delito a procesar", - tipos_de_delito) - - # filtra el dataframe por los tipos de delito seleccionados - df = df[df['Tipo de delito'].isin(tipos_de_delito_seleccionados)] - - subtipos_de_delito = df['Subtipo de delito'].unique() - # haz una lista de selección para los subtipos de delito - subtipos_de_delito_seleccionados = st.multiselect("Selecciona los subtipos de delito a procesar", - subtipos_de_delito) - # filtra el dataframe por los subtipos de delito seleccionados - df = df[df['Subtipo de delito'].isin(subtipos_de_delito_seleccionados)] - - should_filter_by_sex = st.checkbox("Filtrar por sexo") - if should_filter_by_sex: - sexos = df['Sexo'].unique() - # haz una lista de selección para los sexos - sexos_seleccionados = st.multiselect("Selecciona los sexos a procesar", sexos) - # filtra el dataframe por los sexos seleccionados - df = df[df['Sexo'].isin(sexos_seleccionados)] - - should_filter_by_age = st.checkbox("Filtrar por rango de edad") - if should_filter_by_age: - edades = df['Rango de edad'].unique() - # haz una lista de selección para los sexos - edades_seleccionadas = st.multiselect("Selecciona las edades a procesar", edades) - # filtra el dataframe por los sexos seleccionados - df = df[df['Rango de edad'].isin(edades_seleccionadas)] - - - should_filter_by_time = st.checkbox("Filtrar por periodo de tiempo") - # haz una lista de selección para los años - if should_filter_by_time: - min_date = df['Fecha'].min() - min_date = pd.to_datetime(min_date).date() - max_date = df['Fecha'].max() - max_date = pd.to_datetime(max_date).date() - st.write("Elige el periodo de tiempo a procesar") - start_date = st.date_input("Fecha de inicio", min_date) - end_date = st.date_input("Fecha de fin", max_date) - st.write(df.head()) - st.write(df['Fecha'].min()) - if start_date > end_date: - st.error("La fecha de inicio debe ser menor a la fecha de fin") - else: - # create timestamp objects from the dates - start_date_timestamp = pd.to_datetime(start_date) - end_date_timestamp = pd.to_datetime(end_date) - st.write(start_date_timestamp) - df = df[(df['Fecha-dt'] >= start_date) & (df['Fecha-dt'] <= end_date)] - # descarga de datos - """#### Primeros 10 filas de datos filtrados""" - st.write(df.head(10)) - st.download_button("Descargar datos filtrados", data=df_to_csv(df), file_name="idvfc.csv", mime="text/csv") - """## Análisis de datos""" - """### Análisis exploratorio de datos""" - show_report = st.checkbox("Mostrar reporte") - if show_report: - st_profile_report(get_report(df)) - """### Datos a través del tiempo""" - - should_show_data_through_time = st.checkbox("Habilitar sección") - if should_show_data_through_time: - dfg = df.copy() - dfg = dfg.loc[dfg.index.repeat(df['Total'])].drop('Total', axis=1) - - # agrupación de tiempo - """#### Agrupación de tiempo""" - time_grouping = st.selectbox("Selecciona el tipo de agrupación de tiempo", - ["1M", "3M", "6M", "12M", "1Y", "2Y", "3Y", "5Y"]) - - time_offset_amount = int(re.search(r'\d+', time_grouping).group()) - time_offset_unit = re.search(r'[A-Z]', time_grouping).group() - - if time_offset_unit == 'M': - offset = pd.DateOffset(months=time_offset_amount) - end_date_offset = pd.DateOffset(years=0) - elif time_offset_unit == 'Y': - offset = pd.DateOffset(years=time_offset_amount) - end_date_offset = pd.DateOffset(years=1) - - if time_grouping: - if not should_filter_by_time: - min_date = df['Fecha'].min() - start_date = pd.to_datetime(min_date).date() - max_date = df['Fecha'].max() - end_date = pd.to_datetime(max_date).date() - f"""Fecha de inicio: {start_date} - Fecha de fin: {end_date}""" - end_date = end_date + pd.DateOffset(days=2) - f"""Fecha de inicio: {start_date} - Fecha de fin: {end_date}""" - ranges = [] - masks = [] - date_range = list( - pd.date_range(start=start_date - pd.DateOffset(days=start_date.day + 1), - end=end_date + end_date_offset, freq=time_grouping)) - # add 1 day to each date - date_range = [date + pd.DateOffset(days=1) for date in date_range] - for i in range(len(date_range)): - if i == 0: - continue - previous_date = date_range[i - 1] - current_date = date_range[i] - - ranges.append((previous_date, current_date)) - - mask = (df['Fecha'] >= previous_date) & (df['Fecha'] < current_date) - # check if the mask is empty if date is june 2023 - masks.append(mask) - - di = {} - maxes = [] - start = ranges[0][0] - end = start + offset - first_period = offset_label(start, end) - st.write(first_period) - for mask in masks: - df_mask = df.loc[mask] - d = df_mask.groupby('Entidad').sum('Total').reset_index() - # end should be the start + the time grouping - - end = start + offset - - period = offset_label(start, end) - - di[period] = [] - municipality_added = False - - for row in d.to_dict('records'): - if period == first_period: - di[period].append({ - 'Entidad': row['Entidad'], - period: row['Total'], - }) - - else: - di[period].append({ - period: row['Total'], - }) - - # d.to_csv('output/municipios/municipios_' + str(y) + '.csv', index=False) - - m = d.groupby('Entidad').sum()['Total'].max() - maxes.append(m) - start = end - - # db6.loc[masks[0]].groupby('Municipio').sum().to_csv('municipios_2018.csv', index=False) - dfs = [] - for y in di.keys(): - df1 = pd.DataFrame(di[y]) - dfs.append(df1) - # di[y] = df1 - - # join all the dataframes - start = ranges[0][0] - # end should be the start + the time grouping - end = start + offset - period = offset_label(start, end) - - # dfj = di[period] - # for y in di.keys(): - # if y == period: - # continue - # dfj = dfj.join(di[y]) - # substitut join with concat - dfj = pd.concat(dfs, axis=1) - dfj['Total'] = dfj.sum(axis=1, numeric_only=True) - # set the index to the municipality - - dfj.set_index('Entidad', inplace=True) - dfj = dfj.sort_values(by=['Total'], ascending=False) - dfj - # descarga de datos - st.download_button("Descarga tabla como CSV", data=df_to_csv(dfj, True), file_name="idvfc-por-tiempo.csv", - mime="text/csv") - - - # plot the data - """#### Incidencia delictiva por municipio""" - st.bar_chart(dfj) - transposed = dfj.copy() - transposed = transposed.drop(['Total'], axis=1) - transposed = transposed.T - - # convert the index to a datetime index - transposed_index = transposed.index - new_index = [] - # index is in format 'Mes Año' - # convert to datetime - for index_date in transposed_index: - month = index_date.split(' ')[0] - year = index_date.split(' ')[1] - new_index.append(pd.to_datetime(f'{year}-{month_to_num[month]}-15')) - - transposed.index = new_index - - # plot the data - """#### Incidencia delictiva a través del tiempo""" - st.bar_chart(transposed) - - - - - - - - -pages_names_to_functions = { - "Cifras de Incidencia Delictiva Municipal": idm, - "Cifras de Víctimas del Fuero Común": idvfc -} - -page = sidebar.selectbox("Selecciona el tipo de datos a procesar", tuple(pages_names_to_functions.keys())) - -pages_names_to_functions[page]() diff --git a/spaces/Realcat/image-matching-webui/third_party/DarkFeat/datasets/InvISP/model/utils.py b/spaces/Realcat/image-matching-webui/third_party/DarkFeat/datasets/InvISP/model/utils.py deleted file mode 100644 index a1ab33bf1ba26ee027e1c051f63b0a29fefe6706..0000000000000000000000000000000000000000 --- a/spaces/Realcat/image-matching-webui/third_party/DarkFeat/datasets/InvISP/model/utils.py +++ /dev/null @@ -1,48 +0,0 @@ -import math -import torch - - -def compute_same_pad(kernel_size, stride): - if isinstance(kernel_size, int): - kernel_size = [kernel_size] - - if isinstance(stride, int): - stride = [stride] - - assert len(stride) == len( - kernel_size - ), "Pass kernel size and stride both as int, or both as equal length iterable" - - return [((k - 1) * s + 1) // 2 for k, s in zip(kernel_size, stride)] - - -def uniform_binning_correction(x, n_bits=8): - """Replaces x^i with q^i(x) = U(x, x + 1.0 / 256.0). - - Args: - x: 4-D Tensor of shape (NCHW) - n_bits: optional. - Returns: - x: x ~ U(x, x + 1.0 / 256) - objective: Equivalent to -q(x)*log(q(x)). - """ - b, c, h, w = x.size() - n_bins = 2**n_bits - chw = c * h * w - x += torch.zeros_like(x).uniform_(0, 1.0 / n_bins) - - objective = -math.log(n_bins) * chw * torch.ones(b, device=x.device) - return x, objective - - -def split_feature(tensor, type="split"): - """ - type = ["split", "cross"] - """ - C = tensor.size(1) - if type == "split": - # return tensor[:, : C // 2, ...], tensor[:, C // 2 :, ...] - return tensor[:, :1, ...], tensor[:, 1:, ...] - elif type == "cross": - # return tensor[:, 0::2, ...], tensor[:, 1::2, ...] - return tensor[:, 0::2, ...], tensor[:, 1::2, ...] diff --git a/spaces/Redgon/bingo/src/components/markdown.tsx b/spaces/Redgon/bingo/src/components/markdown.tsx deleted file mode 100644 index d4491467a1f14d1d72e535caac9c40636054e5df..0000000000000000000000000000000000000000 --- a/spaces/Redgon/bingo/src/components/markdown.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { FC, memo } from 'react' -import ReactMarkdown, { Options } from 'react-markdown' - -export const MemoizedReactMarkdown: FC<Options> = memo( - ReactMarkdown, - (prevProps, nextProps) => - prevProps.children === nextProps.children && - prevProps.className === nextProps.className -) diff --git a/spaces/Reeve/Ohayou_Face/models/stylegan2/__init__.py b/spaces/Reeve/Ohayou_Face/models/stylegan2/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/spaces/Ridzuan/random_name_selector/app.py b/spaces/Ridzuan/random_name_selector/app.py deleted file mode 100644 index 324f620373135cdf6601e5a3dba9d3ce28d52988..0000000000000000000000000000000000000000 --- a/spaces/Ridzuan/random_name_selector/app.py +++ /dev/null @@ -1,34 +0,0 @@ -import streamlit as st -import pandas as pd -import random -import time - - -st.title('Random Name Selector 🫳🏻 (DAI 02)') -st.subheader('📈Presentation Time📉') - -if 'chosen' not in st.session_state: - st.session_state['chosen'] = {} - -if 'counter' not in st.session_state: - st.session_state['counter'] = 1 - -if 'names' not in st.session_state: - st.session_state['names'] = [] - -name = st.text_area('Please type in candidates names here').split(',') -st.session_state['names'] = name - -if st.button('🤞🏻Time to pick the lucky one🍀'): - with st.spinner(text='Picking in progress'): - time.sleep(5) - st.success('The lucky person is:') - - st.balloons() - temp_lis = set(st.session_state['names']) - set(pd.DataFrame(st.session_state.chosen,index=['Name']).T['Name']) - chosen = random.sample(list(temp_lis),1) - st.title(f'🥳{chosen[0]}🎉') - check ={st.session_state['counter']:chosen[0]} - st.session_state.chosen.update(check) - st.session_state['counter'] += 1 - st.dataframe(pd.DataFrame(st.session_state.chosen,index=['Past Lucky Ones']).T) diff --git a/spaces/Riksarkivet/htr_demo/helper/text/markdown_reader.py b/spaces/Riksarkivet/htr_demo/helper/text/markdown_reader.py deleted file mode 100644 index 556edf21ea73b47267a0385eed54503cc9743f92..0000000000000000000000000000000000000000 --- a/spaces/Riksarkivet/htr_demo/helper/text/markdown_reader.py +++ /dev/null @@ -1,5 +0,0 @@ -def read_markdown(file_path: str) -> str: - with open(file_path, "r") as file: - content = file.read() - - return f"""{content}""" diff --git a/spaces/Roboflow/HotDogGPT/app.py b/spaces/Roboflow/HotDogGPT/app.py deleted file mode 100644 index 1aa2aa5e2b6d0f2eb7bb8a99265877a268bc4b2e..0000000000000000000000000000000000000000 --- a/spaces/Roboflow/HotDogGPT/app.py +++ /dev/null @@ -1,117 +0,0 @@ -import base64 - -import cv2 -import gradio as gr -import numpy as np -import requests - -MARKDOWN = """ -# HotDogGPT 💬 + 🌭 - -HotDogGPT is OpenAI Vision API experiment reproducing the famous -[Hot Dog, Not Hot Dog](https://www.youtube.com/watch?v=ACmydtFDTGs) app from Silicon -Valley. - -<p align="center"> - <img width="600" src="https://miro.medium.com/v2/resize:fit:650/1*VrpXE1hE4rO1roK0laOd7g.png" alt="hotdog"> -</p> - -Visit [awesome-openai-vision-api-experiments](https://github.com/roboflow/awesome-openai-vision-api-experiments) -repository to find more OpenAI Vision API experiments or contribute your own. -""" -API_URL = "https://api.openai.com/v1/chat/completions" -CLASSES = ["🌭 Hot Dog", "❌ Not Hot Dog"] - - -def preprocess_image(image: np.ndarray) -> np.ndarray: - image = np.fliplr(image) - return cv2.cvtColor(image, cv2.COLOR_RGB2BGR) - - -def encode_image_to_base64(image: np.ndarray) -> str: - success, buffer = cv2.imencode('.jpg', image) - if not success: - raise ValueError("Could not encode image to JPEG format.") - - encoded_image = base64.b64encode(buffer).decode('utf-8') - return encoded_image - - -def compose_payload(image: np.ndarray, prompt: str) -> dict: - base64_image = encode_image_to_base64(image) - return { - "model": "gpt-4-vision-preview", - "messages": [ - { - "role": "user", - "content": [ - { - "type": "text", - "text": prompt - }, - { - "type": "image_url", - "image_url": { - "url": f"data:image/jpeg;base64,{base64_image}" - } - } - ] - } - ], - "max_tokens": 300 - } - - -def compose_classification_prompt(classes: list) -> str: - return (f"What is in the image? Return the class of the object in the image. Here " - f"are the classes: {', '.join(classes)}. You can only return one class " - f"from that list.") - - -def compose_headers(api_key: str) -> dict: - return { - "Content-Type": "application/json", - "Authorization": f"Bearer {api_key}" - } - - -def prompt_image(api_key: str, image: np.ndarray, prompt: str) -> str: - headers = compose_headers(api_key=api_key) - payload = compose_payload(image=image, prompt=prompt) - response = requests.post(url=API_URL, headers=headers, json=payload).json() - - if 'error' in response: - raise ValueError(response['error']['message']) - return response['choices'][0]['message']['content'] - - -def classify_image(api_key: str, image: np.ndarray) -> str: - if not api_key: - raise ValueError( - "API_KEY is not set. " - "Please follow the instructions in the README to set it up.") - image = preprocess_image(image=image) - prompt = compose_classification_prompt(classes=CLASSES) - response = prompt_image(api_key=api_key, image=image, prompt=prompt) - return response - - -with gr.Blocks() as demo: - gr.Markdown(MARKDOWN) - api_key_textbox = gr.Textbox( - label="🔑 OpenAI API", type="password") - - with gr.TabItem("Basic"): - with gr.Column(): - input_image = gr.Image( - image_mode='RGB', type='numpy', height=500) - output_text = gr.Textbox( - label="Output") - submit_button = gr.Button("Submit") - - submit_button.click( - fn=classify_image, - inputs=[api_key_textbox, input_image], - outputs=output_text) - -demo.launch(debug=False, show_error=True) diff --git a/spaces/Rongjiehuang/GenerSpeech/modules/parallel_wavegan/layers/pqmf.py b/spaces/Rongjiehuang/GenerSpeech/modules/parallel_wavegan/layers/pqmf.py deleted file mode 100644 index ac21074fd32a370a099fa2facb62cfd3253d7579..0000000000000000000000000000000000000000 --- a/spaces/Rongjiehuang/GenerSpeech/modules/parallel_wavegan/layers/pqmf.py +++ /dev/null @@ -1,129 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Tomoki Hayashi -# MIT License (https://opensource.org/licenses/MIT) - -"""Pseudo QMF modules.""" - -import numpy as np -import torch -import torch.nn.functional as F - -from scipy.signal import kaiser - - -def design_prototype_filter(taps=62, cutoff_ratio=0.15, beta=9.0): - """Design prototype filter for PQMF. - - This method is based on `A Kaiser window approach for the design of prototype - filters of cosine modulated filterbanks`_. - - Args: - taps (int): The number of filter taps. - cutoff_ratio (float): Cut-off frequency ratio. - beta (float): Beta coefficient for kaiser window. - - Returns: - ndarray: Impluse response of prototype filter (taps + 1,). - - .. _`A Kaiser window approach for the design of prototype filters of cosine modulated filterbanks`: - https://ieeexplore.ieee.org/abstract/document/681427 - - """ - # check the arguments are valid - assert taps % 2 == 0, "The number of taps mush be even number." - assert 0.0 < cutoff_ratio < 1.0, "Cutoff ratio must be > 0.0 and < 1.0." - - # make initial filter - omega_c = np.pi * cutoff_ratio - with np.errstate(invalid='ignore'): - h_i = np.sin(omega_c * (np.arange(taps + 1) - 0.5 * taps)) \ - / (np.pi * (np.arange(taps + 1) - 0.5 * taps)) - h_i[taps // 2] = np.cos(0) * cutoff_ratio # fix nan due to indeterminate form - - # apply kaiser window - w = kaiser(taps + 1, beta) - h = h_i * w - - return h - - -class PQMF(torch.nn.Module): - """PQMF module. - - This module is based on `Near-perfect-reconstruction pseudo-QMF banks`_. - - .. _`Near-perfect-reconstruction pseudo-QMF banks`: - https://ieeexplore.ieee.org/document/258122 - - """ - - def __init__(self, subbands=4, taps=62, cutoff_ratio=0.15, beta=9.0): - """Initilize PQMF module. - - Args: - subbands (int): The number of subbands. - taps (int): The number of filter taps. - cutoff_ratio (float): Cut-off frequency ratio. - beta (float): Beta coefficient for kaiser window. - - """ - super(PQMF, self).__init__() - - # define filter coefficient - h_proto = design_prototype_filter(taps, cutoff_ratio, beta) - h_analysis = np.zeros((subbands, len(h_proto))) - h_synthesis = np.zeros((subbands, len(h_proto))) - for k in range(subbands): - h_analysis[k] = 2 * h_proto * np.cos( - (2 * k + 1) * (np.pi / (2 * subbands)) * - (np.arange(taps + 1) - ((taps - 1) / 2)) + - (-1) ** k * np.pi / 4) - h_synthesis[k] = 2 * h_proto * np.cos( - (2 * k + 1) * (np.pi / (2 * subbands)) * - (np.arange(taps + 1) - ((taps - 1) / 2)) - - (-1) ** k * np.pi / 4) - - # convert to tensor - analysis_filter = torch.from_numpy(h_analysis).float().unsqueeze(1) - synthesis_filter = torch.from_numpy(h_synthesis).float().unsqueeze(0) - - # register coefficients as beffer - self.register_buffer("analysis_filter", analysis_filter) - self.register_buffer("synthesis_filter", synthesis_filter) - - # filter for downsampling & upsampling - updown_filter = torch.zeros((subbands, subbands, subbands)).float() - for k in range(subbands): - updown_filter[k, k, 0] = 1.0 - self.register_buffer("updown_filter", updown_filter) - self.subbands = subbands - - # keep padding info - self.pad_fn = torch.nn.ConstantPad1d(taps // 2, 0.0) - - def analysis(self, x): - """Analysis with PQMF. - - Args: - x (Tensor): Input tensor (B, 1, T). - - Returns: - Tensor: Output tensor (B, subbands, T // subbands). - - """ - x = F.conv1d(self.pad_fn(x), self.analysis_filter) - return F.conv1d(x, self.updown_filter, stride=self.subbands) - - def synthesis(self, x): - """Synthesis with PQMF. - - Args: - x (Tensor): Input tensor (B, subbands, T // subbands). - - Returns: - Tensor: Output tensor (B, 1, T). - - """ - x = F.conv_transpose1d(x, self.updown_filter * self.subbands, stride=self.subbands) - return F.conv1d(self.pad_fn(x), self.synthesis_filter) diff --git a/spaces/Rongjiehuang/GenerSpeech/utils/pl_utils.py b/spaces/Rongjiehuang/GenerSpeech/utils/pl_utils.py deleted file mode 100644 index ab99252faaa6ba0a74f20095f7ccb62f5391bde6..0000000000000000000000000000000000000000 --- a/spaces/Rongjiehuang/GenerSpeech/utils/pl_utils.py +++ /dev/null @@ -1,1618 +0,0 @@ -import matplotlib -from torch.nn import DataParallel -from torch.nn.parallel import DistributedDataParallel - -matplotlib.use('Agg') -import glob -import itertools -import subprocess -import threading -import traceback - -from pytorch_lightning.callbacks import GradientAccumulationScheduler -from pytorch_lightning.callbacks import ModelCheckpoint - -from functools import wraps -from torch.cuda._utils import _get_device_index -import numpy as np -import torch.optim -import torch.utils.data -import copy -import logging -import os -import re -import sys -import torch -import torch.distributed as dist -import torch.multiprocessing as mp -import tqdm -from torch.optim.optimizer import Optimizer - - -def get_a_var(obj): # pragma: no cover - if isinstance(obj, torch.Tensor): - return obj - - if isinstance(obj, list) or isinstance(obj, tuple): - for result in map(get_a_var, obj): - if isinstance(result, torch.Tensor): - return result - if isinstance(obj, dict): - for result in map(get_a_var, obj.items()): - if isinstance(result, torch.Tensor): - return result - return None - - -def data_loader(fn): - """ - Decorator to make any fx with this use the lazy property - :param fn: - :return: - """ - - wraps(fn) - attr_name = '_lazy_' + fn.__name__ - - def _get_data_loader(self): - try: - value = getattr(self, attr_name) - except AttributeError: - try: - value = fn(self) # Lazy evaluation, done only once. - if ( - value is not None and - not isinstance(value, list) and - fn.__name__ in ['test_dataloader', 'val_dataloader'] - ): - value = [value] - except AttributeError as e: - # Guard against AttributeError suppression. (Issue #142) - traceback.print_exc() - error = f'{fn.__name__}: An AttributeError was encountered: ' + str(e) - raise RuntimeError(error) from e - setattr(self, attr_name, value) # Memoize evaluation. - return value - - return _get_data_loader - - -def parallel_apply(modules, inputs, kwargs_tup=None, devices=None): # pragma: no cover - r"""Applies each `module` in :attr:`modules` in parallel on arguments - contained in :attr:`inputs` (positional) and :attr:`kwargs_tup` (keyword) - on each of :attr:`devices`. - - Args: - modules (Module): modules to be parallelized - inputs (tensor): inputs to the modules - devices (list of int or torch.device): CUDA devices - - :attr:`modules`, :attr:`inputs`, :attr:`kwargs_tup` (if given), and - :attr:`devices` (if given) should all have same length. Moreover, each - element of :attr:`inputs` can either be a single object as the only argument - to a module, or a collection of positional arguments. - """ - assert len(modules) == len(inputs) - if kwargs_tup is not None: - assert len(modules) == len(kwargs_tup) - else: - kwargs_tup = ({},) * len(modules) - if devices is not None: - assert len(modules) == len(devices) - else: - devices = [None] * len(modules) - devices = list(map(lambda x: _get_device_index(x, True), devices)) - lock = threading.Lock() - results = {} - grad_enabled = torch.is_grad_enabled() - - def _worker(i, module, input, kwargs, device=None): - torch.set_grad_enabled(grad_enabled) - if device is None: - device = get_a_var(input).get_device() - try: - with torch.cuda.device(device): - # this also avoids accidental slicing of `input` if it is a Tensor - if not isinstance(input, (list, tuple)): - input = (input,) - - # --------------- - # CHANGE - if module.training: - output = module.training_step(*input, **kwargs) - - elif module.testing: - output = module.test_step(*input, **kwargs) - - else: - output = module.validation_step(*input, **kwargs) - # --------------- - - with lock: - results[i] = output - except Exception as e: - with lock: - results[i] = e - - # make sure each module knows what training state it's in... - # fixes weird bug where copies are out of sync - root_m = modules[0] - for m in modules[1:]: - m.training = root_m.training - m.testing = root_m.testing - - if len(modules) > 1: - threads = [threading.Thread(target=_worker, - args=(i, module, input, kwargs, device)) - for i, (module, input, kwargs, device) in - enumerate(zip(modules, inputs, kwargs_tup, devices))] - - for thread in threads: - thread.start() - for thread in threads: - thread.join() - else: - _worker(0, modules[0], inputs[0], kwargs_tup[0], devices[0]) - - outputs = [] - for i in range(len(inputs)): - output = results[i] - if isinstance(output, Exception): - raise output - outputs.append(output) - return outputs - - -def _find_tensors(obj): # pragma: no cover - r""" - Recursively find all tensors contained in the specified object. - """ - if isinstance(obj, torch.Tensor): - return [obj] - if isinstance(obj, (list, tuple)): - return itertools.chain(*map(_find_tensors, obj)) - if isinstance(obj, dict): - return itertools.chain(*map(_find_tensors, obj.values())) - return [] - - -class DDP(DistributedDataParallel): - """ - Override the forward call in lightning so it goes to training and validation step respectively - """ - - def parallel_apply(self, replicas, inputs, kwargs): - return parallel_apply(replicas, inputs, kwargs, self.device_ids[:len(replicas)]) - - def forward(self, *inputs, **kwargs): # pragma: no cover - self._sync_params() - if self.device_ids: - inputs, kwargs = self.scatter(inputs, kwargs, self.device_ids) - if len(self.device_ids) == 1: - # -------------- - # LIGHTNING MOD - # -------------- - # normal - # output = self.module(*inputs[0], **kwargs[0]) - # lightning - if self.module.training: - output = self.module.training_step(*inputs[0], **kwargs[0]) - elif self.module.testing: - output = self.module.test_step(*inputs[0], **kwargs[0]) - else: - output = self.module.validation_step(*inputs[0], **kwargs[0]) - else: - outputs = self.parallel_apply(self._module_copies[:len(inputs)], inputs, kwargs) - output = self.gather(outputs, self.output_device) - else: - # normal - output = self.module(*inputs, **kwargs) - - if torch.is_grad_enabled(): - # We'll return the output object verbatim since it is a freeform - # object. We need to find any tensors in this object, though, - # because we need to figure out which parameters were used during - # this forward pass, to ensure we short circuit reduction for any - # unused parameters. Only if `find_unused_parameters` is set. - if self.find_unused_parameters: - self.reducer.prepare_for_backward(list(_find_tensors(output))) - else: - self.reducer.prepare_for_backward([]) - return output - - -class DP(DataParallel): - """ - Override the forward call in lightning so it goes to training and validation step respectively - """ - - def forward(self, *inputs, **kwargs): - if not self.device_ids: - return self.module(*inputs, **kwargs) - - for t in itertools.chain(self.module.parameters(), self.module.buffers()): - if t.device != self.src_device_obj: - raise RuntimeError("module must have its parameters and buffers " - "on device {} (device_ids[0]) but found one of " - "them on device: {}".format(self.src_device_obj, t.device)) - - inputs, kwargs = self.scatter(inputs, kwargs, self.device_ids) - if len(self.device_ids) == 1: - # lightning - if self.module.training: - return self.module.training_step(*inputs[0], **kwargs[0]) - elif self.module.testing: - return self.module.test_step(*inputs[0], **kwargs[0]) - else: - return self.module.validation_step(*inputs[0], **kwargs[0]) - - replicas = self.replicate(self.module, self.device_ids[:len(inputs)]) - outputs = self.parallel_apply(replicas, inputs, kwargs) - return self.gather(outputs, self.output_device) - - def parallel_apply(self, replicas, inputs, kwargs): - return parallel_apply(replicas, inputs, kwargs, self.device_ids[:len(replicas)]) - - -class GradientAccumulationScheduler: - def __init__(self, scheduling: dict): - if scheduling == {}: # empty dict error - raise TypeError("Empty dict cannot be interpreted correct") - - for key in scheduling.keys(): - if not isinstance(key, int) or not isinstance(scheduling[key], int): - raise TypeError("All epoches and accumulation factor must be integers") - - minimal_epoch = min(scheduling.keys()) - if minimal_epoch < 1: - msg = f"Epochs indexing from 1, epoch {minimal_epoch} cannot be interpreted correct" - raise IndexError(msg) - elif minimal_epoch != 1: # if user didnt define first epoch accumulation factor - scheduling.update({1: 1}) - - self.scheduling = scheduling - self.epochs = sorted(scheduling.keys()) - - def on_epoch_begin(self, epoch, trainer): - epoch += 1 # indexing epochs from 1 - for i in reversed(range(len(self.epochs))): - if epoch >= self.epochs[i]: - trainer.accumulate_grad_batches = self.scheduling.get(self.epochs[i]) - break - - -class LatestModelCheckpoint(ModelCheckpoint): - def __init__(self, filepath, monitor='val_loss', verbose=0, num_ckpt_keep=5, - save_weights_only=False, mode='auto', period=1, prefix='model', save_best=True): - super(ModelCheckpoint, self).__init__() - self.monitor = monitor - self.verbose = verbose - self.filepath = filepath - os.makedirs(filepath, exist_ok=True) - self.num_ckpt_keep = num_ckpt_keep - self.save_best = save_best - self.save_weights_only = save_weights_only - self.period = period - self.epochs_since_last_check = 0 - self.prefix = prefix - self.best_k_models = {} - # {filename: monitor} - self.kth_best_model = '' - self.save_top_k = 1 - self.task = None - if mode == 'min': - self.monitor_op = np.less - self.best = np.Inf - self.mode = 'min' - elif mode == 'max': - self.monitor_op = np.greater - self.best = -np.Inf - self.mode = 'max' - else: - if 'acc' in self.monitor or self.monitor.startswith('fmeasure'): - self.monitor_op = np.greater - self.best = -np.Inf - self.mode = 'max' - else: - self.monitor_op = np.less - self.best = np.Inf - self.mode = 'min' - if os.path.exists(f'{self.filepath}/best_valid.npy'): - self.best = np.load(f'{self.filepath}/best_valid.npy')[0] - - def get_all_ckpts(self): - return sorted(glob.glob(f'{self.filepath}/{self.prefix}_ckpt_steps_*.ckpt'), - key=lambda x: -int(re.findall('.*steps\_(\d+)\.ckpt', x)[0])) - - def on_epoch_end(self, epoch, logs=None): - logs = logs or {} - self.epochs_since_last_check += 1 - best_filepath = f'{self.filepath}/{self.prefix}_ckpt_best.pt' - if self.epochs_since_last_check >= self.period: - self.epochs_since_last_check = 0 - filepath = f'{self.filepath}/{self.prefix}_ckpt_steps_{self.task.global_step}.ckpt' - if self.verbose > 0: - logging.info(f'Epoch {epoch:05d}@{self.task.global_step}: saving model to {filepath}') - self._save_model(filepath) - for old_ckpt in self.get_all_ckpts()[self.num_ckpt_keep:]: - subprocess.check_call(f'rm -rf "{old_ckpt}"', shell=True) - if self.verbose > 0: - logging.info(f'Delete ckpt: {os.path.basename(old_ckpt)}') - current = logs.get(self.monitor) - if current is not None and self.save_best: - if self.monitor_op(current, self.best): - self.best = current - if self.verbose > 0: - logging.info( - f'Epoch {epoch:05d}@{self.task.global_step}: {self.monitor} reached' - f' {current:0.5f} (best {self.best:0.5f}), saving model to' - f' {best_filepath} as top 1') - self._save_model(best_filepath) - np.save(f'{self.filepath}/best_valid.npy', [self.best]) - - -class BaseTrainer: - def __init__( - self, - logger=True, - checkpoint_callback=True, - default_save_path=None, - gradient_clip_val=0, - process_position=0, - gpus=-1, - log_gpu_memory=None, - show_progress_bar=True, - track_grad_norm=-1, - check_val_every_n_epoch=1, - accumulate_grad_batches=1, - max_updates=1000, - min_epochs=1, - val_check_interval=1.0, - log_save_interval=100, - row_log_interval=10, - print_nan_grads=False, - weights_summary='full', - num_sanity_val_steps=5, - resume_from_checkpoint=None, - ): - self.log_gpu_memory = log_gpu_memory - self.gradient_clip_val = gradient_clip_val - self.check_val_every_n_epoch = check_val_every_n_epoch - self.track_grad_norm = track_grad_norm - self.on_gpu = True if (gpus and torch.cuda.is_available()) else False - self.process_position = process_position - self.weights_summary = weights_summary - self.max_updates = max_updates - self.min_epochs = min_epochs - self.num_sanity_val_steps = num_sanity_val_steps - self.print_nan_grads = print_nan_grads - self.resume_from_checkpoint = resume_from_checkpoint - self.default_save_path = default_save_path - - # training bookeeping - self.total_batch_idx = 0 - self.running_loss = [] - self.avg_loss = 0 - self.batch_idx = 0 - self.tqdm_metrics = {} - self.callback_metrics = {} - self.num_val_batches = 0 - self.num_training_batches = 0 - self.num_test_batches = 0 - self.get_train_dataloader = None - self.get_test_dataloaders = None - self.get_val_dataloaders = None - self.is_iterable_train_dataloader = False - - # training state - self.model = None - self.testing = False - self.disable_validation = False - self.lr_schedulers = [] - self.optimizers = None - self.global_step = 0 - self.current_epoch = 0 - self.total_batches = 0 - - # configure checkpoint callback - self.checkpoint_callback = checkpoint_callback - self.checkpoint_callback.save_function = self.save_checkpoint - self.weights_save_path = self.checkpoint_callback.filepath - - # accumulated grads - self.configure_accumulated_gradients(accumulate_grad_batches) - - # allow int, string and gpu list - self.data_parallel_device_ids = [ - int(x) for x in os.environ.get("CUDA_VISIBLE_DEVICES", "").split(",") if x != ''] - if len(self.data_parallel_device_ids) == 0: - self.root_gpu = None - self.on_gpu = False - else: - self.root_gpu = self.data_parallel_device_ids[0] - self.on_gpu = True - - # distributed backend choice - self.use_ddp = False - self.use_dp = False - self.single_gpu = False - self.distributed_backend = 'ddp' if self.num_gpus > 0 else 'dp' - self.set_distributed_mode(self.distributed_backend) - - self.proc_rank = 0 - self.world_size = 1 - self.node_rank = 0 - - # can't init progress bar here because starting a new process - # means the progress_bar won't survive pickling - self.show_progress_bar = show_progress_bar - - # logging - self.log_save_interval = log_save_interval - self.val_check_interval = val_check_interval - self.logger = logger - self.logger.rank = 0 - self.row_log_interval = row_log_interval - - @property - def num_gpus(self): - gpus = self.data_parallel_device_ids - if gpus is None: - return 0 - else: - return len(gpus) - - @property - def data_parallel(self): - return self.use_dp or self.use_ddp - - def get_model(self): - is_dp_module = isinstance(self.model, (DDP, DP)) - model = self.model.module if is_dp_module else self.model - return model - - # ----------------------------- - # MODEL TRAINING - # ----------------------------- - def fit(self, model): - if self.use_ddp: - mp.spawn(self.ddp_train, nprocs=self.num_gpus, args=(model,)) - else: - model.model = model.build_model() - if not self.testing: - self.optimizers, self.lr_schedulers = self.init_optimizers(model.configure_optimizers()) - if self.use_dp: - model.cuda(self.root_gpu) - model = DP(model, device_ids=self.data_parallel_device_ids) - elif self.single_gpu: - model.cuda(self.root_gpu) - self.run_pretrain_routine(model) - return 1 - - def init_optimizers(self, optimizers): - - # single optimizer - if isinstance(optimizers, Optimizer): - return [optimizers], [] - - # two lists - elif len(optimizers) == 2 and isinstance(optimizers[0], list): - optimizers, lr_schedulers = optimizers - return optimizers, lr_schedulers - - # single list or tuple - elif isinstance(optimizers, list) or isinstance(optimizers, tuple): - return optimizers, [] - - def run_pretrain_routine(self, model): - """Sanity check a few things before starting actual training. - - :param model: - """ - ref_model = model - if self.data_parallel: - ref_model = model.module - - # give model convenience properties - ref_model.trainer = self - - # set local properties on the model - self.copy_trainer_model_properties(ref_model) - - # link up experiment object - if self.logger is not None: - ref_model.logger = self.logger - self.logger.save() - - if self.use_ddp: - dist.barrier() - - # set up checkpoint callback - # self.configure_checkpoint_callback() - - # transfer data loaders from model - self.get_dataloaders(ref_model) - - # track model now. - # if cluster resets state, the model will update with the saved weights - self.model = model - - # restore training and model before hpc call - self.restore_weights(model) - - # when testing requested only run test and return - if self.testing: - self.run_evaluation(test=True) - return - - # check if we should run validation during training - self.disable_validation = self.num_val_batches == 0 - - # run tiny validation (if validation defined) - # to make sure program won't crash during val - ref_model.on_sanity_check_start() - ref_model.on_train_start() - if not self.disable_validation and self.num_sanity_val_steps > 0: - # init progress bars for validation sanity check - pbar = tqdm.tqdm(desc='Validation sanity check', - total=self.num_sanity_val_steps * len(self.get_val_dataloaders()), - leave=False, position=2 * self.process_position, - disable=not self.show_progress_bar, dynamic_ncols=True, unit='batch') - self.main_progress_bar = pbar - # dummy validation progress bar - self.val_progress_bar = tqdm.tqdm(disable=True) - - self.evaluate(model, self.get_val_dataloaders(), self.num_sanity_val_steps, self.testing) - - # close progress bars - self.main_progress_bar.close() - self.val_progress_bar.close() - - # init progress bar - pbar = tqdm.tqdm(leave=True, position=2 * self.process_position, - disable=not self.show_progress_bar, dynamic_ncols=True, unit='batch', - file=sys.stdout) - self.main_progress_bar = pbar - - # clear cache before training - if self.on_gpu: - torch.cuda.empty_cache() - - # CORE TRAINING LOOP - self.train() - - def test(self, model): - self.testing = True - self.fit(model) - - @property - def training_tqdm_dict(self): - tqdm_dict = { - 'step': '{}'.format(self.global_step), - } - tqdm_dict.update(self.tqdm_metrics) - return tqdm_dict - - # -------------------- - # restore ckpt - # -------------------- - def restore_weights(self, model): - """ - To restore weights we have two cases. - First, attempt to restore hpc weights. If successful, don't restore - other weights. - - Otherwise, try to restore actual weights - :param model: - :return: - """ - # clear cache before restore - if self.on_gpu: - torch.cuda.empty_cache() - - if self.resume_from_checkpoint is not None: - self.restore(self.resume_from_checkpoint, on_gpu=self.on_gpu) - else: - # restore weights if same exp version - self.restore_state_if_checkpoint_exists(model) - - # wait for all model to restore weights - if self.use_ddp: - # wait for all processes to catch up - dist.barrier() - - # clear cache after restore - if self.on_gpu: - torch.cuda.empty_cache() - - def restore_state_if_checkpoint_exists(self, model): - did_restore = False - - # do nothing if there's not dir or callback - no_ckpt_callback = (self.checkpoint_callback is None) or (not self.checkpoint_callback) - if no_ckpt_callback or not os.path.exists(self.checkpoint_callback.filepath): - return did_restore - - # restore trainer state and model if there is a weight for this experiment - last_steps = -1 - last_ckpt_name = None - - # find last epoch - checkpoints = os.listdir(self.checkpoint_callback.filepath) - for name in checkpoints: - if '.ckpt' in name and not name.endswith('part'): - if 'steps_' in name: - steps = name.split('steps_')[1] - steps = int(re.sub('[^0-9]', '', steps)) - - if steps > last_steps: - last_steps = steps - last_ckpt_name = name - - # restore last checkpoint - if last_ckpt_name is not None: - last_ckpt_path = os.path.join(self.checkpoint_callback.filepath, last_ckpt_name) - self.restore(last_ckpt_path, self.on_gpu) - logging.info(f'model and trainer restored from checkpoint: {last_ckpt_path}') - did_restore = True - - return did_restore - - def restore(self, checkpoint_path, on_gpu): - checkpoint = torch.load(checkpoint_path, map_location='cpu') - - # load model state - model = self.get_model() - - # load the state_dict on the model automatically - model.load_state_dict(checkpoint['state_dict'], strict=False) - if on_gpu: - model.cuda(self.root_gpu) - # load training state (affects trainer only) - self.restore_training_state(checkpoint) - model.global_step = self.global_step - del checkpoint - - try: - if dist.is_initialized() and dist.get_rank() > 0: - return - except Exception as e: - print(e) - return - - def restore_training_state(self, checkpoint): - """ - Restore trainer state. - Model will get its change to update - :param checkpoint: - :return: - """ - if self.checkpoint_callback is not None and self.checkpoint_callback is not False: - self.checkpoint_callback.best = checkpoint['checkpoint_callback_best'] - - self.global_step = checkpoint['global_step'] - self.current_epoch = checkpoint['epoch'] - - if self.testing: - return - - # restore the optimizers - optimizer_states = checkpoint['optimizer_states'] - for optimizer, opt_state in zip(self.optimizers, optimizer_states): - if optimizer is None: - return - optimizer.load_state_dict(opt_state) - - # move optimizer to GPU 1 weight at a time - # avoids OOM - if self.root_gpu is not None: - for state in optimizer.state.values(): - for k, v in state.items(): - if isinstance(v, torch.Tensor): - state[k] = v.cuda(self.root_gpu) - - # restore the lr schedulers - lr_schedulers = checkpoint['lr_schedulers'] - for scheduler, lrs_state in zip(self.lr_schedulers, lr_schedulers): - scheduler.load_state_dict(lrs_state) - - # -------------------- - # MODEL SAVE CHECKPOINT - # -------------------- - def _atomic_save(self, checkpoint, filepath): - """Saves a checkpoint atomically, avoiding the creation of incomplete checkpoints. - - This will create a temporary checkpoint with a suffix of ``.part``, then copy it to the final location once - saving is finished. - - Args: - checkpoint (object): The object to save. - Built to be used with the ``dump_checkpoint`` method, but can deal with anything which ``torch.save`` - accepts. - filepath (str|pathlib.Path): The path to which the checkpoint will be saved. - This points to the file that the checkpoint will be stored in. - """ - tmp_path = str(filepath) + ".part" - torch.save(checkpoint, tmp_path) - os.replace(tmp_path, filepath) - - def save_checkpoint(self, filepath): - checkpoint = self.dump_checkpoint() - self._atomic_save(checkpoint, filepath) - - def dump_checkpoint(self): - - checkpoint = { - 'epoch': self.current_epoch, - 'global_step': self.global_step - } - - if self.checkpoint_callback is not None and self.checkpoint_callback is not False: - checkpoint['checkpoint_callback_best'] = self.checkpoint_callback.best - - # save optimizers - optimizer_states = [] - for i, optimizer in enumerate(self.optimizers): - if optimizer is not None: - optimizer_states.append(optimizer.state_dict()) - - checkpoint['optimizer_states'] = optimizer_states - - # save lr schedulers - lr_schedulers = [] - for i, scheduler in enumerate(self.lr_schedulers): - lr_schedulers.append(scheduler.state_dict()) - - checkpoint['lr_schedulers'] = lr_schedulers - - # add the hparams and state_dict from the model - model = self.get_model() - checkpoint['state_dict'] = model.state_dict() - # give the model a chance to add a few things - model.on_save_checkpoint(checkpoint) - - return checkpoint - - def copy_trainer_model_properties(self, model): - if isinstance(model, DP): - ref_model = model.module - elif isinstance(model, DDP): - ref_model = model.module - else: - ref_model = model - - for m in [model, ref_model]: - m.trainer = self - m.on_gpu = self.on_gpu - m.use_dp = self.use_dp - m.use_ddp = self.use_ddp - m.testing = self.testing - m.single_gpu = self.single_gpu - - def transfer_batch_to_gpu(self, batch, gpu_id): - # base case: object can be directly moved using `cuda` or `to` - if callable(getattr(batch, 'cuda', None)): - return batch.cuda(gpu_id, non_blocking=True) - - elif callable(getattr(batch, 'to', None)): - return batch.to(torch.device('cuda', gpu_id), non_blocking=True) - - # when list - elif isinstance(batch, list): - for i, x in enumerate(batch): - batch[i] = self.transfer_batch_to_gpu(x, gpu_id) - return batch - - # when tuple - elif isinstance(batch, tuple): - batch = list(batch) - for i, x in enumerate(batch): - batch[i] = self.transfer_batch_to_gpu(x, gpu_id) - return tuple(batch) - - # when dict - elif isinstance(batch, dict): - for k, v in batch.items(): - batch[k] = self.transfer_batch_to_gpu(v, gpu_id) - - return batch - - # nothing matches, return the value as is without transform - return batch - - def set_distributed_mode(self, distributed_backend): - # skip for CPU - if self.num_gpus == 0: - return - - # single GPU case - # in single gpu case we allow ddp so we can train on multiple - # nodes, 1 gpu per node - elif self.num_gpus == 1: - self.single_gpu = True - self.use_dp = False - self.use_ddp = False - self.root_gpu = 0 - self.data_parallel_device_ids = [0] - else: - if distributed_backend is not None: - self.use_dp = distributed_backend == 'dp' - self.use_ddp = distributed_backend == 'ddp' - elif distributed_backend is None: - self.use_dp = True - self.use_ddp = False - - logging.info(f'gpu available: {torch.cuda.is_available()}, used: {self.on_gpu}') - - def ddp_train(self, gpu_idx, model): - """ - Entry point into a DP thread - :param gpu_idx: - :param model: - :param cluster_obj: - :return: - """ - # otherwise default to node rank 0 - self.node_rank = 0 - - # show progressbar only on progress_rank 0 - self.show_progress_bar = self.show_progress_bar and self.node_rank == 0 and gpu_idx == 0 - - # determine which process we are and world size - if self.use_ddp: - self.proc_rank = self.node_rank * self.num_gpus + gpu_idx - self.world_size = self.num_gpus - - # let the exp know the rank to avoid overwriting logs - if self.logger is not None: - self.logger.rank = self.proc_rank - - # set up server using proc 0's ip address - # try to init for 20 times at max in case ports are taken - # where to store ip_table - model.trainer = self - model.init_ddp_connection(self.proc_rank, self.world_size) - - # CHOOSE OPTIMIZER - # allow for lr schedulers as well - model.model = model.build_model() - if not self.testing: - self.optimizers, self.lr_schedulers = self.init_optimizers(model.configure_optimizers()) - - # MODEL - # copy model to each gpu - if self.distributed_backend == 'ddp': - torch.cuda.set_device(gpu_idx) - model.cuda(gpu_idx) - - # set model properties before going into wrapper - self.copy_trainer_model_properties(model) - - # override root GPU - self.root_gpu = gpu_idx - - if self.distributed_backend == 'ddp': - device_ids = [gpu_idx] - else: - device_ids = None - - # allow user to configure ddp - model = model.configure_ddp(model, device_ids) - - # continue training routine - self.run_pretrain_routine(model) - - def resolve_root_node_address(self, root_node): - if '[' in root_node: - name = root_node.split('[')[0] - number = root_node.split(',')[0] - if '-' in number: - number = number.split('-')[0] - - number = re.sub('[^0-9]', '', number) - root_node = name + number - - return root_node - - def log_metrics(self, metrics, grad_norm_dic, step=None): - """Logs the metric dict passed in. - - :param metrics: - :param grad_norm_dic: - """ - # added metrics by Lightning for convenience - metrics['epoch'] = self.current_epoch - - # add norms - metrics.update(grad_norm_dic) - - # turn all tensors to scalars - scalar_metrics = self.metrics_to_scalars(metrics) - - step = step if step is not None else self.global_step - # log actual metrics - if self.proc_rank == 0 and self.logger is not None: - self.logger.log_metrics(scalar_metrics, step=step) - self.logger.save() - - def add_tqdm_metrics(self, metrics): - for k, v in metrics.items(): - if type(v) is torch.Tensor: - v = v.item() - - self.tqdm_metrics[k] = v - - def metrics_to_scalars(self, metrics): - new_metrics = {} - for k, v in metrics.items(): - if isinstance(v, torch.Tensor): - v = v.item() - - if type(v) is dict: - v = self.metrics_to_scalars(v) - - new_metrics[k] = v - - return new_metrics - - def process_output(self, output, train=False): - """Reduces output according to the training mode. - - Separates loss from logging and tqdm metrics - :param output: - :return: - """ - # --------------- - # EXTRACT CALLBACK KEYS - # --------------- - # all keys not progress_bar or log are candidates for callbacks - callback_metrics = {} - for k, v in output.items(): - if k not in ['progress_bar', 'log', 'hiddens']: - callback_metrics[k] = v - - if train and self.use_dp: - num_gpus = self.num_gpus - callback_metrics = self.reduce_distributed_output(callback_metrics, num_gpus) - - for k, v in callback_metrics.items(): - if isinstance(v, torch.Tensor): - callback_metrics[k] = v.item() - - # --------------- - # EXTRACT PROGRESS BAR KEYS - # --------------- - try: - progress_output = output['progress_bar'] - - # reduce progress metrics for tqdm when using dp - if train and self.use_dp: - num_gpus = self.num_gpus - progress_output = self.reduce_distributed_output(progress_output, num_gpus) - - progress_bar_metrics = progress_output - except Exception: - progress_bar_metrics = {} - - # --------------- - # EXTRACT LOGGING KEYS - # --------------- - # extract metrics to log to experiment - try: - log_output = output['log'] - - # reduce progress metrics for tqdm when using dp - if train and self.use_dp: - num_gpus = self.num_gpus - log_output = self.reduce_distributed_output(log_output, num_gpus) - - log_metrics = log_output - except Exception: - log_metrics = {} - - # --------------- - # EXTRACT LOSS - # --------------- - # if output dict doesn't have the keyword loss - # then assume the output=loss if scalar - loss = None - if train: - try: - loss = output['loss'] - except Exception: - if type(output) is torch.Tensor: - loss = output - else: - raise RuntimeError( - 'No `loss` value in the dictionary returned from `model.training_step()`.' - ) - - # when using dp need to reduce the loss - if self.use_dp: - loss = self.reduce_distributed_output(loss, self.num_gpus) - - # --------------- - # EXTRACT HIDDEN - # --------------- - hiddens = output.get('hiddens') - - # use every metric passed in as a candidate for callback - callback_metrics.update(progress_bar_metrics) - callback_metrics.update(log_metrics) - - # convert tensors to numpy - for k, v in callback_metrics.items(): - if isinstance(v, torch.Tensor): - callback_metrics[k] = v.item() - - return loss, progress_bar_metrics, log_metrics, callback_metrics, hiddens - - def reduce_distributed_output(self, output, num_gpus): - if num_gpus <= 1: - return output - - # when using DP, we get one output per gpu - # average outputs and return - if type(output) is torch.Tensor: - return output.mean() - - for k, v in output.items(): - # recurse on nested dics - if isinstance(output[k], dict): - output[k] = self.reduce_distributed_output(output[k], num_gpus) - - # do nothing when there's a scalar - elif isinstance(output[k], torch.Tensor) and output[k].dim() == 0: - pass - - # reduce only metrics that have the same number of gpus - elif output[k].size(0) == num_gpus: - reduced = torch.mean(output[k]) - output[k] = reduced - return output - - def clip_gradients(self): - if self.gradient_clip_val > 0: - model = self.get_model() - torch.nn.utils.clip_grad_norm_(model.parameters(), self.gradient_clip_val) - - def print_nan_gradients(self): - model = self.get_model() - for param in model.parameters(): - if (param.grad is not None) and torch.isnan(param.grad.float()).any(): - logging.info(param, param.grad) - - def configure_accumulated_gradients(self, accumulate_grad_batches): - self.accumulate_grad_batches = None - - if isinstance(accumulate_grad_batches, dict): - self.accumulation_scheduler = GradientAccumulationScheduler(accumulate_grad_batches) - elif isinstance(accumulate_grad_batches, int): - schedule = {1: accumulate_grad_batches} - self.accumulation_scheduler = GradientAccumulationScheduler(schedule) - else: - raise TypeError("Gradient accumulation supports only int and dict types") - - def get_dataloaders(self, model): - if not self.testing: - self.init_train_dataloader(model) - self.init_val_dataloader(model) - else: - self.init_test_dataloader(model) - - if self.use_ddp: - dist.barrier() - if not self.testing: - self.get_train_dataloader() - self.get_val_dataloaders() - else: - self.get_test_dataloaders() - - def init_train_dataloader(self, model): - self.fisrt_epoch = True - self.get_train_dataloader = model.train_dataloader - if isinstance(self.get_train_dataloader(), torch.utils.data.DataLoader): - self.num_training_batches = len(self.get_train_dataloader()) - self.num_training_batches = int(self.num_training_batches) - else: - self.num_training_batches = float('inf') - self.is_iterable_train_dataloader = True - if isinstance(self.val_check_interval, int): - self.val_check_batch = self.val_check_interval - else: - self._percent_range_check('val_check_interval') - self.val_check_batch = int(self.num_training_batches * self.val_check_interval) - self.val_check_batch = max(1, self.val_check_batch) - - def init_val_dataloader(self, model): - self.get_val_dataloaders = model.val_dataloader - self.num_val_batches = 0 - if self.get_val_dataloaders() is not None: - if isinstance(self.get_val_dataloaders()[0], torch.utils.data.DataLoader): - self.num_val_batches = sum(len(dataloader) for dataloader in self.get_val_dataloaders()) - self.num_val_batches = int(self.num_val_batches) - else: - self.num_val_batches = float('inf') - - def init_test_dataloader(self, model): - self.get_test_dataloaders = model.test_dataloader - if self.get_test_dataloaders() is not None: - if isinstance(self.get_test_dataloaders()[0], torch.utils.data.DataLoader): - self.num_test_batches = sum(len(dataloader) for dataloader in self.get_test_dataloaders()) - self.num_test_batches = int(self.num_test_batches) - else: - self.num_test_batches = float('inf') - - def evaluate(self, model, dataloaders, max_batches, test=False): - """Run evaluation code. - - :param model: PT model - :param dataloaders: list of PT dataloaders - :param max_batches: Scalar - :param test: boolean - :return: - """ - # enable eval mode - model.zero_grad() - model.eval() - - # copy properties for forward overrides - self.copy_trainer_model_properties(model) - - # disable gradients to save memory - torch.set_grad_enabled(False) - - if test: - self.get_model().test_start() - # bookkeeping - outputs = [] - - # run training - for dataloader_idx, dataloader in enumerate(dataloaders): - dl_outputs = [] - for batch_idx, batch in enumerate(dataloader): - - if batch is None: # pragma: no cover - continue - - # stop short when on fast_dev_run (sets max_batch=1) - if batch_idx >= max_batches: - break - - # ----------------- - # RUN EVALUATION STEP - # ----------------- - output = self.evaluation_forward(model, - batch, - batch_idx, - dataloader_idx, - test) - - # track outputs for collation - dl_outputs.append(output) - - # batch done - if test: - self.test_progress_bar.update(1) - else: - self.val_progress_bar.update(1) - outputs.append(dl_outputs) - - # with a single dataloader don't pass an array - if len(dataloaders) == 1: - outputs = outputs[0] - - # give model a chance to do something with the outputs (and method defined) - model = self.get_model() - if test: - eval_results_ = model.test_end(outputs) - else: - eval_results_ = model.validation_end(outputs) - eval_results = eval_results_ - - # enable train mode again - model.train() - - # enable gradients to save memory - torch.set_grad_enabled(True) - - return eval_results - - def run_evaluation(self, test=False): - # when testing make sure user defined a test step - model = self.get_model() - model.on_pre_performance_check() - - # select dataloaders - if test: - dataloaders = self.get_test_dataloaders() - max_batches = self.num_test_batches - else: - # val - dataloaders = self.get_val_dataloaders() - max_batches = self.num_val_batches - - # init validation or test progress bar - # main progress bar will already be closed when testing so initial position is free - position = 2 * self.process_position + (not test) - desc = 'Testing' if test else 'Validating' - pbar = tqdm.tqdm(desc=desc, total=max_batches, leave=test, position=position, - disable=not self.show_progress_bar, dynamic_ncols=True, - unit='batch', file=sys.stdout) - setattr(self, f'{"test" if test else "val"}_progress_bar', pbar) - - # run evaluation - eval_results = self.evaluate(self.model, - dataloaders, - max_batches, - test) - if eval_results is not None: - _, prog_bar_metrics, log_metrics, callback_metrics, _ = self.process_output( - eval_results) - - # add metrics to prog bar - self.add_tqdm_metrics(prog_bar_metrics) - - # log metrics - self.log_metrics(log_metrics, {}) - - # track metrics for callbacks - self.callback_metrics.update(callback_metrics) - - # hook - model.on_post_performance_check() - - # add model specific metrics - tqdm_metrics = self.training_tqdm_dict - if not test: - self.main_progress_bar.set_postfix(**tqdm_metrics) - - # close progress bar - if test: - self.test_progress_bar.close() - else: - self.val_progress_bar.close() - - # model checkpointing - if self.proc_rank == 0 and self.checkpoint_callback is not None and not test: - self.checkpoint_callback.on_epoch_end(epoch=self.current_epoch, - logs=self.callback_metrics) - - def evaluation_forward(self, model, batch, batch_idx, dataloader_idx, test=False): - # make dataloader_idx arg in validation_step optional - args = [batch, batch_idx] - - if test and len(self.get_test_dataloaders()) > 1: - args.append(dataloader_idx) - - elif not test and len(self.get_val_dataloaders()) > 1: - args.append(dataloader_idx) - - # handle DP, DDP forward - if self.use_ddp or self.use_dp: - output = model(*args) - return output - - # single GPU - if self.single_gpu: - # for single GPU put inputs on gpu manually - root_gpu = 0 - if isinstance(self.data_parallel_device_ids, list): - root_gpu = self.data_parallel_device_ids[0] - batch = self.transfer_batch_to_gpu(batch, root_gpu) - args[0] = batch - - # CPU - if test: - output = model.test_step(*args) - else: - output = model.validation_step(*args) - - return output - - def train(self): - model = self.get_model() - # run all epochs - for epoch in range(self.current_epoch, 1000000): - # set seed for distributed sampler (enables shuffling for each epoch) - if self.use_ddp and hasattr(self.get_train_dataloader().sampler, 'set_epoch'): - self.get_train_dataloader().sampler.set_epoch(epoch) - - # get model - model = self.get_model() - - # update training progress in trainer and model - model.current_epoch = epoch - self.current_epoch = epoch - - total_val_batches = 0 - if not self.disable_validation: - # val can be checked multiple times in epoch - is_val_epoch = (self.current_epoch + 1) % self.check_val_every_n_epoch == 0 - val_checks_per_epoch = self.num_training_batches // self.val_check_batch - val_checks_per_epoch = val_checks_per_epoch if is_val_epoch else 0 - total_val_batches = self.num_val_batches * val_checks_per_epoch - - # total batches includes multiple val checks - self.total_batches = self.num_training_batches + total_val_batches - self.batch_loss_value = 0 # accumulated grads - - if self.is_iterable_train_dataloader: - # for iterable train loader, the progress bar never ends - num_iterations = None - else: - num_iterations = self.total_batches - - # reset progress bar - # .reset() doesn't work on disabled progress bar so we should check - desc = f'Epoch {epoch + 1}' if not self.is_iterable_train_dataloader else '' - self.main_progress_bar.set_description(desc) - - # changing gradient according accumulation_scheduler - self.accumulation_scheduler.on_epoch_begin(epoch, self) - - # ----------------- - # RUN TNG EPOCH - # ----------------- - self.run_training_epoch() - - # update LR schedulers - if self.lr_schedulers is not None: - for lr_scheduler in self.lr_schedulers: - lr_scheduler.step(epoch=self.current_epoch) - - self.main_progress_bar.close() - - model.on_train_end() - - if self.logger is not None: - self.logger.finalize("success") - - def run_training_epoch(self): - # before epoch hook - if self.is_function_implemented('on_epoch_start'): - model = self.get_model() - model.on_epoch_start() - - # run epoch - for batch_idx, batch in enumerate(self.get_train_dataloader()): - # stop epoch if we limited the number of training batches - if batch_idx >= self.num_training_batches: - break - - self.batch_idx = batch_idx - - model = self.get_model() - model.global_step = self.global_step - - # --------------- - # RUN TRAIN STEP - # --------------- - output = self.run_training_batch(batch, batch_idx) - batch_result, grad_norm_dic, batch_step_metrics = output - - # when returning -1 from train_step, we end epoch early - early_stop_epoch = batch_result == -1 - - # --------------- - # RUN VAL STEP - # --------------- - should_check_val = ( - not self.disable_validation and self.global_step % self.val_check_batch == 0 and not self.fisrt_epoch) - self.fisrt_epoch = False - - if should_check_val: - self.run_evaluation(test=self.testing) - - # when logs should be saved - should_save_log = (batch_idx + 1) % self.log_save_interval == 0 or early_stop_epoch - if should_save_log: - if self.proc_rank == 0 and self.logger is not None: - self.logger.save() - - # when metrics should be logged - should_log_metrics = batch_idx % self.row_log_interval == 0 or early_stop_epoch - if should_log_metrics: - # logs user requested information to logger - self.log_metrics(batch_step_metrics, grad_norm_dic) - - self.global_step += 1 - self.total_batch_idx += 1 - - # end epoch early - # stop when the flag is changed or we've gone past the amount - # requested in the batches - if early_stop_epoch: - break - if self.global_step > self.max_updates: - print("| Training end..") - exit() - - # epoch end hook - if self.is_function_implemented('on_epoch_end'): - model = self.get_model() - model.on_epoch_end() - - def run_training_batch(self, batch, batch_idx): - # track grad norms - grad_norm_dic = {} - - # track all metrics for callbacks - all_callback_metrics = [] - - # track metrics to log - all_log_metrics = [] - - if batch is None: - return 0, grad_norm_dic, {} - - # hook - if self.is_function_implemented('on_batch_start'): - model_ref = self.get_model() - response = model_ref.on_batch_start(batch) - - if response == -1: - return -1, grad_norm_dic, {} - - splits = [batch] - self.hiddens = None - for split_idx, split_batch in enumerate(splits): - self.split_idx = split_idx - - # call training_step once per optimizer - for opt_idx, optimizer in enumerate(self.optimizers): - if optimizer is None: - continue - # make sure only the gradients of the current optimizer's paramaters are calculated - # in the training step to prevent dangling gradients in multiple-optimizer setup. - if len(self.optimizers) > 1: - for param in self.get_model().parameters(): - param.requires_grad = False - for group in optimizer.param_groups: - for param in group['params']: - param.requires_grad = True - - # wrap the forward step in a closure so second order methods work - def optimizer_closure(): - # forward pass - output = self.training_forward( - split_batch, batch_idx, opt_idx, self.hiddens) - - closure_loss = output[0] - progress_bar_metrics = output[1] - log_metrics = output[2] - callback_metrics = output[3] - self.hiddens = output[4] - if closure_loss is None: - return None - - # accumulate loss - # (if accumulate_grad_batches = 1 no effect) - closure_loss = closure_loss / self.accumulate_grad_batches - - # backward pass - model_ref = self.get_model() - if closure_loss.requires_grad: - model_ref.backward(closure_loss, optimizer) - - # track metrics for callbacks - all_callback_metrics.append(callback_metrics) - - # track progress bar metrics - self.add_tqdm_metrics(progress_bar_metrics) - all_log_metrics.append(log_metrics) - - # insert after step hook - if self.is_function_implemented('on_after_backward'): - model_ref = self.get_model() - model_ref.on_after_backward() - - return closure_loss - - # calculate loss - loss = optimizer_closure() - if loss is None: - continue - - # nan grads - if self.print_nan_grads: - self.print_nan_gradients() - - # track total loss for logging (avoid mem leaks) - self.batch_loss_value += loss.item() - - # gradient update with accumulated gradients - if (self.batch_idx + 1) % self.accumulate_grad_batches == 0: - - # track gradient norms when requested - if batch_idx % self.row_log_interval == 0: - if self.track_grad_norm > 0: - model = self.get_model() - grad_norm_dic = model.grad_norm( - self.track_grad_norm) - - # clip gradients - self.clip_gradients() - - # calls .step(), .zero_grad() - # override function to modify this behavior - model = self.get_model() - model.optimizer_step(self.current_epoch, batch_idx, optimizer, opt_idx) - - # calculate running loss for display - self.running_loss.append(self.batch_loss_value) - self.batch_loss_value = 0 - self.avg_loss = np.mean(self.running_loss[-100:]) - - # activate batch end hook - if self.is_function_implemented('on_batch_end'): - model = self.get_model() - model.on_batch_end() - - # update progress bar - self.main_progress_bar.update(1) - self.main_progress_bar.set_postfix(**self.training_tqdm_dict) - - # collapse all metrics into one dict - all_log_metrics = {k: v for d in all_log_metrics for k, v in d.items()} - - # track all metrics for callbacks - self.callback_metrics.update({k: v for d in all_callback_metrics for k, v in d.items()}) - - return 0, grad_norm_dic, all_log_metrics - - def training_forward(self, batch, batch_idx, opt_idx, hiddens): - """ - Handle forward for each training case (distributed, single gpu, etc...) - :param batch: - :param batch_idx: - :return: - """ - # --------------- - # FORWARD - # --------------- - # enable not needing to add opt_idx to training_step - args = [batch, batch_idx, opt_idx] - - # distributed forward - if self.use_ddp or self.use_dp: - output = self.model(*args) - # single GPU forward - elif self.single_gpu: - gpu_id = 0 - if isinstance(self.data_parallel_device_ids, list): - gpu_id = self.data_parallel_device_ids[0] - batch = self.transfer_batch_to_gpu(copy.copy(batch), gpu_id) - args[0] = batch - output = self.model.training_step(*args) - # CPU forward - else: - output = self.model.training_step(*args) - - # allow any mode to define training_end - model_ref = self.get_model() - output_ = model_ref.training_end(output) - if output_ is not None: - output = output_ - - # format and reduce outputs accordingly - output = self.process_output(output, train=True) - - return output - - # --------------- - # Utils - # --------------- - def is_function_implemented(self, f_name): - model = self.get_model() - f_op = getattr(model, f_name, None) - return callable(f_op) - - def _percent_range_check(self, name): - value = getattr(self, name) - msg = f"`{name}` must lie in the range [0.0, 1.0], but got {value:.3f}." - if name == "val_check_interval": - msg += " If you want to disable validation set `val_percent_check` to 0.0 instead." - - if not 0. <= value <= 1.: - raise ValueError(msg) diff --git a/spaces/Ryzal/rvc-models-new/lib/infer_pack/modules.py b/spaces/Ryzal/rvc-models-new/lib/infer_pack/modules.py deleted file mode 100644 index c83289df7c79a4810dacd15c050148544ba0b6a9..0000000000000000000000000000000000000000 --- a/spaces/Ryzal/rvc-models-new/lib/infer_pack/modules.py +++ /dev/null @@ -1,522 +0,0 @@ -import copy -import math -import numpy as np -import scipy -import torch -from torch import nn -from torch.nn import functional as F - -from torch.nn import Conv1d, ConvTranspose1d, AvgPool1d, Conv2d -from torch.nn.utils import weight_norm, remove_weight_norm - -from lib.infer_pack import commons -from lib.infer_pack.commons import init_weights, get_padding -from lib.infer_pack.transforms import piecewise_rational_quadratic_transform - - -LRELU_SLOPE = 0.1 - - -class LayerNorm(nn.Module): - def __init__(self, channels, eps=1e-5): - super().__init__() - self.channels = channels - self.eps = eps - - self.gamma = nn.Parameter(torch.ones(channels)) - self.beta = nn.Parameter(torch.zeros(channels)) - - def forward(self, x): - x = x.transpose(1, -1) - x = F.layer_norm(x, (self.channels,), self.gamma, self.beta, self.eps) - return x.transpose(1, -1) - - -class ConvReluNorm(nn.Module): - def __init__( - self, - in_channels, - hidden_channels, - out_channels, - kernel_size, - n_layers, - p_dropout, - ): - super().__init__() - self.in_channels = in_channels - self.hidden_channels = hidden_channels - self.out_channels = out_channels - self.kernel_size = kernel_size - self.n_layers = n_layers - self.p_dropout = p_dropout - assert n_layers > 1, "Number of layers should be larger than 0." - - self.conv_layers = nn.ModuleList() - self.norm_layers = nn.ModuleList() - self.conv_layers.append( - nn.Conv1d( - in_channels, hidden_channels, kernel_size, padding=kernel_size // 2 - ) - ) - self.norm_layers.append(LayerNorm(hidden_channels)) - self.relu_drop = nn.Sequential(nn.ReLU(), nn.Dropout(p_dropout)) - for _ in range(n_layers - 1): - self.conv_layers.append( - nn.Conv1d( - hidden_channels, - hidden_channels, - kernel_size, - padding=kernel_size // 2, - ) - ) - self.norm_layers.append(LayerNorm(hidden_channels)) - self.proj = nn.Conv1d(hidden_channels, out_channels, 1) - self.proj.weight.data.zero_() - self.proj.bias.data.zero_() - - def forward(self, x, x_mask): - x_org = x - for i in range(self.n_layers): - x = self.conv_layers[i](x * x_mask) - x = self.norm_layers[i](x) - x = self.relu_drop(x) - x = x_org + self.proj(x) - return x * x_mask - - -class DDSConv(nn.Module): - """ - Dialted and Depth-Separable Convolution - """ - - def __init__(self, channels, kernel_size, n_layers, p_dropout=0.0): - super().__init__() - self.channels = channels - self.kernel_size = kernel_size - self.n_layers = n_layers - self.p_dropout = p_dropout - - self.drop = nn.Dropout(p_dropout) - self.convs_sep = nn.ModuleList() - self.convs_1x1 = nn.ModuleList() - self.norms_1 = nn.ModuleList() - self.norms_2 = nn.ModuleList() - for i in range(n_layers): - dilation = kernel_size**i - padding = (kernel_size * dilation - dilation) // 2 - self.convs_sep.append( - nn.Conv1d( - channels, - channels, - kernel_size, - groups=channels, - dilation=dilation, - padding=padding, - ) - ) - self.convs_1x1.append(nn.Conv1d(channels, channels, 1)) - self.norms_1.append(LayerNorm(channels)) - self.norms_2.append(LayerNorm(channels)) - - def forward(self, x, x_mask, g=None): - if g is not None: - x = x + g - for i in range(self.n_layers): - y = self.convs_sep[i](x * x_mask) - y = self.norms_1[i](y) - y = F.gelu(y) - y = self.convs_1x1[i](y) - y = self.norms_2[i](y) - y = F.gelu(y) - y = self.drop(y) - x = x + y - return x * x_mask - - -class WN(torch.nn.Module): - def __init__( - self, - hidden_channels, - kernel_size, - dilation_rate, - n_layers, - gin_channels=0, - p_dropout=0, - ): - super(WN, self).__init__() - assert kernel_size % 2 == 1 - self.hidden_channels = hidden_channels - self.kernel_size = (kernel_size,) - self.dilation_rate = dilation_rate - self.n_layers = n_layers - self.gin_channels = gin_channels - self.p_dropout = p_dropout - - self.in_layers = torch.nn.ModuleList() - self.res_skip_layers = torch.nn.ModuleList() - self.drop = nn.Dropout(p_dropout) - - if gin_channels != 0: - cond_layer = torch.nn.Conv1d( - gin_channels, 2 * hidden_channels * n_layers, 1 - ) - self.cond_layer = torch.nn.utils.weight_norm(cond_layer, name="weight") - - for i in range(n_layers): - dilation = dilation_rate**i - padding = int((kernel_size * dilation - dilation) / 2) - in_layer = torch.nn.Conv1d( - hidden_channels, - 2 * hidden_channels, - kernel_size, - dilation=dilation, - padding=padding, - ) - in_layer = torch.nn.utils.weight_norm(in_layer, name="weight") - self.in_layers.append(in_layer) - - # last one is not necessary - if i < n_layers - 1: - res_skip_channels = 2 * hidden_channels - else: - res_skip_channels = hidden_channels - - res_skip_layer = torch.nn.Conv1d(hidden_channels, res_skip_channels, 1) - res_skip_layer = torch.nn.utils.weight_norm(res_skip_layer, name="weight") - self.res_skip_layers.append(res_skip_layer) - - def forward(self, x, x_mask, g=None, **kwargs): - output = torch.zeros_like(x) - n_channels_tensor = torch.IntTensor([self.hidden_channels]) - - if g is not None: - g = self.cond_layer(g) - - for i in range(self.n_layers): - x_in = self.in_layers[i](x) - if g is not None: - cond_offset = i * 2 * self.hidden_channels - g_l = g[:, cond_offset : cond_offset + 2 * self.hidden_channels, :] - else: - g_l = torch.zeros_like(x_in) - - acts = commons.fused_add_tanh_sigmoid_multiply(x_in, g_l, n_channels_tensor) - acts = self.drop(acts) - - res_skip_acts = self.res_skip_layers[i](acts) - if i < self.n_layers - 1: - res_acts = res_skip_acts[:, : self.hidden_channels, :] - x = (x + res_acts) * x_mask - output = output + res_skip_acts[:, self.hidden_channels :, :] - else: - output = output + res_skip_acts - return output * x_mask - - def remove_weight_norm(self): - if self.gin_channels != 0: - torch.nn.utils.remove_weight_norm(self.cond_layer) - for l in self.in_layers: - torch.nn.utils.remove_weight_norm(l) - for l in self.res_skip_layers: - torch.nn.utils.remove_weight_norm(l) - - -class ResBlock1(torch.nn.Module): - def __init__(self, channels, kernel_size=3, dilation=(1, 3, 5)): - super(ResBlock1, self).__init__() - self.convs1 = nn.ModuleList( - [ - weight_norm( - Conv1d( - channels, - channels, - kernel_size, - 1, - dilation=dilation[0], - padding=get_padding(kernel_size, dilation[0]), - ) - ), - weight_norm( - Conv1d( - channels, - channels, - kernel_size, - 1, - dilation=dilation[1], - padding=get_padding(kernel_size, dilation[1]), - ) - ), - weight_norm( - Conv1d( - channels, - channels, - kernel_size, - 1, - dilation=dilation[2], - padding=get_padding(kernel_size, dilation[2]), - ) - ), - ] - ) - self.convs1.apply(init_weights) - - self.convs2 = nn.ModuleList( - [ - weight_norm( - Conv1d( - channels, - channels, - kernel_size, - 1, - dilation=1, - padding=get_padding(kernel_size, 1), - ) - ), - weight_norm( - Conv1d( - channels, - channels, - kernel_size, - 1, - dilation=1, - padding=get_padding(kernel_size, 1), - ) - ), - weight_norm( - Conv1d( - channels, - channels, - kernel_size, - 1, - dilation=1, - padding=get_padding(kernel_size, 1), - ) - ), - ] - ) - self.convs2.apply(init_weights) - - def forward(self, x, x_mask=None): - for c1, c2 in zip(self.convs1, self.convs2): - xt = F.leaky_relu(x, LRELU_SLOPE) - if x_mask is not None: - xt = xt * x_mask - xt = c1(xt) - xt = F.leaky_relu(xt, LRELU_SLOPE) - if x_mask is not None: - xt = xt * x_mask - xt = c2(xt) - x = xt + x - if x_mask is not None: - x = x * x_mask - return x - - def remove_weight_norm(self): - for l in self.convs1: - remove_weight_norm(l) - for l in self.convs2: - remove_weight_norm(l) - - -class ResBlock2(torch.nn.Module): - def __init__(self, channels, kernel_size=3, dilation=(1, 3)): - super(ResBlock2, self).__init__() - self.convs = nn.ModuleList( - [ - weight_norm( - Conv1d( - channels, - channels, - kernel_size, - 1, - dilation=dilation[0], - padding=get_padding(kernel_size, dilation[0]), - ) - ), - weight_norm( - Conv1d( - channels, - channels, - kernel_size, - 1, - dilation=dilation[1], - padding=get_padding(kernel_size, dilation[1]), - ) - ), - ] - ) - self.convs.apply(init_weights) - - def forward(self, x, x_mask=None): - for c in self.convs: - xt = F.leaky_relu(x, LRELU_SLOPE) - if x_mask is not None: - xt = xt * x_mask - xt = c(xt) - x = xt + x - if x_mask is not None: - x = x * x_mask - return x - - def remove_weight_norm(self): - for l in self.convs: - remove_weight_norm(l) - - -class Log(nn.Module): - def forward(self, x, x_mask, reverse=False, **kwargs): - if not reverse: - y = torch.log(torch.clamp_min(x, 1e-5)) * x_mask - logdet = torch.sum(-y, [1, 2]) - return y, logdet - else: - x = torch.exp(x) * x_mask - return x - - -class Flip(nn.Module): - def forward(self, x, *args, reverse=False, **kwargs): - x = torch.flip(x, [1]) - if not reverse: - logdet = torch.zeros(x.size(0)).to(dtype=x.dtype, device=x.device) - return x, logdet - else: - return x - - -class ElementwiseAffine(nn.Module): - def __init__(self, channels): - super().__init__() - self.channels = channels - self.m = nn.Parameter(torch.zeros(channels, 1)) - self.logs = nn.Parameter(torch.zeros(channels, 1)) - - def forward(self, x, x_mask, reverse=False, **kwargs): - if not reverse: - y = self.m + torch.exp(self.logs) * x - y = y * x_mask - logdet = torch.sum(self.logs * x_mask, [1, 2]) - return y, logdet - else: - x = (x - self.m) * torch.exp(-self.logs) * x_mask - return x - - -class ResidualCouplingLayer(nn.Module): - def __init__( - self, - channels, - hidden_channels, - kernel_size, - dilation_rate, - n_layers, - p_dropout=0, - gin_channels=0, - mean_only=False, - ): - assert channels % 2 == 0, "channels should be divisible by 2" - super().__init__() - self.channels = channels - self.hidden_channels = hidden_channels - self.kernel_size = kernel_size - self.dilation_rate = dilation_rate - self.n_layers = n_layers - self.half_channels = channels // 2 - self.mean_only = mean_only - - self.pre = nn.Conv1d(self.half_channels, hidden_channels, 1) - self.enc = WN( - hidden_channels, - kernel_size, - dilation_rate, - n_layers, - p_dropout=p_dropout, - gin_channels=gin_channels, - ) - self.post = nn.Conv1d(hidden_channels, self.half_channels * (2 - mean_only), 1) - self.post.weight.data.zero_() - self.post.bias.data.zero_() - - def forward(self, x, x_mask, g=None, reverse=False): - x0, x1 = torch.split(x, [self.half_channels] * 2, 1) - h = self.pre(x0) * x_mask - h = self.enc(h, x_mask, g=g) - stats = self.post(h) * x_mask - if not self.mean_only: - m, logs = torch.split(stats, [self.half_channels] * 2, 1) - else: - m = stats - logs = torch.zeros_like(m) - - if not reverse: - x1 = m + x1 * torch.exp(logs) * x_mask - x = torch.cat([x0, x1], 1) - logdet = torch.sum(logs, [1, 2]) - return x, logdet - else: - x1 = (x1 - m) * torch.exp(-logs) * x_mask - x = torch.cat([x0, x1], 1) - return x - - def remove_weight_norm(self): - self.enc.remove_weight_norm() - - -class ConvFlow(nn.Module): - def __init__( - self, - in_channels, - filter_channels, - kernel_size, - n_layers, - num_bins=10, - tail_bound=5.0, - ): - super().__init__() - self.in_channels = in_channels - self.filter_channels = filter_channels - self.kernel_size = kernel_size - self.n_layers = n_layers - self.num_bins = num_bins - self.tail_bound = tail_bound - self.half_channels = in_channels // 2 - - self.pre = nn.Conv1d(self.half_channels, filter_channels, 1) - self.convs = DDSConv(filter_channels, kernel_size, n_layers, p_dropout=0.0) - self.proj = nn.Conv1d( - filter_channels, self.half_channels * (num_bins * 3 - 1), 1 - ) - self.proj.weight.data.zero_() - self.proj.bias.data.zero_() - - def forward(self, x, x_mask, g=None, reverse=False): - x0, x1 = torch.split(x, [self.half_channels] * 2, 1) - h = self.pre(x0) - h = self.convs(h, x_mask, g=g) - h = self.proj(h) * x_mask - - b, c, t = x0.shape - h = h.reshape(b, c, -1, t).permute(0, 1, 3, 2) # [b, cx?, t] -> [b, c, t, ?] - - unnormalized_widths = h[..., : self.num_bins] / math.sqrt(self.filter_channels) - unnormalized_heights = h[..., self.num_bins : 2 * self.num_bins] / math.sqrt( - self.filter_channels - ) - unnormalized_derivatives = h[..., 2 * self.num_bins :] - - x1, logabsdet = piecewise_rational_quadratic_transform( - x1, - unnormalized_widths, - unnormalized_heights, - unnormalized_derivatives, - inverse=reverse, - tails="linear", - tail_bound=self.tail_bound, - ) - - x = torch.cat([x0, x1], 1) * x_mask - logdet = torch.sum(logabsdet * x_mask, [1, 2]) - if not reverse: - return x, logdet - else: - return x diff --git a/spaces/SIGGRAPH2022/Text2Human/Text2Human/train_sampler.py b/spaces/SIGGRAPH2022/Text2Human/Text2Human/train_sampler.py deleted file mode 100644 index 65f2fc975d519d70915a31bda04063314f4dbdf2..0000000000000000000000000000000000000000 --- a/spaces/SIGGRAPH2022/Text2Human/Text2Human/train_sampler.py +++ /dev/null @@ -1,122 +0,0 @@ -import argparse -import logging -import os -import os.path as osp -import random -import time - -import torch - -from data.segm_attr_dataset import DeepFashionAttrSegmDataset -from models import create_model -from utils.logger import MessageLogger, get_root_logger, init_tb_logger -from utils.options import dict2str, dict_to_nonedict, parse -from utils.util import make_exp_dirs - - -def main(): - # options - parser = argparse.ArgumentParser() - parser.add_argument('-opt', type=str, help='Path to option YAML file.') - args = parser.parse_args() - opt = parse(args.opt, is_train=True) - - # mkdir and loggers - make_exp_dirs(opt) - log_file = osp.join(opt['path']['log'], f"train_{opt['name']}.log") - logger = get_root_logger( - logger_name='base', log_level=logging.INFO, log_file=log_file) - logger.info(dict2str(opt)) - # initialize tensorboard logger - tb_logger = None - if opt['use_tb_logger'] and 'debug' not in opt['name']: - tb_logger = init_tb_logger(log_dir='./tb_logger/' + opt['name']) - - # convert to NoneDict, which returns None for missing keys - opt = dict_to_nonedict(opt) - - # set up data loader - train_dataset = DeepFashionAttrSegmDataset( - img_dir=opt['train_img_dir'], - segm_dir=opt['segm_dir'], - pose_dir=opt['pose_dir'], - ann_dir=opt['train_ann_file'], - xflip=True) - train_loader = torch.utils.data.DataLoader( - dataset=train_dataset, - batch_size=opt['batch_size'], - shuffle=True, - num_workers=opt['num_workers'], - persistent_workers=True, - drop_last=True) - logger.info(f'Number of train set: {len(train_dataset)}.') - opt['max_iters'] = opt['num_epochs'] * len( - train_dataset) // opt['batch_size'] - - val_dataset = DeepFashionAttrSegmDataset( - img_dir=opt['train_img_dir'], - segm_dir=opt['segm_dir'], - pose_dir=opt['pose_dir'], - ann_dir=opt['val_ann_file']) - val_loader = torch.utils.data.DataLoader( - dataset=val_dataset, batch_size=opt['batch_size'], shuffle=False) - logger.info(f'Number of val set: {len(val_dataset)}.') - - test_dataset = DeepFashionAttrSegmDataset( - img_dir=opt['test_img_dir'], - segm_dir=opt['segm_dir'], - pose_dir=opt['pose_dir'], - ann_dir=opt['test_ann_file']) - test_loader = torch.utils.data.DataLoader( - dataset=test_dataset, batch_size=opt['batch_size'], shuffle=False) - logger.info(f'Number of test set: {len(test_dataset)}.') - - current_iter = 0 - - model = create_model(opt) - - data_time, iter_time = 0, 0 - current_iter = 0 - - # create message logger (formatted outputs) - msg_logger = MessageLogger(opt, current_iter, tb_logger) - - for epoch in range(opt['num_epochs']): - lr = model.update_learning_rate(epoch, current_iter) - - for _, batch_data in enumerate(train_loader): - data_time = time.time() - data_time - - current_iter += 1 - - model.feed_data(batch_data) - model.optimize_parameters() - - iter_time = time.time() - iter_time - if current_iter % opt['print_freq'] == 0: - log_vars = {'epoch': epoch, 'iter': current_iter} - log_vars.update({'lrs': [lr]}) - log_vars.update({'time': iter_time, 'data_time': data_time}) - log_vars.update(model.get_current_log()) - msg_logger(log_vars) - - data_time = time.time() - iter_time = time.time() - - if epoch % opt['val_freq'] == 0 and epoch != 0: - save_dir = f'{opt["path"]["visualization"]}/valset/epoch_{epoch:03d}' # noqa - os.makedirs(save_dir, exist_ok=opt['debug']) - model.inference(val_loader, save_dir) - - save_dir = f'{opt["path"]["visualization"]}/testset/epoch_{epoch:03d}' # noqa - os.makedirs(save_dir, exist_ok=opt['debug']) - model.inference(test_loader, save_dir) - - # save model - model.save_network( - model._denoise_fn, - f'{opt["path"]["models"]}/sampler_epoch{epoch}.pth') - - -if __name__ == '__main__': - main() diff --git a/spaces/Sadhvi/ChatBot/README.md b/spaces/Sadhvi/ChatBot/README.md deleted file mode 100644 index 387e6100e6550e5d21fbf896ed127d7cfebe8dbf..0000000000000000000000000000000000000000 --- a/spaces/Sadhvi/ChatBot/README.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: ChatBot -emoji: 📚 -colorFrom: green -colorTo: green -sdk: gradio -sdk_version: 3.39.0 -app_file: app.py -pinned: false ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/SalahZa/Code-Switched-Tunisian-SpeechToText/EnglishCV/results/wav2vec2_ctc_en/1234/train_with_wav2vec.py b/spaces/SalahZa/Code-Switched-Tunisian-SpeechToText/EnglishCV/results/wav2vec2_ctc_en/1234/train_with_wav2vec.py deleted file mode 100644 index d462abf3d2e8244df5cdb183aa231082d7791a45..0000000000000000000000000000000000000000 --- a/spaces/SalahZa/Code-Switched-Tunisian-SpeechToText/EnglishCV/results/wav2vec2_ctc_en/1234/train_with_wav2vec.py +++ /dev/null @@ -1,388 +0,0 @@ -#!/usr/bin/env python3 -import sys -import torch -import logging -import speechbrain as sb -import torchaudio -from hyperpyyaml import load_hyperpyyaml -from speechbrain.tokenizers.SentencePiece import SentencePiece -from speechbrain.utils.data_utils import undo_padding -from speechbrain.utils.distributed import run_on_main - -"""Recipe for training a sequence-to-sequence ASR system with CommonVoice. -The system employs a wav2vec2 encoder and a CTC decoder. -Decoding is performed with greedy decoding (will be extended to beam search). - -To run this recipe, do the following: -> python train_with_wav2vec2.py hparams/train_with_wav2vec2.yaml - -With the default hyperparameters, the system employs a pretrained wav2vec2 encoder. -The wav2vec2 model is pretrained following the model given in the hprams file. -It may be dependent on the language. - -The neural network is trained with CTC on sub-word units estimated with -Byte Pairwise Encoding (BPE). - -The experiment file is flexible enough to support a large variety of -different systems. By properly changing the parameter files, you can try -different encoders, decoders, tokens (e.g, characters instead of BPE), -training languages (all CommonVoice languages), and many -other possible variations. - -Authors - * Titouan Parcollet 2021 -""" - -logger = logging.getLogger(__name__) - - -# Define training procedure -class ASR(sb.core.Brain): - def compute_forward(self, batch, stage): - """Forward computations from the waveform batches to the output probabilities.""" - - batch = batch.to(self.device) - wavs, wav_lens = batch.sig - tokens_bos, _ = batch.tokens_bos - wavs, wav_lens = wavs.to(self.device), wav_lens.to(self.device) - - if stage == sb.Stage.TRAIN: - if hasattr(self.hparams, "augmentation"): - wavs = self.hparams.augmentation(wavs, wav_lens) - - # Forward pass - feats = self.modules.wav2vec2(wavs, wav_lens) - x = self.modules.enc(feats) - logits = self.modules.ctc_lin(x) - p_ctc = self.hparams.log_softmax(logits) - - return p_ctc, wav_lens - - def compute_objectives(self, predictions, batch, stage): - """Computes the loss (CTC) given predictions and targets.""" - - p_ctc, wav_lens = predictions - - ids = batch.id - tokens_eos, tokens_eos_lens = batch.tokens_eos - tokens, tokens_lens = batch.tokens - - loss = self.hparams.ctc_cost(p_ctc, tokens, wav_lens, tokens_lens) - - if stage != sb.Stage.TRAIN: - # Decode token terms to words - sequence = sb.decoders.ctc_greedy_decode( - p_ctc, wav_lens, blank_id=self.hparams.blank_index - ) - - predicted_words = self.tokenizer(sequence, task="decode_from_list") - - # Convert indices to words - target_words = undo_padding(tokens, tokens_lens) - target_words = self.tokenizer(target_words, task="decode_from_list") - - self.wer_metric.append(ids, predicted_words, target_words) - self.cer_metric.append(ids, predicted_words, target_words) - - return loss - - def fit_batch(self, batch): - """Train the parameters given a single batch in input""" - should_step = self.step % self.grad_accumulation_factor == 0 - # Managing automatic mixed precision - # TOFIX: CTC fine-tuning currently is unstable - # This is certainly due to CTC being done in fp16 instead of fp32 - if self.auto_mix_prec: - with torch.cuda.amp.autocast(): - with self.no_sync(): - outputs = self.compute_forward(batch, sb.Stage.TRAIN) - loss = self.compute_objectives(outputs, batch, sb.Stage.TRAIN) - with self.no_sync(not should_step): - self.scaler.scale( - loss / self.grad_accumulation_factor - ).backward() - if should_step: - - if not self.hparams.wav2vec2.freeze: - self.scaler.unscale_(self.wav2vec_optimizer) - self.scaler.unscale_(self.model_optimizer) - if self.check_gradients(loss): - if not self.hparams.wav2vec2.freeze: - if self.optimizer_step >= self.hparams.warmup_steps: - self.scaler.step(self.wav2vec_optimizer) - self.scaler.step(self.model_optimizer) - self.scaler.update() - self.zero_grad() - self.optimizer_step += 1 - else: - # This is mandatory because HF models have a weird behavior with DDP - # on the forward pass - with self.no_sync(): - outputs = self.compute_forward(batch, sb.Stage.TRAIN) - - loss = self.compute_objectives(outputs, batch, sb.Stage.TRAIN) - - with self.no_sync(not should_step): - (loss / self.grad_accumulation_factor).backward() - if should_step: - if self.check_gradients(loss): - if not self.hparams.wav2vec2.freeze: - if self.optimizer_step >= self.hparams.warmup_steps: - self.wav2vec_optimizer.step() - self.model_optimizer.step() - self.zero_grad() - self.optimizer_step += 1 - - self.on_fit_batch_end(batch, outputs, loss, should_step) - return loss.detach().cpu() - - def evaluate_batch(self, batch, stage): - """Computations needed for validation/test batches""" - predictions = self.compute_forward(batch, stage=stage) - with torch.no_grad(): - loss = self.compute_objectives(predictions, batch, stage=stage) - return loss.detach() - - def on_stage_start(self, stage, epoch): - """Gets called at the beginning of each epoch""" - if stage != sb.Stage.TRAIN: - self.cer_metric = self.hparams.cer_computer() - self.wer_metric = self.hparams.error_rate_computer() - - def on_stage_end(self, stage, stage_loss, epoch): - """Gets called at the end of an epoch.""" - # Compute/store important stats - stage_stats = {"loss": stage_loss} - if stage == sb.Stage.TRAIN: - self.train_stats = stage_stats - else: - stage_stats["CER"] = self.cer_metric.summarize("error_rate") - stage_stats["WER"] = self.wer_metric.summarize("error_rate") - - # Perform end-of-iteration things, like annealing, logging, etc. - if stage == sb.Stage.VALID: - old_lr_model, new_lr_model = self.hparams.lr_annealing_model( - stage_stats["loss"] - ) - old_lr_wav2vec, new_lr_wav2vec = self.hparams.lr_annealing_wav2vec( - stage_stats["loss"] - ) - sb.nnet.schedulers.update_learning_rate( - self.model_optimizer, new_lr_model - ) - if not self.hparams.wav2vec2.freeze: - sb.nnet.schedulers.update_learning_rate( - self.wav2vec_optimizer, new_lr_wav2vec - ) - self.hparams.train_logger.log_stats( - stats_meta={ - "epoch": epoch, - "lr_model": old_lr_model, - "lr_wav2vec": old_lr_wav2vec, - }, - train_stats=self.train_stats, - valid_stats=stage_stats, - ) - self.checkpointer.save_and_keep_only( - meta={"WER": stage_stats["WER"]}, min_keys=["WER"], - ) - elif stage == sb.Stage.TEST: - self.hparams.train_logger.log_stats( - stats_meta={"Epoch loaded": self.hparams.epoch_counter.current}, - test_stats=stage_stats, - ) - with open(self.hparams.wer_file, "w") as w: - self.wer_metric.write_stats(w) - - def init_optimizers(self): - "Initializes the wav2vec2 optimizer and model optimizer" - - # If the wav2vec encoder is unfrozen, we create the optimizer - if not self.hparams.wav2vec2.freeze: - self.wav2vec_optimizer = self.hparams.wav2vec_opt_class( - self.modules.wav2vec2.parameters() - ) - if self.checkpointer is not None: - self.checkpointer.add_recoverable( - "wav2vec_opt", self.wav2vec_optimizer - ) - - self.model_optimizer = self.hparams.model_opt_class( - self.hparams.model.parameters() - ) - - if self.checkpointer is not None: - self.checkpointer.add_recoverable("modelopt", self.model_optimizer) - - def zero_grad(self, set_to_none=False): - if not self.hparams.wav2vec2.freeze: - self.wav2vec_optimizer.zero_grad(set_to_none) - self.model_optimizer.zero_grad(set_to_none) - - -# Define custom data procedure -def dataio_prepare(hparams, tokenizer): - """This function prepares the datasets to be used in the brain class. - It also defines the data processing pipeline through user-defined functions.""" - - # 1. Define datasets - data_folder = hparams["data_folder"] - - train_data = sb.dataio.dataset.DynamicItemDataset.from_csv( - csv_path=hparams["train_csv"], replacements={"data_root": data_folder}, - ) - - if hparams["sorting"] == "ascending": - # we sort training data to speed up training and get better results. - train_data = train_data.filtered_sorted( - sort_key="duration", - key_max_value={"duration": hparams["avoid_if_longer_than"]}, - ) - # when sorting do not shuffle in dataloader ! otherwise is pointless - hparams["dataloader_options"]["shuffle"] = False - - elif hparams["sorting"] == "descending": - train_data = train_data.filtered_sorted( - sort_key="duration", - reverse=True, - key_max_value={"duration": hparams["avoid_if_longer_than"]}, - ) - # when sorting do not shuffle in dataloader ! otherwise is pointless - hparams["dataloader_options"]["shuffle"] = False - - elif hparams["sorting"] == "random": - pass - - else: - raise NotImplementedError( - "sorting must be random, ascending or descending" - ) - - valid_data = sb.dataio.dataset.DynamicItemDataset.from_csv( - csv_path=hparams["valid_csv"], replacements={"data_root": data_folder}, - ) - # We also sort the validation data so it is faster to validate - valid_data = valid_data.filtered_sorted(sort_key="duration") - - test_data = sb.dataio.dataset.DynamicItemDataset.from_csv( - csv_path=hparams["test_csv"], replacements={"data_root": data_folder}, - ) - - # We also sort the validation data so it is faster to validate - test_data = test_data.filtered_sorted(sort_key="duration") - - datasets = [train_data, valid_data, test_data] - - # 2. Define audio pipeline: - @sb.utils.data_pipeline.takes("wav") - @sb.utils.data_pipeline.provides("sig") - def audio_pipeline(wav): - info = torchaudio.info(wav) - sig = sb.dataio.dataio.read_audio(wav) - resampled = torchaudio.transforms.Resample( - info.sample_rate, hparams["sample_rate"], - )(sig) - return resampled - - sb.dataio.dataset.add_dynamic_item(datasets, audio_pipeline) - - # 3. Define text pipeline: - @sb.utils.data_pipeline.takes("wrd") - @sb.utils.data_pipeline.provides( - "tokens_list", "tokens_bos", "tokens_eos", "tokens" - ) - def text_pipeline(wrd): - tokens_list = tokenizer.sp.encode_as_ids(wrd) - yield tokens_list - tokens_bos = torch.LongTensor([hparams["bos_index"]] + (tokens_list)) - yield tokens_bos - tokens_eos = torch.LongTensor(tokens_list + [hparams["eos_index"]]) - yield tokens_eos - tokens = torch.LongTensor(tokens_list) - yield tokens - - sb.dataio.dataset.add_dynamic_item(datasets, text_pipeline) - - # 4. Set output: - sb.dataio.dataset.set_output_keys( - datasets, ["id", "sig", "tokens_bos", "tokens_eos", "tokens"], - ) - return train_data, valid_data, test_data - - -if __name__ == "__main__": - - # Load hyperparameters file with command-line overrides - hparams_file, run_opts, overrides = sb.parse_arguments(sys.argv[1:]) - with open(hparams_file) as fin: - hparams = load_hyperpyyaml(fin, overrides) - - # If --distributed_launch then - # create ddp_group with the right communication protocol - sb.utils.distributed.ddp_init_group(run_opts) - - # Dataset preparation (parsing CommonVoice) - from common_voice_prepare import prepare_common_voice # noqa - - # Create experiment directory - sb.create_experiment_directory( - experiment_directory=hparams["output_folder"], - hyperparams_to_save=hparams_file, - overrides=overrides, - ) - - # Due to DDP, we do the preparation ONLY on the main python process - run_on_main( - prepare_common_voice, - kwargs={ - "data_folder": hparams["data_folder"], - "save_folder": hparams["save_folder"], - "train_tsv_file": hparams["train_tsv_file"], - "dev_tsv_file": hparams["dev_tsv_file"], - "test_tsv_file": hparams["test_tsv_file"], - "accented_letters": hparams["accented_letters"], - "language": hparams["language"], - "skip_prep": hparams["skip_prep"], - }, - ) - - # Defining tokenizer and loading it - tokenizer = SentencePiece( - model_dir=hparams["save_folder"], - vocab_size=hparams["output_neurons"], - annotation_train=hparams["train_csv"], - annotation_read="wrd", - model_type=hparams["token_type"], - character_coverage=hparams["character_coverage"], - ) - - # Create the datasets objects as well as tokenization and encoding :-D - train_data, valid_data, test_data = dataio_prepare(hparams, tokenizer) - - # Trainer initialization - asr_brain = ASR( - modules=hparams["modules"], - hparams=hparams, - run_opts=run_opts, - checkpointer=hparams["checkpointer"], - ) - - # Adding objects to trainer. - asr_brain.tokenizer = tokenizer - - # Training - asr_brain.fit( - asr_brain.hparams.epoch_counter, - train_data, - valid_data, - train_loader_kwargs=hparams["dataloader_options"], - valid_loader_kwargs=hparams["test_dataloader_options"], - ) - - # Test - asr_brain.hparams.wer_file = hparams["output_folder"] + "/wer_test.txt" - asr_brain.evaluate( - test_data, - min_key="WER", - test_loader_kwargs=hparams["test_dataloader_options"], - ) diff --git a/spaces/Sanster/Lama-Cleaner-lama/README.md b/spaces/Sanster/Lama-Cleaner-lama/README.md deleted file mode 100644 index a6d24c92e2b9631069ac31a0965c73f6de161a12..0000000000000000000000000000000000000000 --- a/spaces/Sanster/Lama-Cleaner-lama/README.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: Lama Cleaner Lama -emoji: ⚡ -colorFrom: indigo -colorTo: purple -sdk: gradio -sdk_version: 3.9.1 -app_file: app.py -pinned: false -license: apache-2.0 ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/SenY/GalGameUI/README.md b/spaces/SenY/GalGameUI/README.md deleted file mode 100644 index 6d24b5d762397a10de69f67aff783973a6cb0910..0000000000000000000000000000000000000000 --- a/spaces/SenY/GalGameUI/README.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -title: GalGameUI -emoji: 📈 -colorFrom: gray -colorTo: red -sdk: static -pinned: false -license: other ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/Shakeb100/GroomingGenie_AI/clipseg/evaluation_utils.py b/spaces/Shakeb100/GroomingGenie_AI/clipseg/evaluation_utils.py deleted file mode 100644 index 8f913a98ad910db386838463908141fb9dcef442..0000000000000000000000000000000000000000 --- a/spaces/Shakeb100/GroomingGenie_AI/clipseg/evaluation_utils.py +++ /dev/null @@ -1,292 +0,0 @@ -from torch.functional import Tensor -from general_utils import load_model -from torch.utils.data import DataLoader -import torch -import numpy as np - -def denorm(img): - - np_input = False - if isinstance(img, np.ndarray): - img = torch.from_numpy(img) - np_input = True - - mean = torch.Tensor([0.485, 0.456, 0.406]) - std = torch.Tensor([0.229, 0.224, 0.225]) - - img_denorm = (img*std[:,None,None]) + mean[:,None,None] - - if np_input: - img_denorm = np.clip(img_denorm.numpy(), 0, 1) - else: - img_denorm = torch.clamp(img_denorm, 0, 1) - - return img_denorm - - -def norm(img): - mean = torch.Tensor([0.485, 0.456, 0.406]) - std = torch.Tensor([0.229, 0.224, 0.225]) - return (img - mean[:,None,None]) / std[:,None,None] - - -def fast_iou_curve(p, g): - - g = g[p.sort().indices] - p = torch.sigmoid(p.sort().values) - - scores = [] - vals = np.linspace(0, 1, 50) - - for q in vals: - - n = int(len(g) * q) - - valid = torch.where(p > q)[0] - if len(valid) > 0: - n = int(valid[0]) - else: - n = len(g) - - fn = g[:n].sum() - tn = n - fn - tp = g[n:].sum() - fp = len(g) - n - tp - - iou = tp / (tp + fn + fp) - - precision = tp / (tp + fp) - recall = tp / (tp + fn) - - scores += [iou] - - return vals, scores - - -def fast_rp_curve(p, g): - - g = g[p.sort().indices] - p = torch.sigmoid(p.sort().values) - - precisions, recalls = [], [] - vals = np.linspace(p.min(), p.max(), 250) - - for q in p[::100000]: - - n = int(len(g) * q) - - valid = torch.where(p > q)[0] - if len(valid) > 0: - n = int(valid[0]) - else: - n = len(g) - - fn = g[:n].sum() - tn = n - fn - tp = g[n:].sum() - fp = len(g) - n - tp - - iou = tp / (tp + fn + fp) - - precision = tp / (tp + fp) - recall = tp / (tp + fn) - - precisions += [precision] - recalls += [recall] - - return recalls, precisions - - -# Image processing - -def img_preprocess(batch, blur=0, grayscale=False, center_context=None, rect=False, rect_color=(255,0,0), rect_width=2, - brightness=1.0, bg_fac=1, colorize=False, outline=False, image_size=224): - import cv2 - - rw = rect_width - - out = [] - for img, mask in zip(batch[1], batch[2]): - - img = img.cpu() if isinstance(img, torch.Tensor) else torch.from_numpy(img) - mask = mask.cpu() if isinstance(mask, torch.Tensor) else torch.from_numpy(mask) - - img *= brightness - img_bl = img - if blur > 0: # best 5 - img_bl = torch.from_numpy(cv2.GaussianBlur(img.permute(1,2,0).numpy(), (15, 15), blur)).permute(2,0,1) - - if grayscale: - img_bl = img_bl[1][None] - - #img_inp = img_ratio*img*mask + (1-img_ratio)*img_bl - # img_inp = img_ratio*img*mask + (1-img_ratio)*img_bl * (1-mask) - img_inp = img*mask + (bg_fac) * img_bl * (1-mask) - - if rect: - _, bbox = crop_mask(img, mask, context=0.1) - img_inp[:, bbox[2]: bbox[3], max(0, bbox[0]-rw):bbox[0]+rw] = torch.tensor(rect_color)[:,None,None] - img_inp[:, bbox[2]: bbox[3], max(0, bbox[1]-rw):bbox[1]+rw] = torch.tensor(rect_color)[:,None,None] - img_inp[:, max(0, bbox[2]-1): bbox[2]+rw, bbox[0]:bbox[1]] = torch.tensor(rect_color)[:,None,None] - img_inp[:, max(0, bbox[3]-1): bbox[3]+rw, bbox[0]:bbox[1]] = torch.tensor(rect_color)[:,None,None] - - - if center_context is not None: - img_inp = object_crop(img_inp, mask, context=center_context, image_size=image_size) - - if colorize: - img_gray = denorm(img) - img_gray = cv2.cvtColor(img_gray.permute(1,2,0).numpy(), cv2.COLOR_RGB2GRAY) - img_gray = torch.stack([torch.from_numpy(img_gray)]*3) - img_inp = torch.tensor([1,0.2,0.2])[:,None,None] * img_gray * mask + bg_fac * img_gray * (1-mask) - img_inp = norm(img_inp) - - if outline: - cont = cv2.findContours(mask.byte().numpy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) - outline_img = np.zeros(mask.shape, dtype=np.uint8) - cv2.drawContours(outline_img, cont[0], -1, thickness=5, color=(255, 255, 255)) - outline_img = torch.stack([torch.from_numpy(outline_img)]*3).float() / 255. - img_inp = torch.tensor([1,0,0])[:,None,None] * outline_img + denorm(img_inp) * (1- outline_img) - img_inp = norm(img_inp) - - out += [img_inp] - - return torch.stack(out) - - -def object_crop(img, mask, context=0.0, square=False, image_size=224): - img_crop, bbox = crop_mask(img, mask, context=context, square=square) - img_crop = pad_to_square(img_crop, channel_dim=0) - img_crop = torch.nn.functional.interpolate(img_crop.unsqueeze(0), (image_size, image_size)).squeeze(0) - return img_crop - - -def crop_mask(img, mask, context=0.0, square=False): - - assert img.shape[1:] == mask.shape - - bbox = [mask.max(0).values.argmax(), mask.size(0) - mask.max(0).values.flip(0).argmax()] - bbox += [mask.max(1).values.argmax(), mask.size(1) - mask.max(1).values.flip(0).argmax()] - bbox = [int(x) for x in bbox] - - width, height = (bbox[3] - bbox[2]), (bbox[1] - bbox[0]) - - # square mask - if square: - bbox[0] = int(max(0, bbox[0] - context * height)) - bbox[1] = int(min(mask.size(0), bbox[1] + context * height)) - bbox[2] = int(max(0, bbox[2] - context * width)) - bbox[3] = int(min(mask.size(1), bbox[3] + context * width)) - - width, height = (bbox[3] - bbox[2]), (bbox[1] - bbox[0]) - if height > width: - bbox[2] = int(max(0, (bbox[2] - 0.5*height))) - bbox[3] = bbox[2] + height - else: - bbox[0] = int(max(0, (bbox[0] - 0.5*width))) - bbox[1] = bbox[0] + width - else: - bbox[0] = int(max(0, bbox[0] - context * height)) - bbox[1] = int(min(mask.size(0), bbox[1] + context * height)) - bbox[2] = int(max(0, bbox[2] - context * width)) - bbox[3] = int(min(mask.size(1), bbox[3] + context * width)) - - width, height = (bbox[3] - bbox[2]), (bbox[1] - bbox[0]) - img_crop = img[:, bbox[2]: bbox[3], bbox[0]: bbox[1]] - return img_crop, bbox - - -def pad_to_square(img, channel_dim=2, fill=0): - """ - - - add padding such that a squared image is returned """ - - from torchvision.transforms.functional import pad - - if channel_dim == 2: - img = img.permute(2, 0, 1) - elif channel_dim == 0: - pass - else: - raise ValueError('invalid channel_dim') - - h, w = img.shape[1:] - pady1 = pady2 = padx1 = padx2 = 0 - - if h > w: - padx1 = (h - w) // 2 - padx2 = h - w - padx1 - elif w > h: - pady1 = (w - h) // 2 - pady2 = w - h - pady1 - - img_padded = pad(img, padding=(padx1, pady1, padx2, pady2), padding_mode='constant') - - if channel_dim == 2: - img_padded = img_padded.permute(1, 2, 0) - - return img_padded - - -# qualitative - -def split_sentence(inp, limit=9): - t_new, current_len = [], 0 - for k, t in enumerate(inp.split(' ')): - current_len += len(t) + 1 - t_new += [t+' '] - # not last - if current_len > limit and k != len(inp.split(' ')) - 1: - current_len = 0 - t_new += ['\n'] - - t_new = ''.join(t_new) - return t_new - - -from matplotlib import pyplot as plt - - -def plot(imgs, *preds, labels=None, scale=1, cmap=plt.cm.magma, aps=None, gt_labels=None, vmax=None): - - row_off = 0 if labels is None else 1 - _, ax = plt.subplots(len(imgs) + row_off, 1 + len(preds), figsize=(scale * float(1 + 2*len(preds)), scale * float(len(imgs)*2))) - [a.axis('off') for a in ax.flatten()] - - if labels is not None: - for j in range(len(labels)): - t_new = split_sentence(labels[j], limit=6) - ax[0, 1+ j].text(0.5, 0.1, t_new, ha='center', fontsize=3+ 10*scale) - - - for i in range(len(imgs)): - ax[i + row_off,0].imshow(imgs[i]) - for j in range(len(preds)): - img = preds[j][i][0].detach().cpu().numpy() - - if gt_labels is not None and labels[j] == gt_labels[i]: - print(j, labels[j], gt_labels[i]) - edgecolor = 'red' - if aps is not None: - ax[i + row_off, 1 + j].text(30, 70, f'AP: {aps[i]:.3f}', color='red', fontsize=8) - else: - edgecolor = 'k' - - rect = plt.Rectangle([0,0], img.shape[0], img.shape[1], facecolor="none", - edgecolor=edgecolor, linewidth=3) - ax[i + row_off,1 + j].add_patch(rect) - - if vmax is None: - this_vmax = 1 - elif vmax == 'per_prompt': - this_vmax = max([preds[j][_i][0].max() for _i in range(len(imgs))]) - elif vmax == 'per_image': - this_vmax = max([preds[_j][i][0].max() for _j in range(len(preds))]) - - ax[i + row_off,1 + j].imshow(img, vmin=0, vmax=this_vmax, cmap=cmap) - - - # ax[i,1 + j].imshow(preds[j][i][0].detach().cpu().numpy(), vmin=preds[j].min(), vmax=preds[j].max()) - plt.tight_layout() - plt.subplots_adjust(wspace=0.05, hspace=0.05) \ No newline at end of file diff --git a/spaces/SungBeom/chatwine-korean/.venv/Lib/site-packages/IPython/core/magic_arguments.py b/spaces/SungBeom/chatwine-korean/.venv/Lib/site-packages/IPython/core/magic_arguments.py deleted file mode 100644 index 24dd5418767244c39c3e7d0f8aff6d0071180a01..0000000000000000000000000000000000000000 --- a/spaces/SungBeom/chatwine-korean/.venv/Lib/site-packages/IPython/core/magic_arguments.py +++ /dev/null @@ -1,310 +0,0 @@ -''' A decorator-based method of constructing IPython magics with `argparse` -option handling. - -New magic functions can be defined like so:: - - from IPython.core.magic_arguments import (argument, magic_arguments, - parse_argstring) - - @magic_arguments() - @argument('-o', '--option', help='An optional argument.') - @argument('arg', type=int, help='An integer positional argument.') - def magic_cool(self, arg): - """ A really cool magic command. - - """ - args = parse_argstring(magic_cool, arg) - ... - -The `@magic_arguments` decorator marks the function as having argparse arguments. -The `@argument` decorator adds an argument using the same syntax as argparse's -`add_argument()` method. More sophisticated uses may also require the -`@argument_group` or `@kwds` decorator to customize the formatting and the -parsing. - -Help text for the magic is automatically generated from the docstring and the -arguments:: - - In[1]: %cool? - %cool [-o OPTION] arg - - A really cool magic command. - - positional arguments: - arg An integer positional argument. - - optional arguments: - -o OPTION, --option OPTION - An optional argument. - -Here is an elaborated example that uses default parameters in `argument` and calls the `args` in the cell magic:: - - from IPython.core.magic import register_cell_magic - from IPython.core.magic_arguments import (argument, magic_arguments, - parse_argstring) - - - @magic_arguments() - @argument( - "--option", - "-o", - help=("Add an option here"), - ) - @argument( - "--style", - "-s", - default="foo", - help=("Add some style arguments"), - ) - @register_cell_magic - def my_cell_magic(line, cell): - args = parse_argstring(my_cell_magic, line) - print(f"{args.option=}") - print(f"{args.style=}") - print(f"{cell=}") - -In a jupyter notebook, this cell magic can be executed like this:: - - %%my_cell_magic -o Hello - print("bar") - i = 42 - -Inheritance diagram: - -.. inheritance-diagram:: IPython.core.magic_arguments - :parts: 3 - -''' -#----------------------------------------------------------------------------- -# Copyright (C) 2010-2011, IPython Development Team. -# -# Distributed under the terms of the Modified BSD License. -# -# The full license is in the file COPYING.txt, distributed with this software. -#----------------------------------------------------------------------------- -import argparse -import re - -# Our own imports -from IPython.core.error import UsageError -from IPython.utils.decorators import undoc -from IPython.utils.process import arg_split -from IPython.utils.text import dedent - -NAME_RE = re.compile(r"[a-zA-Z][a-zA-Z0-9_-]*$") - -@undoc -class MagicHelpFormatter(argparse.RawDescriptionHelpFormatter): - """A HelpFormatter with a couple of changes to meet our needs. - """ - # Modified to dedent text. - def _fill_text(self, text, width, indent): - return argparse.RawDescriptionHelpFormatter._fill_text(self, dedent(text), width, indent) - - # Modified to wrap argument placeholders in <> where necessary. - def _format_action_invocation(self, action): - if not action.option_strings: - metavar, = self._metavar_formatter(action, action.dest)(1) - return metavar - - else: - parts = [] - - # if the Optional doesn't take a value, format is: - # -s, --long - if action.nargs == 0: - parts.extend(action.option_strings) - - # if the Optional takes a value, format is: - # -s ARGS, --long ARGS - else: - default = action.dest.upper() - args_string = self._format_args(action, default) - # IPYTHON MODIFICATION: If args_string is not a plain name, wrap - # it in <> so it's valid RST. - if not NAME_RE.match(args_string): - args_string = "<%s>" % args_string - for option_string in action.option_strings: - parts.append('%s %s' % (option_string, args_string)) - - return ', '.join(parts) - - # Override the default prefix ('usage') to our % magic escape, - # in a code block. - def add_usage(self, usage, actions, groups, prefix="::\n\n %"): - super(MagicHelpFormatter, self).add_usage(usage, actions, groups, prefix) - -class MagicArgumentParser(argparse.ArgumentParser): - """ An ArgumentParser tweaked for use by IPython magics. - """ - def __init__(self, - prog=None, - usage=None, - description=None, - epilog=None, - parents=None, - formatter_class=MagicHelpFormatter, - prefix_chars='-', - argument_default=None, - conflict_handler='error', - add_help=False): - if parents is None: - parents = [] - super(MagicArgumentParser, self).__init__(prog=prog, usage=usage, - description=description, epilog=epilog, - parents=parents, formatter_class=formatter_class, - prefix_chars=prefix_chars, argument_default=argument_default, - conflict_handler=conflict_handler, add_help=add_help) - - def error(self, message): - """ Raise a catchable error instead of exiting. - """ - raise UsageError(message) - - def parse_argstring(self, argstring): - """ Split a string into an argument list and parse that argument list. - """ - argv = arg_split(argstring) - return self.parse_args(argv) - - -def construct_parser(magic_func): - """ Construct an argument parser using the function decorations. - """ - kwds = getattr(magic_func, 'argcmd_kwds', {}) - if 'description' not in kwds: - kwds['description'] = getattr(magic_func, '__doc__', None) - arg_name = real_name(magic_func) - parser = MagicArgumentParser(arg_name, **kwds) - # Reverse the list of decorators in order to apply them in the - # order in which they appear in the source. - group = None - for deco in magic_func.decorators[::-1]: - result = deco.add_to_parser(parser, group) - if result is not None: - group = result - - # Replace the magic function's docstring with the full help text. - magic_func.__doc__ = parser.format_help() - - return parser - - -def parse_argstring(magic_func, argstring): - """ Parse the string of arguments for the given magic function. - """ - return magic_func.parser.parse_argstring(argstring) - - -def real_name(magic_func): - """ Find the real name of the magic. - """ - magic_name = magic_func.__name__ - if magic_name.startswith('magic_'): - magic_name = magic_name[len('magic_'):] - return getattr(magic_func, 'argcmd_name', magic_name) - - -class ArgDecorator(object): - """ Base class for decorators to add ArgumentParser information to a method. - """ - - def __call__(self, func): - if not getattr(func, 'has_arguments', False): - func.has_arguments = True - func.decorators = [] - func.decorators.append(self) - return func - - def add_to_parser(self, parser, group): - """ Add this object's information to the parser, if necessary. - """ - pass - - -class magic_arguments(ArgDecorator): - """ Mark the magic as having argparse arguments and possibly adjust the - name. - """ - - def __init__(self, name=None): - self.name = name - - def __call__(self, func): - if not getattr(func, 'has_arguments', False): - func.has_arguments = True - func.decorators = [] - if self.name is not None: - func.argcmd_name = self.name - # This should be the first decorator in the list of decorators, thus the - # last to execute. Build the parser. - func.parser = construct_parser(func) - return func - - -class ArgMethodWrapper(ArgDecorator): - - """ - Base class to define a wrapper for ArgumentParser method. - - Child class must define either `_method_name` or `add_to_parser`. - - """ - - _method_name: str - - def __init__(self, *args, **kwds): - self.args = args - self.kwds = kwds - - def add_to_parser(self, parser, group): - """ Add this object's information to the parser. - """ - if group is not None: - parser = group - getattr(parser, self._method_name)(*self.args, **self.kwds) - return None - - -class argument(ArgMethodWrapper): - """ Store arguments and keywords to pass to add_argument(). - - Instances also serve to decorate command methods. - """ - _method_name = 'add_argument' - - -class defaults(ArgMethodWrapper): - """ Store arguments and keywords to pass to set_defaults(). - - Instances also serve to decorate command methods. - """ - _method_name = 'set_defaults' - - -class argument_group(ArgMethodWrapper): - """ Store arguments and keywords to pass to add_argument_group(). - - Instances also serve to decorate command methods. - """ - - def add_to_parser(self, parser, group): - """ Add this object's information to the parser. - """ - return parser.add_argument_group(*self.args, **self.kwds) - - -class kwds(ArgDecorator): - """ Provide other keywords to the sub-parser constructor. - """ - def __init__(self, **kwds): - self.kwds = kwds - - def __call__(self, func): - func = super(kwds, self).__call__(func) - func.argcmd_kwds = self.kwds - return func - - -__all__ = ['magic_arguments', 'argument', 'argument_group', 'kwds', - 'parse_argstring'] diff --git a/spaces/SungBeom/chatwine-korean/.venv/Lib/site-packages/PIL/_util.py b/spaces/SungBeom/chatwine-korean/.venv/Lib/site-packages/PIL/_util.py deleted file mode 100644 index ba27b7e49e98f4973ba9c257be14a8419292fe8a..0000000000000000000000000000000000000000 --- a/spaces/SungBeom/chatwine-korean/.venv/Lib/site-packages/PIL/_util.py +++ /dev/null @@ -1,19 +0,0 @@ -import os -from pathlib import Path - - -def is_path(f): - return isinstance(f, (bytes, str, Path)) - - -def is_directory(f): - """Checks if an object is a string, and that it points to a directory.""" - return is_path(f) and os.path.isdir(f) - - -class DeferredError: - def __init__(self, ex): - self.ex = ex - - def __getattr__(self, elt): - raise self.ex diff --git a/spaces/SungBeom/chatwine-korean/.venv/Lib/site-packages/chromadb/test/property/test_embeddings.py b/spaces/SungBeom/chatwine-korean/.venv/Lib/site-packages/chromadb/test/property/test_embeddings.py deleted file mode 100644 index d0211c6a41fce100744e413ad4a1275cf9b42b73..0000000000000000000000000000000000000000 --- a/spaces/SungBeom/chatwine-korean/.venv/Lib/site-packages/chromadb/test/property/test_embeddings.py +++ /dev/null @@ -1,302 +0,0 @@ -import pytest -import logging -import hypothesis.strategies as st -from typing import Set, cast, Union, DefaultDict -from dataclasses import dataclass -from chromadb.api.types import ID, Include, IDs -import chromadb.errors as errors -from chromadb.api import API -from chromadb.api.models.Collection import Collection -import chromadb.test.property.strategies as strategies -from hypothesis.stateful import ( - Bundle, - RuleBasedStateMachine, - MultipleResults, - rule, - initialize, - precondition, - consumes, - run_state_machine_as_test, - multiple, - invariant, -) -from collections import defaultdict -import chromadb.test.property.invariants as invariants -import numpy as np - - -traces: DefaultDict[str, int] = defaultdict(lambda: 0) - - -def trace(key: str) -> None: - global traces - traces[key] += 1 - - -def print_traces() -> None: - global traces - for key, value in traces.items(): - print(f"{key}: {value}") - - -dtype_shared_st: st.SearchStrategy[ - Union[np.float16, np.float32, np.float64] -] = st.shared(st.sampled_from(strategies.float_types), key="dtype") - -dimension_shared_st: st.SearchStrategy[int] = st.shared( - st.integers(min_value=2, max_value=2048), key="dimension" -) - - -@dataclass -class EmbeddingStateMachineStates: - initialize = "initialize" - add_embeddings = "add_embeddings" - delete_by_ids = "delete_by_ids" - update_embeddings = "update_embeddings" - upsert_embeddings = "upsert_embeddings" - - -collection_st = st.shared(strategies.collections(with_hnsw_params=True), key="coll") - - -class EmbeddingStateMachine(RuleBasedStateMachine): - collection: Collection - embedding_ids: Bundle[ID] = Bundle("embedding_ids") - - def __init__(self, api: API): - super().__init__() - self.api = api - self._rules_strategy = strategies.DeterministicRuleStrategy(self) # type: ignore - - @initialize(collection=collection_st) # type: ignore - def initialize(self, collection: strategies.Collection): - self.api.reset() - self.collection = self.api.create_collection( - name=collection.name, - metadata=collection.metadata, - embedding_function=collection.embedding_function, - ) - self.embedding_function = collection.embedding_function - trace("init") - self.on_state_change(EmbeddingStateMachineStates.initialize) - - self.record_set_state = strategies.StateMachineRecordSet( - ids=[], metadatas=[], documents=[], embeddings=[] - ) - - @rule(target=embedding_ids, record_set=strategies.recordsets(collection_st)) - def add_embeddings(self, record_set: strategies.RecordSet) -> MultipleResults[ID]: - trace("add_embeddings") - self.on_state_change(EmbeddingStateMachineStates.add_embeddings) - - normalized_record_set: strategies.NormalizedRecordSet = invariants.wrap_all( - record_set - ) - - if len(normalized_record_set["ids"]) > 0: - trace("add_more_embeddings") - - if set(normalized_record_set["ids"]).intersection( - set(self.record_set_state["ids"]) - ): - with pytest.raises(errors.IDAlreadyExistsError): - self.collection.add(**normalized_record_set) - return multiple() - else: - self.collection.add(**normalized_record_set) - self._upsert_embeddings(cast(strategies.RecordSet, normalized_record_set)) - return multiple(*normalized_record_set["ids"]) - - @precondition(lambda self: len(self.record_set_state["ids"]) > 20) - @rule(ids=st.lists(consumes(embedding_ids), min_size=1, max_size=20)) - def delete_by_ids(self, ids: IDs) -> None: - trace("remove embeddings") - self.on_state_change(EmbeddingStateMachineStates.delete_by_ids) - indices_to_remove = [self.record_set_state["ids"].index(id) for id in ids] - - self.collection.delete(ids=ids) - self._remove_embeddings(set(indices_to_remove)) - - # Removing the precondition causes the tests to frequently fail as "unsatisfiable" - # Using a value < 5 causes retries and lowers the number of valid samples - @precondition(lambda self: len(self.record_set_state["ids"]) >= 5) - @rule( - record_set=strategies.recordsets( - collection_strategy=collection_st, - id_strategy=embedding_ids, - min_size=1, - max_size=5, - ) - ) - def update_embeddings(self, record_set: strategies.RecordSet) -> None: - trace("update embeddings") - self.on_state_change(EmbeddingStateMachineStates.update_embeddings) - self.collection.update(**record_set) - self._upsert_embeddings(record_set) - - # Using a value < 3 causes more retries and lowers the number of valid samples - @precondition(lambda self: len(self.record_set_state["ids"]) >= 3) - @rule( - record_set=strategies.recordsets( - collection_strategy=collection_st, - id_strategy=st.one_of(embedding_ids, strategies.safe_text), - min_size=1, - max_size=5, - ) - ) - def upsert_embeddings(self, record_set: strategies.RecordSet) -> None: - trace("upsert embeddings") - self.on_state_change(EmbeddingStateMachineStates.upsert_embeddings) - self.collection.upsert(**record_set) - self._upsert_embeddings(record_set) - - @invariant() - def count(self) -> None: - invariants.count( - self.collection, cast(strategies.RecordSet, self.record_set_state) - ) - - @invariant() - def no_duplicates(self) -> None: - invariants.no_duplicates(self.collection) - - @invariant() - def ann_accuracy(self) -> None: - invariants.ann_accuracy( - collection=self.collection, - record_set=cast(strategies.RecordSet, self.record_set_state), - min_recall=0.95, - embedding_function=self.embedding_function, - ) - - def _upsert_embeddings(self, record_set: strategies.RecordSet) -> None: - normalized_record_set: strategies.NormalizedRecordSet = invariants.wrap_all( - record_set - ) - for idx, id in enumerate(normalized_record_set["ids"]): - # Update path - if id in self.record_set_state["ids"]: - target_idx = self.record_set_state["ids"].index(id) - if normalized_record_set["embeddings"] is not None: - self.record_set_state["embeddings"][ - target_idx - ] = normalized_record_set["embeddings"][idx] - else: - assert normalized_record_set["documents"] is not None - assert self.embedding_function is not None - self.record_set_state["embeddings"][ - target_idx - ] = self.embedding_function( - [normalized_record_set["documents"][idx]] - )[ - 0 - ] - if normalized_record_set["metadatas"] is not None: - self.record_set_state["metadatas"][ - target_idx - ] = normalized_record_set["metadatas"][idx] - if normalized_record_set["documents"] is not None: - self.record_set_state["documents"][ - target_idx - ] = normalized_record_set["documents"][idx] - else: - # Add path - self.record_set_state["ids"].append(id) - if normalized_record_set["embeddings"] is not None: - self.record_set_state["embeddings"].append( - normalized_record_set["embeddings"][idx] - ) - else: - assert self.embedding_function is not None - assert normalized_record_set["documents"] is not None - self.record_set_state["embeddings"].append( - self.embedding_function( - [normalized_record_set["documents"][idx]] - )[0] - ) - if normalized_record_set["metadatas"] is not None: - self.record_set_state["metadatas"].append( - normalized_record_set["metadatas"][idx] - ) - else: - self.record_set_state["metadatas"].append(None) - if normalized_record_set["documents"] is not None: - self.record_set_state["documents"].append( - normalized_record_set["documents"][idx] - ) - else: - self.record_set_state["documents"].append(None) - - def _remove_embeddings(self, indices_to_remove: Set[int]) -> None: - indices_list = list(indices_to_remove) - indices_list.sort(reverse=True) - - for i in indices_list: - del self.record_set_state["ids"][i] - del self.record_set_state["embeddings"][i] - del self.record_set_state["metadatas"][i] - del self.record_set_state["documents"][i] - - def on_state_change(self, new_state: str) -> None: - pass - - -def test_embeddings_state(caplog: pytest.LogCaptureFixture, api: API) -> None: - caplog.set_level(logging.ERROR) - run_state_machine_as_test(lambda: EmbeddingStateMachine(api)) # type: ignore - print_traces() - - -def test_multi_add(api: API) -> None: - api.reset() - coll = api.create_collection(name="foo") - coll.add(ids=["a"], embeddings=[[0.0]]) - assert coll.count() == 1 - - with pytest.raises(errors.IDAlreadyExistsError): - coll.add(ids=["a"], embeddings=[[0.0]]) - - assert coll.count() == 1 - - results = coll.get() - assert results["ids"] == ["a"] - - coll.delete(ids=["a"]) - assert coll.count() == 0 - - -def test_dup_add(api: API) -> None: - api.reset() - coll = api.create_collection(name="foo") - with pytest.raises(errors.DuplicateIDError): - coll.add(ids=["a", "a"], embeddings=[[0.0], [1.1]]) - with pytest.raises(errors.DuplicateIDError): - coll.upsert(ids=["a", "a"], embeddings=[[0.0], [1.1]]) - - -def test_query_without_add(api: API) -> None: - api.reset() - coll = api.create_collection(name="foo") - fields: Include = ["documents", "metadatas", "embeddings", "distances"] - N = np.random.randint(1, 2000) - K = np.random.randint(1, 100) - results = coll.query( - query_embeddings=np.random.random((N, K)).tolist(), include=fields - ) - for field in fields: - field_results = results[field] - assert field_results is not None - assert all([len(result) == 0 for result in field_results]) - - -# TODO: Use SQL escaping correctly internally -@pytest.mark.xfail(reason="We don't properly escape SQL internally, causing problems") -def test_escape_chars_in_ids(api: API) -> None: - api.reset() - id = "\x1f" - coll = api.create_collection(name="foo") - coll.add(ids=[id], embeddings=[[0.0]]) - assert coll.count() == 1 - coll.delete(ids=[id]) - assert coll.count() == 0 diff --git a/spaces/SungBeom/chatwine-korean/.venv/Lib/site-packages/click/decorators.py b/spaces/SungBeom/chatwine-korean/.venv/Lib/site-packages/click/decorators.py deleted file mode 100644 index 28618dc52379eafc72a5a1005a679d418d879692..0000000000000000000000000000000000000000 --- a/spaces/SungBeom/chatwine-korean/.venv/Lib/site-packages/click/decorators.py +++ /dev/null @@ -1,497 +0,0 @@ -import inspect -import types -import typing as t -from functools import update_wrapper -from gettext import gettext as _ - -from .core import Argument -from .core import Command -from .core import Context -from .core import Group -from .core import Option -from .core import Parameter -from .globals import get_current_context -from .utils import echo - -F = t.TypeVar("F", bound=t.Callable[..., t.Any]) -FC = t.TypeVar("FC", bound=t.Union[t.Callable[..., t.Any], Command]) - - -def pass_context(f: F) -> F: - """Marks a callback as wanting to receive the current context - object as first argument. - """ - - def new_func(*args, **kwargs): # type: ignore - return f(get_current_context(), *args, **kwargs) - - return update_wrapper(t.cast(F, new_func), f) - - -def pass_obj(f: F) -> F: - """Similar to :func:`pass_context`, but only pass the object on the - context onwards (:attr:`Context.obj`). This is useful if that object - represents the state of a nested system. - """ - - def new_func(*args, **kwargs): # type: ignore - return f(get_current_context().obj, *args, **kwargs) - - return update_wrapper(t.cast(F, new_func), f) - - -def make_pass_decorator( - object_type: t.Type, ensure: bool = False -) -> "t.Callable[[F], F]": - """Given an object type this creates a decorator that will work - similar to :func:`pass_obj` but instead of passing the object of the - current context, it will find the innermost context of type - :func:`object_type`. - - This generates a decorator that works roughly like this:: - - from functools import update_wrapper - - def decorator(f): - @pass_context - def new_func(ctx, *args, **kwargs): - obj = ctx.find_object(object_type) - return ctx.invoke(f, obj, *args, **kwargs) - return update_wrapper(new_func, f) - return decorator - - :param object_type: the type of the object to pass. - :param ensure: if set to `True`, a new object will be created and - remembered on the context if it's not there yet. - """ - - def decorator(f: F) -> F: - def new_func(*args, **kwargs): # type: ignore - ctx = get_current_context() - - if ensure: - obj = ctx.ensure_object(object_type) - else: - obj = ctx.find_object(object_type) - - if obj is None: - raise RuntimeError( - "Managed to invoke callback without a context" - f" object of type {object_type.__name__!r}" - " existing." - ) - - return ctx.invoke(f, obj, *args, **kwargs) - - return update_wrapper(t.cast(F, new_func), f) - - return decorator - - -def pass_meta_key( - key: str, *, doc_description: t.Optional[str] = None -) -> "t.Callable[[F], F]": - """Create a decorator that passes a key from - :attr:`click.Context.meta` as the first argument to the decorated - function. - - :param key: Key in ``Context.meta`` to pass. - :param doc_description: Description of the object being passed, - inserted into the decorator's docstring. Defaults to "the 'key' - key from Context.meta". - - .. versionadded:: 8.0 - """ - - def decorator(f: F) -> F: - def new_func(*args, **kwargs): # type: ignore - ctx = get_current_context() - obj = ctx.meta[key] - return ctx.invoke(f, obj, *args, **kwargs) - - return update_wrapper(t.cast(F, new_func), f) - - if doc_description is None: - doc_description = f"the {key!r} key from :attr:`click.Context.meta`" - - decorator.__doc__ = ( - f"Decorator that passes {doc_description} as the first argument" - " to the decorated function." - ) - return decorator - - -CmdType = t.TypeVar("CmdType", bound=Command) - - -@t.overload -def command( - __func: t.Callable[..., t.Any], -) -> Command: - ... - - -@t.overload -def command( - name: t.Optional[str] = None, - **attrs: t.Any, -) -> t.Callable[..., Command]: - ... - - -@t.overload -def command( - name: t.Optional[str] = None, - cls: t.Type[CmdType] = ..., - **attrs: t.Any, -) -> t.Callable[..., CmdType]: - ... - - -def command( - name: t.Union[str, t.Callable[..., t.Any], None] = None, - cls: t.Optional[t.Type[Command]] = None, - **attrs: t.Any, -) -> t.Union[Command, t.Callable[..., Command]]: - r"""Creates a new :class:`Command` and uses the decorated function as - callback. This will also automatically attach all decorated - :func:`option`\s and :func:`argument`\s as parameters to the command. - - The name of the command defaults to the name of the function with - underscores replaced by dashes. If you want to change that, you can - pass the intended name as the first argument. - - All keyword arguments are forwarded to the underlying command class. - For the ``params`` argument, any decorated params are appended to - the end of the list. - - Once decorated the function turns into a :class:`Command` instance - that can be invoked as a command line utility or be attached to a - command :class:`Group`. - - :param name: the name of the command. This defaults to the function - name with underscores replaced by dashes. - :param cls: the command class to instantiate. This defaults to - :class:`Command`. - - .. versionchanged:: 8.1 - This decorator can be applied without parentheses. - - .. versionchanged:: 8.1 - The ``params`` argument can be used. Decorated params are - appended to the end of the list. - """ - - func: t.Optional[t.Callable[..., t.Any]] = None - - if callable(name): - func = name - name = None - assert cls is None, "Use 'command(cls=cls)(callable)' to specify a class." - assert not attrs, "Use 'command(**kwargs)(callable)' to provide arguments." - - if cls is None: - cls = Command - - def decorator(f: t.Callable[..., t.Any]) -> Command: - if isinstance(f, Command): - raise TypeError("Attempted to convert a callback into a command twice.") - - attr_params = attrs.pop("params", None) - params = attr_params if attr_params is not None else [] - - try: - decorator_params = f.__click_params__ # type: ignore - except AttributeError: - pass - else: - del f.__click_params__ # type: ignore - params.extend(reversed(decorator_params)) - - if attrs.get("help") is None: - attrs["help"] = f.__doc__ - - cmd = cls( # type: ignore[misc] - name=name or f.__name__.lower().replace("_", "-"), # type: ignore[arg-type] - callback=f, - params=params, - **attrs, - ) - cmd.__doc__ = f.__doc__ - return cmd - - if func is not None: - return decorator(func) - - return decorator - - -@t.overload -def group( - __func: t.Callable[..., t.Any], -) -> Group: - ... - - -@t.overload -def group( - name: t.Optional[str] = None, - **attrs: t.Any, -) -> t.Callable[[F], Group]: - ... - - -def group( - name: t.Union[str, t.Callable[..., t.Any], None] = None, **attrs: t.Any -) -> t.Union[Group, t.Callable[[F], Group]]: - """Creates a new :class:`Group` with a function as callback. This - works otherwise the same as :func:`command` just that the `cls` - parameter is set to :class:`Group`. - - .. versionchanged:: 8.1 - This decorator can be applied without parentheses. - """ - if attrs.get("cls") is None: - attrs["cls"] = Group - - if callable(name): - grp: t.Callable[[F], Group] = t.cast(Group, command(**attrs)) - return grp(name) - - return t.cast(Group, command(name, **attrs)) - - -def _param_memo(f: FC, param: Parameter) -> None: - if isinstance(f, Command): - f.params.append(param) - else: - if not hasattr(f, "__click_params__"): - f.__click_params__ = [] # type: ignore - - f.__click_params__.append(param) # type: ignore - - -def argument(*param_decls: str, **attrs: t.Any) -> t.Callable[[FC], FC]: - """Attaches an argument to the command. All positional arguments are - passed as parameter declarations to :class:`Argument`; all keyword - arguments are forwarded unchanged (except ``cls``). - This is equivalent to creating an :class:`Argument` instance manually - and attaching it to the :attr:`Command.params` list. - - :param cls: the argument class to instantiate. This defaults to - :class:`Argument`. - """ - - def decorator(f: FC) -> FC: - ArgumentClass = attrs.pop("cls", None) or Argument - _param_memo(f, ArgumentClass(param_decls, **attrs)) - return f - - return decorator - - -def option(*param_decls: str, **attrs: t.Any) -> t.Callable[[FC], FC]: - """Attaches an option to the command. All positional arguments are - passed as parameter declarations to :class:`Option`; all keyword - arguments are forwarded unchanged (except ``cls``). - This is equivalent to creating an :class:`Option` instance manually - and attaching it to the :attr:`Command.params` list. - - :param cls: the option class to instantiate. This defaults to - :class:`Option`. - """ - - def decorator(f: FC) -> FC: - # Issue 926, copy attrs, so pre-defined options can re-use the same cls= - option_attrs = attrs.copy() - OptionClass = option_attrs.pop("cls", None) or Option - _param_memo(f, OptionClass(param_decls, **option_attrs)) - return f - - return decorator - - -def confirmation_option(*param_decls: str, **kwargs: t.Any) -> t.Callable[[FC], FC]: - """Add a ``--yes`` option which shows a prompt before continuing if - not passed. If the prompt is declined, the program will exit. - - :param param_decls: One or more option names. Defaults to the single - value ``"--yes"``. - :param kwargs: Extra arguments are passed to :func:`option`. - """ - - def callback(ctx: Context, param: Parameter, value: bool) -> None: - if not value: - ctx.abort() - - if not param_decls: - param_decls = ("--yes",) - - kwargs.setdefault("is_flag", True) - kwargs.setdefault("callback", callback) - kwargs.setdefault("expose_value", False) - kwargs.setdefault("prompt", "Do you want to continue?") - kwargs.setdefault("help", "Confirm the action without prompting.") - return option(*param_decls, **kwargs) - - -def password_option(*param_decls: str, **kwargs: t.Any) -> t.Callable[[FC], FC]: - """Add a ``--password`` option which prompts for a password, hiding - input and asking to enter the value again for confirmation. - - :param param_decls: One or more option names. Defaults to the single - value ``"--password"``. - :param kwargs: Extra arguments are passed to :func:`option`. - """ - if not param_decls: - param_decls = ("--password",) - - kwargs.setdefault("prompt", True) - kwargs.setdefault("confirmation_prompt", True) - kwargs.setdefault("hide_input", True) - return option(*param_decls, **kwargs) - - -def version_option( - version: t.Optional[str] = None, - *param_decls: str, - package_name: t.Optional[str] = None, - prog_name: t.Optional[str] = None, - message: t.Optional[str] = None, - **kwargs: t.Any, -) -> t.Callable[[FC], FC]: - """Add a ``--version`` option which immediately prints the version - number and exits the program. - - If ``version`` is not provided, Click will try to detect it using - :func:`importlib.metadata.version` to get the version for the - ``package_name``. On Python < 3.8, the ``importlib_metadata`` - backport must be installed. - - If ``package_name`` is not provided, Click will try to detect it by - inspecting the stack frames. This will be used to detect the - version, so it must match the name of the installed package. - - :param version: The version number to show. If not provided, Click - will try to detect it. - :param param_decls: One or more option names. Defaults to the single - value ``"--version"``. - :param package_name: The package name to detect the version from. If - not provided, Click will try to detect it. - :param prog_name: The name of the CLI to show in the message. If not - provided, it will be detected from the command. - :param message: The message to show. The values ``%(prog)s``, - ``%(package)s``, and ``%(version)s`` are available. Defaults to - ``"%(prog)s, version %(version)s"``. - :param kwargs: Extra arguments are passed to :func:`option`. - :raise RuntimeError: ``version`` could not be detected. - - .. versionchanged:: 8.0 - Add the ``package_name`` parameter, and the ``%(package)s`` - value for messages. - - .. versionchanged:: 8.0 - Use :mod:`importlib.metadata` instead of ``pkg_resources``. The - version is detected based on the package name, not the entry - point name. The Python package name must match the installed - package name, or be passed with ``package_name=``. - """ - if message is None: - message = _("%(prog)s, version %(version)s") - - if version is None and package_name is None: - frame = inspect.currentframe() - f_back = frame.f_back if frame is not None else None - f_globals = f_back.f_globals if f_back is not None else None - # break reference cycle - # https://docs.python.org/3/library/inspect.html#the-interpreter-stack - del frame - - if f_globals is not None: - package_name = f_globals.get("__name__") - - if package_name == "__main__": - package_name = f_globals.get("__package__") - - if package_name: - package_name = package_name.partition(".")[0] - - def callback(ctx: Context, param: Parameter, value: bool) -> None: - if not value or ctx.resilient_parsing: - return - - nonlocal prog_name - nonlocal version - - if prog_name is None: - prog_name = ctx.find_root().info_name - - if version is None and package_name is not None: - metadata: t.Optional[types.ModuleType] - - try: - from importlib import metadata # type: ignore - except ImportError: - # Python < 3.8 - import importlib_metadata as metadata # type: ignore - - try: - version = metadata.version(package_name) # type: ignore - except metadata.PackageNotFoundError: # type: ignore - raise RuntimeError( - f"{package_name!r} is not installed. Try passing" - " 'package_name' instead." - ) from None - - if version is None: - raise RuntimeError( - f"Could not determine the version for {package_name!r} automatically." - ) - - echo( - t.cast(str, message) - % {"prog": prog_name, "package": package_name, "version": version}, - color=ctx.color, - ) - ctx.exit() - - if not param_decls: - param_decls = ("--version",) - - kwargs.setdefault("is_flag", True) - kwargs.setdefault("expose_value", False) - kwargs.setdefault("is_eager", True) - kwargs.setdefault("help", _("Show the version and exit.")) - kwargs["callback"] = callback - return option(*param_decls, **kwargs) - - -def help_option(*param_decls: str, **kwargs: t.Any) -> t.Callable[[FC], FC]: - """Add a ``--help`` option which immediately prints the help page - and exits the program. - - This is usually unnecessary, as the ``--help`` option is added to - each command automatically unless ``add_help_option=False`` is - passed. - - :param param_decls: One or more option names. Defaults to the single - value ``"--help"``. - :param kwargs: Extra arguments are passed to :func:`option`. - """ - - def callback(ctx: Context, param: Parameter, value: bool) -> None: - if not value or ctx.resilient_parsing: - return - - echo(ctx.get_help(), color=ctx.color) - ctx.exit() - - if not param_decls: - param_decls = ("--help",) - - kwargs.setdefault("is_flag", True) - kwargs.setdefault("expose_value", False) - kwargs.setdefault("is_eager", True) - kwargs.setdefault("help", _("Show this message and exit.")) - kwargs["callback"] = callback - return option(*param_decls, **kwargs) diff --git a/spaces/Superlang/ImageProcessor/annotator/normalbae/models/submodules/efficientnet_repo/geffnet/activations/activations_jit.py b/spaces/Superlang/ImageProcessor/annotator/normalbae/models/submodules/efficientnet_repo/geffnet/activations/activations_jit.py deleted file mode 100644 index 7176b05e779787528a47f20d55d64d4a0f219360..0000000000000000000000000000000000000000 --- a/spaces/Superlang/ImageProcessor/annotator/normalbae/models/submodules/efficientnet_repo/geffnet/activations/activations_jit.py +++ /dev/null @@ -1,79 +0,0 @@ -""" Activations (jit) - -A collection of jit-scripted activations fn and modules with a common interface so that they can -easily be swapped. All have an `inplace` arg even if not used. - -All jit scripted activations are lacking in-place variations on purpose, scripted kernel fusion does not -currently work across in-place op boundaries, thus performance is equal to or less than the non-scripted -versions if they contain in-place ops. - -Copyright 2020 Ross Wightman -""" - -import torch -from torch import nn as nn -from torch.nn import functional as F - -__all__ = ['swish_jit', 'SwishJit', 'mish_jit', 'MishJit', - 'hard_sigmoid_jit', 'HardSigmoidJit', 'hard_swish_jit', 'HardSwishJit'] - - -@torch.jit.script -def swish_jit(x, inplace: bool = False): - """Swish - Described originally as SiLU (https://arxiv.org/abs/1702.03118v3) - and also as Swish (https://arxiv.org/abs/1710.05941). - - TODO Rename to SiLU with addition to PyTorch - """ - return x.mul(x.sigmoid()) - - -@torch.jit.script -def mish_jit(x, _inplace: bool = False): - """Mish: A Self Regularized Non-Monotonic Neural Activation Function - https://arxiv.org/abs/1908.08681 - """ - return x.mul(F.softplus(x).tanh()) - - -class SwishJit(nn.Module): - def __init__(self, inplace: bool = False): - super(SwishJit, self).__init__() - - def forward(self, x): - return swish_jit(x) - - -class MishJit(nn.Module): - def __init__(self, inplace: bool = False): - super(MishJit, self).__init__() - - def forward(self, x): - return mish_jit(x) - - -@torch.jit.script -def hard_sigmoid_jit(x, inplace: bool = False): - # return F.relu6(x + 3.) / 6. - return (x + 3).clamp(min=0, max=6).div(6.) # clamp seems ever so slightly faster? - - -class HardSigmoidJit(nn.Module): - def __init__(self, inplace: bool = False): - super(HardSigmoidJit, self).__init__() - - def forward(self, x): - return hard_sigmoid_jit(x) - - -@torch.jit.script -def hard_swish_jit(x, inplace: bool = False): - # return x * (F.relu6(x + 3.) / 6) - return x * (x + 3).clamp(min=0, max=6).div(6.) # clamp seems ever so slightly faster? - - -class HardSwishJit(nn.Module): - def __init__(self, inplace: bool = False): - super(HardSwishJit, self).__init__() - - def forward(self, x): - return hard_swish_jit(x) diff --git a/spaces/Superlang/ImageProcessor/annotator/uniformer/configs/_base_/models/gcnet_r50-d8.py b/spaces/Superlang/ImageProcessor/annotator/uniformer/configs/_base_/models/gcnet_r50-d8.py deleted file mode 100644 index 3d2ad69f5c22adfe79d5fdabf920217628987166..0000000000000000000000000000000000000000 --- a/spaces/Superlang/ImageProcessor/annotator/uniformer/configs/_base_/models/gcnet_r50-d8.py +++ /dev/null @@ -1,46 +0,0 @@ -# model settings -norm_cfg = dict(type='SyncBN', requires_grad=True) -model = dict( - type='EncoderDecoder', - pretrained='open-mmlab://resnet50_v1c', - backbone=dict( - type='ResNetV1c', - depth=50, - num_stages=4, - out_indices=(0, 1, 2, 3), - dilations=(1, 1, 2, 4), - strides=(1, 2, 1, 1), - norm_cfg=norm_cfg, - norm_eval=False, - style='pytorch', - contract_dilation=True), - decode_head=dict( - type='GCHead', - in_channels=2048, - in_index=3, - channels=512, - ratio=1 / 4., - pooling_type='att', - fusion_types=('channel_add', ), - dropout_ratio=0.1, - num_classes=19, - norm_cfg=norm_cfg, - align_corners=False, - loss_decode=dict( - type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)), - auxiliary_head=dict( - type='FCNHead', - in_channels=1024, - in_index=2, - channels=256, - num_convs=1, - concat_input=False, - dropout_ratio=0.1, - num_classes=19, - norm_cfg=norm_cfg, - align_corners=False, - loss_decode=dict( - type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)), - # model training and testing settings - train_cfg=dict(), - test_cfg=dict(mode='whole')) diff --git a/spaces/TEL123/Real-CUGAN/app.py b/spaces/TEL123/Real-CUGAN/app.py deleted file mode 100644 index 2439c5cec6b61e8a517f957daf710cbb6b5c3cf6..0000000000000000000000000000000000000000 --- a/spaces/TEL123/Real-CUGAN/app.py +++ /dev/null @@ -1,62 +0,0 @@ -from upcunet_v3 import RealWaifuUpScaler -import gradio as gr -import time -import logging -import os -from PIL import ImageOps -import numpy as np -import math - - -def greet(input_img, input_model_name, input_tile_mode): - # if input_img.size[0] * input_img.size[1] > 256 * 256: - # y = int(math.sqrt(256*256/input_img.size[0]*input_img.size[1])) - # x = int(input_img.size[0]/input_img.size[1]*y) - # input_img = ImageOps.fit(input_img, (x, y)) - input_img = np.array(input_img) - if input_model_name not in model_cache: - t1 = time.time() - upscaler = RealWaifuUpScaler(input_model_name[2], ModelPath + input_model_name, half=False, device="cpu") - t2 = time.time() - logger.info(f'load model time, {t2 - t1}') - model_cache[input_model_name] = upscaler - else: - upscaler = model_cache[input_model_name] - logger.info(f'load model from cache') - - start = time.time() - result = upscaler(input_img, tile_mode=input_tile_mode) - end = time.time() - logger.info(f'input_model_name, {input_model_name}') - logger.info(f'input_tile_mode, {input_tile_mode}') - logger.info(f'input shape, {input_img.shape}') - logger.info(f'output shape, {result.shape}') - logger.info(f'speed time, {end - start}') - return result - - -if __name__ == '__main__': - logging.basicConfig(level=logging.INFO, format="[%(asctime)s] [%(process)d] [%(levelname)s] %(message)s") - logger = logging.getLogger() - - ModelPath = "weights_v3/" - model_cache = {} - - input_model_name = gr.inputs.Dropdown(os.listdir(ModelPath), default="up2x-latest-denoise2x.pth", label='选择model') - input_tile_mode = gr.inputs.Dropdown([0, 1, 2, 3, 4], default=2, label='选择tile_mode') - input_img = gr.inputs.Image(label='image', type='pil') - - inputs = [input_img, input_model_name, input_tile_mode] - outputs = "image" - iface = gr.Interface(fn=greet, - inputs=inputs, - outputs=outputs, - allow_screenshot=False, - allow_flagging='never', - examples=[['test-img.jpg', "up2x-latest-denoise2x.pth", 2]], - article='[https://github.com/bilibili/ailab/tree/main/Real-CUGAN](https://github.com/bilibili/ailab/tree/main/Real-CUGAN)<br>' - '感谢b站开源的项目,图片过大会导致内存不足,所有我将图片裁剪小,想体验大图片的效果请自行前往上面的链接。<br>' - '修改bbb' - 'The large image will lead to memory limit exceeded. So I crop and resize image. ' - 'If you want to experience the large image, please go to the link above.') - iface.launch() diff --git a/spaces/TandCAcceptMe/face-swap-docker/mynewshinyroop/Lib/site-packages/pip/_internal/metadata/importlib/_compat.py b/spaces/TandCAcceptMe/face-swap-docker/mynewshinyroop/Lib/site-packages/pip/_internal/metadata/importlib/_compat.py deleted file mode 100644 index 593bff23edecd3c517c96e119ee777bd4ee1d9d0..0000000000000000000000000000000000000000 --- a/spaces/TandCAcceptMe/face-swap-docker/mynewshinyroop/Lib/site-packages/pip/_internal/metadata/importlib/_compat.py +++ /dev/null @@ -1,55 +0,0 @@ -import importlib.metadata -from typing import Any, Optional, Protocol, cast - - -class BadMetadata(ValueError): - def __init__(self, dist: importlib.metadata.Distribution, *, reason: str) -> None: - self.dist = dist - self.reason = reason - - def __str__(self) -> str: - return f"Bad metadata in {self.dist} ({self.reason})" - - -class BasePath(Protocol): - """A protocol that various path objects conform. - - This exists because importlib.metadata uses both ``pathlib.Path`` and - ``zipfile.Path``, and we need a common base for type hints (Union does not - work well since ``zipfile.Path`` is too new for our linter setup). - - This does not mean to be exhaustive, but only contains things that present - in both classes *that we need*. - """ - - @property - def name(self) -> str: - raise NotImplementedError() - - @property - def parent(self) -> "BasePath": - raise NotImplementedError() - - -def get_info_location(d: importlib.metadata.Distribution) -> Optional[BasePath]: - """Find the path to the distribution's metadata directory. - - HACK: This relies on importlib.metadata's private ``_path`` attribute. Not - all distributions exist on disk, so importlib.metadata is correct to not - expose the attribute as public. But pip's code base is old and not as clean, - so we do this to avoid having to rewrite too many things. Hopefully we can - eliminate this some day. - """ - return getattr(d, "_path", None) - - -def get_dist_name(dist: importlib.metadata.Distribution) -> str: - """Get the distribution's project name. - - The ``name`` attribute is only available in Python 3.10 or later. We are - targeting exactly that, but Mypy does not know this. - """ - name = cast(Any, dist).name - if not isinstance(name, str): - raise BadMetadata(dist, reason="invalid metadata entry 'name'") - return name diff --git a/spaces/TandCAcceptMe/face-swap-docker/mynewshinyroop/Lib/site-packages/pip/_vendor/packaging/utils.py b/spaces/TandCAcceptMe/face-swap-docker/mynewshinyroop/Lib/site-packages/pip/_vendor/packaging/utils.py deleted file mode 100644 index bab11b80c60f10a4f3bccb12eb5b17c48a449767..0000000000000000000000000000000000000000 --- a/spaces/TandCAcceptMe/face-swap-docker/mynewshinyroop/Lib/site-packages/pip/_vendor/packaging/utils.py +++ /dev/null @@ -1,136 +0,0 @@ -# This file is dual licensed under the terms of the Apache License, Version -# 2.0, and the BSD License. See the LICENSE file in the root of this repository -# for complete details. - -import re -from typing import FrozenSet, NewType, Tuple, Union, cast - -from .tags import Tag, parse_tag -from .version import InvalidVersion, Version - -BuildTag = Union[Tuple[()], Tuple[int, str]] -NormalizedName = NewType("NormalizedName", str) - - -class InvalidWheelFilename(ValueError): - """ - An invalid wheel filename was found, users should refer to PEP 427. - """ - - -class InvalidSdistFilename(ValueError): - """ - An invalid sdist filename was found, users should refer to the packaging user guide. - """ - - -_canonicalize_regex = re.compile(r"[-_.]+") -# PEP 427: The build number must start with a digit. -_build_tag_regex = re.compile(r"(\d+)(.*)") - - -def canonicalize_name(name: str) -> NormalizedName: - # This is taken from PEP 503. - value = _canonicalize_regex.sub("-", name).lower() - return cast(NormalizedName, value) - - -def canonicalize_version(version: Union[Version, str]) -> str: - """ - This is very similar to Version.__str__, but has one subtle difference - with the way it handles the release segment. - """ - if isinstance(version, str): - try: - parsed = Version(version) - except InvalidVersion: - # Legacy versions cannot be normalized - return version - else: - parsed = version - - parts = [] - - # Epoch - if parsed.epoch != 0: - parts.append(f"{parsed.epoch}!") - - # Release segment - # NB: This strips trailing '.0's to normalize - parts.append(re.sub(r"(\.0)+$", "", ".".join(str(x) for x in parsed.release))) - - # Pre-release - if parsed.pre is not None: - parts.append("".join(str(x) for x in parsed.pre)) - - # Post-release - if parsed.post is not None: - parts.append(f".post{parsed.post}") - - # Development release - if parsed.dev is not None: - parts.append(f".dev{parsed.dev}") - - # Local version segment - if parsed.local is not None: - parts.append(f"+{parsed.local}") - - return "".join(parts) - - -def parse_wheel_filename( - filename: str, -) -> Tuple[NormalizedName, Version, BuildTag, FrozenSet[Tag]]: - if not filename.endswith(".whl"): - raise InvalidWheelFilename( - f"Invalid wheel filename (extension must be '.whl'): {filename}" - ) - - filename = filename[:-4] - dashes = filename.count("-") - if dashes not in (4, 5): - raise InvalidWheelFilename( - f"Invalid wheel filename (wrong number of parts): {filename}" - ) - - parts = filename.split("-", dashes - 2) - name_part = parts[0] - # See PEP 427 for the rules on escaping the project name - if "__" in name_part or re.match(r"^[\w\d._]*$", name_part, re.UNICODE) is None: - raise InvalidWheelFilename(f"Invalid project name: {filename}") - name = canonicalize_name(name_part) - version = Version(parts[1]) - if dashes == 5: - build_part = parts[2] - build_match = _build_tag_regex.match(build_part) - if build_match is None: - raise InvalidWheelFilename( - f"Invalid build number: {build_part} in '{filename}'" - ) - build = cast(BuildTag, (int(build_match.group(1)), build_match.group(2))) - else: - build = () - tags = parse_tag(parts[-1]) - return (name, version, build, tags) - - -def parse_sdist_filename(filename: str) -> Tuple[NormalizedName, Version]: - if filename.endswith(".tar.gz"): - file_stem = filename[: -len(".tar.gz")] - elif filename.endswith(".zip"): - file_stem = filename[: -len(".zip")] - else: - raise InvalidSdistFilename( - f"Invalid sdist filename (extension must be '.tar.gz' or '.zip'):" - f" {filename}" - ) - - # We are requiring a PEP 440 version, which cannot contain dashes, - # so we split on the last dash. - name_part, sep, version_part = file_stem.rpartition("-") - if not sep: - raise InvalidSdistFilename(f"Invalid sdist filename: {filename}") - - name = canonicalize_name(name_part) - version = Version(version_part) - return (name, version) diff --git a/spaces/TandCAcceptMe/face-swap-docker/mynewshinyroop/Lib/site-packages/pkg_resources/_vendor/packaging/_musllinux.py b/spaces/TandCAcceptMe/face-swap-docker/mynewshinyroop/Lib/site-packages/pkg_resources/_vendor/packaging/_musllinux.py deleted file mode 100644 index 706ba600a93c1b72594d96d3026daaa1998935b6..0000000000000000000000000000000000000000 --- a/spaces/TandCAcceptMe/face-swap-docker/mynewshinyroop/Lib/site-packages/pkg_resources/_vendor/packaging/_musllinux.py +++ /dev/null @@ -1,80 +0,0 @@ -"""PEP 656 support. - -This module implements logic to detect if the currently running Python is -linked against musl, and what musl version is used. -""" - -import functools -import re -import subprocess -import sys -from typing import Iterator, NamedTuple, Optional - -from ._elffile import ELFFile - - -class _MuslVersion(NamedTuple): - major: int - minor: int - - -def _parse_musl_version(output: str) -> Optional[_MuslVersion]: - lines = [n for n in (n.strip() for n in output.splitlines()) if n] - if len(lines) < 2 or lines[0][:4] != "musl": - return None - m = re.match(r"Version (\d+)\.(\d+)", lines[1]) - if not m: - return None - return _MuslVersion(major=int(m.group(1)), minor=int(m.group(2))) - - -@functools.lru_cache() -def _get_musl_version(executable: str) -> Optional[_MuslVersion]: - """Detect currently-running musl runtime version. - - This is done by checking the specified executable's dynamic linking - information, and invoking the loader to parse its output for a version - string. If the loader is musl, the output would be something like:: - - musl libc (x86_64) - Version 1.2.2 - Dynamic Program Loader - """ - try: - with open(executable, "rb") as f: - ld = ELFFile(f).interpreter - except (OSError, TypeError, ValueError): - return None - if ld is None or "musl" not in ld: - return None - proc = subprocess.run([ld], stderr=subprocess.PIPE, universal_newlines=True) - return _parse_musl_version(proc.stderr) - - -def platform_tags(arch: str) -> Iterator[str]: - """Generate musllinux tags compatible to the current platform. - - :param arch: Should be the part of platform tag after the ``linux_`` - prefix, e.g. ``x86_64``. The ``linux_`` prefix is assumed as a - prerequisite for the current platform to be musllinux-compatible. - - :returns: An iterator of compatible musllinux tags. - """ - sys_musl = _get_musl_version(sys.executable) - if sys_musl is None: # Python not dynamically linked against musl. - return - for minor in range(sys_musl.minor, -1, -1): - yield f"musllinux_{sys_musl.major}_{minor}_{arch}" - - -if __name__ == "__main__": # pragma: no cover - import sysconfig - - plat = sysconfig.get_platform() - assert plat.startswith("linux-"), "not linux" - - print("plat:", plat) - print("musl:", _get_musl_version(sys.executable)) - print("tags:", end=" ") - for t in platform_tags(re.sub(r"[.-]", "_", plat.split("-", 1)[-1])): - print(t, end="\n ") diff --git a/spaces/TencentARC/VLog/models/gpt_model.py b/spaces/TencentARC/VLog/models/gpt_model.py deleted file mode 100644 index 386b20406683db2118682c592de95bfe763aa0f5..0000000000000000000000000000000000000000 --- a/spaces/TencentARC/VLog/models/gpt_model.py +++ /dev/null @@ -1,102 +0,0 @@ -import os -import pdb -import pickle -from langchain.llms import OpenAI -from langchain.vectorstores.faiss import FAISS -from langchain.chains import ChatVectorDBChain -from langchain.prompts.prompt import PromptTemplate -from langchain.text_splitter import RecursiveCharacterTextSplitter -from langchain.document_loaders import UnstructuredFileLoader -from langchain.embeddings import OpenAIEmbeddings - -_template = """Given the following conversation and a follow up question, rephrase the follow up question to be a standalone question. -You can assume the discussion is about the video content. -Chat History: -{chat_history} -Follow Up Input: {question} -Standalone question:""" -CONDENSE_QUESTION_PROMPT = PromptTemplate.from_template(_template) - -qa_template = """You are an AI assistant designed for answering questions about a video. -You are given a document and a question, the document records what people see and hear from this video. -Try to connet these information and provide a conversational answer. -Question: {question} -========= -{context} -========= -""" -QA_PROMPT = PromptTemplate(template=qa_template, input_variables=["question", "context"]) - - -class LlmReasoner(): - def __init__(self, args): - self.history = [] - self.gpt_version = args.gpt_version - self.data_dir = args.data_dir - self.tmp_dir = args.tmp_dir - self.qa_chain = None - self.vectorstore = None - self.top_k = 3 - self.llm = OpenAI(temperature=0, model_name=self.gpt_version) - - def exist_vectorstore(self, video_id): - pkl_path = os.path.join(self.tmp_dir, f"{video_id}.pkl") - log_path = os.path.join(self.data_dir, f"{video_id}.log") - if os.path.exists(pkl_path) and os.path.exists(log_path): - with open(pkl_path, 'rb') as file: - self.vectorstore = pickle.load(file) - - self.qa_chain = ChatVectorDBChain.from_llm( - self.llm, - self.vectorstore, - qa_prompt=QA_PROMPT, - condense_question_prompt=CONDENSE_QUESTION_PROMPT, - ) - self.qa_chain.top_k_docs_for_context = self.top_k - return True - return False - - def create_vectorstore(self, video_id): - pkl_path = os.path.join(self.tmp_dir, f"{video_id}.pkl") - - if not os.path.exists(pkl_path): - loader = UnstructuredFileLoader(os.path.join(self.data_dir, f"{video_id}.log")) - raw_documents = loader.load() - - # Split text - text_splitter = RecursiveCharacterTextSplitter() - documents = text_splitter.split_documents(raw_documents) - - # Load Data to vectorstore - embeddings = OpenAIEmbeddings() - vectorstore = FAISS.from_documents(documents, embeddings) - - # Save vectorstore - with open(pkl_path, "wb") as f: - pickle.dump(vectorstore, f) - - - with open(pkl_path, 'rb') as file: - self.vectorstore = pickle.load(file) - - self.qa_chain = ChatVectorDBChain.from_llm( - self.llm, - self.vectorstore, - qa_prompt=QA_PROMPT, - condense_question_prompt=CONDENSE_QUESTION_PROMPT, - ) - self.qa_chain.top_k_docs_for_context = self.top_k - - return - - def __call__(self, question): - print(f"Question: {question}") - response = self.qa_chain({"question": question, "chat_history": self.history})["answer"] - self.history.append((question, response)) - - print(f"Assistant: {response}") - print("\n") - return response - - def clean_history(self): - self.history = [] diff --git a/spaces/TencentARC/VLog/models/grit_src/grit/data/datasets/grit_coco.py b/spaces/TencentARC/VLog/models/grit_src/grit/data/datasets/grit_coco.py deleted file mode 100644 index fea81f7dd8ad2c27dac8438753b845ab64cef81e..0000000000000000000000000000000000000000 --- a/spaces/TencentARC/VLog/models/grit_src/grit/data/datasets/grit_coco.py +++ /dev/null @@ -1,112 +0,0 @@ -import logging -import os -from fvcore.common.timer import Timer -from detectron2.structures import BoxMode -from fvcore.common.file_io import PathManager -from detectron2.data import DatasetCatalog, MetadataCatalog -from lvis import LVIS - -logger = logging.getLogger(__name__) - -__all__ = ["load_GRiTcoco_json", "register_GRiTcoco_instances"] - - -def register_GRiTcoco_instances(name, metadata, json_file, image_root): - """ - """ - DatasetCatalog.register(name, lambda: load_GRiTcoco_json( - json_file, image_root, name)) - MetadataCatalog.get(name).set( - json_file=json_file, image_root=image_root, - evaluator_type="coco", **metadata - ) - - -def get_GRiTcoco_meta(): - categories = [{'supercategory': 'object', 'id': 1, 'name': 'object'}] - categories = sorted(categories, key=lambda x: x["id"]) - thing_classes = [k["name"] for k in categories] - meta = {"thing_classes": thing_classes} - return meta - - -def load_GRiTcoco_json(json_file, image_root, dataset_name=None): - ''' - Load COCO class name text for object description for GRiT - ''' - - json_file = PathManager.get_local_path(json_file) - - timer = Timer() - lvis_api = LVIS(json_file) - if timer.seconds() > 1: - logger.info("Loading {} takes {:.2f} seconds.".format( - json_file, timer.seconds())) - - class_names = {} - sort_cat = sorted(lvis_api.dataset['categories'], key=lambda x: x['id']) - for x in sort_cat: - class_names[x['id']] = x['name'] - - img_ids = sorted(lvis_api.imgs.keys()) - imgs = lvis_api.load_imgs(img_ids) - anns = [lvis_api.img_ann_map[img_id] for img_id in img_ids] - - ann_ids = [ann["id"] for anns_per_image in anns for ann in anns_per_image] - assert len(set(ann_ids)) == len(ann_ids), \ - "Annotation ids in '{}' are not unique".format(json_file) - - imgs_anns = list(zip(imgs, anns)) - logger.info("Loaded {} images in the LVIS v1 format from {}".format( - len(imgs_anns), json_file)) - - dataset_dicts = [] - - for (img_dict, anno_dict_list) in imgs_anns: - record = {} - if "file_name" in img_dict: - file_name = img_dict["file_name"] - record["file_name"] = os.path.join(image_root, file_name) - - record["height"] = int(img_dict["height"]) - record["width"] = int(img_dict["width"]) - image_id = record["image_id"] = img_dict["id"] - - objs = [] - for anno in anno_dict_list: - assert anno["image_id"] == image_id - if anno.get('iscrowd', 0) > 0: - continue - obj = {"bbox": anno["bbox"], "bbox_mode": BoxMode.XYWH_ABS} - obj["category_id"] = 0 - obj["object_description"] = class_names[anno['category_id']] - if 'segmentation' in anno: - segm = anno["segmentation"] - valid_segm = [poly for poly in segm \ - if len(poly) % 2 == 0 and len(poly) >= 6] - if not len(segm) == len(valid_segm): - print('Annotation contains an invalid polygon with < 3 points') - assert len(segm) > 0 - obj["segmentation"] = segm - objs.append(obj) - record["annotations"] = objs - if len(record["annotations"]) == 0: - continue - record["task"] = "ObjectDet" - dataset_dicts.append(record) - - return dataset_dicts - - -_CUSTOM_SPLITS_LVIS = { - "GRiT_coco2017_train": ("coco/train2017/", "coco/annotations/instances_train2017.json"), -} - - -for key, (image_root, json_file) in _CUSTOM_SPLITS_LVIS.items(): - register_GRiTcoco_instances( - key, - get_GRiTcoco_meta(), - os.path.join("datasets", json_file) if "://" not in json_file else json_file, - os.path.join("datasets", image_root), - ) \ No newline at end of file diff --git a/spaces/TencentARC/VLog/models/grit_src/third_party/CenterNet2/docs/tutorials/training.md b/spaces/TencentARC/VLog/models/grit_src/third_party/CenterNet2/docs/tutorials/training.md deleted file mode 100644 index 7e2987e4e96c024da24d03b2110f826c0fb64824..0000000000000000000000000000000000000000 --- a/spaces/TencentARC/VLog/models/grit_src/third_party/CenterNet2/docs/tutorials/training.md +++ /dev/null @@ -1,67 +0,0 @@ -# Training - -From the previous tutorials, you may now have a custom model and a data loader. -To run training, users typically have a preference in one of the following two styles: - -### Custom Training Loop - -With a model and a data loader ready, everything else needed to write a training loop can -be found in PyTorch, and you are free to write the training loop yourself. -This style allows researchers to manage the entire training logic more clearly and have full control. -One such example is provided in [tools/plain_train_net.py](../../tools/plain_train_net.py). - -Any customization on the training logic is then easily controlled by the user. - -### Trainer Abstraction - -We also provide a standardized "trainer" abstraction with a -hook system that helps simplify the standard training behavior. -It includes the following two instantiations: - -* [SimpleTrainer](../modules/engine.html#detectron2.engine.SimpleTrainer) - provides a minimal training loop for single-cost single-optimizer single-data-source training, with nothing else. - Other tasks (checkpointing, logging, etc) can be implemented using - [the hook system](../modules/engine.html#detectron2.engine.HookBase). -* [DefaultTrainer](../modules/engine.html#detectron2.engine.defaults.DefaultTrainer) is a `SimpleTrainer` initialized from a - yacs config, used by - [tools/train_net.py](../../tools/train_net.py) and many scripts. - It includes more standard default behaviors that one might want to opt in, - including default configurations for optimizer, learning rate schedule, - logging, evaluation, checkpointing etc. - -To customize a `DefaultTrainer`: - -1. For simple customizations (e.g. change optimizer, evaluator, LR scheduler, data loader, etc.), overwrite [its methods](../modules/engine.html#detectron2.engine.defaults.DefaultTrainer) in a subclass, just like [tools/train_net.py](../../tools/train_net.py). -2. For extra tasks during training, check the - [hook system](../modules/engine.html#detectron2.engine.HookBase) to see if it's supported. - - As an example, to print hello during training: - ```python - class HelloHook(HookBase): - def after_step(self): - if self.trainer.iter % 100 == 0: - print(f"Hello at iteration {self.trainer.iter}!") - ``` -3. Using a trainer+hook system means there will always be some non-standard behaviors that cannot be supported, especially in research. - For this reason, we intentionally keep the trainer & hook system minimal, rather than powerful. - If anything cannot be achieved by such a system, it's easier to start from [tools/plain_train_net.py](../../tools/plain_train_net.py) to implement custom training logic manually. - -### Logging of Metrics - -During training, detectron2 models and trainer put metrics to a centralized [EventStorage](../modules/utils.html#detectron2.utils.events.EventStorage). -You can use the following code to access it and log metrics to it: -``` -from detectron2.utils.events import get_event_storage - -# inside the model: -if self.training: - value = # compute the value from inputs - storage = get_event_storage() - storage.put_scalar("some_accuracy", value) -``` - -Refer to its documentation for more details. - -Metrics are then written to various destinations with [EventWriter](../modules/utils.html#module-detectron2.utils.events). -DefaultTrainer enables a few `EventWriter` with default configurations. -See above for how to customize them. diff --git a/spaces/TheRealZoink/Zoink_OV3RL0AD/Dockerfile b/spaces/TheRealZoink/Zoink_OV3RL0AD/Dockerfile deleted file mode 100644 index 6a8d5cd2c758b5d1021de543c3c23d68658776cb..0000000000000000000000000000000000000000 --- a/spaces/TheRealZoink/Zoink_OV3RL0AD/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM node:18-bullseye-slim -RUN apt-get update && \ - apt-get install -y git -RUN git clone https://gitgud.io/TheRealZoink/oai-reverse-proxy.git /app -WORKDIR /app -RUN npm install -COPY Dockerfile greeting.md* .env* ./ -RUN npm run build -EXPOSE 7860 -ENV NODE_ENV=production -CMD [ "npm", "start" ] \ No newline at end of file diff --git a/spaces/Vastness0813/decapoda-research-llama-65b-hf/app.py b/spaces/Vastness0813/decapoda-research-llama-65b-hf/app.py deleted file mode 100644 index 124c27225d5dbbb32e1d10a3cd22753817396324..0000000000000000000000000000000000000000 --- a/spaces/Vastness0813/decapoda-research-llama-65b-hf/app.py +++ /dev/null @@ -1,3 +0,0 @@ -import gradio as gr - -gr.Interface.load("models/decapoda-research/llama-65b-hf").launch() \ No newline at end of file diff --git a/spaces/VideoCrafter/VideoCrafter/t2v_test.py b/spaces/VideoCrafter/VideoCrafter/t2v_test.py deleted file mode 100644 index 79a0cede885c250f0cc3c3934030cac2b43823a6..0000000000000000000000000000000000000000 --- a/spaces/VideoCrafter/VideoCrafter/t2v_test.py +++ /dev/null @@ -1,78 +0,0 @@ -import os -import time -from omegaconf import OmegaConf -import torch -from scripts.evaluation.funcs import load_model_checkpoint, save_videos, batch_ddim_sampling -from utils.utils import instantiate_from_config -from huggingface_hub import hf_hub_download - -class Text2Video(): - def __init__(self,result_dir='./tmp/',gpu_num=1) -> None: - self.download_model() - self.result_dir = result_dir - if not os.path.exists(self.result_dir): - os.mkdir(self.result_dir) - ckpt_path='checkpoints/base_1024_v1/model.ckpt' - config_file='configs/inference_t2v_1024_v1.0.yaml' - config = OmegaConf.load(config_file) - model_config = config.pop("model", OmegaConf.create()) - model_config['params']['unet_config']['params']['use_checkpoint']=False - model_list = [] - for gpu_id in range(gpu_num): - model = instantiate_from_config(model_config) - # model = model.cuda(gpu_id) - assert os.path.exists(ckpt_path), "Error: checkpoint Not Found!" - model = load_model_checkpoint(model, ckpt_path) - model.eval() - model_list.append(model) - self.model_list = model_list - self.save_fps = 8 - - def get_prompt(self, prompt, steps=50, cfg_scale=12.0, eta=1.0, fps=16): - torch.cuda.empty_cache() - print('start:', prompt, time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()))) - start = time.time() - gpu_id=0 - if steps > 60: - steps = 60 - model = self.model_list[gpu_id] - model = model.cuda() - batch_size=1 - channels = model.model.diffusion_model.in_channels - frames = model.temporal_length - h, w = 576 // 8, 1024 // 8 - noise_shape = [batch_size, channels, frames, h, w] - - #prompts = batch_size * [""] - text_emb = model.get_learned_conditioning([prompt]) - - cond = {"c_crossattn": [text_emb], "fps": fps} - - ## inference - batch_samples = batch_ddim_sampling(model, cond, noise_shape, n_samples=1, ddim_steps=steps, ddim_eta=eta, cfg_scale=cfg_scale) - ## b,samples,c,t,h,w - prompt_str = prompt.replace("/", "_slash_") if "/" in prompt else prompt - prompt_str = prompt_str.replace(" ", "_") if " " in prompt else prompt_str - prompt_str=prompt_str[:30] - - save_videos(batch_samples, self.result_dir, filenames=[prompt_str], fps=self.save_fps) - print(f"Saved in {prompt_str}. Time used: {(time.time() - start):.2f} seconds") - model=model.cpu() - return os.path.join(self.result_dir, f"{prompt_str}.mp4") - - def download_model(self): - REPO_ID = 'VideoCrafter/Text2Video-1024' - filename_list = ['model.ckpt'] - if not os.path.exists('./checkpoints/base_1024_v1/'): - os.makedirs('./checkpoints/base_1024_v1/') - for filename in filename_list: - local_file = os.path.join('./checkpoints/base_1024_v1/', filename) - - if not os.path.exists(local_file): - hf_hub_download(repo_id=REPO_ID, filename=filename, local_dir='./checkpoints/base_1024_v1/', local_dir_use_symlinks=False) - - -if __name__ == '__main__': - t2v = Text2Video() - video_path = t2v.get_prompt('a black swan swims on the pond') - print('done', video_path) \ No newline at end of file diff --git a/spaces/VietAI/En2Vi-Translation/app.py b/spaces/VietAI/En2Vi-Translation/app.py deleted file mode 100644 index efe80e346ecd7c5c41441329f10bbf395a5f7755..0000000000000000000000000000000000000000 --- a/spaces/VietAI/En2Vi-Translation/app.py +++ /dev/null @@ -1,52 +0,0 @@ -import gradio as gr -from gradio.mix import Parallel, Series - -from transformers import pipeline - -translater = pipeline("translation", model="VietAI/envit5-translation") - - -def translate(inp, direction): - if direction == 'en->vi': - text = "en: " + inp - else: - text = "vi: " + inp - - res = translater( - text, - max_length=512, - early_stopping=True, - )[0]['translation_text'][3:] - return res - -description = """ -<p> -<center> -Multi-domain Translation Between English and Vietnamese -</center> -</p> -""" -article = "<p style='text-align: center'><a href='http://translate.vietai.org' target='_blank'>by VietAI Research</a> | <a href='https://github.com/vietai/mTet' target='_blank'>Github</a> | Contact: <a href='mailto:heraclex12@gmail.com' target='_blank'>Hieu Tran</a></p></center></p>" -examples = [ - ["Dear God, thank you for granting us the evergreen garden of this world", "en->vi"], - ["Thuốc này đã bị cấm sử dụng trong ngành thú y tại Ấn Độ.", "vi->en"] -] -iface = gr.Interface( - fn=translate, - - title="🌸MTet Translation🌸", - description=description, - article=article, - examples=examples, - inputs=[ - gr.inputs.Textbox(lines=5, placeholder="Enter text (maximum 5 lines)", label="Input"), - gr.inputs.Radio( - choices=[ - 'en->vi', - 'vi->en'], - default='en->vi', - label='Direction'), - ], - outputs="text") - -iface.launch(enable_queue=True) \ No newline at end of file diff --git a/spaces/Vikas01/Attendence_System/static/app.js b/spaces/Vikas01/Attendence_System/static/app.js deleted file mode 100644 index b875ea1344f39e497cab6c6777690e6fba61bbe0..0000000000000000000000000000000000000000 --- a/spaces/Vikas01/Attendence_System/static/app.js +++ /dev/null @@ -1,71 +0,0 @@ -// establishing connection between client and server by getting the url. -var socket = io.connect(window.location.protocol + '//' + document.domain + ':' + location.port, { - transports: ['websocket'] -}); -// once connected sending out printing out connected -socket.on('connect', function () { - console.log("Connected...!", socket.connected) -}); - -// print results -var result = document.getElementById('name') -var score = document.getElementById('score') -socket.on('result',(data) =>{ - //console.log(data); - result.innerHTML = data['name'] - score.innerHTML = data['score'] -}); - -// global varibales for video and output. -var video = document.getElementById('videoElement'); -var canvas = document.getElementById('canvas'); -var context = canvas.getContext('2d'); -var send_data; -// set video dimentions. -video.width = 400; -video.height = 300; -// rate of sending image -const FPS = 10; -// function for sending the webcam input -function send() { - width = video.width; - height = video.height; - context.drawImage(video, 0, 0, width, height); - var data = canvas.toDataURL('image/jpeg', 0.5); - context.clearRect(0, 0, width, height); - socket.emit('image', data); -}; -// funtion to start webcam on client side -function start_camera() { - send_data = setInterval(send, 1000 / FPS) - let devices = navigator.mediaDevices - if (!devices || !devices.getUserMedia) { - console.log("getUserMedia() not supported."); - return; - } - devices.getUserMedia({ - video: true - }) - .then(function (vidstream) { - if ("srcObject" in video) { - video.srcObject = vidstream; - - } else { - video.src = window.src = window.URL.createObjectURL(vidstream); - - } - video.onloadeddata = function (e) { - video.play(); - }; - - }) - .catch(function (e) { - console.log(e.name + ": " + e.massage); - }); -}; -// stopping camera input and sending data. -function stop_camera() { - video.srcObject.getTracks()[0].stop(); - video.srcObject = null; - clearInterval(send_data); -}; \ No newline at end of file diff --git a/spaces/VoiceHero69/changer/webui/ui/tabs/rvc.py b/spaces/VoiceHero69/changer/webui/ui/tabs/rvc.py deleted file mode 100644 index 92535e4c9fccfc5acdc10cf9fdb3130cdbabb34e..0000000000000000000000000000000000000000 --- a/spaces/VoiceHero69/changer/webui/ui/tabs/rvc.py +++ /dev/null @@ -1,193 +0,0 @@ -import os - -import torch.cuda -import torchaudio -import gradio -from webui.modules import util - -from webui.modules.download import fill_models - -flag_strings = ['denoise', 'denoise output', 'separate background'] - - -def flatten_audio(audio_tensor: torch.Tensor | tuple[torch.Tensor, int] | tuple[int, torch.Tensor], add_batch=True): - if isinstance(audio_tensor, tuple): - if isinstance(audio_tensor[0], int): - return audio_tensor[0], flatten_audio(audio_tensor[1]) - elif torch.is_tensor(audio_tensor[0]): - return flatten_audio(audio_tensor[0]), audio_tensor[1] - if audio_tensor.dtype == torch.int16: - audio_tensor = audio_tensor.float() / 32767.0 - if audio_tensor.dtype == torch.int32: - audio_tensor = audio_tensor.float() / 2147483647.0 - if len(audio_tensor.shape) == 2: - if audio_tensor.shape[0] == 2: - # audio_tensor = audio_tensor[0, :].div(2).add(audio_tensor[1, :].div(2)) - audio_tensor = audio_tensor.mean(0) - elif audio_tensor.shape[1] == 2: - # audio_tensor = audio_tensor[:, 0].div(2).add(audio_tensor[:, 1].div(2)) - audio_tensor = audio_tensor.mean(1) - audio_tensor = audio_tensor.flatten() - if add_batch: - audio_tensor = audio_tensor.unsqueeze(0) - return audio_tensor - - -def merge_and_match(x, y, sr): - # import scipy.signal - x = x / 2 - y = y / 2 - import torchaudio.functional as F - y = F.resample(y, sr, int(sr * (x.shape[-1] / y.shape[-1]))) - if x.shape[0] > y.shape[0]: - x = x[-y.shape[0]:] - else: - y = y[-x.shape[0]:] - return x.add(y) - - -def get_models_installed(): - return [gradio.update(choices=fill_models('rvc')), gradio.update()] - - -def unload_rvc(): - import webui.modules.implementations.rvc.rvc as rvc - rvc.unload_rvc() - return [gradio.update(value=''), gradio.update(maximum=0, value=0, visible=False)] - - -def load_rvc(model): - if not model: - return unload_rvc() - import webui.modules.implementations.rvc.rvc as rvc - maximum = rvc.load_rvc(model) - return [gradio.update(), gradio.update(maximum=maximum, value=0, visible=maximum > 0)] - - -def denoise(sr, audio): - if not torch.is_tensor(audio): - audio = torch.tensor(audio) - if len(audio.shape) == 1: - audio = audio.unsqueeze(0) - audio = audio.detach().cpu().numpy() - import noisereduce.noisereduce as noisereduce - audio = torch.tensor(noisereduce.reduce_noise(y=audio, sr=sr)) - return sr, audio - - -def gen(rvc_model_selected, speaker_id, pitch_extract, audio_in, up_key, index_rate, filter_radius, protect, crepe_hop_length, flag): - background = None - audio = None - sr, audio_in = audio_in - audio_tuple = (sr, torch.tensor(audio_in)) - - audio_tuple = flatten_audio(audio_tuple) - - - if rvc_model_selected: - print('Selected model', rvc_model_selected) - if len(audio_tuple[1].shape) == 1: - audio_tuple = (audio_tuple[0], audio_tuple[1].unsqueeze(0)) - torchaudio.save('speakeraudio.wav', audio_tuple[1], audio_tuple[0]) - - import webui.modules.implementations.rvc.rvc as rvc - rvc.load_rvc(rvc_model_selected) - - index_file = '' - try: - model_basedir = os.path.join('data', 'models', 'rvc', os.path.dirname(rvc_model_selected)) - index_files = [f for f in os.listdir(model_basedir) if f.endswith('.index')] - if len(index_files) > 0: - for f in index_files: - full_path = os.path.join(model_basedir, f) - if 'added' in f: - index_file = full_path - if not index_file: - index_file = os.path.join(model_basedir, index_files[0]) - except: - pass - - out1, out2 = rvc.vc_single(speaker_id, 'speakeraudio.wav', up_key, None, pitch_extract, index_file, '', index_rate, filter_radius, 0, 1, protect, crepe_hop_length) - print(out1) - audio_tuple = out2 - - if background is not None and 'separate background' in flag: - audio = audio_tuple[1] if torch.is_tensor(audio_tuple[1]) else torch.tensor(audio_tuple[1]) - audio_tuple = (audio_tuple[0], flatten_audio(audio, False)) - background = flatten_audio(background if torch.is_tensor(background) else torch.tensor(background), False) - if audio_tuple[1].dtype == torch.int16: - audio = audio_tuple[1] - audio = audio.float() / 32767.0 - audio_tuple = (audio_tuple[0], audio) - audio = audio_tuple[1] - audio_tuple = (audio_tuple[0], merge_and_match(audio_tuple[1], background, audio_tuple[0])) - - if 'denoise output' in flag: - audio_tuple = denoise(*audio_tuple) - - if torch.is_tensor(audio_tuple[1]): - audio_tuple = (audio_tuple[0], audio_tuple[1].flatten().detach().cpu().numpy()) - - sr = audio_tuple[0] - - audio = (sr, audio.detach().cpu().numpy()) if audio is not None else None - background = (sr, background.detach().cpu().numpy()) if background is not None else None - - return [audio_tuple, util.make_waveform(audio_tuple), background, audio] - - -def rvc(): - with gradio.Row(): - with gradio.Column(): - use_microphone = gradio.Checkbox(label='Use microphone') - audio_el = gradio.Audio(label='Audio input') - - from webui.ui.ui import tabs_el - - def to_rvc_func(audio): - return gradio.update(selected='🗣▶🗣 RVC'), audio - - - - def update_audio_input(use_mic): - return gradio.update(source='microphone' if use_mic else 'upload') - use_microphone.change(fn=update_audio_input, inputs=use_microphone, outputs=audio_el) - - with gradio.Accordion('🗣 RVC'): - with gradio.Row(): - selected = gradio.Dropdown(get_models_installed()[0]['choices'], label='RVC Model') - with gradio.Column(elem_classes='smallsplit'): - refresh = gradio.Button('🔃', variant='tool secondary') - unload = gradio.Button('💣', variant='tool primary') - speaker_id = gradio.Slider(value=0, step=1, maximum=0, visible=False, label='Speaker id', info='For multi speaker models, the speaker to use.') - pitch_extract = gradio.CheckboxGroup(visible=False, choices=["dio", "pm", "harvest", "torchcrepe", "torchcrepe tiny", "mangio-crepe", "mangio-crepe tiny"], label='Pitch extraction', value='harvest', interactive=True, info='Default: dio. dio and pm are faster, harvest is slower but good. Crepe is good but uses GPU.') - crepe_hop_length = gradio.Slider(visible=False, minimum=64, maximum=512, step=64, value=128, label='torchcrepe hop length', info='The length of the hops used for torchcrepe\'s crepe implementation') - - def update_crepe_hop_length_visible(pitch_mode: str): - return gradio.update(visible='crepe' in pitch_mode) - - pitch_extract.change(fn=update_crepe_hop_length_visible, inputs=pitch_extract, outputs=crepe_hop_length) - - refresh.click(fn=get_models_installed, outputs=[selected, speaker_id], show_progress=True) - unload.click(fn=unload_rvc, outputs=[selected, speaker_id], show_progress=True) - selected.select(fn=load_rvc, inputs=selected, outputs=[selected, speaker_id], show_progress=True) - index_rate = gradio.Slider(0, 1, 0.88,visible=False, step=0.01, label='Index rate for feature retrieval', info='Default: 0.88. Higher is more indexing, takes longer but could be better') - filter_radius = gradio.Slider(0, 7, 3,visible=False, step=1, label='Filter radius', info='Default: 3. Smooth out the pitches, should yield less voice cracks.') - up_key = gradio.Number(value=0, label='Pitch offset', info='Default: 0. Shift the pitch up or down') - protect = gradio.Slider(0, 0.5, 0.33,visible=False, step=0.01, label='Protect amount', info='Default: 0.33. Avoid non voice sounds. Lower is more being ignored.') - flags = gradio.Dropdown(flag_strings, visible=False, label='Flags', info='Things to apply on the audio input/output', multiselect=True) - - with gradio.Row(): - generate = gradio.Button('Generate', variant='primary', elem_id='rvc-generate') - with gradio.Row(): - audio_out = gradio.Audio(label='output audio', show_share_button=True) - with gradio.Row(visible=False): - video_out = gradio.Video(label='output spectrogram video') - with gradio.Row(visible=False): - audio_bg = gradio.Audio(label='background') - with gradio.Row(visible=False): - audio_vocal = gradio.Audio(label='vocals') - - - generate.click(fn=gen, inputs=[selected, speaker_id, pitch_extract, audio_el, - up_key, index_rate, filter_radius, protect, crepe_hop_length, flags], outputs=[audio_out, video_out, audio_bg, audio_vocal]) diff --git a/spaces/Volkopat/SegmentAnythingxGroundingDINO/groundingdino/models/GroundingDINO/csrc/vision.cpp b/spaces/Volkopat/SegmentAnythingxGroundingDINO/groundingdino/models/GroundingDINO/csrc/vision.cpp deleted file mode 100644 index c1f2c50c82909bbd5492c163d634af77a3ba1781..0000000000000000000000000000000000000000 --- a/spaces/Volkopat/SegmentAnythingxGroundingDINO/groundingdino/models/GroundingDINO/csrc/vision.cpp +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved - -#include "MsDeformAttn/ms_deform_attn.h" - -namespace groundingdino { - -#ifdef WITH_CUDA -extern int get_cudart_version(); -#endif - -std::string get_cuda_version() { -#ifdef WITH_CUDA - std::ostringstream oss; - - // copied from - // https://github.com/pytorch/pytorch/blob/master/aten/src/ATen/cuda/detail/CUDAHooks.cpp#L231 - auto printCudaStyleVersion = [&](int v) { - oss << (v / 1000) << "." << (v / 10 % 100); - if (v % 10 != 0) { - oss << "." << (v % 10); - } - }; - printCudaStyleVersion(get_cudart_version()); - return oss.str(); -#else - return std::string("not available"); -#endif -} - -// similar to -// https://github.com/pytorch/pytorch/blob/master/aten/src/ATen/Version.cpp -std::string get_compiler_version() { - std::ostringstream ss; -#if defined(__GNUC__) -#ifndef __clang__ - { ss << "GCC " << __GNUC__ << "." << __GNUC_MINOR__; } -#endif -#endif - -#if defined(__clang_major__) - { - ss << "clang " << __clang_major__ << "." << __clang_minor__ << "." - << __clang_patchlevel__; - } -#endif - -#if defined(_MSC_VER) - { ss << "MSVC " << _MSC_FULL_VER; } -#endif - return ss.str(); -} - -PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) { - m.def("ms_deform_attn_forward", &ms_deform_attn_forward, "ms_deform_attn_forward"); - m.def("ms_deform_attn_backward", &ms_deform_attn_backward, "ms_deform_attn_backward"); -} - -} // namespace groundingdino \ No newline at end of file diff --git a/spaces/Wauplin/gradio-user-history/src/gradio_user_history/__init__.py b/spaces/Wauplin/gradio-user-history/src/gradio_user_history/__init__.py deleted file mode 100644 index e2035568ca422843291a66f6168e665699cb42e9..0000000000000000000000000000000000000000 --- a/spaces/Wauplin/gradio-user-history/src/gradio_user_history/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -""" -User History is a plugin that you can add to your Spaces to cache generated images for your users. - -Key features: -- 🤗 Sign in with Hugging Face -- Save generated images with their metadata: prompts, timestamp, hyper-parameters, etc. -- Export your history as zip. -- Delete your history to respect privacy. -- Compatible with Persistent Storage for long-term storage. -- Admin panel to check configuration and disk usage . - -Useful links: -- Demo: https://huggingface.co/spaces/Wauplin/gradio-user-history -- README: https://huggingface.co/spaces/Wauplin/gradio-user-history/blob/main/README.md -- Source file: https://huggingface.co/spaces/Wauplin/gradio-user-history/blob/main/user_history.py -- Discussions: https://huggingface.co/spaces/Wauplin/gradio-user-history/discussions -""" -from ._user_history import render, save_image, setup # noqa: F401 - - -__version__ = "0.1.0" diff --git a/spaces/Wrathless/Dkrotzer-MusicalMagic/tests/modules/test_lstm.py b/spaces/Wrathless/Dkrotzer-MusicalMagic/tests/modules/test_lstm.py deleted file mode 100644 index 1248964c8191e19f27661f0974bef9cc967eb015..0000000000000000000000000000000000000000 --- a/spaces/Wrathless/Dkrotzer-MusicalMagic/tests/modules/test_lstm.py +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the license found in the -# LICENSE file in the root directory of this source tree. - -import random -import torch - -from audiocraft.modules.lstm import StreamableLSTM - - -class TestStreamableLSTM: - - def test_lstm(self): - B, C, T = 4, 2, random.randint(1, 100) - - lstm = StreamableLSTM(C, 3, skip=False) - x = torch.randn(B, C, T) - y = lstm(x) - - print(y.shape) - assert y.shape == torch.Size([B, C, T]) - - def test_lstm_skip(self): - B, C, T = 4, 2, random.randint(1, 100) - - lstm = StreamableLSTM(C, 3, skip=True) - x = torch.randn(B, C, T) - y = lstm(x) - - assert y.shape == torch.Size([B, C, T]) diff --git a/spaces/XS-1/BW_IMAGE_VIDEO_COLORIZER/fastai/vision/models/unet.py b/spaces/XS-1/BW_IMAGE_VIDEO_COLORIZER/fastai/vision/models/unet.py deleted file mode 100644 index 06ed75c4c10890086e07da775d50e690e91f1d88..0000000000000000000000000000000000000000 --- a/spaces/XS-1/BW_IMAGE_VIDEO_COLORIZER/fastai/vision/models/unet.py +++ /dev/null @@ -1,78 +0,0 @@ -from ...torch_core import * -from ...layers import * -from ...callbacks.hooks import * - -__all__ = ['DynamicUnet', 'UnetBlock'] - -def _get_sfs_idxs(sizes:Sizes) -> List[int]: - "Get the indexes of the layers where the size of the activation changes." - feature_szs = [size[-1] for size in sizes] - sfs_idxs = list(np.where(np.array(feature_szs[:-1]) != np.array(feature_szs[1:]))[0]) - if feature_szs[0] != feature_szs[1]: sfs_idxs = [0] + sfs_idxs - return sfs_idxs - -class UnetBlock(Module): - "A quasi-UNet block, using `PixelShuffle_ICNR upsampling`." - def __init__(self, up_in_c:int, x_in_c:int, hook:Hook, final_div:bool=True, blur:bool=False, leaky:float=None, - self_attention:bool=False, **kwargs): - self.hook = hook - self.shuf = PixelShuffle_ICNR(up_in_c, up_in_c//2, blur=blur, leaky=leaky, **kwargs) - self.bn = batchnorm_2d(x_in_c) - ni = up_in_c//2 + x_in_c - nf = ni if final_div else ni//2 - self.conv1 = conv_layer(ni, nf, leaky=leaky, **kwargs) - self.conv2 = conv_layer(nf, nf, leaky=leaky, self_attention=self_attention, **kwargs) - self.relu = relu(leaky=leaky) - - def forward(self, up_in:Tensor) -> Tensor: - s = self.hook.stored - up_out = self.shuf(up_in) - ssh = s.shape[-2:] - if ssh != up_out.shape[-2:]: - up_out = F.interpolate(up_out, s.shape[-2:], mode='nearest') - cat_x = self.relu(torch.cat([up_out, self.bn(s)], dim=1)) - return self.conv2(self.conv1(cat_x)) - - -class DynamicUnet(SequentialEx): - "Create a U-Net from a given architecture." - def __init__(self, encoder:nn.Module, n_classes:int, img_size:Tuple[int,int]=(256,256), blur:bool=False, blur_final=True, self_attention:bool=False, - y_range:Optional[Tuple[float,float]]=None, - last_cross:bool=True, bottle:bool=False, **kwargs): - imsize = img_size - sfs_szs = model_sizes(encoder, size=imsize) - sfs_idxs = list(reversed(_get_sfs_idxs(sfs_szs))) - self.sfs = hook_outputs([encoder[i] for i in sfs_idxs]) - x = dummy_eval(encoder, imsize).detach() - - ni = sfs_szs[-1][1] - middle_conv = nn.Sequential(conv_layer(ni, ni*2, **kwargs), - conv_layer(ni*2, ni, **kwargs)).eval() - x = middle_conv(x) - layers = [encoder, batchnorm_2d(ni), nn.ReLU(), middle_conv] - - for i,idx in enumerate(sfs_idxs): - not_final = i!=len(sfs_idxs)-1 - up_in_c, x_in_c = int(x.shape[1]), int(sfs_szs[idx][1]) - do_blur = blur and (not_final or blur_final) - sa = self_attention and (i==len(sfs_idxs)-3) - unet_block = UnetBlock(up_in_c, x_in_c, self.sfs[i], final_div=not_final, blur=do_blur, self_attention=sa, - **kwargs).eval() - layers.append(unet_block) - x = unet_block(x) - - ni = x.shape[1] - if imsize != sfs_szs[0][-2:]: layers.append(PixelShuffle_ICNR(ni, **kwargs)) - x = PixelShuffle_ICNR(ni)(x) - if imsize != x.shape[-2:]: layers.append(Lambda(lambda x: F.interpolate(x, imsize, mode='nearest'))) - if last_cross: - layers.append(MergeLayer(dense=True)) - ni += in_channels(encoder) - layers.append(res_block(ni, bottle=bottle, **kwargs)) - layers += [conv_layer(ni, n_classes, ks=1, use_activ=False, **kwargs)] - if y_range is not None: layers.append(SigmoidRange(*y_range)) - super().__init__(*layers) - - def __del__(self): - if hasattr(self, "sfs"): self.sfs.remove() - diff --git a/spaces/Xenova/text-to-speech-client/index.html b/spaces/Xenova/text-to-speech-client/index.html deleted file mode 100644 index 060fe8689c1dc5412da8a63cfd2c11852d81be99..0000000000000000000000000000000000000000 --- a/spaces/Xenova/text-to-speech-client/index.html +++ /dev/null @@ -1,14 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> - <head> - <meta charset="UTF-8" /> - <meta name="viewport" content="width=device-width, initial-scale=1.0" /> - <title>Transformers.js - Text-to-speech demo - - - - -
    - - - diff --git a/spaces/XlalalaX/VITS-Umamusume-voice-synthesizer/ONNXVITS_utils.py b/spaces/XlalalaX/VITS-Umamusume-voice-synthesizer/ONNXVITS_utils.py deleted file mode 100644 index b634ce380421571e6e07fb45dd59717b3f63115c..0000000000000000000000000000000000000000 --- a/spaces/XlalalaX/VITS-Umamusume-voice-synthesizer/ONNXVITS_utils.py +++ /dev/null @@ -1,19 +0,0 @@ -import torch -import numpy as np -import random -import onnxruntime as ort -def set_random_seed(seed=0): - ort.set_seed(seed) - torch.manual_seed(seed) - torch.cuda.manual_seed(seed) - torch.backends.cudnn.deterministic = True - random.seed(seed) - np.random.seed(seed) - -def runonnx(model_path, **kwargs): - ort_session = ort.InferenceSession(model_path) - outputs = ort_session.run( - None, - kwargs - ) - return outputs \ No newline at end of file diff --git a/spaces/XzJosh/Azuma-Bert-VITS2/train_ms.py b/spaces/XzJosh/Azuma-Bert-VITS2/train_ms.py deleted file mode 100644 index 5d109003d40497ea4493e7c73f47c1eb7370a81e..0000000000000000000000000000000000000000 --- a/spaces/XzJosh/Azuma-Bert-VITS2/train_ms.py +++ /dev/null @@ -1,402 +0,0 @@ -import os -import json -import argparse -import itertools -import math -import torch -import shutil -from torch import nn, optim -from torch.nn import functional as F -from torch.utils.data import DataLoader -from torch.utils.tensorboard import SummaryWriter -import torch.multiprocessing as mp -import torch.distributed as dist -from torch.nn.parallel import DistributedDataParallel as DDP -from torch.cuda.amp import autocast, GradScaler -from tqdm import tqdm -import logging -logging.getLogger('numba').setLevel(logging.WARNING) -import commons -import utils -from data_utils import ( - TextAudioSpeakerLoader, - TextAudioSpeakerCollate, - DistributedBucketSampler -) -from models import ( - SynthesizerTrn, - MultiPeriodDiscriminator, - DurationDiscriminator, -) -from losses import ( - generator_loss, - discriminator_loss, - feature_loss, - kl_loss -) -from mel_processing import mel_spectrogram_torch, spec_to_mel_torch -from text.symbols import symbols - -torch.backends.cudnn.benchmark = True -torch.backends.cuda.matmul.allow_tf32 = True -torch.backends.cudnn.allow_tf32 = True -torch.set_float32_matmul_precision('medium') -global_step = 0 - - -def main(): - """Assume Single Node Multi GPUs Training Only""" - assert torch.cuda.is_available(), "CPU training is not allowed." - - n_gpus = torch.cuda.device_count() - os.environ['MASTER_ADDR'] = 'localhost' - os.environ['MASTER_PORT'] = '65280' - - hps = utils.get_hparams() - if not hps.cont: - shutil.copy('./pretrained_models/D_0.pth','./logs/OUTPUT_MODEL/D_0.pth') - shutil.copy('./pretrained_models/G_0.pth','./logs/OUTPUT_MODEL/G_0.pth') - shutil.copy('./pretrained_models/DUR_0.pth','./logs/OUTPUT_MODEL/DUR_0.pth') - mp.spawn(run, nprocs=n_gpus, args=(n_gpus, hps,)) - - -def run(rank, n_gpus, hps): - global global_step - if rank == 0: - logger = utils.get_logger(hps.model_dir) - logger.info(hps) - utils.check_git_hash(hps.model_dir) - writer = SummaryWriter(log_dir=hps.model_dir) - writer_eval = SummaryWriter(log_dir=os.path.join(hps.model_dir, "eval")) - - dist.init_process_group(backend= 'gloo' if os.name == 'nt' else 'nccl', init_method='env://', world_size=n_gpus, rank=rank) - torch.manual_seed(hps.train.seed) - torch.cuda.set_device(rank) - - train_dataset = TextAudioSpeakerLoader(hps.data.training_files, hps.data) - train_sampler = DistributedBucketSampler( - train_dataset, - hps.train.batch_size, - [32, 300, 400, 500, 600, 700, 800, 900, 1000], - num_replicas=n_gpus, - rank=rank, - shuffle=True) - collate_fn = TextAudioSpeakerCollate() - train_loader = DataLoader(train_dataset, num_workers=2, shuffle=False, pin_memory=True, - collate_fn=collate_fn, batch_sampler=train_sampler) - if rank == 0: - eval_dataset = TextAudioSpeakerLoader(hps.data.validation_files, hps.data) - eval_loader = DataLoader(eval_dataset, num_workers=0, shuffle=False, - batch_size=1, pin_memory=True, - drop_last=False, collate_fn=collate_fn) - if "use_noise_scaled_mas" in hps.model.keys() and hps.model.use_noise_scaled_mas == True: - print("Using noise scaled MAS for VITS2") - use_noise_scaled_mas = True - mas_noise_scale_initial = 0.01 - noise_scale_delta = 2e-6 - else: - print("Using normal MAS for VITS1") - use_noise_scaled_mas = False - mas_noise_scale_initial = 0.0 - noise_scale_delta = 0.0 - if "use_duration_discriminator" in hps.model.keys() and hps.model.use_duration_discriminator == True: - print("Using duration discriminator for VITS2") - use_duration_discriminator = True - net_dur_disc = DurationDiscriminator( - hps.model.hidden_channels, - hps.model.hidden_channels, - 3, - 0.1, - gin_channels=hps.model.gin_channels if hps.data.n_speakers != 0 else 0, - ).cuda(rank) - if "use_spk_conditioned_encoder" in hps.model.keys() and hps.model.use_spk_conditioned_encoder == True: - if hps.data.n_speakers == 0: - raise ValueError("n_speakers must be > 0 when using spk conditioned encoder to train multi-speaker model") - use_spk_conditioned_encoder = True - else: - print("Using normal encoder for VITS1") - use_spk_conditioned_encoder = False - - net_g = SynthesizerTrn( - len(symbols), - hps.data.filter_length // 2 + 1, - hps.train.segment_size // hps.data.hop_length, - n_speakers=hps.data.n_speakers, - mas_noise_scale_initial = mas_noise_scale_initial, - noise_scale_delta = noise_scale_delta, - **hps.model).cuda(rank) - - freeze_enc = getattr(hps.model, "freeze_enc", False) - if freeze_enc: - print("freeze encoder !!!") - for param in net_g.enc_p.parameters(): - param.requires_grad = False - - net_d = MultiPeriodDiscriminator(hps.model.use_spectral_norm).cuda(rank) - optim_g = torch.optim.AdamW( - filter(lambda p: p.requires_grad, net_g.parameters()), - hps.train.learning_rate, - betas=hps.train.betas, - eps=hps.train.eps) - optim_d = torch.optim.AdamW( - net_d.parameters(), - hps.train.learning_rate, - betas=hps.train.betas, - eps=hps.train.eps) - if net_dur_disc is not None: - optim_dur_disc = torch.optim.AdamW( - net_dur_disc.parameters(), - hps.train.learning_rate, - betas=hps.train.betas, - eps=hps.train.eps) - else: - optim_dur_disc = None - net_g = DDP(net_g, device_ids=[rank], find_unused_parameters=True) - net_d = DDP(net_d, device_ids=[rank], find_unused_parameters=True) - if net_dur_disc is not None: - net_dur_disc = DDP(net_dur_disc, device_ids=[rank], find_unused_parameters=True) - - pretrain_dir = None - if pretrain_dir is None: - try: - if net_dur_disc is not None: - _, optim_dur_disc, _, epoch_str = utils.load_checkpoint(utils.latest_checkpoint_path(hps.model_dir, "DUR_*.pth"), net_dur_disc, optim_dur_disc, skip_optimizer=not hps.cont) - _, optim_g, _, epoch_str = utils.load_checkpoint(utils.latest_checkpoint_path(hps.model_dir, "G_*.pth"), net_g, - optim_g, skip_optimizer=not hps.cont) - _, optim_d, _, epoch_str = utils.load_checkpoint(utils.latest_checkpoint_path(hps.model_dir, "D_*.pth"), net_d, - optim_d, skip_optimizer=not hps.cont) - - epoch_str = max(epoch_str, 1) - global_step = (epoch_str - 1) * len(train_loader) - except Exception as e: - print(e) - epoch_str = 1 - global_step = 0 - else: - _, _, _, epoch_str = utils.load_checkpoint(utils.latest_checkpoint_path(pretrain_dir, "G_*.pth"), net_g, - optim_g, True) - _, _, _, epoch_str = utils.load_checkpoint(utils.latest_checkpoint_path(pretrain_dir, "D_*.pth"), net_d, - optim_d, True) - - - - scheduler_g = torch.optim.lr_scheduler.ExponentialLR(optim_g, gamma=hps.train.lr_decay, last_epoch=epoch_str - 2) - scheduler_d = torch.optim.lr_scheduler.ExponentialLR(optim_d, gamma=hps.train.lr_decay, last_epoch=epoch_str - 2) - if net_dur_disc is not None: - scheduler_dur_disc = torch.optim.lr_scheduler.ExponentialLR(optim_dur_disc, gamma=hps.train.lr_decay, last_epoch=epoch_str-2) - else: - scheduler_dur_disc = None - scaler = GradScaler(enabled=hps.train.fp16_run) - - for epoch in range(epoch_str, hps.train.epochs + 1): - if rank == 0: - train_and_evaluate(rank, epoch, hps, [net_g, net_d, net_dur_disc], [optim_g, optim_d, optim_dur_disc], [scheduler_g, scheduler_d, scheduler_dur_disc], scaler, [train_loader, eval_loader], logger, [writer, writer_eval]) - else: - train_and_evaluate(rank, epoch, hps, [net_g, net_d, net_dur_disc], [optim_g, optim_d, optim_dur_disc], [scheduler_g, scheduler_d, scheduler_dur_disc], scaler, [train_loader, None], None, None) - scheduler_g.step() - scheduler_d.step() - if net_dur_disc is not None: - scheduler_dur_disc.step() - - -def train_and_evaluate(rank, epoch, hps, nets, optims, schedulers, scaler, loaders, logger, writers): - net_g, net_d, net_dur_disc = nets - optim_g, optim_d, optim_dur_disc = optims - scheduler_g, scheduler_d, scheduler_dur_disc = schedulers - train_loader, eval_loader = loaders - if writers is not None: - writer, writer_eval = writers - - train_loader.batch_sampler.set_epoch(epoch) - global global_step - - net_g.train() - net_d.train() - if net_dur_disc is not None: - net_dur_disc.train() - for batch_idx, (x, x_lengths, spec, spec_lengths, y, y_lengths, speakers, tone, language, bert) in tqdm(enumerate(train_loader)): - if net_g.module.use_noise_scaled_mas: - current_mas_noise_scale = net_g.module.mas_noise_scale_initial - net_g.module.noise_scale_delta * global_step - net_g.module.current_mas_noise_scale = max(current_mas_noise_scale, 0.0) - x, x_lengths = x.cuda(rank, non_blocking=True), x_lengths.cuda(rank, non_blocking=True) - spec, spec_lengths = spec.cuda(rank, non_blocking=True), spec_lengths.cuda(rank, non_blocking=True) - y, y_lengths = y.cuda(rank, non_blocking=True), y_lengths.cuda(rank, non_blocking=True) - speakers = speakers.cuda(rank, non_blocking=True) - tone = tone.cuda(rank, non_blocking=True) - language = language.cuda(rank, non_blocking=True) - bert = bert.cuda(rank, non_blocking=True) - - with autocast(enabled=hps.train.fp16_run): - y_hat, l_length, attn, ids_slice, x_mask, z_mask, \ - (z, z_p, m_p, logs_p, m_q, logs_q), (hidden_x, logw, logw_) = net_g(x, x_lengths, spec, spec_lengths, speakers, tone, language, bert) - mel = spec_to_mel_torch( - spec, - hps.data.filter_length, - hps.data.n_mel_channels, - hps.data.sampling_rate, - hps.data.mel_fmin, - hps.data.mel_fmax) - y_mel = commons.slice_segments(mel, ids_slice, hps.train.segment_size // hps.data.hop_length) - y_hat_mel = mel_spectrogram_torch( - y_hat.squeeze(1), - hps.data.filter_length, - hps.data.n_mel_channels, - hps.data.sampling_rate, - hps.data.hop_length, - hps.data.win_length, - hps.data.mel_fmin, - hps.data.mel_fmax - ) - - y = commons.slice_segments(y, ids_slice * hps.data.hop_length, hps.train.segment_size) # slice - - # Discriminator - y_d_hat_r, y_d_hat_g, _, _ = net_d(y, y_hat.detach()) - with autocast(enabled=False): - loss_disc, losses_disc_r, losses_disc_g = discriminator_loss(y_d_hat_r, y_d_hat_g) - loss_disc_all = loss_disc - if net_dur_disc is not None: - y_dur_hat_r, y_dur_hat_g = net_dur_disc(hidden_x.detach(), x_mask.detach(), logw.detach(), logw_.detach()) - with autocast(enabled=False): - # TODO: I think need to mean using the mask, but for now, just mean all - loss_dur_disc, losses_dur_disc_r, losses_dur_disc_g = discriminator_loss(y_dur_hat_r, y_dur_hat_g) - loss_dur_disc_all = loss_dur_disc - optim_dur_disc.zero_grad() - scaler.scale(loss_dur_disc_all).backward() - scaler.unscale_(optim_dur_disc) - grad_norm_dur_disc = commons.clip_grad_value_(net_dur_disc.parameters(), None) - scaler.step(optim_dur_disc) - - optim_d.zero_grad() - scaler.scale(loss_disc_all).backward() - scaler.unscale_(optim_d) - grad_norm_d = commons.clip_grad_value_(net_d.parameters(), None) - scaler.step(optim_d) - - with autocast(enabled=hps.train.fp16_run): - # Generator - y_d_hat_r, y_d_hat_g, fmap_r, fmap_g = net_d(y, y_hat) - if net_dur_disc is not None: - y_dur_hat_r, y_dur_hat_g = net_dur_disc(hidden_x, x_mask, logw, logw_) - with autocast(enabled=False): - loss_dur = torch.sum(l_length.float()) - loss_mel = F.l1_loss(y_mel, y_hat_mel) * hps.train.c_mel - loss_kl = kl_loss(z_p, logs_q, m_p, logs_p, z_mask) * hps.train.c_kl - - loss_fm = feature_loss(fmap_r, fmap_g) - loss_gen, losses_gen = generator_loss(y_d_hat_g) - loss_gen_all = loss_gen + loss_fm + loss_mel + loss_dur + loss_kl - if net_dur_disc is not None: - loss_dur_gen, losses_dur_gen = generator_loss(y_dur_hat_g) - loss_gen_all += loss_dur_gen - optim_g.zero_grad() - scaler.scale(loss_gen_all).backward() - scaler.unscale_(optim_g) - grad_norm_g = commons.clip_grad_value_(net_g.parameters(), None) - scaler.step(optim_g) - scaler.update() - - if rank == 0: - if global_step % hps.train.log_interval == 0: - lr = optim_g.param_groups[0]['lr'] - losses = [loss_disc, loss_gen, loss_fm, loss_mel, loss_dur, loss_kl] - logger.info('Train Epoch: {} [{:.0f}%]'.format( - epoch, - 100. * batch_idx / len(train_loader))) - logger.info([x.item() for x in losses] + [global_step, lr]) - - scalar_dict = {"loss/g/total": loss_gen_all, "loss/d/total": loss_disc_all, "learning_rate": lr, - "grad_norm_d": grad_norm_d, "grad_norm_g": grad_norm_g} - scalar_dict.update( - {"loss/g/fm": loss_fm, "loss/g/mel": loss_mel, "loss/g/dur": loss_dur, "loss/g/kl": loss_kl}) - scalar_dict.update({"loss/g/{}".format(i): v for i, v in enumerate(losses_gen)}) - scalar_dict.update({"loss/d_r/{}".format(i): v for i, v in enumerate(losses_disc_r)}) - scalar_dict.update({"loss/d_g/{}".format(i): v for i, v in enumerate(losses_disc_g)}) - - image_dict = { - "slice/mel_org": utils.plot_spectrogram_to_numpy(y_mel[0].data.cpu().numpy()), - "slice/mel_gen": utils.plot_spectrogram_to_numpy(y_hat_mel[0].data.cpu().numpy()), - "all/mel": utils.plot_spectrogram_to_numpy(mel[0].data.cpu().numpy()), - "all/attn": utils.plot_alignment_to_numpy(attn[0, 0].data.cpu().numpy()) - } - utils.summarize( - writer=writer, - global_step=global_step, - images=image_dict, - scalars=scalar_dict) - - if global_step % hps.train.eval_interval == 0: - evaluate(hps, net_g, eval_loader, writer_eval) - utils.save_checkpoint(net_g, optim_g, hps.train.learning_rate, epoch, - os.path.join(hps.model_dir, "G_{}.pth".format(global_step))) - utils.save_checkpoint(net_d, optim_d, hps.train.learning_rate, epoch, - os.path.join(hps.model_dir, "D_{}.pth".format(global_step))) - if net_dur_disc is not None: - utils.save_checkpoint(net_dur_disc, optim_dur_disc, hps.train.learning_rate, epoch, os.path.join(hps.model_dir, "DUR_{}.pth".format(global_step))) - keep_ckpts = getattr(hps.train, 'keep_ckpts', 5) - if keep_ckpts > 0: - utils.clean_checkpoints(path_to_models=hps.model_dir, n_ckpts_to_keep=keep_ckpts, sort_by_time=True) - - - global_step += 1 - - if rank == 0: - logger.info('====> Epoch: {}'.format(epoch)) - - - -def evaluate(hps, generator, eval_loader, writer_eval): - generator.eval() - image_dict = {} - audio_dict = {} - print("Evaluating ...") - with torch.no_grad(): - for batch_idx, (x, x_lengths, spec, spec_lengths, y, y_lengths, speakers, tone, language, bert) in enumerate(eval_loader): - x, x_lengths = x.cuda(), x_lengths.cuda() - spec, spec_lengths = spec.cuda(), spec_lengths.cuda() - y, y_lengths = y.cuda(), y_lengths.cuda() - speakers = speakers.cuda() - bert = bert.cuda() - tone = tone.cuda() - language = language.cuda() - for use_sdp in [True, False]: - y_hat, attn, mask, *_ = generator.module.infer(x, x_lengths, speakers, tone, language, bert, y=spec, max_len=1000, sdp_ratio=0.0 if not use_sdp else 1.0) - y_hat_lengths = mask.sum([1, 2]).long() * hps.data.hop_length - - mel = spec_to_mel_torch( - spec, - hps.data.filter_length, - hps.data.n_mel_channels, - hps.data.sampling_rate, - hps.data.mel_fmin, - hps.data.mel_fmax) - y_hat_mel = mel_spectrogram_torch( - y_hat.squeeze(1).float(), - hps.data.filter_length, - hps.data.n_mel_channels, - hps.data.sampling_rate, - hps.data.hop_length, - hps.data.win_length, - hps.data.mel_fmin, - hps.data.mel_fmax - ) - image_dict.update({ - f"gen/mel_{batch_idx}": utils.plot_spectrogram_to_numpy(y_hat_mel[0].cpu().numpy()) - }) - audio_dict.update({ - f"gen/audio_{batch_idx}_{use_sdp}": y_hat[0, :, :y_hat_lengths[0]] - }) - image_dict.update({f"gt/mel_{batch_idx}": utils.plot_spectrogram_to_numpy(mel[0].cpu().numpy())}) - audio_dict.update({f"gt/audio_{batch_idx}": y[0, :, :y_lengths[0]]}) - - utils.summarize( - writer=writer_eval, - global_step=global_step, - images=image_dict, - audios=audio_dict, - audio_sampling_rate=hps.data.sampling_rate - ) - generator.train() - -if __name__ == "__main__": - main() diff --git a/spaces/XzJosh/Jianmo-Bert-VITS2/text/english.py b/spaces/XzJosh/Jianmo-Bert-VITS2/text/english.py deleted file mode 100644 index 781d0a56cef71f66fc67db51d76538be90d3ddd2..0000000000000000000000000000000000000000 --- a/spaces/XzJosh/Jianmo-Bert-VITS2/text/english.py +++ /dev/null @@ -1,138 +0,0 @@ -import pickle -import os -import re -from g2p_en import G2p -from string import punctuation - -from text import symbols - -current_file_path = os.path.dirname(__file__) -CMU_DICT_PATH = os.path.join(current_file_path, 'cmudict.rep') -CACHE_PATH = os.path.join(current_file_path, 'cmudict_cache.pickle') -_g2p = G2p() - -arpa = {'AH0', 'S', 'AH1', 'EY2', 'AE2', 'EH0', 'OW2', 'UH0', 'NG', 'B', 'G', 'AY0', 'M', 'AA0', 'F', 'AO0', 'ER2', 'UH1', 'IY1', 'AH2', 'DH', 'IY0', 'EY1', 'IH0', 'K', 'N', 'W', 'IY2', 'T', 'AA1', 'ER1', 'EH2', 'OY0', 'UH2', 'UW1', 'Z', 'AW2', 'AW1', 'V', 'UW2', 'AA2', 'ER', 'AW0', 'UW0', 'R', 'OW1', 'EH1', 'ZH', 'AE0', 'IH2', 'IH', 'Y', 'JH', 'P', 'AY1', 'EY0', 'OY2', 'TH', 'HH', 'D', 'ER0', 'CH', 'AO1', 'AE1', 'AO2', 'OY1', 'AY2', 'IH1', 'OW0', 'L', 'SH'} - - -def post_replace_ph(ph): - rep_map = { - ':': ',', - ';': ',', - ',': ',', - '。': '.', - '!': '!', - '?': '?', - '\n': '.', - "·": ",", - '、': ",", - '...': '…', - 'v': "V" - } - if ph in rep_map.keys(): - ph = rep_map[ph] - if ph in symbols: - return ph - if ph not in symbols: - ph = 'UNK' - return ph - -def read_dict(): - g2p_dict = {} - start_line = 49 - with open(CMU_DICT_PATH) as f: - line = f.readline() - line_index = 1 - while line: - if line_index >= start_line: - line = line.strip() - word_split = line.split(' ') - word = word_split[0] - - syllable_split = word_split[1].split(' - ') - g2p_dict[word] = [] - for syllable in syllable_split: - phone_split = syllable.split(' ') - g2p_dict[word].append(phone_split) - - line_index = line_index + 1 - line = f.readline() - - return g2p_dict - - -def cache_dict(g2p_dict, file_path): - with open(file_path, 'wb') as pickle_file: - pickle.dump(g2p_dict, pickle_file) - - -def get_dict(): - if os.path.exists(CACHE_PATH): - with open(CACHE_PATH, 'rb') as pickle_file: - g2p_dict = pickle.load(pickle_file) - else: - g2p_dict = read_dict() - cache_dict(g2p_dict, CACHE_PATH) - - return g2p_dict - -eng_dict = get_dict() - -def refine_ph(phn): - tone = 0 - if re.search(r'\d$', phn): - tone = int(phn[-1]) + 1 - phn = phn[:-1] - return phn.lower(), tone - -def refine_syllables(syllables): - tones = [] - phonemes = [] - for phn_list in syllables: - for i in range(len(phn_list)): - phn = phn_list[i] - phn, tone = refine_ph(phn) - phonemes.append(phn) - tones.append(tone) - return phonemes, tones - - -def text_normalize(text): - # todo: eng text normalize - return text - -def g2p(text): - - phones = [] - tones = [] - words = re.split(r"([,;.\-\?\!\s+])", text) - for w in words: - if w.upper() in eng_dict: - phns, tns = refine_syllables(eng_dict[w.upper()]) - phones += phns - tones += tns - else: - phone_list = list(filter(lambda p: p != " ", _g2p(w))) - for ph in phone_list: - if ph in arpa: - ph, tn = refine_ph(ph) - phones.append(ph) - tones.append(tn) - else: - phones.append(ph) - tones.append(0) - # todo: implement word2ph - word2ph = [1 for i in phones] - - phones = [post_replace_ph(i) for i in phones] - return phones, tones, word2ph - -if __name__ == "__main__": - # print(get_dict()) - # print(eng_word_to_phoneme("hello")) - print(g2p("In this paper, we propose 1 DSPGAN, a GAN-based universal vocoder.")) - # all_phones = set() - # for k, syllables in eng_dict.items(): - # for group in syllables: - # for ph in group: - # all_phones.add(ph) - # print(all_phones) \ No newline at end of file diff --git a/spaces/Yarumo/prompthero-openjourney-v4/README.md b/spaces/Yarumo/prompthero-openjourney-v4/README.md deleted file mode 100644 index 8e7be51e6a185816b3144939a81126fec3ddfd14..0000000000000000000000000000000000000000 --- a/spaces/Yarumo/prompthero-openjourney-v4/README.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: Prompthero Openjourney V4 -emoji: 🏃 -colorFrom: red -colorTo: red -sdk: gradio -sdk_version: 3.28.0 -app_file: app.py -pinned: false ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/YenLai/Superhuman/theme_dropdown.py b/spaces/YenLai/Superhuman/theme_dropdown.py deleted file mode 100644 index 6235388fd00549553df44028f3ccf03e946994ea..0000000000000000000000000000000000000000 --- a/spaces/YenLai/Superhuman/theme_dropdown.py +++ /dev/null @@ -1,57 +0,0 @@ -import os -import pathlib - -from gradio.themes.utils import ThemeAsset - - -def create_theme_dropdown(): - import gradio as gr - - asset_path = pathlib.Path(__file__).parent / "themes" - themes = [] - for theme_asset in os.listdir(str(asset_path)): - themes.append( - (ThemeAsset(theme_asset), gr.Theme.load(str(asset_path / theme_asset))) - ) - - def make_else_if(theme_asset): - return f""" - else if (theme == '{str(theme_asset[0].version)}') {{ - var theme_css = `{theme_asset[1]._get_theme_css()}` - }}""" - - head, tail = themes[0], themes[1:] - if_statement = f""" - if (theme == "{str(head[0].version)}") {{ - var theme_css = `{head[1]._get_theme_css()}` - }} {" ".join(make_else_if(t) for t in tail)} - """ - - latest_to_oldest = sorted([t[0] for t in themes], key=lambda asset: asset.version)[ - ::-1 - ] - latest_to_oldest = [str(t.version) for t in latest_to_oldest] - - component = gr.Dropdown( - choices=latest_to_oldest, - value=latest_to_oldest[0], - render=False, - label="Select Version", - ).style(container=False) - - return ( - component, - f""" - (theme) => {{ - if (!document.querySelector('.theme-css')) {{ - var theme_elem = document.createElement('style'); - theme_elem.classList.add('theme-css'); - document.head.appendChild(theme_elem); - }} else {{ - var theme_elem = document.querySelector('.theme-css'); - }} - {if_statement} - theme_elem.innerHTML = theme_css; - }} - """, - ) diff --git a/spaces/Yiqin/ChatVID/model/vision/DenseCaptioner.py b/spaces/Yiqin/ChatVID/model/vision/DenseCaptioner.py deleted file mode 100644 index fe53bfacfb1ced70bc83283cf4beafe2bc52d682..0000000000000000000000000000000000000000 --- a/spaces/Yiqin/ChatVID/model/vision/DenseCaptioner.py +++ /dev/null @@ -1,17 +0,0 @@ -from model.vision.grit_src.image_dense_captions import image_caption_api -import cv2 - - -class DenseCaptioner(): - - def __init__(self, device): - self.device = device - - def __call__(self, imgs): - dense_captions = [] - for img in imgs: - cv2_img = cv2.merge([img[2], img[1], img[0]]) # BGR - caption = image_caption_api(cv2_img, device=self.device) - dense_captions.append(caption) - - return dense_captions diff --git a/spaces/YotamNitzan/domain-expansion/torch_utils/__init__.py b/spaces/YotamNitzan/domain-expansion/torch_utils/__init__.py deleted file mode 100644 index ece0ea08fe2e939cc260a1dafc0ab5b391b773d9..0000000000000000000000000000000000000000 --- a/spaces/YotamNitzan/domain-expansion/torch_utils/__init__.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. -# -# NVIDIA CORPORATION and its licensors retain all intellectual property -# and proprietary rights in and to this software, related documentation -# and any modifications thereto. Any use, reproduction, disclosure or -# distribution of this software and related documentation without an express -# license agreement from NVIDIA CORPORATION is strictly prohibited. - -# empty diff --git a/spaces/aLIdAmIrI/math-help/README.md b/spaces/aLIdAmIrI/math-help/README.md deleted file mode 100644 index 3bc1c028e1fd609125306f983cf8a5ddb9ba13bd..0000000000000000000000000000000000000000 --- a/spaces/aLIdAmIrI/math-help/README.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: Math Help -emoji: 👀 -colorFrom: purple -colorTo: indigo -sdk: streamlit -sdk_version: 1.19.0 -app_file: app.py -pinned: false -license: mit ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/spaces/abhishek/sketch-to-image/annotator/uniformer/mmdet_null/core/bbox/samplers/pseudo_sampler.py b/spaces/abhishek/sketch-to-image/annotator/uniformer/mmdet_null/core/bbox/samplers/pseudo_sampler.py deleted file mode 100644 index 2bd81abcdc62debc14772659d7a171f20bf33364..0000000000000000000000000000000000000000 --- a/spaces/abhishek/sketch-to-image/annotator/uniformer/mmdet_null/core/bbox/samplers/pseudo_sampler.py +++ /dev/null @@ -1,41 +0,0 @@ -import torch - -from ..builder import BBOX_SAMPLERS -from .base_sampler import BaseSampler -from .sampling_result import SamplingResult - - -@BBOX_SAMPLERS.register_module() -class PseudoSampler(BaseSampler): - """A pseudo sampler that does not do sampling actually.""" - - def __init__(self, **kwargs): - pass - - def _sample_pos(self, **kwargs): - """Sample positive samples.""" - raise NotImplementedError - - def _sample_neg(self, **kwargs): - """Sample negative samples.""" - raise NotImplementedError - - def sample(self, assign_result, bboxes, gt_bboxes, **kwargs): - """Directly returns the positive and negative indices of samples. - - Args: - assign_result (:obj:`AssignResult`): Assigned results - bboxes (torch.Tensor): Bounding boxes - gt_bboxes (torch.Tensor): Ground truth boxes - - Returns: - :obj:`SamplingResult`: sampler results - """ - pos_inds = torch.nonzero( - assign_result.gt_inds > 0, as_tuple=False).squeeze(-1).unique() - neg_inds = torch.nonzero( - assign_result.gt_inds == 0, as_tuple=False).squeeze(-1).unique() - gt_flags = bboxes.new_zeros(bboxes.shape[0], dtype=torch.uint8) - sampling_result = SamplingResult(pos_inds, neg_inds, bboxes, gt_bboxes, - assign_result, gt_flags) - return sampling_result diff --git a/spaces/abhishek/sketch-to-image/annotator/uniformer/mmdet_null/models/utils/builder.py b/spaces/abhishek/sketch-to-image/annotator/uniformer/mmdet_null/models/utils/builder.py deleted file mode 100644 index f362d1c92ca9d4ed95a2b3d28d3e6baedd14e462..0000000000000000000000000000000000000000 --- a/spaces/abhishek/sketch-to-image/annotator/uniformer/mmdet_null/models/utils/builder.py +++ /dev/null @@ -1,14 +0,0 @@ -from mmcv.utils import Registry, build_from_cfg - -TRANSFORMER = Registry('Transformer') -POSITIONAL_ENCODING = Registry('Position encoding') - - -def build_transformer(cfg, default_args=None): - """Builder for Transformer.""" - return build_from_cfg(cfg, TRANSFORMER, default_args) - - -def build_positional_encoding(cfg, default_args=None): - """Builder for Position Encoding.""" - return build_from_cfg(cfg, POSITIONAL_ENCODING, default_args) diff --git a/spaces/acmyu/frame_interpolation_prototype/main.py b/spaces/acmyu/frame_interpolation_prototype/main.py deleted file mode 100644 index d67d22f76829e81a3454291c1e4b087e2e0bc993..0000000000000000000000000000000000000000 --- a/spaces/acmyu/frame_interpolation_prototype/main.py +++ /dev/null @@ -1,38 +0,0 @@ - -from parameter import * -from trainer import Trainer -# from tester import Tester -from data_loader import Data_Loader -from torch.backends import cudnn -from utils import make_folder - -def main(config): - # For fast training - cudnn.benchmark = True - - - # Data loader - data_loader = Data_Loader(config.train, config.dataset, config.image_path, config.imsize, - config.batch_size, shuf=config.train) - - # Create directories if not exist - make_folder(config.model_save_path, config.version) - make_folder(config.sample_path, config.version) - make_folder(config.log_path, config.version) - make_folder(config.attn_path, config.version) - - - if config.train: - if config.model=='sagan': - trainer = Trainer(data_loader.loader(), config) - elif config.model == 'qgan': - trainer = qgan_trainer(data_loader.loader(), config) - trainer.train() - else: - tester = Tester(data_loader.loader(), config) - tester.test() - -if __name__ == '__main__': - config = get_parameters() - print(config) - main(config) \ No newline at end of file diff --git a/spaces/adirik/kakao-brain-vit/backbone/.ipynb_checkpoints/__init__-checkpoint.py b/spaces/adirik/kakao-brain-vit/backbone/.ipynb_checkpoints/__init__-checkpoint.py deleted file mode 100644 index a220762e4eb64aa7de6799b54bae484898f38d7c..0000000000000000000000000000000000000000 --- a/spaces/adirik/kakao-brain-vit/backbone/.ipynb_checkpoints/__init__-checkpoint.py +++ /dev/null @@ -1,2 +0,0 @@ -from .vit_model import create_name_vit -from .classification import ClassificationModel \ No newline at end of file diff --git a/spaces/ai-guru/composer/source/ui/README.md b/spaces/ai-guru/composer/source/ui/README.md deleted file mode 100644 index 374efec4c10bf004b18a3faa32566c225a8377af..0000000000000000000000000000000000000000 --- a/spaces/ai-guru/composer/source/ui/README.md +++ /dev/null @@ -1,38 +0,0 @@ -# create-svelte - -Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte). - -## Creating a project - -If you're seeing this, you've probably already done this step. Congrats! - -```bash -# create a new project in the current directory -npm init svelte - -# create a new project in my-app -npm init svelte my-app -``` - -## Developing - -Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server: - -```bash -npm run dev - -# or start the server and open the app in a new browser tab -npm run dev -- --open -``` - -## Building - -To create a production version of your app: - -```bash -npm run build -``` - -You can preview the production build with `npm run preview`. - -> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment. diff --git a/spaces/airsat/dalle-mini/html2canvas.js b/spaces/airsat/dalle-mini/html2canvas.js deleted file mode 100644 index 96e2dc5707b1a584ff7b3b583aea7c6c18d4ea76..0000000000000000000000000000000000000000 --- a/spaces/airsat/dalle-mini/html2canvas.js +++ /dev/null @@ -1,7756 +0,0 @@ -/*! - * html2canvas 1.4.1 - * Copyright (c) 2022 Niklas von Hertzen - * Released under MIT License - */ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.html2canvas = factory()); -}(this, (function () { 'use strict'; - - /*! ***************************************************************************** - 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. - ***************************************************************************** */ - /* global Reflect, Promise */ - - var extendStatics = function(d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - - function __extends(d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - } - - var __assign = function() { - __assign = Object.assign || function __assign(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); - }; - - function __awaiter(thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - } - - function __generator(thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } - } - - function __spreadArray(to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || from); - } - - var Bounds = /** @class */ (function () { - function Bounds(left, top, width, height) { - this.left = left; - this.top = top; - this.width = width; - this.height = height; - } - Bounds.prototype.add = function (x, y, w, h) { - return new Bounds(this.left + x, this.top + y, this.width + w, this.height + h); - }; - Bounds.fromClientRect = function (context, clientRect) { - return new Bounds(clientRect.left + context.windowBounds.left, clientRect.top + context.windowBounds.top, clientRect.width, clientRect.height); - }; - Bounds.fromDOMRectList = function (context, domRectList) { - var domRect = Array.from(domRectList).find(function (rect) { return rect.width !== 0; }); - return domRect - ? new Bounds(domRect.left + context.windowBounds.left, domRect.top + context.windowBounds.top, domRect.width, domRect.height) - : Bounds.EMPTY; - }; - Bounds.EMPTY = new Bounds(0, 0, 0, 0); - return Bounds; - }()); - var parseBounds = function (context, node) { - return Bounds.fromClientRect(context, node.getBoundingClientRect()); - }; - var parseDocumentSize = function (document) { - var body = document.body; - var documentElement = document.documentElement; - if (!body || !documentElement) { - throw new Error("Unable to get document size"); - } - var width = Math.max(Math.max(body.scrollWidth, documentElement.scrollWidth), Math.max(body.offsetWidth, documentElement.offsetWidth), Math.max(body.clientWidth, documentElement.clientWidth)); - var height = Math.max(Math.max(body.scrollHeight, documentElement.scrollHeight), Math.max(body.offsetHeight, documentElement.offsetHeight), Math.max(body.clientHeight, documentElement.clientHeight)); - return new Bounds(0, 0, width, height); - }; - - /* - * css-line-break 2.1.0 - * Copyright (c) 2022 Niklas von Hertzen - * Released under MIT License - */ - var toCodePoints$1 = function (str) { - var codePoints = []; - var i = 0; - var length = str.length; - while (i < length) { - var value = str.charCodeAt(i++); - if (value >= 0xd800 && value <= 0xdbff && i < length) { - var extra = str.charCodeAt(i++); - if ((extra & 0xfc00) === 0xdc00) { - codePoints.push(((value & 0x3ff) << 10) + (extra & 0x3ff) + 0x10000); - } - else { - codePoints.push(value); - i--; - } - } - else { - codePoints.push(value); - } - } - return codePoints; - }; - var fromCodePoint$1 = function () { - var codePoints = []; - for (var _i = 0; _i < arguments.length; _i++) { - codePoints[_i] = arguments[_i]; - } - if (String.fromCodePoint) { - return String.fromCodePoint.apply(String, codePoints); - } - var length = codePoints.length; - if (!length) { - return ''; - } - var codeUnits = []; - var index = -1; - var result = ''; - while (++index < length) { - var codePoint = codePoints[index]; - if (codePoint <= 0xffff) { - codeUnits.push(codePoint); - } - else { - codePoint -= 0x10000; - codeUnits.push((codePoint >> 10) + 0xd800, (codePoint % 0x400) + 0xdc00); - } - if (index + 1 === length || codeUnits.length > 0x4000) { - result += String.fromCharCode.apply(String, codeUnits); - codeUnits.length = 0; - } - } - return result; - }; - var chars$2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; - // Use a lookup table to find the index. - var lookup$2 = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256); - for (var i$2 = 0; i$2 < chars$2.length; i$2++) { - lookup$2[chars$2.charCodeAt(i$2)] = i$2; - } - - /* - * utrie 1.0.2 - * Copyright (c) 2022 Niklas von Hertzen - * Released under MIT License - */ - var chars$1$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; - // Use a lookup table to find the index. - var lookup$1$1 = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256); - for (var i$1$1 = 0; i$1$1 < chars$1$1.length; i$1$1++) { - lookup$1$1[chars$1$1.charCodeAt(i$1$1)] = i$1$1; - } - var decode$1 = function (base64) { - var bufferLength = base64.length * 0.75, len = base64.length, i, p = 0, encoded1, encoded2, encoded3, encoded4; - if (base64[base64.length - 1] === '=') { - bufferLength--; - if (base64[base64.length - 2] === '=') { - bufferLength--; - } - } - var buffer = typeof ArrayBuffer !== 'undefined' && - typeof Uint8Array !== 'undefined' && - typeof Uint8Array.prototype.slice !== 'undefined' - ? new ArrayBuffer(bufferLength) - : new Array(bufferLength); - var bytes = Array.isArray(buffer) ? buffer : new Uint8Array(buffer); - for (i = 0; i < len; i += 4) { - encoded1 = lookup$1$1[base64.charCodeAt(i)]; - encoded2 = lookup$1$1[base64.charCodeAt(i + 1)]; - encoded3 = lookup$1$1[base64.charCodeAt(i + 2)]; - encoded4 = lookup$1$1[base64.charCodeAt(i + 3)]; - bytes[p++] = (encoded1 << 2) | (encoded2 >> 4); - bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2); - bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63); - } - return buffer; - }; - var polyUint16Array$1 = function (buffer) { - var length = buffer.length; - var bytes = []; - for (var i = 0; i < length; i += 2) { - bytes.push((buffer[i + 1] << 8) | buffer[i]); - } - return bytes; - }; - var polyUint32Array$1 = function (buffer) { - var length = buffer.length; - var bytes = []; - for (var i = 0; i < length; i += 4) { - bytes.push((buffer[i + 3] << 24) | (buffer[i + 2] << 16) | (buffer[i + 1] << 8) | buffer[i]); - } - return bytes; - }; - - /** Shift size for getting the index-2 table offset. */ - var UTRIE2_SHIFT_2$1 = 5; - /** Shift size for getting the index-1 table offset. */ - var UTRIE2_SHIFT_1$1 = 6 + 5; - /** - * Shift size for shifting left the index array values. - * Increases possible data size with 16-bit index values at the cost - * of compactability. - * This requires data blocks to be aligned by UTRIE2_DATA_GRANULARITY. - */ - var UTRIE2_INDEX_SHIFT$1 = 2; - /** - * Difference between the two shift sizes, - * for getting an index-1 offset from an index-2 offset. 6=11-5 - */ - var UTRIE2_SHIFT_1_2$1 = UTRIE2_SHIFT_1$1 - UTRIE2_SHIFT_2$1; - /** - * The part of the index-2 table for U+D800..U+DBFF stores values for - * lead surrogate code _units_ not code _points_. - * Values for lead surrogate code _points_ are indexed with this portion of the table. - * Length=32=0x20=0x400>>UTRIE2_SHIFT_2. (There are 1024=0x400 lead surrogates.) - */ - var UTRIE2_LSCP_INDEX_2_OFFSET$1 = 0x10000 >> UTRIE2_SHIFT_2$1; - /** Number of entries in a data block. 32=0x20 */ - var UTRIE2_DATA_BLOCK_LENGTH$1 = 1 << UTRIE2_SHIFT_2$1; - /** Mask for getting the lower bits for the in-data-block offset. */ - var UTRIE2_DATA_MASK$1 = UTRIE2_DATA_BLOCK_LENGTH$1 - 1; - var UTRIE2_LSCP_INDEX_2_LENGTH$1 = 0x400 >> UTRIE2_SHIFT_2$1; - /** Count the lengths of both BMP pieces. 2080=0x820 */ - var UTRIE2_INDEX_2_BMP_LENGTH$1 = UTRIE2_LSCP_INDEX_2_OFFSET$1 + UTRIE2_LSCP_INDEX_2_LENGTH$1; - /** - * The 2-byte UTF-8 version of the index-2 table follows at offset 2080=0x820. - * Length 32=0x20 for lead bytes C0..DF, regardless of UTRIE2_SHIFT_2. - */ - var UTRIE2_UTF8_2B_INDEX_2_OFFSET$1 = UTRIE2_INDEX_2_BMP_LENGTH$1; - var UTRIE2_UTF8_2B_INDEX_2_LENGTH$1 = 0x800 >> 6; /* U+0800 is the first code point after 2-byte UTF-8 */ - /** - * The index-1 table, only used for supplementary code points, at offset 2112=0x840. - * Variable length, for code points up to highStart, where the last single-value range starts. - * Maximum length 512=0x200=0x100000>>UTRIE2_SHIFT_1. - * (For 0x100000 supplementary code points U+10000..U+10ffff.) - * - * The part of the index-2 table for supplementary code points starts - * after this index-1 table. - * - * Both the index-1 table and the following part of the index-2 table - * are omitted completely if there is only BMP data. - */ - var UTRIE2_INDEX_1_OFFSET$1 = UTRIE2_UTF8_2B_INDEX_2_OFFSET$1 + UTRIE2_UTF8_2B_INDEX_2_LENGTH$1; - /** - * Number of index-1 entries for the BMP. 32=0x20 - * This part of the index-1 table is omitted from the serialized form. - */ - var UTRIE2_OMITTED_BMP_INDEX_1_LENGTH$1 = 0x10000 >> UTRIE2_SHIFT_1$1; - /** Number of entries in an index-2 block. 64=0x40 */ - var UTRIE2_INDEX_2_BLOCK_LENGTH$1 = 1 << UTRIE2_SHIFT_1_2$1; - /** Mask for getting the lower bits for the in-index-2-block offset. */ - var UTRIE2_INDEX_2_MASK$1 = UTRIE2_INDEX_2_BLOCK_LENGTH$1 - 1; - var slice16$1 = function (view, start, end) { - if (view.slice) { - return view.slice(start, end); - } - return new Uint16Array(Array.prototype.slice.call(view, start, end)); - }; - var slice32$1 = function (view, start, end) { - if (view.slice) { - return view.slice(start, end); - } - return new Uint32Array(Array.prototype.slice.call(view, start, end)); - }; - var createTrieFromBase64$1 = function (base64, _byteLength) { - var buffer = decode$1(base64); - var view32 = Array.isArray(buffer) ? polyUint32Array$1(buffer) : new Uint32Array(buffer); - var view16 = Array.isArray(buffer) ? polyUint16Array$1(buffer) : new Uint16Array(buffer); - var headerLength = 24; - var index = slice16$1(view16, headerLength / 2, view32[4] / 2); - var data = view32[5] === 2 - ? slice16$1(view16, (headerLength + view32[4]) / 2) - : slice32$1(view32, Math.ceil((headerLength + view32[4]) / 4)); - return new Trie$1(view32[0], view32[1], view32[2], view32[3], index, data); - }; - var Trie$1 = /** @class */ (function () { - function Trie(initialValue, errorValue, highStart, highValueIndex, index, data) { - this.initialValue = initialValue; - this.errorValue = errorValue; - this.highStart = highStart; - this.highValueIndex = highValueIndex; - this.index = index; - this.data = data; - } - /** - * Get the value for a code point as stored in the Trie. - * - * @param codePoint the code point - * @return the value - */ - Trie.prototype.get = function (codePoint) { - var ix; - if (codePoint >= 0) { - if (codePoint < 0x0d800 || (codePoint > 0x0dbff && codePoint <= 0x0ffff)) { - // Ordinary BMP code point, excluding leading surrogates. - // BMP uses a single level lookup. BMP index starts at offset 0 in the Trie2 index. - // 16 bit data is stored in the index array itself. - ix = this.index[codePoint >> UTRIE2_SHIFT_2$1]; - ix = (ix << UTRIE2_INDEX_SHIFT$1) + (codePoint & UTRIE2_DATA_MASK$1); - return this.data[ix]; - } - if (codePoint <= 0xffff) { - // Lead Surrogate Code Point. A Separate index section is stored for - // lead surrogate code units and code points. - // The main index has the code unit data. - // For this function, we need the code point data. - // Note: this expression could be refactored for slightly improved efficiency, but - // surrogate code points will be so rare in practice that it's not worth it. - ix = this.index[UTRIE2_LSCP_INDEX_2_OFFSET$1 + ((codePoint - 0xd800) >> UTRIE2_SHIFT_2$1)]; - ix = (ix << UTRIE2_INDEX_SHIFT$1) + (codePoint & UTRIE2_DATA_MASK$1); - return this.data[ix]; - } - if (codePoint < this.highStart) { - // Supplemental code point, use two-level lookup. - ix = UTRIE2_INDEX_1_OFFSET$1 - UTRIE2_OMITTED_BMP_INDEX_1_LENGTH$1 + (codePoint >> UTRIE2_SHIFT_1$1); - ix = this.index[ix]; - ix += (codePoint >> UTRIE2_SHIFT_2$1) & UTRIE2_INDEX_2_MASK$1; - ix = this.index[ix]; - ix = (ix << UTRIE2_INDEX_SHIFT$1) + (codePoint & UTRIE2_DATA_MASK$1); - return this.data[ix]; - } - if (codePoint <= 0x10ffff) { - return this.data[this.highValueIndex]; - } - } - // Fall through. The code point is outside of the legal range of 0..0x10ffff. - return this.errorValue; - }; - return Trie; - }()); - - /* - * base64-arraybuffer 1.0.2 - * Copyright (c) 2022 Niklas von Hertzen - * Released under MIT License - */ - var chars$3 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; - // Use a lookup table to find the index. - var lookup$3 = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256); - for (var i$3 = 0; i$3 < chars$3.length; i$3++) { - lookup$3[chars$3.charCodeAt(i$3)] = i$3; - } - - var base64$1 = 'KwAAAAAAAAAACA4AUD0AADAgAAACAAAAAAAIABAAGABAAEgAUABYAGAAaABgAGgAYgBqAF8AZwBgAGgAcQB5AHUAfQCFAI0AlQCdAKIAqgCyALoAYABoAGAAaABgAGgAwgDKAGAAaADGAM4A0wDbAOEA6QDxAPkAAQEJAQ8BFwF1AH0AHAEkASwBNAE6AUIBQQFJAVEBWQFhAWgBcAF4ATAAgAGGAY4BlQGXAZ8BpwGvAbUBvQHFAc0B0wHbAeMB6wHxAfkBAQIJAvEBEQIZAiECKQIxAjgCQAJGAk4CVgJeAmQCbAJ0AnwCgQKJApECmQKgAqgCsAK4ArwCxAIwAMwC0wLbAjAA4wLrAvMC+AIAAwcDDwMwABcDHQMlAy0DNQN1AD0DQQNJA0kDSQNRA1EDVwNZA1kDdQB1AGEDdQBpA20DdQN1AHsDdQCBA4kDkQN1AHUAmQOhA3UAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AKYDrgN1AHUAtgO+A8YDzgPWAxcD3gPjA+sD8wN1AHUA+wMDBAkEdQANBBUEHQQlBCoEFwMyBDgEYABABBcDSARQBFgEYARoBDAAcAQzAXgEgASIBJAEdQCXBHUAnwSnBK4EtgS6BMIEyAR1AHUAdQB1AHUAdQCVANAEYABgAGAAYABgAGAAYABgANgEYADcBOQEYADsBPQE/AQEBQwFFAUcBSQFLAU0BWQEPAVEBUsFUwVbBWAAYgVgAGoFcgV6BYIFigWRBWAAmQWfBaYFYABgAGAAYABgAKoFYACxBbAFuQW6BcEFwQXHBcEFwQXPBdMF2wXjBeoF8gX6BQIGCgYSBhoGIgYqBjIGOgZgAD4GRgZMBmAAUwZaBmAAYABgAGAAYABgAGAAYABgAGAAYABgAGIGYABpBnAGYABgAGAAYABgAGAAYABgAGAAYAB4Bn8GhQZgAGAAYAB1AHcDFQSLBmAAYABgAJMGdQA9A3UAmwajBqsGqwaVALMGuwbDBjAAywbSBtIG1QbSBtIG0gbSBtIG0gbdBuMG6wbzBvsGAwcLBxMHAwcbByMHJwcsBywHMQcsB9IGOAdAB0gHTgfSBkgHVgfSBtIG0gbSBtIG0gbSBtIG0gbSBiwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdgAGAALAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdbB2MHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB2kH0gZwB64EdQB1AHUAdQB1AHUAdQB1AHUHfQdgAIUHjQd1AHUAlQedB2AAYAClB6sHYACzB7YHvgfGB3UAzgfWBzMB3gfmB1EB7gf1B/0HlQENAQUIDQh1ABUIHQglCBcDLQg1CD0IRQhNCEEDUwh1AHUAdQBbCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIcAh3CHoIMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIgggwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAALAcsBywHLAcsBywHLAcsBywHLAcsB4oILAcsB44I0gaWCJ4Ipgh1AHUAqgiyCHUAdQB1AHUAdQB1AHUAdQB1AHUAtwh8AXUAvwh1AMUIyQjRCNkI4AjoCHUAdQB1AO4I9gj+CAYJDgkTCS0HGwkjCYIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiAAIAAAAFAAYABgAGIAXwBgAHEAdQBFAJUAogCyAKAAYABgAEIA4ABGANMA4QDxAMEBDwE1AFwBLAE6AQEBUQF4QkhCmEKoQrhCgAHIQsAB0MLAAcABwAHAAeDC6ABoAHDCwMMAAcABwAHAAdDDGMMAAcAB6MM4wwjDWMNow3jDaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAEjDqABWw6bDqABpg6gAaABoAHcDvwOPA+gAaABfA/8DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DpcPAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcAB9cPKwkyCToJMAB1AHUAdQBCCUoJTQl1AFUJXAljCWcJawkwADAAMAAwAHMJdQB2CX4JdQCECYoJjgmWCXUAngkwAGAAYABxAHUApgn3A64JtAl1ALkJdQDACTAAMAAwADAAdQB1AHUAdQB1AHUAdQB1AHUAowYNBMUIMAAwADAAMADICcsJ0wnZCRUE4QkwAOkJ8An4CTAAMAB1AAAKvwh1AAgKDwoXCh8KdQAwACcKLgp1ADYKqAmICT4KRgowADAAdQB1AE4KMAB1AFYKdQBeCnUAZQowADAAMAAwADAAMAAwADAAMAAVBHUAbQowADAAdQC5CXUKMAAwAHwBxAijBogEMgF9CoQKiASMCpQKmgqIBKIKqgquCogEDQG2Cr4KxgrLCjAAMADTCtsKCgHjCusK8Qr5CgELMAAwADAAMAB1AIsECQsRC3UANAEZCzAAMAAwADAAMAB1ACELKQswAHUANAExCzkLdQBBC0kLMABRC1kLMAAwADAAMAAwADAAdQBhCzAAMAAwAGAAYABpC3ELdwt/CzAAMACHC4sLkwubC58Lpwt1AK4Ltgt1APsDMAAwADAAMAAwADAAMAAwAL4LwwvLC9IL1wvdCzAAMADlC+kL8Qv5C/8LSQswADAAMAAwADAAMAAwADAAMAAHDDAAMAAwADAAMAAODBYMHgx1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1ACYMMAAwADAAdQB1AHUALgx1AHUAdQB1AHUAdQA2DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AD4MdQBGDHUAdQB1AHUAdQB1AEkMdQB1AHUAdQB1AFAMMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQBYDHUAdQB1AF8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUA+wMVBGcMMAAwAHwBbwx1AHcMfwyHDI8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAYABgAJcMMAAwADAAdQB1AJ8MlQClDDAAMACtDCwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB7UMLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AA0EMAC9DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAsBywHLAcsBywHLAcsBywHLQcwAMEMyAwsBywHLAcsBywHLAcsBywHLAcsBywHzAwwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1ANQM2QzhDDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMABgAGAAYABgAGAAYABgAOkMYADxDGAA+AwADQYNYABhCWAAYAAODTAAMAAwADAAFg1gAGAAHg37AzAAMAAwADAAYABgACYNYAAsDTQNPA1gAEMNPg1LDWAAYABgAGAAYABgAGAAYABgAGAAUg1aDYsGVglhDV0NcQBnDW0NdQ15DWAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAlQCBDZUAiA2PDZcNMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAnw2nDTAAMAAwADAAMAAwAHUArw23DTAAMAAwADAAMAAwADAAMAAwADAAMAB1AL8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQDHDTAAYABgAM8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA1w11ANwNMAAwAD0B5A0wADAAMAAwADAAMADsDfQN/A0EDgwOFA4wABsOMAAwADAAMAAwADAAMAAwANIG0gbSBtIG0gbSBtIG0gYjDigOwQUuDsEFMw7SBjoO0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGQg5KDlIOVg7SBtIGXg5lDm0OdQ7SBtIGfQ6EDooOjQ6UDtIGmg6hDtIG0gaoDqwO0ga0DrwO0gZgAGAAYADEDmAAYAAkBtIGzA5gANIOYADaDokO0gbSBt8O5w7SBu8O0gb1DvwO0gZgAGAAxA7SBtIG0gbSBtIGYABgAGAAYAAED2AAsAUMD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHJA8sBywHLAcsBywHLAccDywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywPLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAc0D9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHPA/SBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gYUD0QPlQCVAJUAMAAwADAAMACVAJUAlQCVAJUAlQCVAEwPMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA//8EAAQABAAEAAQABAAEAAQABAANAAMAAQABAAIABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQACgATABcAHgAbABoAHgAXABYAEgAeABsAGAAPABgAHABLAEsASwBLAEsASwBLAEsASwBLABgAGAAeAB4AHgATAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABYAGwASAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWAA0AEQAeAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAFAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJABYAGgAbABsAGwAeAB0AHQAeAE8AFwAeAA0AHgAeABoAGwBPAE8ADgBQAB0AHQAdAE8ATwAXAE8ATwBPABYAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAFAATwBAAE8ATwBPAEAATwBQAFAATwBQAB4AHgAeAB4AHgAeAB0AHQAdAB0AHgAdAB4ADgBQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgBQAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAkACQAJAAkACQAJAAkABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAFAAHgAeAB4AKwArAFAAUABQAFAAGABQACsAKwArACsAHgAeAFAAHgBQAFAAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUAAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAYAA0AKwArAB4AHgAbACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAB4ABAAEAB4ABAAEABMABAArACsAKwArACsAKwArACsAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAKwArACsAKwBWAFYAVgBWAB4AHgArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AGgAaABoAGAAYAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQAEwAEACsAEwATAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABLAEsASwBLAEsASwBLAEsASwBLABoAGQAZAB4AUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABMAUAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABABQAFAABAAEAB4ABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUAAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAFAABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQAUABQAB4AHgAYABMAUAArACsABAAbABsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAFAABAAEAAQABAAEAFAABAAEAAQAUAAEAAQABAAEAAQAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArACsAHgArAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAUAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEAA0ADQBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUAArACsAKwBQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABABQACsAKwArACsAKwArACsAKwAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUAAaABoAUABQAFAAUABQAEwAHgAbAFAAHgAEACsAKwAEAAQABAArAFAAUABQAFAAUABQACsAKwArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQACsAUABQACsAKwAEACsABAAEAAQABAAEACsAKwArACsABAAEACsAKwAEAAQABAArACsAKwAEACsAKwArACsAKwArACsAUABQAFAAUAArAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLAAQABABQAFAAUAAEAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAArACsAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AGwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAKwArACsAKwArAAQABAAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAAQAUAArAFAAUABQAFAAUABQACsAKwArAFAAUABQACsAUABQAFAAUAArACsAKwBQAFAAKwBQACsAUABQACsAKwArAFAAUAArACsAKwBQAFAAUAArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArAAQABAAEAAQABAArACsAKwAEAAQABAArAAQABAAEAAQAKwArAFAAKwArACsAKwArACsABAArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAHgAeAB4AHgAeAB4AGwAeACsAKwArACsAKwAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAUABQAFAAKwArACsAKwArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwAOAFAAUABQAFAAUABQAFAAHgBQAAQABAAEAA4AUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAKwArAAQAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAKwArACsAKwArACsAUAArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABABQAB4AKwArACsAKwBQAFAAUAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQABoAUABQAFAAUABQAFAAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQACsAUAArACsAUABQAFAAUABQAFAAUAArACsAKwAEACsAKwArACsABAAEAAQABAAEAAQAKwAEACsABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArAAQABAAeACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAXAAqACoAKgAqACoAKgAqACsAKwArACsAGwBcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAeAEsASwBLAEsASwBLAEsASwBLAEsADQANACsAKwArACsAKwBcAFwAKwBcACsAXABcAFwAXABcACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAXAArAFwAXABcAFwAXABcAFwAXABcAFwAKgBcAFwAKgAqACoAKgAqACoAKgAqACoAXAArACsAXABcAFwAXABcACsAXAArACoAKgAqACoAKgAqACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwBcAFwAXABcAFAADgAOAA4ADgAeAA4ADgAJAA4ADgANAAkAEwATABMAEwATAAkAHgATAB4AHgAeAAQABAAeAB4AHgAeAB4AHgBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQAFAADQAEAB4ABAAeAAQAFgARABYAEQAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAAQABAAEAAQADQAEAAQAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAA0ADQAeAB4AHgAeAB4AHgAEAB4AHgAeAB4AHgAeACsAHgAeAA4ADgANAA4AHgAeAB4AHgAeAAkACQArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgBcAEsASwBLAEsASwBLAEsASwBLAEsADQANAB4AHgAeAB4AXABcAFwAXABcAFwAKgAqACoAKgBcAFwAXABcACoAKgAqAFwAKgAqACoAXABcACoAKgAqACoAKgAqACoAXABcAFwAKgAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqAFwAKgBLAEsASwBLAEsASwBLAEsASwBLACoAKgAqACoAKgAqAFAAUABQAFAAUABQACsAUAArACsAKwArACsAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAKwBQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsABAAEAAQAHgANAB4AHgAeAB4AHgAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUAArACsADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWABEAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQANAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAANAA0AKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUAArAAQABAArACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqAA0ADQAVAFwADQAeAA0AGwBcACoAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwAeAB4AEwATAA0ADQAOAB4AEwATAB4ABAAEAAQACQArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAHgArACsAKwATABMASwBLAEsASwBLAEsASwBLAEsASwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAXABcAFwAXABcACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAXAArACsAKwAqACoAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsAHgAeAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKwAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKwArAAQASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACoAKgAqACoAKgAqACoAXAAqACoAKgAqACoAKgArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABABQAFAAUABQAFAAUABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwANAA0AHgANAA0ADQANAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwAeAB4AHgAeAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArAA0ADQANAA0ADQBLAEsASwBLAEsASwBLAEsASwBLACsAKwArAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUAAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAAQAUABQAFAAUABQAFAABABQAFAABAAEAAQAUAArACsAKwArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQACsAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAFAAUABQACsAHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQACsAKwAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQACsAHgAeAB4AHgAeAB4AHgAOAB4AKwANAA0ADQANAA0ADQANAAkADQANAA0ACAAEAAsABAAEAA0ACQANAA0ADAAdAB0AHgAXABcAFgAXABcAFwAWABcAHQAdAB4AHgAUABQAFAANAAEAAQAEAAQABAAEAAQACQAaABoAGgAaABoAGgAaABoAHgAXABcAHQAVABUAHgAeAB4AHgAeAB4AGAAWABEAFQAVABUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ADQAeAA0ADQANAA0AHgANAA0ADQAHAB4AHgAeAB4AKwAEAAQABAAEAAQABAAEAAQABAAEAFAAUAArACsATwBQAFAAUABQAFAAHgAeAB4AFgARAE8AUABPAE8ATwBPAFAAUABQAFAAUAAeAB4AHgAWABEAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArABsAGwAbABsAGwAbABsAGgAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGgAbABsAGwAbABoAGwAbABoAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAHgAeAFAAGgAeAB0AHgBQAB4AGgAeAB4AHgAeAB4AHgAeAB4AHgBPAB4AUAAbAB4AHgBQAFAAUABQAFAAHgAeAB4AHQAdAB4AUAAeAFAAHgBQAB4AUABPAFAAUAAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgBQAFAAUABQAE8ATwBQAFAAUABQAFAATwBQAFAATwBQAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAUABQAFAATwBPAE8ATwBPAE8ATwBPAE8ATwBQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABPAB4AHgArACsAKwArAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHQAdAB4AHgAeAB0AHQAeAB4AHQAeAB4AHgAdAB4AHQAbABsAHgAdAB4AHgAeAB4AHQAeAB4AHQAdAB0AHQAeAB4AHQAeAB0AHgAdAB0AHQAdAB0AHQAeAB0AHgAeAB4AHgAeAB0AHQAdAB0AHgAeAB4AHgAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeAB0AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAeAB0AHQAdAB0AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAWABEAHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAWABEAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AHQAdAB0AHgAeAB0AHgAeAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlAB4AHQAdAB4AHgAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AJQAlAB0AHQAlAB4AJQAlACUAIAAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAdAB0AHQAeAB0AJQAdAB0AHgAdAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAdAB0AHQAdACUAHgAlACUAJQAdACUAJQAdAB0AHQAlACUAHQAdACUAHQAdACUAJQAlAB4AHQAeAB4AHgAeAB0AHQAlAB0AHQAdAB0AHQAdACUAJQAlACUAJQAdACUAJQAgACUAHQAdACUAJQAlACUAJQAlACUAJQAeAB4AHgAlACUAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AFwAXABcAFwAXABcAHgATABMAJQAeAB4AHgAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARABYAEQAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAEAAQABAAeAB4AKwArACsAKwArABMADQANAA0AUAATAA0AUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUAANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAA0ADQANAA0ADQANAA0ADQAeAA0AFgANAB4AHgAXABcAHgAeABcAFwAWABEAFgARABYAEQAWABEADQANAA0ADQATAFAADQANAB4ADQANAB4AHgAeAB4AHgAMAAwADQANAA0AHgANAA0AFgANAA0ADQANAA0ADQANAA0AHgANAB4ADQANAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArAA0AEQARACUAJQBHAFcAVwAWABEAFgARABYAEQAWABEAFgARACUAJQAWABEAFgARABYAEQAWABEAFQAWABEAEQAlAFcAVwBXAFcAVwBXAFcAVwBXAAQABAAEAAQABAAEACUAVwBXAFcAVwA2ACUAJQBXAFcAVwBHAEcAJQAlACUAKwBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBRAFcAUQBXAFEAVwBXAFcAVwBXAFcAUQBXAFcAVwBXAFcAVwBRAFEAKwArAAQABAAVABUARwBHAFcAFQBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBRAFcAVwBXAFcAVwBXAFEAUQBXAFcAVwBXABUAUQBHAEcAVwArACsAKwArACsAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwAlACUAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACsAKwArACsAKwArACsAKwArACsAKwArAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBPAE8ATwBPAE8ATwBPAE8AJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADQATAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABLAEsASwBLAEsASwBLAEsASwBLAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAABAAEAAQABAAeAAQABAAEAAQABAAEAAQABAAEAAQAHgBQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAeAA0ADQANAA0ADQArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAAQAUABQAFAABABQAFAAUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAeAB4AHgAeAAQAKwArACsAUABQAFAAUABQAFAAHgAeABoAHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADgAOABMAEwArACsAKwArACsAKwArACsABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwANAA0ASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUAAeAB4AHgBQAA4AUABQAAQAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArAB4AWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYACsAKwArAAQAHgAeAB4AHgAeAB4ADQANAA0AHgAeAB4AHgArAFAASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArAB4AHgBcAFwAXABcAFwAKgBcAFwAXABcAFwAXABcAFwAXABcAEsASwBLAEsASwBLAEsASwBLAEsAXABcAFwAXABcACsAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAFAAUABQAAQAUABQAFAAUABQAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAHgANAA0ADQBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAXAAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAKgAqACoAXABcACoAKgBcAFwAXABcAFwAKgAqAFwAKgBcACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcACoAKgBQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAA0ADQBQAFAAUAAEAAQAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQADQAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAVABVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBUAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVACsAKwArACsAKwArACsAKwArACsAKwArAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAKwArACsAKwBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAKwArACsAKwAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAKwArACsAKwArAFYABABWAFYAVgBWAFYAVgBWAFYAVgBWAB4AVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgArAFYAVgBWAFYAVgArAFYAKwBWAFYAKwBWAFYAKwBWAFYAVgBWAFYAVgBWAFYAVgBWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAEQAWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAaAB4AKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAGAARABEAGAAYABMAEwAWABEAFAArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACUAJQAlACUAJQAWABEAFgARABYAEQAWABEAFgARABYAEQAlACUAFgARACUAJQAlACUAJQAlACUAEQAlABEAKwAVABUAEwATACUAFgARABYAEQAWABEAJQAlACUAJQAlACUAJQAlACsAJQAbABoAJQArACsAKwArAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAcAKwATACUAJQAbABoAJQAlABYAEQAlACUAEQAlABEAJQBXAFcAVwBXAFcAVwBXAFcAVwBXABUAFQAlACUAJQATACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXABYAJQARACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAWACUAEQAlABYAEQARABYAEQARABUAVwBRAFEAUQBRAFEAUQBRAFEAUQBRAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcARwArACsAVwBXAFcAVwBXAFcAKwArAFcAVwBXAFcAVwBXACsAKwBXAFcAVwBXAFcAVwArACsAVwBXAFcAKwArACsAGgAbACUAJQAlABsAGwArAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAAQAB0AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsADQANAA0AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAA0AUABQAFAAUAArACsAKwArAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwArAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwBQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAUABQAFAAUABQAAQABAAEACsABAAEACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAKwBQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAA0ADQANAA0ADQANAA0ADQAeACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAArACsAKwArAFAAUABQAFAAUAANAA0ADQANAA0ADQAUACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsADQANAA0ADQANAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArAAQABAANACsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAB4AHgAeAB4AHgArACsAKwArACsAKwAEAAQABAAEAAQABAAEAA0ADQAeAB4AHgAeAB4AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsASwBLAEsASwBLAEsASwBLAEsASwANAA0ADQANAFAABAAEAFAAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAeAA4AUAArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAADQANAB4ADQAEAAQABAAEAB4ABAAEAEsASwBLAEsASwBLAEsASwBLAEsAUAAOAFAADQANAA0AKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAANAA0AHgANAA0AHgAEACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAA0AKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsABAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsABAAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAUAArACsAKwArACsAKwAEACsAKwArACsAKwBQAFAAUABQAFAABAAEACsAKwAEAAQABAAEAAQABAAEACsAKwArAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABABQAFAAUABQAA0ADQANAA0AHgBLAEsASwBLAEsASwBLAEsASwBLAA0ADQArAB4ABABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUAAeAFAAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABAAEAAQADgANAA0AEwATAB4AHgAeAA0ADQANAA0ADQANAA0ADQANAA0ADQANAA0ADQANAFAAUABQAFAABAAEACsAKwAEAA0ADQAeAFAAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKwArACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBcAFwADQANAA0AKgBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAKwArAFAAKwArAFAAUABQAFAAUABQAFAAUAArAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQAKwAEAAQAKwArAAQABAAEAAQAUAAEAFAABAAEAA0ADQANACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABABQAA4AUAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAFAABAAEAAQABAAOAB4ADQANAA0ADQAOAB4ABAArACsAKwArACsAKwArACsAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAA0ADQANAFAADgAOAA4ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAAQABAAEAFAADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAOABMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAArACsAKwAEACsABAAEACsABAAEAAQABAAEAAQABABQAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAaABoAGgAaAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABIAEgAQwBDAEMAUABQAFAAUABDAFAAUABQAEgAQwBIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABDAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAJAAkACQAJAAkACQAJABYAEQArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwANAA0AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAANACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAA0ADQANAB4AHgAeAB4AHgAeAFAAUABQAFAADQAeACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAA0AHgAeACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAARwBHABUARwAJACsAKwArACsAKwArACsAKwArACsAKwAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUQBRAFEAKwArACsAKwArACsAKwArACsAKwArACsAKwBRAFEAUQBRACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAHgAEAAQADQAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQABAAEAAQABAAeAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQAHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAKwArAFAAKwArAFAAUAArACsAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUAArAFAAUABQAFAAUABQAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAHgAeAFAAUABQAFAAUAArAFAAKwArACsAUABQAFAAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeACsAKwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4ABAAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAHgAeAA0ADQANAA0AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArAAQABAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwBQAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArABsAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAB4AHgAeAB4ABAAEAAQABAAEAAQABABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArABYAFgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAGgBQAFAAUAAaAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUAArACsAKwArACsAKwBQACsAKwArACsAUAArAFAAKwBQACsAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUAArAFAAKwBQACsAUAArAFAAUAArAFAAKwArAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAKwBQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8AJQAlACUAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB4AHgAeACUAJQAlAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAlACUAJQAlACUAHgAlACUAJQAlACUAIAAgACAAJQAlACAAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACEAIQAhACEAIQAlACUAIAAgACUAJQAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAIAAlACUAJQAlACAAIAAgACUAIAAgACAAJQAlACUAJQAlACUAJQAgACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAlAB4AJQAeACUAJQAlACUAJQAgACUAJQAlACUAHgAlAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACAAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABcAFwAXABUAFQAVAB4AHgAeAB4AJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAgACUAJQAgACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAIAAgACUAJQAgACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACAAIAAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACAAIAAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAA=='; - - var LETTER_NUMBER_MODIFIER = 50; - // Non-tailorable Line Breaking Classes - var BK = 1; // Cause a line break (after) - var CR$1 = 2; // Cause a line break (after), except between CR and LF - var LF$1 = 3; // Cause a line break (after) - var CM = 4; // Prohibit a line break between the character and the preceding character - var NL = 5; // Cause a line break (after) - var WJ = 7; // Prohibit line breaks before and after - var ZW = 8; // Provide a break opportunity - var GL = 9; // Prohibit line breaks before and after - var SP = 10; // Enable indirect line breaks - var ZWJ$1 = 11; // Prohibit line breaks within joiner sequences - // Break Opportunities - var B2 = 12; // Provide a line break opportunity before and after the character - var BA = 13; // Generally provide a line break opportunity after the character - var BB = 14; // Generally provide a line break opportunity before the character - var HY = 15; // Provide a line break opportunity after the character, except in numeric context - var CB = 16; // Provide a line break opportunity contingent on additional information - // Characters Prohibiting Certain Breaks - var CL = 17; // Prohibit line breaks before - var CP = 18; // Prohibit line breaks before - var EX = 19; // Prohibit line breaks before - var IN = 20; // Allow only indirect line breaks between pairs - var NS = 21; // Allow only indirect line breaks before - var OP = 22; // Prohibit line breaks after - var QU = 23; // Act like they are both opening and closing - // Numeric Context - var IS = 24; // Prevent breaks after any and before numeric - var NU = 25; // Form numeric expressions for line breaking purposes - var PO = 26; // Do not break following a numeric expression - var PR = 27; // Do not break in front of a numeric expression - var SY = 28; // Prevent a break before; and allow a break after - // Other Characters - var AI = 29; // Act like AL when the resolvedEAW is N; otherwise; act as ID - var AL = 30; // Are alphabetic characters or symbols that are used with alphabetic characters - var CJ = 31; // Treat as NS or ID for strict or normal breaking. - var EB = 32; // Do not break from following Emoji Modifier - var EM = 33; // Do not break from preceding Emoji Base - var H2 = 34; // Form Korean syllable blocks - var H3 = 35; // Form Korean syllable blocks - var HL = 36; // Do not break around a following hyphen; otherwise act as Alphabetic - var ID = 37; // Break before or after; except in some numeric context - var JL = 38; // Form Korean syllable blocks - var JV = 39; // Form Korean syllable blocks - var JT = 40; // Form Korean syllable blocks - var RI$1 = 41; // Keep pairs together. For pairs; break before and after other classes - var SA = 42; // Provide a line break opportunity contingent on additional, language-specific context analysis - var XX = 43; // Have as yet unknown line breaking behavior or unassigned code positions - var ea_OP = [0x2329, 0xff08]; - var BREAK_MANDATORY = '!'; - var BREAK_NOT_ALLOWED$1 = '×'; - var BREAK_ALLOWED$1 = '÷'; - var UnicodeTrie$1 = createTrieFromBase64$1(base64$1); - var ALPHABETICS = [AL, HL]; - var HARD_LINE_BREAKS = [BK, CR$1, LF$1, NL]; - var SPACE$1 = [SP, ZW]; - var PREFIX_POSTFIX = [PR, PO]; - var LINE_BREAKS = HARD_LINE_BREAKS.concat(SPACE$1); - var KOREAN_SYLLABLE_BLOCK = [JL, JV, JT, H2, H3]; - var HYPHEN = [HY, BA]; - var codePointsToCharacterClasses = function (codePoints, lineBreak) { - if (lineBreak === void 0) { lineBreak = 'strict'; } - var types = []; - var indices = []; - var categories = []; - codePoints.forEach(function (codePoint, index) { - var classType = UnicodeTrie$1.get(codePoint); - if (classType > LETTER_NUMBER_MODIFIER) { - categories.push(true); - classType -= LETTER_NUMBER_MODIFIER; - } - else { - categories.push(false); - } - if (['normal', 'auto', 'loose'].indexOf(lineBreak) !== -1) { - // U+2010, – U+2013, 〜 U+301C, ゠ U+30A0 - if ([0x2010, 0x2013, 0x301c, 0x30a0].indexOf(codePoint) !== -1) { - indices.push(index); - return types.push(CB); - } - } - if (classType === CM || classType === ZWJ$1) { - // LB10 Treat any remaining combining mark or ZWJ as AL. - if (index === 0) { - indices.push(index); - return types.push(AL); - } - // LB9 Do not break a combining character sequence; treat it as if it has the line breaking class of - // the base character in all of the following rules. Treat ZWJ as if it were CM. - var prev = types[index - 1]; - if (LINE_BREAKS.indexOf(prev) === -1) { - indices.push(indices[index - 1]); - return types.push(prev); - } - indices.push(index); - return types.push(AL); - } - indices.push(index); - if (classType === CJ) { - return types.push(lineBreak === 'strict' ? NS : ID); - } - if (classType === SA) { - return types.push(AL); - } - if (classType === AI) { - return types.push(AL); - } - // For supplementary characters, a useful default is to treat characters in the range 10000..1FFFD as AL - // and characters in the ranges 20000..2FFFD and 30000..3FFFD as ID, until the implementation can be revised - // to take into account the actual line breaking properties for these characters. - if (classType === XX) { - if ((codePoint >= 0x20000 && codePoint <= 0x2fffd) || (codePoint >= 0x30000 && codePoint <= 0x3fffd)) { - return types.push(ID); - } - else { - return types.push(AL); - } - } - types.push(classType); - }); - return [indices, types, categories]; - }; - var isAdjacentWithSpaceIgnored = function (a, b, currentIndex, classTypes) { - var current = classTypes[currentIndex]; - if (Array.isArray(a) ? a.indexOf(current) !== -1 : a === current) { - var i = currentIndex; - while (i <= classTypes.length) { - i++; - var next = classTypes[i]; - if (next === b) { - return true; - } - if (next !== SP) { - break; - } - } - } - if (current === SP) { - var i = currentIndex; - while (i > 0) { - i--; - var prev = classTypes[i]; - if (Array.isArray(a) ? a.indexOf(prev) !== -1 : a === prev) { - var n = currentIndex; - while (n <= classTypes.length) { - n++; - var next = classTypes[n]; - if (next === b) { - return true; - } - if (next !== SP) { - break; - } - } - } - if (prev !== SP) { - break; - } - } - } - return false; - }; - var previousNonSpaceClassType = function (currentIndex, classTypes) { - var i = currentIndex; - while (i >= 0) { - var type = classTypes[i]; - if (type === SP) { - i--; - } - else { - return type; - } - } - return 0; - }; - var _lineBreakAtIndex = function (codePoints, classTypes, indicies, index, forbiddenBreaks) { - if (indicies[index] === 0) { - return BREAK_NOT_ALLOWED$1; - } - var currentIndex = index - 1; - if (Array.isArray(forbiddenBreaks) && forbiddenBreaks[currentIndex] === true) { - return BREAK_NOT_ALLOWED$1; - } - var beforeIndex = currentIndex - 1; - var afterIndex = currentIndex + 1; - var current = classTypes[currentIndex]; - // LB4 Always break after hard line breaks. - // LB5 Treat CR followed by LF, as well as CR, LF, and NL as hard line breaks. - var before = beforeIndex >= 0 ? classTypes[beforeIndex] : 0; - var next = classTypes[afterIndex]; - if (current === CR$1 && next === LF$1) { - return BREAK_NOT_ALLOWED$1; - } - if (HARD_LINE_BREAKS.indexOf(current) !== -1) { - return BREAK_MANDATORY; - } - // LB6 Do not break before hard line breaks. - if (HARD_LINE_BREAKS.indexOf(next) !== -1) { - return BREAK_NOT_ALLOWED$1; - } - // LB7 Do not break before spaces or zero width space. - if (SPACE$1.indexOf(next) !== -1) { - return BREAK_NOT_ALLOWED$1; - } - // LB8 Break before any character following a zero-width space, even if one or more spaces intervene. - if (previousNonSpaceClassType(currentIndex, classTypes) === ZW) { - return BREAK_ALLOWED$1; - } - // LB8a Do not break after a zero width joiner. - if (UnicodeTrie$1.get(codePoints[currentIndex]) === ZWJ$1) { - return BREAK_NOT_ALLOWED$1; - } - // zwj emojis - if ((current === EB || current === EM) && UnicodeTrie$1.get(codePoints[afterIndex]) === ZWJ$1) { - return BREAK_NOT_ALLOWED$1; - } - // LB11 Do not break before or after Word joiner and related characters. - if (current === WJ || next === WJ) { - return BREAK_NOT_ALLOWED$1; - } - // LB12 Do not break after NBSP and related characters. - if (current === GL) { - return BREAK_NOT_ALLOWED$1; - } - // LB12a Do not break before NBSP and related characters, except after spaces and hyphens. - if ([SP, BA, HY].indexOf(current) === -1 && next === GL) { - return BREAK_NOT_ALLOWED$1; - } - // LB13 Do not break before ‘]’ or ‘!’ or ‘;’ or ‘/’, even after spaces. - if ([CL, CP, EX, IS, SY].indexOf(next) !== -1) { - return BREAK_NOT_ALLOWED$1; - } - // LB14 Do not break after ‘[’, even after spaces. - if (previousNonSpaceClassType(currentIndex, classTypes) === OP) { - return BREAK_NOT_ALLOWED$1; - } - // LB15 Do not break within ‘”[’, even with intervening spaces. - if (isAdjacentWithSpaceIgnored(QU, OP, currentIndex, classTypes)) { - return BREAK_NOT_ALLOWED$1; - } - // LB16 Do not break between closing punctuation and a nonstarter (lb=NS), even with intervening spaces. - if (isAdjacentWithSpaceIgnored([CL, CP], NS, currentIndex, classTypes)) { - return BREAK_NOT_ALLOWED$1; - } - // LB17 Do not break within ‘——’, even with intervening spaces. - if (isAdjacentWithSpaceIgnored(B2, B2, currentIndex, classTypes)) { - return BREAK_NOT_ALLOWED$1; - } - // LB18 Break after spaces. - if (current === SP) { - return BREAK_ALLOWED$1; - } - // LB19 Do not break before or after quotation marks, such as ‘ ” ’. - if (current === QU || next === QU) { - return BREAK_NOT_ALLOWED$1; - } - // LB20 Break before and after unresolved CB. - if (next === CB || current === CB) { - return BREAK_ALLOWED$1; - } - // LB21 Do not break before hyphen-minus, other hyphens, fixed-width spaces, small kana, and other non-starters, or after acute accents. - if ([BA, HY, NS].indexOf(next) !== -1 || current === BB) { - return BREAK_NOT_ALLOWED$1; - } - // LB21a Don't break after Hebrew + Hyphen. - if (before === HL && HYPHEN.indexOf(current) !== -1) { - return BREAK_NOT_ALLOWED$1; - } - // LB21b Don’t break between Solidus and Hebrew letters. - if (current === SY && next === HL) { - return BREAK_NOT_ALLOWED$1; - } - // LB22 Do not break before ellipsis. - if (next === IN) { - return BREAK_NOT_ALLOWED$1; - } - // LB23 Do not break between digits and letters. - if ((ALPHABETICS.indexOf(next) !== -1 && current === NU) || (ALPHABETICS.indexOf(current) !== -1 && next === NU)) { - return BREAK_NOT_ALLOWED$1; - } - // LB23a Do not break between numeric prefixes and ideographs, or between ideographs and numeric postfixes. - if ((current === PR && [ID, EB, EM].indexOf(next) !== -1) || - ([ID, EB, EM].indexOf(current) !== -1 && next === PO)) { - return BREAK_NOT_ALLOWED$1; - } - // LB24 Do not break between numeric prefix/postfix and letters, or between letters and prefix/postfix. - if ((ALPHABETICS.indexOf(current) !== -1 && PREFIX_POSTFIX.indexOf(next) !== -1) || - (PREFIX_POSTFIX.indexOf(current) !== -1 && ALPHABETICS.indexOf(next) !== -1)) { - return BREAK_NOT_ALLOWED$1; - } - // LB25 Do not break between the following pairs of classes relevant to numbers: - if ( - // (PR | PO) × ( OP | HY )? NU - ([PR, PO].indexOf(current) !== -1 && - (next === NU || ([OP, HY].indexOf(next) !== -1 && classTypes[afterIndex + 1] === NU))) || - // ( OP | HY ) × NU - ([OP, HY].indexOf(current) !== -1 && next === NU) || - // NU × (NU | SY | IS) - (current === NU && [NU, SY, IS].indexOf(next) !== -1)) { - return BREAK_NOT_ALLOWED$1; - } - // NU (NU | SY | IS)* × (NU | SY | IS | CL | CP) - if ([NU, SY, IS, CL, CP].indexOf(next) !== -1) { - var prevIndex = currentIndex; - while (prevIndex >= 0) { - var type = classTypes[prevIndex]; - if (type === NU) { - return BREAK_NOT_ALLOWED$1; - } - else if ([SY, IS].indexOf(type) !== -1) { - prevIndex--; - } - else { - break; - } - } - } - // NU (NU | SY | IS)* (CL | CP)? × (PO | PR)) - if ([PR, PO].indexOf(next) !== -1) { - var prevIndex = [CL, CP].indexOf(current) !== -1 ? beforeIndex : currentIndex; - while (prevIndex >= 0) { - var type = classTypes[prevIndex]; - if (type === NU) { - return BREAK_NOT_ALLOWED$1; - } - else if ([SY, IS].indexOf(type) !== -1) { - prevIndex--; - } - else { - break; - } - } - } - // LB26 Do not break a Korean syllable. - if ((JL === current && [JL, JV, H2, H3].indexOf(next) !== -1) || - ([JV, H2].indexOf(current) !== -1 && [JV, JT].indexOf(next) !== -1) || - ([JT, H3].indexOf(current) !== -1 && next === JT)) { - return BREAK_NOT_ALLOWED$1; - } - // LB27 Treat a Korean Syllable Block the same as ID. - if ((KOREAN_SYLLABLE_BLOCK.indexOf(current) !== -1 && [IN, PO].indexOf(next) !== -1) || - (KOREAN_SYLLABLE_BLOCK.indexOf(next) !== -1 && current === PR)) { - return BREAK_NOT_ALLOWED$1; - } - // LB28 Do not break between alphabetics (“at”). - if (ALPHABETICS.indexOf(current) !== -1 && ALPHABETICS.indexOf(next) !== -1) { - return BREAK_NOT_ALLOWED$1; - } - // LB29 Do not break between numeric punctuation and alphabetics (“e.g.”). - if (current === IS && ALPHABETICS.indexOf(next) !== -1) { - return BREAK_NOT_ALLOWED$1; - } - // LB30 Do not break between letters, numbers, or ordinary symbols and opening or closing parentheses. - if ((ALPHABETICS.concat(NU).indexOf(current) !== -1 && - next === OP && - ea_OP.indexOf(codePoints[afterIndex]) === -1) || - (ALPHABETICS.concat(NU).indexOf(next) !== -1 && current === CP)) { - return BREAK_NOT_ALLOWED$1; - } - // LB30a Break between two regional indicator symbols if and only if there are an even number of regional - // indicators preceding the position of the break. - if (current === RI$1 && next === RI$1) { - var i = indicies[currentIndex]; - var count = 1; - while (i > 0) { - i--; - if (classTypes[i] === RI$1) { - count++; - } - else { - break; - } - } - if (count % 2 !== 0) { - return BREAK_NOT_ALLOWED$1; - } - } - // LB30b Do not break between an emoji base and an emoji modifier. - if (current === EB && next === EM) { - return BREAK_NOT_ALLOWED$1; - } - return BREAK_ALLOWED$1; - }; - var cssFormattedClasses = function (codePoints, options) { - if (!options) { - options = { lineBreak: 'normal', wordBreak: 'normal' }; - } - var _a = codePointsToCharacterClasses(codePoints, options.lineBreak), indicies = _a[0], classTypes = _a[1], isLetterNumber = _a[2]; - if (options.wordBreak === 'break-all' || options.wordBreak === 'break-word') { - classTypes = classTypes.map(function (type) { return ([NU, AL, SA].indexOf(type) !== -1 ? ID : type); }); - } - var forbiddenBreakpoints = options.wordBreak === 'keep-all' - ? isLetterNumber.map(function (letterNumber, i) { - return letterNumber && codePoints[i] >= 0x4e00 && codePoints[i] <= 0x9fff; - }) - : undefined; - return [indicies, classTypes, forbiddenBreakpoints]; - }; - var Break = /** @class */ (function () { - function Break(codePoints, lineBreak, start, end) { - this.codePoints = codePoints; - this.required = lineBreak === BREAK_MANDATORY; - this.start = start; - this.end = end; - } - Break.prototype.slice = function () { - return fromCodePoint$1.apply(void 0, this.codePoints.slice(this.start, this.end)); - }; - return Break; - }()); - var LineBreaker = function (str, options) { - var codePoints = toCodePoints$1(str); - var _a = cssFormattedClasses(codePoints, options), indicies = _a[0], classTypes = _a[1], forbiddenBreakpoints = _a[2]; - var length = codePoints.length; - var lastEnd = 0; - var nextIndex = 0; - return { - next: function () { - if (nextIndex >= length) { - return { done: true, value: null }; - } - var lineBreak = BREAK_NOT_ALLOWED$1; - while (nextIndex < length && - (lineBreak = _lineBreakAtIndex(codePoints, classTypes, indicies, ++nextIndex, forbiddenBreakpoints)) === - BREAK_NOT_ALLOWED$1) { } - if (lineBreak !== BREAK_NOT_ALLOWED$1 || nextIndex === length) { - var value = new Break(codePoints, lineBreak, lastEnd, nextIndex); - lastEnd = nextIndex; - return { value: value, done: false }; - } - return { done: true, value: null }; - }, - }; - }; - - // https://www.w3.org/TR/css-syntax-3 - var FLAG_UNRESTRICTED = 1 << 0; - var FLAG_ID = 1 << 1; - var FLAG_INTEGER = 1 << 2; - var FLAG_NUMBER = 1 << 3; - var LINE_FEED = 0x000a; - var SOLIDUS = 0x002f; - var REVERSE_SOLIDUS = 0x005c; - var CHARACTER_TABULATION = 0x0009; - var SPACE = 0x0020; - var QUOTATION_MARK = 0x0022; - var EQUALS_SIGN = 0x003d; - var NUMBER_SIGN = 0x0023; - var DOLLAR_SIGN = 0x0024; - var PERCENTAGE_SIGN = 0x0025; - var APOSTROPHE = 0x0027; - var LEFT_PARENTHESIS = 0x0028; - var RIGHT_PARENTHESIS = 0x0029; - var LOW_LINE = 0x005f; - var HYPHEN_MINUS = 0x002d; - var EXCLAMATION_MARK = 0x0021; - var LESS_THAN_SIGN = 0x003c; - var GREATER_THAN_SIGN = 0x003e; - var COMMERCIAL_AT = 0x0040; - var LEFT_SQUARE_BRACKET = 0x005b; - var RIGHT_SQUARE_BRACKET = 0x005d; - var CIRCUMFLEX_ACCENT = 0x003d; - var LEFT_CURLY_BRACKET = 0x007b; - var QUESTION_MARK = 0x003f; - var RIGHT_CURLY_BRACKET = 0x007d; - var VERTICAL_LINE = 0x007c; - var TILDE = 0x007e; - var CONTROL = 0x0080; - var REPLACEMENT_CHARACTER = 0xfffd; - var ASTERISK = 0x002a; - var PLUS_SIGN = 0x002b; - var COMMA = 0x002c; - var COLON = 0x003a; - var SEMICOLON = 0x003b; - var FULL_STOP = 0x002e; - var NULL = 0x0000; - var BACKSPACE = 0x0008; - var LINE_TABULATION = 0x000b; - var SHIFT_OUT = 0x000e; - var INFORMATION_SEPARATOR_ONE = 0x001f; - var DELETE = 0x007f; - var EOF = -1; - var ZERO = 0x0030; - var a = 0x0061; - var e = 0x0065; - var f = 0x0066; - var u = 0x0075; - var z = 0x007a; - var A = 0x0041; - var E = 0x0045; - var F = 0x0046; - var U = 0x0055; - var Z = 0x005a; - var isDigit = function (codePoint) { return codePoint >= ZERO && codePoint <= 0x0039; }; - var isSurrogateCodePoint = function (codePoint) { return codePoint >= 0xd800 && codePoint <= 0xdfff; }; - var isHex = function (codePoint) { - return isDigit(codePoint) || (codePoint >= A && codePoint <= F) || (codePoint >= a && codePoint <= f); - }; - var isLowerCaseLetter = function (codePoint) { return codePoint >= a && codePoint <= z; }; - var isUpperCaseLetter = function (codePoint) { return codePoint >= A && codePoint <= Z; }; - var isLetter = function (codePoint) { return isLowerCaseLetter(codePoint) || isUpperCaseLetter(codePoint); }; - var isNonASCIICodePoint = function (codePoint) { return codePoint >= CONTROL; }; - var isWhiteSpace = function (codePoint) { - return codePoint === LINE_FEED || codePoint === CHARACTER_TABULATION || codePoint === SPACE; - }; - var isNameStartCodePoint = function (codePoint) { - return isLetter(codePoint) || isNonASCIICodePoint(codePoint) || codePoint === LOW_LINE; - }; - var isNameCodePoint = function (codePoint) { - return isNameStartCodePoint(codePoint) || isDigit(codePoint) || codePoint === HYPHEN_MINUS; - }; - var isNonPrintableCodePoint = function (codePoint) { - return ((codePoint >= NULL && codePoint <= BACKSPACE) || - codePoint === LINE_TABULATION || - (codePoint >= SHIFT_OUT && codePoint <= INFORMATION_SEPARATOR_ONE) || - codePoint === DELETE); - }; - var isValidEscape = function (c1, c2) { - if (c1 !== REVERSE_SOLIDUS) { - return false; - } - return c2 !== LINE_FEED; - }; - var isIdentifierStart = function (c1, c2, c3) { - if (c1 === HYPHEN_MINUS) { - return isNameStartCodePoint(c2) || isValidEscape(c2, c3); - } - else if (isNameStartCodePoint(c1)) { - return true; - } - else if (c1 === REVERSE_SOLIDUS && isValidEscape(c1, c2)) { - return true; - } - return false; - }; - var isNumberStart = function (c1, c2, c3) { - if (c1 === PLUS_SIGN || c1 === HYPHEN_MINUS) { - if (isDigit(c2)) { - return true; - } - return c2 === FULL_STOP && isDigit(c3); - } - if (c1 === FULL_STOP) { - return isDigit(c2); - } - return isDigit(c1); - }; - var stringToNumber = function (codePoints) { - var c = 0; - var sign = 1; - if (codePoints[c] === PLUS_SIGN || codePoints[c] === HYPHEN_MINUS) { - if (codePoints[c] === HYPHEN_MINUS) { - sign = -1; - } - c++; - } - var integers = []; - while (isDigit(codePoints[c])) { - integers.push(codePoints[c++]); - } - var int = integers.length ? parseInt(fromCodePoint$1.apply(void 0, integers), 10) : 0; - if (codePoints[c] === FULL_STOP) { - c++; - } - var fraction = []; - while (isDigit(codePoints[c])) { - fraction.push(codePoints[c++]); - } - var fracd = fraction.length; - var frac = fracd ? parseInt(fromCodePoint$1.apply(void 0, fraction), 10) : 0; - if (codePoints[c] === E || codePoints[c] === e) { - c++; - } - var expsign = 1; - if (codePoints[c] === PLUS_SIGN || codePoints[c] === HYPHEN_MINUS) { - if (codePoints[c] === HYPHEN_MINUS) { - expsign = -1; - } - c++; - } - var exponent = []; - while (isDigit(codePoints[c])) { - exponent.push(codePoints[c++]); - } - var exp = exponent.length ? parseInt(fromCodePoint$1.apply(void 0, exponent), 10) : 0; - return sign * (int + frac * Math.pow(10, -fracd)) * Math.pow(10, expsign * exp); - }; - var LEFT_PARENTHESIS_TOKEN = { - type: 2 /* LEFT_PARENTHESIS_TOKEN */ - }; - var RIGHT_PARENTHESIS_TOKEN = { - type: 3 /* RIGHT_PARENTHESIS_TOKEN */ - }; - var COMMA_TOKEN = { type: 4 /* COMMA_TOKEN */ }; - var SUFFIX_MATCH_TOKEN = { type: 13 /* SUFFIX_MATCH_TOKEN */ }; - var PREFIX_MATCH_TOKEN = { type: 8 /* PREFIX_MATCH_TOKEN */ }; - var COLUMN_TOKEN = { type: 21 /* COLUMN_TOKEN */ }; - var DASH_MATCH_TOKEN = { type: 9 /* DASH_MATCH_TOKEN */ }; - var INCLUDE_MATCH_TOKEN = { type: 10 /* INCLUDE_MATCH_TOKEN */ }; - var LEFT_CURLY_BRACKET_TOKEN = { - type: 11 /* LEFT_CURLY_BRACKET_TOKEN */ - }; - var RIGHT_CURLY_BRACKET_TOKEN = { - type: 12 /* RIGHT_CURLY_BRACKET_TOKEN */ - }; - var SUBSTRING_MATCH_TOKEN = { type: 14 /* SUBSTRING_MATCH_TOKEN */ }; - var BAD_URL_TOKEN = { type: 23 /* BAD_URL_TOKEN */ }; - var BAD_STRING_TOKEN = { type: 1 /* BAD_STRING_TOKEN */ }; - var CDO_TOKEN = { type: 25 /* CDO_TOKEN */ }; - var CDC_TOKEN = { type: 24 /* CDC_TOKEN */ }; - var COLON_TOKEN = { type: 26 /* COLON_TOKEN */ }; - var SEMICOLON_TOKEN = { type: 27 /* SEMICOLON_TOKEN */ }; - var LEFT_SQUARE_BRACKET_TOKEN = { - type: 28 /* LEFT_SQUARE_BRACKET_TOKEN */ - }; - var RIGHT_SQUARE_BRACKET_TOKEN = { - type: 29 /* RIGHT_SQUARE_BRACKET_TOKEN */ - }; - var WHITESPACE_TOKEN = { type: 31 /* WHITESPACE_TOKEN */ }; - var EOF_TOKEN = { type: 32 /* EOF_TOKEN */ }; - var Tokenizer = /** @class */ (function () { - function Tokenizer() { - this._value = []; - } - Tokenizer.prototype.write = function (chunk) { - this._value = this._value.concat(toCodePoints$1(chunk)); - }; - Tokenizer.prototype.read = function () { - var tokens = []; - var token = this.consumeToken(); - while (token !== EOF_TOKEN) { - tokens.push(token); - token = this.consumeToken(); - } - return tokens; - }; - Tokenizer.prototype.consumeToken = function () { - var codePoint = this.consumeCodePoint(); - switch (codePoint) { - case QUOTATION_MARK: - return this.consumeStringToken(QUOTATION_MARK); - case NUMBER_SIGN: - var c1 = this.peekCodePoint(0); - var c2 = this.peekCodePoint(1); - var c3 = this.peekCodePoint(2); - if (isNameCodePoint(c1) || isValidEscape(c2, c3)) { - var flags = isIdentifierStart(c1, c2, c3) ? FLAG_ID : FLAG_UNRESTRICTED; - var value = this.consumeName(); - return { type: 5 /* HASH_TOKEN */, value: value, flags: flags }; - } - break; - case DOLLAR_SIGN: - if (this.peekCodePoint(0) === EQUALS_SIGN) { - this.consumeCodePoint(); - return SUFFIX_MATCH_TOKEN; - } - break; - case APOSTROPHE: - return this.consumeStringToken(APOSTROPHE); - case LEFT_PARENTHESIS: - return LEFT_PARENTHESIS_TOKEN; - case RIGHT_PARENTHESIS: - return RIGHT_PARENTHESIS_TOKEN; - case ASTERISK: - if (this.peekCodePoint(0) === EQUALS_SIGN) { - this.consumeCodePoint(); - return SUBSTRING_MATCH_TOKEN; - } - break; - case PLUS_SIGN: - if (isNumberStart(codePoint, this.peekCodePoint(0), this.peekCodePoint(1))) { - this.reconsumeCodePoint(codePoint); - return this.consumeNumericToken(); - } - break; - case COMMA: - return COMMA_TOKEN; - case HYPHEN_MINUS: - var e1 = codePoint; - var e2 = this.peekCodePoint(0); - var e3 = this.peekCodePoint(1); - if (isNumberStart(e1, e2, e3)) { - this.reconsumeCodePoint(codePoint); - return this.consumeNumericToken(); - } - if (isIdentifierStart(e1, e2, e3)) { - this.reconsumeCodePoint(codePoint); - return this.consumeIdentLikeToken(); - } - if (e2 === HYPHEN_MINUS && e3 === GREATER_THAN_SIGN) { - this.consumeCodePoint(); - this.consumeCodePoint(); - return CDC_TOKEN; - } - break; - case FULL_STOP: - if (isNumberStart(codePoint, this.peekCodePoint(0), this.peekCodePoint(1))) { - this.reconsumeCodePoint(codePoint); - return this.consumeNumericToken(); - } - break; - case SOLIDUS: - if (this.peekCodePoint(0) === ASTERISK) { - this.consumeCodePoint(); - while (true) { - var c = this.consumeCodePoint(); - if (c === ASTERISK) { - c = this.consumeCodePoint(); - if (c === SOLIDUS) { - return this.consumeToken(); - } - } - if (c === EOF) { - return this.consumeToken(); - } - } - } - break; - case COLON: - return COLON_TOKEN; - case SEMICOLON: - return SEMICOLON_TOKEN; - case LESS_THAN_SIGN: - if (this.peekCodePoint(0) === EXCLAMATION_MARK && - this.peekCodePoint(1) === HYPHEN_MINUS && - this.peekCodePoint(2) === HYPHEN_MINUS) { - this.consumeCodePoint(); - this.consumeCodePoint(); - return CDO_TOKEN; - } - break; - case COMMERCIAL_AT: - var a1 = this.peekCodePoint(0); - var a2 = this.peekCodePoint(1); - var a3 = this.peekCodePoint(2); - if (isIdentifierStart(a1, a2, a3)) { - var value = this.consumeName(); - return { type: 7 /* AT_KEYWORD_TOKEN */, value: value }; - } - break; - case LEFT_SQUARE_BRACKET: - return LEFT_SQUARE_BRACKET_TOKEN; - case REVERSE_SOLIDUS: - if (isValidEscape(codePoint, this.peekCodePoint(0))) { - this.reconsumeCodePoint(codePoint); - return this.consumeIdentLikeToken(); - } - break; - case RIGHT_SQUARE_BRACKET: - return RIGHT_SQUARE_BRACKET_TOKEN; - case CIRCUMFLEX_ACCENT: - if (this.peekCodePoint(0) === EQUALS_SIGN) { - this.consumeCodePoint(); - return PREFIX_MATCH_TOKEN; - } - break; - case LEFT_CURLY_BRACKET: - return LEFT_CURLY_BRACKET_TOKEN; - case RIGHT_CURLY_BRACKET: - return RIGHT_CURLY_BRACKET_TOKEN; - case u: - case U: - var u1 = this.peekCodePoint(0); - var u2 = this.peekCodePoint(1); - if (u1 === PLUS_SIGN && (isHex(u2) || u2 === QUESTION_MARK)) { - this.consumeCodePoint(); - this.consumeUnicodeRangeToken(); - } - this.reconsumeCodePoint(codePoint); - return this.consumeIdentLikeToken(); - case VERTICAL_LINE: - if (this.peekCodePoint(0) === EQUALS_SIGN) { - this.consumeCodePoint(); - return DASH_MATCH_TOKEN; - } - if (this.peekCodePoint(0) === VERTICAL_LINE) { - this.consumeCodePoint(); - return COLUMN_TOKEN; - } - break; - case TILDE: - if (this.peekCodePoint(0) === EQUALS_SIGN) { - this.consumeCodePoint(); - return INCLUDE_MATCH_TOKEN; - } - break; - case EOF: - return EOF_TOKEN; - } - if (isWhiteSpace(codePoint)) { - this.consumeWhiteSpace(); - return WHITESPACE_TOKEN; - } - if (isDigit(codePoint)) { - this.reconsumeCodePoint(codePoint); - return this.consumeNumericToken(); - } - if (isNameStartCodePoint(codePoint)) { - this.reconsumeCodePoint(codePoint); - return this.consumeIdentLikeToken(); - } - return { type: 6 /* DELIM_TOKEN */, value: fromCodePoint$1(codePoint) }; - }; - Tokenizer.prototype.consumeCodePoint = function () { - var value = this._value.shift(); - return typeof value === 'undefined' ? -1 : value; - }; - Tokenizer.prototype.reconsumeCodePoint = function (codePoint) { - this._value.unshift(codePoint); - }; - Tokenizer.prototype.peekCodePoint = function (delta) { - if (delta >= this._value.length) { - return -1; - } - return this._value[delta]; - }; - Tokenizer.prototype.consumeUnicodeRangeToken = function () { - var digits = []; - var codePoint = this.consumeCodePoint(); - while (isHex(codePoint) && digits.length < 6) { - digits.push(codePoint); - codePoint = this.consumeCodePoint(); - } - var questionMarks = false; - while (codePoint === QUESTION_MARK && digits.length < 6) { - digits.push(codePoint); - codePoint = this.consumeCodePoint(); - questionMarks = true; - } - if (questionMarks) { - var start_1 = parseInt(fromCodePoint$1.apply(void 0, digits.map(function (digit) { return (digit === QUESTION_MARK ? ZERO : digit); })), 16); - var end = parseInt(fromCodePoint$1.apply(void 0, digits.map(function (digit) { return (digit === QUESTION_MARK ? F : digit); })), 16); - return { type: 30 /* UNICODE_RANGE_TOKEN */, start: start_1, end: end }; - } - var start = parseInt(fromCodePoint$1.apply(void 0, digits), 16); - if (this.peekCodePoint(0) === HYPHEN_MINUS && isHex(this.peekCodePoint(1))) { - this.consumeCodePoint(); - codePoint = this.consumeCodePoint(); - var endDigits = []; - while (isHex(codePoint) && endDigits.length < 6) { - endDigits.push(codePoint); - codePoint = this.consumeCodePoint(); - } - var end = parseInt(fromCodePoint$1.apply(void 0, endDigits), 16); - return { type: 30 /* UNICODE_RANGE_TOKEN */, start: start, end: end }; - } - else { - return { type: 30 /* UNICODE_RANGE_TOKEN */, start: start, end: start }; - } - }; - Tokenizer.prototype.consumeIdentLikeToken = function () { - var value = this.consumeName(); - if (value.toLowerCase() === 'url' && this.peekCodePoint(0) === LEFT_PARENTHESIS) { - this.consumeCodePoint(); - return this.consumeUrlToken(); - } - else if (this.peekCodePoint(0) === LEFT_PARENTHESIS) { - this.consumeCodePoint(); - return { type: 19 /* FUNCTION_TOKEN */, value: value }; - } - return { type: 20 /* IDENT_TOKEN */, value: value }; - }; - Tokenizer.prototype.consumeUrlToken = function () { - var value = []; - this.consumeWhiteSpace(); - if (this.peekCodePoint(0) === EOF) { - return { type: 22 /* URL_TOKEN */, value: '' }; - } - var next = this.peekCodePoint(0); - if (next === APOSTROPHE || next === QUOTATION_MARK) { - var stringToken = this.consumeStringToken(this.consumeCodePoint()); - if (stringToken.type === 0 /* STRING_TOKEN */) { - this.consumeWhiteSpace(); - if (this.peekCodePoint(0) === EOF || this.peekCodePoint(0) === RIGHT_PARENTHESIS) { - this.consumeCodePoint(); - return { type: 22 /* URL_TOKEN */, value: stringToken.value }; - } - } - this.consumeBadUrlRemnants(); - return BAD_URL_TOKEN; - } - while (true) { - var codePoint = this.consumeCodePoint(); - if (codePoint === EOF || codePoint === RIGHT_PARENTHESIS) { - return { type: 22 /* URL_TOKEN */, value: fromCodePoint$1.apply(void 0, value) }; - } - else if (isWhiteSpace(codePoint)) { - this.consumeWhiteSpace(); - if (this.peekCodePoint(0) === EOF || this.peekCodePoint(0) === RIGHT_PARENTHESIS) { - this.consumeCodePoint(); - return { type: 22 /* URL_TOKEN */, value: fromCodePoint$1.apply(void 0, value) }; - } - this.consumeBadUrlRemnants(); - return BAD_URL_TOKEN; - } - else if (codePoint === QUOTATION_MARK || - codePoint === APOSTROPHE || - codePoint === LEFT_PARENTHESIS || - isNonPrintableCodePoint(codePoint)) { - this.consumeBadUrlRemnants(); - return BAD_URL_TOKEN; - } - else if (codePoint === REVERSE_SOLIDUS) { - if (isValidEscape(codePoint, this.peekCodePoint(0))) { - value.push(this.consumeEscapedCodePoint()); - } - else { - this.consumeBadUrlRemnants(); - return BAD_URL_TOKEN; - } - } - else { - value.push(codePoint); - } - } - }; - Tokenizer.prototype.consumeWhiteSpace = function () { - while (isWhiteSpace(this.peekCodePoint(0))) { - this.consumeCodePoint(); - } - }; - Tokenizer.prototype.consumeBadUrlRemnants = function () { - while (true) { - var codePoint = this.consumeCodePoint(); - if (codePoint === RIGHT_PARENTHESIS || codePoint === EOF) { - return; - } - if (isValidEscape(codePoint, this.peekCodePoint(0))) { - this.consumeEscapedCodePoint(); - } - } - }; - Tokenizer.prototype.consumeStringSlice = function (count) { - var SLICE_STACK_SIZE = 50000; - var value = ''; - while (count > 0) { - var amount = Math.min(SLICE_STACK_SIZE, count); - value += fromCodePoint$1.apply(void 0, this._value.splice(0, amount)); - count -= amount; - } - this._value.shift(); - return value; - }; - Tokenizer.prototype.consumeStringToken = function (endingCodePoint) { - var value = ''; - var i = 0; - do { - var codePoint = this._value[i]; - if (codePoint === EOF || codePoint === undefined || codePoint === endingCodePoint) { - value += this.consumeStringSlice(i); - return { type: 0 /* STRING_TOKEN */, value: value }; - } - if (codePoint === LINE_FEED) { - this._value.splice(0, i); - return BAD_STRING_TOKEN; - } - if (codePoint === REVERSE_SOLIDUS) { - var next = this._value[i + 1]; - if (next !== EOF && next !== undefined) { - if (next === LINE_FEED) { - value += this.consumeStringSlice(i); - i = -1; - this._value.shift(); - } - else if (isValidEscape(codePoint, next)) { - value += this.consumeStringSlice(i); - value += fromCodePoint$1(this.consumeEscapedCodePoint()); - i = -1; - } - } - } - i++; - } while (true); - }; - Tokenizer.prototype.consumeNumber = function () { - var repr = []; - var type = FLAG_INTEGER; - var c1 = this.peekCodePoint(0); - if (c1 === PLUS_SIGN || c1 === HYPHEN_MINUS) { - repr.push(this.consumeCodePoint()); - } - while (isDigit(this.peekCodePoint(0))) { - repr.push(this.consumeCodePoint()); - } - c1 = this.peekCodePoint(0); - var c2 = this.peekCodePoint(1); - if (c1 === FULL_STOP && isDigit(c2)) { - repr.push(this.consumeCodePoint(), this.consumeCodePoint()); - type = FLAG_NUMBER; - while (isDigit(this.peekCodePoint(0))) { - repr.push(this.consumeCodePoint()); - } - } - c1 = this.peekCodePoint(0); - c2 = this.peekCodePoint(1); - var c3 = this.peekCodePoint(2); - if ((c1 === E || c1 === e) && (((c2 === PLUS_SIGN || c2 === HYPHEN_MINUS) && isDigit(c3)) || isDigit(c2))) { - repr.push(this.consumeCodePoint(), this.consumeCodePoint()); - type = FLAG_NUMBER; - while (isDigit(this.peekCodePoint(0))) { - repr.push(this.consumeCodePoint()); - } - } - return [stringToNumber(repr), type]; - }; - Tokenizer.prototype.consumeNumericToken = function () { - var _a = this.consumeNumber(), number = _a[0], flags = _a[1]; - var c1 = this.peekCodePoint(0); - var c2 = this.peekCodePoint(1); - var c3 = this.peekCodePoint(2); - if (isIdentifierStart(c1, c2, c3)) { - var unit = this.consumeName(); - return { type: 15 /* DIMENSION_TOKEN */, number: number, flags: flags, unit: unit }; - } - if (c1 === PERCENTAGE_SIGN) { - this.consumeCodePoint(); - return { type: 16 /* PERCENTAGE_TOKEN */, number: number, flags: flags }; - } - return { type: 17 /* NUMBER_TOKEN */, number: number, flags: flags }; - }; - Tokenizer.prototype.consumeEscapedCodePoint = function () { - var codePoint = this.consumeCodePoint(); - if (isHex(codePoint)) { - var hex = fromCodePoint$1(codePoint); - while (isHex(this.peekCodePoint(0)) && hex.length < 6) { - hex += fromCodePoint$1(this.consumeCodePoint()); - } - if (isWhiteSpace(this.peekCodePoint(0))) { - this.consumeCodePoint(); - } - var hexCodePoint = parseInt(hex, 16); - if (hexCodePoint === 0 || isSurrogateCodePoint(hexCodePoint) || hexCodePoint > 0x10ffff) { - return REPLACEMENT_CHARACTER; - } - return hexCodePoint; - } - if (codePoint === EOF) { - return REPLACEMENT_CHARACTER; - } - return codePoint; - }; - Tokenizer.prototype.consumeName = function () { - var result = ''; - while (true) { - var codePoint = this.consumeCodePoint(); - if (isNameCodePoint(codePoint)) { - result += fromCodePoint$1(codePoint); - } - else if (isValidEscape(codePoint, this.peekCodePoint(0))) { - result += fromCodePoint$1(this.consumeEscapedCodePoint()); - } - else { - this.reconsumeCodePoint(codePoint); - return result; - } - } - }; - return Tokenizer; - }()); - - var Parser = /** @class */ (function () { - function Parser(tokens) { - this._tokens = tokens; - } - Parser.create = function (value) { - var tokenizer = new Tokenizer(); - tokenizer.write(value); - return new Parser(tokenizer.read()); - }; - Parser.parseValue = function (value) { - return Parser.create(value).parseComponentValue(); - }; - Parser.parseValues = function (value) { - return Parser.create(value).parseComponentValues(); - }; - Parser.prototype.parseComponentValue = function () { - var token = this.consumeToken(); - while (token.type === 31 /* WHITESPACE_TOKEN */) { - token = this.consumeToken(); - } - if (token.type === 32 /* EOF_TOKEN */) { - throw new SyntaxError("Error parsing CSS component value, unexpected EOF"); - } - this.reconsumeToken(token); - var value = this.consumeComponentValue(); - do { - token = this.consumeToken(); - } while (token.type === 31 /* WHITESPACE_TOKEN */); - if (token.type === 32 /* EOF_TOKEN */) { - return value; - } - throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one"); - }; - Parser.prototype.parseComponentValues = function () { - var values = []; - while (true) { - var value = this.consumeComponentValue(); - if (value.type === 32 /* EOF_TOKEN */) { - return values; - } - values.push(value); - values.push(); - } - }; - Parser.prototype.consumeComponentValue = function () { - var token = this.consumeToken(); - switch (token.type) { - case 11 /* LEFT_CURLY_BRACKET_TOKEN */: - case 28 /* LEFT_SQUARE_BRACKET_TOKEN */: - case 2 /* LEFT_PARENTHESIS_TOKEN */: - return this.consumeSimpleBlock(token.type); - case 19 /* FUNCTION_TOKEN */: - return this.consumeFunction(token); - } - return token; - }; - Parser.prototype.consumeSimpleBlock = function (type) { - var block = { type: type, values: [] }; - var token = this.consumeToken(); - while (true) { - if (token.type === 32 /* EOF_TOKEN */ || isEndingTokenFor(token, type)) { - return block; - } - this.reconsumeToken(token); - block.values.push(this.consumeComponentValue()); - token = this.consumeToken(); - } - }; - Parser.prototype.consumeFunction = function (functionToken) { - var cssFunction = { - name: functionToken.value, - values: [], - type: 18 /* FUNCTION */ - }; - while (true) { - var token = this.consumeToken(); - if (token.type === 32 /* EOF_TOKEN */ || token.type === 3 /* RIGHT_PARENTHESIS_TOKEN */) { - return cssFunction; - } - this.reconsumeToken(token); - cssFunction.values.push(this.consumeComponentValue()); - } - }; - Parser.prototype.consumeToken = function () { - var token = this._tokens.shift(); - return typeof token === 'undefined' ? EOF_TOKEN : token; - }; - Parser.prototype.reconsumeToken = function (token) { - this._tokens.unshift(token); - }; - return Parser; - }()); - var isDimensionToken = function (token) { return token.type === 15 /* DIMENSION_TOKEN */; }; - var isNumberToken = function (token) { return token.type === 17 /* NUMBER_TOKEN */; }; - var isIdentToken = function (token) { return token.type === 20 /* IDENT_TOKEN */; }; - var isStringToken = function (token) { return token.type === 0 /* STRING_TOKEN */; }; - var isIdentWithValue = function (token, value) { - return isIdentToken(token) && token.value === value; - }; - var nonWhiteSpace = function (token) { return token.type !== 31 /* WHITESPACE_TOKEN */; }; - var nonFunctionArgSeparator = function (token) { - return token.type !== 31 /* WHITESPACE_TOKEN */ && token.type !== 4 /* COMMA_TOKEN */; - }; - var parseFunctionArgs = function (tokens) { - var args = []; - var arg = []; - tokens.forEach(function (token) { - if (token.type === 4 /* COMMA_TOKEN */) { - if (arg.length === 0) { - throw new Error("Error parsing function args, zero tokens for arg"); - } - args.push(arg); - arg = []; - return; - } - if (token.type !== 31 /* WHITESPACE_TOKEN */) { - arg.push(token); - } - }); - if (arg.length) { - args.push(arg); - } - return args; - }; - var isEndingTokenFor = function (token, type) { - if (type === 11 /* LEFT_CURLY_BRACKET_TOKEN */ && token.type === 12 /* RIGHT_CURLY_BRACKET_TOKEN */) { - return true; - } - if (type === 28 /* LEFT_SQUARE_BRACKET_TOKEN */ && token.type === 29 /* RIGHT_SQUARE_BRACKET_TOKEN */) { - return true; - } - return type === 2 /* LEFT_PARENTHESIS_TOKEN */ && token.type === 3 /* RIGHT_PARENTHESIS_TOKEN */; - }; - - var isLength = function (token) { - return token.type === 17 /* NUMBER_TOKEN */ || token.type === 15 /* DIMENSION_TOKEN */; - }; - - var isLengthPercentage = function (token) { - return token.type === 16 /* PERCENTAGE_TOKEN */ || isLength(token); - }; - var parseLengthPercentageTuple = function (tokens) { - return tokens.length > 1 ? [tokens[0], tokens[1]] : [tokens[0]]; - }; - var ZERO_LENGTH = { - type: 17 /* NUMBER_TOKEN */, - number: 0, - flags: FLAG_INTEGER - }; - var FIFTY_PERCENT = { - type: 16 /* PERCENTAGE_TOKEN */, - number: 50, - flags: FLAG_INTEGER - }; - var HUNDRED_PERCENT = { - type: 16 /* PERCENTAGE_TOKEN */, - number: 100, - flags: FLAG_INTEGER - }; - var getAbsoluteValueForTuple = function (tuple, width, height) { - var x = tuple[0], y = tuple[1]; - return [getAbsoluteValue(x, width), getAbsoluteValue(typeof y !== 'undefined' ? y : x, height)]; - }; - var getAbsoluteValue = function (token, parent) { - if (token.type === 16 /* PERCENTAGE_TOKEN */) { - return (token.number / 100) * parent; - } - if (isDimensionToken(token)) { - switch (token.unit) { - case 'rem': - case 'em': - return 16 * token.number; // TODO use correct font-size - case 'px': - default: - return token.number; - } - } - return token.number; - }; - - var DEG = 'deg'; - var GRAD = 'grad'; - var RAD = 'rad'; - var TURN = 'turn'; - var angle = { - name: 'angle', - parse: function (_context, value) { - if (value.type === 15 /* DIMENSION_TOKEN */) { - switch (value.unit) { - case DEG: - return (Math.PI * value.number) / 180; - case GRAD: - return (Math.PI / 200) * value.number; - case RAD: - return value.number; - case TURN: - return Math.PI * 2 * value.number; - } - } - throw new Error("Unsupported angle type"); - } - }; - var isAngle = function (value) { - if (value.type === 15 /* DIMENSION_TOKEN */) { - if (value.unit === DEG || value.unit === GRAD || value.unit === RAD || value.unit === TURN) { - return true; - } - } - return false; - }; - var parseNamedSide = function (tokens) { - var sideOrCorner = tokens - .filter(isIdentToken) - .map(function (ident) { return ident.value; }) - .join(' '); - switch (sideOrCorner) { - case 'to bottom right': - case 'to right bottom': - case 'left top': - case 'top left': - return [ZERO_LENGTH, ZERO_LENGTH]; - case 'to top': - case 'bottom': - return deg(0); - case 'to bottom left': - case 'to left bottom': - case 'right top': - case 'top right': - return [ZERO_LENGTH, HUNDRED_PERCENT]; - case 'to right': - case 'left': - return deg(90); - case 'to top left': - case 'to left top': - case 'right bottom': - case 'bottom right': - return [HUNDRED_PERCENT, HUNDRED_PERCENT]; - case 'to bottom': - case 'top': - return deg(180); - case 'to top right': - case 'to right top': - case 'left bottom': - case 'bottom left': - return [HUNDRED_PERCENT, ZERO_LENGTH]; - case 'to left': - case 'right': - return deg(270); - } - return 0; - }; - var deg = function (deg) { return (Math.PI * deg) / 180; }; - - var color$1 = { - name: 'color', - parse: function (context, value) { - if (value.type === 18 /* FUNCTION */) { - var colorFunction = SUPPORTED_COLOR_FUNCTIONS[value.name]; - if (typeof colorFunction === 'undefined') { - throw new Error("Attempting to parse an unsupported color function \"" + value.name + "\""); - } - return colorFunction(context, value.values); - } - if (value.type === 5 /* HASH_TOKEN */) { - if (value.value.length === 3) { - var r = value.value.substring(0, 1); - var g = value.value.substring(1, 2); - var b = value.value.substring(2, 3); - return pack(parseInt(r + r, 16), parseInt(g + g, 16), parseInt(b + b, 16), 1); - } - if (value.value.length === 4) { - var r = value.value.substring(0, 1); - var g = value.value.substring(1, 2); - var b = value.value.substring(2, 3); - var a = value.value.substring(3, 4); - return pack(parseInt(r + r, 16), parseInt(g + g, 16), parseInt(b + b, 16), parseInt(a + a, 16) / 255); - } - if (value.value.length === 6) { - var r = value.value.substring(0, 2); - var g = value.value.substring(2, 4); - var b = value.value.substring(4, 6); - return pack(parseInt(r, 16), parseInt(g, 16), parseInt(b, 16), 1); - } - if (value.value.length === 8) { - var r = value.value.substring(0, 2); - var g = value.value.substring(2, 4); - var b = value.value.substring(4, 6); - var a = value.value.substring(6, 8); - return pack(parseInt(r, 16), parseInt(g, 16), parseInt(b, 16), parseInt(a, 16) / 255); - } - } - if (value.type === 20 /* IDENT_TOKEN */) { - var namedColor = COLORS[value.value.toUpperCase()]; - if (typeof namedColor !== 'undefined') { - return namedColor; - } - } - return COLORS.TRANSPARENT; - } - }; - var isTransparent = function (color) { return (0xff & color) === 0; }; - var asString = function (color) { - var alpha = 0xff & color; - var blue = 0xff & (color >> 8); - var green = 0xff & (color >> 16); - var red = 0xff & (color >> 24); - return alpha < 255 ? "rgba(" + red + "," + green + "," + blue + "," + alpha / 255 + ")" : "rgb(" + red + "," + green + "," + blue + ")"; - }; - var pack = function (r, g, b, a) { - return ((r << 24) | (g << 16) | (b << 8) | (Math.round(a * 255) << 0)) >>> 0; - }; - var getTokenColorValue = function (token, i) { - if (token.type === 17 /* NUMBER_TOKEN */) { - return token.number; - } - if (token.type === 16 /* PERCENTAGE_TOKEN */) { - var max = i === 3 ? 1 : 255; - return i === 3 ? (token.number / 100) * max : Math.round((token.number / 100) * max); - } - return 0; - }; - var rgb = function (_context, args) { - var tokens = args.filter(nonFunctionArgSeparator); - if (tokens.length === 3) { - var _a = tokens.map(getTokenColorValue), r = _a[0], g = _a[1], b = _a[2]; - return pack(r, g, b, 1); - } - if (tokens.length === 4) { - var _b = tokens.map(getTokenColorValue), r = _b[0], g = _b[1], b = _b[2], a = _b[3]; - return pack(r, g, b, a); - } - return 0; - }; - function hue2rgb(t1, t2, hue) { - if (hue < 0) { - hue += 1; - } - if (hue >= 1) { - hue -= 1; - } - if (hue < 1 / 6) { - return (t2 - t1) * hue * 6 + t1; - } - else if (hue < 1 / 2) { - return t2; - } - else if (hue < 2 / 3) { - return (t2 - t1) * 6 * (2 / 3 - hue) + t1; - } - else { - return t1; - } - } - var hsl = function (context, args) { - var tokens = args.filter(nonFunctionArgSeparator); - var hue = tokens[0], saturation = tokens[1], lightness = tokens[2], alpha = tokens[3]; - var h = (hue.type === 17 /* NUMBER_TOKEN */ ? deg(hue.number) : angle.parse(context, hue)) / (Math.PI * 2); - var s = isLengthPercentage(saturation) ? saturation.number / 100 : 0; - var l = isLengthPercentage(lightness) ? lightness.number / 100 : 0; - var a = typeof alpha !== 'undefined' && isLengthPercentage(alpha) ? getAbsoluteValue(alpha, 1) : 1; - if (s === 0) { - return pack(l * 255, l * 255, l * 255, 1); - } - var t2 = l <= 0.5 ? l * (s + 1) : l + s - l * s; - var t1 = l * 2 - t2; - var r = hue2rgb(t1, t2, h + 1 / 3); - var g = hue2rgb(t1, t2, h); - var b = hue2rgb(t1, t2, h - 1 / 3); - return pack(r * 255, g * 255, b * 255, a); - }; - var SUPPORTED_COLOR_FUNCTIONS = { - hsl: hsl, - hsla: hsl, - rgb: rgb, - rgba: rgb - }; - var parseColor = function (context, value) { - return color$1.parse(context, Parser.create(value).parseComponentValue()); - }; - var COLORS = { - ALICEBLUE: 0xf0f8ffff, - ANTIQUEWHITE: 0xfaebd7ff, - AQUA: 0x00ffffff, - AQUAMARINE: 0x7fffd4ff, - AZURE: 0xf0ffffff, - BEIGE: 0xf5f5dcff, - BISQUE: 0xffe4c4ff, - BLACK: 0x000000ff, - BLANCHEDALMOND: 0xffebcdff, - BLUE: 0x0000ffff, - BLUEVIOLET: 0x8a2be2ff, - BROWN: 0xa52a2aff, - BURLYWOOD: 0xdeb887ff, - CADETBLUE: 0x5f9ea0ff, - CHARTREUSE: 0x7fff00ff, - CHOCOLATE: 0xd2691eff, - CORAL: 0xff7f50ff, - CORNFLOWERBLUE: 0x6495edff, - CORNSILK: 0xfff8dcff, - CRIMSON: 0xdc143cff, - CYAN: 0x00ffffff, - DARKBLUE: 0x00008bff, - DARKCYAN: 0x008b8bff, - DARKGOLDENROD: 0xb886bbff, - DARKGRAY: 0xa9a9a9ff, - DARKGREEN: 0x006400ff, - DARKGREY: 0xa9a9a9ff, - DARKKHAKI: 0xbdb76bff, - DARKMAGENTA: 0x8b008bff, - DARKOLIVEGREEN: 0x556b2fff, - DARKORANGE: 0xff8c00ff, - DARKORCHID: 0x9932ccff, - DARKRED: 0x8b0000ff, - DARKSALMON: 0xe9967aff, - DARKSEAGREEN: 0x8fbc8fff, - DARKSLATEBLUE: 0x483d8bff, - DARKSLATEGRAY: 0x2f4f4fff, - DARKSLATEGREY: 0x2f4f4fff, - DARKTURQUOISE: 0x00ced1ff, - DARKVIOLET: 0x9400d3ff, - DEEPPINK: 0xff1493ff, - DEEPSKYBLUE: 0x00bfffff, - DIMGRAY: 0x696969ff, - DIMGREY: 0x696969ff, - DODGERBLUE: 0x1e90ffff, - FIREBRICK: 0xb22222ff, - FLORALWHITE: 0xfffaf0ff, - FORESTGREEN: 0x228b22ff, - FUCHSIA: 0xff00ffff, - GAINSBORO: 0xdcdcdcff, - GHOSTWHITE: 0xf8f8ffff, - GOLD: 0xffd700ff, - GOLDENROD: 0xdaa520ff, - GRAY: 0x808080ff, - GREEN: 0x008000ff, - GREENYELLOW: 0xadff2fff, - GREY: 0x808080ff, - HONEYDEW: 0xf0fff0ff, - HOTPINK: 0xff69b4ff, - INDIANRED: 0xcd5c5cff, - INDIGO: 0x4b0082ff, - IVORY: 0xfffff0ff, - KHAKI: 0xf0e68cff, - LAVENDER: 0xe6e6faff, - LAVENDERBLUSH: 0xfff0f5ff, - LAWNGREEN: 0x7cfc00ff, - LEMONCHIFFON: 0xfffacdff, - LIGHTBLUE: 0xadd8e6ff, - LIGHTCORAL: 0xf08080ff, - LIGHTCYAN: 0xe0ffffff, - LIGHTGOLDENRODYELLOW: 0xfafad2ff, - LIGHTGRAY: 0xd3d3d3ff, - LIGHTGREEN: 0x90ee90ff, - LIGHTGREY: 0xd3d3d3ff, - LIGHTPINK: 0xffb6c1ff, - LIGHTSALMON: 0xffa07aff, - LIGHTSEAGREEN: 0x20b2aaff, - LIGHTSKYBLUE: 0x87cefaff, - LIGHTSLATEGRAY: 0x778899ff, - LIGHTSLATEGREY: 0x778899ff, - LIGHTSTEELBLUE: 0xb0c4deff, - LIGHTYELLOW: 0xffffe0ff, - LIME: 0x00ff00ff, - LIMEGREEN: 0x32cd32ff, - LINEN: 0xfaf0e6ff, - MAGENTA: 0xff00ffff, - MAROON: 0x800000ff, - MEDIUMAQUAMARINE: 0x66cdaaff, - MEDIUMBLUE: 0x0000cdff, - MEDIUMORCHID: 0xba55d3ff, - MEDIUMPURPLE: 0x9370dbff, - MEDIUMSEAGREEN: 0x3cb371ff, - MEDIUMSLATEBLUE: 0x7b68eeff, - MEDIUMSPRINGGREEN: 0x00fa9aff, - MEDIUMTURQUOISE: 0x48d1ccff, - MEDIUMVIOLETRED: 0xc71585ff, - MIDNIGHTBLUE: 0x191970ff, - MINTCREAM: 0xf5fffaff, - MISTYROSE: 0xffe4e1ff, - MOCCASIN: 0xffe4b5ff, - NAVAJOWHITE: 0xffdeadff, - NAVY: 0x000080ff, - OLDLACE: 0xfdf5e6ff, - OLIVE: 0x808000ff, - OLIVEDRAB: 0x6b8e23ff, - ORANGE: 0xffa500ff, - ORANGERED: 0xff4500ff, - ORCHID: 0xda70d6ff, - PALEGOLDENROD: 0xeee8aaff, - PALEGREEN: 0x98fb98ff, - PALETURQUOISE: 0xafeeeeff, - PALEVIOLETRED: 0xdb7093ff, - PAPAYAWHIP: 0xffefd5ff, - PEACHPUFF: 0xffdab9ff, - PERU: 0xcd853fff, - PINK: 0xffc0cbff, - PLUM: 0xdda0ddff, - POWDERBLUE: 0xb0e0e6ff, - PURPLE: 0x800080ff, - REBECCAPURPLE: 0x663399ff, - RED: 0xff0000ff, - ROSYBROWN: 0xbc8f8fff, - ROYALBLUE: 0x4169e1ff, - SADDLEBROWN: 0x8b4513ff, - SALMON: 0xfa8072ff, - SANDYBROWN: 0xf4a460ff, - SEAGREEN: 0x2e8b57ff, - SEASHELL: 0xfff5eeff, - SIENNA: 0xa0522dff, - SILVER: 0xc0c0c0ff, - SKYBLUE: 0x87ceebff, - SLATEBLUE: 0x6a5acdff, - SLATEGRAY: 0x708090ff, - SLATEGREY: 0x708090ff, - SNOW: 0xfffafaff, - SPRINGGREEN: 0x00ff7fff, - STEELBLUE: 0x4682b4ff, - TAN: 0xd2b48cff, - TEAL: 0x008080ff, - THISTLE: 0xd8bfd8ff, - TOMATO: 0xff6347ff, - TRANSPARENT: 0x00000000, - TURQUOISE: 0x40e0d0ff, - VIOLET: 0xee82eeff, - WHEAT: 0xf5deb3ff, - WHITE: 0xffffffff, - WHITESMOKE: 0xf5f5f5ff, - YELLOW: 0xffff00ff, - YELLOWGREEN: 0x9acd32ff - }; - - var backgroundClip = { - name: 'background-clip', - initialValue: 'border-box', - prefix: false, - type: 1 /* LIST */, - parse: function (_context, tokens) { - return tokens.map(function (token) { - if (isIdentToken(token)) { - switch (token.value) { - case 'padding-box': - return 1 /* PADDING_BOX */; - case 'content-box': - return 2 /* CONTENT_BOX */; - } - } - return 0 /* BORDER_BOX */; - }); - } - }; - - var backgroundColor = { - name: "background-color", - initialValue: 'transparent', - prefix: false, - type: 3 /* TYPE_VALUE */, - format: 'color' - }; - - var parseColorStop = function (context, args) { - var color = color$1.parse(context, args[0]); - var stop = args[1]; - return stop && isLengthPercentage(stop) ? { color: color, stop: stop } : { color: color, stop: null }; - }; - var processColorStops = function (stops, lineLength) { - var first = stops[0]; - var last = stops[stops.length - 1]; - if (first.stop === null) { - first.stop = ZERO_LENGTH; - } - if (last.stop === null) { - last.stop = HUNDRED_PERCENT; - } - var processStops = []; - var previous = 0; - for (var i = 0; i < stops.length; i++) { - var stop_1 = stops[i].stop; - if (stop_1 !== null) { - var absoluteValue = getAbsoluteValue(stop_1, lineLength); - if (absoluteValue > previous) { - processStops.push(absoluteValue); - } - else { - processStops.push(previous); - } - previous = absoluteValue; - } - else { - processStops.push(null); - } - } - var gapBegin = null; - for (var i = 0; i < processStops.length; i++) { - var stop_2 = processStops[i]; - if (stop_2 === null) { - if (gapBegin === null) { - gapBegin = i; - } - } - else if (gapBegin !== null) { - var gapLength = i - gapBegin; - var beforeGap = processStops[gapBegin - 1]; - var gapValue = (stop_2 - beforeGap) / (gapLength + 1); - for (var g = 1; g <= gapLength; g++) { - processStops[gapBegin + g - 1] = gapValue * g; - } - gapBegin = null; - } - } - return stops.map(function (_a, i) { - var color = _a.color; - return { color: color, stop: Math.max(Math.min(1, processStops[i] / lineLength), 0) }; - }); - }; - var getAngleFromCorner = function (corner, width, height) { - var centerX = width / 2; - var centerY = height / 2; - var x = getAbsoluteValue(corner[0], width) - centerX; - var y = centerY - getAbsoluteValue(corner[1], height); - return (Math.atan2(y, x) + Math.PI * 2) % (Math.PI * 2); - }; - var calculateGradientDirection = function (angle, width, height) { - var radian = typeof angle === 'number' ? angle : getAngleFromCorner(angle, width, height); - var lineLength = Math.abs(width * Math.sin(radian)) + Math.abs(height * Math.cos(radian)); - var halfWidth = width / 2; - var halfHeight = height / 2; - var halfLineLength = lineLength / 2; - var yDiff = Math.sin(radian - Math.PI / 2) * halfLineLength; - var xDiff = Math.cos(radian - Math.PI / 2) * halfLineLength; - return [lineLength, halfWidth - xDiff, halfWidth + xDiff, halfHeight - yDiff, halfHeight + yDiff]; - }; - var distance = function (a, b) { return Math.sqrt(a * a + b * b); }; - var findCorner = function (width, height, x, y, closest) { - var corners = [ - [0, 0], - [0, height], - [width, 0], - [width, height] - ]; - return corners.reduce(function (stat, corner) { - var cx = corner[0], cy = corner[1]; - var d = distance(x - cx, y - cy); - if (closest ? d < stat.optimumDistance : d > stat.optimumDistance) { - return { - optimumCorner: corner, - optimumDistance: d - }; - } - return stat; - }, { - optimumDistance: closest ? Infinity : -Infinity, - optimumCorner: null - }).optimumCorner; - }; - var calculateRadius = function (gradient, x, y, width, height) { - var rx = 0; - var ry = 0; - switch (gradient.size) { - case 0 /* CLOSEST_SIDE */: - // The ending shape is sized so that that it exactly meets the side of the gradient box closest to the gradient’s center. - // If the shape is an ellipse, it exactly meets the closest side in each dimension. - if (gradient.shape === 0 /* CIRCLE */) { - rx = ry = Math.min(Math.abs(x), Math.abs(x - width), Math.abs(y), Math.abs(y - height)); - } - else if (gradient.shape === 1 /* ELLIPSE */) { - rx = Math.min(Math.abs(x), Math.abs(x - width)); - ry = Math.min(Math.abs(y), Math.abs(y - height)); - } - break; - case 2 /* CLOSEST_CORNER */: - // The ending shape is sized so that that it passes through the corner of the gradient box closest to the gradient’s center. - // If the shape is an ellipse, the ending shape is given the same aspect-ratio it would have if closest-side were specified. - if (gradient.shape === 0 /* CIRCLE */) { - rx = ry = Math.min(distance(x, y), distance(x, y - height), distance(x - width, y), distance(x - width, y - height)); - } - else if (gradient.shape === 1 /* ELLIPSE */) { - // Compute the ratio ry/rx (which is to be the same as for "closest-side") - var c = Math.min(Math.abs(y), Math.abs(y - height)) / Math.min(Math.abs(x), Math.abs(x - width)); - var _a = findCorner(width, height, x, y, true), cx = _a[0], cy = _a[1]; - rx = distance(cx - x, (cy - y) / c); - ry = c * rx; - } - break; - case 1 /* FARTHEST_SIDE */: - // Same as closest-side, except the ending shape is sized based on the farthest side(s) - if (gradient.shape === 0 /* CIRCLE */) { - rx = ry = Math.max(Math.abs(x), Math.abs(x - width), Math.abs(y), Math.abs(y - height)); - } - else if (gradient.shape === 1 /* ELLIPSE */) { - rx = Math.max(Math.abs(x), Math.abs(x - width)); - ry = Math.max(Math.abs(y), Math.abs(y - height)); - } - break; - case 3 /* FARTHEST_CORNER */: - // Same as closest-corner, except the ending shape is sized based on the farthest corner. - // If the shape is an ellipse, the ending shape is given the same aspect ratio it would have if farthest-side were specified. - if (gradient.shape === 0 /* CIRCLE */) { - rx = ry = Math.max(distance(x, y), distance(x, y - height), distance(x - width, y), distance(x - width, y - height)); - } - else if (gradient.shape === 1 /* ELLIPSE */) { - // Compute the ratio ry/rx (which is to be the same as for "farthest-side") - var c = Math.max(Math.abs(y), Math.abs(y - height)) / Math.max(Math.abs(x), Math.abs(x - width)); - var _b = findCorner(width, height, x, y, false), cx = _b[0], cy = _b[1]; - rx = distance(cx - x, (cy - y) / c); - ry = c * rx; - } - break; - } - if (Array.isArray(gradient.size)) { - rx = getAbsoluteValue(gradient.size[0], width); - ry = gradient.size.length === 2 ? getAbsoluteValue(gradient.size[1], height) : rx; - } - return [rx, ry]; - }; - - var linearGradient = function (context, tokens) { - var angle$1 = deg(180); - var stops = []; - parseFunctionArgs(tokens).forEach(function (arg, i) { - if (i === 0) { - var firstToken = arg[0]; - if (firstToken.type === 20 /* IDENT_TOKEN */ && firstToken.value === 'to') { - angle$1 = parseNamedSide(arg); - return; - } - else if (isAngle(firstToken)) { - angle$1 = angle.parse(context, firstToken); - return; - } - } - var colorStop = parseColorStop(context, arg); - stops.push(colorStop); - }); - return { angle: angle$1, stops: stops, type: 1 /* LINEAR_GRADIENT */ }; - }; - - var prefixLinearGradient = function (context, tokens) { - var angle$1 = deg(180); - var stops = []; - parseFunctionArgs(tokens).forEach(function (arg, i) { - if (i === 0) { - var firstToken = arg[0]; - if (firstToken.type === 20 /* IDENT_TOKEN */ && - ['top', 'left', 'right', 'bottom'].indexOf(firstToken.value) !== -1) { - angle$1 = parseNamedSide(arg); - return; - } - else if (isAngle(firstToken)) { - angle$1 = (angle.parse(context, firstToken) + deg(270)) % deg(360); - return; - } - } - var colorStop = parseColorStop(context, arg); - stops.push(colorStop); - }); - return { - angle: angle$1, - stops: stops, - type: 1 /* LINEAR_GRADIENT */ - }; - }; - - var webkitGradient = function (context, tokens) { - var angle = deg(180); - var stops = []; - var type = 1 /* LINEAR_GRADIENT */; - var shape = 0 /* CIRCLE */; - var size = 3 /* FARTHEST_CORNER */; - var position = []; - parseFunctionArgs(tokens).forEach(function (arg, i) { - var firstToken = arg[0]; - if (i === 0) { - if (isIdentToken(firstToken) && firstToken.value === 'linear') { - type = 1 /* LINEAR_GRADIENT */; - return; - } - else if (isIdentToken(firstToken) && firstToken.value === 'radial') { - type = 2 /* RADIAL_GRADIENT */; - return; - } - } - if (firstToken.type === 18 /* FUNCTION */) { - if (firstToken.name === 'from') { - var color = color$1.parse(context, firstToken.values[0]); - stops.push({ stop: ZERO_LENGTH, color: color }); - } - else if (firstToken.name === 'to') { - var color = color$1.parse(context, firstToken.values[0]); - stops.push({ stop: HUNDRED_PERCENT, color: color }); - } - else if (firstToken.name === 'color-stop') { - var values = firstToken.values.filter(nonFunctionArgSeparator); - if (values.length === 2) { - var color = color$1.parse(context, values[1]); - var stop_1 = values[0]; - if (isNumberToken(stop_1)) { - stops.push({ - stop: { type: 16 /* PERCENTAGE_TOKEN */, number: stop_1.number * 100, flags: stop_1.flags }, - color: color - }); - } - } - } - } - }); - return type === 1 /* LINEAR_GRADIENT */ - ? { - angle: (angle + deg(180)) % deg(360), - stops: stops, - type: type - } - : { size: size, shape: shape, stops: stops, position: position, type: type }; - }; - - var CLOSEST_SIDE = 'closest-side'; - var FARTHEST_SIDE = 'farthest-side'; - var CLOSEST_CORNER = 'closest-corner'; - var FARTHEST_CORNER = 'farthest-corner'; - var CIRCLE = 'circle'; - var ELLIPSE = 'ellipse'; - var COVER = 'cover'; - var CONTAIN = 'contain'; - var radialGradient = function (context, tokens) { - var shape = 0 /* CIRCLE */; - var size = 3 /* FARTHEST_CORNER */; - var stops = []; - var position = []; - parseFunctionArgs(tokens).forEach(function (arg, i) { - var isColorStop = true; - if (i === 0) { - var isAtPosition_1 = false; - isColorStop = arg.reduce(function (acc, token) { - if (isAtPosition_1) { - if (isIdentToken(token)) { - switch (token.value) { - case 'center': - position.push(FIFTY_PERCENT); - return acc; - case 'top': - case 'left': - position.push(ZERO_LENGTH); - return acc; - case 'right': - case 'bottom': - position.push(HUNDRED_PERCENT); - return acc; - } - } - else if (isLengthPercentage(token) || isLength(token)) { - position.push(token); - } - } - else if (isIdentToken(token)) { - switch (token.value) { - case CIRCLE: - shape = 0 /* CIRCLE */; - return false; - case ELLIPSE: - shape = 1 /* ELLIPSE */; - return false; - case 'at': - isAtPosition_1 = true; - return false; - case CLOSEST_SIDE: - size = 0 /* CLOSEST_SIDE */; - return false; - case COVER: - case FARTHEST_SIDE: - size = 1 /* FARTHEST_SIDE */; - return false; - case CONTAIN: - case CLOSEST_CORNER: - size = 2 /* CLOSEST_CORNER */; - return false; - case FARTHEST_CORNER: - size = 3 /* FARTHEST_CORNER */; - return false; - } - } - else if (isLength(token) || isLengthPercentage(token)) { - if (!Array.isArray(size)) { - size = []; - } - size.push(token); - return false; - } - return acc; - }, isColorStop); - } - if (isColorStop) { - var colorStop = parseColorStop(context, arg); - stops.push(colorStop); - } - }); - return { size: size, shape: shape, stops: stops, position: position, type: 2 /* RADIAL_GRADIENT */ }; - }; - - var prefixRadialGradient = function (context, tokens) { - var shape = 0 /* CIRCLE */; - var size = 3 /* FARTHEST_CORNER */; - var stops = []; - var position = []; - parseFunctionArgs(tokens).forEach(function (arg, i) { - var isColorStop = true; - if (i === 0) { - isColorStop = arg.reduce(function (acc, token) { - if (isIdentToken(token)) { - switch (token.value) { - case 'center': - position.push(FIFTY_PERCENT); - return false; - case 'top': - case 'left': - position.push(ZERO_LENGTH); - return false; - case 'right': - case 'bottom': - position.push(HUNDRED_PERCENT); - return false; - } - } - else if (isLengthPercentage(token) || isLength(token)) { - position.push(token); - return false; - } - return acc; - }, isColorStop); - } - else if (i === 1) { - isColorStop = arg.reduce(function (acc, token) { - if (isIdentToken(token)) { - switch (token.value) { - case CIRCLE: - shape = 0 /* CIRCLE */; - return false; - case ELLIPSE: - shape = 1 /* ELLIPSE */; - return false; - case CONTAIN: - case CLOSEST_SIDE: - size = 0 /* CLOSEST_SIDE */; - return false; - case FARTHEST_SIDE: - size = 1 /* FARTHEST_SIDE */; - return false; - case CLOSEST_CORNER: - size = 2 /* CLOSEST_CORNER */; - return false; - case COVER: - case FARTHEST_CORNER: - size = 3 /* FARTHEST_CORNER */; - return false; - } - } - else if (isLength(token) || isLengthPercentage(token)) { - if (!Array.isArray(size)) { - size = []; - } - size.push(token); - return false; - } - return acc; - }, isColorStop); - } - if (isColorStop) { - var colorStop = parseColorStop(context, arg); - stops.push(colorStop); - } - }); - return { size: size, shape: shape, stops: stops, position: position, type: 2 /* RADIAL_GRADIENT */ }; - }; - - var isLinearGradient = function (background) { - return background.type === 1 /* LINEAR_GRADIENT */; - }; - var isRadialGradient = function (background) { - return background.type === 2 /* RADIAL_GRADIENT */; - }; - var image = { - name: 'image', - parse: function (context, value) { - if (value.type === 22 /* URL_TOKEN */) { - var image_1 = { url: value.value, type: 0 /* URL */ }; - context.cache.addImage(value.value); - return image_1; - } - if (value.type === 18 /* FUNCTION */) { - var imageFunction = SUPPORTED_IMAGE_FUNCTIONS[value.name]; - if (typeof imageFunction === 'undefined') { - throw new Error("Attempting to parse an unsupported image function \"" + value.name + "\""); - } - return imageFunction(context, value.values); - } - throw new Error("Unsupported image type " + value.type); - } - }; - function isSupportedImage(value) { - return (!(value.type === 20 /* IDENT_TOKEN */ && value.value === 'none') && - (value.type !== 18 /* FUNCTION */ || !!SUPPORTED_IMAGE_FUNCTIONS[value.name])); - } - var SUPPORTED_IMAGE_FUNCTIONS = { - 'linear-gradient': linearGradient, - '-moz-linear-gradient': prefixLinearGradient, - '-ms-linear-gradient': prefixLinearGradient, - '-o-linear-gradient': prefixLinearGradient, - '-webkit-linear-gradient': prefixLinearGradient, - 'radial-gradient': radialGradient, - '-moz-radial-gradient': prefixRadialGradient, - '-ms-radial-gradient': prefixRadialGradient, - '-o-radial-gradient': prefixRadialGradient, - '-webkit-radial-gradient': prefixRadialGradient, - '-webkit-gradient': webkitGradient - }; - - var backgroundImage = { - name: 'background-image', - initialValue: 'none', - type: 1 /* LIST */, - prefix: false, - parse: function (context, tokens) { - if (tokens.length === 0) { - return []; - } - var first = tokens[0]; - if (first.type === 20 /* IDENT_TOKEN */ && first.value === 'none') { - return []; - } - return tokens - .filter(function (value) { return nonFunctionArgSeparator(value) && isSupportedImage(value); }) - .map(function (value) { return image.parse(context, value); }); - } - }; - - var backgroundOrigin = { - name: 'background-origin', - initialValue: 'border-box', - prefix: false, - type: 1 /* LIST */, - parse: function (_context, tokens) { - return tokens.map(function (token) { - if (isIdentToken(token)) { - switch (token.value) { - case 'padding-box': - return 1 /* PADDING_BOX */; - case 'content-box': - return 2 /* CONTENT_BOX */; - } - } - return 0 /* BORDER_BOX */; - }); - } - }; - - var backgroundPosition = { - name: 'background-position', - initialValue: '0% 0%', - type: 1 /* LIST */, - prefix: false, - parse: function (_context, tokens) { - return parseFunctionArgs(tokens) - .map(function (values) { return values.filter(isLengthPercentage); }) - .map(parseLengthPercentageTuple); - } - }; - - var backgroundRepeat = { - name: 'background-repeat', - initialValue: 'repeat', - prefix: false, - type: 1 /* LIST */, - parse: function (_context, tokens) { - return parseFunctionArgs(tokens) - .map(function (values) { - return values - .filter(isIdentToken) - .map(function (token) { return token.value; }) - .join(' '); - }) - .map(parseBackgroundRepeat); - } - }; - var parseBackgroundRepeat = function (value) { - switch (value) { - case 'no-repeat': - return 1 /* NO_REPEAT */; - case 'repeat-x': - case 'repeat no-repeat': - return 2 /* REPEAT_X */; - case 'repeat-y': - case 'no-repeat repeat': - return 3 /* REPEAT_Y */; - case 'repeat': - default: - return 0 /* REPEAT */; - } - }; - - var BACKGROUND_SIZE; - (function (BACKGROUND_SIZE) { - BACKGROUND_SIZE["AUTO"] = "auto"; - BACKGROUND_SIZE["CONTAIN"] = "contain"; - BACKGROUND_SIZE["COVER"] = "cover"; - })(BACKGROUND_SIZE || (BACKGROUND_SIZE = {})); - var backgroundSize = { - name: 'background-size', - initialValue: '0', - prefix: false, - type: 1 /* LIST */, - parse: function (_context, tokens) { - return parseFunctionArgs(tokens).map(function (values) { return values.filter(isBackgroundSizeInfoToken); }); - } - }; - var isBackgroundSizeInfoToken = function (value) { - return isIdentToken(value) || isLengthPercentage(value); - }; - - var borderColorForSide = function (side) { return ({ - name: "border-" + side + "-color", - initialValue: 'transparent', - prefix: false, - type: 3 /* TYPE_VALUE */, - format: 'color' - }); }; - var borderTopColor = borderColorForSide('top'); - var borderRightColor = borderColorForSide('right'); - var borderBottomColor = borderColorForSide('bottom'); - var borderLeftColor = borderColorForSide('left'); - - var borderRadiusForSide = function (side) { return ({ - name: "border-radius-" + side, - initialValue: '0 0', - prefix: false, - type: 1 /* LIST */, - parse: function (_context, tokens) { - return parseLengthPercentageTuple(tokens.filter(isLengthPercentage)); - } - }); }; - var borderTopLeftRadius = borderRadiusForSide('top-left'); - var borderTopRightRadius = borderRadiusForSide('top-right'); - var borderBottomRightRadius = borderRadiusForSide('bottom-right'); - var borderBottomLeftRadius = borderRadiusForSide('bottom-left'); - - var borderStyleForSide = function (side) { return ({ - name: "border-" + side + "-style", - initialValue: 'solid', - prefix: false, - type: 2 /* IDENT_VALUE */, - parse: function (_context, style) { - switch (style) { - case 'none': - return 0 /* NONE */; - case 'dashed': - return 2 /* DASHED */; - case 'dotted': - return 3 /* DOTTED */; - case 'double': - return 4 /* DOUBLE */; - } - return 1 /* SOLID */; - } - }); }; - var borderTopStyle = borderStyleForSide('top'); - var borderRightStyle = borderStyleForSide('right'); - var borderBottomStyle = borderStyleForSide('bottom'); - var borderLeftStyle = borderStyleForSide('left'); - - var borderWidthForSide = function (side) { return ({ - name: "border-" + side + "-width", - initialValue: '0', - type: 0 /* VALUE */, - prefix: false, - parse: function (_context, token) { - if (isDimensionToken(token)) { - return token.number; - } - return 0; - } - }); }; - var borderTopWidth = borderWidthForSide('top'); - var borderRightWidth = borderWidthForSide('right'); - var borderBottomWidth = borderWidthForSide('bottom'); - var borderLeftWidth = borderWidthForSide('left'); - - var color = { - name: "color", - initialValue: 'transparent', - prefix: false, - type: 3 /* TYPE_VALUE */, - format: 'color' - }; - - var direction = { - name: 'direction', - initialValue: 'ltr', - prefix: false, - type: 2 /* IDENT_VALUE */, - parse: function (_context, direction) { - switch (direction) { - case 'rtl': - return 1 /* RTL */; - case 'ltr': - default: - return 0 /* LTR */; - } - } - }; - - var display = { - name: 'display', - initialValue: 'inline-block', - prefix: false, - type: 1 /* LIST */, - parse: function (_context, tokens) { - return tokens.filter(isIdentToken).reduce(function (bit, token) { - return bit | parseDisplayValue(token.value); - }, 0 /* NONE */); - } - }; - var parseDisplayValue = function (display) { - switch (display) { - case 'block': - case '-webkit-box': - return 2 /* BLOCK */; - case 'inline': - return 4 /* INLINE */; - case 'run-in': - return 8 /* RUN_IN */; - case 'flow': - return 16 /* FLOW */; - case 'flow-root': - return 32 /* FLOW_ROOT */; - case 'table': - return 64 /* TABLE */; - case 'flex': - case '-webkit-flex': - return 128 /* FLEX */; - case 'grid': - case '-ms-grid': - return 256 /* GRID */; - case 'ruby': - return 512 /* RUBY */; - case 'subgrid': - return 1024 /* SUBGRID */; - case 'list-item': - return 2048 /* LIST_ITEM */; - case 'table-row-group': - return 4096 /* TABLE_ROW_GROUP */; - case 'table-header-group': - return 8192 /* TABLE_HEADER_GROUP */; - case 'table-footer-group': - return 16384 /* TABLE_FOOTER_GROUP */; - case 'table-row': - return 32768 /* TABLE_ROW */; - case 'table-cell': - return 65536 /* TABLE_CELL */; - case 'table-column-group': - return 131072 /* TABLE_COLUMN_GROUP */; - case 'table-column': - return 262144 /* TABLE_COLUMN */; - case 'table-caption': - return 524288 /* TABLE_CAPTION */; - case 'ruby-base': - return 1048576 /* RUBY_BASE */; - case 'ruby-text': - return 2097152 /* RUBY_TEXT */; - case 'ruby-base-container': - return 4194304 /* RUBY_BASE_CONTAINER */; - case 'ruby-text-container': - return 8388608 /* RUBY_TEXT_CONTAINER */; - case 'contents': - return 16777216 /* CONTENTS */; - case 'inline-block': - return 33554432 /* INLINE_BLOCK */; - case 'inline-list-item': - return 67108864 /* INLINE_LIST_ITEM */; - case 'inline-table': - return 134217728 /* INLINE_TABLE */; - case 'inline-flex': - return 268435456 /* INLINE_FLEX */; - case 'inline-grid': - return 536870912 /* INLINE_GRID */; - } - return 0 /* NONE */; - }; - - var float = { - name: 'float', - initialValue: 'none', - prefix: false, - type: 2 /* IDENT_VALUE */, - parse: function (_context, float) { - switch (float) { - case 'left': - return 1 /* LEFT */; - case 'right': - return 2 /* RIGHT */; - case 'inline-start': - return 3 /* INLINE_START */; - case 'inline-end': - return 4 /* INLINE_END */; - } - return 0 /* NONE */; - } - }; - - var letterSpacing = { - name: 'letter-spacing', - initialValue: '0', - prefix: false, - type: 0 /* VALUE */, - parse: function (_context, token) { - if (token.type === 20 /* IDENT_TOKEN */ && token.value === 'normal') { - return 0; - } - if (token.type === 17 /* NUMBER_TOKEN */) { - return token.number; - } - if (token.type === 15 /* DIMENSION_TOKEN */) { - return token.number; - } - return 0; - } - }; - - var LINE_BREAK; - (function (LINE_BREAK) { - LINE_BREAK["NORMAL"] = "normal"; - LINE_BREAK["STRICT"] = "strict"; - })(LINE_BREAK || (LINE_BREAK = {})); - var lineBreak = { - name: 'line-break', - initialValue: 'normal', - prefix: false, - type: 2 /* IDENT_VALUE */, - parse: function (_context, lineBreak) { - switch (lineBreak) { - case 'strict': - return LINE_BREAK.STRICT; - case 'normal': - default: - return LINE_BREAK.NORMAL; - } - } - }; - - var lineHeight = { - name: 'line-height', - initialValue: 'normal', - prefix: false, - type: 4 /* TOKEN_VALUE */ - }; - var computeLineHeight = function (token, fontSize) { - if (isIdentToken(token) && token.value === 'normal') { - return 1.2 * fontSize; - } - else if (token.type === 17 /* NUMBER_TOKEN */) { - return fontSize * token.number; - } - else if (isLengthPercentage(token)) { - return getAbsoluteValue(token, fontSize); - } - return fontSize; - }; - - var listStyleImage = { - name: 'list-style-image', - initialValue: 'none', - type: 0 /* VALUE */, - prefix: false, - parse: function (context, token) { - if (token.type === 20 /* IDENT_TOKEN */ && token.value === 'none') { - return null; - } - return image.parse(context, token); - } - }; - - var listStylePosition = { - name: 'list-style-position', - initialValue: 'outside', - prefix: false, - type: 2 /* IDENT_VALUE */, - parse: function (_context, position) { - switch (position) { - case 'inside': - return 0 /* INSIDE */; - case 'outside': - default: - return 1 /* OUTSIDE */; - } - } - }; - - var listStyleType = { - name: 'list-style-type', - initialValue: 'none', - prefix: false, - type: 2 /* IDENT_VALUE */, - parse: function (_context, type) { - switch (type) { - case 'disc': - return 0 /* DISC */; - case 'circle': - return 1 /* CIRCLE */; - case 'square': - return 2 /* SQUARE */; - case 'decimal': - return 3 /* DECIMAL */; - case 'cjk-decimal': - return 4 /* CJK_DECIMAL */; - case 'decimal-leading-zero': - return 5 /* DECIMAL_LEADING_ZERO */; - case 'lower-roman': - return 6 /* LOWER_ROMAN */; - case 'upper-roman': - return 7 /* UPPER_ROMAN */; - case 'lower-greek': - return 8 /* LOWER_GREEK */; - case 'lower-alpha': - return 9 /* LOWER_ALPHA */; - case 'upper-alpha': - return 10 /* UPPER_ALPHA */; - case 'arabic-indic': - return 11 /* ARABIC_INDIC */; - case 'armenian': - return 12 /* ARMENIAN */; - case 'bengali': - return 13 /* BENGALI */; - case 'cambodian': - return 14 /* CAMBODIAN */; - case 'cjk-earthly-branch': - return 15 /* CJK_EARTHLY_BRANCH */; - case 'cjk-heavenly-stem': - return 16 /* CJK_HEAVENLY_STEM */; - case 'cjk-ideographic': - return 17 /* CJK_IDEOGRAPHIC */; - case 'devanagari': - return 18 /* DEVANAGARI */; - case 'ethiopic-numeric': - return 19 /* ETHIOPIC_NUMERIC */; - case 'georgian': - return 20 /* GEORGIAN */; - case 'gujarati': - return 21 /* GUJARATI */; - case 'gurmukhi': - return 22 /* GURMUKHI */; - case 'hebrew': - return 22 /* HEBREW */; - case 'hiragana': - return 23 /* HIRAGANA */; - case 'hiragana-iroha': - return 24 /* HIRAGANA_IROHA */; - case 'japanese-formal': - return 25 /* JAPANESE_FORMAL */; - case 'japanese-informal': - return 26 /* JAPANESE_INFORMAL */; - case 'kannada': - return 27 /* KANNADA */; - case 'katakana': - return 28 /* KATAKANA */; - case 'katakana-iroha': - return 29 /* KATAKANA_IROHA */; - case 'khmer': - return 30 /* KHMER */; - case 'korean-hangul-formal': - return 31 /* KOREAN_HANGUL_FORMAL */; - case 'korean-hanja-formal': - return 32 /* KOREAN_HANJA_FORMAL */; - case 'korean-hanja-informal': - return 33 /* KOREAN_HANJA_INFORMAL */; - case 'lao': - return 34 /* LAO */; - case 'lower-armenian': - return 35 /* LOWER_ARMENIAN */; - case 'malayalam': - return 36 /* MALAYALAM */; - case 'mongolian': - return 37 /* MONGOLIAN */; - case 'myanmar': - return 38 /* MYANMAR */; - case 'oriya': - return 39 /* ORIYA */; - case 'persian': - return 40 /* PERSIAN */; - case 'simp-chinese-formal': - return 41 /* SIMP_CHINESE_FORMAL */; - case 'simp-chinese-informal': - return 42 /* SIMP_CHINESE_INFORMAL */; - case 'tamil': - return 43 /* TAMIL */; - case 'telugu': - return 44 /* TELUGU */; - case 'thai': - return 45 /* THAI */; - case 'tibetan': - return 46 /* TIBETAN */; - case 'trad-chinese-formal': - return 47 /* TRAD_CHINESE_FORMAL */; - case 'trad-chinese-informal': - return 48 /* TRAD_CHINESE_INFORMAL */; - case 'upper-armenian': - return 49 /* UPPER_ARMENIAN */; - case 'disclosure-open': - return 50 /* DISCLOSURE_OPEN */; - case 'disclosure-closed': - return 51 /* DISCLOSURE_CLOSED */; - case 'none': - default: - return -1 /* NONE */; - } - } - }; - - var marginForSide = function (side) { return ({ - name: "margin-" + side, - initialValue: '0', - prefix: false, - type: 4 /* TOKEN_VALUE */ - }); }; - var marginTop = marginForSide('top'); - var marginRight = marginForSide('right'); - var marginBottom = marginForSide('bottom'); - var marginLeft = marginForSide('left'); - - var overflow = { - name: 'overflow', - initialValue: 'visible', - prefix: false, - type: 1 /* LIST */, - parse: function (_context, tokens) { - return tokens.filter(isIdentToken).map(function (overflow) { - switch (overflow.value) { - case 'hidden': - return 1 /* HIDDEN */; - case 'scroll': - return 2 /* SCROLL */; - case 'clip': - return 3 /* CLIP */; - case 'auto': - return 4 /* AUTO */; - case 'visible': - default: - return 0 /* VISIBLE */; - } - }); - } - }; - - var overflowWrap = { - name: 'overflow-wrap', - initialValue: 'normal', - prefix: false, - type: 2 /* IDENT_VALUE */, - parse: function (_context, overflow) { - switch (overflow) { - case 'break-word': - return "break-word" /* BREAK_WORD */; - case 'normal': - default: - return "normal" /* NORMAL */; - } - } - }; - - var paddingForSide = function (side) { return ({ - name: "padding-" + side, - initialValue: '0', - prefix: false, - type: 3 /* TYPE_VALUE */, - format: 'length-percentage' - }); }; - var paddingTop = paddingForSide('top'); - var paddingRight = paddingForSide('right'); - var paddingBottom = paddingForSide('bottom'); - var paddingLeft = paddingForSide('left'); - - var textAlign = { - name: 'text-align', - initialValue: 'left', - prefix: false, - type: 2 /* IDENT_VALUE */, - parse: function (_context, textAlign) { - switch (textAlign) { - case 'right': - return 2 /* RIGHT */; - case 'center': - case 'justify': - return 1 /* CENTER */; - case 'left': - default: - return 0 /* LEFT */; - } - } - }; - - var position = { - name: 'position', - initialValue: 'static', - prefix: false, - type: 2 /* IDENT_VALUE */, - parse: function (_context, position) { - switch (position) { - case 'relative': - return 1 /* RELATIVE */; - case 'absolute': - return 2 /* ABSOLUTE */; - case 'fixed': - return 3 /* FIXED */; - case 'sticky': - return 4 /* STICKY */; - } - return 0 /* STATIC */; - } - }; - - var textShadow = { - name: 'text-shadow', - initialValue: 'none', - type: 1 /* LIST */, - prefix: false, - parse: function (context, tokens) { - if (tokens.length === 1 && isIdentWithValue(tokens[0], 'none')) { - return []; - } - return parseFunctionArgs(tokens).map(function (values) { - var shadow = { - color: COLORS.TRANSPARENT, - offsetX: ZERO_LENGTH, - offsetY: ZERO_LENGTH, - blur: ZERO_LENGTH - }; - var c = 0; - for (var i = 0; i < values.length; i++) { - var token = values[i]; - if (isLength(token)) { - if (c === 0) { - shadow.offsetX = token; - } - else if (c === 1) { - shadow.offsetY = token; - } - else { - shadow.blur = token; - } - c++; - } - else { - shadow.color = color$1.parse(context, token); - } - } - return shadow; - }); - } - }; - - var textTransform = { - name: 'text-transform', - initialValue: 'none', - prefix: false, - type: 2 /* IDENT_VALUE */, - parse: function (_context, textTransform) { - switch (textTransform) { - case 'uppercase': - return 2 /* UPPERCASE */; - case 'lowercase': - return 1 /* LOWERCASE */; - case 'capitalize': - return 3 /* CAPITALIZE */; - } - return 0 /* NONE */; - } - }; - - var transform$1 = { - name: 'transform', - initialValue: 'none', - prefix: true, - type: 0 /* VALUE */, - parse: function (_context, token) { - if (token.type === 20 /* IDENT_TOKEN */ && token.value === 'none') { - return null; - } - if (token.type === 18 /* FUNCTION */) { - var transformFunction = SUPPORTED_TRANSFORM_FUNCTIONS[token.name]; - if (typeof transformFunction === 'undefined') { - throw new Error("Attempting to parse an unsupported transform function \"" + token.name + "\""); - } - return transformFunction(token.values); - } - return null; - } - }; - var matrix = function (args) { - var values = args.filter(function (arg) { return arg.type === 17 /* NUMBER_TOKEN */; }).map(function (arg) { return arg.number; }); - return values.length === 6 ? values : null; - }; - // doesn't support 3D transforms at the moment - var matrix3d = function (args) { - var values = args.filter(function (arg) { return arg.type === 17 /* NUMBER_TOKEN */; }).map(function (arg) { return arg.number; }); - var a1 = values[0], b1 = values[1]; values[2]; values[3]; var a2 = values[4], b2 = values[5]; values[6]; values[7]; values[8]; values[9]; values[10]; values[11]; var a4 = values[12], b4 = values[13]; values[14]; values[15]; - return values.length === 16 ? [a1, b1, a2, b2, a4, b4] : null; - }; - var SUPPORTED_TRANSFORM_FUNCTIONS = { - matrix: matrix, - matrix3d: matrix3d - }; - - var DEFAULT_VALUE = { - type: 16 /* PERCENTAGE_TOKEN */, - number: 50, - flags: FLAG_INTEGER - }; - var DEFAULT = [DEFAULT_VALUE, DEFAULT_VALUE]; - var transformOrigin = { - name: 'transform-origin', - initialValue: '50% 50%', - prefix: true, - type: 1 /* LIST */, - parse: function (_context, tokens) { - var origins = tokens.filter(isLengthPercentage); - if (origins.length !== 2) { - return DEFAULT; - } - return [origins[0], origins[1]]; - } - }; - - var visibility = { - name: 'visible', - initialValue: 'none', - prefix: false, - type: 2 /* IDENT_VALUE */, - parse: function (_context, visibility) { - switch (visibility) { - case 'hidden': - return 1 /* HIDDEN */; - case 'collapse': - return 2 /* COLLAPSE */; - case 'visible': - default: - return 0 /* VISIBLE */; - } - } - }; - - var WORD_BREAK; - (function (WORD_BREAK) { - WORD_BREAK["NORMAL"] = "normal"; - WORD_BREAK["BREAK_ALL"] = "break-all"; - WORD_BREAK["KEEP_ALL"] = "keep-all"; - })(WORD_BREAK || (WORD_BREAK = {})); - var wordBreak = { - name: 'word-break', - initialValue: 'normal', - prefix: false, - type: 2 /* IDENT_VALUE */, - parse: function (_context, wordBreak) { - switch (wordBreak) { - case 'break-all': - return WORD_BREAK.BREAK_ALL; - case 'keep-all': - return WORD_BREAK.KEEP_ALL; - case 'normal': - default: - return WORD_BREAK.NORMAL; - } - } - }; - - var zIndex = { - name: 'z-index', - initialValue: 'auto', - prefix: false, - type: 0 /* VALUE */, - parse: function (_context, token) { - if (token.type === 20 /* IDENT_TOKEN */) { - return { auto: true, order: 0 }; - } - if (isNumberToken(token)) { - return { auto: false, order: token.number }; - } - throw new Error("Invalid z-index number parsed"); - } - }; - - var time = { - name: 'time', - parse: function (_context, value) { - if (value.type === 15 /* DIMENSION_TOKEN */) { - switch (value.unit.toLowerCase()) { - case 's': - return 1000 * value.number; - case 'ms': - return value.number; - } - } - throw new Error("Unsupported time type"); - } - }; - - var opacity = { - name: 'opacity', - initialValue: '1', - type: 0 /* VALUE */, - prefix: false, - parse: function (_context, token) { - if (isNumberToken(token)) { - return token.number; - } - return 1; - } - }; - - var textDecorationColor = { - name: "text-decoration-color", - initialValue: 'transparent', - prefix: false, - type: 3 /* TYPE_VALUE */, - format: 'color' - }; - - var textDecorationLine = { - name: 'text-decoration-line', - initialValue: 'none', - prefix: false, - type: 1 /* LIST */, - parse: function (_context, tokens) { - return tokens - .filter(isIdentToken) - .map(function (token) { - switch (token.value) { - case 'underline': - return 1 /* UNDERLINE */; - case 'overline': - return 2 /* OVERLINE */; - case 'line-through': - return 3 /* LINE_THROUGH */; - case 'none': - return 4 /* BLINK */; - } - return 0 /* NONE */; - }) - .filter(function (line) { return line !== 0 /* NONE */; }); - } - }; - - var fontFamily = { - name: "font-family", - initialValue: '', - prefix: false, - type: 1 /* LIST */, - parse: function (_context, tokens) { - var accumulator = []; - var results = []; - tokens.forEach(function (token) { - switch (token.type) { - case 20 /* IDENT_TOKEN */: - case 0 /* STRING_TOKEN */: - accumulator.push(token.value); - break; - case 17 /* NUMBER_TOKEN */: - accumulator.push(token.number.toString()); - break; - case 4 /* COMMA_TOKEN */: - results.push(accumulator.join(' ')); - accumulator.length = 0; - break; - } - }); - if (accumulator.length) { - results.push(accumulator.join(' ')); - } - return results.map(function (result) { return (result.indexOf(' ') === -1 ? result : "'" + result + "'"); }); - } - }; - - var fontSize = { - name: "font-size", - initialValue: '0', - prefix: false, - type: 3 /* TYPE_VALUE */, - format: 'length' - }; - - var fontWeight = { - name: 'font-weight', - initialValue: 'normal', - type: 0 /* VALUE */, - prefix: false, - parse: function (_context, token) { - if (isNumberToken(token)) { - return token.number; - } - if (isIdentToken(token)) { - switch (token.value) { - case 'bold': - return 700; - case 'normal': - default: - return 400; - } - } - return 400; - } - }; - - var fontVariant = { - name: 'font-variant', - initialValue: 'none', - type: 1 /* LIST */, - prefix: false, - parse: function (_context, tokens) { - return tokens.filter(isIdentToken).map(function (token) { return token.value; }); - } - }; - - var fontStyle = { - name: 'font-style', - initialValue: 'normal', - prefix: false, - type: 2 /* IDENT_VALUE */, - parse: function (_context, overflow) { - switch (overflow) { - case 'oblique': - return "oblique" /* OBLIQUE */; - case 'italic': - return "italic" /* ITALIC */; - case 'normal': - default: - return "normal" /* NORMAL */; - } - } - }; - - var contains = function (bit, value) { return (bit & value) !== 0; }; - - var content = { - name: 'content', - initialValue: 'none', - type: 1 /* LIST */, - prefix: false, - parse: function (_context, tokens) { - if (tokens.length === 0) { - return []; - } - var first = tokens[0]; - if (first.type === 20 /* IDENT_TOKEN */ && first.value === 'none') { - return []; - } - return tokens; - } - }; - - var counterIncrement = { - name: 'counter-increment', - initialValue: 'none', - prefix: true, - type: 1 /* LIST */, - parse: function (_context, tokens) { - if (tokens.length === 0) { - return null; - } - var first = tokens[0]; - if (first.type === 20 /* IDENT_TOKEN */ && first.value === 'none') { - return null; - } - var increments = []; - var filtered = tokens.filter(nonWhiteSpace); - for (var i = 0; i < filtered.length; i++) { - var counter = filtered[i]; - var next = filtered[i + 1]; - if (counter.type === 20 /* IDENT_TOKEN */) { - var increment = next && isNumberToken(next) ? next.number : 1; - increments.push({ counter: counter.value, increment: increment }); - } - } - return increments; - } - }; - - var counterReset = { - name: 'counter-reset', - initialValue: 'none', - prefix: true, - type: 1 /* LIST */, - parse: function (_context, tokens) { - if (tokens.length === 0) { - return []; - } - var resets = []; - var filtered = tokens.filter(nonWhiteSpace); - for (var i = 0; i < filtered.length; i++) { - var counter = filtered[i]; - var next = filtered[i + 1]; - if (isIdentToken(counter) && counter.value !== 'none') { - var reset = next && isNumberToken(next) ? next.number : 0; - resets.push({ counter: counter.value, reset: reset }); - } - } - return resets; - } - }; - - var duration = { - name: 'duration', - initialValue: '0s', - prefix: false, - type: 1 /* LIST */, - parse: function (context, tokens) { - return tokens.filter(isDimensionToken).map(function (token) { return time.parse(context, token); }); - } - }; - - var quotes = { - name: 'quotes', - initialValue: 'none', - prefix: true, - type: 1 /* LIST */, - parse: function (_context, tokens) { - if (tokens.length === 0) { - return null; - } - var first = tokens[0]; - if (first.type === 20 /* IDENT_TOKEN */ && first.value === 'none') { - return null; - } - var quotes = []; - var filtered = tokens.filter(isStringToken); - if (filtered.length % 2 !== 0) { - return null; - } - for (var i = 0; i < filtered.length; i += 2) { - var open_1 = filtered[i].value; - var close_1 = filtered[i + 1].value; - quotes.push({ open: open_1, close: close_1 }); - } - return quotes; - } - }; - var getQuote = function (quotes, depth, open) { - if (!quotes) { - return ''; - } - var quote = quotes[Math.min(depth, quotes.length - 1)]; - if (!quote) { - return ''; - } - return open ? quote.open : quote.close; - }; - - var paintOrder = { - name: 'paint-order', - initialValue: 'normal', - prefix: false, - type: 1 /* LIST */, - parse: function (_context, tokens) { - var DEFAULT_VALUE = [0 /* FILL */, 1 /* STROKE */, 2 /* MARKERS */]; - var layers = []; - tokens.filter(isIdentToken).forEach(function (token) { - switch (token.value) { - case 'stroke': - layers.push(1 /* STROKE */); - break; - case 'fill': - layers.push(0 /* FILL */); - break; - case 'markers': - layers.push(2 /* MARKERS */); - break; - } - }); - DEFAULT_VALUE.forEach(function (value) { - if (layers.indexOf(value) === -1) { - layers.push(value); - } - }); - return layers; - } - }; - - var webkitTextStrokeColor = { - name: "-webkit-text-stroke-color", - initialValue: 'currentcolor', - prefix: false, - type: 3 /* TYPE_VALUE */, - format: 'color' - }; - - var webkitTextStrokeWidth = { - name: "-webkit-text-stroke-width", - initialValue: '0', - type: 0 /* VALUE */, - prefix: false, - parse: function (_context, token) { - if (isDimensionToken(token)) { - return token.number; - } - return 0; - } - }; - - var CSSParsedDeclaration = /** @class */ (function () { - function CSSParsedDeclaration(context, declaration) { - var _a, _b; - this.animationDuration = parse(context, duration, declaration.animationDuration); - this.backgroundClip = parse(context, backgroundClip, declaration.backgroundClip); - this.backgroundColor = parse(context, backgroundColor, declaration.backgroundColor); - this.backgroundImage = parse(context, backgroundImage, declaration.backgroundImage); - this.backgroundOrigin = parse(context, backgroundOrigin, declaration.backgroundOrigin); - this.backgroundPosition = parse(context, backgroundPosition, declaration.backgroundPosition); - this.backgroundRepeat = parse(context, backgroundRepeat, declaration.backgroundRepeat); - this.backgroundSize = parse(context, backgroundSize, declaration.backgroundSize); - this.borderTopColor = parse(context, borderTopColor, declaration.borderTopColor); - this.borderRightColor = parse(context, borderRightColor, declaration.borderRightColor); - this.borderBottomColor = parse(context, borderBottomColor, declaration.borderBottomColor); - this.borderLeftColor = parse(context, borderLeftColor, declaration.borderLeftColor); - this.borderTopLeftRadius = parse(context, borderTopLeftRadius, declaration.borderTopLeftRadius); - this.borderTopRightRadius = parse(context, borderTopRightRadius, declaration.borderTopRightRadius); - this.borderBottomRightRadius = parse(context, borderBottomRightRadius, declaration.borderBottomRightRadius); - this.borderBottomLeftRadius = parse(context, borderBottomLeftRadius, declaration.borderBottomLeftRadius); - this.borderTopStyle = parse(context, borderTopStyle, declaration.borderTopStyle); - this.borderRightStyle = parse(context, borderRightStyle, declaration.borderRightStyle); - this.borderBottomStyle = parse(context, borderBottomStyle, declaration.borderBottomStyle); - this.borderLeftStyle = parse(context, borderLeftStyle, declaration.borderLeftStyle); - this.borderTopWidth = parse(context, borderTopWidth, declaration.borderTopWidth); - this.borderRightWidth = parse(context, borderRightWidth, declaration.borderRightWidth); - this.borderBottomWidth = parse(context, borderBottomWidth, declaration.borderBottomWidth); - this.borderLeftWidth = parse(context, borderLeftWidth, declaration.borderLeftWidth); - this.color = parse(context, color, declaration.color); - this.direction = parse(context, direction, declaration.direction); - this.display = parse(context, display, declaration.display); - this.float = parse(context, float, declaration.cssFloat); - this.fontFamily = parse(context, fontFamily, declaration.fontFamily); - this.fontSize = parse(context, fontSize, declaration.fontSize); - this.fontStyle = parse(context, fontStyle, declaration.fontStyle); - this.fontVariant = parse(context, fontVariant, declaration.fontVariant); - this.fontWeight = parse(context, fontWeight, declaration.fontWeight); - this.letterSpacing = parse(context, letterSpacing, declaration.letterSpacing); - this.lineBreak = parse(context, lineBreak, declaration.lineBreak); - this.lineHeight = parse(context, lineHeight, declaration.lineHeight); - this.listStyleImage = parse(context, listStyleImage, declaration.listStyleImage); - this.listStylePosition = parse(context, listStylePosition, declaration.listStylePosition); - this.listStyleType = parse(context, listStyleType, declaration.listStyleType); - this.marginTop = parse(context, marginTop, declaration.marginTop); - this.marginRight = parse(context, marginRight, declaration.marginRight); - this.marginBottom = parse(context, marginBottom, declaration.marginBottom); - this.marginLeft = parse(context, marginLeft, declaration.marginLeft); - this.opacity = parse(context, opacity, declaration.opacity); - var overflowTuple = parse(context, overflow, declaration.overflow); - this.overflowX = overflowTuple[0]; - this.overflowY = overflowTuple[overflowTuple.length > 1 ? 1 : 0]; - this.overflowWrap = parse(context, overflowWrap, declaration.overflowWrap); - this.paddingTop = parse(context, paddingTop, declaration.paddingTop); - this.paddingRight = parse(context, paddingRight, declaration.paddingRight); - this.paddingBottom = parse(context, paddingBottom, declaration.paddingBottom); - this.paddingLeft = parse(context, paddingLeft, declaration.paddingLeft); - this.paintOrder = parse(context, paintOrder, declaration.paintOrder); - this.position = parse(context, position, declaration.position); - this.textAlign = parse(context, textAlign, declaration.textAlign); - this.textDecorationColor = parse(context, textDecorationColor, (_a = declaration.textDecorationColor) !== null && _a !== void 0 ? _a : declaration.color); - this.textDecorationLine = parse(context, textDecorationLine, (_b = declaration.textDecorationLine) !== null && _b !== void 0 ? _b : declaration.textDecoration); - this.textShadow = parse(context, textShadow, declaration.textShadow); - this.textTransform = parse(context, textTransform, declaration.textTransform); - this.transform = parse(context, transform$1, declaration.transform); - this.transformOrigin = parse(context, transformOrigin, declaration.transformOrigin); - this.visibility = parse(context, visibility, declaration.visibility); - this.webkitTextStrokeColor = parse(context, webkitTextStrokeColor, declaration.webkitTextStrokeColor); - this.webkitTextStrokeWidth = parse(context, webkitTextStrokeWidth, declaration.webkitTextStrokeWidth); - this.wordBreak = parse(context, wordBreak, declaration.wordBreak); - this.zIndex = parse(context, zIndex, declaration.zIndex); - } - CSSParsedDeclaration.prototype.isVisible = function () { - return this.display > 0 && this.opacity > 0 && this.visibility === 0 /* VISIBLE */; - }; - CSSParsedDeclaration.prototype.isTransparent = function () { - return isTransparent(this.backgroundColor); - }; - CSSParsedDeclaration.prototype.isTransformed = function () { - return this.transform !== null; - }; - CSSParsedDeclaration.prototype.isPositioned = function () { - return this.position !== 0 /* STATIC */; - }; - CSSParsedDeclaration.prototype.isPositionedWithZIndex = function () { - return this.isPositioned() && !this.zIndex.auto; - }; - CSSParsedDeclaration.prototype.isFloating = function () { - return this.float !== 0 /* NONE */; - }; - CSSParsedDeclaration.prototype.isInlineLevel = function () { - return (contains(this.display, 4 /* INLINE */) || - contains(this.display, 33554432 /* INLINE_BLOCK */) || - contains(this.display, 268435456 /* INLINE_FLEX */) || - contains(this.display, 536870912 /* INLINE_GRID */) || - contains(this.display, 67108864 /* INLINE_LIST_ITEM */) || - contains(this.display, 134217728 /* INLINE_TABLE */)); - }; - return CSSParsedDeclaration; - }()); - var CSSParsedPseudoDeclaration = /** @class */ (function () { - function CSSParsedPseudoDeclaration(context, declaration) { - this.content = parse(context, content, declaration.content); - this.quotes = parse(context, quotes, declaration.quotes); - } - return CSSParsedPseudoDeclaration; - }()); - var CSSParsedCounterDeclaration = /** @class */ (function () { - function CSSParsedCounterDeclaration(context, declaration) { - this.counterIncrement = parse(context, counterIncrement, declaration.counterIncrement); - this.counterReset = parse(context, counterReset, declaration.counterReset); - } - return CSSParsedCounterDeclaration; - }()); - // eslint-disable-next-line @typescript-eslint/no-explicit-any - var parse = function (context, descriptor, style) { - var tokenizer = new Tokenizer(); - var value = style !== null && typeof style !== 'undefined' ? style.toString() : descriptor.initialValue; - tokenizer.write(value); - var parser = new Parser(tokenizer.read()); - switch (descriptor.type) { - case 2 /* IDENT_VALUE */: - var token = parser.parseComponentValue(); - return descriptor.parse(context, isIdentToken(token) ? token.value : descriptor.initialValue); - case 0 /* VALUE */: - return descriptor.parse(context, parser.parseComponentValue()); - case 1 /* LIST */: - return descriptor.parse(context, parser.parseComponentValues()); - case 4 /* TOKEN_VALUE */: - return parser.parseComponentValue(); - case 3 /* TYPE_VALUE */: - switch (descriptor.format) { - case 'angle': - return angle.parse(context, parser.parseComponentValue()); - case 'color': - return color$1.parse(context, parser.parseComponentValue()); - case 'image': - return image.parse(context, parser.parseComponentValue()); - case 'length': - var length_1 = parser.parseComponentValue(); - return isLength(length_1) ? length_1 : ZERO_LENGTH; - case 'length-percentage': - var value_1 = parser.parseComponentValue(); - return isLengthPercentage(value_1) ? value_1 : ZERO_LENGTH; - case 'time': - return time.parse(context, parser.parseComponentValue()); - } - break; - } - }; - - var elementDebuggerAttribute = 'data-html2canvas-debug'; - var getElementDebugType = function (element) { - var attribute = element.getAttribute(elementDebuggerAttribute); - switch (attribute) { - case 'all': - return 1 /* ALL */; - case 'clone': - return 2 /* CLONE */; - case 'parse': - return 3 /* PARSE */; - case 'render': - return 4 /* RENDER */; - default: - return 0 /* NONE */; - } - }; - var isDebugging = function (element, type) { - var elementType = getElementDebugType(element); - return elementType === 1 /* ALL */ || type === elementType; - }; - - var ElementContainer = /** @class */ (function () { - function ElementContainer(context, element) { - this.context = context; - this.textNodes = []; - this.elements = []; - this.flags = 0; - if (isDebugging(element, 3 /* PARSE */)) { - debugger; - } - this.styles = new CSSParsedDeclaration(context, window.getComputedStyle(element, null)); - if (isHTMLElementNode(element)) { - if (this.styles.animationDuration.some(function (duration) { return duration > 0; })) { - element.style.animationDuration = '0s'; - } - if (this.styles.transform !== null) { - // getBoundingClientRect takes transforms into account - element.style.transform = 'none'; - } - } - this.bounds = parseBounds(this.context, element); - if (isDebugging(element, 4 /* RENDER */)) { - this.flags |= 16 /* DEBUG_RENDER */; - } - } - return ElementContainer; - }()); - - /* - * text-segmentation 1.0.3 - * Copyright (c) 2022 Niklas von Hertzen - * Released under MIT License - */ - var base64 = 'AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA='; - - /* - * utrie 1.0.2 - * Copyright (c) 2022 Niklas von Hertzen - * Released under MIT License - */ - var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; - // Use a lookup table to find the index. - var lookup$1 = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256); - for (var i$1 = 0; i$1 < chars$1.length; i$1++) { - lookup$1[chars$1.charCodeAt(i$1)] = i$1; - } - var decode = function (base64) { - var bufferLength = base64.length * 0.75, len = base64.length, i, p = 0, encoded1, encoded2, encoded3, encoded4; - if (base64[base64.length - 1] === '=') { - bufferLength--; - if (base64[base64.length - 2] === '=') { - bufferLength--; - } - } - var buffer = typeof ArrayBuffer !== 'undefined' && - typeof Uint8Array !== 'undefined' && - typeof Uint8Array.prototype.slice !== 'undefined' - ? new ArrayBuffer(bufferLength) - : new Array(bufferLength); - var bytes = Array.isArray(buffer) ? buffer : new Uint8Array(buffer); - for (i = 0; i < len; i += 4) { - encoded1 = lookup$1[base64.charCodeAt(i)]; - encoded2 = lookup$1[base64.charCodeAt(i + 1)]; - encoded3 = lookup$1[base64.charCodeAt(i + 2)]; - encoded4 = lookup$1[base64.charCodeAt(i + 3)]; - bytes[p++] = (encoded1 << 2) | (encoded2 >> 4); - bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2); - bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63); - } - return buffer; - }; - var polyUint16Array = function (buffer) { - var length = buffer.length; - var bytes = []; - for (var i = 0; i < length; i += 2) { - bytes.push((buffer[i + 1] << 8) | buffer[i]); - } - return bytes; - }; - var polyUint32Array = function (buffer) { - var length = buffer.length; - var bytes = []; - for (var i = 0; i < length; i += 4) { - bytes.push((buffer[i + 3] << 24) | (buffer[i + 2] << 16) | (buffer[i + 1] << 8) | buffer[i]); - } - return bytes; - }; - - /** Shift size for getting the index-2 table offset. */ - var UTRIE2_SHIFT_2 = 5; - /** Shift size for getting the index-1 table offset. */ - var UTRIE2_SHIFT_1 = 6 + 5; - /** - * Shift size for shifting left the index array values. - * Increases possible data size with 16-bit index values at the cost - * of compactability. - * This requires data blocks to be aligned by UTRIE2_DATA_GRANULARITY. - */ - var UTRIE2_INDEX_SHIFT = 2; - /** - * Difference between the two shift sizes, - * for getting an index-1 offset from an index-2 offset. 6=11-5 - */ - var UTRIE2_SHIFT_1_2 = UTRIE2_SHIFT_1 - UTRIE2_SHIFT_2; - /** - * The part of the index-2 table for U+D800..U+DBFF stores values for - * lead surrogate code _units_ not code _points_. - * Values for lead surrogate code _points_ are indexed with this portion of the table. - * Length=32=0x20=0x400>>UTRIE2_SHIFT_2. (There are 1024=0x400 lead surrogates.) - */ - var UTRIE2_LSCP_INDEX_2_OFFSET = 0x10000 >> UTRIE2_SHIFT_2; - /** Number of entries in a data block. 32=0x20 */ - var UTRIE2_DATA_BLOCK_LENGTH = 1 << UTRIE2_SHIFT_2; - /** Mask for getting the lower bits for the in-data-block offset. */ - var UTRIE2_DATA_MASK = UTRIE2_DATA_BLOCK_LENGTH - 1; - var UTRIE2_LSCP_INDEX_2_LENGTH = 0x400 >> UTRIE2_SHIFT_2; - /** Count the lengths of both BMP pieces. 2080=0x820 */ - var UTRIE2_INDEX_2_BMP_LENGTH = UTRIE2_LSCP_INDEX_2_OFFSET + UTRIE2_LSCP_INDEX_2_LENGTH; - /** - * The 2-byte UTF-8 version of the index-2 table follows at offset 2080=0x820. - * Length 32=0x20 for lead bytes C0..DF, regardless of UTRIE2_SHIFT_2. - */ - var UTRIE2_UTF8_2B_INDEX_2_OFFSET = UTRIE2_INDEX_2_BMP_LENGTH; - var UTRIE2_UTF8_2B_INDEX_2_LENGTH = 0x800 >> 6; /* U+0800 is the first code point after 2-byte UTF-8 */ - /** - * The index-1 table, only used for supplementary code points, at offset 2112=0x840. - * Variable length, for code points up to highStart, where the last single-value range starts. - * Maximum length 512=0x200=0x100000>>UTRIE2_SHIFT_1. - * (For 0x100000 supplementary code points U+10000..U+10ffff.) - * - * The part of the index-2 table for supplementary code points starts - * after this index-1 table. - * - * Both the index-1 table and the following part of the index-2 table - * are omitted completely if there is only BMP data. - */ - var UTRIE2_INDEX_1_OFFSET = UTRIE2_UTF8_2B_INDEX_2_OFFSET + UTRIE2_UTF8_2B_INDEX_2_LENGTH; - /** - * Number of index-1 entries for the BMP. 32=0x20 - * This part of the index-1 table is omitted from the serialized form. - */ - var UTRIE2_OMITTED_BMP_INDEX_1_LENGTH = 0x10000 >> UTRIE2_SHIFT_1; - /** Number of entries in an index-2 block. 64=0x40 */ - var UTRIE2_INDEX_2_BLOCK_LENGTH = 1 << UTRIE2_SHIFT_1_2; - /** Mask for getting the lower bits for the in-index-2-block offset. */ - var UTRIE2_INDEX_2_MASK = UTRIE2_INDEX_2_BLOCK_LENGTH - 1; - var slice16 = function (view, start, end) { - if (view.slice) { - return view.slice(start, end); - } - return new Uint16Array(Array.prototype.slice.call(view, start, end)); - }; - var slice32 = function (view, start, end) { - if (view.slice) { - return view.slice(start, end); - } - return new Uint32Array(Array.prototype.slice.call(view, start, end)); - }; - var createTrieFromBase64 = function (base64, _byteLength) { - var buffer = decode(base64); - var view32 = Array.isArray(buffer) ? polyUint32Array(buffer) : new Uint32Array(buffer); - var view16 = Array.isArray(buffer) ? polyUint16Array(buffer) : new Uint16Array(buffer); - var headerLength = 24; - var index = slice16(view16, headerLength / 2, view32[4] / 2); - var data = view32[5] === 2 - ? slice16(view16, (headerLength + view32[4]) / 2) - : slice32(view32, Math.ceil((headerLength + view32[4]) / 4)); - return new Trie(view32[0], view32[1], view32[2], view32[3], index, data); - }; - var Trie = /** @class */ (function () { - function Trie(initialValue, errorValue, highStart, highValueIndex, index, data) { - this.initialValue = initialValue; - this.errorValue = errorValue; - this.highStart = highStart; - this.highValueIndex = highValueIndex; - this.index = index; - this.data = data; - } - /** - * Get the value for a code point as stored in the Trie. - * - * @param codePoint the code point - * @return the value - */ - Trie.prototype.get = function (codePoint) { - var ix; - if (codePoint >= 0) { - if (codePoint < 0x0d800 || (codePoint > 0x0dbff && codePoint <= 0x0ffff)) { - // Ordinary BMP code point, excluding leading surrogates. - // BMP uses a single level lookup. BMP index starts at offset 0 in the Trie2 index. - // 16 bit data is stored in the index array itself. - ix = this.index[codePoint >> UTRIE2_SHIFT_2]; - ix = (ix << UTRIE2_INDEX_SHIFT) + (codePoint & UTRIE2_DATA_MASK); - return this.data[ix]; - } - if (codePoint <= 0xffff) { - // Lead Surrogate Code Point. A Separate index section is stored for - // lead surrogate code units and code points. - // The main index has the code unit data. - // For this function, we need the code point data. - // Note: this expression could be refactored for slightly improved efficiency, but - // surrogate code points will be so rare in practice that it's not worth it. - ix = this.index[UTRIE2_LSCP_INDEX_2_OFFSET + ((codePoint - 0xd800) >> UTRIE2_SHIFT_2)]; - ix = (ix << UTRIE2_INDEX_SHIFT) + (codePoint & UTRIE2_DATA_MASK); - return this.data[ix]; - } - if (codePoint < this.highStart) { - // Supplemental code point, use two-level lookup. - ix = UTRIE2_INDEX_1_OFFSET - UTRIE2_OMITTED_BMP_INDEX_1_LENGTH + (codePoint >> UTRIE2_SHIFT_1); - ix = this.index[ix]; - ix += (codePoint >> UTRIE2_SHIFT_2) & UTRIE2_INDEX_2_MASK; - ix = this.index[ix]; - ix = (ix << UTRIE2_INDEX_SHIFT) + (codePoint & UTRIE2_DATA_MASK); - return this.data[ix]; - } - if (codePoint <= 0x10ffff) { - return this.data[this.highValueIndex]; - } - } - // Fall through. The code point is outside of the legal range of 0..0x10ffff. - return this.errorValue; - }; - return Trie; - }()); - - /* - * base64-arraybuffer 1.0.2 - * Copyright (c) 2022 Niklas von Hertzen - * Released under MIT License - */ - var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; - // Use a lookup table to find the index. - var lookup = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256); - for (var i = 0; i < chars.length; i++) { - lookup[chars.charCodeAt(i)] = i; - } - - var Prepend = 1; - var CR = 2; - var LF = 3; - var Control = 4; - var Extend = 5; - var SpacingMark = 7; - var L = 8; - var V = 9; - var T = 10; - var LV = 11; - var LVT = 12; - var ZWJ = 13; - var Extended_Pictographic = 14; - var RI = 15; - var toCodePoints = function (str) { - var codePoints = []; - var i = 0; - var length = str.length; - while (i < length) { - var value = str.charCodeAt(i++); - if (value >= 0xd800 && value <= 0xdbff && i < length) { - var extra = str.charCodeAt(i++); - if ((extra & 0xfc00) === 0xdc00) { - codePoints.push(((value & 0x3ff) << 10) + (extra & 0x3ff) + 0x10000); - } - else { - codePoints.push(value); - i--; - } - } - else { - codePoints.push(value); - } - } - return codePoints; - }; - var fromCodePoint = function () { - var codePoints = []; - for (var _i = 0; _i < arguments.length; _i++) { - codePoints[_i] = arguments[_i]; - } - if (String.fromCodePoint) { - return String.fromCodePoint.apply(String, codePoints); - } - var length = codePoints.length; - if (!length) { - return ''; - } - var codeUnits = []; - var index = -1; - var result = ''; - while (++index < length) { - var codePoint = codePoints[index]; - if (codePoint <= 0xffff) { - codeUnits.push(codePoint); - } - else { - codePoint -= 0x10000; - codeUnits.push((codePoint >> 10) + 0xd800, (codePoint % 0x400) + 0xdc00); - } - if (index + 1 === length || codeUnits.length > 0x4000) { - result += String.fromCharCode.apply(String, codeUnits); - codeUnits.length = 0; - } - } - return result; - }; - var UnicodeTrie = createTrieFromBase64(base64); - var BREAK_NOT_ALLOWED = '×'; - var BREAK_ALLOWED = '÷'; - var codePointToClass = function (codePoint) { return UnicodeTrie.get(codePoint); }; - var _graphemeBreakAtIndex = function (_codePoints, classTypes, index) { - var prevIndex = index - 2; - var prev = classTypes[prevIndex]; - var current = classTypes[index - 1]; - var next = classTypes[index]; - // GB3 Do not break between a CR and LF - if (current === CR && next === LF) { - return BREAK_NOT_ALLOWED; - } - // GB4 Otherwise, break before and after controls. - if (current === CR || current === LF || current === Control) { - return BREAK_ALLOWED; - } - // GB5 - if (next === CR || next === LF || next === Control) { - return BREAK_ALLOWED; - } - // Do not break Hangul syllable sequences. - // GB6 - if (current === L && [L, V, LV, LVT].indexOf(next) !== -1) { - return BREAK_NOT_ALLOWED; - } - // GB7 - if ((current === LV || current === V) && (next === V || next === T)) { - return BREAK_NOT_ALLOWED; - } - // GB8 - if ((current === LVT || current === T) && next === T) { - return BREAK_NOT_ALLOWED; - } - // GB9 Do not break before extending characters or ZWJ. - if (next === ZWJ || next === Extend) { - return BREAK_NOT_ALLOWED; - } - // Do not break before SpacingMarks, or after Prepend characters. - // GB9a - if (next === SpacingMark) { - return BREAK_NOT_ALLOWED; - } - // GB9a - if (current === Prepend) { - return BREAK_NOT_ALLOWED; - } - // GB11 Do not break within emoji modifier sequences or emoji zwj sequences. - if (current === ZWJ && next === Extended_Pictographic) { - while (prev === Extend) { - prev = classTypes[--prevIndex]; - } - if (prev === Extended_Pictographic) { - return BREAK_NOT_ALLOWED; - } - } - // GB12 Do not break within emoji flag sequences. - // That is, do not break between regional indicator (RI) symbols - // if there is an odd number of RI characters before the break point. - if (current === RI && next === RI) { - var countRI = 0; - while (prev === RI) { - countRI++; - prev = classTypes[--prevIndex]; - } - if (countRI % 2 === 0) { - return BREAK_NOT_ALLOWED; - } - } - return BREAK_ALLOWED; - }; - var GraphemeBreaker = function (str) { - var codePoints = toCodePoints(str); - var length = codePoints.length; - var index = 0; - var lastEnd = 0; - var classTypes = codePoints.map(codePointToClass); - return { - next: function () { - if (index >= length) { - return { done: true, value: null }; - } - var graphemeBreak = BREAK_NOT_ALLOWED; - while (index < length && - (graphemeBreak = _graphemeBreakAtIndex(codePoints, classTypes, ++index)) === BREAK_NOT_ALLOWED) { } - if (graphemeBreak !== BREAK_NOT_ALLOWED || index === length) { - var value = fromCodePoint.apply(null, codePoints.slice(lastEnd, index)); - lastEnd = index; - return { value: value, done: false }; - } - return { done: true, value: null }; - }, - }; - }; - var splitGraphemes = function (str) { - var breaker = GraphemeBreaker(str); - var graphemes = []; - var bk; - while (!(bk = breaker.next()).done) { - if (bk.value) { - graphemes.push(bk.value.slice()); - } - } - return graphemes; - }; - - var testRangeBounds = function (document) { - var TEST_HEIGHT = 123; - if (document.createRange) { - var range = document.createRange(); - if (range.getBoundingClientRect) { - var testElement = document.createElement('boundtest'); - testElement.style.height = TEST_HEIGHT + "px"; - testElement.style.display = 'block'; - document.body.appendChild(testElement); - range.selectNode(testElement); - var rangeBounds = range.getBoundingClientRect(); - var rangeHeight = Math.round(rangeBounds.height); - document.body.removeChild(testElement); - if (rangeHeight === TEST_HEIGHT) { - return true; - } - } - } - return false; - }; - var testIOSLineBreak = function (document) { - var testElement = document.createElement('boundtest'); - testElement.style.width = '50px'; - testElement.style.display = 'block'; - testElement.style.fontSize = '12px'; - testElement.style.letterSpacing = '0px'; - testElement.style.wordSpacing = '0px'; - document.body.appendChild(testElement); - var range = document.createRange(); - testElement.innerHTML = typeof ''.repeat === 'function' ? '👨'.repeat(10) : ''; - var node = testElement.firstChild; - var textList = toCodePoints$1(node.data).map(function (i) { return fromCodePoint$1(i); }); - var offset = 0; - var prev = {}; - // ios 13 does not handle range getBoundingClientRect line changes correctly #2177 - var supports = textList.every(function (text, i) { - range.setStart(node, offset); - range.setEnd(node, offset + text.length); - var rect = range.getBoundingClientRect(); - offset += text.length; - var boundAhead = rect.x > prev.x || rect.y > prev.y; - prev = rect; - if (i === 0) { - return true; - } - return boundAhead; - }); - document.body.removeChild(testElement); - return supports; - }; - var testCORS = function () { return typeof new Image().crossOrigin !== 'undefined'; }; - var testResponseType = function () { return typeof new XMLHttpRequest().responseType === 'string'; }; - var testSVG = function (document) { - var img = new Image(); - var canvas = document.createElement('canvas'); - var ctx = canvas.getContext('2d'); - if (!ctx) { - return false; - } - img.src = "data:image/svg+xml,"; - try { - ctx.drawImage(img, 0, 0); - canvas.toDataURL(); - } - catch (e) { - return false; - } - return true; - }; - var isGreenPixel = function (data) { - return data[0] === 0 && data[1] === 255 && data[2] === 0 && data[3] === 255; - }; - var testForeignObject = function (document) { - var canvas = document.createElement('canvas'); - var size = 100; - canvas.width = size; - canvas.height = size; - var ctx = canvas.getContext('2d'); - if (!ctx) { - return Promise.reject(false); - } - ctx.fillStyle = 'rgb(0, 255, 0)'; - ctx.fillRect(0, 0, size, size); - var img = new Image(); - var greenImageSrc = canvas.toDataURL(); - img.src = greenImageSrc; - var svg = createForeignObjectSVG(size, size, 0, 0, img); - ctx.fillStyle = 'red'; - ctx.fillRect(0, 0, size, size); - return loadSerializedSVG$1(svg) - .then(function (img) { - ctx.drawImage(img, 0, 0); - var data = ctx.getImageData(0, 0, size, size).data; - ctx.fillStyle = 'red'; - ctx.fillRect(0, 0, size, size); - var node = document.createElement('div'); - node.style.backgroundImage = "url(" + greenImageSrc + ")"; - node.style.height = size + "px"; - // Firefox 55 does not render inline tags - return isGreenPixel(data) - ? loadSerializedSVG$1(createForeignObjectSVG(size, size, 0, 0, node)) - : Promise.reject(false); - }) - .then(function (img) { - ctx.drawImage(img, 0, 0); - // Edge does not render background-images - return isGreenPixel(ctx.getImageData(0, 0, size, size).data); - }) - .catch(function () { return false; }); - }; - var createForeignObjectSVG = function (width, height, x, y, node) { - var xmlns = 'http://www.w3.org/2000/svg'; - var svg = document.createElementNS(xmlns, 'svg'); - var foreignObject = document.createElementNS(xmlns, 'foreignObject'); - svg.setAttributeNS(null, 'width', width.toString()); - svg.setAttributeNS(null, 'height', height.toString()); - foreignObject.setAttributeNS(null, 'width', '100%'); - foreignObject.setAttributeNS(null, 'height', '100%'); - foreignObject.setAttributeNS(null, 'x', x.toString()); - foreignObject.setAttributeNS(null, 'y', y.toString()); - foreignObject.setAttributeNS(null, 'externalResourcesRequired', 'true'); - svg.appendChild(foreignObject); - foreignObject.appendChild(node); - return svg; - }; - var loadSerializedSVG$1 = function (svg) { - return new Promise(function (resolve, reject) { - var img = new Image(); - img.onload = function () { return resolve(img); }; - img.onerror = reject; - img.src = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(new XMLSerializer().serializeToString(svg)); - }); - }; - var FEATURES = { - get SUPPORT_RANGE_BOUNDS() { - var value = testRangeBounds(document); - Object.defineProperty(FEATURES, 'SUPPORT_RANGE_BOUNDS', { value: value }); - return value; - }, - get SUPPORT_WORD_BREAKING() { - var value = FEATURES.SUPPORT_RANGE_BOUNDS && testIOSLineBreak(document); - Object.defineProperty(FEATURES, 'SUPPORT_WORD_BREAKING', { value: value }); - return value; - }, - get SUPPORT_SVG_DRAWING() { - var value = testSVG(document); - Object.defineProperty(FEATURES, 'SUPPORT_SVG_DRAWING', { value: value }); - return value; - }, - get SUPPORT_FOREIGNOBJECT_DRAWING() { - var value = typeof Array.from === 'function' && typeof window.fetch === 'function' - ? testForeignObject(document) - : Promise.resolve(false); - Object.defineProperty(FEATURES, 'SUPPORT_FOREIGNOBJECT_DRAWING', { value: value }); - return value; - }, - get SUPPORT_CORS_IMAGES() { - var value = testCORS(); - Object.defineProperty(FEATURES, 'SUPPORT_CORS_IMAGES', { value: value }); - return value; - }, - get SUPPORT_RESPONSE_TYPE() { - var value = testResponseType(); - Object.defineProperty(FEATURES, 'SUPPORT_RESPONSE_TYPE', { value: value }); - return value; - }, - get SUPPORT_CORS_XHR() { - var value = 'withCredentials' in new XMLHttpRequest(); - Object.defineProperty(FEATURES, 'SUPPORT_CORS_XHR', { value: value }); - return value; - }, - get SUPPORT_NATIVE_TEXT_SEGMENTATION() { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - var value = !!(typeof Intl !== 'undefined' && Intl.Segmenter); - Object.defineProperty(FEATURES, 'SUPPORT_NATIVE_TEXT_SEGMENTATION', { value: value }); - return value; - } - }; - - var TextBounds = /** @class */ (function () { - function TextBounds(text, bounds) { - this.text = text; - this.bounds = bounds; - } - return TextBounds; - }()); - var parseTextBounds = function (context, value, styles, node) { - var textList = breakText(value, styles); - var textBounds = []; - var offset = 0; - textList.forEach(function (text) { - if (styles.textDecorationLine.length || text.trim().length > 0) { - if (FEATURES.SUPPORT_RANGE_BOUNDS) { - var clientRects = createRange(node, offset, text.length).getClientRects(); - if (clientRects.length > 1) { - var subSegments = segmentGraphemes(text); - var subOffset_1 = 0; - subSegments.forEach(function (subSegment) { - textBounds.push(new TextBounds(subSegment, Bounds.fromDOMRectList(context, createRange(node, subOffset_1 + offset, subSegment.length).getClientRects()))); - subOffset_1 += subSegment.length; - }); - } - else { - textBounds.push(new TextBounds(text, Bounds.fromDOMRectList(context, clientRects))); - } - } - else { - var replacementNode = node.splitText(text.length); - textBounds.push(new TextBounds(text, getWrapperBounds(context, node))); - node = replacementNode; - } - } - else if (!FEATURES.SUPPORT_RANGE_BOUNDS) { - node = node.splitText(text.length); - } - offset += text.length; - }); - return textBounds; - }; - var getWrapperBounds = function (context, node) { - var ownerDocument = node.ownerDocument; - if (ownerDocument) { - var wrapper = ownerDocument.createElement('html2canvaswrapper'); - wrapper.appendChild(node.cloneNode(true)); - var parentNode = node.parentNode; - if (parentNode) { - parentNode.replaceChild(wrapper, node); - var bounds = parseBounds(context, wrapper); - if (wrapper.firstChild) { - parentNode.replaceChild(wrapper.firstChild, wrapper); - } - return bounds; - } - } - return Bounds.EMPTY; - }; - var createRange = function (node, offset, length) { - var ownerDocument = node.ownerDocument; - if (!ownerDocument) { - throw new Error('Node has no owner document'); - } - var range = ownerDocument.createRange(); - range.setStart(node, offset); - range.setEnd(node, offset + length); - return range; - }; - var segmentGraphemes = function (value) { - if (FEATURES.SUPPORT_NATIVE_TEXT_SEGMENTATION) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - var segmenter = new Intl.Segmenter(void 0, { granularity: 'grapheme' }); - // eslint-disable-next-line @typescript-eslint/no-explicit-any - return Array.from(segmenter.segment(value)).map(function (segment) { return segment.segment; }); - } - return splitGraphemes(value); - }; - var segmentWords = function (value, styles) { - if (FEATURES.SUPPORT_NATIVE_TEXT_SEGMENTATION) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - var segmenter = new Intl.Segmenter(void 0, { - granularity: 'word' - }); - // eslint-disable-next-line @typescript-eslint/no-explicit-any - return Array.from(segmenter.segment(value)).map(function (segment) { return segment.segment; }); - } - return breakWords(value, styles); - }; - var breakText = function (value, styles) { - return styles.letterSpacing !== 0 ? segmentGraphemes(value) : segmentWords(value, styles); - }; - // https://drafts.csswg.org/css-text/#word-separator - var wordSeparators = [0x0020, 0x00a0, 0x1361, 0x10100, 0x10101, 0x1039, 0x1091]; - var breakWords = function (str, styles) { - var breaker = LineBreaker(str, { - lineBreak: styles.lineBreak, - wordBreak: styles.overflowWrap === "break-word" /* BREAK_WORD */ ? 'break-word' : styles.wordBreak - }); - var words = []; - var bk; - var _loop_1 = function () { - if (bk.value) { - var value = bk.value.slice(); - var codePoints = toCodePoints$1(value); - var word_1 = ''; - codePoints.forEach(function (codePoint) { - if (wordSeparators.indexOf(codePoint) === -1) { - word_1 += fromCodePoint$1(codePoint); - } - else { - if (word_1.length) { - words.push(word_1); - } - words.push(fromCodePoint$1(codePoint)); - word_1 = ''; - } - }); - if (word_1.length) { - words.push(word_1); - } - } - }; - while (!(bk = breaker.next()).done) { - _loop_1(); - } - return words; - }; - - var TextContainer = /** @class */ (function () { - function TextContainer(context, node, styles) { - this.text = transform(node.data, styles.textTransform); - this.textBounds = parseTextBounds(context, this.text, styles, node); - } - return TextContainer; - }()); - var transform = function (text, transform) { - switch (transform) { - case 1 /* LOWERCASE */: - return text.toLowerCase(); - case 3 /* CAPITALIZE */: - return text.replace(CAPITALIZE, capitalize); - case 2 /* UPPERCASE */: - return text.toUpperCase(); - default: - return text; - } - }; - var CAPITALIZE = /(^|\s|:|-|\(|\))([a-z])/g; - var capitalize = function (m, p1, p2) { - if (m.length > 0) { - return p1 + p2.toUpperCase(); - } - return m; - }; - - var ImageElementContainer = /** @class */ (function (_super) { - __extends(ImageElementContainer, _super); - function ImageElementContainer(context, img) { - var _this = _super.call(this, context, img) || this; - _this.src = img.currentSrc || img.src; - _this.intrinsicWidth = img.naturalWidth; - _this.intrinsicHeight = img.naturalHeight; - _this.context.cache.addImage(_this.src); - return _this; - } - return ImageElementContainer; - }(ElementContainer)); - - var CanvasElementContainer = /** @class */ (function (_super) { - __extends(CanvasElementContainer, _super); - function CanvasElementContainer(context, canvas) { - var _this = _super.call(this, context, canvas) || this; - _this.canvas = canvas; - _this.intrinsicWidth = canvas.width; - _this.intrinsicHeight = canvas.height; - return _this; - } - return CanvasElementContainer; - }(ElementContainer)); - - var SVGElementContainer = /** @class */ (function (_super) { - __extends(SVGElementContainer, _super); - function SVGElementContainer(context, img) { - var _this = _super.call(this, context, img) || this; - var s = new XMLSerializer(); - var bounds = parseBounds(context, img); - img.setAttribute('width', bounds.width + "px"); - img.setAttribute('height', bounds.height + "px"); - _this.svg = "data:image/svg+xml," + encodeURIComponent(s.serializeToString(img)); - _this.intrinsicWidth = img.width.baseVal.value; - _this.intrinsicHeight = img.height.baseVal.value; - _this.context.cache.addImage(_this.svg); - return _this; - } - return SVGElementContainer; - }(ElementContainer)); - - var LIElementContainer = /** @class */ (function (_super) { - __extends(LIElementContainer, _super); - function LIElementContainer(context, element) { - var _this = _super.call(this, context, element) || this; - _this.value = element.value; - return _this; - } - return LIElementContainer; - }(ElementContainer)); - - var OLElementContainer = /** @class */ (function (_super) { - __extends(OLElementContainer, _super); - function OLElementContainer(context, element) { - var _this = _super.call(this, context, element) || this; - _this.start = element.start; - _this.reversed = typeof element.reversed === 'boolean' && element.reversed === true; - return _this; - } - return OLElementContainer; - }(ElementContainer)); - - var CHECKBOX_BORDER_RADIUS = [ - { - type: 15 /* DIMENSION_TOKEN */, - flags: 0, - unit: 'px', - number: 3 - } - ]; - var RADIO_BORDER_RADIUS = [ - { - type: 16 /* PERCENTAGE_TOKEN */, - flags: 0, - number: 50 - } - ]; - var reformatInputBounds = function (bounds) { - if (bounds.width > bounds.height) { - return new Bounds(bounds.left + (bounds.width - bounds.height) / 2, bounds.top, bounds.height, bounds.height); - } - else if (bounds.width < bounds.height) { - return new Bounds(bounds.left, bounds.top + (bounds.height - bounds.width) / 2, bounds.width, bounds.width); - } - return bounds; - }; - var getInputValue = function (node) { - var value = node.type === PASSWORD ? new Array(node.value.length + 1).join('\u2022') : node.value; - return value.length === 0 ? node.placeholder || '' : value; - }; - var CHECKBOX = 'checkbox'; - var RADIO = 'radio'; - var PASSWORD = 'password'; - var INPUT_COLOR = 0x2a2a2aff; - var InputElementContainer = /** @class */ (function (_super) { - __extends(InputElementContainer, _super); - function InputElementContainer(context, input) { - var _this = _super.call(this, context, input) || this; - _this.type = input.type.toLowerCase(); - _this.checked = input.checked; - _this.value = getInputValue(input); - if (_this.type === CHECKBOX || _this.type === RADIO) { - _this.styles.backgroundColor = 0xdededeff; - _this.styles.borderTopColor = - _this.styles.borderRightColor = - _this.styles.borderBottomColor = - _this.styles.borderLeftColor = - 0xa5a5a5ff; - _this.styles.borderTopWidth = - _this.styles.borderRightWidth = - _this.styles.borderBottomWidth = - _this.styles.borderLeftWidth = - 1; - _this.styles.borderTopStyle = - _this.styles.borderRightStyle = - _this.styles.borderBottomStyle = - _this.styles.borderLeftStyle = - 1 /* SOLID */; - _this.styles.backgroundClip = [0 /* BORDER_BOX */]; - _this.styles.backgroundOrigin = [0 /* BORDER_BOX */]; - _this.bounds = reformatInputBounds(_this.bounds); - } - switch (_this.type) { - case CHECKBOX: - _this.styles.borderTopRightRadius = - _this.styles.borderTopLeftRadius = - _this.styles.borderBottomRightRadius = - _this.styles.borderBottomLeftRadius = - CHECKBOX_BORDER_RADIUS; - break; - case RADIO: - _this.styles.borderTopRightRadius = - _this.styles.borderTopLeftRadius = - _this.styles.borderBottomRightRadius = - _this.styles.borderBottomLeftRadius = - RADIO_BORDER_RADIUS; - break; - } - return _this; - } - return InputElementContainer; - }(ElementContainer)); - - var SelectElementContainer = /** @class */ (function (_super) { - __extends(SelectElementContainer, _super); - function SelectElementContainer(context, element) { - var _this = _super.call(this, context, element) || this; - var option = element.options[element.selectedIndex || 0]; - _this.value = option ? option.text || '' : ''; - return _this; - } - return SelectElementContainer; - }(ElementContainer)); - - var TextareaElementContainer = /** @class */ (function (_super) { - __extends(TextareaElementContainer, _super); - function TextareaElementContainer(context, element) { - var _this = _super.call(this, context, element) || this; - _this.value = element.value; - return _this; - } - return TextareaElementContainer; - }(ElementContainer)); - - var IFrameElementContainer = /** @class */ (function (_super) { - __extends(IFrameElementContainer, _super); - function IFrameElementContainer(context, iframe) { - var _this = _super.call(this, context, iframe) || this; - _this.src = iframe.src; - _this.width = parseInt(iframe.width, 10) || 0; - _this.height = parseInt(iframe.height, 10) || 0; - _this.backgroundColor = _this.styles.backgroundColor; - try { - if (iframe.contentWindow && - iframe.contentWindow.document && - iframe.contentWindow.document.documentElement) { - _this.tree = parseTree(context, iframe.contentWindow.document.documentElement); - // http://www.w3.org/TR/css3-background/#special-backgrounds - var documentBackgroundColor = iframe.contentWindow.document.documentElement - ? parseColor(context, getComputedStyle(iframe.contentWindow.document.documentElement).backgroundColor) - : COLORS.TRANSPARENT; - var bodyBackgroundColor = iframe.contentWindow.document.body - ? parseColor(context, getComputedStyle(iframe.contentWindow.document.body).backgroundColor) - : COLORS.TRANSPARENT; - _this.backgroundColor = isTransparent(documentBackgroundColor) - ? isTransparent(bodyBackgroundColor) - ? _this.styles.backgroundColor - : bodyBackgroundColor - : documentBackgroundColor; - } - } - catch (e) { } - return _this; - } - return IFrameElementContainer; - }(ElementContainer)); - - var LIST_OWNERS = ['OL', 'UL', 'MENU']; - var parseNodeTree = function (context, node, parent, root) { - for (var childNode = node.firstChild, nextNode = void 0; childNode; childNode = nextNode) { - nextNode = childNode.nextSibling; - if (isTextNode(childNode) && childNode.data.trim().length > 0) { - parent.textNodes.push(new TextContainer(context, childNode, parent.styles)); - } - else if (isElementNode(childNode)) { - if (isSlotElement(childNode) && childNode.assignedNodes) { - childNode.assignedNodes().forEach(function (childNode) { return parseNodeTree(context, childNode, parent, root); }); - } - else { - var container = createContainer(context, childNode); - if (container.styles.isVisible()) { - if (createsRealStackingContext(childNode, container, root)) { - container.flags |= 4 /* CREATES_REAL_STACKING_CONTEXT */; - } - else if (createsStackingContext(container.styles)) { - container.flags |= 2 /* CREATES_STACKING_CONTEXT */; - } - if (LIST_OWNERS.indexOf(childNode.tagName) !== -1) { - container.flags |= 8 /* IS_LIST_OWNER */; - } - parent.elements.push(container); - childNode.slot; - if (childNode.shadowRoot) { - parseNodeTree(context, childNode.shadowRoot, container, root); - } - else if (!isTextareaElement(childNode) && - !isSVGElement(childNode) && - !isSelectElement(childNode)) { - parseNodeTree(context, childNode, container, root); - } - } - } - } - } - }; - var createContainer = function (context, element) { - if (isImageElement(element)) { - return new ImageElementContainer(context, element); - } - if (isCanvasElement(element)) { - return new CanvasElementContainer(context, element); - } - if (isSVGElement(element)) { - return new SVGElementContainer(context, element); - } - if (isLIElement(element)) { - return new LIElementContainer(context, element); - } - if (isOLElement(element)) { - return new OLElementContainer(context, element); - } - if (isInputElement(element)) { - return new InputElementContainer(context, element); - } - if (isSelectElement(element)) { - return new SelectElementContainer(context, element); - } - if (isTextareaElement(element)) { - return new TextareaElementContainer(context, element); - } - if (isIFrameElement(element)) { - return new IFrameElementContainer(context, element); - } - return new ElementContainer(context, element); - }; - var parseTree = function (context, element) { - var container = createContainer(context, element); - container.flags |= 4 /* CREATES_REAL_STACKING_CONTEXT */; - parseNodeTree(context, element, container, container); - return container; - }; - var createsRealStackingContext = function (node, container, root) { - return (container.styles.isPositionedWithZIndex() || - container.styles.opacity < 1 || - container.styles.isTransformed() || - (isBodyElement(node) && root.styles.isTransparent())); - }; - var createsStackingContext = function (styles) { return styles.isPositioned() || styles.isFloating(); }; - var isTextNode = function (node) { return node.nodeType === Node.TEXT_NODE; }; - var isElementNode = function (node) { return node.nodeType === Node.ELEMENT_NODE; }; - var isHTMLElementNode = function (node) { - return isElementNode(node) && typeof node.style !== 'undefined' && !isSVGElementNode(node); - }; - var isSVGElementNode = function (element) { - return typeof element.className === 'object'; - }; - var isLIElement = function (node) { return node.tagName === 'LI'; }; - var isOLElement = function (node) { return node.tagName === 'OL'; }; - var isInputElement = function (node) { return node.tagName === 'INPUT'; }; - var isHTMLElement = function (node) { return node.tagName === 'HTML'; }; - var isSVGElement = function (node) { return node.tagName === 'svg'; }; - var isBodyElement = function (node) { return node.tagName === 'BODY'; }; - var isCanvasElement = function (node) { return node.tagName === 'CANVAS'; }; - var isVideoElement = function (node) { return node.tagName === 'VIDEO'; }; - var isImageElement = function (node) { return node.tagName === 'IMG'; }; - var isIFrameElement = function (node) { return node.tagName === 'IFRAME'; }; - var isStyleElement = function (node) { return node.tagName === 'STYLE'; }; - var isScriptElement = function (node) { return node.tagName === 'SCRIPT'; }; - var isTextareaElement = function (node) { return node.tagName === 'TEXTAREA'; }; - var isSelectElement = function (node) { return node.tagName === 'SELECT'; }; - var isSlotElement = function (node) { return node.tagName === 'SLOT'; }; - // https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name - var isCustomElement = function (node) { return node.tagName.indexOf('-') > 0; }; - - var CounterState = /** @class */ (function () { - function CounterState() { - this.counters = {}; - } - CounterState.prototype.getCounterValue = function (name) { - var counter = this.counters[name]; - if (counter && counter.length) { - return counter[counter.length - 1]; - } - return 1; - }; - CounterState.prototype.getCounterValues = function (name) { - var counter = this.counters[name]; - return counter ? counter : []; - }; - CounterState.prototype.pop = function (counters) { - var _this = this; - counters.forEach(function (counter) { return _this.counters[counter].pop(); }); - }; - CounterState.prototype.parse = function (style) { - var _this = this; - var counterIncrement = style.counterIncrement; - var counterReset = style.counterReset; - var canReset = true; - if (counterIncrement !== null) { - counterIncrement.forEach(function (entry) { - var counter = _this.counters[entry.counter]; - if (counter && entry.increment !== 0) { - canReset = false; - if (!counter.length) { - counter.push(1); - } - counter[Math.max(0, counter.length - 1)] += entry.increment; - } - }); - } - var counterNames = []; - if (canReset) { - counterReset.forEach(function (entry) { - var counter = _this.counters[entry.counter]; - counterNames.push(entry.counter); - if (!counter) { - counter = _this.counters[entry.counter] = []; - } - counter.push(entry.reset); - }); - } - return counterNames; - }; - return CounterState; - }()); - var ROMAN_UPPER = { - integers: [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1], - values: ['M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I'] - }; - var ARMENIAN = { - integers: [ - 9000, 8000, 7000, 6000, 5000, 4000, 3000, 2000, 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, - 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 - ], - values: [ - 'Ք', - 'Փ', - 'Ւ', - 'Ց', - 'Ր', - 'Տ', - 'Վ', - 'Ս', - 'Ռ', - 'Ջ', - 'Պ', - 'Չ', - 'Ո', - 'Շ', - 'Ն', - 'Յ', - 'Մ', - 'Ճ', - 'Ղ', - 'Ձ', - 'Հ', - 'Կ', - 'Ծ', - 'Խ', - 'Լ', - 'Ի', - 'Ժ', - 'Թ', - 'Ը', - 'Է', - 'Զ', - 'Ե', - 'Դ', - 'Գ', - 'Բ', - 'Ա' - ] - }; - var HEBREW = { - integers: [ - 10000, 9000, 8000, 7000, 6000, 5000, 4000, 3000, 2000, 1000, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, - 19, 18, 17, 16, 15, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 - ], - values: [ - 'י׳', - 'ט׳', - 'ח׳', - 'ז׳', - 'ו׳', - 'ה׳', - 'ד׳', - 'ג׳', - 'ב׳', - 'א׳', - 'ת', - 'ש', - 'ר', - 'ק', - 'צ', - 'פ', - 'ע', - 'ס', - 'נ', - 'מ', - 'ל', - 'כ', - 'יט', - 'יח', - 'יז', - 'טז', - 'טו', - 'י', - 'ט', - 'ח', - 'ז', - 'ו', - 'ה', - 'ד', - 'ג', - 'ב', - 'א' - ] - }; - var GEORGIAN = { - integers: [ - 10000, 9000, 8000, 7000, 6000, 5000, 4000, 3000, 2000, 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, - 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 - ], - values: [ - 'ჵ', - 'ჰ', - 'ჯ', - 'ჴ', - 'ხ', - 'ჭ', - 'წ', - 'ძ', - 'ც', - 'ჩ', - 'შ', - 'ყ', - 'ღ', - 'ქ', - 'ფ', - 'ჳ', - 'ტ', - 'ს', - 'რ', - 'ჟ', - 'პ', - 'ო', - 'ჲ', - 'ნ', - 'მ', - 'ლ', - 'კ', - 'ი', - 'თ', - 'ჱ', - 'ზ', - 'ვ', - 'ე', - 'დ', - 'გ', - 'ბ', - 'ა' - ] - }; - var createAdditiveCounter = function (value, min, max, symbols, fallback, suffix) { - if (value < min || value > max) { - return createCounterText(value, fallback, suffix.length > 0); - } - return (symbols.integers.reduce(function (string, integer, index) { - while (value >= integer) { - value -= integer; - string += symbols.values[index]; - } - return string; - }, '') + suffix); - }; - var createCounterStyleWithSymbolResolver = function (value, codePointRangeLength, isNumeric, resolver) { - var string = ''; - do { - if (!isNumeric) { - value--; - } - string = resolver(value) + string; - value /= codePointRangeLength; - } while (value * codePointRangeLength >= codePointRangeLength); - return string; - }; - var createCounterStyleFromRange = function (value, codePointRangeStart, codePointRangeEnd, isNumeric, suffix) { - var codePointRangeLength = codePointRangeEnd - codePointRangeStart + 1; - return ((value < 0 ? '-' : '') + - (createCounterStyleWithSymbolResolver(Math.abs(value), codePointRangeLength, isNumeric, function (codePoint) { - return fromCodePoint$1(Math.floor(codePoint % codePointRangeLength) + codePointRangeStart); - }) + - suffix)); - }; - var createCounterStyleFromSymbols = function (value, symbols, suffix) { - if (suffix === void 0) { suffix = '. '; } - var codePointRangeLength = symbols.length; - return (createCounterStyleWithSymbolResolver(Math.abs(value), codePointRangeLength, false, function (codePoint) { return symbols[Math.floor(codePoint % codePointRangeLength)]; }) + suffix); - }; - var CJK_ZEROS = 1 << 0; - var CJK_TEN_COEFFICIENTS = 1 << 1; - var CJK_TEN_HIGH_COEFFICIENTS = 1 << 2; - var CJK_HUNDRED_COEFFICIENTS = 1 << 3; - var createCJKCounter = function (value, numbers, multipliers, negativeSign, suffix, flags) { - if (value < -9999 || value > 9999) { - return createCounterText(value, 4 /* CJK_DECIMAL */, suffix.length > 0); - } - var tmp = Math.abs(value); - var string = suffix; - if (tmp === 0) { - return numbers[0] + string; - } - for (var digit = 0; tmp > 0 && digit <= 4; digit++) { - var coefficient = tmp % 10; - if (coefficient === 0 && contains(flags, CJK_ZEROS) && string !== '') { - string = numbers[coefficient] + string; - } - else if (coefficient > 1 || - (coefficient === 1 && digit === 0) || - (coefficient === 1 && digit === 1 && contains(flags, CJK_TEN_COEFFICIENTS)) || - (coefficient === 1 && digit === 1 && contains(flags, CJK_TEN_HIGH_COEFFICIENTS) && value > 100) || - (coefficient === 1 && digit > 1 && contains(flags, CJK_HUNDRED_COEFFICIENTS))) { - string = numbers[coefficient] + (digit > 0 ? multipliers[digit - 1] : '') + string; - } - else if (coefficient === 1 && digit > 0) { - string = multipliers[digit - 1] + string; - } - tmp = Math.floor(tmp / 10); - } - return (value < 0 ? negativeSign : '') + string; - }; - var CHINESE_INFORMAL_MULTIPLIERS = '十百千萬'; - var CHINESE_FORMAL_MULTIPLIERS = '拾佰仟萬'; - var JAPANESE_NEGATIVE = 'マイナス'; - var KOREAN_NEGATIVE = '마이너스'; - var createCounterText = function (value, type, appendSuffix) { - var defaultSuffix = appendSuffix ? '. ' : ''; - var cjkSuffix = appendSuffix ? '、' : ''; - var koreanSuffix = appendSuffix ? ', ' : ''; - var spaceSuffix = appendSuffix ? ' ' : ''; - switch (type) { - case 0 /* DISC */: - return '•' + spaceSuffix; - case 1 /* CIRCLE */: - return '◦' + spaceSuffix; - case 2 /* SQUARE */: - return '◾' + spaceSuffix; - case 5 /* DECIMAL_LEADING_ZERO */: - var string = createCounterStyleFromRange(value, 48, 57, true, defaultSuffix); - return string.length < 4 ? "0" + string : string; - case 4 /* CJK_DECIMAL */: - return createCounterStyleFromSymbols(value, '〇一二三四五六七八九', cjkSuffix); - case 6 /* LOWER_ROMAN */: - return createAdditiveCounter(value, 1, 3999, ROMAN_UPPER, 3 /* DECIMAL */, defaultSuffix).toLowerCase(); - case 7 /* UPPER_ROMAN */: - return createAdditiveCounter(value, 1, 3999, ROMAN_UPPER, 3 /* DECIMAL */, defaultSuffix); - case 8 /* LOWER_GREEK */: - return createCounterStyleFromRange(value, 945, 969, false, defaultSuffix); - case 9 /* LOWER_ALPHA */: - return createCounterStyleFromRange(value, 97, 122, false, defaultSuffix); - case 10 /* UPPER_ALPHA */: - return createCounterStyleFromRange(value, 65, 90, false, defaultSuffix); - case 11 /* ARABIC_INDIC */: - return createCounterStyleFromRange(value, 1632, 1641, true, defaultSuffix); - case 12 /* ARMENIAN */: - case 49 /* UPPER_ARMENIAN */: - return createAdditiveCounter(value, 1, 9999, ARMENIAN, 3 /* DECIMAL */, defaultSuffix); - case 35 /* LOWER_ARMENIAN */: - return createAdditiveCounter(value, 1, 9999, ARMENIAN, 3 /* DECIMAL */, defaultSuffix).toLowerCase(); - case 13 /* BENGALI */: - return createCounterStyleFromRange(value, 2534, 2543, true, defaultSuffix); - case 14 /* CAMBODIAN */: - case 30 /* KHMER */: - return createCounterStyleFromRange(value, 6112, 6121, true, defaultSuffix); - case 15 /* CJK_EARTHLY_BRANCH */: - return createCounterStyleFromSymbols(value, '子丑寅卯辰巳午未申酉戌亥', cjkSuffix); - case 16 /* CJK_HEAVENLY_STEM */: - return createCounterStyleFromSymbols(value, '甲乙丙丁戊己庚辛壬癸', cjkSuffix); - case 17 /* CJK_IDEOGRAPHIC */: - case 48 /* TRAD_CHINESE_INFORMAL */: - return createCJKCounter(value, '零一二三四五六七八九', CHINESE_INFORMAL_MULTIPLIERS, '負', cjkSuffix, CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS); - case 47 /* TRAD_CHINESE_FORMAL */: - return createCJKCounter(value, '零壹貳參肆伍陸柒捌玖', CHINESE_FORMAL_MULTIPLIERS, '負', cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS); - case 42 /* SIMP_CHINESE_INFORMAL */: - return createCJKCounter(value, '零一二三四五六七八九', CHINESE_INFORMAL_MULTIPLIERS, '负', cjkSuffix, CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS); - case 41 /* SIMP_CHINESE_FORMAL */: - return createCJKCounter(value, '零壹贰叁肆伍陆柒捌玖', CHINESE_FORMAL_MULTIPLIERS, '负', cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS); - case 26 /* JAPANESE_INFORMAL */: - return createCJKCounter(value, '〇一二三四五六七八九', '十百千万', JAPANESE_NEGATIVE, cjkSuffix, 0); - case 25 /* JAPANESE_FORMAL */: - return createCJKCounter(value, '零壱弐参四伍六七八九', '拾百千万', JAPANESE_NEGATIVE, cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS); - case 31 /* KOREAN_HANGUL_FORMAL */: - return createCJKCounter(value, '영일이삼사오육칠팔구', '십백천만', KOREAN_NEGATIVE, koreanSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS); - case 33 /* KOREAN_HANJA_INFORMAL */: - return createCJKCounter(value, '零一二三四五六七八九', '十百千萬', KOREAN_NEGATIVE, koreanSuffix, 0); - case 32 /* KOREAN_HANJA_FORMAL */: - return createCJKCounter(value, '零壹貳參四五六七八九', '拾百千', KOREAN_NEGATIVE, koreanSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS); - case 18 /* DEVANAGARI */: - return createCounterStyleFromRange(value, 0x966, 0x96f, true, defaultSuffix); - case 20 /* GEORGIAN */: - return createAdditiveCounter(value, 1, 19999, GEORGIAN, 3 /* DECIMAL */, defaultSuffix); - case 21 /* GUJARATI */: - return createCounterStyleFromRange(value, 0xae6, 0xaef, true, defaultSuffix); - case 22 /* GURMUKHI */: - return createCounterStyleFromRange(value, 0xa66, 0xa6f, true, defaultSuffix); - case 22 /* HEBREW */: - return createAdditiveCounter(value, 1, 10999, HEBREW, 3 /* DECIMAL */, defaultSuffix); - case 23 /* HIRAGANA */: - return createCounterStyleFromSymbols(value, 'あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん'); - case 24 /* HIRAGANA_IROHA */: - return createCounterStyleFromSymbols(value, 'いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす'); - case 27 /* KANNADA */: - return createCounterStyleFromRange(value, 0xce6, 0xcef, true, defaultSuffix); - case 28 /* KATAKANA */: - return createCounterStyleFromSymbols(value, 'アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン', cjkSuffix); - case 29 /* KATAKANA_IROHA */: - return createCounterStyleFromSymbols(value, 'イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス', cjkSuffix); - case 34 /* LAO */: - return createCounterStyleFromRange(value, 0xed0, 0xed9, true, defaultSuffix); - case 37 /* MONGOLIAN */: - return createCounterStyleFromRange(value, 0x1810, 0x1819, true, defaultSuffix); - case 38 /* MYANMAR */: - return createCounterStyleFromRange(value, 0x1040, 0x1049, true, defaultSuffix); - case 39 /* ORIYA */: - return createCounterStyleFromRange(value, 0xb66, 0xb6f, true, defaultSuffix); - case 40 /* PERSIAN */: - return createCounterStyleFromRange(value, 0x6f0, 0x6f9, true, defaultSuffix); - case 43 /* TAMIL */: - return createCounterStyleFromRange(value, 0xbe6, 0xbef, true, defaultSuffix); - case 44 /* TELUGU */: - return createCounterStyleFromRange(value, 0xc66, 0xc6f, true, defaultSuffix); - case 45 /* THAI */: - return createCounterStyleFromRange(value, 0xe50, 0xe59, true, defaultSuffix); - case 46 /* TIBETAN */: - return createCounterStyleFromRange(value, 0xf20, 0xf29, true, defaultSuffix); - case 3 /* DECIMAL */: - default: - return createCounterStyleFromRange(value, 48, 57, true, defaultSuffix); - } - }; - - var IGNORE_ATTRIBUTE = 'data-html2canvas-ignore'; - var DocumentCloner = /** @class */ (function () { - function DocumentCloner(context, element, options) { - this.context = context; - this.options = options; - this.scrolledElements = []; - this.referenceElement = element; - this.counters = new CounterState(); - this.quoteDepth = 0; - if (!element.ownerDocument) { - throw new Error('Cloned element does not have an owner document'); - } - this.documentElement = this.cloneNode(element.ownerDocument.documentElement, false); - } - DocumentCloner.prototype.toIFrame = function (ownerDocument, windowSize) { - var _this = this; - var iframe = createIFrameContainer(ownerDocument, windowSize); - if (!iframe.contentWindow) { - return Promise.reject("Unable to find iframe window"); - } - var scrollX = ownerDocument.defaultView.pageXOffset; - var scrollY = ownerDocument.defaultView.pageYOffset; - var cloneWindow = iframe.contentWindow; - var documentClone = cloneWindow.document; - /* Chrome doesn't detect relative background-images assigned in inline - - - - - - - - - -
    -
    Copyright (c) 2022 Robin Rombach and Patrick Esser and contributors
    CreativeML Open RAIL-M
    dated August 22, 2022
    Section I: PREAMBLE
    Multimodal generative models are being widely adopted and used, and have
    the potential to transform the way artists, among other individuals,
    conceive and benefit from AI or ML technologies as a tool for content
    creation.
    Notwithstanding the current and potential benefits that these artifacts
    can bring to society at large, there are also concerns about potential
    misuses of them, either due to their technical limitations or ethical
    considerations.
    In short, this license strives for both the open and responsible
    downstream use of the accompanying model. When it comes to the open
    character, we took inspiration from open source permissive licenses
    regarding the grant of IP rights. Referring to the downstream responsible
    use, we added use-based restrictions not permitting the use of the Model
    in very specific scenarios, in order for the licensor to be able to
    enforce the license in case potential misuses of the Model may occur. At
    the same time, we strive to promote open and responsible research on
    generative models for art and content generation.
    Even though downstream derivative versions of the model could be released
    under different licensing terms, the latter will always have to include -
    at minimum - the same use-based restrictions as the ones in the original
    license (this license). We believe in the intersection between open and
    responsible AI development; thus, this License aims to strike a balance
    between both in order to enable responsible open-science in the field of
    AI.
    This License governs the use of the model (and its derivatives) and is
    informed by the model card associated with the model.
    NOW THEREFORE, You and Licensor agree as follows:
    1. Definitions
    - "License" means the terms and conditions for use, reproduction, and
    Distribution as defined in this document.
    - "Data" means a collection of information and/or content extracted from
    the dataset used with the Model, including to train, pretrain, or
    otherwise evaluate the Model. The Data is not licensed under this
    License.
    - "Output" means the results of operating a Model as embodied in
    informational content resulting therefrom.
    - "Model" means any accompanying machine-learning based assemblies
    (including checkpoints), consisting of learnt weights, parameters
    (including optimizer states), corresponding to the model architecture as
    -
    embodied in the Complementary Material, that have been trained or tuned,
    in whole or in part on the Data, using the Complementary Material.
    - "Derivatives of the Model" means all modifications to the Model, works
    based on the Model, or any other model which is created or initialized by
    transfer of patterns of the weights, parameters, activations or output of
    the Model, to the other model, in order to cause the other model to
    perform similarly to the Model, including - but not limited to -
    distillation methods entailing the use of intermediate data
    representations or methods based on the generation of synthetic data by
    the Model for training the other model.
    - "Complementary Material" means the accompanying source code and scripts
    used to define, run, load, benchmark or evaluate the Model, and used to
    prepare data for training or evaluation, if any. This includes any
    accompanying documentation, tutorials, examples, etc, if any.
    - "Distribution" means any transmission, reproduction, publication or
    other sharing of the Model or Derivatives of the Model to a third party,
    including providing the Model as a hosted service made available by
    electronic or other remote means - e.g. API-based or web access.
    - "Licensor" means the copyright owner or entity authorized by the
    copyright owner that is granting the License, including the persons or
    entities that may have rights in the Model and/or distributing the Model.
    - "You" (or "Your") means an individual or Legal Entity exercising
    permissions granted by this License and/or making use of the Model for
    whichever purpose and in any field of use, including usage of the Model
    in an end-use application - e.g. chatbot, translator, image generator.
    - "Third Parties" means individuals or legal entities that are not under
    common control with Licensor or You.
    - "Contribution" means any work of authorship, including the original
    version of the Model and any modifications or additions to that Model or
    Derivatives of the Model thereof, that is intentionally submitted to
    Licensor for inclusion in the Model 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 Model, but
    excluding communication that is conspicuously marked or otherwise
    designated in writing by the copyright owner as "Not a Contribution."
    - "Contributor" means Licensor and any individual or Legal Entity on
    behalf of whom a Contribution has been received by Licensor and
    subsequently incorporated within the Model.
    Section II: INTELLECTUAL PROPERTY RIGHTS
    Both copyright and patent grants apply to the Model, Derivatives of the
    Model and Complementary Material. The Model and Derivatives of the Model
    are subject to additional terms as described in Section III.
    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, publicly display, publicly perform,
    -
    sublicense, and distribute the Complementary Material, the Model, and
    Derivatives of the Model.
    3. Grant of Patent License. Subject to the terms and conditions of this
    License and where and as applicable, each Contributor hereby grants to
    You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
    irrevocable (except as stated in this paragraph) patent license to make,
    have made, use, offer to sell, sell, import, and otherwise transfer the
    Model and the Complementary Material, 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 Model 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
    Model and/or Complementary Material or a Contribution incorporated within
    the Model and/or Complementary Material constitutes direct or
    contributory patent infringement, then any patent licenses granted to You
    under this License for the Model and/or Work shall terminate as of the
    date such litigation is asserted or filed.
    Section III: CONDITIONS OF USAGE, DISTRIBUTION AND REDISTRIBUTION
    4. Distribution and Redistribution. You may host for Third Party remote
    access purposes (e.g. software-as-a-service), reproduce and distribute
    copies of the Model or Derivatives of the Model thereof in any medium,
    with or without modifications, provided that You meet the following
    conditions:
    Use-based restrictions as referenced in paragraph 5 MUST be included as
    an enforceable provision by You in any type of legal agreement (e.g. a
    license) governing the use and/or distribution of the Model or
    Derivatives of the Model, and You shall give notice to subsequent users
    You Distribute to, that the Model or Derivatives of the Model are subject
    to paragraph 5. This provision does not apply to the use of Complementary
    Material.
    You must give any Third Party recipients of the Model or Derivatives of
    the Model a copy of this License;
    You must cause any modified files to carry prominent notices stating that
    You changed the files;
    You must retain all copyright, patent, trademark, and attribution notices
    excluding those notices that do not pertain to any part of the Model,
    Derivatives of the Model.
    You may add Your own copyright statement to Your modifications and may
    provide additional or different license terms and conditions - respecting
    paragraph 4.a. - for use, reproduction, or Distribution of Your
    modifications, or for any such Derivatives of the Model as a whole,
    provided Your use, reproduction, and Distribution of the Model otherwise
    complies with the conditions stated in this License.
    5. Use-based restrictions. The restrictions set forth in Attachment A are
    considered Use-based restrictions. Therefore You cannot use the Model and
    the Derivatives of the Model for the specified restricted uses. You may
    use the Model subject to this License, including only for lawful purposes
    and in accordance with the License. Use may include creating any content
    with, finetuning, updating, running, training, evaluating and/or
    reparametrizing the Model. You shall require all of Your users who use
    -
    the Model or a Derivative of the Model to comply with the terms of this
    paragraph (paragraph 5).
    6. The Output You Generate. Except as set forth herein, Licensor claims
    no rights in the Output You generate using the Model. You are accountable
    for the Output you generate and its subsequent uses. No use of the output
    can contravene any provision as stated in the License.
    Section IV: OTHER PROVISIONS
    7. Updates and Runtime Restrictions. To the maximum extent permitted by
    law, Licensor reserves the right to restrict (remotely or otherwise)
    usage of the Model in violation of this License, update the Model through
    electronic means, or modify the Output of the Model based on updates. You
    shall undertake reasonable efforts to use the latest version of the
    Model.
    8. Trademarks and related. Nothing in this License permits You to make
    use of Licensors’ trademarks, trade names, logos or to otherwise suggest
    endorsement or misrepresent the relationship between the parties; and any
    rights not expressly granted herein are reserved by the Licensors.
    9. Disclaimer of Warranty. Unless required by applicable law or agreed to
    in writing, Licensor provides the Model and the Complementary Material
    (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 Model, Derivatives of the Model, and the
    Complementary Material and assume any risks associated with Your exercise
    of permissions under this License.
    10. 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 Model and the
    Complementary Material (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.
    11. Accepting Warranty or Additional Liability. While redistributing the
    Model, Derivatives of the Model and the Complementary Material 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.
    12. If any provision of this License is held to be invalid, illegal or
    unenforceable, the remaining provisions shall be unaffected thereby and
    remain valid as if such provision had not been set forth herein.
    -
    END OF TERMS AND CONDITIONS
    Attachment A
    Use Restrictions
    You agree not to use the Model or Derivatives of the Model:
    - In any way that violates any applicable national, federal, state, local
    or international law or regulation;
    - For the purpose of exploiting, harming or attempting to exploit or harm
    minors in any way;
    - To generate or disseminate verifiably false information and/or content
    with the purpose of harming others;
    - To generate or disseminate personal identifiable information that can
    be used to harm an individual;
    - To defame, disparage or otherwise harass others;
    - For fully automated decision making that adversely impacts an
    individual’s legal rights or otherwise creates or modifies a binding,
    enforceable obligation;
    - For any use intended to or which has the effect of discriminating
    against or harming individuals or groups based on online or offline
    social behavior or known or predicted personal or personality
    characteristics;
    - To exploit any of the vulnerabilities of a specific group of persons
    based on their age, social, physical or mental characteristics, in order
    to materially distort the behavior of a person pertaining to that group
    in a manner that causes or is likely to cause that person or another
    person physical or psychological harm;
    - For any use intended to or which has the effect of discriminating
    against individuals or groups based on legally protected characteristics
    or categories;
    - To provide medical advice and medical results interpretation;
    - To generate or disseminate information for the purpose to be used for
    administration of justice, law enforcement, immigration or asylum
    processes, such as predicting an individual will commit fraud/crime
    commitment (e.g. by text profiling, drawing causal relationships between
    assertions made in documents, indiscriminate and arbitrarily-targeted
    use).
    -
    -
    - -
    - - diff --git a/spaces/digitalxingtong/Eileen-Bert-Vits2/text/tone_sandhi.py b/spaces/digitalxingtong/Eileen-Bert-Vits2/text/tone_sandhi.py deleted file mode 100644 index 0f45b7a72c5d858bcaab19ac85cfa686bf9a74da..0000000000000000000000000000000000000000 --- a/spaces/digitalxingtong/Eileen-Bert-Vits2/text/tone_sandhi.py +++ /dev/null @@ -1,351 +0,0 @@ -# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. -# -# 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. -from typing import List -from typing import Tuple - -import jieba -from pypinyin import lazy_pinyin -from pypinyin import Style - - -class ToneSandhi(): - def __init__(self): - self.must_neural_tone_words = { - '麻烦', '麻利', '鸳鸯', '高粱', '骨头', '骆驼', '马虎', '首饰', '馒头', '馄饨', '风筝', - '难为', '队伍', '阔气', '闺女', '门道', '锄头', '铺盖', '铃铛', '铁匠', '钥匙', '里脊', - '里头', '部分', '那么', '道士', '造化', '迷糊', '连累', '这么', '这个', '运气', '过去', - '软和', '转悠', '踏实', '跳蚤', '跟头', '趔趄', '财主', '豆腐', '讲究', '记性', '记号', - '认识', '规矩', '见识', '裁缝', '补丁', '衣裳', '衣服', '衙门', '街坊', '行李', '行当', - '蛤蟆', '蘑菇', '薄荷', '葫芦', '葡萄', '萝卜', '荸荠', '苗条', '苗头', '苍蝇', '芝麻', - '舒服', '舒坦', '舌头', '自在', '膏药', '脾气', '脑袋', '脊梁', '能耐', '胳膊', '胭脂', - '胡萝', '胡琴', '胡同', '聪明', '耽误', '耽搁', '耷拉', '耳朵', '老爷', '老实', '老婆', - '老头', '老太', '翻腾', '罗嗦', '罐头', '编辑', '结实', '红火', '累赘', '糨糊', '糊涂', - '精神', '粮食', '簸箕', '篱笆', '算计', '算盘', '答应', '笤帚', '笑语', '笑话', '窟窿', - '窝囊', '窗户', '稳当', '稀罕', '称呼', '秧歌', '秀气', '秀才', '福气', '祖宗', '砚台', - '码头', '石榴', '石头', '石匠', '知识', '眼睛', '眯缝', '眨巴', '眉毛', '相声', '盘算', - '白净', '痢疾', '痛快', '疟疾', '疙瘩', '疏忽', '畜生', '生意', '甘蔗', '琵琶', '琢磨', - '琉璃', '玻璃', '玫瑰', '玄乎', '狐狸', '状元', '特务', '牲口', '牙碜', '牌楼', '爽快', - '爱人', '热闹', '烧饼', '烟筒', '烂糊', '点心', '炊帚', '灯笼', '火候', '漂亮', '滑溜', - '溜达', '温和', '清楚', '消息', '浪头', '活泼', '比方', '正经', '欺负', '模糊', '槟榔', - '棺材', '棒槌', '棉花', '核桃', '栅栏', '柴火', '架势', '枕头', '枇杷', '机灵', '本事', - '木头', '木匠', '朋友', '月饼', '月亮', '暖和', '明白', '时候', '新鲜', '故事', '收拾', - '收成', '提防', '挖苦', '挑剔', '指甲', '指头', '拾掇', '拳头', '拨弄', '招牌', '招呼', - '抬举', '护士', '折腾', '扫帚', '打量', '打算', '打点', '打扮', '打听', '打发', '扎实', - '扁担', '戒指', '懒得', '意识', '意思', '情形', '悟性', '怪物', '思量', '怎么', '念头', - '念叨', '快活', '忙活', '志气', '心思', '得罪', '张罗', '弟兄', '开通', '应酬', '庄稼', - '干事', '帮手', '帐篷', '希罕', '师父', '师傅', '巴结', '巴掌', '差事', '工夫', '岁数', - '屁股', '尾巴', '少爷', '小气', '小伙', '将就', '对头', '对付', '寡妇', '家伙', '客气', - '实在', '官司', '学问', '学生', '字号', '嫁妆', '媳妇', '媒人', '婆家', '娘家', '委屈', - '姑娘', '姐夫', '妯娌', '妥当', '妖精', '奴才', '女婿', '头发', '太阳', '大爷', '大方', - '大意', '大夫', '多少', '多么', '外甥', '壮实', '地道', '地方', '在乎', '困难', '嘴巴', - '嘱咐', '嘟囔', '嘀咕', '喜欢', '喇嘛', '喇叭', '商量', '唾沫', '哑巴', '哈欠', '哆嗦', - '咳嗽', '和尚', '告诉', '告示', '含糊', '吓唬', '后头', '名字', '名堂', '合同', '吆喝', - '叫唤', '口袋', '厚道', '厉害', '千斤', '包袱', '包涵', '匀称', '勤快', '动静', '动弹', - '功夫', '力气', '前头', '刺猬', '刺激', '别扭', '利落', '利索', '利害', '分析', '出息', - '凑合', '凉快', '冷战', '冤枉', '冒失', '养活', '关系', '先生', '兄弟', '便宜', '使唤', - '佩服', '作坊', '体面', '位置', '似的', '伙计', '休息', '什么', '人家', '亲戚', '亲家', - '交情', '云彩', '事情', '买卖', '主意', '丫头', '丧气', '两口', '东西', '东家', '世故', - '不由', '不在', '下水', '下巴', '上头', '上司', '丈夫', '丈人', '一辈', '那个', '菩萨', - '父亲', '母亲', '咕噜', '邋遢', '费用', '冤家', '甜头', '介绍', '荒唐', '大人', '泥鳅', - '幸福', '熟悉', '计划', '扑腾', '蜡烛', '姥爷', '照顾', '喉咙', '吉他', '弄堂', '蚂蚱', - '凤凰', '拖沓', '寒碜', '糟蹋', '倒腾', '报复', '逻辑', '盘缠', '喽啰', '牢骚', '咖喱', - '扫把', '惦记' - } - self.must_not_neural_tone_words = { - "男子", "女子", "分子", "原子", "量子", "莲子", "石子", "瓜子", "电子", "人人", "虎虎" - } - self.punc = ":,;。?!“”‘’':,;.?!" - - # the meaning of jieba pos tag: https://blog.csdn.net/weixin_44174352/article/details/113731041 - # e.g. - # word: "家里" - # pos: "s" - # finals: ['ia1', 'i3'] - def _neural_sandhi(self, word: str, pos: str, - finals: List[str]) -> List[str]: - - # reduplication words for n. and v. e.g. 奶奶, 试试, 旺旺 - for j, item in enumerate(word): - if j - 1 >= 0 and item == word[j - 1] and pos[0] in { - "n", "v", "a" - } and word not in self.must_not_neural_tone_words: - finals[j] = finals[j][:-1] + "5" - ge_idx = word.find("个") - if len(word) >= 1 and word[-1] in "吧呢啊呐噻嘛吖嗨呐哦哒额滴哩哟喽啰耶喔诶": - finals[-1] = finals[-1][:-1] + "5" - elif len(word) >= 1 and word[-1] in "的地得": - finals[-1] = finals[-1][:-1] + "5" - # e.g. 走了, 看着, 去过 - # elif len(word) == 1 and word in "了着过" and pos in {"ul", "uz", "ug"}: - # finals[-1] = finals[-1][:-1] + "5" - elif len(word) > 1 and word[-1] in "们子" and pos in { - "r", "n" - } and word not in self.must_not_neural_tone_words: - finals[-1] = finals[-1][:-1] + "5" - # e.g. 桌上, 地下, 家里 - elif len(word) > 1 and word[-1] in "上下里" and pos in {"s", "l", "f"}: - finals[-1] = finals[-1][:-1] + "5" - # e.g. 上来, 下去 - elif len(word) > 1 and word[-1] in "来去" and word[-2] in "上下进出回过起开": - finals[-1] = finals[-1][:-1] + "5" - # 个做量词 - elif (ge_idx >= 1 and - (word[ge_idx - 1].isnumeric() or - word[ge_idx - 1] in "几有两半多各整每做是")) or word == '个': - finals[ge_idx] = finals[ge_idx][:-1] + "5" - else: - if word in self.must_neural_tone_words or word[ - -2:] in self.must_neural_tone_words: - finals[-1] = finals[-1][:-1] + "5" - - word_list = self._split_word(word) - finals_list = [finals[:len(word_list[0])], finals[len(word_list[0]):]] - for i, word in enumerate(word_list): - # conventional neural in Chinese - if word in self.must_neural_tone_words or word[ - -2:] in self.must_neural_tone_words: - finals_list[i][-1] = finals_list[i][-1][:-1] + "5" - finals = sum(finals_list, []) - return finals - - def _bu_sandhi(self, word: str, finals: List[str]) -> List[str]: - # e.g. 看不懂 - if len(word) == 3 and word[1] == "不": - finals[1] = finals[1][:-1] + "5" - else: - for i, char in enumerate(word): - # "不" before tone4 should be bu2, e.g. 不怕 - if char == "不" and i + 1 < len(word) and finals[i + - 1][-1] == "4": - finals[i] = finals[i][:-1] + "2" - return finals - - def _yi_sandhi(self, word: str, finals: List[str]) -> List[str]: - # "一" in number sequences, e.g. 一零零, 二一零 - if word.find("一") != -1 and all( - [item.isnumeric() for item in word if item != "一"]): - return finals - # "一" between reduplication words shold be yi5, e.g. 看一看 - elif len(word) == 3 and word[1] == "一" and word[0] == word[-1]: - finals[1] = finals[1][:-1] + "5" - # when "一" is ordinal word, it should be yi1 - elif word.startswith("第一"): - finals[1] = finals[1][:-1] + "1" - else: - for i, char in enumerate(word): - if char == "一" and i + 1 < len(word): - # "一" before tone4 should be yi2, e.g. 一段 - if finals[i + 1][-1] == "4": - finals[i] = finals[i][:-1] + "2" - # "一" before non-tone4 should be yi4, e.g. 一天 - else: - # "一" 后面如果是标点,还读一声 - if word[i + 1] not in self.punc: - finals[i] = finals[i][:-1] + "4" - return finals - - def _split_word(self, word: str) -> List[str]: - word_list = jieba.cut_for_search(word) - word_list = sorted(word_list, key=lambda i: len(i), reverse=False) - first_subword = word_list[0] - first_begin_idx = word.find(first_subword) - if first_begin_idx == 0: - second_subword = word[len(first_subword):] - new_word_list = [first_subword, second_subword] - else: - second_subword = word[:-len(first_subword)] - new_word_list = [second_subword, first_subword] - return new_word_list - - def _three_sandhi(self, word: str, finals: List[str]) -> List[str]: - if len(word) == 2 and self._all_tone_three(finals): - finals[0] = finals[0][:-1] + "2" - elif len(word) == 3: - word_list = self._split_word(word) - if self._all_tone_three(finals): - # disyllabic + monosyllabic, e.g. 蒙古/包 - if len(word_list[0]) == 2: - finals[0] = finals[0][:-1] + "2" - finals[1] = finals[1][:-1] + "2" - # monosyllabic + disyllabic, e.g. 纸/老虎 - elif len(word_list[0]) == 1: - finals[1] = finals[1][:-1] + "2" - else: - finals_list = [ - finals[:len(word_list[0])], finals[len(word_list[0]):] - ] - if len(finals_list) == 2: - for i, sub in enumerate(finals_list): - # e.g. 所有/人 - if self._all_tone_three(sub) and len(sub) == 2: - finals_list[i][0] = finals_list[i][0][:-1] + "2" - # e.g. 好/喜欢 - elif i == 1 and not self._all_tone_three(sub) and finals_list[i][0][-1] == "3" and \ - finals_list[0][-1][-1] == "3": - - finals_list[0][-1] = finals_list[0][-1][:-1] + "2" - finals = sum(finals_list, []) - # split idiom into two words who's length is 2 - elif len(word) == 4: - finals_list = [finals[:2], finals[2:]] - finals = [] - for sub in finals_list: - if self._all_tone_three(sub): - sub[0] = sub[0][:-1] + "2" - finals += sub - - return finals - - def _all_tone_three(self, finals: List[str]) -> bool: - return all(x[-1] == "3" for x in finals) - - # merge "不" and the word behind it - # if don't merge, "不" sometimes appears alone according to jieba, which may occur sandhi error - def _merge_bu(self, seg: List[Tuple[str, str]]) -> List[Tuple[str, str]]: - new_seg = [] - last_word = "" - for word, pos in seg: - if last_word == "不": - word = last_word + word - if word != "不": - new_seg.append((word, pos)) - last_word = word[:] - if last_word == "不": - new_seg.append((last_word, 'd')) - last_word = "" - return new_seg - - # function 1: merge "一" and reduplication words in it's left and right, e.g. "听","一","听" ->"听一听" - # function 2: merge single "一" and the word behind it - # if don't merge, "一" sometimes appears alone according to jieba, which may occur sandhi error - # e.g. - # input seg: [('听', 'v'), ('一', 'm'), ('听', 'v')] - # output seg: [['听一听', 'v']] - def _merge_yi(self, seg: List[Tuple[str, str]]) -> List[Tuple[str, str]]: - new_seg = [] - # function 1 - for i, (word, pos) in enumerate(seg): - if i - 1 >= 0 and word == "一" and i + 1 < len(seg) and seg[i - 1][ - 0] == seg[i + 1][0] and seg[i - 1][1] == "v": - new_seg[i - 1][0] = new_seg[i - 1][0] + "一" + new_seg[i - 1][0] - else: - if i - 2 >= 0 and seg[i - 1][0] == "一" and seg[i - 2][ - 0] == word and pos == "v": - continue - else: - new_seg.append([word, pos]) - seg = new_seg - new_seg = [] - # function 2 - for i, (word, pos) in enumerate(seg): - if new_seg and new_seg[-1][0] == "一": - new_seg[-1][0] = new_seg[-1][0] + word - else: - new_seg.append([word, pos]) - return new_seg - - # the first and the second words are all_tone_three - def _merge_continuous_three_tones( - self, seg: List[Tuple[str, str]]) -> List[Tuple[str, str]]: - new_seg = [] - sub_finals_list = [ - lazy_pinyin( - word, neutral_tone_with_five=True, style=Style.FINALS_TONE3) - for (word, pos) in seg - ] - assert len(sub_finals_list) == len(seg) - merge_last = [False] * len(seg) - for i, (word, pos) in enumerate(seg): - if i - 1 >= 0 and self._all_tone_three( - sub_finals_list[i - 1]) and self._all_tone_three( - sub_finals_list[i]) and not merge_last[i - 1]: - # if the last word is reduplication, not merge, because reduplication need to be _neural_sandhi - if not self._is_reduplication(seg[i - 1][0]) and len( - seg[i - 1][0]) + len(seg[i][0]) <= 3: - new_seg[-1][0] = new_seg[-1][0] + seg[i][0] - merge_last[i] = True - else: - new_seg.append([word, pos]) - else: - new_seg.append([word, pos]) - - return new_seg - - def _is_reduplication(self, word: str) -> bool: - return len(word) == 2 and word[0] == word[1] - - # the last char of first word and the first char of second word is tone_three - def _merge_continuous_three_tones_2( - self, seg: List[Tuple[str, str]]) -> List[Tuple[str, str]]: - new_seg = [] - sub_finals_list = [ - lazy_pinyin( - word, neutral_tone_with_five=True, style=Style.FINALS_TONE3) - for (word, pos) in seg - ] - assert len(sub_finals_list) == len(seg) - merge_last = [False] * len(seg) - for i, (word, pos) in enumerate(seg): - if i - 1 >= 0 and sub_finals_list[i - 1][-1][-1] == "3" and sub_finals_list[i][0][-1] == "3" and not \ - merge_last[i - 1]: - # if the last word is reduplication, not merge, because reduplication need to be _neural_sandhi - if not self._is_reduplication(seg[i - 1][0]) and len( - seg[i - 1][0]) + len(seg[i][0]) <= 3: - new_seg[-1][0] = new_seg[-1][0] + seg[i][0] - merge_last[i] = True - else: - new_seg.append([word, pos]) - else: - new_seg.append([word, pos]) - return new_seg - - def _merge_er(self, seg: List[Tuple[str, str]]) -> List[Tuple[str, str]]: - new_seg = [] - for i, (word, pos) in enumerate(seg): - if i - 1 >= 0 and word == "儿" and seg[i-1][0] != "#": - new_seg[-1][0] = new_seg[-1][0] + seg[i][0] - else: - new_seg.append([word, pos]) - return new_seg - - def _merge_reduplication( - self, seg: List[Tuple[str, str]]) -> List[Tuple[str, str]]: - new_seg = [] - for i, (word, pos) in enumerate(seg): - if new_seg and word == new_seg[-1][0]: - new_seg[-1][0] = new_seg[-1][0] + seg[i][0] - else: - new_seg.append([word, pos]) - return new_seg - - def pre_merge_for_modify( - self, seg: List[Tuple[str, str]]) -> List[Tuple[str, str]]: - seg = self._merge_bu(seg) - try: - seg = self._merge_yi(seg) - except: - print("_merge_yi failed") - seg = self._merge_reduplication(seg) - seg = self._merge_continuous_three_tones(seg) - seg = self._merge_continuous_three_tones_2(seg) - seg = self._merge_er(seg) - return seg - - def modified_tone(self, word: str, pos: str, - finals: List[str]) -> List[str]: - finals = self._bu_sandhi(word, finals) - finals = self._yi_sandhi(word, finals) - finals = self._neural_sandhi(word, pos, finals) - finals = self._three_sandhi(word, finals) - return finals diff --git a/spaces/digitalxingtong/Jiaran-Bert-VITS2/text/tone_sandhi.py b/spaces/digitalxingtong/Jiaran-Bert-VITS2/text/tone_sandhi.py deleted file mode 100644 index 0f45b7a72c5d858bcaab19ac85cfa686bf9a74da..0000000000000000000000000000000000000000 --- a/spaces/digitalxingtong/Jiaran-Bert-VITS2/text/tone_sandhi.py +++ /dev/null @@ -1,351 +0,0 @@ -# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. -# -# 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. -from typing import List -from typing import Tuple - -import jieba -from pypinyin import lazy_pinyin -from pypinyin import Style - - -class ToneSandhi(): - def __init__(self): - self.must_neural_tone_words = { - '麻烦', '麻利', '鸳鸯', '高粱', '骨头', '骆驼', '马虎', '首饰', '馒头', '馄饨', '风筝', - '难为', '队伍', '阔气', '闺女', '门道', '锄头', '铺盖', '铃铛', '铁匠', '钥匙', '里脊', - '里头', '部分', '那么', '道士', '造化', '迷糊', '连累', '这么', '这个', '运气', '过去', - '软和', '转悠', '踏实', '跳蚤', '跟头', '趔趄', '财主', '豆腐', '讲究', '记性', '记号', - '认识', '规矩', '见识', '裁缝', '补丁', '衣裳', '衣服', '衙门', '街坊', '行李', '行当', - '蛤蟆', '蘑菇', '薄荷', '葫芦', '葡萄', '萝卜', '荸荠', '苗条', '苗头', '苍蝇', '芝麻', - '舒服', '舒坦', '舌头', '自在', '膏药', '脾气', '脑袋', '脊梁', '能耐', '胳膊', '胭脂', - '胡萝', '胡琴', '胡同', '聪明', '耽误', '耽搁', '耷拉', '耳朵', '老爷', '老实', '老婆', - '老头', '老太', '翻腾', '罗嗦', '罐头', '编辑', '结实', '红火', '累赘', '糨糊', '糊涂', - '精神', '粮食', '簸箕', '篱笆', '算计', '算盘', '答应', '笤帚', '笑语', '笑话', '窟窿', - '窝囊', '窗户', '稳当', '稀罕', '称呼', '秧歌', '秀气', '秀才', '福气', '祖宗', '砚台', - '码头', '石榴', '石头', '石匠', '知识', '眼睛', '眯缝', '眨巴', '眉毛', '相声', '盘算', - '白净', '痢疾', '痛快', '疟疾', '疙瘩', '疏忽', '畜生', '生意', '甘蔗', '琵琶', '琢磨', - '琉璃', '玻璃', '玫瑰', '玄乎', '狐狸', '状元', '特务', '牲口', '牙碜', '牌楼', '爽快', - '爱人', '热闹', '烧饼', '烟筒', '烂糊', '点心', '炊帚', '灯笼', '火候', '漂亮', '滑溜', - '溜达', '温和', '清楚', '消息', '浪头', '活泼', '比方', '正经', '欺负', '模糊', '槟榔', - '棺材', '棒槌', '棉花', '核桃', '栅栏', '柴火', '架势', '枕头', '枇杷', '机灵', '本事', - '木头', '木匠', '朋友', '月饼', '月亮', '暖和', '明白', '时候', '新鲜', '故事', '收拾', - '收成', '提防', '挖苦', '挑剔', '指甲', '指头', '拾掇', '拳头', '拨弄', '招牌', '招呼', - '抬举', '护士', '折腾', '扫帚', '打量', '打算', '打点', '打扮', '打听', '打发', '扎实', - '扁担', '戒指', '懒得', '意识', '意思', '情形', '悟性', '怪物', '思量', '怎么', '念头', - '念叨', '快活', '忙活', '志气', '心思', '得罪', '张罗', '弟兄', '开通', '应酬', '庄稼', - '干事', '帮手', '帐篷', '希罕', '师父', '师傅', '巴结', '巴掌', '差事', '工夫', '岁数', - '屁股', '尾巴', '少爷', '小气', '小伙', '将就', '对头', '对付', '寡妇', '家伙', '客气', - '实在', '官司', '学问', '学生', '字号', '嫁妆', '媳妇', '媒人', '婆家', '娘家', '委屈', - '姑娘', '姐夫', '妯娌', '妥当', '妖精', '奴才', '女婿', '头发', '太阳', '大爷', '大方', - '大意', '大夫', '多少', '多么', '外甥', '壮实', '地道', '地方', '在乎', '困难', '嘴巴', - '嘱咐', '嘟囔', '嘀咕', '喜欢', '喇嘛', '喇叭', '商量', '唾沫', '哑巴', '哈欠', '哆嗦', - '咳嗽', '和尚', '告诉', '告示', '含糊', '吓唬', '后头', '名字', '名堂', '合同', '吆喝', - '叫唤', '口袋', '厚道', '厉害', '千斤', '包袱', '包涵', '匀称', '勤快', '动静', '动弹', - '功夫', '力气', '前头', '刺猬', '刺激', '别扭', '利落', '利索', '利害', '分析', '出息', - '凑合', '凉快', '冷战', '冤枉', '冒失', '养活', '关系', '先生', '兄弟', '便宜', '使唤', - '佩服', '作坊', '体面', '位置', '似的', '伙计', '休息', '什么', '人家', '亲戚', '亲家', - '交情', '云彩', '事情', '买卖', '主意', '丫头', '丧气', '两口', '东西', '东家', '世故', - '不由', '不在', '下水', '下巴', '上头', '上司', '丈夫', '丈人', '一辈', '那个', '菩萨', - '父亲', '母亲', '咕噜', '邋遢', '费用', '冤家', '甜头', '介绍', '荒唐', '大人', '泥鳅', - '幸福', '熟悉', '计划', '扑腾', '蜡烛', '姥爷', '照顾', '喉咙', '吉他', '弄堂', '蚂蚱', - '凤凰', '拖沓', '寒碜', '糟蹋', '倒腾', '报复', '逻辑', '盘缠', '喽啰', '牢骚', '咖喱', - '扫把', '惦记' - } - self.must_not_neural_tone_words = { - "男子", "女子", "分子", "原子", "量子", "莲子", "石子", "瓜子", "电子", "人人", "虎虎" - } - self.punc = ":,;。?!“”‘’':,;.?!" - - # the meaning of jieba pos tag: https://blog.csdn.net/weixin_44174352/article/details/113731041 - # e.g. - # word: "家里" - # pos: "s" - # finals: ['ia1', 'i3'] - def _neural_sandhi(self, word: str, pos: str, - finals: List[str]) -> List[str]: - - # reduplication words for n. and v. e.g. 奶奶, 试试, 旺旺 - for j, item in enumerate(word): - if j - 1 >= 0 and item == word[j - 1] and pos[0] in { - "n", "v", "a" - } and word not in self.must_not_neural_tone_words: - finals[j] = finals[j][:-1] + "5" - ge_idx = word.find("个") - if len(word) >= 1 and word[-1] in "吧呢啊呐噻嘛吖嗨呐哦哒额滴哩哟喽啰耶喔诶": - finals[-1] = finals[-1][:-1] + "5" - elif len(word) >= 1 and word[-1] in "的地得": - finals[-1] = finals[-1][:-1] + "5" - # e.g. 走了, 看着, 去过 - # elif len(word) == 1 and word in "了着过" and pos in {"ul", "uz", "ug"}: - # finals[-1] = finals[-1][:-1] + "5" - elif len(word) > 1 and word[-1] in "们子" and pos in { - "r", "n" - } and word not in self.must_not_neural_tone_words: - finals[-1] = finals[-1][:-1] + "5" - # e.g. 桌上, 地下, 家里 - elif len(word) > 1 and word[-1] in "上下里" and pos in {"s", "l", "f"}: - finals[-1] = finals[-1][:-1] + "5" - # e.g. 上来, 下去 - elif len(word) > 1 and word[-1] in "来去" and word[-2] in "上下进出回过起开": - finals[-1] = finals[-1][:-1] + "5" - # 个做量词 - elif (ge_idx >= 1 and - (word[ge_idx - 1].isnumeric() or - word[ge_idx - 1] in "几有两半多各整每做是")) or word == '个': - finals[ge_idx] = finals[ge_idx][:-1] + "5" - else: - if word in self.must_neural_tone_words or word[ - -2:] in self.must_neural_tone_words: - finals[-1] = finals[-1][:-1] + "5" - - word_list = self._split_word(word) - finals_list = [finals[:len(word_list[0])], finals[len(word_list[0]):]] - for i, word in enumerate(word_list): - # conventional neural in Chinese - if word in self.must_neural_tone_words or word[ - -2:] in self.must_neural_tone_words: - finals_list[i][-1] = finals_list[i][-1][:-1] + "5" - finals = sum(finals_list, []) - return finals - - def _bu_sandhi(self, word: str, finals: List[str]) -> List[str]: - # e.g. 看不懂 - if len(word) == 3 and word[1] == "不": - finals[1] = finals[1][:-1] + "5" - else: - for i, char in enumerate(word): - # "不" before tone4 should be bu2, e.g. 不怕 - if char == "不" and i + 1 < len(word) and finals[i + - 1][-1] == "4": - finals[i] = finals[i][:-1] + "2" - return finals - - def _yi_sandhi(self, word: str, finals: List[str]) -> List[str]: - # "一" in number sequences, e.g. 一零零, 二一零 - if word.find("一") != -1 and all( - [item.isnumeric() for item in word if item != "一"]): - return finals - # "一" between reduplication words shold be yi5, e.g. 看一看 - elif len(word) == 3 and word[1] == "一" and word[0] == word[-1]: - finals[1] = finals[1][:-1] + "5" - # when "一" is ordinal word, it should be yi1 - elif word.startswith("第一"): - finals[1] = finals[1][:-1] + "1" - else: - for i, char in enumerate(word): - if char == "一" and i + 1 < len(word): - # "一" before tone4 should be yi2, e.g. 一段 - if finals[i + 1][-1] == "4": - finals[i] = finals[i][:-1] + "2" - # "一" before non-tone4 should be yi4, e.g. 一天 - else: - # "一" 后面如果是标点,还读一声 - if word[i + 1] not in self.punc: - finals[i] = finals[i][:-1] + "4" - return finals - - def _split_word(self, word: str) -> List[str]: - word_list = jieba.cut_for_search(word) - word_list = sorted(word_list, key=lambda i: len(i), reverse=False) - first_subword = word_list[0] - first_begin_idx = word.find(first_subword) - if first_begin_idx == 0: - second_subword = word[len(first_subword):] - new_word_list = [first_subword, second_subword] - else: - second_subword = word[:-len(first_subword)] - new_word_list = [second_subword, first_subword] - return new_word_list - - def _three_sandhi(self, word: str, finals: List[str]) -> List[str]: - if len(word) == 2 and self._all_tone_three(finals): - finals[0] = finals[0][:-1] + "2" - elif len(word) == 3: - word_list = self._split_word(word) - if self._all_tone_three(finals): - # disyllabic + monosyllabic, e.g. 蒙古/包 - if len(word_list[0]) == 2: - finals[0] = finals[0][:-1] + "2" - finals[1] = finals[1][:-1] + "2" - # monosyllabic + disyllabic, e.g. 纸/老虎 - elif len(word_list[0]) == 1: - finals[1] = finals[1][:-1] + "2" - else: - finals_list = [ - finals[:len(word_list[0])], finals[len(word_list[0]):] - ] - if len(finals_list) == 2: - for i, sub in enumerate(finals_list): - # e.g. 所有/人 - if self._all_tone_three(sub) and len(sub) == 2: - finals_list[i][0] = finals_list[i][0][:-1] + "2" - # e.g. 好/喜欢 - elif i == 1 and not self._all_tone_three(sub) and finals_list[i][0][-1] == "3" and \ - finals_list[0][-1][-1] == "3": - - finals_list[0][-1] = finals_list[0][-1][:-1] + "2" - finals = sum(finals_list, []) - # split idiom into two words who's length is 2 - elif len(word) == 4: - finals_list = [finals[:2], finals[2:]] - finals = [] - for sub in finals_list: - if self._all_tone_three(sub): - sub[0] = sub[0][:-1] + "2" - finals += sub - - return finals - - def _all_tone_three(self, finals: List[str]) -> bool: - return all(x[-1] == "3" for x in finals) - - # merge "不" and the word behind it - # if don't merge, "不" sometimes appears alone according to jieba, which may occur sandhi error - def _merge_bu(self, seg: List[Tuple[str, str]]) -> List[Tuple[str, str]]: - new_seg = [] - last_word = "" - for word, pos in seg: - if last_word == "不": - word = last_word + word - if word != "不": - new_seg.append((word, pos)) - last_word = word[:] - if last_word == "不": - new_seg.append((last_word, 'd')) - last_word = "" - return new_seg - - # function 1: merge "一" and reduplication words in it's left and right, e.g. "听","一","听" ->"听一听" - # function 2: merge single "一" and the word behind it - # if don't merge, "一" sometimes appears alone according to jieba, which may occur sandhi error - # e.g. - # input seg: [('听', 'v'), ('一', 'm'), ('听', 'v')] - # output seg: [['听一听', 'v']] - def _merge_yi(self, seg: List[Tuple[str, str]]) -> List[Tuple[str, str]]: - new_seg = [] - # function 1 - for i, (word, pos) in enumerate(seg): - if i - 1 >= 0 and word == "一" and i + 1 < len(seg) and seg[i - 1][ - 0] == seg[i + 1][0] and seg[i - 1][1] == "v": - new_seg[i - 1][0] = new_seg[i - 1][0] + "一" + new_seg[i - 1][0] - else: - if i - 2 >= 0 and seg[i - 1][0] == "一" and seg[i - 2][ - 0] == word and pos == "v": - continue - else: - new_seg.append([word, pos]) - seg = new_seg - new_seg = [] - # function 2 - for i, (word, pos) in enumerate(seg): - if new_seg and new_seg[-1][0] == "一": - new_seg[-1][0] = new_seg[-1][0] + word - else: - new_seg.append([word, pos]) - return new_seg - - # the first and the second words are all_tone_three - def _merge_continuous_three_tones( - self, seg: List[Tuple[str, str]]) -> List[Tuple[str, str]]: - new_seg = [] - sub_finals_list = [ - lazy_pinyin( - word, neutral_tone_with_five=True, style=Style.FINALS_TONE3) - for (word, pos) in seg - ] - assert len(sub_finals_list) == len(seg) - merge_last = [False] * len(seg) - for i, (word, pos) in enumerate(seg): - if i - 1 >= 0 and self._all_tone_three( - sub_finals_list[i - 1]) and self._all_tone_three( - sub_finals_list[i]) and not merge_last[i - 1]: - # if the last word is reduplication, not merge, because reduplication need to be _neural_sandhi - if not self._is_reduplication(seg[i - 1][0]) and len( - seg[i - 1][0]) + len(seg[i][0]) <= 3: - new_seg[-1][0] = new_seg[-1][0] + seg[i][0] - merge_last[i] = True - else: - new_seg.append([word, pos]) - else: - new_seg.append([word, pos]) - - return new_seg - - def _is_reduplication(self, word: str) -> bool: - return len(word) == 2 and word[0] == word[1] - - # the last char of first word and the first char of second word is tone_three - def _merge_continuous_three_tones_2( - self, seg: List[Tuple[str, str]]) -> List[Tuple[str, str]]: - new_seg = [] - sub_finals_list = [ - lazy_pinyin( - word, neutral_tone_with_five=True, style=Style.FINALS_TONE3) - for (word, pos) in seg - ] - assert len(sub_finals_list) == len(seg) - merge_last = [False] * len(seg) - for i, (word, pos) in enumerate(seg): - if i - 1 >= 0 and sub_finals_list[i - 1][-1][-1] == "3" and sub_finals_list[i][0][-1] == "3" and not \ - merge_last[i - 1]: - # if the last word is reduplication, not merge, because reduplication need to be _neural_sandhi - if not self._is_reduplication(seg[i - 1][0]) and len( - seg[i - 1][0]) + len(seg[i][0]) <= 3: - new_seg[-1][0] = new_seg[-1][0] + seg[i][0] - merge_last[i] = True - else: - new_seg.append([word, pos]) - else: - new_seg.append([word, pos]) - return new_seg - - def _merge_er(self, seg: List[Tuple[str, str]]) -> List[Tuple[str, str]]: - new_seg = [] - for i, (word, pos) in enumerate(seg): - if i - 1 >= 0 and word == "儿" and seg[i-1][0] != "#": - new_seg[-1][0] = new_seg[-1][0] + seg[i][0] - else: - new_seg.append([word, pos]) - return new_seg - - def _merge_reduplication( - self, seg: List[Tuple[str, str]]) -> List[Tuple[str, str]]: - new_seg = [] - for i, (word, pos) in enumerate(seg): - if new_seg and word == new_seg[-1][0]: - new_seg[-1][0] = new_seg[-1][0] + seg[i][0] - else: - new_seg.append([word, pos]) - return new_seg - - def pre_merge_for_modify( - self, seg: List[Tuple[str, str]]) -> List[Tuple[str, str]]: - seg = self._merge_bu(seg) - try: - seg = self._merge_yi(seg) - except: - print("_merge_yi failed") - seg = self._merge_reduplication(seg) - seg = self._merge_continuous_three_tones(seg) - seg = self._merge_continuous_three_tones_2(seg) - seg = self._merge_er(seg) - return seg - - def modified_tone(self, word: str, pos: str, - finals: List[str]) -> List[str]: - finals = self._bu_sandhi(word, finals) - finals = self._yi_sandhi(word, finals) - finals = self._neural_sandhi(word, pos, finals) - finals = self._three_sandhi(word, finals) - return finals diff --git a/spaces/dineshreddy/WALT/walt/datasets/pipelines/loading.py b/spaces/dineshreddy/WALT/walt/datasets/pipelines/loading.py deleted file mode 100644 index b0369aadc3c4b76ab87db608fc9e31e0040f583f..0000000000000000000000000000000000000000 --- a/spaces/dineshreddy/WALT/walt/datasets/pipelines/loading.py +++ /dev/null @@ -1,465 +0,0 @@ -import os.path as osp - -import mmcv -import numpy as np -import pycocotools.mask as maskUtils - -from mmdet.core import BitmapMasks, PolygonMasks -from ..builder import PIPELINES - - -@PIPELINES.register_module() -class LoadImageFromFile(object): - """Load an image from file. - - Required keys are "img_prefix" and "img_info" (a dict that must contain the - key "filename"). Added or updated keys are "filename", "img", "img_shape", - "ori_shape" (same as `img_shape`), "pad_shape" (same as `img_shape`), - "scale_factor" (1.0) and "img_norm_cfg" (means=0 and stds=1). - - Args: - to_float32 (bool): Whether to convert the loaded image to a float32 - numpy array. If set to False, the loaded image is an uint8 array. - Defaults to False. - color_type (str): The flag argument for :func:`mmcv.imfrombytes`. - Defaults to 'color'. - file_client_args (dict): Arguments to instantiate a FileClient. - See :class:`mmcv.fileio.FileClient` for details. - Defaults to ``dict(backend='disk')``. - """ - - def __init__(self, - to_float32=False, - color_type='color', - file_client_args=dict(backend='disk')): - self.to_float32 = to_float32 - self.color_type = color_type - self.file_client_args = file_client_args.copy() - self.file_client = None - - def __call__(self, results): - """Call functions to load image and get image meta information. - - Args: - results (dict): Result dict from :obj:`mmdet.CustomDataset`. - - Returns: - dict: The dict contains loaded image and meta information. - """ - - if self.file_client is None: - self.file_client = mmcv.FileClient(**self.file_client_args) - - if results['img_prefix'] is not None: - filename = osp.join(results['img_prefix'], - results['img_info']['filename']) - else: - filename = results['img_info']['filename'] - - img_bytes = self.file_client.get(filename) - img = mmcv.imfrombytes(img_bytes, flag=self.color_type) - if self.to_float32: - img = img.astype(np.float32) - - results['filename'] = filename - results['ori_filename'] = results['img_info']['filename'] - results['img'] = img - results['img_shape'] = img.shape - results['ori_shape'] = img.shape - results['img_fields'] = ['img'] - return results - - def __repr__(self): - repr_str = (f'{self.__class__.__name__}(' - f'to_float32={self.to_float32}, ' - f"color_type='{self.color_type}', " - f'file_client_args={self.file_client_args})') - return repr_str - - -@PIPELINES.register_module() -class LoadImageFromWebcam(LoadImageFromFile): - """Load an image from webcam. - - Similar with :obj:`LoadImageFromFile`, but the image read from webcam is in - ``results['img']``. - """ - - def __call__(self, results): - """Call functions to add image meta information. - - Args: - results (dict): Result dict with Webcam read image in - ``results['img']``. - - Returns: - dict: The dict contains loaded image and meta information. - """ - - img = results['img'] - if self.to_float32: - img = img.astype(np.float32) - - results['filename'] = None - results['ori_filename'] = None - results['img'] = img - results['img_shape'] = img.shape - results['ori_shape'] = img.shape - results['img_fields'] = ['img'] - return results - - -@PIPELINES.register_module() -class LoadMultiChannelImageFromFiles(object): - """Load multi-channel images from a list of separate channel files. - - Required keys are "img_prefix" and "img_info" (a dict that must contain the - key "filename", which is expected to be a list of filenames). - Added or updated keys are "filename", "img", "img_shape", - "ori_shape" (same as `img_shape`), "pad_shape" (same as `img_shape`), - "scale_factor" (1.0) and "img_norm_cfg" (means=0 and stds=1). - - Args: - to_float32 (bool): Whether to convert the loaded image to a float32 - numpy array. If set to False, the loaded image is an uint8 array. - Defaults to False. - color_type (str): The flag argument for :func:`mmcv.imfrombytes`. - Defaults to 'color'. - file_client_args (dict): Arguments to instantiate a FileClient. - See :class:`mmcv.fileio.FileClient` for details. - Defaults to ``dict(backend='disk')``. - """ - - def __init__(self, - to_float32=False, - color_type='unchanged', - file_client_args=dict(backend='disk')): - self.to_float32 = to_float32 - self.color_type = color_type - self.file_client_args = file_client_args.copy() - self.file_client = None - - def __call__(self, results): - """Call functions to load multiple images and get images meta - information. - - Args: - results (dict): Result dict from :obj:`mmdet.CustomDataset`. - - Returns: - dict: The dict contains loaded images and meta information. - """ - - if self.file_client is None: - self.file_client = mmcv.FileClient(**self.file_client_args) - - if results['img_prefix'] is not None: - filename = [ - osp.join(results['img_prefix'], fname) - for fname in results['img_info']['filename'] - ] - else: - filename = results['img_info']['filename'] - - img = [] - for name in filename: - img_bytes = self.file_client.get(name) - img.append(mmcv.imfrombytes(img_bytes, flag=self.color_type)) - img = np.stack(img, axis=-1) - if self.to_float32: - img = img.astype(np.float32) - - results['filename'] = filename - results['ori_filename'] = results['img_info']['filename'] - results['img'] = img - results['img_shape'] = img.shape - results['ori_shape'] = img.shape - # Set initial values for default meta_keys - results['pad_shape'] = img.shape - results['scale_factor'] = 1.0 - num_channels = 1 if len(img.shape) < 3 else img.shape[2] - results['img_norm_cfg'] = dict( - mean=np.zeros(num_channels, dtype=np.float32), - std=np.ones(num_channels, dtype=np.float32), - to_rgb=False) - return results - - def __repr__(self): - repr_str = (f'{self.__class__.__name__}(' - f'to_float32={self.to_float32}, ' - f"color_type='{self.color_type}', " - f'file_client_args={self.file_client_args})') - return repr_str - - -@PIPELINES.register_module() -class LoadAnnotations(object): - """Load mutiple types of annotations. - - Args: - with_bbox (bool): Whether to parse and load the bbox annotation. - Default: True. - with_label (bool): Whether to parse and load the label annotation. - Default: True. - with_mask (bool): Whether to parse and load the mask annotation. - Default: False. - with_seg (bool): Whether to parse and load the semantic segmentation - annotation. Default: False. - poly2mask (bool): Whether to convert the instance masks from polygons - to bitmaps. Default: True. - file_client_args (dict): Arguments to instantiate a FileClient. - See :class:`mmcv.fileio.FileClient` for details. - Defaults to ``dict(backend='disk')``. - """ - - def __init__(self, - with_bbox=True, - with_label=True, - with_mask=False, - with_seg=False, - poly2mask=True, - file_client_args=dict(backend='disk')): - self.with_bbox = with_bbox - self.with_label = with_label - self.with_mask = with_mask - self.with_seg = with_seg - self.poly2mask = poly2mask - self.file_client_args = file_client_args.copy() - self.file_client = None - - def _load_bboxes(self, results): - """Private function to load bounding box annotations. - - Args: - results (dict): Result dict from :obj:`mmdet.CustomDataset`. - - Returns: - dict: The dict contains loaded bounding box annotations. - """ - - ann_info = results['ann_info'] - results['gt_bboxes'] = ann_info['bboxes'].copy() - try: - results['gt_bboxes_3d'] = ann_info['bboxes_3d'].copy() - results['gt_bboxes_3d_proj'] = ann_info['bboxes_3d_proj'].copy() - results['bbox3d_fields'].append('gt_bboxes_3d') - results['bbox3d_fields'].append('gt_bboxes_3d_proj') - except: - print('3d data not loaded') - - gt_bboxes_ignore = ann_info.get('bboxes_ignore', None) - if gt_bboxes_ignore is not None: - results['gt_bboxes_ignore'] = gt_bboxes_ignore.copy() - results['bbox_fields'].append('gt_bboxes_ignore') - results['bbox_fields'].append('gt_bboxes') - return results - - def _load_labels(self, results): - """Private function to load label annotations. - - Args: - results (dict): Result dict from :obj:`mmdet.CustomDataset`. - - Returns: - dict: The dict contains loaded label annotations. - """ - - results['gt_labels'] = results['ann_info']['labels'].copy() - return results - - def _poly2mask(self, mask_ann, img_h, img_w): - """Private function to convert masks represented with polygon to - bitmaps. - - Args: - mask_ann (list | dict): Polygon mask annotation input. - img_h (int): The height of output mask. - img_w (int): The width of output mask. - - Returns: - numpy.ndarray: The decode bitmap mask of shape (img_h, img_w). - """ - - if isinstance(mask_ann, list): - # polygon -- a single object might consist of multiple parts - # we merge all parts into one mask rle code - rles = maskUtils.frPyObjects(mask_ann, img_h, img_w) - rle = maskUtils.merge(rles) - elif isinstance(mask_ann['counts'], list): - # uncompressed RLE - rle = maskUtils.frPyObjects(mask_ann, img_h, img_w) - else: - # rle - rle = mask_ann - mask = maskUtils.decode(rle) - return mask - - def process_polygons(self, polygons): - """Convert polygons to list of ndarray and filter invalid polygons. - - Args: - polygons (list[list]): Polygons of one instance. - - Returns: - list[numpy.ndarray]: Processed polygons. - """ - - polygons = [np.array(p) for p in polygons] - valid_polygons = [] - for polygon in polygons: - if len(polygon) % 2 == 0 and len(polygon) >= 6: - valid_polygons.append(polygon) - return valid_polygons - - def _load_masks(self, results): - """Private function to load mask annotations. - - Args: - results (dict): Result dict from :obj:`mmdet.CustomDataset`. - - Returns: - dict: The dict contains loaded mask annotations. - If ``self.poly2mask`` is set ``True``, `gt_mask` will contain - :obj:`PolygonMasks`. Otherwise, :obj:`BitmapMasks` is used. - """ - - h, w = results['img_info']['height'], results['img_info']['width'] - gt_masks = results['ann_info']['masks'] - if self.poly2mask: - gt_masks = BitmapMasks( - [self._poly2mask(mask, h, w) for mask in gt_masks], h, w) - else: - gt_masks = PolygonMasks( - [self.process_polygons(polygons) for polygons in gt_masks], h, - w) - results['gt_masks'] = gt_masks - results['mask_fields'].append('gt_masks') - return results - - def _load_semantic_seg(self, results): - """Private function to load semantic segmentation annotations. - - Args: - results (dict): Result dict from :obj:`dataset`. - - Returns: - dict: The dict contains loaded semantic segmentation annotations. - """ - - if self.file_client is None: - self.file_client = mmcv.FileClient(**self.file_client_args) - - filename = osp.join(results['seg_prefix'], - results['ann_info']['seg_map']) - img_bytes = self.file_client.get(filename) - results['gt_semantic_seg'] = mmcv.imfrombytes( - img_bytes, flag='unchanged').squeeze() - results['seg_fields'].append('gt_semantic_seg') - return results - - def __call__(self, results): - """Call function to load multiple types annotations. - - Args: - results (dict): Result dict from :obj:`mmdet.CustomDataset`. - - Returns: - dict: The dict contains loaded bounding box, label, mask and - semantic segmentation annotations. - """ - - if self.with_bbox: - results = self._load_bboxes(results) - if results is None: - return None - if self.with_label: - results = self._load_labels(results) - if self.with_mask: - results = self._load_masks(results) - if self.with_seg: - results = self._load_semantic_seg(results) - return results - - def __repr__(self): - repr_str = self.__class__.__name__ - repr_str += f'(with_bbox={self.with_bbox}, ' - repr_str += f'with_label={self.with_label}, ' - repr_str += f'with_mask={self.with_mask}, ' - repr_str += f'with_seg={self.with_seg}, ' - repr_str += f'poly2mask={self.poly2mask}, ' - repr_str += f'poly2mask={self.file_client_args})' - return repr_str - - -@PIPELINES.register_module() -class LoadProposals(object): - """Load proposal pipeline. - - Required key is "proposals". Updated keys are "proposals", "bbox_fields". - - Args: - num_max_proposals (int, optional): Maximum number of proposals to load. - If not specified, all proposals will be loaded. - """ - - def __init__(self, num_max_proposals=None): - self.num_max_proposals = num_max_proposals - - def __call__(self, results): - """Call function to load proposals from file. - - Args: - results (dict): Result dict from :obj:`mmdet.CustomDataset`. - - Returns: - dict: The dict contains loaded proposal annotations. - """ - - proposals = results['proposals'] - if proposals.shape[1] not in (4, 5): - raise AssertionError( - 'proposals should have shapes (n, 4) or (n, 5), ' - f'but found {proposals.shape}') - proposals = proposals[:, :4] - - if self.num_max_proposals is not None: - proposals = proposals[:self.num_max_proposals] - - if len(proposals) == 0: - proposals = np.array([[0, 0, 0, 0]], dtype=np.float32) - results['proposals'] = proposals - results['bbox_fields'].append('proposals') - return results - - def __repr__(self): - return self.__class__.__name__ + \ - f'(num_max_proposals={self.num_max_proposals})' - - -@PIPELINES.register_module() -class FilterAnnotations(object): - """Filter invalid annotations. - - Args: - min_gt_bbox_wh (tuple[int]): Minimum width and height of ground truth - boxes. - """ - - def __init__(self, min_gt_bbox_wh): - # TODO: add more filter options - self.min_gt_bbox_wh = min_gt_bbox_wh - - def __call__(self, results): - assert 'gt_bboxes' in results - gt_bboxes = results['gt_bboxes'] - w = gt_bboxes[:, 2] - gt_bboxes[:, 0] - h = gt_bboxes[:, 3] - gt_bboxes[:, 1] - keep = (w > self.min_gt_bbox_wh[0]) & (h > self.min_gt_bbox_wh[1]) - if not keep.any(): - return None - else: - keys = ('gt_bboxes', 'gt_labels', 'gt_masks', 'gt_semantic_seg') - for key in keys: - if key in results: - results[key] = results[key][keep] - return results diff --git a/spaces/dingding27/bingo/Dockerfile b/spaces/dingding27/bingo/Dockerfile deleted file mode 100644 index c677b05b75f7e4b2beee8c97fb47957a0861a83e..0000000000000000000000000000000000000000 --- a/spaces/dingding27/bingo/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM weaigc/bingo:latest - -ARG DEBIAN_FRONTEND=noninteractive - -ENV BING_HEADER "" - -CMD npm start diff --git a/spaces/dmeck/RVC-Speakers/speakers/server/static/static/css/app.bbfea95c.css b/spaces/dmeck/RVC-Speakers/speakers/server/static/static/css/app.bbfea95c.css deleted file mode 100644 index de9d6b0ec0dba3b75b736763d1faaddb77da058b..0000000000000000000000000000000000000000 --- a/spaces/dmeck/RVC-Speakers/speakers/server/static/static/css/app.bbfea95c.css +++ /dev/null @@ -1 +0,0 @@ -@font-face{font-family:element-icons;src:url(../../static/fonts/element-icons.535877f5.woff) format("woff"),url(../../static/fonts/element-icons.732389de.ttf) format("truetype");font-weight:400;font-display:"auto";font-style:normal}[class*=" el-icon-"],[class^=el-icon-]{font-family:element-icons!important;speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;vertical-align:baseline;display:inline-block;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.el-icon-ice-cream-round:before{content:""}.el-icon-ice-cream-square:before{content:""}.el-icon-lollipop:before{content:""}.el-icon-potato-strips:before{content:""}.el-icon-milk-tea:before{content:""}.el-icon-ice-drink:before{content:""}.el-icon-ice-tea:before{content:""}.el-icon-coffee:before{content:""}.el-icon-orange:before{content:""}.el-icon-pear:before{content:""}.el-icon-apple:before{content:""}.el-icon-cherry:before{content:""}.el-icon-watermelon:before{content:""}.el-icon-grape:before{content:""}.el-icon-refrigerator:before{content:""}.el-icon-goblet-square-full:before{content:""}.el-icon-goblet-square:before{content:""}.el-icon-goblet-full:before{content:""}.el-icon-goblet:before{content:""}.el-icon-cold-drink:before{content:""}.el-icon-coffee-cup:before{content:""}.el-icon-water-cup:before{content:""}.el-icon-hot-water:before{content:""}.el-icon-ice-cream:before{content:""}.el-icon-dessert:before{content:""}.el-icon-sugar:before{content:""}.el-icon-tableware:before{content:""}.el-icon-burger:before{content:""}.el-icon-knife-fork:before{content:""}.el-icon-fork-spoon:before{content:""}.el-icon-chicken:before{content:""}.el-icon-food:before{content:""}.el-icon-dish-1:before{content:""}.el-icon-dish:before{content:""}.el-icon-moon-night:before{content:""}.el-icon-moon:before{content:""}.el-icon-cloudy-and-sunny:before{content:""}.el-icon-partly-cloudy:before{content:""}.el-icon-cloudy:before{content:""}.el-icon-sunny:before{content:""}.el-icon-sunset:before{content:""}.el-icon-sunrise-1:before{content:""}.el-icon-sunrise:before{content:""}.el-icon-heavy-rain:before{content:""}.el-icon-lightning:before{content:""}.el-icon-light-rain:before{content:""}.el-icon-wind-power:before{content:""}.el-icon-baseball:before{content:""}.el-icon-soccer:before{content:""}.el-icon-football:before{content:""}.el-icon-basketball:before{content:""}.el-icon-ship:before{content:""}.el-icon-truck:before{content:""}.el-icon-bicycle:before{content:""}.el-icon-mobile-phone:before{content:""}.el-icon-service:before{content:""}.el-icon-key:before{content:""}.el-icon-unlock:before{content:""}.el-icon-lock:before{content:""}.el-icon-watch:before{content:""}.el-icon-watch-1:before{content:""}.el-icon-timer:before{content:""}.el-icon-alarm-clock:before{content:""}.el-icon-map-location:before{content:""}.el-icon-delete-location:before{content:""}.el-icon-add-location:before{content:""}.el-icon-location-information:before{content:""}.el-icon-location-outline:before{content:""}.el-icon-location:before{content:""}.el-icon-place:before{content:""}.el-icon-discover:before{content:""}.el-icon-first-aid-kit:before{content:""}.el-icon-trophy-1:before{content:""}.el-icon-trophy:before{content:""}.el-icon-medal:before{content:""}.el-icon-medal-1:before{content:""}.el-icon-stopwatch:before{content:""}.el-icon-mic:before{content:""}.el-icon-copy-document:before{content:""}.el-icon-full-screen:before{content:""}.el-icon-switch-button:before{content:""}.el-icon-aim:before{content:""}.el-icon-crop:before{content:""}.el-icon-odometer:before{content:""}.el-icon-time:before{content:""}.el-icon-bangzhu:before{content:""}.el-icon-close-notification:before{content:""}.el-icon-microphone:before{content:""}.el-icon-turn-off-microphone:before{content:""}.el-icon-position:before{content:""}.el-icon-postcard:before{content:""}.el-icon-message:before{content:""}.el-icon-chat-line-square:before{content:""}.el-icon-chat-dot-square:before{content:""}.el-icon-chat-dot-round:before{content:""}.el-icon-chat-square:before{content:""}.el-icon-chat-line-round:before{content:""}.el-icon-chat-round:before{content:""}.el-icon-set-up:before{content:""}.el-icon-turn-off:before{content:""}.el-icon-open:before{content:""}.el-icon-connection:before{content:""}.el-icon-link:before{content:""}.el-icon-cpu:before{content:""}.el-icon-thumb:before{content:""}.el-icon-female:before{content:""}.el-icon-male:before{content:""}.el-icon-guide:before{content:""}.el-icon-news:before{content:""}.el-icon-price-tag:before{content:""}.el-icon-discount:before{content:""}.el-icon-wallet:before{content:""}.el-icon-coin:before{content:""}.el-icon-money:before{content:""}.el-icon-bank-card:before{content:""}.el-icon-box:before{content:""}.el-icon-present:before{content:""}.el-icon-sell:before{content:""}.el-icon-sold-out:before{content:""}.el-icon-shopping-bag-2:before{content:""}.el-icon-shopping-bag-1:before{content:""}.el-icon-shopping-cart-2:before{content:""}.el-icon-shopping-cart-1:before{content:""}.el-icon-shopping-cart-full:before{content:""}.el-icon-smoking:before{content:""}.el-icon-no-smoking:before{content:""}.el-icon-house:before{content:""}.el-icon-table-lamp:before{content:""}.el-icon-school:before{content:""}.el-icon-office-building:before{content:""}.el-icon-toilet-paper:before{content:""}.el-icon-notebook-2:before{content:""}.el-icon-notebook-1:before{content:""}.el-icon-files:before{content:""}.el-icon-collection:before{content:""}.el-icon-receiving:before{content:""}.el-icon-suitcase-1:before{content:""}.el-icon-suitcase:before{content:""}.el-icon-film:before{content:""}.el-icon-collection-tag:before{content:""}.el-icon-data-analysis:before{content:""}.el-icon-pie-chart:before{content:""}.el-icon-data-board:before{content:""}.el-icon-data-line:before{content:""}.el-icon-reading:before{content:""}.el-icon-magic-stick:before{content:""}.el-icon-coordinate:before{content:""}.el-icon-mouse:before{content:""}.el-icon-brush:before{content:""}.el-icon-headset:before{content:""}.el-icon-umbrella:before{content:""}.el-icon-scissors:before{content:""}.el-icon-mobile:before{content:""}.el-icon-attract:before{content:""}.el-icon-monitor:before{content:""}.el-icon-search:before{content:""}.el-icon-takeaway-box:before{content:""}.el-icon-paperclip:before{content:""}.el-icon-printer:before{content:""}.el-icon-document-add:before{content:""}.el-icon-document:before{content:""}.el-icon-document-checked:before{content:""}.el-icon-document-copy:before{content:""}.el-icon-document-delete:before{content:""}.el-icon-document-remove:before{content:""}.el-icon-tickets:before{content:""}.el-icon-folder-checked:before{content:""}.el-icon-folder-delete:before{content:""}.el-icon-folder-remove:before{content:""}.el-icon-folder-add:before{content:""}.el-icon-folder-opened:before{content:""}.el-icon-folder:before{content:""}.el-icon-edit-outline:before{content:""}.el-icon-edit:before{content:""}.el-icon-date:before{content:""}.el-icon-c-scale-to-original:before{content:""}.el-icon-view:before{content:""}.el-icon-loading:before{content:""}.el-icon-rank:before{content:""}.el-icon-sort-down:before{content:""}.el-icon-sort-up:before{content:""}.el-icon-sort:before{content:""}.el-icon-finished:before{content:""}.el-icon-refresh-left:before{content:""}.el-icon-refresh-right:before{content:""}.el-icon-refresh:before{content:""}.el-icon-video-play:before{content:""}.el-icon-video-pause:before{content:""}.el-icon-d-arrow-right:before{content:""}.el-icon-d-arrow-left:before{content:""}.el-icon-arrow-up:before{content:""}.el-icon-arrow-down:before{content:""}.el-icon-arrow-right:before{content:""}.el-icon-arrow-left:before{content:""}.el-icon-top-right:before{content:""}.el-icon-top-left:before{content:""}.el-icon-top:before{content:""}.el-icon-bottom:before{content:""}.el-icon-right:before{content:""}.el-icon-back:before{content:""}.el-icon-bottom-right:before{content:""}.el-icon-bottom-left:before{content:""}.el-icon-caret-top:before{content:""}.el-icon-caret-bottom:before{content:""}.el-icon-caret-right:before{content:""}.el-icon-caret-left:before{content:""}.el-icon-d-caret:before{content:""}.el-icon-share:before{content:""}.el-icon-menu:before{content:""}.el-icon-s-grid:before{content:""}.el-icon-s-check:before{content:""}.el-icon-s-data:before{content:""}.el-icon-s-opportunity:before{content:""}.el-icon-s-custom:before{content:""}.el-icon-s-claim:before{content:""}.el-icon-s-finance:before{content:""}.el-icon-s-comment:before{content:""}.el-icon-s-flag:before{content:""}.el-icon-s-marketing:before{content:""}.el-icon-s-shop:before{content:""}.el-icon-s-open:before{content:""}.el-icon-s-management:before{content:""}.el-icon-s-ticket:before{content:""}.el-icon-s-release:before{content:""}.el-icon-s-home:before{content:""}.el-icon-s-promotion:before{content:""}.el-icon-s-operation:before{content:""}.el-icon-s-unfold:before{content:""}.el-icon-s-fold:before{content:""}.el-icon-s-platform:before{content:""}.el-icon-s-order:before{content:""}.el-icon-s-cooperation:before{content:""}.el-icon-bell:before{content:""}.el-icon-message-solid:before{content:""}.el-icon-video-camera:before{content:""}.el-icon-video-camera-solid:before{content:""}.el-icon-camera:before{content:""}.el-icon-camera-solid:before{content:""}.el-icon-download:before{content:""}.el-icon-upload2:before{content:""}.el-icon-upload:before{content:""}.el-icon-picture-outline-round:before{content:""}.el-icon-picture-outline:before{content:""}.el-icon-picture:before{content:""}.el-icon-close:before{content:""}.el-icon-check:before{content:""}.el-icon-plus:before{content:""}.el-icon-minus:before{content:""}.el-icon-help:before{content:""}.el-icon-s-help:before{content:""}.el-icon-circle-close:before{content:""}.el-icon-circle-check:before{content:""}.el-icon-circle-plus-outline:before{content:""}.el-icon-remove-outline:before{content:""}.el-icon-zoom-out:before{content:""}.el-icon-zoom-in:before{content:""}.el-icon-error:before{content:""}.el-icon-success:before{content:""}.el-icon-circle-plus:before{content:""}.el-icon-remove:before{content:""}.el-icon-info:before{content:""}.el-icon-question:before{content:""}.el-icon-warning-outline:before{content:""}.el-icon-warning:before{content:""}.el-icon-goods:before{content:""}.el-icon-s-goods:before{content:""}.el-icon-star-off:before{content:""}.el-icon-star-on:before{content:""}.el-icon-more-outline:before{content:""}.el-icon-more:before{content:""}.el-icon-phone-outline:before{content:""}.el-icon-phone:before{content:""}.el-icon-user:before{content:""}.el-icon-user-solid:before{content:""}.el-icon-setting:before{content:""}.el-icon-s-tools:before{content:""}.el-icon-delete:before{content:""}.el-icon-delete-solid:before{content:""}.el-icon-eleme:before{content:""}.el-icon-platform-eleme:before{content:""}.el-icon-loading{-webkit-animation:rotating 2s linear infinite;animation:rotating 2s linear infinite}.el-icon--right{margin-left:5px}.el-icon--left{margin-right:5px}@-webkit-keyframes rotating{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes rotating{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}.el-pagination{white-space:nowrap;padding:2px 5px;color:#303133;font-weight:700}.el-pagination:after,.el-pagination:before{display:table;content:""}.el-pagination:after{clear:both}.el-pagination button,.el-pagination span:not([class*=suffix]){display:inline-block;font-size:13px;min-width:35.5px;height:28px;line-height:28px;vertical-align:top;-webkit-box-sizing:border-box;box-sizing:border-box}.el-pagination .el-input__inner{text-align:center;-moz-appearance:textfield;line-height:normal}.el-pagination .el-input__suffix{right:0;-webkit-transform:scale(.8);transform:scale(.8)}.el-pagination .el-select .el-input{width:100px;margin:0 5px}.el-pagination .el-select .el-input .el-input__inner{padding-right:25px;border-radius:3px}.el-pagination button{border:none;padding:0 6px;background:transparent}.el-pagination button:focus{outline:none}.el-pagination button:hover{color:#1890ff}.el-pagination button:disabled{color:#c0c4cc;background-color:#fff;cursor:not-allowed}.el-pagination .btn-next,.el-pagination .btn-prev{background:50% no-repeat;background-size:16px;background-color:#fff;cursor:pointer;margin:0;color:#303133}.el-pagination .btn-next .el-icon,.el-pagination .btn-prev .el-icon{display:block;font-size:12px;font-weight:700}.el-pagination .btn-prev{padding-right:12px}.el-pagination .btn-next{padding-left:12px}.el-pagination .el-pager li.disabled{color:#c0c4cc;cursor:not-allowed}.el-pagination--small .btn-next,.el-pagination--small .btn-prev,.el-pagination--small .el-pager li,.el-pagination--small .el-pager li.btn-quicknext,.el-pagination--small .el-pager li.btn-quickprev,.el-pagination--small .el-pager li:last-child{border-color:transparent;font-size:12px;line-height:22px;height:22px;min-width:22px}.el-pagination--small .arrow.disabled{visibility:hidden}.el-pagination--small .more:before,.el-pagination--small li.more:before{line-height:24px}.el-pagination--small button,.el-pagination--small span:not([class*=suffix]){height:22px;line-height:22px}.el-pagination--small .el-pagination__editor,.el-pagination--small .el-pagination__editor.el-input .el-input__inner{height:22px}.el-pagination__sizes{margin:0 10px 0 0;font-weight:400;color:#606266}.el-pagination__sizes .el-input .el-input__inner{font-size:13px;padding-left:8px}.el-pagination__sizes .el-input .el-input__inner:hover{border-color:#1890ff}.el-pagination__total{margin-right:10px;font-weight:400;color:#606266}.el-pagination__jump{margin-left:24px;font-weight:400;color:#606266}.el-pagination__jump .el-input__inner{padding:0 3px}.el-pagination__rightwrapper{float:right}.el-pagination__editor{line-height:18px;padding:0 2px;height:28px;text-align:center;margin:0 2px;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:3px}.el-pagination__editor.el-input{width:50px}.el-pagination__editor.el-input .el-input__inner{height:28px}.el-pagination__editor .el-input__inner::-webkit-inner-spin-button,.el-pagination__editor .el-input__inner::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.el-pagination.is-background .btn-next,.el-pagination.is-background .btn-prev,.el-pagination.is-background .el-pager li{margin:0 5px;background-color:#f4f4f5;color:#606266;min-width:30px;border-radius:2px}.el-pagination.is-background .btn-next.disabled,.el-pagination.is-background .btn-prev.disabled,.el-pagination.is-background .el-pager li.disabled{color:#c0c4cc}.el-pagination.is-background .btn-next,.el-pagination.is-background .btn-prev{padding:0}.el-pagination.is-background .btn-next:disabled,.el-pagination.is-background .btn-prev:disabled{color:#c0c4cc}.el-pagination.is-background .el-pager li:not(.disabled):hover{color:#1890ff}.el-pagination.is-background .el-pager li:not(.disabled).active{background-color:#1890ff;color:#fff}.el-pagination.is-background.el-pagination--small .btn-next,.el-pagination.is-background.el-pagination--small .btn-prev,.el-pagination.is-background.el-pagination--small .el-pager li{margin:0 3px;min-width:22px}.el-pager{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;list-style:none;display:inline-block;vertical-align:top;font-size:0;padding:0;margin:0}.el-pager .more:before{line-height:30px}.el-pager li{padding:0 4px;background:#fff;vertical-align:top;display:inline-block;font-size:13px;min-width:35.5px;height:28px;line-height:28px;cursor:pointer;-webkit-box-sizing:border-box;box-sizing:border-box;text-align:center;margin:0}.el-pager li.btn-quicknext,.el-pager li.btn-quickprev{line-height:28px;color:#303133}.el-pager li.btn-quicknext.disabled,.el-pager li.btn-quickprev.disabled{color:#c0c4cc}.el-pager li.btn-quicknext:hover,.el-pager li.btn-quickprev:hover{cursor:pointer}.el-pager li.active+li{border-left:0}.el-pager li:hover{color:#1890ff}.el-pager li.active{color:#1890ff;cursor:default}@-webkit-keyframes v-modal-in{0%{opacity:0}}@-webkit-keyframes v-modal-out{to{opacity:0}}.el-dialog{margin:0 auto 50px;background:#fff;border-radius:2px;-webkit-box-shadow:0 1px 3px rgba(0,0,0,.3);box-shadow:0 1px 3px rgba(0,0,0,.3);-webkit-box-sizing:border-box;box-sizing:border-box;width:50%}.el-dialog.is-fullscreen{width:100%;margin-top:0;margin-bottom:0;height:100%;overflow:auto}.el-dialog__wrapper{position:fixed;top:0;right:0;bottom:0;left:0;overflow:auto;margin:0}.el-dialog__header{padding:20px;padding-bottom:10px}.el-dialog__headerbtn{position:absolute;top:20px;right:20px;padding:0;background:transparent;border:none;outline:none;cursor:pointer;font-size:16px}.el-dialog__headerbtn .el-dialog__close{color:#909399}.el-dialog__headerbtn:focus .el-dialog__close,.el-dialog__headerbtn:hover .el-dialog__close{color:#1890ff}.el-dialog__title{line-height:24px;font-size:18px;color:#303133}.el-dialog__body{padding:30px 20px;color:#606266;font-size:14px;word-break:break-all}.el-dialog__footer{padding:20px;padding-top:10px;text-align:right;-webkit-box-sizing:border-box;box-sizing:border-box}.el-dialog--center{text-align:center}.el-dialog--center .el-dialog__body{text-align:initial;padding:25px 25px 30px}.el-dialog--center .el-dialog__footer{text-align:inherit}.dialog-fade-enter-active{-webkit-animation:dialog-fade-in .3s;animation:dialog-fade-in .3s}.dialog-fade-leave-active{-webkit-animation:dialog-fade-out .3s;animation:dialog-fade-out .3s}@-webkit-keyframes dialog-fade-in{0%{-webkit-transform:translate3d(0,-20px,0);transform:translate3d(0,-20px,0);opacity:0}to{-webkit-transform:translateZ(0);transform:translateZ(0);opacity:1}}@keyframes dialog-fade-in{0%{-webkit-transform:translate3d(0,-20px,0);transform:translate3d(0,-20px,0);opacity:0}to{-webkit-transform:translateZ(0);transform:translateZ(0);opacity:1}}@-webkit-keyframes dialog-fade-out{0%{-webkit-transform:translateZ(0);transform:translateZ(0);opacity:1}to{-webkit-transform:translate3d(0,-20px,0);transform:translate3d(0,-20px,0);opacity:0}}@keyframes dialog-fade-out{0%{-webkit-transform:translateZ(0);transform:translateZ(0);opacity:1}to{-webkit-transform:translate3d(0,-20px,0);transform:translate3d(0,-20px,0);opacity:0}}.el-autocomplete{position:relative;display:inline-block}.el-autocomplete-suggestion{margin:5px 0;-webkit-box-shadow:0 2px 12px 0 rgba(0,0,0,.1);box-shadow:0 2px 12px 0 rgba(0,0,0,.1);border-radius:4px;border:1px solid #dfe4ed;-webkit-box-sizing:border-box;box-sizing:border-box;background-color:#fff}.el-autocomplete-suggestion__wrap{max-height:280px;padding:10px 0;-webkit-box-sizing:border-box;box-sizing:border-box}.el-autocomplete-suggestion__list{margin:0;padding:0}.el-autocomplete-suggestion li{padding:0 20px;margin:0;line-height:34px;cursor:pointer;color:#606266;font-size:14px;list-style:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.el-autocomplete-suggestion li.highlighted,.el-autocomplete-suggestion li:hover{background-color:#f5f7fa}.el-autocomplete-suggestion li.divider{margin-top:6px;border-top:1px solid #000}.el-autocomplete-suggestion li.divider:last-child{margin-bottom:-6px}.el-autocomplete-suggestion.is-loading li{text-align:center;height:100px;line-height:100px;font-size:20px;color:#999}.el-autocomplete-suggestion.is-loading li:after{display:inline-block;content:"";height:100%;vertical-align:middle}.el-autocomplete-suggestion.is-loading li:hover{background-color:#fff}.el-autocomplete-suggestion.is-loading .el-icon-loading{vertical-align:middle}.el-dropdown{display:inline-block;position:relative;color:#606266;font-size:14px}.el-dropdown .el-button-group{display:block}.el-dropdown .el-button-group .el-button{float:none}.el-dropdown .el-dropdown__caret-button{padding-left:5px;padding-right:5px;position:relative;border-left:none}.el-dropdown .el-dropdown__caret-button:before{content:"";position:absolute;display:block;width:1px;top:5px;bottom:5px;left:0;background:hsla(0,0%,100%,.5)}.el-dropdown .el-dropdown__caret-button.el-button--default:before{background:rgba(220,223,230,.5)}.el-dropdown .el-dropdown__caret-button:hover:not(.is-disabled):before{top:0;bottom:0}.el-dropdown .el-dropdown__caret-button .el-dropdown__icon{padding-left:0}.el-dropdown__icon{font-size:12px;margin:0 3px}.el-dropdown .el-dropdown-selfdefine:focus:active,.el-dropdown .el-dropdown-selfdefine:focus:not(.focusing){outline-width:0}.el-dropdown [disabled]{cursor:not-allowed;color:#bbb}.el-dropdown-menu{position:absolute;top:0;left:0;z-index:10;padding:10px 0;margin:5px 0;background-color:#fff;border:1px solid #e6ebf5;border-radius:4px;-webkit-box-shadow:0 2px 12px 0 rgba(0,0,0,.1);box-shadow:0 2px 12px 0 rgba(0,0,0,.1)}.el-dropdown-menu__item{list-style:none;line-height:36px;padding:0 20px;margin:0;font-size:14px;color:#606266;cursor:pointer;outline:none}.el-dropdown-menu__item:focus,.el-dropdown-menu__item:not(.is-disabled):hover{background-color:#e8f4ff;color:#46a6ff}.el-dropdown-menu__item i{margin-right:5px}.el-dropdown-menu__item--divided{position:relative;margin-top:6px;border-top:1px solid #e6ebf5}.el-dropdown-menu__item--divided:before{content:"";height:6px;display:block;margin:0 -20px;background-color:#fff}.el-dropdown-menu__item.is-disabled{cursor:default;color:#bbb;pointer-events:none}.el-dropdown-menu--medium{padding:6px 0}.el-dropdown-menu--medium .el-dropdown-menu__item{line-height:30px;padding:0 17px;font-size:14px}.el-dropdown-menu--medium .el-dropdown-menu__item.el-dropdown-menu__item--divided{margin-top:6px}.el-dropdown-menu--medium .el-dropdown-menu__item.el-dropdown-menu__item--divided:before{height:6px;margin:0 -17px}.el-dropdown-menu--small{padding:6px 0}.el-dropdown-menu--small .el-dropdown-menu__item{line-height:27px;padding:0 15px;font-size:13px}.el-dropdown-menu--small .el-dropdown-menu__item.el-dropdown-menu__item--divided{margin-top:4px}.el-dropdown-menu--small .el-dropdown-menu__item.el-dropdown-menu__item--divided:before{height:4px;margin:0 -15px}.el-dropdown-menu--mini{padding:3px 0}.el-dropdown-menu--mini .el-dropdown-menu__item{line-height:24px;padding:0 10px;font-size:12px}.el-dropdown-menu--mini .el-dropdown-menu__item.el-dropdown-menu__item--divided{margin-top:3px}.el-dropdown-menu--mini .el-dropdown-menu__item.el-dropdown-menu__item--divided:before{height:3px;margin:0 -10px}.el-menu{border-right:1px solid #e6e6e6;list-style:none;position:relative;margin:0;padding-left:0;background-color:#fff}.el-menu:after,.el-menu:before{display:table;content:""}.el-menu:after{clear:both}.el-menu.el-menu--horizontal{border-bottom:1px solid #e6e6e6}.el-menu--horizontal{border-right:none}.el-menu--horizontal>.el-menu-item{float:left;height:60px;line-height:60px;margin:0;border-bottom:2px solid transparent;color:#909399}.el-menu--horizontal>.el-menu-item a,.el-menu--horizontal>.el-menu-item a:hover{color:inherit}.el-menu--horizontal>.el-menu-item:not(.is-disabled):focus,.el-menu--horizontal>.el-menu-item:not(.is-disabled):hover{background-color:#fff}.el-menu--horizontal>.el-submenu{float:left}.el-menu--horizontal>.el-submenu:focus,.el-menu--horizontal>.el-submenu:hover{outline:none}.el-menu--horizontal>.el-submenu:focus .el-submenu__title,.el-menu--horizontal>.el-submenu:hover .el-submenu__title{color:#303133}.el-menu--horizontal>.el-submenu.is-active .el-submenu__title{border-bottom:2px solid #1890ff;color:#303133}.el-menu--horizontal>.el-submenu .el-submenu__title{height:60px;line-height:60px;border-bottom:2px solid transparent;color:#909399}.el-menu--horizontal>.el-submenu .el-submenu__title:hover{background-color:#fff}.el-menu--horizontal>.el-submenu .el-submenu__icon-arrow{position:static;vertical-align:middle;margin-left:8px;margin-top:-3px}.el-menu--horizontal .el-menu .el-menu-item,.el-menu--horizontal .el-menu .el-submenu__title{background-color:#fff;float:none;height:36px;line-height:36px;padding:0 10px;color:#909399}.el-menu--horizontal .el-menu .el-menu-item.is-active,.el-menu--horizontal .el-menu .el-submenu.is-active>.el-submenu__title{color:#303133}.el-menu--horizontal .el-menu-item:not(.is-disabled):focus,.el-menu--horizontal .el-menu-item:not(.is-disabled):hover{outline:none;color:#303133}.el-menu--horizontal>.el-menu-item.is-active{border-bottom:2px solid #1890ff;color:#303133}.el-menu--collapse{width:64px}.el-menu--collapse>.el-menu-item [class^=el-icon-],.el-menu--collapse>.el-submenu>.el-submenu__title [class^=el-icon-]{margin:0;vertical-align:middle;width:24px;text-align:center}.el-menu--collapse>.el-menu-item .el-submenu__icon-arrow,.el-menu--collapse>.el-submenu>.el-submenu__title .el-submenu__icon-arrow{display:none}.el-menu--collapse>.el-menu-item span,.el-menu--collapse>.el-submenu>.el-submenu__title span{height:0;width:0;overflow:hidden;visibility:hidden;display:inline-block}.el-menu--collapse>.el-menu-item.is-active i{color:inherit}.el-menu--collapse .el-menu .el-submenu{min-width:200px}.el-menu--collapse .el-submenu{position:relative}.el-menu--collapse .el-submenu .el-menu{position:absolute;margin-left:5px;top:0;left:100%;z-index:10;border:1px solid #dfe4ed;border-radius:2px;-webkit-box-shadow:0 2px 12px 0 rgba(0,0,0,.1);box-shadow:0 2px 12px 0 rgba(0,0,0,.1)}.el-menu--collapse .el-submenu.is-opened>.el-submenu__title .el-submenu__icon-arrow{-webkit-transform:none;transform:none}.el-menu--popup{z-index:100;min-width:200px;border:none;padding:5px 0;border-radius:2px;-webkit-box-shadow:0 2px 12px 0 rgba(0,0,0,.1);box-shadow:0 2px 12px 0 rgba(0,0,0,.1)}.el-menu--popup-bottom-start{margin-top:5px}.el-menu--popup-right-start{margin-left:5px;margin-right:5px}.el-menu-item{height:56px;line-height:56px;font-size:14px;color:#303133;padding:0 20px;list-style:none;cursor:pointer;position:relative;-webkit-transition:border-color .3s,background-color .3s,color .3s;transition:border-color .3s,background-color .3s,color .3s;-webkit-box-sizing:border-box;box-sizing:border-box;white-space:nowrap}.el-menu-item *{vertical-align:middle}.el-menu-item i{color:#909399}.el-menu-item:focus,.el-menu-item:hover{outline:none;background-color:#e8f4ff}.el-menu-item.is-disabled{opacity:.25;cursor:not-allowed;background:none!important}.el-menu-item [class^=el-icon-]{margin-right:5px;width:24px;text-align:center;font-size:18px;vertical-align:middle}.el-menu-item.is-active{color:#1890ff}.el-menu-item.is-active i{color:inherit}.el-submenu{list-style:none;margin:0;padding-left:0}.el-submenu__title{height:56px;line-height:56px;font-size:14px;color:#303133;padding:0 20px;list-style:none;cursor:pointer;position:relative;-webkit-transition:border-color .3s,background-color .3s,color .3s;transition:border-color .3s,background-color .3s,color .3s;-webkit-box-sizing:border-box;box-sizing:border-box;white-space:nowrap}.el-submenu__title *{vertical-align:middle}.el-submenu__title i{color:#909399}.el-submenu__title:focus,.el-submenu__title:hover{outline:none;background-color:#e8f4ff}.el-submenu__title.is-disabled{opacity:.25;cursor:not-allowed;background:none!important}.el-submenu__title:hover{background-color:#e8f4ff}.el-submenu .el-menu{border:none}.el-submenu .el-menu-item{height:50px;line-height:50px;padding:0 45px;min-width:200px}.el-submenu__icon-arrow{position:absolute;top:50%;right:20px;margin-top:-7px;-webkit-transition:-webkit-transform .3s;transition:-webkit-transform .3s;transition:transform .3s;transition:transform .3s,-webkit-transform .3s;font-size:12px}.el-submenu.is-active .el-submenu__title{border-bottom-color:#1890ff}.el-submenu.is-opened>.el-submenu__title .el-submenu__icon-arrow{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.el-submenu.is-disabled .el-menu-item,.el-submenu.is-disabled .el-submenu__title{opacity:.25;cursor:not-allowed;background:none!important}.el-submenu [class^=el-icon-]{vertical-align:middle;margin-right:5px;width:24px;text-align:center;font-size:18px}.el-menu-item-group>ul{padding:0}.el-menu-item-group__title{padding:7px 0 7px 20px;line-height:normal;font-size:12px;color:#909399}.horizontal-collapse-transition .el-submenu__title .el-submenu__icon-arrow{-webkit-transition:.2s;transition:.2s;opacity:0}.el-radio-group{display:inline-block;line-height:1;vertical-align:middle;font-size:0}.el-radio-button,.el-radio-button__inner{position:relative;display:inline-block;outline:none}.el-radio-button__inner{line-height:1;white-space:nowrap;vertical-align:middle;background:#fff;border:1px solid #dcdfe6;font-weight:400;border-left:0;color:#606266;-webkit-appearance:none;text-align:center;-webkit-box-sizing:border-box;box-sizing:border-box;margin:0;cursor:pointer;-webkit-transition:all .3s cubic-bezier(.645,.045,.355,1);transition:all .3s cubic-bezier(.645,.045,.355,1);padding:12px 20px;font-size:14px;border-radius:0}.el-radio-button__inner.is-round{padding:12px 20px}.el-radio-button__inner:hover{color:#1890ff}.el-radio-button__inner [class*=el-icon-]{line-height:.9}.el-radio-button__inner [class*=el-icon-]+span{margin-left:5px}.el-radio-button:first-child .el-radio-button__inner{border-left:1px solid #dcdfe6;border-radius:4px 0 0 4px;-webkit-box-shadow:none!important;box-shadow:none!important}.el-radio-button__orig-radio{opacity:0;outline:none;position:absolute;z-index:-1}.el-radio-button__orig-radio:checked+.el-radio-button__inner{color:#fff;background-color:#1890ff;border-color:#1890ff;-webkit-box-shadow:-1px 0 0 0 #1890ff;box-shadow:-1px 0 0 0 #1890ff}.el-radio-button__orig-radio:disabled+.el-radio-button__inner{color:#c0c4cc;cursor:not-allowed;background-image:none;background-color:#fff;border-color:#e6ebf5;-webkit-box-shadow:none;box-shadow:none}.el-radio-button__orig-radio:disabled:checked+.el-radio-button__inner{background-color:#f2f6fc}.el-radio-button:last-child .el-radio-button__inner{border-radius:0 4px 4px 0}.el-radio-button:first-child:last-child .el-radio-button__inner{border-radius:4px}.el-radio-button--medium .el-radio-button__inner{padding:10px 20px;font-size:14px;border-radius:0}.el-radio-button--medium .el-radio-button__inner.is-round{padding:10px 20px}.el-radio-button--small .el-radio-button__inner{padding:9px 15px;font-size:12px;border-radius:0}.el-radio-button--small .el-radio-button__inner.is-round{padding:9px 15px}.el-radio-button--mini .el-radio-button__inner{padding:7px 15px;font-size:12px;border-radius:0}.el-radio-button--mini .el-radio-button__inner.is-round{padding:7px 15px}.el-radio-button:focus:not(.is-focus):not(:active):not(.is-disabled){-webkit-box-shadow:0 0 2px 2px #1890ff;box-shadow:0 0 2px 2px #1890ff}.el-switch{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;position:relative;font-size:14px;line-height:20px;height:20px;vertical-align:middle}.el-switch.is-disabled .el-switch__core,.el-switch.is-disabled .el-switch__label{cursor:not-allowed}.el-switch__label{-webkit-transition:.2s;transition:.2s;height:20px;display:inline-block;font-size:14px;font-weight:500;cursor:pointer;vertical-align:middle;color:#303133}.el-switch__label.is-active{color:#1890ff}.el-switch__label--left{margin-right:10px}.el-switch__label--right{margin-left:10px}.el-switch__label *{line-height:1;font-size:14px;display:inline-block}.el-switch__input{position:absolute;width:0;height:0;opacity:0;margin:0}.el-switch__core{margin:0;display:inline-block;position:relative;width:40px;height:20px;border:1px solid #dcdfe6;outline:none;border-radius:10px;-webkit-box-sizing:border-box;box-sizing:border-box;background:#dcdfe6;cursor:pointer;-webkit-transition:border-color .3s,background-color .3s;transition:border-color .3s,background-color .3s;vertical-align:middle}.el-switch__core:after{content:"";position:absolute;top:1px;left:1px;border-radius:100%;-webkit-transition:all .3s;transition:all .3s;width:16px;height:16px;background-color:#fff}.el-switch.is-checked .el-switch__core{border-color:#1890ff;background-color:#1890ff}.el-switch.is-checked .el-switch__core:after{left:100%;margin-left:-17px}.el-switch.is-disabled{opacity:.6}.el-switch--wide .el-switch__label.el-switch__label--left span{left:10px}.el-switch--wide .el-switch__label.el-switch__label--right span{right:10px}.el-switch .label-fade-enter,.el-switch .label-fade-leave-active{opacity:0}.el-select-dropdown{position:absolute;z-index:1001;border:1px solid #dfe4ed;border-radius:4px;background-color:#fff;-webkit-box-shadow:0 2px 12px 0 rgba(0,0,0,.1);box-shadow:0 2px 12px 0 rgba(0,0,0,.1);-webkit-box-sizing:border-box;box-sizing:border-box;margin:5px 0}.el-select-dropdown.is-multiple .el-select-dropdown__item{padding-right:40px}.el-select-dropdown.is-multiple .el-select-dropdown__item.selected{color:#1890ff;background-color:#fff}.el-select-dropdown.is-multiple .el-select-dropdown__item.selected.hover{background-color:#f5f7fa}.el-select-dropdown.is-multiple .el-select-dropdown__item.selected:after{position:absolute;right:20px;font-family:element-icons;content:"";font-size:12px;font-weight:700;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.el-select-dropdown .el-scrollbar.is-empty .el-select-dropdown__list{padding:0}.el-select-dropdown__empty{padding:10px 0;margin:0;text-align:center;color:#999;font-size:14px}.el-select-dropdown__wrap{max-height:274px}.el-select-dropdown__list{list-style:none;padding:6px 0;margin:0;-webkit-box-sizing:border-box;box-sizing:border-box}.el-select-dropdown__item{font-size:14px;padding:0 20px;position:relative;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#606266;height:34px;line-height:34px;-webkit-box-sizing:border-box;box-sizing:border-box;cursor:pointer}.el-select-dropdown__item.is-disabled{color:#c0c4cc;cursor:not-allowed}.el-select-dropdown__item.is-disabled:hover{background-color:#fff}.el-select-dropdown__item.hover,.el-select-dropdown__item:hover{background-color:#f5f7fa}.el-select-dropdown__item.selected{color:#1890ff;font-weight:700}.el-select-group{margin:0;padding:0}.el-select-group__wrap{position:relative;list-style:none;margin:0;padding:0}.el-select-group__wrap:not(:last-of-type){padding-bottom:24px}.el-select-group__wrap:not(:last-of-type):after{content:"";position:absolute;display:block;left:20px;right:20px;bottom:12px;height:1px;background:#dfe4ed}.el-select-group__title{padding-left:20px;font-size:12px;color:#909399;line-height:30px}.el-select-group .el-select-dropdown__item{padding-left:20px}.el-select{display:inline-block;position:relative}.el-select .el-select__tags>span{display:contents}.el-select:hover .el-input__inner{border-color:#c0c4cc}.el-select .el-input__inner{cursor:pointer;padding-right:35px}.el-select .el-input__inner:focus{border-color:#1890ff}.el-select .el-input .el-select__caret{color:#c0c4cc;font-size:14px;-webkit-transition:-webkit-transform .3s;transition:-webkit-transform .3s;transition:transform .3s;transition:transform .3s,-webkit-transform .3s;-webkit-transform:rotate(180deg);transform:rotate(180deg);cursor:pointer}.el-select .el-input .el-select__caret.is-reverse{-webkit-transform:rotate(0deg);transform:rotate(0deg)}.el-select .el-input .el-select__caret.is-show-close{font-size:14px;text-align:center;-webkit-transform:rotate(180deg);transform:rotate(180deg);border-radius:100%;color:#c0c4cc;-webkit-transition:color .2s cubic-bezier(.645,.045,.355,1);transition:color .2s cubic-bezier(.645,.045,.355,1)}.el-select .el-input .el-select__caret.is-show-close:hover{color:#909399}.el-select .el-input.is-disabled .el-input__inner{cursor:not-allowed}.el-select .el-input.is-disabled .el-input__inner:hover{border-color:#dfe4ed}.el-select .el-input.is-focus .el-input__inner{border-color:#1890ff}.el-select>.el-input{display:block}.el-select__input{border:none;outline:none;padding:0;margin-left:15px;color:#666;font-size:14px;-webkit-appearance:none;-moz-appearance:none;appearance:none;height:28px;background-color:transparent}.el-select__input.is-mini{height:14px}.el-select__close{cursor:pointer;position:absolute;top:8px;z-index:1000;right:25px;color:#c0c4cc;line-height:18px;font-size:14px}.el-select__close:hover{color:#909399}.el-select__tags{position:absolute;line-height:normal;white-space:normal;z-index:1;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-ms-flex-wrap:wrap;flex-wrap:wrap}.el-select__tags-text{overflow:hidden;text-overflow:ellipsis}.el-select .el-tag{-webkit-box-sizing:border-box;box-sizing:border-box;border-color:transparent;margin:2px 0 2px 6px;background-color:#f0f2f5;display:-webkit-box;display:-ms-flexbox;display:flex;max-width:100%;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.el-select .el-tag__close.el-icon-close{background-color:#c0c4cc;top:0;color:#fff;-ms-flex-negative:0;flex-shrink:0}.el-select .el-tag__close.el-icon-close:hover{background-color:#909399}.el-select .el-tag__close.el-icon-close:before{display:block;-webkit-transform:translateY(.5px);transform:translateY(.5px)}.el-table{position:relative;overflow:hidden;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-box-flex:1;-ms-flex:1;flex:1;width:100%;max-width:100%;background-color:#fff;font-size:14px;color:#606266}.el-table__empty-block{min-height:60px;text-align:center;width:100%;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.el-table__empty-text{line-height:60px;width:50%;color:#909399}.el-table__expand-column .cell{padding:0;text-align:center}.el-table__expand-icon{position:relative;cursor:pointer;color:#666;font-size:12px;-webkit-transition:-webkit-transform .2s ease-in-out;transition:-webkit-transform .2s ease-in-out;transition:transform .2s ease-in-out;transition:transform .2s ease-in-out,-webkit-transform .2s ease-in-out;height:20px}.el-table__expand-icon--expanded{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.el-table__expand-icon>.el-icon{position:absolute;left:50%;top:50%;margin-left:-5px;margin-top:-5px}.el-table__expanded-cell{background-color:#fff}.el-table__expanded-cell[class*=cell]{padding:20px 50px}.el-table__expanded-cell:hover{background-color:transparent!important}.el-table__placeholder{display:inline-block;width:20px}.el-table__append-wrapper{overflow:hidden}.el-table--fit{border-right:0;border-bottom:0}.el-table--fit .el-table__cell.gutter{border-right-width:1px}.el-table--scrollable-x .el-table__body-wrapper{overflow-x:auto}.el-table--scrollable-y .el-table__body-wrapper{overflow-y:auto}.el-table thead{color:#909399;font-weight:500}.el-table thead.is-group th.el-table__cell{background:#f5f7fa}.el-table .el-table__cell{padding:12px 0;min-width:0;-webkit-box-sizing:border-box;box-sizing:border-box;text-overflow:ellipsis;vertical-align:middle;position:relative;text-align:left}.el-table .el-table__cell.is-center{text-align:center}.el-table .el-table__cell.is-right{text-align:right}.el-table .el-table__cell.gutter{width:15px;border-right-width:0;border-bottom-width:0;padding:0}.el-table .el-table__cell.is-hidden>*{visibility:hidden}.el-table--medium .el-table__cell{padding:10px 0}.el-table--small{font-size:12px}.el-table--small .el-table__cell{padding:8px 0}.el-table--mini{font-size:12px}.el-table--mini .el-table__cell{padding:6px 0}.el-table tr{background-color:#fff}.el-table tr input[type=checkbox]{margin:0}.el-table td.el-table__cell,.el-table th.el-table__cell.is-leaf{border-bottom:1px solid #dfe6ec}.el-table th.el-table__cell.is-sortable{cursor:pointer}.el-table th.el-table__cell{overflow:hidden;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-color:#fff}.el-table th.el-table__cell>.cell{display:inline-block;-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;vertical-align:middle;padding-left:10px;padding-right:10px;width:100%}.el-table th.el-table__cell>.cell.highlight{color:#1890ff}.el-table th.el-table__cell.required>div:before{display:inline-block;content:"";width:8px;height:8px;border-radius:50%;background:#ff4d51;margin-right:5px;vertical-align:middle}.el-table td.el-table__cell div{-webkit-box-sizing:border-box;box-sizing:border-box}.el-table td.el-table__cell.gutter{width:0}.el-table .cell{-webkit-box-sizing:border-box;box-sizing:border-box;overflow:hidden;text-overflow:ellipsis;white-space:normal;word-break:break-all;line-height:23px;padding-left:10px;padding-right:10px}.el-table .cell.el-tooltip{white-space:nowrap;min-width:50px}.el-table--border,.el-table--group{border:1px solid #dfe6ec}.el-table--border:after,.el-table--group:after,.el-table:before{content:"";position:absolute;background-color:#e6ebf5;z-index:1}.el-table--border:after,.el-table--group:after{top:0;right:0;width:1px;height:100%}.el-table:before{left:0;bottom:0;width:100%;height:1px}.el-table--border{border-right:none;border-bottom:none}.el-table--border.el-loading-parent--relative{border-color:transparent}.el-table--border .el-table__cell{border-right:1px solid #dfe6ec}.el-table--border .el-table__cell:first-child .cell{padding-left:10px}.el-table--border th.el-table__cell.gutter:last-of-type{border-bottom:1px solid #dfe6ec;border-bottom-width:1px}.el-table--border th.el-table__cell{border-bottom:1px solid #dfe6ec}.el-table--hidden{visibility:hidden}.el-table__fixed,.el-table__fixed-right{position:absolute;top:0;left:0;overflow-x:hidden;overflow-y:hidden;-webkit-box-shadow:0 0 10px rgba(0,0,0,.12);box-shadow:0 0 10px rgba(0,0,0,.12)}.el-table__fixed-right:before,.el-table__fixed:before{content:"";position:absolute;left:0;bottom:0;width:100%;height:1px;background-color:#e6ebf5;z-index:4}.el-table__fixed-right-patch{position:absolute;top:-1px;right:0;background-color:#fff;border-bottom:1px solid #dfe6ec}.el-table__fixed-right{top:0;left:auto;right:0}.el-table__fixed-right .el-table__fixed-body-wrapper,.el-table__fixed-right .el-table__fixed-footer-wrapper,.el-table__fixed-right .el-table__fixed-header-wrapper{left:auto;right:0}.el-table__fixed-header-wrapper{position:absolute;left:0;top:0;z-index:3}.el-table__fixed-footer-wrapper{position:absolute;left:0;bottom:0;z-index:3}.el-table__fixed-footer-wrapper tbody td.el-table__cell{border-top:1px solid #dfe6ec;background-color:#f5f7fa;color:#606266}.el-table__fixed-body-wrapper{position:absolute;left:0;top:37px;overflow:hidden;z-index:3}.el-table__body-wrapper,.el-table__footer-wrapper,.el-table__header-wrapper{width:100%}.el-table__footer-wrapper{margin-top:-1px}.el-table__footer-wrapper td.el-table__cell{border-top:1px solid #dfe6ec}.el-table__body,.el-table__footer,.el-table__header{table-layout:fixed;border-collapse:separate}.el-table__footer-wrapper,.el-table__header-wrapper{overflow:hidden}.el-table__footer-wrapper tbody td.el-table__cell,.el-table__header-wrapper tbody td.el-table__cell{background-color:#f5f7fa;color:#606266}.el-table__body-wrapper{overflow:hidden;position:relative}.el-table__body-wrapper.is-scrolling-left~.el-table__fixed,.el-table__body-wrapper.is-scrolling-none~.el-table__fixed,.el-table__body-wrapper.is-scrolling-none~.el-table__fixed-right,.el-table__body-wrapper.is-scrolling-right~.el-table__fixed-right{-webkit-box-shadow:none;box-shadow:none}.el-table__body-wrapper .el-table--border.is-scrolling-right~.el-table__fixed-right{border-left:1px solid #dfe6ec}.el-table__body-wrapper .el-table--border.is-scrolling-left~.el-table__fixed{border-right:1px solid #dfe6ec}.el-table .caret-wrapper{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:center;-ms-flex-align:center;align-items:center;height:34px;width:24px;vertical-align:middle;cursor:pointer;overflow:initial;position:relative}.el-table .sort-caret{width:0;height:0;border:5px solid transparent;position:absolute;left:7px}.el-table .sort-caret.ascending{border-bottom-color:#c0c4cc;top:5px}.el-table .sort-caret.descending{border-top-color:#c0c4cc;bottom:7px}.el-table .ascending .sort-caret.ascending{border-bottom-color:#1890ff}.el-table .descending .sort-caret.descending{border-top-color:#1890ff}.el-table .hidden-columns{visibility:hidden;position:absolute;z-index:-1}.el-table--striped .el-table__body tr.el-table__row--striped td.el-table__cell{background:#fafafa}.el-table--striped .el-table__body tr.el-table__row--striped.current-row td.el-table__cell{background-color:#e8f4ff}.el-table__body tr.hover-row.current-row>td.el-table__cell,.el-table__body tr.hover-row.el-table__row--striped.current-row>td.el-table__cell,.el-table__body tr.hover-row.el-table__row--striped>td.el-table__cell,.el-table__body tr.hover-row>td.el-table__cell{background-color:#f5f7fa}.el-table__body tr.current-row>td.el-table__cell{background-color:#e8f4ff}.el-table__column-resize-proxy{position:absolute;left:200px;top:0;bottom:0;width:0;border-left:1px solid #dfe6ec;z-index:10}.el-table__column-filter-trigger{display:inline-block;line-height:34px;cursor:pointer}.el-table__column-filter-trigger i{color:#909399;font-size:12px;-webkit-transform:scale(.75);transform:scale(.75)}.el-table--enable-row-transition .el-table__body td.el-table__cell{-webkit-transition:background-color .25s ease;transition:background-color .25s ease}.el-table--enable-row-hover .el-table__body tr:hover>td.el-table__cell{background-color:#f5f7fa}.el-table--fluid-height .el-table__fixed,.el-table--fluid-height .el-table__fixed-right{bottom:0;overflow:hidden}.el-table [class*=el-table__row--level] .el-table__expand-icon{display:inline-block;width:20px;line-height:20px;height:20px;text-align:center;margin-right:3px}.el-table-column--selection .cell{padding-left:14px;padding-right:14px}.el-table-filter{border:1px solid #e6ebf5;border-radius:2px;background-color:#fff;-webkit-box-shadow:0 2px 12px 0 rgba(0,0,0,.1);box-shadow:0 2px 12px 0 rgba(0,0,0,.1);-webkit-box-sizing:border-box;box-sizing:border-box;margin:2px 0}.el-table-filter__list{padding:5px 0;margin:0;list-style:none;min-width:100px}.el-table-filter__list-item{line-height:36px;padding:0 10px;cursor:pointer;font-size:14px}.el-table-filter__list-item:hover{background-color:#e8f4ff;color:#46a6ff}.el-table-filter__list-item.is-active{background-color:#1890ff;color:#fff}.el-table-filter__content{min-width:100px}.el-table-filter__bottom{border-top:1px solid #e6ebf5;padding:8px}.el-table-filter__bottom button{background:transparent;border:none;color:#606266;cursor:pointer;font-size:13px;padding:0 3px}.el-table-filter__bottom button:hover{color:#1890ff}.el-table-filter__bottom button:focus{outline:none}.el-table-filter__bottom button.is-disabled{color:#c0c4cc;cursor:not-allowed}.el-table-filter__wrap{max-height:280px}.el-table-filter__checkbox-group{padding:10px}.el-table-filter__checkbox-group label.el-checkbox{display:block;margin-right:5px;margin-bottom:8px;margin-left:5px}.el-table-filter__checkbox-group .el-checkbox:last-child{margin-bottom:0}.el-date-table{font-size:12px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-date-table.is-week-mode .el-date-table__row:hover div{background-color:#f2f6fc}.el-date-table.is-week-mode .el-date-table__row:hover td.available:hover{color:#606266}.el-date-table.is-week-mode .el-date-table__row:hover td:first-child div{margin-left:5px;border-top-left-radius:15px;border-bottom-left-radius:15px}.el-date-table.is-week-mode .el-date-table__row:hover td:last-child div{margin-right:5px;border-top-right-radius:15px;border-bottom-right-radius:15px}.el-date-table.is-week-mode .el-date-table__row.current div{background-color:#f2f6fc}.el-date-table td{width:32px;padding:4px 0;text-align:center;cursor:pointer;position:relative}.el-date-table td,.el-date-table td div{height:30px;-webkit-box-sizing:border-box;box-sizing:border-box}.el-date-table td div{padding:3px 0}.el-date-table td span{width:24px;height:24px;display:block;margin:0 auto;line-height:24px;position:absolute;left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%);border-radius:50%}.el-date-table td.next-month,.el-date-table td.prev-month{color:#c0c4cc}.el-date-table td.today{position:relative}.el-date-table td.today span{color:#1890ff;font-weight:700}.el-date-table td.today.end-date span,.el-date-table td.today.start-date span{color:#fff}.el-date-table td.available:hover{color:#1890ff}.el-date-table td.in-range div,.el-date-table td.in-range div:hover{background-color:#f2f6fc}.el-date-table td.current:not(.disabled) span{color:#fff;background-color:#1890ff}.el-date-table td.end-date div,.el-date-table td.start-date div{color:#fff}.el-date-table td.end-date span,.el-date-table td.start-date span{background-color:#1890ff}.el-date-table td.start-date div{margin-left:5px;border-top-left-radius:15px;border-bottom-left-radius:15px}.el-date-table td.end-date div{margin-right:5px;border-top-right-radius:15px;border-bottom-right-radius:15px}.el-date-table td.disabled div{background-color:#f5f7fa;opacity:1;cursor:not-allowed;color:#c0c4cc}.el-date-table td.selected div{margin-left:5px;margin-right:5px;background-color:#f2f6fc;border-radius:15px}.el-date-table td.selected div:hover{background-color:#f2f6fc}.el-date-table td.selected span{background-color:#1890ff;color:#fff;border-radius:15px}.el-date-table td.week{font-size:80%;color:#606266}.el-date-table th{padding:5px;color:#606266;font-weight:400;border-bottom:1px solid #e6ebf5}.el-month-table{font-size:12px;margin:-1px;border-collapse:collapse}.el-month-table td{text-align:center;padding:8px 0;cursor:pointer}.el-month-table td div{height:48px;padding:6px 0;-webkit-box-sizing:border-box;box-sizing:border-box}.el-month-table td.today .cell{color:#1890ff;font-weight:700}.el-month-table td.today.end-date .cell,.el-month-table td.today.start-date .cell{color:#fff}.el-month-table td.disabled .cell{background-color:#f5f7fa;cursor:not-allowed;color:#c0c4cc}.el-month-table td.disabled .cell:hover{color:#c0c4cc}.el-month-table td .cell{width:60px;height:36px;display:block;line-height:36px;color:#606266;margin:0 auto;border-radius:18px}.el-month-table td .cell:hover{color:#1890ff}.el-month-table td.in-range div,.el-month-table td.in-range div:hover{background-color:#f2f6fc}.el-month-table td.end-date div,.el-month-table td.start-date div{color:#fff}.el-month-table td.end-date .cell,.el-month-table td.start-date .cell{color:#fff;background-color:#1890ff}.el-month-table td.start-date div{border-top-left-radius:24px;border-bottom-left-radius:24px}.el-month-table td.end-date div{border-top-right-radius:24px;border-bottom-right-radius:24px}.el-month-table td.current:not(.disabled) .cell{color:#1890ff}.el-year-table{font-size:12px;margin:-1px;border-collapse:collapse}.el-year-table .el-icon{color:#303133}.el-year-table td{text-align:center;padding:20px 3px;cursor:pointer}.el-year-table td.today .cell{color:#1890ff;font-weight:700}.el-year-table td.disabled .cell{background-color:#f5f7fa;cursor:not-allowed;color:#c0c4cc}.el-year-table td.disabled .cell:hover{color:#c0c4cc}.el-year-table td .cell{width:48px;height:32px;display:block;line-height:32px;color:#606266;margin:0 auto}.el-year-table td .cell:hover,.el-year-table td.current:not(.disabled) .cell{color:#1890ff}.el-date-range-picker{width:646px}.el-date-range-picker.has-sidebar{width:756px}.el-date-range-picker table{table-layout:fixed;width:100%}.el-date-range-picker .el-picker-panel__body{min-width:513px}.el-date-range-picker .el-picker-panel__content{margin:0}.el-date-range-picker__header{position:relative;text-align:center;height:28px}.el-date-range-picker__header [class*=arrow-left]{float:left}.el-date-range-picker__header [class*=arrow-right]{float:right}.el-date-range-picker__header div{font-size:16px;font-weight:500;margin-right:50px}.el-date-range-picker__content{float:left;width:50%;-webkit-box-sizing:border-box;box-sizing:border-box;margin:0;padding:16px}.el-date-range-picker__content.is-left{border-right:1px solid #e4e4e4}.el-date-range-picker__content .el-date-range-picker__header div{margin-left:50px;margin-right:50px}.el-date-range-picker__editors-wrap{-webkit-box-sizing:border-box;box-sizing:border-box;display:table-cell}.el-date-range-picker__editors-wrap.is-right{text-align:right}.el-date-range-picker__time-header{position:relative;border-bottom:1px solid #e4e4e4;font-size:12px;padding:8px 5px 5px 5px;display:table;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box}.el-date-range-picker__time-header>.el-icon-arrow-right{font-size:20px;vertical-align:middle;display:table-cell;color:#303133}.el-date-range-picker__time-picker-wrap{position:relative;display:table-cell;padding:0 5px}.el-date-range-picker__time-picker-wrap .el-picker-panel{position:absolute;top:13px;right:0;z-index:1;background:#fff}.el-date-picker{width:322px}.el-date-picker.has-sidebar.has-time{width:434px}.el-date-picker.has-sidebar{width:438px}.el-date-picker.has-time .el-picker-panel__body-wrapper{position:relative}.el-date-picker .el-picker-panel__content{width:292px}.el-date-picker table{table-layout:fixed;width:100%}.el-date-picker__editor-wrap{position:relative;display:table-cell;padding:0 5px}.el-date-picker__time-header{position:relative;border-bottom:1px solid #e4e4e4;font-size:12px;padding:8px 5px 5px 5px;display:table;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box}.el-date-picker__header{margin:12px;text-align:center}.el-date-picker__header--bordered{margin-bottom:0;padding-bottom:12px;border-bottom:1px solid #e6ebf5}.el-date-picker__header--bordered+.el-picker-panel__content{margin-top:0}.el-date-picker__header-label{font-size:16px;font-weight:500;padding:0 5px;line-height:22px;text-align:center;cursor:pointer;color:#606266}.el-date-picker__header-label.active,.el-date-picker__header-label:hover{color:#1890ff}.el-date-picker__prev-btn{float:left}.el-date-picker__next-btn{float:right}.el-date-picker__time-wrap{padding:10px;text-align:center}.el-date-picker__time-label{float:left;cursor:pointer;line-height:30px;margin-left:10px}.time-select{margin:5px 0;min-width:0}.time-select .el-picker-panel__content{max-height:200px;margin:0}.time-select-item{padding:8px 10px;font-size:14px;line-height:20px}.time-select-item.selected:not(.disabled){color:#1890ff;font-weight:700}.time-select-item.disabled{color:#dfe4ed;cursor:not-allowed}.time-select-item:hover{background-color:#f5f7fa;font-weight:700;cursor:pointer}.el-date-editor{position:relative;display:inline-block;text-align:left}.el-date-editor.el-input,.el-date-editor.el-input__inner{width:220px}.el-date-editor--monthrange.el-input,.el-date-editor--monthrange.el-input__inner{width:300px}.el-date-editor--daterange.el-input,.el-date-editor--daterange.el-input__inner,.el-date-editor--timerange.el-input,.el-date-editor--timerange.el-input__inner{width:350px}.el-date-editor--datetimerange.el-input,.el-date-editor--datetimerange.el-input__inner{width:400px}.el-date-editor--dates .el-input__inner{text-overflow:ellipsis;white-space:nowrap}.el-date-editor .el-icon-circle-close{cursor:pointer}.el-date-editor .el-range__icon{font-size:14px;margin-left:-5px;color:#c0c4cc;float:left;line-height:32px}.el-date-editor .el-range-input{-webkit-appearance:none;-moz-appearance:none;appearance:none;border:none;outline:none;display:inline-block;height:100%;margin:0;padding:0;width:39%;text-align:center;font-size:14px;color:#606266}.el-date-editor .el-range-input::-webkit-input-placeholder{color:#c0c4cc}.el-date-editor .el-range-input::-moz-placeholder{color:#c0c4cc}.el-date-editor .el-range-input:-ms-input-placeholder{color:#c0c4cc}.el-date-editor .el-range-input::-ms-input-placeholder{color:#c0c4cc}.el-date-editor .el-range-input::placeholder{color:#c0c4cc}.el-date-editor .el-range-separator{display:inline-block;height:100%;padding:0 5px;margin:0;text-align:center;line-height:32px;font-size:14px;width:5%;color:#303133}.el-date-editor .el-range__close-icon{font-size:14px;color:#c0c4cc;width:25px;display:inline-block;float:right;line-height:32px}.el-range-editor.el-input__inner{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:3px 10px}.el-range-editor .el-range-input{line-height:1}.el-range-editor.is-active,.el-range-editor.is-active:hover{border-color:#1890ff}.el-range-editor--medium.el-input__inner{height:36px}.el-range-editor--medium .el-range-separator{line-height:28px;font-size:14px}.el-range-editor--medium .el-range-input{font-size:14px}.el-range-editor--medium .el-range__close-icon,.el-range-editor--medium .el-range__icon{line-height:28px}.el-range-editor--small.el-input__inner{height:32px}.el-range-editor--small .el-range-separator{line-height:24px;font-size:13px}.el-range-editor--small .el-range-input{font-size:13px}.el-range-editor--small .el-range__close-icon,.el-range-editor--small .el-range__icon{line-height:24px}.el-range-editor--mini.el-input__inner{height:28px}.el-range-editor--mini .el-range-separator{line-height:20px;font-size:12px}.el-range-editor--mini .el-range-input{font-size:12px}.el-range-editor--mini .el-range__close-icon,.el-range-editor--mini .el-range__icon{line-height:20px}.el-range-editor.is-disabled{background-color:#f5f7fa;border-color:#dfe4ed;color:#c0c4cc;cursor:not-allowed}.el-range-editor.is-disabled:focus,.el-range-editor.is-disabled:hover{border-color:#dfe4ed}.el-range-editor.is-disabled input{background-color:#f5f7fa;color:#c0c4cc;cursor:not-allowed}.el-range-editor.is-disabled input::-webkit-input-placeholder{color:#c0c4cc}.el-range-editor.is-disabled input::-moz-placeholder{color:#c0c4cc}.el-range-editor.is-disabled input:-ms-input-placeholder{color:#c0c4cc}.el-range-editor.is-disabled input::-ms-input-placeholder{color:#c0c4cc}.el-range-editor.is-disabled input::placeholder{color:#c0c4cc}.el-range-editor.is-disabled .el-range-separator{color:#c0c4cc}.el-picker-panel{color:#606266;border:1px solid #dfe4ed;-webkit-box-shadow:0 2px 12px 0 rgba(0,0,0,.1);box-shadow:0 2px 12px 0 rgba(0,0,0,.1);background:#fff;border-radius:4px;line-height:30px;margin:5px 0}.el-picker-panel__body-wrapper:after,.el-picker-panel__body:after{content:"";display:table;clear:both}.el-picker-panel__content{position:relative;margin:15px}.el-picker-panel__footer{border-top:1px solid #e4e4e4;padding:4px;text-align:right;background-color:#fff;position:relative;font-size:0}.el-picker-panel__shortcut{display:block;width:100%;border:0;background-color:transparent;line-height:28px;font-size:14px;color:#606266;padding-left:12px;text-align:left;outline:none;cursor:pointer}.el-picker-panel__shortcut:hover{color:#1890ff}.el-picker-panel__shortcut.active{background-color:#e6f1fe;color:#1890ff}.el-picker-panel__btn{border:1px solid #dcdcdc;color:#333;line-height:24px;border-radius:2px;padding:0 20px;cursor:pointer;background-color:transparent;outline:none;font-size:12px}.el-picker-panel__btn[disabled]{color:#ccc;cursor:not-allowed}.el-picker-panel__icon-btn{font-size:12px;color:#303133;border:0;background:transparent;cursor:pointer;outline:none;margin-top:8px}.el-picker-panel__icon-btn:hover{color:#1890ff}.el-picker-panel__icon-btn.is-disabled{color:#bbb}.el-picker-panel__icon-btn.is-disabled:hover{cursor:not-allowed}.el-picker-panel__link-btn{vertical-align:middle}.el-picker-panel [slot=sidebar],.el-picker-panel__sidebar{position:absolute;top:0;bottom:0;width:110px;border-right:1px solid #e4e4e4;-webkit-box-sizing:border-box;box-sizing:border-box;padding-top:6px;background-color:#fff;overflow:auto}.el-picker-panel [slot=sidebar]+.el-picker-panel__body,.el-picker-panel__sidebar+.el-picker-panel__body{margin-left:110px}.el-time-spinner.has-seconds .el-time-spinner__wrapper{width:33.3%}.el-time-spinner__wrapper{max-height:190px;overflow:auto;display:inline-block;width:50%;vertical-align:top;position:relative}.el-time-spinner__wrapper .el-scrollbar__wrap:not(.el-scrollbar__wrap--hidden-default){padding-bottom:15px}.el-time-spinner__wrapper.is-arrow{-webkit-box-sizing:border-box;box-sizing:border-box;text-align:center;overflow:hidden}.el-time-spinner__wrapper.is-arrow .el-time-spinner__list{-webkit-transform:translateY(-32px);transform:translateY(-32px)}.el-time-spinner__wrapper.is-arrow .el-time-spinner__item:hover:not(.disabled):not(.active){background:#fff;cursor:default}.el-time-spinner__arrow{font-size:12px;color:#909399;position:absolute;left:0;width:100%;z-index:1;text-align:center;height:30px;line-height:30px;cursor:pointer}.el-time-spinner__arrow:hover{color:#1890ff}.el-time-spinner__arrow.el-icon-arrow-up{top:10px}.el-time-spinner__arrow.el-icon-arrow-down{bottom:10px}.el-time-spinner__input.el-input{width:70%}.el-time-spinner__input.el-input .el-input__inner,.el-time-spinner__list{padding:0;text-align:center}.el-time-spinner__list{margin:0;list-style:none}.el-time-spinner__list:after,.el-time-spinner__list:before{content:"";display:block;width:100%;height:80px}.el-time-spinner__item{height:32px;line-height:32px;font-size:12px;color:#606266}.el-time-spinner__item:hover:not(.disabled):not(.active){background:#f5f7fa;cursor:pointer}.el-time-spinner__item.active:not(.disabled){color:#303133;font-weight:700}.el-time-spinner__item.disabled{color:#c0c4cc;cursor:not-allowed}.el-time-panel{margin:5px 0;border:1px solid #dfe4ed;background-color:#fff;-webkit-box-shadow:0 2px 12px 0 rgba(0,0,0,.1);box-shadow:0 2px 12px 0 rgba(0,0,0,.1);border-radius:2px;position:absolute;width:180px;left:0;z-index:1000;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-box-sizing:content-box;box-sizing:content-box}.el-time-panel__content{font-size:0;position:relative;overflow:hidden}.el-time-panel__content:after,.el-time-panel__content:before{content:"";top:50%;position:absolute;margin-top:-15px;height:32px;z-index:-1;left:0;right:0;-webkit-box-sizing:border-box;box-sizing:border-box;padding-top:6px;text-align:left;border-top:1px solid #dfe4ed;border-bottom:1px solid #dfe4ed}.el-time-panel__content:after{left:50%;margin-left:12%;margin-right:12%}.el-time-panel__content:before{padding-left:50%;margin-right:12%;margin-left:12%}.el-time-panel__content.has-seconds:after{left:66.66667%}.el-time-panel__content.has-seconds:before{padding-left:33.33333%}.el-time-panel__footer{border-top:1px solid #e4e4e4;padding:4px;height:36px;line-height:25px;text-align:right;-webkit-box-sizing:border-box;box-sizing:border-box}.el-time-panel__btn{border:none;line-height:28px;padding:0 5px;margin:0 5px;cursor:pointer;background-color:transparent;outline:none;font-size:12px;color:#303133}.el-time-panel__btn.confirm{font-weight:800;color:#1890ff}.el-time-range-picker{width:354px;overflow:visible}.el-time-range-picker__content{position:relative;text-align:center;padding:10px}.el-time-range-picker__cell{-webkit-box-sizing:border-box;box-sizing:border-box;margin:0;padding:4px 7px 7px;width:50%;display:inline-block}.el-time-range-picker__header{margin-bottom:5px;text-align:center;font-size:14px}.el-time-range-picker__body{border-radius:2px;border:1px solid #dfe4ed}.el-popover{position:absolute;background:#fff;min-width:150px;border-radius:4px;border:1px solid #e6ebf5;padding:12px;z-index:2000;color:#606266;line-height:1.4;text-align:justify;font-size:14px;-webkit-box-shadow:0 2px 12px 0 rgba(0,0,0,.1);box-shadow:0 2px 12px 0 rgba(0,0,0,.1);word-break:break-all}.el-popover--plain{padding:18px 20px}.el-popover__title{color:#303133;font-size:16px;line-height:1;margin-bottom:12px}.el-popover:focus,.el-popover:focus:active,.el-popover__reference:focus:hover,.el-popover__reference:focus:not(.focusing){outline-width:0}.v-modal-enter{-webkit-animation:v-modal-in .2s ease;animation:v-modal-in .2s ease}.v-modal-leave{-webkit-animation:v-modal-out .2s ease forwards;animation:v-modal-out .2s ease forwards}@keyframes v-modal-in{0%{opacity:0}}@keyframes v-modal-out{to{opacity:0}}.v-modal{position:fixed;left:0;top:0;width:100%;height:100%;opacity:.5;background:#000}.el-popup-parent--hidden{overflow:hidden}.el-message-box{display:inline-block;width:420px;padding-bottom:10px;vertical-align:middle;background-color:#fff;border-radius:4px;border:1px solid #e6ebf5;font-size:18px;-webkit-box-shadow:0 2px 12px 0 rgba(0,0,0,.1);box-shadow:0 2px 12px 0 rgba(0,0,0,.1);text-align:left;overflow:hidden;-webkit-backface-visibility:hidden;backface-visibility:hidden}.el-message-box__wrapper{position:fixed;top:0;bottom:0;left:0;right:0;text-align:center}.el-message-box__wrapper:after{content:"";display:inline-block;height:100%;width:0;vertical-align:middle}.el-message-box__header{position:relative;padding:15px;padding-bottom:10px}.el-message-box__title{padding-left:0;margin-bottom:0;font-size:18px;line-height:1;color:#303133}.el-message-box__headerbtn{position:absolute;top:15px;right:15px;padding:0;border:none;outline:none;background:transparent;font-size:16px;cursor:pointer}.el-message-box__headerbtn .el-message-box__close{color:#909399}.el-message-box__headerbtn:focus .el-message-box__close,.el-message-box__headerbtn:hover .el-message-box__close{color:#1890ff}.el-message-box__content{padding:10px 15px;color:#606266;font-size:14px}.el-message-box__container{position:relative}.el-message-box__input{padding-top:15px}.el-message-box__input input.invalid,.el-message-box__input input.invalid:focus{border-color:#ff4949}.el-message-box__status{position:absolute;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);font-size:24px!important}.el-message-box__status:before{padding-left:1px}.el-message-box__status+.el-message-box__message{padding-left:36px;padding-right:12px}.el-message-box__status.el-icon-success{color:#13ce66}.el-message-box__status.el-icon-info{color:#909399}.el-message-box__status.el-icon-warning{color:#ffba00}.el-message-box__status.el-icon-error{color:#ff4949}.el-message-box__message{margin:0}.el-message-box__message p{margin:0;line-height:24px}.el-message-box__errormsg{color:#ff4949;font-size:12px;min-height:18px;margin-top:2px}.el-message-box__btns{padding:5px 15px 0;text-align:right}.el-message-box__btns button:nth-child(2){margin-left:10px}.el-message-box__btns-reverse{-webkit-box-orient:horizontal;-webkit-box-direction:reverse;-ms-flex-direction:row-reverse;flex-direction:row-reverse}.el-message-box--center{padding-bottom:30px}.el-message-box--center .el-message-box__header{padding-top:30px}.el-message-box--center .el-message-box__title{position:relative;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.el-message-box--center .el-message-box__status{position:relative;top:auto;padding-right:5px;text-align:center;-webkit-transform:translateY(-1px);transform:translateY(-1px)}.el-message-box--center .el-message-box__message{margin-left:0}.el-message-box--center .el-message-box__btns,.el-message-box--center .el-message-box__content{text-align:center}.el-message-box--center .el-message-box__content{padding-left:27px;padding-right:27px}.msgbox-fade-enter-active{-webkit-animation:msgbox-fade-in .3s;animation:msgbox-fade-in .3s}.msgbox-fade-leave-active{-webkit-animation:msgbox-fade-out .3s;animation:msgbox-fade-out .3s}@-webkit-keyframes msgbox-fade-in{0%{-webkit-transform:translate3d(0,-20px,0);transform:translate3d(0,-20px,0);opacity:0}to{-webkit-transform:translateZ(0);transform:translateZ(0);opacity:1}}@keyframes msgbox-fade-in{0%{-webkit-transform:translate3d(0,-20px,0);transform:translate3d(0,-20px,0);opacity:0}to{-webkit-transform:translateZ(0);transform:translateZ(0);opacity:1}}@-webkit-keyframes msgbox-fade-out{0%{-webkit-transform:translateZ(0);transform:translateZ(0);opacity:1}to{-webkit-transform:translate3d(0,-20px,0);transform:translate3d(0,-20px,0);opacity:0}}@keyframes msgbox-fade-out{0%{-webkit-transform:translateZ(0);transform:translateZ(0);opacity:1}to{-webkit-transform:translate3d(0,-20px,0);transform:translate3d(0,-20px,0);opacity:0}}.el-breadcrumb{font-size:14px;line-height:1}.el-breadcrumb:after,.el-breadcrumb:before{display:table;content:""}.el-breadcrumb:after{clear:both}.el-breadcrumb__separator{margin:0 9px;font-weight:700;color:#c0c4cc}.el-breadcrumb__separator[class*=icon]{margin:0 6px;font-weight:400}.el-breadcrumb__item{float:left}.el-breadcrumb__inner{color:#606266}.el-breadcrumb__inner.is-link,.el-breadcrumb__inner a{font-weight:700;text-decoration:none;-webkit-transition:color .2s cubic-bezier(.645,.045,.355,1);transition:color .2s cubic-bezier(.645,.045,.355,1);color:#303133}.el-breadcrumb__inner.is-link:hover,.el-breadcrumb__inner a:hover{color:#1890ff;cursor:pointer}.el-breadcrumb__item:last-child .el-breadcrumb__inner,.el-breadcrumb__item:last-child .el-breadcrumb__inner:hover,.el-breadcrumb__item:last-child .el-breadcrumb__inner a,.el-breadcrumb__item:last-child .el-breadcrumb__inner a:hover{font-weight:400;color:#606266;cursor:text}.el-breadcrumb__item:last-child .el-breadcrumb__separator{display:none}.el-form--label-left .el-form-item__label{text-align:left}.el-form--label-top .el-form-item__label{float:none;display:inline-block;text-align:left;padding:0 0 10px 0}.el-form--inline .el-form-item{display:inline-block;margin-right:10px;vertical-align:top}.el-form--inline .el-form-item__label{float:none;display:inline-block}.el-form--inline .el-form-item__content{display:inline-block;vertical-align:top}.el-form--inline.el-form--label-top .el-form-item__content{display:block}.el-form-item{margin-bottom:22px}.el-form-item:after,.el-form-item:before{display:table;content:""}.el-form-item:after{clear:both}.el-form-item .el-form-item{margin-bottom:0}.el-form-item .el-input__validateIcon{display:none}.el-form-item--medium .el-form-item__content,.el-form-item--medium .el-form-item__label{line-height:36px}.el-form-item--small .el-form-item__content,.el-form-item--small .el-form-item__label{line-height:32px}.el-form-item--small.el-form-item{margin-bottom:18px}.el-form-item--small .el-form-item__error{padding-top:2px}.el-form-item--mini .el-form-item__content,.el-form-item--mini .el-form-item__label{line-height:28px}.el-form-item--mini.el-form-item{margin-bottom:18px}.el-form-item--mini .el-form-item__error{padding-top:1px}.el-form-item__label-wrap{float:left}.el-form-item__label-wrap .el-form-item__label{display:inline-block;float:none}.el-form-item__label{text-align:right;vertical-align:middle;float:left;font-size:14px;color:#606266;line-height:40px;padding:0 12px 0 0;-webkit-box-sizing:border-box;box-sizing:border-box}.el-form-item__content{line-height:40px;position:relative;font-size:14px}.el-form-item__content:after,.el-form-item__content:before{display:table;content:""}.el-form-item__content:after{clear:both}.el-form-item__content .el-input-group{vertical-align:top}.el-form-item__error{color:#ff4949;font-size:12px;line-height:1;padding-top:4px;position:absolute;top:100%;left:0}.el-form-item__error--inline{position:relative;top:auto;left:auto;display:inline-block;margin-left:10px}.el-form-item.is-required:not(.is-no-asterisk) .el-form-item__label-wrap>.el-form-item__label:before,.el-form-item.is-required:not(.is-no-asterisk)>.el-form-item__label:before{content:"*";color:#ff4949;margin-right:4px}.el-form-item.is-error .el-input__inner,.el-form-item.is-error .el-input__inner:focus,.el-form-item.is-error .el-textarea__inner,.el-form-item.is-error .el-textarea__inner:focus{border-color:#ff4949}.el-form-item.is-error .el-input-group__append .el-input__inner,.el-form-item.is-error .el-input-group__prepend .el-input__inner{border-color:transparent}.el-form-item.is-error .el-input__validateIcon{color:#ff4949}.el-form-item--feedback .el-input__validateIcon{display:inline-block}.el-tabs__header{padding:0;position:relative;margin:0 0 15px}.el-tabs__active-bar{position:absolute;bottom:0;left:0;height:2px;background-color:#1890ff;z-index:1;-webkit-transition:-webkit-transform .3s cubic-bezier(.645,.045,.355,1);transition:-webkit-transform .3s cubic-bezier(.645,.045,.355,1);transition:transform .3s cubic-bezier(.645,.045,.355,1);transition:transform .3s cubic-bezier(.645,.045,.355,1),-webkit-transform .3s cubic-bezier(.645,.045,.355,1);list-style:none}.el-tabs__new-tab{float:right;border:1px solid #d3dce6;height:18px;width:18px;line-height:18px;margin:12px 0 9px 10px;border-radius:3px;text-align:center;font-size:12px;color:#d3dce6;cursor:pointer;-webkit-transition:all .15s;transition:all .15s}.el-tabs__new-tab .el-icon-plus{-webkit-transform:scale(.8);transform:scale(.8)}.el-tabs__new-tab:hover{color:#1890ff}.el-tabs__nav-wrap{overflow:hidden;margin-bottom:-1px;position:relative}.el-tabs__nav-wrap:after{content:"";position:absolute;left:0;bottom:0;width:100%;height:2px;background-color:#dfe4ed;z-index:1}.el-tabs__nav-wrap.is-scrollable{padding:0 20px;-webkit-box-sizing:border-box;box-sizing:border-box}.el-tabs__nav-scroll{overflow:hidden}.el-tabs__nav-next,.el-tabs__nav-prev{position:absolute;cursor:pointer;line-height:44px;font-size:12px;color:#909399}.el-tabs__nav-next{right:0}.el-tabs__nav-prev{left:0}.el-tabs__nav{white-space:nowrap;position:relative;-webkit-transition:-webkit-transform .3s;transition:-webkit-transform .3s;transition:transform .3s;transition:transform .3s,-webkit-transform .3s;float:left;z-index:2}.el-tabs__nav.is-stretch{min-width:100%;display:-webkit-box;display:-ms-flexbox;display:flex}.el-tabs__nav.is-stretch>*{-webkit-box-flex:1;-ms-flex:1;flex:1;text-align:center}.el-tabs__item{padding:0 20px;height:40px;-webkit-box-sizing:border-box;box-sizing:border-box;line-height:40px;display:inline-block;list-style:none;font-size:14px;font-weight:500;color:#303133;position:relative}.el-tabs__item:focus,.el-tabs__item:focus:active{outline:none}.el-tabs__item:focus.is-active.is-focus:not(:active){-webkit-box-shadow:0 0 2px 2px #1890ff inset;box-shadow:inset 0 0 2px 2px #1890ff;border-radius:3px}.el-tabs__item .el-icon-close{border-radius:50%;text-align:center;-webkit-transition:all .3s cubic-bezier(.645,.045,.355,1);transition:all .3s cubic-bezier(.645,.045,.355,1);margin-left:5px}.el-tabs__item .el-icon-close:before{-webkit-transform:scale(.9);transform:scale(.9);display:inline-block}.el-tabs__item .el-icon-close:hover{background-color:#c0c4cc;color:#fff}.el-tabs__item.is-active{color:#1890ff}.el-tabs__item:hover{color:#1890ff;cursor:pointer}.el-tabs__item.is-disabled{color:#c0c4cc;cursor:default}.el-tabs__content{overflow:hidden;position:relative}.el-tabs--card>.el-tabs__header{border-bottom:1px solid #dfe4ed}.el-tabs--card>.el-tabs__header .el-tabs__nav-wrap:after{content:none}.el-tabs--card>.el-tabs__header .el-tabs__nav{border:1px solid #dfe4ed;border-bottom:none;border-radius:4px 4px 0 0;-webkit-box-sizing:border-box;box-sizing:border-box}.el-tabs--card>.el-tabs__header .el-tabs__active-bar{display:none}.el-tabs--card>.el-tabs__header .el-tabs__item .el-icon-close{position:relative;font-size:12px;width:0;height:14px;vertical-align:middle;line-height:15px;overflow:hidden;top:-1px;right:-2px;-webkit-transform-origin:100% 50%;transform-origin:100% 50%}.el-tabs--card>.el-tabs__header .el-tabs__item{border-bottom:1px solid transparent;border-left:1px solid #dfe4ed;-webkit-transition:color .3s cubic-bezier(.645,.045,.355,1),padding .3s cubic-bezier(.645,.045,.355,1);transition:color .3s cubic-bezier(.645,.045,.355,1),padding .3s cubic-bezier(.645,.045,.355,1)}.el-tabs--card>.el-tabs__header .el-tabs__item:first-child{border-left:none}.el-tabs--card>.el-tabs__header .el-tabs__item.is-closable:hover{padding-left:13px;padding-right:13px}.el-tabs--card>.el-tabs__header .el-tabs__item.is-closable:hover .el-icon-close{width:14px}.el-tabs--card>.el-tabs__header .el-tabs__item.is-active{border-bottom-color:#fff}.el-tabs--card>.el-tabs__header .el-tabs__item.is-active.is-closable{padding-left:20px;padding-right:20px}.el-tabs--card>.el-tabs__header .el-tabs__item.is-active.is-closable .el-icon-close{width:14px}.el-tabs--border-card{background:#fff;border:1px solid #dcdfe6;-webkit-box-shadow:0 2px 4px 0 rgba(0,0,0,.12),0 0 6px 0 rgba(0,0,0,.04);box-shadow:0 2px 4px 0 rgba(0,0,0,.12),0 0 6px 0 rgba(0,0,0,.04)}.el-tabs--border-card>.el-tabs__content{padding:15px}.el-tabs--border-card>.el-tabs__header{background-color:#f5f7fa;border-bottom:1px solid #dfe4ed;margin:0}.el-tabs--border-card>.el-tabs__header .el-tabs__nav-wrap:after{content:none}.el-tabs--border-card>.el-tabs__header .el-tabs__item{-webkit-transition:all .3s cubic-bezier(.645,.045,.355,1);transition:all .3s cubic-bezier(.645,.045,.355,1);border:1px solid transparent;margin-top:-1px;color:#909399}.el-tabs--border-card>.el-tabs__header .el-tabs__item+.el-tabs__item,.el-tabs--border-card>.el-tabs__header .el-tabs__item:first-child{margin-left:-1px}.el-tabs--border-card>.el-tabs__header .el-tabs__item.is-active{color:#1890ff;background-color:#fff;border-right-color:#dcdfe6;border-left-color:#dcdfe6}.el-tabs--border-card>.el-tabs__header .el-tabs__item:not(.is-disabled):hover{color:#1890ff}.el-tabs--border-card>.el-tabs__header .el-tabs__item.is-disabled{color:#c0c4cc}.el-tabs--border-card>.el-tabs__header .is-scrollable .el-tabs__item:first-child{margin-left:0}.el-tabs--bottom .el-tabs__item.is-bottom:nth-child(2),.el-tabs--bottom .el-tabs__item.is-top:nth-child(2),.el-tabs--top .el-tabs__item.is-bottom:nth-child(2),.el-tabs--top .el-tabs__item.is-top:nth-child(2){padding-left:0}.el-tabs--bottom .el-tabs__item.is-bottom:last-child,.el-tabs--bottom .el-tabs__item.is-top:last-child,.el-tabs--top .el-tabs__item.is-bottom:last-child,.el-tabs--top .el-tabs__item.is-top:last-child{padding-right:0}.el-tabs--bottom.el-tabs--border-card>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--bottom.el-tabs--card>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--bottom .el-tabs--left>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--bottom .el-tabs--right>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--top.el-tabs--border-card>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--top.el-tabs--card>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--top .el-tabs--left>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--top .el-tabs--right>.el-tabs__header .el-tabs__item:nth-child(2){padding-left:20px}.el-tabs--bottom.el-tabs--border-card>.el-tabs__header .el-tabs__item:last-child,.el-tabs--bottom.el-tabs--card>.el-tabs__header .el-tabs__item:last-child,.el-tabs--bottom .el-tabs--left>.el-tabs__header .el-tabs__item:last-child,.el-tabs--bottom .el-tabs--right>.el-tabs__header .el-tabs__item:last-child,.el-tabs--top.el-tabs--border-card>.el-tabs__header .el-tabs__item:last-child,.el-tabs--top.el-tabs--card>.el-tabs__header .el-tabs__item:last-child,.el-tabs--top .el-tabs--left>.el-tabs__header .el-tabs__item:last-child,.el-tabs--top .el-tabs--right>.el-tabs__header .el-tabs__item:last-child{padding-right:20px}.el-tabs--bottom .el-tabs__header.is-bottom{margin-bottom:0;margin-top:10px}.el-tabs--bottom.el-tabs--border-card .el-tabs__header.is-bottom{border-bottom:0;border-top:1px solid #dcdfe6}.el-tabs--bottom.el-tabs--border-card .el-tabs__nav-wrap.is-bottom{margin-top:-1px;margin-bottom:0}.el-tabs--bottom.el-tabs--border-card .el-tabs__item.is-bottom:not(.is-active){border:1px solid transparent}.el-tabs--bottom.el-tabs--border-card .el-tabs__item.is-bottom{margin:0 -1px -1px -1px}.el-tabs--left,.el-tabs--right{overflow:hidden}.el-tabs--left .el-tabs__header.is-left,.el-tabs--left .el-tabs__header.is-right,.el-tabs--left .el-tabs__nav-scroll,.el-tabs--left .el-tabs__nav-wrap.is-left,.el-tabs--left .el-tabs__nav-wrap.is-right,.el-tabs--right .el-tabs__header.is-left,.el-tabs--right .el-tabs__header.is-right,.el-tabs--right .el-tabs__nav-scroll,.el-tabs--right .el-tabs__nav-wrap.is-left,.el-tabs--right .el-tabs__nav-wrap.is-right{height:100%}.el-tabs--left .el-tabs__active-bar.is-left,.el-tabs--left .el-tabs__active-bar.is-right,.el-tabs--right .el-tabs__active-bar.is-left,.el-tabs--right .el-tabs__active-bar.is-right{top:0;bottom:auto;width:2px;height:auto}.el-tabs--left .el-tabs__nav-wrap.is-left,.el-tabs--left .el-tabs__nav-wrap.is-right,.el-tabs--right .el-tabs__nav-wrap.is-left,.el-tabs--right .el-tabs__nav-wrap.is-right{margin-bottom:0}.el-tabs--left .el-tabs__nav-wrap.is-left>.el-tabs__nav-next,.el-tabs--left .el-tabs__nav-wrap.is-left>.el-tabs__nav-prev,.el-tabs--left .el-tabs__nav-wrap.is-right>.el-tabs__nav-next,.el-tabs--left .el-tabs__nav-wrap.is-right>.el-tabs__nav-prev,.el-tabs--right .el-tabs__nav-wrap.is-left>.el-tabs__nav-next,.el-tabs--right .el-tabs__nav-wrap.is-left>.el-tabs__nav-prev,.el-tabs--right .el-tabs__nav-wrap.is-right>.el-tabs__nav-next,.el-tabs--right .el-tabs__nav-wrap.is-right>.el-tabs__nav-prev{height:30px;line-height:30px;width:100%;text-align:center;cursor:pointer}.el-tabs--left .el-tabs__nav-wrap.is-left>.el-tabs__nav-next i,.el-tabs--left .el-tabs__nav-wrap.is-left>.el-tabs__nav-prev i,.el-tabs--left .el-tabs__nav-wrap.is-right>.el-tabs__nav-next i,.el-tabs--left .el-tabs__nav-wrap.is-right>.el-tabs__nav-prev i,.el-tabs--right .el-tabs__nav-wrap.is-left>.el-tabs__nav-next i,.el-tabs--right .el-tabs__nav-wrap.is-left>.el-tabs__nav-prev i,.el-tabs--right .el-tabs__nav-wrap.is-right>.el-tabs__nav-next i,.el-tabs--right .el-tabs__nav-wrap.is-right>.el-tabs__nav-prev i{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.el-tabs--left .el-tabs__nav-wrap.is-left>.el-tabs__nav-prev,.el-tabs--left .el-tabs__nav-wrap.is-right>.el-tabs__nav-prev,.el-tabs--right .el-tabs__nav-wrap.is-left>.el-tabs__nav-prev,.el-tabs--right .el-tabs__nav-wrap.is-right>.el-tabs__nav-prev{left:auto;top:0}.el-tabs--left .el-tabs__nav-wrap.is-left>.el-tabs__nav-next,.el-tabs--left .el-tabs__nav-wrap.is-right>.el-tabs__nav-next,.el-tabs--right .el-tabs__nav-wrap.is-left>.el-tabs__nav-next,.el-tabs--right .el-tabs__nav-wrap.is-right>.el-tabs__nav-next{right:auto;bottom:0}.el-tabs--left .el-tabs__nav-wrap.is-left.is-scrollable,.el-tabs--left .el-tabs__nav-wrap.is-right.is-scrollable,.el-tabs--right .el-tabs__nav-wrap.is-left.is-scrollable,.el-tabs--right .el-tabs__nav-wrap.is-right.is-scrollable{padding:30px 0}.el-tabs--left .el-tabs__nav-wrap.is-left:after,.el-tabs--left .el-tabs__nav-wrap.is-right:after,.el-tabs--right .el-tabs__nav-wrap.is-left:after,.el-tabs--right .el-tabs__nav-wrap.is-right:after{height:100%;width:2px;bottom:auto;top:0}.el-tabs--left .el-tabs__nav.is-left,.el-tabs--left .el-tabs__nav.is-right,.el-tabs--right .el-tabs__nav.is-left,.el-tabs--right .el-tabs__nav.is-right{float:none}.el-tabs--left .el-tabs__item.is-left,.el-tabs--left .el-tabs__item.is-right,.el-tabs--right .el-tabs__item.is-left,.el-tabs--right .el-tabs__item.is-right{display:block}.el-tabs--left .el-tabs__header.is-left{float:left;margin-bottom:0;margin-right:10px}.el-tabs--left .el-tabs__nav-wrap.is-left{margin-right:-1px}.el-tabs--left .el-tabs__active-bar.is-left,.el-tabs--left .el-tabs__nav-wrap.is-left:after{left:auto;right:0}.el-tabs--left .el-tabs__item.is-left{text-align:right}.el-tabs--left.el-tabs--card .el-tabs__active-bar.is-left{display:none}.el-tabs--left.el-tabs--card .el-tabs__item.is-left{border-left:none;border-right:1px solid #dfe4ed;border-bottom:none;border-top:1px solid #dfe4ed;text-align:left}.el-tabs--left.el-tabs--card .el-tabs__item.is-left:first-child{border-right:1px solid #dfe4ed;border-top:none}.el-tabs--left.el-tabs--card .el-tabs__item.is-left.is-active{border:1px solid #dfe4ed;border-right-color:#fff;border-left:none;border-bottom:none}.el-tabs--left.el-tabs--card .el-tabs__item.is-left.is-active:first-child{border-top:none}.el-tabs--left.el-tabs--card .el-tabs__item.is-left.is-active:last-child{border-bottom:none}.el-tabs--left.el-tabs--card .el-tabs__nav{border-radius:4px 0 0 4px;border-bottom:1px solid #dfe4ed;border-right:none}.el-tabs--left.el-tabs--card .el-tabs__new-tab{float:none}.el-tabs--left.el-tabs--border-card .el-tabs__header.is-left{border-right:1px solid #dfe4ed}.el-tabs--left.el-tabs--border-card .el-tabs__item.is-left{border:1px solid transparent;margin:-1px 0 -1px -1px}.el-tabs--left.el-tabs--border-card .el-tabs__item.is-left.is-active{border-color:transparent;border-top-color:#d1dbe5;border-bottom-color:#d1dbe5}.el-tabs--right .el-tabs__header.is-right{float:right;margin-bottom:0;margin-left:10px}.el-tabs--right .el-tabs__nav-wrap.is-right{margin-left:-1px}.el-tabs--right .el-tabs__nav-wrap.is-right:after{left:0;right:auto}.el-tabs--right .el-tabs__active-bar.is-right{left:0}.el-tabs--right.el-tabs--card .el-tabs__active-bar.is-right{display:none}.el-tabs--right.el-tabs--card .el-tabs__item.is-right{border-bottom:none;border-top:1px solid #dfe4ed}.el-tabs--right.el-tabs--card .el-tabs__item.is-right:first-child{border-left:1px solid #dfe4ed;border-top:none}.el-tabs--right.el-tabs--card .el-tabs__item.is-right.is-active{border:1px solid #dfe4ed;border-left-color:#fff;border-right:none;border-bottom:none}.el-tabs--right.el-tabs--card .el-tabs__item.is-right.is-active:first-child{border-top:none}.el-tabs--right.el-tabs--card .el-tabs__item.is-right.is-active:last-child{border-bottom:none}.el-tabs--right.el-tabs--card .el-tabs__nav{border-radius:0 4px 4px 0;border-bottom:1px solid #dfe4ed;border-left:none}.el-tabs--right.el-tabs--border-card .el-tabs__header.is-right{border-left:1px solid #dfe4ed}.el-tabs--right.el-tabs--border-card .el-tabs__item.is-right{border:1px solid transparent;margin:-1px -1px -1px 0}.el-tabs--right.el-tabs--border-card .el-tabs__item.is-right.is-active{border-color:transparent;border-top-color:#d1dbe5;border-bottom-color:#d1dbe5}.slideInLeft-transition,.slideInRight-transition{display:inline-block}.slideInRight-enter{-webkit-animation:slideInRight-enter .3s;animation:slideInRight-enter .3s}.slideInRight-leave{position:absolute;left:0;right:0;-webkit-animation:slideInRight-leave .3s;animation:slideInRight-leave .3s}.slideInLeft-enter{-webkit-animation:slideInLeft-enter .3s;animation:slideInLeft-enter .3s}.slideInLeft-leave{position:absolute;left:0;right:0;-webkit-animation:slideInLeft-leave .3s;animation:slideInLeft-leave .3s}@-webkit-keyframes slideInRight-enter{0%{opacity:0;-webkit-transform-origin:0 0;transform-origin:0 0;-webkit-transform:translateX(100%);transform:translateX(100%)}to{opacity:1;-webkit-transform-origin:0 0;transform-origin:0 0;-webkit-transform:translateX(0);transform:translateX(0)}}@keyframes slideInRight-enter{0%{opacity:0;-webkit-transform-origin:0 0;transform-origin:0 0;-webkit-transform:translateX(100%);transform:translateX(100%)}to{opacity:1;-webkit-transform-origin:0 0;transform-origin:0 0;-webkit-transform:translateX(0);transform:translateX(0)}}@-webkit-keyframes slideInRight-leave{0%{-webkit-transform-origin:0 0;transform-origin:0 0;-webkit-transform:translateX(0);transform:translateX(0);opacity:1}to{-webkit-transform-origin:0 0;transform-origin:0 0;-webkit-transform:translateX(100%);transform:translateX(100%);opacity:0}}@keyframes slideInRight-leave{0%{-webkit-transform-origin:0 0;transform-origin:0 0;-webkit-transform:translateX(0);transform:translateX(0);opacity:1}to{-webkit-transform-origin:0 0;transform-origin:0 0;-webkit-transform:translateX(100%);transform:translateX(100%);opacity:0}}@-webkit-keyframes slideInLeft-enter{0%{opacity:0;-webkit-transform-origin:0 0;transform-origin:0 0;-webkit-transform:translateX(-100%);transform:translateX(-100%)}to{opacity:1;-webkit-transform-origin:0 0;transform-origin:0 0;-webkit-transform:translateX(0);transform:translateX(0)}}@keyframes slideInLeft-enter{0%{opacity:0;-webkit-transform-origin:0 0;transform-origin:0 0;-webkit-transform:translateX(-100%);transform:translateX(-100%)}to{opacity:1;-webkit-transform-origin:0 0;transform-origin:0 0;-webkit-transform:translateX(0);transform:translateX(0)}}@-webkit-keyframes slideInLeft-leave{0%{-webkit-transform-origin:0 0;transform-origin:0 0;-webkit-transform:translateX(0);transform:translateX(0);opacity:1}to{-webkit-transform-origin:0 0;transform-origin:0 0;-webkit-transform:translateX(-100%);transform:translateX(-100%);opacity:0}}@keyframes slideInLeft-leave{0%{-webkit-transform-origin:0 0;transform-origin:0 0;-webkit-transform:translateX(0);transform:translateX(0);opacity:1}to{-webkit-transform-origin:0 0;transform-origin:0 0;-webkit-transform:translateX(-100%);transform:translateX(-100%);opacity:0}}.el-tree{position:relative;cursor:default;background:#fff;color:#606266}.el-tree__empty-block{position:relative;min-height:60px;text-align:center;width:100%;height:100%}.el-tree__empty-text{position:absolute;left:50%;top:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);color:#909399;font-size:14px}.el-tree__drop-indicator{position:absolute;left:0;right:0;height:1px;background-color:#1890ff}.el-tree-node{white-space:nowrap;outline:none}.el-tree-node:focus>.el-tree-node__content{background-color:#f5f7fa}.el-tree-node.is-drop-inner>.el-tree-node__content .el-tree-node__label{background-color:#1890ff;color:#fff}.el-tree-node__content{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;height:26px;cursor:pointer}.el-tree-node__content>.el-tree-node__expand-icon{padding:6px}.el-tree-node__content>label.el-checkbox{margin-right:8px}.el-tree-node__content:hover{background-color:#f5f7fa}.el-tree.is-dragging .el-tree-node__content{cursor:move}.el-tree.is-dragging .el-tree-node__content *{pointer-events:none}.el-tree.is-dragging.is-drop-not-allow .el-tree-node__content{cursor:not-allowed}.el-tree-node__expand-icon{cursor:pointer;color:#c0c4cc;font-size:12px;-webkit-transform:rotate(0deg);transform:rotate(0deg);-webkit-transition:-webkit-transform .3s ease-in-out;transition:-webkit-transform .3s ease-in-out;transition:transform .3s ease-in-out;transition:transform .3s ease-in-out,-webkit-transform .3s ease-in-out}.el-tree-node__expand-icon.expanded{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.el-tree-node__expand-icon.is-leaf{color:transparent;cursor:default}.el-tree-node__label{font-size:14px}.el-tree-node__loading-icon{margin-right:8px;font-size:14px;color:#c0c4cc}.el-tree-node>.el-tree-node__children{overflow:hidden;background-color:transparent}.el-tree-node.is-expanded>.el-tree-node__children{display:block}.el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content{background-color:#edf6ff}.el-alert{width:100%;padding:8px 16px;margin:0;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:4px;position:relative;background-color:#fff;overflow:hidden;opacity:1;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-transition:opacity .2s;transition:opacity .2s}.el-alert.is-light .el-alert__closebtn{color:#c0c4cc}.el-alert.is-dark .el-alert__closebtn,.el-alert.is-dark .el-alert__description{color:#fff}.el-alert.is-center{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.el-alert--success.is-light{background-color:#e7faf0;color:#13ce66}.el-alert--success.is-light .el-alert__description{color:#13ce66}.el-alert--success.is-dark{background-color:#13ce66;color:#fff}.el-alert--info.is-light{background-color:#f4f4f5;color:#909399}.el-alert--info.is-dark{background-color:#909399;color:#fff}.el-alert--info .el-alert__description{color:#909399}.el-alert--warning.is-light{background-color:#fff8e6;color:#ffba00}.el-alert--warning.is-light .el-alert__description{color:#ffba00}.el-alert--warning.is-dark{background-color:#ffba00;color:#fff}.el-alert--error.is-light{background-color:#ffeded;color:#ff4949}.el-alert--error.is-light .el-alert__description{color:#ff4949}.el-alert--error.is-dark{background-color:#ff4949;color:#fff}.el-alert__content{display:table-cell;padding:0 8px}.el-alert__icon{font-size:16px;width:16px}.el-alert__icon.is-big{font-size:28px;width:28px}.el-alert__title{font-size:13px;line-height:18px}.el-alert__title.is-bold{font-weight:700}.el-alert .el-alert__description{font-size:12px;margin:5px 0 0 0}.el-alert__closebtn{font-size:12px;opacity:1;position:absolute;top:12px;right:15px;cursor:pointer}.el-alert__closebtn.is-customed{font-style:normal;font-size:13px;top:9px}.el-alert-fade-enter,.el-alert-fade-leave-active{opacity:0}.el-notification{display:-webkit-box;display:-ms-flexbox;display:flex;width:330px;padding:14px 26px 14px 13px;border-radius:8px;-webkit-box-sizing:border-box;box-sizing:border-box;border:1px solid #e6ebf5;position:fixed;background-color:#fff;-webkit-box-shadow:0 2px 12px 0 rgba(0,0,0,.1);box-shadow:0 2px 12px 0 rgba(0,0,0,.1);-webkit-transition:opacity .3s,left .3s,right .3s,top .4s,bottom .3s,-webkit-transform .3s;transition:opacity .3s,left .3s,right .3s,top .4s,bottom .3s,-webkit-transform .3s;transition:opacity .3s,transform .3s,left .3s,right .3s,top .4s,bottom .3s;transition:opacity .3s,transform .3s,left .3s,right .3s,top .4s,bottom .3s,-webkit-transform .3s;overflow:hidden}.el-notification.right{right:16px}.el-notification.left{left:16px}.el-notification__group{margin-left:13px;margin-right:8px}.el-notification__title{font-weight:700;font-size:16px;color:#303133;margin:0}.el-notification__content{font-size:14px;line-height:21px;margin:6px 0 0 0;color:#606266;text-align:justify}.el-notification__content p{margin:0}.el-notification__icon{height:24px;width:24px;font-size:24px}.el-notification__closeBtn{position:absolute;top:18px;right:15px;cursor:pointer;color:#909399;font-size:16px}.el-notification__closeBtn:hover{color:#606266}.el-notification .el-icon-success{color:#13ce66}.el-notification .el-icon-error{color:#ff4949}.el-notification .el-icon-info{color:#909399}.el-notification .el-icon-warning{color:#ffba00}.el-notification-fade-enter.right{right:0;-webkit-transform:translateX(100%);transform:translateX(100%)}.el-notification-fade-enter.left{left:0;-webkit-transform:translateX(-100%);transform:translateX(-100%)}.el-notification-fade-leave-active{opacity:0}.el-input-number{position:relative;display:inline-block;width:180px;line-height:38px}.el-input-number .el-input{display:block}.el-input-number .el-input__inner{-webkit-appearance:none;padding-left:50px;padding-right:50px;text-align:center}.el-input-number__decrease,.el-input-number__increase{position:absolute;z-index:1;top:1px;width:40px;height:auto;text-align:center;background:#f5f7fa;color:#606266;cursor:pointer;font-size:13px}.el-input-number__decrease:hover,.el-input-number__increase:hover{color:#1890ff}.el-input-number__decrease:hover:not(.is-disabled)~.el-input .el-input__inner:not(.is-disabled),.el-input-number__increase:hover:not(.is-disabled)~.el-input .el-input__inner:not(.is-disabled){border-color:#1890ff}.el-input-number__decrease.is-disabled,.el-input-number__increase.is-disabled{color:#c0c4cc;cursor:not-allowed}.el-input-number__increase{right:1px;border-radius:0 4px 4px 0;border-left:1px solid #dcdfe6}.el-input-number__decrease{left:1px;border-radius:4px 0 0 4px;border-right:1px solid #dcdfe6}.el-input-number.is-disabled .el-input-number__decrease,.el-input-number.is-disabled .el-input-number__increase{border-color:#dfe4ed;color:#dfe4ed}.el-input-number.is-disabled .el-input-number__decrease:hover,.el-input-number.is-disabled .el-input-number__increase:hover{color:#dfe4ed;cursor:not-allowed}.el-input-number--medium{width:200px;line-height:34px}.el-input-number--medium .el-input-number__decrease,.el-input-number--medium .el-input-number__increase{width:36px;font-size:14px}.el-input-number--medium .el-input__inner{padding-left:43px;padding-right:43px}.el-input-number--small{width:130px;line-height:30px}.el-input-number--small .el-input-number__decrease,.el-input-number--small .el-input-number__increase{width:32px;font-size:13px}.el-input-number--small .el-input-number__decrease [class*=el-icon],.el-input-number--small .el-input-number__increase [class*=el-icon]{-webkit-transform:scale(.9);transform:scale(.9)}.el-input-number--small .el-input__inner{padding-left:39px;padding-right:39px}.el-input-number--mini{width:130px;line-height:26px}.el-input-number--mini .el-input-number__decrease,.el-input-number--mini .el-input-number__increase{width:28px;font-size:12px}.el-input-number--mini .el-input-number__decrease [class*=el-icon],.el-input-number--mini .el-input-number__increase [class*=el-icon]{-webkit-transform:scale(.8);transform:scale(.8)}.el-input-number--mini .el-input__inner{padding-left:35px;padding-right:35px}.el-input-number.is-without-controls .el-input__inner{padding-left:15px;padding-right:15px}.el-input-number.is-controls-right .el-input__inner{padding-left:15px;padding-right:50px}.el-input-number.is-controls-right .el-input-number__decrease,.el-input-number.is-controls-right .el-input-number__increase{height:auto;line-height:19px}.el-input-number.is-controls-right .el-input-number__decrease [class*=el-icon],.el-input-number.is-controls-right .el-input-number__increase [class*=el-icon]{-webkit-transform:scale(.8);transform:scale(.8)}.el-input-number.is-controls-right .el-input-number__increase{border-radius:0 4px 0 0;border-bottom:1px solid #dcdfe6}.el-input-number.is-controls-right .el-input-number__decrease{right:1px;bottom:1px;top:auto;left:auto;border-right:none;border-left:1px solid #dcdfe6;border-radius:0 0 4px 0}.el-input-number.is-controls-right[class*=medium] [class*=decrease],.el-input-number.is-controls-right[class*=medium] [class*=increase]{line-height:17px}.el-input-number.is-controls-right[class*=small] [class*=decrease],.el-input-number.is-controls-right[class*=small] [class*=increase]{line-height:15px}.el-input-number.is-controls-right[class*=mini] [class*=decrease],.el-input-number.is-controls-right[class*=mini] [class*=increase]{line-height:13px}.el-tooltip:focus:hover,.el-tooltip:focus:not(.focusing){outline-width:0}.el-tooltip__popper{position:absolute;border-radius:4px;padding:10px;z-index:2000;font-size:12px;line-height:1.2;min-width:10px;word-wrap:break-word}.el-tooltip__popper .popper__arrow,.el-tooltip__popper .popper__arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.el-tooltip__popper .popper__arrow{border-width:6px}.el-tooltip__popper .popper__arrow:after{content:" ";border-width:5px}.el-tooltip__popper[x-placement^=top]{margin-bottom:12px}.el-tooltip__popper[x-placement^=top] .popper__arrow{bottom:-6px;border-top-color:#303133;border-bottom-width:0}.el-tooltip__popper[x-placement^=top] .popper__arrow:after{bottom:1px;margin-left:-5px;border-top-color:#303133;border-bottom-width:0}.el-tooltip__popper[x-placement^=bottom]{margin-top:12px}.el-tooltip__popper[x-placement^=bottom] .popper__arrow{top:-6px;border-top-width:0;border-bottom-color:#303133}.el-tooltip__popper[x-placement^=bottom] .popper__arrow:after{top:1px;margin-left:-5px;border-top-width:0;border-bottom-color:#303133}.el-tooltip__popper[x-placement^=right]{margin-left:12px}.el-tooltip__popper[x-placement^=right] .popper__arrow{left:-6px;border-right-color:#303133;border-left-width:0}.el-tooltip__popper[x-placement^=right] .popper__arrow:after{bottom:-5px;left:1px;border-right-color:#303133;border-left-width:0}.el-tooltip__popper[x-placement^=left]{margin-right:12px}.el-tooltip__popper[x-placement^=left] .popper__arrow{right:-6px;border-right-width:0;border-left-color:#303133}.el-tooltip__popper[x-placement^=left] .popper__arrow:after{right:1px;bottom:-5px;margin-left:-5px;border-right-width:0;border-left-color:#303133}.el-tooltip__popper.is-dark{background:#303133;color:#fff}.el-tooltip__popper.is-light{background:#fff;border:1px solid #303133}.el-tooltip__popper.is-light[x-placement^=top] .popper__arrow{border-top-color:#303133}.el-tooltip__popper.is-light[x-placement^=top] .popper__arrow:after{border-top-color:#fff}.el-tooltip__popper.is-light[x-placement^=bottom] .popper__arrow{border-bottom-color:#303133}.el-tooltip__popper.is-light[x-placement^=bottom] .popper__arrow:after{border-bottom-color:#fff}.el-tooltip__popper.is-light[x-placement^=left] .popper__arrow{border-left-color:#303133}.el-tooltip__popper.is-light[x-placement^=left] .popper__arrow:after{border-left-color:#fff}.el-tooltip__popper.is-light[x-placement^=right] .popper__arrow{border-right-color:#303133}.el-tooltip__popper.is-light[x-placement^=right] .popper__arrow:after{border-right-color:#fff}.el-slider:after,.el-slider:before{display:table;content:""}.el-slider:after{clear:both}.el-slider__runway{width:100%;height:6px;margin:16px 0;background-color:#dfe4ed;border-radius:3px;position:relative;cursor:pointer;vertical-align:middle}.el-slider__runway.show-input{margin-right:160px;width:auto}.el-slider__runway.disabled{cursor:default}.el-slider__runway.disabled .el-slider__bar{background-color:#c0c4cc}.el-slider__runway.disabled .el-slider__button{border-color:#c0c4cc}.el-slider__runway.disabled .el-slider__button-wrapper.dragging,.el-slider__runway.disabled .el-slider__button-wrapper.hover,.el-slider__runway.disabled .el-slider__button-wrapper:hover{cursor:not-allowed}.el-slider__runway.disabled .el-slider__button.dragging,.el-slider__runway.disabled .el-slider__button.hover,.el-slider__runway.disabled .el-slider__button:hover{-webkit-transform:scale(1);transform:scale(1)}.el-slider__runway.disabled .el-slider__button.dragging,.el-slider__runway.disabled .el-slider__button.hover,.el-slider__runway.disabled .el-slider__button:hover{cursor:not-allowed}.el-slider__input{float:right;margin-top:3px;width:130px}.el-slider__input.el-input-number--mini{margin-top:5px}.el-slider__input.el-input-number--medium{margin-top:0}.el-slider__input.el-input-number--large{margin-top:-2px}.el-slider__bar{height:6px;background-color:#1890ff;border-top-left-radius:3px;border-bottom-left-radius:3px;position:absolute}.el-slider__button-wrapper{height:36px;width:36px;position:absolute;z-index:1001;top:-15px;-webkit-transform:translateX(-50%);transform:translateX(-50%);background-color:transparent;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;line-height:normal}.el-slider__button-wrapper:after{content:"";height:100%}.el-slider__button-wrapper .el-tooltip,.el-slider__button-wrapper:after{display:inline-block;vertical-align:middle}.el-slider__button-wrapper.hover,.el-slider__button-wrapper:hover{cursor:-webkit-grab;cursor:grab}.el-slider__button-wrapper.dragging{cursor:-webkit-grabbing;cursor:grabbing}.el-slider__button{width:16px;height:16px;border:2px solid #1890ff;background-color:#fff;border-radius:50%;-webkit-transition:.2s;transition:.2s;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-slider__button.dragging,.el-slider__button.hover,.el-slider__button:hover{-webkit-transform:scale(1.2);transform:scale(1.2)}.el-slider__button.hover,.el-slider__button:hover{cursor:-webkit-grab;cursor:grab}.el-slider__button.dragging{cursor:-webkit-grabbing;cursor:grabbing}.el-slider__stop{position:absolute;height:6px;width:6px;border-radius:100%;background-color:#fff;-webkit-transform:translateX(-50%);transform:translateX(-50%)}.el-slider__marks{top:0;left:12px;width:18px;height:100%}.el-slider__marks-text{position:absolute;-webkit-transform:translateX(-50%);transform:translateX(-50%);font-size:14px;color:#909399;margin-top:15px}.el-slider.is-vertical{position:relative}.el-slider.is-vertical .el-slider__runway{width:6px;height:100%;margin:0 16px}.el-slider.is-vertical .el-slider__bar{width:6px;height:auto;border-radius:0 0 3px 3px}.el-slider.is-vertical .el-slider__button-wrapper{top:auto;left:-15px}.el-slider.is-vertical .el-slider__button-wrapper,.el-slider.is-vertical .el-slider__stop{-webkit-transform:translateY(50%);transform:translateY(50%)}.el-slider.is-vertical.el-slider--with-input{padding-bottom:58px}.el-slider.is-vertical.el-slider--with-input .el-slider__input{overflow:visible;float:none;position:absolute;bottom:22px;width:36px;margin-top:15px}.el-slider.is-vertical.el-slider--with-input .el-slider__input .el-input__inner{text-align:center;padding-left:5px;padding-right:5px}.el-slider.is-vertical.el-slider--with-input .el-slider__input .el-input-number__decrease,.el-slider.is-vertical.el-slider--with-input .el-slider__input .el-input-number__increase{top:32px;margin-top:-1px;border:1px solid #dcdfe6;line-height:20px;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-transition:border-color .2s cubic-bezier(.645,.045,.355,1);transition:border-color .2s cubic-bezier(.645,.045,.355,1)}.el-slider.is-vertical.el-slider--with-input .el-slider__input .el-input-number__decrease{width:18px;right:18px;border-bottom-left-radius:4px}.el-slider.is-vertical.el-slider--with-input .el-slider__input .el-input-number__increase{width:19px;border-bottom-right-radius:4px}.el-slider.is-vertical.el-slider--with-input .el-slider__input .el-input-number__increase~.el-input .el-input__inner{border-bottom-left-radius:0;border-bottom-right-radius:0}.el-slider.is-vertical.el-slider--with-input .el-slider__input:hover .el-input-number__decrease,.el-slider.is-vertical.el-slider--with-input .el-slider__input:hover .el-input-number__increase{border-color:#c0c4cc}.el-slider.is-vertical.el-slider--with-input .el-slider__input:active .el-input-number__decrease,.el-slider.is-vertical.el-slider--with-input .el-slider__input:active .el-input-number__increase{border-color:#1890ff}.el-slider.is-vertical .el-slider__marks-text{margin-top:0;left:15px;-webkit-transform:translateY(50%);transform:translateY(50%)}.el-loading-parent--relative{position:relative!important}.el-loading-parent--hidden{overflow:hidden!important}.el-loading-mask{position:absolute;z-index:2000;background-color:hsla(0,0%,100%,.9);margin:0;top:0;right:0;bottom:0;left:0;-webkit-transition:opacity .3s;transition:opacity .3s}.el-loading-mask.is-fullscreen{position:fixed}.el-loading-mask.is-fullscreen .el-loading-spinner{margin-top:-25px}.el-loading-mask.is-fullscreen .el-loading-spinner .circular{height:50px;width:50px}.el-loading-spinner{top:50%;margin-top:-21px;width:100%;text-align:center;position:absolute}.el-loading-spinner .el-loading-text{color:#1890ff;margin:3px 0;font-size:14px}.el-loading-spinner .circular{height:42px;width:42px;-webkit-animation:loading-rotate 2s linear infinite;animation:loading-rotate 2s linear infinite}.el-loading-spinner .path{-webkit-animation:loading-dash 1.5s ease-in-out infinite;animation:loading-dash 1.5s ease-in-out infinite;stroke-dasharray:90,150;stroke-dashoffset:0;stroke-width:2;stroke:#1890ff;stroke-linecap:round}.el-loading-spinner i{color:#1890ff}.el-loading-fade-enter,.el-loading-fade-leave-active{opacity:0}@-webkit-keyframes loading-rotate{to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes loading-rotate{to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@-webkit-keyframes loading-dash{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-40px}to{stroke-dasharray:90,150;stroke-dashoffset:-120px}}@keyframes loading-dash{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-40px}to{stroke-dasharray:90,150;stroke-dashoffset:-120px}}.el-row{position:relative;-webkit-box-sizing:border-box;box-sizing:border-box}.el-row:after,.el-row:before{display:table;content:""}.el-row:after{clear:both}.el-row--flex{display:-webkit-box;display:-ms-flexbox;display:flex}.el-row--flex:after,.el-row--flex:before{display:none}.el-row--flex.is-justify-center{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.el-row--flex.is-justify-end{-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end}.el-row--flex.is-justify-space-between{-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.el-row--flex.is-justify-space-around{-ms-flex-pack:distribute;justify-content:space-around}.el-row--flex.is-align-top{-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start}.el-row--flex.is-align-middle{-webkit-box-align:center;-ms-flex-align:center;align-items:center}.el-row--flex.is-align-bottom{-webkit-box-align:end;-ms-flex-align:end;align-items:flex-end}[class*=el-col-]{float:left;-webkit-box-sizing:border-box;box-sizing:border-box}.el-col-0{display:none;width:0}.el-col-offset-0{margin-left:0}.el-col-pull-0{position:relative;right:0}.el-col-push-0{position:relative;left:0}.el-col-1{width:4.1666666667%}.el-col-offset-1{margin-left:4.1666666667%}.el-col-pull-1{position:relative;right:4.1666666667%}.el-col-push-1{position:relative;left:4.1666666667%}.el-col-2{width:8.3333333333%}.el-col-offset-2{margin-left:8.3333333333%}.el-col-pull-2{position:relative;right:8.3333333333%}.el-col-push-2{position:relative;left:8.3333333333%}.el-col-3{width:12.5%}.el-col-offset-3{margin-left:12.5%}.el-col-pull-3{position:relative;right:12.5%}.el-col-push-3{position:relative;left:12.5%}.el-col-4{width:16.6666666667%}.el-col-offset-4{margin-left:16.6666666667%}.el-col-pull-4{position:relative;right:16.6666666667%}.el-col-push-4{position:relative;left:16.6666666667%}.el-col-5{width:20.8333333333%}.el-col-offset-5{margin-left:20.8333333333%}.el-col-pull-5{position:relative;right:20.8333333333%}.el-col-push-5{position:relative;left:20.8333333333%}.el-col-6{width:25%}.el-col-offset-6{margin-left:25%}.el-col-pull-6{position:relative;right:25%}.el-col-push-6{position:relative;left:25%}.el-col-7{width:29.1666666667%}.el-col-offset-7{margin-left:29.1666666667%}.el-col-pull-7{position:relative;right:29.1666666667%}.el-col-push-7{position:relative;left:29.1666666667%}.el-col-8{width:33.3333333333%}.el-col-offset-8{margin-left:33.3333333333%}.el-col-pull-8{position:relative;right:33.3333333333%}.el-col-push-8{position:relative;left:33.3333333333%}.el-col-9{width:37.5%}.el-col-offset-9{margin-left:37.5%}.el-col-pull-9{position:relative;right:37.5%}.el-col-push-9{position:relative;left:37.5%}.el-col-10{width:41.6666666667%}.el-col-offset-10{margin-left:41.6666666667%}.el-col-pull-10{position:relative;right:41.6666666667%}.el-col-push-10{position:relative;left:41.6666666667%}.el-col-11{width:45.8333333333%}.el-col-offset-11{margin-left:45.8333333333%}.el-col-pull-11{position:relative;right:45.8333333333%}.el-col-push-11{position:relative;left:45.8333333333%}.el-col-12{width:50%}.el-col-offset-12{margin-left:50%}.el-col-pull-12{position:relative;right:50%}.el-col-push-12{position:relative;left:50%}.el-col-13{width:54.1666666667%}.el-col-offset-13{margin-left:54.1666666667%}.el-col-pull-13{position:relative;right:54.1666666667%}.el-col-push-13{position:relative;left:54.1666666667%}.el-col-14{width:58.3333333333%}.el-col-offset-14{margin-left:58.3333333333%}.el-col-pull-14{position:relative;right:58.3333333333%}.el-col-push-14{position:relative;left:58.3333333333%}.el-col-15{width:62.5%}.el-col-offset-15{margin-left:62.5%}.el-col-pull-15{position:relative;right:62.5%}.el-col-push-15{position:relative;left:62.5%}.el-col-16{width:66.6666666667%}.el-col-offset-16{margin-left:66.6666666667%}.el-col-pull-16{position:relative;right:66.6666666667%}.el-col-push-16{position:relative;left:66.6666666667%}.el-col-17{width:70.8333333333%}.el-col-offset-17{margin-left:70.8333333333%}.el-col-pull-17{position:relative;right:70.8333333333%}.el-col-push-17{position:relative;left:70.8333333333%}.el-col-18{width:75%}.el-col-offset-18{margin-left:75%}.el-col-pull-18{position:relative;right:75%}.el-col-push-18{position:relative;left:75%}.el-col-19{width:79.1666666667%}.el-col-offset-19{margin-left:79.1666666667%}.el-col-pull-19{position:relative;right:79.1666666667%}.el-col-push-19{position:relative;left:79.1666666667%}.el-col-20{width:83.3333333333%}.el-col-offset-20{margin-left:83.3333333333%}.el-col-pull-20{position:relative;right:83.3333333333%}.el-col-push-20{position:relative;left:83.3333333333%}.el-col-21{width:87.5%}.el-col-offset-21{margin-left:87.5%}.el-col-pull-21{position:relative;right:87.5%}.el-col-push-21{position:relative;left:87.5%}.el-col-22{width:91.6666666667%}.el-col-offset-22{margin-left:91.6666666667%}.el-col-pull-22{position:relative;right:91.6666666667%}.el-col-push-22{position:relative;left:91.6666666667%}.el-col-23{width:95.8333333333%}.el-col-offset-23{margin-left:95.8333333333%}.el-col-pull-23{position:relative;right:95.8333333333%}.el-col-push-23{position:relative;left:95.8333333333%}.el-col-24{width:100%}.el-col-offset-24{margin-left:100%}.el-col-pull-24{position:relative;right:100%}.el-col-push-24{position:relative;left:100%}@media only screen and (max-width:767px){.el-col-xs-0{display:none;width:0}.el-col-xs-offset-0{margin-left:0}.el-col-xs-pull-0{position:relative;right:0}.el-col-xs-push-0{position:relative;left:0}.el-col-xs-1{width:4.1666666667%}.el-col-xs-offset-1{margin-left:4.1666666667%}.el-col-xs-pull-1{position:relative;right:4.1666666667%}.el-col-xs-push-1{position:relative;left:4.1666666667%}.el-col-xs-2{width:8.3333333333%}.el-col-xs-offset-2{margin-left:8.3333333333%}.el-col-xs-pull-2{position:relative;right:8.3333333333%}.el-col-xs-push-2{position:relative;left:8.3333333333%}.el-col-xs-3{width:12.5%}.el-col-xs-offset-3{margin-left:12.5%}.el-col-xs-pull-3{position:relative;right:12.5%}.el-col-xs-push-3{position:relative;left:12.5%}.el-col-xs-4{width:16.6666666667%}.el-col-xs-offset-4{margin-left:16.6666666667%}.el-col-xs-pull-4{position:relative;right:16.6666666667%}.el-col-xs-push-4{position:relative;left:16.6666666667%}.el-col-xs-5{width:20.8333333333%}.el-col-xs-offset-5{margin-left:20.8333333333%}.el-col-xs-pull-5{position:relative;right:20.8333333333%}.el-col-xs-push-5{position:relative;left:20.8333333333%}.el-col-xs-6{width:25%}.el-col-xs-offset-6{margin-left:25%}.el-col-xs-pull-6{position:relative;right:25%}.el-col-xs-push-6{position:relative;left:25%}.el-col-xs-7{width:29.1666666667%}.el-col-xs-offset-7{margin-left:29.1666666667%}.el-col-xs-pull-7{position:relative;right:29.1666666667%}.el-col-xs-push-7{position:relative;left:29.1666666667%}.el-col-xs-8{width:33.3333333333%}.el-col-xs-offset-8{margin-left:33.3333333333%}.el-col-xs-pull-8{position:relative;right:33.3333333333%}.el-col-xs-push-8{position:relative;left:33.3333333333%}.el-col-xs-9{width:37.5%}.el-col-xs-offset-9{margin-left:37.5%}.el-col-xs-pull-9{position:relative;right:37.5%}.el-col-xs-push-9{position:relative;left:37.5%}.el-col-xs-10{width:41.6666666667%}.el-col-xs-offset-10{margin-left:41.6666666667%}.el-col-xs-pull-10{position:relative;right:41.6666666667%}.el-col-xs-push-10{position:relative;left:41.6666666667%}.el-col-xs-11{width:45.8333333333%}.el-col-xs-offset-11{margin-left:45.8333333333%}.el-col-xs-pull-11{position:relative;right:45.8333333333%}.el-col-xs-push-11{position:relative;left:45.8333333333%}.el-col-xs-12{width:50%}.el-col-xs-offset-12{margin-left:50%}.el-col-xs-pull-12{position:relative;right:50%}.el-col-xs-push-12{position:relative;left:50%}.el-col-xs-13{width:54.1666666667%}.el-col-xs-offset-13{margin-left:54.1666666667%}.el-col-xs-pull-13{position:relative;right:54.1666666667%}.el-col-xs-push-13{position:relative;left:54.1666666667%}.el-col-xs-14{width:58.3333333333%}.el-col-xs-offset-14{margin-left:58.3333333333%}.el-col-xs-pull-14{position:relative;right:58.3333333333%}.el-col-xs-push-14{position:relative;left:58.3333333333%}.el-col-xs-15{width:62.5%}.el-col-xs-offset-15{margin-left:62.5%}.el-col-xs-pull-15{position:relative;right:62.5%}.el-col-xs-push-15{position:relative;left:62.5%}.el-col-xs-16{width:66.6666666667%}.el-col-xs-offset-16{margin-left:66.6666666667%}.el-col-xs-pull-16{position:relative;right:66.6666666667%}.el-col-xs-push-16{position:relative;left:66.6666666667%}.el-col-xs-17{width:70.8333333333%}.el-col-xs-offset-17{margin-left:70.8333333333%}.el-col-xs-pull-17{position:relative;right:70.8333333333%}.el-col-xs-push-17{position:relative;left:70.8333333333%}.el-col-xs-18{width:75%}.el-col-xs-offset-18{margin-left:75%}.el-col-xs-pull-18{position:relative;right:75%}.el-col-xs-push-18{position:relative;left:75%}.el-col-xs-19{width:79.1666666667%}.el-col-xs-offset-19{margin-left:79.1666666667%}.el-col-xs-pull-19{position:relative;right:79.1666666667%}.el-col-xs-push-19{position:relative;left:79.1666666667%}.el-col-xs-20{width:83.3333333333%}.el-col-xs-offset-20{margin-left:83.3333333333%}.el-col-xs-pull-20{position:relative;right:83.3333333333%}.el-col-xs-push-20{position:relative;left:83.3333333333%}.el-col-xs-21{width:87.5%}.el-col-xs-offset-21{margin-left:87.5%}.el-col-xs-pull-21{position:relative;right:87.5%}.el-col-xs-push-21{position:relative;left:87.5%}.el-col-xs-22{width:91.6666666667%}.el-col-xs-offset-22{margin-left:91.6666666667%}.el-col-xs-pull-22{position:relative;right:91.6666666667%}.el-col-xs-push-22{position:relative;left:91.6666666667%}.el-col-xs-23{width:95.8333333333%}.el-col-xs-offset-23{margin-left:95.8333333333%}.el-col-xs-pull-23{position:relative;right:95.8333333333%}.el-col-xs-push-23{position:relative;left:95.8333333333%}.el-col-xs-24{width:100%}.el-col-xs-offset-24{margin-left:100%}.el-col-xs-pull-24{position:relative;right:100%}.el-col-xs-push-24{position:relative;left:100%}}@media only screen and (min-width:768px){.el-col-sm-0{display:none;width:0}.el-col-sm-offset-0{margin-left:0}.el-col-sm-pull-0{position:relative;right:0}.el-col-sm-push-0{position:relative;left:0}.el-col-sm-1{width:4.1666666667%}.el-col-sm-offset-1{margin-left:4.1666666667%}.el-col-sm-pull-1{position:relative;right:4.1666666667%}.el-col-sm-push-1{position:relative;left:4.1666666667%}.el-col-sm-2{width:8.3333333333%}.el-col-sm-offset-2{margin-left:8.3333333333%}.el-col-sm-pull-2{position:relative;right:8.3333333333%}.el-col-sm-push-2{position:relative;left:8.3333333333%}.el-col-sm-3{width:12.5%}.el-col-sm-offset-3{margin-left:12.5%}.el-col-sm-pull-3{position:relative;right:12.5%}.el-col-sm-push-3{position:relative;left:12.5%}.el-col-sm-4{width:16.6666666667%}.el-col-sm-offset-4{margin-left:16.6666666667%}.el-col-sm-pull-4{position:relative;right:16.6666666667%}.el-col-sm-push-4{position:relative;left:16.6666666667%}.el-col-sm-5{width:20.8333333333%}.el-col-sm-offset-5{margin-left:20.8333333333%}.el-col-sm-pull-5{position:relative;right:20.8333333333%}.el-col-sm-push-5{position:relative;left:20.8333333333%}.el-col-sm-6{width:25%}.el-col-sm-offset-6{margin-left:25%}.el-col-sm-pull-6{position:relative;right:25%}.el-col-sm-push-6{position:relative;left:25%}.el-col-sm-7{width:29.1666666667%}.el-col-sm-offset-7{margin-left:29.1666666667%}.el-col-sm-pull-7{position:relative;right:29.1666666667%}.el-col-sm-push-7{position:relative;left:29.1666666667%}.el-col-sm-8{width:33.3333333333%}.el-col-sm-offset-8{margin-left:33.3333333333%}.el-col-sm-pull-8{position:relative;right:33.3333333333%}.el-col-sm-push-8{position:relative;left:33.3333333333%}.el-col-sm-9{width:37.5%}.el-col-sm-offset-9{margin-left:37.5%}.el-col-sm-pull-9{position:relative;right:37.5%}.el-col-sm-push-9{position:relative;left:37.5%}.el-col-sm-10{width:41.6666666667%}.el-col-sm-offset-10{margin-left:41.6666666667%}.el-col-sm-pull-10{position:relative;right:41.6666666667%}.el-col-sm-push-10{position:relative;left:41.6666666667%}.el-col-sm-11{width:45.8333333333%}.el-col-sm-offset-11{margin-left:45.8333333333%}.el-col-sm-pull-11{position:relative;right:45.8333333333%}.el-col-sm-push-11{position:relative;left:45.8333333333%}.el-col-sm-12{width:50%}.el-col-sm-offset-12{margin-left:50%}.el-col-sm-pull-12{position:relative;right:50%}.el-col-sm-push-12{position:relative;left:50%}.el-col-sm-13{width:54.1666666667%}.el-col-sm-offset-13{margin-left:54.1666666667%}.el-col-sm-pull-13{position:relative;right:54.1666666667%}.el-col-sm-push-13{position:relative;left:54.1666666667%}.el-col-sm-14{width:58.3333333333%}.el-col-sm-offset-14{margin-left:58.3333333333%}.el-col-sm-pull-14{position:relative;right:58.3333333333%}.el-col-sm-push-14{position:relative;left:58.3333333333%}.el-col-sm-15{width:62.5%}.el-col-sm-offset-15{margin-left:62.5%}.el-col-sm-pull-15{position:relative;right:62.5%}.el-col-sm-push-15{position:relative;left:62.5%}.el-col-sm-16{width:66.6666666667%}.el-col-sm-offset-16{margin-left:66.6666666667%}.el-col-sm-pull-16{position:relative;right:66.6666666667%}.el-col-sm-push-16{position:relative;left:66.6666666667%}.el-col-sm-17{width:70.8333333333%}.el-col-sm-offset-17{margin-left:70.8333333333%}.el-col-sm-pull-17{position:relative;right:70.8333333333%}.el-col-sm-push-17{position:relative;left:70.8333333333%}.el-col-sm-18{width:75%}.el-col-sm-offset-18{margin-left:75%}.el-col-sm-pull-18{position:relative;right:75%}.el-col-sm-push-18{position:relative;left:75%}.el-col-sm-19{width:79.1666666667%}.el-col-sm-offset-19{margin-left:79.1666666667%}.el-col-sm-pull-19{position:relative;right:79.1666666667%}.el-col-sm-push-19{position:relative;left:79.1666666667%}.el-col-sm-20{width:83.3333333333%}.el-col-sm-offset-20{margin-left:83.3333333333%}.el-col-sm-pull-20{position:relative;right:83.3333333333%}.el-col-sm-push-20{position:relative;left:83.3333333333%}.el-col-sm-21{width:87.5%}.el-col-sm-offset-21{margin-left:87.5%}.el-col-sm-pull-21{position:relative;right:87.5%}.el-col-sm-push-21{position:relative;left:87.5%}.el-col-sm-22{width:91.6666666667%}.el-col-sm-offset-22{margin-left:91.6666666667%}.el-col-sm-pull-22{position:relative;right:91.6666666667%}.el-col-sm-push-22{position:relative;left:91.6666666667%}.el-col-sm-23{width:95.8333333333%}.el-col-sm-offset-23{margin-left:95.8333333333%}.el-col-sm-pull-23{position:relative;right:95.8333333333%}.el-col-sm-push-23{position:relative;left:95.8333333333%}.el-col-sm-24{width:100%}.el-col-sm-offset-24{margin-left:100%}.el-col-sm-pull-24{position:relative;right:100%}.el-col-sm-push-24{position:relative;left:100%}}@media only screen and (min-width:992px){.el-col-md-0{display:none;width:0}.el-col-md-offset-0{margin-left:0}.el-col-md-pull-0{position:relative;right:0}.el-col-md-push-0{position:relative;left:0}.el-col-md-1{width:4.1666666667%}.el-col-md-offset-1{margin-left:4.1666666667%}.el-col-md-pull-1{position:relative;right:4.1666666667%}.el-col-md-push-1{position:relative;left:4.1666666667%}.el-col-md-2{width:8.3333333333%}.el-col-md-offset-2{margin-left:8.3333333333%}.el-col-md-pull-2{position:relative;right:8.3333333333%}.el-col-md-push-2{position:relative;left:8.3333333333%}.el-col-md-3{width:12.5%}.el-col-md-offset-3{margin-left:12.5%}.el-col-md-pull-3{position:relative;right:12.5%}.el-col-md-push-3{position:relative;left:12.5%}.el-col-md-4{width:16.6666666667%}.el-col-md-offset-4{margin-left:16.6666666667%}.el-col-md-pull-4{position:relative;right:16.6666666667%}.el-col-md-push-4{position:relative;left:16.6666666667%}.el-col-md-5{width:20.8333333333%}.el-col-md-offset-5{margin-left:20.8333333333%}.el-col-md-pull-5{position:relative;right:20.8333333333%}.el-col-md-push-5{position:relative;left:20.8333333333%}.el-col-md-6{width:25%}.el-col-md-offset-6{margin-left:25%}.el-col-md-pull-6{position:relative;right:25%}.el-col-md-push-6{position:relative;left:25%}.el-col-md-7{width:29.1666666667%}.el-col-md-offset-7{margin-left:29.1666666667%}.el-col-md-pull-7{position:relative;right:29.1666666667%}.el-col-md-push-7{position:relative;left:29.1666666667%}.el-col-md-8{width:33.3333333333%}.el-col-md-offset-8{margin-left:33.3333333333%}.el-col-md-pull-8{position:relative;right:33.3333333333%}.el-col-md-push-8{position:relative;left:33.3333333333%}.el-col-md-9{width:37.5%}.el-col-md-offset-9{margin-left:37.5%}.el-col-md-pull-9{position:relative;right:37.5%}.el-col-md-push-9{position:relative;left:37.5%}.el-col-md-10{width:41.6666666667%}.el-col-md-offset-10{margin-left:41.6666666667%}.el-col-md-pull-10{position:relative;right:41.6666666667%}.el-col-md-push-10{position:relative;left:41.6666666667%}.el-col-md-11{width:45.8333333333%}.el-col-md-offset-11{margin-left:45.8333333333%}.el-col-md-pull-11{position:relative;right:45.8333333333%}.el-col-md-push-11{position:relative;left:45.8333333333%}.el-col-md-12{width:50%}.el-col-md-offset-12{margin-left:50%}.el-col-md-pull-12{position:relative;right:50%}.el-col-md-push-12{position:relative;left:50%}.el-col-md-13{width:54.1666666667%}.el-col-md-offset-13{margin-left:54.1666666667%}.el-col-md-pull-13{position:relative;right:54.1666666667%}.el-col-md-push-13{position:relative;left:54.1666666667%}.el-col-md-14{width:58.3333333333%}.el-col-md-offset-14{margin-left:58.3333333333%}.el-col-md-pull-14{position:relative;right:58.3333333333%}.el-col-md-push-14{position:relative;left:58.3333333333%}.el-col-md-15{width:62.5%}.el-col-md-offset-15{margin-left:62.5%}.el-col-md-pull-15{position:relative;right:62.5%}.el-col-md-push-15{position:relative;left:62.5%}.el-col-md-16{width:66.6666666667%}.el-col-md-offset-16{margin-left:66.6666666667%}.el-col-md-pull-16{position:relative;right:66.6666666667%}.el-col-md-push-16{position:relative;left:66.6666666667%}.el-col-md-17{width:70.8333333333%}.el-col-md-offset-17{margin-left:70.8333333333%}.el-col-md-pull-17{position:relative;right:70.8333333333%}.el-col-md-push-17{position:relative;left:70.8333333333%}.el-col-md-18{width:75%}.el-col-md-offset-18{margin-left:75%}.el-col-md-pull-18{position:relative;right:75%}.el-col-md-push-18{position:relative;left:75%}.el-col-md-19{width:79.1666666667%}.el-col-md-offset-19{margin-left:79.1666666667%}.el-col-md-pull-19{position:relative;right:79.1666666667%}.el-col-md-push-19{position:relative;left:79.1666666667%}.el-col-md-20{width:83.3333333333%}.el-col-md-offset-20{margin-left:83.3333333333%}.el-col-md-pull-20{position:relative;right:83.3333333333%}.el-col-md-push-20{position:relative;left:83.3333333333%}.el-col-md-21{width:87.5%}.el-col-md-offset-21{margin-left:87.5%}.el-col-md-pull-21{position:relative;right:87.5%}.el-col-md-push-21{position:relative;left:87.5%}.el-col-md-22{width:91.6666666667%}.el-col-md-offset-22{margin-left:91.6666666667%}.el-col-md-pull-22{position:relative;right:91.6666666667%}.el-col-md-push-22{position:relative;left:91.6666666667%}.el-col-md-23{width:95.8333333333%}.el-col-md-offset-23{margin-left:95.8333333333%}.el-col-md-pull-23{position:relative;right:95.8333333333%}.el-col-md-push-23{position:relative;left:95.8333333333%}.el-col-md-24{width:100%}.el-col-md-offset-24{margin-left:100%}.el-col-md-pull-24{position:relative;right:100%}.el-col-md-push-24{position:relative;left:100%}}@media only screen and (min-width:1200px){.el-col-lg-0{display:none;width:0}.el-col-lg-offset-0{margin-left:0}.el-col-lg-pull-0{position:relative;right:0}.el-col-lg-push-0{position:relative;left:0}.el-col-lg-1{width:4.1666666667%}.el-col-lg-offset-1{margin-left:4.1666666667%}.el-col-lg-pull-1{position:relative;right:4.1666666667%}.el-col-lg-push-1{position:relative;left:4.1666666667%}.el-col-lg-2{width:8.3333333333%}.el-col-lg-offset-2{margin-left:8.3333333333%}.el-col-lg-pull-2{position:relative;right:8.3333333333%}.el-col-lg-push-2{position:relative;left:8.3333333333%}.el-col-lg-3{width:12.5%}.el-col-lg-offset-3{margin-left:12.5%}.el-col-lg-pull-3{position:relative;right:12.5%}.el-col-lg-push-3{position:relative;left:12.5%}.el-col-lg-4{width:16.6666666667%}.el-col-lg-offset-4{margin-left:16.6666666667%}.el-col-lg-pull-4{position:relative;right:16.6666666667%}.el-col-lg-push-4{position:relative;left:16.6666666667%}.el-col-lg-5{width:20.8333333333%}.el-col-lg-offset-5{margin-left:20.8333333333%}.el-col-lg-pull-5{position:relative;right:20.8333333333%}.el-col-lg-push-5{position:relative;left:20.8333333333%}.el-col-lg-6{width:25%}.el-col-lg-offset-6{margin-left:25%}.el-col-lg-pull-6{position:relative;right:25%}.el-col-lg-push-6{position:relative;left:25%}.el-col-lg-7{width:29.1666666667%}.el-col-lg-offset-7{margin-left:29.1666666667%}.el-col-lg-pull-7{position:relative;right:29.1666666667%}.el-col-lg-push-7{position:relative;left:29.1666666667%}.el-col-lg-8{width:33.3333333333%}.el-col-lg-offset-8{margin-left:33.3333333333%}.el-col-lg-pull-8{position:relative;right:33.3333333333%}.el-col-lg-push-8{position:relative;left:33.3333333333%}.el-col-lg-9{width:37.5%}.el-col-lg-offset-9{margin-left:37.5%}.el-col-lg-pull-9{position:relative;right:37.5%}.el-col-lg-push-9{position:relative;left:37.5%}.el-col-lg-10{width:41.6666666667%}.el-col-lg-offset-10{margin-left:41.6666666667%}.el-col-lg-pull-10{position:relative;right:41.6666666667%}.el-col-lg-push-10{position:relative;left:41.6666666667%}.el-col-lg-11{width:45.8333333333%}.el-col-lg-offset-11{margin-left:45.8333333333%}.el-col-lg-pull-11{position:relative;right:45.8333333333%}.el-col-lg-push-11{position:relative;left:45.8333333333%}.el-col-lg-12{width:50%}.el-col-lg-offset-12{margin-left:50%}.el-col-lg-pull-12{position:relative;right:50%}.el-col-lg-push-12{position:relative;left:50%}.el-col-lg-13{width:54.1666666667%}.el-col-lg-offset-13{margin-left:54.1666666667%}.el-col-lg-pull-13{position:relative;right:54.1666666667%}.el-col-lg-push-13{position:relative;left:54.1666666667%}.el-col-lg-14{width:58.3333333333%}.el-col-lg-offset-14{margin-left:58.3333333333%}.el-col-lg-pull-14{position:relative;right:58.3333333333%}.el-col-lg-push-14{position:relative;left:58.3333333333%}.el-col-lg-15{width:62.5%}.el-col-lg-offset-15{margin-left:62.5%}.el-col-lg-pull-15{position:relative;right:62.5%}.el-col-lg-push-15{position:relative;left:62.5%}.el-col-lg-16{width:66.6666666667%}.el-col-lg-offset-16{margin-left:66.6666666667%}.el-col-lg-pull-16{position:relative;right:66.6666666667%}.el-col-lg-push-16{position:relative;left:66.6666666667%}.el-col-lg-17{width:70.8333333333%}.el-col-lg-offset-17{margin-left:70.8333333333%}.el-col-lg-pull-17{position:relative;right:70.8333333333%}.el-col-lg-push-17{position:relative;left:70.8333333333%}.el-col-lg-18{width:75%}.el-col-lg-offset-18{margin-left:75%}.el-col-lg-pull-18{position:relative;right:75%}.el-col-lg-push-18{position:relative;left:75%}.el-col-lg-19{width:79.1666666667%}.el-col-lg-offset-19{margin-left:79.1666666667%}.el-col-lg-pull-19{position:relative;right:79.1666666667%}.el-col-lg-push-19{position:relative;left:79.1666666667%}.el-col-lg-20{width:83.3333333333%}.el-col-lg-offset-20{margin-left:83.3333333333%}.el-col-lg-pull-20{position:relative;right:83.3333333333%}.el-col-lg-push-20{position:relative;left:83.3333333333%}.el-col-lg-21{width:87.5%}.el-col-lg-offset-21{margin-left:87.5%}.el-col-lg-pull-21{position:relative;right:87.5%}.el-col-lg-push-21{position:relative;left:87.5%}.el-col-lg-22{width:91.6666666667%}.el-col-lg-offset-22{margin-left:91.6666666667%}.el-col-lg-pull-22{position:relative;right:91.6666666667%}.el-col-lg-push-22{position:relative;left:91.6666666667%}.el-col-lg-23{width:95.8333333333%}.el-col-lg-offset-23{margin-left:95.8333333333%}.el-col-lg-pull-23{position:relative;right:95.8333333333%}.el-col-lg-push-23{position:relative;left:95.8333333333%}.el-col-lg-24{width:100%}.el-col-lg-offset-24{margin-left:100%}.el-col-lg-pull-24{position:relative;right:100%}.el-col-lg-push-24{position:relative;left:100%}}@media only screen and (min-width:1920px){.el-col-xl-0{display:none;width:0}.el-col-xl-offset-0{margin-left:0}.el-col-xl-pull-0{position:relative;right:0}.el-col-xl-push-0{position:relative;left:0}.el-col-xl-1{width:4.1666666667%}.el-col-xl-offset-1{margin-left:4.1666666667%}.el-col-xl-pull-1{position:relative;right:4.1666666667%}.el-col-xl-push-1{position:relative;left:4.1666666667%}.el-col-xl-2{width:8.3333333333%}.el-col-xl-offset-2{margin-left:8.3333333333%}.el-col-xl-pull-2{position:relative;right:8.3333333333%}.el-col-xl-push-2{position:relative;left:8.3333333333%}.el-col-xl-3{width:12.5%}.el-col-xl-offset-3{margin-left:12.5%}.el-col-xl-pull-3{position:relative;right:12.5%}.el-col-xl-push-3{position:relative;left:12.5%}.el-col-xl-4{width:16.6666666667%}.el-col-xl-offset-4{margin-left:16.6666666667%}.el-col-xl-pull-4{position:relative;right:16.6666666667%}.el-col-xl-push-4{position:relative;left:16.6666666667%}.el-col-xl-5{width:20.8333333333%}.el-col-xl-offset-5{margin-left:20.8333333333%}.el-col-xl-pull-5{position:relative;right:20.8333333333%}.el-col-xl-push-5{position:relative;left:20.8333333333%}.el-col-xl-6{width:25%}.el-col-xl-offset-6{margin-left:25%}.el-col-xl-pull-6{position:relative;right:25%}.el-col-xl-push-6{position:relative;left:25%}.el-col-xl-7{width:29.1666666667%}.el-col-xl-offset-7{margin-left:29.1666666667%}.el-col-xl-pull-7{position:relative;right:29.1666666667%}.el-col-xl-push-7{position:relative;left:29.1666666667%}.el-col-xl-8{width:33.3333333333%}.el-col-xl-offset-8{margin-left:33.3333333333%}.el-col-xl-pull-8{position:relative;right:33.3333333333%}.el-col-xl-push-8{position:relative;left:33.3333333333%}.el-col-xl-9{width:37.5%}.el-col-xl-offset-9{margin-left:37.5%}.el-col-xl-pull-9{position:relative;right:37.5%}.el-col-xl-push-9{position:relative;left:37.5%}.el-col-xl-10{width:41.6666666667%}.el-col-xl-offset-10{margin-left:41.6666666667%}.el-col-xl-pull-10{position:relative;right:41.6666666667%}.el-col-xl-push-10{position:relative;left:41.6666666667%}.el-col-xl-11{width:45.8333333333%}.el-col-xl-offset-11{margin-left:45.8333333333%}.el-col-xl-pull-11{position:relative;right:45.8333333333%}.el-col-xl-push-11{position:relative;left:45.8333333333%}.el-col-xl-12{width:50%}.el-col-xl-offset-12{margin-left:50%}.el-col-xl-pull-12{position:relative;right:50%}.el-col-xl-push-12{position:relative;left:50%}.el-col-xl-13{width:54.1666666667%}.el-col-xl-offset-13{margin-left:54.1666666667%}.el-col-xl-pull-13{position:relative;right:54.1666666667%}.el-col-xl-push-13{position:relative;left:54.1666666667%}.el-col-xl-14{width:58.3333333333%}.el-col-xl-offset-14{margin-left:58.3333333333%}.el-col-xl-pull-14{position:relative;right:58.3333333333%}.el-col-xl-push-14{position:relative;left:58.3333333333%}.el-col-xl-15{width:62.5%}.el-col-xl-offset-15{margin-left:62.5%}.el-col-xl-pull-15{position:relative;right:62.5%}.el-col-xl-push-15{position:relative;left:62.5%}.el-col-xl-16{width:66.6666666667%}.el-col-xl-offset-16{margin-left:66.6666666667%}.el-col-xl-pull-16{position:relative;right:66.6666666667%}.el-col-xl-push-16{position:relative;left:66.6666666667%}.el-col-xl-17{width:70.8333333333%}.el-col-xl-offset-17{margin-left:70.8333333333%}.el-col-xl-pull-17{position:relative;right:70.8333333333%}.el-col-xl-push-17{position:relative;left:70.8333333333%}.el-col-xl-18{width:75%}.el-col-xl-offset-18{margin-left:75%}.el-col-xl-pull-18{position:relative;right:75%}.el-col-xl-push-18{position:relative;left:75%}.el-col-xl-19{width:79.1666666667%}.el-col-xl-offset-19{margin-left:79.1666666667%}.el-col-xl-pull-19{position:relative;right:79.1666666667%}.el-col-xl-push-19{position:relative;left:79.1666666667%}.el-col-xl-20{width:83.3333333333%}.el-col-xl-offset-20{margin-left:83.3333333333%}.el-col-xl-pull-20{position:relative;right:83.3333333333%}.el-col-xl-push-20{position:relative;left:83.3333333333%}.el-col-xl-21{width:87.5%}.el-col-xl-offset-21{margin-left:87.5%}.el-col-xl-pull-21{position:relative;right:87.5%}.el-col-xl-push-21{position:relative;left:87.5%}.el-col-xl-22{width:91.6666666667%}.el-col-xl-offset-22{margin-left:91.6666666667%}.el-col-xl-pull-22{position:relative;right:91.6666666667%}.el-col-xl-push-22{position:relative;left:91.6666666667%}.el-col-xl-23{width:95.8333333333%}.el-col-xl-offset-23{margin-left:95.8333333333%}.el-col-xl-pull-23{position:relative;right:95.8333333333%}.el-col-xl-push-23{position:relative;left:95.8333333333%}.el-col-xl-24{width:100%}.el-col-xl-offset-24{margin-left:100%}.el-col-xl-pull-24{position:relative;right:100%}.el-col-xl-push-24{position:relative;left:100%}}@-webkit-keyframes progress{0%{background-position:0 0}to{background-position:32px 0}}.el-upload{display:inline-block;text-align:center;cursor:pointer;outline:none}.el-upload__tip{font-size:12px;color:#606266;margin-top:7px}.el-upload iframe{position:absolute;z-index:-1;top:0;left:0;opacity:0;filter:alpha(opacity=0)}.el-upload--picture-card{background-color:#fbfdff;border:1px dashed #c0ccda;border-radius:6px;-webkit-box-sizing:border-box;box-sizing:border-box;width:148px;height:148px;cursor:pointer;line-height:146px;vertical-align:top}.el-upload--picture-card i{font-size:28px;color:#8c939d}.el-upload--picture-card:hover,.el-upload:focus{border-color:#1890ff;color:#1890ff}.el-upload:focus .el-upload-dragger{border-color:#1890ff}.el-upload-dragger{background-color:#fff;border:1px dashed #d9d9d9;border-radius:6px;-webkit-box-sizing:border-box;box-sizing:border-box;width:360px;height:180px;text-align:center;cursor:pointer;position:relative;overflow:hidden}.el-upload-dragger .el-icon-upload{font-size:67px;color:#c0c4cc;margin:40px 0 16px;line-height:50px}.el-upload-dragger+.el-upload__tip{text-align:center}.el-upload-dragger~.el-upload__files{border-top:1px solid #dcdfe6;margin-top:7px;padding-top:5px}.el-upload-dragger .el-upload__text{color:#606266;font-size:14px;text-align:center}.el-upload-dragger .el-upload__text em{color:#1890ff;font-style:normal}.el-upload-dragger:hover{border-color:#1890ff}.el-upload-dragger.is-dragover{background-color:rgba(32,159,255,.06);border:2px dashed #1890ff}.el-upload-list{margin:0;padding:0;list-style:none}.el-upload-list__item{-webkit-transition:all .5s cubic-bezier(.55,0,.1,1);transition:all .5s cubic-bezier(.55,0,.1,1);font-size:14px;color:#606266;line-height:1.8;margin-top:5px;position:relative;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:4px;width:100%}.el-upload-list__item .el-progress{position:absolute;top:20px;width:100%}.el-upload-list__item .el-progress__text{position:absolute;right:0;top:-13px}.el-upload-list__item .el-progress-bar{margin-right:0;padding-right:0}.el-upload-list__item:first-child{margin-top:10px}.el-upload-list__item .el-icon-upload-success{color:#13ce66}.el-upload-list__item .el-icon-close{display:none;position:absolute;top:5px;right:5px;cursor:pointer;opacity:.75;color:#606266}.el-upload-list__item .el-icon-close:hover{opacity:1}.el-upload-list__item .el-icon-close-tip{display:none;position:absolute;top:5px;right:5px;font-size:12px;cursor:pointer;opacity:1;color:#1890ff}.el-upload-list__item:hover{background-color:#f5f7fa}.el-upload-list__item:hover .el-icon-close{display:inline-block}.el-upload-list__item:hover .el-progress__text{display:none}.el-upload-list__item.is-success .el-upload-list__item-status-label{display:block}.el-upload-list__item.is-success .el-upload-list__item-name:focus,.el-upload-list__item.is-success .el-upload-list__item-name:hover{color:#1890ff;cursor:pointer}.el-upload-list__item.is-success:focus:not(:hover) .el-icon-close-tip{display:inline-block}.el-upload-list__item.is-success:active,.el-upload-list__item.is-success:not(.focusing):focus{outline-width:0}.el-upload-list__item.is-success:active .el-icon-close-tip,.el-upload-list__item.is-success:focus .el-upload-list__item-status-label,.el-upload-list__item.is-success:hover .el-upload-list__item-status-label,.el-upload-list__item.is-success:not(.focusing):focus .el-icon-close-tip{display:none}.el-upload-list.is-disabled .el-upload-list__item:hover .el-upload-list__item-status-label{display:block}.el-upload-list__item-name{color:#606266;display:block;margin-right:40px;overflow:hidden;padding-left:4px;text-overflow:ellipsis;-webkit-transition:color .3s;transition:color .3s;white-space:nowrap}.el-upload-list__item-name [class^=el-icon]{height:100%;margin-right:7px;color:#909399;line-height:inherit}.el-upload-list__item-status-label{position:absolute;right:5px;top:0;line-height:inherit;display:none}.el-upload-list__item-delete{position:absolute;right:10px;top:0;font-size:12px;color:#606266;display:none}.el-upload-list__item-delete:hover{color:#1890ff}.el-upload-list--picture-card{margin:0;display:inline;vertical-align:top}.el-upload-list--picture-card .el-upload-list__item{overflow:hidden;background-color:#fff;border:1px solid #c0ccda;border-radius:6px;-webkit-box-sizing:border-box;box-sizing:border-box;width:148px;height:148px;margin:0 8px 8px 0;display:inline-block}.el-upload-list--picture-card .el-upload-list__item .el-icon-check,.el-upload-list--picture-card .el-upload-list__item .el-icon-circle-check{color:#fff}.el-upload-list--picture-card .el-upload-list__item .el-icon-close,.el-upload-list--picture-card .el-upload-list__item:hover .el-upload-list__item-status-label{display:none}.el-upload-list--picture-card .el-upload-list__item:hover .el-progress__text{display:block}.el-upload-list--picture-card .el-upload-list__item-name{display:none}.el-upload-list--picture-card .el-upload-list__item-thumbnail{width:100%;height:100%}.el-upload-list--picture-card .el-upload-list__item-status-label{position:absolute;right:-15px;top:-6px;width:40px;height:24px;background:#13ce66;text-align:center;-webkit-transform:rotate(45deg);transform:rotate(45deg);-webkit-box-shadow:0 0 1pc 1px rgba(0,0,0,.2);box-shadow:0 0 1pc 1px rgba(0,0,0,.2)}.el-upload-list--picture-card .el-upload-list__item-status-label i{font-size:12px;margin-top:11px;-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}.el-upload-list--picture-card .el-upload-list__item-actions{position:absolute;width:100%;height:100%;left:0;top:0;cursor:default;text-align:center;color:#fff;opacity:0;font-size:20px;background-color:rgba(0,0,0,.5);-webkit-transition:opacity .3s;transition:opacity .3s}.el-upload-list--picture-card .el-upload-list__item-actions:after{display:inline-block;content:"";height:100%;vertical-align:middle}.el-upload-list--picture-card .el-upload-list__item-actions span{display:none;cursor:pointer}.el-upload-list--picture-card .el-upload-list__item-actions span+span{margin-left:15px}.el-upload-list--picture-card .el-upload-list__item-actions .el-upload-list__item-delete{position:static;font-size:inherit;color:inherit}.el-upload-list--picture-card .el-upload-list__item-actions:hover{opacity:1}.el-upload-list--picture-card .el-upload-list__item-actions:hover span{display:inline-block}.el-upload-list--picture-card .el-progress{top:50%;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);bottom:auto;width:126px}.el-upload-list--picture-card .el-progress .el-progress__text{top:50%}.el-upload-list--picture .el-upload-list__item{overflow:hidden;z-index:0;background-color:#fff;border:1px solid #c0ccda;border-radius:6px;-webkit-box-sizing:border-box;box-sizing:border-box;margin-top:10px;padding:10px 10px 10px 90px;height:92px}.el-upload-list--picture .el-upload-list__item .el-icon-check,.el-upload-list--picture .el-upload-list__item .el-icon-circle-check{color:#fff}.el-upload-list--picture .el-upload-list__item:hover .el-upload-list__item-status-label{background:transparent;-webkit-box-shadow:none;box-shadow:none;top:-2px;right:-12px}.el-upload-list--picture .el-upload-list__item:hover .el-progress__text{display:block}.el-upload-list--picture .el-upload-list__item.is-success .el-upload-list__item-name{line-height:70px;margin-top:0}.el-upload-list--picture .el-upload-list__item.is-success .el-upload-list__item-name i{display:none}.el-upload-list--picture .el-upload-list__item-thumbnail{vertical-align:middle;display:inline-block;width:70px;height:70px;float:left;position:relative;z-index:1;margin-left:-80px;background-color:#fff}.el-upload-list--picture .el-upload-list__item-name{display:block;margin-top:20px}.el-upload-list--picture .el-upload-list__item-name i{font-size:70px;line-height:1;position:absolute;left:9px;top:10px}.el-upload-list--picture .el-upload-list__item-status-label{position:absolute;right:-17px;top:-7px;width:46px;height:26px;background:#13ce66;text-align:center;-webkit-transform:rotate(45deg);transform:rotate(45deg);-webkit-box-shadow:0 1px 1px #ccc;box-shadow:0 1px 1px #ccc}.el-upload-list--picture .el-upload-list__item-status-label i{font-size:12px;margin-top:12px;-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}.el-upload-list--picture .el-progress{position:relative;top:-7px}.el-upload-cover{position:absolute;left:0;top:0;width:100%;height:100%;overflow:hidden;z-index:10;cursor:default}.el-upload-cover:after{display:inline-block;content:"";height:100%;vertical-align:middle}.el-upload-cover img{display:block;width:100%;height:100%}.el-upload-cover__label{position:absolute;right:-15px;top:-6px;width:40px;height:24px;background:#13ce66;text-align:center;-webkit-transform:rotate(45deg);transform:rotate(45deg);-webkit-box-shadow:0 0 1pc 1px rgba(0,0,0,.2);box-shadow:0 0 1pc 1px rgba(0,0,0,.2)}.el-upload-cover__label i{font-size:12px;margin-top:11px;-webkit-transform:rotate(-45deg);transform:rotate(-45deg);color:#fff}.el-upload-cover__progress{display:inline-block;vertical-align:middle;position:static;width:243px}.el-upload-cover__progress+.el-upload__inner{opacity:0}.el-upload-cover__content{position:absolute;top:0;left:0;width:100%;height:100%}.el-upload-cover__interact{position:absolute;bottom:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,.72);text-align:center}.el-upload-cover__interact .btn{display:inline-block;color:#fff;font-size:14px;cursor:pointer;vertical-align:middle;-webkit-transition:opacity .3s cubic-bezier(.23,1,.32,1),-webkit-transform .3s cubic-bezier(.23,1,.32,1);transition:opacity .3s cubic-bezier(.23,1,.32,1),-webkit-transform .3s cubic-bezier(.23,1,.32,1);transition:transform .3s cubic-bezier(.23,1,.32,1),opacity .3s cubic-bezier(.23,1,.32,1);transition:transform .3s cubic-bezier(.23,1,.32,1),opacity .3s cubic-bezier(.23,1,.32,1),-webkit-transform .3s cubic-bezier(.23,1,.32,1);margin-top:60px}.el-upload-cover__interact .btn i{margin-top:0}.el-upload-cover__interact .btn span{opacity:0;-webkit-transition:opacity .15s linear;transition:opacity .15s linear}.el-upload-cover__interact .btn:not(:first-child){margin-left:35px}.el-upload-cover__interact .btn:hover{-webkit-transform:translateY(-13px);transform:translateY(-13px)}.el-upload-cover__interact .btn:hover span{opacity:1}.el-upload-cover__interact .btn i{color:#fff;display:block;font-size:24px;line-height:inherit;margin:0 auto 5px}.el-upload-cover__title{position:absolute;bottom:0;left:0;background-color:#fff;height:36px;width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:400;text-align:left;padding:0 10px;margin:0;line-height:36px;font-size:14px;color:#303133}.el-upload-cover+.el-upload__inner{opacity:0;position:relative;z-index:1}.el-progress{position:relative;line-height:1}.el-progress__text{font-size:14px;color:#606266;display:inline-block;vertical-align:middle;margin-left:10px;line-height:1}.el-progress__text i{vertical-align:middle;display:block}.el-progress--circle,.el-progress--dashboard{display:inline-block}.el-progress--circle .el-progress__text,.el-progress--dashboard .el-progress__text{position:absolute;top:50%;left:0;width:100%;text-align:center;margin:0;-webkit-transform:translateY(-50%);transform:translateY(-50%)}.el-progress--circle .el-progress__text i,.el-progress--dashboard .el-progress__text i{vertical-align:middle;display:inline-block}.el-progress--without-text .el-progress__text{display:none}.el-progress--without-text .el-progress-bar{padding-right:0;margin-right:0;display:block}.el-progress--text-inside .el-progress-bar{padding-right:0;margin-right:0}.el-progress.is-success .el-progress-bar__inner{background-color:#13ce66}.el-progress.is-success .el-progress__text{color:#13ce66}.el-progress.is-warning .el-progress-bar__inner{background-color:#ffba00}.el-progress.is-warning .el-progress__text{color:#ffba00}.el-progress.is-exception .el-progress-bar__inner{background-color:#ff4949}.el-progress.is-exception .el-progress__text{color:#ff4949}.el-progress-bar{padding-right:50px;display:inline-block;vertical-align:middle;width:100%;margin-right:-55px;-webkit-box-sizing:border-box;box-sizing:border-box}.el-progress-bar__outer{height:6px;border-radius:100px;background-color:#e6ebf5;overflow:hidden;position:relative;vertical-align:middle}.el-progress-bar__inner{position:absolute;left:0;top:0;height:100%;background-color:#1890ff;text-align:right;border-radius:100px;line-height:1;white-space:nowrap;-webkit-transition:width .6s ease;transition:width .6s ease}.el-progress-bar__inner:after{display:inline-block;content:"";height:100%;vertical-align:middle}.el-progress-bar__innerText{display:inline-block;vertical-align:middle;color:#fff;font-size:12px;margin:0 5px}@keyframes progress{0%{background-position:0 0}to{background-position:32px 0}}.el-time-spinner{width:100%;white-space:nowrap}.el-spinner{display:inline-block;vertical-align:middle}.el-spinner-inner{-webkit-animation:rotate 2s linear infinite;animation:rotate 2s linear infinite;width:50px;height:50px}.el-spinner-inner .path{stroke:#ececec;stroke-linecap:round;-webkit-animation:dash 1.5s ease-in-out infinite;animation:dash 1.5s ease-in-out infinite}@-webkit-keyframes rotate{to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes rotate{to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@-webkit-keyframes dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}to{stroke-dasharray:90,150;stroke-dashoffset:-124}}@keyframes dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}to{stroke-dasharray:90,150;stroke-dashoffset:-124}}.el-message{min-width:380px;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:4px;border-width:1px;border-style:solid;border-color:#e6ebf5;position:fixed;left:50%;top:20px;-webkit-transform:translateX(-50%);transform:translateX(-50%);background-color:#edf2fc;-webkit-transition:opacity .3s,top .4s,-webkit-transform .4s;transition:opacity .3s,top .4s,-webkit-transform .4s;transition:opacity .3s,transform .4s,top .4s;transition:opacity .3s,transform .4s,top .4s,-webkit-transform .4s;overflow:hidden;padding:15px 15px 15px 20px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.el-message.is-center{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.el-message.is-closable .el-message__content{padding-right:16px}.el-message p{margin:0}.el-message--info .el-message__content{color:#909399}.el-message--success{background-color:#e7faf0;border-color:#d0f5e0}.el-message--success .el-message__content{color:#13ce66}.el-message--warning{background-color:#fff8e6;border-color:#fff1cc}.el-message--warning .el-message__content{color:#ffba00}.el-message--error{background-color:#ffeded;border-color:#ffdbdb}.el-message--error .el-message__content{color:#ff4949}.el-message__icon{margin-right:10px}.el-message__content{padding:0;font-size:14px;line-height:1}.el-message__content:focus{outline-width:0}.el-message__closeBtn{position:absolute;top:50%;right:15px;-webkit-transform:translateY(-50%);transform:translateY(-50%);cursor:pointer;color:#c0c4cc;font-size:16px}.el-message__closeBtn:focus{outline-width:0}.el-message__closeBtn:hover{color:#909399}.el-message .el-icon-success{color:#13ce66}.el-message .el-icon-error{color:#ff4949}.el-message .el-icon-info{color:#909399}.el-message .el-icon-warning{color:#ffba00}.el-message-fade-enter,.el-message-fade-leave-active{opacity:0;-webkit-transform:translate(-50%,-100%);transform:translate(-50%,-100%)}.el-badge{position:relative;vertical-align:middle;display:inline-block}.el-badge__content{background-color:#ff4949;border-radius:10px;color:#fff;display:inline-block;font-size:12px;height:18px;line-height:18px;padding:0 6px;text-align:center;white-space:nowrap;border:1px solid #fff}.el-badge__content.is-fixed{position:absolute;top:0;right:10px;-webkit-transform:translateY(-50%) translateX(100%);transform:translateY(-50%) translateX(100%)}.el-badge__content.is-fixed.is-dot{right:5px}.el-badge__content.is-dot{height:8px;width:8px;padding:0;right:0;border-radius:50%}.el-badge__content--primary{background-color:#1890ff}.el-badge__content--success{background-color:#13ce66}.el-badge__content--warning{background-color:#ffba00}.el-badge__content--info{background-color:#909399}.el-badge__content--danger{background-color:#ff4949}.el-card{border-radius:4px;border:1px solid #e6ebf5;background-color:#fff;overflow:hidden;color:#303133;-webkit-transition:.3s;transition:.3s}.el-card.is-always-shadow,.el-card.is-hover-shadow:focus,.el-card.is-hover-shadow:hover{-webkit-box-shadow:0 2px 12px 0 rgba(0,0,0,.1);box-shadow:0 2px 12px 0 rgba(0,0,0,.1)}.el-card__header{padding:18px 20px;border-bottom:1px solid #e6ebf5;-webkit-box-sizing:border-box;box-sizing:border-box}.el-card__body{padding:20px}.el-rate{height:20px;line-height:1}.el-rate:active,.el-rate:focus{outline-width:0}.el-rate__item{font-size:0;vertical-align:middle}.el-rate__icon,.el-rate__item{display:inline-block;position:relative}.el-rate__icon{font-size:18px;margin-right:6px;color:#c0c4cc;-webkit-transition:.3s;transition:.3s}.el-rate__icon.hover{-webkit-transform:scale(1.15);transform:scale(1.15)}.el-rate__decimal,.el-rate__icon .path2{position:absolute;left:0;top:0}.el-rate__decimal{display:inline-block;overflow:hidden}.el-rate__text{font-size:14px;vertical-align:middle}.el-steps{display:-webkit-box;display:-ms-flexbox;display:flex}.el-steps--simple{padding:13px 8%;border-radius:4px;background:#f5f7fa}.el-steps--horizontal{white-space:nowrap}.el-steps--vertical{height:100%;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-flow:column;flex-flow:column}.el-step{position:relative;-ms-flex-negative:1;flex-shrink:1}.el-step:last-of-type .el-step__line{display:none}.el-step:last-of-type.is-flex{-ms-flex-preferred-size:auto!important;flex-basis:auto!important;-ms-flex-negative:0;flex-shrink:0;-webkit-box-flex:0;-ms-flex-positive:0;flex-grow:0}.el-step:last-of-type .el-step__description,.el-step:last-of-type .el-step__main{padding-right:0}.el-step__head{position:relative;width:100%}.el-step__head.is-process{color:#303133;border-color:#303133}.el-step__head.is-wait{color:#c0c4cc;border-color:#c0c4cc}.el-step__head.is-success{color:#13ce66;border-color:#13ce66}.el-step__head.is-error{color:#ff4949;border-color:#ff4949}.el-step__head.is-finish{color:#1890ff;border-color:#1890ff}.el-step__icon{position:relative;z-index:1;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;width:24px;height:24px;font-size:14px;-webkit-box-sizing:border-box;box-sizing:border-box;background:#fff;-webkit-transition:.15s ease-out;transition:.15s ease-out}.el-step__icon.is-text{border-radius:50%;border:2px solid;border-color:inherit}.el-step__icon.is-icon{width:40px}.el-step__icon-inner{display:inline-block;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;text-align:center;font-weight:700;line-height:1;color:inherit}.el-step__icon-inner[class*=el-icon]:not(.is-status){font-size:25px;font-weight:400}.el-step__icon-inner.is-status{-webkit-transform:translateY(1px);transform:translateY(1px)}.el-step__line{position:absolute;border-color:inherit;background-color:#c0c4cc}.el-step__line-inner{display:block;border-width:1px;border-style:solid;border-color:inherit;-webkit-transition:.15s ease-out;transition:.15s ease-out;-webkit-box-sizing:border-box;box-sizing:border-box;width:0;height:0}.el-step__main{white-space:normal;text-align:left}.el-step__title{font-size:16px;line-height:38px}.el-step__title.is-process{font-weight:700;color:#303133}.el-step__title.is-wait{color:#c0c4cc}.el-step__title.is-success{color:#13ce66}.el-step__title.is-error{color:#ff4949}.el-step__title.is-finish{color:#1890ff}.el-step__description{padding-right:10%;margin-top:-5px;font-size:12px;line-height:20px;font-weight:400}.el-step__description.is-process{color:#303133}.el-step__description.is-wait{color:#c0c4cc}.el-step__description.is-success{color:#13ce66}.el-step__description.is-error{color:#ff4949}.el-step__description.is-finish{color:#1890ff}.el-step.is-horizontal{display:inline-block}.el-step.is-horizontal .el-step__line{height:2px;top:11px;left:0;right:0}.el-step.is-vertical{display:-webkit-box;display:-ms-flexbox;display:flex}.el-step.is-vertical .el-step__head{-webkit-box-flex:0;-ms-flex-positive:0;flex-grow:0;width:24px}.el-step.is-vertical .el-step__main{padding-left:10px;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1}.el-step.is-vertical .el-step__title{line-height:24px;padding-bottom:8px}.el-step.is-vertical .el-step__line{width:2px;top:0;bottom:0;left:11px}.el-step.is-vertical .el-step__icon.is-icon{width:24px}.el-step.is-center .el-step__head,.el-step.is-center .el-step__main{text-align:center}.el-step.is-center .el-step__description{padding-left:20%;padding-right:20%}.el-step.is-center .el-step__line{left:50%;right:-50%}.el-step.is-simple{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.el-step.is-simple .el-step__head{width:auto;font-size:0;padding-right:10px}.el-step.is-simple .el-step__icon{background:transparent;width:16px;height:16px;font-size:12px}.el-step.is-simple .el-step__icon-inner[class*=el-icon]:not(.is-status){font-size:18px}.el-step.is-simple .el-step__icon-inner.is-status{-webkit-transform:scale(.8) translateY(1px);transform:scale(.8) translateY(1px)}.el-step.is-simple .el-step__main{position:relative;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1}.el-step.is-simple .el-step__title{font-size:16px;line-height:20px}.el-step.is-simple:not(:last-of-type) .el-step__title{max-width:50%;word-break:break-all}.el-step.is-simple .el-step__arrow{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.el-step.is-simple .el-step__arrow:after,.el-step.is-simple .el-step__arrow:before{content:"";display:inline-block;position:absolute;height:15px;width:1px;background:#c0c4cc}.el-step.is-simple .el-step__arrow:before{-webkit-transform:rotate(-45deg) translateY(-4px);transform:rotate(-45deg) translateY(-4px);-webkit-transform-origin:0 0;transform-origin:0 0}.el-step.is-simple .el-step__arrow:after{-webkit-transform:rotate(45deg) translateY(4px);transform:rotate(45deg) translateY(4px);-webkit-transform-origin:100% 100%;transform-origin:100% 100%}.el-step.is-simple:last-of-type .el-step__arrow{display:none}.el-carousel{position:relative}.el-carousel--horizontal{overflow-x:hidden}.el-carousel--vertical{overflow-y:hidden}.el-carousel__container{position:relative;height:300px}.el-carousel__arrow{border:none;outline:none;padding:0;margin:0;height:36px;width:36px;cursor:pointer;-webkit-transition:.3s;transition:.3s;border-radius:50%;background-color:rgba(31,45,61,.11);color:#fff;position:absolute;top:50%;z-index:10;-webkit-transform:translateY(-50%);transform:translateY(-50%);text-align:center;font-size:12px}.el-carousel__arrow--left{left:16px}.el-carousel__arrow--right{right:16px}.el-carousel__arrow:hover{background-color:rgba(31,45,61,.23)}.el-carousel__arrow i{cursor:pointer}.el-carousel__indicators{position:absolute;list-style:none;margin:0;padding:0;z-index:2}.el-carousel__indicators--horizontal{bottom:0;left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%)}.el-carousel__indicators--vertical{right:0;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%)}.el-carousel__indicators--outside{bottom:26px;text-align:center;position:static;-webkit-transform:none;transform:none}.el-carousel__indicators--outside .el-carousel__indicator:hover button{opacity:.64}.el-carousel__indicators--outside button{background-color:#c0c4cc;opacity:.24}.el-carousel__indicators--labels{left:0;right:0;-webkit-transform:none;transform:none;text-align:center}.el-carousel__indicators--labels .el-carousel__button{height:auto;width:auto;padding:2px 18px;font-size:12px}.el-carousel__indicators--labels .el-carousel__indicator{padding:6px 4px}.el-carousel__indicator{background-color:transparent;cursor:pointer}.el-carousel__indicator:hover button{opacity:.72}.el-carousel__indicator--horizontal{display:inline-block;padding:12px 4px}.el-carousel__indicator--vertical{padding:4px 12px}.el-carousel__indicator--vertical .el-carousel__button{width:2px;height:15px}.el-carousel__indicator.is-active button{opacity:1}.el-carousel__button{display:block;opacity:.48;width:30px;height:2px;background-color:#fff;border:none;outline:none;padding:0;margin:0;cursor:pointer;-webkit-transition:.3s;transition:.3s}.carousel-arrow-left-enter,.carousel-arrow-left-leave-active{-webkit-transform:translateY(-50%) translateX(-10px);transform:translateY(-50%) translateX(-10px);opacity:0}.carousel-arrow-right-enter,.carousel-arrow-right-leave-active{-webkit-transform:translateY(-50%) translateX(10px);transform:translateY(-50%) translateX(10px);opacity:0}.el-carousel__item{position:absolute;top:0;left:0;width:100%;height:100%;display:inline-block;overflow:hidden;z-index:0}.el-carousel__item.is-active{z-index:2}.el-carousel__item--card,.el-carousel__item.is-animating{-webkit-transition:-webkit-transform .4s ease-in-out;transition:-webkit-transform .4s ease-in-out;transition:transform .4s ease-in-out;transition:transform .4s ease-in-out,-webkit-transform .4s ease-in-out}.el-carousel__item--card{width:50%}.el-carousel__item--card.is-in-stage{cursor:pointer;z-index:1}.el-carousel__item--card.is-in-stage.is-hover .el-carousel__mask,.el-carousel__item--card.is-in-stage:hover .el-carousel__mask{opacity:.12}.el-carousel__item--card.is-active{z-index:2}.el-carousel__mask{position:absolute;width:100%;height:100%;top:0;left:0;background-color:#fff;opacity:.24;-webkit-transition:.2s;transition:.2s}.fade-in-linear-enter-active,.fade-in-linear-leave-active{-webkit-transition:opacity .2s linear;transition:opacity .2s linear}.fade-in-linear-enter,.fade-in-linear-leave,.fade-in-linear-leave-active{opacity:0}.el-fade-in-linear-enter-active,.el-fade-in-linear-leave-active{-webkit-transition:opacity .2s linear;transition:opacity .2s linear}.el-fade-in-linear-enter,.el-fade-in-linear-leave,.el-fade-in-linear-leave-active{opacity:0}.el-fade-in-enter-active,.el-fade-in-leave-active{-webkit-transition:all .3s cubic-bezier(.55,0,.1,1);transition:all .3s cubic-bezier(.55,0,.1,1)}.el-fade-in-enter,.el-fade-in-leave-active{opacity:0}.el-zoom-in-center-enter-active,.el-zoom-in-center-leave-active{-webkit-transition:all .3s cubic-bezier(.55,0,.1,1);transition:all .3s cubic-bezier(.55,0,.1,1)}.el-zoom-in-center-enter,.el-zoom-in-center-leave-active{opacity:0;-webkit-transform:scaleX(0);transform:scaleX(0)}.el-zoom-in-top-enter-active,.el-zoom-in-top-leave-active{opacity:1;-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transition:opacity .3s cubic-bezier(.23,1,.32,1),-webkit-transform .3s cubic-bezier(.23,1,.32,1);transition:opacity .3s cubic-bezier(.23,1,.32,1),-webkit-transform .3s cubic-bezier(.23,1,.32,1);transition:transform .3s cubic-bezier(.23,1,.32,1),opacity .3s cubic-bezier(.23,1,.32,1);transition:transform .3s cubic-bezier(.23,1,.32,1),opacity .3s cubic-bezier(.23,1,.32,1),-webkit-transform .3s cubic-bezier(.23,1,.32,1);-webkit-transform-origin:center top;transform-origin:center top}.el-zoom-in-top-enter,.el-zoom-in-top-leave-active{opacity:0;-webkit-transform:scaleY(0);transform:scaleY(0)}.el-zoom-in-bottom-enter-active,.el-zoom-in-bottom-leave-active{opacity:1;-webkit-transform:scaleY(1);transform:scaleY(1);-webkit-transition:opacity .3s cubic-bezier(.23,1,.32,1),-webkit-transform .3s cubic-bezier(.23,1,.32,1);transition:opacity .3s cubic-bezier(.23,1,.32,1),-webkit-transform .3s cubic-bezier(.23,1,.32,1);transition:transform .3s cubic-bezier(.23,1,.32,1),opacity .3s cubic-bezier(.23,1,.32,1);transition:transform .3s cubic-bezier(.23,1,.32,1),opacity .3s cubic-bezier(.23,1,.32,1),-webkit-transform .3s cubic-bezier(.23,1,.32,1);-webkit-transform-origin:center bottom;transform-origin:center bottom}.el-zoom-in-bottom-enter,.el-zoom-in-bottom-leave-active{opacity:0;-webkit-transform:scaleY(0);transform:scaleY(0)}.el-zoom-in-left-enter-active,.el-zoom-in-left-leave-active{opacity:1;-webkit-transform:scale(1);transform:scale(1);-webkit-transition:opacity .3s cubic-bezier(.23,1,.32,1),-webkit-transform .3s cubic-bezier(.23,1,.32,1);transition:opacity .3s cubic-bezier(.23,1,.32,1),-webkit-transform .3s cubic-bezier(.23,1,.32,1);transition:transform .3s cubic-bezier(.23,1,.32,1),opacity .3s cubic-bezier(.23,1,.32,1);transition:transform .3s cubic-bezier(.23,1,.32,1),opacity .3s cubic-bezier(.23,1,.32,1),-webkit-transform .3s cubic-bezier(.23,1,.32,1);-webkit-transform-origin:top left;transform-origin:top left}.el-zoom-in-left-enter,.el-zoom-in-left-leave-active{opacity:0;-webkit-transform:scale(.45);transform:scale(.45)}.collapse-transition{-webkit-transition:height .3s ease-in-out,padding-top .3s ease-in-out,padding-bottom .3s ease-in-out;transition:height .3s ease-in-out,padding-top .3s ease-in-out,padding-bottom .3s ease-in-out}.horizontal-collapse-transition{-webkit-transition:width .3s ease-in-out,padding-left .3s ease-in-out,padding-right .3s ease-in-out;transition:width .3s ease-in-out,padding-left .3s ease-in-out,padding-right .3s ease-in-out}.el-list-enter-active,.el-list-leave-active{-webkit-transition:all 1s;transition:all 1s}.el-list-enter,.el-list-leave-active{opacity:0;-webkit-transform:translateY(-30px);transform:translateY(-30px)}.el-opacity-transition{-webkit-transition:opacity .3s cubic-bezier(.55,0,.1,1);transition:opacity .3s cubic-bezier(.55,0,.1,1)}.el-collapse{border-top:1px solid #e6ebf5;border-bottom:1px solid #e6ebf5}.el-collapse-item.is-disabled .el-collapse-item__header{color:#bbb;cursor:not-allowed}.el-collapse-item__header{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;height:48px;line-height:48px;background-color:#fff;color:#303133;cursor:pointer;border-bottom:1px solid #e6ebf5;font-size:13px;font-weight:500;-webkit-transition:border-bottom-color .3s;transition:border-bottom-color .3s;outline:none}.el-collapse-item__arrow{margin:0 8px 0 auto;-webkit-transition:-webkit-transform .3s;transition:-webkit-transform .3s;transition:transform .3s;transition:transform .3s,-webkit-transform .3s;font-weight:300}.el-collapse-item__arrow.is-active{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.el-collapse-item__header.focusing:focus:not(:hover){color:#1890ff}.el-collapse-item__header.is-active{border-bottom-color:transparent}.el-collapse-item__wrap{will-change:height;background-color:#fff;overflow:hidden;-webkit-box-sizing:border-box;box-sizing:border-box;border-bottom:1px solid #e6ebf5}.el-collapse-item__content{padding-bottom:25px;font-size:13px;color:#303133;line-height:1.7692307692}.el-collapse-item:last-child{margin-bottom:-1px}.el-popper .popper__arrow,.el-popper .popper__arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.el-popper .popper__arrow{border-width:6px;-webkit-filter:drop-shadow(0 2px 12px rgba(0,0,0,.03));filter:drop-shadow(0 2px 12px rgba(0,0,0,.03))}.el-popper .popper__arrow:after{content:" ";border-width:6px}.el-popper[x-placement^=top]{margin-bottom:12px}.el-popper[x-placement^=top] .popper__arrow{bottom:-6px;left:50%;margin-right:3px;border-top-color:#e6ebf5;border-bottom-width:0}.el-popper[x-placement^=top] .popper__arrow:after{bottom:1px;margin-left:-6px;border-top-color:#fff;border-bottom-width:0}.el-popper[x-placement^=bottom]{margin-top:12px}.el-popper[x-placement^=bottom] .popper__arrow{top:-6px;left:50%;margin-right:3px;border-top-width:0;border-bottom-color:#e6ebf5}.el-popper[x-placement^=bottom] .popper__arrow:after{top:1px;margin-left:-6px;border-top-width:0;border-bottom-color:#fff}.el-popper[x-placement^=right]{margin-left:12px}.el-popper[x-placement^=right] .popper__arrow{top:50%;left:-6px;margin-bottom:3px;border-right-color:#e6ebf5;border-left-width:0}.el-popper[x-placement^=right] .popper__arrow:after{bottom:-6px;left:1px;border-right-color:#fff;border-left-width:0}.el-popper[x-placement^=left]{margin-right:12px}.el-popper[x-placement^=left] .popper__arrow{top:50%;right:-6px;margin-bottom:3px;border-right-width:0;border-left-color:#e6ebf5}.el-popper[x-placement^=left] .popper__arrow:after{right:1px;bottom:-6px;margin-left:-6px;border-right-width:0;border-left-color:#fff}.el-tag{background-color:#e8f4ff;border-color:#d1e9ff;display:inline-block;height:32px;padding:0 10px;line-height:30px;font-size:12px;color:#1890ff;border-width:1px;border-style:solid;border-radius:4px;-webkit-box-sizing:border-box;box-sizing:border-box;white-space:nowrap}.el-tag.is-hit{border-color:#1890ff}.el-tag .el-tag__close{color:#1890ff}.el-tag .el-tag__close:hover{color:#fff;background-color:#1890ff}.el-tag.el-tag--info{background-color:#f4f4f5;border-color:#e9e9eb;color:#909399}.el-tag.el-tag--info.is-hit{border-color:#909399}.el-tag.el-tag--info .el-tag__close{color:#909399}.el-tag.el-tag--info .el-tag__close:hover{color:#fff;background-color:#909399}.el-tag.el-tag--success{background-color:#e7faf0;border-color:#d0f5e0;color:#13ce66}.el-tag.el-tag--success.is-hit{border-color:#13ce66}.el-tag.el-tag--success .el-tag__close{color:#13ce66}.el-tag.el-tag--success .el-tag__close:hover{color:#fff;background-color:#13ce66}.el-tag.el-tag--warning{background-color:#fff8e6;border-color:#fff1cc;color:#ffba00}.el-tag.el-tag--warning.is-hit{border-color:#ffba00}.el-tag.el-tag--warning .el-tag__close{color:#ffba00}.el-tag.el-tag--warning .el-tag__close:hover{color:#fff;background-color:#ffba00}.el-tag.el-tag--danger{background-color:#ffeded;border-color:#ffdbdb;color:#ff4949}.el-tag.el-tag--danger.is-hit{border-color:#ff4949}.el-tag.el-tag--danger .el-tag__close{color:#ff4949}.el-tag.el-tag--danger .el-tag__close:hover{color:#fff;background-color:#ff4949}.el-tag .el-icon-close{border-radius:50%;text-align:center;position:relative;cursor:pointer;font-size:12px;height:16px;width:16px;line-height:16px;vertical-align:middle;top:-1px;right:-5px}.el-tag .el-icon-close:before{display:block}.el-tag--dark{background-color:#1890ff;color:#fff}.el-tag--dark,.el-tag--dark.is-hit{border-color:#1890ff}.el-tag--dark .el-tag__close{color:#fff}.el-tag--dark .el-tag__close:hover{color:#fff;background-color:#46a6ff}.el-tag--dark.el-tag--info{background-color:#909399;border-color:#909399;color:#fff}.el-tag--dark.el-tag--info.is-hit{border-color:#909399}.el-tag--dark.el-tag--info .el-tag__close{color:#fff}.el-tag--dark.el-tag--info .el-tag__close:hover{color:#fff;background-color:#a6a9ad}.el-tag--dark.el-tag--success{background-color:#13ce66;border-color:#13ce66;color:#fff}.el-tag--dark.el-tag--success.is-hit{border-color:#13ce66}.el-tag--dark.el-tag--success .el-tag__close{color:#fff}.el-tag--dark.el-tag--success .el-tag__close:hover{color:#fff;background-color:#42d885}.el-tag--dark.el-tag--warning{background-color:#ffba00;border-color:#ffba00;color:#fff}.el-tag--dark.el-tag--warning.is-hit{border-color:#ffba00}.el-tag--dark.el-tag--warning .el-tag__close{color:#fff}.el-tag--dark.el-tag--warning .el-tag__close:hover{color:#fff;background-color:#ffc833}.el-tag--dark.el-tag--danger{background-color:#ff4949;border-color:#ff4949;color:#fff}.el-tag--dark.el-tag--danger.is-hit{border-color:#ff4949}.el-tag--dark.el-tag--danger .el-tag__close{color:#fff}.el-tag--dark.el-tag--danger .el-tag__close:hover{color:#fff;background-color:#ff6d6d}.el-tag--plain{background-color:#fff;border-color:#a3d3ff;color:#1890ff}.el-tag--plain.is-hit{border-color:#1890ff}.el-tag--plain .el-tag__close{color:#1890ff}.el-tag--plain .el-tag__close:hover{color:#fff;background-color:#1890ff}.el-tag--plain.el-tag--info{background-color:#fff;border-color:#d3d4d6;color:#909399}.el-tag--plain.el-tag--info.is-hit{border-color:#909399}.el-tag--plain.el-tag--info .el-tag__close{color:#909399}.el-tag--plain.el-tag--info .el-tag__close:hover{color:#fff;background-color:#909399}.el-tag--plain.el-tag--success{background-color:#fff;border-color:#a1ebc2;color:#13ce66}.el-tag--plain.el-tag--success.is-hit{border-color:#13ce66}.el-tag--plain.el-tag--success .el-tag__close{color:#13ce66}.el-tag--plain.el-tag--success .el-tag__close:hover{color:#fff;background-color:#13ce66}.el-tag--plain.el-tag--warning{background-color:#fff;border-color:#ffe399;color:#ffba00}.el-tag--plain.el-tag--warning.is-hit{border-color:#ffba00}.el-tag--plain.el-tag--warning .el-tag__close{color:#ffba00}.el-tag--plain.el-tag--warning .el-tag__close:hover{color:#fff;background-color:#ffba00}.el-tag--plain.el-tag--danger{background-color:#fff;border-color:#ffb6b6;color:#ff4949}.el-tag--plain.el-tag--danger.is-hit{border-color:#ff4949}.el-tag--plain.el-tag--danger .el-tag__close{color:#ff4949}.el-tag--plain.el-tag--danger .el-tag__close:hover{color:#fff;background-color:#ff4949}.el-tag--medium{height:28px;line-height:26px}.el-tag--medium .el-icon-close{-webkit-transform:scale(.8);transform:scale(.8)}.el-tag--small{height:24px;padding:0 8px;line-height:22px}.el-tag--small .el-icon-close{-webkit-transform:scale(.8);transform:scale(.8)}.el-tag--mini{height:20px;padding:0 5px;line-height:19px}.el-tag--mini .el-icon-close{margin-left:-3px;-webkit-transform:scale(.7);transform:scale(.7)}.el-cascader{display:inline-block;position:relative;font-size:14px;line-height:40px}.el-cascader:not(.is-disabled):hover .el-input__inner{cursor:pointer;border-color:#c0c4cc}.el-cascader .el-input{cursor:pointer}.el-cascader .el-input .el-input__inner{text-overflow:ellipsis}.el-cascader .el-input .el-input__inner:focus{border-color:#1890ff}.el-cascader .el-input .el-icon-arrow-down{-webkit-transition:-webkit-transform .3s;transition:-webkit-transform .3s;transition:transform .3s;transition:transform .3s,-webkit-transform .3s;font-size:14px}.el-cascader .el-input .el-icon-arrow-down.is-reverse{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.el-cascader .el-input .el-icon-circle-close:hover{color:#909399}.el-cascader .el-input.is-focus .el-input__inner{border-color:#1890ff}.el-cascader--medium{font-size:14px;line-height:36px}.el-cascader--small{font-size:13px;line-height:32px}.el-cascader--mini{font-size:12px;line-height:28px}.el-cascader.is-disabled .el-cascader__label{z-index:2;color:#c0c4cc}.el-cascader__dropdown{margin:5px 0;font-size:14px;background:#fff;border:1px solid #dfe4ed;border-radius:4px;-webkit-box-shadow:0 2px 12px 0 rgba(0,0,0,.1);box-shadow:0 2px 12px 0 rgba(0,0,0,.1)}.el-cascader__tags{position:absolute;left:0;right:30px;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;line-height:normal;text-align:left;-webkit-box-sizing:border-box;box-sizing:border-box}.el-cascader__tags .el-tag{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;max-width:100%;margin:2px 0 2px 6px;text-overflow:ellipsis;background:#f0f2f5}.el-cascader__tags .el-tag:not(.is-hit){border-color:transparent}.el-cascader__tags .el-tag>span{-webkit-box-flex:1;-ms-flex:1;flex:1;overflow:hidden;text-overflow:ellipsis}.el-cascader__tags .el-tag .el-icon-close{-webkit-box-flex:0;-ms-flex:none;flex:none;background-color:#c0c4cc;color:#fff}.el-cascader__tags .el-tag .el-icon-close:hover{background-color:#909399}.el-cascader__suggestion-panel{border-radius:4px}.el-cascader__suggestion-list{max-height:204px;margin:0;padding:6px 0;font-size:14px;color:#606266;text-align:center}.el-cascader__suggestion-item{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-webkit-box-align:center;-ms-flex-align:center;align-items:center;height:34px;padding:0 15px;text-align:left;outline:none;cursor:pointer}.el-cascader__suggestion-item:focus,.el-cascader__suggestion-item:hover{background:#f5f7fa}.el-cascader__suggestion-item.is-checked{color:#1890ff;font-weight:700}.el-cascader__suggestion-item>span{margin-right:10px}.el-cascader__empty-text{margin:10px 0;color:#c0c4cc}.el-cascader__search-input{-webkit-box-flex:1;-ms-flex:1;flex:1;height:24px;min-width:60px;margin:2px 0 2px 15px;padding:0;color:#606266;border:none;outline:none;-webkit-box-sizing:border-box;box-sizing:border-box}.el-cascader__search-input::-webkit-input-placeholder{color:#c0c4cc}.el-cascader__search-input::-moz-placeholder{color:#c0c4cc}.el-cascader__search-input:-ms-input-placeholder{color:#c0c4cc}.el-cascader__search-input::-ms-input-placeholder{color:#c0c4cc}.el-cascader__search-input::placeholder{color:#c0c4cc}.el-color-predefine{font-size:12px;margin-top:8px;width:280px}.el-color-predefine,.el-color-predefine__colors{display:-webkit-box;display:-ms-flexbox;display:flex}.el-color-predefine__colors{-webkit-box-flex:1;-ms-flex:1;flex:1;-ms-flex-wrap:wrap;flex-wrap:wrap}.el-color-predefine__color-selector{margin:0 0 8px 8px;width:20px;height:20px;border-radius:4px;cursor:pointer}.el-color-predefine__color-selector:nth-child(10n+1){margin-left:0}.el-color-predefine__color-selector.selected{-webkit-box-shadow:0 0 3px 2px #1890ff;box-shadow:0 0 3px 2px #1890ff}.el-color-predefine__color-selector>div{display:-webkit-box;display:-ms-flexbox;display:flex;height:100%;border-radius:3px}.el-color-predefine__color-selector.is-alpha{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==)}.el-color-hue-slider{position:relative;-webkit-box-sizing:border-box;box-sizing:border-box;width:280px;height:12px;background-color:red;padding:0 2px}.el-color-hue-slider__bar{position:relative;background:-webkit-gradient(linear,left top,right top,from(red),color-stop(17%,#ff0),color-stop(33%,#0f0),color-stop(50%,#0ff),color-stop(67%,#00f),color-stop(83%,#f0f),to(red));background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red);height:100%}.el-color-hue-slider__thumb{position:absolute;cursor:pointer;-webkit-box-sizing:border-box;box-sizing:border-box;left:0;top:0;width:4px;height:100%;border-radius:1px;background:#fff;border:1px solid #f0f0f0;-webkit-box-shadow:0 0 2px rgba(0,0,0,.6);box-shadow:0 0 2px rgba(0,0,0,.6);z-index:1}.el-color-hue-slider.is-vertical{width:12px;height:180px;padding:2px 0}.el-color-hue-slider.is-vertical .el-color-hue-slider__bar{background:-webkit-gradient(linear,left top,left bottom,from(red),color-stop(17%,#ff0),color-stop(33%,#0f0),color-stop(50%,#0ff),color-stop(67%,#00f),color-stop(83%,#f0f),to(red));background:linear-gradient(180deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.el-color-hue-slider.is-vertical .el-color-hue-slider__thumb{left:0;top:0;width:100%;height:4px}.el-color-svpanel{position:relative;width:280px;height:180px}.el-color-svpanel__black,.el-color-svpanel__white{position:absolute;top:0;left:0;right:0;bottom:0}.el-color-svpanel__white{background:-webkit-gradient(linear,left top,right top,from(#fff),to(hsla(0,0%,100%,0)));background:linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.el-color-svpanel__black{background:-webkit-gradient(linear,left bottom,left top,from(#000),to(transparent));background:linear-gradient(0deg,#000,transparent)}.el-color-svpanel__cursor{position:absolute}.el-color-svpanel__cursor>div{cursor:head;width:4px;height:4px;-webkit-box-shadow:0 0 0 1.5px #fff,inset 0 0 1px 1px rgba(0,0,0,.3),0 0 1px 2px rgba(0,0,0,.4);box-shadow:0 0 0 1.5px #fff,inset 0 0 1px 1px rgba(0,0,0,.3),0 0 1px 2px rgba(0,0,0,.4);border-radius:50%;-webkit-transform:translate(-2px,-2px);transform:translate(-2px,-2px)}.el-color-alpha-slider{position:relative;-webkit-box-sizing:border-box;box-sizing:border-box;width:280px;height:12px;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==)}.el-color-alpha-slider__bar{position:relative;background:-webkit-gradient(linear,left top,right top,from(hsla(0,0%,100%,0)),to(#fff));background:linear-gradient(90deg,hsla(0,0%,100%,0) 0,#fff);height:100%}.el-color-alpha-slider__thumb{position:absolute;cursor:pointer;-webkit-box-sizing:border-box;box-sizing:border-box;left:0;top:0;width:4px;height:100%;border-radius:1px;background:#fff;border:1px solid #f0f0f0;-webkit-box-shadow:0 0 2px rgba(0,0,0,.6);box-shadow:0 0 2px rgba(0,0,0,.6);z-index:1}.el-color-alpha-slider.is-vertical{width:20px;height:180px}.el-color-alpha-slider.is-vertical .el-color-alpha-slider__bar{background:-webkit-gradient(linear,left top,left bottom,from(hsla(0,0%,100%,0)),to(#fff));background:linear-gradient(180deg,hsla(0,0%,100%,0) 0,#fff)}.el-color-alpha-slider.is-vertical .el-color-alpha-slider__thumb{left:0;top:0;width:100%;height:4px}.el-color-dropdown{width:300px}.el-color-dropdown__main-wrapper{margin-bottom:6px}.el-color-dropdown__main-wrapper:after{content:"";display:table;clear:both}.el-color-dropdown__btns{margin-top:6px;text-align:right}.el-color-dropdown__value{float:left;line-height:26px;font-size:12px;color:#000;width:160px}.el-color-dropdown__btn{border:1px solid #dcdcdc;color:#333;line-height:24px;border-radius:2px;padding:0 20px;cursor:pointer;background-color:transparent;outline:none;font-size:12px}.el-color-dropdown__btn[disabled]{color:#ccc;cursor:not-allowed}.el-color-dropdown__btn:hover{color:#1890ff;border-color:#1890ff}.el-color-dropdown__link-btn{cursor:pointer;color:#1890ff;text-decoration:none;padding:15px;font-size:12px}.el-color-dropdown__link-btn:hover{color:tint(#1890ff,20%)}.el-color-picker{display:inline-block;position:relative;line-height:normal;height:40px}.el-color-picker.is-disabled .el-color-picker__trigger{cursor:not-allowed}.el-color-picker--medium{height:36px}.el-color-picker--medium .el-color-picker__trigger{height:36px;width:36px}.el-color-picker--medium .el-color-picker__mask{height:34px;width:34px}.el-color-picker--small{height:32px}.el-color-picker--small .el-color-picker__trigger{height:32px;width:32px}.el-color-picker--small .el-color-picker__mask{height:30px;width:30px}.el-color-picker--small .el-color-picker__empty,.el-color-picker--small .el-color-picker__icon{-webkit-transform:translate3d(-50%,-50%,0) scale(.8);transform:translate3d(-50%,-50%,0) scale(.8)}.el-color-picker--mini{height:28px}.el-color-picker--mini .el-color-picker__trigger{height:28px;width:28px}.el-color-picker--mini .el-color-picker__mask{height:26px;width:26px}.el-color-picker--mini .el-color-picker__empty,.el-color-picker--mini .el-color-picker__icon{-webkit-transform:translate3d(-50%,-50%,0) scale(.8);transform:translate3d(-50%,-50%,0) scale(.8)}.el-color-picker__mask{height:38px;width:38px;border-radius:4px;position:absolute;top:1px;left:1px;z-index:1;cursor:not-allowed;background-color:hsla(0,0%,100%,.7)}.el-color-picker__trigger{display:inline-block;height:40px;width:40px;padding:4px;border:1px solid #e6e6e6;border-radius:4px;font-size:0;cursor:pointer}.el-color-picker__color,.el-color-picker__trigger{-webkit-box-sizing:border-box;box-sizing:border-box;position:relative}.el-color-picker__color{display:block;border:1px solid #999;border-radius:2px;width:100%;height:100%;text-align:center}.el-color-picker__color.is-alpha{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==)}.el-color-picker__color-inner{position:absolute;left:0;top:0;right:0;bottom:0}.el-color-picker__empty{color:#999}.el-color-picker__empty,.el-color-picker__icon{font-size:12px;position:absolute;top:50%;left:50%;-webkit-transform:translate3d(-50%,-50%,0);transform:translate3d(-50%,-50%,0)}.el-color-picker__icon{display:inline-block;width:100%;color:#fff;text-align:center}.el-color-picker__panel{position:absolute;z-index:10;padding:6px;-webkit-box-sizing:content-box;box-sizing:content-box;background-color:#fff;border:1px solid #e6ebf5;border-radius:4px;-webkit-box-shadow:0 2px 12px 0 rgba(0,0,0,.1);box-shadow:0 2px 12px 0 rgba(0,0,0,.1)}.el-textarea{position:relative;display:inline-block;width:100%;vertical-align:bottom;font-size:14px}.el-textarea__inner{display:block;resize:vertical;padding:5px 15px;line-height:1.5;-webkit-box-sizing:border-box;box-sizing:border-box;width:100%;font-size:inherit;color:#606266;background-color:#fff;background-image:none;border:1px solid #dcdfe6;border-radius:4px;-webkit-transition:border-color .2s cubic-bezier(.645,.045,.355,1);transition:border-color .2s cubic-bezier(.645,.045,.355,1)}.el-textarea__inner::-webkit-input-placeholder{color:#c0c4cc}.el-textarea__inner::-moz-placeholder{color:#c0c4cc}.el-textarea__inner:-ms-input-placeholder{color:#c0c4cc}.el-textarea__inner::-ms-input-placeholder{color:#c0c4cc}.el-textarea__inner::placeholder{color:#c0c4cc}.el-textarea__inner:hover{border-color:#c0c4cc}.el-textarea__inner:focus{outline:none;border-color:#1890ff}.el-textarea .el-input__count{color:#909399;background:#fff;position:absolute;font-size:12px;bottom:5px;right:10px}.el-textarea.is-disabled .el-textarea__inner{background-color:#f5f7fa;border-color:#dfe4ed;color:#c0c4cc;cursor:not-allowed}.el-textarea.is-disabled .el-textarea__inner::-webkit-input-placeholder{color:#c0c4cc}.el-textarea.is-disabled .el-textarea__inner::-moz-placeholder{color:#c0c4cc}.el-textarea.is-disabled .el-textarea__inner:-ms-input-placeholder{color:#c0c4cc}.el-textarea.is-disabled .el-textarea__inner::-ms-input-placeholder{color:#c0c4cc}.el-textarea.is-disabled .el-textarea__inner::placeholder{color:#c0c4cc}.el-textarea.is-exceed .el-textarea__inner{border-color:#ff4949}.el-textarea.is-exceed .el-input__count{color:#ff4949}.el-input{position:relative;font-size:14px;display:inline-block;width:100%}.el-input::-webkit-scrollbar{z-index:11;width:6px}.el-input::-webkit-scrollbar:horizontal{height:6px}.el-input::-webkit-scrollbar-thumb{border-radius:5px;width:6px;background:#b4bccc}.el-input::-webkit-scrollbar-corner,.el-input::-webkit-scrollbar-track{background:#fff}.el-input::-webkit-scrollbar-track-piece{background:#fff;width:6px}.el-input .el-input__clear{color:#c0c4cc;font-size:14px;cursor:pointer;-webkit-transition:color .2s cubic-bezier(.645,.045,.355,1);transition:color .2s cubic-bezier(.645,.045,.355,1)}.el-input .el-input__clear:hover{color:#909399}.el-input .el-input__count{height:100%;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:#909399;font-size:12px}.el-input .el-input__count .el-input__count-inner{background:#fff;line-height:normal;display:inline-block;padding:0 5px}.el-input__inner{-webkit-appearance:none;background-color:#fff;background-image:none;border-radius:4px;border:1px solid #dcdfe6;-webkit-box-sizing:border-box;box-sizing:border-box;color:#606266;display:inline-block;font-size:inherit;height:40px;line-height:40px;outline:none;padding:0 15px;-webkit-transition:border-color .2s cubic-bezier(.645,.045,.355,1);transition:border-color .2s cubic-bezier(.645,.045,.355,1);width:100%}.el-input__inner::-ms-reveal{display:none}.el-input__inner::-webkit-input-placeholder{color:#c0c4cc}.el-input__inner::-moz-placeholder{color:#c0c4cc}.el-input__inner:-ms-input-placeholder{color:#c0c4cc}.el-input__inner::-ms-input-placeholder{color:#c0c4cc}.el-input__inner::placeholder{color:#c0c4cc}.el-input__inner:hover{border-color:#c0c4cc}.el-input__inner:focus{outline:none;border-color:#1890ff}.el-input__suffix{position:absolute;height:100%;right:5px;top:0;text-align:center;color:#c0c4cc;-webkit-transition:all .3s;transition:all .3s;pointer-events:none}.el-input__suffix-inner{pointer-events:all}.el-input__prefix{position:absolute;left:5px;top:0;color:#c0c4cc}.el-input__icon,.el-input__prefix{height:100%;text-align:center;-webkit-transition:all .3s;transition:all .3s}.el-input__icon{width:25px;line-height:40px}.el-input__icon:after{content:"";height:100%;width:0;display:inline-block;vertical-align:middle}.el-input__validateIcon{pointer-events:none}.el-input.is-active .el-input__inner{outline:none;border-color:#1890ff}.el-input.is-disabled .el-input__inner{background-color:#f5f7fa;border-color:#dfe4ed;color:#c0c4cc;cursor:not-allowed}.el-input.is-disabled .el-input__inner::-webkit-input-placeholder{color:#c0c4cc}.el-input.is-disabled .el-input__inner::-moz-placeholder{color:#c0c4cc}.el-input.is-disabled .el-input__inner:-ms-input-placeholder{color:#c0c4cc}.el-input.is-disabled .el-input__inner::-ms-input-placeholder{color:#c0c4cc}.el-input.is-disabled .el-input__inner::placeholder{color:#c0c4cc}.el-input.is-disabled .el-input__icon{cursor:not-allowed}.el-input.is-exceed .el-input__inner{border-color:#ff4949}.el-input.is-exceed .el-input__suffix .el-input__count{color:#ff4949}.el-input--suffix .el-input__inner{padding-right:30px}.el-input--prefix .el-input__inner{padding-left:30px}.el-input--medium{font-size:14px}.el-input--medium .el-input__inner{height:36px;line-height:36px}.el-input--medium .el-input__icon{line-height:36px}.el-input--small{font-size:13px}.el-input--small .el-input__inner{height:32px;line-height:32px}.el-input--small .el-input__icon{line-height:32px}.el-input--mini{font-size:12px}.el-input--mini .el-input__inner{height:28px;line-height:28px}.el-input--mini .el-input__icon{line-height:28px}.el-input-group{line-height:normal;display:inline-table;width:100%;border-collapse:separate;border-spacing:0}.el-input-group>.el-input__inner{vertical-align:middle;display:table-cell}.el-input-group__append,.el-input-group__prepend{background-color:#f5f7fa;color:#909399;vertical-align:middle;display:table-cell;position:relative;border:1px solid #dcdfe6;border-radius:4px;padding:0 20px;width:1px;white-space:nowrap}.el-input-group__append:focus,.el-input-group__prepend:focus{outline:none}.el-input-group__append .el-button,.el-input-group__append .el-select,.el-input-group__prepend .el-button,.el-input-group__prepend .el-select{display:inline-block;margin:-10px -20px}.el-input-group__append button.el-button,.el-input-group__append div.el-select .el-input__inner,.el-input-group__append div.el-select:hover .el-input__inner,.el-input-group__prepend button.el-button,.el-input-group__prepend div.el-select .el-input__inner,.el-input-group__prepend div.el-select:hover .el-input__inner{border-color:transparent;background-color:transparent;color:inherit;border-top:0;border-bottom:0}.el-input-group__append .el-button,.el-input-group__append .el-input,.el-input-group__prepend .el-button,.el-input-group__prepend .el-input{font-size:inherit}.el-input-group__prepend{border-right:0;border-top-right-radius:0;border-bottom-right-radius:0}.el-input-group__append{border-left:0}.el-input-group--prepend .el-input__inner,.el-input-group__append{border-top-left-radius:0;border-bottom-left-radius:0}.el-input-group--prepend .el-select .el-input.is-focus .el-input__inner{border-color:transparent}.el-input-group--append .el-input__inner{border-top-right-radius:0;border-bottom-right-radius:0}.el-input-group--append .el-select .el-input.is-focus .el-input__inner{border-color:transparent}.el-input__inner::-ms-clear{display:none;width:0;height:0}.el-transfer{font-size:14px}.el-transfer__buttons{display:inline-block;vertical-align:middle;padding:0 30px}.el-transfer__button{display:block;margin:0 auto;padding:10px;border-radius:50%;color:#fff;background-color:#1890ff;font-size:0}.el-transfer__button.is-with-texts{border-radius:4px}.el-transfer__button.is-disabled,.el-transfer__button.is-disabled:hover{border:1px solid #dcdfe6;background-color:#f5f7fa;color:#c0c4cc}.el-transfer__button:first-child{margin-bottom:10px}.el-transfer__button:nth-child(2){margin:0}.el-transfer__button i,.el-transfer__button span{font-size:14px}.el-transfer__button [class*=el-icon-]+span{margin-left:0}.el-transfer-panel{border:1px solid #e6ebf5;border-radius:4px;overflow:hidden;background:#fff;display:inline-block;vertical-align:middle;width:200px;max-height:100%;-webkit-box-sizing:border-box;box-sizing:border-box;position:relative}.el-transfer-panel__body{height:246px}.el-transfer-panel__body.is-with-footer{padding-bottom:40px}.el-transfer-panel__list{margin:0;padding:6px 0;list-style:none;height:246px;overflow:auto;-webkit-box-sizing:border-box;box-sizing:border-box}.el-transfer-panel__list.is-filterable{height:194px;padding-top:0}.el-transfer-panel__item{height:30px;line-height:30px;padding-left:15px;display:block!important}.el-transfer-panel__item+.el-transfer-panel__item{margin-left:0}.el-transfer-panel__item.el-checkbox{color:#606266}.el-transfer-panel__item:hover{color:#1890ff}.el-transfer-panel__item.el-checkbox .el-checkbox__label{width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;-webkit-box-sizing:border-box;box-sizing:border-box;padding-left:24px;line-height:30px}.el-transfer-panel__item .el-checkbox__input{position:absolute;top:8px}.el-transfer-panel__filter{text-align:center;margin:15px;-webkit-box-sizing:border-box;box-sizing:border-box;display:block;width:auto}.el-transfer-panel__filter .el-input__inner{height:32px;width:100%;font-size:12px;display:inline-block;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:16px;padding-right:10px;padding-left:30px}.el-transfer-panel__filter .el-input__icon{margin-left:5px}.el-transfer-panel__filter .el-icon-circle-close{cursor:pointer}.el-transfer-panel .el-transfer-panel__header{height:40px;line-height:40px;background:#f5f7fa;margin:0;padding-left:15px;border-bottom:1px solid #e6ebf5;-webkit-box-sizing:border-box;box-sizing:border-box;color:#000}.el-transfer-panel .el-transfer-panel__header .el-checkbox{display:block;line-height:40px}.el-transfer-panel .el-transfer-panel__header .el-checkbox .el-checkbox__label{font-size:16px;color:#303133;font-weight:400}.el-transfer-panel .el-transfer-panel__header .el-checkbox .el-checkbox__label span{position:absolute;right:15px;color:#909399;font-size:12px;font-weight:400}.el-transfer-panel .el-transfer-panel__footer{height:40px;background:#fff;margin:0;padding:0;border-top:1px solid #e6ebf5;position:absolute;bottom:0;left:0;width:100%;z-index:1}.el-transfer-panel .el-transfer-panel__footer:after{display:inline-block;content:"";height:100%;vertical-align:middle}.el-transfer-panel .el-transfer-panel__footer .el-checkbox{padding-left:20px;color:#606266}.el-transfer-panel .el-transfer-panel__empty{margin:0;height:30px;line-height:30px;padding:6px 15px 0;color:#909399;text-align:center}.el-transfer-panel .el-checkbox__label{padding-left:8px}.el-transfer-panel .el-checkbox__inner{height:14px;width:14px;border-radius:3px}.el-transfer-panel .el-checkbox__inner:after{height:6px;width:3px;left:4px}.el-container{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-webkit-box-flex:1;-ms-flex:1;flex:1;-ms-flex-preferred-size:auto;flex-basis:auto;-webkit-box-sizing:border-box;box-sizing:border-box;min-width:0}.el-container.is-vertical{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.el-header{padding:0 20px}.el-aside,.el-header{-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-negative:0;flex-shrink:0}.el-aside{overflow:auto}.el-main{display:block;-webkit-box-flex:1;-ms-flex:1;flex:1;-ms-flex-preferred-size:auto;flex-basis:auto;overflow:auto;padding:20px}.el-footer,.el-main{-webkit-box-sizing:border-box;box-sizing:border-box}.el-footer{padding:0 20px;-ms-flex-negative:0;flex-shrink:0}.el-timeline{margin:0;font-size:14px;list-style:none}.el-timeline .el-timeline-item:last-child .el-timeline-item__tail{display:none}.el-timeline-item{position:relative;padding-bottom:20px}.el-timeline-item__wrapper{position:relative;padding-left:28px;top:-3px}.el-timeline-item__tail{position:absolute;left:4px;height:100%;border-left:2px solid #dfe4ed}.el-timeline-item__icon{color:#fff;font-size:13px}.el-timeline-item__node{position:absolute;background-color:#dfe4ed;border-radius:50%;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.el-timeline-item__node--normal{left:-1px;width:12px;height:12px}.el-timeline-item__node--large{left:-2px;width:14px;height:14px}.el-timeline-item__node--primary{background-color:#1890ff}.el-timeline-item__node--success{background-color:#13ce66}.el-timeline-item__node--warning{background-color:#ffba00}.el-timeline-item__node--danger{background-color:#ff4949}.el-timeline-item__node--info{background-color:#909399}.el-timeline-item__dot{position:absolute;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.el-timeline-item__content{color:#303133}.el-timeline-item__timestamp{color:#909399;line-height:1;font-size:13px}.el-timeline-item__timestamp.is-top{margin-bottom:8px;padding-top:4px}.el-timeline-item__timestamp.is-bottom{margin-top:8px}.el-link{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;vertical-align:middle;position:relative;text-decoration:none;outline:none;cursor:pointer;padding:0;font-size:14px;font-weight:500}.el-link.is-underline:hover:after{content:"";position:absolute;left:0;right:0;height:0;bottom:0;border-bottom:1px solid #1890ff}.el-link.is-disabled{cursor:not-allowed}.el-link [class*=el-icon-]+span{margin-left:5px}.el-link.el-link--default{color:#606266}.el-link.el-link--default:hover{color:#1890ff}.el-link.el-link--default:after{border-color:#1890ff}.el-link.el-link--default.is-disabled{color:#c0c4cc}.el-link.el-link--primary{color:#1890ff}.el-link.el-link--primary:hover{color:#46a6ff}.el-link.el-link--primary:after{border-color:#1890ff}.el-link.el-link--primary.is-disabled{color:#8cc8ff}.el-link.el-link--primary.is-underline:hover:after{border-color:#1890ff}.el-link.el-link--danger{color:#ff4949}.el-link.el-link--danger:hover{color:#ff6d6d}.el-link.el-link--danger:after{border-color:#ff4949}.el-link.el-link--danger.is-disabled{color:#ffa4a4}.el-link.el-link--danger.is-underline:hover:after{border-color:#ff4949}.el-link.el-link--success{color:#13ce66}.el-link.el-link--success:hover{color:#42d885}.el-link.el-link--success:after{border-color:#13ce66}.el-link.el-link--success.is-disabled{color:#89e7b3}.el-link.el-link--success.is-underline:hover:after{border-color:#13ce66}.el-link.el-link--warning{color:#ffba00}.el-link.el-link--warning:hover{color:#ffc833}.el-link.el-link--warning:after{border-color:#ffba00}.el-link.el-link--warning.is-disabled{color:#ffdd80}.el-link.el-link--warning.is-underline:hover:after{border-color:#ffba00}.el-link.el-link--info{color:#909399}.el-link.el-link--info:hover{color:#a6a9ad}.el-link.el-link--info:after{border-color:#909399}.el-link.el-link--info.is-disabled{color:#c8c9cc}.el-link.el-link--info.is-underline:hover:after{border-color:#909399}.el-divider{background-color:#dcdfe6;position:relative}.el-divider--horizontal{display:block;height:1px;width:100%;margin:24px 0}.el-divider--vertical{display:inline-block;width:1px;height:1em;margin:0 8px;vertical-align:middle;position:relative}.el-divider__text{position:absolute;background-color:#fff;padding:0 20px;font-weight:500;color:#303133;font-size:14px}.el-divider__text.is-left{left:20px;-webkit-transform:translateY(-50%);transform:translateY(-50%)}.el-divider__text.is-center{left:50%;-webkit-transform:translateX(-50%) translateY(-50%);transform:translateX(-50%) translateY(-50%)}.el-divider__text.is-right{right:20px;-webkit-transform:translateY(-50%);transform:translateY(-50%)}.el-image__error,.el-image__inner,.el-image__placeholder{width:100%;height:100%}.el-image{position:relative;display:inline-block;overflow:hidden}.el-image__inner{vertical-align:top}.el-image__inner--center{position:relative;top:50%;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);display:block}.el-image__error,.el-image__placeholder{background:#f5f7fa}.el-image__error{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;font-size:14px;color:#c0c4cc;vertical-align:middle}.el-image__preview{cursor:pointer}.el-image-viewer__wrapper{position:fixed;top:0;right:0;bottom:0;left:0}.el-image-viewer__btn{position:absolute;z-index:1;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;border-radius:50%;opacity:.8;cursor:pointer;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-image-viewer__close{top:40px;right:40px;width:40px;height:40px;font-size:24px;color:#fff;background-color:#606266}.el-image-viewer__canvas{width:100%;height:100%;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.el-image-viewer__actions{left:50%;bottom:30px;-webkit-transform:translateX(-50%);transform:translateX(-50%);width:282px;height:44px;padding:0 23px;background-color:#606266;border-color:#fff;border-radius:22px}.el-image-viewer__actions__inner{width:100%;height:100%;text-align:justify;cursor:default;font-size:23px;color:#fff;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-ms-flex-pack:distribute;justify-content:space-around}.el-image-viewer__prev{left:40px}.el-image-viewer__next,.el-image-viewer__prev{top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);width:44px;height:44px;font-size:24px;color:#fff;background-color:#606266;border-color:#fff}.el-image-viewer__next{right:40px;text-indent:2px}.el-image-viewer__mask{position:absolute;width:100%;height:100%;top:0;left:0;opacity:.5;background:#000}.viewer-fade-enter-active{-webkit-animation:viewer-fade-in .3s;animation:viewer-fade-in .3s}.viewer-fade-leave-active{-webkit-animation:viewer-fade-out .3s;animation:viewer-fade-out .3s}@-webkit-keyframes viewer-fade-in{0%{-webkit-transform:translate3d(0,-20px,0);transform:translate3d(0,-20px,0);opacity:0}to{-webkit-transform:translateZ(0);transform:translateZ(0);opacity:1}}@keyframes viewer-fade-in{0%{-webkit-transform:translate3d(0,-20px,0);transform:translate3d(0,-20px,0);opacity:0}to{-webkit-transform:translateZ(0);transform:translateZ(0);opacity:1}}@-webkit-keyframes viewer-fade-out{0%{-webkit-transform:translateZ(0);transform:translateZ(0);opacity:1}to{-webkit-transform:translate3d(0,-20px,0);transform:translate3d(0,-20px,0);opacity:0}}@keyframes viewer-fade-out{0%{-webkit-transform:translateZ(0);transform:translateZ(0);opacity:1}to{-webkit-transform:translate3d(0,-20px,0);transform:translate3d(0,-20px,0);opacity:0}}.el-button{display:inline-block;line-height:1;white-space:nowrap;cursor:pointer;background:#fff;border:1px solid #dcdfe6;border-color:#dcdfe6;color:#606266;-webkit-appearance:none;text-align:center;-webkit-box-sizing:border-box;box-sizing:border-box;outline:none;margin:0;-webkit-transition:.1s;transition:.1s;font-weight:400;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;padding:12px 20px;font-size:14px;border-radius:4px}.el-button+.el-button{margin-left:10px}.el-button.is-round{padding:12px 20px}.el-button:focus,.el-button:hover{color:#1890ff;border-color:#badeff;background-color:#e8f4ff}.el-button:active{color:#1682e6;border-color:#1682e6;outline:none}.el-button::-moz-focus-inner{border:0}.el-button [class*=el-icon-]+span{margin-left:5px}.el-button.is-plain:focus,.el-button.is-plain:hover{background:#fff;border-color:#1890ff;color:#1890ff}.el-button.is-plain:active{background:#fff;outline:none}.el-button.is-active,.el-button.is-plain:active{border-color:#1682e6;color:#1682e6}.el-button.is-disabled,.el-button.is-disabled:focus,.el-button.is-disabled:hover{color:#c0c4cc;cursor:not-allowed;background-image:none;background-color:#fff;border-color:#e6ebf5}.el-button.is-disabled.el-button--text{background-color:transparent}.el-button.is-disabled.is-plain,.el-button.is-disabled.is-plain:focus,.el-button.is-disabled.is-plain:hover{background-color:#fff;border-color:#e6ebf5;color:#c0c4cc}.el-button.is-loading{position:relative;pointer-events:none}.el-button.is-loading:before{pointer-events:none;content:"";position:absolute;left:-1px;top:-1px;right:-1px;bottom:-1px;border-radius:inherit;background-color:hsla(0,0%,100%,.35)}.el-button.is-round{border-radius:20px;padding:12px 23px}.el-button.is-circle{border-radius:50%;padding:12px}.el-button--primary{color:#fff;background-color:#1890ff;border-color:#1890ff}.el-button--primary:focus,.el-button--primary:hover{background:#46a6ff;border-color:#46a6ff;color:#fff}.el-button--primary:active{outline:none}.el-button--primary.is-active,.el-button--primary:active{background:#1682e6;border-color:#1682e6;color:#fff}.el-button--primary.is-disabled,.el-button--primary.is-disabled:active,.el-button--primary.is-disabled:focus,.el-button--primary.is-disabled:hover{color:#fff;background-color:#8cc8ff;border-color:#8cc8ff}.el-button--primary.is-plain{color:#1890ff;background:#e8f4ff;border-color:#a3d3ff}.el-button--primary.is-plain:focus,.el-button--primary.is-plain:hover{background:#1890ff;border-color:#1890ff;color:#fff}.el-button--primary.is-plain:active{background:#1682e6;border-color:#1682e6;color:#fff;outline:none}.el-button--primary.is-plain.is-disabled,.el-button--primary.is-plain.is-disabled:active,.el-button--primary.is-plain.is-disabled:focus,.el-button--primary.is-plain.is-disabled:hover{color:#74bcff;background-color:#e8f4ff;border-color:#d1e9ff}.el-button--success{color:#fff;background-color:#13ce66;border-color:#13ce66}.el-button--success:focus,.el-button--success:hover{background:#42d885;border-color:#42d885;color:#fff}.el-button--success:active{outline:none}.el-button--success.is-active,.el-button--success:active{background:#11b95c;border-color:#11b95c;color:#fff}.el-button--success.is-disabled,.el-button--success.is-disabled:active,.el-button--success.is-disabled:focus,.el-button--success.is-disabled:hover{color:#fff;background-color:#89e7b3;border-color:#89e7b3}.el-button--success.is-plain{color:#13ce66;background:#e7faf0;border-color:#a1ebc2}.el-button--success.is-plain:focus,.el-button--success.is-plain:hover{background:#13ce66;border-color:#13ce66;color:#fff}.el-button--success.is-plain:active{background:#11b95c;border-color:#11b95c;color:#fff;outline:none}.el-button--success.is-plain.is-disabled,.el-button--success.is-plain.is-disabled:active,.el-button--success.is-plain.is-disabled:focus,.el-button--success.is-plain.is-disabled:hover{color:#71e2a3;background-color:#e7faf0;border-color:#d0f5e0}.el-button--warning{color:#fff;background-color:#ffba00;border-color:#ffba00}.el-button--warning:focus,.el-button--warning:hover{background:#ffc833;border-color:#ffc833;color:#fff}.el-button--warning:active{outline:none}.el-button--warning.is-active,.el-button--warning:active{background:#e6a700;border-color:#e6a700;color:#fff}.el-button--warning.is-disabled,.el-button--warning.is-disabled:active,.el-button--warning.is-disabled:focus,.el-button--warning.is-disabled:hover{color:#fff;background-color:#ffdd80;border-color:#ffdd80}.el-button--warning.is-plain{color:#ffba00;background:#fff8e6;border-color:#ffe399}.el-button--warning.is-plain:focus,.el-button--warning.is-plain:hover{background:#ffba00;border-color:#ffba00;color:#fff}.el-button--warning.is-plain:active{background:#e6a700;border-color:#e6a700;color:#fff;outline:none}.el-button--warning.is-plain.is-disabled,.el-button--warning.is-plain.is-disabled:active,.el-button--warning.is-plain.is-disabled:focus,.el-button--warning.is-plain.is-disabled:hover{color:#ffd666;background-color:#fff8e6;border-color:#fff1cc}.el-button--danger{color:#fff;background-color:#ff4949;border-color:#ff4949}.el-button--danger:focus,.el-button--danger:hover{background:#ff6d6d;border-color:#ff6d6d;color:#fff}.el-button--danger:active{outline:none}.el-button--danger.is-active,.el-button--danger:active{background:#e64242;border-color:#e64242;color:#fff}.el-button--danger.is-disabled,.el-button--danger.is-disabled:active,.el-button--danger.is-disabled:focus,.el-button--danger.is-disabled:hover{color:#fff;background-color:#ffa4a4;border-color:#ffa4a4}.el-button--danger.is-plain{color:#ff4949;background:#ffeded;border-color:#ffb6b6}.el-button--danger.is-plain:focus,.el-button--danger.is-plain:hover{background:#ff4949;border-color:#ff4949;color:#fff}.el-button--danger.is-plain:active{background:#e64242;border-color:#e64242;color:#fff;outline:none}.el-button--danger.is-plain.is-disabled,.el-button--danger.is-plain.is-disabled:active,.el-button--danger.is-plain.is-disabled:focus,.el-button--danger.is-plain.is-disabled:hover{color:#ff9292;background-color:#ffeded;border-color:#ffdbdb}.el-button--info{color:#fff;background-color:#909399;border-color:#909399}.el-button--info:focus,.el-button--info:hover{background:#a6a9ad;border-color:#a6a9ad;color:#fff}.el-button--info:active{outline:none}.el-button--info.is-active,.el-button--info:active{background:#82848a;border-color:#82848a;color:#fff}.el-button--info.is-disabled,.el-button--info.is-disabled:active,.el-button--info.is-disabled:focus,.el-button--info.is-disabled:hover{color:#fff;background-color:#c8c9cc;border-color:#c8c9cc}.el-button--info.is-plain{color:#909399;background:#f4f4f5;border-color:#d3d4d6}.el-button--info.is-plain:focus,.el-button--info.is-plain:hover{background:#909399;border-color:#909399;color:#fff}.el-button--info.is-plain:active{background:#82848a;border-color:#82848a;color:#fff;outline:none}.el-button--info.is-plain.is-disabled,.el-button--info.is-plain.is-disabled:active,.el-button--info.is-plain.is-disabled:focus,.el-button--info.is-plain.is-disabled:hover{color:#bcbec2;background-color:#f4f4f5;border-color:#e9e9eb}.el-button--medium{padding:10px 20px;font-size:14px;border-radius:4px}.el-button--medium.is-round{padding:10px 20px}.el-button--medium.is-circle{padding:10px}.el-button--small{padding:9px 15px;font-size:12px;border-radius:3px}.el-button--small.is-round{padding:9px 15px}.el-button--small.is-circle{padding:9px}.el-button--mini{padding:7px 15px;font-size:12px;border-radius:3px}.el-button--mini.is-round{padding:7px 15px}.el-button--mini.is-circle{padding:7px}.el-button--text{border-color:transparent;color:#1890ff;background:transparent;padding-left:0;padding-right:0}.el-button--text:focus,.el-button--text:hover{color:#46a6ff;border-color:transparent;background-color:transparent}.el-button--text:active{color:#1682e6;background-color:transparent}.el-button--text.is-disabled,.el-button--text.is-disabled:focus,.el-button--text.is-disabled:hover,.el-button--text:active{border-color:transparent}.el-button-group{display:inline-block;vertical-align:middle}.el-button-group:after,.el-button-group:before{display:table;content:""}.el-button-group:after{clear:both}.el-button-group>.el-button{float:left;position:relative}.el-button-group>.el-button+.el-button{margin-left:0}.el-button-group>.el-button.is-disabled{z-index:1}.el-button-group>.el-button:first-child{border-top-right-radius:0;border-bottom-right-radius:0}.el-button-group>.el-button:last-child{border-top-left-radius:0;border-bottom-left-radius:0}.el-button-group>.el-button:first-child:last-child{border-top-right-radius:4px;border-bottom-right-radius:4px;border-top-left-radius:4px;border-bottom-left-radius:4px}.el-button-group>.el-button:first-child:last-child.is-round{border-radius:20px}.el-button-group>.el-button:first-child:last-child.is-circle{border-radius:50%}.el-button-group>.el-button:not(:first-child):not(:last-child){border-radius:0}.el-button-group>.el-button:not(:last-child){margin-right:-1px}.el-button-group>.el-button.is-active,.el-button-group>.el-button:not(.is-disabled):active,.el-button-group>.el-button:not(.is-disabled):focus,.el-button-group>.el-button:not(.is-disabled):hover{z-index:1}.el-button-group>.el-dropdown>.el-button{border-top-left-radius:0;border-bottom-left-radius:0;border-left-color:hsla(0,0%,100%,.5)}.el-button-group .el-button--primary:first-child{border-right-color:hsla(0,0%,100%,.5)}.el-button-group .el-button--primary:last-child{border-left-color:hsla(0,0%,100%,.5)}.el-button-group .el-button--primary:not(:first-child):not(:last-child){border-left-color:hsla(0,0%,100%,.5);border-right-color:hsla(0,0%,100%,.5)}.el-button-group .el-button--success:first-child{border-right-color:hsla(0,0%,100%,.5)}.el-button-group .el-button--success:last-child{border-left-color:hsla(0,0%,100%,.5)}.el-button-group .el-button--success:not(:first-child):not(:last-child){border-left-color:hsla(0,0%,100%,.5);border-right-color:hsla(0,0%,100%,.5)}.el-button-group .el-button--warning:first-child{border-right-color:hsla(0,0%,100%,.5)}.el-button-group .el-button--warning:last-child{border-left-color:hsla(0,0%,100%,.5)}.el-button-group .el-button--warning:not(:first-child):not(:last-child){border-left-color:hsla(0,0%,100%,.5);border-right-color:hsla(0,0%,100%,.5)}.el-button-group .el-button--danger:first-child{border-right-color:hsla(0,0%,100%,.5)}.el-button-group .el-button--danger:last-child{border-left-color:hsla(0,0%,100%,.5)}.el-button-group .el-button--danger:not(:first-child):not(:last-child){border-left-color:hsla(0,0%,100%,.5);border-right-color:hsla(0,0%,100%,.5)}.el-button-group .el-button--info:first-child{border-right-color:hsla(0,0%,100%,.5)}.el-button-group .el-button--info:last-child{border-left-color:hsla(0,0%,100%,.5)}.el-button-group .el-button--info:not(:first-child):not(:last-child){border-left-color:hsla(0,0%,100%,.5);border-right-color:hsla(0,0%,100%,.5)}.el-calendar{background-color:#fff}.el-calendar__header{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;padding:12px 20px;border-bottom:1px solid #dfe6ec}.el-calendar__title{color:#000;-ms-flex-item-align:center;align-self:center}.el-calendar__body{padding:12px 20px 35px}.el-calendar-table{table-layout:fixed;width:100%}.el-calendar-table thead th{padding:12px 0;color:#606266;font-weight:400}.el-calendar-table:not(.is-range) td.next,.el-calendar-table:not(.is-range) td.prev{color:#c0c4cc}.el-calendar-table td{border-bottom:1px solid #dfe6ec;border-right:1px solid #dfe6ec;vertical-align:top;-webkit-transition:background-color .2s ease;transition:background-color .2s ease}.el-calendar-table td.is-selected{background-color:#f2f8fe}.el-calendar-table td.is-today{color:#1890ff}.el-calendar-table tr:first-child td{border-top:1px solid #dfe6ec}.el-calendar-table tr td:first-child{border-left:1px solid #dfe6ec}.el-calendar-table tr.el-calendar-table__row--hide-border td{border-top:none}.el-calendar-table .el-calendar-day{-webkit-box-sizing:border-box;box-sizing:border-box;padding:8px;height:85px}.el-calendar-table .el-calendar-day:hover{cursor:pointer;background-color:#f2f8fe}.el-backtop{position:fixed;background-color:#fff;width:40px;height:40px;border-radius:50%;color:#1890ff;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;font-size:20px;-webkit-box-shadow:0 0 6px rgba(0,0,0,.12);box-shadow:0 0 6px rgba(0,0,0,.12);cursor:pointer;z-index:5}.el-backtop:hover{background-color:#f2f6fc}.el-page-header{line-height:24px}.el-page-header,.el-page-header__left{display:-webkit-box;display:-ms-flexbox;display:flex}.el-page-header__left{cursor:pointer;margin-right:40px;position:relative}.el-page-header__left:after{content:"";position:absolute;width:1px;height:16px;right:-20px;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);background-color:#dcdfe6}.el-page-header__left .el-icon-back{font-size:18px;margin-right:6px;-ms-flex-item-align:center;align-self:center}.el-page-header__title{font-size:14px;font-weight:500}.el-page-header__content{font-size:18px;color:#303133}.el-checkbox{color:#606266;font-weight:500;font-size:14px;position:relative;cursor:pointer;display:inline-block;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;margin-right:30px}.el-checkbox.is-bordered{padding:9px 20px 9px 10px;border-radius:4px;border:1px solid #dcdfe6;-webkit-box-sizing:border-box;box-sizing:border-box;line-height:normal;height:40px}.el-checkbox.is-bordered.is-checked{border-color:#1890ff}.el-checkbox.is-bordered.is-disabled{border-color:#e6ebf5;cursor:not-allowed}.el-checkbox.is-bordered+.el-checkbox.is-bordered{margin-left:10px}.el-checkbox.is-bordered.el-checkbox--medium{padding:7px 20px 7px 10px;border-radius:4px;height:36px}.el-checkbox.is-bordered.el-checkbox--medium .el-checkbox__label{line-height:17px;font-size:14px}.el-checkbox.is-bordered.el-checkbox--medium .el-checkbox__inner{height:14px;width:14px}.el-checkbox.is-bordered.el-checkbox--small{padding:5px 15px 5px 10px;border-radius:3px;height:32px}.el-checkbox.is-bordered.el-checkbox--small .el-checkbox__label{line-height:15px;font-size:12px}.el-checkbox.is-bordered.el-checkbox--small .el-checkbox__inner{height:12px;width:12px}.el-checkbox.is-bordered.el-checkbox--small .el-checkbox__inner:after{height:6px;width:2px}.el-checkbox.is-bordered.el-checkbox--mini{padding:3px 15px 3px 10px;border-radius:3px;height:28px}.el-checkbox.is-bordered.el-checkbox--mini .el-checkbox__label{line-height:12px;font-size:12px}.el-checkbox.is-bordered.el-checkbox--mini .el-checkbox__inner{height:12px;width:12px}.el-checkbox.is-bordered.el-checkbox--mini .el-checkbox__inner:after{height:6px;width:2px}.el-checkbox__input{white-space:nowrap;cursor:pointer;outline:none;display:inline-block;line-height:1;position:relative;vertical-align:middle}.el-checkbox__input.is-disabled .el-checkbox__inner{background-color:#edf2fc;border-color:#dcdfe6;cursor:not-allowed}.el-checkbox__input.is-disabled .el-checkbox__inner:after{cursor:not-allowed;border-color:#c0c4cc}.el-checkbox__input.is-disabled .el-checkbox__inner+.el-checkbox__label{cursor:not-allowed}.el-checkbox__input.is-disabled.is-checked .el-checkbox__inner{background-color:#f2f6fc;border-color:#dcdfe6}.el-checkbox__input.is-disabled.is-checked .el-checkbox__inner:after{border-color:#c0c4cc}.el-checkbox__input.is-disabled.is-indeterminate .el-checkbox__inner{background-color:#f2f6fc;border-color:#dcdfe6}.el-checkbox__input.is-disabled.is-indeterminate .el-checkbox__inner:before{background-color:#c0c4cc;border-color:#c0c4cc}.el-checkbox__input.is-disabled+span.el-checkbox__label{color:#c0c4cc;cursor:not-allowed}.el-checkbox__input.is-checked .el-checkbox__inner{background-color:#1890ff;border-color:#1890ff}.el-checkbox__input.is-checked .el-checkbox__inner:after{-webkit-transform:rotate(45deg) scaleY(1);transform:rotate(45deg) scaleY(1)}.el-checkbox__input.is-checked+.el-checkbox__label{color:#1890ff}.el-checkbox__input.is-focus .el-checkbox__inner{border-color:#1890ff}.el-checkbox__input.is-indeterminate .el-checkbox__inner{background-color:#1890ff;border-color:#1890ff}.el-checkbox__input.is-indeterminate .el-checkbox__inner:before{content:"";position:absolute;display:block;background-color:#fff;height:2px;-webkit-transform:scale(.5);transform:scale(.5);left:0;right:0;top:5px}.el-checkbox__input.is-indeterminate .el-checkbox__inner:after{display:none}.el-checkbox__inner{display:inline-block;position:relative;border:1px solid #dcdfe6;border-radius:2px;-webkit-box-sizing:border-box;box-sizing:border-box;width:14px;height:14px;background-color:#fff;z-index:1;-webkit-transition:border-color .25s cubic-bezier(.71,-.46,.29,1.46),background-color .25s cubic-bezier(.71,-.46,.29,1.46);transition:border-color .25s cubic-bezier(.71,-.46,.29,1.46),background-color .25s cubic-bezier(.71,-.46,.29,1.46)}.el-checkbox__inner:hover{border-color:#1890ff}.el-checkbox__inner:after{-webkit-box-sizing:content-box;box-sizing:content-box;content:"";border:1px solid #fff;border-left:0;border-top:0;height:7px;left:4px;position:absolute;top:1px;-webkit-transform:rotate(45deg) scaleY(0);transform:rotate(45deg) scaleY(0);width:3px;-webkit-transition:-webkit-transform .15s ease-in .05s;transition:-webkit-transform .15s ease-in .05s;transition:transform .15s ease-in .05s;transition:transform .15s ease-in .05s,-webkit-transform .15s ease-in .05s;-webkit-transform-origin:center;transform-origin:center}.el-checkbox__original{opacity:0;outline:none;position:absolute;margin:0;width:0;height:0;z-index:-1}.el-checkbox__label{display:inline-block;padding-left:10px;line-height:19px;font-size:14px}.el-checkbox:last-of-type{margin-right:0}.el-checkbox-button,.el-checkbox-button__inner{position:relative;display:inline-block}.el-checkbox-button__inner{line-height:1;font-weight:500;white-space:nowrap;vertical-align:middle;cursor:pointer;background:#fff;border:1px solid #dcdfe6;border-left:0;color:#606266;-webkit-appearance:none;text-align:center;-webkit-box-sizing:border-box;box-sizing:border-box;outline:none;margin:0;-webkit-transition:all .3s cubic-bezier(.645,.045,.355,1);transition:all .3s cubic-bezier(.645,.045,.355,1);-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;padding:12px 20px;font-size:14px;border-radius:0}.el-checkbox-button__inner.is-round{padding:12px 20px}.el-checkbox-button__inner:hover{color:#1890ff}.el-checkbox-button__inner [class*=el-icon-]{line-height:.9}.el-checkbox-button__inner [class*=el-icon-]+span{margin-left:5px}.el-checkbox-button__original{opacity:0;outline:none;position:absolute;margin:0;z-index:-1}.el-checkbox-button.is-checked .el-checkbox-button__inner{color:#fff;background-color:#1890ff;border-color:#1890ff;-webkit-box-shadow:-1px 0 0 0 #74bcff;box-shadow:-1px 0 0 0 #74bcff}.el-checkbox-button.is-checked:first-child .el-checkbox-button__inner{border-left-color:#1890ff}.el-checkbox-button.is-disabled .el-checkbox-button__inner{color:#c0c4cc;cursor:not-allowed;background-image:none;background-color:#fff;border-color:#e6ebf5;-webkit-box-shadow:none;box-shadow:none}.el-checkbox-button.is-disabled:first-child .el-checkbox-button__inner{border-left-color:#e6ebf5}.el-checkbox-button:first-child .el-checkbox-button__inner{border-left:1px solid #dcdfe6;border-radius:4px 0 0 4px;-webkit-box-shadow:none!important;box-shadow:none!important}.el-checkbox-button.is-focus .el-checkbox-button__inner{border-color:#1890ff}.el-checkbox-button:last-child .el-checkbox-button__inner{border-radius:0 4px 4px 0}.el-checkbox-button--medium .el-checkbox-button__inner{padding:10px 20px;font-size:14px;border-radius:0}.el-checkbox-button--medium .el-checkbox-button__inner.is-round{padding:10px 20px}.el-checkbox-button--small .el-checkbox-button__inner{padding:9px 15px;font-size:12px;border-radius:0}.el-checkbox-button--small .el-checkbox-button__inner.is-round{padding:9px 15px}.el-checkbox-button--mini .el-checkbox-button__inner{padding:7px 15px;font-size:12px;border-radius:0}.el-checkbox-button--mini .el-checkbox-button__inner.is-round{padding:7px 15px}.el-checkbox-group{font-size:0}.el-radio{color:#606266;font-weight:500;line-height:1;position:relative;cursor:pointer;display:inline-block;white-space:nowrap;outline:none;font-size:14px;margin-right:30px;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.el-radio.is-bordered{padding:12px 20px 0 10px;border-radius:4px;border:1px solid #dcdfe6;-webkit-box-sizing:border-box;box-sizing:border-box;height:40px}.el-radio.is-bordered.is-checked{border-color:#1890ff}.el-radio.is-bordered.is-disabled{cursor:not-allowed;border-color:#e6ebf5}.el-radio.is-bordered+.el-radio.is-bordered{margin-left:10px}.el-radio--medium.is-bordered{padding:10px 20px 0 10px;border-radius:4px;height:36px}.el-radio--medium.is-bordered .el-radio__label{font-size:14px}.el-radio--medium.is-bordered .el-radio__inner{height:14px;width:14px}.el-radio--small.is-bordered{padding:8px 15px 0 10px;border-radius:3px;height:32px}.el-radio--small.is-bordered .el-radio__label{font-size:12px}.el-radio--small.is-bordered .el-radio__inner{height:12px;width:12px}.el-radio--mini.is-bordered{padding:6px 15px 0 10px;border-radius:3px;height:28px}.el-radio--mini.is-bordered .el-radio__label{font-size:12px}.el-radio--mini.is-bordered .el-radio__inner{height:12px;width:12px}.el-radio:last-child{margin-right:0}.el-radio__input{white-space:nowrap;cursor:pointer;outline:none;display:inline-block;line-height:1;position:relative;vertical-align:middle}.el-radio__input.is-disabled .el-radio__inner{background-color:#f5f7fa;border-color:#dfe4ed;cursor:not-allowed}.el-radio__input.is-disabled .el-radio__inner:after{cursor:not-allowed;background-color:#f5f7fa}.el-radio__input.is-disabled .el-radio__inner+.el-radio__label{cursor:not-allowed}.el-radio__input.is-disabled.is-checked .el-radio__inner{background-color:#f5f7fa;border-color:#dfe4ed}.el-radio__input.is-disabled.is-checked .el-radio__inner:after{background-color:#c0c4cc}.el-radio__input.is-disabled+span.el-radio__label{color:#c0c4cc;cursor:not-allowed}.el-radio__input.is-checked .el-radio__inner{border-color:#1890ff;background:#1890ff}.el-radio__input.is-checked .el-radio__inner:after{-webkit-transform:translate(-50%,-50%) scale(1);transform:translate(-50%,-50%) scale(1)}.el-radio__input.is-checked+.el-radio__label{color:#1890ff}.el-radio__input.is-focus .el-radio__inner{border-color:#1890ff}.el-radio__inner{border:1px solid #dcdfe6;border-radius:100%;width:14px;height:14px;background-color:#fff;position:relative;cursor:pointer;display:inline-block;-webkit-box-sizing:border-box;box-sizing:border-box}.el-radio__inner:hover{border-color:#1890ff}.el-radio__inner:after{width:4px;height:4px;border-radius:100%;background-color:#fff;content:"";position:absolute;left:50%;top:50%;-webkit-transform:translate(-50%,-50%) scale(0);transform:translate(-50%,-50%) scale(0);-webkit-transition:-webkit-transform .15s ease-in;transition:-webkit-transform .15s ease-in;transition:transform .15s ease-in;transition:transform .15s ease-in,-webkit-transform .15s ease-in}.el-radio__original{opacity:0;outline:none;position:absolute;z-index:-1;top:0;left:0;right:0;bottom:0;margin:0}.el-radio:focus:not(.is-focus):not(:active):not(.is-disabled) .el-radio__inner{-webkit-box-shadow:0 0 2px 2px #1890ff;box-shadow:0 0 2px 2px #1890ff}.el-radio__label{font-size:14px;padding-left:10px}.el-scrollbar{overflow:hidden;position:relative}.el-scrollbar:active>.el-scrollbar__bar,.el-scrollbar:focus>.el-scrollbar__bar,.el-scrollbar:hover>.el-scrollbar__bar{opacity:1;-webkit-transition:opacity .34s ease-out;transition:opacity .34s ease-out}.el-scrollbar__wrap{overflow:scroll;height:100%}.el-scrollbar__wrap--hidden-default{scrollbar-width:none}.el-scrollbar__wrap--hidden-default::-webkit-scrollbar{width:0;height:0}.el-scrollbar__thumb{position:relative;display:block;width:0;height:0;cursor:pointer;border-radius:inherit;background-color:rgba(144,147,153,.3);-webkit-transition:background-color .3s;transition:background-color .3s}.el-scrollbar__thumb:hover{background-color:rgba(144,147,153,.5)}.el-scrollbar__bar{position:absolute;right:2px;bottom:2px;z-index:1;border-radius:4px;opacity:0;-webkit-transition:opacity .12s ease-out;transition:opacity .12s ease-out}.el-scrollbar__bar.is-vertical{width:6px;top:2px}.el-scrollbar__bar.is-vertical>div{width:100%}.el-scrollbar__bar.is-horizontal{height:6px;left:2px}.el-scrollbar__bar.is-horizontal>div{height:100%}.el-cascader-panel{display:-webkit-box;display:-ms-flexbox;display:flex;border-radius:4px;font-size:14px}.el-cascader-panel.is-bordered{border:1px solid #dfe4ed;border-radius:4px}.el-cascader-menu{min-width:180px;-webkit-box-sizing:border-box;box-sizing:border-box;color:#606266;border-right:1px solid #dfe4ed}.el-cascader-menu:last-child{border-right:none}.el-cascader-menu:last-child .el-cascader-node{padding-right:20px}.el-cascader-menu__wrap{height:204px}.el-cascader-menu__list{position:relative;min-height:100%;margin:0;padding:6px 0;list-style:none;-webkit-box-sizing:border-box;box-sizing:border-box}.el-cascader-menu__hover-zone{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none}.el-cascader-menu__empty-text{position:absolute;top:50%;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);text-align:center;color:#c0c4cc}.el-cascader-node{position:relative;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:0 30px 0 20px;height:34px;line-height:34px;outline:none}.el-cascader-node.is-selectable.in-active-path{color:#606266}.el-cascader-node.in-active-path,.el-cascader-node.is-active,.el-cascader-node.is-selectable.in-checked-path{color:#1890ff;font-weight:700}.el-cascader-node:not(.is-disabled){cursor:pointer}.el-cascader-node:not(.is-disabled):focus,.el-cascader-node:not(.is-disabled):hover{background:#f5f7fa}.el-cascader-node.is-disabled{color:#c0c4cc;cursor:not-allowed}.el-cascader-node__prefix{position:absolute;left:10px}.el-cascader-node__postfix{position:absolute;right:10px}.el-cascader-node__label{-webkit-box-flex:1;-ms-flex:1;flex:1;padding:0 10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.el-cascader-node>.el-radio{margin-right:0}.el-cascader-node>.el-radio .el-radio__label{padding-left:0}.el-avatar{-webkit-box-sizing:border-box;box-sizing:border-box;background:#c0c4cc;width:40px;height:40px;line-height:40px;font-size:14px}.el-avatar>img{display:block;height:100%;vertical-align:middle}.el-avatar--circle{border-radius:50%}.el-avatar--square{border-radius:4px}.el-avatar--icon{font-size:18px}.el-avatar--large{width:40px;height:40px;line-height:40px}.el-avatar--medium{width:36px;height:36px;line-height:36px}.el-avatar--small{width:28px;height:28px;line-height:28px}@-webkit-keyframes el-drawer-fade-in{0%{opacity:0}to{opacity:1}}@keyframes el-drawer-fade-in{0%{opacity:0}to{opacity:1}}@-webkit-keyframes rtl-drawer-in{0%{-webkit-transform:translate(100%);transform:translate(100%)}to{-webkit-transform:translate(0);transform:translate(0)}}@keyframes rtl-drawer-in{0%{-webkit-transform:translate(100%);transform:translate(100%)}to{-webkit-transform:translate(0);transform:translate(0)}}@-webkit-keyframes rtl-drawer-out{0%{-webkit-transform:translate(0);transform:translate(0)}to{-webkit-transform:translate(100%);transform:translate(100%)}}@keyframes rtl-drawer-out{0%{-webkit-transform:translate(0);transform:translate(0)}to{-webkit-transform:translate(100%);transform:translate(100%)}}@-webkit-keyframes ltr-drawer-in{0%{-webkit-transform:translate(-100%);transform:translate(-100%)}to{-webkit-transform:translate(0);transform:translate(0)}}@keyframes ltr-drawer-in{0%{-webkit-transform:translate(-100%);transform:translate(-100%)}to{-webkit-transform:translate(0);transform:translate(0)}}@-webkit-keyframes ltr-drawer-out{0%{-webkit-transform:translate(0);transform:translate(0)}to{-webkit-transform:translate(-100%);transform:translate(-100%)}}@keyframes ltr-drawer-out{0%{-webkit-transform:translate(0);transform:translate(0)}to{-webkit-transform:translate(-100%);transform:translate(-100%)}}@-webkit-keyframes ttb-drawer-in{0%{-webkit-transform:translateY(-100%);transform:translateY(-100%)}to{-webkit-transform:translate(0);transform:translate(0)}}@keyframes ttb-drawer-in{0%{-webkit-transform:translateY(-100%);transform:translateY(-100%)}to{-webkit-transform:translate(0);transform:translate(0)}}@-webkit-keyframes ttb-drawer-out{0%{-webkit-transform:translate(0);transform:translate(0)}to{-webkit-transform:translateY(-100%);transform:translateY(-100%)}}@keyframes ttb-drawer-out{0%{-webkit-transform:translate(0);transform:translate(0)}to{-webkit-transform:translateY(-100%);transform:translateY(-100%)}}@-webkit-keyframes btt-drawer-in{0%{-webkit-transform:translateY(100%);transform:translateY(100%)}to{-webkit-transform:translate(0);transform:translate(0)}}@keyframes btt-drawer-in{0%{-webkit-transform:translateY(100%);transform:translateY(100%)}to{-webkit-transform:translate(0);transform:translate(0)}}@-webkit-keyframes btt-drawer-out{0%{-webkit-transform:translate(0);transform:translate(0)}to{-webkit-transform:translateY(100%);transform:translateY(100%)}}@keyframes btt-drawer-out{0%{-webkit-transform:translate(0);transform:translate(0)}to{-webkit-transform:translateY(100%);transform:translateY(100%)}}.el-drawer{position:absolute;-webkit-box-sizing:border-box;box-sizing:border-box;background-color:#fff;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-shadow:0 8px 10px -5px rgba(0,0,0,.2),0 16px 24px 2px rgba(0,0,0,.14),0 6px 30px 5px rgba(0,0,0,.12);box-shadow:0 8px 10px -5px rgba(0,0,0,.2),0 16px 24px 2px rgba(0,0,0,.14),0 6px 30px 5px rgba(0,0,0,.12);overflow:hidden;outline:0}.el-drawer.rtl{-webkit-animation:rtl-drawer-out .3s;animation:rtl-drawer-out .3s}.el-drawer__open .el-drawer.rtl{-webkit-animation:rtl-drawer-in .3s 1ms;animation:rtl-drawer-in .3s 1ms}.el-drawer.ltr{-webkit-animation:ltr-drawer-out .3s;animation:ltr-drawer-out .3s}.el-drawer__open .el-drawer.ltr{-webkit-animation:ltr-drawer-in .3s 1ms;animation:ltr-drawer-in .3s 1ms}.el-drawer.ttb{-webkit-animation:ttb-drawer-out .3s;animation:ttb-drawer-out .3s}.el-drawer__open .el-drawer.ttb{-webkit-animation:ttb-drawer-in .3s 1ms;animation:ttb-drawer-in .3s 1ms}.el-drawer.btt{-webkit-animation:btt-drawer-out .3s;animation:btt-drawer-out .3s}.el-drawer__open .el-drawer.btt{-webkit-animation:btt-drawer-in .3s 1ms;animation:btt-drawer-in .3s 1ms}.el-drawer__wrapper{position:fixed;top:0;right:0;bottom:0;left:0;overflow:hidden;margin:0}.el-drawer__header{-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:#72767b;display:-webkit-box;display:-ms-flexbox;display:flex;margin-bottom:32px;padding:20px;padding-bottom:0}.el-drawer__header>:first-child,.el-drawer__title{-webkit-box-flex:1;-ms-flex:1;flex:1}.el-drawer__title{margin:0;line-height:inherit;font-size:1rem}.el-drawer__close-btn{border:none;cursor:pointer;font-size:20px;color:inherit;background-color:transparent}.el-drawer__body{-webkit-box-flex:1;-ms-flex:1;flex:1;overflow:auto}.el-drawer__body>*{-webkit-box-sizing:border-box;box-sizing:border-box}.el-drawer.ltr,.el-drawer.rtl{height:100%;top:0;bottom:0}.el-drawer.btt,.el-drawer.ttb{width:100%;left:0;right:0}.el-drawer.ltr{left:0}.el-drawer.rtl{right:0}.el-drawer.ttb{top:0}.el-drawer.btt{bottom:0}.el-drawer__container{position:relative;left:0;right:0;top:0;bottom:0;height:100%;width:100%}.el-drawer-fade-enter-active{-webkit-animation:el-drawer-fade-in .3s;animation:el-drawer-fade-in .3s}.el-drawer-fade-leave-active{animation:el-drawer-fade-in .3s reverse}.el-popconfirm__main{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.el-popconfirm__icon{margin-right:5px}.el-popconfirm__action{text-align:right;margin:0}@-webkit-keyframes el-skeleton-loading{0%{background-position:100% 50%}to{background-position:0 50%}}@keyframes el-skeleton-loading{0%{background-position:100% 50%}to{background-position:0 50%}}.el-skeleton{width:100%}.el-skeleton__first-line,.el-skeleton__paragraph{height:16px;margin-top:16px;background:#f2f2f2}.el-skeleton.is-animated .el-skeleton__item{background:-webkit-gradient(linear,left top,right top,color-stop(25%,#f2f2f2),color-stop(37%,#e6e6e6),color-stop(63%,#f2f2f2));background:linear-gradient(90deg,#f2f2f2 25%,#e6e6e6 37%,#f2f2f2 63%);background-size:400% 100%;-webkit-animation:el-skeleton-loading 1.4s ease infinite;animation:el-skeleton-loading 1.4s ease infinite}.el-skeleton__item{background:#f2f2f2;display:inline-block;height:16px;border-radius:4px;width:100%}.el-skeleton__circle{border-radius:50%;width:36px;height:36px;line-height:36px}.el-skeleton__circle--lg{width:40px;height:40px;line-height:40px}.el-skeleton__circle--md{width:28px;height:28px;line-height:28px}.el-skeleton__button{height:40px;width:64px;border-radius:4px}.el-skeleton__p{width:100%}.el-skeleton__p.is-last{width:61%}.el-skeleton__p.is-first{width:33%}.el-skeleton__text{width:100%;height:13px}.el-skeleton__caption{height:12px}.el-skeleton__h1{height:20px}.el-skeleton__h3{height:18px}.el-skeleton__h5{height:16px}.el-skeleton__image{width:unset;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;border-radius:0}.el-skeleton__image svg{fill:#dcdde0;width:22%;height:22%}.el-empty{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;text-align:center;-webkit-box-sizing:border-box;box-sizing:border-box;padding:40px 0}.el-empty__image{width:160px}.el-empty__image img{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:100%;height:100%;vertical-align:top;-o-object-fit:contain;object-fit:contain}.el-empty__image svg{fill:#dcdde0;width:100%;height:100%;vertical-align:top}.el-empty__description{margin-top:20px}.el-empty__description p{margin:0;font-size:14px;color:#909399}.el-empty__bottom{margin-top:20px}.el-descriptions{-webkit-box-sizing:border-box;box-sizing:border-box;font-size:14px;color:#303133}.el-descriptions__header{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-webkit-box-align:center;-ms-flex-align:center;align-items:center;margin-bottom:20px}.el-descriptions__title{font-size:16px;font-weight:700}.el-descriptions__body{color:#606266;background-color:#fff}.el-descriptions__body .el-descriptions__table{border-collapse:collapse;width:100%;table-layout:fixed}.el-descriptions__body .el-descriptions__table .el-descriptions-item__cell{-webkit-box-sizing:border-box;box-sizing:border-box;text-align:left;font-weight:400;line-height:1.5}.el-descriptions__body .el-descriptions__table .el-descriptions-item__cell.is-left{text-align:left}.el-descriptions__body .el-descriptions__table .el-descriptions-item__cell.is-center{text-align:center}.el-descriptions__body .el-descriptions__table .el-descriptions-item__cell.is-right{text-align:right}.el-descriptions .is-bordered{table-layout:auto}.el-descriptions .is-bordered .el-descriptions-item__cell{border:1px solid #e6ebf5;padding:12px 10px}.el-descriptions :not(.is-bordered) .el-descriptions-item__cell{padding-bottom:12px}.el-descriptions--medium.is-bordered .el-descriptions-item__cell{padding:10px}.el-descriptions--medium:not(.is-bordered) .el-descriptions-item__cell{padding-bottom:10px}.el-descriptions--small{font-size:12px}.el-descriptions--small.is-bordered .el-descriptions-item__cell{padding:8px 10px}.el-descriptions--small:not(.is-bordered) .el-descriptions-item__cell{padding-bottom:8px}.el-descriptions--mini{font-size:12px}.el-descriptions--mini.is-bordered .el-descriptions-item__cell{padding:6px 10px}.el-descriptions--mini:not(.is-bordered) .el-descriptions-item__cell{padding-bottom:6px}.el-descriptions-item{vertical-align:top}.el-descriptions-item__container{display:-webkit-box;display:-ms-flexbox;display:flex}.el-descriptions-item__container .el-descriptions-item__content,.el-descriptions-item__container .el-descriptions-item__label{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:baseline;-ms-flex-align:baseline;align-items:baseline}.el-descriptions-item__container .el-descriptions-item__content{-webkit-box-flex:1;-ms-flex:1;flex:1}.el-descriptions-item__label.has-colon:after{content:":";position:relative;top:-.5px}.el-descriptions-item__label.is-bordered-label{font-weight:700;color:#909399;background:#fafafa}.el-descriptions-item__label:not(.is-bordered-label){margin-right:10px}.el-descriptions-item__content{word-break:break-word;overflow-wrap:break-word}.el-result{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;text-align:center;-webkit-box-sizing:border-box;box-sizing:border-box;padding:40px 30px}.el-result__icon svg{width:64px;height:64px}.el-result__title{margin-top:20px}.el-result__title p{margin:0;font-size:20px;color:#303133;line-height:1.3}.el-result__subtitle{margin-top:10px}.el-result__subtitle p{margin:0;font-size:14px;color:#606266;line-height:1.3}.el-result__extra{margin-top:30px}.el-result .icon-success{fill:#13ce66}.el-result .icon-error{fill:#ff4949}.el-result .icon-info{fill:#909399}.el-result .icon-warning{fill:#ffba00}.el-breadcrumb__inner,.el-breadcrumb__inner a{font-weight:400!important}.el-upload input[type=file]{display:none!important}.el-upload__input{display:none}.cell .el-tag{margin-right:0}.small-padding .cell{padding-left:5px;padding-right:5px}.fixed-width .el-button--mini{padding:7px 10px;width:60px}.status-col .cell{padding:0 10px;text-align:center}.status-col .cell .el-tag{margin-right:0}.el-dialog{-webkit-transform:none;transform:none;left:0;position:relative;margin:0 auto}.upload-container .el-upload{width:100%}.upload-container .el-upload .el-upload-dragger{width:100%;height:200px}.el-dropdown-menu a{display:block}.el-range-editor.el-input__inner{display:-webkit-inline-box!important;display:-ms-inline-flexbox!important;display:inline-flex!important}.blue-btn{background:#324157}.blue-btn:hover{color:#324157}.blue-btn:hover:after,.blue-btn:hover:before{background:#324157}.light-blue-btn{background:#3a71a8}.light-blue-btn:hover{color:#3a71a8}.light-blue-btn:hover:after,.light-blue-btn:hover:before{background:#3a71a8}.red-btn{background:#c03639}.red-btn:hover{color:#c03639}.red-btn:hover:after,.red-btn:hover:before{background:#c03639}.pink-btn{background:#e65d6e}.pink-btn:hover{color:#e65d6e}.pink-btn:hover:after,.pink-btn:hover:before{background:#e65d6e}.green-btn{background:#30b08f}.green-btn:hover{color:#30b08f}.green-btn:hover:after,.green-btn:hover:before{background:#30b08f}.tiffany-btn{background:#4ab7bd}.tiffany-btn:hover{color:#4ab7bd}.tiffany-btn:hover:after,.tiffany-btn:hover:before{background:#4ab7bd}.yellow-btn{background:#fec171}.yellow-btn:hover{color:#fec171}.yellow-btn:hover:after,.yellow-btn:hover:before{background:#fec171}.pan-btn{font-size:14px;color:#fff;padding:14px 36px;border-radius:8px;border:none;outline:none;-webkit-transition:all .6s ease;transition:all .6s ease;position:relative;display:inline-block}.pan-btn:hover{background:#fff}.pan-btn:hover:after,.pan-btn:hover:before{width:100%;-webkit-transition:all .6s ease;transition:all .6s ease}.pan-btn:after,.pan-btn:before{content:"";position:absolute;top:0;right:0;height:2px;width:0;-webkit-transition:all .4s ease;transition:all .4s ease}.pan-btn:after{right:inherit;top:inherit;left:0;bottom:0}.custom-button{display:inline-block;line-height:1;white-space:nowrap;cursor:pointer;background:#fff;color:#fff;-webkit-appearance:none;text-align:center;-webkit-box-sizing:border-box;box-sizing:border-box;outline:0;margin:0;padding:10px 15px;font-size:14px;border-radius:4px}.head-container{padding-bottom:10px}.head-container .filter-item{display:inline-block;vertical-align:middle;margin:0 3px 10px 0}.head-container .filter-item input{height:30.5px;line-height:30.5px}.head-container .el-form-item-label{margin:0 3px 9px 0;display:inline-block;text-align:right;vertical-align:middle;font-size:14px;color:#606266;line-height:30.5px;padding:0 7px 0 7px}.head-container .el-button+.el-button{margin-left:0!important}.head-container .el-select__caret.el-input__icon.el-icon-arrow-up{line-height:30.5px}.head-container .date-item{margin-bottom:10px;height:30.5px!important;width:230px!important}.el-avatar,.head-container .date-item{display:inline-block;vertical-align:middle}.el-avatar{text-align:center;background:#ccc;color:#fff;white-space:nowrap;position:relative;overflow:hidden;width:32px;height:32px;line-height:32px;border-radius:16px}.logo-con{height:60px;padding:13px 0 0}.logo-con img{height:32px;width:135px;display:block}#el-login-footer{height:40px;line-height:40px;text-align:center;color:#fff;font-family:Arial,serif;font-size:12px;letter-spacing:1px}#el-login-footer,#el-main-footer{position:fixed;bottom:0;width:100%}#el-main-footer{background:none repeat scroll 0 0 #fff;border-top:1px solid #e7eaec;overflow:hidden;padding:10px 6px 0 6px;height:33px;font-size:.7rem!important;color:#7a8b9a;letter-spacing:.8px;font-family:Arial,sans-serif!important;z-index:99}.eladmin-upload{border:1px dashed #c0ccda;border-radius:5px;height:45px;line-height:45px;width:368px}.my-blockquote{margin:0 0 10px;padding:15px;line-height:22px;border-left:5px solid #00437b;border-radius:0 2px 2px 0;background-color:#f2f2f2}.my-code{position:relative;padding:15px;line-height:20px;border-left:5px solid #ddd;color:#333;font-family:Courier New,serif;font-size:12px}.el-tabs{margin-bottom:25px}body{height:100%;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;font-family:Helvetica Neue,Helvetica,PingFang SC,Hiragino Sans GB,Microsoft YaHei,Arial,sans-serif}label{font-weight:700}html{-webkit-box-sizing:border-box;box-sizing:border-box}#app,html{height:100%}*,:after,:before{-webkit-box-sizing:inherit;box-sizing:inherit}.no-padding{padding:0!important}.padding-content{padding:4px 0}a:active,a:focus{outline:none}a,a:focus,a:hover{cursor:pointer;color:inherit;text-decoration:none}div:focus{outline:none}.fr{float:right}.fl{float:left}.pr-5{padding-right:5px}.pl-5{padding-left:5px}.block{display:block}.pointer{cursor:pointer}.inlineBlock{display:block}.clearfix:after{visibility:hidden;display:block;font-size:0;content:" ";clear:both;height:0}aside{background:#eef1f6;padding:8px 24px;margin-bottom:20px;border-radius:2px;display:block;line-height:32px;font-size:16px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;color:#2c3e50;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}aside a{color:#337ab7;cursor:pointer}aside a:hover{color:#20a0ff}.app-container{padding:20px 20px 45px 20px}.components-container{margin:30px 50px;position:relative}.pagination-container{margin-top:30px}.text-center{text-align:center}.sub-navbar{height:50px;line-height:50px;position:relative;width:100%;text-align:right;padding-right:20px;-webkit-transition:position .6s ease;transition:position .6s ease;background:-webkit-gradient(linear,left top,right top,from(#20b6f9),color-stop(0,#20b6f9),color-stop(100%,#2178f1),to(#2178f1));background:linear-gradient(90deg,#20b6f9,#20b6f9 0,#2178f1 100%,#2178f1 0)}.sub-navbar .subtitle{font-size:20px;color:#fff}.sub-navbar.deleted,.sub-navbar.draft{background:#d0d0d0}.link-type,.link-type:focus{color:#337ab7;cursor:pointer}.link-type:focus:hover,.link-type:hover{color:#20a0ff}.multiselect{line-height:16px}.multiselect--active{z-index:1000!important} \ No newline at end of file diff --git a/spaces/ehristoforu/Diffehsj/app.py b/spaces/ehristoforu/Diffehsj/app.py deleted file mode 100644 index ff6121d386475ab202cf7bf378365b8f35f0f499..0000000000000000000000000000000000000000 --- a/spaces/ehristoforu/Diffehsj/app.py +++ /dev/null @@ -1,24 +0,0 @@ -import gradio as gr -from transformers import DiffusionModel - -# Загрузка модели -model = DiffusionModel.from_pretrained("runwayml/stable-diffusion-v1-5") - -def generate_images(input_text): - # Генерация изображений из текста - outputs = model.generate(input_text, num_outputs=2) - - # Сохранение изображений и получение путей к ним - image_paths = [] - for i, image in enumerate(outputs): - image_path = f"output_image_{i+1}.jpg" - image.save(image_path) - image_paths.append(image_path) - - return image_paths - -# Создание интерфейса Gradio -input_text = gr.inputs.Textbox(label="Введите текст") # Ввод текста от пользователя -output_images = gr.outputs.Image(label="Изображение", type="file", multiple=True) # Вывод сгенерированных изображений - -gr.Interface(fn=generate_images, inputs=input_text, outputs=output_images).launch() \ No newline at end of file diff --git a/spaces/ethzanalytics/gpt2-xl-conversational/grammar_improve.py b/spaces/ethzanalytics/gpt2-xl-conversational/grammar_improve.py deleted file mode 100644 index 4dba455196ab27c7b009f8aa42290c3cea85a487..0000000000000000000000000000000000000000 --- a/spaces/ethzanalytics/gpt2-xl-conversational/grammar_improve.py +++ /dev/null @@ -1,513 +0,0 @@ -""" -grammar_improve.py - this .py script contains functions to improve the grammar of a user's input or the models output. - -""" - -import logging -logging.basicConfig(level=logging.INFO) -import math -import pprint as pp -import re -import time - -import neuspell -import transformers -from cleantext import clean -from neuspell import BertChecker, SclstmChecker -from symspellpy.symspellpy import SymSpell - -from utils import suppress_stdout - - -def detect_propers(text: str): - """ - detect_propers - detect if a string contains proper nouns - - Args: - text (str): [string to be checked] - - Returns: - [bool]: [True if string contains proper nouns] - """ - pat = re.compile(r"(?:\w+['’])?\w+(?:-(?:\w+['’])?\w+)*") - return bool(pat.search(text)) - - -def fix_punct_spaces(string): - """ - fix_punct_spaces - replace spaces around punctuation with punctuation. For example, "hello , there" -> "hello, there" - - Parameters - ---------- - string : str, required, input string to be corrected - - Returns - ------- - str, corrected string - """ - - fix_spaces = re.compile(r"\s*([?!.,]+(?:\s+[?!.,]+)*)\s*") - string = fix_spaces.sub(lambda x: "{} ".format(x.group(1).replace(" ", "")), string) - return string.strip() - - -def split_sentences(text: str): - """ - split_sentences - split a string into a list of sentences that keep their ending punctuation. powered by regex witchcraft - - Args: - text (str): [string to be split] - - Returns: - [list]: [list of strings] - """ - return re.split(r"(? 0, "entered string for correction is empty" - - if sym_checker is None: - # need to create a new class object. user can specify their own dictionary and bigram files - if verbose: - print("creating new SymSpell object") - sym_checker = build_symspell_obj( - edit_dist=max_dist, - prefix_length=prefix_length, - dictionary_path=dictionary_path, - bigram_path=bigram_path, - ) - else: - if verbose: - print("using existing SymSpell object") - # max edit distance per lookup (per single word, not per whole input string) - suggestions = sym_checker.lookup_compound( - my_string, - max_edit_distance=max_dist, - ignore_non_words=ignore_non_words, - ignore_term_with_digits=True, - transfer_casing=True, - ) - - if verbose: - print(f"{len(suggestions)} suggestions found") - print(f"the original string is:\n\t{my_string}") - sug_list = [sug.term for sug in suggestions] - print(f"suggestions:\n\t{sug_list}\n") - - if len(suggestions) < 1: - return clean(my_string) # no correction because no suggestions - else: - first_result = suggestions[0] # first result is the most likely - return first_result._term - - -def build_symspell_obj( - edit_dist=2, - prefix_length=7, - dictionary_path=None, - bigram_path=None, -): - """ - build_symspell_obj [build a SymSpell object] - - Args: - verbose (bool, optional): Defaults to False. - - Returns: - SymSpell: a SymSpell object - """ - dictionary_path = ( - r"symspell_rsc/frequency_dictionary_en_82_765.txt" - if dictionary_path is None - else dictionary_path - ) - bigram_path = ( - r"symspell_rsc/frequency_bigramdictionary_en_243_342.txt" - if bigram_path is None - else bigram_path - ) - sym_checker = SymSpell( - max_dictionary_edit_distance=edit_dist + 2, prefix_length=prefix_length - ) - # term_index is the column of the term and count_index is the - # column of the term frequency - sym_checker.load_dictionary(dictionary_path, term_index=0, count_index=1) - sym_checker.load_bigram_dictionary(bigram_path, term_index=0, count_index=2) - - return sym_checker - - -""" -# if using t5b_correction to check for spelling errors, use this code to initialize the objects - -import torch -from transformers import T5Tokenizer, T5ForConditionalGeneration - -model_name = 'deep-learning-analytics/GrammarCorrector' -# torch_device = 'cuda' if torch.cuda.is_available() else 'cpu' -torch_device = 'cpu' -gc_tokenizer = T5Tokenizer.from_pretrained(model_name) -gc_model = T5ForConditionalGeneration.from_pretrained(model_name).to(torch_device) - -""" - - -def t5b_correction(prompt: str, korrektor, verbose=False, beams=4): - """ - t5b_correction - correct a string using a text2textgen pipeline model from transformers - - Parameters - ---------- - prompt : str, required, input prompt to be corrected - korrektor : transformers.pipeline, required, pipeline object - verbose : bool, optional, whether to print the corrected prompt. Defaults to False. - beams : int, optional, number of beams to use for the correction. Defaults to 4. - - Returns - ------- - str, corrected prompt - """ - - p_min_len = int(math.ceil(0.9 * len(prompt))) - p_max_len = int(math.ceil(1.1 * len(prompt))) - if verbose: - print(f"setting min to {p_min_len} and max to {p_max_len}\n") - gcorr_result = korrektor( - f"grammar: {prompt}", - return_text=True, - clean_up_tokenization_spaces=True, - num_beams=beams, - max_length=p_max_len, - repetition_penalty=1.3, - length_penalty=0.2, - no_repeat_ngram_size=2, - ) - if verbose: - print(f"grammar correction result: \n\t{gcorr_result}\n") - return gcorr_result - - -def all_neuspell_chkrs(): - """ - disp_neuspell_chkrs - display the neuspell checkers available - - Parameters - ---------- - None - - Returns - ------- - checker_opts - list of checkers available - """ - - checker_opts = dir(neuspell) - print(f"\navailable checkers:") - - pp.pprint(checker_opts, indent=4, compact=True) - - return checker_opts - - -def load_ns_checker(customckr=None, fast=False): - """ - load_ns_checker - helper function, load / "set up" a neuspell checker from huggingface transformers - - Args: - customckr (neuspell.NeuSpell): [neuspell checker object], optional, if not provided, will load the default checker - - Returns: - [neuspell.NeuSpell]: [neuspell checker object] - """ - st = time.perf_counter() - # stop all printing to the console - with suppress_stdout(): - if customckr is None and not fast: - - checker = BertChecker( - pretrained=True - ) # load the default checker, has the best balance - elif customckr is None and fast: - checker = SclstmChecker( - pretrained=True - ) # this one is faster but not as accurate - else: - checker = customckr(pretrained=True) - rt_min = (time.perf_counter() - st) / 60 - # return to standard logging level - print(f"\n\nloaded checker in {rt_min} minutes") - - return checker - - -def neuspell_correct(input_text: str, checker=None, verbose=False): - """ - neuspell_correct - correct a string using neuspell. - note that modificaitons to the checker are needed if doing list-based corrections - - Parameters - ---------- - input_text : str, required, input string to be corrected - checker : neuspell.NeuSpell, optional, neuspell checker object. Defaults to None. - verbose : bool, optional, whether to print the corrected string. Defaults to False. - - Returns - ------- - str, corrected string - """ - if isinstance(input_text, str) and len(input_text) < 4: - print(f"input text of {input_text} is too short to be corrected") - return input_text - - if checker is None: - print("NOTE - no checker provided, loading default checker") - checker = SclstmChecker(pretrained=True) - - corrected = checker.correct(input_text) - cleaned_txt = fix_punct_spaces(corrected) - - if verbose: - print(f"neuspell correction result: \n\t{cleaned_txt}\n") - return cleaned_txt - - -def grammarpipe(corrector, qphrase: str): - """ - gramformer_correct - THE ORIGINAL ONE USED IN PROJECT AND NEEDS TO BE CHANGED. - Idea is to correct a string using a text2textgen pipeline model from transformers - Args: - corrector (transformers.pipeline): [transformers pipeline object, already created w/ relevant model] - qphrase (str): [text to be corrected] - Returns: - [str]: [corrected text] - """ - if isinstance(qphrase, str) and len(qphrase) < 4: - print(f"input text of {qphrase} is too short to be corrected") - return qphrase - try: - corrected = corrector( - clean(qphrase), return_text=True, clean_up_tokenization_spaces=True - ) - return corrected[0]["generated_text"] - except Exception as e: - print(f"NOTE - failed to correct with grammarpipe:\n {e}") - return clean(qphrase) - - -def DLA_correct(qphrase: str): - """ - DLA_correct - an "overhead" function to call correct_grammar() on a string, allowing for each newline to be corrected individually - - Args: - qphrase (str): [string to be corrected] - - Returns: - str, the list of the corrected strings joined under " " - """ - if isinstance(qphrase, str) and len(qphrase) < 4: - print(f"input text of {qphrase} is too short to be corrected") - return qphrase - - sentences = split_sentences(qphrase) - if len(sentences) == 1: - corrected = correct_grammar(sentences[0]) - return corrected - else: - full_cor = [] - for sen in sentences: - corr_sen = correct_grammar(clean(sen)) - full_cor.append(corr_sen) - return " ".join(full_cor) - - -def correct_grammar( - input_text: str, - tokenizer, - model, - n_results: int = 1, - beams: int = 8, - temp=1, - no_repeat_ngram_size=4, - rep_penalty=2.5, - device="cpu", -): - """ - correct_grammar - correct a string using a text2textgen pipeline model from transformers. - This function is an alternative to the t5b_correction function. - - Parameters - ---------- - input_text : str, required, input string to be corrected - tokenizer : transformers.T5Tokenizer, required, tokenizer object, already created w/ relevant model - model : transformers.T5ForConditionalGeneration, required, model object, already created w/ relevant model - n_results : int, optional, number of results to return. Defaults to 1. - beams : int, optional, number of beams to use for the correction. Defaults to 8. - temp : int, optional, temperature to use for the correction. Defaults to 1. - uniq_ngrams : int, optional, number of ngrams to use for the correction. Defaults to 2. - rep_penalty : float, optional, penalty to use for the correction. Defaults to 1.5. - device : str, optional, device to use for the correction. Defaults to 'cpu'. - - Returns - ------- - str, corrected string (or list of strings if n_results > 1) - """ - st = time.perf_counter() - - if len(tokenizer(input_text).input_ids) < 4: - logging.info(f"input text of {input_text} is too short to be corrected") - return input_text - max_length = min(int(math.ceil(len(input_text) * 1.2)), 128) - batch = tokenizer( - [input_text], - truncation=True, - padding="max_length", - max_length=max_length, - return_tensors="pt", - ).to(device) - translated = model.generate( - **batch, - max_length=max_length, - min_length=min(10, len(input_text)), - no_repeat_ngram_size=no_repeat_ngram_size, - repetition_penalty=rep_penalty, - num_beams=beams, - num_return_sequences=n_results, - temperature=temp, - ) - - tgt_text = tokenizer.batch_decode(translated) - rt_min = (time.perf_counter() - st) / 60 - print(f"\n\ncorrected in {rt_min} minutes") - - if isinstance(tgt_text, list): - return tgt_text[0] - else: - return tgt_text diff --git a/spaces/fadyabila/Heart-Failure-Death-Prediction/eda.py b/spaces/fadyabila/Heart-Failure-Death-Prediction/eda.py deleted file mode 100644 index dc990c41ce22df49fda6874db67926f1a45e43f5..0000000000000000000000000000000000000000 --- a/spaces/fadyabila/Heart-Failure-Death-Prediction/eda.py +++ /dev/null @@ -1,85 +0,0 @@ -import streamlit as st -import pandas as pd -import seaborn as sns -import matplotlib.pyplot as plt -import plotly.express as px -from PIL import Image - -# Melebarkan visualisasi untuk memaksmalkan browser -st.set_page_config( - page_title='Heart Failure', - layout='wide', - initial_sidebar_state='expanded' -) - -def run(): - # Membuat title - st.title('Patients with Heart Failure-Death Prediction') - - # Menambahkan Gambar - image = Image.open('heart.jpg') - st.image(image, caption='Heart Failure') - - # Menambahkan Deskripsi - st.write('## Definition') - st.write('Heart failure is progressive condition in which the heart muscle is unable to pump enough blood to meet the body needs for blood and oxygen.' - 'Basically, the heart cant keep up with its workload.' - 'Heart failure can caused by diabetes, smoking, and high of blood pressure.' - 'Heart failure can cause death in chronic and acute conditions.') - - st.write('## Heart and kidney') - st.write('The interaction between the heart and kidney can often become deranged in heart failure.' - 'Not only do heart failure and chronic kidney disease (CKD) often co-exist and share common risk factors in their development, both heart and kidney disease can worsen each others prognosis.' - 'The preload of the heart directly depends on the sodium and water homeostasis regulated by the kidney.' - 'The kidney depends on adequate contraction and relaxation of the heart to have a sufficient trans-renal pressure gradient to maintain renal blood flow (RBF).' - 'So, heart failure have a correlation with sodium level in blood and creatinin (CPK enzyme).') - - # Membuat Garis Lurus - st.markdown('---') - - # Membuat Sub Headrer - st.subheader('EDA for Analyze Patients') - - # Magic Syntax - ''' - On this page, the author will do a simple exploration. - The dataset used is the Heart Failure dataset. - This dataset comes from GCP in the Hacktiv8 project. - ''' - - # Show DataFrame - df1 = pd.read_csv('h8dsft_P1G3_fadya_ulya.csv') - st.dataframe(df1) - - # Membuat Barplot - st.write('#### Plot Death Event') - fig = plt.figure(figsize=(15,8)) - sns.countplot(x='DEATH_EVENT', data=df1, palette="PuRd") - st.pyplot(fig) - - # Membuat Barplot Diabetes, Smoking, dan Darah Tinggi - st.write('#### Diabetes') - plt.figure(figsize=(15,8)) - sns.countplot(x='diabetes', data=df1, palette="Blues") - st.pyplot(fig) - - st.write('#### High Blood Pressure') - plt.figure(figsize=(15,8)) - sns.countplot(x='high_blood_pressure', data=df1, palette="Blues") - st.pyplot(fig) - - st.write('#### Smoking') - plt.figure(figsize=(15,8)) - sns.countplot(x='smoking', data=df1, palette="Blues") - st.pyplot(fig) - - # Membuat Histogram Berdasarkan Input User - st.write('#### Histogram Based On User Input') - pilihan = st.selectbox('Choose Column : ', ('age', 'creatinine_phosphokinase', 'ejection_fraction', - 'platelets', 'serum_sodium', 'serum_creatinine', 'time')) - fig = plt.figure(figsize=(15,5)) - sns.histplot(df1[pilihan], bins=30, kde=True) - st.pyplot(fig) - -if __name__ == '__main__': - run() \ No newline at end of file diff --git a/spaces/falterWliame/Face_Mask_Detection/Download Buku Semantik Pdf Files NEW!.md b/spaces/falterWliame/Face_Mask_Detection/Download Buku Semantik Pdf Files NEW!.md deleted file mode 100644 index 2c7b9ef19c8db8bf81585be4eae4db419ef15d18..0000000000000000000000000000000000000000 --- a/spaces/falterWliame/Face_Mask_Detection/Download Buku Semantik Pdf Files NEW!.md +++ /dev/null @@ -1,13 +0,0 @@ -

    download buku semantik pdf files


    DOWNLOAD >>>>> https://urlca.com/2uDcUj



    - -All rights reserved. All materials are posted for informational purposes. -If you liked the materials of the site, then you can also place our banner on your site. -For more information, contact the site administrator -How do you feel about sports? -If you answered yes, then you will be interested in this article. -And if you answer no, then I advise you to read this article and start playing sports at least a little. -Sport is the key to good health! -Nowadays, people pay little attention to sports. 8a78ff9644
    -
    -
    -

    diff --git a/spaces/falterWliame/Face_Mask_Detection/Dynamo Studio 2010 32 Bit Full Indir Tek Link TOP.md b/spaces/falterWliame/Face_Mask_Detection/Dynamo Studio 2010 32 Bit Full Indir Tek Link TOP.md deleted file mode 100644 index 7bfaff743b37c531ec95ad012f300c7bfe2ce0de..0000000000000000000000000000000000000000 --- a/spaces/falterWliame/Face_Mask_Detection/Dynamo Studio 2010 32 Bit Full Indir Tek Link TOP.md +++ /dev/null @@ -1,6 +0,0 @@ -

    Dynamo Studio 2010 32 Bit Full Indir Tek Link


    Download File ——— https://urlca.com/2uDcgU



    -
    -Xforce ... Dynamo Studio 2005 64 bit full indir tek link · download . ... Build 204 32 x 64 Bit Full Tek link indir Autodesk AutoCAD 2013, . ... Autocad 2007 64 Bit Tek Link Indirautocad 2010 indir tek linkautocad 2013 full indir tek ... 1fdad05405
    -
    -
    -

    diff --git a/spaces/fatiXbelha/sd/BTRoblox - The Best Extension for Roblox Fans on Chrome Web Store.md b/spaces/fatiXbelha/sd/BTRoblox - The Best Extension for Roblox Fans on Chrome Web Store.md deleted file mode 100644 index 9e49755f394c2eeef4a580df943756ddbdd9bf63..0000000000000000000000000000000000000000 --- a/spaces/fatiXbelha/sd/BTRoblox - The Best Extension for Roblox Fans on Chrome Web Store.md +++ /dev/null @@ -1,111 +0,0 @@ - -

    BTRoblox Download: How to Enhance Your Roblox Experience

    -

    Roblox is one of the most popular online gaming platforms in the world, with millions of players and creators. But did you know that you can make your Roblox experience even better with a simple extension called BTRoblox?

    -

    In this article, we will tell you what BTRoblox is, what features it offers, how to download it, and how to use it. By the end of this article, you will be able to enjoy Roblox like never before!

    -

    btroblox download


    Download ✑ ✑ ✑ https://urllie.com/2uNIIQ



    -

    What is BTRoblox?

    -

    BTRoblox, or Better Roblox, is an extension that aims to enhance Roblox's website by modifying the look and adding to the core website functionality by adding a plethora of new features . It was created by AntiBoomz, a Roblox developer and fan, who wanted to improve the user interface and user experience of Roblox.

    -

    BTRoblox is available for both Chrome and Firefox browsers, and it is completely free and safe to use. It does not require any permissions or access to your personal data, and it does not interfere with your gameplay or performance. It only works on the Roblox website, not on the Roblox app or studio.

    -

    Features of BTRoblox

    -

    BTRoblox offers a wide range of features that make Roblox more fun and convenient. Here are some of the most notable ones:

    -

    Custom themes

    -

    BTRoblox allows you to change the appearance of the Roblox website by applying different themes and colors. You can choose from the preset themes or create your own custom theme with your favorite colors and images. You can also adjust the brightness, contrast, saturation, and hue of the website.

    -

    Avatar enhancements

    -

    BTRoblox adds some useful features to your avatar page, such as showing your RAP (recent average price) and value, displaying your outfits and accessories in a grid view, allowing you to try on any item before buying it, and enabling you to copy other users' outfits.

    -

    Item details

    -

    BTRoblox shows you more information about any item on the catalog or inventory, such as its sales, favorites, ratings, comments, owners, serial numbers, and more. You can also see the price history and trends of any item, as well as compare it with other similar items.

    -

    Profile statistics

    -

    BTRoblox adds some extra statistics to your profile page, such as your total visits, followers, badges, game passes, and more. You can also see your rank among other users based on various criteria, such as RAP, value, followers, badges, etc.

    -

    Game filters

    -

    BTRoblox lets you filter games by different categories and tags, such as genre, popularity, rating, age rating, creator, etc. You can also sort games by different criteria, such as most played, most favorited, most liked, etc. This makes it easier to find games that suit your preferences and interests.

    -

    btroblox download chrome
    -btroblox download firefox
    -btroblox download android
    -btroblox download extension
    -btroblox download pc
    -btroblox download mac
    -btroblox download windows 10
    -btroblox download apk
    -btroblox download for roblox
    -btroblox download microsoft edge
    -btroblox download opera
    -btroblox download safari
    -btroblox download ios
    -btroblox download linux
    -btroblox download free
    -btroblox download 2023
    -btroblox download update
    -btroblox download link
    -btroblox download file
    -btroblox download online
    -btroblox download review
    -btroblox download tutorial
    -btroblox download guide
    -btroblox download features
    -btroblox download benefits
    -btroblox download problems
    -btroblox download issues
    -btroblox download error
    -btroblox download fix
    -btroblox download support
    -btroblox download help
    -btroblox download reddit
    -btroblox download youtube
    -btroblox download video
    -btroblox download install
    -btroblox download uninstall
    -btroblox download enable
    -btroblox download disable
    -btroblox download settings
    -btroblox download options
    -btroblox download customize
    -btroblox download enhance
    -btroblox download improve
    -btroblox download modify
    -btroblox download add-on
    -btroblox download plugin
    -btroblox download app
    -btroblox download software
    -btroblox download tool

    -

    And more

    -

    BTRoblox has many more features that enhance your Roblox experience, such as adding a search bar to the homepage, showing the exact time of messages and notifications, adding a live chat feature to the website, adding a dark mode option to the website, adding a button to join any game server directly from the website, and much more.

    -

    How to download BTRoblox?

    -

    Downloading BTRoblox is very easy and fast. Depending on which browser you use, you can follow these steps to download BTRoblox:

    -

    For Chrome users

    -
      -
    1. Go to the Chrome Web Store and search for BTRoblox.
    2. -
    3. Click on the "Add to Chrome" button and confirm the installation.
    4. -
    5. You will see a BTRoblox icon on the top right corner of your browser. Click on it to access the settings menu.
    6. -
    -

    For Firefox users

    -
      -
    1. Go to the Firefox Add-ons and search for BTRoblox.
    2. -
    3. Click on the "Add to Firefox" button and confirm the installation.
    4. -
    5. You will see a BTRoblox icon on the top right corner of your browser. Click on it to access the settings menu.
    6. -
    -

    How to use BTRoblox?

    -

    Using BTRoblox is very simple and intuitive. You can customize your Roblox experience by enabling and disabling different features and options from the settings menu. Here are some tips on how to use BTRoblox:

    -

    Accessing the settings menu

    -

    To access the settings menu, you need to click on the BTRoblox icon on the top right corner of your browser. You will see a list of categories, such as General, Themes, Avatar, Inventory, etc. You can click on any category to see the available features and options for that category.

    -

    Enabling and disabling features

    -

    To enable or disable any feature, you need to check or uncheck the box next to it. For example, if you want to enable the custom themes feature, you need to check the box next to "Enable Custom Themes". If you want to disable it, you need to uncheck it. You can also hover over any feature to see a brief description of what it does.

    -

    Customizing your theme

    -

    If you enable the custom themes feature, you can change the appearance of the Roblox website by applying different themes and colors. You can choose from the preset themes or create your own custom theme with your favorite colors and images. To customize your theme, you need to click on the "Themes" category in the settings menu and then click on the "Customize Theme" button. You will see a panel where you can adjust the brightness, contrast, saturation, and hue of the website, as well as select a background image and a logo image. You can also save your theme and share it with others.

    -

    Conclusion

    -

    BTRoblox is an amazing extension that enhances your Roblox experience by adding many new features and options. You can download it for free from the Chrome Web Store or Firefox Add-ons, and customize it according to your preferences. With BTRoblox, you can enjoy Roblox like never before!

    -

    Frequently Asked Questions

    -
      -
    1. Is BTRoblox safe to use?
    2. -

      Yes, BTRoblox is safe to use. It does not require any permissions or access to your personal data, and it does not interfere with your gameplay or performance. It only works on the Roblox website, not on the Roblox app or studio.

      -
    3. Does BTRoblox work on mobile devices?
    4. -

      No, BTRoblox does not work on mobile devices. It is only compatible with Chrome and Firefox browsers on desktop computers.

      -
    5. Can I use BTRoblox with other extensions?
    6. -

      Yes, you can use BTRoblox with other extensions, as long as they do not conflict with each other or cause any errors. However, some extensions may override or interfere with some of BTRoblox's features, so you may need to disable them if you encounter any problems.

      -
    7. How do I update BTRoblox?
    8. -

      BTRoblox updates automatically whenever there is a new version available. You do not need to do anything to update it. However, if you want to manually check for updates, you can go to the extension page in your browser and click on the "Update" button.

      -
    9. How do I uninstall BTRoblox?
    10. -

      If you want to uninstall BTRoblox, you can go to the extension page in your browser and click on the "Remove" button. You can also right-click on the BTRoblox icon in your browser and select "Remove from Chrome" or "Remove from Firefox".

      -
    - [^1^

    197e85843d
    -
    -
    \ No newline at end of file diff --git a/spaces/fatiXbelha/sd/Bounce and collect A Fun and Addictive Game for Android.md b/spaces/fatiXbelha/sd/Bounce and collect A Fun and Addictive Game for Android.md deleted file mode 100644 index c88327638aee477229b1c521ab0114dd635f391a..0000000000000000000000000000000000000000 --- a/spaces/fatiXbelha/sd/Bounce and collect A Fun and Addictive Game for Android.md +++ /dev/null @@ -1,111 +0,0 @@ -
    -

    Bounce and Collect APK: A Fun and Challenging Game for Android Users

    -

    Do you love games that test your skills, logic, and creativity? Do you enjoy games that are simple to play but hard to master? Do you want to have a fun and relaxing time with your Android device? If you answered yes to any of these questions, then you should try Bounce and Collect APK, a game that will keep you entertained for hours.

    -

    bounce and collect apk


    Download ===> https://urllie.com/2uNy2L



    -

    Bounce and Collect APK is a game developed by VOODOO, a popular studio that creates casual games for mobile devices. In this game, you have to drop balls in the right place to collect the maximum number of balls and unlock the next challenge. The game has over 10 million downloads on Google Play Store, and it has received positive reviews from players who praised its addictive gameplay, simple graphics, and smooth performance.

    -

    In this article, we will tell you everything you need to know about Bounce and Collect APK, including how to play it, what makes it different from other games, and how to download and install it on your Android device. By the end of this article, you will be ready to enjoy this fun and challenging game on your phone or tablet.

    -

    How to Play Bounce and Collect APK

    -

    The gameplay of Bounce and Collect APK is very easy to understand. You have a cup of balls that you can tilt by tapping on the left or right side of the screen. You have to drop the balls through various gates that have different effects on them. Some gates will multiply your balls, some will reduce them, some will change their color, some will teleport them, and some will have a question mark that can have a random effect.

    -

    bounce and collect apk download
    -bounce and collect apk mod
    -bounce and collect apk pure
    -bounce and collect apk latest version
    -bounce and collect apk for android
    -bounce and collect apk offline
    -bounce and collect apk hack
    -bounce and collect apk unlimited money
    -bounce and collect apk no ads
    -bounce and collect apk free
    -bounce and collect game apk
    -bounce and collect app apk
    -bounce and collect mod apk android 1
    -bounce and collect mod apk revdl
    -bounce and collect mod apk happymod
    -bounce and collect mod apk rexdl
    -bounce and collect mod apk unlimited balls
    -bounce and collect mod apk 2023
    -bounce and collect mod apk 2022
    -bounce and collect mod apk 2021
    -bounce and collect voodoo apk
    -bounce and collect voodoo mod apk
    -bounce and collect voodoo game apk
    -bounce and collect voodoo app apk
    -bounce and collect voodoo hack apk
    -bounce and collect by voodoo apk download
    -bounce and collect by voodoo mod apk
    -bounce and collect by voodoo game apk
    -bounce and collect by voodoo app apk
    -bounce and collect by voodoo hack apk
    -download game bounce and collect apk
    -download app bounce and collect apk
    -download mod bounce and collect apk
    -download hack bounce and collect apk
    -download latest bounce and collect apk
    -download free bounce and collect apk
    -install game bounce and collect apk
    -install app bounce and collect apk
    -install mod bounce and collect apk
    -install hack bounce and collect apk
    -install latest bounce and collect apk
    -install free bounce and collect apk
    -play game bounce and collect apk
    -play app bounce and collect apk
    -play mod bounce and collect apk
    -play hack bounce and collect apk
    -play latest bounce and collect apk
    -play free bounce and collect apk

    -

    Your goal is to collect as many balls as possible at the end of each level. The more balls you collect, the higher your score will be. You can also earn coins by collecting balls that have a coin symbol on them. You can use these coins to unlock new cups and balls with different designs and colors.

    -

    The game has hundreds of levels with different layouts, obstacles, and challenges. Some levels are easy, while others are very hard. You have to use your logic, strategy, and timing skills to drop the balls in the right place at the right time. You also have to be careful not to drop too many balls or run out of balls before reaching the end.

    -

    Here are some tips and tricks that will help you play Bounce and Collect APK better:

    -
      -
    • Look at how the gates are set up and where your balls are likely to go when you drop them. There might be a big multiplier gate, but would you be better off dropping through a series of multipliers to end up with more balls at the end? Think carefully before you tip to get the most out of the level.
    • -
    • Watch out for question marks. Sometimes they can be very helpful, other times they can ruin your run. There are times when you can't avoid them, but there are other times when it's best to bypass them completely. Don't risk your progression in a game of chance.
    • -
    • Time your tips. When there are moving gates or obstacles, you have to time your tips to make sure your balls go through the right gate at the right moment. Don't tip too early or too late, or you might miss a good opportunity or hit a bad one.
    • -
    • Don't be afraid to restart a level. Sometimes you might make a mistake or get unlucky with a question mark. If you feel like you can do better, you can always restart the level and try again. You don't lose anything by doing so, and you might improve your score and coins.
    • -
    -

    Bounce and Collect APK is a game that will test your skills and keep you hooked for hours. You will never get bored with the variety of levels and challenges that the game offers. You will also have fun collecting and customizing your cups and balls with different colors and designs.

    -

    What Makes Bounce and Collect APK Different from Other Games?

    -

    Bounce and Collect APK is not just another casual game that you can play mindlessly. It is a game that has some unique and fun features that make it stand out from other games in the market. Here are some of them:

    -

    Unique and Fun Popcorn Puzzle Game

    -

    Bounce and Collect APK is a game that uses physical principles and math to create a unique and fun experience. The game is based on the idea of popcorn, which is a type of corn that pops when heated. The game simulates how popcorn behaves when it pops, and how it interacts with other popcorns and objects. The game also uses math to calculate how many balls you can collect at the end of each level, based on the number of balls you start with, the number of gates you go through, and the multiplier effect of each gate.

    -

    This makes the game more than just a simple tapping game. It makes it a game that requires logic, strategy, and creativity. You have to think about how to drop your balls in the best way possible, how to use the gates to your advantage, and how to avoid the obstacles that can ruin your run. You also have to be aware of how many balls you have left, how many balls you need to collect, and how much time you have left.

    -

    The game is also very fun to play, as you can see your balls pop like popcorn, bounce around like crazy, change colors, multiply, teleport, and more. The game also has satisfying sound effects that make you feel like you are playing with real popcorn.

    -

    Easy-to-Use Gameplay and Well-Designed Game Levels

    -

    Bounce and Collect APK is a game that is easy to use and well-designed. The game has simple graphics that are colorful and appealing, but not too distracting or cluttered. The game also has smooth performance that does not lag or crash, even when there are hundreds of balls on the screen.

    -

    The game also has well-designed game levels that are challenging but not frustrating. The game has hundreds of levels with different layouts, obstacles, and challenges. Each level has a different goal that you have to achieve, such as collecting a certain number of balls, collecting balls of a certain color, or collecting coins. The game also has different modes that offer different gameplay experiences, such as endless mode, time mode, or arcade mode.

    -

    The game also has a user-friendly interface that allows you to easily control your cup, access the menu, restart the level, or change your settings. The game also has a tutorial that explains the basics of the game and gives you some tips on how to play better.

    -

    A Fun Game to Relieve Stress and Kill Time

    -

    Bounce and Collect APK is a game that is fun to play anytime and anywhere. The game is addictive, relaxing, and satisfying to play. You can play it for hours without getting bored or tired. You can also play it for a few minutes when you need a break or want to kill some time.

    -

    The game is also a great way to relieve stress and have some fun. The game is not too hard or too easy, so you don't feel frustrated or bored. The game also has positive feedback that makes you feel good about yourself, such as rewarding you with coins, unlocking new cups and balls, or showing you your high score.

    -

    The game is also suitable for anyone who likes casual games that are simple but challenging. The game does not require any special skills or knowledge to play. Anyone can enjoy it regardless of their age, gender, or background.

    -

    How to Download and Install Bounce and Collect APK on Your Android Device

    -

    If you want to try Bounce and Collect APK on your Android device, you have to download and install it from a reliable source. Here are the steps that you need to follow:

    -
      -
    1. Go to [this link] (this link) to go to the download page of Bounce and Collect APK on APKCombo, a trusted website that provides safe and original APK files for Android apps and games.
    2. -
    3. Tap on the green Download APK button to start downloading the APK file of Bounce and Collect APK on your device. You might see a warning message that says "This type of file can harm your device. Do you want to keep it anyway?" Tap on OK to proceed.
    4. -
    5. Once the download is complete, go to your device's file manager and locate the downloaded APK file. Tap on it to open it. You might see another warning message that says "For your security, your phone is not allowed to install unknown apps from this source." Tap on Settings to allow the installation.
    6. -
    7. After you enable the installation, go back to the APK file and tap on it again. You will see a screen that shows the app's permissions and features. Tap on Install to start installing Bounce and Collect APK on your device.
    8. -
    9. Wait for a few seconds until the installation is finished. You will see a message that says "App installed." Tap on Open to launch Bounce and Collect APK and enjoy the game.
    10. -
    -

    Congratulations, you have successfully downloaded and installed Bounce and Collect APK on your Android device. You can now play this fun and challenging game anytime and anywhere you want.

    -

    Conclusion

    -

    Bounce and Collect APK is a game that you should not miss if you are looking for a fun and challenging game for your Android device. It is a game that combines physical principles, math, logic, strategy, and creativity to create a unique and fun experience. It is also a game that is easy to use, well-designed, and relaxing to play.

    -

    In this article, we have told you everything you need to know about Bounce and Collect APK, including how to play it, what makes it different from other games, and how to download and install it on your Android device. We hope that this article has been helpful and informative for you, and that you have learned something new today.

    -

    If you are ready to try Bounce and Collect APK, then follow the steps above to download and install it on your device. You will not regret it, as you will have a lot of fun playing this game. You will also improve your skills, logic, and creativity along the way.

    -

    So what are you waiting for? Download Bounce and Collect APK now and start bouncing and collecting balls like popcorn. You will love it!

    -

    FAQs

    -

    Here are some frequently asked questions about Bounce and Collect APK that you might find useful:

    -
      -
    • Q: Is Bounce and Collect APK free to play?
    • -
    • A: Yes, Bounce and Collect APK is free to play. You don't have to pay anything to download or play the game. However, the game does have some optional in-app purchases that can enhance your gameplay experience, such as removing ads or buying more coins.
    • -
    • Q: Is Bounce and Collect APK safe to download?
    • -
    • A: Yes, Bounce and Collect APK is safe to download. As long as you download it from a reliable source like APKCombo, you don't have to worry about any viruses or malware infecting your device. The game also does not require any special permissions or access to your personal data.
    • -
    • Q: How can I update Bounce and Collect APK?
    • -
    • A: You can update Bounce and Collect APK by following the same steps as downloading and installing it. Just go to the download page of Bounce and Collect APK on APKCombo, tap on the green Download APK button, and follow the instructions on your screen. The latest version of the game will overwrite the previous one without affecting your progress or settings.
    • -
    • Q: How can I contact the developer of Bounce and Collect APK?
    • -
    • A: You can contact the developer of Bounce and Collect APK by sending an email to support@voodoo.io. You can also visit their website at https://www.voodoo.io/ or follow them on social media platforms like Facebook or Twitter. You can give them feedback, suggestions, bug reports, or any other inquiries related to the game.
    • -
    • Q: How can I share my feedback or review of Bounce and Collect APK?
    • -
    • A: You can share your feedback or review of Bounce and Collect APK by leaving a comment or rating on the Google Play Store or on the APKCombo website. You can also share your thoughts and opinions with other players on online forums or social media platforms. Your feedback or review will help the developer improve the game and make it more enjoyable for everyone.
    • -

    401be4b1e0
    -
    -
    \ No newline at end of file diff --git a/spaces/fatiXbelha/sd/Bus Simulator 2023 APK - Otobs Srcs Olmann Tadn kar.md b/spaces/fatiXbelha/sd/Bus Simulator 2023 APK - Otobs Srcs Olmann Tadn kar.md deleted file mode 100644 index 8731c0488e3f7dd409bf0a15716bc37decb2b3c2..0000000000000000000000000000000000000000 --- a/spaces/fatiXbelha/sd/Bus Simulator 2023 APK - Otobs Srcs Olmann Tadn kar.md +++ /dev/null @@ -1,142 +0,0 @@ - -

    Bus Simulator 2023 Hile Apk Indir: How to Download and Play the Best Bus Simulation Game of 2023

    -

    If you are a fan of bus simulation games, you might have heard of Bus Simulator 2023, the latest and most realistic bus simulation game for Android devices. This game lets you become a real bus driver and drive various buses through detailed city maps all over the world. You can also customize your bus as you wish and complete different routes and missions in career mode or freeride mode. You can also play online with your friends and compete with other players in multiplayer mode.

    -

    bus simulator 2023 hile apk indir


    Download Zip ->>> https://urllie.com/2uNDeU



    -

    But what if you want to enjoy the game without any limitations or restrictions? What if you want to have unlimited resources, unlocked buses, free upgrades, and more? Well, there is a way to do that. You can download Bus Simulator 2023 Hile Apk, a modified version of the game that gives you access to all the features and benefits that you can imagine. In this article, we will show you how to download and install Bus Simulator 2023 Hile Apk on your device, what are the benefits of using it, how to play the game, and some tips and tricks for becoming a better bus driver. We will also give you a brief review of the game and answer some frequently asked questions about it. So, let's get started!

    -

    What is Bus Simulator 2023?

    -

    Bus Simulator 2023 is a bus simulation game developed by Zuuks Games, a Turkish game studio that specializes in simulation games. The game was released in June 2023 for Android devices and has received positive reviews from critics and players alike. The game has over 10 million downloads on the Google Play Store and has a rating of 4.5 out of 5 stars.

    -

    Bus Simulator 2023 is a realistic and immersive bus simulation game that lets you experience what it is like to be a bus driver in different cities around the world. You can choose from various bus models, such as city buses, electric buses, school buses, and more, and customize them with different options, such as paint, accessories, body parts, etc. You can also drive your bus through detailed city maps, such as Rio de Janeiro, Munich, Los Angeles, and more, with realistic traffic, weather, and day/night cycle. You can complete various routes and missions in career mode, freeride mode, or online multiplayer mode with friends. You can also earn money and reputation by driving safely and efficiently, and use them to buy new buses or upgrade your existing ones.

    -

    Bus Simulator 2023 is a fun and addictive game that will keep you entertained for hours. You will enjoy the realistic graphics, the smooth gameplay, the realistic sound effects, the challenging missions, and the variety of options that the game offers. If you love bus simulation games, you will love Bus Simulator 2023.

    -

    bus simulator 2023 mod apk download
    -bus simulator 2023 android oyun club
    -bus simulator 2023 hileli apk son sürüm
    -bus simulator 2023 para hilesi apk
    -bus simulator 2023 ücretsiz indir
    -bus simulator 2023 full apk
    -bus simulator 2023 hack apk
    -bus simulator 2023 unlimited money apk
    -bus simulator 2023 apk indir cepde
    -bus simulator 2023 apk indir android
    -bus simulator 2023 apk indir mobilism
    -bus simulator 2023 apk indir apkpure
    -bus simulator 2023 apk indir uptodown
    -bus simulator 2023 apk indir rexdl
    -bus simulator 2023 apk indir revdl
    -bus simulator 2023 oyunu indir
    -bus simulator 2023 oyunu oyna
    -bus simulator 2023 oyunu nasıl indirilir
    -bus simulator 2023 oyunu nasıl oynanır
    -bus simulator 2023 oyunu hakkında bilgi
    -bus simulator 2023 oyunu inceleme
    -bus simulator 2023 oyunu video
    -bus simulator 2023 oyunu yorumlar
    -bus simulator 2023 oyunu sistem gereksinimleri
    -bus simulator 2023 oyunu güncelleme
    -bus simulator 2023 online oyna
    -bus simulator 2023 online indir
    -bus simulator 2023 online multiplayer
    -bus simulator 2023 online mod apk
    -bus simulator 2023 online hile
    -bus simulator 2023 online para kasma
    -bus simulator 2023 online arkadaş ekleme
    -bus simulator 2023 online nasıl girilir
    -bus simulator 2023 online nasıl kayıt olunur
    -bus simulator 2023 online nasıl oynanır
    -bus simulator 2023 yeni sürüm apk indir
    -bus simulator 2023 yeni sürüm hile apk indir
    -bus simulator 2023 yeni sürüm mod apk indir
    -bus simulator 2023 yeni sürüm para hilesi apk indir
    -bus simulator 2023 yeni sürüm ücretsiz indir
    -bus simulator 2023 yeni sürüm full apk indir
    -bus simulator 2023 yeni sürüm hack apk indir
    -bus simulator 2023 yeni sürüm unlimited money apk indir
    -bus simulator 2023 yeni sürüm güncelleme
    -bus simulator 2023 yeni sürüm ne zaman çıkacak

    -

    How to Download Bus Simulator 2023 Hile Apk?

    -

    If you want to download Bus Simulator 2023 Hile Apk, you need to follow some simple steps. But before that, you need to be aware of some risks that come with downloading apk files from unknown sources. Apk files are files that contain the installation package of an Android app. They are usually used to install apps that are not available on the Google Play Store or to install modified versions of apps that offer extra features or benefits. However, not all apk files are safe or reliable. Some apk files may contain viruses or malware that can harm your device or steal your personal information. Some apk files may also not work properly or cause problems with your device's performance or compatibility.

    -

    Therefore, you need to be careful when downloading apk files from unknown sources. You need to make sure that the website that offers the apk file is trustworthy and reputable. You need to check the reviews and ratings of the website and the apk file before downloading it. You need to avoid websites that have pop-up ads, redirects, or suspicious links. You need to scan the apk file with an antivirus software before installing it on your device.

    -

    Here are some tips on how to find a reliable source for Bus Simulator 2023 Hile Apk:

    -
      -
    • Search for Bus Simulator 2023 Hile Apk on Google or any other search engine.
    • -
    • Look for websites that have a domain name related to the game or the apk file.
    • -
    • Look for websites that have a high ranking on the search results page.
    • -
    • Look for websites that have a lot of positive feedback from users who have downloaded the apk file.
    • -
    • Look for websites that have a clear and detailed description of the apk file and its features.
    • -
    • Look for websites that have a secure connection (https) and a valid certificate.
    • -
    -

    Once you have found a reliable source for Bus Simulator 2023 Hile Apk, you can follow these steps to download and install it on your device:

    -

    Step 1: Find a reliable source for the apk file

    -

    As mentioned above, you need to find a trustworthy website that offers Bus Simulator 2023 Hile Apk. For example , you can use this website: Bus Simulator 2023 Hile Apk Download. This website has a high ranking on Google, a lot of positive feedback from users, a clear and detailed description of the apk file and its features, a secure connection and a valid certificate. You can trust this website to download Bus Simulator 2023 Hile Apk.

    -

    Step 2: Enable unknown sources on your device

    -

    Before you can install Bus Simulator 2023 Hile Apk on your device, you need to enable unknown sources on your device settings. This will allow you to install apk files from outside the Google Play Store. To enable unknown sources on your device, follow these steps:

    -
      -
    • Go to your device settings and tap on Security or Privacy.
    • -
    • Find the option that says Unknown Sources or Install Unknown Apps and toggle it on.
    • -
    • A warning message will pop up. Read it carefully and tap on OK or Allow.
    • -
    -

    Now you have enabled unknown sources on your device and you can install Bus Simulator 2023 Hile Apk.

    -

    Step 3: Download and install Bus Simulator 2023 Hile Apk

    -

    Now that you have found a reliable source for the apk file and enabled unknown sources on your device, you can download and install Bus Simulator 2023 Hile Apk. To do that, follow these steps:

    -
      -
    • Go to the website that offers Bus Simulator 2023 Hile Apk and tap on the download button or link.
    • -
    • A download prompt will appear. Tap on Download or OK to start the download process.
    • -
    • Wait for the download to finish. You can check the progress in your notification bar or your download manager.
    • -
    • Once the download is complete, tap on the apk file to open it.
    • -
    • A installation prompt will appear. Tap on Install or Next to start the installation process.
    • -
    • Wait for the installation to finish. You can check the progress in your notification bar or your installation manager.
    • -
    • Once the installation is complete, tap on Open or Done to launch the game or exit the installation process.
    • -
    -

    Congratulations! You have successfully downloaded and installed Bus Simulator 2023 Hile Apk on your device. You can now enjoy the game with all its features and benefits.

    -

    What are the Benefits of Bus Simulator 2023 Hile Apk?

    -

    Bus Simulator 2023 Hile Apk is a modified version of Bus Simulator 2023 that gives you access to all the features and benefits that you can imagine. Here are some of the benefits of using Bus Simulator 2023 Hile Apk:

    -
      -
    • You can have unlimited resources, such as money, coins, gems, etc., that you can use to buy new buses or upgrade your existing ones.
    • -
    • You can have unlocked buses, such as electric buses, school buses, etc., that you can drive without having to complete certain missions or levels.
    • -
    • You can have free upgrades, such as engine, transmission, brakes, etc., that you can apply to your buses without having to pay any cost.
    • -
    • You can have unlimited fuel, which means you don't have to worry about running out of gas or refilling your tank.
    • -
    • You can have unlimited time, which means you don't have to worry about completing your routes or missions within a certain time limit.
    • -
    • You can have no ads, which means you don't have to watch any annoying ads or videos that interrupt your gameplay or waste your time.
    • -
    -

    These are just some of the benefits of using Bus Simulator 2023 Hile Apk. There are many more benefits that you can discover by yourself when you play the game. Bus Simulator 2023 Hile Apk will make your gaming experience more fun and enjoyable.

    -

    How to Play Bus Simulator 2023?

    -

    Bus Simulator 2023 is a easy and simple game to play. You just need to follow some basic steps and instructions. Here is how to play Bus Simulator 2023:

    -

    Choose your bus model and customize it

    -

    The first thing you need to do is to choose your bus model and customize it as you wish. You can choose from different bus models, such as city buses, electric buses, school buses, etc. Each bus model has its own characteristics, such as speed, capacity, fuel consumption, etc. You can also customize your bus with different options, such as paint, accessories, body parts, etc. You can change the color of your bus, add stickers or decals, change the wheels or tires, add mirrors or lights, etc. You can make your bus look unique and stylish.

    -

    Drive your bus through realistic city maps

    -

    The next thing you need to do is to drive your bus through realistic city maps. You can choose from different city maps, such as Rio de Janeiro, Munich, Los Angeles, etc. Each city map has its own features, such as landmarks, buildings, roads, traffic, weather, etc. You can also choose the time of the day, such as morning, afternoon, evening, or night. You can drive your bus through the city and enjoy the scenery and the atmosphere.

    -

    You need to follow the traffic rules and regulations when you drive your bus. You need to obey the traffic lights, signs, signals, speed limits, etc. You need to avoid accidents and collisions with other vehicles or pedestrians. You need to park your bus properly and safely at the designated spots. You need to be careful and attentive when you drive your bus.

    -

    Complete various routes and missions

    -

    The last thing you need to do is to complete various routes and missions. You can choose from different modes of play, such as career mode, freeride mode, or online multiplayer mode. In career mode, you need to complete different routes and missions that are assigned to you by your boss. You need to pick up and drop off passengers at the right stops, collect fares, maintain your bus condition, etc. You can also earn money and reputation by doing a good job. You can use the money to buy new buses or upgrade your existing ones. You can use the reputation to unlock new routes or missions.

    -

    In freeride mode, you can drive your bus freely without any restrictions or objectives. You can explore the city at your own pace and enjoy the game without any pressure or stress. You can also customize your bus as you wish and try different options and features.

    -

    In online multiplayer mode, you can play with your friends or other players from around the world. You can join or create a room and invite other players to join you. You can chat with other players and communicate with them. You can also compete with other players in different challenges or events.

    -

    Tips and Tricks for Bus Simulator 2023

    -

    Bus Simulator 2023 is a fun and addictive game that will keep you entertained for hours. However, it can also be challenging and difficult at times. Here are some tips and tricks that will help you play Bus Simulator 2023 better:

    -
      -
    • Follow the traffic rules and regulations. This will help you avoid accidents and penalties that will cost you money and reputation.
    • -
    • Drive defensively. This will help you avoid collisions with other vehicles or pedestrians that will damage your bus and affect your performance.
    • -
    • Make the right investments. This will help you buy new buses or upgrade your existing ones that will improve your speed, capacity, fuel efficiency, etc.
    • -
    • Take breaks on the trip. This will help you relax and recharge your energy and mood.
    • -
    • Claim gifts as often as possible. This will help you get free resources, such as money, coins, gems, etc., that you can use to buy or upgrade your buses.
    • -
    -

    Review of Bus Simulator 2023

    -

    Bus Simulator 2023 is a great game that will appeal to anyone who loves bus simulation games. The game has realistic graphics, smooth gameplay, realistic sound effects , replay value, and variety of options. The game is easy and simple to play, but also challenging and difficult at times. The game will keep you entertained for hours as you drive your bus through different city maps, complete various routes and missions, customize your bus as you wish, and play online with your friends or other players. The game is suitable for all ages and preferences.

    -

    Bus Simulator 2023 is a game that deserves a high rating and a recommendation. If you are looking for a realistic and immersive bus simulation game that will give you a lot of fun and enjoyment, you should download and play Bus Simulator 2023. You will not regret it.

    -

    Conclusion

    -

    In conclusion, Bus Simulator 2023 is a fantastic bus simulation game that will make you feel like a real bus driver. You can download Bus Simulator 2023 Hile Apk, a modified version of the game that gives you access to all the features and benefits that you can imagine. You can have unlimited resources, unlocked buses, free upgrades, and more. You can also play the game with realistic graphics, smooth gameplay, realistic sound effects, replay value, and variety of options. You can also play the game with your friends or other players in online multiplayer mode.

    -

    Bus Simulator 2023 is a game that you should not miss. It is one of the best bus simulation games of 2023. It is a game that will give you a lot of fun and enjoyment. It is a game that will make you love bus simulation games even more.

    -

    FAQs

    -

    Here are some frequently asked questions about Bus Simulator 2023:

    -
      -
    • Q: How much does Bus Simulator 2023 cost?
    • -
    • A: Bus Simulator 2023 is a free-to-play game that you can download from the Google Play Store or from other sources. However, the game may contain in-app purchases or ads that may require real money.
    • -
    • Q: Is Bus Simulator 2023 compatible with my device?
    • -
    • A: Bus Simulator 2023 is compatible with most Android devices that have Android 5.0 or higher and at least 2 GB of RAM. However, some devices may experience performance issues or compatibility problems depending on their specifications or settings.
    • -
    • Q: Is Bus Simulator 2023 safe to download and install?
    • -
    • A: Bus Simulator 2023 is safe to download and install from the Google Play Store or from other reliable sources. However, you need to be careful when downloading apk files from unknown sources as they may contain viruses or malware that can harm your device or steal your personal information.
    • -
    • Q: How can I contact the developers of Bus Simulator 2023?
    • -
    • A: You can contact the developers of Bus Simulator 2023 by sending an email to support@zuuks.com or by visiting their website https://www.zuuks.com/. You can also follow them on their social media accounts such as Facebook, Twitter, Instagram, YouTube, etc.
    • -
    • Q: How can I update Bus Simulator 2023?
    • -
    • A: You can update Bus Simulator 2023 by downloading the latest version of the game from the Google Play Store or from other sources. You can also enable automatic updates on your device settings so that you don't miss any new features or improvements.
    • -

    401be4b1e0
    -
    -
    \ No newline at end of file diff --git a/spaces/fatiXbelha/sd/Download Project Playtime APK and Survive the Toy Factory Horror.md b/spaces/fatiXbelha/sd/Download Project Playtime APK and Survive the Toy Factory Horror.md deleted file mode 100644 index 80f929db97d9fb536ccf3693c1d71d7b2a27528a..0000000000000000000000000000000000000000 --- a/spaces/fatiXbelha/sd/Download Project Playtime APK and Survive the Toy Factory Horror.md +++ /dev/null @@ -1,166 +0,0 @@ -
    -

    Project Playtime Official APK: A Survival Horror Game with a Twist

    -

    Do you love horror games that challenge your wits and nerves? Do you enjoy solving puzzles while avoiding deadly traps and monsters? Do you want to experience a unique and immersive story that will keep you on the edge of your seat? If you answered yes to any of these questions, then you should try Project Playtime Official APK, a free-to-play puzzle game from Visible Actions. In this article, we will tell you everything you need to know about this game, including what it is, how to download and install it, and how to play it.

    -

    project playtime official apk


    Download File ❤❤❤ https://urllie.com/2uNvQb



    -

    What is Project Playtime?

    -

    Project Playtime is a survival horror game that lets you explore an abandoned toy factory filled with different types of monsters. You play as a character who wears a GrabPack, a device that allows you to grab and interact with objects in the environment. You have to use your GrabPack to solve puzzles, find clues, and escape from the factory alive.

    -

    The story behind the game

    -

    The game is inspired by the popular YouTube series Poppy Playtime, created by Moonbear. In the series, Poppy is a former employee of Playtime Co., a toy company that mysteriously shut down after a series of accidents. Poppy decides to investigate the factory and find out what happened to her co-workers and the toys they made. Along the way, she encounters Huggy Wuggy, a giant blue monster that was once a friendly mascot of the company.

    -

    The gameplay and features

    -

    The game is divided into chapters, each with its own setting, puzzles, and enemies. The game features realistic graphics, sound effects, and voice acting that create a creepy atmosphere. The game also has multiple endings and achievements that depend on your choices and actions. The game is compatible with Android devices running Android 4.4 or higher.

    -

    The characters and enemies

    -

    The main character of the game is unnamed, but you can customize their appearance and gender. The main enemy of the game is Huggy Wuggy, a huge blue creature that can chase you down and kill you instantly. There are also other enemies in the game, such as Kissy Missy, a pink monster that can disguise herself as a human; Boogie Bot, a robot that can shoot lasers; and Ticky Tocky, a clockwork toy that can explode.

    -

    How to download and install Project Playtime Official APK?

    -

    If you want to play Project Playtime Official APK on your Android device, you need to download and install it manually from a third-party source. Here are the steps you need to follow:

    -

    project playtime free download apk
    -project playtime horror game apk
    -project playtime steam apk
    -project playtime multiplayer apk
    -project playtime early access apk
    -project playtime android apk
    -project playtime mob entertainment apk
    -project playtime latest version apk
    -project playtime toy factory apk
    -project playtime survival horror apk
    -project playtime online apk
    -project playtime pc apk
    -project playtime mod apk
    -project playtime full game apk
    -project playtime story mode apk
    -project playtime beta apk
    -project playtime cracked apk
    -project playtime gameplay apk
    -project playtime review apk
    -project playtime trailer apk
    -project playtime update apk
    -project playtime cheats apk
    -project playtime tips apk
    -project playtime guide apk
    -project playtime wiki apk
    -project playtime walkthrough apk
    -project playtime secrets apk
    -project playtime easter eggs apk
    -project playtime achievements apk
    -project playtime perks and sabotages apk
    -project playtime monsters and toys apk
    -project playtime maps and levels apk
    -project playtime characters and skins apk
    -project playtime voice chat and communication apk
    -project playtime discord and community apk
    -project playtime feedback and bug report apk
    -project playtime developer and publisher apk
    -project playtime release date and news apk
    -project playtime system requirements and compatibility apk
    -project playtime faq and support apk

    -

    The requirements and permissions

    -

    Before you download the game, make sure that your device meets the following requirements:

    -
      -
    • Android 4.4 or higher
    • -
    • At least 1 GB of RAM
    • -
    • At least 500 MB of free storage space
    • -
    • A stable internet connection
    • -
    -

    You also need to enable the installation of apps from unknown sources on your device. To do this, go to Settings > Security > Unknown Sources and toggle it on.

    -

    The steps to follow

    -

    Once you have prepared your device, follow these steps:

    -
      -Project Playtime Official APK Download] and tap on the download button. This will start downloading the APK file to your device. -
    1. Once the download is complete, locate the APK file in your device's file manager and tap on it. This will launch the installation process.
    2. -
    3. Follow the instructions on the screen and grant the necessary permissions to the app. This may include access to your device's storage, camera, microphone, and location.
    4. -
    5. Wait for the installation to finish and then tap on the open button. This will launch the game and you can start playing.
    6. -
    -

    The benefits and risks

    -

    Downloading and installing Project Playtime Official APK has some benefits and risks that you should be aware of. Here are some of them:

    - - - - - - - - - - - - - - - - - -
    BenefitsRisks
    You can play the game for free without any ads or in-app purchases.You may encounter some bugs or glitches that affect the game's performance or functionality.
    You can access the latest version of the game with all the updates and features.You may expose your device to malware or viruses that can harm your data or privacy.
    You can play the game offline without any internet connection.You may violate the game's terms of service or copyright laws by downloading it from an unofficial source.
    -

    Therefore, you should download and install Project Playtime Official APK at your own risk and discretion. We are not responsible for any damages or losses that may occur as a result of using this app.

    -

    How to play Project Playtime Official APK?

    -

    Now that you have downloaded and installed Project Playtime Official APK, you are ready to play it. Here are some tips and tricks that will help you enjoy the game more:

    -

    The controls and tips

    -

    The game uses a simple touch-based control system that lets you move, look around, grab, and interact with objects. You can also use buttons on the screen to pause, resume, or quit the game. Here are some tips for using the controls:

    -
      -
    • To move, use the virtual joystick on the left side of the screen. You can also swipe on the screen to change your direction.
    • -
    • To look around, use the virtual joystick on the right side of the screen. You can also pinch on the screen to zoom in or out.
    • -
    • To grab an object, tap on it with your finger. You can also drag it around or throw it by swiping on the screen.
    • -
    • To interact with an object, tap on it with your finger. You can also double-tap on it to activate or deactivate it.
    • -
    • To use your GrabPack, tap on the button on the bottom right corner of the screen. You can also switch between different modes by tapping on the icons above it.
    • -
    -

    The puzzles and secrets

    -

    The game is full of puzzles and secrets that you need to solve and discover in order to progress and unlock new areas. Here are some hints for finding and solving them:

    -
      -
    • Pay attention to your surroundings and look for clues that indicate what you need to do or where you need to go.
    • -
    • Use your GrabPack to manipulate objects and create paths or bridges that help you reach inaccessible places.
    • -
    • Listen to the audio tapes and read the notes that you find along the way. They provide useful information and backstory about the game's plot and characters.
    • -
    • Explore every corner of the factory and look for hidden rooms or passages that contain extra items or Easter eggs.
    • -
    • Try different combinations of actions and objects until you find a solution that works. Don't be afraid to experiment and have fun.
    • -
    -

    The endings and achievements

    -

    The game has multiple endings and achievements that depend on your choices and actions throughout the game. Here are some tips for getting them:

    -
      -
    • The endings are determined by whether you escape from the factory or not, and whether you save or kill certain characters along the way.
    • -
    • The achievements are awarded for completing certain tasks or challenges in the game, such as finding all the audio tapes, solving all the puzzles, or surviving all the enemies.
    • -
    • To see your endings and achievements, go to the main menu and tap on the icons on the top right corner of the screen.
    • -bottom left corner of the screen. -
    -

    Conclusion

    -

    Project Playtime Official APK is a survival horror game that offers a thrilling and immersive experience for fans of the genre. The game features a captivating story, challenging puzzles, and terrifying enemies that will keep you hooked until the end. The game is also free to play and easy to download and install on your Android device. However, you should be careful of the potential risks and consequences of using an unofficial app from a third-party source.

    -

    Summary of the main points

    -

    In summary, here are the main points of this article:

    -
      -
    • Project Playtime is a survival horror game inspired by the YouTube series Poppy Playtime.
    • -
    • The game lets you explore an abandoned toy factory with a GrabPack, a device that allows you to grab and interact with objects.
    • -
    • The game has multiple chapters, endings, and achievements that depend on your choices and actions.
    • -
    • The game can be downloaded and installed manually from a third-party source, but this comes with some benefits and risks.
    • -
    -

    Call to action and recommendation

    -

    If you are interested in playing Project Playtime Official APK, you can download it from the link below. However, we recommend that you also check out the official website of the game and support the developers by purchasing the game from a legitimate source. You can also watch the YouTube series Poppy Playtime to learn more about the game's story and characters. We hope you enjoy playing Project Playtime Official APK and have a fun and scary time.

    -

    Download Project Playtime Official APK here

    -

    Visit the official website of Project Playtime here

    -

    Watch Poppy Playtime on YouTube here

    -

    FAQs

    -

    Here are some frequently asked questions about Project Playtime Official APK:

    -
      -
    1. Is Project Playtime Official APK safe to use?
    2. -

      Project Playtime Official APK is not an official app from the developers of the game. It is a modified version of the game that is distributed by a third-party source. Therefore, it may not be safe to use and may contain malware or viruses that can harm your device or data. You should download and install Project Playtime Official APK at your own risk and discretion.

      -
    3. How do I update Project Playtime Official APK?
    4. -

      Project Playtime Official APK does not have an automatic update feature. If you want to update the game to the latest version, you need to download and install it again from the same source or a different one. However, this may overwrite your previous data and progress in the game. You should also check if the new version is compatible with your device and has no bugs or glitches.

      -
    5. How do I uninstall Project Playtime Official APK?
    6. -

      If you want to uninstall Project Playtime Official APK from your device, you can follow these steps:

      -
        -
      • Go to Settings > Apps > Project Playtime Official APK and tap on it.
      • -
      • Tap on the uninstall button and confirm your action.
      • -
      • Wait for the app to be removed from your device.
      • -
      -
    7. What are some alternatives to Project Playtime Official APK?
    8. -

      If you are looking for some alternatives to Project Playtime Official APK, you can try these games:

      -
        -
      • Five Nights at Freddy's: A horror game that involves surviving in a haunted pizzeria with animatronic characters.
      • -
      • Hello Neighbor: A stealth game that involves sneaking into your neighbor's house and discovering his secrets.
      • -
      • Little Nightmares: A puzzle-platformer game that involves escaping from a dark and twisted world with grotesque creatures.
      • -
      -
    9. Where can I find more information about Project Playtime Official APK?
    10. -

      If you want to find more information about Project Playtime Official APK, you can visit these sources:

      -
        -
      • Project Playtime Official APK Review: A detailed review of the game's features, gameplay, graphics, and sound.
      • -
      • Project Playtime Official APK Guide: A comprehensive guide on how to play the game, solve puzzles, and get endings and achievements.
      • -forum where you can discuss the game with other players, share tips and tricks, and report issues or feedback. -
      -

    401be4b1e0
    -
    -
    \ No newline at end of file diff --git a/spaces/fatiXbelha/sd/Download and Play GTA 5 on XBOX 360 RGH The ISO File You Need.md b/spaces/fatiXbelha/sd/Download and Play GTA 5 on XBOX 360 RGH The ISO File You Need.md deleted file mode 100644 index 7e6bdeb79fbc688ce6b759320c8f0c7c4714be17..0000000000000000000000000000000000000000 --- a/spaces/fatiXbelha/sd/Download and Play GTA 5 on XBOX 360 RGH The ISO File You Need.md +++ /dev/null @@ -1,90 +0,0 @@ -
    -

    How to Download GTA 5 Xbox 360 RGH ISO

    -

    If you are a fan of open-world action-adventure games, you probably have heard of Grand Theft Auto V (GTA 5), one of the best-selling and most critically acclaimed games of all time. GTA 5 is set in the fictional city of Los Santos, where you can explore, rob, shoot, drive, and do whatever you want as one of the three main characters: Michael, Franklin, or Trevor.

    -

    But what if you want to play GTA 5 on your Xbox 360 console, which is no longer supported by Rockstar Games? Or what if you want to enhance your gaming experience with faster loading, better performance, more customization, and modding options? Well, there is a way to do that, and it involves downloading GTA 5 Xbox 360 RGH ISO.

    -

    download gta 5 xbox 360 rgh iso


    DOWNLOAD ★★★ https://urllie.com/2uNzgd



    -

    In this article, we will explain what RGH and ISO are, how they are related to GTA 5, how to download and install them on your Xbox 360 console, and what benefits you can get from playing GTA 5 Xbox 360 RGH ISO. Let's get started!

    -

    What is RGH and ISO and how they are related to GTA 5

    -

    RGH stands for Reset Glitch Hack, which is a method of modifying your Xbox 360 console to run unsigned code. This means that you can run homebrew applications, emulators, games, and other software that are not authorized by Microsoft. RGH also allows you to access the NAND (flash memory) of your console, where you can backup or restore your system files.

    -

    ISO stands for International Organization for Standardization, which is a format of storing data on optical discs. An ISO file is an image of a disc that contains all the files and folders that are on the original disc. You can burn an ISO file to a disc or mount it on a virtual drive to access its contents.

    -

    GTA 5 Xbox 360 RGH ISO is an ISO file that contains the game data of GTA 5 for Xbox 360. You can download this file from various sources on the internet, such as torrent sites or file-sharing platforms. However, you need to have an RGH-modified Xbox 360 console to be able to play this file. Otherwise, your console will not recognize or run the game.

    -

    How to download GTA 5 Xbox 360 RGH ISO

    -

    Before you proceed with downloading GTA 5 Xbox 360 RGH ISO, there are some requirements and precautions that you need to consider:

    -
      -
    • You need to have an RGH-modified Xbox 360 console. If you don't have one, you can either buy one online or mod your own console using a tutorial like this one. Be aware that modding your console will void your warranty and may damage your console if done incorrectly.
    • -
    • You need to have a hard drive or a USB flash drive with enough space to store the GTA 5 Xbox 360 RGH ISO file. The file size is about 16 GB, so make sure you have enough free space on your storage device.
    • -
    • You need to have a software that can extract or mount ISO files. You can use programs like WinRAR or Daemon Tools for this purpose.
    • -
    • You need to have a reliable internet connection and a torrent client like uTorrent or BitTorrent to download the GTA 5 Xbox 360 RGH ISO file. Be careful when choosing the source of the file, as some files may contain viruses or malware that can harm your computer or console.
    • -
    • You need to have a DVD burner or a USB transfer cable to transfer the GTA 5 Xbox 360 RGH ISO file from your computer to your console. You can use programs like ImgBurn or XBOX Image Browser for this purpose. -
    • On your computer, open your torrent client and search for GTA 5 Xbox 360 RGH ISO. Choose a file that has a high number of seeders and leechers, as this indicates that the file is popular and reliable. Download the file to your computer.
    • -
    • On your computer, open your software that can extract or mount ISO files. Locate the GTA 5 Xbox 360 RGH ISO file that you have downloaded and extract or mount it. You should see a folder that contains several files, such as .xex, .dvd, .iso, etc.
    • -
    • On your computer, open your DVD burner or USB transfer cable software. Choose the option to burn or transfer the GTA 5 Xbox 360 RGH ISO file to your hard drive or USB flash drive. Make sure you select the correct destination and format for your storage device.
    • -
    • On your console, turn it on and connect your hard drive or USB flash drive. Navigate to the file manager and locate the GTA 5 Xbox 360 RGH ISO file on your storage device. Select the file and press A to launch it.
    • -
    • Enjoy playing GTA 5 on your Xbox 360 console!
    • -
-

Benefits of playing GTA 5 Xbox 360 RGH ISO

-

By playing GTA 5 Xbox 360 RGH ISO, you can enjoy several benefits that are not available on the official version of the game. Here are some of them:

- -

Conclusion

-

GTA 5 is one of the most amazing games ever made, and you can enjoy it even more by playing it on your Xbox 360 console using RGH and ISO. In this article, we have explained what RGH and ISO are, how they are related to GTA 5, how to download and install them on your console, and what benefits you can get from playing GTA 5 Xbox 360 RGH ISO.

-

How to download gta 5 xbox 360 rgh iso for free
-Download gta 5 xbox 360 rgh iso from Emerson Lino Games[^1^]
-GTA 5 xbox 360 rgh iso download link
-GTA 5 xbox 360 rgh iso torrent download
-GTA 5 xbox 360 rgh iso full game download
-GTA 5 xbox 360 rgh iso installation guide
-GTA 5 xbox 360 rgh iso gameplay video
-GTA 5 xbox 360 rgh iso cheats and mods
-GTA 5 xbox 360 rgh iso update and patch download
-GTA 5 xbox 360 rgh iso online multiplayer mode
-GTA 5 xbox 360 rgh iso best settings and tips
-GTA 5 xbox 360 rgh iso review and rating
-GTA 5 xbox 360 rgh iso comparison with other versions
-GTA 5 xbox 360 rgh iso system requirements and compatibility
-GTA 5 xbox 360 rgh iso error and fix solutions
-GTA 5 xbox 360 rgh iso download size and time
-GTA 5 xbox 360 rgh iso backup and restore options
-GTA 5 xbox 360 rgh iso region and language options
-GTA 5 xbox 360 rgh iso bonus and extra content download
-GTA 5 xbox 360 rgh iso support and contact information
-Download gta v xbox 360 jtag rgh iso
-Download gta v xbox 360 lt3.0 iso
-Download gta v xbox one x enhanced edition
-Download gta v pc version for free
-Download gta v ps4 pro enhanced edition
-Download gta v ps3 jailbreak iso
-Download gta v android apk + data
-Download gta v ios ipa + data
-Download gta v nintendo switch edition
-Download gta v vr edition for oculus rift and htc vive
-Download gta v mod menu for xbox 360 rgh iso
-Download gta v trainer for xbox 360 rgh iso
-Download gta v save editor for xbox 360 rgh iso
-Download gta v graphics enhancer for xbox 360 rgh iso
-Download gta v car pack for xbox 360 rgh iso
-Download gta v weapon pack for xbox 360 rgh iso
-Download gta v skin pack for xbox 360 rgh iso
-Download gta v map pack for xbox 360 rgh iso
-Download gta v sound pack for xbox 360 rgh iso
-Download gta v mission pack for xbox 360 rgh iso

-

If you are looking for a way to enhance your gaming experience with faster loading, better performance, more customization, and modding options, and access to online features and updates, then you should definitely try GTA 5 Xbox 360 RGH ISO. Just make sure you follow the requirements and precautions we have mentioned before downloading and installing the game.

-

We hope you have found this article helpful and informative. If you have any questions or comments, feel free to leave them below. And if you liked this article, please share it with your friends who might be interested in playing GTA 5 Xbox 360 RGH ISO. Thank you for reading!

-

FAQs

-

Here are some frequently asked questions about GTA 5 Xbox 360 RGH ISO:

-
    -
  1. Is it legal to download and play GTA 5 Xbox 360 RGH ISO?
    -The legality of downloading and playing GTA 5 Xbox 360 RGH ISO depends on your country's laws and regulations regarding piracy and intellectual property rights. Generally speaking, it is illegal to download and play games that you do not own or have permission from the developers or publishers. However, some countries may have exceptions or loopholes for personal use or backup purposes. We do not condone or encourage piracy in any way, and we advise you to consult a legal expert before downloading and playing GTA 5 Xbox 360 RGH ISO.
  2. -
  3. Will I get banned from Xbox Live if I play GTA 5 Xbox 360 RGH ISO?
    -There is always a risk of getting banned from Xbox Live if you play games that are not authorized by Microsoft or Rockstar Games. To avoid getting banned from Xbox Live, you should follow the rules and guidelines that Microsoft and Rockstar Games have set for their services. Some of the things that you should not do are : - Cheat by using mods or exploiting game glitches - Tamper with your account, gamerscore, achievements, or system files - Steal or impersonate someone else's account or identity - Harass, threaten, or bully other players or staff - Spread lies, rumors, or false information about someone or something - Post or share offensive, inappropriate, or illegal content, such as nudity, violence, or hate speech - Engage in phishing, solicitation, or extortion - Use a VPN or proxy to bypass regional restrictions or hide your IP address If you follow these rules and respect the Xbox Live community, you should be able to enjoy GTA 5 Xbox 360 RGH ISO without any problems. However, if you do get banned or suspended from Xbox Live, you can visit the Xbox Enforcement Actions page to find out the reason and request a review. You can also contact the Xbox Live Policy & Enforcement Team for more assistance.
  4. Can I play GTA 5 Xbox 360 RGH ISO with my friends online?
    -Yes, you can play GTA 5 Xbox 360 RGH ISO with your friends online, as long as they also have an RGH-modified Xbox 360 console and the same GTA 5 Xbox 360 RGH ISO file. You can join or host a private session or a public lobby and invite your friends to play with you. You can also use voice chat or text chat to communicate with your friends and other players. However, you should be careful not to join or invite players who are using the official version of GTA 5 or GTA Online, as this may cause compatibility issues or get you banned from Xbox Live.
  5. -
  6. How can I update GTA 5 Xbox 360 RGH ISO to the latest version?
    -To update GTA 5 Xbox 360 RGH ISO to the latest version, you need to download the latest update file from a reliable source on the internet, such as this one. You can then transfer the update file to your hard drive or USB flash drive using your DVD burner or USB transfer cable software. After that, you can launch the update file from your console and follow the instructions to install it. You should always backup your game data before updating, as some updates may overwrite or delete your existing files.
  7. -
  8. Where can I find more mods and cheats for GTA 5 Xbox 360 RGH ISO?
    -There are many websites and forums where you can find more mods and cheats for GTA 5 Xbox 360 RGH ISO, such as this one. You can browse through the categories and subcategories of mods and cheats, such as graphics, gameplay, vehicles, weapons, maps, missions, etc. You can also search for specific mods and cheats using keywords or filters. You can then download the mods and cheats that you like and install them on your console using your DVD burner or USB transfer cable software. You should always read the instructions and reviews of the mods and cheats before installing them, as some of them may not work properly or cause errors or crashes.
  9. -

197e85843d
-
-
\ No newline at end of file diff --git a/spaces/fatiXbelha/sd/Dumb Ways to Die 2 The Games - The Official Sequel to the Viral Hit.md b/spaces/fatiXbelha/sd/Dumb Ways to Die 2 The Games - The Official Sequel to the Viral Hit.md deleted file mode 100644 index 605dd2e3e248ebdc9f953261e27a192814ba61a6..0000000000000000000000000000000000000000 --- a/spaces/fatiXbelha/sd/Dumb Ways to Die 2 The Games - The Official Sequel to the Viral Hit.md +++ /dev/null @@ -1,133 +0,0 @@ - -

Dumb Ways to Die 2: The Games - Free Download

-

If you are looking for a game that will make you laugh, challenge your skills, and teach you a valuable lesson, then you should download Dumb Ways to Die 2: The Games today. This is the official sequel to the world-famous hit game Dumb Ways to Die, which started as a railway safety video and became a viral sensation. In this game, you will take part in various tricky challenges and try not to die in the most dumb ways possible. Sounds fun, right? Let's find out more about this game and how you can download it for free.

-

dumb ways to die 2 the games free download


Download Filehttps://urllie.com/2uNHKQ



-

What is Dumb Ways to Die 2: The Games?

-

Dumb Ways to Die 2: The Games is a casual game that features a cast of cute and clumsy characters who are always getting into trouble. Your job is to help them survive through quick thinking and fast reactions. The game has three main aspects:

-

A sequel to the viral hit game Dumb Ways to Die

-

The original Dumb Ways to Die game was released in 2013 by Metro Trains Melbourne, as part of a campaign to promote train safety. The game featured a catchy song and a series of mini-games that showed the dumb ways people can die around trains. The game was a huge success, with over 200 million downloads and millions of fans around the world. The sequel, Dumb Ways to Die 2: The Games, was released in 2014, with new levels, characters, and challenges.

-

A collection of hilarious mini-games that test your reflexes and wit

-

The game consists of several mini-games that are randomly selected for each round. Each mini-game has a different objective and requires you to tap, swipe, tilt, or shake your device. Some examples of the mini-games are:

- -

The mini-games are fast-paced and fun, but also very challenging. You have to act quickly and accurately, or else you will die in a dumb way. For example, if you fail to run away from the bull, you will get gored. If you fail to jump over the fence, you will get electrocuted. If you fail to balance on the dolphin, you will fall into the water and get eaten by a shark. And so on.

-

A way to spread the message of train safety in a fun and cheeky way

-

Despite being a comedy game, Dumb Ways to Die 2: The Games also has a serious purpose: to raise awareness about train safety. The game features several mini-games that involve trains, such as:

- -

The game also

The game also shows the consequences of being careless around trains, such as losing limbs, getting squashed, or exploding. The game does not shy away from showing blood and gore, but it does so in a cartoonish and humorous way. The game's motto is "Be safe around trains. A message from Metro."

-

dumb ways to die 2 the games apk download
-dumb ways to die 2 the games play online
-dumb ways to die 2 the games mod apk
-dumb ways to die 2 the games pc download
-dumb ways to die 2 the games cheats
-dumb ways to die 2 the games hack
-dumb ways to die 2 the games unblocked
-dumb ways to die 2 the games app store
-dumb ways to die 2 the games google play
-dumb ways to die 2 the games microsoft store
-dumb ways to die 2 the games for windows 10
-dumb ways to die 2 the games for android
-dumb ways to die 2 the games for ios
-dumb ways to die 2 the games for mac
-dumb ways to die 2 the games for linux
-dumb ways to die 2 the games review
-dumb ways to die 2 the games trailer
-dumb ways to die 2 the games gameplay
-dumb ways to die 2 the games walkthrough
-dumb ways to die 2 the games tips and tricks
-dumb ways to die 2 the games characters
-dumb ways to die 2 the games levels
-dumb ways to die 2 the games minigames
-dumb ways to die 2 the games maps
-dumb ways to die 2 the games themes
-dumb ways to die 2 the games soundtrack
-dumb ways to die 2 the games songs
-dumb ways to die 2 the games lyrics
-dumb ways to die 2 the games video
-dumb ways to die 2 the games animation
-dumb ways to die 2 the games memes
-dumb ways to die 2 the games fan art
-dumb ways to die 2 the games merchandise
-dumb ways to die 2 the games toys
-dumb ways to die 2 the games plushies
-dumb ways to die 2 the games stickers
-dumb ways to die 2 the games t-shirts
-dumb ways to die 2 the games hoodies
-dumb ways to die 2 the games mugs
-dumb ways to die 2 the games posters
-dumb ways to die 2 the games wallpapers
-dumb ways to die 2 the games screensavers
-dumb ways to die 2 the games coloring pages
-dumb ways to die 2 the games quizzes
-dumb ways to die 2 the games trivia
-dumb ways to die 2 the games facts
-dumb ways to die 2 the games history
-dumb ways to die 2 the games developer

-

How to play Dumb Ways to Die 2: The Games?

-

Playing Dumb Ways to Die 2: The Games is easy and fun. Here are the steps you need to follow:

-

Choose from different areas on the map, each with its own theme and challenges

-

The game has a map that shows different locations where you can play the mini-games. Each location has a different theme and a different set of mini-games. For example, you can go to:

- -

You can choose any location you want, or you can let the game choose one for you randomly.

-

Complete the mini-games as fast as possible without dying

-

Once you enter a location, you will be presented with a series of mini-games that you have to complete in a limited time. Each mini-game has a simple instruction that tells you what to do. For example, "Tap to jump", "Swipe to dodge", or "Tilt to balance". You have to follow the instruction and perform the action as fast as possible, or else you will die in a dumb way. The faster you complete the mini-game, the more points you get.

-

Earn coins, tickets, and stars for your performance

-

After each round of mini-games, you will be rewarded with coins, tickets, and stars based on how well you did. Coins are the main currency of the game, which you can use to buy new characters and outfits. Tickets are used to enter special events and challenges that offer extra rewards. Stars are used to unlock new locations and levels on the map.

-

Unlock new characters and achievements

-

The game has over 70 characters that you can collect and play with. Each character has its own name, personality, and appearance. Some of them are based on the original Dumb Ways to Die characters, such as Numpty, Hapless, and Stumble. Others are new additions that fit the theme of each location, such as Lax, Fiasco, and Mishap. You can unlock new characters by spending coins or by completing certain achievements. Achievements are goals that challenge you to do something specific in the game, such as "Die by electrocution 10 times" or "Survive 5 rounds in Dumbest of the Dumb". You can check your progress and claim your rewards in the achievements menu.

-

How to download Dumb Ways to Die 2: The Games for free?

-

Dumb Ways to Die 2: The Games is a free game that you can download and play on various devices and platforms. Here are some of the options you have:

-

Download from Google Play Store for Android devices

-

If you have an Android device, such as a smartphone or a tablet, you can download the game from the Google Play Store. Just search for "Dumb Ways to Die 2" or click on this link: [Dumb Ways to Die 2]. Then tap on "Install" and wait for the game to download and install on your device. You will need at least 150 MB of free space and Android 4.4 or higher to run the game.

-

Download from App Store for iOS devices

-

If you have an iOS device, such as an iPhone or an iPad, you can download the game from the App Store. Just search for "Dumb Ways to Die 2" or click on this link: [Dumb Ways to Die 2]. Then tap on "Get" and wait for the game to download and install on your device. You will need at least 300 MB of free space and iOS 10.0 or higher to run the game.

-

Download from Microsoft Store for Windows devices

-

If you have a Windows device, such as a PC or a laptop, you can download the game from the Microsoft Store

If you have a Windows device, such as a PC or a laptop, you can download the game from the Microsoft Store. Just search for "Dumb Ways to Die 2" or click on this link: [Dumb Ways to Die 2]. Then click on "Get" and wait for the game to download and install on your device. You will need at least 300 MB of free space and Windows 10 or higher to run the game.

-

Download from CrazyGames for web browsers

-

If you don't want to download the game, you can also play it online on your web browser. Just go to the website of CrazyGames, a platform that hosts thousands of free games. Then search for "Dumb Ways to Die 2" or click on this link: [Dumb Ways to Die 2]. Then click on "Play" and wait for the game to load on your browser. You will need a stable internet connection and Adobe Flash Player to run the game.

-

Conclusion

-

Dumb Ways to Die 2: The Games is a fun and addictive game that will make you laugh and test your skills. It is also a game that has a noble cause: to educate people about train safety and prevent accidents. The game is free to download and play on various devices and platforms, so you have no excuse not to try it out. Download Dumb Ways to Die 2: The Games today and see how many dumb ways you can die!

-

FAQs

-

Here are some of the frequently asked questions about Dumb Ways to Die 2: The Games:

-

197e85843d
-
-
\ No newline at end of file diff --git a/spaces/fb700/chatglm-fitness-RLHF/src/face3d/options/test_options.py b/spaces/fb700/chatglm-fitness-RLHF/src/face3d/options/test_options.py deleted file mode 100644 index 4ff3ad142779850d1d5a1640bc00f70d34d4a862..0000000000000000000000000000000000000000 --- a/spaces/fb700/chatglm-fitness-RLHF/src/face3d/options/test_options.py +++ /dev/null @@ -1,21 +0,0 @@ -"""This script contains the test options for Deep3DFaceRecon_pytorch -""" - -from .base_options import BaseOptions - - -class TestOptions(BaseOptions): - """This class includes test options. - - It also includes shared options defined in BaseOptions. - """ - - def initialize(self, parser): - parser = BaseOptions.initialize(self, parser) # define shared options - parser.add_argument('--phase', type=str, default='test', help='train, val, test, etc') - parser.add_argument('--dataset_mode', type=str, default=None, help='chooses how datasets are loaded. [None | flist]') - parser.add_argument('--img_folder', type=str, default='examples', help='folder for test images.') - - # Dropout and Batchnorm has different behavior during training and test. - self.isTrain = False - return parser diff --git a/spaces/feregVcuzo/sanity-test-midi/checkpoint/Brotato A Roguelike Game with 6 Weapons and Aliens - Download Now on Google Drive.md b/spaces/feregVcuzo/sanity-test-midi/checkpoint/Brotato A Roguelike Game with 6 Weapons and Aliens - Download Now on Google Drive.md deleted file mode 100644 index 7f44eaa1e7a996c95f4f1025a6d365d96a1dd46a..0000000000000000000000000000000000000000 --- a/spaces/feregVcuzo/sanity-test-midi/checkpoint/Brotato A Roguelike Game with 6 Weapons and Aliens - Download Now on Google Drive.md +++ /dev/null @@ -1,129 +0,0 @@ -
-

How to Download Brotato from Google Drive

-

If you are looking for a fun and addictive game that will challenge your skills and reflexes, you might want to try Brotato. Brotato is a top-down arena shooter roguelite where you play as a potato wielding up to six weapons at a time to fight off hordes of aliens. You can choose from a variety of traits and items to create unique builds and survive until help arrives. In this article, we will show you how to download Brotato from Google Drive, one of the platforms where you can get the game for free.

-

brotato download google drive


DOWNLOAD ===> https://gohhs.com/2uPnBe



-

What is Brotato?

-

A top-down arena shooter roguelite game

-

Brotato is a game developed by Blobfish, an indie game studio based in France. The game was released on June 23rd, 2023, after entering Early Access on September 27th, 2022. A demo was also published on May 2, 2022, and was part of the "Going Rogue: A Festival of Persistence" and "June Next Fest" Steam festivals.

-

The game is inspired by other popular roguelites such as Binding of Isaac, Enter the Gungeon, and Nuclear Throne. The game features pixel art graphics, catchy music, and fast-paced action. The game is available for Windows, Mac, Linux, iOS, and Android devices.

-

Features and gameplay

-

Brotato has many features that make it an enjoyable and replayable game. Some of them are:

- -

The gameplay is simple but challenging. You control a potato that can hold up to six weapons at a time. You can switch between them by pressing the corresponding number keys or tapping on the screen. You can also aim manually by holding down the right mouse button or dragging on the screen. You have to move around the arena and avoid getting hit by enemies or environmental hazards. You can also use items such as bombs, shields, or potions to help you out.

-

The game has five difficulty levels: Easy, Normal, Hard, Insane, and Nightmare. Each level increases the number and strength of enemies, as well as the number of waves you have to survive. The game also has a leaderboard system where you can compare your scores with other players.

-

brotato game download google drive
-brotato apk download google drive
-brotato mod apk download google drive
-brotato premium apk download google drive
-brotato offline download google drive
-brotato shooting game download google drive
-brotato roguelike game download google drive
-brotato action game download google drive
-brotato android game download google drive
-brotato pc game download google drive
-how to download brotato from google drive
-how to install brotato from google drive
-how to play brotato offline from google drive
-how to update brotato from google drive
-how to backup brotato data to google drive
-is it safe to download brotato from google drive
-is it legal to download brotato from google drive
-is it free to download brotato from google drive
-why can't I download brotato from google drive
-why is brotato not available on google play store
-best alternative to brotato on google play store
-best tips and tricks for playing brotato on android
-best weapons and items for brotato game
-best characters and classes for brotato game
-best strategies and guides for brotato game
-how to unlock all characters in brotato game
-how to get unlimited potatoes in brotato game
-how to get more coins and gems in brotato game
-how to level up faster in brotato game
-how to survive longer in brotato game
-what is the highest score in brotato game
-what is the hardest level in brotato game
-what is the best mode in brotato game
-what is the difference between brotato and brotato premium
-what is the difference between online and offline mode in brotato game
-who is the developer of brotato game
-who is the publisher of brotato game
-who are the voice actors of brotato game characters
-who are the top players of brotato game worldwide
-who are the best youtubers and streamers of brotato game

-

How to Download Brotato from Google Drive on Desktop

-

Go to the official website of Brotato

-

The first step is to go to the official website of Brotato at [13](https://thomasgervraud.com/press/brotato/).

On this website, you will find more information about the game, such as screenshots, videos, and press kits. You will also find the links to download the game from different platforms, including Google Drive.

-

Click on the Google Drive link

-

On the website, scroll down until you see the section that says "Download". Under this section, you will see several icons representing different platforms. Click on the one that says "Google Drive". This will open a new tab that will take you to the Google Drive folder where the game files are stored.

-

Sign in to your Google account and grant access

-

If you are not already signed in to your Google account, you will be prompted to do so. Enter your email and password and click on "Next". You will then see a message that says "Brotato wants to access your Google Account". This is necessary to allow you to download the game files from Google Drive. Click on "Allow" to grant access.

-

Download the game files and unzip them

-

Once you have granted access, you will see the Google Drive folder that contains the game files. There are three files: Brotato.zip, Brotato_Mac.zip, and Brotato_Linux.zip. Depending on your operating system, choose the appropriate file and click on it. You will then see a preview of the file and a button that says "Download". Click on this button and choose a location on your computer where you want to save the file.

-

After the download is complete, locate the file on your computer and unzip it. You can use any software that can extract zip files, such as WinRAR or 7-Zip. You will then see a folder that contains the game files.

-

Run the game executable file

-

To run the game, open the folder that contains the game files and look for the file that has the game icon and says "Brotato.exe". Double-click on this file and wait for the game to launch. You will then see the game menu where you can start playing, change settings, or exit.

-

How to Download Brotato from Google Drive on Mobile

-

Install the Google Drive app on your device

-

If you want to download Brotato from Google Drive on your mobile device, you will need to install the Google Drive app first. You can find this app on the App Store for iOS devices or on the Google Play Store for Android devices. Search for "Google Drive" and download and install the app on your device.

-

Open the app and sign in to your Google account

-

After installing the app, open it and sign in to your Google account. If you don't have a Google account, you can create one for free by following the instructions on the screen. You will then see your Google Drive folders and files.

-

Tap on the shared link of Brotato

-

To access the shared link of Brotato, you can either copy and paste it from another source or scan a QR code that will take you directly to it. The shared link is [12](https://drive.google.com/drive/folders/1ZyQX8w0i9lq6j0XlJfWQ5V9fT4sOx4gZ?usp=sharing) and the QR code is below:

- QR code for Brotato shared link -

Once you tap on the shared link or scan the QR code, you will see the same Google Drive folder that contains the game files as before.

-

Tap on the download icon and choose a location

-

To download Brotato from Google Drive on your mobile device, tap on the file that says "Brotato.apk". This is an Android application package file that contains all the necessary data to install and run Brotato on your device. You will then see a download icon at the top right corner of your screen. Tap on this icon and choose a location on your device where you want to save the file.

-

Install the game apk file and enjoy

-

After downloading Brotato.apk, locate it on your device and tap on it. You will then see a message that says "Do you want to install this application?". Tap on "Install" and wait for Brotato to be installed on your device. You may need to enable unknown sources in your settings if you haven't done so before.

-

Once Brotato is installed, you can open it from your app drawer or home screen. You will then see the game menu where you can start playing, change settings, or exit.

-

Conclusion

-

Brotato is a fun and addictive game that will keep you entertained for hours. You can download it from Google Drive for free on your desktop or mobile device. All you need is a Google account and some storage space. Follow the steps above and enjoy playing Brotato as a potato with guns.

-

FAQs

-

What are the system requirements for Brotato?

-

Brotato is a lightweight game that does not require high-end specifications. The minimum system requirements are:

- - - - - - - -
OSWindows 7 or later, Mac OS X 10.9 or later, Linux, Android 4.4 or later, iOS 9.0 or later
Processor1.5 GHz or faster
Memory1 GB RAM
GraphicsOpenGL 2.0 compatible
Storage100 MB available space
Sound CardAny
-

How can I support the developers of Brotato?

-

If you like Brotato and want to support the developers, you can do so by:

- -

How can I get more items and weapons in Brotato?

-

You can get more items and weapons in Brotato by:

- -

How can I play Brotato with my friends?

-

Brotato currently does not have a multiplayer mode, but the developers are working on it. They plan to add online co-op and versus modes in the future updates. In the meantime, you can play Brotato with your friends by using remote play software such as Parsec or Steam Remote Play Together.

-

How can I contact the developers of Brotato?

-

You can contact the developers of Brotato by:

-